@telepath-computer/television 1.5.9 → 1.6.0

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.
Files changed (130) hide show
  1. package/dist/THIRD-PARTY-NOTICES.txt +701 -0
  2. package/dist/cli.cjs +9035 -596
  3. package/dist/onboarding/tv-guide/welcome.html +14 -4
  4. package/dist/skills/television/SKILL.md +39 -33
  5. package/dist/skills/television/resources.md +4 -4
  6. package/dist/skills/television/templates.md +77 -0
  7. package/dist/skills/television/theming.md +31 -17
  8. package/dist/templates/calendar/README.md +17 -0
  9. package/dist/{skills/tv-tasks → templates/calendar}/THIRD-PARTY-NOTICES.txt +22 -22
  10. package/dist/templates/calendar/calendar-attendees.js +131 -0
  11. package/dist/templates/calendar/calendar-event.js +22 -0
  12. package/dist/templates/calendar/calendar-motion.js +273 -0
  13. package/dist/templates/calendar/calendar-page.js +403 -0
  14. package/dist/templates/calendar/calendar-time-axis.js +32 -0
  15. package/dist/templates/calendar/calendar-week.js +711 -0
  16. package/dist/templates/calendar/data.json +3 -0
  17. package/dist/templates/calendar/icon.svg +1 -0
  18. package/dist/templates/calendar/index.html +27 -0
  19. package/dist/templates/calendar/manifest.json +148 -0
  20. package/dist/templates/calendar/styles.css +771 -0
  21. package/dist/templates/checklist/README.md +45 -0
  22. package/dist/templates/checklist/THIRD-PARTY-NOTICES.txt +29 -0
  23. package/dist/templates/checklist/data.json +1 -0
  24. package/dist/templates/checklist/icon.svg +8 -0
  25. package/dist/templates/checklist/icons.css +61 -0
  26. package/dist/templates/checklist/index.html +47 -0
  27. package/dist/templates/checklist/manifest.json +49 -0
  28. package/dist/templates/checklist/model.d.ts +30 -0
  29. package/dist/templates/checklist/model.js +60 -0
  30. package/dist/templates/checklist/page.js +425 -0
  31. package/dist/templates/checklist/styles.css +206 -0
  32. package/dist/templates/document/README.md +55 -0
  33. package/dist/templates/document/THIRD-PARTY-NOTICES.txt +1080 -0
  34. package/dist/templates/document/data.json +3 -0
  35. package/dist/templates/document/editor.css +1 -0
  36. package/dist/templates/document/editor.js +37 -0
  37. package/dist/templates/document/icon.svg +6 -0
  38. package/dist/templates/document/index.html +29 -0
  39. package/dist/templates/document/manifest.json +22 -0
  40. package/dist/templates/document/page.js +190 -0
  41. package/dist/templates/document/styles.css +76 -0
  42. package/dist/templates/map/README.md +85 -0
  43. package/dist/templates/map/THIRD-PARTY-NOTICES.txt +84 -0
  44. package/dist/templates/map/data.json +1 -0
  45. package/dist/templates/map/icon.svg +8 -0
  46. package/dist/templates/map/icons.svg +43 -0
  47. package/dist/templates/map/index.html +95 -0
  48. package/dist/templates/map/manifest.json +227 -0
  49. package/dist/templates/map/map-model.js +18 -0
  50. package/dist/templates/map/map.css +202 -0
  51. package/dist/templates/map/map.js +728 -0
  52. package/dist/templates/map/vendor/LICENSE +26 -0
  53. package/dist/templates/map/vendor/README.md +11 -0
  54. package/dist/templates/map/vendor/leaflet.css +661 -0
  55. package/dist/templates/map/vendor/leaflet.js +6 -0
  56. package/dist/templates/map/vendor/lucide/LICENSE +43 -0
  57. package/dist/templates/map/vendor/lucide/README.md +46 -0
  58. package/dist/templates/map/vendor/lucide/icons.js +832 -0
  59. package/dist/templates/map/vendor/lucide/svg/airport.svg +15 -0
  60. package/dist/templates/map/vendor/lucide/svg/bar.svg +17 -0
  61. package/dist/templates/map/vendor/lucide/svg/beach.svg +17 -0
  62. package/dist/templates/map/vendor/lucide/svg/bridge.svg +20 -0
  63. package/dist/templates/map/vendor/lucide/svg/bus.svg +21 -0
  64. package/dist/templates/map/vendor/lucide/svg/church.svg +19 -0
  65. package/dist/templates/map/vendor/lucide/svg/coffee.svg +18 -0
  66. package/dist/templates/map/vendor/lucide/svg/ferry.svg +19 -0
  67. package/dist/templates/map/vendor/lucide/svg/flag.svg +15 -0
  68. package/dist/templates/map/vendor/lucide/svg/heart.svg +15 -0
  69. package/dist/templates/map/vendor/lucide/svg/home.svg +16 -0
  70. package/dist/templates/map/vendor/lucide/svg/hospital.svg +19 -0
  71. package/dist/templates/map/vendor/lucide/svg/hotel.svg +24 -0
  72. package/dist/templates/map/vendor/lucide/svg/info.svg +17 -0
  73. package/dist/templates/map/vendor/lucide/svg/landmark.svg +20 -0
  74. package/dist/templates/map/vendor/lucide/svg/mountain.svg +15 -0
  75. package/dist/templates/map/vendor/lucide/svg/museum.svg +20 -0
  76. package/dist/templates/map/vendor/lucide/svg/music.svg +17 -0
  77. package/dist/templates/map/vendor/lucide/svg/park.svg +18 -0
  78. package/dist/templates/map/vendor/lucide/svg/parking.svg +16 -0
  79. package/dist/templates/map/vendor/lucide/svg/pin.svg +16 -0
  80. package/dist/templates/map/vendor/lucide/svg/restaurant.svg +17 -0
  81. package/dist/templates/map/vendor/lucide/svg/school.svg +20 -0
  82. package/dist/templates/map/vendor/lucide/svg/shop.svg +17 -0
  83. package/dist/templates/map/vendor/lucide/svg/sports.svg +19 -0
  84. package/dist/templates/map/vendor/lucide/svg/star.svg +15 -0
  85. package/dist/templates/map/vendor/lucide/svg/theatre.svg +23 -0
  86. package/dist/templates/map/vendor/lucide/svg/train.svg +20 -0
  87. package/dist/templates/map/vendor/lucide/svg/viewpoint.svg +20 -0
  88. package/dist/templates/map/vendor/lucide/svg/work.svg +18 -0
  89. package/dist/templates/sticky-note/Caveat-Medium.woff2 +0 -0
  90. package/dist/templates/sticky-note/README.md +47 -0
  91. package/dist/templates/sticky-note/THIRD-PARTY-NOTICES.txt +127 -0
  92. package/dist/templates/sticky-note/data.json +1 -0
  93. package/dist/templates/sticky-note/icon.svg +16 -0
  94. package/dist/templates/sticky-note/icons.css +61 -0
  95. package/dist/templates/sticky-note/index.html +31 -0
  96. package/dist/templates/sticky-note/manifest.json +27 -0
  97. package/dist/templates/sticky-note/model.d.ts +33 -0
  98. package/dist/templates/sticky-note/model.js +152 -0
  99. package/dist/templates/sticky-note/page.js +84 -0
  100. package/dist/templates/sticky-note/styles.css +140 -0
  101. package/dist/templates/table/README.md +107 -0
  102. package/dist/templates/table/data.json +4 -0
  103. package/dist/templates/table/icon.svg +6 -0
  104. package/dist/templates/table/index.html +15 -0
  105. package/dist/templates/table/manifest.json +70 -0
  106. package/dist/templates/table/model.d.ts +164 -0
  107. package/dist/templates/table/model.js +395 -0
  108. package/dist/templates/table/page.js +1045 -0
  109. package/dist/templates/table/selection-model.d.ts +67 -0
  110. package/dist/templates/table/selection-model.js +163 -0
  111. package/dist/templates/table/styles.css +522 -0
  112. package/dist/views/markdown/THIRD-PARTY-NOTICES.txt +408 -0
  113. package/dist/views/markdown/index.html +21 -21
  114. package/dist/web/assets/main-CRSNodQt.js +864 -0
  115. package/dist/web/assets/main-DnvQkpg4.css +1 -0
  116. package/dist/web/index.html +2 -2
  117. package/package.json +1 -1
  118. package/dist/skills/tv-calendar/SKILL.md +0 -100
  119. package/dist/skills/tv-calendar/calendar.css +0 -1
  120. package/dist/skills/tv-calendar/calendar.js +0 -400
  121. package/dist/skills/tv-table/SKILL.md +0 -95
  122. package/dist/skills/tv-tasks/SKILL.md +0 -269
  123. package/dist/skills/tv-tasks/task.css +0 -180
  124. package/dist/skills/tv-tasks/task.js +0 -304
  125. package/dist/web/assets/calendar-DToAnkzj.png +0 -0
  126. package/dist/web/assets/main-CPopSWec.js +0 -848
  127. package/dist/web/assets/main-CunC2_Nx.css +0 -1
  128. package/dist/web/assets/markdown-DdDrJuVK.png +0 -0
  129. package/dist/web/assets/table-oeG9uAN1.png +0 -0
  130. package/dist/web/assets/tasks-D4xqXFPl.png +0 -0
@@ -1,848 +0,0 @@
1
- var E4=Object.defineProperty;var Uv=n=>{throw TypeError(n)};var k4=(n,t,e)=>t in n?E4(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var R=(n,t,e)=>k4(n,typeof t!="symbol"?t+"":t,e),cp=(n,t,e)=>t.has(n)||Uv("Cannot "+e);var o=(n,t,e)=>(cp(n,t,"read from private field"),e?e.call(n):t.get(n)),m=(n,t,e)=>t.has(n)?Uv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),d=(n,t,e,r)=>(cp(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e),h=(n,t,e)=>(cp(n,t,"access private method"),e);var Mh=(n,t,e,r)=>({set _(i){d(n,t,i,e)},get _(){return o(n,t,r)}});import{i as T4,a as C4,b as R4,c as I4,d as $4,e as x4,f as P4,g as D4,U as O4,A as L4,h as M4}from"./artifact-bridge-DTPacxDw.js";import{m as N4,a as z4,b as H4}from"./missing-artifact-page-DVzJ41AE.js";var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Z4(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var Fv={},qv={},up,Vv;function d8(){if(Vv)return up;Vv=1;var n=Object.prototype.toString;return up=function(e){var r=n.call(e),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&n.call(e.callee)==="[object Function]"),i},up}var hp,Bv;function U4(){if(Bv)return hp;Bv=1;var n;if(!Object.keys){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=d8(),i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(y){var v=y.constructor;return v&&v.prototype===y},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=(function(){if(typeof window>"u")return!1;for(var y in window)try{if(!u["$"+y]&&t.call(window,y)&&window[y]!==null&&typeof window[y]=="object")try{c(window[y])}catch{return!0}}catch{return!0}return!1})(),p=function(y){if(typeof window>"u"||!f)return c(y);try{return c(y)}catch{return!1}};n=function(v){var S=v!==null&&typeof v=="object",_=e.call(v)==="[object Function]",I=r(v),Z=S&&e.call(v)==="[object String]",O=[];if(!S&&!_&&!I)throw new TypeError("Object.keys called on a non-object");var z=a&&_;if(Z&&v.length>0&&!t.call(v,0))for(var P=0;P<v.length;++P)O.push(String(P));if(I&&v.length>0)for(var V=0;V<v.length;++V)O.push(String(V));else for(var F in v)!(z&&F==="prototype")&&t.call(v,F)&&O.push(String(F));if(s)for(var q=p(v),Q=0;Q<l.length;++Q)!(q&&l[Q]==="constructor")&&t.call(v,l[Q])&&O.push(l[Q]);return O}}return hp=n,hp}var dp,jv;function F4(){if(jv)return dp;jv=1;var n=Array.prototype.slice,t=d8(),e=Object.keys,r=e?function(a){return e(a)}:U4(),i=Object.keys;return r.shim=function(){if(Object.keys){var a=(function(){var l=Object.keys(arguments);return l&&l.length===arguments.length})(1,2);a||(Object.keys=function(c){return t(c)?i(n.call(c)):i(c)})}else Object.keys=r;return Object.keys||r},dp=r,dp}var fp,Wv;function Sh(){if(Wv)return fp;Wv=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return fp=n,fp}var pp,Gv;function ki(){return Gv||(Gv=1,pp=SyntaxError),pp}var mp,Jv;function pe(){return Jv||(Jv=1,mp=TypeError),mp}var gp,Yv;function q4(){return Yv||(Yv=1,gp=Object.getOwnPropertyDescriptor),gp}var vp,Kv;function Gl(){if(Kv)return vp;Kv=1;var n=q4();if(n)try{n([],"length")}catch{n=null}return vp=n,vp}var yp,Xv;function f8(){if(Xv)return yp;Xv=1;var n=Sh(),t=ki(),e=pe(),r=Gl();return yp=function(s,a,l){if(!s||typeof s!="object"&&typeof s!="function")throw new e("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new e("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new e("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new e("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new e("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new e("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,y=!!r&&r(s,a);if(n)n(s,a,{configurable:f===null&&y?y.configurable:!f,enumerable:c===null&&y?y.enumerable:!c,value:l,writable:u===null&&y?y.writable:!u});else if(p||!c&&!u&&!f)s[a]=l;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},yp}var wp,Qv;function Zf(){if(Qv)return wp;Qv=1;var n=Sh(),t=function(){return!!n};return t.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],"length",{value:1}).length!==1}catch{return!0}},wp=t,wp}var bp,ey;function oa(){if(ey)return bp;ey=1;var n=F4(),t=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",e=Object.prototype.toString,r=Array.prototype.concat,i=f8(),s=function(u){return typeof u=="function"&&e.call(u)==="[object Function]"},a=Zf()(),l=function(u,f,p,y){if(f in u){if(y===!0){if(u[f]===p)return}else if(!s(y)||!y())return}a?i(u,f,p,!0):i(u,f,p)},c=function(u,f){var p=arguments.length>2?arguments[2]:{},y=n(f);t&&(y=r.call(y,Object.getOwnPropertySymbols(f)));for(var v=0;v<y.length;v+=1)l(u,y[v],f[y[v]],p[y[v]])};return c.supportsDescriptors=!!a,bp=c,bp}var mc={exports:{}},ty;function p8(){return ty||(ty=1,typeof self<"u"?mc.exports=self:typeof window<"u"?mc.exports=window:mc.exports=Function("return this")()),mc.exports}var Sp,ny;function m8(){if(ny)return Sp;ny=1;var n=p8();return Sp=function(){return typeof Qs!="object"||!Qs||Qs.Math!==Math||Qs.Array!==Array?n:Qs},Sp}var _p,ry;function V4(){if(ry)return _p;ry=1;var n=oa(),t=Gl(),e=m8();return _p=function(){var i=e();if(n.supportsDescriptors){var s=t(i,"globalThis");(!s||s.configurable&&(s.enumerable||!s.writable||globalThis!==i))&&Object.defineProperty(i,"globalThis",{configurable:!0,enumerable:!1,value:i,writable:!0})}else(typeof globalThis!="object"||globalThis!==i)&&(i.globalThis=i);return i},_p}var Ap,iy;function L1(){if(iy)return Ap;iy=1;var n=oa(),t=p8(),e=m8(),r=V4(),i=e(),s=function(){return i};return n(s,{getPolyfill:e,implementation:t,shim:r}),Ap=s,Ap}var Ep,sy;function Ti(){return sy||(sy=1,Ep=function(t){return!!t&&(typeof t=="function"||typeof t=="object")}),Ep}var kp,oy;function M1(){return oy||(oy=1,kp=Object),kp}var Tp,ay;function g8(){return ay||(ay=1,Tp=Error),Tp}var Cp,ly;function B4(){return ly||(ly=1,Cp=EvalError),Cp}var Rp,cy;function j4(){return cy||(cy=1,Rp=RangeError),Rp}var Ip,uy;function N1(){return uy||(uy=1,Ip=ReferenceError),Ip}var $p,hy;function W4(){return hy||(hy=1,$p=URIError),$p}var xp,dy;function G4(){return dy||(dy=1,xp=Math.abs),xp}var Pp,fy;function J4(){return fy||(fy=1,Pp=Math.floor),Pp}var Dp,py;function Y4(){return py||(py=1,Dp=Math.max),Dp}var Op,my;function K4(){return my||(my=1,Op=Math.min),Op}var Lp,gy;function X4(){return gy||(gy=1,Lp=Math.pow),Lp}var Mp,vy;function Q4(){return vy||(vy=1,Mp=Math.round),Mp}var Np,yy;function z1(){return yy||(yy=1,Np=Number.isNaN||function(t){return t!==t}),Np}var zp,wy;function eE(){if(wy)return zp;wy=1;var n=z1();return zp=function(e){return n(e)||e===0?e:e<0?-1:1},zp}var Hp,by;function Jl(){return by||(by=1,Hp=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[e]=i;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(t,e);if(l.value!==i||l.enumerable!==!0)return!1}return!0}),Hp}var Zp,Sy;function H1(){if(Sy)return Zp;Sy=1;var n=typeof Symbol<"u"&&Symbol,t=Jl();return Zp=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},Zp}var Up,_y;function v8(){return _y||(_y=1,Up=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Up}var Fp,Ay;function y8(){if(Ay)return Fp;Ay=1;var n=M1();return Fp=n.getPrototypeOf||null,Fp}var qp,Ey;function tE(){if(Ey)return qp;Ey=1;var n="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,e=Math.max,r="[object Function]",i=function(c,u){for(var f=[],p=0;p<c.length;p+=1)f[p]=c[p];for(var y=0;y<u.length;y+=1)f[y+c.length]=u[y];return f},s=function(c,u){for(var f=[],p=u,y=0;p<c.length;p+=1,y+=1)f[y]=c[p];return f},a=function(l,c){for(var u="",f=0;f<l.length;f+=1)u+=l[f],f+1<l.length&&(u+=c);return u};return qp=function(c){var u=this;if(typeof u!="function"||t.apply(u)!==r)throw new TypeError(n+u);for(var f=s(arguments,1),p,y=function(){if(this instanceof p){var Z=u.apply(this,i(f,arguments));return Object(Z)===Z?Z:this}return u.apply(c,i(f,arguments))},v=e(0,u.length-f.length),S=[],_=0;_<v;_++)S[_]="$"+_;if(p=Function("binder","return function ("+a(S,",")+"){ return binder.apply(this,arguments); }")(y),u.prototype){var I=function(){};I.prototype=u.prototype,p.prototype=new I,I.prototype=null}return p},qp}var Vp,ky;function _h(){if(ky)return Vp;ky=1;var n=tE();return Vp=Function.prototype.bind||n,Vp}var Bp,Ty;function Z1(){return Ty||(Ty=1,Bp=Function.prototype.call),Bp}var jp,Cy;function U1(){return Cy||(Cy=1,jp=Function.prototype.apply),jp}var Wp,Ry;function nE(){return Ry||(Ry=1,Wp=typeof Reflect<"u"&&Reflect&&Reflect.apply),Wp}var Gp,Iy;function w8(){if(Iy)return Gp;Iy=1;var n=_h(),t=U1(),e=Z1(),r=nE();return Gp=r||n.call(e,t),Gp}var Jp,$y;function Uf(){if($y)return Jp;$y=1;var n=_h(),t=pe(),e=Z1(),r=w8();return Jp=function(s){if(s.length<1||typeof s[0]!="function")throw new t("a function is required");return r(n,e,s)},Jp}var Yp,xy;function rE(){if(xy)return Yp;xy=1;var n=Uf(),t=Gl(),e;try{e=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var r=!!e&&t&&t(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return Yp=r&&typeof r.get=="function"?n([r.get]):typeof s=="function"?function(l){return s(l==null?l:i(l))}:!1,Yp}var Kp,Py;function b8(){if(Py)return Kp;Py=1;var n=v8(),t=y8(),e=rE();return Kp=n?function(i){return n(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:e?function(i){return e(i)}:null,Kp}var Xp,Dy;function Ci(){if(Dy)return Xp;Dy=1;var n=Function.prototype.call,t=Object.prototype.hasOwnProperty,e=_h();return Xp=e.call(n,t),Xp}var Qp,Oy;function In(){if(Oy)return Qp;Oy=1;var n,t=M1(),e=g8(),r=B4(),i=j4(),s=N1(),a=ki(),l=pe(),c=W4(),u=G4(),f=J4(),p=Y4(),y=K4(),v=X4(),S=Q4(),_=eE(),I=Function,Z=function(St){try{return I('"use strict"; return ('+St+").constructor;")()}catch{}},O=Gl(),z=Sh(),P=function(){throw new l},V=O?(function(){try{return arguments.callee,P}catch{try{return O(arguments,"callee").get}catch{return P}}})():P,F=H1()(),q=b8(),Q=y8(),K=v8(),ue=U1(),ae=Z1(),_e={},ot=typeof Uint8Array>"u"||!q?n:q(Uint8Array),se={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":F&&q?q([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":_e,"%AsyncGenerator%":_e,"%AsyncGeneratorFunction%":_e,"%AsyncIteratorPrototype%":_e,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":r,"%Float16Array%":typeof Float16Array>"u"?n:Float16Array,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":I,"%GeneratorFunction%":_e,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":F&&q?q(q([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!F||!q?n:q(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":O,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":i,"%ReferenceError%":s,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!F||!q?n:q(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":F&&q?q(""[Symbol.iterator]()):n,"%Symbol%":F?Symbol:n,"%SyntaxError%":a,"%ThrowTypeError%":V,"%TypedArray%":ot,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":ae,"%Function.prototype.apply%":ue,"%Object.defineProperty%":z,"%Object.getPrototypeOf%":Q,"%Math.abs%":u,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":y,"%Math.pow%":v,"%Math.round%":S,"%Math.sign%":_,"%Reflect.getPrototypeOf%":K};if(q)try{null.error}catch(St){var Pe=q(q(St));se["%Error.prototype%"]=Pe}var ht=function St($e){var je;if($e==="%AsyncFunction%")je=Z("async function () {}");else if($e==="%GeneratorFunction%")je=Z("function* () {}");else if($e==="%AsyncGeneratorFunction%")je=Z("async function* () {}");else if($e==="%AsyncGenerator%"){var Oe=St("%AsyncGeneratorFunction%");Oe&&(je=Oe.prototype)}else if($e==="%AsyncIteratorPrototype%"){var Ge=St("%AsyncGenerator%");Ge&&q&&(je=q(Ge.prototype))}return se[$e]=je,je},Pn={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},dt=_h(),bt=Ci(),Ls=dt.call(ae,Array.prototype.concat),ua=dt.call(ue,Array.prototype.splice),Ms=dt.call(ae,String.prototype.replace),Ii=dt.call(ae,String.prototype.slice),Te=dt.call(ae,RegExp.prototype.exec),oc=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Dn=/\\(\\)?/g,Ns=function($e){var je=Ii($e,0,1),Oe=Ii($e,-1);if(je==="%"&&Oe!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(Oe==="%"&&je!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Ge=[];return Ms($e,oc,function(ce,pn,oe,at){Ge[Ge.length]=oe?Ms(at,Dn,"$1"):pn||ce}),Ge},ac=function($e,je){var Oe=$e,Ge;if(bt(Pn,Oe)&&(Ge=Pn[Oe],Oe="%"+Ge[0]+"%"),bt(se,Oe)){var ce=se[Oe];if(ce===_e&&(ce=ht(Oe)),typeof ce>"u"&&!je)throw new l("intrinsic "+$e+" exists, but is not available. Please file an issue!");return{alias:Ge,name:Oe,value:ce}}throw new a("intrinsic "+$e+" does not exist!")};return Qp=function($e,je){if(typeof $e!="string"||$e.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof je!="boolean")throw new l('"allowMissing" argument must be a boolean');if(Te(/^%?[^%]*%?$/,$e)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Oe=Ns($e),Ge=Oe.length>0?Oe[0]:"",ce=ac("%"+Ge+"%",je),pn=ce.name,oe=ce.value,at=!1,He=ce.alias;He&&(Ge=He[0],ua(Oe,Ls([0,1],He)));for(var mn=1,On=!0;mn<Oe.length;mn+=1){var Je=Oe[mn],Pr=Ii(Je,0,1),Xn=Ii(Je,-1);if((Pr==='"'||Pr==="'"||Pr==="`"||Xn==='"'||Xn==="'"||Xn==="`")&&Pr!==Xn)throw new a("property names with quotes must have matching quotes");if((Je==="constructor"||!On)&&(at=!0),Ge+="."+Je,pn="%"+Ge+"%",bt(se,pn))oe=se[pn];else if(oe!=null){if(!(Je in oe)){if(!je)throw new l("base intrinsic for "+$e+" exists, but the property is not available.");return}if(O&&mn+1>=Oe.length){var Dr=O(oe,Je);On=!!Dr,On&&"get"in Dr&&!("originalValue"in Dr.get)?oe=Dr.get:oe=oe[Je]}else On=bt(oe,Je),oe=oe[Je];On&&!at&&(se[pn]=oe)}}return oe},Qp}var e0,Ly;function Ps(){if(Ly)return e0;Ly=1;var n=In(),t=Uf(),e=t([n("%String.prototype.indexOf%")]);return e0=function(i,s){var a=n(i,!!s);return typeof a=="function"&&e(i,".prototype.")>-1?t([a]):a},e0}var t0,My;function F1(){if(My)return t0;My=1;var n=In(),t=n("%Array%"),e=!t.isArray&&Ps()("Object.prototype.toString");return t0=t.isArray||function(i){return e(i)==="[object Array]"},t0}var n0,Ny;function q1(){if(Ny)return n0;Ny=1;var n=Zf(),t=Sh(),e=n.hasArrayLengthDefineBug(),r=e&&F1(),i=Ps(),s=i("Object.prototype.propertyIsEnumerable");return n0=function(l,c,u,f,p,y){if(!t){if(!l(y)||!y["[[Configurable]]"]||!y["[[Writable]]"]||p in f&&s(f,p)!==!!y["[[Enumerable]]"])return!1;var v=y["[[Value]]"];return f[p]=v,c(f[p],v)}return e&&p==="length"&&"[[Value]]"in y&&r(f)&&f.length!==y["[[Value]]"]?(f.length=y["[[Value]]"],f.length===y["[[Value]]"]):(t(f,p,u(y)),!0)},n0}var r0,zy;function Yl(){if(zy)return r0;zy=1;var n=pe(),t=Ci(),e={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};return r0=function(i){if(!i||typeof i!="object")return!1;for(var s in i)if(t(i,s)&&!e[s])return!1;var a=t(i,"[[Value]]")||t(i,"[[Writable]]"),l=t(i,"[[Get]]")||t(i,"[[Set]]");if(a&&l)throw new n("Property Descriptors may not be both accessor and data descriptors");return!0},r0}var i0,Hy;function S8(){return Hy||(Hy=1,i0=function(t){if(typeof t>"u")return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e}),i0}var s0,Zy;function _8(){if(Zy)return s0;Zy=1;var n=pe(),t=Yl(),e=S8();return s0=function(i){if(typeof i<"u"&&!t(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return e(i)},s0}var o0,Uy;function A8(){if(Uy)return o0;Uy=1;var n=pe(),t=Ci(),e=Yl();return o0=function(i){if(typeof i>"u")return!1;if(!e(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!t(i,"[[Value]]")&&!t(i,"[[Writable]]"))},o0}var a0,Fy;function Kl(){return Fy||(Fy=1,a0=function(t){return typeof t=="string"||typeof t=="symbol"}),a0}var l0,qy;function E8(){if(qy)return l0;qy=1;var n=z1();return l0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},l0}var c0,Vy;function V1(){if(Vy)return c0;Vy=1;var n=pe(),t=Ti(),e=q1(),r=_8(),i=A8(),s=Kl(),a=E8();return c0=function(c,u,f){if(!t(c))throw new n("Assertion failed: Type(O) is not Object");if(!s(u))throw new n("Assertion failed: P is not a Property Key");var p={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":f,"[[Writable]]":!0};return e(i,a,r,c,u,p)},c0}var u0,By;function k8(){if(By)return u0;By=1;var n=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,e,r;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},t(function(){throw 42},null,e)}catch(O){O!==r&&(t=null)}else t=null;var i=/^\s*class\b/,s=function(z){try{var P=n.call(z);return i.test(P)}catch{return!1}},a=function(z){try{return s(z)?!1:(n.call(z),!0)}catch{return!1}},l=Object.prototype.toString,c="[object Object]",u="[object Function]",f="[object GeneratorFunction]",p="[object HTMLAllCollection]",y="[object HTML document.all class]",v="[object HTMLCollection]",S=typeof Symbol=="function"&&!!Symbol.toStringTag,_=!(0 in[,]),I=function(){return!1};if(typeof document=="object"){var Z=document.all;l.call(Z)===l.call(document.all)&&(I=function(z){if((_||!z)&&(typeof z>"u"||typeof z=="object"))try{var P=l.call(z);return(P===p||P===y||P===v||P===c)&&z("")==null}catch{}return!1})}return u0=t?function(z){if(I(z))return!0;if(!z||typeof z!="function"&&typeof z!="object")return!1;try{t(z,null,e)}catch(P){if(P!==r)return!1}return!s(z)&&a(z)}:function(z){if(I(z))return!0;if(!z||typeof z!="function"&&typeof z!="object")return!1;if(S)return a(z);if(s(z))return!1;var P=l.call(z);return P!==u&&P!==f&&!/^\[object HTML/.test(P)?!1:a(z)},u0}var h0,jy;function iE(){return jy||(jy=1,h0=k8()),h0}var d0,Wy;function sE(){return Wy||(Wy=1,d0=function(t){return!!t}),d0}var f0,Gy;function oE(){if(Gy)return f0;Gy=1;var n=Ci(),t=pe(),e=Ti(),r=iE(),i=sE();return f0=function(a){if(!e(a))throw new t("ToPropertyDescriptor requires an object");var l={};if(n(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),n(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),n(a,"value")&&(l["[[Value]]"]=a.value),n(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),n(a,"get")){var c=a.get;if(typeof c<"u"&&!r(c))throw new t("getter must be a function");l["[[Get]]"]=c}if(n(a,"set")){var u=a.set;if(typeof u<"u"&&!r(u))throw new t("setter must be a function");l["[[Set]]"]=u}if((n(l,"[[Get]]")||n(l,"[[Set]]"))&&(n(l,"[[Value]]")||n(l,"[[Writable]]")))throw new t("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},f0}var p0,Jy;function aE(){if(Jy)return p0;Jy=1;var n=pe(),t=Ti(),e=Yl(),r=q1(),i=_8(),s=A8(),a=Kl(),l=E8(),c=oE();return p0=function(f,p,y){if(!t(f))throw new n("Assertion failed: Type(O) is not Object");if(!a(p))throw new n("Assertion failed: P is not a Property Key");var v=e(y)?y:c(y);if(!e(v))throw new n("Assertion failed: Desc is not a valid Property Descriptor");return r(s,l,i,f,p,v)},p0}var m0,Yy;function lE(){if(Yy)return m0;Yy=1;var n=pe(),t=Ti(),e=aE(),r=Kl();return m0=function(s,a,l){if(!t(s))throw new n("Assertion failed: Type(O) is not Object");if(!r(a))throw new n("Assertion failed: P is not a Property Key");var c={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":l,"[[Writable]]":!0};return e(s,a,c)},m0}var g0,Ky;function cE(){return Ky||(Ky=1,g0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null),g0}var v0,Xy;function uE(){if(Xy)return v0;Xy=1;var n=M1();return v0=n.setPrototypeOf||null,v0}var y0,Qy;function hE(){if(Qy)return y0;Qy=1;var n=Uf(),t=Gl(),e=pe(),r={};try{r.__proto__=null}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!("toString"in r),s=t&&t(Object.prototype,"__proto__");return y0=i&&(!!s&&typeof s.set=="function"&&n([s.set])||function(l,c){if(l==null)throw new e("set Object.prototype.__proto__ called on null or undefined");return l.__proto__=c,c}),y0}var w0,ew;function dE(){if(ew)return w0;ew=1;var n=cE(),t=uE(),e=hE(),r=pe();return w0=n?function(s,a){if(n(s,a))return s;throw new r("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:t||(e?function(s,a){return e(s,a),s}:null),w0}var b0,tw;function fE(){if(tw)return b0;tw=1;var n=pe(),t=Ti(),e=b8();return b0=function(i){if(!t(i))throw new n("Assertion failed: O must be an Object");if(!e)throw new n("This environment does not support fetching prototypes.");return e(i)},b0}var S0,nw;function pE(){if(nw)return S0;nw=1;var n=pe(),t=dE(),e=Ti(),r=fE();return S0=function(s,a){if(a!==null&&!e(a))throw new n("Assertion failed: V must be Object or Null");try{t(s,a)}catch{return!1}return r(s)===a},S0}var _0,rw;function mE(){if(rw)return _0;rw=1;var n=V1(),t=lE(),e=pE(),r=Zf()(),i=g8();function s(l,c,u){var f=new i(u);return e(f,a),delete f.constructor,t(f,"error",l),t(f,"suppressed",c),f}r&&Object.defineProperty(s,"prototype",{writable:!1});var a=s.prototype;if(!n(a,"constructor",s)||!n(a,"message","")||!n(a,"name","SuppressedError"))throw new i("unable to install SuppressedError.prototype properties; please report this!");return e(s.prototype,i.prototype),_0=s,_0}var A0,iw;function T8(){if(iw)return A0;iw=1;var n=mE();return A0=function(){return typeof SuppressedError=="function"?SuppressedError:n},A0}var E0,sw;function gE(){if(sw)return E0;sw=1;var n=oa(),t=L1()(),e=T8();return E0=function(){var i=e();return n(t,{SuppressedError:i},{SuppressedError:function(){return t.SuppressedError!==i}}),i},E0}var ow;function vE(){return ow||(ow=1,gE()()),qv}var k0,aw;function yE(){if(aw)return k0;aw=1;var n=pe(),t=Yl(),e=S8();return k0=function(i){if(typeof i<"u"&&!t(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return e(i)},k0}var T0,lw;function wE(){if(lw)return T0;lw=1;var n=pe(),t=Ci(),e=Yl();return T0=function(i){if(typeof i>"u")return!1;if(!e(i))throw new n("Assertion failed: `Desc` must be a Property Descriptor");return!(!t(i,"[[Value]]")&&!t(i,"[[Writable]]"))},T0}var C0,cw;function bE(){if(cw)return C0;cw=1;var n=z1();return C0=function(e,r){return e===r?e===0?1/e===1/r:!0:n(e)&&n(r)},C0}var R0,uw;function Xl(){return uw||(uw=1,R0=k8()),R0}var I0,hw;function SE(){return hw||(hw=1,I0=function(t){return!!t}),I0}var $0,dw;function _E(){if(dw)return $0;dw=1;var n=Ci(),t=pe(),e=Ti(),r=Xl(),i=SE();return $0=function(a){if(!e(a))throw new t("ToPropertyDescriptor requires an object");var l={};if(n(a,"enumerable")&&(l["[[Enumerable]]"]=i(a.enumerable)),n(a,"configurable")&&(l["[[Configurable]]"]=i(a.configurable)),n(a,"value")&&(l["[[Value]]"]=a.value),n(a,"writable")&&(l["[[Writable]]"]=i(a.writable)),n(a,"get")){var c=a.get;if(typeof c<"u"&&!r(c))throw new t("getter must be a function");l["[[Get]]"]=c}if(n(a,"set")){var u=a.set;if(typeof u<"u"&&!r(u))throw new t("setter must be a function");l["[[Set]]"]=u}if((n(l,"[[Get]]")||n(l,"[[Set]]"))&&(n(l,"[[Value]]")||n(l,"[[Writable]]")))throw new t("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return l},$0}var x0,fw;function Ah(){if(fw)return x0;fw=1;var n=pe(),t=Ti(),e=Yl(),r=q1(),i=yE(),s=wE(),a=Kl(),l=bE(),c=_E();return x0=function(f,p,y){if(!t(f))throw new n("Assertion failed: Type(O) is not Object");if(!a(p))throw new n("Assertion failed: P is not a Property Key");var v=e(y)?y:c(y);if(!e(v))throw new n("Assertion failed: Desc is not a valid Property Descriptor");return r(s,l,i,f,p,v)},x0}var P0,pw;function AE(){if(pw)return P0;pw=1;var n=Jl()();return P0=n?Symbol.dispose||Symbol("Symbol.dispose"):null,P0}var D0,mw;function B1(){if(mw)return D0;mw=1;var n=Jl(),t=AE();return D0=function(){return n()&&Symbol.dispose||t},D0}var O0,gw;function EE(){if(gw)return O0;gw=1;var n=H1(),t=Ah(),e=B1();return O0=function(){var i=e();return n()&&t(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},O0}var L0,vw;function kE(){if(vw)return L0;vw=1;var n=Jl()();return L0=n?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,L0}var M0,yw;function j1(){if(yw)return M0;yw=1;var n=Jl(),t=kE();return M0=function(){return n()&&Symbol.asyncDispose||t},M0}var N0,ww;function TE(){if(ww)return N0;ww=1;var n=H1(),t=Ah(),e=j1();return N0=function(){var i=e();return n()&&t(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":i}),i},N0}var z0,bw;function CE(){return bw||(bw=1,z0=F1()),z0}var H0,Sw;function Ff(){if(Sw)return H0;Sw=1;var n=In(),t=Ps(),e=pe(),r=CE(),i=n("%Reflect.apply%",!0)||t("Function.prototype.apply");return H0=function(a,l){var c=arguments.length>2?arguments[2]:[];if(!r(c))throw new e("Assertion failed: optional `argumentsList`, if provided, must be a List");return i(a,l,c)},H0}const RE={},IE=Object.freeze(Object.defineProperty({__proto__:null,default:RE},Symbol.toStringTag,{value:"Module"})),$E=Z4(IE);var Z0,_w;function Ql(){if(_w)return Z0;_w=1;var n=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,e=n&&t&&typeof t.get=="function"?t.get:null,r=n&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,s=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=i&&s&&typeof s.get=="function"?s.get:null,l=i&&Set.prototype.forEach,c=typeof WeakMap=="function"&&WeakMap.prototype,u=c?WeakMap.prototype.has:null,f=typeof WeakSet=="function"&&WeakSet.prototype,p=f?WeakSet.prototype.has:null,y=typeof WeakRef=="function"&&WeakRef.prototype,v=y?WeakRef.prototype.deref:null,S=Boolean.prototype.valueOf,_=Object.prototype.toString,I=Function.prototype.toString,Z=String.prototype.match,O=String.prototype.slice,z=String.prototype.replace,P=String.prototype.toUpperCase,V=String.prototype.toLowerCase,F=RegExp.prototype.test,q=Array.prototype.concat,Q=Array.prototype.join,K=Array.prototype.slice,ue=Math.floor,ae=typeof BigInt=="function"?BigInt.prototype.valueOf:null,_e=Object.getOwnPropertySymbols,ot=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,se=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Pe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===se||!0)?Symbol.toStringTag:null,ht=Object.prototype.propertyIsEnumerable,Pn=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(k){return k.__proto__}:null);function dt(k,C){if(k===1/0||k===-1/0||k!==k||k&&k>-1e3&&k<1e3||F.call(/e/,C))return C;var me=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof k=="number"){var Ae=k<0?-ue(-k):ue(k);if(Ae!==k){var Ce=String(Ae),ne=O.call(C,Ce.length+1);return z.call(Ce,me,"$&_")+"."+z.call(z.call(ne,/([0-9]{3})/g,"$&_"),/_$/,"")}}return z.call(C,me,"$&_")}var bt=$E,Ls=bt.custom,ua=ce(Ls)?Ls:null,Ms={__proto__:null,double:'"',single:"'"},Ii={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Z0=function k(C,me,Ae,Ce){var ne=me||{};if(at(ne,"quoteStyle")&&!at(Ms,ne.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(at(ne,"maxStringLength")&&(typeof ne.maxStringLength=="number"?ne.maxStringLength<0&&ne.maxStringLength!==1/0:ne.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var _t=at(ne,"customInspect")?ne.customInspect:!0;if(typeof _t!="boolean"&&_t!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(at(ne,"indent")&&ne.indent!==null&&ne.indent!==" "&&!(parseInt(ne.indent,10)===ne.indent&&ne.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(at(ne,"numericSeparator")&&typeof ne.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var tr=ne.numericSeparator;if(typeof C>"u")return"undefined";if(C===null)return"null";if(typeof C=="boolean")return C?"true":"false";if(typeof C=="string")return er(C,ne);if(typeof C=="number"){if(C===0)return 1/0/C>0?"0":"-0";var ft=String(C);return tr?dt(C,ft):ft}if(typeof C=="bigint"){var Ln=String(C)+"n";return tr?dt(C,Ln):Ln}var ha=typeof ne.depth>"u"?5:ne.depth;if(typeof Ae>"u"&&(Ae=0),Ae>=ha&&ha>0&&typeof C=="object")return Ns(C)?"[Array]":"[Object]";var Nr=xi(ne,Ae);if(typeof Ce>"u")Ce=[];else if(On(Ce,C)>=0)return"[Circular]";function pt(Oi,Fs,dc){if(Fs&&(Ce=K.call(Ce),Ce.push(Fs)),dc){var fc={depth:ne.depth};return at(ne,"quoteStyle")&&(fc.quoteStyle=ne.quoteStyle),k(Oi,fc,Ae+1,Ce)}return k(Oi,ne,Ae+1,Ce)}if(typeof C=="function"&&!St(C)){var Hs=mn(C),Yt=Mr(C,pt);return"[Function"+(Hs?": "+Hs:" (anonymous)")+"]"+(Yt.length>0?" { "+Q.call(Yt,", ")+" }":"")}if(ce(C)){var zr=se?z.call(String(C),/^(Symbol\(.*\))_[^)]*$/,"$1"):ot.call(C);return typeof C=="object"&&!se?Lr(zr):zr}if(Qn(C)){for(var Hr="<"+V.call(String(C.nodeName)),Zs=C.attributes||[],da=0;da<Zs.length;da++)Hr+=" "+Zs[da].name+"="+Te(oc(Zs[da].value),"double",ne);return Hr+=">",C.childNodes&&C.childNodes.length&&(Hr+="..."),Hr+="</"+V.call(String(C.nodeName))+">",Hr}if(Ns(C)){if(C.length===0)return"[]";var fa=Mr(C,pt);return Nr&&!lc(fa)?"["+Pi(fa,Nr)+"]":"[ "+Q.call(fa,", ")+" ]"}if($e(C)){var Us=Mr(C,pt);return!("cause"in Error.prototype)&&"cause"in C&&!ht.call(C,"cause")?"{ ["+String(C)+"] "+Q.call(q.call("[cause]: "+pt(C.cause),Us),", ")+" }":Us.length===0?"["+String(C)+"]":"{ ["+String(C)+"] "+Q.call(Us,", ")+" }"}if(typeof C=="object"&&_t){if(ua&&typeof C[ua]=="function"&&bt)return bt(C,{depth:ha-Ae});if(_t!=="symbol"&&typeof C.inspect=="function")return C.inspect()}if(Je(C)){var cc=[];return r&&r.call(C,function(Oi,Fs){cc.push(pt(Fs,C,!0)+" => "+pt(Oi,C))}),zs("Map",e.call(C),cc,Nr)}if(Dr(C)){var pa=[];return l&&l.call(C,function(Oi){pa.push(pt(Oi,C))}),zs("Set",a.call(C),pa,Nr)}if(Pr(C))return $i("WeakMap");if(Rh(C))return $i("WeakSet");if(Xn(C))return $i("WeakRef");if(Oe(C))return Lr(pt(Number(C)));if(pn(C))return Lr(pt(ae.call(C)));if(Ge(C))return Lr(S.call(C));if(je(C))return Lr(pt(String(C)));if(typeof window<"u"&&C===window)return"{ [object Window] }";if(typeof globalThis<"u"&&C===globalThis||typeof Qs<"u"&&C===Qs)return"{ [object globalThis] }";if(!ac(C)&&!St(C)){var uc=Mr(C,pt),Di=Pn?Pn(C)===Object.prototype:C instanceof Object||C.constructor===Object,hc=C instanceof Object?"":"null prototype",Ih=!Di&&Pe&&Object(C)===C&&Pe in C?O.call(He(C),8,-1):hc?"Object":"",Ze=Di||typeof C.constructor!="function"?"":C.constructor.name?C.constructor.name+" ":"",nr=Ze+(Ih||hc?"["+Q.call(q.call([],Ih||[],hc||[]),": ")+"] ":"");return uc.length===0?nr+"{}":Nr?nr+"{"+Pi(uc,Nr)+"}":nr+"{ "+Q.call(uc,", ")+" }"}return String(C)};function Te(k,C,me){var Ae=me.quoteStyle||C,Ce=Ms[Ae];return Ce+k+Ce}function oc(k){return z.call(String(k),/"/g,"&quot;")}function Dn(k){return!Pe||!(typeof k=="object"&&(Pe in k||typeof k[Pe]<"u"))}function Ns(k){return He(k)==="[object Array]"&&Dn(k)}function ac(k){return He(k)==="[object Date]"&&Dn(k)}function St(k){return He(k)==="[object RegExp]"&&Dn(k)}function $e(k){return He(k)==="[object Error]"&&Dn(k)}function je(k){return He(k)==="[object String]"&&Dn(k)}function Oe(k){return He(k)==="[object Number]"&&Dn(k)}function Ge(k){return He(k)==="[object Boolean]"&&Dn(k)}function ce(k){if(se)return k&&typeof k=="object"&&k instanceof Symbol;if(typeof k=="symbol")return!0;if(!k||typeof k!="object"||!ot)return!1;try{return ot.call(k),!0}catch{}return!1}function pn(k){if(!k||typeof k!="object"||!ae)return!1;try{return ae.call(k),!0}catch{}return!1}var oe=Object.prototype.hasOwnProperty||function(k){return k in this};function at(k,C){return oe.call(k,C)}function He(k){return _.call(k)}function mn(k){if(k.name)return k.name;var C=Z.call(I.call(k),/^function\s*([\w$]+)/);return C?C[1]:null}function On(k,C){if(k.indexOf)return k.indexOf(C);for(var me=0,Ae=k.length;me<Ae;me++)if(k[me]===C)return me;return-1}function Je(k){if(!e||!k||typeof k!="object")return!1;try{e.call(k);try{a.call(k)}catch{return!0}return k instanceof Map}catch{}return!1}function Pr(k){if(!u||!k||typeof k!="object")return!1;try{u.call(k,u);try{p.call(k,p)}catch{return!0}return k instanceof WeakMap}catch{}return!1}function Xn(k){if(!v||!k||typeof k!="object")return!1;try{return v.call(k),!0}catch{}return!1}function Dr(k){if(!a||!k||typeof k!="object")return!1;try{a.call(k);try{e.call(k)}catch{return!0}return k instanceof Set}catch{}return!1}function Rh(k){if(!p||!k||typeof k!="object")return!1;try{p.call(k,p);try{u.call(k,u)}catch{return!0}return k instanceof WeakSet}catch{}return!1}function Qn(k){return!k||typeof k!="object"?!1:typeof HTMLElement<"u"&&k instanceof HTMLElement?!0:typeof k.nodeName=="string"&&typeof k.getAttribute=="function"}function er(k,C){if(k.length>C.maxStringLength){var me=k.length-C.maxStringLength,Ae="... "+me+" more character"+(me>1?"s":"");return er(O.call(k,0,C.maxStringLength),C)+Ae}var Ce=Ii[C.quoteStyle||"single"];Ce.lastIndex=0;var ne=z.call(z.call(k,Ce,"\\$1"),/[\x00-\x1f]/g,Or);return Te(ne,"single",C)}function Or(k){var C=k.charCodeAt(0),me={8:"b",9:"t",10:"n",12:"f",13:"r"}[C];return me?"\\"+me:"\\x"+(C<16?"0":"")+P.call(C.toString(16))}function Lr(k){return"Object("+k+")"}function $i(k){return k+" { ? }"}function zs(k,C,me,Ae){var Ce=Ae?Pi(me,Ae):Q.call(me,", ");return k+" ("+C+") {"+Ce+"}"}function lc(k){for(var C=0;C<k.length;C++)if(On(k[C],`
2
- `)>=0)return!1;return!0}function xi(k,C){var me;if(k.indent===" ")me=" ";else if(typeof k.indent=="number"&&k.indent>0)me=Q.call(Array(k.indent+1)," ");else return null;return{base:me,prev:Q.call(Array(C+1),me)}}function Pi(k,C){if(k.length===0)return"";var me=`
3
- `+C.prev+C.base;return me+Q.call(k,","+me)+`
4
- `+C.prev}function Mr(k,C){var me=Ns(k),Ae=[];if(me){Ae.length=k.length;for(var Ce=0;Ce<k.length;Ce++)Ae[Ce]=at(k,Ce)?C(k[Ce],k):""}var ne=typeof _e=="function"?_e(k):[],_t;if(se){_t={};for(var tr=0;tr<ne.length;tr++)_t["$"+ne[tr]]=ne[tr]}for(var ft in k)at(k,ft)&&(me&&String(Number(ft))===ft&&ft<k.length||se&&_t["$"+ft]instanceof Symbol||(F.call(/[^\w$]/,ft)?Ae.push(C(ft,k)+": "+C(k[ft],k)):Ae.push(ft+": "+C(k[ft],k))));if(typeof _e=="function")for(var Ln=0;Ln<ne.length;Ln++)ht.call(k,ne[Ln])&&Ae.push("["+C(ne[Ln])+"]: "+C(k[ne[Ln]],k));return Ae}return Z0}var U0,Aw;function xE(){if(Aw)return U0;Aw=1;var n=Ql(),t=pe(),e=function(l,c,u){for(var f=l,p;(p=f.next)!=null;f=p)if(p.key===c)return f.next=p.next,u||(p.next=l.next,l.next=p),p},r=function(l,c){if(l){var u=e(l,c);return u&&u.value}},i=function(l,c,u){var f=e(l,c);f?f.value=u:l.next={key:c,next:l.next,value:u}},s=function(l,c){return l?!!e(l,c):!1},a=function(l,c){if(l)return e(l,c,!0)};return U0=function(){var c,u={assert:function(f){if(!u.has(f))throw new t("Side channel does not contain "+n(f))},delete:function(f){var p=a(c,f);return p&&c&&!c.next&&(c=void 0),!!p},get:function(f){return r(c,f)},has:function(f){return s(c,f)},set:function(f,p){c||(c={next:void 0}),i(c,f,p)}};return u},U0}var F0,Ew;function C8(){if(Ew)return F0;Ew=1;var n=In(),t=Ps(),e=Ql(),r=pe(),i=n("%Map%",!0),s=t("Map.prototype.get",!0),a=t("Map.prototype.set",!0),l=t("Map.prototype.has",!0),c=t("Map.prototype.delete",!0),u=t("Map.prototype.size",!0);return F0=!!i&&function(){var p,y={assert:function(v){if(!y.has(v))throw new r("Side channel does not contain "+e(v))},delete:function(v){if(p){var S=c(p,v);return u(p)===0&&(p=void 0),S}return!1},get:function(v){if(p)return s(p,v)},has:function(v){return p?l(p,v):!1},set:function(v,S){p||(p=new i),a(p,v,S)}};return y},F0}var q0,kw;function PE(){if(kw)return q0;kw=1;var n=In(),t=Ps(),e=Ql(),r=C8(),i=pe(),s=n("%WeakMap%",!0),a=t("WeakMap.prototype.get",!0),l=t("WeakMap.prototype.set",!0),c=t("WeakMap.prototype.has",!0),u=t("WeakMap.prototype.delete",!0);return q0=s?function(){var p,y,v={assert:function(S){if(!v.has(S))throw new i("Side channel does not contain "+e(S))},delete:function(S){if(s&&S&&(typeof S=="object"||typeof S=="function")){if(p)return u(p,S)}else if(r&&y)return y.delete(S);return!1},get:function(S){return s&&S&&(typeof S=="object"||typeof S=="function")&&p?a(p,S):y&&y.get(S)},has:function(S){return s&&S&&(typeof S=="object"||typeof S=="function")&&p?c(p,S):!!y&&y.has(S)},set:function(S,_){s&&S&&(typeof S=="object"||typeof S=="function")?(p||(p=new s),l(p,S,_)):r&&(y||(y=r()),y.set(S,_))}};return v}:r,q0}var V0,Tw;function DE(){if(Tw)return V0;Tw=1;var n=pe(),t=Ql(),e=xE(),r=C8(),i=PE(),s=i||r||e;return V0=function(){var l,c={assert:function(u){if(!c.has(u)){var f=u&&Object(u)===u?"the given object key":t(u);throw new n("Side channel does not contain "+f)}},delete:function(u){return!!l&&l.delete(u)},get:function(u){return l&&l.get(u)},has:function(u){return!!l&&l.has(u)},set:function(u,f){l||(l=s()),l.set(u,f)}};return c},V0}var B0,Cw;function W1(){if(Cw)return B0;Cw=1;var n=Ci(),t=DE()(),e=pe(),r={assert:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");if(t.assert(i),!r.has(i,s))throw new e("`"+s+"` is not present on `O`")},get:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var a=t.get(i);return a&&a["$"+s]},has:function(i,s){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var a=t.get(i);return!!a&&n(a,"$"+s)},set:function(i,s,a){if(!i||typeof i!="object"&&typeof i!="function")throw new e("`O` is not an object");if(typeof s!="string")throw new e("`slot` must be a string");var l=t.get(i);l||(l={},t.set(i,l)),l["$"+s]=a}};return Object.freeze&&Object.freeze(r),B0=r,B0}var j0,Rw;function G1(){if(Rw)return j0;Rw=1;var n=ki(),t=W1(),e=function r(i,s){if(!(this instanceof r))return new r(i,s);if(i!=="normal"&&i!=="break"&&i!=="continue"&&i!=="return"&&i!=="throw")throw new n('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');t.set(this,"[[Type]]",i),t.set(this,"[[Value]]",s)};return e.prototype.type=function(){return t.get(this,"[[Type]]")},e.prototype.value=function(){return t.get(this,"[[Value]]")},e.prototype["?"]=function(){var i=t.get(this,"[[Type]]"),s=t.get(this,"[[Value]]");if(i==="throw")throw s;return s},e.prototype["!"]=function(){var i=t.get(this,"[[Type]]");if(i!=="normal")throw new n('Assertion failed: Completion Record is not of type "normal"');return t.get(this,"[[Value]]")},j0=e,j0}var W0,Iw;function J1(){if(Iw)return W0;Iw=1;var n=G1();return W0=function(e){return new n("normal",e)},W0}var G0,$w;function OE(){if($w)return G0;$w=1;var n=Jl();return G0=function(){return n()&&!!Symbol.toStringTag},G0}var J0,xw;function R8(){if(xw)return J0;xw=1;var n=In(),t=n("%Object.defineProperty%",!0),e=OE()(),r=Ci(),i=pe(),s=e?Symbol.toStringTag:null;return J0=function(l,c){var u=arguments.length>2&&!!arguments[2]&&arguments[2].force,f=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof u<"u"&&typeof u!="boolean"||typeof f<"u"&&typeof f!="boolean")throw new i("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");s&&(u||!r(l,s))&&(t?t(l,s,{configurable:!f,enumerable:!1,value:c,writable:!1}):l[s]=c)},J0}var Y0={exports:{}},K0,Pw;function LE(){if(Pw)return K0;Pw=1;var n=In(),t=f8(),e=Zf()(),r=Gl(),i=pe(),s=n("%Math.floor%");return K0=function(l,c){if(typeof l!="function")throw new i("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||s(c)!==c)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],f=!0,p=!0;if("length"in l&&r){var y=r(l,"length");y&&!y.configurable&&(f=!1),y&&!y.writable&&(p=!1)}return(f||p||!u)&&(e?t(l,"length",c,!0,!0):t(l,"length",c)),l},K0}var X0,Dw;function ME(){if(Dw)return X0;Dw=1;var n=_h(),t=U1(),e=w8();return X0=function(){return e(n,t,arguments)},X0}var Ow;function Y1(){return Ow||(Ow=1,(function(n){var t=LE(),e=Sh(),r=Uf(),i=ME();n.exports=function(a){var l=r(arguments),c=1+a.length-(arguments.length-1);return t(l,c>0?c:0,!0)},e?e(n.exports,"apply",{value:i}):n.exports.apply=i})(Y0)),Y0.exports}var Q0,Lw;function NE(){return Lw||(Lw=1,Q0=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0}),Q0}var em,Mw;function zE(){if(Mw)return em;Mw=1;var n=Object;return em=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||n(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},em}var tm,Nw;function HE(){if(Nw)return tm;Nw=1;var n=Ci(),t=F1(),e=NE(),r=zE();return tm=function(s){return s&&typeof s=="object"&&n(s,"[[DisposableResourceStack]]")&&t(s["[[DisposableResourceStack]]"])&&(s["[[DisposableResourceStack]]"].length===0||e(s["[[DisposableResourceStack]]"],r))},tm}var nm,zw;function ZE(){if(zw)return nm;zw=1;var n=Ti();return nm=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(n(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},nm}var rm,Hw;function K1(){if(Hw)return rm;Hw=1;var n=ZE();return rm=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":n(e)},rm}var im,Zw;function UE(){if(Zw)return im;Zw=1;var n=pe(),t=Ql(),e=Kl();return im=function(i,s){if(!e(s))throw new n("Assertion failed: P is not a Property Key, got "+t(s));return i[s]},im}var sm,Uw;function FE(){if(Uw)return sm;Uw=1;var n=pe(),t=UE(),e=Xl(),r=Kl(),i=Ql();return sm=function(a,l){if(!r(l))throw new n("Assertion failed: P is not a Property Key");var c=t(a,l);if(c!=null){if(!e(c))throw new n(i(l)+" is not a function: "+i(c));return c}},sm}var Nh={exports:{}},om,Fw;function qE(){return Fw||(Fw=1,om=In()),om}var qw;function VE(){if(qw)return Nh.exports;qw=1;var n=qE(),t=n("%Reflect.construct%",!0),e=Ah();try{e({},"",{"[[Get]]":function(){}})}catch{e=null}if(e&&t){var r={},i={};e(i,"length",{"[[Get]]":function(){throw r},"[[Enumerable]]":!0}),Nh.exports=function(a){try{t(a,i)}catch(l){return l===r}}}else Nh.exports=function(a){return typeof a=="function"&&!!a.prototype};return Nh.exports}var am,Vw;function BE(){if(Vw)return am;Vw=1;var n=pe(),t=Xl(),e=VE();return am=function(i){if(!e(i))throw new n("C must be a constructor");var s={"[[Resolve]]":void 0,"[[Reject]]":void 0},a=new i(function(l,c){if(typeof s["[[Resolve]]"]<"u"||typeof s["[[Reject]]"]<"u")throw new n("executor has already been called");s["[[Resolve]]"]=l,s["[[Reject]]"]=c});if(!t(s["[[Resolve]]"])||!t(s["[[Reject]]"]))throw new n("executor must provide valid resolve and reject functions");return{"[[Promise]]":a,"[[Resolve]]":s["[[Resolve]]"],"[[Reject]]":s["[[Reject]]"]}},am}var lm,Bw;function jE(){if(Bw)return lm;Bw=1;var n=ki(),t=pe(),e=Ff(),r=FE(),i=BE(),s=K1(),a=B1()(),l=j1()();return lm=function(u,f){if(s(u)!=="Object")throw new t("`V` must be an Object");if(f!=="SYNC-DISPOSE"&&f!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var p;if(f==="ASYNC-DISPOSE"&&l&&(p=r(u,l)),!p){if(!a)throw new n("`Symbol.dispose` is not supported");if(p=r(u,a),typeof p<"u")return function(){var y=this;if(f==="ASYNC-DISPOSE"){var v=i(Promise);try{e(p,y),e(v["[[Resolve]]"],void 0,[void 0])}catch(S){v["[[Reject]]"](S)}return v["[[Promise]]"]}e(p,y)}}return p},lm}var cm,jw;function WE(){if(jw)return cm;jw=1;var n=ki(),t=pe(),e=Xl(),r=K1(),i=jE();return cm=function(a,l){if(l!=="SYNC-DISPOSE"&&l!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var c;if(arguments.length<3)if(a==null)a=void 0,c=void 0;else{if(typeof a<"u"&&r(a)!=="Object")throw new t("`V` must be an Object, or `null` or `undefined`");if(c=i(a,l),typeof c>"u")throw new t("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(c=arguments[2],!e(c))throw new t("`method`, when provided, must be a function");return{"[[ResourceValue]]":a,"[[Hint]]":l,"[[DisposeMethod]]":c}},cm}var um,Ww;function I8(){if(Ww)return um;Ww=1;var n=ki(),t=pe(),e=HE(),r=WE(),i=Ps(),s=i("Array.prototype.push");return um=function(l,c,u){if(!e(l))throw new t("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(u!=="SYNC-DISPOSE"&&u!=="ASYNC-DISPOSE")throw new n("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var f=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof f!="function")throw new t("Assertion failed: `method`, when present, must be a function");if(!l["[[DisposableResourceStack]]"])throw new t("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var p;if(arguments.length<4){if(c==null&&u==="SYNC_DISPOSE")return"UNUSED";p=r(c,u)}else{if(typeof c<"u")throw new t("Assertion failed: `V` must be undefined when `method` is present");p=r(void 0,u,f)}return s(l["[[DisposableResourceStack]]"],p),"UNUSED"},um}var hm,Gw;function X1(){if(Gw)return hm;Gw=1;var n=In(),t=Y1(),e=ki(),r=n("%Promise.resolve%",!0),i=r&&t(r);return hm=function(a,l){if(!i)throw new e("This environment does not support Promises.");return i(a,l)},hm}var dm,Jw;function GE(){if(Jw)return dm;Jw=1;var n=In(),t=ki(),e=n("%Promise%",!0),r=Ff(),i=X1(),s=K1();return dm=function(l,c,u){if(typeof l<"u"&&s(l)!=="Object")throw new t("Assertion failed: `V` must be `undefined` or an Object");if(c!=="SYNC-DISPOSE"&&c!=="ASYNC-DISPOSE")throw new t("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new t("Assertion failed: `method` must be `undefined` or a function");var f=typeof u>"u"?u:r(u,l);if(c==="ASYNC-DISPOSE")return i(e,f)},dm}var fm,Yw;function JE(){if(Yw)return fm;Yw=1;var n=G1();return fm=function(e){return new n("throw",e)},fm}var pm,Kw;function $8(){if(Kw)return pm;Kw=1;var n=In(),t=ki(),e=pe(),r=n("%Promise%",!0),i=Ps(),s=i("Promise.prototype.then",!0),a=G1(),l=GE(),c=J1(),u=X1(),f=JE(),p=T8()();return pm=function(v,S){if(!(S instanceof a))throw new e("`completion` must be a Completion Record");var _=v["[[DisposableResourceStack]]"];if(!_)throw new e("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var I,Z=_.length-1;Z>=0;Z-=1)if(!I)I=_[Z]["[[Hint]]"];else if(I!==_[Z]["[[Hint]]"])throw new t("mixed hint stacks are not supported");for(var O=I==="ASYNC-DISPOSE"&&u(r,S),z=function(Q){if(S.type()==="throw"){var K=S.value(),ue=new p(Q,K);S=f(ue)}else S=f(Q)},P=I==="ASYNC-DISPOSE"&&function(K){return s(O,function(){var ue=l(K["[[ResourceValue]]"],K["[[Hint]]"],K["[[DisposeMethod]]"]);if(!ue)throw new t("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return s(ue,c)},z)},V=_.length-1;V>=0;V-=1)if(I==="ASYNC-DISPOSE")O=P(_[V]);else{var F=_[V];try{var q=l(F["[[ResourceValue]]"],F["[[Hint]]"],F["[[DisposeMethod]]"]);if(q)throw new t("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(Q){z(Q)}}return v["[[DisposableResourceStack]]"]=null,I==="ASYNC-DISPOSE"?O:S},pm}var mm,Xw;function x8(){return Xw||(Xw=1,mm=function(){var t=[];return{"[[DisposableResourceStack]]":t}}),mm}var gm,Qw;function YE(){if(Qw)return gm;Qw=1;var n=N1(),t=pe(),e=Ff(),r=V1(),i=Ah(),s=Xl(),a=J1(),l=W1(),c=R8(),u=oa().supportsDescriptors,f=Y1(),p=I8(),y=$8(),v=x8(),S=B1()(),_=function z(){if(!(this instanceof z)||l.has(this,"[[DisposableState]]")||l.has(this,"[[DisposeCapability]]"))throw new t("can only be used with new");l.set(this,"[[DisposableState]]","PENDING"),l.set(this,"[[DisposeCapability]]",v())},I=function(){var P=this;return l.assert(P,"[[DisposableState]]"),l.get(P,"[[DisposableState]]")==="DISPOSED"},Z=f(I);u?i(_.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":I}):_.prototype.disposed=!1;var O=function(P){l.set(P,"[[DisposableState]]","DISPOSED"),u||(P.disposed=!0)};return r(_.prototype,"dispose",function(){var P=this;if(!Z(P))return O(P),y(l.get(P,"[[DisposeCapability]]"),a())["?"]()}),r(_.prototype,"use",function(P){var V=this;if(Z(V))throw new n("a disposed stack can not use anything new");return p(l.get(V,"[[DisposeCapability]]"),P,"SYNC-DISPOSE"),P}),r(_.prototype,"adopt",function(P,V){var F=this;if(Z(F))throw new n("a disposed stack can not use anything new");if(!s(V))throw new t("`onDispose` must be a function");var q=(function(){return e(V,void 0,[P])});return p(l.get(F,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",q),P}),r(_.prototype,"defer",function(P){var V=this;if(Z(V))throw new n("a disposed stack can not defer anything new");if(!s(P))throw new t("`onDispose` must be a function");p(l.get(V,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",P)}),r(_.prototype,"move",function(){var P=this;if(Z(P))throw new n("a disposed stack can not use anything new");var V=new _;return l.set(V,"[[DisposeCapability]]",l.get(P,"[[DisposeCapability]]")),l.set(P,"[[DisposeCapability]]",v()),O(P),V}),S&&r(_.prototype,S,_.prototype.dispose),c(_.prototype,"DisposableStack"),gm=_,gm}var vm,e2;function KE(){if(e2)return vm;e2=1;var n=YE();return vm=function(){return typeof DisposableStack=="function"?DisposableStack:n},vm}var ym,t2;function XE(){if(t2)return ym;t2=1;var n=oa(),t=L1()(),e=KE();return ym=function(){var i=e();return n(t,{DisposableStack:i},{DisposableStack:!0}),i},ym}var wm,n2;function QE(){if(n2)return wm;n2=1;var n=In(),t=N1(),e=pe(),r=n("%Promise%",!0),i=I8(),s=Ff(),a=V1(),l=Ah(),c=$8(),u=Xl(),f=x8(),p=J1(),y=X1(),v=W1(),S=R8(),_=oa().supportsDescriptors,I=Y1(),Z=Ps(),O=Z("Promise.prototype.then",!0),z=j1()(),P=function Q(){if(!(this instanceof Q)||v.has(this,"[[AsyncDisposableState]]")||v.has(this,"[[DisposeCapability]]"))throw new e("can only be used with new");v.set(this,"[[AsyncDisposableState]]","pending"),v.set(this,"[[DisposeCapability]]",f())},V=function(){var K=this;return v.assert(K,"[[AsyncDisposableState]]"),v.get(K,"[[AsyncDisposableState]]")==="disposed"},F=I(V);_?l(P.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":V}):P.prototype.disposed=!1;var q=function(K){v.set(K,"[[AsyncDisposableState]]","disposed"),_||(K.disposed=!0)};return a(P.prototype,"disposeAsync",function(){var K=this;return F(K)?y(r):(q(K),O(y(r,c(v.get(K,"[[DisposeCapability]]"),p())),function(ue){return ue["?"]()}))}),a(P.prototype,"use",function(K){var ue=this;if(F(ue))throw new t("a disposed stack can not use anything new");return i(v.get(ue,"[[DisposeCapability]]"),K,"ASYNC-DISPOSE"),K}),a(P.prototype,"adopt",function(K,ue){var ae=this;if(F(ae))throw new t("a disposed stack can not use anything new");if(!u(ue))throw new e("`onDisposeAsync` must be a function");var _e=(function(){return s(ue,void 0,[K])});return _e.value=K,i(v.get(ae,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",_e),K}),a(P.prototype,"defer",function(K){var ue=this;if(F(ue))throw new t("a disposed stack can not defer anything new");if(!u(K))throw new e("`onDispose` must be a function");i(v.get(ue,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",K)}),a(P.prototype,"move",function(){var K=this;if(F(K))throw new t("a disposed stack can not use anything new");var ue=new P;return v.set(ue,"[[DisposeCapability]]",v.get(K,"[[DisposeCapability]]")),v.set(K,"[[DisposeCapability]]",f()),q(K),ue}),z&&a(P.prototype,z,P.prototype.disposeAsync),S(P.prototype,"AsyncDisposableStack"),wm=P,wm}var bm,r2;function ek(){if(r2)return bm;r2=1;var n=QE();return bm=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:n},bm}var Sm,i2;function tk(){if(i2)return Sm;i2=1;var n=oa(),t=L1()(),e=ek();return Sm=function(){var i=e();return n(t,{AsyncDisposableStack:i},{AsyncDisposableStack:!0}),i},Sm}var _m,s2;function nk(){if(s2)return _m;s2=1;var n=EE(),t=TE(),e=XE(),r=tk();return _m=function(){n(),t(),e(),r()},_m}var o2;function rk(){return o2||(o2=1,vE(),nk()()),Fv}rk();const a2=new WeakMap;function ik(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function ya(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function l2(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function sk(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class ok{constructor(){R(this,"entries",new Map);R(this,"constructionStack",[])}register(t,e){if(e===void 0){if(typeof t!="function")throw l2();this.validateClassRegistration(t),this.storeFactory(t,()=>this.instantiateClass(t));return}if(typeof e!="function")throw l2();if(e.constructor.name==="AsyncFunction")throw sk();this.storeFactory(t,e)}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.factory)!==void 0}resolve(t){return this.resolveAny(t)}storeFactory(t,e){const r=this.getOrCreateEntry(t);r.factory=e,r.instance=void 0,r.error=void 0}validateClassRegistration(t){const e=a2.get(t);if(e){if(t.length!==e.length)throw new Error(`${ya(t)} cannot be registered with register(Class). @injectable(...) declared ${e.length} dependencies but constructor arity is ${t.length}. Use register(Key, () => value) instead.`);return}if(t.length!==0)throw new Error(`${ya(t)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(t){const e=a2.get(t);if(!e)return new t;const r=e.map(i=>this.resolveAny(i));return new t(...r)}resolveAny(t){return this.getOrCreateEntry(t).proxy}getOrCreateEntry(t){let e=this.entries.get(t);return e||(e={key:t},e.proxy=this.createProxy(e),this.entries.set(t,e),e)}createProxy(t){return new Proxy({},{get:(e,r)=>{if(r==="then")return;const i=this.getInstance(t),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(e,r,i)=>{const s=this.getInstance(t);return Reflect.set(s,r,i,s)},has:(e,r)=>{const i=this.getInstance(t);return r in i}})}getInstance(t){if(t.instance)return t.instance;if(t.error)throw t.error;if(!t.factory)throw new Error(`${ya(t.key)} was resolved but never registered`);const e=this.constructionStack.indexOf(t.key);if(e!==-1){const r=[...this.constructionStack.slice(e),t.key].map(i=>ya(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(t.key);try{const r=t.factory();if(ik(r))throw new Error(`Factory for ${ya(t.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${ya(t.key)} returned a non-object value. Wrap primitives in an object.`);return t.instance=r,r}catch(r){throw t.error=r,r}finally{this.constructionStack.pop()}}}const P8=new ok,ak=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function lk(n){for(const t of Object.keys(n))if(ak.has(t))throw new Error(`Event payload key "${t}" is reserved; choose a different property name`)}function ck(n,t){lk(t);for(const e of Object.keys(t))Object.defineProperty(n,e,{value:t[e],writable:!0,enumerable:!0,configurable:!0})}function $n(){class n extends Event{constructor(e,r){const{type:i,bubbles:s,cancelable:a,composed:l,...c}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(e,{bubbles:s,cancelable:a,composed:l}),ck(this,c)}}return n}class Ri extends globalThis.EventTarget{}const uk="X-Television-Client-Meta",hk="telemetry-activity",dk="telemetry-signal",D8={kind:"single",full_screen:!1},O8={width:760,height:770};function fk(n){return n.layout.flatMap(t=>t.artifactIds)}function pk(n){if(!Array.isArray(n))return{valid:!1,errors:["Layout must be an array of pages"]};const t=[];for(const[e,r]of n.entries())mk(r,e,t);return{valid:t.length===0,errors:t}}function Qc(n){return n.flatMap(t=>t.artifactIds)}function Bm(n,t){return n.flatMap(e=>{if(!e.artifactIds.includes(t))return[e];const r=e.artifactIds.filter(i=>i!==t);return r.length===0?[]:[{...e,artifactIds:r}]})}function mk(n,t,e){if(!Am(n)){e.push(`Page ${t} must be an object`);return}for(const r of Object.keys(n))r!=="artifactIds"&&r!=="geometry"&&r!=="size"&&e.push(`Page ${t} has unknown field: ${r}`);if(!Array.isArray(n.artifactIds)||n.artifactIds.length===0?e.push(`Page ${t} must contain at least one artifact id`):n.artifactIds.some(r=>typeof r!="string"||r.length===0)&&e.push(`Page ${t} artifact ids must be non-empty strings`),!Am(n.geometry)){e.push(`Page ${t} geometry must be an object`);return}for(const r of Object.keys(n.geometry))r!=="kind"&&r!=="full_screen"&&e.push(`Page ${t} geometry has unknown field: ${r}`);if(n.geometry.kind!=="single"){e.push(`Page ${t} has unknown geometry kind: ${String(n.geometry.kind)}`);return}if(typeof n.geometry.full_screen!="boolean"&&e.push(`Page ${t} single geometry must include a boolean full_screen`),!Am(n.size)){e.push(`Page ${t} size must be an object`);return}for(const r of Object.keys(n.size))r!=="width"&&r!=="height"&&e.push(`Page ${t} size has unknown field: ${r}`);for(const r of["width","height"]){const i=n.size[r];(typeof i!="number"||!Number.isFinite(i)||i<=0)&&e.push(`Page ${t} size ${r} must be a finite positive number`)}}function Am(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Wt=$n(),Qh=$n(),c2=$n(),gk=$n(),vk=$n(),yk=$n();function L8(n){class t extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return t}const ec=L8("RequestError"),u2=L8("ValidationError");function Fl(n,t){return Object.assign(new Error(t),{code:n})}const wk=new TextEncoder;function M8(n){return wk.encode(n).length}const N8=768,eu=32;function h2(n){const t=n.split("/").filter(e=>e.length>0);return bk(t),t}function bk(n){if(n.length>eu)throw Fl("invalid-path",`A path has at most ${eu} segments.`);for(const t of n)if(!z8(t))throw Fl("invalid-path",`A path key is at most ${N8} bytes.`)}function d2(){return Fl("invalid-path",`A value can be at most ${eu} keys below the store's root.`)}function z8(n){return n.length>0&&!n.includes("/")&&M8(n)<=N8}function Sk(n,t){const e=n.length<=t.length?n:t,r=e===n?t:n;return e.every((i,s)=>r[s]===i)}function jm(n,t){if(n===t)return!0;if(n===void 0||t===void 0||n===null||t===null)return!1;if(Array.isArray(n)||Array.isArray(t))return!Array.isArray(n)||!Array.isArray(t)||n.length!==t.length?!1:n.every((r,i)=>jm(r,t[i]));if(typeof n!="object"||typeof t!="object")return!1;const e=Object.keys(n);return e.length!==Object.keys(t).length?!1:e.every(r=>Object.hasOwn(t,r)&&jm(n[r],t[r]))}class _k{constructor(t){R(this,"serverValue");this.serverValue=t,Object.freeze(this)}}class Ak{constructor(){Object.freeze(this)}}function wa(n){return Fl("invalid-value",n)}function Ek(n){const t=Object.getPrototypeOf(n);return t===Object.prototype||t===null}function Wm(n,t,e,r){if(!(n===null||typeof n=="boolean"||typeof n=="string")){if(typeof n=="number"){if(!Number.isFinite(n))throw wa("A stored number must be finite.");return}if(typeof n!="object")throw wa(`A ${typeof n} is not a JSON value.`);if(e.has(n))throw wa("A value cannot contain itself.");if(e.add(n),Array.isArray(n)){if(n.length>0&&r>=eu)throw d2();for(let i=0;i<n.length;i++){if(!(i in n))throw wa("An array cannot have holes.");Wm(n[i],t,e,r+1)}}else{if(!Ek(n))throw wa("Only plain objects, arrays, strings, finite numbers, booleans and null are JSON values.");const i=Object.keys(n);if(i.length>0&&r>=eu)throw d2();for(const s of i){if(!z8(s))throw wa("An object key must be non-empty, contain no /, and be at most 768 bytes.");Wm(n[s],t,e,r+1)}}e.delete(n)}}function kk(n){Wm(n,!1,new Set,0)}function Tk(n,t,e){Object.defineProperty(n,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}function Gm(n){const t=[],e=(i,s)=>{if(i instanceof _k)return t.push({at:s,serverValue:{...i.serverValue}}),null;if(Array.isArray(i))return i.map((a,l)=>e(a,[...s,String(l)]));if(i!==null&&typeof i=="object"){const a={};for(const l of Object.keys(i))Tk(a,l,e(i[l],[...s,l]));return a}return i},r=e(n,[]);return t.length>0?{value:r,serverValues:t}:{value:r}}function Ck(n){return Object.keys(n).map(t=>{const e=n[t];return e instanceof Ak?{key:t,delete:!0}:{key:t,value:Gm(e)}})}const H8=16777216;function Rk(n){if(M8(n)>H8)throw Ik()}function Ik(){return Fl("too-large",`A write is at most ${H8} bytes as sent.`)}/**
5
- * @license
6
- * Adapted from the Firebase JavaScript SDK, https://github.com/firebase/firebase-js-sdk:
7
- * the push-ID generator in packages/database/src/core/util/NextPushId.ts, at
8
- * commit 6cde0c0230b4c1da01d4a058333daa7663322fd1 (@firebase/database 1.1.5).
9
- * Modified by Television: rewritten as one function that reads the clock
10
- * itself, draws its random characters from crypto.getRandomValues, and stops
11
- * the same-millisecond increment at the first character.
12
- *
13
- * Copyright 2017 Google LLC
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */const $k=12;new Array($k).fill(0);const qr="/api/resources/v1",gc=(n,t="")=>`${qr}/resources/${encodeURIComponent(n)}${t===""?"":`/${t}`}`,f2=(n,t)=>`${qr}/artifacts/${encodeURIComponent(n)}/${t}`,jt={list:`${qr}/resources`,info:n=>gc(n),describe:n=>gc(n,"describe"),bind:n=>gc(n,"bind"),unbind:n=>gc(n,"unbind"),destroy:n=>gc(n,"destroy"),share:n=>f2(n,"share"),unshare:n=>f2(n,"unshare"),jsonCreate:`${qr}/json/create`,jsonGet:`${qr}/json/value`,jsonSet:`${qr}/json/set`,jsonUpdate:`${qr}/json/update`,jsonPush:`${qr}/json/push`,jsonRemove:`${qr}/json/remove`},p2={artifactID:"artifact",resourceID:"resourceID"};function xk(n){return"artifactID"in n?new URLSearchParams({[p2.artifactID]:n.artifactID}):new URLSearchParams({[p2.resourceID]:n.resourceID})}const Pk=200,Dk=300,vc=401,Ok="/events",Lk=4401;class Mk{constructor(t,e){R(this,"serverURL");R(this,"token");R(this,"onUnauthorized");R(this,"telemetryMeta");this.serverURL=t.replace(/\/$/,""),this.token=e.token,this.onUnauthorized=e.onUnauthorized,this.telemetryMeta=e.telemetryMeta}async requestJSON(t,e,r){return this.requestSerializedJSON(t,e,r!==void 0?JSON.stringify(r):void 0)}async requestSerializedJSON(t,e,r){var a;const i=await this.request(t,e,r,r!==void 0?{"content-type":"application/json"}:void 0),s=await Nk(i);if(!i.ok||i.status<Pk||i.status>=Dk)throw i.status===vc&&((a=this.onUnauthorized)==null||a.call(this)),this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(t,e,r){var s;const i=await this.request(t,e,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0);if(!i.ok)throw i.status===vc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Em(i,i.statusText),i.status)}async requestText(t,e){var i;const r=await this.request(t,e);if(!r.ok)throw r.status===vc&&((i=this.onUnauthorized)==null||i.call(this)),this.createError(await Em(r,r.statusText),r.status);return r.text()}async requestRawVoid(t,e,r){var s;const i=await this.request(t,e,r,{"content-type":"text/markdown; charset=utf-8"});if(!i.ok)throw i.status===vc&&((s=this.onUnauthorized)==null||s.call(this)),this.createError(await Em(i,i.statusText),i.status)}webSocketURL(t){const e=new URL(`${this.serverURL}${t}`);return e.protocol=e.protocol==="https:"?"wss:":"ws:",this.token&&e.searchParams.set("token",this.token),e.toString()}unauthorizedError(t){var e;return(e=this.onUnauthorized)==null||e.call(this),this.createError(t,vc)}createError(t,e){const r={serverURL:this.serverURL};return e!==void 0&&(r.status=e),new ec(t,r)}async request(t,e,r,i){const s=`${this.serverURL}${e}`;try{return await fetch(s,{method:t,headers:this.buildHeaders(i),body:r})}catch(a){throw this.createError(a instanceof Error?a.message:"Failed to reach server")}}buildHeaders(t){const e={...t??{}};return this.token&&(e.Authorization=`Bearer ${this.token}`),this.telemetryMeta&&(e[uk]=JSON.stringify(this.telemetryMeta)),Object.keys(e).length>0?e:void 0}}async function Nk(n){try{return await n.json()}catch{const t=await n.text().catch(()=>"");return t?{message:t}:{}}}async function Em(n,t){try{const e=await n.json();if(typeof e.error=="string")return e.error;if(typeof e.message=="string")return e.message}catch{}return t}function zk(n){return n.map(t=>`${t.name} (${t.id})`).join(", ")}var Br,Wd,Z8;class Hk{constructor(t){m(this,Wd);m(this,Br);d(this,Br,t)}list(){return o(this,Br).requestJSON("GET","/channels")}async get(t={}){const e=await h(this,Wd,Z8).call(this,t.channelID);return o(this,Br).requestJSON("GET",`/channels/${encodeURIComponent(e)}`)}create(t){const e={name:t.name};return t.id!==void 0&&(e.id=t.id),o(this,Br).requestJSON("POST","/channels",e)}update(t){const{channelID:e,...r}=t;return o(this,Br).requestJSON("PATCH",`/channels/${encodeURIComponent(e)}`,r)}remove(t){return o(this,Br).requestJSON("DELETE",`/channels/${encodeURIComponent(t.channelID)}`)}}Br=new WeakMap,Wd=new WeakSet,Z8=async function(t){if(t!==void 0)return t;const{channels:e}=await this.list();if(e.length===1)return e[0].id;throw e.length===0?new u2("channelID is required, but no channels exist."):new u2(`channelID is required when multiple channels exist. Available channels: ${zk(e)}`)};var or;class Zk{constructor(t){m(this,or);d(this,or,t)}create(t){const e={kind:t.kind,title:t.title};switch(t.kind){case"path":e.path=t.path;break;case"url":e.url=t.url;break}return e.channelID=t.channelID,t.before!==void 0&&(e.before=t.before),t.after!==void 0&&(e.after=t.after),o(this,or).requestJSON("POST","/artifacts",e)}list(t={}){const e=new URLSearchParams;t.channelID!==void 0&&e.set("channelID",t.channelID);const r=e.toString();return o(this,or).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(t){return o(this,or).requestJSON("GET",`/artifacts/${encodeURIComponent(t.artifactID)}`)}update(t){const e={};return t.title!==void 0&&(e.title=t.title),t.path!==void 0&&(e.path=t.path),t.url!==void 0&&(e.url=t.url),o(this,or).requestJSON("PATCH",`/artifacts/${encodeURIComponent(t.artifactID)}`,e)}delete(t){return o(this,or).requestJSON("DELETE",`/artifacts/${encodeURIComponent(t.artifactID)}`)}move(t){return o(this,or).requestJSON("POST",`/artifacts/${encodeURIComponent(t.artifactID)}/move`,{channelID:t.channelID,...t.before!==void 0?{before:t.before}:{},...t.after!==void 0?{after:t.after}:{}})}}or=new WeakMap;var qa;class Uk{constructor(t){m(this,qa);d(this,qa,t)}list(){return o(this,qa).requestJSON("GET","/themes")}refresh(){return o(this,qa).requestJSON("POST","/themes/refresh")}}qa=new WeakMap;var Va;class Fk{constructor(t){m(this,Va);d(this,Va,t)}get(t){return o(this,Va).requestText("GET",`/markdown/${encodeURIComponent(t.artifactID)}`)}update(t){return o(this,Va).requestRawVoid("PUT",`/markdown/${encodeURIComponent(t.artifactID)}`,t.content)}}Va=new WeakMap;var so;class qk{constructor(t){m(this,so);d(this,so,t)}status(){return o(this,so).requestJSON("GET","/telemetry")}enable(){return o(this,so).requestJSON("POST","/telemetry/enable")}disable(){return o(this,so).requestJSON("POST","/telemetry/disable")}}so=new WeakMap;var oo;class Vk{constructor(t){m(this,oo);d(this,oo,t)}get(){return o(this,oo).requestJSON("GET","/display")}patch(t){const e={};return t.focusedChannelId!==void 0&&(e.focusedChannelId=t.focusedChannelId),t.pinnedChannelIds!==void 0&&(e.pinnedChannelIds=t.pinnedChannelIds),t.activeThemeName!==void 0&&(e.activeThemeName=t.activeThemeName),t.appearanceMode!==void 0&&(e.appearanceMode=t.appearanceMode),t.themeJavaScriptConsentIds!==void 0&&(e.themeJavaScriptConsentIds=t.themeJavaScriptConsentIds),o(this,oo).requestVoid("PATCH","/display",e)}focus(t){return o(this,oo).requestJSON("POST","/display/focus",{artifactID:t.artifactID})}}oo=new WeakMap;function U8(n,t,e){let r=!1,i=()=>{};return{finished:new Promise((a,l)=>{let c=null;i=v=>{r||(r=!0,e==null||e.removeEventListener("abort",u),c==null||c.close(),v?l(v):a())};const u=()=>i();if(e!=null&&e.aborted){i();return}e==null||e.addEventListener("abort",u,{once:!0}),c=new WebSocket(n.webSocketURL(Ok));let f=!1,p=!1;const y=v=>{try{v()}catch(S){i(S instanceof Error?S:new Error(String(S)))}};c.addEventListener("open",()=>{f=!0}),c.addEventListener("message",v=>{if(r)return;p||(p=!0,t.onReady&&y(t.onReady));let S;try{S=JSON.parse(String(v.data))}catch{return}if(r||S.type!=="resource-event"||S.event===void 0)return;const _=S.event;y(()=>t.onEvent(_))}),c.addEventListener("close",v=>{v.code===Lk?i(n.unauthorizedError("Unauthorized")):i(n.createError(f?"The event stream ended.":"Could not open the event stream."))})}),get ended(){return r},end:a=>i(a)}}function Bk(n,t){return!n.exists||!t.exists?n.exists===t.exists:jm(n.value,t.value)}function zh(n){return kk(n),n}var ao,Bi,Sa;class jk{constructor(t){m(this,Bi);m(this,ao);d(this,ao,t)}async create(t){const e={description:t.description};return t.usage!==void 0&&(e.usage=t.usage),t.value!==void 0&&(e.value=zh(t.value)),(await h(this,Bi,Sa).call(this,jt.jsonCreate,e)).resource}get(t){const e=xk(t.store);return e.set("path",t.path),o(this,ao).requestJSON("GET",`${jt.jsonGet}?${e.toString()}`)}async set(t){await h(this,Bi,Sa).call(this,jt.jsonSet,{store:t.store,path:t.path,value:Gm(zh(t.value))})}async update(t){for(const e of Object.keys(t.values))zh(t.values[e]);await h(this,Bi,Sa).call(this,jt.jsonUpdate,{store:t.store,path:t.path,entries:Ck(t.values)})}async push(t){await h(this,Bi,Sa).call(this,jt.jsonPush,{store:t.store,path:t.path,key:t.key,value:Gm(zh(t.value))})}async remove(t){await h(this,Bi,Sa).call(this,jt.jsonRemove,{store:t.store,path:t.path})}watch(t){let e;try{e=h2(t.path)}catch(c){return Promise.reject(c)}let r=null,i=!1,s=!1;const a=()=>{if(i){s=!0;return}i=!0,this.get({store:t.store,path:t.path}).then(c=>{if(i=!1,!l.ended){if(r===null||!Bk(c,r)){r=c;try{t.onValue(c)}catch(u){l.end(u instanceof Error?u:new Error(String(u)));return}}s&&(s=!1,a())}},c=>l.end(c instanceof Error?c:new Error(String(c))))},l=U8(o(this,ao),{onReady:a,onEvent:c=>{const{store:u}=t,f=p=>"artifactID"in u?p.artifactID===u.artifactID:p.resourceID===u.resourceID;if(c.event==="destroyed"&&f(c)){if("resourceID"in u)throw Fl("not-found",`Resource not found: ${u.resourceID}`);a();return}c.event!=="changed"||!f(c)||c.paths.some(p=>Sk(h2(p),e))&&a()}},t.signal);return l.finished}}ao=new WeakMap,Bi=new WeakSet,Sa=function(t,e){const r=JSON.stringify(e);return Rk(r),o(this,ao).requestSerializedJSON("POST",t,r)};var en;class Wk{constructor(t){R(this,"json");m(this,en);d(this,en,t),this.json=new jk(t)}share(t){return o(this,en).requestJSON("POST",jt.share(t.artifactID),t.access===void 0?{}:{access:t.access})}async unshare(t){await o(this,en).requestJSON("POST",jt.unshare(t.artifactID),{})}async list(t={}){const e=t.artifactID===void 0?"":`?${new URLSearchParams({artifact:t.artifactID}).toString()}`;return(await o(this,en).requestJSON("GET",`${jt.list}${e}`)).resources}async info(t){return(await o(this,en).requestJSON("GET",jt.info(t.resourceID))).resource}async describe(t){const e={};return t.description!==void 0&&(e.description=t.description),t.usage!==void 0&&(e.usage=t.usage),(await o(this,en).requestJSON("POST",jt.describe(t.resourceID),e)).resource}destroy(t){return o(this,en).requestJSON("POST",jt.destroy(t.resourceID),t.force===void 0?{}:{force:t.force})}bind(t){return o(this,en).requestJSON("POST",jt.bind(t.resourceID),{artifactID:t.artifactID,access:t.access})}async unbind(t){await o(this,en).requestJSON("POST",jt.unbind(t.resourceID),{artifactID:t.artifactID})}events(t){return U8(o(this,en),{onEvent:t.onEvent},t.signal).finished}}en=new WeakMap;var tn;class Gk{constructor(t,e={}){R(this,"channels");R(this,"artifacts");R(this,"display");R(this,"themes");R(this,"markdown");R(this,"telemetry");R(this,"resources");m(this,tn);d(this,tn,new Mk(t,e)),this.channels=new Hk(o(this,tn)),this.artifacts=new Zk(o(this,tn)),this.display=new Vk(o(this,tn)),this.themes=new Uk(o(this,tn)),this.markdown=new Fk(o(this,tn)),this.telemetry=new qk(o(this,tn)),this.resources=new Wk(o(this,tn))}health(){return o(this,tn).requestJSON("GET","/health")}demoMode(){return o(this,tn).requestJSON("GET","/demo-mode")}}tn=new WeakMap;const $d="0.0.0",Jk=/^\d+\.\d+\.\d+$/,Yk=3;function qf(n){return Jk.test(n)}function Q1(n,t){const e=n.split(".").map(Number),r=t.split(".").map(Number);for(let i=0;i<Yk;i++)if(e[i]!==r[i])return e[i]>r[i];return!1}function Kk(n,t){return n===$d||t===$d?!1:n!==t}const Xk=400,Qk=404,F8=500,eT=600,tT={focusedChannelId:null,pinnedChannelIds:[],activeThemeName:null,activeThemeColorScheme:null,appearanceMode:"system",themeJavaScriptConsentIds:[],acpEnabled:!1};var fe,lu,cu,jr,Ye,Ee,lo,ji,co,Wr,nn,Ba,uu,U,ir,Jm,_a,q8,Ym,V8,ed,Km,B8,Aa,j8,Ur,Xm,W8,et;class nT extends Ri{constructor(e){super();m(this,U);m(this,fe);m(this,lu);m(this,cu);m(this,jr,new Set);R(this,"pendingPageWrites",new Map);m(this,Ye,new Map);m(this,Ee,sT());m(this,lo);m(this,ji,!1);m(this,co,!1);m(this,Wr,0);m(this,nn,!1);m(this,Ba,()=>{if(o(this,nn))return;const e=o(this,fe).connection.status==="connected";e&&!o(this,co)?(d(this,co,!0),h(this,U,j8).call(this)):!e&&o(this,co)&&(d(this,co,!1),d(this,Wr,o(this,Wr)+1)),h(this,U,Ur).call(this)});m(this,uu,e=>{if(o(this,nn))return;for(const i of o(this,jr))i.push(e.event);const r=e.event;if(r.type==="artifact-content-changed"){this.dispatchEvent(new c2("artifact-content-changed",{artifactID:r.artifactID}));return}if(r.type==="artifact-focus"){o(this,ji)&&xd(o(this,Ee),o(this,Ye),r.channelID,r.artifactID)&&h(this,U,Ur).call(this),this.dispatchEvent(new gk("artifact-focus",{channelID:r.channelID,artifactID:r.artifactID}));return}r.type==="theme-changed"&&this.dispatchEvent(new vk("theme-changed",{themeName:r.themeName,activeThemeColorScheme:r.activeThemeColorScheme,themeJavaScriptConsentIds:[...r.themeJavaScriptConsentIds]})),r.type==="appearance-changed"&&this.dispatchEvent(new yk("appearance-changed",{appearanceMode:r.appearanceMode})),o(this,ji)&&(Hh(o(this,Ee),r,this.pendingPageWrites,o(this,Ye)),km(o(this,Ee),o(this,Ye)),h(this,U,Ur).call(this))});d(this,fe,e.connectionOwner),d(this,lu,e.navigationKeyHandler),d(this,cu,e.retainedGateHalted??(()=>!1)),d(this,lo,h(this,U,Xm).call(this)),o(this,fe).addEventListener("change",o(this,Ba)),o(this,fe).addEventListener("server-event",o(this,uu)),o(this,Ba).call(this)}get snapshot(){return o(this,lo)}handleNavigationKey(e){var r;h(this,U,et).call(this),(r=o(this,lu))==null||r.call(this,e)}async createChannel(e){h(this,U,et).call(this);const{channel:r}=await h(this,U,ir).call(this,o(this,fe).connection.client.channels.create({name:e}),()=>h(this,U,q8).call(this));return r}focusChannel(e){return h(this,U,et).call(this),h(this,U,ir).call(this,o(this,fe).connection.client.display.patch({focusedChannelId:e}),()=>h(this,U,_a).call(this))}setPinnedChannelIds(e){return h(this,U,et).call(this),h(this,U,ir).call(this,o(this,fe).connection.client.display.patch({pinnedChannelIds:[...e]}),()=>h(this,U,_a).call(this))}listThemes(){return h(this,U,et).call(this),o(this,fe).connection.client.themes.list()}refreshThemes(){return h(this,U,et).call(this),o(this,fe).connection.client.themes.refresh()}setActiveTheme(e){return h(this,U,et).call(this),h(this,U,ir).call(this,o(this,fe).connection.client.display.patch({activeThemeName:e}),()=>h(this,U,_a).call(this))}setAppearanceMode(e){return h(this,U,et).call(this),h(this,U,ir).call(this,o(this,fe).connection.client.display.patch({appearanceMode:e}),()=>h(this,U,_a).call(this))}setThemeJavaScriptConsent(e,r){h(this,U,et).call(this);const i=o(this,Ee).display.themeJavaScriptConsentIds,s=r?i.includes(e)?[...i]:[...i,e]:i.filter(a=>a!==e);return h(this,U,ir).call(this,o(this,fe).connection.client.display.patch({themeJavaScriptConsentIds:s}),()=>h(this,U,_a).call(this))}selectPage(e,r){h(this,U,et).call(this),xd(o(this,Ee),o(this,Ye),e,r)&&h(this,U,Ur).call(this)}async renameChannel(e,r){h(this,U,et).call(this),await h(this,U,ir).call(this,o(this,fe).connection.client.channels.update({channelID:e,name:r}),()=>h(this,U,Ym).call(this,e))}async deleteChannel(e){h(this,U,et).call(this),await h(this,U,ir).call(this,o(this,fe).connection.client.channels.remove({channelID:e}),()=>h(this,U,V8).call(this,e))}updateChannelPages(e,r){h(this,U,et).call(this);const i=pk(r),s=o(this,Ee).channels.get(e);if(!i.valid||!s)return Promise.resolve();const a=to(r),l=to(s.channel.layout),c={previousPages:l};return na(o(this,Ye),e,l,a),s.channel={...s.channel,layout:a},this.pendingPageWrites.set(e,c),h(this,U,Ur).call(this),o(this,fe).connection.client.channels.update({channelID:e,layout:to(a)}).then(()=>{this.pendingPageWrites.get(e)===c&&this.pendingPageWrites.delete(e)},async u=>{if(o(this,nn))throw u;const f=this.pendingPageWrites.get(e)===c;if(f&&this.pendingPageWrites.delete(e),g2(u))throw await h(this,U,Jm).call(this,()=>h(this,U,Ym).call(this,e)),u;if(!f||!uT(u))throw u;const p=o(this,Ee).channels.get(e);if(!p)throw u;const y=to(c.previousPages);throw na(o(this,Ye),e,p.channel.layout,y),p.channel={...p.channel,layout:y},h(this,U,Ur).call(this),u})}async deleteArtifact(e){h(this,U,et).call(this);const r=v2(o(this,Ee),e);await h(this,U,ir).call(this,o(this,fe).connection.client.artifacts.delete({artifactID:e}),()=>h(this,U,B8).call(this,e,r))}readMarkdown(e){return h(this,U,et).call(this),o(this,fe).connection.client.markdown.get({artifactID:e})}writeMarkdown(e,r){return h(this,U,et).call(this),o(this,fe).connection.client.markdown.update({artifactID:e,content:r})}get browserDemoMode(){return o(this,fe).connection.browserDemoMode}getArtifactViewURL(e){return h(this,U,et).call(this),o(this,fe).connection.getViewURL(e)}getArtifactContentURL(e){return h(this,U,et).call(this),o(this,fe).connection.getContentURL(e)}dispose(){o(this,nn)||(d(this,nn,!0),d(this,Wr,o(this,Wr)+1),o(this,jr).clear(),this.pendingPageWrites.clear(),o(this,Ye).clear(),o(this,fe).removeEventListener("change",o(this,Ba)),o(this,fe).removeEventListener("server-event",o(this,uu)))}}fe=new WeakMap,lu=new WeakMap,cu=new WeakMap,jr=new WeakMap,Ye=new WeakMap,Ee=new WeakMap,lo=new WeakMap,ji=new WeakMap,co=new WeakMap,Wr=new WeakMap,nn=new WeakMap,Ba=new WeakMap,uu=new WeakMap,U=new WeakSet,ir=async function(e,r){try{return await e}catch(i){throw!o(this,nn)&&g2(i)&&await h(this,U,Jm).call(this,r),i}},Jm=async function(e){try{await e()}catch{}},_a=function(){const e=o(this,fe).connection.client;return h(this,U,Aa).call(this,()=>e.display.get(),r=>h(this,U,ed).call(this,r))},q8=function(){const e=o(this,fe).connection.client;return h(this,U,Aa).call(this,async()=>{const[{channels:r},i]=await Promise.all([e.channels.list(),e.display.get()]);return{channels:r,display:i}},({channels:r,display:i})=>{const s=new Set(r.map(({id:a})=>a));for(const a of o(this,Ee).channels.keys())s.has(a)||(this.pendingPageWrites.delete(a),o(this,Ye).delete(a),o(this,Ee).channels.delete(a));for(const a of r)o(this,Ee).channels.has(a.id)||o(this,Ee).channels.set(a.id,{channel:Za(a),artifacts:new Map});h(this,U,ed).call(this,i)})},Ym=function(e){const r=o(this,fe).connection.client;return h(this,U,Aa).call(this,()=>Tm(()=>r.channels.get({channelID:e})),i=>h(this,U,Km).call(this,e,i))},V8=function(e){const r=o(this,fe).connection.client;return h(this,U,Aa).call(this,async()=>{const[i,s]=await Promise.all([Tm(()=>r.channels.get({channelID:e})),r.display.get()]);return{detail:i,display:s}},({detail:i,display:s})=>{h(this,U,Km).call(this,e,i),h(this,U,ed).call(this,s)})},ed=function(e){o(this,Ee).display=eg(e),o(this,fe).connection.acpClient.setEnabled(e.acpEnabled)},Km=function(e,r){this.pendingPageWrites.delete(e);const i=o(this,Ee).channels.get(e);if(r===null){o(this,Ye).delete(e),o(this,Ee).channels.delete(e);return}na(o(this,Ye),e,(i==null?void 0:i.channel.layout)??[],r.channel.layout),o(this,Ee).channels.set(e,{channel:Za(r.channel),artifacts:new Map(r.artifacts.map(s=>[s.id,structuredClone(s)]))})},B8=function(e,r){const i=o(this,fe).connection.client;return h(this,U,Aa).call(this,()=>Tm(()=>i.artifacts.get({artifactID:e})),s=>{const a=v2(o(this,Ee),e)??r;if(s===null){a!==null&&Hh(o(this,Ee),{type:"artifact-removed",channelID:a,artifactID:e},this.pendingPageWrites,o(this,Ye));return}const l=a===null?void 0:o(this,Ee).channels.get(a);l==null||l.artifacts.set(e,structuredClone(s.artifact))})},Aa=async function(e,r){const i=o(this,Wr),s=[];o(this,jr).add(s);try{const a=await e();if(o(this,nn)||i!==o(this,Wr))return;r(a);for(const l of s)Hh(o(this,Ee),l,this.pendingPageWrites,o(this,Ye));km(o(this,Ee),o(this,Ye)),h(this,U,Ur).call(this)}finally{o(this,jr).delete(s)}},j8=async function(){const e=++Mh(this,Wr)._,r=o(this,fe).connection,i=r.client,s=[];o(this,jr).add(s);try{const[{channels:a},l]=await Promise.all([i.channels.list(),i.display.get()]),c=await Promise.all(a.map(({id:p})=>i.channels.get({channelID:p})));if(o(this,nn)||e!==o(this,Wr))return;const u={channels:new Map,display:eg(l)};for(const p of c)u.channels.set(p.channel.id,{channel:Za(p.channel),artifacts:new Map(p.artifacts.map(y=>[y.id,structuredClone(y)]))});oT(o(this,Ye),o(this,Ee),u);for(const p of s)Hh(u,p,this.pendingPageWrites,o(this,Ye));km(u,o(this,Ye));const f=o(this,ji)?rT(o(this,Ee),u):[];this.pendingPageWrites.clear(),d(this,Ee,u),d(this,ji,!0),r.acpClient.setEnabled(l.acpEnabled),h(this,U,Ur).call(this);for(const p of f)this.dispatchEvent(new c2("artifact-content-changed",{artifactID:p}))}catch{}finally{o(this,jr).delete(s)}},Ur=function(){o(this,nn)||(d(this,lo,h(this,U,Xm).call(this)),h(this,U,W8).call(this),this.dispatchEvent(new Wt("change")))},Xm=function(){var s;const e=[...o(this,Ee).channels.values()].map(a=>lT(a,o(this,Ye).get(a.channel.id))),r=e.find(({id:a})=>a===o(this,Ee).display.focusedChannelId)??null,i=o(this,fe).connection;return Object.freeze({ready:o(this,ji),channels:Object.freeze(e),display:cT(o(this,Ee).display),focusedChannel:r,connection:Object.freeze({authorizationRequired:i.hasAuthRejected,gateHalted:i.bootState==="halted"||o(this,cu).call(this),status:i.status,hasEverConnected:i.hasEverConnected,failedReconnectAttempts:i.failedReconnectAttempts,firstConnectError:i.hasEverConnected?null:o(this,fe).connectError,nextRetryAt:i.nextRetryAt,upgradeInstructions:iT(((s=i.updateState)==null?void 0:s.desktop)??null)})})},W8=function(){const e=o(this,lo).focusedChannel;o(this,fe).connection.acpClient.setChannelContext(e?{channelID:e.id,channelName:e.name}:null)},et=function(){if(o(this,nn))throw new Error("ApplicationService is disposed")};function rT(n,t){const e=t.display.focusedChannelId;if(e===null||n.display.focusedChannelId!==e)return[];const r=n.channels.get(e),i=t.channels.get(e);if(!r||!i)return[];const s=new Set(Qc(r.channel.layout));return Qc(i.channel.layout).filter(a=>{var l,c;return s.has(a)&&((l=r.artifacts.get(a))==null?void 0:l.kind)==="path"&&((c=i.artifacts.get(a))==null?void 0:c.kind)==="path"})}function iT(n){return n===null?null:Object.freeze({...n})}function sT(){return{channels:new Map,display:eg(tT)}}function Hh(n,t,e,r){switch(t.type){case"channel-created":r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:Za(t.channel),artifacts:new Map});return;case"channel-updated":{e.delete(t.channel.id);const i=n.channels.get(t.channel.id);if(!i){r.delete(t.channel.id),n.channels.set(t.channel.id,{channel:Za(t.channel),artifacts:new Map});return}na(r,t.channel.id,i.channel.layout,t.channel.layout);const s=new Set(Qc(t.channel.layout));i.channel=Za(t.channel);for(const a of i.artifacts.keys())s.has(a)||i.artifacts.delete(a);return}case"channel-removed":e.delete(t.channelID),r.delete(t.channelID),n.channels.delete(t.channelID);return;case"channel-changed":n.display.focusedChannelId=t.channelID;return;case"pinned-channels-changed":n.display.pinnedChannelIds=[...t.pinnedChannelIds];return;case"theme-changed":n.display.activeThemeName=t.themeName,n.display.activeThemeColorScheme=t.activeThemeColorScheme,n.display.themeJavaScriptConsentIds=[...t.themeJavaScriptConsentIds];return;case"appearance-changed":n.display.appearanceMode=t.appearanceMode;return;case"artifact-created":{const i=n.channels.get(t.channelID);if(!i)return;const s=e.get(t.channelID);if(s&&(s.previousPages=m2(s.previousPages,t.artifact.id)),!Qc(i.channel.layout).includes(t.artifact.id)){const a=i.channel.layout,l=m2(a,t.artifact.id);na(r,t.channelID,a,l),i.channel={...i.channel,layout:l}}i.artifacts.set(t.artifact.id,structuredClone(t.artifact));return}case"artifact-updated":for(const i of n.channels.values())if(i.artifacts.has(t.artifact.id)){i.artifacts.set(t.artifact.id,structuredClone(t.artifact));return}return;case"artifact-removed":{const i=n.channels.get(t.channelID);if(!i)return;const s=e.get(t.channelID);s&&(s.previousPages=Bm(s.previousPages,t.artifactID)),i.artifacts.delete(t.artifactID);const a=i.channel.layout,l=Bm(a,t.artifactID);na(r,t.channelID,a,l),i.channel={...i.channel,layout:l};return}case"artifact-focus":xd(n,r,t.channelID,t.artifactID);return;case"artifact-content-changed":return;default:return hT(t)}}function oT(n,t,e){var r;for(const i of n.keys())e.channels.has(i)||n.delete(i);for(const[i,s]of e.channels)na(n,i,((r=t.channels.get(i))==null?void 0:r.channel.layout)??[],s.channel.layout)}function na(n,t,e,r){const i=n.get(t);if(i===void 0)return;if(r.length===0){n.delete(t);return}const s=Qm(r,i);if(s!==-1){n.set(t,[...r[s].artifactIds]);return}const a=Qm(e,i),l=a===-1?0:Math.min(a,r.length-1);n.set(t,[...r[l].artifactIds])}function xd(n,t,e,r){const i=n.channels.get(e),s=i==null?void 0:i.channel.layout.find(({artifactIds:l})=>l.includes(r));if(!s)return!1;const a=t.get(e);return a&&aT(a,s.artifactIds)?!1:(t.set(e,[...s.artifactIds]),!0)}function km(n,t){var i,s;const e=n.display.focusedChannelId;if(e===null||t.has(e))return;const r=(s=(i=n.channels.get(e))==null?void 0:i.channel.layout[0])==null?void 0:s.artifactIds[0];r!==void 0&&xd(n,t,e,r)}function Qm(n,t){const e=new Set(t);return n.findIndex(r=>r.artifactIds.some(i=>e.has(i)))}function aT(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function lT(n,t){const e=Object.freeze(n.channel.layout.map(l=>Object.freeze({artifactIds:Object.freeze([...l.artifactIds]),geometry:Object.freeze({...l.geometry}),size:Object.freeze({...l.size})}))),r=t===void 0?0:Qm(n.channel.layout,t),i=e[r]??e[0]??null,s=Object.freeze([...n.artifacts.values()].map(l=>Object.freeze(structuredClone(l)))),a={id:n.channel.id,name:n.channel.name,pages:e,selectedPage:i,artifacts:s};return Object.freeze(n.channel.onboarding?{...a,onboarding:Object.freeze({...n.channel.onboarding})}:a)}function cT(n){return Object.freeze({focusedChannelId:n.focusedChannelId,pinnedChannelIds:Object.freeze([...n.pinnedChannelIds]),activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:Object.freeze([...n.themeJavaScriptConsentIds]),acpEnabled:n.acpEnabled})}function m2(n,t){return Qc(n).includes(t)?to(n):[...to(n),{artifactIds:[t],geometry:{...D8},size:{...O8}}]}function uT(n){return n instanceof ec&&n.status!==void 0&&n.status>=Xk&&n.status<F8}function g2(n){return n instanceof ec&&(n.status===void 0||n.status>=F8&&n.status<eT)}async function Tm(n){try{return await n()}catch(t){if(t instanceof ec&&t.status===Qk)return null;throw t}}function v2(n,t){for(const[e,r]of n.channels)if(r.artifacts.has(t))return e;return null}function to(n){return n.map(t=>({artifactIds:[...t.artifactIds],geometry:{...t.geometry},size:{...t.size}}))}function Za(n){return{id:n.id,name:n.name,layout:to(n.layout),...n.onboarding?{onboarding:{...n.onboarding}}:{}}}function eg(n){return{focusedChannelId:n.focusedChannelId,pinnedChannelIds:[...n.pinnedChannelIds],activeThemeName:n.activeThemeName,activeThemeColorScheme:n.activeThemeColorScheme,appearanceMode:n.appearanceMode,themeJavaScriptConsentIds:[...n.themeJavaScriptConsentIds],acpEnabled:n.acpEnabled}}function hT(n){throw new Error(`Unexpected server event: ${JSON.stringify(n)}`)}function dT(n,t){var c;const e=n.snapshot,r=e.focusedChannel;if(t==="ArrowLeft"||t==="ArrowRight"){if(r===null||r.selectedPage===null)return!1;const u=r.pages.indexOf(r.selectedPage),f=u+(t==="ArrowLeft"?-1:1),p=(c=r.pages[f])==null?void 0:c.artifactIds[0];return u===-1||p===void 0?!1:(y2(),n.selectPage(r.id,p),!0)}const i=fT(e),s=r===null?-1:i.indexOf(r.id),a=s+(t==="ArrowUp"?-1:1),l=i[a];return s===-1||l===void 0?!1:(y2(),n.focusChannel(l).catch(()=>{}),!0)}function fT(n){const t=new Map(n.channels.map(s=>[s.id,s])),e=n.display.pinnedChannelIds.filter(s=>t.has(s)),r=new Set(e),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,a)=>a.localeCompare(s));return[...e,...i]}function y2(){const n=document.activeElement;n instanceof HTMLElement&&n.blur()}const G8="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Pd=32,pT=16,J8=10,w2=0xffffffffffff;var no;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(no||(no={}));class Ic extends Error{constructor(t,e){super(`${e} (${t})`),this.name="ULIDError",this.code=t}}function mT(n){const t=Math.floor(n()*Pd)%Pd;return G8.charAt(t)}function gT(n){const t=vT(),e=t&&(t.crypto||t.msCrypto)||null;if(typeof(e==null?void 0:e.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]/256};if(typeof(e==null?void 0:e.randomBytes)=="function")return()=>e.randomBytes(1).readUInt8()/256;throw new Ic(no.PRNGDetectFailure,"Failed to find a reliable PRNG")}function vT(){return bT()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function yT(n,t){let e="";for(;n>0;n--)e=mT(t)+e;return e}function wT(n,t=J8){if(isNaN(n))throw new Ic(no.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>w2)throw new Ic(no.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${w2}: ${n}`);if(n<0)throw new Ic(no.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Ic(no.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let e,r="";for(let i=t;i>0;i--)e=n%Pd,r=G8.charAt(e)+r,n=(n-e)/Pd;return r}function bT(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function ev(n,t){const e=gT(),r=Date.now();return wT(r,J8)+yT(pT,e)}const $c=$n(),Y8=$n(),K8=$n(),ST=$n(),Cm=$n(),_T="store-";function aa(n){return new URL(n).origin}function AT(){return{authTokens:{}}}var uo,ho,fo;class ET extends Ri{constructor(e,r,i={}){super();m(this,uo);m(this,ho);m(this,fo);d(this,uo,`${_T}${e}`),d(this,ho,i.storage??CT());const s=o(this,ho).getItem(o(this,uo));s===null?(d(this,fo,r),o(this,ho).setItem(o(this,uo),JSON.stringify(r))):d(this,fo,RT(JSON.parse(s),r))}get(){return o(this,fo)}set(e){d(this,fo,e),o(this,ho).setItem(o(this,uo),JSON.stringify(e)),this.dispatchEvent(new Wt("change"))}}uo=new WeakMap,ho=new WeakMap,fo=new WeakMap;function b2(n,t){return n.authTokens[aa(t)]??null}function kT(n,t,e){return{authTokens:{...n.authTokens,[aa(t)]:e}}}function TT(n,t){const e=aa(t);if(!(e in n.authTokens))return n;const r={...n.authTokens};return delete r[e],{authTokens:r}}function CT(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function RT(n,t){if(typeof n!="object"||n===null||Array.isArray(n))return t;const e=n.authTokens;if(typeof e!="object"||e===null||Array.isArray(e))return t;const r={};for(const[i,s]of Object.entries(e))if(typeof s=="string")try{r[aa(i)]=s}catch{}return{authTokens:r}}function $(n,t,e){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(n))return;l._zod.traits.add(n),t(l,c);const u=a.prototype,f=Object.keys(u);for(let p=0;p<f.length;p++){const y=f[p];y in l||(l[y]=u[y].bind(l))}}const i=(e==null?void 0:e.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function a(l){var c;const u=e!=null&&e.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var c,u;return e!=null&&e.Parent&&l instanceof e.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(n)}}),Object.defineProperty(a,"name",{value:n}),a}class Ua extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class X8 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Q8={};function Rs(n){return Q8}function e6(n){const t=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function tg(n,t){return typeof t=="bigint"?t.toString():t}function Vf(n){return{get value(){{const t=n();return Object.defineProperty(this,"value",{value:t}),t}}}}function tv(n){return n==null}function nv(n){const t=n.startsWith("^")?1:0,e=n.endsWith("$")?n.length-1:n.length;return n.slice(t,e)}function IT(n,t){const e=(n.toString().split(".")[1]||"").length,r=t.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c!=null&&c[1]&&(i=Number.parseInt(c[1]))}const s=e>i?e:i,a=Number.parseInt(n.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return a%l/10**s}const S2=Symbol("evaluating");function ke(n,t,e){let r;Object.defineProperty(n,t,{get(){if(r!==S2)return r===void 0&&(r=S2,r=e()),r},set(i){Object.defineProperty(n,t,{value:i})},configurable:!0})}function la(n,t,e){Object.defineProperty(n,t,{value:e,writable:!0,enumerable:!0,configurable:!0})}function Ds(...n){const t={};for(const e of n){const r=Object.getOwnPropertyDescriptors(e);Object.assign(t,r)}return Object.defineProperties({},t)}function _2(n){return JSON.stringify(n)}function $T(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const t6="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function tu(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const xT=Vf(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ql(n){if(tu(n)===!1)return!1;const t=n.constructor;if(t===void 0||typeof t!="function")return!0;const e=t.prototype;return!(tu(e)===!1||Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")===!1)}function n6(n){return ql(n)?{...n}:Array.isArray(n)?[...n]:n}const PT=new Set(["string","number","symbol"]);function Vl(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Os(n,t,e){const r=new n._zod.constr(t??n._zod.def);return(!t||e!=null&&e.parent)&&(r._zod.parent=n),r}function J(n){const t=n;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function DT(n){return Object.keys(n).filter(t=>n[t]._zod.optin==="optional"&&n[t]._zod.optout==="optional")}const OT={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 LT(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Ds(n._zod.def,{get shape(){const a={};for(const l in t){if(!(l in e.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=e.shape[l])}return la(this,"shape",a),a},checks:[]});return Os(n,s)}function MT(n,t){const e=n._zod.def,r=e.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Ds(n._zod.def,{get shape(){const a={...n._zod.def.shape};for(const l in t){if(!(l in e.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return la(this,"shape",a),a},checks:[]});return Os(n,s)}function NT(n,t){if(!ql(t))throw new Error("Invalid input to extend: expected a plain object");const e=n._zod.def.checks;if(e&&e.length>0){const s=n._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Ds(n._zod.def,{get shape(){const s={...n._zod.def.shape,...t};return la(this,"shape",s),s}});return Os(n,i)}function zT(n,t){if(!ql(t))throw new Error("Invalid input to safeExtend: expected a plain object");const e=Ds(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t};return la(this,"shape",r),r}});return Os(n,e)}function HT(n,t){const e=Ds(n._zod.def,{get shape(){const r={...n._zod.def.shape,...t._zod.def.shape};return la(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Os(n,e)}function ZT(n,t,e){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Ds(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(e)for(const u in e){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(c[u]=n?new n({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=n?new n({type:"optional",innerType:l[u]}):l[u];return la(this,"shape",c),c},checks:[]});return Os(t,a)}function UT(n,t,e){const r=Ds(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(e)for(const a in e){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=new n({type:"nonoptional",innerType:i[a]}))}else for(const a in i)s[a]=new n({type:"nonoptional",innerType:i[a]});return la(this,"shape",s),s}});return Os(t,r)}function Na(n,t=0){var e;if(n.aborted===!0)return!0;for(let r=t;r<n.issues.length;r++)if(((e=n.issues[r])==null?void 0:e.continue)!==!0)return!0;return!1}function za(n,t){return t.map(e=>{var r;return(r=e).path??(r.path=[]),e.path.unshift(n),e})}function Zh(n){return typeof n=="string"?n:n==null?void 0:n.message}function Is(n,t,e){var i,s,a,l,c,u;const r={...n,path:n.path??[]};if(!n.message){const f=Zh((a=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,n))??Zh((l=t==null?void 0:t.error)==null?void 0:l.call(t,n))??Zh((c=e.customError)==null?void 0:c.call(e,n))??Zh((u=e.localeError)==null?void 0:u.call(e,n))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function rv(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function nu(...n){const[t,e,r]=n;return typeof t=="string"?{message:t,code:"custom",input:e,inst:r}:{...t}}const r6=(n,t)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:t,enumerable:!1}),n.message=JSON.stringify(t,tg,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},i6=$("$ZodError",r6),s6=$("$ZodError",r6,{Parent:Error});function FT(n,t=e=>e.message){const e={},r=[];for(const i of n.issues)i.path.length>0?(e[i.path[0]]=e[i.path[0]]||[],e[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:e}}function qT(n,t=e=>e.message){const e={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)e._errors.push(t(s));else{let a=e,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(n),e}const iv=n=>(t,e,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:e,issues:[]},s);if(a instanceof Promise)throw new Ua;if(a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>Is(c,s,Rs())));throw t6(l,i==null?void 0:i.callee),l}return a.value},sv=n=>async(t,e,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:e,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new((i==null?void 0:i.Err)??n)(a.issues.map(c=>Is(c,s,Rs())));throw t6(l,i==null?void 0:i.callee),l}return a.value},Bf=n=>(t,e,r)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:e,issues:[]},i);if(s instanceof Promise)throw new Ua;return s.issues.length?{success:!1,error:new(n??i6)(s.issues.map(a=>Is(a,i,Rs())))}:{success:!0,data:s.value}},VT=Bf(s6),jf=n=>async(t,e,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:e,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(a=>Is(a,i,Rs())))}:{success:!0,data:s.value}},BT=jf(s6),jT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return iv(n)(t,e,i)},WT=n=>(t,e,r)=>iv(n)(t,e,r),GT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return sv(n)(t,e,i)},JT=n=>async(t,e,r)=>sv(n)(t,e,r),YT=n=>(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bf(n)(t,e,i)},KT=n=>(t,e,r)=>Bf(n)(t,e,r),XT=n=>async(t,e,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jf(n)(t,e,i)},QT=n=>async(t,e,r)=>jf(n)(t,e,r),eC=/^[cC][^\s-]{8,}$/,tC=/^[0-9a-z]+$/,nC=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rC=/^[0-9a-vA-V]{20}$/,iC=/^[A-Za-z0-9]{27}$/,sC=/^[a-zA-Z0-9_-]{21}$/,oC=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,aC=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,A2=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,lC=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uC(){return new RegExp(cC,"u")}const hC=/^(?:(?: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])$/,dC=/^(([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}|:))$/,fC=/^((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])$/,pC=/^(([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])$/,mC=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,o6=/^[A-Za-z0-9_-]*$/,gC=/^\+[1-9]\d{6,14}$/,a6="(?:(?:\\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])))",vC=new RegExp(`^${a6}$`);function l6(n){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${t}`:n.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${n.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yC(n){return new RegExp(`^${l6(n)}$`)}function wC(n){const t=l6({precision:n.precision}),e=["Z"];n.local&&e.push(""),n.offset&&e.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${e.join("|")})`;return new RegExp(`^${a6}T(?:${r})$`)}const bC=n=>{const t=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},SC=/^-?\d+$/,c6=/^-?\d+(?:\.\d+)?$/,_C=/^(?:true|false)$/i,AC=/^[^A-Z]*$/,EC=/^[^a-z]*$/,Jt=$("$ZodCheck",(n,t)=>{var e;n._zod??(n._zod={}),n._zod.def=t,(e=n._zod).onattach??(e.onattach=[])}),u6={number:"number",bigint:"bigint",object:"date"},h6=$("$ZodCheckLessThan",(n,t)=>{Jt.init(n,t);const e=u6[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:e,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),d6=$("$ZodCheckGreaterThan",(n,t)=>{Jt.init(n,t);const e=u6[typeof t.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),n._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:e,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:n,continue:!t.abort})}}),kC=$("$ZodCheckMultipleOf",(n,t)=>{Jt.init(n,t),n._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),n._zod.check=e=>{if(typeof e.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof e.value=="bigint"?e.value%t.value===BigInt(0):IT(e.value,t.value)===0)||e.issues.push({origin:typeof e.value,code:"not_multiple_of",divisor:t.value,input:e.value,inst:n,continue:!t.abort})}}),TC=$("$ZodCheckNumberFormat",(n,t)=>{var a;Jt.init(n,t),t.format=t.format||"float64";const e=(a=t.format)==null?void 0:a.includes("int"),r=e?"int":"number",[i,s]=OT[t.format];n._zod.onattach.push(l=>{const c=l._zod.bag;c.format=t.format,c.minimum=i,c.maximum=s,e&&(c.pattern=SC)}),n._zod.check=l=>{const c=l.value;if(e){if(!Number.isInteger(c)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:n});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!t.abort});return}}c<i&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!t.abort}),c>s&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!t.abort})}}),CC=$("$ZodCheckMaxLength",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!tv(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const a=rv(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),RC=$("$ZodCheckMinLength",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!tv(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const a=rv(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:n,continue:!t.abort})}}),IC=$("$ZodCheckLengthEquals",(n,t)=>{var e;Jt.init(n,t),(e=n._zod.def).when??(e.when=r=>{const i=r.value;return!tv(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===t.length)return;const a=rv(i),l=s>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!t.abort})}}),Wf=$("$ZodCheckStringFormat",(n,t)=>{var e,r;Jt.init(n,t),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(e=n._zod).check??(e.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:n,continue:!t.abort})}):(r=n._zod).check??(r.check=()=>{})}),$C=$("$ZodCheckRegex",(n,t)=>{Wf.init(n,t),n._zod.check=e=>{t.pattern.lastIndex=0,!t.pattern.test(e.value)&&e.issues.push({origin:"string",code:"invalid_format",format:"regex",input:e.value,pattern:t.pattern.toString(),inst:n,continue:!t.abort})}}),xC=$("$ZodCheckLowerCase",(n,t)=>{t.pattern??(t.pattern=AC),Wf.init(n,t)}),PC=$("$ZodCheckUpperCase",(n,t)=>{t.pattern??(t.pattern=EC),Wf.init(n,t)}),DC=$("$ZodCheckIncludes",(n,t)=>{Jt.init(n,t);const e=Vl(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${e}`:e);t.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:n,continue:!t.abort})}}),OC=$("$ZodCheckStartsWith",(n,t)=>{Jt.init(n,t);const e=new RegExp(`^${Vl(t.prefix)}.*`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:n,continue:!t.abort})}}),LC=$("$ZodCheckEndsWith",(n,t)=>{Jt.init(n,t);const e=new RegExp(`.*${Vl(t.suffix)}$`);t.pattern??(t.pattern=e),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(e)}),n._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:n,continue:!t.abort})}}),MC=$("$ZodCheckOverwrite",(n,t)=>{Jt.init(n,t),n._zod.check=e=>{e.value=t.tx(e.value)}});class NC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
27
- `).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,e=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...e,i.join(`
28
- `))}}const zC={major:4,minor:3,patch:6},Fe=$("$ZodType",(n,t)=>{var i;var e;n??(n={}),n._zod.def=t,n._zod.bag=n._zod.bag||{},n._zod.version=zC;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const a of s._zod.onattach)a(n);if(r.length===0)(e=n._zod).deferred??(e.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(l,c,u)=>{let f=Na(l),p;for(const y of c){if(y._zod.def.when){if(!y._zod.def.when(l))continue}else if(f)continue;const v=l.issues.length,S=y._zod.check(l);if(S instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ua;if(p||S instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await S,l.issues.length!==v&&(f||(f=Na(l,v)))});else{if(l.issues.length===v)continue;f||(f=Na(l,v))}}return p?p.then(()=>l):l},a=(l,c,u)=>{if(Na(l))return l.aborted=!0,l;const f=s(c,r,u);if(f instanceof Promise){if(u.async===!1)throw new Ua;return f.then(p=>n._zod.parse(p,u))}return n._zod.parse(f,u)};n._zod.run=(l,c)=>{if(c.skipChecks)return n._zod.parse(l,c);if(c.direction==="backward"){const f=n._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return f instanceof Promise?f.then(p=>a(p,l,c)):a(f,l,c)}const u=n._zod.parse(l,c);if(u instanceof Promise){if(c.async===!1)throw new Ua;return u.then(f=>s(f,r,c))}return s(u,r,c)}}ke(n,"~standard",()=>({validate:s=>{var a;try{const l=VT(n,s);return l.success?{value:l.data}:{issues:(a=l.error)==null?void 0:a.issues}}catch{return BT(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}))}),ov=$("$ZodString",(n,t)=>{var e;Fe.init(n,t),n._zod.pattern=[...((e=n==null?void 0:n._zod.bag)==null?void 0:e.patterns)??[]].pop()??bC(n._zod.bag),n._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),ze=$("$ZodStringFormat",(n,t)=>{Wf.init(n,t),ov.init(n,t)}),HC=$("$ZodGUID",(n,t)=>{t.pattern??(t.pattern=aC),ze.init(n,t)}),ZC=$("$ZodUUID",(n,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=A2(r))}else t.pattern??(t.pattern=A2());ze.init(n,t)}),UC=$("$ZodEmail",(n,t)=>{t.pattern??(t.pattern=lC),ze.init(n,t)}),FC=$("$ZodURL",(n,t)=>{ze.init(n,t),n._zod.check=e=>{try{const r=e.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:e.value,inst:n,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||e.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:e.value,inst:n,continue:!t.abort})),t.normalize?e.value=i.href:e.value=r;return}catch{e.issues.push({code:"invalid_format",format:"url",input:e.value,inst:n,continue:!t.abort})}}}),qC=$("$ZodEmoji",(n,t)=>{t.pattern??(t.pattern=uC()),ze.init(n,t)}),VC=$("$ZodNanoID",(n,t)=>{t.pattern??(t.pattern=sC),ze.init(n,t)}),BC=$("$ZodCUID",(n,t)=>{t.pattern??(t.pattern=eC),ze.init(n,t)}),jC=$("$ZodCUID2",(n,t)=>{t.pattern??(t.pattern=tC),ze.init(n,t)}),WC=$("$ZodULID",(n,t)=>{t.pattern??(t.pattern=nC),ze.init(n,t)}),GC=$("$ZodXID",(n,t)=>{t.pattern??(t.pattern=rC),ze.init(n,t)}),JC=$("$ZodKSUID",(n,t)=>{t.pattern??(t.pattern=iC),ze.init(n,t)}),YC=$("$ZodISODateTime",(n,t)=>{t.pattern??(t.pattern=wC(t)),ze.init(n,t)}),KC=$("$ZodISODate",(n,t)=>{t.pattern??(t.pattern=vC),ze.init(n,t)}),XC=$("$ZodISOTime",(n,t)=>{t.pattern??(t.pattern=yC(t)),ze.init(n,t)}),QC=$("$ZodISODuration",(n,t)=>{t.pattern??(t.pattern=oC),ze.init(n,t)}),eR=$("$ZodIPv4",(n,t)=>{t.pattern??(t.pattern=hC),ze.init(n,t),n._zod.bag.format="ipv4"}),tR=$("$ZodIPv6",(n,t)=>{t.pattern??(t.pattern=dC),ze.init(n,t),n._zod.bag.format="ipv6",n._zod.check=e=>{try{new URL(`http://[${e.value}]`)}catch{e.issues.push({code:"invalid_format",format:"ipv6",input:e.value,inst:n,continue:!t.abort})}}}),nR=$("$ZodCIDRv4",(n,t)=>{t.pattern??(t.pattern=fC),ze.init(n,t)}),rR=$("$ZodCIDRv6",(n,t)=>{t.pattern??(t.pattern=pC),ze.init(n,t),n._zod.check=e=>{const r=e.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{e.issues.push({code:"invalid_format",format:"cidrv6",input:e.value,inst:n,continue:!t.abort})}}});function f6(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const iR=$("$ZodBase64",(n,t)=>{t.pattern??(t.pattern=mC),ze.init(n,t),n._zod.bag.contentEncoding="base64",n._zod.check=e=>{f6(e.value)||e.issues.push({code:"invalid_format",format:"base64",input:e.value,inst:n,continue:!t.abort})}});function sR(n){if(!o6.test(n))return!1;const t=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),e=t.padEnd(Math.ceil(t.length/4)*4,"=");return f6(e)}const oR=$("$ZodBase64URL",(n,t)=>{t.pattern??(t.pattern=o6),ze.init(n,t),n._zod.bag.contentEncoding="base64url",n._zod.check=e=>{sR(e.value)||e.issues.push({code:"invalid_format",format:"base64url",input:e.value,inst:n,continue:!t.abort})}}),aR=$("$ZodE164",(n,t)=>{t.pattern??(t.pattern=gC),ze.init(n,t)});function lR(n,t=null){try{const e=n.split(".");if(e.length!==3)return!1;const[r]=e;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const cR=$("$ZodJWT",(n,t)=>{ze.init(n,t),n._zod.check=e=>{lR(e.value,t.alg)||e.issues.push({code:"invalid_format",format:"jwt",input:e.value,inst:n,continue:!t.abort})}}),p6=$("$ZodNumber",(n,t)=>{Fe.init(n,t),n._zod.pattern=n._zod.bag.pattern??c6,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=Number(e.value)}catch{}const i=e.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return e;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return e.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),e}}),uR=$("$ZodNumberFormat",(n,t)=>{TC.init(n,t),p6.init(n,t)}),hR=$("$ZodBoolean",(n,t)=>{Fe.init(n,t),n._zod.pattern=_C,n._zod.parse=(e,r)=>{if(t.coerce)try{e.value=!!e.value}catch{}const i=e.value;return typeof i=="boolean"||e.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),e}}),dR=$("$ZodUnknown",(n,t)=>{Fe.init(n,t),n._zod.parse=e=>e}),fR=$("$ZodNever",(n,t)=>{Fe.init(n,t),n._zod.parse=(e,r)=>(e.issues.push({expected:"never",code:"invalid_type",input:e.value,inst:n}),e)});function E2(n,t,e){n.issues.length&&t.issues.push(...za(e,n.issues)),t.value[e]=n.value}const pR=$("$ZodArray",(n,t)=>{Fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!Array.isArray(i))return e.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),e;e.value=Array(i.length);const s=[];for(let a=0;a<i.length;a++){const l=i[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>E2(u,e,a))):E2(c,e,a)}return s.length?Promise.all(s).then(()=>e):e}});function Dd(n,t,e,r,i){if(n.issues.length){if(i&&!(e in r))return;t.issues.push(...za(e,n.issues))}n.value===void 0?e in r&&(t.value[e]=void 0):t.value[e]=n.value}function m6(n){var r,i,s,a;const t=Object.keys(n.shape);for(const l of t)if(!((a=(s=(i=(r=n.shape)==null?void 0:r[l])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const e=DT(n.shape);return{...n,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(e)}}function g6(n,t,e,r,i,s){const a=[],l=i.keySet,c=i.catchall._zod,u=c.def.type,f=c.optout==="optional";for(const p in t){if(l.has(p))continue;if(u==="never"){a.push(p);continue}const y=c.run({value:t[p],issues:[]},r);y instanceof Promise?n.push(y.then(v=>Dd(v,e,p,t,f))):Dd(y,e,p,t,f)}return a.length&&e.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),n.length?Promise.all(n).then(()=>e):e}const mR=$("$ZodObject",(n,t)=>{Fe.init(n,t);const e=Object.getOwnPropertyDescriptor(t,"shape");if(!(e!=null&&e.get)){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Vf(()=>m6(t));ke(n._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const f=l[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(const p of f.values)c[u].add(p)}}return c});const i=tu,s=t.catchall;let a;n._zod.parse=(l,c)=>{a??(a=r.value);const u=l.value;if(!i(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),l;l.value={};const f=[],p=a.shape;for(const y of a.keys){const v=p[y],S=v._zod.optout==="optional",_=v._zod.run({value:u[y],issues:[]},c);_ instanceof Promise?f.push(_.then(I=>Dd(I,l,y,u,S))):Dd(_,l,y,u,S)}return s?g6(f,u,l,c,r.value,n):f.length?Promise.all(f).then(()=>l):l}}),gR=$("$ZodObjectJIT",(n,t)=>{mR.init(n,t);const e=n._zod.parse,r=Vf(()=>m6(t)),i=y=>{var z;const v=new NC(["shape","payload","ctx"]),S=r.value,_=P=>{const V=_2(P);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};v.write("const input = payload.value;");const I=Object.create(null);let Z=0;for(const P of S.keys)I[P]=`key_${Z++}`;v.write("const newResult = {};");for(const P of S.keys){const V=I[P],F=_2(P),q=y[P],Q=((z=q==null?void 0:q._zod)==null?void 0:z.optout)==="optional";v.write(`const ${V} = ${_(P)};`),Q?v.write(`
29
- if (${V}.issues.length) {
30
- if (${F} in input) {
31
- payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
32
- ...iss,
33
- path: iss.path ? [${F}, ...iss.path] : [${F}]
34
- })));
35
- }
36
- }
37
-
38
- if (${V}.value === undefined) {
39
- if (${F} in input) {
40
- newResult[${F}] = undefined;
41
- }
42
- } else {
43
- newResult[${F}] = ${V}.value;
44
- }
45
-
46
- `):v.write(`
47
- if (${V}.issues.length) {
48
- payload.issues = payload.issues.concat(${V}.issues.map(iss => ({
49
- ...iss,
50
- path: iss.path ? [${F}, ...iss.path] : [${F}]
51
- })));
52
- }
53
-
54
- if (${V}.value === undefined) {
55
- if (${F} in input) {
56
- newResult[${F}] = undefined;
57
- }
58
- } else {
59
- newResult[${F}] = ${V}.value;
60
- }
61
-
62
- `)}v.write("payload.value = newResult;"),v.write("return payload;");const O=v.compile();return(P,V)=>O(y,P,V)};let s;const a=tu,l=!Q8.jitless,u=l&&xT.value,f=t.catchall;let p;n._zod.parse=(y,v)=>{p??(p=r.value);const S=y.value;return a(S)?l&&u&&(v==null?void 0:v.async)===!1&&v.jitless!==!0?(s||(s=i(t.shape)),y=s(y,v),f?g6([],S,y,v,p,n):y):e(y,v):(y.issues.push({expected:"object",code:"invalid_type",input:S,inst:n}),y)}});function k2(n,t,e,r){for(const s of n)if(s.issues.length===0)return t.value=s.value,t;const i=n.filter(s=>!Na(s));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:e,errors:n.map(s=>s.issues.map(a=>Is(a,r,Rs())))}),t)}const v6=$("$ZodUnion",(n,t)=>{Fe.init(n,t),ke(n._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ke(n._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ke(n._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),ke(n._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>nv(s.source)).join("|")})$`)}});const e=t.options.length===1,r=t.options[0]._zod.run;n._zod.parse=(i,s)=>{if(e)return r(i,s);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)l.push(u),a=!0;else{if(u.issues.length===0)return u;l.push(u)}}return a?Promise.all(l).then(c=>k2(c,i,n,s)):k2(l,i,n,s)}}),vR=$("$ZodDiscriminatedUnion",(n,t)=>{t.inclusive=!1,v6.init(n,t);const e=n._zod.parse;ke(n._zod,"propValues",()=>{const i={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(a)){i[l]||(i[l]=new Set);for(const u of c)i[l].add(u)}}return i});const r=Vf(()=>{var a;const i=t.options,s=new Map;for(const l of i){const c=(a=l._zod.propValues)==null?void 0:a[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const u of c){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,l)}}return s});n._zod.parse=(i,s)=>{const a=i.value;if(!tu(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:n}),i;const l=r.value.get(a==null?void 0:a[t.discriminator]);return l?l._zod.run(i,s):t.unionFallback?e(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:n}),i)}}),yR=$("$ZodIntersection",(n,t)=>{Fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,u])=>T2(e,c,u)):T2(e,s,a)}});function ng(n,t){if(n===t)return{valid:!0,data:n};if(n instanceof Date&&t instanceof Date&&+n==+t)return{valid:!0,data:n};if(ql(n)&&ql(t)){const e=Object.keys(t),r=Object.keys(n).filter(s=>e.indexOf(s)!==-1),i={...n,...t};for(const s of r){const a=ng(n[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};i[s]=a.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return{valid:!1,mergeErrorPath:[]};const e=[];for(let r=0;r<n.length;r++){const i=n[r],s=t[r],a=ng(i,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};e.push(a.data)}return{valid:!0,data:e}}return{valid:!1,mergeErrorPath:[]}}function T2(n,t,e){const r=new Map;let i;for(const l of t.issues)if(l.code==="unrecognized_keys"){i??(i=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else n.issues.push(l);for(const l of e.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else n.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&i&&n.issues.push({...i,keys:s}),Na(n))return n;const a=ng(t.value,e.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return n.value=a.data,n}const wR=$("$ZodRecord",(n,t)=>{Fe.init(n,t),n._zod.parse=(e,r)=>{const i=e.value;if(!ql(i))return e.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),e;const s=[],a=t.keyType._zod.values;if(a){e.value={};const l=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const f=t.valueType._zod.run({value:i[u],issues:[]},r);f instanceof Promise?s.push(f.then(p=>{p.issues.length&&e.issues.push(...za(u,p.issues)),e.value[u]=p.value})):(f.issues.length&&e.issues.push(...za(u,f.issues)),e.value[u]=f.value)}let c;for(const u in i)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&e.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:c})}else{e.value={};for(const l of Reflect.ownKeys(i)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&c6.test(l)&&c.issues.length){const p=t.keyType._zod.run({value:Number(l),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?e.value[l]=i[l]:e.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Is(p,r,Rs())),input:l,path:[l],inst:n});continue}const f=t.valueType._zod.run({value:i[l],issues:[]},r);f instanceof Promise?s.push(f.then(p=>{p.issues.length&&e.issues.push(...za(l,p.issues)),e.value[c.value]=p.value})):(f.issues.length&&e.issues.push(...za(l,f.issues)),e.value[c.value]=f.value)}}return s.length?Promise.all(s).then(()=>e):e}}),bR=$("$ZodEnum",(n,t)=>{Fe.init(n,t);const e=e6(t.entries),r=new Set(e);n._zod.values=r,n._zod.pattern=new RegExp(`^(${e.filter(i=>PT.has(typeof i)).map(i=>typeof i=="string"?Vl(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:e,input:a,inst:n}),i}}),SR=$("$ZodLiteral",(n,t)=>{if(Fe.init(n,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const e=new Set(t.values);n._zod.values=e,n._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Vl(r):r?Vl(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return e.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:n}),r}}),_R=$("$ZodTransform",(n,t)=>{Fe.init(n,t),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new X8(n.constructor.name);const i=t.transform(e.value,e);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(e.value=a,e));if(i instanceof Promise)throw new Ua;return e.value=i,e}});function C2(n,t){return n.issues.length&&t===void 0?{issues:[],value:void 0}:n}const y6=$("$ZodOptional",(n,t)=>{Fe.init(n,t),n._zod.optin="optional",n._zod.optout="optional",ke(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ke(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${nv(e.source)})?$`):void 0}),n._zod.parse=(e,r)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>C2(s,e.value)):C2(i,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,r)}}),AR=$("$ZodExactOptional",(n,t)=>{y6.init(n,t),ke(n._zod,"values",()=>t.innerType._zod.values),ke(n._zod,"pattern",()=>t.innerType._zod.pattern),n._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),ER=$("$ZodNullable",(n,t)=>{Fe.init(n,t),ke(n._zod,"optin",()=>t.innerType._zod.optin),ke(n._zod,"optout",()=>t.innerType._zod.optout),ke(n._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${nv(e.source)}|null)$`):void 0}),ke(n._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),n._zod.parse=(e,r)=>e.value===null?e:t.innerType._zod.run(e,r)}),kR=$("$ZodDefault",(n,t)=>{Fe.init(n,t),n._zod.optin="optional",ke(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);if(e.value===void 0)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>R2(s,t)):R2(i,t)}});function R2(n,t){return n.value===void 0&&(n.value=t.defaultValue),n}const TR=$("$ZodPrefault",(n,t)=>{Fe.init(n,t),n._zod.optin="optional",ke(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>(r.direction==="backward"||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),CR=$("$ZodNonOptional",(n,t)=>{Fe.init(n,t),ke(n._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(r=>r!==void 0)):void 0}),n._zod.parse=(e,r)=>{const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>I2(s,n)):I2(i,n)}});function I2(n,t){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:t}),n}const RR=$("$ZodCatch",(n,t)=>{Fe.init(n,t),ke(n._zod,"optin",()=>t.innerType._zod.optin),ke(n._zod,"optout",()=>t.innerType._zod.optout),ke(n._zod,"values",()=>t.innerType._zod.values),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(a=>Is(a,r,Rs()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(s=>Is(s,r,Rs()))},input:e.value}),e.issues=[]),e)}}),IR=$("$ZodPipe",(n,t)=>{Fe.init(n,t),ke(n._zod,"values",()=>t.in._zod.values),ke(n._zod,"optin",()=>t.in._zod.optin),ke(n._zod,"optout",()=>t.out._zod.optout),ke(n._zod,"propValues",()=>t.in._zod.propValues),n._zod.parse=(e,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(e,r);return s instanceof Promise?s.then(a=>Uh(a,t.in,r)):Uh(s,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(s=>Uh(s,t.out,r)):Uh(i,t.out,r)}});function Uh(n,t,e){return n.issues.length?(n.aborted=!0,n):t._zod.run({value:n.value,issues:n.issues},e)}const $R=$("$ZodReadonly",(n,t)=>{Fe.init(n,t),ke(n._zod,"propValues",()=>t.innerType._zod.propValues),ke(n._zod,"values",()=>t.innerType._zod.values),ke(n._zod,"optin",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optin}),ke(n._zod,"optout",()=>{var e,r;return(r=(e=t.innerType)==null?void 0:e._zod)==null?void 0:r.optout}),n._zod.parse=(e,r)=>{if(r.direction==="backward")return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then($2):$2(i)}});function $2(n){return n.value=Object.freeze(n.value),n}const xR=$("$ZodCustom",(n,t)=>{Jt.init(n,t),Fe.init(n,t),n._zod.parse=(e,r)=>e,n._zod.check=e=>{const r=e.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>x2(s,e,r,n));x2(i,e,r,n)}});function x2(n,t,e,r){if(!n){const i={code:"custom",input:e,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(nu(i))}}var P2;class PR{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...e){const r=e[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const e=this._map.get(t);return e&&typeof e=="object"&&"id"in e&&this._idmap.delete(e.id),this._map.delete(t),this}get(t){const e=t._zod.parent;if(e){const r={...this.get(e)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function DR(){return new PR}(P2=globalThis).__zod_globalRegistry??(P2.__zod_globalRegistry=DR());const xc=globalThis.__zod_globalRegistry;function OR(n,t){return new n({type:"string",...J(t)})}function LR(n,t){return new n({type:"string",format:"email",check:"string_format",abort:!1,...J(t)})}function D2(n,t){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...J(t)})}function MR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...J(t)})}function NR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(t)})}function zR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(t)})}function HR(n,t){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(t)})}function ZR(n,t){return new n({type:"string",format:"url",check:"string_format",abort:!1,...J(t)})}function UR(n,t){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...J(t)})}function FR(n,t){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(t)})}function qR(n,t){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...J(t)})}function VR(n,t){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(t)})}function BR(n,t){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...J(t)})}function jR(n,t){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...J(t)})}function WR(n,t){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(t)})}function GR(n,t){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(t)})}function JR(n,t){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(t)})}function YR(n,t){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(t)})}function KR(n,t){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(t)})}function XR(n,t){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...J(t)})}function QR(n,t){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...J(t)})}function e3(n,t){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...J(t)})}function t3(n,t){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...J(t)})}function n3(n,t){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(t)})}function r3(n,t){return new n({type:"string",format:"date",check:"string_format",...J(t)})}function i3(n,t){return new n({type:"string",format:"time",check:"string_format",precision:null,...J(t)})}function s3(n,t){return new n({type:"string",format:"duration",check:"string_format",...J(t)})}function o3(n,t){return new n({type:"number",checks:[],...J(t)})}function a3(n,t){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...J(t)})}function l3(n,t){return new n({type:"boolean",...J(t)})}function c3(n){return new n({type:"unknown"})}function u3(n,t){return new n({type:"never",...J(t)})}function O2(n,t){return new h6({check:"less_than",...J(t),value:n,inclusive:!1})}function Rm(n,t){return new h6({check:"less_than",...J(t),value:n,inclusive:!0})}function L2(n,t){return new d6({check:"greater_than",...J(t),value:n,inclusive:!1})}function Im(n,t){return new d6({check:"greater_than",...J(t),value:n,inclusive:!0})}function M2(n,t){return new kC({check:"multiple_of",...J(t),value:n})}function w6(n,t){return new CC({check:"max_length",...J(t),maximum:n})}function Od(n,t){return new RC({check:"min_length",...J(t),minimum:n})}function b6(n,t){return new IC({check:"length_equals",...J(t),length:n})}function h3(n,t){return new $C({check:"string_format",format:"regex",...J(t),pattern:n})}function d3(n){return new xC({check:"string_format",format:"lowercase",...J(n)})}function f3(n){return new PC({check:"string_format",format:"uppercase",...J(n)})}function p3(n,t){return new DC({check:"string_format",format:"includes",...J(t),includes:n})}function m3(n,t){return new OC({check:"string_format",format:"starts_with",...J(t),prefix:n})}function g3(n,t){return new LC({check:"string_format",format:"ends_with",...J(t),suffix:n})}function tc(n){return new MC({check:"overwrite",tx:n})}function v3(n){return tc(t=>t.normalize(n))}function y3(){return tc(n=>n.trim())}function w3(){return tc(n=>n.toLowerCase())}function b3(){return tc(n=>n.toUpperCase())}function S3(){return tc(n=>$T(n))}function _3(n,t,e){return new n({type:"array",element:t,...J(e)})}function A3(n,t,e){return new n({type:"custom",check:"custom",fn:t,...J(e)})}function E3(n){const t=k3(e=>(e.addIssue=r=>{if(typeof r=="string")e.issues.push(nu(r,e.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=e.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),e.issues.push(nu(i))}},n(e.value,e)));return t}function k3(n,t){const e=new Jt({check:"custom",...J(t)});return e._zod.check=n,e}function S6(n){let t=(n==null?void 0:n.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??xc,target:t,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function Xe(n,t,e={path:[],schemaPath:[]}){var f,p;var r;const i=n._zod.def,s=t.seen.get(n);if(s)return s.count++,e.schemaPath.includes(n)&&(s.cycle=e.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:e.path};t.seen.set(n,a);const l=(p=(f=n._zod).toJSONSchema)==null?void 0:p.call(f);if(l)a.schema=l;else{const y={...e,schemaPath:[...e.schemaPath,n],path:e.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(t,a.schema,y);else{const S=a.schema,_=t.processors[i.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);_(n,t,S,y)}const v=n._zod.parent;v&&(a.ref||(a.ref=v),Xe(v,t,y),t.seen.get(v).isParent=!0)}const c=t.metadataRegistry.get(n);return c&&Object.assign(a.schema,c),t.io==="input"&&Et(n)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(n).schema}function _6(n,t){var a,l,c,u;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of n.seen.entries()){const p=(a=n.metadataRegistry.get(f[0]))==null?void 0:a.id;if(p){const y=r.get(p);if(y&&y!==f[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,f[0])}}const i=f=>{var _;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(_=n.external.registry.get(f[0]))==null?void 0:_.id,Z=n.external.uri??(z=>z);if(I)return{ref:Z(I)};const O=f[1].defId??f[1].schema.id??`schema${n.counter++}`;return f[1].defId=O,{defId:O,ref:`${Z("__shared")}#/${p}/${O}`}}if(f[1]===e)return{ref:"#"};const v=`#/${p}/`,S=f[1].schema.id??`__schema${n.counter++}`;return{defId:S,ref:v+S}},s=f=>{if(f[1].schema.$ref)return;const p=f[1],{ref:y,defId:v}=i(f);p.def={...p.schema},v&&(p.defId=v);const S=p.schema;for(const _ in S)delete S[_];S.$ref=y};if(n.cycles==="throw")for(const f of n.seen.entries()){const p=f[1];if(p.cycle)throw new Error(`Cycle detected: #/${(l=p.cycle)==null?void 0:l.join("/")}/<root>
63
-
64
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of n.seen.entries()){const p=f[1];if(t===f[0]){s(f);continue}if(n.external){const v=(c=n.external.registry.get(f[0]))==null?void 0:c.id;if(t!==f[0]&&v){s(f);continue}}if((u=n.metadataRegistry.get(f[0]))==null?void 0:u.id){s(f);continue}if(p.cycle){s(f);continue}if(p.count>1&&n.reused==="ref"){s(f);continue}}}function A6(n,t){var a,l,c;const e=n.seen.get(t);if(!e)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const f=n.seen.get(u);if(f.ref===null)return;const p=f.def??f.schema,y={...p},v=f.ref;if(f.ref=null,v){r(v);const _=n.seen.get(v),I=_.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,y),u._zod.parent===v)for(const O in p)O==="$ref"||O==="allOf"||O in y||delete p[O];if(I.$ref&&_.def)for(const O in p)O==="$ref"||O==="allOf"||O in _.def&&JSON.stringify(p[O])===JSON.stringify(_.def[O])&&delete p[O]}const S=u._zod.parent;if(S&&S!==v){r(S);const _=n.seen.get(S);if(_!=null&&_.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const I in p)I==="$ref"||I==="allOf"||I in _.def&&JSON.stringify(p[I])===JSON.stringify(_.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:f.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(a=n.external)!=null&&a.uri){const u=(l=n.external.registry.get(t))==null?void 0:l.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,e.def??e.schema);const s=((c=n.external)==null?void 0:c.defs)??{};for(const u of n.seen.entries()){const f=u[1];f.def&&f.defId&&(s[f.defId]=f.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ld(t,"input",n.processors),output:Ld(t,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Et(n,t){const e=t??{seen:new Set};if(e.seen.has(n))return!1;e.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Et(r.element,e);if(r.type==="set")return Et(r.valueType,e);if(r.type==="lazy")return Et(r.getter(),e);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Et(r.innerType,e);if(r.type==="intersection")return Et(r.left,e)||Et(r.right,e);if(r.type==="record"||r.type==="map")return Et(r.keyType,e)||Et(r.valueType,e);if(r.type==="pipe")return Et(r.in,e)||Et(r.out,e);if(r.type==="object"){for(const i in r.shape)if(Et(r.shape[i],e))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(Et(i,e))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(Et(i,e))return!0;return!!(r.rest&&Et(r.rest,e))}return!1}const T3=(n,t={})=>e=>{const r=S6({...e,processors:t});return Xe(n,r),_6(r,n),A6(r,n)},Ld=(n,t,e={})=>r=>{const{libraryOptions:i,target:s}=r??{},a=S6({...i??{},target:s,io:t,processors:e});return Xe(n,a),_6(a,n),A6(a,n)},C3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},R3=(n,t,e,r)=>{const i=e;i.type="string";const{minimum:s,maximum:a,format:l,patterns:c,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof a=="number"&&(i.maxLength=a),l&&(i.format=C3[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){const f=[...c];f.length===1?i.pattern=f[0].source:f.length>1&&(i.allOf=[...f.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},I3=(n,t,e,r)=>{const i=e,{minimum:s,maximum:a,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=n._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number",typeof f=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=f,i.exclusiveMinimum=!0):i.exclusiveMinimum=f),typeof s=="number"&&(i.minimum=s,typeof f=="number"&&t.target!=="draft-04"&&(f>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},$3=(n,t,e,r)=>{e.type="boolean"},x3=(n,t,e,r)=>{e.not={}},P3=(n,t,e,r)=>{},D3=(n,t,e,r)=>{const i=n._zod.def,s=e6(i.entries);s.every(a=>typeof a=="number")&&(e.type="number"),s.every(a=>typeof a=="string")&&(e.type="string"),e.enum=s},O3=(n,t,e,r)=>{const i=n._zod.def,s=[];for(const a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];e.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?e.enum=[a]:e.const=a}else s.every(a=>typeof a=="number")&&(e.type="number"),s.every(a=>typeof a=="string")&&(e.type="string"),s.every(a=>typeof a=="boolean")&&(e.type="boolean"),s.every(a=>a===null)&&(e.type="null"),e.enum=s},L3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},M3=(n,t,e,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},N3=(n,t,e,r)=>{const i=e,s=n._zod.def,{minimum:a,maximum:l}=n._zod.bag;typeof a=="number"&&(i.minItems=a),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=Xe(s.element,t,{...r,path:[...r.path,"items"]})},z3=(n,t,e,r)=>{var u;const i=e,s=n._zod.def;i.type="object",i.properties={};const a=s.shape;for(const f in a)i.properties[f]=Xe(a[f],t,{...r,path:[...r.path,"properties",f]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(f=>{const p=s.shape[f]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));c.size>0&&(i.required=Array.from(c)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},H3=(n,t,e,r)=>{const i=n._zod.def,s=i.inclusive===!1,a=i.options.map((l,c)=>Xe(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?e.oneOf=a:e.anyOf=a},Z3=(n,t,e,r)=>{const i=n._zod.def,s=Xe(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=Xe(i.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];e.allOf=c},U3=(n,t,e,r)=>{const i=e,s=n._zod.def;i.type="object";const a=s.keyType,l=a._zod.bag,c=l==null?void 0:l.patterns;if(s.mode==="loose"&&c&&c.size>0){const f=Xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of c)i.patternProperties[p.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const f=[...u].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(i.required=f)}},F3=(n,t,e,r)=>{const i=n._zod.def,s=Xe(i.innerType,t,r),a=t.seen.get(n);t.target==="openapi-3.0"?(a.ref=i.innerType,e.nullable=!0):e.anyOf=[s,{type:"null"}]},q3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},V3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.default=JSON.parse(JSON.stringify(i.defaultValue))},B3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,t.io==="input"&&(e._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},j3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}e.default=a},W3=(n,t,e,r)=>{const i=n._zod.def,s=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Xe(s,t,r);const a=t.seen.get(n);a.ref=s},G3=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType,e.readOnly=!0},E6=(n,t,e,r)=>{const i=n._zod.def;Xe(i.innerType,t,r);const s=t.seen.get(n);s.ref=i.innerType},J3=$("ZodISODateTime",(n,t)=>{YC.init(n,t),Ve.init(n,t)});function Y3(n){return n3(J3,n)}const K3=$("ZodISODate",(n,t)=>{KC.init(n,t),Ve.init(n,t)});function X3(n){return r3(K3,n)}const Q3=$("ZodISOTime",(n,t)=>{XC.init(n,t),Ve.init(n,t)});function eI(n){return i3(Q3,n)}const tI=$("ZodISODuration",(n,t)=>{QC.init(n,t),Ve.init(n,t)});function nI(n){return s3(tI,n)}const k6=(n,t)=>{i6.init(n,t),n.name="ZodError",Object.defineProperties(n,{format:{value:e=>qT(n,e)},flatten:{value:e=>FT(n,e)},addIssue:{value:e=>{n.issues.push(e),n.message=JSON.stringify(n.issues,tg,2)}},addIssues:{value:e=>{n.issues.push(...e),n.message=JSON.stringify(n.issues,tg,2)}},isEmpty:{get(){return n.issues.length===0}}})},N2=$("ZodError",k6),xn=$("ZodError",k6,{Parent:Error}),rI=iv(xn),iI=sv(xn),sI=Bf(xn),oI=jf(xn),aI=jT(xn),lI=WT(xn),cI=GT(xn),uI=JT(xn),hI=YT(xn),dI=KT(xn),fI=XT(xn),pI=QT(xn),qe=$("ZodType",(n,t)=>(Fe.init(n,t),Object.assign(n["~standard"],{jsonSchema:{input:Ld(n,"input"),output:Ld(n,"output")}}),n.toJSONSchema=T3(n,{}),n.def=t,n.type=t.type,Object.defineProperty(n,"_def",{value:t}),n.check=(...e)=>n.clone(Ds(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(e,r)=>Os(n,e,r),n.brand=()=>n,n.register=((e,r)=>(e.add(n,r),n)),n.parse=(e,r)=>rI(n,e,r,{callee:n.parse}),n.safeParse=(e,r)=>sI(n,e,r),n.parseAsync=async(e,r)=>iI(n,e,r,{callee:n.parseAsync}),n.safeParseAsync=async(e,r)=>oI(n,e,r),n.spa=n.safeParseAsync,n.encode=(e,r)=>aI(n,e,r),n.decode=(e,r)=>lI(n,e,r),n.encodeAsync=async(e,r)=>cI(n,e,r),n.decodeAsync=async(e,r)=>uI(n,e,r),n.safeEncode=(e,r)=>hI(n,e,r),n.safeDecode=(e,r)=>dI(n,e,r),n.safeEncodeAsync=async(e,r)=>fI(n,e,r),n.safeDecodeAsync=async(e,r)=>pI(n,e,r),n.refine=(e,r)=>n.check(o$(e,r)),n.superRefine=e=>n.check(a$(e)),n.overwrite=e=>n.check(tc(e)),n.optional=()=>Z2(n),n.exactOptional=()=>WI(n),n.nullable=()=>U2(n),n.nullish=()=>Z2(U2(n)),n.nonoptional=e=>QI(n,e),n.array=()=>W(n),n.or=e=>le([n,e]),n.and=e=>Gf(n,e),n.transform=e=>F2(n,BI(e)),n.default=e=>YI(n,e),n.prefault=e=>XI(n,e),n.catch=e=>t$(n,e),n.pipe=e=>F2(n,e),n.readonly=()=>i$(n),n.describe=e=>{const r=n.clone();return xc.add(r,{description:e}),r},Object.defineProperty(n,"description",{get(){var e;return(e=xc.get(n))==null?void 0:e.description},configurable:!0}),n.meta=(...e)=>{if(e.length===0)return xc.get(n);const r=n.clone();return xc.add(r,e[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=e=>e(n),n)),T6=$("_ZodString",(n,t)=>{ov.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>R3(n,r,i);const e=n._zod.bag;n.format=e.format??null,n.minLength=e.minimum??null,n.maxLength=e.maximum??null,n.regex=(...r)=>n.check(h3(...r)),n.includes=(...r)=>n.check(p3(...r)),n.startsWith=(...r)=>n.check(m3(...r)),n.endsWith=(...r)=>n.check(g3(...r)),n.min=(...r)=>n.check(Od(...r)),n.max=(...r)=>n.check(w6(...r)),n.length=(...r)=>n.check(b6(...r)),n.nonempty=(...r)=>n.check(Od(1,...r)),n.lowercase=r=>n.check(d3(r)),n.uppercase=r=>n.check(f3(r)),n.trim=()=>n.check(y3()),n.normalize=(...r)=>n.check(v3(...r)),n.toLowerCase=()=>n.check(w3()),n.toUpperCase=()=>n.check(b3()),n.slugify=()=>n.check(S3())}),mI=$("ZodString",(n,t)=>{ov.init(n,t),T6.init(n,t),n.email=e=>n.check(LR(gI,e)),n.url=e=>n.check(ZR(vI,e)),n.jwt=e=>n.check(t3(PI,e)),n.emoji=e=>n.check(UR(yI,e)),n.guid=e=>n.check(D2(z2,e)),n.uuid=e=>n.check(MR(Fh,e)),n.uuidv4=e=>n.check(NR(Fh,e)),n.uuidv6=e=>n.check(zR(Fh,e)),n.uuidv7=e=>n.check(HR(Fh,e)),n.nanoid=e=>n.check(FR(wI,e)),n.guid=e=>n.check(D2(z2,e)),n.cuid=e=>n.check(qR(bI,e)),n.cuid2=e=>n.check(VR(SI,e)),n.ulid=e=>n.check(BR(_I,e)),n.base64=e=>n.check(XR(II,e)),n.base64url=e=>n.check(QR($I,e)),n.xid=e=>n.check(jR(AI,e)),n.ksuid=e=>n.check(WR(EI,e)),n.ipv4=e=>n.check(GR(kI,e)),n.ipv6=e=>n.check(JR(TI,e)),n.cidrv4=e=>n.check(YR(CI,e)),n.cidrv6=e=>n.check(KR(RI,e)),n.e164=e=>n.check(e3(xI,e)),n.datetime=e=>n.check(Y3(e)),n.date=e=>n.check(X3(e)),n.time=e=>n.check(eI(e)),n.duration=e=>n.check(nI(e))});function g(n){return OR(mI,n)}const Ve=$("ZodStringFormat",(n,t)=>{ze.init(n,t),T6.init(n,t)}),gI=$("ZodEmail",(n,t)=>{UC.init(n,t),Ve.init(n,t)}),z2=$("ZodGUID",(n,t)=>{HC.init(n,t),Ve.init(n,t)}),Fh=$("ZodUUID",(n,t)=>{ZC.init(n,t),Ve.init(n,t)}),vI=$("ZodURL",(n,t)=>{FC.init(n,t),Ve.init(n,t)}),yI=$("ZodEmoji",(n,t)=>{qC.init(n,t),Ve.init(n,t)}),wI=$("ZodNanoID",(n,t)=>{VC.init(n,t),Ve.init(n,t)}),bI=$("ZodCUID",(n,t)=>{BC.init(n,t),Ve.init(n,t)}),SI=$("ZodCUID2",(n,t)=>{jC.init(n,t),Ve.init(n,t)}),_I=$("ZodULID",(n,t)=>{WC.init(n,t),Ve.init(n,t)}),AI=$("ZodXID",(n,t)=>{GC.init(n,t),Ve.init(n,t)}),EI=$("ZodKSUID",(n,t)=>{JC.init(n,t),Ve.init(n,t)}),kI=$("ZodIPv4",(n,t)=>{eR.init(n,t),Ve.init(n,t)}),TI=$("ZodIPv6",(n,t)=>{tR.init(n,t),Ve.init(n,t)}),CI=$("ZodCIDRv4",(n,t)=>{nR.init(n,t),Ve.init(n,t)}),RI=$("ZodCIDRv6",(n,t)=>{rR.init(n,t),Ve.init(n,t)}),II=$("ZodBase64",(n,t)=>{iR.init(n,t),Ve.init(n,t)}),$I=$("ZodBase64URL",(n,t)=>{oR.init(n,t),Ve.init(n,t)}),xI=$("ZodE164",(n,t)=>{aR.init(n,t),Ve.init(n,t)}),PI=$("ZodJWT",(n,t)=>{cR.init(n,t),Ve.init(n,t)}),C6=$("ZodNumber",(n,t)=>{p6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>I3(n,r,i),n.gt=(r,i)=>n.check(L2(r,i)),n.gte=(r,i)=>n.check(Im(r,i)),n.min=(r,i)=>n.check(Im(r,i)),n.lt=(r,i)=>n.check(O2(r,i)),n.lte=(r,i)=>n.check(Rm(r,i)),n.max=(r,i)=>n.check(Rm(r,i)),n.int=r=>n.check(H2(r)),n.safe=r=>n.check(H2(r)),n.positive=r=>n.check(L2(0,r)),n.nonnegative=r=>n.check(Im(0,r)),n.negative=r=>n.check(O2(0,r)),n.nonpositive=r=>n.check(Rm(0,r)),n.multipleOf=(r,i)=>n.check(M2(r,i)),n.step=(r,i)=>n.check(M2(r,i)),n.finite=()=>n;const e=n._zod.bag;n.minValue=Math.max(e.minimum??Number.NEGATIVE_INFINITY,e.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(e.maximum??Number.POSITIVE_INFINITY,e.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(e.format??"").includes("int")||Number.isSafeInteger(e.multipleOf??.5),n.isFinite=!0,n.format=e.format??null});function ie(n){return o3(C6,n)}const DI=$("ZodNumberFormat",(n,t)=>{uR.init(n,t),C6.init(n,t)});function H2(n){return a3(DI,n)}const OI=$("ZodBoolean",(n,t)=>{hR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>$3(n,e,r)});function ct(n){return l3(OI,n)}const LI=$("ZodUnknown",(n,t)=>{dR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>P3()});function E(){return c3(LI)}const MI=$("ZodNever",(n,t)=>{fR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>x3(n,e,r)});function NI(n){return u3(MI,n)}const zI=$("ZodArray",(n,t)=>{pR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>N3(n,e,r,i),n.element=t.element,n.min=(e,r)=>n.check(Od(e,r)),n.nonempty=e=>n.check(Od(1,e)),n.max=(e,r)=>n.check(w6(e,r)),n.length=(e,r)=>n.check(b6(e,r)),n.unwrap=()=>n.element});function W(n,t){return _3(zI,n,t)}const R6=$("ZodObject",(n,t)=>{gR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>z3(n,e,r,i),ke(n,"shape",()=>t.shape),n.keyof=()=>av(Object.keys(n._zod.def.shape)),n.catchall=e=>n.clone({...n._zod.def,catchall:e}),n.passthrough=()=>n.clone({...n._zod.def,catchall:E()}),n.loose=()=>n.clone({...n._zod.def,catchall:E()}),n.strict=()=>n.clone({...n._zod.def,catchall:NI()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=e=>NT(n,e),n.safeExtend=e=>zT(n,e),n.merge=e=>HT(n,e),n.pick=e=>LT(n,e),n.omit=e=>MT(n,e),n.partial=(...e)=>ZT($6,n,e[0]),n.required=(...e)=>UT(x6,n,e[0])});function rg(n,t){const e={type:"object",shape:n??{},...J(t)};return new R6(e)}function b(n,t){return new R6({type:"object",shape:n,catchall:E(),...J(t)})}const I6=$("ZodUnion",(n,t)=>{v6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>H3(n,e,r,i),n.options=t.options});function le(n,t){return new I6({type:"union",options:n,...J(t)})}const HI=$("ZodDiscriminatedUnion",(n,t)=>{I6.init(n,t),vR.init(n,t)});function ZI(n,t,e){return new HI({type:"union",options:t,discriminator:n,...J(e)})}const UI=$("ZodIntersection",(n,t)=>{yR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>Z3(n,e,r,i)});function Gf(n,t){return new UI({type:"intersection",left:n,right:t})}const FI=$("ZodRecord",(n,t)=>{wR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>U3(n,e,r,i),n.keyType=t.keyType,n.valueType=t.valueType});function T(n,t,e){return new FI({type:"record",keyType:n,valueType:t,...J(e)})}const ig=$("ZodEnum",(n,t)=>{bR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(r,i,s)=>D3(n,r,i),n.enum=t.entries,n.options=Object.values(t.entries);const e=new Set(Object.keys(t.entries));n.extract=(r,i)=>{const s={};for(const a of r)if(e.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ig({...t,checks:[],...J(i),entries:s})},n.exclude=(r,i)=>{const s={...t.entries};for(const a of r)if(e.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new ig({...t,checks:[],...J(i),entries:s})}});function av(n,t){const e=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new ig({type:"enum",entries:e,...J(t)})}const qI=$("ZodLiteral",(n,t)=>{SR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>O3(n,e,r),n.values=new Set(t.values),Object.defineProperty(n,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function D(n,t){return new qI({type:"literal",values:Array.isArray(n)?n:[n],...J(t)})}const VI=$("ZodTransform",(n,t)=>{_R.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>M3(n,e),n._zod.parse=(e,r)=>{if(r.direction==="backward")throw new X8(n.constructor.name);e.addIssue=s=>{if(typeof s=="string")e.issues.push(nu(s,e.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=e.value),a.inst??(a.inst=n),e.issues.push(nu(a))}};const i=t.transform(e.value,e);return i instanceof Promise?i.then(s=>(e.value=s,e)):(e.value=i,e)}});function BI(n){return new VI({type:"transform",transform:n})}const $6=$("ZodOptional",(n,t)=>{y6.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>E6(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function Z2(n){return new $6({type:"optional",innerType:n})}const jI=$("ZodExactOptional",(n,t)=>{AR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>E6(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function WI(n){return new jI({type:"optional",innerType:n})}const GI=$("ZodNullable",(n,t)=>{ER.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>F3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function U2(n){return new GI({type:"nullable",innerType:n})}const JI=$("ZodDefault",(n,t)=>{kR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>V3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function YI(n,t){return new JI({type:"default",innerType:n,get defaultValue(){return typeof t=="function"?t():n6(t)}})}const KI=$("ZodPrefault",(n,t)=>{TR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>B3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function XI(n,t){return new KI({type:"prefault",innerType:n,get defaultValue(){return typeof t=="function"?t():n6(t)}})}const x6=$("ZodNonOptional",(n,t)=>{CR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>q3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function QI(n,t){return new x6({type:"nonoptional",innerType:n,...J(t)})}const e$=$("ZodCatch",(n,t)=>{RR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>j3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function t$(n,t){return new e$({type:"catch",innerType:n,catchValue:typeof t=="function"?t:()=>t})}const n$=$("ZodPipe",(n,t)=>{IR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>W3(n,e,r,i),n.in=t.in,n.out=t.out});function F2(n,t){return new n$({type:"pipe",in:n,out:t})}const r$=$("ZodReadonly",(n,t)=>{$R.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>G3(n,e,r,i),n.unwrap=()=>n._zod.def.innerType});function i$(n){return new r$({type:"readonly",innerType:n})}const s$=$("ZodCustom",(n,t)=>{xR.init(n,t),qe.init(n,t),n._zod.processJSONSchema=(e,r,i)=>L3(n,e)});function o$(n,t={}){return A3(s$,n,t)}function a$(n){return E3(n)}const l$=[".md",".markdown"];function P6(n){if(n.length===0)return!1;const t=n.at(-1);return t==="/"||t==="\\"}function D6(n){const t=n.lastIndexOf("/"),e=n.lastIndexOf("\\");return n.slice(Math.max(t,e)+1)}function c$(n){return D6(n).toLowerCase()}function u$(n,t){const e=c$(n);return t.some(r=>e.endsWith(r))}function sg(n){return!P6(n)&&u$(n,l$)}function h$(n){let t;try{t=new URL(n)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}function Vr(n){try{const{pathname:t}=new URL(n);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(t)}catch{return!1}}const d$=rg({id:g().min(1),kind:D("path"),title:g(),path:g(),store:g().optional(),share:rg({id:g().min(1),access:av(["read","read-write"])}).strict().optional()}).strict(),f$=rg({id:g().min(1),kind:D("url"),title:g(),url:g().refine(h$,{message:"url must be an http(s) URL"})}).strict();ZI("kind",[d$,f$]);const p$=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]);function m$(n,t){try{const e=new URL(t),r=new URL(n,e);return r.protocol==="http:"||r.protocol==="https:"?{kind:"web",url:r.href}:p$.has(r.protocol)?{kind:"browser-local",url:r.href}:{kind:"application",url:r.href}}catch{return{kind:"invalid"}}}function q2(n,t){return m$(n,t).kind==="web"}const g$="/views/markdown/",v$="/views/url-unsupported/";function y$(n){try{const{protocol:t}=new URL(n);return t==="http:"||t==="https:"}catch{return!1}}function O6(n){return`/artifact/${encodeURIComponent(n)}`}function w$(n,t){return`${O6(n)}/${encodeURIComponent(t)}`}function b$(n){return`/markdown/${encodeURIComponent(n)}`}function ru(n,t={electron:!1}){if(n.kind==="url")return t.electron?{renderer:"url-webview",viewURL:n.url,contentURL:null}:Vr(n.url)?{renderer:"proxy-iframe",viewURL:n.url,contentURL:null}:t.browserDemo&&y$(n.url)?{renderer:"url-direct",viewURL:n.url,contentURL:null}:{renderer:"url-unsupported",viewURL:v$,contentURL:null};if(sg(n.path)){const r={viewURL:g$,contentURL:b$(n.id)};return t.electron?{renderer:"url-webview",...r}:{renderer:"markdown",...r}}const e=P6(n.path)?`${O6(n.id)}/`:w$(n.id,D6(n.path));return t.electron?{renderer:"url-webview",viewURL:e,contentURL:null}:{renderer:"proxy-iframe",viewURL:e,contentURL:null}}const S$="token",_$="mode",A$="desktopAppVersion",E$="electron";function k$(n=window.location.search){return new URLSearchParams(n).get(S$)}function bi(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(_$)===E$}function L6(n=typeof window>"u"?"":window.location.search){return new URLSearchParams(n).get(A$)}const V2="tv.telemetry.clientId",T$=5,C$=60,R$=1e3,I$=T$*C$*R$,B2=["pointerdown","scroll","keydown"],j2=["focus"],W2=["visibilitychange"],$$="hidden";function x$(n,t=M$){const e=n.getItem(V2);if(e)return e;const r=t();return n.setItem(V2,r),r}function P$(n){return{clientId:x$(n.storage,n.idFactory),userAgent:n.userAgent??(typeof navigator>"u"?"":navigator.userAgent),clientApp:n.clientApp,...n.desktopAppVersion?{desktopAppVersion:n.desktopAppVersion}:{}}}function D$(n){const t=new URLSearchParams;return t.set("clientId",n.clientId),t.set("userAgent",n.userAgent),t.set("clientApp",n.clientApp),n.desktopAppVersion&&t.set("desktopAppVersion",n.desktopAppVersion),t}function O$(n){return new L$(n)}var hu,Gr,Wi,du,fu,yn,po,pu,Gd,M6;class L${constructor(t){m(this,Gd);m(this,hu);m(this,Gr);m(this,Wi);m(this,du);m(this,fu);m(this,yn);m(this,po,!1);m(this,pu,Number.NEGATIVE_INFINITY);d(this,hu,t.meta),d(this,Gr,t.documentTarget),d(this,Wi,t.windowTarget),d(this,du,t.send),d(this,fu,t.nowMs??Date.now),d(this,yn,()=>h(this,Gd,M6).call(this))}start(){if(!o(this,po)){d(this,po,!0);for(const t of B2)o(this,Wi).addEventListener(t,o(this,yn)),o(this,Gr).addEventListener(t,o(this,yn));for(const t of j2)o(this,Wi).addEventListener(t,o(this,yn));for(const t of W2)o(this,Gr).addEventListener(t,o(this,yn))}}stop(){if(o(this,po)){d(this,po,!1);for(const t of B2)o(this,Wi).removeEventListener(t,o(this,yn)),o(this,Gr).removeEventListener(t,o(this,yn));for(const t of j2)o(this,Wi).removeEventListener(t,o(this,yn));for(const t of W2)o(this,Gr).removeEventListener(t,o(this,yn))}}}hu=new WeakMap,Gr=new WeakMap,Wi=new WeakMap,du=new WeakMap,fu=new WeakMap,yn=new WeakMap,po=new WeakMap,pu=new WeakMap,Gd=new WeakSet,M6=function(){if(o(this,Gr).visibilityState===$$)return;const t=o(this,fu).call(this);t-o(this,pu)<I$||(d(this,pu,t),o(this,du).call(this,{type:hk,clientId:o(this,hu).clientId}))};function M$(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():ev().toLowerCase()}const Le={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"},Zr={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"},N$=1,z$=b({_meta:T(g(),E()).nullish(),terminal:ct().optional().default(!1)}),H$=b({_meta:T(g(),E()).nullish(),label:g().nullish(),name:g(),optional:ct().optional().default(!1),secret:ct().optional().default(!0)}),Z$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),name:g()}),U$=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:g(),link:g().nullish(),name:g(),vars:W(H$)}),F$=b({_meta:T(g(),E()).nullish(),args:W(g()).optional(),description:g().nullish(),env:T(g(),g()).optional(),id:g(),name:g()}),q$=le([U$.and(b({type:D("env_var")})),F$.and(b({type:D("terminal")})),Z$]),V$=b({_meta:T(g(),E()).nullish(),methodId:g()}),B$=b({_meta:T(g(),E()).nullish()}),j$=b({_meta:T(g(),E()).nullish(),blob:g(),mimeType:g().nullish(),uri:g()}),W$=b({default:ct().nullish(),description:g().nullish(),title:g().nullish()}),G$=b({_meta:T(g(),E()).nullish()}),J$=b({_meta:T(g(),E()).nullish()}),Y$=b({amount:ie(),currency:g()}),K$=b({_meta:T(g(),E()).nullish(),terminalId:g()}),X$=b({_meta:T(g(),E()).nullish(),newText:g(),oldText:g().nullish(),path:g()}),Q$=le([g(),ie(),ie(),ct(),W(g())]),ex=b({content:T(g(),Q$).nullish()}),tx=le([ex.and(b({action:D("accept")})),b({action:D("decline")}),b({action:D("cancel")})]),nx=b({_meta:T(g(),E()).nullish()}),N6=g(),rx=b({_meta:T(g(),E()).nullish(),elicitationId:N6}),ix=b({_meta:T(g(),E()).nullish(),action:tx}),sx=D("object"),ox=D("string"),ax=b({_meta:T(g(),E()).nullish()}),lx=b({_meta:T(g(),E()).nullish(),form:nx.nullish(),url:ax.nullish()}),cx=b({elicitationId:N6,url:g().url()}),z6=b({const:g(),title:g()}),H6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),ux=le([D(-32700),D(-32600),D(-32601),D(-32602),D(-32603),D(-32800),D(-32e3),D(-32002),D(-32042),ie().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Z6=b({code:ux,data:E().optional(),message:g()}),U6=E(),F6=E(),q6=E(),hx=b({_meta:T(g(),E()).nullish(),readTextFile:ct().optional().default(!1),writeTextFile:ct().optional().default(!1)}),V6=b({_meta:T(g(),E()).nullish(),name:g(),value:g()}),B6=b({_meta:T(g(),E()).nullish(),name:g(),title:g().nullish(),version:g()}),dx=b({default:ie().nullish(),description:g().nullish(),maximum:ie().nullish(),minimum:ie().nullish(),title:g().nullish()}),fx=b({_meta:T(g(),E()).nullish()}),px=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cursor:g().nullish(),cwd:g().nullish()}),mx=b({_meta:T(g(),E()).nullish()}),gx=b({_meta:T(g(),E()).nullish(),logout:mx.nullish()}),vx=b({_meta:T(g(),E()).nullish()}),yx=b({_meta:T(g(),E()).nullish()}),wx=b({_meta:T(g(),E()).nullish(),http:ct().optional().default(!1),sse:ct().optional().default(!1)}),bx=b({_meta:T(g(),E()).nullish(),headers:W(V6),name:g(),url:g()}),Sx=b({_meta:T(g(),E()).nullish(),headers:W(V6),name:g(),url:g()}),_x=b({_meta:T(g(),E()).nullish(),args:W(g()),command:g(),env:W(H6),name:g()}),Jf=le([bx.and(b({type:D("http")})),Sx.and(b({type:D("sse")})),_x]),lv=g(),Ax=b({_meta:T(g(),E()).nullish(),description:g().nullish(),modelId:lv,name:g()}),Ex=le([D("error"),D("warning"),D("information"),D("hint")]),kx=b({_meta:T(g(),E()).nullish()}),Tx=b({_meta:T(g(),E()).nullish()}),Cx=b({_meta:T(g(),E()).nullish()}),Rx=b({_meta:T(g(),E()).nullish()}),Ix=b({_meta:T(g(),E()).nullish()}),$x=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),xx=b({diff:g(),uri:g()}),Px=b({endLine:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:g()}),Dx=b({_meta:T(g(),E()).nullish()}),Ox=b({_meta:T(g(),E()).nullish()}),Lx=b({languageId:g(),text:g(),uri:g()}),Mx=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Nx=le([D("rejected"),D("ignored"),D("replaced"),D("cancelled")]),zx=b({excerpts:W(Px),uri:g()}),Hx=b({_meta:T(g(),E()).nullish()}),Zx=b({_meta:T(g(),E()).nullish()}),Ux=b({name:g(),owner:g(),remoteUrl:g()}),Fx=b({_meta:T(g(),E()).nullish()}),qx=b({_meta:T(g(),E()).nullish(),jump:Dx.nullish(),rename:Zx.nullish(),searchAndReplace:Fx.nullish()}),Vx=b({id:g(),isRegex:ct().nullish(),replace:g(),search:g(),uri:g()}),Bx=le([D("automatic"),D("diagnostic"),D("manual")]),jx=b({_meta:T(g(),E()).nullish(),maxCount:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),Wx=b({_meta:T(g(),E()).nullish(),diagnostics:kx.nullish(),editHistory:$x.nullish(),openFiles:Ox.nullish(),recentFiles:Mx.nullish(),relatedSnippets:Hx.nullish(),userActions:jx.nullish()}),Gx=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cwd:g(),mcpServers:W(Jf)}),Jx=b({default:ie().nullish(),description:g().nullish(),maximum:ie().nullish(),minimum:ie().nullish(),title:g().nullish()}),j6=g(),Yx=le([D("allow_once"),D("allow_always"),D("reject_once"),D("reject_always")]),Kx=b({_meta:T(g(),E()).nullish(),kind:Yx,name:g(),optionId:j6}),Xx=le([D("high"),D("medium"),D("low")]),Qx=le([D("pending"),D("in_progress"),D("completed")]),eP=b({_meta:T(g(),E()).nullish(),content:g(),priority:Xx,status:Qx}),tP=b({_meta:T(g(),E()).nullish(),entries:W(eP)}),$s=b({character:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),nP=b({id:g(),position:$s,uri:g()}),rP=b({id:g(),newName:g(),position:$s,uri:g()}),iP=b({action:g(),position:$s,timestampMs:ie(),uri:g()}),W6=le([D("utf-16"),D("utf-32"),D("utf-8")]),sP=b({_meta:T(g(),E()).nullish(),auth:z$.optional().default({terminal:!1}),elicitation:lx.nullish(),fs:hx.optional().default({readTextFile:!1,writeTextFile:!1}),nes:qx.nullish(),positionEncodings:W(W6).optional(),terminal:ct().optional().default(!1)}),oP=b({_meta:T(g(),E()).nullish(),audio:ct().optional().default(!1),embeddedContext:ct().optional().default(!1),image:ct().optional().default(!1)}),G6=ie().int().gte(0).lte(65535),aP=b({_meta:T(g(),E()).nullish(),clientCapabilities:sP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:B6.nullish(),protocolVersion:G6}),nc=b({end:$s,start:$s}),lP=b({message:g(),range:nc,severity:Ex,uri:g()}),cP=b({languageId:g(),lastFocusedMs:ie().nullish(),uri:g(),visibleRange:nc.nullish()}),uP=b({_meta:T(g(),E()).nullish(),diagnostics:W(lP).nullish(),editHistory:W(xx).nullish(),openFiles:W(cP).nullish(),recentFiles:W(Lx).nullish(),relatedSnippets:W(zx).nullish(),userActions:W(iP).nullish()}),hP=b({newText:g(),range:nc}),dP=b({cursorPosition:$s.nullish(),edits:W(hP),id:g(),uri:g()}),fP=le([dP.and(b({kind:D("edit")})),nP.and(b({kind:D("jump")})),rP.and(b({kind:D("rename")})),Vx.and(b({kind:D("searchAndReplace")}))]),pP=b({_meta:T(g(),E()).nullish(),content:g()}),mP=b({_meta:T(g(),E()).nullish()}),ra=le([ie(),g()]).nullable();b({_meta:T(g(),E()).nullish(),requestId:ra});const gP=av(["assistant","user"]),Eh=b({_meta:T(g(),E()).nullish(),audience:W(gP).nullish(),lastModified:g().nullish(),priority:ie().nullish()}),vP=b({_meta:T(g(),E()).nullish(),annotations:Eh.nullish(),data:g(),mimeType:g()}),yP=b({_meta:T(g(),E()).nullish(),annotations:Eh.nullish(),data:g(),mimeType:g(),uri:g().nullish()}),wP=b({_meta:T(g(),E()).nullish(),annotations:Eh.nullish(),description:g().nullish(),mimeType:g().nullish(),name:g(),size:ie().nullish(),title:g().nullish(),uri:g()}),bP=b({_meta:T(g(),E()).nullish(),optionId:j6}),SP=le([b({outcome:D("cancelled")}),bP.and(b({outcome:D("selected")}))]),_P=b({_meta:T(g(),E()).nullish(),outcome:SP}),AP=b({_meta:T(g(),E()).nullish()}),EP=b({_meta:T(g(),E()).nullish()}),kP=b({currentValue:ct()}),TP=g(),J6=g(),CP=le([D("mode"),D("model"),D("thought_level"),g()]),cv=g(),Y6=b({_meta:T(g(),E()).nullish(),description:g().nullish(),name:g(),value:cv}),RP=b({_meta:T(g(),E()).nullish(),group:TP,name:g(),options:W(Y6)}),IP=le([W(Y6),W(RP)]),$P=b({currentValue:cv,options:IP}),rc=Gf(le([$P.and(b({type:D("select")})),kP.and(b({type:D("boolean")}))]),b({_meta:T(g(),E()).nullish(),category:CP.nullish(),description:g().nullish(),id:J6,name:g()})),xP=b({_meta:T(g(),E()).nullish(),configOptions:W(rc)}),PP=b({_meta:T(g(),E()).nullish()}),Se=g(),DP=b({_meta:T(g(),E()).nullish(),id:g(),sessionId:Se}),OP=b({_meta:T(g(),E()).nullish(),sessionId:Se}),LP=b({_meta:T(g(),E()).nullish(),sessionId:Se}),MP=b({_meta:T(g(),E()).nullish(),sessionId:Se}),K6=b({_meta:T(g(),E()).nullish(),args:W(g()).optional(),command:g(),cwd:g().nullish(),env:W(H6).optional(),outputByteLimit:ie().nullish(),sessionId:Se}),NP=b({_meta:T(g(),E()).nullish(),sessionId:Se,uri:g()}),zP=b({_meta:T(g(),E()).nullish(),position:$s,sessionId:Se,uri:g(),version:ie(),visibleRange:nc}),HP=b({_meta:T(g(),E()).nullish(),languageId:g(),sessionId:Se,text:g(),uri:g(),version:ie()}),ZP=b({_meta:T(g(),E()).nullish(),sessionId:Se,uri:g()}),UP=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cwd:g(),mcpServers:W(Jf).optional(),sessionId:Se}),X6=b({_meta:T(g(),E()).nullish(),sessionId:Se,terminalId:g()}),FP=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cwd:g(),mcpServers:W(Jf),sessionId:Se}),Q6=b({_meta:T(g(),E()).nullish(),limit:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:g(),sessionId:Se}),qP=b({_meta:T(g(),E()).nullish(),id:g(),reason:Nx.nullish(),sessionId:Se}),eS=b({_meta:T(g(),E()).nullish(),sessionId:Se,terminalId:g()}),VP=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cwd:g(),mcpServers:W(Jf).optional(),sessionId:Se}),BP=b({_meta:T(g(),E()).nullish(),additionalDirectories:W(g()).optional(),cwd:g(),sessionId:Se,title:g().nullish(),updatedAt:g().nullish()}),jP=b({_meta:T(g(),E()).nullish(),nextCursor:g().nullish(),sessions:W(BP)}),WP=b({_meta:T(g(),E()).nullish(),title:g().nullish(),updatedAt:g().nullish()}),GP=b({_meta:T(g(),E()).nullish()}),Yf=g(),JP=b({_meta:T(g(),E()).nullish(),currentModeId:Yf}),YP=b({_meta:T(g(),E()).nullish(),description:g().nullish(),id:Yf,name:g()}),Kf=b({_meta:T(g(),E()).nullish(),availableModes:W(YP),currentModeId:Yf}),Xf=b({_meta:T(g(),E()).nullish(),availableModels:W(Ax),currentModelId:lv}),KP=b({_meta:T(g(),E()).nullish(),configOptions:W(rc).nullish(),models:Xf.nullish(),modes:Kf.nullish(),sessionId:Se}),XP=b({_meta:T(g(),E()).nullish(),configOptions:W(rc).nullish(),models:Xf.nullish(),modes:Kf.nullish()}),QP=b({_meta:T(g(),E()).nullish(),configOptions:W(rc).nullish(),models:Xf.nullish(),modes:Kf.nullish(),sessionId:Se}),e5=b({_meta:T(g(),E()).nullish(),configOptions:W(rc).nullish(),models:Xf.nullish(),modes:Kf.nullish()}),t5=b({_meta:T(g(),E()).nullish()}),n5=b({_meta:T(g(),E()).nullish(),additionalDirectories:AP.nullish(),close:EP.nullish(),fork:PP.nullish(),list:GP.nullish(),resume:t5.nullish()}),r5=Gf(le([b({type:D("boolean"),value:ct()}),b({value:cv})]),b({_meta:T(g(),E()).nullish(),configId:J6,sessionId:Se})),i5=b({_meta:T(g(),E()).nullish(),configOptions:W(rc)}),s5=b({_meta:T(g(),E()).nullish(),modeId:Yf,sessionId:Se}),o5=b({_meta:T(g(),E()).nullish()}),a5=b({_meta:T(g(),E()).nullish(),modelId:lv,sessionId:Se}),l5=b({_meta:T(g(),E()).nullish()}),c5=b({_meta:T(g(),E()).nullish(),sessionId:Se}),u5=le([D("end_turn"),D("max_tokens"),D("max_turn_requests"),D("refusal"),D("cancelled")]),h5=le([D("email"),D("uri"),D("date"),D("date-time")]),d5=b({default:g().nullish(),description:g().nullish(),enum:W(g()).nullish(),format:h5.nullish(),maxLength:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:W(z6).nullish(),pattern:g().nullish(),title:g().nullish()}),f5=b({_meta:T(g(),E()).nullish(),context:uP.nullish(),position:$s,selection:nc.nullish(),sessionId:Se,triggerKind:Bx,uri:g(),version:ie()}),p5=b({_meta:T(g(),E()).nullish(),suggestions:W(fP)}),m5=b({_meta:T(g(),E()).nullish(),terminalId:g()}),g5=b({_meta:T(g(),E()).nullish(),exitCode:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:g().nullish()}),tS=b({_meta:T(g(),E()).nullish(),sessionId:Se,terminalId:g()}),v5=b({_meta:T(g(),E()).nullish(),exitStatus:g5.nullish(),output:g(),truncated:ct()}),y5=b({_meta:T(g(),E()).nullish(),annotations:Eh.nullish(),text:g()}),w5=b({range:nc.nullish(),text:g()}),b5=b({_meta:T(g(),E()).nullish(),contentChanges:W(w5),sessionId:Se,uri:g(),version:ie()});b({method:g(),params:le([OP,HP,b5,NP,ZP,zP,DP,qP,U6]).nullish()});const S5=le([D("full"),D("incremental")]),_5=b({_meta:T(g(),E()).nullish(),syncKind:S5}),A5=b({_meta:T(g(),E()).nullish(),didChange:_5.nullish(),didClose:Tx.nullish(),didFocus:Cx.nullish(),didOpen:Rx.nullish(),didSave:Ix.nullish()}),E5=b({_meta:T(g(),E()).nullish(),document:A5.nullish()}),k5=b({_meta:T(g(),E()).nullish(),context:Wx.nullish(),events:E5.nullish()}),T5=b({_meta:T(g(),E()).nullish(),auth:gx.optional().default({}),loadSession:ct().optional().default(!1),mcpCapabilities:wx.optional().default({http:!1,sse:!1}),nes:k5.nullish(),positionEncoding:W6.nullish(),promptCapabilities:oP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:n5.optional().default({})}),C5=b({_meta:T(g(),E()).nullish(),agentCapabilities:T5.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:B6.nullish(),authMethods:W(q$).optional().default([]),protocolVersion:G6}),R5=b({_meta:T(g(),E()).nullish(),mimeType:g().nullish(),text:g(),uri:g()}),I5=le([R5,j$]),$5=b({_meta:T(g(),E()).nullish(),annotations:Eh.nullish(),resource:I5}),uv=le([y5.and(b({type:D("text")})),yP.and(b({type:D("image")})),vP.and(b({type:D("audio")})),wP.and(b({type:D("resource_link")})),$5.and(b({type:D("resource")}))]),x5=b({_meta:T(g(),E()).nullish(),content:uv}),$m=b({_meta:T(g(),E()).nullish(),content:uv,messageId:g().nullish()}),P5=b({_meta:T(g(),E()).nullish(),messageId:g().nullish(),prompt:W(uv),sessionId:Se}),D5=b({anyOf:W(z6)}),nS=le([x5.and(b({type:D("content")})),X$.and(b({type:D("diff")})),m5.and(b({type:D("terminal")}))]),rS=g(),iS=b({_meta:T(g(),E()).nullish(),line:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:g()}),sS=le([D("pending"),D("in_progress"),D("completed"),D("failed")]),oS=le([D("read"),D("edit"),D("delete"),D("move"),D("search"),D("execute"),D("think"),D("fetch"),D("switch_mode"),D("other")]),O5=b({_meta:T(g(),E()).nullish(),content:W(nS).optional(),kind:oS.optional(),locations:W(iS).optional(),rawInput:E().optional(),rawOutput:E().optional(),status:sS.optional(),title:g(),toolCallId:rS}),aS=b({_meta:T(g(),E()).nullish(),content:W(nS).nullish(),kind:oS.nullish(),locations:W(iS).nullish(),rawInput:E().optional(),rawOutput:E().optional(),status:sS.nullish(),title:g().nullish(),toolCallId:rS}),lS=b({_meta:T(g(),E()).nullish(),options:W(Kx),sessionId:Se,toolCall:aS}),L5=b({_meta:T(g(),E()).nullish(),hint:g()}),M5=L5,N5=b({_meta:T(g(),E()).nullish(),description:g(),input:M5.nullish(),name:g()}),z5=b({_meta:T(g(),E()).nullish(),availableCommands:W(N5)}),H5=b({enum:W(g()),type:ox}),Z5=le([H5,D5]),U5=b({default:W(g()).nullish(),description:g().nullish(),items:Z5,maxItems:ie().nullish(),minItems:ie().nullish(),title:g().nullish()}),F5=le([d5.and(b({type:D("string")})),Jx.and(b({type:D("number")})),dx.and(b({type:D("integer")})),W$.and(b({type:D("boolean")})),U5.and(b({type:D("array")}))]),q5=b({description:g().nullish(),properties:T(g(),F5).optional().default({}),required:W(g()).nullish(),title:g().nullish(),type:sx.optional().default("object")}),V5=b({requestedSchema:q5}),B5=Gf(le([V5.and(b({mode:D("form")})),cx.and(b({mode:D("url")}))]),b({_meta:T(g(),E()).nullish(),message:g(),sessionId:Se})),j5=b({cachedReadTokens:ie().nullish(),cachedWriteTokens:ie().nullish(),inputTokens:ie(),outputTokens:ie(),thoughtTokens:ie().nullish(),totalTokens:ie()}),W5=b({_meta:T(g(),E()).nullish(),stopReason:u5,usage:j5.nullish(),userMessageId:g().nullish()});le([b({id:ra,result:le([C5,B$,yx,QP,XP,jP,KP,e5,J$,o5,i5,W5,l5,c5,p5,G$,q6])}),b({error:Z6,id:ra})]);const G5=b({_meta:T(g(),E()).nullish(),cost:Y$.nullish(),size:ie(),used:ie()}),J5=le([$m.and(b({sessionUpdate:D("user_message_chunk")})),$m.and(b({sessionUpdate:D("agent_message_chunk")})),$m.and(b({sessionUpdate:D("agent_thought_chunk")})),O5.and(b({sessionUpdate:D("tool_call")})),aS.and(b({sessionUpdate:D("tool_call_update")})),tP.and(b({sessionUpdate:D("plan")})),z5.and(b({sessionUpdate:D("available_commands_update")})),JP.and(b({sessionUpdate:D("current_mode_update")})),xP.and(b({sessionUpdate:D("config_option_update")})),WP.and(b({sessionUpdate:D("session_info_update")})),G5.and(b({sessionUpdate:D("usage_update")}))]),cS=b({_meta:T(g(),E()).nullish(),sessionId:Se,update:J5});b({method:g(),params:le([cS,rx,U6]).nullish()});const uS=b({_meta:T(g(),E()).nullish(),sessionId:Se,terminalId:g()}),Y5=b({_meta:T(g(),E()).nullish(),exitCode:ie().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:g().nullish()}),K5=b({name:g(),uri:g()}),X5=b({_meta:T(g(),E()).nullish(),repository:Ux.nullish(),workspaceFolders:W(K5).nullish(),workspaceUri:g().nullish()});b({id:ra,method:g(),params:le([aP,V$,vx,Gx,FP,px,UP,VP,MP,s5,r5,P5,a5,X5,f5,LP,F6]).nullish()});const hS=b({_meta:T(g(),E()).nullish(),content:g(),path:g(),sessionId:Se});b({id:ra,method:g(),params:le([hS,Q6,lS,K6,tS,eS,uS,X6,B5,F6]).nullish()});const Q5=b({_meta:T(g(),E()).nullish()});le([b({id:ra,result:le([Q5,pP,_P,K$,v5,mP,Y5,fx,ix,q6])}),b({error:Z6,id:ra})]);var be;class eD{constructor(t,e){m(this,be);const r=t(this),i=async(a,l)=>{var c,u,f,p,y,v,S;switch(a){case Zr.fs_write_text_file:{const _=hS.parse(l);return(c=r.writeTextFile)==null?void 0:c.call(r,_)}case Zr.fs_read_text_file:{const _=Q6.parse(l);return(u=r.readTextFile)==null?void 0:u.call(r,_)}case Zr.session_request_permission:{const _=lS.parse(l);return r.requestPermission(_)}case Zr.terminal_create:{const _=K6.parse(l);return(f=r.createTerminal)==null?void 0:f.call(r,_)}case Zr.terminal_output:{const _=tS.parse(l);return(p=r.terminalOutput)==null?void 0:p.call(r,_)}case Zr.terminal_release:{const _=eS.parse(l);return await((y=r.releaseTerminal)==null?void 0:y.call(r,_))??{}}case Zr.terminal_wait_for_exit:{const _=uS.parse(l);return(v=r.waitForTerminalExit)==null?void 0:v.call(r,_)}case Zr.terminal_kill:{const _=X6.parse(l);return await((S=r.killTerminal)==null?void 0:S.call(r,_))??{}}default:if(r.extMethod)return r.extMethod(a,l);throw nt.methodNotFound(a)}},s=async(a,l)=>{switch(a){case Zr.session_update:{const c=cS.parse(l);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(a,l);throw nt.methodNotFound(a)}};d(this,be,new tD(i,s,e))}async initialize(t){return await o(this,be).sendRequest(Le.initialize,t)}async newSession(t){return await o(this,be).sendRequest(Le.session_new,t)}async loadSession(t){return await o(this,be).sendRequest(Le.session_load,t)??{}}async unstable_forkSession(t){return await o(this,be).sendRequest(Le.session_fork,t)}async listSessions(t){return await o(this,be).sendRequest(Le.session_list,t)}async unstable_resumeSession(t){return await o(this,be).sendRequest(Le.session_resume,t)}async unstable_closeSession(t){return await o(this,be).sendRequest(Le.session_close,t)}async setSessionMode(t){return await o(this,be).sendRequest(Le.session_set_mode,t)??{}}async unstable_setSessionModel(t){return await o(this,be).sendRequest(Le.session_set_model,t)??{}}async setSessionConfigOption(t){return await o(this,be).sendRequest(Le.session_set_config_option,t)}async authenticate(t){return await o(this,be).sendRequest(Le.authenticate,t)??{}}async unstable_logout(t){return await o(this,be).sendRequest(Le.logout,t)??{}}async prompt(t){return await o(this,be).sendRequest(Le.session_prompt,t)}async cancel(t){return await o(this,be).sendNotification(Le.session_cancel,t)}async unstable_startNes(t){return await o(this,be).sendRequest(Le.nes_start,t)}async unstable_suggestNes(t){return await o(this,be).sendRequest(Le.nes_suggest,t)}async unstable_closeNes(t){return await o(this,be).sendRequest(Le.nes_close,t)??{}}async unstable_didOpenDocument(t){return await o(this,be).sendNotification(Le.document_did_open,t)}async unstable_didChangeDocument(t){return await o(this,be).sendNotification(Le.document_did_change,t)}async unstable_didCloseDocument(t){return await o(this,be).sendNotification(Le.document_did_close,t)}async unstable_didSaveDocument(t){return await o(this,be).sendNotification(Le.document_did_save,t)}async unstable_didFocusDocument(t){return await o(this,be).sendNotification(Le.document_did_focus,t)}async unstable_acceptNes(t){return await o(this,be).sendNotification(Le.nes_accept,t)}async unstable_rejectNes(t){return await o(this,be).sendNotification(Le.nes_reject,t)}async extMethod(t,e){return await o(this,be).sendRequest(t,e)}async extNotification(t,e){return await o(this,be).sendNotification(t,e)}get signal(){return o(this,be).signal}get closed(){return o(this,be).closed}}be=new WeakMap;var Gi,Jd,mu,gu,ja,Wa,ar,vu,Ue,dS,og,fS,pS,mS,gS,ag,Pc;class tD{constructor(t,e,r){m(this,Ue);m(this,Gi,new Map);m(this,Jd,0);m(this,mu);m(this,gu);m(this,ja);m(this,Wa,Promise.resolve());m(this,ar,new AbortController);m(this,vu);d(this,mu,t),d(this,gu,e),d(this,ja,r),d(this,vu,new Promise(i=>{o(this,ar).signal.addEventListener("abort",()=>i())})),h(this,Ue,dS).call(this)}get signal(){return o(this,ar).signal}get closed(){return o(this,vu)}async sendRequest(t,e){h(this,Ue,ag).call(this);const r=Mh(this,Jd)._++,i=new Promise((s,a)=>{o(this,Gi).set(r,{resolve:s,reject:a})});return await h(this,Ue,Pc).call(this,{jsonrpc:"2.0",id:r,method:t,params:e}),i}async sendNotification(t,e){h(this,Ue,ag).call(this),await h(this,Ue,Pc).call(this,{jsonrpc:"2.0",method:t,params:e})}}Gi=new WeakMap,Jd=new WeakMap,mu=new WeakMap,gu=new WeakMap,ja=new WeakMap,Wa=new WeakMap,ar=new WeakMap,vu=new WeakMap,Ue=new WeakSet,dS=async function(){let t;try{const e=o(this,ja).readable.getReader();try{for(;!o(this,ar).signal.aborted;){const{value:r,done:i}=await e.read();if(i)break;if(r)try{h(this,Ue,fS).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&h(this,Ue,Pc).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{e.releaseLock()}}catch(e){t=e}finally{h(this,Ue,og).call(this,t)}},og=function(t){if(o(this,ar).signal.aborted)return;const e=t??new Error("ACP connection closed");for(const r of o(this,Gi).values())r.reject(e);o(this,Gi).clear(),o(this,ar).abort(e)},fS=async function(t){if("method"in t&&"id"in t){const e=await h(this,Ue,pS).call(this,t.method,t.params);"error"in e&&console.error("Error handling request",t,e.error),await h(this,Ue,Pc).call(this,{jsonrpc:"2.0",id:t.id,...e})}else if("method"in t){const e=await h(this,Ue,mS).call(this,t.method,t.params);"error"in e&&console.error("Error handling notification",t,e.error)}else"id"in t?h(this,Ue,gS).call(this,t):console.error("Invalid message",{message:t})},pS=async function(t,e){try{return{result:await o(this,mu).call(this,t,e)??null}}catch(r){if(r instanceof nt)return r.toResult();if(r instanceof N2)return nt.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 nt.internalError(i?JSON.parse(i):{}).toResult()}catch{return nt.internalError({details:i}).toResult()}}},mS=async function(t,e){try{return await o(this,gu).call(this,t,e),{result:null}}catch(r){if(r instanceof nt)return r.toResult();if(r instanceof N2)return nt.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 nt.internalError(i?JSON.parse(i):{}).toResult()}catch{return nt.internalError({details:i}).toResult()}}},gS=function(t){const e=o(this,Gi).get(t.id);if(e){if("result"in t)e.resolve(t.result);else if("error"in t){const{code:r,message:i,data:s}=t.error;e.reject(new nt(r,i,s))}o(this,Gi).delete(t.id)}else console.error("Got response to unknown request",t.id)},ag=function(){if(o(this,ar).signal.aborted)throw o(this,ar).signal.reason??new Error("ACP connection closed")},Pc=async function(t){return d(this,Wa,o(this,Wa).then(async()=>{const e=o(this,ja).writable.getWriter();try{await e.write(t)}finally{e.releaseLock()}}).catch(e=>{h(this,Ue,og).call(this,e)})),o(this,Wa)};class nt extends Error{constructor(e,r,i){super(r);R(this,"code");R(this,"data");this.code=e,this.name="RequestError",this.data=i}static parseError(e,r){return new nt(-32700,`Parse error${r?`: ${r}`:""}`,e)}static invalidRequest(e,r){return new nt(-32600,`Invalid request${r?`: ${r}`:""}`,e)}static methodNotFound(e){return new nt(-32601,`"Method not found": ${e}`,{method:e})}static invalidParams(e,r){return new nt(-32602,`Invalid params${r?`: ${r}`:""}`,e)}static internalError(e,r){return new nt(-32603,`Internal error${r?`: ${r}`:""}`,e)}static authRequired(e,r){return new nt(-32e3,`Authentication required${r?`: ${r}`:""}`,e)}static resourceNotFound(e){return new nt(-32002,`Resource not found${e?`: ${e}`:""}`,e&&{uri:e})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}function nD(n,t,e){const r=n.dispose.bind(n);n.dispose=(()=>{if(!t())return e(),r()})}function vS(n){var e;class t extends n{constructor(...s){super(...s);m(this,e,!1);nD(this,()=>o(this,e),()=>{d(this,e,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return o(this,e)}}return e=new WeakMap,t}const rD=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,iD=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,sD=/\[Television channel context\][\s\S]*?\[\/Television channel context\]\n*/,oD=/\b(tv|television|channel|artifact|artifacts|viewer|filmstrip|layout|focus)\b/i,aD=/^[A-Za-z0-9_@%+=:,./-]+$/,lD=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,cD="single_session",uD={name:"television-acp-client",version:"0.0.0"},yS="agent:main:television",hD=vS(Ri);var Ga,lr,rn,cr,Ji,Nn,Jr,ur,zn,Yi,Hn,Ja,Ya,hr,kt,Yr,Ka,mo,Kr,Ki,yu,Zn,dr,Yd,fr,L,lg,wS,bS,SS,td,_S,AS,ES,kS,TS,CS,RS,Ws,Ea,ka,Fr,IS,Ta,cg,ug,nd,$S,rd,hg,dg,wu,bu,id,Ca,fg,xS;class dD extends hD{constructor(e){super();m(this,L);m(this,Ga,"disconnected");m(this,lr,null);m(this,rn,new Map);m(this,cr,null);m(this,Ji,null);m(this,Nn,null);m(this,Jr,null);m(this,ur,null);m(this,zn,null);m(this,Yi);m(this,Hn,null);m(this,Ja,0);m(this,Ya,1);m(this,hr,null);m(this,kt,null);m(this,Yr,!1);m(this,Ka,!1);m(this,mo,!1);m(this,Kr,null);m(this,Ki,new Set);m(this,yu);m(this,Zn);m(this,dr);m(this,Yd,e=>{h(this,L,bS).call(this,e)});m(this,fr,null);m(this,wu,()=>{h(this,L,Ca).call(this,"ACP bridge websocket closed")});m(this,bu,()=>{h(this,L,Ca).call(this,"ACP bridge websocket error")});d(this,Zn,e),d(this,dr,e.sessionMode??cD),d(this,Yi,e.mappedSessionStore??fD()),d(this,yu,e.createSocket??(r=>new WebSocket(r)))}get status(){return o(this,Ga)}get messages(){return[...o(this,rn).values()]}get enabled(){return o(this,Zn).enabled??!1}setToken(e){o(this,Zn).token=e??""}setEnabled(e){o(this,Zn).enabled=e,e||(h(this,L,id).call(this),d(this,lr,null),h(this,L,Fr).call(this,"disconnected"))}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(this.enabled&&this.status==="disconnected"){o(this,Ji)===null&&(d(this,lr,null),d(this,Ji,h(this,L,wS).call(this)));try{await o(this,Ji),await h(this,L,td).call(this)}catch(e){throw h(this,L,Ca).call(this,xm(e)),e}}}dispose(){h(this,L,id).call(this),d(this,lr,null),h(this,L,Fr).call(this,"disposed")}async sendMessage(e){if(await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,L,lg).call(this,"ready")),(o(this,ur)===null||o(this,Hn)!==h(this,L,rd).call(this))&&await h(this,L,td).call(this),this.status!=="ready")throw new Error("ACPClient is not ready to send a new message");const r=e.text.trim();if(!r)throw new Error("Cannot send an empty message");h(this,L,Ea).call(this,{id:h(this,L,Ta).call(this,"user"),kind:"user",text:r,status:"final"}),h(this,L,Fr).call(this,"running");try{const i=await h(this,L,nd).call(this).prompt({sessionId:h(this,L,ug).call(this),prompt:[{type:"text",text:h(this,L,IS).call(this,r)}]});h(this,L,Ws).call(this,i.stopReason==="cancelled"?"cancelled":"final"),h(this,L,Fr).call(this,"ready")}catch(i){throw h(this,L,xS).call(this)||(h(this,L,Ws).call(this,"error"),h(this,L,Fr).call(this,"ready")),i}}async startNewSession(){var r;await this.connect(),(this.status==="running"||this.status==="cancelling")&&(await this.cancel(),await h(this,L,lg).call(this,"ready"));const e=h(this,L,rd).call(this);((r=o(this,zn))==null?void 0:r.sessionIdStrategy)==="mapped"?o(this,Yi).clearActualSessionId(e):d(this,Ja,o(this,Ja)+1),d(this,Nn,null),d(this,Jr,null),d(this,ur,null),d(this,Hn,null),h(this,L,fg).call(this)}async cancel(){this.status==="running"&&(h(this,L,Fr).call(this,"cancelling"),await h(this,L,nd).call(this).cancel({sessionId:h(this,L,ug).call(this)}))}setChannelContext(e){var s,a,l;if(e===null){if(o(this,kt)===null)return;d(this,kt,null),d(this,Yr,!1);return}const r={channelID:e.channelID,channelName:e.channelName};if(((s=o(this,kt))==null?void 0:s.channelID)===r.channelID&&((a=o(this,kt))==null?void 0:a.channelName)===r.channelName)return;const i=((l=o(this,kt))==null?void 0:l.channelID)??null;if(d(this,kt,r),o(this,dr)==="single_session"){(!o(this,Hn)||i!==r.channelID)&&d(this,Yr,!0);return}o(this,Hn)!==h(this,L,hg).call(this,r.channelID)&&(d(this,Nn,null),d(this,Jr,null),o(this,cr)&&this.status==="ready"&&h(this,L,td).call(this).catch(c=>{h(this,L,Ca).call(this,xm(c))}))}}Ga=new WeakMap,lr=new WeakMap,rn=new WeakMap,cr=new WeakMap,Ji=new WeakMap,Nn=new WeakMap,Jr=new WeakMap,ur=new WeakMap,zn=new WeakMap,Yi=new WeakMap,Hn=new WeakMap,Ja=new WeakMap,Ya=new WeakMap,hr=new WeakMap,kt=new WeakMap,Yr=new WeakMap,Ka=new WeakMap,mo=new WeakMap,Kr=new WeakMap,Ki=new WeakMap,yu=new WeakMap,Zn=new WeakMap,dr=new WeakMap,Yd=new WeakMap,fr=new WeakMap,L=new WeakSet,lg=async function(e){if(this.status!==e){if(this.status==="disposed")throw new Error("ACPClient has been disposed");if(this.status==="disconnected")throw new Error(o(this,lr)??"ACPClient is disconnected");await new Promise((r,i)=>{const s=()=>{this.removeEventListener("status-changed",a)},a=()=>{if(this.status===e){s(),r();return}if(this.status==="disposed"){s(),i(new Error("ACPClient has been disposed"));return}this.status==="disconnected"&&(s(),i(new Error(o(this,lr)??"ACPClient is disconnected")))};this.addEventListener("status-changed",a)})}},wS=async function(){try{const{stream:e,socket:r,metadata:i}=await vD({serverURL:o(this,Zn).serverURL,token:o(this,Zn).token,createSocket:o(this,yu),onDisconnect:o(this,Yd)});d(this,zn,i),d(this,fr,r),r.addEventListener("close",o(this,wu)),r.addEventListener("error",o(this,bu)),d(this,cr,new eD(s=>({connection:s,sessionUpdate:async a=>{await h(this,L,AS).call(this,a)},requestPermission:async a=>h(this,L,ES).call(this,a)}),e)),await o(this,cr).initialize({protocolVersion:N$,clientCapabilities:{},clientInfo:uD})}catch(e){throw e}},bS=function(e){h(this,L,Ca).call(this,xm(e))},SS=function(e){const r=e==null?void 0:e.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},td=async function(){const e=h(this,L,rd).call(this);if(o(this,Nn)&&o(this,Jr)===e){await o(this,Nn);return}d(this,Jr,e),d(this,Nn,h(this,L,_S).call(this,e)),await o(this,Nn)},_S=async function(e){var c;const r=h(this,L,nd).call(this);h(this,L,fg).call(this);let i,s=!1,a=null;const l={cwd:h(this,L,$S).call(this),mcpServers:[],_meta:{sessionKey:e}};try{if(d(this,mo,!0),d(this,Kr,null),((c=o(this,zn))==null?void 0:c.sessionIdStrategy)==="mapped"){const u=o(this,Yi).getActualSessionId(e);if(u)try{const f=await r.loadSession({...l,sessionId:u});if(pD(f))throw new Error("Mapped ACP session was not found");a=f,i=u,s=!0}catch{const f=await r.newSession(l);a=f,i=f.sessionId,o(this,Yi).setActualSessionId(e,i),s=!1}else{const f=await r.newSession(l);a=f,i=f.sessionId,o(this,Yi).setActualSessionId(e,i),s=!1}}else try{a=await r.loadSession({...l,sessionId:e}),i=e,s=o(this,rn).size>0}catch{const u=await r.newSession(l);a=u,i=u.sessionId,s=!1}}finally{d(this,mo,!1),d(this,Kr,null),h(this,L,Ws).call(this,"final")}h(this,L,SS).call(this,a),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),d(this,ur,i),d(this,Hn,e),d(this,Ka,!0),s?(o(this,Ki).add(e),o(this,dr)==="single_session"&&d(this,Yr,!1)):(o(this,Ki).delete(e),d(this,Yr,o(this,dr)==="single_session")),d(this,lr,null),h(this,L,Fr).call(this,"ready")},AS=async function(e){const r=e.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&h(this,L,RS).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&h(this,L,kS).call(this,r.content.text);return;case"tool_call":h(this,L,TS).call(this,r);return;case"tool_call_update":h(this,L,CS).call(this,r);return;case"agent_thought_chunk":return;default:return}},ES=async function(e){return{outcome:{outcome:"cancelled"}}},kS=function(e){d(this,Kr,null);const r=gD(e);if(!r)return;if(!o(this,hr)){const s={id:h(this,L,Ta).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};d(this,hr,s.id),h(this,L,Ea).call(this,s);return}const i=o(this,rn).get(o(this,hr));if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");h(this,L,ka).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},TS=function(e){h(this,L,Ws).call(this,"final");const r=h(this,L,cg).call(this,e.toolCallId),i=J2("content"in e?e.content:void 0),s={id:(r==null?void 0:r.id)??h(this,L,Ta).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:e.title,toolKind:e.kind??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:e.locations??(r==null?void 0:r.locations)};if(r){h(this,L,ka).call(this,s);return}h(this,L,Ea).call(this,s)},CS=function(e){const r=h(this,L,cg).call(this,e.toolCallId),i=(r==null?void 0:r.text)??"",s=J2(e.content),a=s?`${i}${s}`:i,l={id:(r==null?void 0:r.id)??h(this,L,Ta).call(this,"tool"),kind:"tool_call",toolCallId:e.toolCallId,title:(r==null?void 0:r.title)??e.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:e.status==="failed"?"failed":e.status==="completed"?"completed":"in_progress",text:a,locations:e.locations??(r==null?void 0:r.locations)};if(r){h(this,L,ka).call(this,l);return}h(this,L,Ea).call(this,l)},RS=function(e){if(h(this,L,Ws).call(this,"final"),!e)return;const r=o(this,mo)?o(this,Kr):null;if(!r){const s=G2(e);if(!s)return;const a={id:h(this,L,Ta).call(this,"user"),kind:"user",text:s,status:"final"};h(this,L,Ea).call(this,a),o(this,mo)&&d(this,Kr,a.id);return}const i=o(this,rn).get(r);if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");h(this,L,ka).call(this,{...i,text:G2(`${i.text}${e}`)})},Ws=function(e){if(!o(this,hr))return;const r=o(this,rn).get(o(this,hr));(r==null?void 0:r.kind)==="assistant"&&h(this,L,ka).call(this,{...r,status:e}),d(this,hr,null)},Ea=function(e){o(this,rn).set(e.id,e),this.dispatchEvent(new Cm("messages-changed"))},ka=function(e){o(this,rn).set(e.id,e),this.dispatchEvent(new Cm("messages-changed"))},Fr=function(e){o(this,Ga)!==e&&(d(this,Ga,e),this.dispatchEvent(new ST("status-changed")))},IS=function(e){var u;const r=o(this,Hn);if(!r)return e;const i=o(this,kt)?o(this,dr)==="single_session"?o(this,Yr)||!o(this,Ki).has(r):!o(this,Ki).has(r):!1,s=o(this,Ka)&&(o(this,kt)!==null||oD.test(e));if(!(s||i))return e;s&&d(this,Ka,!1),i&&(d(this,Yr,!1),o(this,Ki).add(r));const l=["[Television channel context]","This chat session is coming from a Television client.","Using Television requires the knowledge in the `television` skill. Re-read it only if it is not already in context or you know it changed.","If the skill is not installed, it can be installed via `tv skills install <your agent skills path>`."],c=((u=o(this,zn))==null?void 0:u.tvArgs)??[];return c.length>0&&l.push(`To reach this Television server, add these arguments to each tv command that contacts it: ${c.map(bD).join(" ")}`),o(this,kt)?(l.push("This conversation is currently attached to the channel below."),l.push(`channel_id: ${o(this,kt).channelID}`),l.push(`channel_name: ${o(this,kt).channelName??""}`),l.push("When the user asks to inspect or change Television state with the tv CLI, use this channel ID with the --channel argument.")):l.push("There is currently no active Television channel."),l.push("[/Television channel context]","",e),l.join(`
65
- `)},Ta=function(e){const r=`${e}-${o(this,Ya)}`;return d(this,Ya,o(this,Ya)+1),r},cg=function(e){for(const r of o(this,rn).values())if((r==null?void 0:r.kind)==="tool_call"&&r.toolCallId===e)return r;return null},ug=function(){if(!o(this,ur))throw new Error("ACP session is not ready");return o(this,ur)},nd=function(){if(!o(this,cr))throw new Error("ACP connection is not ready");return o(this,cr)},$S=function(){var r;const e=(r=o(this,zn))==null?void 0:r.sessionCwd;if(!e)throw new Error("ACP bridge session cwd is not ready");return e},rd=function(){var r;if(o(this,dr)==="single_session")return h(this,L,dg).call(this,`${yS}-${(o(this,Zn).clientGUID??"default-client").toLowerCase()}`);const e=(r=o(this,kt))==null?void 0:r.channelID;if(!e)throw new Error("Channel context is required for per-channel session mode");return h(this,L,hg).call(this,e)},hg=function(e){return h(this,L,dg).call(this,mD(o(this,dr),e,o(this,Zn).clientGUID??"default-client"))},dg=function(e){var r;return((r=o(this,zn))==null?void 0:r.sessionIdStrategy)==="deterministic"&&o(this,Ja)>0?`${e}:epoch-${o(this,Ja)}`:e},wu=new WeakMap,bu=new WeakMap,id=function(){d(this,cr,null),d(this,Ji,null),d(this,Nn,null),d(this,Jr,null),d(this,ur,null),d(this,Hn,null),d(this,zn,null),o(this,fr)&&(o(this,fr).removeEventListener("close",o(this,wu)),o(this,fr).removeEventListener("error",o(this,bu)),o(this,fr).close(),d(this,fr,null))},Ca=function(e){const r=o(this,cr)!==null||o(this,Ji)!==null||o(this,Nn)!==null||o(this,Jr)!==null||o(this,ur)!==null||o(this,Hn)!==null||o(this,zn)!==null||o(this,fr)!==null;this.disposed||this.status==="disconnected"&&!r||(h(this,L,Ws).call(this,"error"),h(this,L,id).call(this),d(this,lr,e??null),h(this,L,Fr).call(this,"disconnected"))},fg=function(){const e=o(this,rn).size>0;d(this,hr,null),d(this,Kr,null),d(this,Ya,1),o(this,rn).clear(),e&&this.dispatchEvent(new Cm("messages-changed"))},xS=function(){return this.status==="disconnected"};function fD(){const n=new Map;return{getActualSessionId(t){return n.get(t)??null},setActualSessionId(t,e){n.set(t,e)},clearActualSessionId(t){n.delete(t)}}}function pD(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function mD(n,t,e){return n==="single_session"?`${yS}-${e.toLowerCase()}`:`agent:main:television-${e.toLowerCase()}-${t.toLowerCase()}`}function PS(n){return n.replace(/^(?:\s*\n)+/,"")}function G2(n){let t=n;return t=t.replace(rD,""),t=t.replace(iD,""),t=t.replace(sD,""),t=PS(t),t}function gD(n){let t=n;return t=t.replace(lD,""),t=PS(t),t}function J2(n){return!n||n.length===0?"":n.flatMap(t=>t.type==="content"&&t.content.type==="text"?[t.content.text]:[]).join("")}async function vD(n){const t=n.createSocket(_D(n.serverURL,n.token));let e=!1,r,i;const s=new Promise((u,f)=>{r=u,i=f}),a=new ReadableStream({start(u){let f=!1;const p=()=>{t.send(JSON.stringify({type:"acp-bridge-connect"}))},y=_=>{const I=SD(_);if(!I)return;let Z;try{Z=JSON.parse(I)}catch(O){const z=O instanceof Error?O:new Error(String(O));i(z),u.error(z);return}switch(Z.type){case"acp-bridge-status":if(Z.status==="ready"){let O;try{O=yD(Z)}catch(z){const P=z instanceof Error?z:new Error(String(z));e||i(P),u.error(P);return}e||(e=!0,r(O));return}if(Z.status==="error"||Z.status==="exited"){const O=new Error(Z.error??`ACP bridge ${Z.status}`);e||i(O),u.error(O)}return;case"acp-bridge-message":u.enqueue(Z.message);return}},v=()=>{var I;if(f)return;f=!0;const _=new Error("ACP bridge websocket closed");e||i(_),(I=n.onDisconnect)==null||I.call(n,_),u.close()},S=()=>{var I;if(f)return;f=!0;const _=new Error("ACP bridge websocket error");e||i(_),(I=n.onDisconnect)==null||I.call(n,_),u.error(_)};t.addEventListener("open",p),t.addEventListener("message",y),t.addEventListener("close",v),t.addEventListener("error",S)}}),l=new WritableStream({async write(u){await s,t.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){t.close()},abort(){t.close()}}),c=await s;return{stream:{readable:a,writable:l},socket:t,metadata:c}}function yD(n){const{agent:t,sessionIdStrategy:e,sessionCwd:r,tvArgs:i}=n;if((t==="openclaw"||t==="hermes")&&(e==="deterministic"||e==="mapped")&&typeof r=="string"&&r.length>0&&wD(i))return{agent:t,sessionIdStrategy:e,sessionCwd:r,tvArgs:i};throw new Error("ACP bridge ready status missing bootstrap metadata")}function wD(n){return Array.isArray(n)&&n.every(t=>typeof t=="string")}function bD(n){return aD.test(n)?n:`'${n.replace(/'/g,"'\\''")}'`}function SD(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const t=n.data;if(typeof t=="string")return t;if(t instanceof Uint8Array)return new TextDecoder().decode(t);if(Array.isArray(t))return Buffer.concat(t).toString("utf8")}return null}function _D(n,t){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname="/acp",e.search="",e.searchParams.set("token",t),e.hash="",e.toString()}function xm(n){return n instanceof Error?n.message:String(n)}const Y2="television.acpClientGUID",K2="television.acpMappedSessions",X2=1;var Xa;class AD{constructor(){m(this,Xa,new Map)}getActualSessionId(t){return o(this,Xa).get(t)??null}setActualSessionId(t,e){o(this,Xa).set(t,e)}clearActualSessionId(t){o(this,Xa).delete(t)}}Xa=new WeakMap;var Qa,Su,hn,sd,od,pg;class ED{constructor(t,e){m(this,hn);m(this,Qa);m(this,Su);d(this,Qa,t),d(this,Su,e)}getActualSessionId(t){const e=h(this,hn,od).call(this)[h(this,hn,sd).call(this,t)];return typeof e=="string"&&e.length>0?e:null}setActualSessionId(t,e){const r=h(this,hn,od).call(this);r[h(this,hn,sd).call(this,t)]=e,h(this,hn,pg).call(this,r)}clearActualSessionId(t){const e=h(this,hn,od).call(this);delete e[h(this,hn,sd).call(this,t)],h(this,hn,pg).call(this,e)}}Qa=new WeakMap,Su=new WeakMap,hn=new WeakSet,sd=function(t){return JSON.stringify([o(this,Su),t])},od=function(){const t=o(this,Qa).getItem(K2);if(!t)return{};let e;try{e=JSON.parse(t)}catch{return{}}if(typeof e!="object"||e===null||Array.isArray(e))return{};const r=e;return r.version!==X2?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},pg=function(t){const e={version:X2,entries:t};o(this,Qa).setItem(K2,JSON.stringify(e))};function DS(){return typeof window>"u"?null:window.localStorage}function kD(n){const t=n.getItem(Y2);if(t)return t;const e=ev().toLowerCase();return n.setItem(Y2,e),e}const Q2=4401,TD=401,qh=1e3,CD=3e4;class ad extends Error{constructor(t="Authentication required"){super(t),this.name="AuthError"}}class RD extends Ri{constructor(e){var a,l;super();R(this,"url");R(this,"name");R(this,"telemetryMeta");R(this,"status","unauthorized");R(this,"channels",new Map);R(this,"client");R(this,"acpClient");R(this,"_token");R(this,"attempting",!1);R(this,"nextRetryAt",null);R(this,"hasEverConnected",!1);R(this,"failedReconnectAttempts",0);R(this,"browserDemoMode",!1);R(this,"hasAuthRejected",!1);R(this,"bootState","pending");R(this,"serverVersion",null);R(this,"updateState",null);R(this,"decideBoot");R(this,"navigationPending");R(this,"createSocket");R(this,"createClient");R(this,"socket",null);R(this,"connectAttempt",0);R(this,"autoReconnect",!1);R(this,"retryTimer",null);R(this,"retryDelay",qh);R(this,"visibilityEventTarget");R(this,"networkEventTarget");R(this,"onVisibilityChange");R(this,"onNetworkOnline");R(this,"telemetryActivityAgent");this.url=aa(e.url),this.name=e.name,this.decideBoot=e.decideBoot??null,this.navigationPending=e.navigationPending??(()=>!1),this._token=e.token??null,this.telemetryMeta=e.telemetryMeta??null,this.createSocket=e.createSocket??(c=>new WebSocket(c)),this.createClient=e.createClient??((c,u,f)=>new Gk(c,{token:u??void 0,onUnauthorized:()=>this.handleAuthRejected(),...f?{telemetryMeta:f}:{}})),this.client=this.createClient(this.url,this._token,this.telemetryMeta);const r=e.mappedSessionStore??(e.acpStorage?new ED(e.acpStorage,this.url):new AD);this.acpClient=new dD({serverURL:this.url,token:this._token??"",...e.createACPSocket?{createSocket:e.createACPSocket}:e.createSocket?{createSocket:e.createSocket}:{},...e.clientGUID?{clientGUID:e.clientGUID}:{},mappedSessionStore:r}),this.visibilityEventTarget=e.visibilityEventTarget!==void 0?e.visibilityEventTarget:typeof document<"u"?document:null,this.networkEventTarget=e.networkEventTarget!==void 0?e.networkEventTarget:typeof window<"u"?window:null,this.onVisibilityChange=()=>{this.isPageVisible()&&this.kickReconnect()},this.onNetworkOnline=()=>{this.kickReconnect()},(a=this.visibilityEventTarget)==null||a.addEventListener("visibilitychange",this.onVisibilityChange),(l=this.networkEventTarget)==null||l.addEventListener("online",this.onNetworkOnline);const i=e.telemetryDocumentTarget!==void 0?e.telemetryDocumentTarget:typeof document<"u"?document:null,s=e.telemetryWindowTarget!==void 0?e.telemetryWindowTarget:typeof window<"u"?window:null;this.telemetryActivityAgent=this.telemetryMeta&&i&&s?O$({meta:this.telemetryMeta,documentTarget:i,windowTarget:s,send:c=>this.sendTelemetryActivity(c)}):null}get token(){return this._token}clearToken(){this._token=null,this.acpClient.setToken(null),this.client=this.createClient(this.url,null,this.telemetryMeta)}async connect(e){this._token=e,this.hasAuthRejected=!1,this.acpClient.setToken(e),this.cancelRetryTimer(),this.retryDelay=qh,this.autoReconnect=!0,await this.attempt()}dispose(){var e,r,i,s;this.autoReconnect=!1,this.connectAttempt+=1,this.cancelRetryTimer(),(e=this.socket)==null||e.close(),this.socket=null,this.setStatus("unauthorized"),(r=this.visibilityEventTarget)==null||r.removeEventListener("visibilitychange",this.onVisibilityChange),(i=this.networkEventTarget)==null||i.removeEventListener("online",this.onNetworkOnline),(s=this.telemetryActivityAgent)==null||s.stop(),this.acpClient.dispose()}getViewURL(e){const r=ru(e,this.renderOptions());return bi()?new URL(r.viewURL,this.url).toString():r.renderer==="proxy-iframe"?new URL(r.viewURL,this.url).toString():r.viewURL}async readDemoMode(){try{return await this.client.demoMode()}catch{return null}}renderOptions(){return{electron:bi(),browserDemo:this.browserDemoMode}}getContentURL(e){const r=ru(e,this.renderOptions()).contentURL;return r===null?null:new URL(r,this.url).toString()}async createChannel(e){const{channel:r}=await this.client.channels.create({name:e});return this.channels.set(r.id,structuredClone(r)),r}applyServerEvent(e){switch(e.type){case"channel-created":this.channels.set(e.channel.id,structuredClone(e.channel)),this.dispatchEvent(new $c("channels-changed"));break;case"channel-updated":this.channels.set(e.channel.id,structuredClone(e.channel)),this.dispatchEvent(new $c("channels-changed"));break;case"channel-removed":this.channels.delete(e.channelID),this.dispatchEvent(new $c("channels-changed"));break;case"artifact-created":{const r=this.channels.get(e.channelID);r&&!fk(r).includes(e.artifact.id)&&(r.layout=[...r.layout,{artifactIds:[e.artifact.id],geometry:{...D8},size:{...O8}}]);break}case"artifact-removed":{const r=this.channels.get(e.channelID);r&&(r.layout=Bm(r.layout,e.artifactID));break}case"artifact-updated":case"artifact-content-changed":case"channel-changed":case"pinned-channels-changed":case"theme-changed":case"appearance-changed":case"artifact-focus":break;default:return ID(e,"server event")}}async attempt(){var i;this.attempting=!0,this.nextRetryAt=null,this.connectAttempt+=1,this.bootState="pending";const e=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this._token,this.telemetryMeta),this.setStatus("disconnected"),this.dispatchEvent(new Wt("change"));const r=this.createSocket($D(this.url,this._token,this.telemetryMeta));return this.socket=r,await new Promise((s,a)=>{let l=!1,c=!1;const u=()=>{var y;l||this.connectAttempt!==e||(l=!0,c=!0,this.retryDelay=qh,this.hasEverConnected=!0,this.failedReconnectAttempts=0,this.setStatus("connected"),(y=this.telemetryActivityAgent)==null||y.start(),s())},f=y=>{l||this.connectAttempt!==e||(l=!0,a(y))},p=async()=>{const y=this.hasEverConnected;try{const[{channels:v},S,_]=await Promise.all([this.client.channels.list(),this.client.display.get(),y?null:this.readDemoMode()]);y||(this.browserDemoMode=(_==null?void 0:_.browserExternalPages)===!0),this.channels=new Map(v.map(I=>[I.id,structuredClone(I)])),this.acpClient.setEnabled(S.acpEnabled),this.dispatchEvent(new Wt("change")),y&&this.dispatchEvent(new $c("channels-changed")),this.dispatchEvent(new Qh("server-event",{event:{type:"channel-changed",channelID:S.focusedChannelId}})),this.dispatchEvent(new Qh("server-event",{event:{type:"pinned-channels-changed",pinnedChannelIds:[...S.pinnedChannelIds]}})),u(),y&&this.connectAttempt===e&&this.dispatchEvent(new Y8("server-reconnected"))}catch(v){if(MD(v)){f(new ad);return}f(v instanceof Error?v:new Error(String(v)))}};r.addEventListener("open",()=>{this.decideBoot===null&&(this.bootState="booted",this.navigationPending()||p())}),r.addEventListener("message",y=>{const v=LD(y);if(!v)return;if(v.type==="server-status"){const _=v;this.serverVersion=_.version,this.updateState=_.update??null;let I=!1;this.decideBoot!==null&&this.bootState==="pending"&&this.connectAttempt===e&&(this.decideBoot(_)==="boot"?(this.bootState="booted",I=!0):(this.bootState="halted",this.attempting=!1)),this.dispatchEvent(new K8("server-status",{message:_})),I?this.navigationPending()||p():this.bootState==="halted"&&!this.navigationPending()&&this.dispatchEvent(new Wt("change"));return}if(!OD(v.type))return;const S=v;this.applyServerEvent(S),this.dispatchEvent(new Qh("server-event",{event:S}))}),r.addEventListener("close",y=>{if(this.connectAttempt!==e)return;this.socket=null;const v=xD(y);if(!l){f(v===Q2?new ad:new Error("Connection closed before initialization"));return}if(c){if(v===Q2){this.handleAuthRejected();return}this.handleTransportFailure(new Error("Connection closed"))}}),r.addEventListener("error",()=>{if(this.connectAttempt===e){if(l){if(!c)return;this.handleTransportFailure(new Error("WebSocket error"));return}f(new Error("WebSocket connection failed"))}})}).then(()=>{this.attempting=!1},s=>{throw this.attempting=!1,this.handleAttemptFailure(s),s})}handleAuthRejected(){this.hasAuthRejected=!0,this.autoReconnect=!1,this.cancelRetryTimer(),this.setStatus("unauthorized")}handleAttemptFailure(e){if(e instanceof ad){this.handleAuthRejected();return}this.autoReconnect&&(this.hasEverConnected&&(this.failedReconnectAttempts+=1),this.scheduleRetry())}handleTransportFailure(e){this.autoReconnect&&(this.setStatus("disconnected"),this.scheduleRetry())}scheduleRetry(){this.cancelRetryTimer(),this.connectAttempt+=1;const e=this.retryDelay;this.retryDelay=Math.min(this.retryDelay*2,CD),this.nextRetryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.attempt().catch(()=>{})},e),this.dispatchEvent(new Wt("change"))}cancelRetryTimer(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.nextRetryAt!==null&&(this.nextRetryAt=null,this.dispatchEvent(new Wt("change")))}kickReconnect(){this.autoReconnect&&this.status!=="connected"&&(this.attempting||(this.cancelRetryTimer(),this.retryDelay=qh,this.attempt().catch(()=>{})))}sendTelemetryActivity(e){var r;this.status==="connected"&&((r=this.socket)==null||r.send(JSON.stringify(e)))}sendTelemetrySignal(e,r){var s;if(!this.telemetryMeta||this.status!=="connected"&&this.bootState!=="halted")return;const i={type:dk,clientId:this.telemetryMeta.clientId,event:e,properties:r};(s=this.socket)==null||s.send(JSON.stringify(i))}setStatus(e){this.status!==e&&(this.status=e,this.dispatchEvent(new Wt("change")))}isPageVisible(){return this.visibilityEventTarget===null?!0:this.visibilityEventTarget.visibilityState==="visible"}}function ID(n,t){throw new Error(`Unexpected ${t}: ${JSON.stringify(n)}`)}function $D(n,t,e=null){const r=new URL(n);if(r.protocol=r.protocol==="https:"?"wss:":"ws:",r.pathname="/events",r.search="",t&&r.searchParams.set("token",t),e)for(const[i,s]of D$(e))r.searchParams.set(i,s);return r.hash="",r.toString()}function xD(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}const PD={"artifact-created":!0,"artifact-updated":!0,"artifact-content-changed":!0,"artifact-removed":!0,"channel-created":!0,"channel-updated":!0,"channel-removed":!0,"channel-changed":!0,"pinned-channels-changed":!0,"theme-changed":!0,"appearance-changed":!0,"artifact-focus":!0},DD=new Set(Object.keys(PD));function OD(n){return DD.has(n)}function LD(n){const t=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}return typeof e!="object"||e===null||!("type"in e)||typeof e.type!="string"?null:e}function MD(n){return n instanceof ec&&n.status===TD}const ND="Local";var pr,Un,Ei,OS,mg,LS,_u,Au,Eu,ku,Tu;class zD extends Ri{constructor(e){super();m(this,Ei);R(this,"connection");R(this,"clientGUID");R(this,"acpStorage");R(this,"connectError",null);m(this,pr);m(this,Un,!1);m(this,_u,()=>{o(this,Un)||(h(this,Ei,LS).call(this),this.dispatchEvent(new Wt("change")))});m(this,Au,e=>{o(this,Un)||this.dispatchEvent(new Qh("server-event",{event:e.event}))});m(this,Eu,()=>{o(this,Un)||this.dispatchEvent(new $c("channels-changed"))});m(this,ku,()=>{o(this,Un)||this.dispatchEvent(new Y8("server-reconnected"))});m(this,Tu,e=>{o(this,Un)||this.dispatchEvent(new K8("server-status",{message:e.message}))});d(this,pr,e.localStore),this.acpStorage=e.acpStorage===void 0?DS():e.acpStorage,this.clientGUID=e.clientGUID??(this.acpStorage?kD(this.acpStorage):ev().toLowerCase());const r=aa(e.serverURL);e.launchToken!==void 0&&e.launchToken!==null&&o(this,pr).set(kT(o(this,pr).get(),r,e.launchToken));const i=e.launchToken??b2(o(this,pr).get(),r),s=e.createSocket??(l=>new WebSocket(l)),a=e.createConnection??(l=>new RD(l));this.connection=a({url:r,name:e.connectionName??ND,token:i,createSocket:s,clientGUID:this.clientGUID,acpStorage:this.acpStorage,telemetryMeta:e.telemetryMeta??null,decideBoot:e.decideBoot,navigationPending:e.navigationPending}),this.connection.addEventListener("change",o(this,_u)),this.connection.addEventListener("server-event",o(this,Au)),this.connection.addEventListener("channels-changed",o(this,Eu)),this.connection.addEventListener("server-reconnected",o(this,ku)),this.connection.addEventListener("server-status",o(this,Tu))}get storedAuthToken(){return b2(o(this,pr).get(),this.connection.url)}async connect(){await h(this,Ei,OS).call(this,this.connection.token)}dispose(){o(this,Un)||(d(this,Un,!0),this.connection.removeEventListener("change",o(this,_u)),this.connection.removeEventListener("server-event",o(this,Au)),this.connection.removeEventListener("channels-changed",o(this,Eu)),this.connection.removeEventListener("server-reconnected",o(this,ku)),this.connection.removeEventListener("server-status",o(this,Tu)),this.connection.dispose())}}pr=new WeakMap,Un=new WeakMap,Ei=new WeakSet,OS=async function(e){if(!o(this,Un)){h(this,Ei,mg).call(this,null);try{await this.connection.connect(e)}catch(r){h(this,Ei,mg).call(this,r instanceof ad?null:r instanceof Error?r.message:String(r))}}},mg=function(e){this.connectError!==e&&(this.connectError=e,this.dispatchEvent(new Wt("change")))},LS=function(){if(this.connection.status!=="unauthorized"||!this.connection.hasAuthRejected)return;const e=o(this,pr).get(),r=TT(e,this.connection.url);r!==e&&o(this,pr).set(r),this.connection.token!==null&&this.connection.clearToken()},_u=new WeakMap,Au=new WeakMap,Eu=new WeakMap,ku=new WeakMap,Tu=new WeakMap;const gg="tv-nav:",Bl="tv-reload",eb=100,HD=1e3,ZD=60,UD=60,FD=24,qD=30,VD=qD*FD*UD*ZD*HD;function Si(n){try{const t=new URL(n,window.location.href),e=t.searchParams.has(Bl);return t.searchParams.delete(Bl),t.origin===window.location.origin?`${t.pathname}${t.search}${t.hash}`:e?t.toString():n}catch{return n}}var Cu,el,De,Ie,go,Ke,MS,zi,NS,vg,yg;class BD extends Ri{constructor(e,r){super();m(this,Ke);m(this,Cu);m(this,el);m(this,De,[]);m(this,Ie,-1);m(this,go,0);d(this,Cu,e),d(this,el,Si(r)),h(this,Ke,MS).call(this)}get currentURL(){var e;return o(this,Ie)===-1?null:((e=o(this,De)[o(this,Ie)])==null?void 0:e.url)??null}get canGoBack(){return o(this,Ie)>-1}get canGoForward(){return o(this,Ie)<o(this,De).length-1}get entries(){return o(this,De).map(e=>({...e}))}get cursor(){return o(this,Ie)}navigate(e){const r=Si(e);if(r===o(this,el)){if(o(this,Ie)===-1)return;d(this,Ie,-1),h(this,Ke,zi).call(this);return}o(this,Ie)<o(this,De).length-1&&d(this,De,o(this,De).slice(0,o(this,Ie)+1)),o(this,De).push({url:r}),d(this,Ie,o(this,De).length-1),h(this,Ke,vg).call(this),h(this,Ke,zi).call(this)}replace(e){var i;if(o(this,Ie)===-1){this.navigate(e);return}const r=Si(e);if(r===o(this,el)){d(this,De,o(this,De).filter((s,a)=>a!==o(this,Ie))),d(this,Ie,-1),h(this,Ke,zi).call(this);return}((i=o(this,De)[o(this,Ie)])==null?void 0:i.url)!==r&&(d(this,De,o(this,De).map((s,a)=>a===o(this,Ie)?{url:r}:s)),h(this,Ke,zi).call(this))}back(){o(this,Ie)!==-1&&(d(this,Ie,o(this,Ie)-1),h(this,Ke,zi).call(this))}forward(){this.canGoForward&&(d(this,Ie,o(this,Ie)+1),h(this,Ke,zi).call(this))}reset(){o(this,Ie)===-1&&o(this,De).length===0||(d(this,De,[]),d(this,Ie,-1),h(this,Ke,zi).call(this))}}Cu=new WeakMap,el=new WeakMap,De=new WeakMap,Ie=new WeakMap,go=new WeakMap,Ke=new WeakSet,MS=function(){const e=localStorage.getItem(o(this,Ke,yg));if(e!==null)try{const r=JSON.parse(e);if(!zS(r))return;d(this,De,r.entries.map(i=>({url:i.url}))),d(this,Ie,r.cursor),d(this,go,r.lastWritten),h(this,Ke,vg).call(this)}catch{d(this,De,[]),d(this,Ie,-1),d(this,go,0)}},zi=function(){d(this,go,Date.now());try{localStorage.setItem(o(this,Ke,yg),JSON.stringify(h(this,Ke,NS).call(this)))}catch(e){if(!GD(e))throw e}this.dispatchEvent(new Wt("change"))},NS=function(){return{v:1,entries:o(this,De).map(e=>({...e})),cursor:o(this,Ie),lastWritten:o(this,go)}},vg=function(){if(o(this,De).length<=eb)return;const e=o(this,De).length-eb;d(this,De,o(this,De).slice(e)),d(this,Ie,Math.max(-1,o(this,Ie)-e))},yg=function(){return jD(o(this,Cu))};function jD(n){return`${gg}${n}`}function WD(n){const t=Date.now()-VD,e=[];for(let r=0;r<localStorage.length;r+=1){const i=localStorage.key(r);if(!(i!=null&&i.startsWith(gg)))continue;const s=i.slice(gg.length),a=localStorage.getItem(i);if(a===null)continue;let l;try{l=JSON.parse(a)}catch{e.push(i);continue}if(!zS(l)){e.push(i);continue}!n.has(s)&&l.lastWritten<t&&e.push(i)}for(const r of e)localStorage.removeItem(r)}function GD(n){return n instanceof DOMException&&n.name==="QuotaExceededError"}function zS(n){if(typeof n!="object"||n===null)return!1;const t=n;if(t.v!==1||!Array.isArray(t.entries))return!1;const e=t.cursor;return typeof e!="number"||!Number.isInteger(e)||typeof t.lastWritten!="number"||!Number.isFinite(t.lastWritten)||e<-1||e>=t.entries.length?!1:t.entries.every(r=>typeof r=="object"&&r!==null&&typeof r.url=="string")}const Pm="tv-channel-sidebar-collapsed";var vo;class JD{constructor(t){m(this,vo);d(this,vo,t)}read(){return o(this,vo).getItem(Pm)==="true"}setCollapsed(t){try{t?o(this,vo).setItem(Pm,"true"):o(this,vo).removeItem(Pm)}catch{}}}vo=new WeakMap;const Dm="tv-channel-sidebar-width",wg=160,bg=350,Vh=260,YD=/^-?\d+$/;var yo;class KD{constructor(t){m(this,yo);d(this,yo,t)}read(){const t=o(this,yo).getItem(Dm);if(t===null||!YD.test(t))return null;const e=BigInt(t);return e<BigInt(wg)?wg:e>BigInt(bg)?bg:Number(e)}commit(t){const e=HS(Math.round(t));try{o(this,yo).setItem(Dm,String(e))}catch{}return e}clear(){try{o(this,yo).removeItem(Dm)}catch{}}}yo=new WeakMap;function HS(n){return Math.min(Math.max(n,wg),bg)}const XD="1.5.9";function hv(n=XD){return n!==void 0&&n.length>0?n:"0.0.0"}function dv(){let n=!1;return{get pending(){return n},begin(t){n||(n=!0,t())}}}const Sg="tv-reload-attempted";function QD(n){return n.marker!==null&&n.bundleVersion===n.serverVersion?{action:"signal-autoreloaded",fromVersion:n.marker.fromVersion,toVersion:n.bundleVersion}:Kk(n.bundleVersion,n.serverVersion)?n.marker!==null&&n.marker.serverVersion===n.serverVersion?{action:"none"}:{action:"reload",marker:{serverVersion:n.serverVersion,fromVersion:n.bundleVersion}}:{action:"none"}}function eO(n){const t=n.getItem(Sg);if(t===null)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;const r=e;return typeof r.serverVersion!="string"||typeof r.fromVersion!="string"?null:{serverVersion:r.serverVersion,fromVersion:r.fromVersion}}function tO(n){const t=n.storage!==void 0?n.storage:typeof sessionStorage<"u"?sessionStorage:null,e=n.reload??(()=>location.reload()),r=n.navigationLatch??dv(),i=n.bundleVersion??hv();if(t===null)return{dispose(){}};let s=null;const a=()=>{if(s===null)return;const u=n.owner.connection;if(u.status!=="connected")return;const f=s;s=null,u.sendTelemetrySignal("client_autoreloaded",{from_version:f.fromVersion,to_version:f.toVersion})},l=u=>{if(r.pending)return;const f=QD({bundleVersion:i,serverVersion:u.message.version,marker:eO(t)});switch(f.action){case"reload":t.setItem(Sg,JSON.stringify(f.marker)),r.begin(e);return;case"signal-autoreloaded":t.removeItem(Sg),s={fromVersion:f.fromVersion,toVersion:f.toVersion},a();return;case"none":return}},c=()=>{a()};return n.owner.addEventListener("server-status",l),n.owner.addEventListener("change",c),{dispose(){n.owner.removeEventListener("server-status",l),n.owner.removeEventListener("change",c)}}}function nO(n){const t=bi(n.search),e=L6(n.search),r=e!==null&&qf(e)?e:null;return{electron:t,shellVersion:r}}function rO(n){return!n.electron||n.requiredDesktopVersion===null||!qf(n.requiredDesktopVersion)?!1:n.shellVersion===null?!0:n.shellVersion===$d?!1:Q1(n.requiredDesktopVersion,n.shellVersion)}const iO=`# Desktop app update required
66
-
67
- This version of the Television desktop app does not work with this server and needs to be updated. The new version has already downloaded and installs when you restart the app.`,sO=`# Desktop app update required
68
-
69
- This version of the Television desktop app does not work with this server and needs to be updated. [Download the latest version for Mac](https://dl.todesktop.com/260923p52umxx/mac/dmg/arm64) and install it.`;function ZS(n,t=!1){return t?iO:n===null?sO:n.upgradeMarkdown}function oO(n){const t=rO(n);return{gated:t,instructionsMarkdown:t?ZS(n.desktop):null,suppressUpdateToast:t}}function aO(n){const t=n.reload??(()=>location.reload()),e=n.navigationLatch??dv();let r=null,i=!1;const s=new Set,a=f=>{var p;return oO({electron:n.detection.electron,shellVersion:n.detection.shellVersion,requiredDesktopVersion:f.requiredDesktopVersion,desktop:((p=f.update)==null?void 0:p.desktop)??null})};function l(){var f;(f=n.presentation)==null||f.suppressToasts()}function c(f){const p=f.requiredDesktopVersion;p===null||s.has(p)||(s.add(p),r==null||r.connection.sendTelemetrySignal("desktop_upgrade_gate_shown",{...n.detection.shellVersion===null?{}:{desktop_app_version:n.detection.shellVersion},required_desktop_version:p}))}const u=f=>{e.pending||(a(f.message).gated?(i=!0,l(),c(f.message)):i&&e.begin(t))};return{get gated(){return i},decideBoot(f){return a(f).gated?"halt":"boot"},attach(f){r=f,f.addEventListener("server-status",u)},dispose(){r==null||r.removeEventListener("server-status",u),r=null}}}var tl;class lO extends Ri{constructor(){super(...arguments);m(this,tl,!1)}get toastsSuppressed(){return o(this,tl)}suppressToasts(){o(this,tl)||(d(this,tl,!0),this.dispatchEvent(new Wt("change")))}}tl=new WeakMap;const cO=`### Desktop app update ready
70
-
71
- Television updates its desktop app automatically. Version {version} has downloaded and installs when you restart the app.`,uO="tv-desktop-self-update-dismissed";function hO(n){return cO.replace("{version}",n)}var Ru,nl,Iu,wo,rl;class dO extends Ri{constructor({electron:e,bridge:r}){super();m(this,Ru);m(this,nl);m(this,Iu,!1);m(this,wo,null);m(this,rl,!1);d(this,Ru,e),d(this,nl,r??null)}get version(){return o(this,wo)}get restarting(){return o(this,rl)}subscribe(){if(o(this,Iu))return;d(this,Iu,!0);const e=o(this,nl);!o(this,Ru)||typeof(e==null?void 0:e.onDesktopUpdateDownloaded)!="function"||e.onDesktopUpdateDownloaded(r=>{typeof r!="string"||r.length===0||r===o(this,wo)||(d(this,wo,r),this.dispatchEvent(new Wt("change")))})}restart(){var e,r;o(this,wo)===null||o(this,rl)||(d(this,rl,!0),(r=(e=o(this,nl))==null?void 0:e.restartToInstallUpdate)==null||r.call(e),this.dispatchEvent(new Wt("change")))}}Ru=new WeakMap,nl=new WeakMap,Iu=new WeakMap,wo=new WeakMap,rl=new WeakMap;function fO(n,t=window){const e=t.__televisionAppearanceResolver;if(e!==void 0)return e;const r=t.matchMedia("(prefers-color-scheme: dark)");let i=n;const s=c=>c==="system"||c==="light"||c==="dark",a=()=>{const c=i==="system"?r.matches?"dark":"light":i;t.document.documentElement.dataset.theme=c},l={setPreference(c){s(c)&&(i=c,a())}};return t.__televisionAppearanceResolver=l,r.addEventListener("change",()=>{i==="system"&&a()}),a(),l}function US(n){return typeof n=="object"&&n!==null}function FS(n){return!US(n)||n.type!=="ready"?!1:!("id"in n)}function qS(n){return!(!US(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}const VS=$n(),BS="No handler registered for update-content",jS="handleUpdateContent: handler already registered",tb="television-artifact-bridge";function WS(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const GS=vS(Ri);var il,sl,ol,bo,So,al,rt,_g,JS,YS,Ra,ld,h8;let pO=(h8=class extends GS{constructor(e){super();m(this,rt);m(this,il);m(this,sl);m(this,ol);m(this,bo,null);m(this,So,null);m(this,al,!1);d(this,il,e);const r=e.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");d(this,sl,r),d(this,ol,i=>h(this,rt,JS).call(this,i)),o(this,sl).addEventListener("message",o(this,ol))}get content(){return o(this,So)}set content(e){h(this,rt,ld).call(this),d(this,So,e),o(this,al)&&h(this,rt,_g).call(this,e)}handleUpdateContent(e){if(h(this,rt,ld).call(this),o(this,bo)!==null)throw new Error(jS);d(this,bo,e)}notifyStylesChanged(){if(h(this,rt,ld).call(this),!o(this,al))return;const e={type:"styles-changed"};h(this,rt,Ra).call(this,e)}dispose(){o(this,sl).removeEventListener("message",o(this,ol)),d(this,bo,null)}},il=new WeakMap,sl=new WeakMap,ol=new WeakMap,bo=new WeakMap,So=new WeakMap,al=new WeakMap,rt=new WeakSet,_g=function(e){const r={type:"content-updated",content:e};h(this,rt,Ra).call(this,r)},JS=function(e){if(this.disposed||e.source!==o(this,il).contentWindow)return;const r=e.data;if(FS(r)){d(this,al,!0),this.dispatchEvent(new VS("ready")),o(this,So)!==null&&h(this,rt,_g).call(this,o(this,So));return}if(qS(r)){h(this,rt,YS).call(this,r);return}},YS=async function(e){const r=o(this,bo);if(r===null){h(this,rt,Ra).call(this,{type:"response",id:e.id,error:{message:BS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,rt,Ra).call(this,{type:"response",id:e.id,error:{message:WS(i)}});return}this.disposed||h(this,rt,Ra).call(this,{type:"response",id:e.id,result:{}})},Ra=function(e){const r=o(this,il).contentWindow;r&&r.postMessage(e,"*")},ld=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},h8);var _o,ll,Ao,Eo,cl,it,Ag,KS,XS,Ia,cd;class mO extends GS{constructor(e){super();m(this,it);m(this,_o);m(this,ll);m(this,Ao,null);m(this,Eo,null);m(this,cl,!1);d(this,_o,e),d(this,ll,r=>h(this,it,KS).call(this,r)),o(this,_o).addEventListener("ipc-message",o(this,ll))}get content(){return o(this,Eo)}set content(e){h(this,it,cd).call(this),d(this,Eo,e),o(this,cl)&&h(this,it,Ag).call(this,e)}handleUpdateContent(e){if(h(this,it,cd).call(this),o(this,Ao)!==null)throw new Error(jS);d(this,Ao,e)}notifyStylesChanged(){if(h(this,it,cd).call(this),!o(this,cl))return;const e={type:"styles-changed"};h(this,it,Ia).call(this,e)}dispose(){o(this,_o).removeEventListener("ipc-message",o(this,ll)),d(this,Ao,null)}}_o=new WeakMap,ll=new WeakMap,Ao=new WeakMap,Eo=new WeakMap,cl=new WeakMap,it=new WeakSet,Ag=function(e){const r={type:"content-updated",content:e};h(this,it,Ia).call(this,r)},KS=function(e){var s;if(this.disposed)return;const r=e.detail??e;if(!r||r.channel!==tb)return;const i=(s=r.args)==null?void 0:s[0];if(FS(i)){d(this,cl,!0),this.dispatchEvent(new VS("ready")),o(this,Eo)!==null&&h(this,it,Ag).call(this,o(this,Eo));return}if(qS(i)){h(this,it,XS).call(this,i);return}},XS=async function(e){const r=o(this,Ao);if(r===null){h(this,it,Ia).call(this,{type:"response",id:e.id,error:{message:BS}});return}try{await r(e.content)}catch(i){if(this.disposed)return;h(this,it,Ia).call(this,{type:"response",id:e.id,error:{message:WS(i)}});return}this.disposed||h(this,it,Ia).call(this,{type:"response",id:e.id,result:{}})},Ia=function(e){var r,i;(i=(r=o(this,_o)).send)==null||i.call(r,tb,e)},cd=function(){if(this.disposed)throw new Error("WebviewArtifactViewRuntime is disposed")};/**
72
- * @license
73
- * Copyright 2017 Google LLC
74
- * SPDX-License-Identifier: BSD-3-Clause
75
- */const Yc=globalThis,nb=n=>n,Md=Yc.trustedTypes,rb=Md?Md.createPolicy("lit-html",{createHTML:n=>n}):void 0,QS="$lit$",qi=`lit$${Math.random().toFixed(9).slice(2)}$`,e_="?"+qi,gO=`<${e_}>`,ia=document,iu=()=>ia.createComment(""),su=n=>n===null||typeof n!="object"&&typeof n!="function",fv=Array.isArray,vO=n=>fv(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Om=`[
76
- \f\r]`,yc=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ib=/-->/g,sb=/>/g,Vs=RegExp(`>|${Om}(?:([^\\s"'>=/]+)(${Om}*=${Om}*(?:[^
77
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ob=/'/g,ab=/"/g,t_=/^(?:script|style|textarea|title)$/i,yO=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),j=yO(1),xt=Symbol.for("lit-noChange"),de=Symbol.for("lit-nothing"),lb=new WeakMap,ro=ia.createTreeWalker(ia,129);function n_(n,t){if(!fv(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return rb!==void 0?rb.createHTML(t):t}const wO=(n,t)=>{const e=n.length-1,r=[];let i,s=t===2?"<svg>":t===3?"<math>":"",a=yc;for(let l=0;l<e;l++){const c=n[l];let u,f,p=-1,y=0;for(;y<c.length&&(a.lastIndex=y,f=a.exec(c),f!==null);)y=a.lastIndex,a===yc?f[1]==="!--"?a=ib:f[1]!==void 0?a=sb:f[2]!==void 0?(t_.test(f[2])&&(i=RegExp("</"+f[2],"g")),a=Vs):f[3]!==void 0&&(a=Vs):a===Vs?f[0]===">"?(a=i??yc,p=-1):f[1]===void 0?p=-2:(p=a.lastIndex-f[2].length,u=f[1],a=f[3]===void 0?Vs:f[3]==='"'?ab:ob):a===ab||a===ob?a=Vs:a===ib||a===sb?a=yc:(a=Vs,i=void 0);const v=a===Vs&&n[l+1].startsWith("/>")?" ":"";s+=a===yc?c+gO:p>=0?(r.push(u),c.slice(0,p)+QS+c.slice(p)+qi+v):c+qi+(p===-2?l:v)}return[n_(n,s+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class ou{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let s=0,a=0;const l=t.length-1,c=this.parts,[u,f]=wO(t,e);if(this.el=ou.createElement(u,r),ro.currentNode=this.el.content,e===2||e===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ro.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(QS)){const y=f[a++],v=i.getAttribute(p).split(qi),S=/([.?@])?(.*)/.exec(y);c.push({type:1,index:s,name:S[2],strings:v,ctor:S[1]==="."?SO:S[1]==="?"?_O:S[1]==="@"?AO:ep}),i.removeAttribute(p)}else p.startsWith(qi)&&(c.push({type:6,index:s}),i.removeAttribute(p));if(t_.test(i.tagName)){const p=i.textContent.split(qi),y=p.length-1;if(y>0){i.textContent=Md?Md.emptyScript:"";for(let v=0;v<y;v++)i.append(p[v],iu()),ro.nextNode(),c.push({type:2,index:++s});i.append(p[y],iu())}}}else if(i.nodeType===8)if(i.data===e_)c.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(qi,p+1))!==-1;)c.push({type:7,index:s}),p+=qi.length-1}s++}}static createElement(t,e){const r=ia.createElement("template");return r.innerHTML=t,r}}function jl(n,t,e=n,r){var a,l;if(t===xt)return t;let i=r!==void 0?(a=e._$Co)==null?void 0:a[r]:e._$Cl;const s=su(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((l=i==null?void 0:i._$AO)==null||l.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=i:e._$Cl=i),i!==void 0&&(t=jl(n,i._$AS(n,t.values),i,r)),t}class bO{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,i=((t==null?void 0:t.creationScope)??ia).importNode(e,!0);ro.currentNode=i;let s=ro.nextNode(),a=0,l=0,c=r[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new Qf(s,s.nextSibling,this,t):c.type===1?u=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(u=new EO(s,this,t)),this._$AV.push(u),c=r[++l]}a!==(c==null?void 0:c.index)&&(s=ro.nextNode(),a++)}return ro.currentNode=ia,i}p(t){let e=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}let Qf=class r_{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=de,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=jl(this,t,e),su(t)?t===de||t==null||t===""?(this._$AH!==de&&this._$AR(),this._$AH=de):t!==this._$AH&&t!==xt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):vO(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==de&&su(this._$AH)?this._$AA.nextSibling.data=t:this.T(ia.createTextNode(t)),this._$AH=t}$(t){var s;const{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ou.createElement(n_(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(e);else{const a=new bO(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(t){let e=lb.get(t.strings);return e===void 0&&lb.set(t.strings,e=new ou(t)),e}k(t){fv(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const s of t)i===e.length?e.push(r=new r_(this.O(iu()),this.O(iu()),this,this.options)):r=e[i],r._$AI(s),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t!==this._$AB;){const i=nb(t).nextSibling;nb(t).remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},ep=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,s){this.type=1,this._$AH=de,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=de}_$AI(t,e=this,r,i){const s=this.strings;let a=!1;if(s===void 0)t=jl(this,t,e,0),a=!su(t)||t!==this._$AH&&t!==xt,a&&(this._$AH=t);else{const l=t;let c,u;for(t=s[0],c=0;c<s.length-1;c++)u=jl(this,l[r+c],e,c),u===xt&&(u=this._$AH[c]),a||(a=!su(u)||u!==this._$AH[c]),u===de?t=de:t!==de&&(t+=(u??"")+s[c+1]),this._$AH[c]=u}a&&!i&&this.j(t)}j(t){t===de?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},SO=class extends ep{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===de?void 0:t}},_O=class extends ep{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==de)}},AO=class extends ep{constructor(t,e,r,i,s){super(t,e,r,i,s),this.type=5}_$AI(t,e=this){if((t=jl(this,t,e,0)??de)===xt)return;const r=this._$AH,i=t===de&&r!==de||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==de&&(r===de||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}};class EO{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){jl(this,t)}}const kO={I:Qf},Lm=Yc.litHtmlPolyfillSupport;Lm==null||Lm(ou,Qf),(Yc.litHtmlVersions??(Yc.litHtmlVersions=[])).push("3.3.2");const Eg=(n,t,e)=>{const r=t;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new Qf(t.insertBefore(iu(),null),null,void 0,{})),i._$AI(n),i};/**
78
- * @license
79
- * Copyright 2020 Google LLC
80
- * SPDX-License-Identifier: BSD-3-Clause
81
- */const{I:TO}=kO,cb=n=>n,i_=n=>n.strings===void 0,ub=()=>document.createComment(""),wc=(n,t,e)=>{var s;const r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){const a=r.insertBefore(ub(),i),l=r.insertBefore(ub(),i);e=new TO(a,l,n,n.options)}else{const a=e._$AB.nextSibling,l=e._$AM,c=l!==n;if(c){let u;(s=e._$AQ)==null||s.call(e,n),e._$AM=n,e._$AP!==void 0&&(u=n._$AU)!==l._$AU&&e._$AP(u)}if(a!==i||c){let u=e._$AA;for(;u!==a;){const f=cb(u).nextSibling;cb(r).insertBefore(u,i),u=f}}}return e},Bs=(n,t,e=n)=>(n._$AI(t,e),n),CO={},s_=(n,t=CO)=>n._$AH=t,RO=n=>n._$AH,Mm=n=>{n._$AR(),n._$AA.remove()};/**
82
- * @license
83
- * Copyright 2017 Google LLC
84
- * SPDX-License-Identifier: BSD-3-Clause
85
- */const Ir={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4},ic=n=>(...t)=>({_$litDirective$:n,values:t});let kh=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};/**
86
- * @license
87
- * Copyright 2017 Google LLC
88
- * SPDX-License-Identifier: BSD-3-Clause
89
- */const Kc=(n,t)=>{var r;const e=n._$AN;if(e===void 0)return!1;for(const i of e)(r=i._$AO)==null||r.call(i,t,!1),Kc(i,t);return!0},Nd=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while((e==null?void 0:e.size)===0)},o_=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),xO(t)}};function IO(n){this._$AN!==void 0?(Nd(this),this._$AM=n,o_(this)):this._$AM=n}function $O(n,t=!1,e=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)Kc(r[s],!1),Nd(r[s]);else r!=null&&(Kc(r,!1),Nd(r));else Kc(this,n)}const xO=n=>{n.type==Ir.CHILD&&(n._$AP??(n._$AP=$O),n._$AQ??(n._$AQ=IO))};class a_ extends kh{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),o_(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(Kc(this,t),Nd(this))}setValue(t){if(i_(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}var $u,xu,Xi,ko;class dn extends a_{constructor(){super(...arguments);m(this,$u,[]);m(this,xu,!1);m(this,Xi,!1);m(this,ko,!1)}connected(){}template(...e){return xt}render(...e){return!this.isConnected||o(this,Xi)||this.setValue(e.length?e[0]:this.template(...o(this,$u))),xt}update(e,r){d(this,$u,r),d(this,ko,!1),d(this,Xi,!0);try{return o(this,xu)||(d(this,xu,!0),this.connected()),this.template(...r)}finally{d(this,Xi,!1)}}reconnected(){d(this,Xi,!0);try{this.connected()}finally{d(this,Xi,!1)}d(this,ko,!0),queueMicrotask(()=>{o(this,ko)&&(d(this,ko,!1),this.render())})}}$u=new WeakMap,xu=new WeakMap,Xi=new WeakMap,ko=new WeakMap;function fn(n){return ic(n)}const PO=3;function DO(n,t){var r;const e=n.connection;return e.gateHalted?{kind:"needs-upgrade",instructions:e.upgradeInstructions}:e.authorizationRequired?{kind:"unauthorized"}:e.status!=="connected"?e.failedReconnectAttempts>=PO||!e.hasEverConnected&&e.firstConnectError!==null?{kind:"error",serverURL:t,nextRetryAt:e.nextRetryAt}:e.hasEverConnected?{kind:"disconnected",nextRetryAt:e.nextRetryAt}:{kind:"connecting"}:n.ready?n.channels.length===0?{kind:"no-channel"}:((r=n.focusedChannel)==null?void 0:r.pages.length)===0?{kind:"empty-channel"}:{kind:"connected"}:{kind:"connecting"}}const OO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"/></svg>',LO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>',MO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"/></svg>',NO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/></svg>',zO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"/></svg>',HO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/></svg>',ZO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z"/></svg>',UO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"/></svg>',FO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/></svg>',qO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/></svg>',VO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"/></svg>',BO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"><path d="M74 96 128 46 182 96"/><path d="M74 160 128 210 182 160"/></svg>',jO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M71.59,61.47a8,8,0,0,0-15.18,0l-40,120A8,8,0,0,0,24,192h80a8,8,0,0,0,7.59-10.53ZM35.1,176,64,89.3,92.9,176ZM208,76a52,52,0,1,0-52,52A52.06,52.06,0,0,0,208,76Zm-88,0a36,36,0,1,1,36,36A36,36,0,0,1,120,76Zm104,68H136a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h88a8,8,0,0,0,8-8V152A8,8,0,0,0,224,144Zm-8,56H144V160h72Z"/></svg>',WO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,71.1a8,8,0,0,1-10.78-3.42,94.13,94.13,0,0,0-33.46-36.91,8,8,0,1,1,8.54-13.54,111.46,111.46,0,0,1,39.12,43.09A8,8,0,0,1,224,71.1ZM35.71,72a8,8,0,0,0,7.1-4.32A94.13,94.13,0,0,1,76.27,30.77a8,8,0,1,0-8.54-13.54A111.46,111.46,0,0,0,28.61,60.32,8,8,0,0,0,35.71,72Zm186.1,103.94A16,16,0,0,1,208,200H167.2a40,40,0,0,1-78.4,0H48a16,16,0,0,1-13.79-24.06C43.22,160.39,48,138.28,48,112a80,80,0,0,1,160,0C208,138.27,212.78,160.38,221.81,175.94ZM150.62,200H105.38a24,24,0,0,0,45.24,0ZM208,184c-10.64-18.27-16-42.49-16-72a64,64,0,0,0-128,0c0,29.52-5.38,53.74-16,72Z"/></svg>',GO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,96V216H96V160h64V96Z" opacity="0.2"/><path d="M216,88H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8V160a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V96A8,8,0,0,0,216,88ZM48,48H152V152H48ZM208,208H104V168h56a8,8,0,0,0,8-8V104h40Z"/></svg>',JO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"/></svg>',YO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,112a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm80-72H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"/></svg>',KO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M53.92,34.62A8,8,0,1,0,42.08,45.38L67.37,73.2A69.82,69.82,0,0,0,38,87.63a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33,89.75,89.75,0,0,0,11.58-20.27l21.84,24a8,8,0,1,0,11.84-10.76ZM155.9,208,48,100.08C58.23,91.83,69.2,87.72,80.66,87.81l87.16,95.88C165.59,193.56,160.24,202.23,155.9,208Zm79.42-104-44.64,44.79a8,8,0,1,1-11.33-11.3L224,92.7,163.32,32,122.1,73.35a8,8,0,0,1-11.33-11.29L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.32,104Z"/></svg>',XO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/></svg>',QO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"/></svg>',eL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H147.31l34.35-34.34a8,8,0,1,0-11.32-11.32L128,60.69,85.66,18.34A8,8,0,0,0,74.34,29.66L108.69,64H40A16,16,0,0,0,24,80V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64ZM40,80H144V200H40ZM216,200H160V80h56V200Zm-16-84a12,12,0,1,1-12-12A12,12,0,0,1,200,116Zm0,48a12,12,0,1,1-12-12A12,12,0,0,1,200,164Z"/></svg>',tL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z"/></svg>',nL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48v48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48v48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48v48Z"/></svg>',rL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z"/></svg>',iL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/></svg>',sL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"/></svg>',oL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,88.23a54.43,54.43,0,0,1-16,37L189.25,160a54.27,54.27,0,0,1-38.63,16h-.05A54.63,54.63,0,0,1,96,119.84a8,8,0,0,1,16,.45A38.62,38.62,0,0,0,150.58,160h0a38.39,38.39,0,0,0,27.31-11.31l34.75-34.75a38.63,38.63,0,0,0-54.63-54.63l-11,11A8,8,0,0,1,135.7,59l11-11A54.65,54.65,0,0,1,224,48,54.86,54.86,0,0,1,240,88.23ZM109,185.66l-11,11A38.41,38.41,0,0,1,70.6,208h0a38.63,38.63,0,0,1-27.29-65.94L78,107.31A38.63,38.63,0,0,1,144,135.71a8,8,0,0,0,16,.45A54.86,54.86,0,0,0,144,96a54.65,54.65,0,0,0-77.27,0L32,130.75A54.62,54.62,0,0,0,70.56,224h0a54.28,54.28,0,0,0,38.64-16l11-11A8,8,0,0,0,109,185.66Z"/></svg>',aL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"/></svg>',lL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z"/></svg>',cL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/></svg>',uL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/></svg>',hL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/></svg>',dL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"/></svg>',fL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H131.31L104,44.69A15.86,15.86,0,0,0,92.69,40H40A16,16,0,0,0,24,56V200.62A15.4,15.4,0,0,0,39.38,216H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72ZM40,56H92.69l16,16H40ZM216,200H40V88H216Z"/></svg>',pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"/></svg>',mL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z"/></svg>',gL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z"/></svg>',vL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/></svg>',yL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/></svg>',wL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z"/></svg>',bL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M230.6,49.53A15.81,15.81,0,0,0,216,40H40A16,16,0,0,0,28.19,66.76l.08.09L96,139.17V216a16,16,0,0,0,24.87,13.32l32-21.34A16,16,0,0,0,160,194.66V139.17l67.74-72.32.08-.09A15.8,15.8,0,0,0,230.6,49.53ZM40,56h0Zm106.18,74.58A8,8,0,0,0,144,136v58.66L112,216V136a8,8,0,0,0-2.16-5.47L40,56H216Z"/></svg>',SL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"/></svg>',_L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',AL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,200h-8V40a8,8,0,0,0-8-8H152a8,8,0,0,0-8,8V80H96a8,8,0,0,0-8,8v40H48a8,8,0,0,0-8,8v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16ZM160,48h40V200H160ZM104,96h40V200H104ZM56,144H88v56H56Z"/></svg>',EL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"/></svg>',kL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"/></svg>',TL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,64a40,40,0,1,0,40,40A40,40,0,0,0,128,64Zm0,64a24,24,0,1,1,24-24A24,24,0,0,1,128,128Zm0-112a88.1,88.1,0,0,0-88,88c0,31.4,14.51,64.68,42,96.25a254.19,254.19,0,0,0,41.45,38.3,8,8,0,0,0,9.18,0A254.19,254.19,0,0,0,174,200.25c27.45-31.57,42-64.85,42-96.25A88.1,88.1,0,0,0,128,16Zm0,206c-16.53-13-72-60.75-72-118a72,72,0,0,1,144,0C200,161.23,144.53,209,128,222Z"/></svg>',CL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z"/></svg>',RL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z"/></svg>',IL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z"/></svg>',$L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M251.77,73a8,8,0,0,0-8.21.39L208,97.05V72a16,16,0,0,0-16-16H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V159l35.56,23.71A8,8,0,0,0,248,184a8,8,0,0,0,8-8V80A8,8,0,0,0,251.77,73ZM192,184H32V72H192V184Zm48-22.95-32-21.33V116.28L240,95Z"/></svg>',xL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M212.92,17.69a8,8,0,0,0-6.86-1.45l-128,32A8,8,0,0,0,72,56V166.08A36,36,0,1,0,88,196V110.25l112-28v51.83A36,36,0,1,0,216,164V24A8,8,0,0,0,212.92,17.69ZM52,216a20,20,0,1,1,20-20A20,20,0,0,1,52,216ZM88,93.75V62.25l112-28v31.5ZM180,184a20,20,0,1,1,20-20A20,20,0,0,1,180,184Z"/></svg>',PL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',DL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z"/></svg>',OL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M222.37,158.46l-47.11-21.11-.13-.06a16,16,0,0,0-15.17,1.4,8.12,8.12,0,0,0-.75.56L134.87,160c-15.42-7.49-31.34-23.29-38.83-38.51l20.78-24.71c.2-.25.39-.5.57-.77a16,16,0,0,0,1.32-15.06l0-.12L97.54,33.64a16,16,0,0,0-16.62-9.52A56.26,56.26,0,0,0,32,80c0,79.4,64.6,144,144,144a56.26,56.26,0,0,0,55.88-48.92A16,16,0,0,0,222.37,158.46ZM176,208A128.14,128.14,0,0,1,48,80,40.2,40.2,0,0,1,82.87,40a.61.61,0,0,0,0,.12l21,47L83.2,111.86a6.13,6.13,0,0,0-.57.77,16,16,0,0,0-1,15.7c9.06,18.53,27.73,37.06,46.46,46.11a16,16,0,0,0,15.75-1.14,8.44,8.44,0,0,0,.74-.56L168.89,152l47,21.05h0s.08,0,.11,0A40.21,40.21,0,0,1,176,208Z"/></svg>',LL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24h0A104,104,0,1,0,232,128,104.12,104.12,0,0,0,128,24Zm88,104a87.61,87.61,0,0,1-3.33,24H174.16a157.44,157.44,0,0,0,0-48h38.51A87.61,87.61,0,0,1,216,128ZM102,168H154a115.11,115.11,0,0,1-26,45A115.27,115.27,0,0,1,102,168Zm-3.9-16a140.84,140.84,0,0,1,0-48h59.88a140.84,140.84,0,0,1,0,48ZM40,128a87.61,87.61,0,0,1,3.33-24H81.84a157.44,157.44,0,0,0,0,48H43.33A87.61,87.61,0,0,1,40,128ZM154,88H102a115.11,115.11,0,0,1,26-45A115.27,115.27,0,0,1,154,88Zm52.33,0H170.71a135.28,135.28,0,0,0-22.3-45.6A88.29,88.29,0,0,1,206.37,88ZM107.59,42.4A135.28,135.28,0,0,0,85.29,88H49.63A88.29,88.29,0,0,1,107.59,42.4ZM49.63,168H85.29a135.28,135.28,0,0,0,22.3,45.6A88.29,88.29,0,0,1,49.63,168Zm98.78,45.6a135.28,135.28,0,0,0,22.3-45.6h35.66A88.29,88.29,0,0,1,148.41,213.6Z"/></svg>',ML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M243.31,136,144,36.69A15.86,15.86,0,0,0,132.69,32H40a8,8,0,0,0-8,8v92.69A15.86,15.86,0,0,0,36.69,144L136,243.31a16,16,0,0,0,22.63,0l84.68-84.68a16,16,0,0,0,0-22.63Zm-96,96L48,132.69V48h84.69L232,147.31ZM96,84A12,12,0,1,1,84,72,12,12,0,0,1,96,84Z"/></svg>',NL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,32H72A16,16,0,0,0,56,48V224a8,8,0,0,0,12.24,6.78L128,193.43l59.77,37.35A8,8,0,0,0,200,224V48A16,16,0,0,0,184,32Zm0,177.57-51.77-32.35a8,8,0,0,0-8.48,0L72,209.57V48H184Z"/></svg>',zL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"/></svg>',HL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z"/></svg>',ZL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M117.25,157.92a60,60,0,1,0-66.5,0A95.83,95.83,0,0,0,3.53,195.63a8,8,0,1,0,13.4,8.74,80,80,0,0,1,134.14,0,8,8,0,0,0,13.4-8.74A95.83,95.83,0,0,0,117.25,157.92ZM40,108a44,44,0,1,1,44,44A44.05,44.05,0,0,1,40,108Zm210.14,98.7a8,8,0,0,1-11.07-2.33A79.83,79.83,0,0,0,172,168a8,8,0,0,1,0-16,44,44,0,1,0-16.34-84.87,8,8,0,1,1-5.94-14.85,60,60,0,0,1,55.53,105.64,95.83,95.83,0,0,1,47.22,37.71A8,8,0,0,1,250.14,206.7Z"/></svg>',UL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"/></svg>',FL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"/></svg>',qL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,120H136V56h8a32,32,0,0,1,32,32,8,8,0,0,0,16,0,48.05,48.05,0,0,0-48-48h-8V24a8,8,0,0,0-16,0V40h-8a48,48,0,0,0,0,96h8v64H104a32,32,0,0,1-32-32,8,8,0,0,0-16,0,48.05,48.05,0,0,0,48,48h16v16a8,8,0,0,0,16,0V216h16a48,48,0,0,0,0-96Zm-40,0a32,32,0,0,1,0-64h8v64Zm40,80H136V136h16a32,32,0,0,1,0,64Z"/></svg>',VL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M24,104H48v64H32a8,8,0,0,0,0,16H224a8,8,0,0,0,0-16H208V104h24a8,8,0,0,0,4.19-14.81l-104-64a8,8,0,0,0-8.38,0l-104,64A8,8,0,0,0,24,104Zm40,0H96v64H64Zm80,0v64H112V104Zm48,64H160V104h32ZM128,41.39,203.74,88H52.26ZM248,208a8,8,0,0,1-8,8H16a8,8,0,0,1,0-16H240A8,8,0,0,1,248,208Z"/></svg>',BL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,16V88H32V64Zm0,128H32V104H224v88Zm-16-24a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h32A8,8,0,0,1,208,168Zm-64,0a8,8,0,0,1-8,8H120a8,8,0,0,1,0-16h16A8,8,0,0,1,144,168Z"/></svg>',jL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,64H56a8,8,0,0,1,0-16H192a8,8,0,0,0,0-16H56A24,24,0,0,0,32,56V184a24,24,0,0,0,24,24H216a16,16,0,0,0,16-16V80A16,16,0,0,0,216,64Zm0,128H56a8,8,0,0,1-8-8V78.63A23.84,23.84,0,0,0,56,80H216Zm-48-60a12,12,0,1,1,12,12A12,12,0,0,1,168,132Z"/></svg>',WL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M207.06,72.67A111.24,111.24,0,0,0,128,40h-.4C66.07,40.21,16,91,16,153.13V176a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V152A111.25,111.25,0,0,0,207.06,72.67ZM224,176H119.71l54.76-75.3a8,8,0,0,0-12.94-9.42L99.92,176H32V153.13c0-3.08.15-6.12.43-9.13H56a8,8,0,0,0,0-16H35.27c10.32-38.86,44-68.24,84.73-71.66V80a8,8,0,0,0,16,0V56.33A96.14,96.14,0,0,1,221,128H200a8,8,0,0,0,0,16h23.67c.21,2.65.33,5.31.33,8Z"/></svg>',GL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a8,8,0,0,1-8,8H204.94l-37.78,75.58A8,8,0,0,1,160,216h-.4a8,8,0,0,1-7.08-5.14L95.35,60.76,63.28,131.31A8,8,0,0,1,56,136H24a8,8,0,0,1,0-16H50.85L88.72,36.69a8,8,0,0,1,14.76.46l57.51,151,31.85-63.71A8,8,0,0,1,200,120h32A8,8,0,0,1,240,128Z"/></svg>',JL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z"/></svg>',YL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z"/></svg>',KL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z"/></svg>',XL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,136H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V152A16,16,0,0,0,208,136Zm0,64H48V152H208v48Zm0-160H48A16,16,0,0,0,32,56v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V56A16,16,0,0,0,208,40Zm0,64H48V56H208v48ZM192,80a12,12,0,1,1-12-12A12,12,0,0,1,192,80Zm0,96a12,12,0,1,1-12-12A12,12,0,0,1,192,176Z"/></svg>',QL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M223.85,47.12a16,16,0,0,0-15-15c-12.58-.75-44.73.4-71.41,27.07L132.69,64H74.36A15.91,15.91,0,0,0,63,68.68L28.7,103a16,16,0,0,0,9.07,27.16l38.47,5.37,44.21,44.21,5.37,38.49a15.94,15.94,0,0,0,10.78,12.92,16.11,16.11,0,0,0,5.1.83A15.91,15.91,0,0,0,153,227.3L187.32,193A15.91,15.91,0,0,0,192,181.64V123.31l4.77-4.77C223.45,91.86,224.6,59.71,223.85,47.12ZM74.36,80h42.33L77.16,119.52,40,114.34Zm74.41-9.45a76.65,76.65,0,0,1,59.11-22.47,76.46,76.46,0,0,1-22.42,59.16L128,164.68,91.32,128ZM176,181.64,141.67,216l-5.19-37.17L176,139.31Zm-74.16,9.5C97.34,201,82.29,224,40,224a8,8,0,0,1-8-8c0-42.29,23-57.34,32.86-61.85a8,8,0,0,1,6.64,14.56c-6.43,2.93-20.62,12.36-23.12,38.91,26.55-2.5,36-16.69,38.91-23.12a8,8,0,1,1,14.56,6.64Z"/></svg>',eM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"/></svg>',tM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"/></svg>',nM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z"/></svg>',rM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0Z"/></svg>',iM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"/></svg>',sM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.58,128.84,160,91.06V48a32,32,0,0,0-64,0V91.06L20.42,128.84A8,8,0,0,0,16,136v32a8,8,0,0,0,9.57,7.84L96,161.76v18.93L82.34,194.34A8,8,0,0,0,80,200v32a8,8,0,0,0,11,7.43l37-14.81,37,14.81A8,8,0,0,0,176,232V200a8,8,0,0,0-2.34-5.66L160,180.69V161.76l70.43,14.08A8,8,0,0,0,240,168V136A8,8,0,0,0,235.58,128.84ZM224,158.24l-70.43-14.08A8,8,0,0,0,144,152v32a8,8,0,0,0,2.34,5.66L160,203.31v16.87l-29-11.61a8,8,0,0,0-5.94,0L96,220.18V203.31l13.66-13.65A8,8,0,0,0,112,184V152a8,8,0,0,0-9.57-7.84L32,158.24v-17.3l75.58-37.78A8,8,0,0,0,112,96V48a16,16,0,0,1,32,0V96a8,8,0,0,0,4.42,7.16L224,140.94Z"/></svg>',oM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,104H229.2L201.42,41.5A16,16,0,0,0,186.8,32H69.2a16,16,0,0,0-14.62,9.5L26.8,104H16a8,8,0,0,0,0,16h8v80a16,16,0,0,0,16,16H64a16,16,0,0,0,16-16V184h96v16a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V120h8a8,8,0,0,0,0-16ZM69.2,48H186.8l24.89,56H44.31ZM64,200H40V184H64Zm128,0V184h24v16Zm24-32H40V120H216ZM56,144a8,8,0,0,1,8-8H80a8,8,0,0,1,0,16H64A8,8,0,0,1,56,144Zm112,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H176A8,8,0,0,1,168,144Z"/></svg>',aM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,32H72A32,32,0,0,0,40,64V208a16,16,0,0,0,16,16H80a16,16,0,0,0,16-16V192h64v16a16,16,0,0,0,16,16h24a16,16,0,0,0,16-16V64A32,32,0,0,0,184,32ZM56,176V120H200v56Zm0-96H200v24H56ZM72,48H184a16,16,0,0,1,16,16H56A16,16,0,0,1,72,48Zm8,160H56V192H80Zm96,0V192h24v16Zm-72-60a12,12,0,1,1-12-12A12,12,0,0,1,104,148Zm72,0a12,12,0,1,1-12-12A12,12,0,0,1,176,148Zm72-68v24a8,8,0,0,1-16,0V80a8,8,0,0,1,16,0ZM24,80v24a8,8,0,0,1-16,0V80a8,8,0,0,1,16,0Z"/></svg>',lM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H32V48a8,8,0,0,0-16,0V208a8,8,0,0,0,16,0V176H240v32a8,8,0,0,0,16,0V112A40,40,0,0,0,216,72ZM32,88h72v72H32Zm88,72V88h96a24,24,0,0,1,24,24v48Z"/></svg>',cM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M72,88V40a8,8,0,0,1,16,0V88a8,8,0,0,1-16,0ZM216,40V224a8,8,0,0,1-16,0V176H152a8,8,0,0,1-8-8,268.75,268.75,0,0,1,7.22-56.88c9.78-40.49,28.32-67.63,53.63-78.47A8,8,0,0,1,216,40ZM200,53.9c-32.17,24.57-38.47,84.42-39.7,106.1H200ZM119.89,38.69a8,8,0,1,0-15.78,2.63L112,88.63a32,32,0,0,1-64,0l7.88-47.31a8,8,0,1,0-15.78-2.63l-8,48A8.17,8.17,0,0,0,32,88a48.07,48.07,0,0,0,40,47.32V224a8,8,0,0,0,16,0V135.32A48.07,48.07,0,0,0,128,88a8.17,8.17,0,0,0-.11-1.31Z"/></svg>',uM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,112a24,24,0,0,0-24-24H136V79a32.06,32.06,0,0,0,24-31c0-28-26.44-45.91-27.56-46.66a8,8,0,0,0-8.88,0C122.44,2.09,96,20,96,48a32.06,32.06,0,0,0,24,31v9H48a24,24,0,0,0-24,24v23.33a40.84,40.84,0,0,0,8,24.24V200a24,24,0,0,0,24,24H200a24,24,0,0,0,24-24V159.57a40.84,40.84,0,0,0,8-24.24ZM112,48c0-13.57,10-24.46,16-29.79,6,5.33,16,16.22,16,29.79a16,16,0,0,1-32,0ZM40,112a8,8,0,0,1,8-8H208a8,8,0,0,1,8,8v23.33c0,13.25-10.46,24.31-23.32,24.66A24,24,0,0,1,168,136a8,8,0,0,0-16,0,24,24,0,0,1-48,0,8,8,0,0,0-16,0,24,24,0,0,1-24.68,24C50.46,159.64,40,148.58,40,135.33Zm160,96H56a8,8,0,0,1-8-8V172.56A38.77,38.77,0,0,0,62.88,176a39.69,39.69,0,0,0,29-11.31A40.36,40.36,0,0,0,96,160a40,40,0,0,0,64,0,40.36,40.36,0,0,0,4.13,4.67A39.67,39.67,0,0,0,192,176c.38,0,.76,0,1.14,0A38.77,38.77,0,0,0,208,172.56V200A8,8,0,0,1,200,208Z"/></svg>',hM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M255.31,188.75l-64-144A8,8,0,0,0,184,40H72a8,8,0,0,0-7.27,4.69.21.21,0,0,0,0,.06l0,.12,0,0L.69,188.75A8,8,0,0,0,8,200H248a8,8,0,0,0,7.31-11.25ZM64,184H20.31L64,85.7Zm16,0V85.7L123.69,184Zm61.2,0L84.31,56H178.8l56.89,128Z"/></svg>',dM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z"/></svg>',fM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,56H176V48a24,24,0,0,0-24-24H104A24,24,0,0,0,80,48v8H40A16,16,0,0,0,24,72V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V72A16,16,0,0,0,216,56ZM96,48a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm64,24V200H96V72ZM40,72H80V200H40ZM216,200H176V72h40V200Z"/></svg>',pM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216.57,39.43A80,80,0,0,0,83.91,120.78L28.69,176A15.86,15.86,0,0,0,24,187.31V216a16,16,0,0,0,16,16H72a8,8,0,0,0,8-8V208H96a8,8,0,0,0,8-8V184h16a8,8,0,0,0,5.66-2.34l9.56-9.57A79.73,79.73,0,0,0,160,176h.1A80,80,0,0,0,216.57,39.43ZM224,98.1c-1.09,34.09-29.75,61.86-63.89,61.9H160a63.7,63.7,0,0,1-23.65-4.51,8,8,0,0,0-8.84,1.68L116.69,168H96a8,8,0,0,0-8,8v16H72a8,8,0,0,0-8,8v16H40V187.31l58.83-58.82a8,8,0,0,0,1.68-8.84A63.72,63.72,0,0,1,96,95.92c0-34.14,27.81-62.8,61.9-63.89A64,64,0,0,1,224,98.1ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></svg>',mM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"/></svg>',gM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"/></svg>',vM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24a104,104,0,0,0,0,208c21.51,0,44.1-6.48,60.43-17.33a8,8,0,0,0-8.86-13.33C166,210.38,146.21,216,128,216a88,88,0,1,1,88-88c0,26.45-10.88,32-20,32s-20-5.55-20-32V88a8,8,0,0,0-16,0v4.26a48,48,0,1,0,5.93,65.1c6,12,16.35,18.64,30.07,18.64,22.54,0,36-17.94,36-48A104.11,104.11,0,0,0,128,24Zm0,136a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"/></svg>',yM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,56H176V48a24,24,0,0,0-24-24H104A24,24,0,0,0,80,48v8H40A16,16,0,0,0,24,72V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V72A16,16,0,0,0,216,56ZM96,48a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96ZM216,72v41.61A184,184,0,0,1,128,136a184.07,184.07,0,0,1-88-22.38V72Zm0,128H40V131.64A200.19,200.19,0,0,0,128,152a200.25,200.25,0,0,0,88-20.37V200ZM104,112a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,112Z"/></svg>',wM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,112a47.81,47.81,0,0,0-16.93,3.09L165.93,72H192a8,8,0,0,1,8,8,8,8,0,0,0,16,0,24,24,0,0,0-24-24H152a8,8,0,0,0-6.91,12l11.65,20H99.26L82.91,60A8,8,0,0,0,76,56H48a8,8,0,0,0,0,16H71.41L85.12,95.51,69.41,117.06a48.13,48.13,0,1,0,12.92,9.44l11.59-15.9L125.09,164A8,8,0,1,0,138.91,156l-30.32-52h57.48l11.19,19.17A48,48,0,1,0,208,112ZM80,160a32,32,0,1,1-20.21-29.74l-18.25,25a8,8,0,1,0,12.92,9.42l18.25-25A31.88,31.88,0,0,1,80,160Zm128,32a32,32,0,0,1-22.51-54.72L201.09,164A8,8,0,1,0,214.91,156L199.3,129.21A32,32,0,1,1,208,192Z"/></svg>',bM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184,24H72A32,32,0,0,0,40,56V184a32,32,0,0,0,32,32h8L65.6,235.2a8,8,0,1,0,12.8,9.6L100,216h56l21.6,28.8a8,8,0,1,0,12.8-9.6L176,216h8a32,32,0,0,0,32-32V56A32,32,0,0,0,184,24ZM56,120V80h64v40Zm80-40h64v40H136ZM72,40H184a16,16,0,0,1,16,16v8H56V56A16,16,0,0,1,72,40ZM184,200H72a16,16,0,0,1-16-16V136H200v48A16,16,0,0,1,184,200ZM96,172a12,12,0,1,1-12-12A12,12,0,0,1,96,172Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,172Z"/></svg>',SM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,72H180.92c.39-.33.79-.65,1.17-1A29.53,29.53,0,0,0,192,49.57,32.62,32.62,0,0,0,158.44,16,29.53,29.53,0,0,0,137,25.91a54.94,54.94,0,0,0-9,14.48,54.94,54.94,0,0,0-9-14.48A29.53,29.53,0,0,0,97.56,16,32.62,32.62,0,0,0,64,49.57,29.53,29.53,0,0,0,73.91,71c.38.33.78.65,1.17,1H40A16,16,0,0,0,24,88v32a16,16,0,0,0,16,16v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V136a16,16,0,0,0,16-16V88A16,16,0,0,0,216,72ZM149,36.51a13.69,13.69,0,0,1,10-4.5h.49A16.62,16.62,0,0,1,176,49.08a13.69,13.69,0,0,1-4.5,10c-9.49,8.4-25.24,11.36-35,12.4C137.7,60.89,141,45.5,149,36.51Zm-64.09.36A16.63,16.63,0,0,1,96.59,32h.49a13.69,13.69,0,0,1,10,4.5c8.39,9.48,11.35,25.2,12.39,34.92-9.72-1-25.44-4-34.92-12.39a13.69,13.69,0,0,1-4.5-10A16.6,16.6,0,0,1,84.87,36.87ZM40,88h80v32H40Zm16,48h64v64H56Zm144,64H136V136h64Zm16-80H136V88h80v32Z"/></svg>',_M='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z"/></svg>',AM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"/></svg>',EM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z"/></svg>',kM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M200,75.64V40a16,16,0,0,0-16-16H72A16,16,0,0,0,56,40V76a16.07,16.07,0,0,0,6.4,12.8L114.67,128,62.4,167.2A16.07,16.07,0,0,0,56,180v36a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V180.36a16.09,16.09,0,0,0-6.35-12.77L141.27,128l52.38-39.6A16.05,16.05,0,0,0,200,75.64ZM184,216H72V180l56-42,56,42.35Zm0-140.36L128,118,72,76V40H184Z"/></svg>',TM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M214.67,72H200V40a8,8,0,0,0-8-8H64a8,8,0,0,0-8,8V72H41.33C27.36,72,16,82.77,16,96v80a8,8,0,0,0,8,8H56v32a8,8,0,0,0,8,8H192a8,8,0,0,0,8-8V184h32a8,8,0,0,0,8-8V96C240,82.77,228.64,72,214.67,72ZM72,48H184V72H72ZM184,208H72V160H184Zm40-40H200V152a8,8,0,0,0-8-8H64a8,8,0,0,0-8,8v16H32V96c0-4.41,4.19-8,9.33-8H214.67c5.14,0,9.33,3.59,9.33,8Zm-24-52a12,12,0,1,1-12-12A12,12,0,0,1,200,116Z"/></svg>',CM=':host,tv-icon:not(:defined){display:inline-flex;flex:none;width:1em;height:1em;vertical-align:-.125em}:host([size="sm"]),tv-icon:not(:defined)[size=sm]{font-size:16px}:host([size="md"]),tv-icon:not(:defined)[size=md]{font-size:20px}:host([size="lg"]),tv-icon:not(:defined)[size=lg]{font-size:24px}:host([size="xl"]),tv-icon:not(:defined)[size=xl]{font-size:32px}svg{width:100%;height:100%}:host([spinning])>svg{animation:tv-icon-spin 1s linear infinite}@keyframes tv-icon-spin{to{rotate:1turn}}@media(prefers-reduced-motion:reduce){:host([spinning])>svg{animation:none}}',l_=new CSSStyleSheet;l_.replaceSync(CM);const c_={check:OO,close:LO,copy:MO,pin:NO,search:zO,add:HO,more:ZO,settings:UO,expand:FO,collapse:qO,"collapse-up":VO,select:BO,skills:jO,notification:WO,artifact:GO,spinner:JO,locked:YO,unpin:KO,back:XO,forward:QO,television:eL,calendar:tL,grid:nL,hash:rL,delete:iL,edit:sL,link:oL,external:aL,download:lL,reload:cL,warning:uL,info:hL,file:dL,folder:fL,clock:pL,user:mL,upload:gL,star:vL,home:yL,send:wL,filter:bL,sort:SL,help:_L,chart:AL,image:EL,chat:kL,location:TL,play:CL,pause:RL,stop:IL,video:$L,music:xL,error:PL,email:DL,phone:OL,web:LL,tag:ML,bookmark:NL,table:zL,code:HL,group:ZL,up:UL,down:FL,money:qL,bank:VL,card:BL,wallet:jL,gauge:WL,activity:GL,"trend-up":JL,"trend-down":YL,database:KL,server:XL,deploy:QL,list:eM,terminal:tM,branch:nM,shield:rM,sidebar:iM,plane:sM,car:oM,bus:aM,bed:lM,food:cM,cake:uM,tent:hM,microphone:dM,luggage:fM,key:pM,sun:mM,moon:gM,at:vM,briefcase:yM,bicycle:wM,train:bM,gift:SM,book:_M,camera:AM,inbox:EM,hourglass:kM,printer:TM};function RM(n){return n!==null&&Object.hasOwn(c_,n)}var Pu,kg;class u_ extends HTMLElement{constructor(){super(...arguments);m(this,Pu)}connectedCallback(){h(this,Pu,kg).call(this)}attributeChangedCallback(){this.isConnected&&h(this,Pu,kg).call(this)}}Pu=new WeakSet,kg=function(){const e=this.shadowRoot??this.attachShadow({mode:"open"});e.adoptedStyleSheets=[l_],this.replaceChildren();const r=this.getAttribute("name");e.innerHTML=RM(r)?c_[r]:""},R(u_,"observedAttributes",["name"]);customElements.get("tv-icon")||customElements.define("tv-icon",u_);function tp(n,t=null){return j`<div class="dialog-overlay"><dialog open>${t}<div class="dialog-content">${n}</div></dialog></div>`}function np(n,t){let e=!1;const r=s=>{s.preventDefault(),t("escape")},i=s=>{if(s.target!==n)return;const a=n.getBoundingClientRect();s.clientX>=a.left&&s.clientX<=a.right&&s.clientY>=a.top&&s.clientY<=a.bottom||t("backdrop")};n.addEventListener("cancel",r),n.addEventListener("click",i);for(const s of n.ownerDocument.querySelectorAll("tv-popover[open], tv-menu[open], tv-select[open]"))s.removeAttribute("open");return n.removeAttribute("open"),n.showModal(),{withdraw(){e||(e=!0,n.removeEventListener("cancel",r),n.removeEventListener("click",i),n.open&&n.close())}}}function au(n){n==null||n.focus({preventScroll:!0}),n==null||n.scrollIntoView({block:"nearest"})}function h_(n,t){if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"||t.length===0)return!1;const e=t.indexOf(t[0].ownerDocument.activeElement),r=n.key==="ArrowDown",i=e<0?r?0:t.length-1:Math.max(0,Math.min(t.length-1,e+(r?1:-1)));return n.preventDefault(),n.stopImmediatePropagation(),au(t[i]),!0}const Tg=new WeakMap;function $a(n,t,e){e===null?n.hasAttribute(t)&&n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}var Xr,Du,Ou,ul,Qi,xs,Cg,Kd,Xd,Qd,ef,tf,Rg;class IM{constructor(t){m(this,xs);R(this,"document");R(this,"panels",new Set);m(this,Xr,new Map);m(this,Du,new WeakMap);m(this,Ou,new AbortController);m(this,ul);m(this,Qi,0);m(this,Kd,t=>{if(!(t.target instanceof Element))return;const e=t.target;o(this,Du).set(t,{inside:new Set([...this.panels].filter(r=>{var i;return this.contains(r,e)||((i=r.trigger)==null?void 0:i.contains(e))})),open:[...this.panels].filter(r=>r.open)})});m(this,Xd,t=>{var s,a,l;if(!(t.target instanceof Element))return;const e=t.target,r=o(this,Du).get(t),i=[...this.panels].find(c=>{var u;return(u=c.trigger)==null?void 0:u.contains(e)});for(const c of(r==null?void 0:r.open)??[])c.open&&!c.manual&&c!==i&&!(r!=null&&r.inside.has(c))&&c.close();if(i&&!((s=i.trigger)!=null&&s.disabled))i.toggle(t.detail===0);else for(const c of[...this.panels])c.open&&c.host.contains(e)&&((l=(a=c.behavior).click)==null||l.call(a,e))});m(this,Qd,t=>{var e,r;if(t.target instanceof Element)for(const i of this.panels)i.open&&i.host.contains(t.target)&&((r=(e=i.behavior).pointermove)==null||r.call(e,t.target))});m(this,ef,t=>{var s,a,l,c;const e=h(this,xs,Cg).call(this),r=e.find(u=>u.behavior.select),i=r??e.find(u=>u.behavior.keydown);if(!((a=i==null?void 0:(s=i.behavior).keydown)!=null&&a.call(s,t))){if(t.key==="Escape"&&r){h(this,xs,Rg).call(this,t,e,r);return}for(const u of this.panels)if(!u.open&&u.trigger===this.document.activeElement&&((c=(l=u.behavior).keydown)!=null&&c.call(l,t)))return}});m(this,tf,t=>{if(t.key!=="Escape"||t.defaultPrevented)return;const e=h(this,xs,Cg).call(this);h(this,xs,Rg).call(this,t,e)});this.document=t;const e={signal:o(this,Ou).signal};t.addEventListener("click",o(this,Kd),{...e,capture:!0}),t.addEventListener("click",o(this,Xd),e),t.addEventListener("keydown",o(this,ef),{...e,capture:!0}),t.addEventListener("keydown",o(this,tf),e),t.addEventListener("pointermove",o(this,Qd),e),d(this,ul,new MutationObserver(()=>{for(const r of[...this.panels])r.refresh()})),o(this,ul).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["id","trigger","selected","value","aria-expanded","role","aria-haspopup","aria-controls","aria-activedescendant"]})}animate(){if(o(this,Qi))return;const t=()=>{d(this,Qi,0);for(const e of this.panels)e.open&&e.place();[...this.panels].some(e=>e.open)&&d(this,Qi,this.document.defaultView.requestAnimationFrame(t))};d(this,Qi,this.document.defaultView.requestAnimationFrame(t))}remove(t){this.closed(t),this.panels.delete(t),!this.panels.size&&(o(this,Ou).abort(),o(this,ul).disconnect(),this.document.defaultView.cancelAnimationFrame(o(this,Qi)),Tg.delete(this.document))}prepareOpen(t){let e=null;for(const r of this.panels)r===t||!r.open||!t.trigger||!r.host.contains(t.trigger)||(e===null||e.host.contains(r.host))&&(e=r);if(o(this,Xr).set(t,e),!(t.manual||t.behavior.select))for(const r of this.panels)r.open&&r!==t&&!r.manual&&!r.behavior.select&&!this.isDescendant(t,r)&&r.close()}isDescendant(t,e){for(let r=o(this,Xr).get(t);r;r=o(this,Xr).get(r))if(r===e)return!0;return!1}contains(t,e){return e?t.host.contains(e)||[...this.panels].some(r=>this.isDescendant(r,t)&&r.host.contains(e)):!1}closeDescendants(t){for(const e of[...this.panels])this.isDescendant(e,t)&&e.close(!1)}closed(t){o(this,Xr).delete(t)}}Xr=new WeakMap,Du=new WeakMap,Ou=new WeakMap,ul=new WeakMap,Qi=new WeakMap,xs=new WeakSet,Cg=function(){const t=e=>{let r=0;for(let i=o(this,Xr).get(e);i;i=o(this,Xr).get(i))r++;return r};return[...this.panels].filter(e=>e.open).reverse().sort((e,r)=>t(r)-t(e))},Kd=new WeakMap,Xd=new WeakMap,Qd=new WeakMap,ef=new WeakMap,tf=new WeakMap,Rg=function(t,e,r){if(!r&&e.some(s=>s.manual&&t.composedPath().includes(s.host)))return;const i=r??e.find(s=>!s.manual);i&&!i.manual&&(t.preventDefault(),t.stopImmediatePropagation(),i.close())};var We,es,To,hl,ts,ns,Ot,Ig,d_,$g,Lu,f_,xg;class pv{constructor(t,e={}){m(this,Ot);R(this,"host");R(this,"behavior");R(this,"trigger",null);m(this,We);m(this,es,!1);m(this,To,!1);m(this,hl,!0);m(this,ts,new Map);m(this,ns,new Set);m(this,Lu,t=>{const e=t.target;e instanceof HTMLElement&&e!==this.host&&this.host.contains(e)&&o(this,ns).add(e)});this.host=t,this.behavior=e}get open(){return this.host.hasAttribute("open")&&o(this,es)}get manual(){return this.host.hasAttribute("manual")}connect(){if(o(this,We))return;const t=this.host.ownerDocument;d(this,We,Tg.get(t)),o(this,We)||(d(this,We,new IM(t)),Tg.set(t,o(this,We))),o(this,We).panels.add(this),this.refresh()}disconnect(){var e,r,i,s;if(!o(this,We))return;const t=o(this,We).contains(this,this.host.ownerDocument.activeElement);d(this,es,!1),o(this,We).closeDescendants(this),o(this,We).closed(this),this.host.removeAttribute("open"),(r=(e=this.behavior).closed)==null||r.call(e),h(this,Ot,$g).call(this),h(this,Ot,xg).call(this),t&&((i=this.trigger)!=null&&i.isConnected)&&this.trigger.focus({preventScroll:!0}),h(this,Ot,Ig).call(this),(s=o(this,We))==null||s.remove(this),d(this,We,void 0)}refresh(){var r,i,s,a,l,c,u;if(!o(this,We))return;const t=this.host.ownerDocument.getElementById(this.host.getAttribute("trigger")??""),e=t instanceof HTMLButtonElement?t:null;if(e!==this.trigger&&(h(this,Ot,Ig).call(this),this.trigger=e),this.trigger&&$a(this.trigger,"aria-expanded",this.host.hasAttribute("open")?"true":"false"),(i=(r=this.behavior).refresh)==null||i.call(r),this.host.hasAttribute("open")&&!this.trigger){this.host.removeAttribute("open");return}if(this.host.hasAttribute("open")!==o(this,es))if(this.host.hasAttribute("open"))o(this,We).prepareOpen(this),d(this,es,!0),h(this,Ot,d_).call(this),h(this,Ot,f_).call(this),this.place(),(a=(s=this.behavior).opened)==null||a.call(s,o(this,To)),d(this,To,!1),o(this,We).animate();else{const f=o(this,We).contains(this,this.host.ownerDocument.activeElement);d(this,es,!1),o(this,We).closeDescendants(this),o(this,We).closed(this),(c=(l=this.behavior).closed)==null||c.call(l),h(this,Ot,$g).call(this),h(this,Ot,xg).call(this),f&&o(this,hl)&&((u=this.trigger)!=null&&u.isConnected)&&this.trigger.focus({preventScroll:!0})}}toggle(t=!1){d(this,To,t),this.host.toggleAttribute("open")}show(t=!1){d(this,To,t),this.host.setAttribute("open","")}close(t=!0){d(this,hl,t),this.host.removeAttribute("open"),this.refresh(),d(this,hl,!0)}place(){var ae,_e,ot;if(!this.open||!this.trigger)return;const t=this.host,e=t.ownerDocument.defaultView,r=this.trigger.getBoundingClientRect();if(!this.trigger.isConnected){this.close();return}const i=Number.parseFloat(e.getComputedStyle(t).getPropertyValue("--popover-distance"));if(!Number.isFinite(i))return;const s=t.scrollTop,a=t.scrollLeft,l=[];for(const se of o(this,ns)){if(!se.isConnected||!t.contains(se)){o(this,ns).delete(se);continue}l.push({element:se,scrollTop:se.scrollTop,scrollLeft:se.scrollLeft})}t.style.maxWidth="none";const c=o(this,ts).get("max-height");c!=null&&c.value?t.style.setProperty("max-height",c.value,c.priority):t.style.removeProperty("max-height");const u=e.getComputedStyle(t).maxHeight;t.style.minWidth=this.behavior.select?`${Math.min(r.width,e.innerWidth-2*i)}px`:((ae=o(this,ts).get("min-width"))==null?void 0:ae.value)??"";const f=t.getBoundingClientRect(),p=Math.max(0,e.innerWidth-i-r.left),y=Math.max(0,r.right-i),v=f.width>p&&y>p,S=Math.min(e.innerWidth-2*i,v?y:p),_=Number.parseFloat(e.getComputedStyle(t).minWidth)||0;t.style.minWidth=`${Math.max(0,Math.min(_,S))}px`,t.style.maxWidth=`${Math.max(0,S)}px`;const I=t.getBoundingClientRect(),Z=I.width,O=I.height,z=Math.max(i,Math.min(v?r.right-Z:r.left,e.innerWidth-i-Z));let P,V;if(this.behavior.select){const se=(ot=(_e=this.behavior).selectedRow)==null?void 0:ot.call(_e),Pe=se?se.getBoundingClientRect().top+se.offsetHeight/2-I.top:0,ht=r.top+r.height/2-Pe;if(ht>=i&&ht+O<=e.innerHeight-i)P=ht,V=e.innerHeight-i-ht;else{const Pn=e.innerHeight-i-r.top,dt=r.bottom-i,bt=O>Pn&&dt>Pn;V=bt?dt:Pn,P=bt?r.bottom-Math.min(O,V):r.top}}else{const se=Math.max(0,e.innerHeight-i-r.bottom-i),Pe=Math.max(0,r.top-2*i),ht=O>se&&Pe>se;V=ht?Pe:se,P=ht?r.top-i-Math.min(O,Pe):r.bottom+i}const F=`${Math.max(0,V)}px`;t.style.maxHeight=u==="none"?F:`min(${u}, ${F})`,t.style.left=`${z}px`,t.style.top=`${Math.max(i,Math.min(P,e.innerHeight-i-Math.min(O,V)))}px`;const q=e.getComputedStyle(t),Q=q.boxSizing==="border-box",K=parseFloat(q.width)+(Q?0:parseFloat(q.paddingLeft)+parseFloat(q.paddingRight)+parseFloat(q.borderLeftWidth)+parseFloat(q.borderRightWidth)),ue=parseFloat(q.height)+(Q?0:parseFloat(q.paddingTop)+parseFloat(q.paddingBottom)+parseFloat(q.borderTopWidth)+parseFloat(q.borderBottomWidth));t.style.setProperty("--_panel-edge-inset",`${t.style.top} auto auto ${t.style.left}`),t.style.setProperty("--_panel-edge-width",`${K}px`),t.style.setProperty("--_panel-edge-height",`${ue}px`),t.scrollTop=s,t.scrollLeft=a;for(const se of l)se.element.scrollTop=se.scrollTop,se.element.scrollLeft=se.scrollLeft}}We=new WeakMap,es=new WeakMap,To=new WeakMap,hl=new WeakMap,ts=new WeakMap,ns=new WeakMap,Ot=new WeakSet,Ig=function(){var t,e;this.trigger&&(this.trigger.removeAttribute("aria-expanded"),(e=(t=this.behavior).unpair)==null||e.call(t,this.trigger),this.trigger=null)},d_=function(){o(this,ns).clear(),this.host.addEventListener("scroll",o(this,Lu),!0)},$g=function(){this.host.removeEventListener("scroll",o(this,Lu),!0),o(this,ns).clear()},Lu=new WeakMap,f_=function(){const t=this.host;for(const e of["position","z-index","left","top","margin","max-width","max-height","min-width","overflow","--_panel-edge-position","--_panel-edge-inset","--_panel-edge-width","--_panel-edge-height"])o(this,ts).set(e,{value:t.style.getPropertyValue(e),priority:t.style.getPropertyPriority(e)});t.style.position="fixed",t.style.zIndex="var(--layer-panel)",t.style.margin="0",t.style.overflow="auto",t.style.setProperty("--_panel-edge-position","fixed")},xg=function(){for(const[t,{value:e,priority:r}]of o(this,ts))e?this.host.style.setProperty(t,e,r):this.host.style.removeProperty(t);o(this,ts).clear()};class $M extends HTMLElement{constructor(){super(),this.attachInternals().role="menuitem"}connectedCallback(){this.tabIndex=-1}}var rs,xr,Pg,Dg,m_;class p_ extends HTMLElement{constructor(){super();m(this,xr);m(this,rs,new pv(this,{opened:e=>{e&&au(h(this,xr,Pg).call(this)[0])},keydown:e=>h(this,xr,m_).call(this,e),pointermove:e=>au(h(this,xr,Dg).call(this,e)??void 0),click:e=>{h(this,xr,Dg).call(this,e)&&o(this,rs).close()}}));this.attachInternals().role="menu"}connectedCallback(){o(this,rs).connect()}disconnectedCallback(){o(this,rs).disconnect()}attributeChangedCallback(){o(this,rs).refresh()}}rs=new WeakMap,xr=new WeakSet,Pg=function(){return[...this.querySelectorAll("tv-menu-item")]},Dg=function(e){const r=e.closest("tv-menu-item");return(r==null?void 0:r.closest("tv-menu"))===this?r:null},m_=function(e){if(!o(this,rs).open)return!1;const r=h(this,xr,Pg).call(this),i=r.indexOf(this.ownerDocument.activeElement);return h_(e,r)?!0:e.key==="Enter"&&i>=0?(e.preventDefault(),e.stopImmediatePropagation(),r[i].click(),!0):!1},R(p_,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-menu-item")||customElements.define("tv-menu-item",$M);customElements.get("tv-menu")||customElements.define("tv-menu",p_);let xM=0;var Mu;class PM extends dn{constructor(){super(...arguments);m(this,Mu,`menu-trigger-${++xM}`)}template(e,{trigger:r}){return j`${r(o(this,Mu))}<tv-menu trigger=${o(this,Mu)}>
90
- ${e.map(i=>"separator"in i?j`<hr>`:j`<tv-menu-item intent=${i.destructive?"danger":de} @click=${i.action}>${i.label}</tv-menu-item>`)}
91
- </tv-menu>`}}Mu=new WeakMap;const g_=fn(PM);/**
92
- * @license
93
- * Copyright 2020 Google LLC
94
- * SPDX-License-Identifier: BSD-3-Clause
95
- */const Jn=()=>new DM;class DM{}const Nm=new WeakMap,yt=ic(class extends a_{render(n){return de}update(n,[t]){var r;const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),de}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=Nm.get(t);e===void 0&&(e=new WeakMap,Nm.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,t;return typeof this.G=="function"?(n=Nm.get(this.ht??globalThis))==null?void 0:n.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
96
- * @license
97
- * Copyright 2017 Google LLC
98
- * SPDX-License-Identifier: BSD-3-Clause
99
- */const hb=(n,t,e)=>{const r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},zd=ic(class extends kh{constructor(n){if(super(n),n.type!==Ir.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);const i=[],s=[];let a=0;for(const l of n)i[a]=r?r(l,a):a,s[a]=e(l,a),a++;return{values:s,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){const i=RO(n),{values:s,keys:a}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=a,s;const l=this.ut??(this.ut=[]),c=[];let u,f,p=0,y=i.length-1,v=0,S=s.length-1;for(;p<=y&&v<=S;)if(i[p]===null)p++;else if(i[y]===null)y--;else if(l[p]===a[v])c[v]=Bs(i[p],s[v]),p++,v++;else if(l[y]===a[S])c[S]=Bs(i[y],s[S]),y--,S--;else if(l[p]===a[S])c[S]=Bs(i[p],s[S]),wc(n,c[S+1],i[p]),p++,S--;else if(l[y]===a[v])c[v]=Bs(i[y],s[v]),wc(n,i[p],i[y]),y--,v++;else if(u===void 0&&(u=hb(a,v,S),f=hb(l,p,y)),u.has(l[p]))if(u.has(l[y])){const _=f.get(a[v]),I=_!==void 0?i[_]:null;if(I===null){const Z=wc(n,i[p]);Bs(Z,s[v]),c[v]=Z}else c[v]=Bs(I,s[v]),wc(n,i[p],I),i[_]=null;v++}else Mm(i[y]),y--;else Mm(i[p]),p++;for(;v<=S;){const _=wc(n,c[S+1]);Bs(_,s[v]),c[v++]=_}for(;p<=y;){const _=i[p++];_!==null&&Mm(_)}return this.ut=a,s_(n,c),xt}});/**
100
- * @license
101
- * Copyright 2018 Google LLC
102
- * SPDX-License-Identifier: BSD-3-Clause
103
- */const v_="important",OM=" !"+v_,Hd=ic(class extends kh{constructor(n){var t;if(super(n),n.type!==Ir.ATTRIBUTE||n.name!=="style"||((t=n.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((t,e)=>{const r=n[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[t]){const{style:e}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(const r in t){const i=t[r];if(i!=null){this.ft.add(r);const s=typeof i=="string"&&i.endsWith(OM);r.includes("-")||s?e.setProperty(r,s?i.slice(0,-11):i,s?v_:""):e[r]=i}}return xt}}),LM=24;function MM(n){return!db(n.source)||!db(n.current)||!qM(n.source,n.current)||!VM(n)||!FM(n.geometry)?{kind:"invalidated"}:HM(n.pointer,n.geometry)==="pinned"?NM(n):zM(n)}function NM(n){var c;const{source:t,current:e,pointer:r,geometry:i}=n,a=(((c=i.placeholder)==null?void 0:c.side)==="pinned"&&r.y>=i.placeholder.top&&r.y<=i.placeholder.bottom?i.placeholder.index:null)??ZM(r.y,i.pinnedRows),l=e.pinnedChannelIds.filter(u=>u!==t.channelId);return l.splice(a,0,t.channelId),{kind:"placement",side:"pinned",placeholder:{side:"pinned",index:a},operation:l}}function zM(n){const{source:t,current:e}=n,r=t.pinnedChannelIds.includes(t.channelId),i=r?UM(e.unpinnedChannelIds,t.channelId):t.unpinnedChannelIds.indexOf(t.channelId);return{kind:"placement",side:"unpinned",placeholder:r&&e.unpinnedChannelIds.length===0?null:{side:"unpinned",index:i},operation:r?e.pinnedChannelIds.filter(s=>s!==t.channelId):null}}function HM(n,t){const{sidebar:e}=t;if(n.x<e.left||n.x>e.right||n.y<e.top||n.y>e.bottom)return"unpinned";const i=t.unpinnedGroupTop??(t.pinnedContentBottom===null?Number.NEGATIVE_INFINITY:t.pinnedContentBottom+LM);return n.y<i?"pinned":"unpinned"}function ZM(n,t){const e=t.findIndex(({top:r,bottom:i})=>n<r+(i-r)/2);return e===-1?t.length:e}function UM(n,t){const e=n.filter(i=>i!==t),r=e.findIndex(i=>i<t);return r===-1?e.length:r}function FM(n){return n.unpinnedGroupTop!==null||n.pinnedContentBottom!==null}function db(n){const t=[...n.pinnedChannelIds,...n.unpinnedChannelIds];return new Set(t).size===t.length}function qM(n,t){return Og(n.pinnedChannelIds,t.pinnedChannelIds)&&Og(n.unpinnedChannelIds,t.unpinnedChannelIds)}function VM(n){const t=n.current.pinnedChannelIds.filter(s=>s!==n.source.channelId),e=n.geometry.pinnedRows.map(({channelId:s})=>s),r=n.geometry.placeholder,i=r===null||Number.isInteger(r.index)&&r.index>=0&&r.index<=(r.side==="pinned"?t.length:n.current.unpinnedChannelIds.length);return n.source.pinnedChannelIds.includes(n.source.channelId)!==n.source.unpinnedChannelIds.includes(n.source.channelId)&&Og(t,e)&&i}function Og(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}const y_=4,Ha=200,Rn=28,Zd=800,Bh="ease",fb=.5,bc=.5,BM="New channel",js=".channel-group:not(.channel-group-withdrawal) .channel-row",jM=24;var Lt,sn,Tt,gt,on,Mt,mr,Co,Me,we,wn,bn,Sn,Nt,zt,Ht,_n,Zt,gr,Qr,dl,fl,is,x,Lg,b_,S_,__,A_,ud,E_,k_,T_,C_,Dc,xa,R_,I_,Mg,Oc,nf,rf,sf,of,$_,Ng,zg,x_,Nu,zu,P_,af,Hu,D_,O_,Lc,Hg,L_,M_,Mc,Zg,Ug,Fg,N_,hd,Zu,Uu,Fu,qu,z_,qg,dd,fd,Nc,Vg,Bg;class w_{constructor(t){m(this,x);m(this,Lt);m(this,sn,null);m(this,Tt,null);m(this,gt,{management:!0});m(this,on,!1);m(this,Mt,null);m(this,mr,"");m(this,Co,!1);m(this,Me,null);m(this,we,null);m(this,wn,!1);m(this,bn,null);m(this,Sn,null);m(this,Nt,null);m(this,zt,null);m(this,Ht,null);m(this,_n,null);m(this,Zt,null);m(this,gr,null);m(this,Qr,Jn());m(this,dl,Jn());m(this,fl,Jn());m(this,is,null);R(this,"create",()=>{const t=o(this,sn),e=o(this,Tt);if(t===null||e===null||o(this,bn)!==null)return;const r={resultChannelId:null};d(this,bn,r),o(this,Lt).call(this),t.createChannel(BM).then(i=>{r.resultChannelId=i.id,t.focusChannel(i.id).catch(()=>{}),o(this,bn)===r&&o(this,Lt).call(this)},()=>{o(this,bn)!==r||o(this,Sn)!==null||(d(this,bn,null),o(this,Lt).call(this))})});m(this,nf,t=>{d(this,mr,t.currentTarget.value)});m(this,rf,t=>{t.key==="Enter"?(t.preventDefault(),h(this,x,Oc).call(this,!0)):t.key==="Escape"&&(t.preventDefault(),h(this,x,Oc).call(this,!1))});m(this,sf,()=>{h(this,x,Oc).call(this,!0)});m(this,of,t=>{t.preventDefault(),h(this,x,Oc).call(this,!0)});m(this,Nu,()=>{d(this,wn,!1)});m(this,zu,t=>{!o(this,wn)||t.detail===0||(d(this,wn,!1),t.preventDefault(),t.stopImmediatePropagation())});m(this,af,t=>{var e;!o(this,gt).highlightOnPointerMove||o(this,we)!==null||o(this,Mt)!==null||(e=o(this,Qr).value)!=null&&e.querySelector("tv-menu[open]")||au(t.currentTarget)});m(this,Hu,t=>{if(o(this,on)){d(this,Me,null);return}const e=o(this,we);if(e!==null){if(e.pointerId!==t.pointerId)return;t.preventDefault(),h(this,x,Lc).call(this,e,t);return}const r=o(this,Me);if(!(r===null||r.pointerId!==t.pointerId)){if(t.buttons===0){d(this,Me,null);return}Math.hypot(t.clientX-r.x,t.clientY-r.y)<=y_||h(this,x,D_).call(this,r,t)}});m(this,Zu,t=>{var r;const e=o(this,we);if(e!==null&&e.pointerId===t.pointerId){if(e.completed)return;const i=e.captureTarget.hasPointerCapture(t.pointerId);h(this,x,Lc).call(this,e,t);const s=i&&e.placement.kind==="placement"?e.placement.operation:null,a=o(this,sn);if(s===null||a===null){h(this,x,Nc).call(this,e,!1);return}e.completed=!0,h(this,x,Mc).call(this,e),e.operation=[...s],a.setPinnedChannelIds([...s]).then(()=>{o(this,we)===e&&(e.operationResolved=!0,h(this,x,qg).call(this,o(this,Tt)))},()=>{o(this,we)===e&&(e.operationResolved=!0,e.operationRejected=!0,h(this,x,dd).call(this,e))});return}((r=o(this,Me))==null?void 0:r.pointerId)===t.pointerId&&d(this,Me,null)});m(this,Uu,t=>{var e,r;((e=o(this,we))==null?void 0:e.pointerId)===t.pointerId&&!o(this,we).completed?h(this,x,fd).call(this):((r=o(this,Me))==null?void 0:r.pointerId)===t.pointerId&&d(this,Me,null)});m(this,Fu,t=>{const e=o(this,we);e===null||e.pointerId!==t.pointerId||e.completed||h(this,x,Nc).call(this,e,!1)});m(this,qu,t=>{t.key!=="Escape"||o(this,we)===null||o(this,we).completed||(t.preventDefault(),t.stopImmediatePropagation(),h(this,x,fd).call(this))});d(this,Lt,t)}get creating(){return o(this,bn)!==null}get dragging(){return o(this,we)!==null}connect(){window.addEventListener("pointermove",o(this,Hu)),window.addEventListener("pointerup",o(this,Zu)),window.addEventListener("pointercancel",o(this,Uu)),window.addEventListener("lostpointercapture",o(this,Fu)),window.addEventListener("keydown",o(this,qu),!0),window.addEventListener("click",o(this,zu),!0),window.addEventListener("pointerdown",o(this,Nu),!0)}update(t,e,r){const i=o(this,Tt),s=o(this,on);d(this,sn,t),d(this,Tt,e),d(this,gt,r),d(this,on,r.motionSuppressed??!1),!s&&o(this,on)&&h(this,x,R_).call(this),h(this,x,z_).call(this,e),h(this,x,__).call(this,e),h(this,x,T_).call(this,i,e),o(this,Mt)!==null&&!e.channels.some(({id:l})=>l===o(this,Mt))&&(d(this,Mt,null),d(this,mr,"")),h(this,x,qg).call(this,e);const a=o(this,is);a!==null&&e.display.pinnedChannelIds.includes(a.channelId)===a.pinned&&(d(this,is,null),queueMicrotask(()=>{const l=h(this,x,Ng).call(this,a.channelId);l==null||l.scrollIntoView({block:"nearest"}),a.focus&&(l==null||l.focus({preventScroll:!0}))})),s&&!o(this,on)&&h(this,x,I_).call(this)}template(){var r;const t=o(this,Tt);if(t===null)return de;const e=h(this,x,C_).call(this,pb(t,(r=o(this,we))==null?void 0:r.source));return j`
104
- <div
105
- class="channel-list"
106
- role="listbox"
107
- aria-label="Channels"
108
- ${yt(o(this,Qr))}
109
- >
110
- ${h(this,x,Lg).call(this,"Pinned",e.pinned)}
111
- ${h(this,x,Lg).call(this,"Recent",e.unpinned)}
112
- </div>
113
- `}overlayTemplate(){return o(this,gt).management?h(this,x,k_).call(this):de}disconnect(){var t,e,r;window.removeEventListener("pointermove",o(this,Hu)),window.removeEventListener("pointerup",o(this,Zu)),window.removeEventListener("pointercancel",o(this,Uu)),window.removeEventListener("lostpointercapture",o(this,Fu)),window.removeEventListener("keydown",o(this,qu),!0),window.removeEventListener("click",o(this,zu),!0),window.removeEventListener("pointerdown",o(this,Nu),!0),h(this,x,Vg).call(this),(t=o(this,gr))==null||t.withdraw(),d(this,gr,null),(e=o(this,_n))==null||e.cancel(),d(this,_n,null),(r=o(this,Zt))==null||r.cancel(),d(this,Zt,null),d(this,sn,null),d(this,Tt,null),d(this,Mt,null),d(this,mr,""),d(this,Co,!1),d(this,Me,null),d(this,wn,!1),d(this,bn,null),d(this,Sn,null),d(this,Nt,null),d(this,zt,null),d(this,Ht,null),d(this,is,null)}}Lt=new WeakMap,sn=new WeakMap,Tt=new WeakMap,gt=new WeakMap,on=new WeakMap,Mt=new WeakMap,mr=new WeakMap,Co=new WeakMap,Me=new WeakMap,we=new WeakMap,wn=new WeakMap,bn=new WeakMap,Sn=new WeakMap,Nt=new WeakMap,zt=new WeakMap,Ht=new WeakMap,_n=new WeakMap,Zt=new WeakMap,gr=new WeakMap,Qr=new WeakMap,dl=new WeakMap,fl=new WeakMap,is=new WeakMap,x=new WeakSet,Lg=function(t,e){var f;const r=t==="Pinned"?"pinned":"unpinned",i=o(this,we);if(i===null&&e.length===0)return null;const s=i===null?void 0:e.find(({channel:p})=>p.id===i.channelId),a=i===null?e:e.filter(({channel:p})=>p.id!==i.channelId),l=(i==null?void 0:i.placement.kind)==="placement"&&((f=i.placement.placeholder)==null?void 0:f.side)===r?i.placement.placeholder:null,c=a.map(p=>({kind:"row",row:p}));l!==null&&c.splice(l.index,0,{kind:"placeholder",key:`channel-placeholder-${r}`}),s!==void 0&&c.push({kind:"row",row:s});const u=i!==null&&a.length===0&&l===null;return j`
114
- <div
115
- class="channel-group"
116
- role="group"
117
- aria-labelledby=${`channel-group-${r}`}
118
- data-channel-side=${r}
119
- ?drag-collapsed=${u}
120
- >
121
- <div class="channel-group-label" id=${`channel-group-${r}`}>${t}</div>
122
- ${zd(c,p=>p.kind==="row"?p.row.channel.id:p.key,p=>p.kind==="row"?h(this,x,b_).call(this,p.row):j`
123
- <span
124
- class="channel-placeholder"
125
- aria-hidden="true"
126
- data-channel-side=${r}
127
- data-channel-index=${(l==null?void 0:l.index)??0}
128
- style=${Hd({height:`${(i==null?void 0:i.rowHeight)??0}px`})}
129
- ></span>
130
- `)}
131
- </div>
132
- `},b_=function(t){var c;const{channel:e,pinned:r,selected:i}=t,s=((c=o(this,we))==null?void 0:c.channelId)===e.id?o(this,we):null,a=s!==null&&r&&s.placement.kind==="placement"&&s.placement.side==="unpinned",l=e.id===o(this,Mt);return j`
133
- <div
134
- class=${`channel-row${s!==null?" dragged":""}${a?" unpinning":""}`}
135
- data-channel-id=${e.id}
136
- style=${Hd(s===null?{}:{left:`${s.currentX-s.grip.previewOffsetX}px`,top:`${s.currentY-s.grip.offsetY}px`,width:`${s.rowWidth}px`,height:`${s.rowHeight}px`})}
137
- >
138
- ${a?j`
139
- <span class="channel-drag-action" aria-hidden="true">
140
- <tv-icon name="unpin"></tv-icon>
141
- Unpin
142
- </span>
143
- `:null}
144
- ${l?j`
145
- <input
146
- class="channel-rename"
147
- aria-label="Channel name"
148
- .value=${o(this,mr)}
149
- @input=${o(this,nf)}
150
- @keydown=${o(this,rf)}
151
- @blur=${o(this,sf)}
152
- ${yt(o(this,dl))}
153
- />
154
- <button
155
- class="channel-rename-commit"
156
- variant="ghost"
157
- icon
158
- size="sm"
159
- type="button"
160
- tabindex="-1"
161
- aria-label="Rename"
162
- @pointerdown=${o(this,of)}
163
- >
164
- <tv-icon name="check"></tv-icon>
165
- </button>
166
- `:j`
167
- <div
168
- class="channel"
169
- role="option"
170
- tabindex="-1"
171
- @keydown=${u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),u.stopPropagation(),u.currentTarget.click())}}
172
- @pointermove=${o(this,af)}
173
- aria-selected=${i?"true":de}
174
- @pointerdown=${u=>o(this,gt).dragging??o(this,gt).management?h(this,x,x_).call(this,e.id,u):void 0}
175
- @click=${u=>h(this,x,P_).call(this,e.id,u)}
176
- >
177
- ${e.name}
178
- </div>
179
- ${o(this,gt).management?g_(h(this,x,S_).call(this,t),{trigger:u=>j`
180
- <button
181
- class="channel-menu-trigger"
182
- variant="ghost"
183
- icon
184
- size="sm"
185
- type="button"
186
- tabindex="-1"
187
- id=${u}
188
- aria-haspopup="menu"
189
- title=${`${e.name} menu`}
190
- >
191
- <tv-icon name="expand"></tv-icon>
192
- </button>
193
- `}):de}
194
- `}
195
- </div>
196
- `},S_=function(t){const{channel:e,pinned:r}=t;return[{label:"Rename",action:()=>h(this,x,Mg).call(this,e.id)},{label:r?"Unpin":"Pin",action:()=>h(this,x,$_).call(this,e.id,!r)},{separator:!0},{label:"Delete",destructive:!0,action:()=>h(this,x,A_).call(this,e.id,e.name)}]},__=function(t){const e=o(this,bn);if(e===null||o(this,Sn)!==null||e.resultChannelId===null)return;const r=t.channels.find(({id:i})=>i===e.resultChannelId);r!==void 0&&(d(this,Sn,r.id),queueMicrotask(()=>h(this,x,Dc).call(this,"create",r.id)))},A_=function(t,e){var i,s,a,l,c;if(o(this,Nt)!==null||o(this,zt)!==null)return;h(this,x,zg).call(this,t),d(this,Nt,{channelId:t,name:e}),(s=(i=o(this,gt)).onDeleteStart)==null||s.call(i,t),o(this,Lt).call(this);const r=(a=o(this,fl).value)==null?void 0:a.closest("dialog");r instanceof HTMLDialogElement&&(d(this,gr,np(r,()=>{h(this,x,ud).call(this)})),(c=(l=o(this,fl).value)==null?void 0:l.querySelector(".dialog-actions button"))==null||c.focus())},ud=function(t=!1){var i,s;const e=o(this,Nt),r=o(this,gr);d(this,gr,null),d(this,Nt,null),r==null||r.withdraw(),o(this,Lt).call(this),!t&&e!==null&&((s=(i=o(this,gt)).onDeleteEnd)==null||s.call(i,e.channelId,!1))},E_=function(){const t=o(this,sn),e=o(this,Nt);if(t===null||e===null||o(this,zt)!==null)return;d(this,zt,e.channelId),h(this,x,ud).call(this,!0);const r=o(this,gt).onDeleteEnd;t.deleteChannel(e.channelId).then(()=>{r==null||r(e.channelId,!0)}).catch(()=>{o(this,zt)===e.channelId&&o(this,Ht)===null&&(d(this,zt,null),o(this,Lt).call(this)),r==null||r(e.channelId,!1)})},k_=function(){const t=o(this,Nt);return t===null?null:tp(j`
197
- <div
198
- class="dialog-alert channel-delete-alert"
199
- role="alertdialog"
200
- aria-labelledby="channel-delete-title"
201
- aria-describedby="channel-delete-body"
202
- ${yt(o(this,fl))}
203
- >
204
- <h2 id="channel-delete-title">Delete “${t.name}”?</h2>
205
- <p id="channel-delete-body">
206
- This will permanently delete this channel from Television.
207
- </p>
208
- <div class="dialog-actions">
209
- <button type="button" autofocus @click=${()=>h(this,x,ud).call(this)}>
210
- Cancel
211
- </button>
212
- <button type="button" intent="danger" @click=${()=>h(this,x,E_).call(this)}>
213
- Delete
214
- </button>
215
- </div>
216
- </div>
217
- `)},T_=function(t,e){var u,f;if(o(this,Nt)!==null&&!e.channels.some(({id:p})=>{var y;return p===((y=o(this,Nt))==null?void 0:y.channelId)})){const p=o(this,Nt);(u=o(this,gr))==null||u.withdraw(),d(this,gr,null),d(this,Nt,null),queueMicrotask(()=>{var y,v;return(v=(y=o(this,gt)).onDeleteEnd)==null?void 0:v.call(y,p.channelId,!0)})}const r=o(this,Ht);if(r!==null&&e.channels.some(({id:p})=>p===r.row.channel.id)){(f=o(this,Zt))==null||f.cancel(),d(this,Zt,null),d(this,Ht,null),d(this,zt,null);return}const i=o(this,zt);if(i===null||r!==null||e.channels.some(({id:p})=>p===i))return;if(t===null){d(this,zt,null);return}const s=pb(t),a=s.pinned.findIndex(({channel:p})=>p.id===i),l=s.unpinned.findIndex(({channel:p})=>p.id===i),c=a>=0?s.pinned[a]:s.unpinned[l];if(c===void 0){d(this,zt,null);return}d(this,Ht,{row:{...c,selected:!1},side:a>=0?"pinned":"unpinned",index:a>=0?a:l}),queueMicrotask(()=>h(this,x,Dc).call(this,"delete",i))},C_=function(t){const e=o(this,Ht);if(e===null)return t;const r=[...t[e.side]];return r.some(({channel:i})=>i.id===e.row.channel.id)||r.splice(e.index,0,e.row),{...t,[e.side]:r}},Dc=function(t,e){var l,c;if(t==="create"&&o(this,Sn)!==e||t==="delete"&&((l=o(this,Ht))==null?void 0:l.row.channel.id)!==e||o(this,on))return;const r=[...((c=o(this,Qr).value)==null?void 0:c.querySelectorAll(js))??[]].find(u=>u.dataset.channelId===e);if(r===void 0){t==="delete"&&h(this,x,xa).call(this,t,e);return}if(typeof r.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches){h(this,x,xa).call(this,t,e);return}const i=r.getBoundingClientRect().height,s=t==="create"?[{maxHeight:"0px",opacity:0},{maxHeight:`${i}px`,opacity:1}]:[{maxHeight:`${i}px`,opacity:1},{maxHeight:"0px",opacity:0}],a=r.animate(s,{duration:Ha,easing:Bh});t==="create"?d(this,_n,a):d(this,Zt,a),a.finished.then(()=>{t==="create"&&o(this,_n)!==a||t==="delete"&&o(this,Zt)!==a||(t==="create"?d(this,_n,null):d(this,Zt,null),h(this,x,xa).call(this,t,e))},()=>{})},xa=function(t,e){var r;if(t==="create"){if(o(this,Sn)!==e)return;d(this,Sn,null),d(this,bn,null),h(this,x,Mg).call(this,e);return}((r=o(this,Ht))==null?void 0:r.row.channel.id)===e&&(d(this,Ht,null),d(this,zt,null),o(this,Lt).call(this))},R_=function(){var r;d(this,Me,null),h(this,x,Vg).call(this);const t=o(this,Sn);o(this,_n)!==null&&(o(this,_n).cancel(),d(this,_n,null),t!==null&&queueMicrotask(()=>h(this,x,xa).call(this,"create",t)));const e=((r=o(this,Ht))==null?void 0:r.row.channel.id)??null;o(this,Zt)!==null&&(o(this,Zt).cancel(),d(this,Zt,null),e!==null&&queueMicrotask(()=>h(this,x,xa).call(this,"delete",e)))},I_=function(){var r;const t=o(this,Sn),e=((r=o(this,Ht))==null?void 0:r.row.channel.id)??null;t!==null&&o(this,_n)===null&&queueMicrotask(()=>h(this,x,Dc).call(this,"create",t)),e!==null&&o(this,Zt)===null&&queueMicrotask(()=>h(this,x,Dc).call(this,"delete",e))},Mg=function(t){var r;const e=(r=o(this,Tt))==null?void 0:r.channels.find(({id:i})=>i===t);e!==void 0&&(d(this,Mt,t),d(this,mr,e.name),d(this,Me,null),o(this,Lt).call(this),queueMicrotask(()=>{var i,s;o(this,Mt)===t&&((i=o(this,dl).value)==null||i.focus(),(s=o(this,dl).value)==null||s.select())}))},Oc=function(t){if(o(this,Mt)===null||o(this,Co)||o(this,sn)===null)return;d(this,Co,!0);const e=o(this,Mt),r=o(this,mr).trim();d(this,Mt,null),d(this,mr,""),o(this,Lt).call(this),d(this,Co,!1),t&&r.length>0&&o(this,sn).renameChannel(e,r).catch(()=>{})},nf=new WeakMap,rf=new WeakMap,sf=new WeakMap,of=new WeakMap,$_=function(t,e){var s;if(o(this,sn)===null||o(this,Tt)===null)return;if(h(this,x,zg).call(this,t),o(this,gt).revealMovedRow){const a=h(this,x,Ng).call(this,t);d(this,is,{channelId:t,pinned:e,focus:((s=a==null?void 0:a.parentElement)==null?void 0:s.contains(document.activeElement))??!1})}const r=o(this,Tt).display.pinnedChannelIds,i=e?[...r.filter(a=>a!==t),t]:r.filter(a=>a!==t);o(this,sn).setPinnedChannelIds(i).catch(()=>{d(this,is,null)})},Ng=function(t){var e,r;return((r=[...((e=o(this,Qr).value)==null?void 0:e.querySelectorAll(js))??[]].find(i=>i.dataset.channelId===t))==null?void 0:r.querySelector(".channel"))??void 0},zg=function(t){var i,s,a;const e=[...((i=o(this,Qr).value)==null?void 0:i.querySelectorAll(js))??[]].find(l=>l.dataset.channelId===t),r=e==null?void 0:e.querySelector(".channel-menu-trigger");r&&((a=(s=o(this,Qr).value)==null?void 0:s.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||a.removeAttribute("open"))},x_=function(t,e){if(e.button!==0||o(this,Me)!==null||o(this,we)!==null||o(this,Tt)===null)return;d(this,wn,!1);const i=e.currentTarget.closest(".sidebar, .channel-switcher-pop");if(i===null)return;const s=zc(o(this,Tt));!s.pinnedChannelIds.includes(t)&&!s.unpinnedChannelIds.includes(t)||d(this,Me,{channelId:t,pointerId:e.pointerId,x:e.clientX,y:e.clientY,source:{channelId:t,...s},captureTarget:i})},Nu=new WeakMap,zu=new WeakMap,P_=function(t,e){var r;if(e.detail!==0&&o(this,wn)){d(this,wn,!1);return}d(this,wn,!1),o(this,we)===null&&(o(this,gt).selectChannel?o(this,gt).selectChannel(t):(r=o(this,sn))==null||r.focusChannel(t).catch(()=>{}))},af=new WeakMap,Hu=new WeakMap,D_=function(t,e){if(o(this,on)){d(this,Me,null);return}const r=[...t.captureTarget.querySelectorAll(js)].find(f=>f.dataset.channelId===t.channelId);if(r===void 0){d(this,Me,null);return}const i=r.getBoundingClientRect(),s=h(this,x,O_).call(this,r),a=WM({wideRow:i,compactPreviewWidth:s,pointer:{x:t.x,y:t.y}}),l=t.captureTarget.querySelector('[data-channel-side="pinned"]'),c=t.captureTarget.querySelector('[data-channel-side="unpinned"]');try{t.captureTarget.setPointerCapture(t.pointerId)}catch{d(this,Me,null);return}t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-x",`${a.previewOffsetX}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-y",`${a.offsetY}px`),t.captureTarget.style.setProperty("--channel-sidebar-drag-grip-correction-x",`${a.correctionX}px`),d(this,wn,!0);const u={...t,placement:{kind:"invalidated"},currentX:e.clientX,currentY:e.clientY,grip:a,rowWidth:s,rowHeight:i.height,originPinnedContentBottom:(l==null?void 0:l.getBoundingClientRect().bottom)??null,originUnpinnedGroupTop:(c==null?void 0:c.getBoundingClientRect().top)??null,displacementAnimations:new Set,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,completed:!1,operation:null,operationResolved:!1,operationRejected:!1,restorationQueued:!1};d(this,Me,null),d(this,we,u),h(this,x,Lc).call(this,u,e)},O_=function(t){const e=t.cloneNode(!0);for(const i of[e,...e.querySelectorAll("[id], [trigger]")])i.removeAttribute("id"),i.removeAttribute("trigger");e.classList.add("dragged"),e.style.position="fixed",e.style.left="-10000px",e.style.top="-10000px",e.style.visibility="hidden",e.style.pointerEvents="none",document.body.append(e);const r=e.getBoundingClientRect().width;return e.remove(),r},Lc=function(t,e,r=!0){if(t.completed)return;const i=o(this,Tt);if(i===null){t.placement={kind:"invalidated"};return}t.currentX=e.clientX,t.currentY=e.clientY;const s=zc(i),a=new Map([...t.captureTarget.querySelectorAll(js)].map(O=>[O.dataset.channelId,O])),l=s.pinnedChannelIds.filter(O=>O!==t.channelId).flatMap(O=>{const z=a.get(O);if(z===void 0)return[];const P=z.getBoundingClientRect();return[{channelId:O,top:P.top,bottom:P.bottom}]}),c=t.captureTarget.querySelector('.channel-group[data-channel-side="pinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),u=t.captureTarget.querySelector('.channel-group[data-channel-side="unpinned"]:not([drag-collapsed]):not(.channel-group-withdrawal)'),f=t.captureTarget.querySelector(".channel-group:not(.channel-group-withdrawal) .channel-placeholder"),p=f==null?void 0:f.getBoundingClientRect(),y=f==null?void 0:f.dataset.channelSide,v=Number(f==null?void 0:f.dataset.channelIndex),S=t.captureTarget.getBoundingClientRect(),_=MM({source:t.source,current:s,pointer:{x:e.clientX,y:e.clientY},geometry:{sidebar:{left:S.left,right:S.right,top:S.top,bottom:S.bottom},pinnedRows:l,unpinnedGroupTop:(u==null?void 0:u.getBoundingClientRect().top)??t.originUnpinnedGroupTop,pinnedContentBottom:(c==null?void 0:c.getBoundingClientRect().bottom)??t.originPinnedContentBottom,placeholder:p!==void 0&&(y==="pinned"||y==="unpinned")&&Number.isInteger(v)?{side:y,index:v,top:p.top,bottom:p.bottom}:null}}),I=!GM(t.placement,_),Z=I?h(this,x,Ug).call(this,t):null;t.placement=_,(I||r)&&h(this,x,Fg).call(this,t,Z,!1),h(this,x,Hg).call(this,t)},Hg=function(t){const e=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),r=e?h(this,x,Zg).call(this,e,t.currentY):0,i=e?Math.max(0,e.scrollHeight-e.clientHeight):0,s=r<0?((e==null?void 0:e.scrollTop)??0)<=fb:((e==null?void 0:e.scrollTop)??0)>=i-fb;if(o(this,on)||t.completed||r===0||i===0||s||typeof requestAnimationFrame!="function"){h(this,x,Mc).call(this,t);return}t.edgeScrollFrame===0&&(t.edgeScrollFrame=requestAnimationFrame(a=>{h(this,x,L_).call(this,t,a)}))},L_=function(t,e){if(t.edgeScrollFrame=0,o(this,on)||o(this,we)!==t||t.completed){t.edgeScrollTimestamp=null;return}const r=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");if(r===null){t.edgeScrollTimestamp=null;return}const i=h(this,x,Zg).call(this,r,t.currentY),s=t.edgeScrollTimestamp;if(t.edgeScrollTimestamp=e,i!==0&&s!==null){const a=Math.max(0,e-s)/1e3,l=Math.max(0,r.scrollHeight-r.clientHeight),c=r.scrollTop,u=i*a+t.edgeScrollRemainder,f=Math.max(0,Math.min(l,c+u));r.scrollTop=f;const p=r.scrollTop-c;if(t.edgeScrollRemainder=f===0||f===l?0:u-p,p!==0){r.toggleAttribute("continues-start",r.scrollTop>0),h(this,x,M_).call(this,t);return}}h(this,x,Hg).call(this,t)},M_=function(t){h(this,x,Lc).call(this,t,{clientX:t.currentX,clientY:t.currentY},!1)},Mc=function(t){t.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(t.edgeScrollFrame),t.edgeScrollFrame=0,t.edgeScrollTimestamp=null,t.edgeScrollRemainder=0},Zg=function(t,e){const r=t.getBoundingClientRect();return e>=r.top&&e<r.top+Rn?-Zd*(r.top+Rn-e)/Rn:e>r.bottom-Rn&&e<=r.bottom?Zd*(e-(r.bottom-Rn))/Rn:0},Ug=function(t){var i;for(const s of t.displacementAnimations)s.cancel();t.displacementAnimations.clear();const e=new Map;for(const s of t.captureTarget.querySelectorAll(js)){const a=s.dataset.channelId;if(a===void 0)continue;const l=s.getBoundingClientRect();e.set(a,{left:l.left,top:l.top})}const r=new Map;for(const s of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const a=s.dataset.channelSide;if(a!=="pinned"&&a!=="unpinned")continue;const l=s.getBoundingClientRect(),c=s.cloneNode(!0);for(const u of[c,...c.querySelectorAll("[id], [trigger]")])u.removeAttribute("id"),u.removeAttribute("trigger");(i=c.querySelector(".channel-row.dragged"))==null||i.remove(),c.classList.add("channel-group-withdrawal"),c.setAttribute("aria-hidden","true"),c.removeAttribute("drag-collapsed"),r.set(a,{left:l.left,top:l.top,width:l.width,height:s.hasAttribute("drag-collapsed")?0:l.height,withdrawal:c})}return{rows:e,groups:r}},Fg=function(t,e,r){const i=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body"),s=(i==null?void 0:i.scrollTop)??0;o(this,Lt).call(this),queueMicrotask(()=>{const a=t.captureTarget.querySelector(".sidebar-body, .channel-switcher-pop-body");a!==null&&(a.scrollTop=s),e!==null&&h(this,x,N_).call(this,t,e,r)})},N_=function(t,e,r){if(!(o(this,on)||typeof HTMLElement.prototype.animate!="function"||matchMedia("(prefers-reduced-motion: reduce)").matches)){for(const i of t.captureTarget.querySelectorAll(js)){const s=i.dataset.channelId;if(s===void 0||!r&&s===t.channelId)continue;const a=e.rows.get(s);if(a===void 0)continue;const l=i.getBoundingClientRect(),c=a.left-l.left,u=a.top-l.top;Math.hypot(c,u)<=bc||h(this,x,hd).call(this,t,i.animate({translate:[`${c}px ${u}px`,"0px 0px"]},{duration:Ha,easing:Bh}))}for(const i of t.captureTarget.querySelectorAll(".channel-group:not(.channel-group-withdrawal)")){const s=i.dataset.channelSide;if(s!=="pinned"&&s!=="unpinned")continue;const a=e.groups.get(s),l=i.getBoundingClientRect(),c=i.hasAttribute("drag-collapsed")?0:l.height;if(a!==void 0){if(a.height<=bc&&c>bc)h(this,x,hd).call(this,t,i.animate([{opacity:0,translate:`0px -${c}px`},{opacity:1,translate:"0px 0px"}],{duration:Ha,easing:Bh}));else if(a.height>bc&&c<=bc&&a.withdrawal.childElementCount>0){const u=a.withdrawal;u.style.left=`${a.left}px`,u.style.top=`${a.top}px`,u.style.width=`${a.width}px`,u.style.height=`${a.height}px`,t.captureTarget.append(u);const f=u.animate([{opacity:1,translate:"0px 0px"},{opacity:0,translate:`0px -${a.height}px`}],{duration:Ha,easing:Bh});h(this,x,hd).call(this,t,f),f.finished.finally(()=>u.remove()).catch(()=>{})}}}}},hd=function(t,e){t.displacementAnimations.add(e),e.finished.finally(()=>{t.displacementAnimations.delete(e)}).catch(()=>{})},Zu=new WeakMap,Uu=new WeakMap,Fu=new WeakMap,qu=new WeakMap,z_=function(t){const e=zc(t);o(this,we)!==null&&!o(this,we).completed&&!mb(o(this,we).source,e)&&h(this,x,fd).call(this),o(this,Me)!==null&&!mb(o(this,Me).source,e)&&d(this,Me,null)},qg=function(t){const e=o(this,we);if(t===null||e===null||!e.completed||!e.operationResolved||e.restorationQueued)return;if(e.operationRejected){h(this,x,dd).call(this,e);return}const r=e.operation;r!==null&&Ud(zc(t).pinnedChannelIds,r)&&h(this,x,dd).call(this,e)},dd=function(t){o(this,we)!==t||t.restorationQueued||(t.restorationQueued=!0,queueMicrotask(()=>{o(this,we)===t&&h(this,x,Nc).call(this,t,!1)}))},fd=function(){d(this,Me,null);const t=o(this,we);t!==null&&h(this,x,Nc).call(this,t,!0)},Nc=function(t,e){if(o(this,we)!==t)return;h(this,x,Mc).call(this,t);const r=h(this,x,Ug).call(this,t);d(this,we,null),h(this,x,Bg).call(this,t),e&&t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId),h(this,x,Fg).call(this,t,r,!0)},Vg=function(){d(this,Me,null);const t=o(this,we);if(d(this,we,null),t!==null){h(this,x,Mc).call(this,t);for(const e of t.displacementAnimations)e.cancel();t.displacementAnimations.clear(),h(this,x,Bg).call(this,t),t.captureTarget.hasPointerCapture(t.pointerId)&&t.captureTarget.releasePointerCapture(t.pointerId)}},Bg=function(t){t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-x"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-y"),t.captureTarget.style.removeProperty("--channel-sidebar-drag-grip-correction-x")};function WM(n){const t=Math.max(0,n.wideRow.right-n.wideRow.left),e=Math.max(0,n.wideRow.bottom-n.wideRow.top),r=gb(n.pointer.x-n.wideRow.left,0,t),i=Math.min(r,Math.max(0,n.compactPreviewWidth-jM));return{wideOffsetX:r,previewOffsetX:i,correctionX:r-i,offsetY:gb(n.pointer.y-n.wideRow.top,0,e)}}function pb(n,t=zc(n)){var l,c;const e=new Map(n.channels.map(u=>[u.id,u])),r=t.pinnedChannelIds.flatMap(u=>{const f=e.get(u);return f===void 0?[]:[f]}),i=t.unpinnedChannelIds.flatMap(u=>{const f=e.get(u);return f===void 0?[]:[f]}),s=n.display.focusedChannelId,a=s!==null&&e.has(s)?s:((l=r[0])==null?void 0:l.id)??((c=i[0])==null?void 0:c.id)??null;return{pinned:r.map(u=>({channel:u,pinned:!0,selected:u.id===a})),unpinned:i.map(u=>({channel:u,pinned:!1,selected:u.id===a}))}}function zc(n){const t=new Set(n.channels.map(({id:s})=>s)),e=n.display.pinnedChannelIds.filter(s=>t.has(s)),r=new Set(e),i=n.channels.filter(({id:s})=>!r.has(s)).map(({id:s})=>s).sort((s,a)=>a.localeCompare(s));return{pinnedChannelIds:e,unpinnedChannelIds:i}}function mb(n,t){return Ud(n.pinnedChannelIds,t.pinnedChannelIds)&&Ud(n.unpinnedChannelIds,t.unpinnedChannelIds)}function Ud(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function GM(n,t){var e,r,i,s;return n.kind!==t.kind?!1:n.kind==="invalidated"||t.kind==="invalidated"?!0:n.side===t.side&&((e=n.placeholder)==null?void 0:e.side)===((r=t.placeholder)==null?void 0:r.side)&&((i=n.placeholder)==null?void 0:i.index)===((s=t.placeholder)==null?void 0:s.index)&&n.operation===null==(t.operation===null)&&(n.operation===null||t.operation===null||Ud(n.operation,t.operation))}function gb(n,t,e){return Math.max(t,Math.min(e,n))}var Fn,lf;class JM extends dn{constructor(){super(...arguments);m(this,Fn,new w_(()=>this.render()));m(this,lf,e=>{const r=e.currentTarget;r.toggleAttribute("continues-start",r.scrollTop>0)})}connected(){o(this,Fn).connect()}template(e,r,i,s,a,l=!1){return o(this,Fn).update(e,r,{management:!0,motionSuppressed:l}),j`
218
- <nav class="sidebar" ?dragging=${o(this,Fn).dragging}>
219
- <header
220
- class="sidebar-titlebar"
221
- ?electron-draggable=${i}
222
- >
223
- <button
224
- class="channel-create"
225
- variant="ghost"
226
- icon
227
- aria-label="New channel"
228
- title="New channel"
229
- type="button"
230
- ?disabled=${o(this,Fn).creating}
231
- @click=${o(this,Fn).create}
232
- >
233
- <tv-icon name="add"></tv-icon>
234
- </button>
235
- <span
236
- class="toolbar-separator"
237
- role="separator"
238
- aria-orientation="vertical"
239
- ></span>
240
- ${a===void 0?j`
241
- <button
242
- class="sidebar-collapse"
243
- variant="ghost"
244
- icon
245
- aria-label="Collapse sidebar"
246
- title="Collapse sidebar"
247
- type="button"
248
- @click=${s}
249
- >
250
- <tv-icon name="sidebar" size="sm"></tv-icon>
251
- </button>
252
- `:a??j`
253
- <span class="sidebar-toggle-seat" aria-hidden="true"></span>
254
- `}
255
- </header>
256
-
257
- <div class="sidebar-body" @scroll=${o(this,lf)}>
258
- ${o(this,Fn).template()}
259
- </div>
260
- </nav>
261
- ${o(this,Fn).overlayTemplate()}
262
- `}disconnected(){o(this,Fn).disconnect()}}Fn=new WeakMap,lf=new WeakMap;const YM=fn(JM),KM=1280,XM=800,vb=.4,yb=.4,H_=280,wb=180,QM=14,eN=45,tN=16,bb=64,nN=90,rN=1,iN=24,sN=230,oN=230;function aN(n,t){const{expandedSidebarWidth:e,expandedToggleLeft:r,collapsedToggleLeft:i,toggleWidth:s,toggleSwitcherGap:a,collapsedLeadReservation:l,hasSwitcher:c}=t,u=e*(1-n),f=e-r,p=Math.max(u-f,i),y=i+f,v=Math.max(0,Math.min(s,u-p)),S=jg((u-y)/(e-y)),_=s+a,I=i+_,Z=c?jg((I-u)/_):0;let O=n*l;if(l>e){const z=1-I/e,P=Math.min(1,n/z);O=n*e+P*(l-e)}return{sidebarBoundary:u,toggleLeft:p,toggleWipe:v,titlebarOpacity:S,switcherOpacity:Z,leadReservation:O}}function lN(n,t,e,r){const i=r*Math.abs(t-n);if(i===0)return t;const a=1-(1-jg(e/i))**2;return n+(t-n)*a}function jg(n){return Math.max(0,Math.min(1,n))}var ei,ss,ti,pl,ml,Ro,Ai,pd,Wg;class cN{constructor(t){m(this,Ai);m(this,ei,null);m(this,ss,0);m(this,ti);m(this,pl);m(this,ml);m(this,Ro,1);d(this,ti,t),d(this,pl,t),d(this,ml,t)}get boundary(){return h(this,Ai,pd).call(this),o(this,ti)}move(t){const e=this.boundary;if(h(this,Ai,Wg).call(this),d(this,pl,e),d(this,ml,t.target),d(this,Ro,t.width),t.onFrame(e),matchMedia("(prefers-reduced-motion: reduce)").matches||Math.abs(t.target-e)<Number.EPSILON){d(this,ti,t.target),t.onFrame(t.target),t.onFinish(t.target);return}const r=Math.abs(t.target-e)/t.width,i=t.root.animate([{},{}],{duration:wb*r,easing:"linear"});i.id="sidebar-collapse-boundary",d(this,ei,i);const s=()=>{if(o(this,ei)===i){if(h(this,Ai,pd).call(this),t.onFrame(o(this,ti)),i.playState==="finished"){d(this,ei,null),d(this,ss,0),d(this,ti,t.target),t.onFrame(t.target),t.onFinish(t.target);return}d(this,ss,requestAnimationFrame(s))}};d(this,ss,requestAnimationFrame(s))}cancel(){h(this,Ai,pd).call(this),h(this,Ai,Wg).call(this)}}ei=new WeakMap,ss=new WeakMap,ti=new WeakMap,pl=new WeakMap,ml=new WeakMap,Ro=new WeakMap,Ai=new WeakSet,pd=function(){const t=o(this,ei);if(t===null)return;const e=lN(1-o(this,pl)/o(this,Ro),1-o(this,ml)/o(this,Ro),Number(t.currentTime??0),wb);d(this,ti,o(this,Ro)*(1-e))},Wg=function(){var t;cancelAnimationFrame(o(this,ss)),d(this,ss,0),(t=o(this,ei))==null||t.cancel(),d(this,ei,null)};const Z_="television-active-theme",mv="tv-theme";let Vi=null,_i=null,Ts=null,Cs=null,Hi=null,Sb=0,Fd=0;function uN(n){const t=document.createElement("link"),e=new URL("/theme/theme.css",n);e.searchParams.set(mv,gv()),t.rel="stylesheet",t.href=e.toString(),t.dataset.televisionStyle=Z_;const r=()=>{Vi===t&&document.dispatchEvent(new Event("television-theme-styles-changed"))};return t.addEventListener("load",r,{once:!0}),t.addEventListener("error",r,{once:!0}),Vi==null||Vi.remove(),document.head.append(t),Vi=t,t}function hN(){Vi&&(Vi.remove(),Vi=null,document.dispatchEvent(new Event("television-theme-styles-changed")))}function _b(n){const t=document.createElement("script"),e=new URL("/theme/main.js",n);return e.searchParams.set(mv,gv()),t.src=e.toString(),t.dataset.televisionScript=Z_,_i==null||_i.remove(),document.head.append(t),_i=t,t}function dN(){_i==null||_i.remove(),_i=null}function fN(){return _i}async function pN(n,t,e){const r=U_();if(t===null)return;let i;try{i=await e()}catch{return}if(r!==Fd)return;const s=i.themes.find(f=>f.id===t);if(s===void 0)return;const a=document.querySelector("#app"),l=document.querySelector("#foreground-overlay");if(a===null||l===null)return;const c=s.enableIframeBackgroundJS===!0?Ab(n,"background"):null,u=s.enableIframeOverlayJS===!0?Ab(n,"overlay"):null;r===Fd&&(c!==null&&(a.before(c),Ts=c),u!==null&&(l.after(u),Cs=u))}function mN(){U_()}function U_(){return Fd+=1,Ts==null||Ts.remove(),Cs==null||Cs.remove(),Ts=null,Cs=null,Fd}function Ab(n,t){const e=t==="background"?new URL("/theme/iframe-background.js",n):new URL("/theme/iframe-overlay.js",n);e.searchParams.set(mv,gv());const r=document.createElement("iframe");return r.id=t==="background"?"theme-iframe-background":"theme-iframe-overlay",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("inert",""),r.setAttribute("tabindex","-1"),r.setAttribute("aria-hidden","true"),r.srcdoc=vN(e.toString(),gN()),r}function gN(){const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n}function vN(n,t){return`<!doctype html>
263
- <html data-theme="${t}">
264
- <head>
265
- <meta charset="utf-8">
266
- <style>
267
- html, body {
268
- width: 100%;
269
- height: 100%;
270
- margin: 0;
271
- overflow: hidden;
272
- background: transparent;
273
- color-scheme: ${t};
274
- }
275
- </style>
276
- </head>
277
- <body>
278
- <script src="${n}"><\/script>
279
- </body>
280
- </html>`}function F_(n){var s;let t,e=n.button,r=n.buttons;switch(n.eventType){case"pointermove":t="television-theme-pointer-move",e=-1;break;case"pointerdown":t="television-theme-pointer-down";break;case"pointerup":t="television-theme-pointer-up";break;case"pointercancel":t="television-theme-pointer-cancel",e=-1,r=0;break;case"click":t="television-theme-pointer-click",r=0;break}const i={type:t,clientX:n.clientX,clientY:n.clientY,button:e,buttons:r};for(const a of[Ts,Cs])(a==null?void 0:a.isConnected)===!0&&((s=a.contentWindow)==null||s.postMessage(i,"*"))}function Th(n){n.isTrusted&&F_({eventType:n.type,clientX:n.clientX,clientY:n.clientY,button:n.button,buttons:n.buttons})}document.addEventListener("pointermove",Th,{capture:!0});document.addEventListener("pointerdown",Th,{capture:!0});document.addEventListener("pointerup",Th,{capture:!0});document.addEventListener("pointercancel",Th,{capture:!0});document.addEventListener("click",Th,{capture:!0});function q_(n){if(n!==Ts&&n!==Cs)return!1;const e=((Hi==null?void 0:Hi.isConnected)===!0&&Hi!==Ts&&Hi!==Cs&&Hi.closest("#foreground-overlay")===null?Hi:null)??document.querySelector("#app");return e==null||e.focus({preventScroll:!0}),!0}document.addEventListener("focusin",n=>{const t=n.target;t instanceof HTMLElement&&(q_(t)||t.isConnected&&t.closest("#foreground-overlay")===null&&(Hi=t))},{capture:!0});window.addEventListener("blur",()=>{queueMicrotask(()=>q_(document.activeElement))},{capture:!0});function gv(){return Sb+=1,`${Date.now()}-${Sb}`}const yN=404,wN="/views/url-unsupported/",bN="allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads",SN="clipboard-write; fullscreen; autoplay; picture-in-picture; web-share; encrypted-media",_N="tv-artifact:",AN="tv-url-artifact";function md(n){const t=ru(n.artifact,{electron:n.electron,browserDemo:n.browserDemo??!1});let e;if(t.renderer==="url-direct")e=t;else if(n.currentURL===null){const r=n.viewURL??t.viewURL;t.renderer==="markdown"?e={renderer:"markdown",viewURL:r,contentURL:n.contentURL??t.contentURL}:t.renderer==="url-webview"&&t.contentURL!==null?e={renderer:"url-webview",viewURL:r,contentURL:n.contentURL??t.contentURL}:e={...t,viewURL:r}}else Eb(n.currentURL)&&!n.electron?e=Vr(n.currentURL)?{renderer:"proxy-iframe",viewURL:n.currentURL,contentURL:null}:{renderer:"proxy-iframe",viewURL:wN,contentURL:null}:Eb(n.currentURL)?e={renderer:"url-webview",viewURL:n.currentURL,contentURL:null}:e={renderer:n.electron?"url-webview":"proxy-iframe",viewURL:RN(n.currentURL,n.viewURL),contentURL:null};return n.frameSrcOverride?{...e,viewURL:n.frameSrcOverride}:e}var lt,an,gl,Io,$o,qn,xo,vl,Ut,yl,wl,vr,os,as,Po,te,Gg,V_,gd,B_,j_,Jg,W_,yr,vd,Hc,Yg,G_,Kg,Xg,Gs;class EN extends dn{constructor(){super(...arguments);m(this,te);m(this,lt,null);m(this,an,null);m(this,gl,"");m(this,Io,()=>{});m(this,$o,()=>{});m(this,qn,null);m(this,xo,null);m(this,vl,null);m(this,Ut,null);m(this,yl,null);m(this,wl,null);m(this,vr,null);m(this,os,null);m(this,as,null);m(this,Po,null);m(this,yr,()=>{!o(this,an)||o(this,an)!==o(this,qn)||o(this,Io).call(this,!0)})}get currentFrame(){return o(this,an)}connected(){h(this,te,vd).call(this),h(this,te,Yg).call(this)}disconnected(){h(this,te,Hc).call(this),h(this,te,Gs).call(this)}template(e,r,i=()=>{}){return d(this,Io,r),d(this,$o,i),e(this),o(this,gl)}assignSource(e){const r=o(this,lt),i=r?!IN(r.artifact,e.artifact):!0;((r==null?void 0:r.artifact.id)!==e.artifact.id||(r==null?void 0:r.artifact.kind)==="path"&&e.artifact.kind==="path"&&r.artifact.path!==e.artifact.path)&&d(this,Po,null),i&&(d(this,vr,null),o(this,Ut)&&(o(this,Ut).content=""),d(this,os,null),d(this,as,null)),d(this,lt,e),h(this,te,gd).call(this)}handleArtifactContentChanged(e){const r=o(this,lt);return e!==(r==null?void 0:r.artifact.id)||!o(this,Ut)&&!h(this,te,Xg).call(this)?!1:(h(this,te,Kg).call(this),!0)}handleThemeChanged(){var r;const e=(r=o(this,lt))==null?void 0:r.artifact;return(e==null?void 0:e.kind)!=="path"||!sg(e.path)||o(this,Ut)===null?!1:(o(this,Ut).notifyStylesChanged(),!0)}refreshFrameLoadState(){h(this,te,vd).call(this)}assignFrameSrc(e){o(this,an)&&h(this,te,Gg).call(this,o(this,an),e)}}lt=new WeakMap,an=new WeakMap,gl=new WeakMap,Io=new WeakMap,$o=new WeakMap,qn=new WeakMap,xo=new WeakMap,vl=new WeakMap,Ut=new WeakMap,yl=new WeakMap,wl=new WeakMap,vr=new WeakMap,os=new WeakMap,as=new WeakMap,Po=new WeakMap,te=new WeakSet,Gg=function(e,r){e.tagName.toLowerCase()==="iframe"&&(!h(this,te,V_).call(this)&&CN(r)?e.setAttribute("sandbox",bN):e.removeAttribute("sandbox")),e.setAttribute("src",r)},V_=function(){const e=o(this,lt);return e!==null&&ru(e.artifact,{electron:e.electron,browserDemo:e.browserDemo??!1}).renderer==="url-direct"},gd=function(){const e=o(this,lt);if(!e)return;if(e.artifact.kind==="path"&&h(this,te,Xg).call(this)){h(this,te,W_).call(this,e.artifact);return}const r=md(e),i=h(this,te,B_).call(this,r.renderer,TN(e));h(this,te,j_).call(this,i,r),h(this,te,Jg).call(this,i),h(this,te,vd).call(this),h(this,te,Yg).call(this)},B_=function(e,r){const i=e==="url-webview"?"webview":"iframe",s=o(this,an);if((s==null?void 0:s.tagName.toLowerCase())===i&&(i!=="webview"||s.getAttribute("partition")===r))return s;h(this,te,Hc).call(this),h(this,te,Gs).call(this);const a=document.createElement(i);return a.className="artifact-content",i==="webview"?(r!==null&&a.setAttribute("partition",r),a.setAttribute("allowpopups","")):a.setAttribute("allow",SN),d(this,an,a),a},j_=function(e,r){e.getAttribute("src")!==r.viewURL&&(o(this,$o).call(this,null),o(this,$o).call(this,e),h(this,te,Gg).call(this,e,r.viewURL)),r.contentURL===null?delete e.dataset.contentUrl:e.dataset.contentUrl=r.contentURL},Jg=function(e){o(this,gl)!==e&&(d(this,gl,e),this.render(e))},W_=function(e){o(this,$o).call(this,null),h(this,te,Hc).call(this),h(this,te,Gs).call(this),d(this,an,null),o(this,Io).call(this,!1),h(this,te,Jg).call(this,j`
281
- <section class="artifact-missing artifact-content" role="status" aria-label="Artifact file not found">
282
- <div class="artifact-missing-wrapper">
283
- <h1>${N4()}</h1>
284
- <p>${z4()}</p>
285
- <section class="artifact-missing-path" aria-label="Missing artifact path">
286
- <p class="artifact-missing-path-label">Registered path:</p>
287
- <p><code>${e.path}</code></p>
288
- </section>
289
- <p>${H4()}</p>
290
- </div>
291
- </section>
292
- `)},yr=new WeakMap,vd=function(){var s;const e=o(this,an),r=e?`${e.tagName.toLowerCase()}:${e.getAttribute("src")??""}:${e.dataset.contentUrl??""}`:null;if(e&&e===o(this,qn)&&r===o(this,xo)||(h(this,te,Hc).call(this),o(this,Io).call(this,!1),!e||!r||!this.isConnected))return;if(d(this,qn,e),d(this,xo,r),e.tagName.toLowerCase()==="webview"){e.addEventListener("did-finish-load",o(this,yr)),e.addEventListener("did-fail-load",o(this,yr));return}e.addEventListener("load",o(this,yr));const i=e;try{i.isConnected&&((s=i.contentDocument)==null?void 0:s.readyState)==="complete"&&o(this,yr).call(this)}catch{}},Hc=function(){if(!o(this,qn)){d(this,xo,null);return}o(this,qn).removeEventListener("load",o(this,yr)),o(this,qn).removeEventListener("did-finish-load",o(this,yr)),o(this,qn).removeEventListener("did-fail-load",o(this,yr)),d(this,qn,null),d(this,xo,null)},Yg=function(){const e=o(this,lt),r=o(this,an),i=(r==null?void 0:r.dataset.contentUrl)??null,s=(e==null?void 0:e.artifact.id)??null;if(!e||!r||!i||!s){h(this,te,Gs).call(this,{clearContent:!0});return}if(r!==o(this,vl)||s!==o(this,wl)){h(this,te,Gs).call(this),d(this,vl,r),d(this,yl,i),d(this,wl,s);const a=r.tagName.toLowerCase()==="webview"?new mO(r):new pO(r);d(this,Ut,a),a.handleUpdateContent(async l=>{const c=o(this,lt),u=c==null?void 0:c.application;if(!c||!u)throw new Error("No markdown artifact selected");await u.writeMarkdown(c.artifact.id,l),d(this,vr,l),o(this,Ut)===a&&(a.content=l)}),o(this,vr)!==null&&(a.content=o(this,vr))}else d(this,yl,i);h(this,te,G_).call(this)},G_=function(){const e=o(this,lt),r=e==null?void 0:e.application;!e||!r||!o(this,Ut)||o(this,os)===e.artifact.id&&o(this,as)===r||(d(this,os,e.artifact.id),d(this,as,r),h(this,te,Kg).call(this))},Kg=async function(){var s,a;const e=o(this,lt),r=e==null?void 0:e.application;if(!e||!r)return;const i=e.artifact.id;try{const l=await r.readMarkdown(i);if(((s=o(this,lt))==null?void 0:s.artifact.id)!==i||o(this,lt).application!==r)return;d(this,Po,null),d(this,vr,l);const c=o(this,Ut);if(!c){h(this,te,gd).call(this);return}c.content=l}catch(l){if(((a=o(this,lt))==null?void 0:a.artifact.id)!==i||o(this,lt).application!==r)return;if(l instanceof ec&&l.status===yN){d(this,Po,i),d(this,vr,null),h(this,te,Gs).call(this),h(this,te,gd).call(this);return}d(this,os,null),d(this,as,null)}},Xg=function(){var r;const e=(r=o(this,lt))==null?void 0:r.artifact;return o(this,Po)===(e==null?void 0:e.id)&&e.kind==="path"&&sg(e.path)},Gs=function(e={}){var r;(r=o(this,Ut))==null||r.dispose(),d(this,Ut,null),d(this,vl,null),d(this,yl,null),d(this,wl,null),d(this,os,null),d(this,as,null),e.clearContent&&d(this,vr,null)};const kN=fn(EN);function TN(n){const t=globalThis.__televisionNativeBridge;return!n.electron||(t==null?void 0:t.artifactPartitions)!==1?null:n.artifact.kind==="path"?`${_N}${n.artifact.id}`:AN}function Eb(n){return n.startsWith("http://")||n.startsWith("https://")}function CN(n){try{return/^\/artifact\/[^/]+(\/|$)/.test(new URL(n,window.location.href).pathname)}catch{return!1}}function RN(n,t){if(!n.startsWith("/")||!t)return n;try{return new URL(n,t).toString()}catch{return n}}function IN(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?n.url===t.url:!0}var Vu,bl,Bu,wr,ni,ls,ri,cs,ju,Wu,Dt,J_,Gu,Ju,Qg,yd,wd;class $N{constructor(t,e=()=>{},r=()=>{}){m(this,Dt);m(this,Vu);m(this,bl);m(this,Bu);m(this,wr,null);m(this,ni,null);m(this,ls,null);m(this,ri,null);m(this,cs,!1);m(this,ju,t=>{const e=Cb(t.data);if(!e)return;const r=o(this,ls);if(!r||r.tagName.toLowerCase()!=="iframe"||!r.isConnected)return;const i=r,s=i.contentWindow;if(s===null)return;const a=e.type==="leaving",l=e.type==="navigation-request"&&e.native===!0&&e.sameDocument!==!0,c=s===t.source,u=(a||l)&&o(this,ni)!==null&&o(this,ni)===t.source,f=a&&ON(i)===t.origin;!c&&!u&&!f||h(this,Dt,Qg).call(this,e,i,{send:p=>{var y;return(y=i.contentWindow)==null?void 0:y.postMessage(p,"*")}})});m(this,Wu,t=>{var s,a;const e=t.detail??t;if((e==null?void 0:e.channel)===xN){h(this,Dt,J_).call(this,(s=e.args)==null?void 0:s[0]);return}if(!e||e.channel!==kb)return;const r=Cb((a=e.args)==null?void 0:a[0]),i=o(this,ri);!r||!i||h(this,Dt,Qg).call(this,r,i,{send:l=>{var c;return(c=i.send)==null?void 0:c.call(i,kb,l)}})});m(this,Gu,t=>{const e=Rb(t);e.isMainFrame===!0&&e.isInPlace!==!0&&this.reset()});m(this,Ju,t=>{Rb(t).isMainFrame!==!1&&this.reset()});d(this,Vu,t),d(this,bl,e),d(this,Bu,r)}get currentGuid(){return o(this,wr)}get lifecycleWindow(){return o(this,ni)}get trustState(){return{currentGuid:o(this,wr),lifecycleWindow:o(this,ni)}}connect(){o(this,cs)||(d(this,cs,!0),window.addEventListener("message",o(this,ju)),h(this,Dt,yd).call(this))}disconnect(){o(this,cs)&&(window.removeEventListener("message",o(this,ju)),d(this,cs,!1),h(this,Dt,wd).call(this))}reset(){d(this,wr,null),d(this,ni,null),o(this,bl).call(this)}setCurrentFrame(t){if(t===o(this,ls)){h(this,Dt,yd).call(this);return}h(this,Dt,wd).call(this),o(this,ls)!==null&&this.reset(),d(this,ls,DN(t)?t:null),h(this,Dt,yd).call(this)}}Vu=new WeakMap,bl=new WeakMap,Bu=new WeakMap,wr=new WeakMap,ni=new WeakMap,ls=new WeakMap,ri=new WeakMap,cs=new WeakMap,ju=new WeakMap,Wu=new WeakMap,Dt=new WeakSet,J_=function(t){const e=o(this,ri);!e||typeof t!="string"||!PN(e)||o(this,Bu).call(this,t)},Gu=new WeakMap,Ju=new WeakMap,Qg=function(t,e,r){t.type==="bridge-ready"&&t.guid!==o(this,wr)?(o(this,wr)!==null&&o(this,bl).call(this),d(this,wr,t.guid),d(this,ni,e.tagName.toLowerCase()==="iframe"?e.contentWindow:null)):t.type==="leaving"&&t.guid===o(this,wr)&&this.reset(),o(this,Vu).call(this,t,r)},yd=function(){if(!o(this,cs))return;const t=o(this,ls),e=(t==null?void 0:t.tagName.toLowerCase())==="webview"?t:null;e!==o(this,ri)&&(h(this,Dt,wd).call(this),e&&(e.addEventListener("ipc-message",o(this,Wu)),e.addEventListener("did-start-navigation",o(this,Gu)),e.addEventListener("did-fail-load",o(this,Ju)),d(this,ri,e)))},wd=function(){const t=o(this,ri);t&&(t.removeEventListener("ipc-message",o(this,Wu)),t.removeEventListener("did-start-navigation",o(this,Gu)),t.removeEventListener("did-fail-load",o(this,Ju)),d(this,ri,null))};const kb="television-artifact-bridge",xN="television-application-link";function Tb(n){return n.protocol==="http:"||n.protocol==="https:"}function PN(n){var e;const t=window.location;if(!Tb(t))return!1;try{const r=new URL(((e=n.getURL)==null?void 0:e.call(n))??"");return Tb(r)&&r.origin===t.origin}catch{return!1}}function Cb(n){return T4(n)||C4(n)||R4(n)||I4(n)||$4(n)||x4(n)||P4(n)||D4(n)?n:null}function DN(n){if(!n)return!1;const t=n.tagName.toLowerCase();return t==="iframe"||t==="webview"}function ON(n){if(n.hasAttribute("sandbox"))return"null";try{return new URL(n.getAttribute("src")??n.src,window.location.href).origin}catch{return null}}function Rb(n){return n.detail??n}const LN="/views/url-unsupported/";class MN extends dn{constructor(){super(...arguments);R(this,"_artifact",null);R(this,"_viewURL",null);R(this,"_contentURL",null);R(this,"_application",null);R(this,"_fullScreen",!1);R(this,"_inert",!1);R(this,"_onFullScreenChange",()=>{});R(this,"_connected",!1);R(this,"_deleteConfirmationOpen",!1);R(this,"_dialogPresentation",null);R(this,"_subscribedWebview",null);R(this,"_documentHost",null);R(this,"_pendingDocumentSource",null);R(this,"_rootRef",Jn());R(this,"_trustedChannel",new $N((e,r)=>{this.handleTrustedFrameMessage(e,r)},()=>{this._missingArtifactReplyTransport=null},e=>HN(e)));R(this,"_activeReloadFrameSrc",null);R(this,"_applicationSubscriptionsAttached",!1);R(this,"_proxyReloadVersion",0);R(this,"_navigationState",null);R(this,"_navigationArtifactId",null);R(this,"_navigationCanonicalURL",null);R(this,"_preserveFrameSrcOnNavigationRender",!1);R(this,"_missingArtifactReplyTransport",null);R(this,"handleNavigationChange",()=>{const e=this._preserveFrameSrcOnNavigationRender,r=!e;r&&!bi()?(this.renderArtifact({preserveFrameSrc:!0}),this.forceCurrentFrameSrc()):this.renderArtifact({preserveFrameSrc:e,resetTrust:r}),this._preserveFrameSrcOnNavigationRender=!1});R(this,"handleArtifactContentChanged",e=>{var s;const r=e.artifactID,i=this._artifact;!i||r!==i.id||i.kind!=="path"||typeof r=="string"&&((s=this._documentHost)!=null&&s.handleArtifactContentChanged(r))||this.reloadProxyFrame()});R(this,"handleThemeChanged",()=>{var e,r;((e=this._artifact)==null?void 0:e.kind)==="url"&&Vr(this._artifact.url)||this.isDemoPage()||(r=this._documentHost)!=null&&r.handleThemeChanged()||this.reloadProxyFrame()});R(this,"handleWebviewDidNavigate",e=>{this.handleWebviewNavigationEvent(e)});R(this,"handleWebviewDidNavigateInPage",e=>{if(e.isMainFrame===!1)return;this._preserveFrameSrcOnNavigationRender=!0,this.handleWebviewNavigationEvent(e)||(this._preserveFrameSrcOnNavigationRender=!1)});R(this,"captureDocumentHost",e=>{this._documentHost=e,this._pendingDocumentSource&&(e.assignSource(this._pendingDocumentSource),this.syncFrameSubscriptions())});R(this,"handleEmbedLoadChange",e=>{var r;(r=this._rootRef.value)==null||r.toggleAttribute("data-embed-loaded",e)});R(this,"handleDocumentFrameChange",e=>{e===null&&this.resetTrustedFrame(),this.syncFrameTitle(e),this._trustedChannel.setCurrentFrame(this.bridgeFrame(e)),this.syncWebviewSubscription(e)});R(this,"handleTitleBarDoubleClick",e=>{const r=e.target;r instanceof Element&&r.closest("button")||this.requestFullScreen(!this._fullScreen)})}update(e,r){var u;const[i,s,a]=r;let l=!1;this._application!==i&&(this.detachApplicationSubscriptions(),this._application=i,this.attachApplicationSubscriptions(),this._connected&&(this.assignDocumentSource({preserveFrameSrc:!0}),l=!0));const c=this._artifact;if(c!==s){const f=c?!ZN(c,s):!0;if(f&&(this._activeReloadFrameSrc=null),this._artifact=s,this.syncNavigationState(),this._connected){if(this.renderArtifact({resetTrust:f}),l=!0,c&&UN(c,s)){const p=this.currentMissingArtifactMessage();p&&((u=this._missingArtifactReplyTransport)==null||u.send(p))}}else f&&this.resetTrustedFrame()}return this._viewURL!==a.viewURL&&(this._viewURL=a.viewURL,this.syncNavigationState(),this._connected?(this.renderArtifact({resetTrust:!0}),l=!0):this._trustedChannel.reset()),this._contentURL!==a.contentURL&&(this._contentURL=a.contentURL,this._connected&&(this.renderArtifact(),l=!0)),this._fullScreen!==a.fullScreen&&(this._fullScreen=a.fullScreen,this._connected&&this._artifact&&(this.renderArtifact({preserveFrameSrc:!0}),l=!0)),this._inert=a.inert,this._onFullScreenChange=a.onFullScreenChange,this._connected&&!l&&this.renderArtifact({preserveFrameSrc:!0}),super.update(e,r)}attachApplicationSubscriptions(){!this._application||this._applicationSubscriptionsAttached||(this._application.addEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.addEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!0)}detachApplicationSubscriptions(){!this._application||!this._applicationSubscriptionsAttached||(this._application.removeEventListener("artifact-content-changed",this.handleArtifactContentChanged),this._application.removeEventListener("theme-changed",this.handleThemeChanged),this._applicationSubscriptionsAttached=!1)}get activeView(){return null}connected(){this._connected=!0,this._trustedChannel.connect(),this.attachApplicationSubscriptions(),this.resetTrustedFrame(),this.syncNavigationState(),this.renderArtifact(),this.syncFrameSubscriptions()}disconnected(){var e;this._connected=!1,(e=this._dialogPresentation)==null||e.withdraw(),this._dialogPresentation=null,this._deleteConfirmationOpen=!1,this.resetTrustedFrame(),this._trustedChannel.disconnect(),this.unsubscribeFromWebview(),this.syncNavigationState(),this.detachApplicationSubscriptions()}handleTrustedFrameMessage(e,r){var i;switch(e.type){case"url-target-request":r.send({type:O4,url:this.currentExternalTargetURL()});return;case"artifact-missing-request":{const s=this.currentMissingArtifactMessage();s&&(this._missingArtifactReplyTransport=r,r.send(s));return}case"proxy-content-changed":this.handleProxyContentChanged();return;case"navigation-request":this.handleNavigationRequest(e);return;case"navigation-key":(i=this._application)==null||i.handleNavigationKey(e.key);return;case"artifact-pointer":this.handleArtifactPointer(e);return;case"bridge-ready":case"leaving":return}}handleArtifactPointer(e){const r=this.currentFrame;if(r===null||r.clientWidth<=0||r.clientHeight<=0)return;const i=r.getBoundingClientRect();F_({eventType:e.eventType,clientX:i.left+e.clientX*i.width/r.clientWidth,clientY:i.top+e.clientY*i.height/r.clientHeight,button:e.button,buttons:e.buttons})}currentExternalTargetURL(){var r,i;const e=((r=this._navigationState)==null?void 0:r.currentURL)??null;return e&&zN(e)?e:((i=this._artifact)==null?void 0:i.kind)==="url"?this._artifact.url:null}currentMissingArtifactMessage(){const e=this._artifact;return(e==null?void 0:e.kind)!=="path"?null:{type:L4,title:e.title,path:e.path}}handleProxyContentChanged(){var e;((e=this._artifact)==null?void 0:e.kind)!=="url"||!Vr(this._artifact.url)||this.reloadProxyFrame()}handleNavigationRequest(e){if(!q2(e.url,window.location.href))return;this.syncNavigationState();const r=this._navigationState;if(!r)return;const i=this.convertIframeNavigationURL(e.url);if(i===LN||i===r.currentURL)return;const s=e.native===!0;(e.sameDocument||s)&&(this._preserveFrameSrcOnNavigationRender=!0),e.replace?r.replace(i):r.navigate(i),this._preserveFrameSrcOnNavigationRender=!1}syncNavigationState(){if(!this._connected||!this._artifact||this.isDemoPage()){this.disposeNavigationState();return}const e=this.canonicalURLForArtifact(this._artifact);this._navigationState&&this._navigationArtifactId===this._artifact.id&&this._navigationCanonicalURL===e||(this.disposeNavigationState(),this._navigationState=new BD(this._artifact.id,e),this._navigationArtifactId=this._artifact.id,this._navigationCanonicalURL=e,this._navigationState.addEventListener("change",this.handleNavigationChange),this._navigationState.currentURL!==null?this.renderArtifact():this._navigationState.canGoForward&&this.renderArtifact({preserveFrameSrc:!0}))}disposeNavigationState(){var e;(e=this._navigationState)==null||e.removeEventListener("change",this.handleNavigationChange),this._navigationState=null,this._navigationArtifactId=null,this._navigationCanonicalURL=null,this._preserveFrameSrcOnNavigationRender=!1}canonicalURLForArtifact(e){const r=md({artifact:e,application:this._application,electron:bi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:null}),i=r.viewURL;return e.kind==="url"&&Vr(e.url)||r.renderer==="url-webview"?Si(i):Ib(i,i)}convertIframeNavigationURL(e){var r;return((r=this._artifact)==null?void 0:r.kind)==="url"&&Vr(this._artifact.url)&&Vr(e)?Si(e):Ib(e,this._viewURL??this._navigationCanonicalURL??null)}handleWebviewNavigationEvent(e){const r=e.url;if(typeof r!="string"||!q2(r,window.location.href))return!1;this.syncNavigationState();const i=this._navigationState;if(!i)return!1;const s=Si(r);return s===i.currentURL?!1:(i.navigate(s),!0)}syncWebviewSubscription(e=this.currentFrame){const r=(e==null?void 0:e.tagName.toLowerCase())==="webview"?e:null;r!==this._subscribedWebview&&(this.unsubscribeFromWebview(),r&&(r.addEventListener("did-navigate",this.handleWebviewDidNavigate),r.addEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=r))}unsubscribeFromWebview(){this._subscribedWebview&&(this._subscribedWebview.removeEventListener("did-navigate",this.handleWebviewDidNavigate),this._subscribedWebview.removeEventListener("did-navigate-in-page",this.handleWebviewDidNavigateInPage),this._subscribedWebview=null)}get currentFrame(){var e;return((e=this._documentHost)==null?void 0:e.currentFrame)??null}syncFrameSubscriptions(){const e=this.currentFrame;this.syncFrameTitle(e),this._trustedChannel.setCurrentFrame(this.bridgeFrame(e)),this.syncWebviewSubscription(e)}bridgeFrame(e){return this.isDemoPage()?null:e}get browserDemo(){var e;return((e=this._application)==null?void 0:e.browserDemoMode)===!0}isDemoPage(){const e=this._artifact;return e?ru(e,{electron:bi(),browserDemo:this.browserDemo}).renderer==="url-direct":!1}returnToOriginalPage(){var i,s,a;const e=this._artifact,r=this.currentFrame;(e==null?void 0:e.kind)!=="url"||(r==null?void 0:r.tagName.toLowerCase())!=="iframe"||((i=this._rootRef.value)==null||i.removeAttribute("data-embed-loaded"),(s=this._documentHost)==null||s.assignFrameSrc(e.url),(a=this._documentHost)==null||a.refreshFrameLoadState())}syncFrameTitle(e){e&&this._artifact&&e.getAttribute("title")!==this._artifact.title&&e.setAttribute("title",this._artifact.title)}resetTrustedFrame(){this._missingArtifactReplyTransport=null,this._trustedChannel.reset()}assignDocumentSource(e={}){var f,p,y;const r=this._artifact;if(!r)return;e.resetTrust&&this.resetTrustedFrame();const i={artifact:r,application:this._application,electron:bi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((f=this._navigationState)==null?void 0:f.currentURL)??null},s=md(i),a=(p=this.currentFrame)==null?void 0:p.getAttribute("src");let l=null;this._activeReloadFrameSrc&&(Y_(this._activeReloadFrameSrc,s.viewURL)?l=this._activeReloadFrameSrc:this._activeReloadFrameSrc=null);const c=e.frameSrcOverride??l??(e.preserveFrameSrc&&a?a:s.viewURL),u={...i,frameSrcOverride:c};this._pendingDocumentSource=u,(y=this._documentHost)==null||y.assignSource(u),this.syncFrameSubscriptions()}reloadProxyFrame(){var a,l,c,u,f;const e=this.currentFrame;if(!e||e.hasAttribute("data-content-url")||e.tagName.toLowerCase()==="webview"&&!(((a=this._artifact)==null?void 0:a.kind)==="path"||((l=this._artifact)==null?void 0:l.kind)==="url"&&Vr(this._artifact.url)))return;const r=((c=this._artifact)==null?void 0:c.kind)==="url"&&Vr(this._artifact.url)?((u=this._navigationState)==null?void 0:u.currentURL)??e.getAttribute("src"):e.getAttribute("src");if(r===null)return;const i=new URL(r,window.location.href);i.searchParams.set(Bl,String(++this._proxyReloadVersion));const s=r.startsWith("/")?`${i.pathname}${i.search}${i.hash}`:i.href;this._activeReloadFrameSrc=s,(f=this._rootRef.value)==null||f.removeAttribute("data-embed-loaded"),this.renderArtifact({frameSrcOverride:s,resetTrust:!0})}forceCurrentFrameSrc(){var s,a,l,c;if(!this._artifact)return;const e=md({artifact:this._artifact,application:this._application,electron:bi(),browserDemo:this.browserDemo,viewURL:this._viewURL,contentURL:this._contentURL,currentURL:((s=this._navigationState)==null?void 0:s.currentURL)??null});if(e.renderer==="url-webview")return;const r=this.currentFrame;(r==null?void 0:r.tagName.toLowerCase())==="iframe"&&r&&(this.resetTrustedFrame(),this._activeReloadFrameSrc=null,(a=this._rootRef.value)==null||a.removeAttribute("data-embed-loaded"),(l=this._documentHost)==null||l.assignFrameSrc(e.viewURL),(c=this._documentHost)==null||c.refreshFrameLoadState())}menuEntries(){return[{label:this._fullScreen?"Exit full-screen":"Make full-screen",action:()=>this.requestFullScreen(!this._fullScreen)},{separator:!0},{label:"Delete",destructive:!0,action:()=>this.showDeleteConfirmation()}]}closeMenu(){var i;const e=this._rootRef.value,r=e==null?void 0:e.querySelector(".artifact-menu-trigger");r&&((i=e==null?void 0:e.ownerDocument.querySelector(`tv-menu[trigger="${r.id}"]`))==null||i.removeAttribute("open"))}requestFullScreen(e){this.closeMenu(),this._onFullScreenChange(e)}showDeleteConfirmation(){var r,i,s;if(this._deleteConfirmationOpen)return;this.closeMenu(),this._deleteConfirmationOpen=!0,this.renderArtifact({preserveFrameSrc:!0});const e=(r=this._rootRef.value)==null?void 0:r.querySelector("dialog");e&&(this._dialogPresentation=np(e,()=>this.dismissDeleteConfirmation()),(s=(i=this._rootRef.value)==null?void 0:i.querySelector(".dialog-actions button"))==null||s.focus())}dismissDeleteConfirmation(){const e=this._dialogPresentation;this._dialogPresentation=null,this._deleteConfirmationOpen=!1,e==null||e.withdraw(),this.isConnected&&this._artifact&&this.renderArtifact({preserveFrameSrc:!0})}confirmDelete(){var i;const e=(i=this._artifact)==null?void 0:i.id,r=this._application;this.dismissDeleteConfirmation(),!(!e||!r)&&r.deleteArtifact(e).catch(()=>{})}artifactIconTemplate(){return this.isDemoPage()?j`
293
- <button
294
- icon
295
- size="sm"
296
- variant="ghost"
297
- class="artifact-return"
298
- @click=${()=>this.returnToOriginalPage()}
299
- aria-label="Return to the original page"
300
- >
301
- <tv-icon name="artifact"></tv-icon>
302
- </button>
303
- `:j`<tv-icon name="artifact"></tv-icon>`}navigationControlsTemplate(){const e=this._navigationState;return!e||!e.canGoBack&&!e.canGoForward?null:j`
304
- <button
305
- icon
306
- size="sm"
307
- variant="ghost"
308
- class="artifact-back"
309
- ?disabled=${!e.canGoBack}
310
- @click=${()=>e.back()}
311
- aria-label="Back"
312
- >
313
- <tv-icon name="back" size="sm"></tv-icon>
314
- </button>
315
- <button
316
- icon
317
- size="sm"
318
- variant="ghost"
319
- class="artifact-forward"
320
- ?disabled=${!e.canGoForward}
321
- @click=${()=>e.forward()}
322
- aria-label="Forward"
323
- >
324
- <tv-icon name="forward" size="sm"></tv-icon>
325
- </button>
326
- <span class="artifact-bar-divider" aria-hidden="true"></span>
327
- `}deleteConfirmationTemplate(){return!this._deleteConfirmationOpen||!this._artifact?null:tp(j`
328
- <div class="dialog-alert" role="alertdialog">
329
- <h2>Delete “${this._artifact.title}”?</h2>
330
- <p>It’s removed from this channel; the file or web page it points to is not deleted.</p>
331
- <div class="dialog-actions">
332
- <button @click=${()=>this.dismissDeleteConfirmation()}>Cancel</button>
333
- <button intent="danger" @click=${()=>this.confirmDelete()}>Delete</button>
334
- </div>
335
- </div>
336
- `)}template(e,r,i){const s=this._artifact;return j`
337
- <div
338
- class="artifact-view artifact-frame"
339
- kind=${s.kind}
340
- ?full-screen=${this._fullScreen}
341
- ?inert=${this._inert}
342
- ._trustedChannel=${this._trustedChannel}
343
- ${yt(this._rootRef)}
344
- >
345
- <div class="artifact-frame-clip">
346
- ${kN(this.captureDocumentHost,this.handleEmbedLoadChange,this.handleDocumentFrameChange)}
347
- <footer class="artifact-title-bar" @dblclick=${this.handleTitleBarDoubleClick}>
348
- ${this.artifactIconTemplate()}
349
- <span class="artifact-title">${s.title}</span>
350
- ${this.navigationControlsTemplate()}
351
- ${g_(this.menuEntries(),{trigger:a=>j`
352
- <button
353
- icon
354
- size="sm"
355
- variant="ghost"
356
- class="artifact-menu-trigger"
357
- id=${a}
358
- aria-label=${`${s.title} menu`}
359
- >
360
- <tv-icon name="expand"></tv-icon>
361
- </button>
362
- `})}
363
- </footer>
364
- </div>
365
- ${this.deleteConfirmationTemplate()}
366
- </div>
367
- `}renderArtifact(e={}){this._artifact&&(this.assignDocumentSource({preserveFrameSrc:e.preserveFrameSrc??!1,frameSrcOverride:e.frameSrcOverride,resetTrust:e.resetTrust}),this.render(),e.forceFrameSrc&&this.forceCurrentFrameSrc(),this.syncFrameSubscriptions())}}const NN=fn(MN);function zN(n){return n.startsWith("http://")||n.startsWith("https://")}function HN(n){var e;const t=globalThis.__televisionNativeBridge;(e=t==null?void 0:t.openApplicationLink)==null||e.call(t,n)}function ZN(n,t){return n.id!==t.id||n.kind!==t.kind?!1:n.kind==="path"&&t.kind==="path"?n.path===t.path:n.kind==="url"&&t.kind==="url"?Y_(n.url,t.url):!0}function UN(n,t){return n.kind==="path"&&t.kind==="path"&&n.id===t.id&&(n.title!==t.title||n.path!==t.path)}function Y_(n,t){try{const e=new URL(n,window.location.href),r=new URL(t,window.location.href);return e.searchParams.delete(Bl),r.searchParams.delete(Bl),e.origin===r.origin&&e.pathname===r.pathname&&e.search===r.search}catch{return!1}}function Ib(n,t){try{const e=new URL(n,window.location.href);if(t){const r=new URL(t,window.location.href);if(e.origin!=="null"&&e.origin===r.origin)return e.searchParams.delete(Bl),`${e.pathname}${e.search}${e.hash}`}}catch{return Si(n)}return Si(n)}function K_(n,t,e,r,i){const s=t.pages.map(a=>({artifactIds:[...a.artifactIds],geometry:{...a.geometry,full_screen:a===e?i:a.geometry.full_screen},size:a===e?{...r}:{...a.size}}));n.updateChannelPages(t.id,s).catch(()=>{})}function e1(n,t,e,r){K_(n,t,e,e.size,r)}function vv(n){return{width:1-vb+vb*n.width/KM,height:1-yb+yb*n.height/XM}}function X_(n){return{width:Math.min(sN,n.width),height:Math.min(oN,n.height)}}function $b(n,t){const e=vv(t),r=X_(t);return{width:Math.min(t.width,Math.max(r.width,n.width*e.width)),height:Math.min(t.height,Math.max(r.height,n.height*e.height))}}function FN(n,t){const e=vv(t);return{width:n.width/e.width,height:n.height/e.height}}const xb=.5,jh=2,qN=120,VN=["left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"];var Do,br,Sl,ii,_l,Oo,us,Lo,hs,ds,si,Mo,No,Sr,Al,oi,_r,Ct,ai,Ar,G,Q_,eA,Zc,tA,Uc,t1,bd,nA,Yu,Ku,Xu,Qu,zo,eh,n1,Mn,r1,Pa,rA,iA,Fc;class BN extends dn{constructor(){super(...arguments);m(this,G);m(this,Do,Jn());m(this,br,Jn());m(this,Sl);m(this,ii);m(this,_l);m(this,Oo);m(this,us);m(this,Lo);m(this,hs,0);m(this,ds,0);m(this,si,null);m(this,Mo,null);m(this,No,null);m(this,Sr,null);m(this,Al,[]);m(this,oi,null);m(this,_r,null);m(this,Ct,null);m(this,ai,new Set);m(this,Ar,!1);m(this,Yu,e=>{const r=o(this,Ct);!r||e.pointerId!==r.pointerId||(r.lastPointer={x:e.clientX,y:e.clientY},r.option=e.altKey,h(this,G,n1).call(this,r))});m(this,Ku,e=>{var r;e.pointerId===((r=o(this,Ct))==null?void 0:r.pointerId)&&h(this,G,Mn).call(this,!0)});m(this,Xu,e=>{var r;e.pointerId===((r=o(this,Ct))==null?void 0:r.pointerId)&&h(this,G,Mn).call(this,!1)});m(this,Qu,e=>{var r;e.pointerId===((r=o(this,Ct))==null?void 0:r.pointerId)&&h(this,G,Mn).call(this,!1)});m(this,zo,e=>{const r=o(this,Ct);if(r){if(e.type==="keydown"&&e.key==="Escape"){e.preventDefault(),h(this,G,Mn).call(this,!1);return}r.option!==e.altKey&&(r.option=e.altKey,h(this,G,n1).call(this,r))}});m(this,eh,()=>{const e=o(this,Ct);!e||Pb(h(this,G,Zc).call(this,e.filmstrip),e.pageBox)||(h(this,G,t1).call(this),h(this,G,Mn).call(this,!1))})}connected(){d(this,Sl,void 0),d(this,ii,void 0),d(this,_l,void 0),d(this,Oo,void 0),d(this,us,void 0),d(this,Lo,void 0)}template(e,r,i,s=!1){var ue;const a=!o(this,Ar)&&s;if(d(this,Ar,s),a){h(this,G,Mn).call(this,!1),h(this,G,Fc).call(this);for(const ae of o(this,ai))ae.cancel();o(this,ai).clear()}const l=(i==null?void 0:i.channelId)===(r==null?void 0:r.id)?i:null,c=WN(r,(l==null?void 0:l.pages)??(r==null?void 0:r.pages)),u=(r==null?void 0:r.selectedPage)??null,f=(r==null?void 0:r.id)??null,p=(u==null?void 0:u.artifactIds[0])??null,y=(u==null?void 0:u.geometry.full_screen)??null,v=o(this,Oo)!==void 0,S=c.map(({key:ae,page:_e})=>`${ae}:${_e.geometry.full_screen}:${_e.size.width}:${_e.size.height}`).sort().join("|"),_=l===null?null:c.map(({key:ae})=>ae).join("|"),I=f!==o(this,Sl),Z=p!==o(this,ii),O=y!==o(this,_l),z=S!==o(this,Oo),P=_!==o(this,us),V=c.map(({key:ae})=>ae).join("|"),F=!I&&o(this,Lo)!==void 0&&V!==o(this,Lo),Q=!o(this,Ar)&&l!==null&&o(this,us)!==void 0&&o(this,us)!==null&&P?h(this,G,rA).call(this):null,K=!o(this,Ar)&&Z&&!I&&o(this,ii)!==void 0&&o(this,ii)!==null&&p!==null;return o(this,Ct)&&(I||Z||O)&&h(this,G,Mn).call(this,!1),d(this,Sl,f),d(this,ii,p),d(this,_l,y),d(this,Oo,S),d(this,us,_),d(this,Lo,V),d(this,Al,c),z&&v&&h(this,G,bd).call(this),I&&((ue=o(this,Sr))==null||ue.disconnect(),d(this,Mo,null),d(this,No,null),d(this,oi,null)),queueMicrotask(()=>h(this,G,Uc).call(this)),I||Z||z||a?queueMicrotask(()=>h(this,G,Q_).call(this,p,K)):(P||F)&&queueMicrotask(()=>{const ae=o(this,br).value;ae&&(h(this,G,Pa).call(this,ae,p,!1),Q&&h(this,G,iA).call(this,Q))}),j`
368
- <section
369
- class="stage"
370
- ${yt(o(this,Do))}
371
- style=${`--handle-band: ${QM}px; --handle-reach: ${eN}px; --handle-thickness: ${tN}px;`}
372
- >
373
- ${r!==null&&c.length===0?j`
374
- <div class="stage-empty">
375
- <tv-icon name="artifact" size="xl"></tv-icon>
376
- <p>No artifacts yet — ask your agent to put something here.</p>
377
- </div>
378
- `:null}
379
- ${zd([f],ae=>ae,()=>j`
380
- <div class="filmstrip" ${yt(o(this,br))}>
381
- <div class="filmstrip-inner">
382
- ${zd(c,({key:ae})=>ae,({page:ae,artifact:_e,key:ot})=>{if(r===null)return null;const se=ot===p;return j`
383
- <div
384
- class="page"
385
- data-page-key=${ot}
386
- ?selected=${se}
387
- ?full-screen=${ae.geometry.full_screen}
388
- style=${h(this,G,tA).call(this,ae)}
389
- @click=${se||_e===null?null:()=>e.selectPage(r.id,_e.id)}
390
- >
391
- ${_e?NN(e,_e,{viewURL:e.getArtifactViewURL(_e),contentURL:e.getArtifactContentURL(_e),fullScreen:ae.geometry.full_screen,inert:!se,onFullScreenChange:Pe=>e1(e,r,ae,Pe)}):null}
392
- ${se?j`
393
- <div class="page-handles" aria-hidden="true">
394
- ${VN.map(Pe=>j`
395
- <span
396
- class="page-handle ${Pe}"
397
- @pointerdown=${ht=>h(this,G,nA).call(this,ht,Pe,e,r,ae,ot)}
398
- ></span>
399
- `)}
400
- </div>
401
- `:null}
402
- </div>
403
- `})}
404
- </div>
405
- </div>
406
- `)}
407
- </section>
408
- `}disconnected(){var e;h(this,G,Mn).call(this,!1),h(this,G,bd).call(this),h(this,G,Fc).call(this),cancelAnimationFrame(o(this,hs)),d(this,hs,0),(e=o(this,Sr))==null||e.disconnect(),d(this,Sr,null),d(this,Mo,null),d(this,No,null),d(this,oi,null),d(this,Al,[]);for(const r of o(this,ai))r.cancel();o(this,ai).clear()}}Do=new WeakMap,br=new WeakMap,Sl=new WeakMap,ii=new WeakMap,_l=new WeakMap,Oo=new WeakMap,us=new WeakMap,Lo=new WeakMap,hs=new WeakMap,ds=new WeakMap,si=new WeakMap,Mo=new WeakMap,No=new WeakMap,Sr=new WeakMap,Al=new WeakMap,oi=new WeakMap,_r=new WeakMap,Ct=new WeakMap,ai=new WeakMap,Ar=new WeakMap,G=new WeakSet,Q_=function(e,r){const i=o(this,br).value;i&&(cancelAnimationFrame(o(this,hs)),d(this,hs,requestAnimationFrame(()=>{d(this,hs,0),h(this,G,Pa).call(this,i,e,r)})))},eA=function(e,r){var i;typeof ResizeObserver>"u"||e===o(this,Mo)&&r===o(this,No)||((i=o(this,Sr))==null||i.disconnect(),d(this,Mo,e),d(this,No,r),d(this,Sr,new ResizeObserver(()=>{const s=h(this,G,Zc).call(this,e);Pb(s,o(this,oi))||(h(this,G,t1).call(this),o(this,Ct)&&h(this,G,Mn).call(this,!1),h(this,G,Uc).call(this,e)),o(this,si)===null&&h(this,G,Pa).call(this,e,o(this,ii)??null,!1)})),o(this,Sr).observe(e),o(this,Sr).observe(r))},Zc=function(e){const r=Number.parseFloat(getComputedStyle(e).getPropertyValue("--page-inset"))||0;return{width:Math.max(0,e.clientWidth-2*r),height:Math.max(0,e.clientHeight-r)}},tA=function(e){if(e.geometry.full_screen||o(this,oi)===null)return"";const r=$b(e.size,o(this,oi));return`width: ${r.width}px; height: ${r.height}px;`},Uc=function(e=o(this,br).value){var s;if(!e)return;const r=h(this,G,Zc).call(this,e);d(this,oi,r);const i=new Map(o(this,Al).map(a=>[a.key,a.page]));for(const a of e.querySelectorAll(".page")){if(a===((s=o(this,Ct))==null?void 0:s.pageElement))continue;const l=i.get(a.dataset.pageKey??"");if(!l)continue;if(l.geometry.full_screen){a.style.width="",a.style.height="";continue}const c=$b(l.size,r);a.style.width=`${c.width}px`,a.style.height=`${c.height}px`}},t1=function(){const e=o(this,Do).value;e&&(e.setAttribute("window-tracking",""),o(this,_r)!==null&&clearTimeout(o(this,_r)),d(this,_r,setTimeout(()=>{d(this,_r,null),e.removeAttribute("window-tracking")},qN)))},bd=function(){var e;o(this,_r)!==null&&(clearTimeout(o(this,_r)),d(this,_r,null)),(e=o(this,Do).value)==null||e.removeAttribute("window-tracking")},nA=function(e,r,i,s,a,l){if(o(this,Ar)||e.button!==0||!e.isPrimary)return;const c=e.currentTarget,u=c.closest(".page"),f=o(this,br).value,p=o(this,Do).value;if(!u||!f||!p)return;h(this,G,Mn).call(this,!1),h(this,G,bd).call(this),e.preventDefault(),e.stopPropagation();const y=u.getBoundingClientRect(),v=h(this,G,Zc).call(this,f),S=vv(v),_=a.geometry.full_screen,I=r.includes("left")||r.includes("right"),Z=r.includes("top")||r.includes("bottom");d(this,Ct,{application:i,channel:s,page:a,pageKey:l,pageElement:u,filmstrip:f,stage:p,handle:c,pointerId:e.pointerId,startPointer:{x:e.clientX,y:e.clientY},lastPointer:{x:e.clientX,y:e.clientY},startRendered:{width:y.width,height:y.height},rendered:{width:y.width,height:y.height},baselineSize:_?{width:v.width/S.width,height:v.height/S.height}:{...a.size},pageBox:v,wasFullScreen:_,horizontal:I,vertical:Z,leftish:r.includes("left"),topish:r.includes("top"),option:e.altKey,armed:!1,leftFullScreen:!1}),p.setAttribute("resizing",""),c.addEventListener("pointermove",o(this,Yu)),c.addEventListener("pointerup",o(this,Ku)),c.addEventListener("pointercancel",o(this,Xu)),c.addEventListener("lostpointercapture",o(this,Qu)),window.addEventListener("keydown",o(this,zo)),window.addEventListener("keyup",o(this,zo)),window.addEventListener("resize",o(this,eh)),c.setPointerCapture(e.pointerId)},Yu=new WeakMap,Ku=new WeakMap,Xu=new WeakMap,Qu=new WeakMap,zo=new WeakMap,eh=new WeakMap,n1=function(e){const r=e.lastPointer.x!==e.startPointer.x||e.lastPointer.y!==e.startPointer.y;if(e.wasFullScreen&&!e.leftFullScreen){if(!r)return;e.leftFullScreen=!0,e.pageElement.removeAttribute("full-screen")}const i=X_(e.pageBox);let s=e.startRendered.width,a=e.startRendered.height;if(e.horizontal){const l=e.leftish?-jh:jh;s=Math.min(e.pageBox.width,Math.max(i.width,e.startRendered.width+(e.lastPointer.x-e.startPointer.x)*l))}if(e.vertical){const l=e.topish?-jh:jh;a=Math.min(e.pageBox.height,Math.max(i.height,e.startRendered.height+(e.lastPointer.y-e.startPointer.y)*l))}e.armed=!e.option&&e.horizontal&&e.vertical&&s>=e.pageBox.width-bb&&a>=e.pageBox.height-bb,e.rendered=e.armed?{...e.pageBox}:{width:s,height:a},e.pageElement.style.width=`${e.rendered.width}px`,e.pageElement.style.height=`${e.rendered.height}px`,h(this,G,r1).call(this,e.stage,e.armed),h(this,G,Pa).call(this,e.filmstrip,e.pageKey,!1)},Mn=function(e){const r=o(this,Ct);if(r){if(d(this,Ct,null),r.handle.removeEventListener("pointermove",o(this,Yu)),r.handle.removeEventListener("pointerup",o(this,Ku)),r.handle.removeEventListener("pointercancel",o(this,Xu)),r.handle.removeEventListener("lostpointercapture",o(this,Qu)),window.removeEventListener("keydown",o(this,zo)),window.removeEventListener("keyup",o(this,zo)),window.removeEventListener("resize",o(this,eh)),r.handle.hasPointerCapture(r.pointerId)&&r.handle.releasePointerCapture(r.pointerId),h(this,G,r1).call(this,r.stage,!1),e&&r.armed)r.wasFullScreen&&r.pageElement.setAttribute("full-screen",""),e1(r.application,r.channel,r.page,!0);else if(e){const i={...r.baselineSize},s=FN(r.rendered,r.pageBox);let a=r.wasFullScreen&&r.leftFullScreen;r.horizontal&&r.rendered.width!==r.startRendered.width&&(i.width=s.width,a=!0),r.vertical&&r.rendered.height!==r.startRendered.height&&(i.height=s.height,a=!0),a?K_(r.application,r.channel,r.page,i,!1):h(this,G,Uc).call(this,r.filmstrip)}else r.pageElement.toggleAttribute("full-screen",r.wasFullScreen),h(this,G,Uc).call(this,r.filmstrip);r.pageElement.getBoundingClientRect(),r.stage.removeAttribute("resizing"),h(this,G,Pa).call(this,r.filmstrip,r.pageKey,!1)}},r1=function(e,r){const i=e.querySelector(":scope > .snap-outline");if(!r){i==null||i.remove();return}if(i)return;const s=document.createElement("div");s.className="snap-outline",s.setAttribute("aria-hidden","true"),e.append(s)},Pa=function(e,r,i){const s=[...e.querySelectorAll(".page")].find(y=>y.dataset.pageKey===r);if(!s){h(this,G,Fc).call(this);return}h(this,G,eA).call(this,e,s);const a=s.getBoundingClientRect(),l=e.getBoundingClientRect(),c=Math.max(0,Math.min(e.scrollLeft+a.left+a.width/2-(l.left+l.width/2),e.scrollWidth-e.clientWidth));if(h(this,G,Fc).call(this),o(this,Ar)||!i||Math.abs(c-e.scrollLeft)<xb||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=c;return}const u=e.scrollLeft,f=e.animate([{},{}],{duration:H_,easing:"ease"});d(this,si,f);const p=()=>{var v;if(f!==o(this,si))return;const y=f.playState==="finished"?1:((v=f.effect)==null?void 0:v.getComputedTiming().progress)??0;e.scrollLeft=u+(c-u)*y,f.playState==="finished"?(e.scrollLeft=c,d(this,si,null),d(this,ds,0)):d(this,ds,requestAnimationFrame(p))};d(this,ds,requestAnimationFrame(p))},rA=function(){const e=o(this,br).value;return e?new Map([...e.querySelectorAll(".page")].map(r=>[r.dataset.pageKey??"",r.getBoundingClientRect().left])):new Map},iA=function(e){if(o(this,Ar))return;const r=o(this,br).value;if(r)for(const i of r.querySelectorAll(".page")){if(i.hasAttribute("selected"))continue;const s=e.get(i.dataset.pageKey??"");if(s===void 0)continue;const a=s-i.getBoundingClientRect().left;if(Math.abs(a)<=xb)continue;const l=i.animate({translate:[`${a}px 0`,"0px 0"]},{duration:Ha,easing:"ease"});o(this,ai).add(l),l.finished.finally(()=>{o(this,ai).delete(l)}).catch(()=>{})}},Fc=function(){var e;cancelAnimationFrame(o(this,ds)),d(this,ds,0),(e=o(this,si))==null||e.cancel(),d(this,si,null)};const jN=fn(BN);function WN(n,t){if(!n||!t)return[];const e=new Map(n.artifacts.map(r=>[r.id,r]));return t.map((r,i)=>{const s=r.artifactIds[0];return{page:r,artifact:s===void 0?null:e.get(s)??null,key:s??`empty-page-${i}`}})}function Pb(n,t){return t!==null&&n.width===t.width&&n.height===t.height}const GN=250,JN=1e3;var fs,ps,Ho,ms,Gt,sA,i1,oA,s1,aA;class YN extends dn{constructor(){super(...arguments);m(this,Gt);m(this,fs,XN());m(this,ps,null);m(this,Ho,!1);m(this,ms,null)}disconnected(){var e;h(this,Gt,s1).call(this),(e=o(this,ps))==null||e.withdraw(),d(this,ps,null),d(this,Ho,!1),Eg(null,o(this,fs))}template(e,r){return h(this,Gt,oA).call(this,e),Eg(tp(h(this,Gt,sA).call(this,e,r),lA(r.dragStrip)),o(this,fs)),h(this,Gt,aA).call(this),o(this,fs)}}fs=new WeakMap,ps=new WeakMap,Ho=new WeakMap,ms=new WeakMap,Gt=new WeakSet,sA=function(e,r){switch(e.kind){case"connecting":return j`
409
- <div class="system-modal" role="status" aria-live="polite">
410
- <tv-icon name="spinner" size="xl" spinning></tv-icon>
411
- <h2>Connecting</h2>
412
- </div>
413
- `;case"disconnected":return j`
414
- <div class="system-modal" role="status" aria-live="polite">
415
- <tv-icon name="spinner" size="xl" spinning></tv-icon>
416
- <h2>Disconnected</h2>
417
- <p>${Db(e.nextRetryAt)}</p>
418
- </div>
419
- `;case"unauthorized":return j`
420
- <div class="system-modal">
421
- <tv-icon name="locked" size="xl"></tv-icon>
422
- <h2>Access token required</h2>
423
- <p>${{browser:"This server requires a valid access token to connect. Ask your agent for the current link, and paste the whole link into the address bar.",desktop:"This server requires a valid access token to connect. Choose Television › Disconnect from Server, then try again.",local:"This server requires a valid access token to connect. Disconnect from Server, then paste the current link from your agent."}[r.context]}</p>
424
- ${h(this,Gt,i1).call(this,r)}
425
- </div>
426
- `;case"error":return j`
427
- <div class="system-modal">
428
- <h2>Can’t connect with server</h2>
429
- <p class="server-url">${e.serverURL}</p>
430
- <p>Check your internet connection and that the server is running. ${Db(e.nextRetryAt)}</p>
431
- ${h(this,Gt,i1).call(this,r)}
432
- </div>
433
- `}},i1=function(e){return e.context==="local"?j`<button intent="danger" class="system-modal-disconnect" @click=${e.onDisconnect}>Disconnect from Server</button>`:null},oA=function(e){const r=(e.kind==="disconnected"||e.kind==="error")&&e.nextRetryAt!==null;r&&o(this,ms)===null?d(this,ms,setInterval(()=>this.render(),GN)):r||h(this,Gt,s1).call(this)},s1=function(){o(this,ms)!==null&&(clearInterval(o(this,ms)),d(this,ms,null))},aA=function(){o(this,ps)!==null||o(this,Ho)||(d(this,Ho,!0),queueMicrotask(()=>{if(d(this,Ho,!1),!this.isConnected||!o(this,fs).isConnected||o(this,ps)!==null)return;const e=o(this,fs).querySelector("dialog");e!==null&&d(this,ps,np(e,()=>{}))}))};const KN=fn(YN);function XN(){const n=document.createElement("section");return n.className="system-modal-host",n}function Db(n){if(n===null)return"Reconnecting now…";const t=n-Date.now();return t<=0?"Reconnecting now…":`Reconnecting in ${Math.ceil(t/JN)}s…`}function lA(n=!1){return n?j`<div class="window-drag-strip" electron-draggable aria-hidden="true"></div>`:null}/**
434
- * @license
435
- * Copyright 2017 Google LLC
436
- * SPDX-License-Identifier: BSD-3-Clause
437
- */class o1 extends kh{constructor(t){if(super(t),this.it=de,t.type!==Ir.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===de||t==null)return this._t=void 0,this.it=t;if(t===xt)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}o1.directiveName="unsafeHTML",o1.resultType=1;const cA=ic(o1);/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */function Ob(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function QN(n){if(Array.isArray(n))return n}function e9(n,t){var e=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(e!=null){var r,i,s,a,l=[],c=!0,u=!1;try{if(s=(e=e.call(n)).next,t!==0)for(;!(c=(r=s.call(e)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function t9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
438
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function n9(n,t){return QN(n)||e9(n,t)||r9(n,t)||t9()}function r9(n,t){if(n){if(typeof n=="string")return Ob(n,t);var e={}.toString.call(n).slice(8,-1);return e==="Object"&&n.constructor&&(e=n.constructor.name),e==="Map"||e==="Set"?Array.from(n):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Ob(n,t):void 0}}const uA=Object.entries,Lb=Object.setPrototypeOf,i9=Object.isFrozen,s9=Object.getPrototypeOf,o9=Object.getOwnPropertyDescriptor;let st=Object.freeze,ut=Object.seal,Da=Object.create,hA=typeof Reflect<"u"&&Reflect,a1=hA.apply,l1=hA.construct;st||(st=function(t){return t});ut||(ut=function(t){return t});a1||(a1=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return t.apply(e,i)});l1||(l1=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return new t(...r)});const Js=Qe(Array.prototype.forEach),a9=Qe(Array.prototype.lastIndexOf),Mb=Qe(Array.prototype.pop),Sc=Qe(Array.prototype.push),l9=Qe(Array.prototype.splice),Fa=Array.isArray,qc=Qe(String.prototype.toLowerCase),zm=Qe(String.prototype.toString),Nb=Qe(String.prototype.match),_c=Qe(String.prototype.replace),zb=Qe(String.prototype.indexOf),c9=Qe(String.prototype.trim),u9=Qe(Number.prototype.toString),h9=Qe(Boolean.prototype.toString),Hb=typeof BigInt>"u"?null:Qe(BigInt.prototype.toString),Zb=typeof Symbol>"u"?null:Qe(Symbol.prototype.toString),Bt=Qe(Object.prototype.hasOwnProperty),Ac=Qe(Object.prototype.toString),mt=Qe(RegExp.prototype.test),Mi=d9(TypeError);function Qe(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return a1(n,t,r)}}function d9(n){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return l1(n,e)}}function ye(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qc;if(Lb&&Lb(n,null),!Fa(t))return n;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const s=e(i);s!==i&&(i9(t)||(t[r]=s),i=s)}n[i]=!0}return n}function f9(n){for(let t=0;t<n.length;t++)Bt(n,t)||(n[t]=null);return n}function Qt(n){const t=Da(null);for(const r of uA(n)){var e=n9(r,2);const i=e[0],s=e[1];Bt(n,i)&&(Fa(s)?t[i]=f9(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=Qt(s):t[i]=s)}return t}function p9(n){switch(typeof n){case"string":return n;case"number":return u9(n);case"boolean":return h9(n);case"bigint":return Hb?Hb(n):"0";case"symbol":return Zb?Zb(n):"Symbol()";case"undefined":return Ac(n);case"function":case"object":{if(n===null)return Ac(n);const t=n,e=vn(t,"toString");if(typeof e=="function"){const r=e(t);return typeof r=="string"?r:Ac(r)}return Ac(n)}default:return Ac(n)}}function vn(n,t){for(;n!==null;){const r=o9(n,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}n=s9(n)}function e(){return null}return e}function m9(n){try{return mt(n,""),!0}catch{return!1}}const Ub=st(["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"]),Hm=st(["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"]),Zm=st(["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"]),g9=st(["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"]),Um=st(["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"]),v9=st(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Fb=st(["#text"]),qb=st(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Fm=st(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Vb=st(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Wh=st(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),y9=ut(/{{[\w\W]*|^[\w\W]*}}/g),w9=ut(/<%[\w\W]*|^[\w\W]*%>/g),b9=ut(/\${[\w\W]*/g),S9=ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),_9=ut(/^aria-[\-\w]+$/),Bb=ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),A9=ut(/^(?:\w+script|data):/i),E9=ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),k9=ut(/^html$/i),T9=ut(/^[a-z][.\w]*(-[.\w]+)+$/i),jb=ut(/<[/\w!]/g),Wb=ut(/<[/\w]/g),C9=ut(/<\/no(script|embed|frames)/i),R9=ut(/\/>/i),Xt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},dA=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],I9=st(ye({},dA)),$9=(function(){const n={};return Js(dA,t=>{n[t]=ut(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),st(n)})(),x9=function(){return typeof window>"u"?null:window},P9=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(r=e.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Gb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ni=function(t,e,r,i){return Bt(t,e)&&Fa(t[e])?ye(i.base?Qt(i.base):{},t[e],i.transform):r},qm=function(t,e,r){const i=Bt(t,e)?t[e]:void 0;return i&&typeof i=="object"?Qt(i):r()};function fA(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x9();const t=N=>fA(N);if(t.version="3.4.16",t.removed=[],!n||!n.document||n.document.nodeType!==Xt.document||!n.Element)return t.isSupported=!1,t;let e=n.document;const r=e,i=r.currentScript;n.DocumentFragment;const s=n.HTMLTemplateElement,a=n.Node,l=n.Element,c=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const u=n.DOMParser,f=n.trustedTypes,p=l.prototype,y=vn(p,"cloneNode"),v=vn(p,"remove"),S=vn(p,"removeAttributeNode"),_=vn(p,"nextSibling"),I=vn(p,"childNodes"),Z=vn(p,"parentNode"),O=vn(p,"shadowRoot"),z=vn(p,"attributes"),P=a&&a.prototype?vn(a.prototype,"nodeType"):null,V=a&&a.prototype?vn(a.prototype,"nodeName"):null,F=a&&a.prototype?vn(a.prototype,"ownerDocument"):null,q=function(w){return P?P(w):w.nodeType},Q=function(w){return V?V(w):w.nodeName};if(typeof s=="function"){const N=e.createElement("template");N.content&&N.content.ownerDocument&&(e=N.content.ownerDocument)}let K,ue="",ae,_e=!1,ot=0;const se=function(){if(ot>0)throw Mi('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Pe=function(w){se(),ot++;try{return K.createHTML(w)}finally{ot--}},ht=function(w){se(),ot++;try{return K.createScriptURL(w)}finally{ot--}},Pn=function(){return _e||(ae=P9(f,i),_e=!0),ae},dt=e,bt=dt.implementation,Ls=dt.createNodeIterator,ua=dt.createDocumentFragment,Ms=dt.getElementsByTagName,Ii=r.importNode;let Te=Gb();t.isSupported=typeof uA=="function"&&typeof Z=="function"&&bt&&bt.createHTMLDocument!==void 0;const oc=y9,Dn=w9,Ns=b9,ac=S9,St=_9,$e=A9,je=E9,Oe=T9;let Ge=Bb,ce=null;const pn=ye({},[...Ub,...Hm,...Zm,...Um,...Fb]);let oe=null;const at=ye({},[...qb,...Fm,...Vb,...Wh]);let He=Object.seal(Da(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),mn=null,On=null;const Je=Object.seal(Da(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Pr=!0,Xn=!0,Dr=!1,Rh=!0,Qn=!1,er=!0,Or=!1,Lr=!1,$i=null,zs=null,lc=!1,xi=!1,Pi=!1,Mr=!1,k=!0,C=!1;const me="user-content-";let Ae=!0,Ce=!1,ne={},_t=null;const tr=ye({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ft=null;const Ln=ye({},["audio","video","img","source","image","track"]);let ha=null;const Nr=ye({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",Hs="http://www.w3.org/2000/svg",Yt="http://www.w3.org/1999/xhtml";let zr=Yt,Hr=!1,Zs=null;const da=ye({},[pt,Hs,Yt],zm),fa=st(["mi","mo","mn","ms","mtext"]);let Us=ye({},fa);const cc=st(["annotation-xml"]);let pa=ye({},cc);const uc=ye({},["title","style","font","a","script"]);let Di=null;const hc=["application/xhtml+xml","text/html"],Ih="text/html";let Ze=null,nr=null;const Oi=e.createElement("form"),Fs=function(w){return w instanceof RegExp||w instanceof Function},dc=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(nr&&nr===w)return;(!w||typeof w!="object")&&(w={}),w=Qt(w),Di=hc.indexOf(w.PARSER_MEDIA_TYPE)===-1?Ih:w.PARSER_MEDIA_TYPE,Ze=Di==="application/xhtml+xml"?zm:qc,ce=Ni(w,"ALLOWED_TAGS",pn,{transform:Ze}),oe=Ni(w,"ALLOWED_ATTR",at,{transform:Ze}),Zs=Ni(w,"ALLOWED_NAMESPACES",da,{transform:zm}),ha=Ni(w,"ADD_URI_SAFE_ATTR",Nr,{transform:Ze,base:Nr}),ft=Ni(w,"ADD_DATA_URI_TAGS",Ln,{transform:Ze,base:Ln}),_t=Ni(w,"FORBID_CONTENTS",tr,{transform:Ze}),mn=Ni(w,"FORBID_TAGS",Qt({}),{transform:Ze}),On=Ni(w,"FORBID_ATTR",Qt({}),{transform:Ze}),ne=Bt(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Qt(w.USE_PROFILES):w.USE_PROFILES:!1,Pr=w.ALLOW_ARIA_ATTR!==!1,Xn=w.ALLOW_DATA_ATTR!==!1,Dr=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Rh=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qn=w.SAFE_FOR_TEMPLATES||!1,er=w.SAFE_FOR_XML!==!1,Or=w.WHOLE_DOCUMENT||!1,xi=w.RETURN_DOM||!1,Pi=w.RETURN_DOM_FRAGMENT||!1,Mr=w.RETURN_TRUSTED_TYPE||!1,lc=w.FORCE_BODY||!1,k=w.SANITIZE_DOM!==!1,C=w.SANITIZE_NAMED_PROPS||!1,Ae=w.KEEP_CONTENT!==!1,Ce=w.IN_PLACE||!1,Ge=m9(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:Bb,zr=typeof w.NAMESPACE=="string"?w.NAMESPACE:Yt,Us=qm(w,"MATHML_TEXT_INTEGRATION_POINTS",()=>ye({},fa)),pa=qm(w,"HTML_INTEGRATION_POINTS",()=>ye({},cc));const A=qm(w,"CUSTOM_ELEMENT_HANDLING",()=>Da(null));if(He=Da(null),Bt(A,"tagNameCheck")&&Fs(A.tagNameCheck)&&(He.tagNameCheck=A.tagNameCheck),Bt(A,"attributeNameCheck")&&Fs(A.attributeNameCheck)&&(He.attributeNameCheck=A.attributeNameCheck),Bt(A,"allowCustomizedBuiltInElements")&&typeof A.allowCustomizedBuiltInElements=="boolean"&&(He.allowCustomizedBuiltInElements=A.allowCustomizedBuiltInElements),ut(He),Qn&&(Xn=!1),Pi&&(xi=!0),ne&&(ce=ye({},Fb),oe=Da(null),ne.html===!0&&(ye(ce,Ub),ye(oe,qb)),ne.svg===!0&&(ye(ce,Hm),ye(oe,Fm),ye(oe,Wh)),ne.svgFilters===!0&&(ye(ce,Zm),ye(oe,Fm),ye(oe,Wh)),ne.mathMl===!0&&(ye(ce,Um),ye(oe,Vb),ye(oe,Wh))),Je.tagCheck=null,Je.attributeCheck=null,Bt(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Je.tagCheck=w.ADD_TAGS:Fa(w.ADD_TAGS)&&(ce===pn&&(ce=Qt(ce)),ye(ce,w.ADD_TAGS,Ze))),Bt(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Je.attributeCheck=w.ADD_ATTR:Fa(w.ADD_ATTR)&&(oe===at&&(oe=Qt(oe)),ye(oe,w.ADD_ATTR,Ze))),Bt(w,"ADD_FORBID_CONTENTS")&&Fa(w.ADD_FORBID_CONTENTS)&&(_t===tr&&(_t=Qt(_t)),ye(_t,w.ADD_FORBID_CONTENTS,Ze)),Ae&&(ce["#text"]=!0),Or&&ye(ce,["html","head","body"]),ce.table&&(ye(ce,["tbody"]),delete mn.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const M=K;K=w.TRUSTED_TYPES_POLICY;try{ue=Pe("")}catch(H){throw K=M,H}}else w.TRUSTED_TYPES_POLICY===null?(K=void 0,ue=""):(K===void 0&&(K=Pn()),K&&typeof ue=="string"&&(ue=Pe("")));st&&st(w),nr=w},fc=ye({},[...Hm,...Zm,...g9]),$v=ye({},[...Um,...v9]),f4=function(w,A,M){return A.namespaceURI===Yt?w==="svg":A.namespaceURI===pt?w==="svg"&&(M==="annotation-xml"||Us[M]):!!fc[w]},p4=function(w,A,M){return A.namespaceURI===Yt?w==="math":A.namespaceURI===Hs?w==="math"&&pa[M]:!!$v[w]},m4=function(w,A,M){return A.namespaceURI===Hs&&!pa[M]||A.namespaceURI===pt&&!Us[M]?!1:!$v[w]&&(uc[w]||!fc[w])},g4=function(w){let A=Z(w);(!A||!A.tagName)&&(A={namespaceURI:zr,tagName:"template"});const M=qc(w.tagName),H=qc(A.tagName);return Zs[w.namespaceURI]?w.namespaceURI===Hs?f4(M,A,H):w.namespaceURI===pt?p4(M,A,H):w.namespaceURI===Yt?m4(M,A,H):!!(Di==="application/xhtml+xml"&&Zs[w.namespaceURI]):!1},Li=function(w){Sc(t.removed,{element:w});try{Z(w).removeChild(w)}catch{if(v(w),!Z(w))throw Mi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},xv=function(w,A,M){try{S(w,A)}catch{try{w.removeAttribute(M)}catch{}}},$h=function(w){xh(w);const A=I(w);if(A){const H=[];Js(A,X=>{Sc(H,X)}),Js(H,X=>{try{v(X)}catch{}})}const M=z(w);if(M)for(let H=M.length-1;H>=0;--H){const X=M[H],he=X&&X.name;typeof he=="string"&&xv(w,X,he)}},qs=function(w,A,M){if(!M)try{M=A.getAttributeNode(w)}catch{M=null}Sc(t.removed,{attribute:M||null,from:A});try{M?S(A,M):A.removeAttribute(w)}catch{try{A.removeAttribute(w)}catch{}}if(w==="is")if(xi||Pi)try{Li(A)}catch{}else try{A.setAttribute(w,"")}catch{}},v4=function(w){const A=z(w);if(A)for(let M=A.length-1;M>=0;--M){const H=A[M],X=H&&H.name;typeof X!="string"||oe[Ze(X)]||xv(w,H,X)}},xh=function(w){const A=[w];for(;A.length>0;){const M=A.pop();q(M)===Xt.element&&v4(M);const H=I(M);if(H)for(let X=H.length-1;X>=0;--X)A.push(H[X])}},Pv=function(w,A){return er?w==="patchsrc"?!0:w==="for"&&A!=="label"&&A!=="output":!1},y4=function(w){if(!er)return;const A=[w];for(;A.length>0;){const M=A.pop(),H=q(M);if(H===Xt.processingInstruction||H===Xt.comment&&mt(Wb,M.data)){try{v(M)}catch{}continue}if(H===Xt.element){const he=M,ge=Ze(Q(M));try{he.hasAttribute&&he.hasAttribute("patchsrc")&&he.removeAttribute("patchsrc"),he.hasAttribute&&he.hasAttribute("for")&&Pv("for",ge)&&he.removeAttribute("for")}catch{}}const X=I(M);if(X)for(let he=X.length-1;he>=0;--he)A.push(X[he])}},Dv=function(w){let A=null,M=null;if(lc)w="<remove></remove>"+w;else{const he=Nb(w,/^[\r\n\t ]+/);M=he&&he[0]}Di==="application/xhtml+xml"&&zr===Yt&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const H=K?Pe(w):w;if(zr===Yt)try{A=new u().parseFromString(H,Di)}catch{}if(!A||!A.documentElement){A=bt.createDocument(zr,"template",null);try{A.documentElement.innerHTML=Hr?ue:H}catch{}}const X=A.body||A.documentElement;return w&&M&&X.insertBefore(e.createTextNode(M),X.childNodes[0]||null),zr===Yt?Ms.call(A,Or?"html":"body")[0]:Or?A.documentElement:X},Ov=function(w){const A=F?F(w):w.ownerDocument;return Ls.call(A||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ph=function(w){return w=_c(w,oc," "),w=_c(w,Dn," "),w=_c(w,Ns," "),w},op=function(w){var A;w.normalize();const M=F?F(w):w.ownerDocument,H=Ls.call(M||w,w,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let X=H.nextNode();for(;X;)X.data=Ph(X.data),X=H.nextNode();const he=(A=w.querySelectorAll)===null||A===void 0?void 0:A.call(w,"template");he&&Js(he,ge=>{ma(ge.content)&&op(ge.content)})},Dh=function(w){const A=V?V(w):null;return typeof A!="string"||Ze(A)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==z(w)||typeof w.removeAttribute!="function"||typeof w.removeAttributeNode!="function"||typeof w.getAttributeNode!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==P(w)||w.childNodes!==I(w)},ma=function(w){if(!P||typeof w!="object"||w===null)return!1;try{return P(w)===Xt.documentFragment}catch{return!1}},pc=function(w){if(!P||typeof w!="object"||w===null)return!1;try{return typeof P(w)=="number"}catch{return!1}};function rr(N,w,A){N.length!==0&&Js(N,M=>{M.call(t,w,A,nr)})}const w4=function(w,A){return!!(er&&w.hasChildNodes()&&!pc(w.firstElementChild)&&mt(jb,w.textContent)&&mt(jb,w.innerHTML)||er&&w.namespaceURI===Yt&&I9[A]&&(pc(w.firstElementChild)||typeof w.textContent=="string"&&mt($9[A],w.textContent))||w.nodeType===Xt.processingInstruction||er&&w.nodeType===Xt.comment&&mt(Wb,w.data))},Oh=function(w,A){if(w instanceof RegExp)return mt(w,A);if(w instanceof Function){for(var M=arguments.length,H=new Array(M>2?M-2:0),X=2;X<M;X++)H[X-2]=arguments[X];return!!w(A,...H)}return!1},b4=function(w,A,M){if(!mn[A]&&zv(A)&&Oh(He.tagNameCheck,A))return!1;if(Ae&&!_t[A]){const H=Z(w),X=I(w);if(X&&H){const he=X.length;for(let ge=he-1;ge>=0;--ge){const Be=w===M?y(X[ge],!0):X[ge];H.insertBefore(Be,_(w))}}}return Li(w),!0},Lv=function(w,A,M,H){return w.length===0?A:A===M||A===H?Qt(A):A},ga=function(w,A){return w===A||Z(w)!==null?!1:(Ce&&xh(w),!0)},Mv=function(w,A){if(rr(Te.beforeSanitizeElements,w,null),ga(w,A))return!0;if(Dh(w))return Li(w),!0;const M=Ze(Q(w));if(ce=Lv(Te.uponSanitizeElement,ce,pn,$i),rr(Te.uponSanitizeElement,w,{tagName:M,allowedTags:ce}),ga(w,A))return!0;if(w4(w,M))return Li(w),!0;if(mn[M]||!(Je.tagCheck instanceof Function&&Je.tagCheck(M))&&!ce[M]){const H=b4(w,M,A);return H===!1&&(rr(Te.afterSanitizeElements,w,null),ga(w,A))?!0:H}if(q(w)===Xt.element&&!g4(w)||(M==="noscript"||M==="noembed"||M==="noframes")&&mt(C9,w.innerHTML))return Li(w),!0;if(Qn&&w.nodeType===Xt.text){const H=Ph(w.textContent);w.textContent!==H&&(Sc(t.removed,{element:w.cloneNode()}),w.textContent=H)}return rr(Te.afterSanitizeElements,w,null),ga(w,A)},Nv=function(w,A,M){if(On[A]||Pv(A,w)||k&&(A==="id"||A==="name")&&(M in e||M in Oi))return!1;const H=oe[A]||Je.attributeCheck instanceof Function&&Je.attributeCheck(A,w);return Xn&&mt(ac,A)||Pr&&mt(St,A)?!0:H?ha[A]||mt(Ge,_c(M,je,""))||(A==="src"||A==="xlink:href"||A==="href")&&w!=="script"&&zb(M,"data:")===0&&ft[w]||Dr&&!mt($e,_c(M,je,""))?!0:!M:zv(w)&&Oh(He.tagNameCheck,w)&&Oh(He.attributeNameCheck,A,w)||A==="is"&&He.allowCustomizedBuiltInElements&&Oh(He.tagNameCheck,M)},S4=ye({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zv=function(w){return!S4[qc(w)]&&mt(Oe,w)},_4=function(w,A,M,H){if(K&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!M)switch(f.getAttributeType(w,A)){case"TrustedHTML":return Pe(H);case"TrustedScriptURL":return ht(H)}return H},A4=function(w,A,M,H){try{return M?w.setAttributeNS(M,A,H):w.setAttribute(A,H),Dh(w)?(Li(w),!1):!0}catch{return qs(A,w),!1}},Hv=function(w,A){if(rr(Te.beforeSanitizeAttributes,w,null),ga(w,A))return;const M=w.attributes;if(!M||Dh(w))return;oe=Lv(Te.uponSanitizeAttribute,oe,at,zs);const H={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let X=M.length;const he=Ze(w.nodeName);for(;X--;){const ge=M[X],Be=ge.name,gn=ge.namespaceURI,Kt=ge.value,va=Ze(Be),lp=Kt;let At=Be==="value"?lp:c9(lp),Zv=!1;if(H.attrName=va,H.attrValue=At,H.keepAttr=!0,H.forceKeepAttr=void 0,rr(Te.uponSanitizeAttribute,w,H),At=H.attrValue,C&&(va==="id"||va==="name")&&zb(At,me)!==0&&(qs(Be,w,ge),At=me+At,Zv=!0),er&&mt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){qs(Be,w,ge);continue}if(va==="attributename"&&Nb(At,"href")){qs(Be,w,ge);continue}if(!H.forceKeepAttr){if(!H.keepAttr){qs(Be,w,ge);continue}if(!Rh&&mt(R9,At)){qs(Be,w,ge);continue}if(Qn&&(At=Ph(At)),!Nv(he,va,At)){qs(Be,w,ge);continue}At=_4(he,va,gn,At),At!==lp&&A4(w,Be,gn,At)&&Zv&&Mb(t.removed)}}rr(Te.afterSanitizeAttributes,w,null),ga(w,A)},Lh=function(w){let A=null;const M=Ov(w);for(rr(Te.beforeSanitizeShadowDOM,w,null);A=M.nextNode();)if(rr(Te.uponSanitizeShadowNode,A,null),Mv(A,w),Hv(A,w),ma(A.content)&&Lh(A.content),q(A)===Xt.element){const H=O(A);ma(H)&&(ap(H),Lh(H))}rr(Te.afterSanitizeShadowDOM,w,null)},ap=function(w){const A=[{node:w,shadow:null}];for(;A.length>0;){const M=A.pop();if(M.shadow){Lh(M.shadow);continue}const H=M.node,X=q(H)===Xt.element,he=I(H);if(he)for(let ge=he.length-1;ge>=0;--ge)A.push({node:he[ge],shadow:null});if(X){const ge=V?V(H):null;if(typeof ge=="string"&&Ze(ge)==="template"){const Be=H.content;ma(Be)&&A.push({node:Be,shadow:null})}}if(X){const ge=O(H);ma(ge)&&A.push({node:null,shadow:ge},{node:ge,shadow:null})}}};return t.sanitize=function(N){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,M=null,H=null,X=null;if(Hr=!N,Hr&&(N="<!-->"),typeof N!="string"&&!pc(N)&&(N=p9(N),typeof N!="string"))throw Mi("dirty is not a string, aborting");if(!t.isSupported)return N;Lr?(ce=$i,oe=zs):dc(w),(Te.uponSanitizeElement.length>0||Te.uponSanitizeAttribute.length>0)&&(ce=Qt(ce)),Te.uponSanitizeAttribute.length>0&&(oe=Qt(oe)),t.removed=[];const he=Ce&&typeof N!="string"&&pc(N);if(he){y4(N);const gn=Q(N);if(typeof gn=="string"){const Kt=Ze(gn);if(!ce[Kt]||mn[Kt])throw $h(N),Mi("root node is forbidden and cannot be sanitized in-place")}if(Dh(N))throw $h(N),Mi("root node is clobbered and cannot be sanitized in-place");try{ap(N)}catch(Kt){throw $h(N),Kt}}else if(pc(N))A=Dv("<!---->"),M=A.ownerDocument.importNode(N,!0),M.nodeType===Xt.element&&M.nodeName==="BODY"||M.nodeName==="HTML"?A=M:A.appendChild(M),ap(A);else{if(!xi&&!Qn&&!Or&&N.indexOf("<")===-1)return K&&Mr?Pe(N):N;if(A=Dv(N),!A)return xi?null:Mr?ue:""}A&&lc&&Li(A.firstChild);const ge=he?N:A;try{const gn=Ov(ge);for(;H=gn.nextNode();)Mv(H,ge),Hv(H,ge),ma(H.content)&&Lh(H.content)}catch(gn){throw he&&($h(N),Js(t.removed,Kt=>{Kt.element&&xh(Kt.element)})),gn}if(he){let gn=!1;if(Js(t.removed,Kt=>{Kt.element&&(Kt.element===N&&(gn=!0),xh(Kt.element))}),gn)throw Mi("a node selected for removal could not be safely returned; refusing to sanitize in place");return Qn&&op(N),N}if(xi){if(Qn&&op(A),Pi)for(X=ua.call(A.ownerDocument);A.firstChild;)X.appendChild(A.firstChild);else X=A;return(oe.shadowroot||oe.shadowrootmode)&&(X=Ii.call(r,X,!0)),X}let Be=Or?A.outerHTML:A.innerHTML;return Or&&ce["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&mt(k9,A.ownerDocument.doctype.name)&&(Be="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
439
- `+Be),Qn&&(Be=Ph(Be)),K&&Mr?Pe(Be):Be},t.setConfig=function(){let N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dc(N),Lr=!0,$i=ce,zs=oe},t.clearConfig=function(){nr=null,Lr=!1,$i=null,zs=null,K=ae,ue=""},t.isValidAttribute=function(N,w,A){nr||dc({});const M=Ze(N),H=Ze(w);return Nv(M,H,A)},t.addHook=function(N,w){typeof w=="function"&&Bt(Te,N)&&Sc(Te[N],w)},t.removeHook=function(N,w){if(Bt(Te,N)){if(w!==void 0){const A=a9(Te[N],w);return A===-1?void 0:l9(Te[N],A,1)[0]}return Mb(Te[N])}},t.removeHooks=function(N){Bt(Te,N)&&(Te[N]=[])},t.removeAllHooks=function(){Te=Gb()},t}var pA=fA();function yv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ca=yv();function mA(n){ca=n}var eo={exec:()=>null};function ve(n,t=""){let e=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(Pt.caret,"$1"),e=e.replace(i,a),r},getRegex:()=>new RegExp(e,t)};return r}var D9=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Pt={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)}}>`)},O9=/^(?:[ \t]*(?:\n|$))+/,L9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,M9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ch=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,N9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,gA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vA=ve(gA).replace(/bull/g,wv).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(),z9=ve(gA).replace(/bull/g,wv).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(),bv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,H9=/^[^\n]+/,Sv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Z9=ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),U9=ve(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,wv).getRegex(),rp="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",_v=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,F9=ve("^ {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",_v).replace("tag",rp).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yA=ve(bv).replace("hr",Ch).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",rp).getRegex(),q9=ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",yA).getRegex(),Av={blockquote:q9,code:L9,def:Z9,fences:M9,heading:N9,hr:Ch,html:F9,lheading:vA,list:U9,newline:O9,paragraph:yA,table:eo,text:H9},Jb=ve("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ch).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",rp).getRegex(),V9={...Av,lheading:z9,table:Jb,paragraph:ve(bv).replace("hr",Ch).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jb).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",rp).getRegex()},B9={...Av,html:ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_v).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:eo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ve(bv).replace("hr",Ch).replace("heading",` *#{1,6} *[^
440
- ]`).replace("lheading",vA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},j9=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,W9=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,wA=/^( {2,}|\\)\n(?!\s*$)/,G9=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,sc=/[\p{P}\p{S}]/u,ip=/[\s\p{P}\p{S}]/u,Ev=/[^\s\p{P}\p{S}]/u,J9=ve(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ip).getRegex(),bA=/(?!~)[\p{P}\p{S}]/u,Y9=/(?!~)[\s\p{P}\p{S}]/u,K9=/(?:[^\s\p{P}\p{S}]|~)/u,X9=ve(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",D9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),SA=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Q9=ve(SA,"u").replace(/punct/g,sc).getRegex(),ez=ve(SA,"u").replace(/punct/g,bA).getRegex(),_A="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",tz=ve(_A,"gu").replace(/notPunctSpace/g,Ev).replace(/punctSpace/g,ip).replace(/punct/g,sc).getRegex(),nz=ve(_A,"gu").replace(/notPunctSpace/g,K9).replace(/punctSpace/g,Y9).replace(/punct/g,bA).getRegex(),rz=ve("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ev).replace(/punctSpace/g,ip).replace(/punct/g,sc).getRegex(),iz=ve(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,sc).getRegex(),sz="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",oz=ve(sz,"gu").replace(/notPunctSpace/g,Ev).replace(/punctSpace/g,ip).replace(/punct/g,sc).getRegex(),az=ve(/\\(punct)/,"gu").replace(/punct/g,sc).getRegex(),lz=ve(/^<(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(),cz=ve(_v).replace("(?:-->|$)","-->").getRegex(),uz=ve("^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",cz).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hz=ve(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",qd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),AA=ve(/^!?\[(label)\]\[(ref)\]/).replace("label",qd).replace("ref",Sv).getRegex(),EA=ve(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sv).getRegex(),dz=ve("reflink|nolink(?!\\()","g").replace("reflink",AA).replace("nolink",EA).getRegex(),Yb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,kv={_backpedal:eo,anyPunctuation:az,autolink:lz,blockSkip:X9,br:wA,code:W9,del:eo,delLDelim:eo,delRDelim:eo,emStrongLDelim:Q9,emStrongRDelimAst:tz,emStrongRDelimUnd:rz,escape:j9,link:hz,nolink:EA,punctuation:J9,reflink:AA,reflinkSearch:dz,tag:uz,text:G9,url:eo},fz={...kv,link:ve(/^!?\[(label)\]\((.*?)\)/).replace("label",qd).getRegex(),reflink:ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qd).getRegex()},c1={...kv,emStrongRDelimAst:nz,emStrongLDelim:ez,delLDelim:iz,delRDelim:oz,url:ve(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Yb).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:ve(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Yb).getRegex()},pz={...c1,br:ve(wA).replace("{2,}","*").getRegex(),text:ve(c1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Gh={normal:Av,gfm:V9,pedantic:B9},Ec={normal:kv,gfm:c1,breaks:pz,pedantic:fz},mz={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Kb=n=>mz[n];function sr(n,t){if(t){if(Pt.escapeTest.test(n))return n.replace(Pt.escapeReplace,Kb)}else if(Pt.escapeTestNoEncode.test(n))return n.replace(Pt.escapeReplaceNoEncode,Kb);return n}function Xb(n){try{n=encodeURI(n).replace(Pt.percentDecode,"%")}catch{return null}return n}function Qb(n,t){var s;let e=n.replace(Pt.findPipe,(a,l,c)=>{let u=!1,f=l;for(;--f>=0&&c[f]==="\\";)u=!u;return u?"|":" |"}),r=e.split(Pt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Pt.slashPipe,"|");return r}function kc(n,t,e){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===t;)i++;return n.slice(0,r-i)}function gz(n,t){if(n.indexOf(t[1])===-1)return-1;let e=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===t[0])e++;else if(n[r]===t[1]&&(e--,e<0))return r;return e>0?-2:-1}function vz(n,t=0){let e=t,r="";for(let i of n)if(i===" "){let s=4-e%4;r+=" ".repeat(s),e+=s}else r+=i,e++;return r}function e8(n,t,e,r,i){let s=t.href,a=t.title||null,l=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:n[0].charAt(0)==="!"?"image":"link",raw:e,href:s,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function yz(n,t,e){let r=n.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
441
- `).map(s=>{let a=s.match(e.other.beginningSpace);if(a===null)return s;let[l]=a;return l.length>=i.length?s.slice(i.length):s}).join(`
442
- `)}var Vd=class{constructor(n){R(this,"options");R(this,"rules");R(this,"lexer");this.options=n||ca}space(n){let t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){let t=this.rules.block.code.exec(n);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:kc(e,`
443
- `)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let e=t[0],r=yz(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(n){let t=this.rules.block.heading.exec(n);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let r=kc(e,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(e=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(n){let t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:kc(t[0],`
444
- `)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let e=kc(t[0],`
445
- `).split(`
446
- `),r="",i="",s=[];for(;e.length>0;){let a=!1,l=[],c;for(c=0;c<e.length;c++)if(this.rules.other.blockquoteStart.test(e[c]))l.push(e[c]),a=!0;else if(!a)l.push(e[c]);else break;e=e.slice(c);let u=l.join(`
447
- `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
448
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
449
- ${u}`:u,i=i?`${i}
450
- ${f}`:f;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=p,e.length===0)break;let y=s.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){let v=y,S=v.raw+`
451
- `+e.join(`
452
- `),_=this.blockquote(S);s[s.length-1]=_,r=r.substring(0,r.length-v.raw.length)+_.raw,i=i.substring(0,i.length-v.text.length)+_.text;break}else if((y==null?void 0:y.type)==="list"){let v=y,S=v.raw+`
453
- `+e.join(`
454
- `),_=this.list(S);s[s.length-1]=_,r=r.substring(0,r.length-y.raw.length)+_.raw,i=i.substring(0,i.length-v.raw.length)+_.raw,e=S.substring(s.at(-1).raw.length).split(`
455
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var e,r;let t=this.rules.block.list.exec(n);if(t){let i=t[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let l=this.rules.other.listItemRegex(i),c=!1;for(;n;){let f=!1,p="",y="";if(!(t=l.exec(n))||this.rules.block.hr.test(n))break;p=t[0],n=n.substring(p.length);let v=vz(t[2].split(`
456
- `,1)[0],t[1].length),S=n.split(`
457
- `,1)[0],_=!v.trim(),I=0;if(this.options.pedantic?(I=2,y=v.trimStart()):_?I=t[1].length+1:(I=v.search(this.rules.other.nonSpaceChar),I=I>4?1:I,y=v.slice(I),I+=t[1].length),_&&this.rules.other.blankLine.test(S)&&(p+=S+`
458
- `,n=n.substring(S.length+1),f=!0),!f){let Z=this.rules.other.nextBulletRegex(I),O=this.rules.other.hrRegex(I),z=this.rules.other.fencesBeginRegex(I),P=this.rules.other.headingBeginRegex(I),V=this.rules.other.htmlBeginRegex(I),F=this.rules.other.blockquoteBeginRegex(I);for(;n;){let q=n.split(`
459
- `,1)[0],Q;if(S=q,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),Q=S):Q=S.replace(this.rules.other.tabCharGlobal," "),z.test(S)||P.test(S)||V.test(S)||F.test(S)||Z.test(S)||O.test(S))break;if(Q.search(this.rules.other.nonSpaceChar)>=I||!S.trim())y+=`
460
- `+Q.slice(I);else{if(_||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(v)||P.test(v)||O.test(v))break;y+=`
461
- `+S}_=!S.trim(),p+=q+`
462
- `,n=n.substring(q.length+1),v=Q.slice(I)}}a.loose||(c?a.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!0)),a.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(y),loose:!1,text:y,tokens:[]}),a.raw+=p}let u=a.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let f of a.items){if(this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]),f.task){if(f.text=f.text.replace(this.rules.other.listReplaceTask,""),((e=f.tokens[0])==null?void 0:e.type)==="text"||((r=f.tokens[0])==null?void 0:r.type)==="paragraph"){f.tokens[0].raw=f.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),f.tokens[0].text=f.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let y=this.lexer.inlineQueue.length-1;y>=0;y--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)){this.lexer.inlineQueue[y].src=this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let y={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=y.checked,a.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=y.raw+f.tokens[0].raw,f.tokens[0].text=y.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(y)):f.tokens.unshift({type:"paragraph",raw:y.raw,text:y.raw,tokens:[y]}):f.tokens.unshift(y)}}if(!a.loose){let p=f.tokens.filter(v=>v.type==="space"),y=p.length>0&&p.some(v=>this.rules.other.anyLine.test(v.raw));a.loose=y}}if(a.loose)for(let f of a.items){f.loose=!0;for(let p of f.tokens)p.type==="text"&&(p.type="paragraph")}return a}}html(n){let t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){let t=this.rules.block.def.exec(n);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:i}}}table(n){var a;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=Qb(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
463
- `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<e.length;l++)s.header.push({text:e[l],tokens:this.lexer.inline(e[l]),header:!0,align:s.align[l]});for(let l of i)s.rows.push(Qb(l,s.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[u]})));return s}}lheading(n){let t=this.rules.block.lheading.exec(n);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(n){let t=this.rules.block.paragraph.exec(n);if(t){let e=t[1].charAt(t[1].length-1)===`
464
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(n){let t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){let t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(n){let t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){let t=this.rules.inline.link.exec(n);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let s=kc(e.slice(0,-1),"\\");if((e.length-s.length)%2===0)return}else{let s=gz(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r=r.slice(1):r=r.slice(1,-1)),e8(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(n,t){let e;if((e=this.rules.inline.reflink.exec(n))||(e=this.rules.inline.nolink.exec(n))){let r=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=e[0].charAt(0);return{type:"text",raw:s,text:s}}return e8(e,i,e[0],this.lexer,this.rules)}}emStrong(n,t,e=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,a,l=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*n.length+i);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let f=[...r[0]][0].length,p=n.slice(0,i+r.index+f+a);if(Math.min(i,a)%2){let v=p.slice(1,-1);return{type:"em",raw:p,text:v,tokens:this.lexer.inlineTokens(v)}}let y=p.slice(2,-2);return{type:"strong",raw:p,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,e=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,s,a,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*n.length+i);(r=c.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(a=[...s].length,a!==i))continue;if(r[3]||r[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let u=[...r[0]][0].length,f=n.slice(0,i+r.index+u+a),p=f.slice(i,-i);return{type:"del",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let t=this.rules.inline.autolink.exec(n);if(t){let e,r;return t[2]==="@"?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(n){var e;let t;if(t=this.rules.inline.url.exec(n)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let s;do s=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let t=this.rules.inline.text.exec(n);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},Wn=class u1{constructor(t){R(this,"tokens");R(this,"options");R(this,"state");R(this,"inlineQueue");R(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ca,this.options.tokenizer=this.options.tokenizer||new Vd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={other:Pt,block:Gh.normal,inline:Ec.normal};this.options.pedantic?(e.block=Gh.pedantic,e.inline=Ec.pedantic):this.options.gfm&&(e.block=Gh.gfm,this.options.breaks?e.inline=Ec.breaks:e.inline=Ec.gfm),this.tokenizer.rules=e}static get rules(){return{block:Gh,inline:Ec}}static lex(t,e){return new u1(e).lex(t)}static lexInline(t,e){return new u1(e).inlineTokens(t)}lex(t){t=t.replace(Pt.carriageReturn,`
465
- `),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let r=this.inlineQueue[e];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],r=!1){var i,s,a;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Pt.tabCharGlobal," ").replace(Pt.spaceLine,""));t;){let l;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(l=u.call({lexer:this},t,e))?(t=t.substring(l.raw.length),e.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let u=e.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
466
- `:e.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
467
- `)?"":`
468
- `)+l.raw,u.text+=`
469
- `+l.text,this.inlineQueue.at(-1).src=u.text):e.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
470
- `)?"":`
471
- `)+l.raw,u.text+=`
472
- `+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},e.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),e.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),e.push(l);continue}let c=t;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,f=t.slice(1),p;this.options.extensions.startBlock.forEach(y=>{p=y.call({lexer:this},f),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(c=t.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){let u=e.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
473
- `)?"":`
474
- `)+l.raw,u.text+=`
475
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(l),r=c.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let u=e.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
476
- `)?"":`
477
- `)+l.raw,u.text+=`
478
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):e.push(l);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){var c,u,f,p,y;this.tokenizer.lexer=this;let r=t,i=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)v.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let a=!1,l="";for(;t;){a||(l=""),a=!1;let v;if((p=(f=this.options.extensions)==null?void 0:f.inline)!=null&&p.some(_=>(v=_.call({lexer:this},t,e))?(t=t.substring(v.raw.length),e.push(v),!0):!1))continue;if(v=this.tokenizer.escape(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.tag(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.link(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(v.raw.length);let _=e.at(-1);v.type==="text"&&(_==null?void 0:_.type)==="text"?(_.raw+=v.raw,_.text+=v.text):e.push(v);continue}if(v=this.tokenizer.emStrong(t,r,l)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.codespan(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.br(t)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.del(t,r,l)){t=t.substring(v.raw.length),e.push(v);continue}if(v=this.tokenizer.autolink(t)){t=t.substring(v.raw.length),e.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(t))){t=t.substring(v.raw.length),e.push(v);continue}let S=t;if((y=this.options.extensions)!=null&&y.startInline){let _=1/0,I=t.slice(1),Z;this.options.extensions.startInline.forEach(O=>{Z=O.call({lexer:this},I),typeof Z=="number"&&Z>=0&&(_=Math.min(_,Z))}),_<1/0&&_>=0&&(S=t.substring(0,_+1))}if(v=this.tokenizer.inlineText(S)){t=t.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(l=v.raw.slice(-1)),a=!0;let _=e.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=v.raw,_.text+=v.text):e.push(v);continue}if(t){let _="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return e}},Bd=class{constructor(n){R(this,"options");R(this,"parser");this.options=n||ca}space(n){return""}code({text:n,lang:t,escaped:e}){var s;let r=(s=(t||"").match(Pt.notSpaceStart))==null?void 0:s[0],i=n.replace(Pt.endingNewline,"")+`
479
- `;return r?'<pre><code class="language-'+sr(r)+'">'+(e?i:sr(i,!0))+`</code></pre>
480
- `:"<pre><code>"+(e?i:sr(i,!0))+`</code></pre>
481
- `}blockquote({tokens:n}){return`<blockquote>
482
- ${this.parser.parse(n)}</blockquote>
483
- `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:t}){return`<h${t}>${this.parser.parseInline(n)}</h${t}>
484
- `}hr(n){return`<hr>
485
- `}list(n){let t=n.ordered,e=n.start,r="";for(let a=0;a<n.items.length;a++){let l=n.items[a];r+=this.listitem(l)}let i=t?"ol":"ul",s=t&&e!==1?' start="'+e+'"':"";return"<"+i+s+`>
486
- `+r+"</"+i+`>
487
- `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
488
- `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
489
- `}table(n){let t="",e="";for(let i=0;i<n.header.length;i++)e+=this.tablecell(n.header[i]);t+=this.tablerow({text:e});let r="";for(let i=0;i<n.rows.length;i++){let s=n.rows[i];e="";for(let a=0;a<s.length;a++)e+=this.tablecell(s[a]);r+=this.tablerow({text:e})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
490
- <thead>
491
- `+t+`</thead>
492
- `+r+`</table>
493
- `}tablerow({text:n}){return`<tr>
494
- ${n}</tr>
495
- `}tablecell(n){let t=this.parser.parseInline(n.tokens),e=n.header?"th":"td";return(n.align?`<${e} align="${n.align}">`:`<${e}>`)+t+`</${e}>
496
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${sr(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:t,tokens:e}){let r=this.parser.parseInline(e),i=Xb(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return t&&(s+=' title="'+sr(t)+'"'),s+=">"+r+"</a>",s}image({href:n,title:t,text:e,tokens:r}){r&&(e=this.parser.parseInline(r,this.parser.textRenderer));let i=Xb(n);if(i===null)return sr(e);n=i;let s=`<img src="${n}" alt="${sr(e)}"`;return t&&(s+=` title="${sr(t)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:sr(n.text)}},Tv=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Gn=class h1{constructor(t){R(this,"options");R(this,"renderer");R(this,"textRenderer");this.options=t||ca,this.options.renderer=this.options.renderer||new Bd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Tv}static parse(t,e){return new h1(e).parse(t)}static parseInline(t,e){return new h1(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let s=0;s<t.length;s++){let a=t[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[a.type]){let c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){e+=u||"";continue}}let l=a;switch(l.type){case"space":{e+=this.renderer.space(l);break}case"hr":{e+=this.renderer.hr(l);break}case"heading":{e+=this.renderer.heading(l);break}case"code":{e+=this.renderer.code(l);break}case"table":{e+=this.renderer.table(l);break}case"blockquote":{e+=this.renderer.blockquote(l);break}case"list":{e+=this.renderer.list(l);break}case"checkbox":{e+=this.renderer.checkbox(l);break}case"html":{e+=this.renderer.html(l);break}case"def":{e+=this.renderer.def(l);break}case"paragraph":{e+=this.renderer.paragraph(l);break}case"text":{e+=this.renderer.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return e}parseInline(t,e=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let l=t[a];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[l.type]){let u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=u||"";continue}}let c=l;switch(c.type){case"escape":{r+=e.text(c);break}case"html":{r+=e.html(c);break}case"link":{r+=e.link(c);break}case"image":{r+=e.image(c);break}case"checkbox":{r+=e.checkbox(c);break}case"strong":{r+=e.strong(c);break}case"em":{r+=e.em(c);break}case"codespan":{r+=e.codespan(c);break}case"br":{r+=e.br(c);break}case"del":{r+=e.del(c);break}case"text":{r+=e.text(c);break}default:{let u='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Xh,Vc=(Xh=class{constructor(n){R(this,"options");R(this,"block");this.options=n||ca}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Wn.lex:Wn.lexInline}provideParser(){return this.block?Gn.parse:Gn.parseInline}},R(Xh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),R(Xh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Xh),wz=class{constructor(...n){R(this,"defaults",yv());R(this,"options",this.setOptions);R(this,"parse",this.parseMarkdown(!0));R(this,"parseInline",this.parseMarkdown(!1));R(this,"Parser",Gn);R(this,"Renderer",Bd);R(this,"TextRenderer",Tv);R(this,"Lexer",Wn);R(this,"Tokenizer",Vd);R(this,"Hooks",Vc);this.use(...n)}walkTokens(n,t){var r,i;let e=[];for(let s of n)switch(e=e.concat(t.call(this,s)),s.type){case"table":{let a=s;for(let l of a.header)e=e.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)e=e.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=s;e=e.concat(this.walkTokens(a.items,t));break}default:{let a=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);e=e.concat(this.walkTokens(c,t))}):a.tokens&&(e=e.concat(this.walkTokens(a.tokens,t)))}}return e}use(...n){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),e.renderer){let i=this.defaults.renderer||new Bd(this.defaults);for(let s in e.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,l=e.renderer[a],c=i[a];i[a]=(...u)=>{let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new Vd(this.defaults);for(let s in e.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,l=e.tokenizer[a],c=i[a];i[a]=(...u)=>{let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Vc;for(let s in e.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,l=e.hooks[a],c=i[a];Vc.passThroughHooks.has(s)?i[a]=u=>{if(this.defaults.async&&Vc.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await l.call(i,u);return c.call(i,p)})();let f=l.call(i,u);return c.call(i,f)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(i,u);return p===!1&&(p=await c.apply(i,u)),p})();let f=l.apply(i,u);return f===!1&&(f=c.apply(i,u)),f}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,s=e.walkTokens;r.walkTokens=function(a){let l=[];return l.push(s.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return Wn.lex(n,t??this.defaults)}parser(n,t){return Gn.parse(n,t??this.defaults)}parseMarkdown(n){return(t,e)=>{let r={...e},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():n?Wn.lex:Wn.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?Gn.parse:Gn.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer():n?Wn.lex:Wn.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():n?Gn.parse:Gn.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return s(a)}}}onError(n,t){return e=>{if(e.message+=`
497
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+sr(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},sa=new wz;function Re(n,t){return sa.parse(n,t)}Re.options=Re.setOptions=function(n){return sa.setOptions(n),Re.defaults=sa.defaults,mA(Re.defaults),Re};Re.getDefaults=yv;Re.defaults=ca;Re.use=function(...n){return sa.use(...n),Re.defaults=sa.defaults,mA(Re.defaults),Re};Re.walkTokens=function(n,t){return sa.walkTokens(n,t)};Re.parseInline=sa.parseInline;Re.Parser=Gn;Re.parser=Gn.parse;Re.Renderer=Bd;Re.TextRenderer=Tv;Re.Lexer=Wn;Re.lexer=Wn.lex;Re.Tokenizer=Vd;Re.Hooks=Vc;Re.parse=Re;Re.options;Re.setOptions;Re.use;Re.walkTokens;Re.parseInline;Gn.parse;Wn.lex;pA.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function kA(n){const t=Re.parse(n,{async:!1});return pA.sanitize(t,{USE_PROFILES:{html:!0}})}const t8={restart_to_update:"Restart to update",restarting:"Restarting…"};var Zo,th,Vn,cf,TA,El,uf;class bz extends dn{constructor(){super(...arguments);m(this,cf);m(this,Zo,null);m(this,th,Jn());m(this,Vn,null);m(this,El,()=>{this.render()});m(this,uf,()=>{var e;(e=o(this,Vn))==null||e.restart()})}connected(){queueMicrotask(()=>{var r;if(!this.isConnected||o(this,Zo)!==null)return;const e=((r=o(this,th).value)==null?void 0:r.querySelector("dialog"))??null;if(e===null)throw new Error("Desktop upgrade gate requires its composed dialog");d(this,Zo,np(e,()=>{}))})}disconnected(){var e,r;(e=o(this,Zo))==null||e.withdraw(),d(this,Zo,null),(r=o(this,Vn))==null||r.removeEventListener("change",o(this,El)),d(this,Vn,null)}template(e,r,i){var l,c;h(this,cf,TA).call(this,r??null);const s=((l=o(this,Vn))==null?void 0:l.version)??null,a=((c=o(this,Vn))==null?void 0:c.restarting)??!1;return j`
498
- <div class="desktop-upgrade-gate" ${yt(o(this,th))}>
499
- ${tp(j`<div class="upgrade-gate-body" data-testid="upgrade-gate-body">${cA(kA(ZS(e,s!==null)))}</div>${s===null?de:j`<div class="upgrade-gate-actions"><button
500
- intent="primary"
501
- class="upgrade-gate-restart"
502
- ?disabled=${a}
503
- @click=${o(this,uf)}
504
- >${a?t8.restarting:t8.restart_to_update}</button></div>`}`,i)}
505
- </div>
506
- `}}Zo=new WeakMap,th=new WeakMap,Vn=new WeakMap,cf=new WeakSet,TA=function(e){var r;e!==o(this,Vn)&&((r=o(this,Vn))==null||r.removeEventListener("change",o(this,El)),d(this,Vn,e),e==null||e.addEventListener("change",o(this,El)),e==null||e.subscribe())},El=new WeakMap,uf=new WeakMap;const Sz=fn(bz),_z=1400,Jh=new WeakMap;function Az(n,t){var s;const e=t.ownerDocument,r=(s=e.defaultView)==null?void 0:s.navigator.clipboard;if(r&&typeof r.writeText=="function"){r.writeText(n).catch(()=>{});return}const i=e.createElement("textarea");i.value=n,i.setAttribute("readonly",""),i.style.position="fixed",i.style.opacity="0",e.body.append(i),i.select();try{e.execCommand("copy")}catch{}i.remove()}const Ez={writeClipboard:Az,scheduler:{setTimeout(n,t){return globalThis.setTimeout(n,t)},clearTimeout(n){globalThis.clearTimeout(n)}}};function kz(n,t,e){const r=n.currentTarget;if(!r)return;t.writeClipboard(r.getAttribute("prompt")??"",r),r.toggleAttribute("copied",!0);const i=r.nextElementSibling,s=i!=null&&i.classList.contains("copy-button-status")?i:null;s&&(s.textContent="",s.textContent="Copied");const a=Jh.get(r);a&&a.scheduler.clearTimeout(a.handle);const l={handle:void 0,scheduler:t.scheduler};l.handle=t.scheduler.setTimeout(()=>{Jh.get(r)===l&&(Jh.delete(r),r.toggleAttribute("copied",!1),s&&(s.textContent=""))},_z),Jh.set(r,l),e()}function CA({label:n,prompt:t="",intent:e,size:r="sm",copied:i=!1,onActivate:s=()=>{}},a=Ez){return j`
507
- <button
508
- class="copy-button"
509
- size=${r==="default"?de:r}
510
- aria-label=${n}
511
- intent=${e??de}
512
- ?copied=${i}
513
- prompt=${t}
514
- @click=${l=>kz(l,a,s)}
515
- >
516
- <span class="copy-button-idle"><tv-icon name="copy"></tv-icon>${n}</span>
517
- <span class="copy-button-done"><tv-icon name="check"></tv-icon>Copied</span>
518
- </button>
519
- <span
520
- class="copy-button-status"
521
- role="status"
522
- aria-live="polite"
523
- >${i?"Copied":de}</span
524
- >
525
- `}const RA="1.4.0",Tz="tv-desktop-upgrade-recommendation-dismissed",Cz=`### Recommended desktop upgrade available
526
-
527
- The Television desktop app is now a downloaded Mac app that updates itself. This copy was installed with npm and receives no more updates.
528
-
529
- To move to the downloaded app on an Apple Silicon Mac:
530
-
531
- 1. [Download Television for Mac](https://dl.todesktop.com/260923p52umxx/mac/dmg/arm64).
532
- 2. Open the downloaded disk image and drag Television to Applications.
533
- 3. Quit this app, then open Television from Applications. It keeps your saved server connection.
534
-
535
- From then on, open Television from Applications, not with \`tv-desktop\`.`;function Rz(n){var t;return!n.electron||n.noticesSuppressed||((t=n.updateState)==null?void 0:t.toast)!=null||n.shellVersion===null||!qf(n.shellVersion)||n.shellVersion===$d?!1:Q1(RA,n.shellVersion)}var kl;class IA extends HTMLElement{constructor(){super(...arguments);m(this,kl,new pv(this))}connectedCallback(){o(this,kl).connect()}disconnectedCallback(){o(this,kl).disconnect()}attributeChangedCallback(){o(this,kl).refresh()}}kl=new WeakMap,R(IA,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-popover")||customElements.define("tv-popover",IA);const Iz="tv-update-dismissed",ba={update_available:"Update available",copy_prompt:"Copy upgrade prompt",later:"Later",restart_to_update:"Restart to update",restarting:"Restarting…"},$z="update-popover";function xz(n,t){const e=n.target;if(!(e instanceof Element))return!1;const r=e.closest("button, a[href], input, select, textarea, [tabindex]");return r!==null&&t.contains(r)}var Tl,li,Cl,nh,rh,hf;class Pz extends dn{constructor(){super(...arguments);m(this,Tl);m(this,li);m(this,Cl,!1);m(this,nh,()=>{});m(this,rh,()=>{});m(this,hf,e=>{var r;(r=o(this,li))==null||r.disconnect(),d(this,li,void 0),d(this,Tl,e),d(this,Cl,(e==null?void 0:e.hasAttribute("open"))??!1),e&&(d(this,li,new MutationObserver(()=>{const i=e.hasAttribute("open");i!==o(this,Cl)&&(d(this,Cl,i),i?o(this,nh).call(this):o(this,rh).call(this))})),o(this,li).observe(e,{attributes:!0,attributeFilter:["open"]}))})}disconnected(){var e;(e=o(this,li))==null||e.disconnect(),d(this,li,void 0),d(this,Tl,void 0)}template({body:e,prompt:r,copied:i=!1,restart:s,panelRef:a,bellRef:l,onPresent:c=()=>{},onDismiss:u=()=>{},onCopy:f=()=>{},onRestart:p=()=>{}}){d(this,nh,c),d(this,rh,u);const y=()=>{var S;(S=o(this,Tl))==null||S.removeAttribute("open")},v=S=>{const _=S.currentTarget;S.key!=="Escape"||!xz(S,_)||(S.preventDefault(),S.stopPropagation(),_.removeAttribute("open"))};return j`
536
- <button
537
- class="update-bell"
538
- id="update-bell"
539
- icon
540
- intent="alert"
541
- aria-label=${ba.update_available}
542
- title=${ba.update_available}
543
- ${l===void 0?de:yt(l)}
544
- >
545
- <tv-icon name="notification" size="sm"></tv-icon>
546
- </button>
547
-
548
- <tv-popover
549
- id=${$z}
550
- manual
551
- trigger="update-bell"
552
- role="status"
553
- class="update-popover"
554
- ${yt(o(this,hf))}
555
- ${a===void 0?de:yt(a)}
556
- @keydown=${v}
557
- >
558
- ${e}
559
- <div class="update-actions">
560
- <button size="sm" class="update-later" @click=${y}
561
- >${ba.later}</button
562
- >
563
- ${r===void 0?de:CA({label:ba.copy_prompt,prompt:r,intent:"primary",copied:i,onActivate:f})}
564
- ${s===void 0?de:j`<button
565
- size="sm"
566
- intent="primary"
567
- class="update-restart"
568
- ?disabled=${s==="restarting"}
569
- @click=${p}
570
- >${s==="restarting"?ba.restarting:ba.restart_to_update}</button>`}
571
- </div>
572
- </tv-popover>
573
- `}}Tl=new WeakMap,li=new WeakMap,Cl=new WeakMap,nh=new WeakMap,rh=new WeakMap,hf=new WeakMap;const Dz=fn(Pz);function Oz(n,t){return t===null?!0:Q1(n,t)}const n8=new Set;var An,ln,ih,cn,Rl,Er,Uo,Fo,qo,Il,vt,ci,Vo,$l,xl,Bo,gs,ee,d1,f1,p1,m1,g1,v1,y1,jo,Wo,Sd,Bc,w1,$A,b1,S1,_1,df,ff,pf,mf,gf,vf,jc,xA;class Lz{constructor(t=()=>{}){m(this,ee);m(this,An,null);m(this,ln,null);m(this,ih,null);m(this,cn,null);m(this,Rl);m(this,Er,!1);m(this,Uo,!1);m(this,Fo,!1);m(this,qo,!1);m(this,Il,null);m(this,vt,!1);m(this,ci,!1);m(this,Vo,null);m(this,$l,null);m(this,xl,!1);m(this,Bo,[]);m(this,gs);m(this,jo,()=>{o(this,gs).call(this)});m(this,Wo,()=>{h(this,ee,_1).call(this),o(this,gs).call(this)});m(this,df,()=>{var e;const t=h(this,ee,Bc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);t===null||o(this,vt)||(d(this,vt,!0),t.kind==="server"&&h(this,ee,b1).call(this,t.toast),o(this,gs).call(this))});m(this,ff,()=>{var e,r;if(!o(this,vt))return;const t=h(this,ee,Bc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);t!==null&&((r=h(this,ee,d1).call(this))==null||r.setItem(h(this,ee,w1).call(this,t),t.version)),d(this,vt,!1),d(this,ci,!0),o(this,gs).call(this)});m(this,pf,()=>{var t;(t=o(this,cn))==null||t.restart()});m(this,mf,()=>{var e;const t=h(this,ee,Bc).call(this,((e=o(this,ln))==null?void 0:e.toastsSuppressed)??!1);(t==null?void 0:t.kind)!=="server"||t.prompt===void 0||h(this,ee,S1).call(this,"update_prompt_copy_clicked",t.toast)});m(this,gf,t=>{d(this,Vo,t instanceof HTMLElement?t:null),h(this,ee,jc).call(this)});m(this,vf,t=>{d(this,$l,t instanceof HTMLElement?t:null),h(this,ee,jc).call(this)});d(this,gs,t)}get presented(){return o(this,vt)}configure({connectionOwner:t=null,presentation:e=null,dismissalStorage:r,desktopRecommendation:i=null,desktopUpdate:s=null}){t!==o(this,An)&&(h(this,ee,p1).call(this),d(this,An,t),h(this,ee,f1).call(this)),e!==o(this,ln)&&(h(this,ee,g1).call(this),d(this,ln,e),h(this,ee,m1).call(this)),s!==o(this,cn)&&(h(this,ee,y1).call(this),d(this,cn,s),h(this,ee,v1).call(this)),d(this,Rl,r),d(this,ih,i)}connect(){o(this,Er)||(d(this,Er,!0),h(this,ee,f1).call(this),h(this,ee,m1).call(this),h(this,ee,v1).call(this))}disconnect(){o(this,Er)&&(h(this,ee,p1).call(this),h(this,ee,g1).call(this),h(this,ee,y1).call(this),d(this,Er,!1),d(this,Vo,null),d(this,$l,null))}template(){var l,c,u;const t=((l=o(this,ln))==null?void 0:l.toastsSuppressed)??!1,e=h(this,ee,Bc).call(this,t),r=e===null?null:`${e.kind}:${e.version}`;if(e===null?(d(this,Il,null),d(this,vt,!1),d(this,ci,!0)):r!==o(this,Il)&&(d(this,Il,r),d(this,vt,h(this,ee,$A).call(this,e)),d(this,ci,!0),o(this,vt)&&e.kind==="server"&&!t&&h(this,ee,b1).call(this,e.toast)),e===null||t)return d(this,vt,!1),d(this,ci,!0),h(this,ee,jc).call(this),de;const i=(c=o(this,Vo))==null?void 0:c.querySelector(".copy-button"),s=o(this,vt)&&!o(this,ci)&&(i==null?void 0:i.hasAttribute("copied"))===!0,a=Dz({body:cA(kA(e.markdown)),prompt:e.kind==="server"?e.prompt:void 0,copied:s,restart:e.kind!=="desktop-self-update"?void 0:(u=o(this,cn))!=null&&u.restarting?"restarting":"ready",presented:o(this,vt),panelRef:o(this,gf),bellRef:o(this,vf),onPresent:o(this,df),onDismiss:o(this,ff),onCopy:o(this,mf),onRestart:o(this,pf)});return d(this,ci,!1),h(this,ee,jc).call(this),a}}An=new WeakMap,ln=new WeakMap,ih=new WeakMap,cn=new WeakMap,Rl=new WeakMap,Er=new WeakMap,Uo=new WeakMap,Fo=new WeakMap,qo=new WeakMap,Il=new WeakMap,vt=new WeakMap,ci=new WeakMap,Vo=new WeakMap,$l=new WeakMap,xl=new WeakMap,Bo=new WeakMap,gs=new WeakMap,ee=new WeakSet,d1=function(){return o(this,Rl)!==void 0?o(this,Rl):typeof localStorage>"u"?null:localStorage},f1=function(){!o(this,Er)||o(this,Uo)||o(this,An)===null||(o(this,An).addEventListener("server-status",o(this,Wo)),o(this,An).addEventListener("change",o(this,Wo)),d(this,Uo,!0))},p1=function(){!o(this,Uo)||o(this,An)===null||(o(this,An).removeEventListener("server-status",o(this,Wo)),o(this,An).removeEventListener("change",o(this,Wo)),d(this,Uo,!1))},m1=function(){!o(this,Er)||o(this,Fo)||o(this,ln)===null||(o(this,ln).addEventListener("change",o(this,jo)),d(this,Fo,!0))},g1=function(){!o(this,Fo)||o(this,ln)===null||(o(this,ln).removeEventListener("change",o(this,jo)),d(this,Fo,!1))},v1=function(){!o(this,Er)||o(this,qo)||o(this,cn)===null||(o(this,cn).addEventListener("change",o(this,jo)),o(this,cn).subscribe(),d(this,qo,!0))},y1=function(){!o(this,qo)||o(this,cn)===null||(o(this,cn).removeEventListener("change",o(this,jo)),d(this,qo,!1))},jo=new WeakMap,Wo=new WeakMap,Sd=function(){var t;return((t=o(this,An))==null?void 0:t.connection)??null},Bc=function(t){var a,l;const e=((a=h(this,ee,Sd).call(this))==null?void 0:a.updateState)??null,r=(e==null?void 0:e.toast)??null;if(r!==null)return{kind:"server",version:r.version,markdown:r.markdown,...r.prompt===void 0?{}:{prompt:r.prompt},toast:r};const i=t?null:((l=o(this,cn))==null?void 0:l.version)??null;if(i!==null)return{kind:"desktop-self-update",version:i,markdown:hO(i)};const s=o(this,ih);return s!==null&&Rz({...s,noticesSuppressed:t,updateState:e})?{kind:"recommendation",version:RA,markdown:Cz}:null},w1=function(t){switch(t.kind){case"server":return Iz;case"desktop-self-update":return uO;case"recommendation":return Tz}},$A=function(t){var r;const e=((r=h(this,ee,d1).call(this))==null?void 0:r.getItem(h(this,ee,w1).call(this,t)))??null;return t.kind==="desktop-self-update"?e!==t.version:Oz(t.version,e!==null&&qf(e)?e:null)},b1=function(t){n8.has(t.version)||(n8.add(t.version),h(this,ee,S1).call(this,"update_toast_shown",t))},S1=function(t,e){var r;o(this,Bo).push({event:t,properties:{server_version:((r=h(this,ee,Sd).call(this))==null?void 0:r.serverVersion)??"",channel_version:e.version}}),h(this,ee,_1).call(this)},_1=function(){if(o(this,Bo).length===0)return;const t=h(this,ee,Sd).call(this);if(!t||t.status!=="connected")return;const e=o(this,Bo);d(this,Bo,[]);for(const r of e)t.sendTelemetrySignal(r.event,r.properties)},df=new WeakMap,ff=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,vf=new WeakMap,jc=function(){o(this,xl)||(d(this,xl,!0),queueMicrotask(()=>{d(this,xl,!1),h(this,ee,xA).call(this)}))},xA=function(){const t=o(this,Vo);t!==null&&(o(this,vt)&&o(this,$l)===null||t.toggleAttribute("open",o(this,vt)))};const Mz=""+new URL("calendar-DToAnkzj.png",import.meta.url).href,Nz=""+new URL("table-oeG9uAN1.png",import.meta.url).href,zz=""+new URL("tasks-D4xqXFPl.png",import.meta.url).href,Hz=""+new URL("markdown-DdDrJuVK.png",import.meta.url).href,r8="Artifact skills",Zz="Artifact skills",Uz="Ready-made starting prompts for creating Television artifacts. Copy one, add the details of what you want, and send it to your agent.",Fz="Copy prompt";function Yh({artifactSkill:n,name:t,description:e,prompt:r,thumbnail:i},s){return j`
574
- <article class="skill-card">
575
- <div class="skill-thumb"><img src=${i} alt="" /></div>
576
- <div class="skill-name">${t}</div>
577
- <p class="skill-desc">${e}</p>
578
- ${CA({label:Fz,prompt:r,onActivate:()=>s==null?void 0:s.sendTelemetrySignal("artifact_skill_prompt_copy_clicked",{artifact_skill:n})})}
579
- </article>
580
- `}class qz extends dn{template(t=null){return j`
581
- <button
582
- class="skill-trigger"
583
- variant="ghost"
584
- icon
585
- id="skills-trigger"
586
- aria-label=${r8}
587
- title=${r8}
588
- >
589
- <tv-icon name="skills" size="sm"></tv-icon>
590
- </button>
591
-
592
- <tv-popover
593
- id="skills-popover"
594
- trigger="skills-trigger"
595
- class="skill-popover"
596
- >
597
- <div class="skill-heading">${Zz}</div>
598
- <p class="skill-intro">${Uz}</p>
599
- <div class="skill-grid">
600
- ${Yh({artifactSkill:"calendar",name:"Calendar",description:"Visualize your calendar events across day and week views.",prompt:"Use the tv-calendar skill to make a calendar artifact for the following request, and put it on TV: ",thumbnail:Mz},t)}
601
- ${Yh({artifactSkill:"table",name:"Table",description:"Beautiful tables with headers, grouping, and chips for displaying data.",prompt:"Use the tv-table skill to make a table artifact for the following request, and put it on TV: ",thumbnail:Nz},t)}
602
- ${Yh({artifactSkill:"tasks",name:"Tasks",description:"Track tasks and plans in a checklist, with due dates, projects, and labels.",prompt:"Use the tv-tasks skill to make a task list artifact for the following request, and put it on TV: ",thumbnail:zz},t)}
603
- ${Yh({artifactSkill:"markdown",name:"Markdown",description:"An interactive markdown editor for Obsidian notes and other formatted docs.",prompt:"Make a markdown artifact for the following request, and put it on TV: ",thumbnail:Hz},t)}
604
- </div>
605
- </tv-popover>
606
- `}}const Vz=fn(qz),Bz=600;let jz=0;const i8=new WeakMap,Vm=n=>{if(n.id)return n.id;let t=i8.get(n);if(!t){do t=`tv-select-${++jz}`;while(n.ownerDocument.getElementById(t));i8.set(n,t)}return n.id=t,t},Kh=n=>{var t;return((t=n.textContent)==null?void 0:t.trim())??""};var sh;class PA extends HTMLElement{constructor(){super();m(this,sh,this.attachInternals());o(this,sh).role="option"}connectedCallback(){this.attributeChangedCallback()}attributeChangedCallback(){o(this,sh).ariaSelected=String(this.hasAttribute("selected"))}}sh=new WeakMap,R(PA,"observedAttributes",["selected"]);var Rt,ui,Pl,vs,ys,oh,re,Zi,Oa,A1,_d,Ui,Ad,E1,OA,Ed,LA;class DA extends HTMLElement{constructor(){super();m(this,re);m(this,Rt,new pv(this,{select:!0,refresh:()=>h(this,re,Ad).call(this),opened:()=>{d(this,ys,""),h(this,re,Ui).call(this,h(this,re,Oa).call(this))},closed:()=>{h(this,re,Ui).call(this,void 0),d(this,ys,"")},keydown:e=>h(this,re,LA).call(this,e),pointermove:e=>{const r=h(this,re,A1).call(this,e);r&&h(this,re,Ui).call(this,r)},click:e=>{const r=h(this,re,A1).call(this,e);r&&h(this,re,Ed).call(this,r)},selectedRow:()=>h(this,re,Oa).call(this),unpair:e=>h(this,re,OA).call(this,e)}));m(this,ui);m(this,Pl,"");m(this,vs);m(this,ys,"");m(this,oh,0);this.attachInternals().role="listbox"}connectedCallback(){o(this,Rt).connect()}disconnectedCallback(){o(this,Rt).disconnect()}attributeChangedCallback(){o(this,Rt).refresh()}get value(){var e;return((e=h(this,re,Oa).call(this))==null?void 0:e.getAttribute("value"))??""}set value(e){const r=h(this,re,Zi).call(this).find(i=>i.getAttribute("value")===e);r&&(h(this,re,_d).call(this,r),h(this,re,Ad).call(this))}}Rt=new WeakMap,ui=new WeakMap,Pl=new WeakMap,vs=new WeakMap,ys=new WeakMap,oh=new WeakMap,re=new WeakSet,Zi=function(){return[...this.querySelectorAll("tv-option")].filter(e=>e.closest("tv-select")===this)},Oa=function(){return h(this,re,Zi).call(this).find(e=>e.hasAttribute("selected"))},A1=function(e){const r=e.closest("tv-option");return(r==null?void 0:r.closest("tv-select"))===this?r:void 0},_d=function(e){for(const r of h(this,re,Zi).call(this))r.toggleAttribute("selected",r===e)},Ui=function(e){for(const r of h(this,re,Zi).call(this))r.toggleAttribute("highlighted",r===e);if(o(this,Rt).trigger&&$a(o(this,Rt).trigger,"aria-activedescendant",e?Vm(e):null),e){const r=e.getBoundingClientRect(),i=this.getBoundingClientRect();r.top<i.top+this.clientTop?this.scrollTop-=i.top+this.clientTop-r.top:r.bottom>i.top+this.clientTop+this.clientHeight&&(this.scrollTop+=r.bottom-i.top-this.clientTop-this.clientHeight)}},Ad=function(){var l;const e=h(this,re,Zi).call(this),r=h(this,re,Oa).call(this)??e[0];r&&h(this,re,_d).call(this,r);const i=o(this,Rt).trigger;if(!i)return;$a(i,"role","combobox"),$a(i,"aria-haspopup","listbox"),$a(i,"aria-controls",Vm(this));for(const c of e)Vm(c);const s=e.find(c=>c.hasAttribute("highlighted"));$a(i,"aria-activedescendant",this.hasAttribute("open")&&s?s.id:null);const a=r?Kh(r):"";if(!(i.firstChild instanceof Text)||i.firstChild.nodeValue!==`${a} `||i.childNodes.length!==2||((l=i.lastElementChild)==null?void 0:l.getAttribute("name"))!=="select"){const c=this.ownerDocument.createElement("tv-icon");c.setAttribute("name","select"),c.setAttribute("aria-hidden","true"),i.replaceChildren(`${a} `,c)}h(this,re,E1).call(this,i,e)},E1=function(e,r){if(o(this,vs)||(d(this,vs,new ResizeObserver(()=>{const c=o(this,Rt).trigger;c&&h(this,re,E1).call(this,c,h(this,re,Zi).call(this))})),o(this,vs).observe(e)),!e.getClientRects().length)return;const i=this.ownerDocument.defaultView.getComputedStyle(e),s=JSON.stringify([e.id,r.map(Kh),i.font,i.letterSpacing,i.padding,i.borderWidth,i.gap]);if(s===o(this,Pl))return;d(this,Pl,s);const a=e.cloneNode(!0);a.removeAttribute("id"),a.style.cssText+=";position:absolute;visibility:hidden;pointer-events:none;width:max-content;min-width:0;max-width:none;",a.style.font=i.font,a.style.letterSpacing=i.letterSpacing,e.after(a);let l=0;for(const c of r)a.firstChild.nodeValue=`${Kh(c)} `,l=Math.max(l,a.getBoundingClientRect().width);a.remove(),o(this,ui)??d(this,ui,this.ownerDocument.createElement("style")),o(this,ui).textContent=`:where(button[id="${CSS.escape(e.id)}"]) { width: ${l}px; }`,o(this,ui).isConnected||this.ownerDocument.head.append(o(this,ui))},OA=function(e){var r,i;for(const s of["role","aria-haspopup","aria-controls","aria-activedescendant"])e.removeAttribute(s);(r=o(this,vs))==null||r.disconnect(),d(this,vs,void 0),(i=o(this,ui))==null||i.remove(),d(this,ui,void 0),d(this,Pl,"")},Ed=function(e){const r=h(this,re,Oa).call(this)!==e;h(this,re,_d).call(this,e),h(this,re,Ad).call(this),o(this,Rt).close(),r&&this.dispatchEvent(new Event("change",{bubbles:!0}))},LA=function(e){if(!o(this,Rt).open)return this.ownerDocument.activeElement!==o(this,Rt).trigger||!["Enter"," ","ArrowDown","ArrowUp"].includes(e.key)?!1:(e.preventDefault(),e.stopImmediatePropagation(),o(this,Rt).show(!0),!0);const r=h(this,re,Zi).call(this),i=r.findIndex(a=>a.hasAttribute("highlighted"));if(e.key==="Tab")return e.stopImmediatePropagation(),this.ownerDocument.activeElement!==o(this,Rt).trigger?(e.preventDefault(),!0):(r[i]&&h(this,re,Ed).call(this,r[i]),!0);if(e.key==="Escape")return!1;const s=e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey;if(!["ArrowDown","ArrowUp","Home","End","Enter"," "].includes(e.key)&&!s)return!1;if(e.preventDefault(),e.stopImmediatePropagation(),e.key==="Enter"||e.key===" ")r[i]&&h(this,re,Ed).call(this,r[i]);else if(e.key==="Home")h(this,re,Ui).call(this,r[0]);else if(e.key==="End")h(this,re,Ui).call(this,r.at(-1));else if(e.key==="ArrowDown"||e.key==="ArrowUp")h(this,re,Ui).call(this,r[Math.max(0,Math.min(r.length-1,i+(e.key==="ArrowDown"?1:-1)))]);else{const a=performance.now();d(this,ys,a-o(this,oh)>Bz?e.key.toLowerCase():o(this,ys)+e.key.toLowerCase()),d(this,oh,a);const c=[...r.slice(i+1),...r.slice(0,i+1)].find(u=>Kh(u).toLowerCase().startsWith(o(this,ys)));c&&h(this,re,Ui).call(this,c)}return!0},R(DA,"observedAttributes",["open","trigger","manual"]);customElements.get("tv-option")||customElements.define("tv-option",PA);customElements.get("tv-select")||customElements.define("tv-select",DA);/**
607
- * @license
608
- * Copyright 2020 Google LLC
609
- * SPDX-License-Identifier: BSD-3-Clause
610
- */const Wz=ic(class extends kh{constructor(n){if(super(n),n.type!==Ir.PROPERTY&&n.type!==Ir.ATTRIBUTE&&n.type!==Ir.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i_(n))throw Error("`live` bindings can only contain a single expression")}render(n){return n}update(n,[t]){if(t===xt||t===de)return t;const e=n.element,r=n.name;if(n.type===Ir.PROPERTY){if(t===e[r])return xt}else if(n.type===Ir.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(r))return xt}else if(n.type===Ir.ATTRIBUTE&&e.getAttribute(r)===t+"")return xt;return s_(n),t}}),s8="Settings",o8="Refresh themes",Gz="Themes directory",Jz="None";function a8(n){return n instanceof Error?n.message:String(n)}var Ft,Go,hi,kr,ah,di,fi,Jo,Dl,Ol,Yn,MA,yf,wf,k1,bf,Sf,_f,kd;class Yz extends dn{constructor(){super(...arguments);m(this,Yn);m(this,Ft,null);m(this,Go,null);m(this,hi,!1);m(this,kr,null);m(this,ah,!1);m(this,di,0);m(this,fi,null);m(this,Jo,!1);m(this,Dl,Jn());m(this,Ol,Jn());m(this,yf,e=>{var i;if((i=o(this,fi))==null||i.disconnect(),d(this,fi,null),d(this,Jo,!1),!e)return;const r=()=>{const s=e.hasAttribute("open");s!==o(this,Jo)&&(d(this,Jo,s),s&&h(this,Yn,k1).call(this,!1))};d(this,fi,new MutationObserver(r)),o(this,fi).observe(e,{attributes:!0,attributeFilter:["open"]}),r()});m(this,wf,()=>{h(this,Yn,k1).call(this,!0)});m(this,bf,e=>{var s;const r=e.currentTarget,i=r.value;r.value=((s=o(this,Ft))==null?void 0:s.snapshot.display.appearanceMode)??"system",this.render(),h(this,Yn,kd).call(this,()=>{var a;return(a=o(this,Ft))==null?void 0:a.setAppearanceMode(i)},"Unable to change light/dark mode")});m(this,Sf,e=>{var s;const r=e.currentTarget,i=r.value||null;r.value=((s=o(this,Ft))==null?void 0:s.snapshot.display.activeThemeName)??"",this.render(),h(this,Yn,kd).call(this,()=>{var a;return(a=o(this,Ft))==null?void 0:a.setActiveTheme(i)},"Unable to change theme")});m(this,_f,e=>{var a;const r=e.currentTarget,i=r.value,s=r.checked;r.checked=((a=o(this,Ft))==null?void 0:a.snapshot.display.themeJavaScriptConsentIds.includes(i))??!1,this.render(),h(this,Yn,kd).call(this,()=>{var l;return(l=o(this,Ft))==null?void 0:l.setThemeJavaScriptConsent(i,s)},"Unable to change theme JavaScript consent")})}template(e){var p,y;d(this,Ft,e);const r=e.snapshot.connection.status==="connected";o(this,ah)&&!r&&h(this,Yn,MA).call(this),d(this,ah,r);const{activeThemeName:i,appearanceMode:s,themeJavaScriptConsentIds:a}=e.snapshot.display,l=((p=o(this,Go))==null?void 0:p.themes)??[],c=((y=o(this,Go))==null?void 0:y.errors)??[],u=i===null?void 0:l.find(v=>v.id===i&&v.enableMainJS===!0),f=i!==null&&a.includes(i);return queueMicrotask(()=>{var v,S;this.isConnected&&(o(this,Dl).value&&(o(this,Dl).value.value=((v=o(this,Ft))==null?void 0:v.snapshot.display.appearanceMode)??"system"),o(this,Ol).value&&(o(this,Ol).value.value=((S=o(this,Ft))==null?void 0:S.snapshot.display.activeThemeName)??""))}),j`
611
- <button
612
- class="settings-trigger"
613
- variant="ghost"
614
- icon
615
- id="settings-trigger"
616
- aria-label=${s8}
617
- title=${s8}
618
- >
619
- <tv-icon name="settings" size="sm"></tv-icon>
620
- </button>
621
-
622
- <tv-popover
623
- id="settings-popover"
624
- trigger="settings-trigger"
625
- class="settings-popover"
626
- ${yt(o(this,yf))}
627
- >
628
- <div class="settings-heading">Settings</div>
629
-
630
- <div class="settings-field">
631
- <label id="settings-appearance-label">Light/dark mode</label>
632
- <button id="settings-appearance" aria-labelledby="settings-appearance-label"></button>
633
- <tv-select
634
- trigger="settings-appearance"
635
- name="appearance-mode"
636
- ${yt(o(this,Dl))}
637
- @change=${o(this,bf)}
638
- >
639
- <tv-option value="system" ?selected=${s==="system"}>Adapt to system</tv-option>
640
- <tv-option value="light" ?selected=${s==="light"}>Light</tv-option>
641
- <tv-option value="dark" ?selected=${s==="dark"}>Dark</tv-option>
642
- </tv-select>
643
- </div>
644
-
645
- <div class="settings-field">
646
- <label id="settings-theme-label">Theme</label>
647
- <div class="settings-theme-control">
648
- <button id="settings-theme" aria-labelledby="settings-theme-label"></button>
649
- <tv-select
650
- trigger="settings-theme"
651
- name="theme"
652
- ${yt(o(this,Ol))}
653
- @change=${o(this,Sf)}
654
- >
655
- <tv-option value="" ?selected=${i===null}>${Jz}</tv-option>
656
- ${l.map(v=>j`
657
- <tv-option
658
- value=${v.id}
659
- ?selected=${v.id===i}
660
- >${v.name}</tv-option>
661
- `)}
662
- </tv-select>
663
- <button
664
- type="button"
665
- variant="ghost"
666
- icon
667
- aria-label=${o8}
668
- title=${o8}
669
- ?disabled=${o(this,hi)||!r}
670
- @click=${o(this,wf)}
671
- >
672
- <tv-icon name="reload" size="sm"></tv-icon>
673
- </button>
674
- </div>
675
- </div>
676
-
677
- ${u?j`
678
- <section
679
- class="settings-javascript-consent"
680
- aria-label="Experimental main-page JavaScript"
681
- >
682
- <p class="settings-javascript-disclosure">This theme uses experimental JavaScript. JavaScript can access your Television content, so only enable for themes you trust or have had your agent inspect.</p>
683
- <label class="settings-javascript-toggle">
684
- <input
685
- type="checkbox"
686
- role="switch"
687
- name="theme-javascript-consent"
688
- value=${u.id}
689
- .checked=${Wz(f)}
690
- @change=${o(this,_f)}
691
- >
692
- <span>Enable experimental javascript for this theme</span>
693
- </label>
694
- </section>
695
- `:null}
696
-
697
- ${o(this,hi)?j`<p class="settings-status" role="status">Loading themes…</p>`:null}
698
- ${o(this,kr)?j`<p class="settings-failure" role="alert">${o(this,kr)}</p>`:null}
699
- ${c.length>0?j`
700
- <div class="settings-errors" aria-label="Theme validation errors">
701
- ${c.map(v=>j`
702
- <p><strong>${v.folder??Gz}</strong>: ${v.error}</p>
703
- `)}
704
- </div>
705
- `:null}
706
- </tv-popover>
707
- `}disconnected(){var e;(e=o(this,fi))==null||e.disconnect(),d(this,fi,null),d(this,Jo,!1),d(this,Ft,null),d(this,di,o(this,di)+1)}}Ft=new WeakMap,Go=new WeakMap,hi=new WeakMap,kr=new WeakMap,ah=new WeakMap,di=new WeakMap,fi=new WeakMap,Jo=new WeakMap,Dl=new WeakMap,Ol=new WeakMap,Yn=new WeakSet,MA=function(){d(this,Go,null),d(this,kr,null),d(this,hi,!1),d(this,di,o(this,di)+1)},yf=new WeakMap,wf=new WeakMap,k1=async function(e){const r=o(this,Ft);if(r===null||r.snapshot.connection.status!=="connected"||o(this,hi))return;const i=++Mh(this,di)._;d(this,hi,!0),d(this,kr,null),this.render();try{const s=await(e?r.refreshThemes():r.listThemes());if(i!==o(this,di))return;d(this,Go,s)}catch(s){if(i!==o(this,di))return;d(this,kr,`${e?"Unable to refresh themes":"Unable to load themes"}: ${a8(s)}`)}finally{i===o(this,di)&&(d(this,hi,!1),this.render())}},bf=new WeakMap,Sf=new WeakMap,_f=new WeakMap,kd=async function(e,r){d(this,kr,null),this.render();try{await e()}catch(i){d(this,kr,`${r}: ${a8(i)}`),this.render()}};const Kz=fn(Yz),Tc={start:"--item-fade-start",end:"--item-fade-end",left:"--item-fade-left",right:"--item-fade-right"},Xz=(n,{items:t,distance:e,edges:r})=>{const i=new Set;let s=0,a=!1;const l=v=>{v.removeAttribute("data-item-edge-fade");for(const S of Object.values(Tc))v.style.removeProperty(S)},c=()=>{s=0;const v=new Set(n.querySelectorAll(t)),S=[];for(const F of i)v.has(F)||(f.unobserve(F),i.delete(F),S.push(F));for(const F of v)i.has(F)||(i.add(F),f.observe(F));const I=n.getBoundingClientRect().left+n.clientLeft,Z=I+n.clientWidth,O=Math.max(0,Math.min(e,n.clientWidth/2)),z=n.scrollLeft>1?O:0,P=n.scrollLeft<n.scrollWidth-n.clientWidth-1?O:0,V=[...v].map(F=>({item:F,bounds:F.getBoundingClientRect()}));for(const F of S)l(F);for(const{item:F,bounds:q}of V){const Q=z>0&&q.left<I+z&&q.right>I,K=P>0&&q.right>Z-P&&q.left<Z;if(!Q&&!K){l(F);continue}F.style.setProperty(Tc.start,`${I-q.left}px`),F.style.setProperty(Tc.end,`${Z-q.left}px`),F.style.setProperty(Tc.left,`${z}px`),F.style.setProperty(Tc.right,`${P}px`),F.setAttribute("data-item-edge-fade","")}},u=()=>{!a&&!s&&(s=requestAnimationFrame(c))},f=new ResizeObserver(u);f.observe(n);const p=new MutationObserver(u);return p.observe(n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class"]}),n.addEventListener("scroll",u,{passive:!0}),u(),{refresh:u,dispose:()=>{if(!a){a=!0,cancelAnimationFrame(s),f.disconnect(),p.disconnect(),n.removeEventListener("scroll",u);for(const v of i)l(v);i.clear()}}}},Cc=.5;var qt,Ll,Ml,Yo,ws,Tr,pi,mi,bs,Ss,Bn,_s,Nl,As,Ko,lh,tt,gi,vi,En,Af,B,NA,zA,ch,uh,hh,Ef,dh,La,T1,HA,Td,C1,R1,I1,ZA,UA,zl,fh,FA,Ys,Cd,qA,VA,BA,jA,Ma,WA,Wc;class Qz extends dn{constructor(){super(...arguments);m(this,B);m(this,qt,Jn());m(this,Ll);m(this,Ml);m(this,Yo,!1);m(this,ws,0);m(this,Tr,!1);m(this,pi,!1);m(this,mi,!1);m(this,bs,0);m(this,Ss,null);m(this,Bn,!1);m(this,_s,null);m(this,Nl,null);m(this,As,null);m(this,Ko,null);m(this,lh,!1);m(this,tt,null);m(this,gi,!1);m(this,vi,!1);m(this,En,!1);m(this,Af,()=>{h(this,B,Wc).call(this)});m(this,ch,e=>{var s;const r=o(this,tt);if(r===null||r.pointerId!==e.pointerId||!r.dragging&&Math.hypot(e.clientX-r.originX,e.clientY-r.originY)<=y_)return;const i=o(this,qt).value;if(i){if(r.currentX=e.clientX,r.currentY=e.clientY,r.dragging)this.render();else{h(this,B,Ma).call(this);const a=r.tab.getBoundingClientRect();d(this,gi,!0),r.dragging=!0,r.tabLeft=a.left,r.tabTop=a.top,r.tabWidth=a.width,r.tabHeight=a.height,i.setPointerCapture(e.pointerId),this.render(),(s=r.onReorderChange)==null||s.call(r,h(this,B,I1).call(this,r))}h(this,B,R1).call(this,r),h(this,B,T1).call(this,r)}});m(this,uh,e=>{const r=o(this,tt);r===null||r.pointerId!==e.pointerId||h(this,B,La).call(this,!0,!0)});m(this,hh,e=>{var r;((r=o(this,tt))==null?void 0:r.pointerId)===e.pointerId&&h(this,B,La).call(this,!1,!0)});m(this,Ef,e=>{var r;((r=o(this,tt))==null?void 0:r.pointerId)===e.pointerId&&h(this,B,La).call(this,!1,!0)});m(this,dh,e=>{var r;e.key!=="Escape"||!((r=o(this,tt))!=null&&r.dragging)||(e.preventDefault(),h(this,B,La).call(this,!1,!0))});m(this,zl,()=>{d(this,Bn,!0),h(this,B,Ys).call(this,!1)});m(this,fh,()=>{d(this,Bn,!0),h(this,B,Ys).call(this,!0)})}connected(){var e;d(this,Ll,void 0),d(this,Ml,void 0),d(this,Bn,!1),h(this,B,FA).call(this),typeof document<"u"&&((e=document.fonts)==null||e.addEventListener("loadingdone",o(this,fh))),document.addEventListener("television-theme-styles-changed",o(this,zl)),d(this,Ko,new MutationObserver(o(this,zl))),o(this,Ko).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("pointermove",o(this,ch)),window.addEventListener("pointerup",o(this,uh)),window.addEventListener("pointercancel",o(this,hh)),window.addEventListener("keydown",o(this,dh))}template(e,r,i=null,s,a=!1){var I,Z;h(this,B,WA).call(this,a);const l=(I=o(this,tt))!=null&&I.dragging?o(this,tt):null,c=(l==null?void 0:l.provisionalPages)??(r==null?void 0:r.pages),u=t7(r,c),f=(l==null?void 0:l.artifactId)??i,p=((Z=r==null?void 0:r.selectedPage)==null?void 0:Z.artifactIds[0])??null,y=`${(r==null?void 0:r.id)??""}:${u.map(({key:O,label:z})=>`${O}:${z}`).join("|")}`,v=p!==o(this,Ll),S=y!==o(this,Ml);v&&d(this,vi,!1);const _=v||l===null&&S;return S&&d(this,Bn,!0),d(this,Ll,p),d(this,Ml,y),h(this,B,Ys).call(this,_,v,v&&!S),j`
708
- <div
709
- class="tab-strip"
710
- role="tablist"
711
- ${yt(o(this,qt))}
712
- ?tab-held=${l!==null}
713
- @scroll=${o(this,Af)}
714
- @lostpointercapture=${o(this,Ef)}
715
- >
716
- ${zd(u,({key:O})=>O,(O,z)=>{const P=O.artifactId!==null&&O.artifactId===p,V=O.artifactId!==null&&O.artifactId===f,F=V&&l!==null;return j`
717
- ${V?j`
718
- <span
719
- class="tab-placeholder"
720
- aria-hidden="true"
721
- style=${Hd(F?{width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
722
- ></span>
723
- `:null}
724
- <div
725
- class=${V?"tab dragged":"tab"}
726
- ?dragging=${F}
727
- style=${Hd(F?{left:`${l.tabLeft+l.currentX-l.originX}px`,top:`${l.tabTop+l.currentY-l.originY}px`,width:`${l.tabWidth}px`,height:`${l.tabHeight}px`}:{})}
728
- @keydown=${q=>{q.key!=="Enter"&&q.key!==" "||(q.preventDefault(),q.currentTarget.click())}}
729
- role="tab"
730
- aria-selected=${P?"true":"false"}
731
- tabindex=${P?"0":"-1"}
732
- data-artifact-id=${O.artifactId??""}
733
- @pointerdown=${f===null?q=>h(this,B,NA).call(this,q,e,r,O,s):null}
734
- @click=${q=>h(this,B,zA).call(this,q,e,r,O)}
735
- @dblclick=${P&&r!==null&&!F?()=>e1(e,r,O.page,!O.page.geometry.full_screen):null}
736
- >
737
- <span class="tab-label">${O.label}</span>
738
- </div>
739
- `})}
740
- </div>
741
- `}disconnected(){var e,r,i,s;d(this,Yo,!1),typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,ws)),d(this,ws,0),d(this,Tr,!1),d(this,pi,!1),d(this,mi,!1),h(this,B,Ma).call(this),d(this,vi,!1),d(this,Bn,!1),(e=o(this,_s))==null||e.disconnect(),d(this,_s,null),d(this,Nl,null),(r=o(this,As))==null||r.dispose(),d(this,As,null),(i=o(this,Ko))==null||i.disconnect(),d(this,Ko,null),document.removeEventListener("television-theme-styles-changed",o(this,zl)),typeof document<"u"&&((s=document.fonts)==null||s.removeEventListener("loadingdone",o(this,fh))),window.removeEventListener("pointermove",o(this,ch)),window.removeEventListener("pointerup",o(this,uh)),window.removeEventListener("pointercancel",o(this,hh)),window.removeEventListener("keydown",o(this,dh)),h(this,B,La).call(this,!1,!1),d(this,gi,!1)}}qt=new WeakMap,Ll=new WeakMap,Ml=new WeakMap,Yo=new WeakMap,ws=new WeakMap,Tr=new WeakMap,pi=new WeakMap,mi=new WeakMap,bs=new WeakMap,Ss=new WeakMap,Bn=new WeakMap,_s=new WeakMap,Nl=new WeakMap,As=new WeakMap,Ko=new WeakMap,lh=new WeakMap,tt=new WeakMap,gi=new WeakMap,vi=new WeakMap,En=new WeakMap,Af=new WeakMap,B=new WeakSet,NA=function(e,r,i,s,a){o(this,En)||o(this,tt)!==null||i===null||s.artifactId===null||e.button!==0||!e.isPrimary||(d(this,gi,!1),d(this,tt,{pointerId:e.pointerId,originX:e.clientX,originY:e.clientY,tab:e.currentTarget,application:r,channelId:i.id,artifactId:s.artifactId,originalPages:i.pages,onReorderChange:a,displacementAnimations:new Set,provisionalPages:[...i.pages],slot:i.pages.indexOf(s.page),currentX:e.clientX,currentY:e.clientY,tabLeft:0,tabTop:0,tabWidth:0,tabHeight:0,edgeScrollFrame:0,edgeScrollTimestamp:null,edgeScrollRemainder:0,edgeScrollMoved:!1,dragging:!1}))},zA=function(e,r,i,s){var a;if(e.detail!==0&&o(this,gi)){d(this,gi,!1);return}d(this,gi,!1),!((a=o(this,tt))!=null&&a.dragging||i===null||s.artifactId===null)&&r.selectPage(i.id,s.artifactId)},ch=new WeakMap,uh=new WeakMap,hh=new WeakMap,Ef=new WeakMap,dh=new WeakMap,La=function(e,r){var a;const i=o(this,tt);if(i===null)return;if(h(this,B,Td).call(this,i),i.edgeScrollMoved&&d(this,vi,!0),i.dragging&&(d(this,Tr,o(this,pi)),o(this,pi)||d(this,mi,!1)),i.dragging&&e&&!n7(i.originalPages,i.provisionalPages)){const l=i.provisionalPages.map(c=>({artifactIds:[...c.artifactIds],geometry:{...c.geometry},size:{...c.size}}));i.application.updateChannelPages(i.channelId,l).catch(()=>{})}if(!e)for(const l of i.displacementAnimations)l.cancel();d(this,tt,null),(a=i.onReorderChange)==null||a.call(i,null);const s=o(this,qt).value;i.dragging&&(s!=null&&s.hasPointerCapture(i.pointerId))&&s.releasePointerCapture(i.pointerId),r&&this.render()},T1=function(e){const r=o(this,qt).value,i=r?h(this,B,C1).call(this,r,e.currentX):0,s=r?Math.max(0,r.scrollWidth-r.clientWidth):0,a=i<0?((r==null?void 0:r.scrollLeft)??0)<=Cc:((r==null?void 0:r.scrollLeft)??0)>=s-Cc;if(o(this,En)||!e.dragging||i===0||s===0||a||typeof requestAnimationFrame!="function"){h(this,B,Td).call(this,e);return}e.edgeScrollFrame===0&&(e.edgeScrollFrame=requestAnimationFrame(l=>{h(this,B,HA).call(this,e,l)}))},HA=function(e,r){if(e.edgeScrollFrame=0,o(this,En)||o(this,tt)!==e||!e.dragging){e.edgeScrollTimestamp=null;return}const i=o(this,qt).value;if(!i){e.edgeScrollTimestamp=null;return}const s=h(this,B,C1).call(this,i,e.currentX),a=e.edgeScrollTimestamp;if(e.edgeScrollTimestamp=r,s!==0&&a!==null){const l=Math.max(0,r-a)/1e3,c=Math.max(0,i.scrollWidth-i.clientWidth),u=i.scrollLeft,f=s*l+e.edgeScrollRemainder,p=Math.max(0,Math.min(c,u+f));i.scrollLeft=p;const y=i.scrollLeft-u;y!==0&&(e.edgeScrollMoved=!0),e.edgeScrollRemainder=p===0||p===c?0:f-y,y!==0&&(h(this,B,Wc).call(this,i),h(this,B,R1).call(this,e))}h(this,B,T1).call(this,e)},Td=function(e){e.edgeScrollFrame!==0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e.edgeScrollFrame),e.edgeScrollFrame=0,e.edgeScrollTimestamp=null,e.edgeScrollRemainder=0},C1=function(e,r){const i=e.getBoundingClientRect();return r>=i.left&&r<i.left+Rn?-Zd*(i.left+Rn-r)/Rn:r>i.right-Rn&&r<=i.right?Zd*(r-(i.right-Rn))/Rn:0},R1=function(e){var S;const r=o(this,qt).value,i=r==null?void 0:r.querySelector(".tab-placeholder");if(!r||!i)return;const s=i.nextElementSibling,a=e.tab.getBoundingClientRect(),l=a.left+a.width/2;let c=e.slot,u=i.previousElementSibling;for(;u!=null&&u.classList.contains("tab");){const _=u.getBoundingClientRect();if(l>=_.left+_.width/2)break;c-=1,u=u.previousElementSibling}let f=s==null?void 0:s.nextElementSibling;for(;f!=null&&f.classList.contains("tab");){const _=f.getBoundingClientRect();if(l<=_.left+_.width/2)break;c+=1,f=f.nextElementSibling}if(c===e.slot)return;const p=h(this,B,ZA).call(this,r),y=[...e.provisionalPages],[v]=y.splice(e.slot,1);v&&(y.splice(c,0,v),e.provisionalPages=y,e.slot=c,this.render(),(S=e.onReorderChange)==null||S.call(e,h(this,B,I1).call(this,e)),queueMicrotask(()=>h(this,B,UA).call(this,e,p)))},I1=function(e){return{channelId:e.channelId,pages:e.provisionalPages,carriedArtifactId:e.artifactId}},ZA=function(e){return new Map([...e.querySelectorAll(".tab:not([dragging])")].map(r=>[r.dataset.artifactId??"",r.getBoundingClientRect().left]))},UA=function(e,r){if(o(this,En))return;const i=o(this,qt).value;if(i)for(const s of i.querySelectorAll(".tab:not([dragging])")){const a=r.get(s.dataset.artifactId??"");if(a===void 0)continue;const l=a-s.getBoundingClientRect().left;if(Math.abs(l)<=Cc)continue;const c=s.animate({translate:[`${l}px 0`,"0px 0"]},{duration:Ha,easing:"ease"});e.displacementAnimations.add(c),c.finished.finally(()=>{e.displacementAnimations.delete(c)}).catch(()=>{})}},zl=new WeakMap,fh=new WeakMap,FA=function(){o(this,lh)||typeof document>"u"||!document.fonts||(d(this,lh,!0),document.fonts.ready.then(()=>{this.isConnected&&(d(this,Bn,!0),h(this,B,Ys).call(this,!0))}))},Ys=function(e,r=!1,i=!1){o(this,Tr)||d(this,Tr,e),e&&r&&(d(this,pi,!0),d(this,mi,i&&!o(this,En))),!(o(this,Yo)||o(this,ws)!==0)&&(d(this,Yo,!0),queueMicrotask(()=>{if(d(this,Yo,!1),!!this.isConnected){if(typeof requestAnimationFrame!="function"){h(this,B,Cd).call(this);return}d(this,ws,requestAnimationFrame(()=>{d(this,ws,0),h(this,B,Cd).call(this)}))}}))},Cd=function(){var l,c;const e=o(this,qt).value;if(!e)return;o(this,Bn)&&(d(this,Bn,!1),h(this,B,VA).call(this,e)),h(this,B,BA).call(this,e),h(this,B,qA).call(this,e);const r=((l=o(this,tt))==null?void 0:l.dragging)===!0,i=o(this,pi),s=i&&o(this,mi),a=!r&&(i||o(this,Tr)&&!o(this,vi));r?d(this,Tr,i):(d(this,Tr,!1),d(this,pi,!1),d(this,mi,!1),i&&d(this,vi,!1)),a&&h(this,B,jA).call(this,e,s),h(this,B,Wc).call(this,e),(c=o(this,As))==null||c.refresh()},qA=function(e){for(const r of e.querySelectorAll(".tab-label"))r.toggleAttribute("data-overflow",r.scrollWidth>r.clientWidth)},VA=function(e){var r;for(const i of e.querySelectorAll(".tab")){const s=i.querySelector(".tab-label");if(!s)continue;const a=document.createRange();a.selectNodeContents(s);const l=(r=a.getBoundingClientRect)==null?void 0:r.call(a);if(!l||l.width<=0)continue;const c=getComputedStyle(i),u=Rc(c.paddingLeft)+Rc(c.paddingRight)+Rc(c.borderLeftWidth)+Rc(c.borderRightWidth),p=Math.ceil(l.width)+u>nN+rN?"capped":"hugging";i.dataset.compression!==p&&(i.dataset.compression=p)}},BA=function(e){var r,i;typeof ResizeObserver>"u"||o(this,Nl)===e||((r=o(this,_s))==null||r.disconnect(),o(this,_s)??d(this,_s,new ResizeObserver(()=>{o(this,En)?(d(this,Tr,!0),h(this,B,Cd).call(this)):h(this,B,Ys).call(this,!0)})),o(this,_s).observe(e),d(this,Nl,e),(i=o(this,As))==null||i.dispose(),d(this,As,Xz(e,{items:".tab:not(.dragged)",distance:iN,edges:"both"})))},jA=function(e,r){const i=e.querySelector('.tab[aria-selected="true"]');if(!i){h(this,B,Ma).call(this);return}const s=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Rc(getComputedStyle(i).translate),c=Math.max(0,Math.min(e.scrollLeft+a.left-l+a.width/2-(s.left+s.width/2),e.scrollWidth-e.clientWidth));if(h(this,B,Ma).call(this),o(this,En)||!r||Math.abs(e.scrollLeft-c)<=Cc||matchMedia("(prefers-reduced-motion: reduce)").matches){e.scrollLeft=c;return}const u=e.scrollLeft,f=e.animate([{},{}],{duration:H_,easing:"ease"});d(this,Ss,f);const p=()=>{var v;if(f!==o(this,Ss))return;const y=f.playState==="finished"?1:((v=f.effect)==null?void 0:v.getComputedTiming().progress)??0;e.scrollLeft=u+(c-u)*y,f.playState==="finished"?(e.scrollLeft=c,d(this,Ss,null),d(this,bs,0),h(this,B,Wc).call(this,e)):d(this,bs,requestAnimationFrame(p))};d(this,bs,requestAnimationFrame(p))},Ma=function(){var e;typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o(this,bs)),d(this,bs,0),(e=o(this,Ss))==null||e.cancel(),d(this,Ss,null)},WA=function(e){var i;if(o(this,En)===e||(d(this,En,e),!e))return;h(this,B,Ma).call(this),d(this,mi,!1),d(this,vi,!1);const r=o(this,tt);if(r!==null){h(this,B,Td).call(this,r);for(const s of r.displacementAnimations)s.cancel();r.displacementAnimations.clear(),d(this,tt,null),r.dragging&&((i=o(this,qt).value)!=null&&i.hasPointerCapture(r.pointerId))&&o(this,qt).value.releasePointerCapture(r.pointerId),queueMicrotask(()=>{var s;return(s=r.onReorderChange)==null?void 0:s.call(r,null)})}h(this,B,Ys).call(this,!0,!0,!1)},Wc=function(e=o(this,qt).value){if(!e)return;const r=Math.max(0,e.scrollWidth-e.clientWidth);e.toggleAttribute("data-overflow",r>Cc)};const e7=fn(Qz);function t7(n,t){if(!n||!t)return[];const e=new Map(n.artifacts.map(r=>[r.id,r]));return t.map((r,i)=>{var a;const s=r.artifactIds[0]??null;return{page:r,artifactId:s,label:s===null?"":((a=e.get(s))==null?void 0:a.title)??"",key:s??`empty-page-${i}`}})}function n7(n,t){return n.length===t.length&&n.every((e,r)=>e===t[r])}function Rc(n){const t=Number.parseFloat(n);return Number.isFinite(t)?t:0}let r7=0;var Xo,Vt,ph,It,yi,Cr,Hl,wi,mh,kn,kf,Tf,gh,Wl,GA,Cf,Rf,JA,If,$f;class i7 extends dn{constructor(){super(...arguments);m(this,Wl);m(this,Xo,new Lz(()=>this.render()));m(this,Vt,new w_(()=>this.render()));m(this,ph,`channel-switcher-trigger-${++r7}`);m(this,It,null);m(this,yi,null);m(this,Cr,!1);m(this,Hl,null);m(this,wi,null);m(this,mh,Jn());m(this,kn,null);m(this,kf,e=>{var r,i,s;(r=o(this,It))==null||r.removeAttribute("open"),((i=o(this,wi))==null?void 0:i.display.focusedChannelId)!==e&&((s=o(this,Hl))==null||s.focusChannel(e).catch(()=>{}))});m(this,Tf,e=>{o(this,Cr)||(d(this,Cr,!0),this.render(),e.detail===0&&requestAnimationFrame(()=>{var r;(r=o(this,It))!=null&&r.hasAttribute("open")&&h(this,Wl,GA).call(this,0)}))});m(this,gh,e=>{const r=o(this,It);r===null||!r.hasAttribute("open")||o(this,Vt).dragging||r.querySelector("input, tv-menu[open]")||h_(e,[...r.querySelectorAll('.channel[role="option"]')])});m(this,Cf,e=>{var r,i;d(this,kn,{channelId:e,scrollTop:((i=(r=o(this,It))==null?void 0:r.querySelector(".channel-switcher-pop-body"))==null?void 0:i.scrollTop)??0,result:null})});m(this,Rf,(e,r)=>{var i;((i=o(this,kn))==null?void 0:i.channelId)===e&&(o(this,kn).result=r?"deleted":"cancelled",this.render())});m(this,If,e=>{var r;(r=o(this,yi))==null||r.disconnect(),d(this,yi,null),o(this,It)!==null&&o(this,kn)===null&&o(this,Vt).disconnect(),d(this,It,e instanceof HTMLElement?e:null),o(this,It)!==null&&(o(this,Vt).connect(),d(this,yi,new MutationObserver(o(this,$f))),o(this,yi).observe(o(this,It),{attributes:!0,attributeFilter:["open"]}))});m(this,$f,()=>{var e;(((e=o(this,It))==null?void 0:e.hasAttribute("open"))??!0)||o(this,kn)===null&&(d(this,Cr,!1),this.render())})}connected(){o(this,Xo).connect(),document.addEventListener("keydown",o(this,gh))}template(e,r,i={}){var l;d(this,Hl,e),d(this,wi,r);const s=i.collapsed||i.sidebarTransitioning;(i.sidebarTransitioning||!s||r.focusedChannel===null)&&d(this,Cr,!1),o(this,Vt).update(e,r,{management:!0,dragging:!0,revealMovedRow:!0,onDeleteStart:o(this,Cf),onDeleteEnd:o(this,Rf),selectChannel:o(this,kf),highlightOnPointerMove:!0,motionSuppressed:i.sidebarTransitioning});const a=o(this,kn);return a!=null&&a.result&&(r.channels.length===0||r.focusedChannel!==null)&&(a.result==="cancelled"||!r.channels.some(({id:c})=>c===a.channelId))&&queueMicrotask(()=>h(this,Wl,JA).call(this,a)),o(this,Xo).configure({connectionOwner:i.connectionOwner,presentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,desktopUpdate:i.desktopUpdate,dismissalStorage:i.dismissalStorage}),i.onRenderComplete&&queueMicrotask(i.onRenderComplete),j`
742
- <header class="top-bar" ${yt(o(this,mh))}>
743
- ${s?j`
744
- <div class="top-bar-lead">
745
- ${i.sidebarToggle===void 0?j`
746
- <button
747
- class="sidebar-expand"
748
- variant="ghost"
749
- icon
750
- aria-label="Show sidebar"
751
- title="Show sidebar"
752
- type="button"
753
- @click=${i.onExpandSidebar}
754
- >
755
- <tv-icon name="sidebar" size="sm"></tv-icon>
756
- </button>
757
- `:i.sidebarToggle??j`
758
- <span class="sidebar-toggle-seat" aria-hidden="true"></span>
759
- `}
760
- ${r.focusedChannel===null?null:j`
761
- <button
762
- class="channel-switcher"
763
- variant="ghost"
764
- target
765
- aria-haspopup="listbox"
766
- id=${o(this,ph)}
767
- type="button"
768
- @click=${o(this,Tf)}
769
- >
770
- <span class="channel-switcher-name">
771
- ${r.focusedChannel.name}
772
- </span>
773
- <tv-icon name="select" size="sm"></tv-icon>
774
- </button>
775
- ${o(this,Cr)?j`
776
- <tv-popover
777
- class="channel-switcher-pop"
778
- ?dragging=${o(this,Vt).dragging}
779
- trigger=${o(this,ph)}
780
- ${yt(o(this,If))}
781
- >
782
- <div class="channel-switcher-pop-body">
783
- ${o(this,Vt).template()}
784
- </div>
785
- <footer class="channel-switcher-pop-footer">
786
- <button
787
- class="channel-create"
788
- variant="ghost"
789
- icon
790
- aria-label="New channel"
791
- title="New channel"
792
- type="button"
793
- ?disabled=${o(this,Vt).creating}
794
- @click=${o(this,Vt).create}
795
- >
796
- <tv-icon name="add"></tv-icon>
797
- </button>
798
- </footer>
799
- </tv-popover>
800
- `:null}
801
- `}
802
- </div>
803
- `:null}
804
- ${e7(e,r.focusedChannel,null,i.onTabReorderChange,i.sidebarTransitioning)}
805
- <div class="top-bar-controls">
806
- ${Vz((l=i.connectionOwner)==null?void 0:l.connection)}
807
- ${Kz(e)}
808
- ${o(this,Xo).template()}
809
- </div>
810
- </header>
811
- ${o(this,Vt).overlayTemplate()}
812
- `}disconnected(){var e;o(this,Xo).disconnect(),document.removeEventListener("keydown",o(this,gh)),o(this,Vt).disconnect(),(e=o(this,yi))==null||e.disconnect(),d(this,yi,null),d(this,It,null),d(this,Cr,!1),d(this,Hl,null),d(this,wi,null),d(this,kn,null)}}Xo=new WeakMap,Vt=new WeakMap,ph=new WeakMap,It=new WeakMap,yi=new WeakMap,Cr=new WeakMap,Hl=new WeakMap,wi=new WeakMap,mh=new WeakMap,kn=new WeakMap,kf=new WeakMap,Tf=new WeakMap,gh=new WeakMap,Wl=new WeakSet,GA=function(e){var r;au((r=o(this,It))==null?void 0:r.querySelectorAll('.channel[role="option"]')[e])},Cf=new WeakMap,Rf=new WeakMap,JA=function(e){var u,f;if(o(this,kn)!==e||o(this,wi)===null)return;d(this,kn,null);const r=o(this,wi).focusedChannel;d(this,Cr,r!==null),this.render();const i=o(this,It);if(i===null){o(this,Vt).disconnect(),(f=(u=o(this,mh).value)==null?void 0:u.querySelector(".sidebar-expand"))==null||f.focus();return}i.setAttribute("open","");const s=i.querySelector(".channel-switcher-pop-body");s&&(s.scrollTop=e.scrollTop);const a=e.result==="cancelled"&&o(this,wi).channels.some(({id:p})=>p===e.channelId)?e.channelId:r==null?void 0:r.id,l=[...i.querySelectorAll(".channel-row")].find(p=>p.dataset.channelId===a),c=l==null?void 0:l.querySelector(".channel");c==null||c.focus({preventScroll:!0}),e.result==="deleted"&&(c==null||c.scrollIntoView({block:"nearest"}))},If=new WeakMap,$f=new WeakMap;const s7=fn(i7);var Rr,vh,Qo,Zl,$t,un,Tn,Cn,ea,xe,jn,Es,Ul,ks,yh,xf,ta,Pf,Df,Of,Y,Rd,$1,YA,wh,Lf,Fi,Ks,Gc,Id,x1,KA,XA,Mf,Nf,zf,bh,Hf,Xs,Jc,QA;class o7 extends dn{constructor(){super(...arguments);m(this,Y);m(this,Rr,null);m(this,vh);m(this,Qo,null);m(this,Zl,null);m(this,$t,Vh);m(this,un,!1);m(this,Tn,null);m(this,Cn,null);m(this,ea,null);m(this,xe,!1);m(this,jn,!1);m(this,Es,Vh);m(this,Ul,0);m(this,ks,null);m(this,yh,e=>{var r;if(e.key==="Escape"&&o(this,Tn)!==null){e.preventDefault(),e.stopPropagation(),h(this,Y,Xs).call(this);return}M4(e,navigator.platform)&&(e.preventDefault(),e.stopPropagation(),(r=o(this,Rr))==null||r.handleNavigationKey(e.key))});m(this,xf,e=>{d(this,vh,e??void 0),this.render()});m(this,ta,()=>{this.render()});m(this,Pf,()=>h(this,Y,Rd).call(this,!0));m(this,Df,()=>h(this,Y,Rd).call(this,!1));m(this,Of,()=>{const e=o(this,xe)?!o(this,jn):!o(this,un);h(this,Y,Rd).call(this,e)});m(this,wh,e=>{const r=o(this,ks),i=h(this,Y,Ks).call(this).closest("#app");if(!r||!i)return;d(this,Es,e);const s=aN(1-e/r.expandedSidebarWidth,r),a=(c,u)=>{i.style.setProperty(`--motion-${c}`,`${u}px`)};a("boundary",s.sidebarBoundary),a("toggle-left",s.toggleLeft),a("toggle-top",r.toggleTop),a("toggle-width",r.toggleWidth),a("toggle-height",r.toggleHeight),a("toggle-wipe",s.toggleWipe),a("lead-reservation",s.leadReservation),a("switcher-left",r.collapsedToggleLeft+r.toggleWidth+r.toggleSwitcherGap-s.sidebarBoundary-r.barInset),i.style.setProperty("--motion-titlebar-opacity",String(s.titlebarOpacity)),i.style.setProperty("--motion-switcher-opacity",String(s.switcherOpacity));const l=h(this,Y,Ks).call(this);l.style.removeProperty("left"),l.style.removeProperty("top")});m(this,Lf,e=>{var s;if(!o(this,xe))return;const r=e===0;if(r!==o(this,jn))return;const i=document.activeElement===o(this,Cn);h(this,Y,Fi).call(this,r),this.render(),i&&((s=o(this,Cn))==null||s.focus({preventScroll:!0}))});m(this,Mf,e=>{if(e.button!==0||o(this,Tn)!==null)return;const r=e.currentTarget,i=r.closest("#app");i!==null&&(r.setPointerCapture(e.pointerId),d(this,Tn,{pointerId:e.pointerId,startX:e.clientX,startWidth:o(this,$t),root:i}),e.preventDefault())});m(this,Nf,e=>{const r=o(this,Tn);r===null||e.pointerId!==r.pointerId||h(this,Y,Jc).call(this,r.root,r.startWidth+e.clientX-r.startX)});m(this,zf,e=>{var s;const r=o(this,Tn);if(r===null||e.pointerId!==r.pointerId)return;d(this,Tn,null);const i=((s=o(this,Qo))==null?void 0:s.commit(o(this,$t)))??o(this,$t);h(this,Y,Jc).call(this,r.root,i)});m(this,bh,e=>{const r=o(this,Tn);r===null||e.pointerId!==r.pointerId||h(this,Y,Xs).call(this)});m(this,Hf,e=>{var i;const r=e.currentTarget.closest("#app");r!==null&&((i=o(this,Qo))==null||i.clear(),h(this,Y,Jc).call(this,r,Vh))})}update(e,r){const i=r[0],s=r[1].sidebarWidthPreference,a=r[1].sidebarCollapsedPreference;o(this,Rr)!==i&&(o(this,Rr)!==null&&this.isConnected&&(o(this,Rr).removeEventListener("change",o(this,ta)),i.addEventListener("change",o(this,ta))),d(this,Rr,i));const l=o(this,Qo)!==s,c=o(this,Zl)!==a;return l&&(h(this,Y,Xs).call(this),d(this,Qo,s),d(this,$t,s.read()??Vh)),c&&(h(this,Y,Xs).call(this),d(this,Zl,a),d(this,un,a.read())),(l||c)&&h(this,Y,Fi).call(this,o(this,un)),super.update(e,r)}connected(){var e;(e=o(this,Rr))==null||e.addEventListener("change",o(this,ta)),document.addEventListener("keydown",o(this,yh),{capture:!0})}disconnected(){var e,r;h(this,Y,Xs).call(this),o(this,xe)?h(this,Y,Fi).call(this,o(this,jn)):(e=o(this,ea))==null||e.cancel(),(r=o(this,Rr))==null||r.removeEventListener("change",o(this,ta)),document.removeEventListener("keydown",o(this,yh),{capture:!0})}template(e,r){const i=DO(e.snapshot,r.serverURL),s=e.snapshot,a=l7(i,s.connection.hasEverConnected);return r.onRenderComplete&&queueMicrotask(()=>{var l;this.isConnected&&((l=r.onRenderComplete)==null||l.call(r,i.kind))}),j`
813
- <div
814
- id="app"
815
- tabindex="-1"
816
- data-app-state=${i.kind}
817
- ?data-sidebar-transition=${o(this,xe)}
818
- ?data-sidebar-motion=${o(this,xe)}
819
- style=${h(this,Y,XA).call(this)}
820
- >
821
- ${a?h(this,Y,QA).call(this,e,s,r):null}
822
- ${i.kind==="needs-upgrade"?Sz(i.instructions,r.desktopUpdate,lA(r.electronMode&&!a)):c7(i)?KN(i,{context:r.electronMode?"desktop":"browser",dragStrip:r.electronMode&&!a}):null}
823
- </div>
824
- <div id="foreground-overlay" inert aria-hidden="true"></div>
825
- `}}Rr=new WeakMap,vh=new WeakMap,Qo=new WeakMap,Zl=new WeakMap,$t=new WeakMap,un=new WeakMap,Tn=new WeakMap,Cn=new WeakMap,ea=new WeakMap,xe=new WeakMap,jn=new WeakMap,Es=new WeakMap,Ul=new WeakMap,ks=new WeakMap,yh=new WeakMap,xf=new WeakMap,ta=new WeakMap,Pf=new WeakMap,Df=new WeakMap,Of=new WeakMap,Y=new WeakSet,Rd=function(e){var c,u;if(!o(this,xe)&&o(this,un)===e||o(this,xe)&&o(this,jn)===e)return;h(this,Y,Xs).call(this);const r=document.activeElement===o(this,Cn);if((c=o(this,Zl))==null||c.setCollapsed(e),matchMedia("(prefers-reduced-motion: reduce)").matches){h(this,Y,Fi).call(this,e),this.render(),r&&((u=o(this,Cn))==null||u.focus({preventScroll:!0}));return}if(d(this,jn,e),o(this,xe)){h(this,Y,Gc).call(this),h(this,Y,$1).call(this);return}const i=h(this,Y,Ks).call(this),s=i.closest("#app"),a=i.getBoundingClientRect(),l=s==null?void 0:s.getBoundingClientRect();if(!s||!l||a.width===0){h(this,Y,Fi).call(this,e),this.render();return}for(const f of s.getAnimations({subtree:!0}))f.cancel();d(this,xe,!0),d(this,Ul,a.top-l.top),d(this,ks,null),i.style.left=`${a.left-l.left}px`,i.style.top=`${o(this,Ul)}px`,h(this,Y,Gc).call(this),this.render(),queueMicrotask(()=>{o(this,xe)&&(h(this,Y,YA).call(this),r&&i.focus({preventScroll:!0}),h(this,Y,$1).call(this))})},$1=function(){const e=h(this,Y,Ks).call(this).closest("#app"),r=o(this,ea);if(!e||!r||!o(this,ks))return;const i=o(this,jn)?0:o(this,$t);r.move({root:e,width:o(this,$t),target:i,onFrame:o(this,wh),onFinish:o(this,Lf)})},YA=function(){const r=h(this,Y,Ks).call(this).closest("#app"),i=r==null?void 0:r.querySelector(".sidebar-titlebar > .sidebar-toggle-seat"),s=r==null?void 0:r.querySelector(".top-bar > .top-bar-lead"),a=s==null?void 0:s.querySelector(":scope > .sidebar-toggle-seat"),l=s==null?void 0:s.querySelector(":scope > .channel-switcher"),c=s==null?void 0:s.closest(".top-bar");if(!r||!i||!s||!a||!c){h(this,Y,Fi).call(this,o(this,jn)),this.render();return}const u=i.closest(".app-sidebar");r.removeAttribute("data-sidebar-motion");const f=r.getBoundingClientRect(),p=s.style.display;s.style.display="none";const y=i.getBoundingClientRect();u.style.marginLeft=`${-o(this,$t)}px`,s.style.display=p;const v=a.getBoundingClientRect(),S=l==null?void 0:l.getBoundingClientRect();d(this,ks,{expandedSidebarWidth:o(this,$t),expandedToggleLeft:y.left-f.left,collapsedToggleLeft:v.left-f.left,toggleTop:o(this,Ul),toggleWidth:v.width,toggleHeight:v.height,toggleSwitcherGap:S?S.left-v.right:0,collapsedLeadReservation:s.getBoundingClientRect().width,hasSwitcher:!!l,barInset:c.getBoundingClientRect().left-f.left}),u.style.removeProperty("margin-left"),r.setAttribute("data-sidebar-motion",""),o(this,wh).call(this,o(this,Es))},wh=new WeakMap,Lf=new WeakMap,Fi=function(e){var r;(r=o(this,ea))==null||r.cancel(),d(this,un,e),d(this,xe,!1),d(this,Es,e?0:o(this,$t)),d(this,ea,new cN(o(this,Es))),d(this,ks,null),h(this,Y,KA).call(this),h(this,Y,Gc).call(this)},Ks=function(){if(o(this,Cn)!==null)return o(this,Cn);const e=document.createElement("button");return e.type="button",e.setAttribute("variant","ghost"),e.setAttribute("icon",""),e.append(h(this,Y,Id).call(this)),e.addEventListener("pointerdown",r=>{r.button===0&&e.setPointerCapture(r.pointerId)}),e.addEventListener("click",o(this,Of)),d(this,Cn,e),h(this,Y,Gc).call(this),e},Gc=function(){var s;const e=o(this,Cn);if(e===null)return;const r=o(this,xe)?o(this,jn):o(this,un);e.className=o(this,xe)?"sidebar-motion-toggle sidebar-toggle":r?"sidebar-expand":"sidebar-collapse",o(this,xe)?e.querySelectorAll(":scope > .sidebar-toggle-paint").length!==2&&e.replaceChildren(h(this,Y,x1).call(this,"expanded-paint"),h(this,Y,x1).call(this,"collapsed-paint")):(e.children.length!==1||!((s=e.firstElementChild)!=null&&s.matches("tv-icon[name='sidebar']")))&&e.replaceChildren(h(this,Y,Id).call(this));const i=r?"Show sidebar":"Collapse sidebar";e.setAttribute("aria-label",i),e.title=i},Id=function(){const e=document.createElement("tv-icon");return e.setAttribute("name","sidebar"),e.setAttribute("size","sm"),e},x1=function(e){const r=document.createElement("span");return r.className=`sidebar-toggle-paint ${e}`,r.setAttribute("aria-hidden","true"),r.append(h(this,Y,Id).call(this)),r},KA=function(){const e=o(this,Cn);e!==null&&(e.style.removeProperty("left"),e.style.removeProperty("top"))},XA=function(){const e=[`--sidebar-width: ${o(this,$t)}px`];return o(this,xe)&&e.push(`--motion-boundary: ${o(this,Es)}px`),e.join("; ")},Mf=new WeakMap,Nf=new WeakMap,zf=new WeakMap,bh=new WeakMap,Hf=new WeakMap,Xs=function(){const e=o(this,Tn);if(e===null)return;d(this,Tn,null),h(this,Y,Jc).call(this,e.root,e.startWidth);const r=e.root.querySelector(".app-sidebar-resize");r!=null&&r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId)},Jc=function(e,r){d(this,$t,HS(r)),h(this,Y,Fi).call(this,o(this,un)),e.style.setProperty("--sidebar-width",`${o(this,$t)}px`)},QA=function(e,r,i){const s=!o(this,un)||o(this,xe),a=h(this,Y,Ks).call(this);return j`
826
- ${s?j`
827
- <aside class="app-sidebar">
828
- ${YM(e,r,i.electronMode,o(this,Pf),o(this,xe)?null:a,o(this,xe))}
829
- </aside>
830
- ${o(this,xe)?null:j`
831
- <div
832
- class="app-sidebar-resize"
833
- aria-hidden="true"
834
- @pointerdown=${o(this,Mf)}
835
- @pointermove=${o(this,Nf)}
836
- @pointerup=${o(this,zf)}
837
- @pointercancel=${o(this,bh)}
838
- @lostpointercapture=${o(this,bh)}
839
- @dblclick=${o(this,Hf)}
840
- ></div>
841
- `}
842
- `:null}
843
- <main class="app-main">
844
- ${s7(e,r,{connectionOwner:i.connectionOwner,updatePresentation:i.updatePresentation,desktopRecommendation:i.desktopRecommendation,desktopUpdate:i.desktopUpdate,onTabReorderChange:o(this,xf),collapsed:o(this,un),onExpandSidebar:o(this,Df),sidebarToggle:o(this,xe)?null:o(this,un)?a:void 0,sidebarTransitioning:o(this,xe)})}
845
- ${jN(e,r.focusedChannel,o(this,vh),o(this,xe))}
846
- </main>
847
- ${o(this,xe)?a:null}
848
- `};const a7=fn(o7);function l7(n,t){return n.kind==="connected"||n.kind==="no-channel"||n.kind==="empty-channel"||n.kind==="disconnected"||n.kind==="error"&&t}function c7(n){return n.kind!=="connected"&&n.kind!=="no-channel"&&n.kind!=="empty-channel"}const e4="television-appearance-mode";function u7(n){return n==="system"||n==="light"||n==="dark"}function h7(){try{const n=window.localStorage.getItem(e4);return u7(n)?n:"system"}catch{return"system"}}function t4(){return window.__televisionAppearanceResolver??fO(h7())}function d7(n,t){return t==="light"||t==="dark"?t:n}function f7(n){t4().setPreference(n);try{window.localStorage.setItem(e4,n)}catch{}}document.documentElement.dataset.tvBundleVersion=hv();Object.defineProperty(window,"__tvVersion",{value:hv(),writable:!1,configurable:!1});t4();const p7=I7(),$r=bi();$r?document.documentElement.dataset.platform="electron":delete document.documentElement.dataset.platform;const n4=aa(window.location.origin),r4=k$(),m7=new ET($r?"television-electron":"television-browser",AT()),g7=new KD(window.localStorage),v7=new JD(window.localStorage),l8=DS(),y7=l8?P$({storage:l8,clientApp:$r?"desktop":"browser",desktopAppVersion:$r?L6():null}):null,Cv=nO({search:window.location.search}),Kn=dv(),i4=new lO,Rv=aO({detection:Cv,navigationLatch:Kn,presentation:i4}),Ne=new zD({localStore:m7,serverURL:n4,launchToken:r4,telemetryMeta:y7,navigationPending:()=>Kn.pending,...Cv.electron?{decideBoot:n=>Rv.decideBoot(n)}:{}}),w7=n=>{dT(wt,n)},wt=new nT({connectionOwner:Ne,navigationKeyHandler:w7,retainedGateHalted:()=>Rv.gated}),io=globalThis.__televisionNativeBridge;$r&&io&&io.onNavigationKey(n=>wt.handleNavigationKey(n));const b7=new dO({electron:$r,bridge:io});if(r4){const n=new URL(window.location.href);n.searchParams.delete("token"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`)}tO({owner:Ne,navigationLatch:Kn});Rv.attach(Ne);const S7=()=>{const n=Ne.connection;n.status==="connected"&&n.client.artifacts.list().then(({artifacts:t})=>{const e=new Set(t.map(r=>r.id));WD(e)}).catch(()=>{})},s4=()=>{Ne.connection.status==="connected"&&uN(Ne.connection.url)};let jd=null,P1=null,o4=Ne.connection.status;const _7=()=>{Kn.pending||Kn.begin(()=>{const n=document.querySelector("#settings-popover");if(n!=null&&n.hasAttribute("open")){const t=new URL(window.location.href);t.searchParams.set("reopenSettings","1"),window.history.replaceState(window.history.state,"",`${t.pathname}${t.search}${t.hash}`)}window.location.reload()})},a4=(n,t,e)=>{if(Kn.pending||Ne.connection.status!=="connected"||wt.snapshot.connection.status!=="connected"||!wt.snapshot.ready)return;const r={activeThemeName:n,consentIds:new Set(t)},i=jd,s=fN(),a=i!==null&&i.activeThemeName!==r.activeThemeName,l=(i==null?void 0:i.activeThemeName)!==null&&(i==null?void 0:i.activeThemeName)!==void 0&&i.consentIds.has(i.activeThemeName),c=r.activeThemeName!==null&&r.consentIds.has(r.activeThemeName),u=i!==null&&!a&&l&&!c,f=i!==null&&d4(i.consentIds,r.consentIds);if(jd=r,s!==null&&(a||u)){_7();return}if(s===null&&c){_b(Ne.connection.url);return}s!==null&&c&&e&&!a&&f&&_b(Ne.connection.url)},A7=()=>{const n=document.documentElement.dataset.theme;if(n!=="light"&&n!=="dark")throw new Error("Application root has no effective theme-frame appearance");return n},l4=(n,t)=>{if(Kn.pending||Ne.connection.status!=="connected"||wt.snapshot.connection.status!=="connected"||!wt.snapshot.ready)return;const e={activeThemeName:n,serverURL:Ne.connection.url,appearance:A7()},r=P1;P1=e,!(!t&&(r==null?void 0:r.activeThemeName)===e.activeThemeName&&r.serverURL===e.serverURL&&r.appearance===e.appearance)&&pN(e.serverURL,e.activeThemeName,()=>wt.listThemes())},c4=()=>{if(!Kn.pending){if(o4=Ne.connection.status,Ne.connection.status!=="connected"){hN(),dN(),mN(),jd=null,P1=null;return}s4(),S7()}};let D1,O1;const Iv=(n,t)=>{const e=d7(n,t);e!==D1&&(f7(e),D1=e),e!==O1&&$r&&typeof(io==null?void 0:io.setAppearanceMode)=="function"&&(io.setAppearanceMode(e),O1=e)},sp=()=>{const n=wt.snapshot;if(n.connection.status!=="connected"){D1=void 0,O1=void 0;return}n.ready&&(Iv(n.display.appearanceMode,n.display.activeThemeColorScheme),o4===Ne.connection.status&&(a4(n.display.activeThemeName,n.display.themeJavaScriptConsentIds,!1),l4(n.display.activeThemeName,!1)))},E7=n=>{if(Kn.pending)return;Iv(wt.snapshot.display.appearanceMode,n.activeThemeColorScheme);const t=jd,e=t!==null&&t.activeThemeName===n.themeName&&!d4(t.consentIds,new Set(n.themeJavaScriptConsentIds));a4(n.themeName,n.themeJavaScriptConsentIds,!0),!(Kn.pending||e)&&(s4(),l4(n.themeName,!0))},k7=n=>{Kn.pending||Iv(n.appearanceMode,wt.snapshot.display.activeThemeColorScheme)};c4();sp();Ne.addEventListener("change",c4);wt.addEventListener("change",sp);wt.addEventListener("theme-changed",E7);wt.addEventListener("appearance-changed",k7);const T7=new MutationObserver(()=>{sp()});T7.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});P8.register("ServerConnectionOwner",()=>Ne);P8.register("ApplicationService",()=>wt);const Xc=globalThis.__telepath??(globalThis.__telepath={});Xc.applicationService=wt;Xc.connectionOwner=Ne;const C7=Xc.renderCompleteCallbacks??(Xc.renderCompleteCallbacks=new Set);$r&&document.body.classList.add("electron");let c8=!1,u8=!1;const R7=n=>{if(!p7||u8||n!=="connected"&&n!=="no-channel"&&n!=="empty-channel")return;const t=document.querySelector("#settings-popover");t!==null&&(u8=!0,t.setAttribute("open",""))},u4=()=>{c8||(Eg(a7(wt,{serverURL:n4,electronMode:$r,connectionOwner:Ne,updatePresentation:i4,desktopRecommendation:Cv,desktopUpdate:b7,sidebarWidthPreference:g7,sidebarCollapsedPreference:v7,onRenderComplete(n){R7(n);for(const t of C7)t(n)}}),document.body),c8=!0,sp())},h4=()=>{const n=Ne.connection;n.bootState==="pending"&&!n.hasAuthRejected&&Ne.connectError===null||(Ne.removeEventListener("change",h4),u4())};$r?Ne.addEventListener("change",h4):u4();Ne.connect();function I7(){const n=new URL(window.location.href);return n.searchParams.get("reopenSettings")!=="1"?!1:(n.searchParams.delete("reopenSettings"),window.history.replaceState(window.history.state,"",`${n.pathname}${n.search}${n.hash}`),!0)}function d4(n,t){if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0}