tencil 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/^m(i|n|o|s|text|space)$/,v=Array.isArray,y=g.slice,b=Object.assign;function ee(e){e&&e.parentNode&&e.remove()}function te(e,t,n){var r,i,a,o={},s=arguments.length;for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return s>2&&(o.children=s>3?y.call(arguments,2):n),ne(e,o,r,i,null)}function ne(e,t,i,a,o){var s={type:e,props:t,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++r,__i:-1,__u:0};return!o&&n.vnode&&n.vnode(s),s}function x(e){return e.children}function re(e,t){this.props=e,this.context=t,this.__g=0}function ie(e,t){if(t==null)return e.__?ie(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:ie(e)}function S(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),S(e)}function C(e){(8&e.__g||!(e.__g|=8)||!a.push(e)||s++)&&o==n.debounceRendering||((o=n.debounceRendering)||queueMicrotask)(ae)}function ae(){var e,t,r,i,o,l,u,d,f;try{for(t=1;a.length;)a.length>t&&a.sort(c),e=a.shift(),t=a.length,8&e.__g&&(i=void 0,o=void 0,l=(o=(r=e).__v).__e,u=[],d=[],(f=r.__P)&&((i=b({constructor:void 0},o)).__v=o.__v+1,n.vnode&&n.vnode(i),pe(f,i,o,r.__n,f.namespaceURI,32&o.__u?[l]:null,u,l||ie(o),32&o.__u,d),i.__v=o.__v,i.__.__k[i.__i]=i,he(u,i,d),o.__=o.__e=null,i.__e!=l&&S(i)))}finally{a.length=s=0}}function oe(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y=r.__k||g,b=t.length;for(c=se(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||h,p.__i=d,v=pe(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&(f.ref!=p.ref||8&f.__u)&&(f.ref!=p.ref&&f.ref&&_e(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_||=m,4&p.__u?(c=ce(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function se(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,y=!1,b=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=b[a]=ne(null,o):v(o)?o=b[a]=ne(x,{children:o}):o.constructor===void 0&&o.__b?o=b[a]=ne(o.type,o.props,o.key,o.ref,o.__v):b[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=le(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,y=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):b[a]=null;if(y){for(u=[],d=[],a=0;a<i;a++)if((o=b[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:b[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=ie(s)),ve(s,s));return r}function ce(e,t,n,r){var i,a;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=ce(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=ie(e))&&!t.parentNode&&(t=null),e.__e!=t&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function le(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ue(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function de(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ue(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ue(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),(e.__e||={})[t+a]=n,n?r?n[u]=r[u]:(n[u]=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function fe(e){return function(t){if(this.__e){var r=this.__e[t.type+e];if(t[l]==null)t[l]=f++;else if(t[l]<r[u])return;return r(n.event?n.event(t):t)}}}function pe(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,y,te,ne,S,C,ae,se,ce,le,ue,de,fe,pe,he,_e=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(l=32&r.__u,d=r.__c.__z)){if(t.__u|=l,f=o=[],d.nodeType==8)for(p=1,m=d.nextSibling;m;m=m.nextSibling){if(m.nodeType==8){if(m.data.startsWith(`$s`))p++;else if(m.data.startsWith(`/$s`)&&!--p)break}o.push(m)}else o.push(d);c=o[0]}(d=n.__b)&&d(t);n:if(typeof _e==`function`){h=s.length;try{if(S=t.props,C=(d=_e.prototype)&&d.render,ae=(d=_e.contextType)&&i[d.__c],se=d?ae?ae.props.value:d.__:i,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(C?t.__c=_=new _e(S,se):(t.__c=_=new re(S,se),_.constructor=_e,_.render=ye),ae&&ae.sub(_),_.state||(_.state={}),_.__n=i,_.__g|=8,_.__h=[],_.__k=[]),C&&(_.__s||(_.__s=_.state),_e.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=b({},_.__s)),b(_.__s,_e.getDerivedStateFromProps(S,_.__s)))),y=_.props,te=_.state,_.__v=t,r.__c){if(C&&!_e.getDerivedStateFromProps&&S!==y&&_.componentWillReceiveProps&&_.componentWillReceiveProps(S,se),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(S,_.__s,se)){t.__v!=r.__v&&(_.props=S,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&s.push(_),c=ie(r);break n}_.componentWillUpdate&&_.componentWillUpdate(S,_.__s,se),C&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(y,te,ne)})}else C&&!_e.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),C&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=se,_.props=S,_.__P=e,_.__g&=-5,ce=n.__r,le=0,C)_.state=_.__s,_.__g&=-9,ce&&ce(t),d=_.render(_.props,_.state,_.context),g.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,ce&&ce(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++le<25);_.state=_.__s,_.getChildContext&&(i=b({},i,_.getChildContext())),C&&r.__c&&_.getSnapshotBeforeUpdate&&(ne=_.getSnapshotBeforeUpdate(y,te)),ue=d&&d.type===x&&d.key==null?d.props.children:d,S.__P&&(d=c,a=(e=S.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=e&&(r.__k.some(function(e){e&&ve(e,e)}),r.__k=null),c=r.__k?ie(r,0):null),c=oe(e,v(ue)?ue:[ue],t,r,i,a,o,s,c,l,u),S.__P&&(t.__e=null,c=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(ee),_.__h.length&&s.push(_),1&_.__g&&(_.__g&=-4)}catch(e){if(s.length=h,t.__v=null,l||o){if(e.then){if(de=0,t.__u|=l?160:128,o){for(pe=0;pe<o.length;pe++)if(he=o[pe]){if(he.nodeType==8){if(o[pe]=null,he.data.startsWith(`$s`))de++||(fe=he);else if(he.data.startsWith(`/$s`)&&!--de){c=he;break}}else de&&(o[pe]=null)}}if(!fe){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o&&(o[o.indexOf(c)]=null),fe=c}t.__c.__z||(t.__c.__z=fe),t.__e=c}else o&&o.some(ee)}else t.__e=r.__e;t.__k||=r.__k||[],e.then||me(t),n.__e(e,t,r)}}else c=t.__e=ge(r.__e,t,r,i,a,o,s,l,u,e);return(d=n.diffed)&&d(t),128&t.__u?void 0:c}function me(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(me))}function he(e,t,r){for(var i=0;i<r.length;)_e(r[i++],r[i++],r[i++]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function ge(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,te,ne,x,re=r.props||h,S=t.props,C=t.type;if(C==`svg`?a=`http://www.w3.org/2000/svg`:C==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(d=0;d<o.length;d++)if((g=o[d])&&(C?g.localName==C:g.nodeType==3)){e=g,o[d]=null;break}}if(!e){if(ne=u.ownerDocument||document,!C)return ne.createTextNode(S);e=ne.createElementNS(a,C,S.is&&S),c&&=(n.__m&&n.__m(t,o),!1),o=null}if(C){if(u=C==`template`?e.content:e,o=C==`textarea`&&S.defaultValue!=null?null:o&&y.call(u.childNodes),!c&&o)for(re={},d=0;d<e.attributes.length;d++)re[(g=e.attributes[d]).name]=g.value;for(d in re)g=re[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||de(e,d,null,g,a);for(d in x=1&r.__u,S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?b=g:d==`checked`?te=g:c&&typeof g!=`function`||!(re[d]!==g||x&&g!=null)||de(e,d,g,re[d],a);f?(c||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(p&&(e.textContent=``),(C==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&_.test(C))&&(a=`http://www.w3.org/1999/xhtml`),oe(u,v(m)?m:[m],t,r,i,a,o,s,o?o[0]:r.__k&&ie(r,0),c,l),o&&o.some(ee)),c&&C!=`textarea`||(d=`value`,C==`progress`&&b==null?e.removeAttribute(d):b==null||b===e[d]&&(C!=`progress`||b)||de(e,d,b,re[d],a),d=`checked`,te!=null&&te!=e[d]&&de(e,d,te,re[d],a))}else re===S||c&&e.data==S||(e.data=S);return e}function _e(e,t,r){try{typeof e==`function`?(typeof e.__u==`function`&&e.__u(),(typeof e.__u!=`function`||t)&&(e.__u=e(t))):e.current=t}catch(e){n.__e(e,r)}}function ve(e,t,r){var i,a;if(n.unmount&&n.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||_e(i,null,t),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&ve(i[a],t,typeof e.type!=`function`||r&&!e.props.__P);(i=e.__e)&&(r||ee(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function ye(e,t,n){return this.constructor(e,n)}function be(e,t){var r,i,a,o;n.__&&n.__(e,t),t.nodeType==9&&(t=t.documentElement),i=(r=e&&32&e.__u)?null:t.__k,t.__k=ne(x,{children:[e]}),a=[],o=[],pe(t,t.__k,i||h,h,t.namespaceURI,i?null:t.firstChild?y.call(t.childNodes):null,a,i?i.__e:t.firstChild,r,o),he(a,t.__k,o),t.__k.props.children=null}n={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw s=0,e}},r=0,i=function(e){return e!=null&&e.constructor===void 0},re.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=b({},this.state)),typeof e==`function`&&(e=e(b({},n),this.props)),e&&(b(n,e),this.__v&&(t&&this.__k.push(t),C(this)))},re.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),C(this))},re.prototype.render=x,a=[],s=0,c=function(e,t){return e.__v.__b-t.__v.__b},l=Symbol(),u=Symbol(),d=/(PointerCapture)$|Capture$/i,f=0,p=fe(!1),m=fe(!0);var xe,w,Se,Ce,we=Object.is,Te=0,Ee=[],De=[],T=n,Oe=T.__b,ke=T.__r,Ae=T.diffed,je=T.__c,Me=T.unmount,Ne=T.__;function Pe(e,t){T.__h&&T.__h(w,e,Te||t),Te=0;var n=w.__H||(w.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return Te=1,Fe(Ke,e)}function Fe(e,t,n){var r=Pe(xe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);we(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=w,!w.__f)){w.__f=!0;var i=w.shouldComponentUpdate;w.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,we(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function Ie(e,t){var n=Pe(xe++,3);!T.__s&&Ge(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,w.__H.__h.push(n))}function Le(e,t){var n=Pe(xe++,4);!T.__s&&Ge(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,w.__h.push(n))}function D(e){return Te=5,Re(function(){return{current:e}},[])}function Re(e,t){var n=Pe(xe++,7);return Ge(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function ze(){var e;do{for(;e=De.shift();)try{Ue(e)}catch(t){T.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Ee.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ue),t.__h.some(We),t.__h=[]}catch(n){t.__h=[],T.__e(n,e.__v)}}}while(De.length)}T.__b=function(e){w=null,Oe&&Oe(e)},T.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},T.__r=function(e){ke&&ke(e),xe=0;var t=(w=e.__c).__H;t&&(Se==w?w.__h=[]:(t.__h.some(Ue),t.__h.some(We),xe=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Se=w},T.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&He(Ee.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Se=w=null},T.__c=function(e,t){t.some(function(e){try{e.__h.some(Ue),e.__h=e.__h.filter(function(e){return!e.__||We(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],T.__e(n,e.__v)}}),je&&je(e,t)},T.unmount=function(e){Me&&Me(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,He(De.push(r))}else Ue(r)}catch(e){t=e}}),r.__H=void 0,t&&T.__e(t,r.__v))};var Be=typeof requestAnimationFrame==`function`;function Ve(e){var t,n=function(){clearTimeout(r),Be&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Be&&(t=requestAnimationFrame(n))}function He(e){e!=1&&Ce==T.requestAnimationFrame||((Ce=T.requestAnimationFrame)||Ve)(ze)}function Ue(e){var t=w,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),w=t}function We(e){var t=w;e.__c=e.__(),w=t}function Ge(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!we(t,e[n])})}function Ke(e,t){return typeof t==`function`?t(e):t}var qe=Symbol.for(`preact-signals`);function Je(){if($e>1)$e--;else{var e,t=!1;for((function(){var e=rt;for(rt=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Qe!==void 0;){var n=Qe;for(Qe=void 0,et++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ot(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(et=0,$e--,t)throw e}}function Ye(e){if($e>0)return e();nt=++tt,$e++;try{return e()}finally{Je()}}var Xe,O=void 0;function Ze(e){var t=O,n=Xe;O=void 0,Xe=void 0;try{return e()}finally{O=t,Xe=n}}var Qe=void 0,$e=0,et=0,tt=0,nt=0,rt=void 0,it=0;function at(e){if(O!==void 0){var t=e.n;if(t===void 0||t.t!==O)return t={i:0,S:e,p:O.s,n:void 0,t:O,e:void 0,x:void 0,r:t},O.s!==void 0&&(O.s.n=t),O.s=t,e.n=t,32&O.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=O.s,t.n=void 0,O.s.n=t,O.s=t),t}}function k(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}k.prototype.brand=qe,k.prototype.h=function(){return!0},k.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Ze(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},k.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Ze(function(){var e;(e=t.Z)==null||e.call(t)}))}},k.prototype.subscribe=function(e){var t=this;return mt(function(){var n=t.value;Ze(function(){return e(n)})},{name:`sub`})},k.prototype.valueOf=function(){return this.value},k.prototype.toString=function(){return this.value+``},k.prototype.toJSON=function(){return this.value},k.prototype.peek=function(){var e=this;return Ze(function(){return e.value})},Object.defineProperty(k.prototype,"value",{get:function(){var e=at(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(et>100)throw Error(`Cycle detected`);(function(e){$e!==0&&et===0&&e.l!==nt&&(e.l=nt,rt={S:e,v:e.v,i:e.i,o:rt})})(this),this.v=e,this.i++,it++,$e++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Je()}}}});function A(e,t){return new k(e,t)}function ot(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function st(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ct(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function lt(e,t){k.call(this,void 0,t),this.x=e,this.s=void 0,this.g=it-1,this.f=4}lt.prototype=new k,lt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===it))return!0;if(this.g=it,this.f|=1,this.i>0&&!ot(this))return this.f&=-2,!0;var e=O;try{st(this),O=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return O=e,ct(this),this.f&=-2,!0},lt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}k.prototype.S.call(this,e)},lt.prototype.U=function(e){if(this.t!==void 0&&(k.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},lt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(lt.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=at(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function j(e,t){return new lt(e,t)}function ut(e){var t=e.m;if(e.m=void 0,typeof t==`function`){$e++;var n=O;O=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,dt(e),t}finally{O=n,Je()}}}function dt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ut(e)}function ft(e){if(O!==this)throw Error(`Out-of-order effect`);ct(this),O=e,this.f&=-2,8&this.f&&dt(this),Je()}function pt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Xe&&Xe.push(this)}pt.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},pt.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,ut(this),st(this),$e++;var e=O;return O=this,ft.bind(this,e)},pt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qe,Qe=this)},pt.prototype.d=function(){this.f|=8,1&this.f||dt(this)},pt.prototype.dispose=function(){this.d()};function mt(e,t){var n=new pt(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ht,gt,_t=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,vt=[];mt(function(){ht=this.N})();function yt(e,t){n[e]=t.bind(null,n[e]||function(){})}function bt(e){if(gt){var t=gt;gt=void 0,t()}gt=e&&e.S()}function xt(e){var t=this,n=e.data,r=Ct(n);r.name=`ReactiveDom`,r.value=n;var a=Re(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var a=j(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),o=j(function(){return!Array.isArray(a.value)&&!i(a.value)}),s=mt(function(){if(this.N=Et,o.value){var t=a.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),c=t.__$u.d;return t.__$u.d=function(){s(),c.call(this)},[o,a]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}xt.displayName=`ReactiveTextNode`,Object.defineProperties(k.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:xt},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),yt(`__b`,function(e,t){if(bt(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof k&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),yt(`__r`,function(e,t){if(e(t),t.type!==x){bt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return mt(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;_t&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),bt(n)}}),yt(`__e`,function(e,t,n,r){bt(),e(t,n,r)}),yt(`diffed`,function(e,t){bt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=St(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function St(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=A(n);return{o:function(e,t){a.value=e,r=t},d:mt(function(){this.N=Et;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}yt(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),yt(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),re.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Ct(e,t){return Re(function(){return A(e,t)},[])}var wt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Tt(){Ye(function(){for(var e;e=vt.shift();)ht.call(e)})}function Et(){vt.push(this)===1&&(n.requestAnimationFrame||wt)(Tt)}let Dt=A(null),Ot=A(null),kt=A(!1),At=j(()=>Dt.value?`Sign in to Tencil Cloud to pin`:Ot.value?.access===`read`?`View only: you need write access to the repository to pin`:null),jt=6e4;function Mt(e){return`tencil-cloud-token:${new URL(e).host}`}function Nt(e,t=Date.now()){try{let n=localStorage.getItem(Mt(e));if(!n)return;let r=JSON.parse(n);if(typeof r.token==`string`&&r.expiresAt-jt>t)return r.token;localStorage.removeItem(Mt(e))}catch{}return Pt?.bridgeUrl===e&&Pt.expiresAt-jt>t?Pt.token:void 0}let Pt;function Ft(e,t){Pt={...t,bridgeUrl:e};try{localStorage.setItem(Mt(e),JSON.stringify(t))}catch{}}function It(e){Pt=void 0;try{localStorage.removeItem(Mt(e))}catch{}}async function Lt(e,t){let n=window.open(`about:blank`,`tencil-sign-in`,`popup,width=520,height=680`);if(!n)throw Error(`The sign-in window was blocked. Allow popups for this page.`);let r=Bt(64),i=`${Bt(32)}.${Vt(new TextEncoder().encode(location.origin))}`,a=new URL(t.authorizeUrl);a.search=new URLSearchParams({response_type:`code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_challenge:await zt(r),code_challenge_method:`S256`,state:i,...t.scope?{scope:t.scope}:{}}).toString(),n.location.href=a.toString(),kt.value=!0;try{let a=await Rt(n,new URL(t.redirectUri).origin,i),o=await fetch(t.tokenUrl,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_verifier:r,code:a})});if(!o.ok)throw Error(`Tencil Cloud refused the sign-in (${o.status})`);let s=await o.json();if(!s.access_token)throw Error(`Tencil Cloud sent no token`);Ft(e,{token:s.access_token,expiresAt:Date.now()+(s.expires_in??3600)*1e3})}finally{kt.value=!1}}function Rt(e,t,n){return new Promise((r,i)=>{let a=setInterval(()=>{e.closed&&(s(),i(/* @__PURE__ */ Error(`Sign-in was cancelled`)))},500),o=a=>{if(a.origin!==t||a.source!==e)return;let o=a.data;o?.type===`tencil:oauth`&&o.state===n&&(s(),e.close(),o.code?r(o.code):i(Error(o.error??`Sign-in failed`)))},s=()=>{clearInterval(a),window.removeEventListener(`message`,o)};window.addEventListener(`message`,o)})}async function zt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Vt(new Uint8Array(t))}function Bt(e){return Vt(crypto.getRandomValues(new Uint8Array(e)))}function Vt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Ht(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let Ut=A(`connecting`),Wt=A(null),M=A(null),Gt=A(null),Kt=A(null),qt=A(null),Jt=A(null),Yt=A(null),Xt=A(null),Zt=A(null),Qt=A(/* @__PURE__ */ new Map),$t=A(null),en=A(null),tn=A(null),nn=A(null),rn=A(null),an=A(void 0),on=A(null),sn,cn=500,ln=``,un,dn;function fn(e,t,n){ln=e,un=t,dn=n,window.addEventListener(`focus`,()=>{rn.value&&hn()}),yn()}function pn(){return un!==void 0}function mn(){return ln}function hn(){let e=sn;sn=void 0,e?.close(),cn=500,yn()}let gn;function _n(){try{return new URL(ln).host}catch{return ln}}function N(e){return sn?.readyState===WebSocket.OPEN?(sn.send(JSON.stringify(e)),!0):(on.value={message:`Not connected to the Tencil bridge`,at:Date.now()},!1)}function vn(e){let t=new Map(Qt.value);t.set(e.id,e),Qt.value=t}function yn(){let e=new URL(`/ws`,ln);e.protocol=e.protocol===`https:`?`wss:`:`ws:`,Ut.value=`connecting`;let t=new WebSocket(e);sn=t,gn=un?Nt(ln):void 0,t.addEventListener(`open`,()=>{cn=500,t.send(JSON.stringify({type:`hello`,protocol:1,pageUrl:location.href,...dn&&{root:dn},...un&&{build:un},...gn&&{token:gn}}))}),t.addEventListener(`message`,e=>{try{bn(JSON.parse(String(e.data)))}catch(e){console.warn(`[tencil] bad message`,e)}}),t.addEventListener(`close`,()=>{if(sn!==t||(Ut.value=`closed`,rn.value))return;let e=Yt.value?.state===`restarting`;setTimeout(yn,e?500:cn),e||(cn=Math.min(cn*2,1e4))})}function bn(e){switch(e.type){case`ready`:Ye(()=>{Ut.value=`open`,rn.value=null,Dt.value=null,Ot.value=e.viewer??null,nn.value=null,Wt.value=e.provider,M.value=e.settings,Gt.value=e.project,Yt.value?.state===`restarting`&&(Zt.value=Jt.value),Jt.value=e.version,Yt.value=e.update??null,Qt.value=new Map(e.threads.map(e=>[e.id,e]))});return;case`origin.blocked`:rn.value={origin:e.origin,approveUrl:e.approveUrl};return;case`project.unknown`:Ye(()=>{Ut.value=`open`,rn.value=null,nn.value=e.choices,an.value=e.emptyHint});return;case`auth.required`:gn&&It(ln),Ye(()=>{Ut.value=`open`,Ot.value=null,Dt.value={signIn:e.signIn,reason:e.reason}});return;case`provider.status`:Wt.value=e.provider;return;case`project.choices`:Kt.value=e.choices;return;case`project.source`:qt.value=e.source;return;case`preferences`:Xt.value=e.preferences;return;case`update`:Yt.value=e.update;return;case`settings`:Ye(()=>{let t=M.value?.provider!==e.settings.provider;M.value=e.settings,t&&($t.value=null,en.value=null,tn.value=null)});return;case`thread.upsert`:vn(e.thread);return;case`thread.removed`:{let t=new Map(Qt.value);t.delete(e.threadId),Qt.value=t;return}case`provider.models`:tn.value={provider:e.provider,models:e.models,defaultModel:e.defaultModel};return;case`provider.threads`:Ye(()=>{$t.value=e.threads,en.value=e.project});return;case`error`:on.value={message:e.message,threadId:e.threadId,at:Date.now()};return}}function xn(e){return M.value?.providers.find(t=>t.id===e)?.label??e}function Sn(){sn?.readyState===WebSocket.OPEN&&sn.send(JSON.stringify({type:`provider.threads`}))}function Cn(){sn?.readyState===WebSocket.OPEN&&sn.send(JSON.stringify({type:`provider.models`}))}function wn(e){for(let t of Qt.value.values())if(t.provider.threadId===e.id&&!t.anchor)return t.id;let t=Ht();return N({type:`thread.open`,id:t,providerThreadId:e.id,title:e.title})?t:null}let Tn=`tencil:shortcuts`,En=[`Alt`,`Control`,`Meta`,`Shift`],Dn=/* @__PURE__ */ new Set([`KeyC`,`KeyV`,`KeyX`,`KeyA`,`KeyZ`,`KeyR`,`KeyL`,`KeyT`,`KeyW`]),On=(e,t,n={})=>({code:e,key:t,alt:!1,ctrl:!1,meta:!1,shift:!1,...n}),kn={comment:On(`KeyC`,`C`),ruler:On(`KeyR`,`R`),hidePins:null,hideDock:On(`KeyT`,`T`,{alt:!0}),measure:`Alt`},An=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),jn=A(qn()),Mn=A(!1);function Nn(e){Fn(e),N({type:`preferences.update`,preferences:{shortcuts:e}})}function Pn(){Nn(kn)}mt(()=>{let e=Xt.value;e&&(e.shortcuts?Kn(e.shortcuts,jn.peek())||Fn(e.shortcuts):In()!==null&&N({type:`preferences.update`,preferences:{shortcuts:jn.peek()}}))});function Fn(e){jn.value=e;try{localStorage.setItem(Tn,JSON.stringify(e))}catch{}}function In(){try{return localStorage.getItem(Tn)}catch{return null}}function Ln(e,t){return e!==null&&t.code===e.code&&t.altKey===e.alt&&t.ctrlKey===e.ctrl&&t.metaKey===e.meta&&t.shiftKey===e.shift}function Rn(e,t){switch(e){case`Alt`:return t.altKey;case`Control`:return t.ctrlKey;case`Meta`:return t.metaKey;case`Shift`:return t.shiftKey;default:return!1}}function zn(e){return En.includes(e)}function Bn(e,t=An){return t?`${e.ctrl?`⌃`:``}${e.alt?`⌥`:``}${e.shift?`⇧`:``}${e.meta?`⌘`:``}${e.key}`:[e.ctrl&&`Ctrl`,e.alt&&`Alt`,e.shift&&`Shift`,e.meta&&`Win`,e.key].filter(Boolean).join(`+`)}function Vn(e,t=An){return t?{Alt:`⌥ Option`,Control:`⌃ Control`,Meta:`⌘ Command`,Shift:`⇧ Shift`}[e]:{Alt:`Alt`,Control:`Ctrl`,Meta:`Win`,Shift:`Shift`}[e]}let Hn=j(()=>{let e=jn.value,t=e=>e?Bn(e):null;return{comment:t(e.comment),ruler:t(e.ruler),hidePins:t(e.hidePins),hideDock:Bn(e.hideDock),measure:e.measure?Vn(e.measure):null}});function Un(e){let{key:t=``,code:n=``}=e;return zn(t)?null:t===`Escape`||t===`Tab`||t===`Enter`?{error:`${t} is kept for leaving fields and dialogs.`}:(e.ctrlKey||e.metaKey)&&Dn.has(n)?{error:`The browser or the page already uses that one.`}:{code:n,key:Wn(t,n,e.altKey),alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey}}function Wn(e,t,n){return e.length===1&&e!==` `&&!n?e.toUpperCase():t.startsWith(`Key`)?t.slice(3):t.startsWith(`Digit`)?t.slice(5):t===`Space`?`Space`:e.length===1?e.toUpperCase():e}function Gn(e,t){return e!==null&&t!==null&&e.code===t.code&&e.alt===t.alt&&e.ctrl===t.ctrl&&e.meta===t.meta&&e.shift===t.shift}function Kn(e,t){let n=(e,t)=>e===t||Gn(e,t)&&e?.key===t?.key;return e.measure===t.measure&&n(e.comment,t.comment)&&n(e.ruler,t.ruler)&&n(e.hidePins,t.hidePins)&&n(e.hideDock,t.hideDock)}function qn(){try{let e=JSON.parse(localStorage.getItem(Tn)??`null`);if(!e||typeof e!=`object`)return kn;let t=e=>e===null||typeof e==`object`&&typeof e.code==`string`&&typeof e.key==`string`;return{comment:t(e.comment)?e.comment:kn.comment,ruler:t(e.ruler)?e.ruler:kn.ruler,hidePins:t(e.hidePins)?e.hidePins:kn.hidePins,hideDock:e.hideDock&&t(e.hideDock)?e.hideDock:kn.hideDock,measure:e.measure===null||zn(e.measure??void 0)?e.measure??null:kn.measure}}catch{return kn}}let Jn=A(`idle`),Yn=A(null),Xn=A(!1),Zn=A(null),P=A(null),F=A(null),Qn=A(!1),$n=A(!1),er=A(`overview`),tr=A(!1),nr=A(!1),rr=j(()=>M.value?.batch??!1),ir=A(!1),ar=j(()=>rr.value&&ir.value);function or(e){let t=M.value;t&&N({type:`settings.update`,batch:e})&&(M.value={...t,batch:e})}let sr=`tencil:ruler`,cr=`tencil:dock-hidden`,lr=A(_r(cr)),ur=A(0);function dr(e){lr.value=e,ur.value=e?Date.now():0,vr(cr,e),e&&(kr(),P.value=null,Zn.value=null,F.value=null,Qn.value=!1,$n.value=!1)}let fr=j(()=>{let e=M.value;return e!==null&&e.ruler!==!1}),pr=A(_r(sr)),mr=j(()=>fr.value&&pr.value&&!lr.value);function hr(e){let t=M.value;t&&N({type:`settings.update`,ruler:e})&&(M.value={...t,ruler:e})}function gr(){pr.value=!pr.value,Zn.value=null,vr(sr,pr.value)}function _r(e){try{return localStorage.getItem(e)===`on`}catch{return!1}}function vr(e,t){try{localStorage.setItem(e,t?`on`:`off`)}catch{}}let yr=A(null),br=A(0),xr=A(Sr(location.href));function Sr(e){try{let t=new URL(e);return`${t.origin}${t.pathname.replace(/\/$/,``)||`/`}`}catch{return e}}let Cr=j(()=>[...Qt.value.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),wr=j(()=>Cr.value.filter(e=>e.anchor&&e.pageUrl&&Sr(e.pageUrl)===xr.value).filter(e=>tr.value||!e.resolved).reverse()),Tr=j(()=>Cr.value.filter(e=>!e.resolved).length),Er=j(()=>[...Cr.value].reverse().filter(e=>e.status===`draft`)),Dr=j(()=>Cr.value.filter(e=>e.status===`working`||e.status===`starting`).length);function Or(){At.value||(P.value=null,Zn.value=null,F.value=null,Jn.value=`picking`)}function kr(){Jn.value=`idle`,Yn.value=null}function Ar(e){let{key:t,storageKey:n,fallback:r,parse:i,serialize:a=String}=e,o=()=>{try{return localStorage.getItem(n)}catch{return null}},s=o(),c=A((s===null?void 0:i(s))??r),l=e=>{c.value=e;try{localStorage.setItem(n,a(e))}catch{}},u=e=>N({type:`preferences.update`,preferences:{[t]:e}});return mt(()=>{let e=Xt.value;if(!e)return;let n=e[t];n===void 0?o()!==null&&u(c.peek()):n!==c.peek()&&l(n)}),[c,e=>{l(e),u(e)}]}let jr=[`dark`,`light`,`system`],[Mr,Nr]=Ar({key:`theme`,storageKey:`tencil:theme`,fallback:`dark`,parse:e=>jr.includes(e)?e:void 0}),Pr=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):void 0,Fr=A(Pr?.matches??!0);Pr?.addEventListener(`change`,e=>{Fr.value=e.matches});let Ir=j(()=>Mr.value===`system`?Fr.value:Mr.value===`dark`),Lr=`bippy-0.7.3`,Rr=Object.defineProperty,zr=()=>{
1
+ (function(){var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n,r,i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/^m(i|n|o|s|text|space)$/,v=Array.isArray,y=g.slice,b=Object.assign;function ee(e){e&&e.parentNode&&e.remove()}function te(e,t,n){var r,i,a,o={},s=arguments.length;for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return s>2&&(o.children=s>3?y.call(arguments,2):n),ne(e,o,r,i,null)}function ne(e,t,i,a,o){var s={type:e,props:t,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++r,__i:-1,__u:0};return!o&&n.vnode&&n.vnode(s),s}function x(e){return e.children}function re(e,t){this.props=e,this.context=t,this.__g=0}function ie(e,t){if(t==null)return e.__?ie(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:ie(e)}function S(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),S(e)}function C(e){(8&e.__g||!(e.__g|=8)||!a.push(e)||s++)&&o==n.debounceRendering||((o=n.debounceRendering)||queueMicrotask)(ae)}function ae(){var e,t,r,i,o,l,u,d,f;try{for(t=1;a.length;)a.length>t&&a.sort(c),e=a.shift(),t=a.length,8&e.__g&&(i=void 0,o=void 0,l=(o=(r=e).__v).__e,u=[],d=[],(f=r.__P)&&((i=b({constructor:void 0},o)).__v=o.__v+1,n.vnode&&n.vnode(i),pe(f,i,o,r.__n,f.namespaceURI,32&o.__u?[l]:null,u,l||ie(o),32&o.__u,d),i.__v=o.__v,i.__.__k[i.__i]=i,he(u,i,d),o.__=o.__e=null,i.__e!=l&&S(i)))}finally{a.length=s=0}}function oe(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y=r.__k||g,b=t.length;for(c=se(n,t,y,c,b),d=0;d<b;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||h,p.__i=d,v=pe(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&(f.ref!=p.ref||8&f.__u)&&(f.ref!=p.ref&&f.ref&&_e(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_||=m,4&p.__u?(c=ce(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function se(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,y=!1,b=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=b[a]=ne(null,o):v(o)?o=b[a]=ne(x,{children:o}):o.constructor===void 0&&o.__b?o=b[a]=ne(o.type,o.props,o.key,o.ref,o.__v):b[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=le(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,y=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):b[a]=null;if(y){for(u=[],d=[],a=0;a<i;a++)if((o=b[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:b[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=ie(s)),ve(s,s));return r}function ce(e,t,n,r){var i,a;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=ce(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=ie(e))&&!t.parentNode&&(t=null),e.__e!=t&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function le(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ue(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function de(e,t,n,r,i){var a;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ue(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ue(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),(e.__e||={})[t+a]=n,n?r?n[u]=r[u]:(n[u]=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function fe(e){return function(t){if(this.__e){var r=this.__e[t.type+e];if(t[l]==null)t[l]=f++;else if(t[l]<r[u])return;return r(n.event?n.event(t):t)}}}function pe(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,h,_,y,te,ne,S,C,ae,se,ce,le,ue,de,fe,pe,he,_e=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(l=32&r.__u,d=r.__c.__z)){if(t.__u|=l,f=o=[],d.nodeType==8)for(p=1,m=d.nextSibling;m;m=m.nextSibling){if(m.nodeType==8){if(m.data.startsWith(`$s`))p++;else if(m.data.startsWith(`/$s`)&&!--p)break}o.push(m)}else o.push(d);c=o[0]}(d=n.__b)&&d(t);n:if(typeof _e==`function`){h=s.length;try{if(S=t.props,C=(d=_e.prototype)&&d.render,ae=(d=_e.contextType)&&i[d.__c],se=d?ae?ae.props.value:d.__:i,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(C?t.__c=_=new _e(S,se):(t.__c=_=new re(S,se),_.constructor=_e,_.render=ye),ae&&ae.sub(_),_.state||(_.state={}),_.__n=i,_.__g|=8,_.__h=[],_.__k=[]),C&&(_.__s||(_.__s=_.state),_e.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=b({},_.__s)),b(_.__s,_e.getDerivedStateFromProps(S,_.__s)))),y=_.props,te=_.state,_.__v=t,r.__c){if(C&&!_e.getDerivedStateFromProps&&S!==y&&_.componentWillReceiveProps&&_.componentWillReceiveProps(S,se),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(S,_.__s,se)){t.__v!=r.__v&&(_.props=S,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&s.push(_),c=ie(r);break n}_.componentWillUpdate&&_.componentWillUpdate(S,_.__s,se),C&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(y,te,ne)})}else C&&!_e.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),C&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=se,_.props=S,_.__P=e,_.__g&=-5,ce=n.__r,le=0,C)_.state=_.__s,_.__g&=-9,ce&&ce(t),d=_.render(_.props,_.state,_.context),g.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,ce&&ce(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++le<25);_.state=_.__s,_.getChildContext&&(i=b({},i,_.getChildContext())),C&&r.__c&&_.getSnapshotBeforeUpdate&&(ne=_.getSnapshotBeforeUpdate(y,te)),ue=d&&d.type===x&&d.key==null?d.props.children:d,S.__P&&(d=c,a=(e=S.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=e&&(r.__k.some(function(e){e&&ve(e,e)}),r.__k=null),c=r.__k?ie(r,0):null),c=oe(e,v(ue)?ue:[ue],t,r,i,a,o,s,c,l,u),S.__P&&(t.__e=null,c=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(ee),_.__h.length&&s.push(_),1&_.__g&&(_.__g&=-4)}catch(e){if(s.length=h,t.__v=null,l||o){if(e.then){if(de=0,t.__u|=l?160:128,o){for(pe=0;pe<o.length;pe++)if(he=o[pe]){if(he.nodeType==8){if(o[pe]=null,he.data.startsWith(`$s`))de++||(fe=he);else if(he.data.startsWith(`/$s`)&&!--de){c=he;break}}else de&&(o[pe]=null)}}if(!fe){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o&&(o[o.indexOf(c)]=null),fe=c}t.__c.__z||(t.__c.__z=fe),t.__e=c}else o&&o.some(ee)}else t.__e=r.__e;t.__k||=r.__k||[],e.then||me(t),n.__e(e,t,r)}}else c=t.__e=ge(r.__e,t,r,i,a,o,s,l,u,e);return(d=n.diffed)&&d(t),128&t.__u?void 0:c}function me(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(me))}function he(e,t,r){for(var i=0;i<r.length;)_e(r[i++],r[i++],r[i++]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function ge(e,t,r,i,a,o,s,c,l,u){var d,f,p,m,g,b,te,ne,x,re=r.props||h,S=t.props,C=t.type;if(C==`svg`?a=`http://www.w3.org/2000/svg`:C==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(d=0;d<o.length;d++)if((g=o[d])&&(C?g.localName==C:g.nodeType==3)){e=g,o[d]=null;break}}if(!e){if(ne=u.ownerDocument||document,!C)return ne.createTextNode(S);e=ne.createElementNS(a,C,S.is&&S),c&&=(n.__m&&n.__m(t,o),!1),o=null}if(C){if(u=C==`template`?e.content:e,o=C==`textarea`&&S.defaultValue!=null?null:o&&y.call(u.childNodes),!c&&o)for(re={},d=0;d<e.attributes.length;d++)re[(g=e.attributes[d]).name]=g.value;for(d in re)g=re[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||de(e,d,null,g,a);for(d in x=1&r.__u,S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?b=g:d==`checked`?te=g:c&&typeof g!=`function`||!(re[d]!==g||x&&g!=null)||de(e,d,g,re[d],a);f?(c||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(p&&(e.textContent=``),(C==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&_.test(C))&&(a=`http://www.w3.org/1999/xhtml`),oe(u,v(m)?m:[m],t,r,i,a,o,s,o?o[0]:r.__k&&ie(r,0),c,l),o&&o.some(ee)),c&&C!=`textarea`||(d=`value`,C==`progress`&&b==null?e.removeAttribute(d):b==null||b===e[d]&&(C!=`progress`||b)||de(e,d,b,re[d],a),d=`checked`,te!=null&&te!=e[d]&&de(e,d,te,re[d],a))}else re===S||c&&e.data==S||(e.data=S);return e}function _e(e,t,r){try{typeof e==`function`?(typeof e.__u==`function`&&e.__u(),(typeof e.__u!=`function`||t)&&(e.__u=e(t))):e.current=t}catch(e){n.__e(e,r)}}function ve(e,t,r){var i,a;if(n.unmount&&n.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||_e(i,null,t),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&ve(i[a],t,typeof e.type!=`function`||r&&!e.props.__P);(i=e.__e)&&(r||ee(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function ye(e,t,n){return this.constructor(e,n)}function be(e,t){var r,i,a,o;n.__&&n.__(e,t),t.nodeType==9&&(t=t.documentElement),i=(r=e&&32&e.__u)?null:t.__k,t.__k=ne(x,{children:[e]}),a=[],o=[],pe(t,t.__k,i||h,h,t.namespaceURI,i?null:t.firstChild?y.call(t.childNodes):null,a,i?i.__e:t.firstChild,r,o),he(a,t.__k,o),t.__k.props.children=null}n={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw s=0,e}},r=0,i=function(e){return e!=null&&e.constructor===void 0},re.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=b({},this.state)),typeof e==`function`&&(e=e(b({},n),this.props)),e&&(b(n,e),this.__v&&(t&&this.__k.push(t),C(this)))},re.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),C(this))},re.prototype.render=x,a=[],s=0,c=function(e,t){return e.__v.__b-t.__v.__b},l=Symbol(),u=Symbol(),d=/(PointerCapture)$|Capture$/i,f=0,p=fe(!1),m=fe(!0);var xe,w,Se,Ce,we=Object.is,Te=0,Ee=[],De=[],T=n,Oe=T.__b,ke=T.__r,Ae=T.diffed,je=T.__c,Me=T.unmount,Ne=T.__;function Pe(e,t){T.__h&&T.__h(w,e,Te||t),Te=0;var n=w.__H||(w.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return Te=1,Fe(Ke,e)}function Fe(e,t,n){var r=Pe(xe++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ke(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);we(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=w,!w.__f)){w.__f=!0;var i=w.shouldComponentUpdate;w.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,we(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function Ie(e,t){var n=Pe(xe++,3);!T.__s&&Ge(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,w.__H.__h.push(n))}function Le(e,t){var n=Pe(xe++,4);!T.__s&&Ge(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,w.__h.push(n))}function D(e){return Te=5,Re(function(){return{current:e}},[])}function Re(e,t){var n=Pe(xe++,7);return Ge(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function ze(){var e;do{for(;e=De.shift();)try{Ue(e)}catch(t){T.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Ee.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ue),t.__h.some(We),t.__h=[]}catch(n){t.__h=[],T.__e(n,e.__v)}}}while(De.length)}T.__b=function(e){w=null,Oe&&Oe(e)},T.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ne&&Ne(e,t)},T.__r=function(e){ke&&ke(e),xe=0;var t=(w=e.__c).__H;t&&(Se==w?w.__h=[]:(t.__h.some(Ue),t.__h.some(We),xe=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Se=w},T.diffed=function(e){Ae&&Ae(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&He(Ee.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Se=w=null},T.__c=function(e,t){t.some(function(e){try{e.__h.some(Ue),e.__h=e.__h.filter(function(e){return!e.__||We(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],T.__e(n,e.__v)}}),je&&je(e,t)},T.unmount=function(e){Me&&Me(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,He(De.push(r))}else Ue(r)}catch(e){t=e}}),r.__H=void 0,t&&T.__e(t,r.__v))};var Be=typeof requestAnimationFrame==`function`;function Ve(e){var t,n=function(){clearTimeout(r),Be&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Be&&(t=requestAnimationFrame(n))}function He(e){e!=1&&Ce==T.requestAnimationFrame||((Ce=T.requestAnimationFrame)||Ve)(ze)}function Ue(e){var t=w,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),w=t}function We(e){var t=w;e.__c=e.__(),w=t}function Ge(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!we(t,e[n])})}function Ke(e,t){return typeof t==`function`?t(e):t}var qe=Symbol.for(`preact-signals`);function Je(){if($e>1)$e--;else{var e,t=!1;for((function(){var e=rt;for(rt=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Qe!==void 0;){var n=Qe;for(Qe=void 0,et++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ot(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(et=0,$e--,t)throw e}}function Ye(e){if($e>0)return e();nt=++tt,$e++;try{return e()}finally{Je()}}var Xe,O=void 0;function Ze(e){var t=O,n=Xe;O=void 0,Xe=void 0;try{return e()}finally{O=t,Xe=n}}var Qe=void 0,$e=0,et=0,tt=0,nt=0,rt=void 0,it=0;function at(e){if(O!==void 0){var t=e.n;if(t===void 0||t.t!==O)return t={i:0,S:e,p:O.s,n:void 0,t:O,e:void 0,x:void 0,r:t},O.s!==void 0&&(O.s.n=t),O.s=t,e.n=t,32&O.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=O.s,t.n=void 0,O.s.n=t,O.s=t),t}}function k(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}k.prototype.brand=qe,k.prototype.h=function(){return!0},k.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Ze(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},k.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Ze(function(){var e;(e=t.Z)==null||e.call(t)}))}},k.prototype.subscribe=function(e){var t=this;return mt(function(){var n=t.value;Ze(function(){return e(n)})},{name:`sub`})},k.prototype.valueOf=function(){return this.value},k.prototype.toString=function(){return this.value+``},k.prototype.toJSON=function(){return this.value},k.prototype.peek=function(){var e=this;return Ze(function(){return e.value})},Object.defineProperty(k.prototype,"value",{get:function(){var e=at(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(et>100)throw Error(`Cycle detected`);(function(e){$e!==0&&et===0&&e.l!==nt&&(e.l=nt,rt={S:e,v:e.v,i:e.i,o:rt})})(this),this.v=e,this.i++,it++,$e++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Je()}}}});function A(e,t){return new k(e,t)}function ot(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function st(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ct(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function lt(e,t){k.call(this,void 0,t),this.x=e,this.s=void 0,this.g=it-1,this.f=4}lt.prototype=new k,lt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===it))return!0;if(this.g=it,this.f|=1,this.i>0&&!ot(this))return this.f&=-2,!0;var e=O;try{st(this),O=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return O=e,ct(this),this.f&=-2,!0},lt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}k.prototype.S.call(this,e)},lt.prototype.U=function(e){if(this.t!==void 0&&(k.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},lt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(lt.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=at(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function j(e,t){return new lt(e,t)}function ut(e){var t=e.m;if(e.m=void 0,typeof t==`function`){$e++;var n=O;O=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,dt(e),t}finally{O=n,Je()}}}function dt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ut(e)}function ft(e){if(O!==this)throw Error(`Out-of-order effect`);ct(this),O=e,this.f&=-2,8&this.f&&dt(this),Je()}function pt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Xe&&Xe.push(this)}pt.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},pt.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,ut(this),st(this),$e++;var e=O;return O=this,ft.bind(this,e)},pt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qe,Qe=this)},pt.prototype.d=function(){this.f|=8,1&this.f||dt(this)},pt.prototype.dispose=function(){this.d()};function mt(e,t){var n=new pt(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ht,gt,_t=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,vt=[];mt(function(){ht=this.N})();function yt(e,t){n[e]=t.bind(null,n[e]||function(){})}function bt(e){if(gt){var t=gt;gt=void 0,t()}gt=e&&e.S()}function xt(e){var t=this,n=e.data,r=Ct(n);r.name=`ReactiveDom`,r.value=n;var a=Re(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var a=j(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),o=j(function(){return!Array.isArray(a.value)&&!i(a.value)}),s=mt(function(){if(this.N=Et,o.value){var t=a.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),c=t.__$u.d;return t.__$u.d=function(){s(),c.call(this)},[o,a]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}xt.displayName=`ReactiveTextNode`,Object.defineProperties(k.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:xt},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),yt(`__b`,function(e,t){if(bt(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof k&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),yt(`__r`,function(e,t){if(e(t),t.type!==x){bt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return mt(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;_t&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),bt(n)}}),yt(`__e`,function(e,t,n,r){bt(),e(t,n,r)}),yt(`diffed`,function(e,t){bt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=St(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function St(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=A(n);return{o:function(e,t){a.value=e,r=t},d:mt(function(){this.N=Et;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}yt(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),yt(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),re.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Ct(e,t){return Re(function(){return A(e,t)},[])}var wt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Tt(){Ye(function(){for(var e;e=vt.shift();)ht.call(e)})}function Et(){vt.push(this)===1&&(n.requestAnimationFrame||wt)(Tt)}let Dt=A(null),Ot=A(null),kt=A(!1),At=j(()=>Dt.value?`Sign in to Tencil Cloud to pin`:Ot.value?.access===`read`?`View only: you need write access to the repository to pin`:null),jt=6e4;function Mt(e){return`tencil-cloud-token:${new URL(e).host}`}function Nt(e,t=Date.now()){try{let n=localStorage.getItem(Mt(e));if(!n)return;let r=JSON.parse(n);if(typeof r.token==`string`&&r.expiresAt-jt>t)return r.token;localStorage.removeItem(Mt(e))}catch{}return Pt?.bridgeUrl===e&&Pt.expiresAt-jt>t?Pt.token:void 0}let Pt;function Ft(e,t){Pt={...t,bridgeUrl:e};try{localStorage.setItem(Mt(e),JSON.stringify(t))}catch{}}function It(e){Pt=void 0;try{localStorage.removeItem(Mt(e))}catch{}}async function Lt(e,t){let n=window.open(`about:blank`,`tencil-sign-in`,`popup,width=520,height=680`);if(!n)throw Error(`The sign-in window was blocked. Allow popups for this page.`);let r=Bt(64),i=`${Bt(32)}.${Vt(new TextEncoder().encode(location.origin))}`,a=new URL(t.authorizeUrl);a.search=new URLSearchParams({response_type:`code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_challenge:await zt(r),code_challenge_method:`S256`,state:i,...t.scope?{scope:t.scope}:{}}).toString(),n.location.href=a.toString(),kt.value=!0;try{let a=await Rt(n,new URL(t.redirectUri).origin,i),o=await fetch(t.tokenUrl,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,client_id:t.clientId,redirect_uri:t.redirectUri,code_verifier:r,code:a})});if(!o.ok)throw Error(`Tencil Cloud refused the sign-in (${o.status})`);let s=await o.json();if(!s.access_token)throw Error(`Tencil Cloud sent no token`);Ft(e,{token:s.access_token,expiresAt:Date.now()+(s.expires_in??3600)*1e3})}finally{kt.value=!1}}function Rt(e,t,n){return new Promise((r,i)=>{let a=setInterval(()=>{e.closed&&(s(),i(/* @__PURE__ */ Error(`Sign-in was cancelled`)))},500),o=a=>{if(a.origin!==t||a.source!==e)return;let o=a.data;o?.type===`tencil:oauth`&&o.state===n&&(s(),e.close(),o.code?r(o.code):i(Error(o.error??`Sign-in failed`)))},s=()=>{clearInterval(a),window.removeEventListener(`message`,o)};window.addEventListener(`message`,o)})}async function zt(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Vt(new Uint8Array(t))}function Bt(e){return Vt(crypto.getRandomValues(new Uint8Array(e)))}function Vt(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Ht(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));e[6]=(e[6]??0)&15|64,e[8]=(e[8]??0)&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let Ut=A(`connecting`),Wt=A(null),M=A(null),Gt=A(null),Kt=A(null),qt=A(null),Jt=A(null),Yt=A(null),Xt=A(null),Zt=A(null),Qt=A(/* @__PURE__ */ new Map),$t=A(null),en=A(null),tn=A(null),nn=A(null),rn=A(null),an=A(void 0),on=A(null),sn,cn=500,ln,un=``,dn,fn;function pn(e,t,n){un=e,dn=t,fn=n;let r=()=>{document.visibilityState!==`hidden`&&(rn.value||Ut.value===`closed`)&&gn()};window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,r),xn()}function mn(){return dn!==void 0}function hn(){return un}function gn(){let e=sn;sn=void 0,e?.close(),clearTimeout(ln),cn=500,xn()}function _n(){Ut.value=`connecting`,gn()}let vn;function yn(){try{return new URL(un).host}catch{return un}}function N(e){return sn?.readyState===WebSocket.OPEN?(sn.send(JSON.stringify(e)),!0):(on.value={message:`Not connected to the Tencil bridge`,at:Date.now()},!1)}function bn(e){let t=new Map(Qt.value);t.set(e.id,e),Qt.value=t}function xn(){let e=new URL(`/ws`,un);e.protocol=e.protocol===`https:`?`wss:`:`ws:`,(Ut.value!==`closed`||Yt.value?.state===`restarting`)&&(Ut.value=`connecting`);let t=new WebSocket(e);sn=t,vn=dn?Nt(un):void 0,t.addEventListener(`open`,()=>{cn=500,t.send(JSON.stringify({type:`hello`,protocol:1,pageUrl:location.href,...fn&&{root:fn},...dn&&{build:dn},...vn&&{token:vn}}))}),t.addEventListener(`message`,e=>{try{Sn(JSON.parse(String(e.data)))}catch(e){console.warn(`[tencil] bad message`,e)}}),t.addEventListener(`close`,()=>{if(sn!==t||(Ut.value=`closed`,rn.value))return;let e=Yt.value?.state===`restarting`;ln=setTimeout(xn,e?500:cn),e||(cn=Math.min(cn*2,mn()?1e4:2e3))})}function Sn(e){switch(e.type){case`ready`:Ye(()=>{Ut.value=`open`,rn.value=null,Dt.value=null,Ot.value=e.viewer??null,nn.value=null,Wt.value=e.provider,M.value=e.settings,Gt.value=e.project,Yt.value?.state===`restarting`&&(Zt.value=Jt.value),Jt.value=e.version,Yt.value=e.update??null,Qt.value=new Map(e.threads.map(e=>[e.id,e]))});return;case`origin.blocked`:rn.value={origin:e.origin,approveUrl:e.approveUrl};return;case`project.unknown`:Ye(()=>{Ut.value=`open`,rn.value=null,nn.value=e.choices,an.value=e.emptyHint});return;case`auth.required`:vn&&It(un),Ye(()=>{Ut.value=`open`,Ot.value=null,Dt.value={signIn:e.signIn,reason:e.reason}});return;case`provider.status`:Wt.value=e.provider;return;case`project.choices`:Kt.value=e.choices;return;case`project.source`:qt.value=e.source;return;case`preferences`:Xt.value=e.preferences;return;case`update`:Yt.value=e.update;return;case`settings`:Ye(()=>{let t=M.value?.provider!==e.settings.provider;M.value=e.settings,t&&($t.value=null,en.value=null,tn.value=null)});return;case`thread.upsert`:bn(e.thread);return;case`thread.removed`:{let t=new Map(Qt.value);t.delete(e.threadId),Qt.value=t;return}case`provider.models`:tn.value={provider:e.provider,models:e.models,defaultModel:e.defaultModel};return;case`provider.threads`:Ye(()=>{$t.value=e.threads,en.value=e.project});return;case`error`:on.value={message:e.message,threadId:e.threadId,at:Date.now()};return}}function Cn(e){return M.value?.providers.find(t=>t.id===e)?.label??e}function wn(){sn?.readyState===WebSocket.OPEN&&sn.send(JSON.stringify({type:`provider.threads`}))}function Tn(){sn?.readyState===WebSocket.OPEN&&sn.send(JSON.stringify({type:`provider.models`}))}function En(e){for(let t of Qt.value.values())if(t.provider.threadId===e.id&&!t.anchor)return t.id;let t=Ht();return N({type:`thread.open`,id:t,providerThreadId:e.id,title:e.title})?t:null}let Dn=`tencil:shortcuts`,On=[`Alt`,`Control`,`Meta`,`Shift`],kn=/* @__PURE__ */ new Set([`KeyC`,`KeyV`,`KeyX`,`KeyA`,`KeyZ`,`KeyR`,`KeyL`,`KeyT`,`KeyW`]),An=(e,t,n={})=>({code:e,key:t,alt:!1,ctrl:!1,meta:!1,shift:!1,...n}),jn={comment:An(`KeyC`,`C`),ruler:An(`KeyR`,`R`),hidePins:null,hideDock:An(`KeyT`,`T`,{alt:!0}),measure:`Alt`},Mn=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),Nn=A(Yn()),Pn=A(!1);function Fn(e){Ln(e),N({type:`preferences.update`,preferences:{shortcuts:e}})}function In(){Fn(jn)}mt(()=>{let e=Xt.value;e&&(e.shortcuts?Jn(e.shortcuts,Nn.peek())||Ln(e.shortcuts):Rn()!==null&&N({type:`preferences.update`,preferences:{shortcuts:Nn.peek()}}))});function Ln(e){Nn.value=e;try{localStorage.setItem(Dn,JSON.stringify(e))}catch{}}function Rn(){try{return localStorage.getItem(Dn)}catch{return null}}function zn(e,t){return e!==null&&t.code===e.code&&t.altKey===e.alt&&t.ctrlKey===e.ctrl&&t.metaKey===e.meta&&t.shiftKey===e.shift}function Bn(e,t){switch(e){case`Alt`:return t.altKey;case`Control`:return t.ctrlKey;case`Meta`:return t.metaKey;case`Shift`:return t.shiftKey;default:return!1}}function Vn(e){return On.includes(e)}function Hn(e,t=Mn){return t?`${e.ctrl?`⌃`:``}${e.alt?`⌥`:``}${e.shift?`⇧`:``}${e.meta?`⌘`:``}${e.key}`:[e.ctrl&&`Ctrl`,e.alt&&`Alt`,e.shift&&`Shift`,e.meta&&`Win`,e.key].filter(Boolean).join(`+`)}function Un(e,t=Mn){return t?{Alt:`⌥ Option`,Control:`⌃ Control`,Meta:`⌘ Command`,Shift:`⇧ Shift`}[e]:{Alt:`Alt`,Control:`Ctrl`,Meta:`Win`,Shift:`Shift`}[e]}let Wn=j(()=>{let e=Nn.value,t=e=>e?Hn(e):null;return{comment:t(e.comment),ruler:t(e.ruler),hidePins:t(e.hidePins),hideDock:Hn(e.hideDock),measure:e.measure?Un(e.measure):null}});function Gn(e){let{key:t=``,code:n=``}=e;return Vn(t)?null:t===`Escape`||t===`Tab`||t===`Enter`?{error:`${t} is kept for leaving fields and dialogs.`}:(e.ctrlKey||e.metaKey)&&kn.has(n)?{error:`The browser or the page already uses that one.`}:{code:n,key:Kn(t,n,e.altKey),alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey}}function Kn(e,t,n){return e.length===1&&e!==` `&&!n?e.toUpperCase():t.startsWith(`Key`)?t.slice(3):t.startsWith(`Digit`)?t.slice(5):t===`Space`?`Space`:e.length===1?e.toUpperCase():e}function qn(e,t){return e!==null&&t!==null&&e.code===t.code&&e.alt===t.alt&&e.ctrl===t.ctrl&&e.meta===t.meta&&e.shift===t.shift}function Jn(e,t){let n=(e,t)=>e===t||qn(e,t)&&e?.key===t?.key;return e.measure===t.measure&&n(e.comment,t.comment)&&n(e.ruler,t.ruler)&&n(e.hidePins,t.hidePins)&&n(e.hideDock,t.hideDock)}function Yn(){try{let e=JSON.parse(localStorage.getItem(Dn)??`null`);if(!e||typeof e!=`object`)return jn;let t=e=>e===null||typeof e==`object`&&typeof e.code==`string`&&typeof e.key==`string`;return{comment:t(e.comment)?e.comment:jn.comment,ruler:t(e.ruler)?e.ruler:jn.ruler,hidePins:t(e.hidePins)?e.hidePins:jn.hidePins,hideDock:e.hideDock&&t(e.hideDock)?e.hideDock:jn.hideDock,measure:e.measure===null||Vn(e.measure??void 0)?e.measure??null:jn.measure}}catch{return jn}}let Xn=A(`idle`),Zn=A(null),Qn=A(!1),$n=A(null),P=A(null),F=A(null),er=A(!1),tr=A(!1),nr=A(`overview`),rr=A(!1),ir=A(!1),ar=j(()=>M.value?.batch??!1),or=A(!1),sr=j(()=>ar.value&&or.value);function cr(e){let t=M.value;t&&N({type:`settings.update`,batch:e})&&(M.value={...t,batch:e})}let lr=`tencil:ruler`,ur=`tencil:dock-hidden`,dr=A(yr(ur)),fr=A(0);function pr(e){dr.value=e,fr.value=e?Date.now():0,br(ur,e),e&&(jr(),P.value=null,$n.value=null,F.value=null,er.value=!1,tr.value=!1)}let mr=j(()=>{let e=M.value;return e!==null&&e.ruler!==!1}),hr=A(yr(lr)),gr=j(()=>mr.value&&hr.value&&!dr.value);function _r(e){let t=M.value;t&&N({type:`settings.update`,ruler:e})&&(M.value={...t,ruler:e})}function vr(){hr.value=!hr.value,$n.value=null,br(lr,hr.value)}function yr(e){try{return localStorage.getItem(e)===`on`}catch{return!1}}function br(e,t){try{localStorage.setItem(e,t?`on`:`off`)}catch{}}let xr=A(null),Sr=A(0),Cr=A(wr(location.href));function wr(e){try{let t=new URL(e);return`${t.origin}${t.pathname.replace(/\/$/,``)||`/`}`}catch{return e}}let Tr=j(()=>[...Qt.value.values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt))),Er=j(()=>Tr.value.filter(e=>e.anchor&&e.pageUrl&&wr(e.pageUrl)===Cr.value).filter(e=>rr.value||!e.resolved).reverse()),Dr=j(()=>Tr.value.filter(e=>!e.resolved).length),Or=j(()=>[...Tr.value].reverse().filter(e=>e.status===`draft`)),kr=j(()=>Tr.value.filter(e=>e.status===`working`||e.status===`starting`).length);function Ar(){At.value||(P.value=null,$n.value=null,F.value=null,Xn.value=`picking`)}function jr(){Xn.value=`idle`,Zn.value=null}function Mr(e){let{key:t,storageKey:n,fallback:r,parse:i,serialize:a=String}=e,o=()=>{try{return localStorage.getItem(n)}catch{return null}},s=o(),c=A((s===null?void 0:i(s))??r),l=e=>{c.value=e;try{localStorage.setItem(n,a(e))}catch{}},u=e=>N({type:`preferences.update`,preferences:{[t]:e}});return mt(()=>{let e=Xt.value;if(!e)return;let n=e[t];n===void 0?o()!==null&&u(c.peek()):n!==c.peek()&&l(n)}),[c,e=>{l(e),u(e)}]}let Nr=[`dark`,`light`,`system`],[Pr,Fr]=Mr({key:`theme`,storageKey:`tencil:theme`,fallback:`dark`,parse:e=>Nr.includes(e)?e:void 0}),Ir=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):void 0,Lr=A(Ir?.matches??!0);Ir?.addEventListener(`change`,e=>{Lr.value=e.matches});let Rr=j(()=>Pr.value===`system`?Lr.value:Pr.value===`dark`),zr=`bippy-0.7.3`,Br=Object.defineProperty,Vr=()=>{
2
2
  /**
3
3
  * @license bippy
4
4
  *
@@ -7,7 +7,7 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- },Br=e=>e.__REACT_DEVTOOLS_GLOBAL_HOOK__,Vr=e=>Object.assign(e,{[Symbol.dispose]:e}),Hr=e=>{let t=e.current.memoizedState;return t===null||t!==void 0&&(t.element===null||t.element===void 0)},Ur=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},Wr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e&&e._isBippyHook!==!0),Gr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>{if(!e||typeof e.inject!=`function`||Wr(e))return!1;try{return Function.prototype.toString.call(e.inject).includes(`(injected)`)}catch{return!1}},Kr=/* @__PURE__ */ new Set,qr=/* @__PURE__ */ new Set,Jr=/* @__PURE__ */ new WeakMap,Yr=/* @__PURE__ */ new Set,Xr=/* @__PURE__ */ new Set,Zr=/* @__PURE__ */ new WeakMap,Qr=(e,t)=>{Kr.add(e);let n=Jr.get(e)??/* @__PURE__ */ new Set;n.add(t),Jr.set(e,n)},$r=e=>{for(let t of Kr)Jr.get(t)?.has(e)&&t()},ei=(e,t)=>{for(let n of Yr)n.target===e&&n.listener(t)},ti=(e,t)=>{for(let n of Xr)n(e,t)},ni=e=>(Xr.add(e),Vr(()=>{Xr.delete(e)})),ri=e=>Object.prototype.toString.call(e)===`[object Map]`,ii=e=>(ri(e.renderers)||(e.renderers=/* @__PURE__ */ new Map),e.renderers),ai=(e,t,n,r,i)=>{n.set(r,i),qr.add(i),e._instrumentationIsActive||(e._instrumentationIsActive=!0,$r(t));let a=Zr.get(t)??/* @__PURE__ */ new WeakSet;Zr.set(t,a),!a.has(i)&&(a.add(i),ei(t,i))},oi=(e,t=globalThis)=>{e&&Qr(e,t);let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=e=>{let t=r.get(e)??/* @__PURE__ */ new Set;return r.set(e,t),t},a=0,o={_instrumentationIsActive:!1,_instrumentationSource:Lr,_isBippyHook:!0,checkDCE:Ur,getFiberRoots:i,hasUnsupportedRendererAttached:!1,inject:e=>{let r=++a;return ai(o,t,n,r,e),r},on:zr,onCommitFiberRoot:(e,t)=>{let n=i(e);Hr(t)?n.delete(t):n.add(t)},onCommitFiberUnmount:zr,onPostCommitFiberRoot:zr,renderers:n,supportsFiber:!0,supportsFlight:!0};try{if(Rr(t,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get:()=>o,set:n=>{if(n&&typeof n==`object`){let r=o.renderers;o=n;let i=ii(o);r.forEach((e,t)=>{qr.add(e),i.set(t,e)}),(r.size>0||Xr.size>0)&&si(e,t),ti(o,t)}}}),t===globalThis&&typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,r=()=>{t?Rr(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};Rr(window,`hasOwnProperty`,{configurable:!0,value:t=>!n&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(n=!0,r(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{si(e,t)}return o},si=(e,t=globalThis)=>{e&&Qr(e,t);let n=!1,r=Br(t);if(!r)return;let i=ii(r);if(!r._instrumentationSource){r.checkDCE=Ur,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=Lr,r._instrumentationIsActive=!1;let e=Wr(r);e||(r.on=zr),i.size?(i.forEach(e=>qr.add(e)),r._instrumentationIsActive=!0,$r(t),n=!0):!e&&Gr(r)&&(r._instrumentationIsActive=!0,$r(t),n=!0);let a=r.inject;r.inject=e=>{let n=a.call(r,e);return ai(r,t,i,n,e),n}}!n&&(i.size||r._instrumentationIsActive)&&e?.()},ci=(e=globalThis)=>Object.hasOwn(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),li=(e,t=globalThis)=>ci(t)?(si(e,t),Br(t)??oi(e,t)):oi(e,t);
10
+ },Hr=e=>e.__REACT_DEVTOOLS_GLOBAL_HOOK__,Ur=e=>Object.assign(e,{[Symbol.dispose]:e}),Wr=e=>{let t=e.current.memoizedState;return t===null||t!==void 0&&(t.element===null||t.element===void 0)},Gr=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://react.dev/link/perf-use-production-build`)})}catch{}},Kr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e&&e._isBippyHook!==!0),qr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>{if(!e||typeof e.inject!=`function`||Kr(e))return!1;try{return Function.prototype.toString.call(e.inject).includes(`(injected)`)}catch{return!1}},Jr=/* @__PURE__ */ new Set,Yr=/* @__PURE__ */ new Set,Xr=/* @__PURE__ */ new WeakMap,Zr=/* @__PURE__ */ new Set,Qr=/* @__PURE__ */ new Set,$r=/* @__PURE__ */ new WeakMap,ei=(e,t)=>{Jr.add(e);let n=Xr.get(e)??/* @__PURE__ */ new Set;n.add(t),Xr.set(e,n)},ti=e=>{for(let t of Jr)Xr.get(t)?.has(e)&&t()},ni=(e,t)=>{for(let n of Zr)n.target===e&&n.listener(t)},ri=(e,t)=>{for(let n of Qr)n(e,t)},ii=e=>(Qr.add(e),Ur(()=>{Qr.delete(e)})),ai=e=>Object.prototype.toString.call(e)===`[object Map]`,oi=e=>(ai(e.renderers)||(e.renderers=/* @__PURE__ */ new Map),e.renderers),si=(e,t,n,r,i)=>{n.set(r,i),Yr.add(i),e._instrumentationIsActive||(e._instrumentationIsActive=!0,ti(t));let a=$r.get(t)??/* @__PURE__ */ new WeakSet;$r.set(t,a),!a.has(i)&&(a.add(i),ni(t,i))},ci=(e,t=globalThis)=>{e&&ei(e,t);let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=e=>{let t=r.get(e)??/* @__PURE__ */ new Set;return r.set(e,t),t},a=0,o={_instrumentationIsActive:!1,_instrumentationSource:zr,_isBippyHook:!0,checkDCE:Gr,getFiberRoots:i,hasUnsupportedRendererAttached:!1,inject:e=>{let r=++a;return si(o,t,n,r,e),r},on:Vr,onCommitFiberRoot:(e,t)=>{let n=i(e);Wr(t)?n.delete(t):n.add(t)},onCommitFiberUnmount:Vr,onPostCommitFiberRoot:Vr,renderers:n,supportsFiber:!0,supportsFlight:!0};try{if(Br(t,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get:()=>o,set:n=>{if(n&&typeof n==`object`){let r=o.renderers;o=n;let i=oi(o);r.forEach((e,t)=>{Yr.add(e),i.set(t,e)}),(r.size>0||Qr.size>0)&&li(e,t),ri(o,t)}}}),t===globalThis&&typeof window<`u`){let e=window.hasOwnProperty.bind(window),t=Object.getOwnPropertyDescriptor(window,`hasOwnProperty`),n=!1,r=()=>{t?Br(window,`hasOwnProperty`,t):Reflect.deleteProperty(window,`hasOwnProperty`)};Br(window,`hasOwnProperty`,{configurable:!0,value:t=>!n&&t===`__REACT_DEVTOOLS_GLOBAL_HOOK__`?(n=!0,r(),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,!1):e(t),writable:!0})}}catch{li(e,t)}return o},li=(e,t=globalThis)=>{e&&ei(e,t);let n=!1,r=Hr(t);if(!r)return;let i=oi(r);if(!r._instrumentationSource){r.checkDCE=Gr,r.supportsFiber=!0,r.supportsFlight=!0,r.hasUnsupportedRendererAttached=!1,r._instrumentationSource=zr,r._instrumentationIsActive=!1;let e=Kr(r);e||(r.on=Vr),i.size?(i.forEach(e=>Yr.add(e)),r._instrumentationIsActive=!0,ti(t),n=!0):!e&&qr(r)&&(r._instrumentationIsActive=!0,ti(t),n=!0);let a=r.inject;r.inject=e=>{let n=a.call(r,e);return si(r,t,i,n,e),n}}!n&&(i.size||r._instrumentationIsActive)&&e?.()},ui=(e=globalThis)=>Object.hasOwn(e,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),di=(e,t=globalThis)=>ui(t)?(li(e,t),Hr(t)??ci(e,t)):ci(e,t);
11
11
  /**
12
12
  * @license bippy
13
13
  *
@@ -16,7 +16,7 @@
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
18
  */
19
- try{li()}catch{}
19
+ try{di()}catch{}
20
20
  /**
21
21
  * @license bippy
22
22
  *
@@ -25,7 +25,7 @@ try{li()}catch{}
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
27
  */
28
- let ui=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,di=/^\d+$/,fi=e=>pi(e)!==null,pi=e=>{let t=ui.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>di.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},mi=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,hi=(e,t)=>{let n=di.test(e),r=di.test(t);return n&&r?mi(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},gi=(e,t)=>{if(e.length===0||t.length===0)return e.length===t.length?0:e.length===0?1:-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===void 0||i===void 0)return n===void 0?-1:1;let a=hi(n,i);if(a!==0)return a}return 0},_i=(e,t)=>{let n=pi(e),r=pi(t);if(!n||!r)return null;let i=mi(n.major,r.major);if(i!==0)return i;let a=mi(n.minor,r.minor);if(a!==0)return a;let o=mi(n.patch,r.patch);return o===0?gi(n.prerelease,r.prerelease):o},vi={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},yi=(e=>e)({"16.0.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:9},"16.4.3-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostHoistable:-1,HostPortal:6,HostRoot:5,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"16.6.0-beta.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.0-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.2":{ActivityComponent:31,CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:26,HostPortal:4,HostRoot:3,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:29,TracingMarkerComponent:25,ViewTransitionComponent:30,YieldComponent:-1}}),bi=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:yi[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:yi[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:yi[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:yi[`16.4.3-alpha`]}],xi=yi[`17.0.2`],Si=e=>{if(e===void 0)return xi;for(let t of bi){let n=_i(e,t.minimumVersion);if(n===null)return xi;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return yi[`16.0.0`]},Ci=Si(),wi=/* @__PURE__ */ new WeakMap,Ti=e=>e.startsWith(`0.0.0-`)?Ci:Si(e),Ei=e=>{let t=e?.reconcilerVersion;return t&&fi(t)?Ti(t):e?.version?Ti(e.version):Ci},Di=(e,t)=>{let n=Ei(t);wi.set(e,n),e.alternate&&wi.set(e.alternate,n)},Oi=e=>{let t=wi.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=wi.get(r)??Ci;for(let e of n)wi.set(e,i),e.alternate&&wi.set(e.alternate,i);return i};vi.Placement|vi.Update|vi.ChildDeletion|vi.ContentReset|vi.Hydrating|vi.Visibility|vi.Snapshot;var ki=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},Ai=class extends ki{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},ji=class extends Ai{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},Mi=class extends ki{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let Ni=e=>typeof e==`function`,Pi=e=>{let t=`displayName`in e?e.displayName:null;if(typeof t==`string`&&t)return t;let n=`name`in e?e.name:null;return typeof n==`string`&&n?n:null},Fi=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Ii=e=>{let t=Oi(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},Li=e=>{let t=Oi(e);switch(e.tag){case t.ClassComponent:case t.ForwardRef:case t.FunctionComponent:case t.MemoComponent:case t.SimpleMemoComponent:return!0;default:return!1}};function Ri(e,t,n=!1){if(!e)return null;let r=t(e);return zi(r)?Promise.resolve(r).then(r=>r===!0?e:Bi(e,t,n)):r===!0?e:Bi(e,t,n)}let zi=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Bi=(e,t,n)=>{let r=n?e.return:e.child;return Vi(r,t,n)},Vi=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=Ri(e,t,n);return zi(i)?Promise.resolve(i).then(e=>e??Vi(r,t,n)):i??Vi(r,t,n)},Hi=e=>Ni(e)?e:typeof e!=`object`||!e?null:Hi(Reflect.get(e,`type`)??Reflect.get(e,`render`)),Ui=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=Pi(e);if(t)return t;let n=Hi(e);return n?Pi(n):null},Wi=/* @__PURE__ */ new Set,Gi=/* @__PURE__ */ new WeakMap,Ki=/* @__PURE__ */ new WeakMap,qi=/* @__PURE__ */ new WeakMap,Ji=/* @__PURE__ */ new Map;typeof FinalizationRegistry==`function`&&new FinalizationRegistry(e=>{Ji.get(e)?.deref()||Ji.delete(e)});let Yi=e=>{let t=e.alternate?[e,e.alternate]:[e],n=/* @__PURE__ */ new Set;for(let e of t){let t=qi.get(e);t!==void 0&&n.add(t),qi.delete(e)}for(let e of n){let n=Ji.get(e)?.deref();(!n||t.includes(n))&&Ji.delete(e)}},Xi=/* @__PURE__ */ new Set,Zi=/* @__PURE__ */ new WeakMap,Qi=/* @__PURE__ */ new WeakMap,$i=!1,ea=e=>{let t=Zi.get(e)??{};if(Zi.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a,o)=>{if(n&&n.call(e,t,i,a,o),Zi.get(e)?.onCommitFiberRoot===r){Di(i.current,e.renderers.get(t)),Hr(i)?(Wi.delete(i),Gi.delete(i),Ki.delete(i)):(Wi.add(i),Gi.set(i,t),Ki.set(i,e));for(let{options:n,target:r}of Xi)r===Qi.get(e)&&n.onCommitFiberRoot&&n.onCommitFiberRoot(t,i,a,o)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(Di(i,e.renderers.get(t)),n&&n.call(e,t,i),Zi.get(e)?.onCommitFiberUnmount===r)try{for(let{options:n,target:r}of Xi)r===Qi.get(e)&&n.onCommitFiberUnmount&&n.onCommitFiberUnmount(t,i)}finally{Yi(i)}};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n&&n.call(e,t,i),Zi.get(e)?.onPostCommitFiberRoot===r)for(let{options:n,target:r}of Xi)r===Qi.get(e)&&n.onPostCommitFiberRoot&&n.onPostCommitFiberRoot(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n&&n.call(e,t,i,a),Zi.get(e)?.onScheduleFiberRoot===r)for(let{options:n,target:r}of Xi)r===Qi.get(e)&&n.onScheduleFiberRoot&&n.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},ta=(e,t)=>{Qi.set(e,t),ea(e)},na=(e,t=globalThis)=>{$i||=(ni(ta),!0),Qi.set(e,t),ea(e)};try{ci()&&na(li())}catch{}let ra=/* @__PURE__ */ new Set,ia=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),aa=e=>{let t=Reflect.get(e,`_reactRootContainer`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`_internalRoot`);if(typeof n!=`object`||!n)return null;let r=Reflect.get(n,`current`);if(typeof r!=`object`||!r)return null;let i=Reflect.get(r,`child`);return Fi(i)?i:null},oa=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return Fi(t)?t:null},sa=e=>{if(typeof e!=`object`||!e)return e;let t=Reflect.get(e,`canonical`);if(typeof t==`object`&&t){let e=Reflect.get(t,`publicInstance`);if(typeof e==`object`&&e)return e}let n=Reflect.get(e,`_nativeTag`);return typeof n==`number`?n:e},ca=(e,t=globalThis)=>{let n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n)for(let t of n.renderers.values())try{let n=t.findFiberByHostInstance?.(e);if(n)return n}catch{}if(typeof e==`object`&&e){let t=aa(e);if(t)return t;let n=oa(e);if(n)return n;for(let t of ra){let n=Reflect.get(e,t);if(Fi(n))return n}for(let t of Object.keys(e))if(ia(t)){ra.add(t);let n=Reflect.get(e,t);if(Fi(n))return n}}if(e!=null&&(typeof e==`object`||typeof e==`number`)){let t=/* @__PURE__ */ new Set;if(n?.getFiberRoots)for(let e of n.renderers.keys())for(let r of n.getFiberRoots(e))t.add(r);for(let e of Wi)Ki.get(e)===n&&t.add(e);for(let n of t){let t=Ri(n.current,t=>Ii(t)&&sa(t.stateNode)===e);if(t)return t}}return null};Reflect.get(/* @__PURE__ */ t({useEffect:()=>void 0,useReducer:()=>void 0,useRef:()=>void 0}),`useSyncExternalStore`);
28
+ let fi=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,pi=/^\d+$/,mi=e=>hi(e)!==null,hi=e=>{let t=fi.exec(e);if(!t)return null;let n=t[4]?.split(`.`)??[];return n.some(e=>pi.test(e)&&e.length>1&&e.startsWith(`0`))?null:{major:t[1],minor:t[2],patch:t[3],prerelease:n}},gi=(e,t)=>e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1,_i=(e,t)=>{let n=pi.test(e),r=pi.test(t);return n&&r?gi(e,t):n===r?e===t?0:e<t?-1:1:n?-1:1},vi=(e,t)=>{if(e.length===0||t.length===0)return e.length===t.length?0:e.length===0?1:-1;let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===void 0||i===void 0)return n===void 0?-1:1;let a=_i(n,i);if(a!==0)return a}return 0},yi=(e,t)=>{let n=hi(e),r=hi(t);if(!n||!r)return null;let i=gi(n.major,r.major);if(i!==0)return i;let a=gi(n.minor,r.minor);if(a!==0)return a;let o=gi(n.patch,r.patch);return o===0?vi(n.prerelease,r.prerelease):o},bi={ChildDeletion:16,Cloned:8,ContentReset:32,Hydrating:4096,PerformedWork:1,Placement:2,Snapshot:1024,Update:4,Visibility:8192},xi=(e=>e)({"16.0.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:9},"16.4.3-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostHoistable:-1,HostPortal:6,HostRoot:5,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IncompleteFunctionComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"16.6.0-beta.0":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.0-alpha":{ActivityComponent:-1,CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:-1,HostPortal:4,HostRoot:3,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:-1,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:-1,TracingMarkerComponent:-1,ViewTransitionComponent:-1,YieldComponent:-1},"17.0.2":{ActivityComponent:31,CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostHoistable:26,HostPortal:4,HostRoot:3,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IncompleteFunctionComponent:28,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,Throw:29,TracingMarkerComponent:25,ViewTransitionComponent:30,YieldComponent:-1}}),Si=[{isMinimumExcluded:!0,minimumVersion:`17.0.1`,workTags:xi[`17.0.2`]},{isMinimumExcluded:!1,minimumVersion:`17.0.0-alpha`,workTags:xi[`17.0.0-alpha`]},{isMinimumExcluded:!1,minimumVersion:`16.6.0-beta.0`,workTags:xi[`16.6.0-beta.0`]},{isMinimumExcluded:!1,minimumVersion:`16.4.3-alpha`,workTags:xi[`16.4.3-alpha`]}],Ci=xi[`17.0.2`],wi=e=>{if(e===void 0)return Ci;for(let t of Si){let n=yi(e,t.minimumVersion);if(n===null)return Ci;if(n===1||n===0&&!t.isMinimumExcluded)return t.workTags}return xi[`16.0.0`]},Ti=wi(),Ei=/* @__PURE__ */ new WeakMap,Di=e=>e.startsWith(`0.0.0-`)?Ti:wi(e),Oi=e=>{let t=e?.reconcilerVersion;return t&&mi(t)?Di(t):e?.version?Di(e.version):Ti},ki=(e,t)=>{let n=Oi(t);Ei.set(e,n),e.alternate&&Ei.set(e.alternate,n)},Ai=e=>{let t=Ei.get(e);if(t)return t;let n=[e],r=e;for(;r.return;)r=r.return,n.push(r);let i=Ei.get(r)??Ti;for(let e of n)Ei.set(e,i),e.alternate&&Ei.set(e.alternate,i);return i};bi.Placement|bi.Update|bi.ChildDeletion|bi.ContentReset|bi.Hydrating|bi.Visibility|bi.Snapshot;var ji=class extends Error{constructor(e,t){super(e,{cause:t}),this.name=`BippyError`}},Mi=class extends ji{constructor(e,t){super(e,t),this.name=`BippyHookInspectionError`}},Ni=class extends Mi{constructor(e,t){super(e,t),this.name=`BippyUnsupportedHookError`}},Pi=class extends ji{constructor(e,t){super(e,t),this.name=`BippySourceMapError`}};let Fi=e=>typeof e==`function`,Ii=e=>{let t=`displayName`in e?e.displayName:null;if(typeof t==`string`&&t)return t;let n=`name`in e?e.name:null;return typeof n==`string`&&n?n:null},Li=e=>typeof e==`object`&&!!e&&`tag`in e&&`stateNode`in e&&`return`in e&&`child`in e&&`sibling`in e&&`flags`in e,Ri=e=>{let t=Ai(e);switch(e.tag){case t.HostComponent:case t.HostText:case t.HostHoistable:case t.HostSingleton:return!0;default:return!1}},zi=e=>{let t=Ai(e);switch(e.tag){case t.ClassComponent:case t.ForwardRef:case t.FunctionComponent:case t.MemoComponent:case t.SimpleMemoComponent:return!0;default:return!1}};function Bi(e,t,n=!1){if(!e)return null;let r=t(e);return Vi(r)?Promise.resolve(r).then(r=>r===!0?e:Hi(e,t,n)):r===!0?e:Hi(e,t,n)}let Vi=e=>(typeof e==`object`||typeof e==`function`)&&e!==null&&`then`in e&&typeof e.then==`function`,Hi=(e,t,n)=>{let r=n?e.return:e.child;return Ui(r,t,n)},Ui=(e,t,n)=>{if(!e)return null;let r=n?null:e.sibling,i=Bi(e,t,n);return Vi(i)?Promise.resolve(i).then(e=>e??Ui(r,t,n)):i??Ui(r,t,n)},Wi=e=>Fi(e)?e:typeof e!=`object`||!e?null:Wi(Reflect.get(e,`type`)??Reflect.get(e,`render`)),Gi=e=>{if(typeof e==`string`)return e;if(typeof e!=`function`&&typeof e!=`object`||e===null)return null;let t=Ii(e);if(t)return t;let n=Wi(e);return n?Ii(n):null},Ki=/* @__PURE__ */ new Set,qi=/* @__PURE__ */ new WeakMap,Ji=/* @__PURE__ */ new WeakMap,Yi=/* @__PURE__ */ new WeakMap,Xi=/* @__PURE__ */ new Map;typeof FinalizationRegistry==`function`&&new FinalizationRegistry(e=>{Xi.get(e)?.deref()||Xi.delete(e)});let Zi=e=>{let t=e.alternate?[e,e.alternate]:[e],n=/* @__PURE__ */ new Set;for(let e of t){let t=Yi.get(e);t!==void 0&&n.add(t),Yi.delete(e)}for(let e of n){let n=Xi.get(e)?.deref();(!n||t.includes(n))&&Xi.delete(e)}},Qi=/* @__PURE__ */ new Set,$i=/* @__PURE__ */ new WeakMap,ea=/* @__PURE__ */ new WeakMap,ta=!1,na=e=>{let t=$i.get(e)??{};if($i.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a,o)=>{if(n&&n.call(e,t,i,a,o),$i.get(e)?.onCommitFiberRoot===r){ki(i.current,e.renderers.get(t)),Wr(i)?(Ki.delete(i),qi.delete(i),Ji.delete(i)):(Ki.add(i),qi.set(i,t),Ji.set(i,e));for(let{options:n,target:r}of Qi)r===ea.get(e)&&n.onCommitFiberRoot&&n.onCommitFiberRoot(t,i,a,o)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(ki(i,e.renderers.get(t)),n&&n.call(e,t,i),$i.get(e)?.onCommitFiberUnmount===r)try{for(let{options:n,target:r}of Qi)r===ea.get(e)&&n.onCommitFiberUnmount&&n.onCommitFiberUnmount(t,i)}finally{Zi(i)}};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n&&n.call(e,t,i),$i.get(e)?.onPostCommitFiberRoot===r)for(let{options:n,target:r}of Qi)r===ea.get(e)&&n.onPostCommitFiberRoot&&n.onPostCommitFiberRoot(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n&&n.call(e,t,i,a),$i.get(e)?.onScheduleFiberRoot===r)for(let{options:n,target:r}of Qi)r===ea.get(e)&&n.onScheduleFiberRoot&&n.onScheduleFiberRoot(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},ra=(e,t)=>{ea.set(e,t),na(e)},ia=(e,t=globalThis)=>{ta||=(ii(ra),!0),ea.set(e,t),na(e)};try{ui()&&ia(di())}catch{}let aa=/* @__PURE__ */ new Set,oa=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),sa=e=>{let t=Reflect.get(e,`_reactRootContainer`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`_internalRoot`);if(typeof n!=`object`||!n)return null;let r=Reflect.get(n,`current`);if(typeof r!=`object`||!r)return null;let i=Reflect.get(r,`child`);return Li(i)?i:null},ca=e=>{let t=Reflect.get(e,`__internalInstanceHandle`)??Reflect.get(e,`_internalInstanceHandle`);return Li(t)?t:null},la=e=>{if(typeof e!=`object`||!e)return e;let t=Reflect.get(e,`canonical`);if(typeof t==`object`&&t){let e=Reflect.get(t,`publicInstance`);if(typeof e==`object`&&e)return e}let n=Reflect.get(e,`_nativeTag`);return typeof n==`number`?n:e},ua=(e,t=globalThis)=>{let n=t.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n)for(let t of n.renderers.values())try{let n=t.findFiberByHostInstance?.(e);if(n)return n}catch{}if(typeof e==`object`&&e){let t=sa(e);if(t)return t;let n=ca(e);if(n)return n;for(let t of aa){let n=Reflect.get(e,t);if(Li(n))return n}for(let t of Object.keys(e))if(oa(t)){aa.add(t);let n=Reflect.get(e,t);if(Li(n))return n}}if(e!=null&&(typeof e==`object`||typeof e==`number`)){let t=/* @__PURE__ */ new Set;if(n?.getFiberRoots)for(let e of n.renderers.keys())for(let r of n.getFiberRoots(e))t.add(r);for(let e of Ki)Ji.get(e)===n&&t.add(e);for(let n of t){let t=Bi(n.current,t=>Ri(t)&&la(t.stateNode)===e);if(t)return t}}return null};Reflect.get(/* @__PURE__ */ t({useEffect:()=>void 0,useReducer:()=>void 0,useRef:()=>void 0}),`useSyncExternalStore`);
29
29
  /**
30
30
  * @license bippy
31
31
  *
@@ -42,33 +42,33 @@ let ui=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
44
  */
45
- let la=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,ua=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],da=[`rsc://`,`about://React/`],fa=[`<anonymous>`,`eval`,``],pa=/\.(cjs|cts|js|jsx|mdx|mjs|mts|ts|tsx)$/,ma=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,ha=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,ga=/\[[^\]]+\]$/,_a=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],va=Error,ya=()=>va.prepareStackTrace,ba=e=>{va.prepareStackTrace=e},xa=/(^|@)\S+:\d+/,Sa=/^\s*at .*(\S+:\d+|\(native\))/m,Ca=/^(eval@)?(\[native code\])?$/,wa=(e,t)=>{if(t?.includeInElement!==!1){let t=e.split(`
46
- `),n=[];for(let e of t)if(/^\s*at\s+/.test(e)){let t=Ea(e)[0];t&&n.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*(?:\(at .*\)|\[[^\]]+\])$/,``);n.push({functionName:t,source:e})}else if(e.match(xa)){let t=Da(e)[0];t&&n.push(t)}return n}return e.match(Sa)?Ea(e):Da(e)},Ta=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},Ea=e=>e.split(`
47
- `).filter(e=>!!e.match(Sa)).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=Ta(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`,`(native)`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),Da=e=>e.split(`
48
- `).filter(e=>!e.match(Ca)).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=Ta(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),Oa=/* @__PURE__ */ new WeakMap,ka=e=>_a.some(t=>e.includes(t)),Aa=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},ja=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=Aa(r);if(ka(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},Ma=e=>{let t=-1;for(let n of _a)if(t=e.indexOf(n),t!==-1)break;let n=t===-1?e:e.slice(0,e.lastIndexOf(`
49
- `,t));return{frames:wa(n).slice(1),isTrusted:t!==-1}},Na=e=>{let t=Oa.get(e);if(t)return t;let n=null,r=(e,t)=>{n=ja(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=ya();ba(r);let a;try{a=String(e.stack)}finally{ba(i)}let o=n??Ma(a);return Oa.set(e,o),o},Pa=(e=globalThis)=>{let t=li(void 0,e),n=ri(t.renderers)?t.renderers.values():[],r=e===globalThis?/* @__PURE__ */ new Set([...qr,...n]):new Set(n),i=[],a=/* @__PURE__ */ new Set;for(let e of r){let t=e.currentDispatcherRef;!t||a.has(t)||(a.add(t),i.push(t))}return i},Fa=e=>`H`in e?e.H:e.current,Ia=(e,t)=>{`H`in e?e.H=t:e.current=t};var La=44,Ra=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,za=/* @__PURE__ */ new Uint8Array(64),Ba=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<Ra.length;e++){let t=Ra.charCodeAt(e);za[e]=t,Ba[t]=e}function Va(e,t){let n=0,r=0,i=0;do i=Ba[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Ha(e,t){return e.pos>=t?!1:e.peek()!==La}var Ua=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function Wa(e){let{length:t}=e,n=new Ua(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Va(n,i),i<u&&(l=!1),u=i,Ha(n,e)?(a=Va(n,a),o=Va(n,o),s=Va(n,s),Ha(n,e)?(c=Va(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Ga(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Ga(e){e.sort(Ka)}function Ka(e,t){return e[0]-t[0]}let qa=/^data:application\/json(?:;[^,]*)?,/i,Ja=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Ya=/* @__PURE__ */ new Map,Xa=/* @__PURE__ */ new WeakMap;var Za=class extends Error{};let Qa=/* @__PURE__ */ new Map,$a=/* @__PURE__ */ new WeakMap,eo=/* @__PURE__ */ new Set([`chrome-extension:`,`moz-extension:`,`safari-web-extension:`]),to=/* @__PURE__ */ new Set([`http:`,`https:`,...eo]),no=(e,t,n,r)=>{let[,i,a,o,s]=e;if(i===void 0||a===void 0||o===void 0)return null;let c=t[i];return c?{columnNumber:o,fileName:c,functionName:s===void 0?void 0:r?.[s]||void 0,isIgnoreListed:n?.has(i)??!1,lineNumber:a+1}:null},ro=(e,t,n,r,i,a)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let s=null,c=0,l=o.length-1;for(;c<=l;){let e=c+l>>1;o[e][0]<=r?(s=o[e],c=e+1):l=e-1}return!s||s.length<4?null:no(s,t,i,a)},io=(e,t,n)=>{if(e.sections){let r=t-1,i=null;for(let t of e.sections)if(r>t.offset.line||r===t.offset.line&&n>=t.offset.column)i=t;else break;if(!i)return null;let a=r-i.offset.line,o=r===i.offset.line?n-i.offset.column:n;return ro(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices,i.map.names)}return ro(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices,e.names)},ao=(e,t)=>{if(qa.test(e))return e;try{return new URL(e,t).toString()}catch{try{return new URL(e).toString()}catch{try{let n=new URL(e,new URL(t,`https://bippy.invalid/`));return`${n.pathname}${n.search}${n.hash}`}catch{return null}}}},oo=e=>{try{let t=new URL(e),n=t.pathname.lastIndexOf(`.bundle`);if(n===-1)return null;let r=t.pathname.slice(n+7);if(r&&!r.startsWith(`//&`))return null;if(t.pathname=`${t.pathname.slice(0,n)}.map`,r){let e=new URLSearchParams(r.slice(3));for(let[n,r]of e)t.searchParams.set(n,r)}return t.hash=``,t.toString()}catch{return null}},so=(e,t,n)=>{let r=n.headers.get(`sourcemap`)??n.headers.get(`x-sourcemap`);if(r)return ao(r.trim(),e);let i,a=t.length;for(;a>0&&!i;){let e=t.lastIndexOf(`
50
- `,a-1)+1,n=t.slice(e,a).match(Ja);n&&(i=n[1]||n[2]),a=e-1}return i?ao(i,e):oo(e)},co=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`mappings`),r=Reflect.get(e,`file`),i=Reflect.get(e,`names`),a=Reflect.get(e,`sourceRoot`),o=Reflect.get(e,`sources`),s=Reflect.get(e,`sourcesContent`),c=Reflect.get(e,`ignoreList`),l=Reflect.get(e,`x_google_ignoreList`);if(t!==3||typeof n!=`string`||r!==void 0&&typeof r!=`string`||i!==void 0&&(!Array.isArray(i)||i.some(e=>typeof e!=`string`))||a!==void 0&&typeof a!=`string`||s!==void 0&&(!Array.isArray(s)||s.some(e=>typeof e!=`string`&&e!==null))||c!==void 0&&(!Array.isArray(c)||c.some(e=>!Number.isInteger(e)||e<0))||l!==void 0&&(!Array.isArray(l)||l.some(e=>!Number.isInteger(e)||e<0))||!Array.isArray(o)||o.some(e=>typeof e!=`string`)||s&&s.length!==o.length)return!1;let u=o.length;return[...c??[],...l??[]].every(e=>e<u)},lo=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`sections`);return t!==3||!Array.isArray(n)?!1:n.every(e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`map`),n=Reflect.get(e,`url`),r=Reflect.get(e,`offset`);if(typeof r!=`object`||!r)return!1;let i=Reflect.get(r,`column`),a=Reflect.get(r,`line`);return co(t)!==(typeof n==`string`&&n.length>0)&&typeof i==`number`&&Number.isInteger(i)&&i>=0&&typeof a==`number`&&Number.isInteger(a)&&a>=0})},uo=e=>{let t=e.ignoreList??e.x_google_ignoreList;return t?.length?new Set(t):void 0},fo=(e,t,n)=>{if(!e||la.test(t)||t.startsWith(`/`))return t;let r=e.endsWith(`/`)?e:`${e}/`,i=t.replace(/^\.\//,``);try{let e=la.test(r)?r:new URL(r,n).toString();return new URL(i,e).toString()}catch{let e=`${r}${i}`.split(`/`),t=[];for(let n of e)n===`..`?t.pop():n!==`.`&&t.push(n);return t.join(`/`)}},po=(e,t)=>e.sources.map(n=>fo(e.sourceRoot,n,t)),mo=e=>qa.test(e)?void 0:e,ho=(e,t)=>{try{return{file:e.file,ignoredSourceIndices:uo(e),mappings:Wa(e.mappings),names:e.names,sourceMapUrl:mo(t),sourceRoot:e.sourceRoot,sources:po(e,t),sourcesContent:e.sourcesContent,version:3}}catch{return null}},go=async(e,t,n)=>{let r=[],i=-1,a=-1;for(let o of e.sections){if(o.offset.line<i||o.offset.line===i&&o.offset.column<=a)return null;i=o.offset.line,a=o.offset.column;let e=o.url?ao(o.url,t):null,s=o.map??(e?await n(e):null);if(!s)return null;let c=e??t;try{r.push({map:{...s,ignoredSourceIndices:uo(s),mappings:Wa(s.mappings),sources:po(s,c)},offset:o.offset})}catch{return null}}let o=/* @__PURE__ */ new Set;for(let e of r)for(let t of e.map.sources)o.add(t);return{file:e.file,mappings:[],names:[],sections:r,sourceMapUrl:mo(t),sourceRoot:void 0,sources:Array.from(o),sourcesContent:void 0,version:3}},_o=(e,t=!1)=>{if(!e)return!1;let n=e.trim();if(!n)return!1;let r=n.match(la);if(!r)return!0;let i=r[0].toLowerCase();return t||to.has(i)},vo=()=>typeof window>`u`&&typeof process<`u`&&typeof process.versions?.node==`string`,yo=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!t.username&&!t.password}catch{return!1}},bo=e=>{try{return new URL(e).protocol}catch{return null}},xo=e=>{let t=bo(e);return t!==null&&eo.has(t)},So=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host}catch{return!1}},Co=(e,t,n,r)=>{if(qa.test(t))return!0;if(!_o(t,r))return!1;let i=bo(e),a=bo(t),o=i!==null&&!to.has(i)||a!==null&&!to.has(a);return!(n||o||xo(e)||xo(t))||So(e,t)},wo=e=>e===408||e===425||e===429||e>=500,To=e=>{if(e.ok)return!0;if(wo(e.status))throw new Za;return!1},Eo=(e,t,n)=>!n||t.url.length===0||So(e,t.url),Do=e=>{if(e.timeoutMs===void 0||e.timeoutMs<0)return{cleanup:()=>{},signal:e.signal};let t=new AbortController,n=()=>t.abort(e.signal?.reason);e.signal?.aborted?n():e.signal?.addEventListener(`abort`,n,{once:!0});let r=setTimeout(()=>t.abort(new Mi(`Source map request timed out`)),e.timeoutMs);return{cleanup:()=>{clearTimeout(r),e.signal?.removeEventListener(`abort`,n)},signal:t.signal}},Oo=async(e,t)=>{let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)return null;if(!e.body){let n=await e.text();return new TextEncoder().encode(n).byteLength>t?null:n}let r=e.body.getReader(),i=new TextDecoder,a=[],o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(o+=n.byteLength,o>t)return await r.cancel(),null;a.push(i.decode(n,{stream:!0}))}return a.push(i.decode()),a.join(``)}finally{r.releaseLock()}},ko=e=>{try{if(typeof globalThis.atob==`function`)return new TextDecoder().decode(Uint8Array.from(globalThis.atob(e),e=>e.charCodeAt(0)))}catch{return null}let t=e.replace(/\s/g,``).replace(/=+$/,``),n=[],r=0,i=0;for(let e of t){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(t===-1)return null;r=r*64+t,i+=6,i>=8&&(i-=8,n.push(Math.floor(r/2**i)&255),r%=2**i)}return new TextDecoder().decode(Uint8Array.from(n))},Ao=(e,t)=>{let n=e.indexOf(`,`);if(n===-1)return null;let r=e.slice(0,n),i=e.slice(n+1);if(i.length>t*2)return null;try{let e=r.toLowerCase().includes(`;base64`)?ko(i):decodeURIComponent(i);return e===null||new TextEncoder().encode(e).byteLength>t?null:JSON.parse(e)}catch{return null}},jo=async(e,t,n,r,i)=>{if(qa.test(e))return Ao(e,r);let a=await t(e,{redirect:i?`error`:`follow`,signal:n});if(!To(a)||!Eo(e,a,i))return null;let o=await Oo(a,r);if(o===null)return null;try{return JSON.parse(o)}catch{return null}},Mo=async(e,t,n={})=>{let r=t!==void 0;if(!_o(e,r))return null;let i=vo(),a=(i||xo(e))&&!n.allowCrossOriginSourceMap;if(i&&!t&&(!n.allowUnsafeServerFetch||!yo(e)))return null;let o=t??(typeof globalThis.fetch==`function`?globalThis.fetch.bind(globalThis):void 0);if(!o)return null;let s=n.maxBundleSizeBytes??26214400,c=n.maxSourceMapSizeBytes??104857600;if(s<0||c<0)return null;let l=Do(n);try{let t=await o(e,{redirect:a?`error`:`follow`,signal:l.signal});if(!To(t)||!Eo(e,t,a))return null;let n=await Oo(t,s);if(n===null)return null;let i=so(e,n,t);if(!i||!Co(e,i,a,r))return null;let u=await jo(i,o,l.signal,c,a);return co(u)?ho(u,i):lo(u)?go(u,i,async t=>{if(!Co(e,t,a,r))return null;let n=await jo(t,o,l.signal,c,a);return co(n)?n:null}):null}finally{l.cleanup()}},No=(e,t,n)=>{if(!n)return t;let r=e.get(n);return r||(r=/* @__PURE__ */ new Map,e.set(n,r)),r},Po=e=>No(Xa,Ya,e),Fo=e=>No($a,Qa,e),Io=(e,t)=>t.allowCrossOriginSourceMap===void 0&&t.allowUnsafeServerFetch===void 0&&t.maxBundleSizeBytes===void 0&&t.maxSourceMapSizeBytes===void 0&&t.timeoutMs===void 0?e:`${e}\0${t.allowCrossOriginSourceMap??``}\0${t.allowUnsafeServerFetch??``}\0${t.maxBundleSizeBytes??``}\0${t.maxSourceMapSizeBytes??``}\0${t.timeoutMs??``}`,Lo=async(e,t=!0,n,r={})=>{let i=t&&r.signal===void 0,a=Po(n),o=Fo(n),s=Io(e,r);if(i&&a.has(s))return a.get(s)??null;let c=i?o.get(s):void 0;if(c)return(await c).sourceMap;let l=Mo(e,n,r).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));i&&o.set(s,l);let{sourceMap:u,isTransientFailure:d}=await l;return i&&(o.delete(s),d||a.set(s,u)),u},Ro=async(e,t=!0,n,r={})=>Promise.all(e.map(async e=>{if(!e.fileName)return e;let i=await Lo(e.fileName,t,n,r);if(!i||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let a=io(i,e.lineNumber,e.columnNumber);return a?{...e,source:a.fileName&&e.source?e.source.replace(e.fileName,a.fileName):e.source,fileName:a.fileName,functionName:a.functionName??e.functionName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,isIgnoreListed:a.isIgnoreListed,isSymbolicated:!0}:e})),zo=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,Bo=e=>`tag`in e&&typeof e.tag==`number`,Vo=e=>{let t=null;if(Ri(e,n=>{if(n===e)return!1;let r=n._debugOwner;return(r===e||e.alternate!==null&&r===e.alternate)&&n._debugStack instanceof Error&&(t=n._debugStack,!0)}),!t)return null;let{frames:n,isTrusted:r}=Na(t);if(!r)return null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.fileName)return{...t,lineNumber:t.enclosingLineNumber||t.lineNumber,columnNumber:t.enclosingColumnNumber||t.columnNumber}}return null},Ho=()=>{let e=[];for(let t of Pa())e.push({currentDispatcherRef:t,value:Fa(t)}),Ia(t,null);return e},Uo=e=>{for(let{currentDispatcherRef:t,value:n}of e)Ia(t,n)},Wo=e=>`\n in ${e}`,Go=(e,t,n)=>{if(n){let t=Zo(n.stack??``),r=t.lastIndexOf(`
51
- `),i=r===-1?t:t.slice(r+1);if(i.includes(e))return`\n${i}`}return Wo(`${e}${t?` [${t}]`:``}`)},Ko=!1,qo=/* @__PURE__ */ new WeakMap,Jo=(e,t)=>{if(!e||Ko)return``;let n=qo.get(e);if(n!==void 0)return n;let r=ya();ba(void 0),Ko=!0;let i=Ho(),a=console.error,o=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}});try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{throw Error()}catch(e){n=e}let t=Function.prototype.apply.call(e,void 0,[]);typeof t==`object`&&t&&`catch`in t&&typeof t.catch==`function`&&t.catch(()=>void 0)}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};Object.defineProperty(n.DetermineComponentFrameRoot,"displayName",{value:`DetermineComponentFrameRoot`}),Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
45
+ let da=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,fa=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],pa=[`rsc://`,`about://React/`],ma=[`<anonymous>`,`eval`,``],ha=/\.(cjs|cts|js|jsx|mdx|mjs|mts|ts|tsx)$/,ga=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,_a=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,va=/\[[^\]]+\]$/,ya=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],ba=Error,xa=()=>ba.prepareStackTrace,Sa=e=>{ba.prepareStackTrace=e},Ca=/(^|@)\S+:\d+/,wa=/^\s*at .*(\S+:\d+|\(native\))/m,Ta=/^(eval@)?(\[native code\])?$/,Ea=(e,t)=>{if(t?.includeInElement!==!1){let t=e.split(`
46
+ `),n=[];for(let e of t)if(/^\s*at\s+/.test(e)){let t=Oa(e)[0];t&&n.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*(?:\(at .*\)|\[[^\]]+\])$/,``);n.push({functionName:t,source:e})}else if(e.match(Ca)){let t=ka(e)[0];t&&n.push(t)}return n}return e.match(wa)?Oa(e):ka(e)},Da=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},Oa=e=>e.split(`
47
+ `).filter(e=>!!e.match(wa)).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=Da(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`,`(native)`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),ka=e=>e.split(`
48
+ `).filter(e=>!e.match(Ta)).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=Da(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),Aa=/* @__PURE__ */ new WeakMap,ja=e=>ya.some(t=>e.includes(t)),Ma=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},Na=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=Ma(r);if(ja(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},Pa=e=>{let t=-1;for(let n of ya)if(t=e.indexOf(n),t!==-1)break;let n=t===-1?e:e.slice(0,e.lastIndexOf(`
49
+ `,t));return{frames:Ea(n).slice(1),isTrusted:t!==-1}},Fa=e=>{let t=Aa.get(e);if(t)return t;let n=null,r=(e,t)=>{n=Na(t);let r=`${e.name||`Error`}: ${e.message||``}`;for(let e of t)r+=`\n at ${e.toString()}`;return r},i=xa();Sa(r);let a;try{a=String(e.stack)}finally{Sa(i)}let o=n??Pa(a);return Aa.set(e,o),o},Ia=(e=globalThis)=>{let t=di(void 0,e),n=ai(t.renderers)?t.renderers.values():[],r=e===globalThis?/* @__PURE__ */ new Set([...Yr,...n]):new Set(n),i=[],a=/* @__PURE__ */ new Set;for(let e of r){let t=e.currentDispatcherRef;!t||a.has(t)||(a.add(t),i.push(t))}return i},La=e=>`H`in e?e.H:e.current,Ra=(e,t)=>{`H`in e?e.H=t:e.current=t};var za=44,Ba=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Va=/* @__PURE__ */ new Uint8Array(64),Ha=/* @__PURE__ */ new Uint8Array(128);for(let e=0;e<Ba.length;e++){let t=Ba.charCodeAt(e);Va[e]=t,Ha[t]=e}function Ua(e,t){let n=0,r=0,i=0;do i=Ha[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Wa(e,t){return e.pos>=t?!1:e.peek()!==za}var Ga=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function Ka(e){let{length:t}=e,n=new Ga(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Ua(n,i),i<u&&(l=!1),u=i,Wa(n,e)?(a=Ua(n,a),o=Ua(n,o),s=Ua(n,s),Wa(n,e)?(c=Ua(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||qa(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function qa(e){e.sort(Ja)}function Ja(e,t){return e[0]-t[0]}let Ya=/^data:application\/json(?:;[^,]*)?,/i,Xa=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Za=/* @__PURE__ */ new Map,Qa=/* @__PURE__ */ new WeakMap;var $a=class extends Error{};let eo=/* @__PURE__ */ new Map,to=/* @__PURE__ */ new WeakMap,no=/* @__PURE__ */ new Set([`chrome-extension:`,`moz-extension:`,`safari-web-extension:`]),ro=/* @__PURE__ */ new Set([`http:`,`https:`,...no]),io=(e,t,n,r)=>{let[,i,a,o,s]=e;if(i===void 0||a===void 0||o===void 0)return null;let c=t[i];return c?{columnNumber:o,fileName:c,functionName:s===void 0?void 0:r?.[s]||void 0,isIgnoreListed:n?.has(i)??!1,lineNumber:a+1}:null},ao=(e,t,n,r,i,a)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let s=null,c=0,l=o.length-1;for(;c<=l;){let e=c+l>>1;o[e][0]<=r?(s=o[e],c=e+1):l=e-1}return!s||s.length<4?null:io(s,t,i,a)},oo=(e,t,n)=>{if(e.sections){let r=t-1,i=null;for(let t of e.sections)if(r>t.offset.line||r===t.offset.line&&n>=t.offset.column)i=t;else break;if(!i)return null;let a=r-i.offset.line,o=r===i.offset.line?n-i.offset.column:n;return ao(i.map.mappings,i.map.sources,a,o,i.map.ignoredSourceIndices,i.map.names)}return ao(e.mappings,e.sources,t-1,n,e.ignoredSourceIndices,e.names)},so=(e,t)=>{if(Ya.test(e))return e;try{return new URL(e,t).toString()}catch{try{return new URL(e).toString()}catch{try{let n=new URL(e,new URL(t,`https://bippy.invalid/`));return`${n.pathname}${n.search}${n.hash}`}catch{return null}}}},co=e=>{try{let t=new URL(e),n=t.pathname.lastIndexOf(`.bundle`);if(n===-1)return null;let r=t.pathname.slice(n+7);if(r&&!r.startsWith(`//&`))return null;if(t.pathname=`${t.pathname.slice(0,n)}.map`,r){let e=new URLSearchParams(r.slice(3));for(let[n,r]of e)t.searchParams.set(n,r)}return t.hash=``,t.toString()}catch{return null}},lo=(e,t,n)=>{let r=n.headers.get(`sourcemap`)??n.headers.get(`x-sourcemap`);if(r)return so(r.trim(),e);let i,a=t.length;for(;a>0&&!i;){let e=t.lastIndexOf(`
50
+ `,a-1)+1,n=t.slice(e,a).match(Xa);n&&(i=n[1]||n[2]),a=e-1}return i?so(i,e):co(e)},uo=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`mappings`),r=Reflect.get(e,`file`),i=Reflect.get(e,`names`),a=Reflect.get(e,`sourceRoot`),o=Reflect.get(e,`sources`),s=Reflect.get(e,`sourcesContent`),c=Reflect.get(e,`ignoreList`),l=Reflect.get(e,`x_google_ignoreList`);if(t!==3||typeof n!=`string`||r!==void 0&&typeof r!=`string`||i!==void 0&&(!Array.isArray(i)||i.some(e=>typeof e!=`string`))||a!==void 0&&typeof a!=`string`||s!==void 0&&(!Array.isArray(s)||s.some(e=>typeof e!=`string`&&e!==null))||c!==void 0&&(!Array.isArray(c)||c.some(e=>!Number.isInteger(e)||e<0))||l!==void 0&&(!Array.isArray(l)||l.some(e=>!Number.isInteger(e)||e<0))||!Array.isArray(o)||o.some(e=>typeof e!=`string`)||s&&s.length!==o.length)return!1;let u=o.length;return[...c??[],...l??[]].every(e=>e<u)},fo=e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`version`),n=Reflect.get(e,`sections`);return t!==3||!Array.isArray(n)?!1:n.every(e=>{if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`map`),n=Reflect.get(e,`url`),r=Reflect.get(e,`offset`);if(typeof r!=`object`||!r)return!1;let i=Reflect.get(r,`column`),a=Reflect.get(r,`line`);return uo(t)!==(typeof n==`string`&&n.length>0)&&typeof i==`number`&&Number.isInteger(i)&&i>=0&&typeof a==`number`&&Number.isInteger(a)&&a>=0})},po=e=>{let t=e.ignoreList??e.x_google_ignoreList;return t?.length?new Set(t):void 0},mo=(e,t,n)=>{if(!e||da.test(t)||t.startsWith(`/`))return t;let r=e.endsWith(`/`)?e:`${e}/`,i=t.replace(/^\.\//,``);try{let e=da.test(r)?r:new URL(r,n).toString();return new URL(i,e).toString()}catch{let e=`${r}${i}`.split(`/`),t=[];for(let n of e)n===`..`?t.pop():n!==`.`&&t.push(n);return t.join(`/`)}},ho=(e,t)=>e.sources.map(n=>mo(e.sourceRoot,n,t)),go=e=>Ya.test(e)?void 0:e,_o=(e,t)=>{try{return{file:e.file,ignoredSourceIndices:po(e),mappings:Ka(e.mappings),names:e.names,sourceMapUrl:go(t),sourceRoot:e.sourceRoot,sources:ho(e,t),sourcesContent:e.sourcesContent,version:3}}catch{return null}},vo=async(e,t,n)=>{let r=[],i=-1,a=-1;for(let o of e.sections){if(o.offset.line<i||o.offset.line===i&&o.offset.column<=a)return null;i=o.offset.line,a=o.offset.column;let e=o.url?so(o.url,t):null,s=o.map??(e?await n(e):null);if(!s)return null;let c=e??t;try{r.push({map:{...s,ignoredSourceIndices:po(s),mappings:Ka(s.mappings),sources:ho(s,c)},offset:o.offset})}catch{return null}}let o=/* @__PURE__ */ new Set;for(let e of r)for(let t of e.map.sources)o.add(t);return{file:e.file,mappings:[],names:[],sections:r,sourceMapUrl:go(t),sourceRoot:void 0,sources:Array.from(o),sourcesContent:void 0,version:3}},yo=(e,t=!1)=>{if(!e)return!1;let n=e.trim();if(!n)return!1;let r=n.match(da);if(!r)return!0;let i=r[0].toLowerCase();return t||ro.has(i)},bo=()=>typeof window>`u`&&typeof process<`u`&&typeof process.versions?.node==`string`,xo=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!t.username&&!t.password}catch{return!1}},So=e=>{try{return new URL(e).protocol}catch{return null}},Co=e=>{let t=So(e);return t!==null&&no.has(t)},wo=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.protocol===r.protocol&&n.host===r.host}catch{return!1}},To=(e,t,n,r)=>{if(Ya.test(t))return!0;if(!yo(t,r))return!1;let i=So(e),a=So(t),o=i!==null&&!ro.has(i)||a!==null&&!ro.has(a);return!(n||o||Co(e)||Co(t))||wo(e,t)},Eo=e=>e===408||e===425||e===429||e>=500,Do=e=>{if(e.ok)return!0;if(Eo(e.status))throw new $a;return!1},Oo=(e,t,n)=>!n||t.url.length===0||wo(e,t.url),ko=e=>{if(e.timeoutMs===void 0||e.timeoutMs<0)return{cleanup:()=>{},signal:e.signal};let t=new AbortController,n=()=>t.abort(e.signal?.reason);e.signal?.aborted?n():e.signal?.addEventListener(`abort`,n,{once:!0});let r=setTimeout(()=>t.abort(new Pi(`Source map request timed out`)),e.timeoutMs);return{cleanup:()=>{clearTimeout(r),e.signal?.removeEventListener(`abort`,n)},signal:t.signal}},Ao=async(e,t)=>{let n=Number(e.headers.get(`content-length`));if(Number.isFinite(n)&&n>t)return null;if(!e.body){let n=await e.text();return new TextEncoder().encode(n).byteLength>t?null:n}let r=e.body.getReader(),i=new TextDecoder,a=[],o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e)break;if(o+=n.byteLength,o>t)return await r.cancel(),null;a.push(i.decode(n,{stream:!0}))}return a.push(i.decode()),a.join(``)}finally{r.releaseLock()}},jo=e=>{try{if(typeof globalThis.atob==`function`)return new TextDecoder().decode(Uint8Array.from(globalThis.atob(e),e=>e.charCodeAt(0)))}catch{return null}let t=e.replace(/\s/g,``).replace(/=+$/,``),n=[],r=0,i=0;for(let e of t){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.indexOf(e);if(t===-1)return null;r=r*64+t,i+=6,i>=8&&(i-=8,n.push(Math.floor(r/2**i)&255),r%=2**i)}return new TextDecoder().decode(Uint8Array.from(n))},Mo=(e,t)=>{let n=e.indexOf(`,`);if(n===-1)return null;let r=e.slice(0,n),i=e.slice(n+1);if(i.length>t*2)return null;try{let e=r.toLowerCase().includes(`;base64`)?jo(i):decodeURIComponent(i);return e===null||new TextEncoder().encode(e).byteLength>t?null:JSON.parse(e)}catch{return null}},No=async(e,t,n,r,i)=>{if(Ya.test(e))return Mo(e,r);let a=await t(e,{redirect:i?`error`:`follow`,signal:n});if(!Do(a)||!Oo(e,a,i))return null;let o=await Ao(a,r);if(o===null)return null;try{return JSON.parse(o)}catch{return null}},Po=async(e,t,n={})=>{let r=t!==void 0;if(!yo(e,r))return null;let i=bo(),a=(i||Co(e))&&!n.allowCrossOriginSourceMap;if(i&&!t&&(!n.allowUnsafeServerFetch||!xo(e)))return null;let o=t??(typeof globalThis.fetch==`function`?globalThis.fetch.bind(globalThis):void 0);if(!o)return null;let s=n.maxBundleSizeBytes??26214400,c=n.maxSourceMapSizeBytes??104857600;if(s<0||c<0)return null;let l=ko(n);try{let t=await o(e,{redirect:a?`error`:`follow`,signal:l.signal});if(!Do(t)||!Oo(e,t,a))return null;let n=await Ao(t,s);if(n===null)return null;let i=lo(e,n,t);if(!i||!To(e,i,a,r))return null;let u=await No(i,o,l.signal,c,a);return uo(u)?_o(u,i):fo(u)?vo(u,i,async t=>{if(!To(e,t,a,r))return null;let n=await No(t,o,l.signal,c,a);return uo(n)?n:null}):null}finally{l.cleanup()}},Fo=(e,t,n)=>{if(!n)return t;let r=e.get(n);return r||(r=/* @__PURE__ */ new Map,e.set(n,r)),r},Io=e=>Fo(Qa,Za,e),Lo=e=>Fo(to,eo,e),Ro=(e,t)=>t.allowCrossOriginSourceMap===void 0&&t.allowUnsafeServerFetch===void 0&&t.maxBundleSizeBytes===void 0&&t.maxSourceMapSizeBytes===void 0&&t.timeoutMs===void 0?e:`${e}\0${t.allowCrossOriginSourceMap??``}\0${t.allowUnsafeServerFetch??``}\0${t.maxBundleSizeBytes??``}\0${t.maxSourceMapSizeBytes??``}\0${t.timeoutMs??``}`,zo=async(e,t=!0,n,r={})=>{let i=t&&r.signal===void 0,a=Io(n),o=Lo(n),s=Ro(e,r);if(i&&a.has(s))return a.get(s)??null;let c=i?o.get(s):void 0;if(c)return(await c).sourceMap;let l=Po(e,n,r).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));i&&o.set(s,l);let{sourceMap:u,isTransientFailure:d}=await l;return i&&(o.delete(s),d||a.set(s,u)),u},Bo=async(e,t=!0,n,r={})=>Promise.all(e.map(async e=>{if(!e.fileName)return e;let i=await zo(e.fileName,t,n,r);if(!i||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let a=oo(i,e.lineNumber,e.columnNumber);return a?{...e,source:a.fileName&&e.source?e.source.replace(e.fileName,a.fileName):e.source,fileName:a.fileName,functionName:a.functionName??e.functionName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,isIgnoreListed:a.isIgnoreListed,isSymbolicated:!0}:e})),Vo=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,Ho=e=>`tag`in e&&typeof e.tag==`number`,Uo=e=>{let t=null;if(Bi(e,n=>{if(n===e)return!1;let r=n._debugOwner;return(r===e||e.alternate!==null&&r===e.alternate)&&n._debugStack instanceof Error&&(t=n._debugStack,!0)}),!t)return null;let{frames:n,isTrusted:r}=Fa(t);if(!r)return null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t.fileName)return{...t,lineNumber:t.enclosingLineNumber||t.lineNumber,columnNumber:t.enclosingColumnNumber||t.columnNumber}}return null},Wo=()=>{let e=[];for(let t of Ia())e.push({currentDispatcherRef:t,value:La(t)}),Ra(t,null);return e},Go=e=>{for(let{currentDispatcherRef:t,value:n}of e)Ra(t,n)},Ko=e=>`\n in ${e}`,qo=(e,t,n)=>{if(n){let t=$o(n.stack??``),r=t.lastIndexOf(`
51
+ `),i=r===-1?t:t.slice(r+1);if(i.includes(e))return`\n${i}`}return Ko(`${e}${t?` [${t}]`:``}`)},Jo=!1,Yo=/* @__PURE__ */ new WeakMap,Xo=(e,t)=>{if(!e||Jo)return``;let n=Yo.get(e);if(n!==void 0)return n;let r=xa();Sa(void 0),Jo=!0;let i=Wo(),a=console.error,o=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}});try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{throw Error()}catch(e){n=e}let t=Function.prototype.apply.call(e,void 0,[]);typeof t==`object`&&t&&`catch`in t&&typeof t.catch==`function`&&t.catch(()=>void 0)}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};Object.defineProperty(n.DetermineComponentFrameRoot,"displayName",{value:`DetermineComponentFrameRoot`}),Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
52
52
  `),n=i.split(`
53
- `),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,[r]=wa(n);if(!r?.fileName)break;let i=Ui(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),qo.set(e,n),n}while(a>=1&&o>=0);break}}}finally{Ko=!1,ba(r),Uo(i),console.error=a,console.warn=o}let s=Ui(e),c=s?Wo(s):``;return qo.set(e,c),c},Yo=(e,t)=>{let n=``,r=Oi(e);switch(e.tag){case r.ActivityComponent:n=Wo(`Activity`);break;case r.ClassComponent:n=Jo(e.type,!0);break;case r.ForwardRef:n=Jo(Hi(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=Jo(Hi(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=Wo(e.type));break;case r.LazyComponent:n=Wo(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?Wo(`Suspense Fallback`):Wo(`Suspense`);break;case r.SuspenseListComponent:n=Wo(`SuspenseList`);break;case r.ViewTransitionComponent:n=Wo(`ViewTransition`);break;default:return``}return n},Xo=e=>{try{let t=``,n=e,r=null;do{t+=Yo(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=Go(r.name,r.env,r.debugLocation))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nBippy couldn’t generate the stack: ${e.message}\n${e.stack}`:``}},Zo=e=>{let t=e;if(!t)return``;t.startsWith(`Error: react-stack-top-frame
53
+ `),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,[r]=Ea(n);if(!r?.fileName)break;let i=Gi(e);return i&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,i)),Yo.set(e,n),n}while(a>=1&&o>=0);break}}}finally{Jo=!1,Sa(r),Go(i),console.error=a,console.warn=o}let s=Gi(e),c=s?Ko(s):``;return Yo.set(e,c),c},Zo=(e,t)=>{let n=``,r=Ai(e);switch(e.tag){case r.ActivityComponent:n=Ko(`Activity`);break;case r.ClassComponent:n=Xo(e.type,!0);break;case r.ForwardRef:n=Xo(Wi(e.type)??e.type,!1);break;case r.FunctionComponent:case r.SimpleMemoComponent:n=Xo(Wi(e.type)??e.type,!1);break;case r.HostComponent:case r.HostHoistable:case r.HostSingleton:typeof e.type==`string`&&(n=Ko(e.type));break;case r.LazyComponent:n=Ko(`Lazy`);break;case r.SuspenseComponent:n=e.child!==t&&t!==null?Ko(`Suspense Fallback`):Ko(`Suspense`);break;case r.SuspenseListComponent:n=Ko(`SuspenseList`);break;case r.ViewTransitionComponent:n=Ko(`ViewTransition`);break;default:return``}return n},Qo=e=>{try{let t=``,n=e,r=null;do{t+=Zo(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=qo(r.name,r.env,r.debugLocation))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nBippy couldn’t generate the stack: ${e.message}\n${e.stack}`:``}},$o=e=>{let t=e;if(!t)return``;t.startsWith(`Error: react-stack-top-frame
54
54
  `)&&(t=t.slice(29));let n=t.indexOf(`
55
- `);n!==-1&&(t=t.slice(n+1));let r=Math.max(..._a.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
56
- `,r)),r!==-1)t=t.slice(0,r);else return``;return t},Qo=e=>!!(e.functionName&&e.fileName&&ns(e.fileName)),$o=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,es=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!Qo(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>$o(e,n))||(r.push(n),t.set(e,r))}return t},ts=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(ga,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},ns=e=>da.some(t=>e.startsWith(t)),rs=e=>!e.isServer&&e.fileName&&ns(e.fileName)?{...e,isServer:!0}:e,is=e=>{let t=[],n=e;for(;n;)if(Bo(n)){let e=n;if(n=e._debugOwner,n&&zo(e)){let{frames:n,isTrusted:r}=Na(e._debugStack);if(r)for(let e of n)t.push(rs(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of Na(e.debugStack).frames)t.push({...n,isServer:!0})}return t},as=e=>{let t=[];return Ri(e,e=>{if(!zo(e))return;let{frames:n,isTrusted:r}=Na(e._debugStack);r&&t.push(...n)},!0),t},os=e=>{let t=as(e),n=wa(Xo(e)),r=es(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&ga.test(e.source)?ts(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},ss=async(e,t=!0,n,r={})=>Ro(os(e),t,n,r),cs=e=>!!e.fileName&&!e.isIgnoreListed,ls=async(e,t=!0,n,r={})=>{let i=is(e);if(i.length>0){let a=Vo(e)??{};a.functionName=Ui(e.type)??a.functionName;let o=await Ro([a,...i],t,n,r);if(o.some((e,t)=>t>0&&cs(e)))return o}return ss(e,t,n,r)},us=e=>e.split(`/`).filter(Boolean).length,ds=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(us(n)!==1)return e;let r=e.slice(t);if(!pa.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},fs=e=>{if(!e||fa.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=ds(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of ua)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(la);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);ha.test(e)&&(t=t.slice(0,i))}return t},ps=e=>{let t=fs(e);return!(!t||!pa.test(t)||ma.test(t))},ms=Symbol.for(`react.context`),hs=Symbol.for(`react.recoverable`),gs=[],_s=null,vs=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),I=()=>{let e=_s;return e!==null&&(_s=e.next),e},ys=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,bs=e=>typeof e==`object`&&!!e&&`current`in e,xs=e=>typeof e==`object`&&!!e&&`_currentValue`in e,Ss=e=>e._currentValue,L=(e,t,n,r=null,i=null)=>{gs.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},Cs=e=>{if(typeof e==`object`&&e){if(ys(e)){let t=e,n=ys(t)?t:e;switch(n.status){case`fulfilled`:return L(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw L(`Unresolved`,n,`Use`,null,n._debugInfo??null),vs}if(`$$typeof`in e&&e.$$typeof===hs){L(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===ms&&xs(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=Ss(t);return L(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new Ai(`use() received an unsupported value: `+String(e))},ws=e=>{let t=Ss(e);return L(`Context`,t,`Context`,e.displayName||null),t},Ts=e=>{let t=I(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return L(`State`,n,`State`),[n,()=>{}]},Es=(e,t,n)=>{let r=I(),i=r===null?n===void 0?t:n(t):r.memoizedState;return L(`Reducer`,i,`Reducer`),[i,()=>{}]},Ds=e=>{let t=I(),n=bs(t?.memoizedState)?t.memoizedState:{current:e};return L(`Ref`,n.current,`Ref`),n},Os=()=>{let e=I();return L(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},ks=e=>{I(),L(`LayoutEffect`,e,`LayoutEffect`)},As=e=>{I(),L(`InsertionEffect`,e,`InsertionEffect`)},js=e=>{I(),L(`Effect`,e,`Effect`)},Ms=e=>{I();let t=bs(e)?e.current:void 0;L(`ImperativeHandle`,t,`ImperativeHandle`)},Ns=(e,t)=>{L(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},Ps=e=>{let t=I();return L(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},Fs=e=>{let t=I(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return L(`Memo`,n,`Memo`),n},Is=(e,t)=>{let n=I();I();let r=n===null?t():n.memoizedState;return L(`SyncExternalStore`,r,`SyncExternalStore`),r},Ls=()=>{let e=I();I();let t=e?.memoizedState===!0;return L(`Transition`,t,`Transition`),[t,()=>{}]},Rs=e=>{let t=I(),n=t===null?e:t.memoizedState;return L(`DeferredValue`,n,`DeferredValue`),n},zs=()=>{let e=I(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return L(`Id`,t,`Id`),t},Bs=e=>[],Vs=e=>{let t=I(),n=t===null?e:t.memoizedState;return L(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Hs=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(ys(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=vs,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},Us=e=>(t,n)=>{let r=I();I(),I();let{value:i,debugInfo:a,error:o}=Hs(r,n);if(L(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},Ws=Us(`ActionState`),Gs={readContext:Ss,use:Cs,useCallback:Ps,useContext:ws,useEffect:js,useImperativeHandle:Ms,useLayoutEffect:ks,useInsertionEffect:As,useMemo:Fs,useReducer:Es,useRef:Ds,useState:Ts,useDebugValue:Ns,useDeferredValue:Rs,useTransition:Ls,useSyncExternalStore:Is,useId:zs,useHostTransitionStatus:()=>{let e=Ss({_currentValue:null});return L(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:Us(`FormState`),useActionState:Ws,useOptimistic:Vs,useMemoCache:Bs,useCacheRefresh:Os,useEffectEvent:e=>(I(),L(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(Gs,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new ji(`The React dispatcher is missing method `+t)}});let Ks=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return Ks(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([L,...Object.values(Gs)].map(e=>Ks(e.name)));let qs=[`top`,`right`,`bottom`,`left`];function Js(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Ys(e){return Math.round(e*10)/10}function Xs(e,t){let n=t.right<=e.left||t.left>=e.right,r=t.bottom<=e.top||t.top>=e.bottom,i=ec(e.left,e.right,t.left,t.right),a=ec(e.top,e.bottom,t.top,t.bottom),o=[];if(n||r)return t.bottom<=e.top?o.push(Qs(`top`,i,t.bottom,e.top,t)):t.top>=e.bottom&&o.push(Qs(`bottom`,i,e.bottom,t.top,t)),t.right<=e.left?o.push($s(`left`,a,t.right,e.left,t)):t.left>=e.right&&o.push($s(`right`,a,e.right,t.left,t)),o;let s=[[`top`,e.top,t.top],[`right`,e.right,t.right],[`bottom`,e.bottom,t.bottom],[`left`,e.left,t.left]];for(let[e,t,n]of s){let r=Ys(Math.abs(t-n));if(r===0)continue;let[s,c]=t<n?[t,n]:[n,t];o.push(e===`top`||e===`bottom`?{side:e,value:r,from:{x:i,y:s},to:{x:i,y:c}}:{side:e,value:r,from:{x:s,y:a},to:{x:c,y:a}})}return o}function Zs(e,t){let n={...t};for(let t of e)n[t.side]=t.value;return n}function Qs(e,t,n,r,i){let a={side:e,value:Ys(r-n),from:{x:t,y:n},to:{x:t,y:r}};if(t<i.left||t>i.right){let n=e===`top`?i.bottom:i.top;a.extension={from:{x:t<i.left?i.left:i.right,y:n},to:{x:t,y:n}}}return a}function $s(e,t,n,r,i){let a={side:e,value:Ys(r-n),from:{x:n,y:t},to:{x:r,y:t}};if(t<i.top||t>i.bottom){let n=e===`left`?i.right:i.left;a.extension={from:{x:n,y:t<i.top?i.top:i.bottom},to:{x:n,y:t}}}return a}function ec(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);return i<=a?(i+a)/2:(e+t)/2}function tc(e){let t=getComputedStyle(e),n=e=>qs.map(n=>Ys(rc(t.getPropertyValue(e(n))))),r={margin:n(e=>`margin-${e}`),padding:n(e=>`padding-${e}`),border:n(e=>`border-${e}-width`)};if(/flex|grid/.test(t.display)){let e=Ys(rc(t.rowGap)),n=Ys(rc(t.columnGap));(e>0||n>0)&&(r.gap={row:e,column:n})}return r}function nc(e,t,n){let r=[...e.children].slice(0,100).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0),i=[];for(let e=1;e<r.length;e++){let a=r[e-1],o=r[e];t.column>0&&o.left>=a.right-.5&&o.top<a.bottom?i.push({axis:`column`,left:a.right,right:o.left,top:Math.max(a.top,o.top),bottom:Math.min(a.bottom,o.bottom)}):t.row>0&&o.top>=a.bottom-.5&&i.push({axis:`row`,left:n.left,right:n.right,top:a.bottom,bottom:o.top})}return i.filter(e=>e.right-e.left>.5&&e.bottom-e.top>.5)}function rc(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}let ic={top:`t`,right:`r`,bottom:`b`,left:`l`},ac={top:`y`,right:`x`,bottom:`y`,left:`x`};function oc(e,t,n,r){let i=new Set(e.classList),a=t===`gap`?[`gap-${n===`row`?`y`:`x`}`,`gap`]:[`${t[0]}${ic[n]}`,`${t[0]}${ac[n]}`,t[0]];for(let e of a){let t=[...i].find(t=>t.startsWith(`${e}-`));if(!t)continue;let n=sc(t.slice(e.length+1));return n!==void 0&&Math.abs(n-r)<.5?t:void 0}}function sc(e){if(e===`px`)return 1;let t=e.match(/^\[(-?[\d.]+)(px|rem)\]$/);if(t)return Number(t[1])*(t[2]===`rem`?cc():1);if(/^\d+(?:\.\d+)?$/.test(e))return Number(e)*.25*cc()}function cc(){return rc(getComputedStyle(document.documentElement).fontSize)||16}async function lc(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim(),r=tc(e);return{tagName:e.tagName.toLowerCase(),selector:dc(e),html:gc(e),text:vc(e),components:await yc(e),box:r,rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function uc(e){let t=e.tagName.toLowerCase(),n=Tc(e);if(!n)return t;let r=null;return Ri(n,e=>Li(e)?(r=Ui(e.type),!(!r||Ec(r))):!1,!0),r?`${r} · ${t}`:t}function dc(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=fc(n);if(r){t.unshift(r);let n=t.join(` > `);if(mc(n,e))return n}else{t.unshift(pc(n));let r=t.join(` > `);if(t.length>=2&&mc(r,e))return r}n=n.parentElement}return t.join(` > `)}function fc(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function pc(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function mc(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let hc=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function gc(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>_c(e.name)-_c(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${Ac(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:Ac(e.textContent?.trim()??``,100)}</${t}>`}function _c(e){let t=hc.indexOf(e);return t===-1?hc.length:t}function vc(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?Ac(t,200):void 0}async function yc(e){let t=bc(e);if(t.length>0)return t;let n=Tc(e);if(!n)return[];try{let e=await jc(ls(n),1500),t=Sc(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!Ec(e.functionName)).slice(0,6).map(e=>Cc(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return wc(n)}function bc(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??xc(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function xc(e){return e.slice(e.lastIndexOf(`/`)+1)}function Sc(e){let t=/* @__PURE__ */ new Map;try{for(let n of is(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,Oc(n.fileName))}catch{}return t}function Cc(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=kc(e.fileName);return r?{name:n,library:r}:ps(e.fileName)?{name:n,source:{file:Dc(Oc(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function wc(e){let t=[];return Ri(e,e=>{if(Li(e)){let n=Ui(e.type);n&&!Ec(n)&&t.push({name:n})}return t.length>=6},!0),t}function Tc(e){try{return ca(e)}catch{return null}}function Ec(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function Dc(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function Oc(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function kc(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function Ac(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function jc(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let Mc;function Nc(e){Mc=e}function Pc(){if(!Mc)throw Error(`Tencil overlay is not mounted`);return Mc}let Fc=/* @__PURE__ */ new Map;function Ic(e,t){let n=t??Rc(e.selector);if(!n?.isConnected)return null;let r=n.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e.offsetX,y:r.top+r.height*e.offsetY}}function Lc(e,t){let n=e.getBoundingClientRect(),r=(e,t)=>t>0?Bc(e/t,0,1):.5;return{offsetX:r(t.x-n.left,n.width),offsetY:r(t.y-n.top,n.height)}}function Rc(e){if(!e)return null;let t=Fc.get(e)?.deref();if(t?.isConnected&&t.matches(e))return t;try{let t=document.querySelector(e);return t&&Fc.set(e,new WeakRef(t)),t}catch{return null}}function zc(e,t,n=16){let r=window.innerWidth,i=window.innerHeight,a=e.x+n;a+t.width>r-12&&(a=e.x-n-t.width),a=Bc(a,12,r-t.width-12);let o=Bc(e.y-24,12,i-t.height-12),s=`${Bc(e.x-a,0,t.width)}px ${Bc(e.y-o,0,t.height)}px`;return{left:a,top:o,origin:s}}function Bc(e,t,n){return Math.max(t,Math.min(n,e))}function Vc(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}let Hc;function Uc(){let e=/* @__PURE__ */ new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}function Wc(e){let t=-1;Hc||=Uc();for(let n=0;n<e.length;n++)t=Hc[(t^e[n])&255]^t>>>8;return t^-1}function Gc(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===112&&e[n-2]===72&&e[n-1]===89&&e[n]===115)return n-3;return 0}function Kc(e,t,n=!1){let r=/* @__PURE__ */ new Uint8Array(13);t*=39.3701,r[0]=112,r[1]=72,r[2]=89,r[3]=115,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let i=Wc(r),a=/* @__PURE__ */ new Uint8Array(4);if(a[0]=i>>>24,a[1]=i>>>16,a[2]=i>>>8,a[3]=i&255,n){let t=Gc(e);return e.set(r,t),e.set(a,t+13),e}{let t=/* @__PURE__ */ new Uint8Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=9;let n=/* @__PURE__ */ new Uint8Array(54);return n.set(e,0),n.set(t,33),n.set(r,37),n.set(a,50),n}}function qc(e){let t=e.indexOf(`AAlwSFlz`);return t===-1&&(t=e.indexOf(`AAAJcEhZ`)),t===-1&&(t=e.indexOf(`AAAACXBI`)),t}let Jc=`[modern-screenshot]`,Yc=typeof window<`u`,Xc=Yc&&`Worker`in window,Zc=Yc&&`atob`in window,Qc=Yc&&`btoa`in window,$c=Yc?window.navigator?.userAgent:``,el=$c.includes(`Chrome`),tl=$c.includes(`AppleWebKit`)&&!el,nl=$c.includes(`Firefox`),rl=e=>e&&`__CONTEXT__`in e,il=e=>e.constructor.name===`CSSFontFaceRule`,al=e=>e.constructor.name===`CSSImportRule`,ol=e=>e.constructor.name===`CSSLayerBlockRule`,sl=e=>e.nodeType===1,cl=e=>typeof e.className==`object`,ll=e=>e.tagName===`image`,ul=e=>e.tagName===`use`,dl=e=>sl(e)&&e.style!==void 0&&!cl(e),fl=e=>e.nodeType===8,pl=e=>e.nodeType===3,ml=e=>e.tagName===`IMG`,hl=e=>e.tagName===`VIDEO`,gl=e=>e.tagName===`CANVAS`,_l=e=>e.tagName===`TEXTAREA`,vl=e=>e.tagName===`INPUT`,yl=e=>e.tagName===`STYLE`,bl=e=>e.tagName===`SCRIPT`,xl=e=>e.tagName===`SELECT`,Sl=e=>e.tagName===`SLOT`,Cl=e=>e.tagName===`IFRAME`,wl=(...e)=>console.warn(Jc,...e);function Tl(e){let t=e?.createElement?.(`canvas`);return t&&(t.height=t.width=1),!!t&&`toDataURL`in t&&!!t.toDataURL(`image/webp`).includes(`image/webp`)}let El=e=>e.startsWith(`data:`);function Dl(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Yc&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Yc)return e;let n=Ol().implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function Ol(e){return(e&&sl(e)?e?.ownerDocument:e)??window.document}let kl=`http://www.w3.org/2000/svg`;function Al(e,t,n){let r=Ol(n).createElementNS(kl,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function jl(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,``)),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Ml(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(/* @__PURE__ */ Error(`Failed read blob to ${t}`)),t===`dataUrl`?i.readAsDataURL(e):t===`arrayBuffer`&&i.readAsArrayBuffer(e)})}let Nl=e=>Ml(e,`dataUrl`);function Pl(e,t){let n=Ol(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function Fl(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?Pl(e,Ol(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),hl(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?Fl(s.poster,t).then(n):u();if(s.readyState>=2)return u();let r=u,i=t=>{o?.(`Failed video load`,e,t),a?.(t),u()};l=()=>{s.removeEventListener(`loadeddata`,r),s.removeEventListener(`error`,i)},s.addEventListener(`loadeddata`,r,{once:!0}),s.addEventListener(`error`,i,{once:!0})}else{let e=ll(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if(ml(s)&&`decode`in s)try{await s.decode()}catch(t){o?.(`Failed to decode image, trying to render anyway`,s.dataset.originalSrc||e,t)}u()},n=t=>{o?.(`Failed image load`,s.dataset.originalSrc||e,t),u()};if(ml(s)&&s.complete)return t();l=()=>{s.removeEventListener(`load`,t),s.removeEventListener(`error`,n)},s.addEventListener(`load`,t,{once:!0}),s.addEventListener(`error`,n,{once:!0})}})}async function Il(e,t){dl(e)&&(ml(e)||hl(e)?await Fl(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Fl(e,t)))))}let Ll=/* @__PURE__ */ function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function Rl(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}let zl=0;function Bl(e){let t=`${Jc}[#${zl}]`;return zl++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&wl(...t)}}function Vl(e){return{cache:e?`no-cache`:`force-cache`}}async function Hl(e,t){return rl(e)?e:Ul(e,{...t,autoDestruct:!0})}async function Ul(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(Yc?window.document:void 0),c=e.ownerDocument?.defaultView??(Yc?window:void 0),l=/* @__PURE__ */ new Map,u={width:0,height:0,quality:1,type:`image/png`,scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:a,fetch:{requestInit:Vl(t?.fetch?.bypassingCache),placeholderImage:`data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Bl(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:Wl(s),svgDefsElement:s?.createElementNS(kl,`defs`),svgStyles:/* @__PURE__ */ new Map,defaultComputedStyles:/* @__PURE__ */ new Map,workers:[...Array.from({length:Xc&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?l.get(t)?.resolve?.(n):l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e}catch(e){return u.log.warn(`Failed to new Worker`,e),null}}).filter(Boolean),fontFamilies:/* @__PURE__ */ new Map,fontCssTexts:/* @__PURE__ */ new Map,acceptOfImage:`${[Tl(s)&&`image/webp`,`image/svg+xml`,`image/*`,`*/*`].filter(Boolean).join(`,`)};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:o,isEnable:e=>e===`restoreScrollPosition`?typeof o==`boolean`?!1:o[e]??!1:typeof o==`boolean`?o:o[e]??!0,shadowRoots:[]};u.log.time(`wait until load`),await Il(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=Gl(e,u);return u.width=d,u.height=f,u}function Wl(e){if(!e)return;let t=e.createElement(`style`),n=t.ownerDocument.createTextNode(`
55
+ `);n!==-1&&(t=t.slice(n+1));let r=Math.max(...ya.map(e=>t.indexOf(e)));if(r!==-1&&(r=t.lastIndexOf(`
56
+ `,r)),r!==-1)t=t.slice(0,r);else return``;return t},es=e=>!!(e.functionName&&e.fileName&&is(e.fileName)),ts=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,ns=e=>{let t=/* @__PURE__ */ new Map;for(let n of e){if(!es(n))continue;let e=n.functionName,r=t.get(e)??[];r.some(e=>ts(e,n))||(r.push(n),t.set(e,r))}return t},rs=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(va,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},is=e=>pa.some(t=>e.startsWith(t)),as=e=>!e.isServer&&e.fileName&&is(e.fileName)?{...e,isServer:!0}:e,os=e=>{let t=[],n=e;for(;n;)if(Ho(n)){let e=n;if(n=e._debugOwner,n&&Vo(e)){let{frames:n,isTrusted:r}=Fa(e._debugStack);if(r)for(let e of n)t.push(as(e))}}else{let e=n;if(n=e.owner,n&&e.debugStack instanceof Error)for(let n of Fa(e.debugStack).frames)t.push({...n,isServer:!0})}return t},ss=e=>{let t=[];return Bi(e,e=>{if(!Vo(e))return;let{frames:n,isTrusted:r}=Fa(e._debugStack);r&&t.push(...n)},!0),t},cs=e=>{let t=ss(e),n=Ea(Qo(e)),r=ns(t),i=/* @__PURE__ */ new Map;return n.map(e=>e.source!==void 0&&va.test(e.source)?rs(e,r,i):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName})},ls=async(e,t=!0,n,r={})=>Bo(cs(e),t,n,r),us=e=>!!e.fileName&&!e.isIgnoreListed,ds=async(e,t=!0,n,r={})=>{let i=os(e);if(i.length>0){let a=Uo(e)??{};a.functionName=Gi(e.type)??a.functionName;let o=await Bo([a,...i],t,n,r);if(o.some((e,t)=>t>0&&us(e)))return o}return ls(e,t,n,r)},fs=e=>e.split(`/`).filter(Boolean).length,ps=e=>{let t=e.indexOf(`/`,1);if(t===-1)return e;let n=e.slice(0,t);if(fs(n)!==1)return e;let r=e.slice(t);if(!ha.test(r))return e;let i=r.split(`/`).filter(Boolean);if(i.length<2)return e;let a=i[0];return a.startsWith(`@`)||a.length>4?e:r},ms=e=>{if(!e||ma.some(t=>t===e))return``;let t=e,n=/^[a-zA-Z]:[\\/]/.test(t);if(t.startsWith(`http://`)||t.startsWith(`https://`)){try{t=new URL(t).pathname}catch{}t=ps(t)}if(t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of fa)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(!n){let e=t.match(da);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);_a.test(e)&&(t=t.slice(0,i))}return t},hs=e=>{let t=ms(e);return!(!t||!ha.test(t)||ga.test(t))},gs=Symbol.for(`react.context`),_s=Symbol.for(`react.recoverable`),vs=[],ys=null,bs=Error("Suspense interrupted this render. This error is an internal implementation detail of `use`."),I=()=>{let e=ys;return e!==null&&(ys=e.next),e},xs=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`,Ss=e=>typeof e==`object`&&!!e&&`current`in e,Cs=e=>typeof e==`object`&&!!e&&`_currentValue`in e,ws=e=>e._currentValue,L=(e,t,n,r=null,i=null)=>{vs.push({displayName:r,primitive:e,stackError:Error(),value:t,debugInfo:i,dispatcherHookName:n})},Ts=e=>{if(typeof e==`object`&&e){if(xs(e)){let t=e,n=xs(t)?t:e;switch(n.status){case`fulfilled`:return L(`Promise`,n.value,`Use`,null,n._debugInfo??null),n.value;case`rejected`:throw n.reason}throw L(`Unresolved`,n,`Use`,null,n._debugInfo??null),bs}if(`$$typeof`in e&&e.$$typeof===_s){L(`Recoverable`,void 0,`Use`);return}if(`$$typeof`in e&&e.$$typeof===gs&&Cs(e)){let t={_currentValue:e._currentValue,displayName:typeof e.displayName==`string`?e.displayName:void 0},n=ws(t);return L(`Context (use)`,n,`Use`,t.displayName||`Context`),n}}throw new Mi(`use() received an unsupported value: `+String(e))},Es=e=>{let t=ws(e);return L(`Context`,t,`Context`,e.displayName||null),t},Ds=e=>{let t=I(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return L(`State`,n,`State`),[n,()=>{}]},Os=(e,t,n)=>{let r=I(),i=r===null?n===void 0?t:n(t):r.memoizedState;return L(`Reducer`,i,`Reducer`),[i,()=>{}]},ks=e=>{let t=I(),n=Ss(t?.memoizedState)?t.memoizedState:{current:e};return L(`Ref`,n.current,`Ref`),n},As=()=>{let e=I();return L(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},js=e=>{I(),L(`LayoutEffect`,e,`LayoutEffect`)},Ms=e=>{I(),L(`InsertionEffect`,e,`InsertionEffect`)},Ns=e=>{I(),L(`Effect`,e,`Effect`)},Ps=e=>{I();let t=Ss(e)?e.current:void 0;L(`ImperativeHandle`,t,`ImperativeHandle`)},Fs=(e,t)=>{L(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},Is=e=>{let t=I();return L(`Callback`,Array.isArray(t?.memoizedState)?t.memoizedState[0]:e,`Callback`),e},Ls=e=>{let t=I(),n=Array.isArray(t?.memoizedState)?t.memoizedState[0]:e();return L(`Memo`,n,`Memo`),n},Rs=(e,t)=>{let n=I();I();let r=n===null?t():n.memoizedState;return L(`SyncExternalStore`,r,`SyncExternalStore`),r},zs=()=>{let e=I();I();let t=e?.memoizedState===!0;return L(`Transition`,t,`Transition`),[t,()=>{}]},Bs=e=>{let t=I(),n=t===null?e:t.memoizedState;return L(`DeferredValue`,n,`DeferredValue`),n},Vs=()=>{let e=I(),t=typeof e?.memoizedState==`string`?e.memoizedState:``;return L(`Id`,t,`Id`),t},Hs=e=>[],Us=e=>{let t=I(),n=t===null?e:t.memoizedState;return L(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Ws=(e,t)=>{let n,r=null,i=null;if(e!==null){let t=e.memoizedState;if(xs(t))switch(t.status){case`fulfilled`:n=t.value,r=t._debugInfo??null;break;case`rejected`:i=t.reason;break;default:i=bs,n=t,r=t._debugInfo??null}else n=t}else n=t;return{value:n,debugInfo:r,error:i}},Gs=e=>(t,n)=>{let r=I();I(),I();let{value:i,debugInfo:a,error:o}=Ws(r,n);if(L(e,i,e,null,a),o!==null)throw o;return[i,()=>{},!1]},Ks=Gs(`ActionState`),qs={readContext:ws,use:Ts,useCallback:Is,useContext:Es,useEffect:Ns,useImperativeHandle:Ps,useLayoutEffect:js,useInsertionEffect:Ms,useMemo:Ls,useReducer:Os,useRef:ks,useState:Ds,useDebugValue:Fs,useDeferredValue:Bs,useTransition:zs,useSyncExternalStore:Rs,useId:Vs,useHostTransitionStatus:()=>{let e=ws({_currentValue:null});return L(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:Gs(`FormState`),useActionState:Ks,useOptimistic:Us,useMemoCache:Hs,useCacheRefresh:As,useEffectEvent:e=>(I(),L(`EffectEvent`,e,`EffectEvent`),e)};new Proxy(qs,{get(e,t){if(Object.hasOwn(e,t))return Reflect.get(e,t);throw new Ni(`The React dispatcher is missing method `+t)}});let Js=e=>{if(!e)return``;let t=e.lastIndexOf(`[as `);if(t!==-1)return Js(e.slice(t+4,-1));if(t=e.lastIndexOf(`.`),t=t===-1?0:t+1,e.slice(t).startsWith(`unstable_`)&&(t+=9),e.slice(t).startsWith(`experimental_`)&&(t+=13),e.slice(t,t+3)===`use`){if(e.length-t===3)return`Use`;t+=3}return e.slice(t)};new Set([L,...Object.values(qs)].map(e=>Js(e.name)));let Ys=[`top`,`right`,`bottom`,`left`];function Xs(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Zs(e){return Math.round(e*10)/10}function Qs(e,t){let n=t.right<=e.left||t.left>=e.right,r=t.bottom<=e.top||t.top>=e.bottom,i=nc(e.left,e.right,t.left,t.right),a=nc(e.top,e.bottom,t.top,t.bottom),o=[];if(n||r)return t.bottom<=e.top?o.push(ec(`top`,i,t.bottom,e.top,t)):t.top>=e.bottom&&o.push(ec(`bottom`,i,e.bottom,t.top,t)),t.right<=e.left?o.push(tc(`left`,a,t.right,e.left,t)):t.left>=e.right&&o.push(tc(`right`,a,e.right,t.left,t)),o;let s=[[`top`,e.top,t.top],[`right`,e.right,t.right],[`bottom`,e.bottom,t.bottom],[`left`,e.left,t.left]];for(let[e,t,n]of s){let r=Zs(Math.abs(t-n));if(r===0)continue;let[s,c]=t<n?[t,n]:[n,t];o.push(e===`top`||e===`bottom`?{side:e,value:r,from:{x:i,y:s},to:{x:i,y:c}}:{side:e,value:r,from:{x:s,y:a},to:{x:c,y:a}})}return o}function $s(e,t){let n={...t};for(let t of e)n[t.side]=t.value;return n}function ec(e,t,n,r,i){let a={side:e,value:Zs(r-n),from:{x:t,y:n},to:{x:t,y:r}};if(t<i.left||t>i.right){let n=e===`top`?i.bottom:i.top;a.extension={from:{x:t<i.left?i.left:i.right,y:n},to:{x:t,y:n}}}return a}function tc(e,t,n,r,i){let a={side:e,value:Zs(r-n),from:{x:n,y:t},to:{x:r,y:t}};if(t<i.top||t>i.bottom){let n=e===`left`?i.right:i.left;a.extension={from:{x:n,y:t<i.top?i.top:i.bottom},to:{x:n,y:t}}}return a}function nc(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);return i<=a?(i+a)/2:(e+t)/2}function rc(e){let t=getComputedStyle(e),n=e=>Ys.map(n=>Zs(ac(t.getPropertyValue(e(n))))),r={margin:n(e=>`margin-${e}`),padding:n(e=>`padding-${e}`),border:n(e=>`border-${e}-width`)};if(/flex|grid/.test(t.display)){let e=Zs(ac(t.rowGap)),n=Zs(ac(t.columnGap));(e>0||n>0)&&(r.gap={row:e,column:n})}return r}function ic(e,t,n){let r=[...e.children].slice(0,100).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0),i=[];for(let e=1;e<r.length;e++){let a=r[e-1],o=r[e];t.column>0&&o.left>=a.right-.5&&o.top<a.bottom?i.push({axis:`column`,left:a.right,right:o.left,top:Math.max(a.top,o.top),bottom:Math.min(a.bottom,o.bottom)}):t.row>0&&o.top>=a.bottom-.5&&i.push({axis:`row`,left:n.left,right:n.right,top:a.bottom,bottom:o.top})}return i.filter(e=>e.right-e.left>.5&&e.bottom-e.top>.5)}function ac(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}let oc={top:`t`,right:`r`,bottom:`b`,left:`l`},sc={top:`y`,right:`x`,bottom:`y`,left:`x`};function cc(e,t,n,r){let i=new Set(e.classList),a=t===`gap`?[`gap-${n===`row`?`y`:`x`}`,`gap`]:[`${t[0]}${oc[n]}`,`${t[0]}${sc[n]}`,t[0]];for(let e of a){let t=[...i].find(t=>t.startsWith(`${e}-`));if(!t)continue;let n=lc(t.slice(e.length+1));return n!==void 0&&Math.abs(n-r)<.5?t:void 0}}function lc(e){if(e===`px`)return 1;let t=e.match(/^\[(-?[\d.]+)(px|rem)\]$/);if(t)return Number(t[1])*(t[2]===`rem`?uc():1);if(/^\d+(?:\.\d+)?$/.test(e))return Number(e)*.25*uc()}function uc(){return ac(getComputedStyle(document.documentElement).fontSize)||16}async function dc(e){let t=e.getBoundingClientRect(),n=window.getSelection()?.toString().trim(),r=rc(e);return{tagName:e.tagName.toLowerCase(),selector:pc(e),html:vc(e),text:bc(e),components:await xc(e),box:r,rect:{x:t.x,y:t.y,width:t.width,height:t.height},viewport:{width:window.innerWidth,height:window.innerHeight,dpr:Math.round(window.devicePixelRatio*100)/100},...n&&e.contains(window.getSelection()?.anchorNode??null)?{selection:n}:{}}}function fc(e){let t=e.tagName.toLowerCase(),n=Dc(e);if(!n)return t;let r=null;return Bi(n,e=>zi(e)?(r=Gi(e.type),!(!r||Oc(r))):!1,!0),r?`${r} · ${t}`:t}function pc(e){let t=[],n=e;for(;n&&n!==document.documentElement;){let r=mc(n);if(r){t.unshift(r);let n=t.join(` > `);if(gc(n,e))return n}else{t.unshift(hc(n));let r=t.join(` > `);if(t.length>=2&&gc(r,e))return r}n=n.parentElement}return t.join(` > `)}function mc(e){for(let t of[`data-testid`,`data-test`,`data-cy`,`data-tencil-id`]){let n=e.getAttribute(t);if(n)return`${e.tagName.toLowerCase()}[${t}="${CSS.escape(n)}"]`}let t=e.id;return t&&!/[:«»]|\d{3,}/.test(t)?`#${CSS.escape(t)}`:null}function hc(e){let t=e.tagName.toLowerCase(),n=e.parentElement;if(!n)return t;let r=[...n.children].filter(t=>t.tagName===e.tagName);return r.length===1?t:`${t}:nth-of-type(${r.indexOf(e)+1})`}function gc(e,t){try{let n=document.querySelectorAll(e);return n.length===1&&n[0]===t}catch{return!1}}let _c=[`id`,`class`,`href`,`src`,`alt`,`type`,`name`,`role`,`aria-label`];function vc(e){let t=e.tagName.toLowerCase(),n=`<${[t,...[...e.attributes].filter(e=>!e.name.startsWith(`data-tencil`)).sort((e,t)=>yc(e.name)-yc(t.name)).slice(0,8).map(e=>{let t=e.name===`class`?80:120;return e.value?`${e.name}="${Mc(e.value,t)}"`:e.name})].join(` `)}>`,r=e.children.length;return`${n}${r>0?`…${r} element${r===1?``:`s`}…`:Mc(e.textContent?.trim()??``,100)}</${t}>`}function yc(e){let t=_c.indexOf(e);return t===-1?_c.length:t}function bc(e){let t=e.innerText?.replace(/\s+/g,` `).trim();return t?Mc(t,200):void 0}async function xc(e){let t=Sc(e);if(t.length>0)return t;let n=Dc(e);if(!n)return[];try{let e=await Nc(ds(n),1500),t=wc(n),r=e.filter(e=>e.functionName&&!/^[a-z]/.test(e.functionName)&&!Oc(e.functionName)).slice(0,6).map(e=>Tc(e,t.get(e.functionName)));if(r.length>0)return r}catch{}return Ec(n)}function Sc(e){let t=[],n;for(let r=e;r&&t.length<6;r=r.parentElement){let e=r.getAttribute(`data-tencil-src`)?.match(/^(.+):(\d+):(\d+)$/);if(!e)continue;let[,i=``,a,o]=e,s=r.getAttribute(`data-tencil-component`)??Cc(i);s!==n&&(n=s,t.push({name:s,source:{file:i,line:Number(a),column:Number(o)}}))}return t}function Cc(e){return e.slice(e.lastIndexOf(`/`)+1)}function wc(e){let t=/* @__PURE__ */ new Map;try{for(let n of os(e))n.functionName&&n.fileName&&!t.has(n.functionName)&&t.set(n.functionName,Ac(n.fileName))}catch{}return t}function Tc(e,t){let n=e.functionName??`Anonymous`;if(!e.fileName)return{name:n};let r=jc(e.fileName);return r?{name:n,library:r}:hs(e.fileName)?{name:n,source:{file:kc(Ac(e.fileName),t),...e.lineNumber==null?{}:{line:e.lineNumber},...e.columnNumber==null?{}:{column:e.columnNumber}}}:{name:n}}function Ec(e){let t=[];return Bi(e,e=>{if(zi(e)){let n=Gi(e.type);n&&!Oc(n)&&t.push({name:n})}return t.length>=6},!0),t}function Dc(e){try{return ua(e)}catch{return null}}function Oc(e){return/^(?:Anonymous|Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|ErrorBoundary|InnerLayoutRouter|OuterLayoutRouter|RedirectBoundary|NotFoundBoundary|LoadingBoundary|HotReload|Router|AppRouter|ServerRoot|ScrollAndFocusHandler|RenderFromTemplateContext)$/.test(e)||/(?:Provider|Context|Boundary)$/.test(e)}function kc(e,t){return e.includes(`/`)||!t?e:t.endsWith(`/${e}`)?t:e}function Ac(e){let t=e;if(/^https?:\/\//.test(e))try{t=decodeURIComponent(new URL(e).pathname)}catch{}return t.replace(/[?#].*$/,``).replace(/^\/@fs/,``).replace(/^(?:webpack-internal:\/\/\/|webpack:\/\/[^/]*\/|turbopack:\/\/\/|rsc:\/\/React\/[^/]+\/|file:\/\/)/,``).replace(/^\/?\((?:app-pages-browser|ssr|rsc)\)\//,``).replace(/^\.\//,``).replace(/^\/(?=(?:src|app|pages|components|lib)\/)/,``)}function jc(e){return e.match(/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?((?:@[^/]+\/)?[^/]+)/)?.[1]}function Mc(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function Nc(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(/* @__PURE__ */ Error(`timeout`)),t))])}let Pc;function Fc(e){Pc=e}function Ic(){if(!Pc)throw Error(`Tencil overlay is not mounted`);return Pc}let Lc=/* @__PURE__ */ new Map;function Rc(e,t){let n=t??Bc(e.selector);if(!n?.isConnected)return null;let r=n.getBoundingClientRect();return r.width===0&&r.height===0?null:{x:r.left+r.width*e.offsetX,y:r.top+r.height*e.offsetY}}function zc(e,t){let n=e.getBoundingClientRect(),r=(e,t)=>t>0?Hc(e/t,0,1):.5;return{offsetX:r(t.x-n.left,n.width),offsetY:r(t.y-n.top,n.height)}}function Bc(e){if(!e)return null;let t=Lc.get(e)?.deref();if(t?.isConnected&&t.matches(e))return t;try{let t=document.querySelector(e);return t&&Lc.set(e,new WeakRef(t)),t}catch{return null}}function Vc(e,t,n=16){let r=window.innerWidth,i=window.innerHeight,a=e.x+n;a+t.width>r-12&&(a=e.x-n-t.width),a=Hc(a,12,r-t.width-12);let o=Hc(e.y-24,12,i-t.height-12),s=`${Hc(e.x-a,0,t.width)}px ${Hc(e.y-o,0,t.height)}px`;return{left:a,top:o,origin:s}}function Hc(e,t,n){return Math.max(t,Math.min(n,e))}function Uc(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}let Wc;function Gc(){let e=/* @__PURE__ */ new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}function Kc(e){let t=-1;Wc||=Gc();for(let n=0;n<e.length;n++)t=Wc[(t^e[n])&255]^t>>>8;return t^-1}function qc(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===112&&e[n-2]===72&&e[n-1]===89&&e[n]===115)return n-3;return 0}function Jc(e,t,n=!1){let r=/* @__PURE__ */ new Uint8Array(13);t*=39.3701,r[0]=112,r[1]=72,r[2]=89,r[3]=115,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let i=Kc(r),a=/* @__PURE__ */ new Uint8Array(4);if(a[0]=i>>>24,a[1]=i>>>16,a[2]=i>>>8,a[3]=i&255,n){let t=qc(e);return e.set(r,t),e.set(a,t+13),e}{let t=/* @__PURE__ */ new Uint8Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=9;let n=/* @__PURE__ */ new Uint8Array(54);return n.set(e,0),n.set(t,33),n.set(r,37),n.set(a,50),n}}function Yc(e){let t=e.indexOf(`AAlwSFlz`);return t===-1&&(t=e.indexOf(`AAAJcEhZ`)),t===-1&&(t=e.indexOf(`AAAACXBI`)),t}let Xc=`[modern-screenshot]`,Zc=typeof window<`u`,Qc=Zc&&`Worker`in window,$c=Zc&&`atob`in window,el=Zc&&`btoa`in window,tl=Zc?window.navigator?.userAgent:``,nl=tl.includes(`Chrome`),rl=tl.includes(`AppleWebKit`)&&!nl,il=tl.includes(`Firefox`),al=e=>e&&`__CONTEXT__`in e,ol=e=>e.constructor.name===`CSSFontFaceRule`,sl=e=>e.constructor.name===`CSSImportRule`,cl=e=>e.constructor.name===`CSSLayerBlockRule`,ll=e=>e.nodeType===1,ul=e=>typeof e.className==`object`,dl=e=>e.tagName===`image`,fl=e=>e.tagName===`use`,pl=e=>ll(e)&&e.style!==void 0&&!ul(e),ml=e=>e.nodeType===8,hl=e=>e.nodeType===3,gl=e=>e.tagName===`IMG`,_l=e=>e.tagName===`VIDEO`,vl=e=>e.tagName===`CANVAS`,yl=e=>e.tagName===`TEXTAREA`,bl=e=>e.tagName===`INPUT`,xl=e=>e.tagName===`STYLE`,Sl=e=>e.tagName===`SCRIPT`,Cl=e=>e.tagName===`SELECT`,wl=e=>e.tagName===`SLOT`,Tl=e=>e.tagName===`IFRAME`,El=(...e)=>console.warn(Xc,...e);function Dl(e){let t=e?.createElement?.(`canvas`);return t&&(t.height=t.width=1),!!t&&`toDataURL`in t&&!!t.toDataURL(`image/webp`).includes(`image/webp`)}let Ol=e=>e.startsWith(`data:`);function kl(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Zc&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Zc)return e;let n=Al().implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function Al(e){return(e&&ll(e)?e?.ownerDocument:e)??window.document}let jl=`http://www.w3.org/2000/svg`;function Ml(e,t,n){let r=Al(n).createElementNS(jl,`svg`);return r.setAttributeNS(null,`width`,e.toString()),r.setAttributeNS(null,`height`,t.toString()),r.setAttributeNS(null,`viewBox`,`0 0 ${e} ${t}`),r}function Nl(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,``)),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Pl(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(/* @__PURE__ */ Error(`Failed read blob to ${t}`)),t===`dataUrl`?i.readAsDataURL(e):t===`arrayBuffer`&&i.readAsArrayBuffer(e)})}let Fl=e=>Pl(e,`dataUrl`);function Il(e,t){let n=Al(t).createElement(`img`);return n.decoding=`sync`,n.loading=`eager`,n.src=e,n}function Ll(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:a,onWarn:o}=t??{},s=typeof e==`string`?Il(e,Al(i)):e,c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(r&&(c=setTimeout(u,r)),_l(s)){let e=s.currentSrc||s.src;if(!e)return s.poster?Ll(s.poster,t).then(n):u();if(s.readyState>=2)return u();let r=u,i=t=>{o?.(`Failed video load`,e,t),a?.(t),u()};l=()=>{s.removeEventListener(`loadeddata`,r),s.removeEventListener(`error`,i)},s.addEventListener(`loadeddata`,r,{once:!0}),s.addEventListener(`error`,i,{once:!0})}else{let e=dl(s)?s.href.baseVal:s.currentSrc||s.src;if(!e)return u();let t=async()=>{if(gl(s)&&`decode`in s)try{await s.decode()}catch(t){o?.(`Failed to decode image, trying to render anyway`,s.dataset.originalSrc||e,t)}u()},n=t=>{o?.(`Failed image load`,s.dataset.originalSrc||e,t),u()};if(gl(s)&&s.complete)return t();l=()=>{s.removeEventListener(`load`,t),s.removeEventListener(`error`,n)},s.addEventListener(`load`,t,{once:!0}),s.addEventListener(`error`,n,{once:!0})}})}async function Rl(e,t){pl(e)&&(gl(e)||_l(e)?await Ll(e,t):await Promise.all([`img`,`video`].flatMap(n=>Array.from(e.querySelectorAll(n)).map(e=>Ll(e,t)))))}let zl=/* @__PURE__ */ function(){let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)}();function Bl(e){return e?.split(`,`).map(e=>e.trim().replace(/"|'/g,``).toLowerCase()).filter(Boolean)}let Vl=0;function Hl(e){let t=`${Xc}[#${Vl}]`;return Vl++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...t)=>e&&El(...t)}}function Ul(e){return{cache:e?`no-cache`:`force-cache`}}async function Wl(e,t){return al(e)?e:Gl(e,{...t,autoDestruct:!0})}async function Gl(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},a=!!t?.debug,o=t?.features??!0,s=e.ownerDocument??(Zc?window.document:void 0),c=e.ownerDocument?.defaultView??(Zc?window:void 0),l=/* @__PURE__ */ new Map,u={width:0,height:0,quality:1,type:`image/png`,scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:a,fetch:{requestInit:Ul(t?.fetch?.bypassingCache),placeholderImage:`data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:Hl(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:Kl(s),svgDefsElement:s?.createElementNS(jl,`defs`),svgStyles:/* @__PURE__ */ new Map,defaultComputedStyles:/* @__PURE__ */ new Map,workers:[...Array.from({length:Qc&&r&&i?i:0})].map(()=>{try{let e=new Worker(r);return e.onmessage=async e=>{let{url:t,result:n}=e.data;n?l.get(t)?.resolve?.(n):l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e.onmessageerror=e=>{let{url:t}=e.data;l.get(t)?.reject?.(/* @__PURE__ */ Error(`Error receiving message from worker: ${t}`))},e}catch(e){return u.log.warn(`Failed to new Worker`,e),null}}).filter(Boolean),fontFamilies:/* @__PURE__ */ new Map,fontCssTexts:/* @__PURE__ */ new Map,acceptOfImage:`${[Dl(s)&&`image/webp`,`image/svg+xml`,`image/*`,`*/*`].filter(Boolean).join(`,`)};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:o,isEnable:e=>e===`restoreScrollPosition`?typeof o==`boolean`?!1:o[e]??!1:typeof o==`boolean`?o:o[e]??!0,shadowRoots:[]};u.log.time(`wait until load`),await Rl(e,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd(`wait until load`);let{width:d,height:f}=ql(e,u);return u.width=d,u.height=f,u}function Kl(e){if(!e)return;let t=e.createElement(`style`),n=t.ownerDocument.createTextNode(`
57
57
  .______background-clip--text {
58
58
  background-clip: text;
59
59
  -webkit-background-clip: text;
60
60
  }
61
- `);return t.appendChild(n),t}function Gl(e,t){let{width:n,height:r}=t;if(sl(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute(`width`))||0,r=r||t.height||Number(e.getAttribute(`height`))||0}return{width:n,height:r}}async function Kl(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await Fl(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=ql(e.ownerDocument,t),l=()=>{try{c?.drawImage(o,0,0,s.width,s.height)}catch(e){t.log.warn(`Failed to drawImage`,e)}};if(l(),t.isEnable(`fixSvgXmlDecode`))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),t()},e+a)});return t.drawImageCount=0,n.timeEnd(`image to canvas`),s}function ql(e,t){let{width:n,height:r,scale:i,backgroundColor:a,maximumCanvasSize:o}=t,s=e.createElement(`canvas`);s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,o&&(s.width>o||s.height>o)&&(s.width>o&&s.height>o?s.width>s.height?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o):s.width>o?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o));let c=s.getContext(`2d`);return c&&a&&(c.fillStyle=a,c.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:c}}function Jl(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return Pl(t,e.ownerDocument)}catch(e){t.log.warn(`Failed to clone canvas`,e)}let n=e.cloneNode(!1),r=e.getContext(`2d`),i=n.getContext(`2d`);try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn(`Failed to clone canvas`,e)}return n}function Yl(e,t){try{if(e?.contentDocument?.documentElement)return hu(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function Xl(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`),t}async function Zl(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Pl(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin=`anonymous`,e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await Fl(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Pl(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener(`seeked`,e,{once:!0})});let a=r.createElement(`canvas`);a.width=e.offsetWidth,a.height=e.offsetHeight;try{let e=a.getContext(`2d`);e&&e.drawImage(n,0,0,a.width,a.height)}catch(r){return t.log.warn(`Failed to clone video`,r),e.poster?Pl(e.poster,e.ownerDocument):n}return Jl(a,t)}return n}function Ql(e,t){return gl(e)?Jl(e,t):Cl(e)?Yl(e,t):ml(e)?Xl(e):hl(e)?Zl(e,t):e.cloneNode(!1)}function $l(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${Ll()}`,t.width=`0`,t.height=`0`,t.style.visibility=`hidden`,t.style.position=`fixed`,n.body.appendChild(t),t.srcdoc=`<!DOCTYPE html><meta charset="UTF-8"><title></title><body>`,e.sandbox=t)}catch(t){e.log.warn(`Failed to getSandBox`,t)}}return t}let eu=[`width`,`height`,`-webkit-text-fill-color`],tu=[`stroke`,`fill`];function nu(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=cl(e)&&i!==`svg`,o=a?tu.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>e!==null):[],s=[a&&`svg`,i,o.map((e,t)=>`${e}=${t}`).join(`,`),t].filter(Boolean).join(`:`);if(r.has(s))return r.get(s);let c=$l(n)?.contentWindow;if(!c)return/* @__PURE__ */ new Map;let l=c?.document,u,d;a?(u=l.createElementNS(kl,`svg`),d=u.ownerDocument.createElementNS(u.namespaceURI,i),o.forEach(([e,t])=>{d.setAttributeNS(null,e,t)}),u.appendChild(d)):u=d=l.createElement(i),d.textContent=` `,l.body.appendChild(u);let f=c.getComputedStyle(d,t),p=/* @__PURE__ */ new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);eu.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function ru(e,t,n){let r=/* @__PURE__ */ new Map,i=[],a=/* @__PURE__ */ new Map;if(n)for(let e of n)o(e);else for(let t=e.length,n=0;n<t;n++)o(e.item(n));for(let e=i.length,t=0;t<e;t++)a.get(i[t])?.forEach((e,t)=>r.set(t,e));function o(n){let o=e.getPropertyValue(n),s=e.getPropertyPriority(n),c=n.lastIndexOf(`-`),l=c>-1?n.substring(0,c):void 0;if(l){let e=a.get(l);e||(e=/* @__PURE__ */ new Map,a.set(l,e)),e.set(n,[o,s])}(t.get(n)!==o||s)&&(l?i.push(l):r.set(n,[o,s]))}return r}function iu(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=nu(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=ru(c,l,a);u.delete(`transition-property`),u.delete(`all`),u.delete(`d`),u.delete(`content`),n&&(u.delete(`position`),u.delete(`margin-top`),u.delete(`margin-right`),u.delete(`margin-bottom`),u.delete(`margin-left`),u.delete(`margin-block-start`),u.delete(`margin-block-end`),u.delete(`margin-inline-start`),u.delete(`margin-inline-end`),u.set(`box-sizing`,[`border-box`,``])),u.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`),el&&(u.has(`font-kerning`)||u.set(`font-kerning`,[`normal`,``]),(u.get(`overflow-x`)?.[0]===`hidden`||u.get(`overflow-y`)?.[0]===`hidden`)&&u.get(`text-overflow`)?.[0]===`ellipsis`&&e.scrollWidth===e.clientWidth&&u.set(`text-overflow`,[`clip`,``]));for(let e=s.length,t=0;t<e;t++)s.removeProperty(s.item(t));return u.forEach(([e,t],n)=>{s.setProperty(n,e,t)}),u}function au(e,t){(_l(e)||vl(e)||xl(e))&&t.setAttribute(`value`,e.value)}let ou=[`::before`,`::after`],su=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function cu(e,t,n,r,i){let{ownerWindow:a,svgStyleElement:o,svgStyles:s,currentNodeStyle:c}=r;if(!o||!a)return;function l(n){let o=a.getComputedStyle(e,n),l=o.getPropertyValue(`content`);if(!l||l===`none`)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,``);let u=[Ll()],d=nu(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=ru(o,d,r.includeStyleProperties);f.delete(`content`),f.delete(`-webkit-locale`),f.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`);let p=[`content: '${l}';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?` !important`:``};`)}),p.length===1)return;try{t.className=[t.className,...u].join(` `)}catch(e){r.log.warn(`Failed to copyPseudoClass`,e);return}let m=p.join(`
62
- `),h=s.get(m);h||(h=[],s.set(m,h)),h.push(`.${u[0]}${n}`)}ou.forEach(l),n&&su.forEach(l)}let lu=/* @__PURE__ */ new Set([`symbol`]);async function uu(e,t,n,r,i){if(sl(n)&&(yl(n)||bl(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=lu.has(t.nodeName)||lu.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await hu(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&fu(e,a),t.appendChild(a)}async function du(e,t,n,r){let i=e.firstChild;sl(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let a=i;a;a=a.nextSibling)if(!fl(a)){if(sl(a)&&Sl(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await uu(e,t,i[a],n,r)}else await uu(e,t,a,n,r)}}function fu(e,t){if(!dl(e)||!dl(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,a=new DOMMatrix(i),{a:o,b:s,c,d:l}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=o,a.b=s,a.c=c,a.d=l,t.style.transform=a.toString()}function pu(e,t){let{backgroundColor:n,width:r,height:i,style:a}=t,o=e.style;if(n&&o.setProperty(`background-color`,n,`important`),r&&o.setProperty(`width`,`${r}px`,`important`),i&&o.setProperty(`height`,`${i}px`,`important`),a)for(let e in a)o[e]=a[e]}let mu=/^[\w-:]+$/;async function hu(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&pl(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&sl(e)&&(dl(e)||cl(e))){let r=await Ql(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];mu.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=iu(e,r,n,t);n&&pu(r,t);let a=!1;if(t.isEnable(`copyScrollbar`)){let t=[i.get(`overflow-x`)?.[0],i.get(`overflow-y`)?.[0]];a=t.includes(`scroll`)||(t.includes(`auto`)||t.includes(`overlay`))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let c=i.get(`text-transform`)?.[0],l=Rl(i.get(`font-family`)?.[0]),u=l?e=>{c===`uppercase`?e=e.toUpperCase():c===`lowercase`?e=e.toLowerCase():c===`capitalize`&&(e=e[0].toUpperCase()+e.substring(1)),l.forEach(t=>{let n=o.get(t);n||o.set(t,n=/* @__PURE__ */ new Set),e.split(``).forEach(e=>n.add(e))})}:void 0;return cu(e,r,a,t,u),au(e,r),hl(e)||await du(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await du(e,c,t),await s?.(c),c}function gu(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn(`Failed to destroyContext`,t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function _u(e){let{url:t,timeout:n,responseType:r,...i}=e,a=new AbortController,o=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...i}).then(e=>{if(!e.ok)throw Error(`Failed fetch, not 2xx response`,{cause:e});switch(r){case`arrayBuffer`:return e.arrayBuffer();case`dataUrl`:return e.blob().then(Nl);default:return e.text()}}).finally(()=>clearTimeout(o))}function vu(e,t){let{url:n,requestType:r=`text`,responseType:i=`text`,imageDom:a}=t,o=n,{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:m,workers:h,fontFamilies:g}=e;r===`image`&&(tl||nl)&&e.drawImageCount++;let _=l.get(n);if(!_){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?`&`:`?`)+(/* @__PURE__ */ new Date()).getTime());let t=r.startsWith(`font`)&&m&&m.minify,v=/* @__PURE__ */ new Set;t&&r.split(`;`)[1].split(`,`).forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let y=t&&v.size,b={url:o,timeout:s,responseType:y?`arrayBuffer`:i,headers:r===`image`?{accept:c}:void 0,...d};_={type:r,resolve:void 0,reject:void 0,response:null},_.response=(async()=>{if(u&&r===`image`){let e=await u(n);if(e)return e}return!tl&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):_u(b)})().catch(t=>{if(l.delete(n),r===`image`&&p)return e.log.warn(`Failed to fetch image base64, trying to use placeholder image`,o),typeof p==`string`?p:p(a);throw t}),l.set(n,_)}return _.response}async function yu(e,t,n,r){if(!bu(e))return e;for(let[i,a]of Su(e,t))try{let t=await vu(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(Cu(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function bu(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}let xu=/url\((['"]?)([^'"]+?)\1\)/g;function Su(e,t){let n=[];return e.replace(xu,(e,r,i)=>(n.push([i,Dl(i,t)]),e)),n.filter(([e])=>!El(e))}function Cu(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}let wu=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function Tu(e,t){return wu.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((tl||nl)&&t.drawImageCount++,yu(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function Eu(e,t){if(ml(e)){let n=e.currentSrc||e.src;if(!El(n))return[vu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(tl||nl)&&t.drawImageCount++}else if(cl(e)&&!El(e.href.baseVal)){let n=e.href.baseVal;return[vu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function Du(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute(`href`)??e.getAttribute(`xlink:href`);if(!i)return[];let[a,o]=i.split(`#`);if(o){let i=`#${o}`,s=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(a&&e.setAttribute(`href`,i),r?.querySelector(i))return[];if(s)return r?.appendChild(s.cloneNode(!0)),[];if(a)return[vu(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function Ou(e,t){let{tasks:n}=t;sl(e)&&((ml(e)||ll(e))&&n.push(...Eu(e,t)),ul(e)&&n.push(...Du(e,t))),dl(e)&&n.push(...Tu(e.style,t)),e.childNodes.forEach(e=>{Ou(e,t)})}async function ku(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:a,tasks:o,font:s}=t;if(n&&r&&i.size){if(s&&s.cssText){let e=Fu(s.cssText,t);r.appendChild(n.createTextNode(`${e}
63
- `))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return`cssRules`in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),s=n.implementation.createHTMLDocument(``),c=s.createElement(`style`);s.head.appendChild(c);let l=c.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if(al(e)){let n=e.href,r=``;try{r=await vu(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(xu,(e,t,r)=>e.replace(r,Dl(r,n)));for(let e of Mu(i))try{l.insertRule(e,l.cssRules.length)}catch(n){t.log.warn(`Error inserting rule from remote css import`,{rule:e,error:n})}}}))),l.cssRules.length&&e.push(l);let u=[];e.forEach(e=>{Iu(e.cssRules,u)}),u.filter(e=>il(e)&&bu(e.style.getPropertyValue(`src`))&&Rl(e.style.getPropertyValue(`font-family`))?.some(e=>i.has(e))).forEach(e=>{let i=e,s=a.get(i.cssText);s?r.appendChild(n.createTextNode(`${s}
64
- `)):o.push(yu(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=Fu(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
65
- `))}))})}}}let Au=/(\/\*[\s\S]*?\*\/)/g,ju=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Mu(e){if(e==null)return[];let t=[],n=e.replace(Au,``);for(;;){let e=ju.exec(n);if(!e)break;t.push(e[0])}n=n.replace(ju,``);let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=/* @__PURE__ */ RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else if(e=i.exec(n),e)r.lastIndex=i.lastIndex;else break;t.push(e[0])}return t}let Nu=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Pu=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Fu(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(Pu,e=>{for(;;){let[t,,n]=Nu.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function Iu(e,t=[]){for(let n of Array.from(e))ol(n)?t.push(...Iu(n.cssRules)):`cssRules`in n?Iu(n.cssRules,t):t.push(n);return t}let Lu=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function Ru(e){return Lu.test(e.innerHTML)}async function zu(e,t){let n=await Hl(e,t);if(sl(n.node)&&cl(n.node)&&!Ru(n.node))return n.node;let{ownerDocument:r,log:i,tasks:a,svgStyleElement:o,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:m}=n;i.time(`clone node`);let h=await hu(n.node,n,!0);if(o&&r){let e=``;c.forEach((t,n)=>{e+=`${t.join(`,
61
+ `);return t.appendChild(n),t}function ql(e,t){let{width:n,height:r}=t;if(ll(e)&&(!n||!r)){let t=e.getBoundingClientRect();n=n||t.width||Number(e.getAttribute(`width`))||0,r=r||t.height||Number(e.getAttribute(`height`))||0}return{width:n,height:r}}async function Jl(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:a}=t;n.time(`image to canvas`);let o=await Ll(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:c}=Yl(e.ownerDocument,t),l=()=>{try{c?.drawImage(o,0,0,s.width,s.height)}catch(e){t.log.warn(`Failed to drawImage`,e)}};if(l(),t.isEnable(`fixSvgXmlDecode`))for(let e=0;e<i;e++)await new Promise(t=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),t()},e+a)});return t.drawImageCount=0,n.timeEnd(`image to canvas`),s}function Yl(e,t){let{width:n,height:r,scale:i,backgroundColor:a,maximumCanvasSize:o}=t,s=e.createElement(`canvas`);s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,o&&(s.width>o||s.height>o)&&(s.width>o&&s.height>o?s.width>s.height?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o):s.width>o?(s.height*=o/s.width,s.width=o):(s.width*=o/s.height,s.height=o));let c=s.getContext(`2d`);return c&&a&&(c.fillStyle=a,c.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:c}}function Xl(e,t){if(e.ownerDocument)try{let t=e.toDataURL();if(t!==`data:,`)return Il(t,e.ownerDocument)}catch(e){t.log.warn(`Failed to clone canvas`,e)}let n=e.cloneNode(!1),r=e.getContext(`2d`),i=n.getContext(`2d`);try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(e){t.log.warn(`Failed to clone canvas`,e)}return n}function Zl(e,t){try{if(e?.contentDocument?.documentElement)return _u(e.contentDocument.documentElement,t)}catch(e){t.log.warn(`Failed to clone iframe`,e)}return e.cloneNode(!1)}function Ql(e){let t=e.cloneNode(!1);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=``),t.loading===`lazy`&&(t.loading=`eager`),t}async function $l(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Il(e.poster,e.ownerDocument);let n=e.cloneNode(!1);n.crossOrigin=`anonymous`,e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=!0;if(await Ll(n,{onError:()=>i=!1,onWarn:t.log.warn}),!i)return e.poster?Il(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(e=>{n.addEventListener(`seeked`,e,{once:!0})});let a=r.createElement(`canvas`);a.width=e.offsetWidth,a.height=e.offsetHeight;try{let e=a.getContext(`2d`);e&&e.drawImage(n,0,0,a.width,a.height)}catch(r){return t.log.warn(`Failed to clone video`,r),e.poster?Il(e.poster,e.ownerDocument):n}return Xl(a,t)}return n}function eu(e,t){return vl(e)?Xl(e,t):Tl(e)?Zl(e,t):gl(e)?Ql(e):_l(e)?$l(e,t):e.cloneNode(!1)}function tu(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement(`iframe`),t.id=`__SANDBOX__${zl()}`,t.width=`0`,t.height=`0`,t.style.visibility=`hidden`,t.style.position=`fixed`,n.body.appendChild(t),t.srcdoc=`<!DOCTYPE html><meta charset="UTF-8"><title></title><body>`,e.sandbox=t)}catch(t){e.log.warn(`Failed to getSandBox`,t)}}return t}let nu=[`width`,`height`,`-webkit-text-fill-color`],ru=[`stroke`,`fill`];function iu(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),a=ul(e)&&i!==`svg`,o=a?ru.map(t=>[t,e.getAttribute(t)]).filter(([,e])=>e!==null):[],s=[a&&`svg`,i,o.map((e,t)=>`${e}=${t}`).join(`,`),t].filter(Boolean).join(`:`);if(r.has(s))return r.get(s);let c=tu(n)?.contentWindow;if(!c)return/* @__PURE__ */ new Map;let l=c?.document,u,d;a?(u=l.createElementNS(jl,`svg`),d=u.ownerDocument.createElementNS(u.namespaceURI,i),o.forEach(([e,t])=>{d.setAttributeNS(null,e,t)}),u.appendChild(d)):u=d=l.createElement(i),d.textContent=` `,l.body.appendChild(u);let f=c.getComputedStyle(d,t),p=/* @__PURE__ */ new Map;for(let e=f.length,t=0;t<e;t++){let e=f.item(t);nu.includes(e)||p.set(e,f.getPropertyValue(e))}return l.body.removeChild(u),r.set(s,p),p}function au(e,t,n){let r=/* @__PURE__ */ new Map,i=[],a=/* @__PURE__ */ new Map;if(n)for(let e of n)o(e);else for(let t=e.length,n=0;n<t;n++)o(e.item(n));for(let e=i.length,t=0;t<e;t++)a.get(i[t])?.forEach((e,t)=>r.set(t,e));function o(n){let o=e.getPropertyValue(n),s=e.getPropertyPriority(n),c=n.lastIndexOf(`-`),l=c>-1?n.substring(0,c):void 0;if(l){let e=a.get(l);e||(e=/* @__PURE__ */ new Map,a.set(l,e)),e.set(n,[o,s])}(t.get(n)!==o||s)&&(l?i.push(l):r.set(n,[o,s]))}return r}function ou(e,t,n,r){let{ownerWindow:i,includeStyleProperties:a,currentParentNodeStyle:o}=r,s=t.style,c=i.getComputedStyle(e),l=iu(e,null,r);o?.forEach((e,t)=>{l.delete(t)});let u=au(c,l,a);u.delete(`transition-property`),u.delete(`all`),u.delete(`d`),u.delete(`content`),n&&(u.delete(`position`),u.delete(`margin-top`),u.delete(`margin-right`),u.delete(`margin-bottom`),u.delete(`margin-left`),u.delete(`margin-block-start`),u.delete(`margin-block-end`),u.delete(`margin-inline-start`),u.delete(`margin-inline-end`),u.set(`box-sizing`,[`border-box`,``])),u.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`),nl&&(u.has(`font-kerning`)||u.set(`font-kerning`,[`normal`,``]),(u.get(`overflow-x`)?.[0]===`hidden`||u.get(`overflow-y`)?.[0]===`hidden`)&&u.get(`text-overflow`)?.[0]===`ellipsis`&&e.scrollWidth===e.clientWidth&&u.set(`text-overflow`,[`clip`,``]));for(let e=s.length,t=0;t<e;t++)s.removeProperty(s.item(t));return u.forEach(([e,t],n)=>{s.setProperty(n,e,t)}),u}function su(e,t){(yl(e)||bl(e)||Cl(e))&&t.setAttribute(`value`,e.value)}let cu=[`::before`,`::after`],lu=[`::-webkit-scrollbar`,`::-webkit-scrollbar-button`,`::-webkit-scrollbar-thumb`,`::-webkit-scrollbar-track`,`::-webkit-scrollbar-track-piece`,`::-webkit-scrollbar-corner`,`::-webkit-resizer`];function uu(e,t,n,r,i){let{ownerWindow:a,svgStyleElement:o,svgStyles:s,currentNodeStyle:c}=r;if(!o||!a)return;function l(n){let o=a.getComputedStyle(e,n),l=o.getPropertyValue(`content`);if(!l||l===`none`)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,``);let u=[zl()],d=iu(e,n,r);c?.forEach((e,t)=>{d.delete(t)});let f=au(o,d,r.includeStyleProperties);f.delete(`content`),f.delete(`-webkit-locale`),f.get(`background-clip`)?.[0]===`text`&&t.classList.add(`______background-clip--text`);let p=[`content: '${l}';`];if(f.forEach(([e,t],n)=>{p.push(`${n}: ${e}${t?` !important`:``};`)}),p.length===1)return;try{t.className=[t.className,...u].join(` `)}catch(e){r.log.warn(`Failed to copyPseudoClass`,e);return}let m=p.join(`
62
+ `),h=s.get(m);h||(h=[],s.set(m,h)),h.push(`.${u[0]}${n}`)}cu.forEach(l),n&&lu.forEach(l)}let du=/* @__PURE__ */ new Set([`symbol`]);async function fu(e,t,n,r,i){if(ll(n)&&(xl(n)||Sl(n))||r.filter&&!r.filter(n))return;r.currentParentNodeStyle=du.has(t.nodeName)||du.has(n.nodeName)?void 0:r.currentNodeStyle;let a=await _u(n,r,!1,i);r.isEnable(`restoreScrollPosition`)&&mu(e,a),t.appendChild(a)}async function pu(e,t,n,r){let i=e.firstChild;ll(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let a=i;a;a=a.nextSibling)if(!ml(a)){if(ll(a)&&wl(a)&&typeof a.assignedNodes==`function`){let i=a.assignedNodes();for(let a=0;a<i.length;a++)await fu(e,t,i[a],n,r)}else await fu(e,t,a,n,r)}}function mu(e,t){if(!pl(e)||!pl(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,a=new DOMMatrix(i),{a:o,b:s,c,d:l}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=o,a.b=s,a.c=c,a.d=l,t.style.transform=a.toString()}function hu(e,t){let{backgroundColor:n,width:r,height:i,style:a}=t,o=e.style;if(n&&o.setProperty(`background-color`,n,`important`),r&&o.setProperty(`width`,`${r}px`,`important`),i&&o.setProperty(`height`,`${i}px`,`important`),a)for(let e in a)o[e]=a[e]}let gu=/^[\w-:]+$/;async function _u(e,t,n=!1,r){let{ownerDocument:i,ownerWindow:a,fontFamilies:o,onCloneEachNode:s}=t;if(i&&hl(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&a&&ll(e)&&(pl(e)||ul(e))){let r=await eu(e,t);if(t.isEnable(`removeAbnormalAttributes`)){let e=r.getAttributeNames();for(let t=e.length,n=0;n<t;n++){let t=e[n];gu.test(t)||r.removeAttribute(t)}}let i=t.currentNodeStyle=ou(e,r,n,t);n&&hu(r,t);let a=!1;if(t.isEnable(`copyScrollbar`)){let t=[i.get(`overflow-x`)?.[0],i.get(`overflow-y`)?.[0]];a=t.includes(`scroll`)||(t.includes(`auto`)||t.includes(`overlay`))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let c=i.get(`text-transform`)?.[0],l=Bl(i.get(`font-family`)?.[0]),u=l?e=>{c===`uppercase`?e=e.toUpperCase():c===`lowercase`?e=e.toLowerCase():c===`capitalize`&&(e=e[0].toUpperCase()+e.substring(1)),l.forEach(t=>{let n=o.get(t);n||o.set(t,n=/* @__PURE__ */ new Set),e.split(``).forEach(e=>n.add(e))})}:void 0;return uu(e,r,a,t,u),su(e,r),_l(e)||await pu(e,r,t,u),await s?.(r),r}let c=e.cloneNode(!1);return await pu(e,c,t),await s?.(c),c}function vu(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn(`Failed to destroyContext`,t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function yu(e){let{url:t,timeout:n,responseType:r,...i}=e,a=new AbortController,o=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...i}).then(e=>{if(!e.ok)throw Error(`Failed fetch, not 2xx response`,{cause:e});switch(r){case`arrayBuffer`:return e.arrayBuffer();case`dataUrl`:return e.blob().then(Fl);default:return e.text()}}).finally(()=>clearTimeout(o))}function bu(e,t){let{url:n,requestType:r=`text`,responseType:i=`text`,imageDom:a}=t,o=n,{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:f,placeholderImage:p},font:m,workers:h,fontFamilies:g}=e;r===`image`&&(rl||il)&&e.drawImageCount++;let _=l.get(n);if(!_){f&&f instanceof RegExp&&f.test(o)&&(o+=(/\?/.test(o)?`&`:`?`)+(/* @__PURE__ */ new Date()).getTime());let t=r.startsWith(`font`)&&m&&m.minify,v=/* @__PURE__ */ new Set;t&&r.split(`;`)[1].split(`,`).forEach(e=>{g.has(e)&&g.get(e).forEach(e=>v.add(e))});let y=t&&v.size,b={url:o,timeout:s,responseType:y?`arrayBuffer`:i,headers:r===`image`?{accept:c}:void 0,...d};_={type:r,resolve:void 0,reject:void 0,response:null},_.response=(async()=>{if(u&&r===`image`){let e=await u(n);if(e)return e}return!rl&&n.startsWith(`http`)&&h.length?new Promise((e,t)=>{h[l.size&h.length-1].postMessage({rawUrl:n,...b}),_.resolve=e,_.reject=t}):yu(b)})().catch(t=>{if(l.delete(n),r===`image`&&p)return e.log.warn(`Failed to fetch image base64, trying to use placeholder image`,o),typeof p==`string`?p:p(a);throw t}),l.set(n,_)}return _.response}async function xu(e,t,n,r){if(!Su(e))return e;for(let[i,a]of wu(e,t))try{let t=await bu(n,{url:a,requestType:r?`image`:`text`,responseType:`dataUrl`});e=e.replace(Tu(i),`$1${t}$3`)}catch(e){n.log.warn(`Failed to fetch css data url`,i,e)}return e}function Su(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}let Cu=/url\((['"]?)([^'"]+?)\1\)/g;function wu(e,t){let n=[];return e.replace(Cu,(e,r,i)=>(n.push([i,kl(i,t)]),e)),n.filter(([e])=>!Ol(e))}function Tu(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}let Eu=[`background-image`,`border-image-source`,`-webkit-border-image`,`-webkit-mask-image`,`list-style-image`];function Du(e,t){return Eu.map(n=>{let r=e.getPropertyValue(n);return!r||r===`none`?null:((rl||il)&&t.drawImageCount++,xu(r,null,t,!0).then(t=>{t&&r!==t&&e.setProperty(n,t,e.getPropertyPriority(n))}))}).filter(Boolean)}function Ou(e,t){if(gl(e)){let n=e.currentSrc||e.src;if(!Ol(n))return[bu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.srcset=``,e.dataset.originalSrc=n,e.src=t||``)})];(rl||il)&&t.drawImageCount++}else if(ul(e)&&!Ol(e.href.baseVal)){let n=e.href.baseVal;return[bu(t,{url:n,imageDom:e,requestType:`image`,responseType:`dataUrl`}).then(t=>{t&&(e.dataset.originalSrc=n,e.href.baseVal=t||``)})]}return[]}function ku(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute(`href`)??e.getAttribute(`xlink:href`);if(!i)return[];let[a,o]=i.split(`#`);if(o){let i=`#${o}`,s=t.shadowRoots.reduce((e,t)=>e??t.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(a&&e.setAttribute(`href`,i),r?.querySelector(i))return[];if(s)return r?.appendChild(s.cloneNode(!0)),[];if(a)return[bu(t,{url:a,responseType:`text`}).then(e=>{r?.insertAdjacentHTML(`beforeend`,e)})]}return[]}function Au(e,t){let{tasks:n}=t;ll(e)&&((gl(e)||dl(e))&&n.push(...Ou(e,t)),fl(e)&&n.push(...ku(e,t))),pl(e)&&n.push(...Du(e.style,t)),e.childNodes.forEach(e=>{Au(e,t)})}async function ju(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:a,tasks:o,font:s}=t;if(n&&r&&i.size){if(s&&s.cssText){let e=Lu(s.cssText,t);r.appendChild(n.createTextNode(`${e}
63
+ `))}else{let e=Array.from(n.styleSheets).filter(e=>{try{return`cssRules`in e&&!!e.cssRules.length}catch(n){return t.log.warn(`Error while reading CSS rules from ${e.href}`,n),!1}}),s=n.implementation.createHTMLDocument(``),c=s.createElement(`style`);s.head.appendChild(c);let l=c.sheet;await Promise.all(e.flatMap(e=>Array.from(e.cssRules).map(async e=>{if(sl(e)){let n=e.href,r=``;try{r=await bu(t,{url:n,requestType:`text`,responseType:`text`})}catch(e){t.log.warn(`Error fetch remote css import from ${n}`,e)}let i=r.replace(Cu,(e,t,r)=>e.replace(r,kl(r,n)));for(let e of Pu(i))try{l.insertRule(e,l.cssRules.length)}catch(n){t.log.warn(`Error inserting rule from remote css import`,{rule:e,error:n})}}}))),l.cssRules.length&&e.push(l);let u=[];e.forEach(e=>{Ru(e.cssRules,u)}),u.filter(e=>ol(e)&&Su(e.style.getPropertyValue(`src`))&&Bl(e.style.getPropertyValue(`font-family`))?.some(e=>i.has(e))).forEach(e=>{let i=e,s=a.get(i.cssText);s?r.appendChild(n.createTextNode(`${s}
64
+ `)):o.push(xu(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,t).then(e=>{e=Lu(e,t),a.set(i.cssText,e),r.appendChild(n.createTextNode(`${e}
65
+ `))}))})}}}let Mu=/(\/\*[\s\S]*?\*\/)/g,Nu=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Pu(e){if(e==null)return[];let t=[],n=e.replace(Mu,``);for(;;){let e=Nu.exec(n);if(!e)break;t.push(e[0])}n=n.replace(Nu,``);let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=/* @__PURE__ */ RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=r.exec(n);if(e)i.lastIndex=r.lastIndex;else if(e=i.exec(n),e)r.lastIndex=i.lastIndex;else break;t.push(e[0])}return t}let Fu=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Iu=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Lu(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(Iu,e=>{for(;;){let[t,,n]=Fu.exec(e)||[];if(!n)return``;if(n===r)return`src: ${t};`}}):e}function Ru(e,t=[]){for(let n of Array.from(e))cl(n)?t.push(...Ru(n.cssRules)):`cssRules`in n?Ru(n.cssRules,t):t.push(n);return t}let zu=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function Bu(e){return zu.test(e.innerHTML)}async function Vu(e,t){let n=await Wl(e,t);if(ll(n.node)&&ul(n.node)&&!Bu(n.node))return n.node;let{ownerDocument:r,log:i,tasks:a,svgStyleElement:o,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:f,onEmbedNode:p,onCreateForeignObjectSvg:m}=n;i.time(`clone node`);let h=await _u(n.node,n,!0);if(o&&r){let e=``;c.forEach((t,n)=>{e+=`${t.join(`,
66
66
  `)} {
67
67
  ${n}
68
68
  }
69
- `}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&sl(h)&&(i.time(`embed web font`),await ku(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),Ou(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Bu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&gu(n),await m?.(y),y}function Bu(e,t){let{width:n,height:r}=t,i=Al(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Vu(e,t){let n=await Hl(e,t),r=await zu(n),i=jl(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Wl(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(kl,`defs`),n.svgStyles.clear()),await Kl(Pl(i,r.ownerDocument),n)}async function Hu(e,t){let n=await Hl(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Vu(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&Zc&&Qc){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=qc(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Kc(u,o,r):Vc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Uu(e,t){return Hu(await Hl(e,{...t,type:`image/jpeg`}))}async function Wu(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Uu(r,{scale:a,quality:.85,backgroundColor:Gu(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Gu(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var Ku=0;Array.isArray;function R(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ku,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let qu={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Ju(e){if(qu[e])return qu[e];let t=e.toLowerCase();if(t.includes(`claude`))return qu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return qu.codex;if(t.includes(`cursor`))return qu.cursor;if(t.includes(`ensemble`))return qu.ensemble}function Yu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Ju(e);return r?/* @__PURE__ */ R(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ R(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ R(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function z({children:e,size:t=16}){return/* @__PURE__ */ R(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Xu=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ R(`path`,{d:`M12 8v8M8 12h8`})]}),Zu=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ R(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),Qu=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ R(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ R(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),$u=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),ed=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),td=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),nd=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M20 6 9 17l-5-5`})}),rd=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ R(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),id=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),ad=()=>/* @__PURE__ */ R(z,{size:14,children:/* @__PURE__ */ R(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),od=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M18 6 6 18M6 6l12 12`})}),sd=()=>/* @__PURE__ */ R(z,{size:14,children:[/* @__PURE__ */ R(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),cd=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),ld=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),ud=({size:e=16})=>/* @__PURE__ */ R(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:/* @__PURE__ */ R(`path`,{d:`M80 0C106.51 0 128 21.4903 128 48V80C128 106.51 106.51 128 80 128H4C1.79086 128 0 126.209 0 124V48C0 21.4903 21.4903 0 48 0H80ZM102.06 31.19A4 4 0 0 0 96.81 25.94L17.67 59.86A4 4 0 0 0 17.98 67.33L48.1 77.37A4 4 0 0 1 50.63 79.9L60.67 110.02A4 4 0 0 0 68.14 110.33Z`,transform:`translate(3 3) scale(0.140625)`,fill:`#3b62ff`,"fill-rule":`evenodd`})}),dd=()=>/* @__PURE__ */ R(z,{size:14,children:[/* @__PURE__ */ R(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ R(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),fd=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ R(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),pd=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ R(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),md=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`path`,{d:`m6 9 6 6 6-6`})}),hd=()=>/* @__PURE__ */ R(z,{size:14,children:/* @__PURE__ */ R(`path`,{d:`M11.5 2.8a.6.6 0 0 1 1 0l2.6 5.3 5.8.8a.6.6 0 0 1 .3 1l-4.2 4.1 1 5.8a.6.6 0 0 1-.8.6L12 17.7l-5.2 2.7a.6.6 0 0 1-.8-.6l1-5.8-4.2-4.1a.6.6 0 0 1 .3-1l5.8-.8Z`})}),gd=()=>/* @__PURE__ */ R(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ R(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1.1.9 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3`})}),_d=j(()=>{let e=/* @__PURE__ */ new Map,t=[...Cr.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function vd(){let e=Er.value.flatMap(e=>{let t=_d.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&N({type:`drafts.send`,drafts:e})&&(F.value=e[0]?.threadId??null)}function yd(){let e=bd();if(nr.value)return null;let t=P.value;return/* @__PURE__ */ R(x,{children:[wr.value.map(e=>/* @__PURE__ */ R(Sd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ R(xd,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ R(kd,{})]})}function bd(){let e=wr.value,t=xr.value,n=D({page:t,pins:[]}),[r,i]=E([]);return Le(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:_d.value.get(e.id),variant:Ad(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:Qt.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function xd({pin:e}){br.value;let t=e.thread.anchor?Ic(e.thread.anchor):null;return t?/* @__PURE__ */ R(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:[/* @__PURE__ */ R(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ R(nd,{})}),/* @__PURE__ */ R(`span`,{class:`pin-shine`})]})]})}):null}function Sd({thread:e}){if(br.value,!e.anchor)return null;let t=yr.value,n=t?.threadId===e.id,r=n?t.point:Ic(e.anchor);if(!r)return null;let i=F.value===e.id;return/* @__PURE__ */ R(`button`,{type:`button`,class:`pin pin-${Ad(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>wd(t,e,r),onClick:()=>{if(Cd===e.id){Cd=null;return}P.value=null,F.value=i?null:e.id},children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:_d.value.get(e.id)??`•`})})}let Cd=null;function wd(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Cd=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!yr.value&&Math.hypot(r,o)<4||(yr.value={threadId:t.id,point:Td({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Ed,!0);let n=yr.value;n&&(yr.value=null,Cd=t.id,e.type===`pointerup`&&Dd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Ed,!0)}function Td(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Ed(e){e.preventDefault()}function Dd(e,t){let n=Od(t);if(!n)return;let r={selector:dc(n),...Lc(n,t)};N({type:`thread.move`,threadId:e.id,anchor:r})&&vn({...e,anchor:r})}function Od(e){let t=Pc();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function kd(){br.value;let e=P.value,t=Ic(e.anchor,e.element);return t?/* @__PURE__ */ R(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:`+`})}):null}function Ad(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let jd=`tencil:open`;function Md(){let[e,t]=E(`page`),n=Wt.value?.label??`Agent`,r=Ut.value===`open`&&Wt.value?.state===`ready`,i=Wt.value?.id;return Ie(()=>{r&&Qn.value&&e===`provider`&&Sn()},[e,Qn.value,r,i]),Qn.value?/* @__PURE__ */ R(`aside`,{class:`inbox`,children:[/* @__PURE__ */ R(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ R(`div`,{class:`segmented`,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ R(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ R(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{Qn.value=!1},children:/* @__PURE__ */ R(od,{})})]}),e===`provider`?/* @__PURE__ */ R(Pd,{label:n}):/* @__PURE__ */ R(Nd,{scope:e})]}):null}function Nd({scope:e}){let t=Cr.value.filter(e=>tr.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&Sr(t.pageUrl)===xr.value),n=t.filter(e=>Ad(e)===`done`);return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`inbox-toolbar`,children:[/* @__PURE__ */ R(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ R(`span`,{class:`checkbox`,children:[/* @__PURE__ */ R(`input`,{type:`checkbox`,class:`checkbox-input`,checked:tr.value,onChange:e=>{tr.value=e.target.checked}}),/* @__PURE__ */ R(nd,{})]}),`Show resolved`]}),n.length>0&&/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-resolve`,onClick:()=>{for(let e of n)N({type:`thread.resolve`,threadId:e.id,resolved:!0});n.some(e=>e.id===F.value)&&(F.value=null)},children:[/* @__PURE__ */ R(nd,{}),`Resolve `,n.length,` done`]})]}),/* @__PURE__ */ R(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ R(`p`,{class:`empty`,children:Hn.value.comment?/* @__PURE__ */ R(x,{children:[`No pins yet. Press `,/* @__PURE__ */ R(`kbd`,{children:Hn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ R(Ld,{thread:e},e.id))})]})}function Pd({label:e}){let t=$t.value;return t?t.length===0?/* @__PURE__ */ R(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ R(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ R(Fd,{summary:e},e.id))}):/* @__PURE__ */ R(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function Fd({summary:e}){let t=en.value,n=[...Qt.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=wn(e);t&&(F.value=t)},children:[/* @__PURE__ */ R(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ R(Id,{project:t}),/* @__PURE__ */ R(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ R(`span`,{class:`provider-item-state state-${e.status}`,children:Bd(e.status)}):e.background===`monitoring`?/* @__PURE__ */ R(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ R(`span`,{class:`provider-item-time`,children:Vd(e.updatedAt)})]}),/* @__PURE__ */ R(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ R(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ R(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ R(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ R(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ R(Yu,{agent:e.agent})]})]})}function Id({project:e}){return e.emoji?/* @__PURE__ */ R(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ R(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ R(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Ld({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||Sr(e.pageUrl)===xr.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-item${F.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(jd,e.id),location.href=e.pageUrl;return}F.value=e.id,Rd(e)},children:[t?/* @__PURE__ */ R(`span`,{class:`pin pin-static pin-${Ad(e)}`,children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:_d.value.get(e.id)})}):/* @__PURE__ */ R(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ R(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ R(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ R(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ R(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),zd(e),` · `,Vd(e.updatedAt)]}),r&&/* @__PURE__ */ R(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Rd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function zd(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function Bd(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Vd(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Hd({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=E(t),u=D(null);Ie(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Ie(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ R(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ R(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ R(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ R(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ R(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ R(`span`,{class:`spinner`}):/* @__PURE__ */ R(ed,{})})]})]})}let Ud=A(null);function Wd(){br.value;let e=P.value,t=D(null),[n,r]=E(140),[i,a]=E(!1),[o,s]=E(!1),[c,l]=E(null),u=Wt.value?.state===`ready`,d=Wt.value?.id;if(Ie(()=>{e&&u&&(Sn(),Cn())},[e,u,d]),Ie(()=>{Ud.value=null},[d]),Le(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Ic(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=zc(f,{width:340,height:n}),g=Wt.value,_=g?.state===`ready`,v=ar.value,y=v?null:Ud.value,b=y?void 0:Yd(g?.id);return/* @__PURE__ */ R(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ R(`div`,{class:`composer-target`,children:[/* @__PURE__ */ R(`span`,{class:`chip`,children:[/* @__PURE__ */ R(cd,{}),e.label]}),g&&v&&/* @__PURE__ */ R(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Er.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ R(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ R(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ R(md,{})]})]}),e.measuredTo&&mr.value&&/* @__PURE__ */ R(Kd,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ R(Zd,{onPick:e=>{Ud.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ R(Xd,{choices:b,onPick:e=>{N({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ R(Hd,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=Jd(await e.context,e),r=[];if(i){let t=await Wu(e.element,Pc());t&&r.push(t)}let a=Ht(),o={...e.anchor,selector:n.selector};if(!N({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();vn({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),P.value=null,v?Or():F.value=a}finally{s(!1)}},onCancel:()=>{P.value=null},children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ R(sd,{})}),rr.value&&/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{ir.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ R(dd,{})}),b&&/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ R(Yu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ R(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ R(md,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ R(`p`,{class:`hint`,children:g.detail})]})}let Gd={top:`above`,right:`right`,bottom:`below`,left:`left`};function Kd({pending:e}){let t=e.measuredTo,n=qd(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Gd[e]}`);return/* @__PURE__ */ R(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ R(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ R(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{P.value&&={...P.value,measuredTo:void 0}},children:/* @__PURE__ */ R(od,{})})]})}function qd(e){let t=e.measuredTo;return!t||!mr.value||!e.element.isConnected||!t.element.isConnected?void 0:Zs(Xs(Js(e.element.getBoundingClientRect()),Js(t.element.getBoundingClientRect())),{to:t.label,selector:dc(t.element),...t.parent?{parent:!0}:{}})}function Jd(e,t){let n=qd(t);return n?{...e,spacing:n}:e}function Yd(e){let t=tn.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(M.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Xd({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ R(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`p`,{class:`menu-group`,children:[/* @__PURE__ */ R(Yu,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Zd({onPick:e}){let t=$t.value,n=Ud.value?.id??null;return/* @__PURE__ */ R(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ R(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ R(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ R(Yu,{agent:t.agent,size:12}),/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:Vd(t.updatedAt)})]},t.id))]})}function Qd(){br.value;let e=Yn.value;if(!e)return null;let t=Jn.value===`picking`,n=!t&&!P.value&&mr.value&&Xn.value&&!Zn.value;if(!t&&!n)return null;let r=Js(e.getBoundingClientRect());return/* @__PURE__ */ R(x,{children:[mr.value&&(n||!Xn.value)&&/* @__PURE__ */ R(ef,{element:e,box:r}),/* @__PURE__ */ R(`div`,{class:`highlight`,style:of(r)}),/* @__PURE__ */ R($d,{element:e,box:r})]})}function $d({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ R(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[uc(e),/* @__PURE__ */ R(`span`,{class:`highlight-size`,children:[Ys(t.right-t.left),`×`,Ys(t.bottom-t.top)]})]})}function ef({element:e,box:t}){let n=tc(e),r=[...tf(e,t,n),...nf(e,t,n),...af(e,t,n)];return/* @__PURE__ */ R(x,{children:[r.map((e,t)=>/* @__PURE__ */ R(`div`,{class:`band band-${e.kind}`,style:of(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ R(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:sf(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ R(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function tf(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return rf(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function nf(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return rf(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function rf(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:oc(e,t,n,r)}))}function af(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return nc(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?oc(e,`gap`,r,n[r]):void 0}})}function of(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function sf(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function cf(){if(br.value,!mr.value)return null;let e=Jn.value===`idle`&&!P.value?Zn.value?.element:void 0,t=uf(e),n=e?.isConnected?Js(e.getBoundingClientRect()):null;return/* @__PURE__ */ R(x,{children:[e&&n&&/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`measure-box`,style:of(n)}),/* @__PURE__ */ R($d,{element:e,box:n})]}),t&&/* @__PURE__ */ R(lf,{pair:t})]})}function lf({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Js(e.getBoundingClientRect()),r=Js(t.getBoundingClientRect()),i=P.value;return/* @__PURE__ */ R(x,{children:[i?.element===e&&/* @__PURE__ */ R(`div`,{class:`measure-box`,style:of(n)}),/* @__PURE__ */ R(`div`,{class:`measure-target`,style:of(r)}),Xs(n,r).map(e=>/* @__PURE__ */ R(df,{guide:e},e.side))]})}function uf(e){let t=Yn.value,n=P.value;if(Jn.value===`picking`||!n&&!e){let e=t?.parentElement;return!Xn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?Xn.value&&t&&t!==e?[e,t]:null:n?Xn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function df({guide:e}){return/* @__PURE__ */ R(x,{children:[e.extension&&/* @__PURE__ */ R(`div`,{class:`guide guide-extension`,style:ff(e.extension)}),/* @__PURE__ */ R(`div`,{class:`guide`,style:ff(e)}),/* @__PURE__ */ R(`span`,{class:`guide-value`,style:{transform:sf(pf(e))},children:e.value})]})}function ff(e){let t=pf(e);return of(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function pf({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function mf(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function hf(e,t=`|`){return e.map(e=>Bf(e)).join(t)}function gf(e,t){return typeof t==`bigint`?t.toString():t}var _f=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function vf(e){return new _f(e)}function yf(e){return e==null}function bf(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function xf(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Sf(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Cf(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function wf(e){return Cf(e._zod.def)??e._zod.def.shape}function Tf(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Sf(this,t,e),e},enumerable:!0,configurable:!0})}function Ef(e,t,n){t in e?Sf(e,t,n):e[t]=n}function Df(e,t,n,r){let i=wf(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Tf(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Ef(e,a,r?r(n.value,a):n.value))}}function Of(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Tf(e,n,()=>t[n]):Ef(e,n,r.value))}}function kf(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Af(e){return JSON.stringify(e)}function jf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Mf=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Nf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Pf=/* @__PURE__*/ vf(()=>{if(Op.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ff(e){if(Nf(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Nf(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function If(e){return Ff(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Lf=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Rf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zf(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw 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 Bf(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Vf(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let Hf={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Uf={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function Wf(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Df(i,e,Gf(e,t)),zf(e,kf(n,{shape:i,checks:[]}))}function Gf(e,t){let n=wf(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Kf(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Gf(e,t)),a={};return Df(a,e,Reflect.ownKeys(wf(e)).filter(e=>!i.has(e))),zf(e,kf(n,{shape:a,checks:[]}))}function qf(e,t){if(!Ff(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=wf(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return zf(e,kf(e._zod.def,{shape:Jf(e,t)}))}function Jf(e,t){let n={};return Df(n,e,Reflect.ownKeys(wf(e))),Of(n,t),n}function Yf(e,t){if(!Ff(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return zf(e,kf(e._zod.def,{shape:Jf(e,t)}))}function Xf(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Df(n,e,Reflect.ownKeys(wf(e))),Df(n,t,Reflect.ownKeys(wf(t))),zf(e,kf(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Zf(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Gf(t,n)):void 0,o={};return Df(o,t,Reflect.ownKeys(wf(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),zf(t,kf(t._zod.def,{shape:o,checks:[]}))}function Qf(e,t,n){let r=n?new Set(Gf(t,n)):void 0,i={};return Df(i,t,Reflect.ownKeys(wf(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),zf(t,kf(t._zod.def,{shape:i}))}function $f(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ep(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function tp(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function np(e){return typeof e==`string`?e:e?.message}function rp(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function ip(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function ap(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:np(e.inst?._zod.def?.error?.(e))??np(a?.(e))??np(t?.error?.(e))??np(n.customError?.(e))??np(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let op=/[\uD800-\uDBFF]/;function sp(e){let t=e.length;if(!op.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function cp(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function lp(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function up(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function dp(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):hp(e,n,r.value)}}function fp(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function pp(e,t,n){return fp(e,t,n,!1)}function mp(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return fp(this,n,r(this))},set(e){fp(this,n,e)}})}return t}function hp(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:fp(this,t,n.bind(this))},set(e){fp(this,t,e)}})}function gp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let _p,vp=!1,yp={configurable:!0,get(){vp=!0}};function V(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&_p!==e._zod){_p=void 0;return}_p=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,yp);let e=vp;vp=!1;try{let r=n(this);return vp?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),vp||=e,r}catch(n){throw delete this[t],vp||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function bp(e,t,n,r){let i=gp(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function xp(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Sp;let Cp={value:void 0,enumerable:!1},wp=`captureStackTrace`in Error?Error:null;function Tp(e){let t=wp;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return wp=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Cp.value=new a(r);try{Object.defineProperty(n,"_zod",Cp)}finally{Cp.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),dp(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Tp(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ep=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Dp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Sp=globalThis).__zod_globalConfig??(Sp.__zod_globalConfig={});let Op=globalThis.__zod_globalConfig;function kp(e){return e&&Object.assign(Op,e),Op}function Ap(){let e=this._zod;return e.message??=JSON.stringify(e.def,gf,2),e.message}function jp(e){this._zod.message=e}let Mp={get:Ap,set:jp,enumerable:!0,configurable:!0},Np={value:void 0,enumerable:!1},Pp=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),Fp=(e,t)=>{e.name=`$ZodError`,Np.value=t,Object.defineProperty(e,"issues",Np),Np.value=void 0,Object.defineProperty(e,"message",Mp);let n=Object.getPrototypeOf(e);Pp.has(n)||(Pp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Ip=H(`$ZodError`,Fp);H(`$ZodError`,Fp,void 0,{Parent:Error});function Lp(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Rp(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Lp(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function zp(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Bp(e,t){return{callee:t?.callee??e,Err:t?.Err}}let Vp=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ep;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ap(e,o,kp())));throw Mf(n,a?.callee??t),n}return s.value};return t},Hp=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ap(e,o,kp())));throw Mf(n,a?.callee??t),n}return s.value};return t},Up=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ep;return a.issues.length?Wp(e,a.issues,i):{success:!0,data:a.value}};function Wp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>ap(e,n,kp()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let Gp=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Wp(e,a.issues,i):{success:!0,data:a.value}},Kp=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),qp=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),Jp=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Kp)return!0;if(r.definite===!0&&n===void 0)return!1}return Yp(e,t,n)});function Yp(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[qp]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Ep;return a.issues.length===0}let Xp=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Zp=e=>{let t=Vp(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Bp(n,a))};return n},Qp=e=>{let t=Vp(e),n=(e,r,i,a)=>t(e,r,i,Bp(n,a));return n},$p=e=>{let t=Hp(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Bp(n,a))};return n},em=e=>{let t=Hp(e),n=async(e,r,i,a)=>await t(e,r,i,Bp(n,a));return n},tm=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Up(e)(t,n,i)},nm=e=>(t,n,r)=>Up(e)(t,n,r),rm=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gp(e)(t,n,i)},im=e=>async(t,n,r)=>Gp(e)(t,n,r),am=/^[cC][0-9a-z]{6,}$/,om=/^[0-9a-z]+$/,sm=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,cm=/^[0-9a-vA-V]{20}$/,lm=/^[A-Za-z0-9]{27}$/,um=/^[a-zA-Z0-9_-]{21}$/;function dm(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let fm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pm=/^([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})$/,mm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,hm=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function gm(){return/* @__PURE__ */ RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let _m=/^(?:(?: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])$/,vm=/^(([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}|:))$/,ym=/^((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])$/,bm=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sm=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Cm=/^https?$/,wm=/^\+[1-9]\d{6,14}$/,Tm=`(?:(?:\\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])))`;function Em(e){return RegExp(`^${e}$`)}let Dm=/*@__PURE__*/ Em(Tm);function Om(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function km(e){return RegExp(`^${Om(e)}$`)}function Am(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Om({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Om({precision:e.precision})}`:n;return RegExp(`^${Tm}T(?:${r})$`)}let jm=/^[\s\S]{0,}$/,Mm=/^-?\d+(?:\.\d+)?$/,Nm=/^(?:true|false)$/i,Pm=/^[^A-Z]*$/,Fm=/^[^a-z]*$/,Im=/*@__PURE__*/ H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lm=e=>{let t=e.value;return!yf(t)&&t.length!==void 0},Rm={number:`number`,bigint:`bigint`,object:`date`},zm=/*@__PURE__*/ H(`$ZodCheckLessThan`,(e,t)=>{Im.init(e,t);let n=Rm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Rm[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bm=/*@__PURE__*/ H(`$ZodCheckGreaterThan`,(e,t)=>{Im.init(e,t);let n=Rm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Rm[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vm=/*@__PURE__*/ H(`$ZodCheckMultipleOf`,(e,t)=>{Im.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):xf(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Hm=/*@__PURE__*/ H(`$ZodCheckNumberFormat`,(e,t)=>{Im.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Hf[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Um=/*@__PURE__*/ H(`$ZodCheckMaxLength`,(e,t)=>{var n;Im.init(e,t),(n=e._zod.def).when??(n.when=Lm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?sp(r):i)<=t.maximum)return;let a=cp(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Wm=/*@__PURE__*/ H(`$ZodCheckMinLength`,(e,t)=>{var n;Im.init(e,t),(n=e._zod.def).when??(n.when=Lm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?sp(r):i)>=t.minimum)return;let a=cp(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Gm=/*@__PURE__*/ H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Im.init(e,t),(n=e._zod.def).when??(n.when=Lm),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?sp(r):i;if(a===t.length)return;let o=cp(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Km=/*@__PURE__*/ H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Im.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),qm=/*@__PURE__*/ H(`$ZodCheckRegex`,(e,t)=>{Km.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jm=/*@__PURE__*/ H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Pm,Km.init(e,t)}),Ym=/*@__PURE__*/ H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Fm,Km.init(e,t)}),Xm=/*@__PURE__*/ H(`$ZodCheckIncludes`,(e,t)=>{Im.init(e,t);let n=Rf(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Zm=/*@__PURE__*/ H(`$ZodCheckStartsWith`,(e,t)=>{Im.init(e,t);let n=RegExp(`^${Rf(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qm=/*@__PURE__*/ H(`$ZodCheckEndsWith`,(e,t)=>{Im.init(e,t);let n=RegExp(`.*${Rf(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$m=/*@__PURE__*/ H(`$ZodCheckOverwrite`,(e,t)=>{Im.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var eh=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
69
+ `}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&ll(h)&&(i.time(`embed web font`),await ju(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),Au(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Hu(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&vu(n),await m?.(y),y}function Hu(e,t){let{width:n,height:r}=t,i=Ml(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Uu(e,t){let n=await Wl(e,t),r=await Vu(n),i=Nl(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Kl(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(jl,`defs`),n.svgStyles.clear()),await Jl(Il(i,r.ownerDocument),n)}async function Wu(e,t){let n=await Wl(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Uu(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&$c&&el){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Yc(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Jc(u,o,r):Uc(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Gu(e,t){return Wu(await Wl(e,{...t,type:`image/jpeg`}))}async function Ku(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Gu(r,{scale:a,quality:.85,backgroundColor:qu(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function qu(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var Ju=0;Array.isArray;function R(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ju,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Yu={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Xu(e){if(Yu[e])return Yu[e];let t=e.toLowerCase();if(t.includes(`claude`))return Yu.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Yu.codex;if(t.includes(`cursor`))return Yu.cursor;if(t.includes(`ensemble`))return Yu.ensemble}function Zu({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Xu(e);return r?/* @__PURE__ */ R(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ R(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ R(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function z({children:e,size:t=16}){return/* @__PURE__ */ R(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Qu=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ R(`path`,{d:`M12 8v8M8 12h8`})]}),$u=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ R(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),ed=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ R(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ R(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),td=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),nd=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),rd=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),id=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M20 6 9 17l-5-5`})}),ad=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ R(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),od=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),sd=()=>/* @__PURE__ */ R(z,{size:14,children:/* @__PURE__ */ R(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),cd=()=>/* @__PURE__ */ R(z,{children:/* @__PURE__ */ R(`path`,{d:`M18 6 6 18M6 6l12 12`})}),ld=()=>/* @__PURE__ */ R(z,{size:14,children:[/* @__PURE__ */ R(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),ud=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),dd=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ R(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),fd=({size:e=16})=>/* @__PURE__ */ R(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:/* @__PURE__ */ R(`path`,{d:`M80 0C106.51 0 128 21.4903 128 48V80C128 106.51 106.51 128 80 128H4C1.79086 128 0 126.209 0 124V48C0 21.4903 21.4903 0 48 0H80ZM102.06 31.19A4 4 0 0 0 96.81 25.94L17.67 59.86A4 4 0 0 0 17.98 67.33L48.1 77.37A4 4 0 0 1 50.63 79.9L60.67 110.02A4 4 0 0 0 68.14 110.33Z`,transform:`translate(3 3) scale(0.140625)`,fill:`#3b62ff`,"fill-rule":`evenodd`})}),pd=()=>/* @__PURE__ */ R(z,{size:14,children:[/* @__PURE__ */ R(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ R(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),md=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ R(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),hd=()=>/* @__PURE__ */ R(z,{children:[/* @__PURE__ */ R(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ R(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),gd=()=>/* @__PURE__ */ R(z,{size:12,children:/* @__PURE__ */ R(`path`,{d:`m6 9 6 6 6-6`})}),_d=()=>/* @__PURE__ */ R(z,{size:14,children:/* @__PURE__ */ R(`path`,{d:`M11.5 2.8a.6.6 0 0 1 1 0l2.6 5.3 5.8.8a.6.6 0 0 1 .3 1l-4.2 4.1 1 5.8a.6.6 0 0 1-.8.6L12 17.7l-5.2 2.7a.6.6 0 0 1-.8-.6l1-5.8-4.2-4.1a.6.6 0 0 1 .3-1l5.8-.8Z`})}),vd=()=>/* @__PURE__ */ R(`svg`,{width:14,height:14,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ R(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 0-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.2-.4-.6-1.6 0-3.2 0 0 1-.3 3.4 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.8 5.6-5.5 5.9.5.4.9 1.1.9 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3`})}),yd=j(()=>{let e=/* @__PURE__ */ new Map,t=[...Tr.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function bd(){let e=Or.value.flatMap(e=>{let t=yd.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&N({type:`drafts.send`,drafts:e})&&(F.value=e[0]?.threadId??null)}function xd(){let e=Sd();if(ir.value)return null;let t=P.value;return/* @__PURE__ */ R(x,{children:[Er.value.map(e=>/* @__PURE__ */ R(wd,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ R(Cd,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ R(jd,{})]})}function Sd(){let e=Er.value,t=Cr.value,n=D({page:t,pins:[]}),[r,i]=E([]);return Le(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:yd.value.get(e.id),variant:Md(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:Qt.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function Cd({pin:e}){Sr.value;let t=e.thread.anchor?Rc(e.thread.anchor):null;return t?/* @__PURE__ */ R(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:[/* @__PURE__ */ R(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ R(id,{})}),/* @__PURE__ */ R(`span`,{class:`pin-shine`})]})]})}):null}function wd({thread:e}){if(Sr.value,!e.anchor)return null;let t=xr.value,n=t?.threadId===e.id,r=n?t.point:Rc(e.anchor);if(!r)return null;let i=F.value===e.id;return/* @__PURE__ */ R(`button`,{type:`button`,class:`pin pin-${Md(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Ed(t,e,r),onClick:()=>{if(Td===e.id){Td=null;return}P.value=null,F.value=i?null:e.id},children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:yd.value.get(e.id)??`•`})})}let Td=null;function Ed(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Td=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!xr.value&&Math.hypot(r,o)<4||(xr.value={threadId:t.id,point:Dd({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Od,!0);let n=xr.value;n&&(xr.value=null,Td=t.id,e.type===`pointerup`&&kd(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Od,!0)}function Dd(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Od(e){e.preventDefault()}function kd(e,t){let n=Ad(t);if(!n)return;let r={selector:pc(n),...zc(n,t)};N({type:`thread.move`,threadId:e.id,anchor:r})&&bn({...e,anchor:r})}function Ad(e){let t=Ic();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function jd(){Sr.value;let e=P.value,t=Rc(e.anchor,e.element);return t?/* @__PURE__ */ R(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:`+`})}):null}function Md(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let Nd=`tencil:open`;function Pd(){let[e,t]=E(`page`),n=Wt.value?.label??`Agent`,r=Ut.value===`open`&&Wt.value?.state===`ready`,i=Wt.value?.id;return Ie(()=>{r&&er.value&&e===`provider`&&wn()},[e,er.value,r,i]),er.value?/* @__PURE__ */ R(`aside`,{class:`inbox`,children:[/* @__PURE__ */ R(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ R(`div`,{class:`segmented`,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ R(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ R(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{er.value=!1},children:/* @__PURE__ */ R(cd,{})})]}),e===`provider`?/* @__PURE__ */ R(Id,{label:n}):/* @__PURE__ */ R(Fd,{scope:e})]}):null}function Fd({scope:e}){let t=Tr.value.filter(e=>rr.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&wr(t.pageUrl)===Cr.value),n=t.filter(e=>Md(e)===`done`);return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`inbox-toolbar`,children:[/* @__PURE__ */ R(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ R(`span`,{class:`checkbox`,children:[/* @__PURE__ */ R(`input`,{type:`checkbox`,class:`checkbox-input`,checked:rr.value,onChange:e=>{rr.value=e.target.checked}}),/* @__PURE__ */ R(id,{})]}),`Show resolved`]}),n.length>0&&/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-resolve`,onClick:()=>{for(let e of n)N({type:`thread.resolve`,threadId:e.id,resolved:!0});n.some(e=>e.id===F.value)&&(F.value=null)},children:[/* @__PURE__ */ R(id,{}),`Resolve `,n.length,` done`]})]}),/* @__PURE__ */ R(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ R(`p`,{class:`empty`,children:Wn.value.comment?/* @__PURE__ */ R(x,{children:[`No pins yet. Press `,/* @__PURE__ */ R(`kbd`,{children:Wn.value.comment}),` and click anything on the page.`]}):`No pins yet. Click Comment, then anything on the page.`}):t.map(e=>/* @__PURE__ */ R(zd,{thread:e},e.id))})]})}function Id({label:e}){let t=$t.value;return t?t.length===0?/* @__PURE__ */ R(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ R(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ R(Ld,{summary:e},e.id))}):/* @__PURE__ */ R(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function Ld({summary:e}){let t=en.value,n=[...Qt.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=En(e);t&&(F.value=t)},children:[/* @__PURE__ */ R(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ R(Rd,{project:t}),/* @__PURE__ */ R(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ R(`span`,{class:`provider-item-state state-${e.status}`,children:Hd(e.status)}):e.background===`monitoring`?/* @__PURE__ */ R(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ R(`span`,{class:`provider-item-time`,children:Ud(e.updatedAt)})]}),/* @__PURE__ */ R(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ R(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ R(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ R(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ R(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ R(Zu,{agent:e.agent})]})]})}function Rd({project:e}){return e.emoji?/* @__PURE__ */ R(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ R(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ R(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function zd({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||wr(e.pageUrl)===Cr.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ R(`button`,{type:`button`,class:`inbox-item${F.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(Nd,e.id),location.href=e.pageUrl;return}F.value=e.id,Bd(e)},children:[t?/* @__PURE__ */ R(`span`,{class:`pin pin-static pin-${Md(e)}`,children:/* @__PURE__ */ R(`span`,{class:`pin-body`,children:yd.value.get(e.id)})}):/* @__PURE__ */ R(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ R(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ R(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ R(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ R(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),Vd(e),` · `,Ud(e.updatedAt)]}),r&&/* @__PURE__ */ R(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Bd(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function Vd(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function Hd(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Ud(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Wd({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=E(t),u=D(null);Ie(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Ie(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ R(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ R(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ R(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ R(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ R(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ R(`span`,{class:`spinner`}):/* @__PURE__ */ R(nd,{})})]})]})}let Gd=A(null);function Kd(){Sr.value;let e=P.value,t=D(null),[n,r]=E(140),[i,a]=E(!1),[o,s]=E(!1),[c,l]=E(null),u=Wt.value?.state===`ready`,d=Wt.value?.id;if(Ie(()=>{e&&u&&(wn(),Tn())},[e,u,d]),Ie(()=>{Gd.value=null},[d]),Le(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Rc(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Vc(f,{width:340,height:n}),g=Wt.value,_=g?.state===`ready`,v=sr.value,y=v?null:Gd.value,b=y?void 0:Zd(g?.id);return/* @__PURE__ */ R(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ R(`div`,{class:`composer-target`,children:[/* @__PURE__ */ R(`span`,{class:`chip`,children:[/* @__PURE__ */ R(ud,{}),e.label]}),g&&v&&/* @__PURE__ */ R(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Or.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ R(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ R(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ R(gd,{})]})]}),e.measuredTo&&gr.value&&/* @__PURE__ */ R(Jd,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ R($d,{onPick:e=>{Gd.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ R(Qd,{choices:b,onPick:e=>{N({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ R(Wd,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=Xd(await e.context,e),r=[];if(i){let t=await Ku(e.element,Ic());t&&r.push(t)}let a=Ht(),o={...e.anchor,selector:n.selector};if(!N({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();bn({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),P.value=null,v?Ar():F.value=a}finally{s(!1)}},onCancel:()=>{P.value=null},children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ R(ld,{})}),ar.value&&/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{or.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ R(pd,{})}),b&&/* @__PURE__ */ R(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ R(Zu,{agent:b.current?.agent,size:12}),/* @__PURE__ */ R(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ R(gd,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ R(`p`,{class:`hint`,children:g.detail})]})}let qd={top:`above`,right:`right`,bottom:`below`,left:`left`};function Jd({pending:e}){let t=e.measuredTo,n=Yd(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${qd[e]}`);return/* @__PURE__ */ R(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ R(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ R(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{P.value&&={...P.value,measuredTo:void 0}},children:/* @__PURE__ */ R(cd,{})})]})}function Yd(e){let t=e.measuredTo;return!t||!gr.value||!e.element.isConnected||!t.element.isConnected?void 0:$s(Qs(Xs(e.element.getBoundingClientRect()),Xs(t.element.getBoundingClientRect())),{to:t.label,selector:pc(t.element),...t.parent?{parent:!0}:{}})}function Xd(e,t){let n=Yd(t);return n?{...e,spacing:n}:e}function Zd(e){let t=tn.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(M.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Qd({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ R(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`p`,{class:`menu-group`,children:[/* @__PURE__ */ R(Zu,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function $d({onPick:e}){let t=$t.value,n=Gd.value?.id??null;return/* @__PURE__ */ R(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ R(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ R(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ R(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ R(Zu,{agent:t.agent,size:12}),/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:Ud(t.updatedAt)})]},t.id))]})}function ef(){Sr.value;let e=Zn.value;if(!e)return null;let t=Xn.value===`picking`,n=!t&&!P.value&&gr.value&&Qn.value&&!$n.value;if(!t&&!n)return null;let r=Xs(e.getBoundingClientRect());return/* @__PURE__ */ R(x,{children:[gr.value&&(n||!Qn.value)&&/* @__PURE__ */ R(nf,{element:e,box:r}),/* @__PURE__ */ R(`div`,{class:`highlight`,style:cf(r)}),/* @__PURE__ */ R(tf,{element:e,box:r})]})}function tf({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ R(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[fc(e),/* @__PURE__ */ R(`span`,{class:`highlight-size`,children:[Zs(t.right-t.left),`×`,Zs(t.bottom-t.top)]})]})}function nf({element:e,box:t}){let n=rc(e),r=[...rf(e,t,n),...af(e,t,n),...sf(e,t,n)];return/* @__PURE__ */ R(x,{children:[r.map((e,t)=>/* @__PURE__ */ R(`div`,{class:`band band-${e.kind}`,style:cf(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ R(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:lf(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ R(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function rf(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return of(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function af(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return of(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function of(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:cc(e,t,n,r)}))}function sf(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return ic(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?cc(e,`gap`,r,n[r]):void 0}})}function cf(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function lf(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function uf(){if(Sr.value,!gr.value)return null;let e=Xn.value===`idle`&&!P.value?$n.value?.element:void 0,t=ff(e),n=e?.isConnected?Xs(e.getBoundingClientRect()):null;return/* @__PURE__ */ R(x,{children:[e&&n&&/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`measure-box`,style:cf(n)}),/* @__PURE__ */ R(tf,{element:e,box:n})]}),t&&/* @__PURE__ */ R(df,{pair:t})]})}function df({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Xs(e.getBoundingClientRect()),r=Xs(t.getBoundingClientRect()),i=P.value;return/* @__PURE__ */ R(x,{children:[i?.element===e&&/* @__PURE__ */ R(`div`,{class:`measure-box`,style:cf(n)}),/* @__PURE__ */ R(`div`,{class:`measure-target`,style:cf(r)}),Qs(n,r).map(e=>/* @__PURE__ */ R(pf,{guide:e},e.side))]})}function ff(e){let t=Zn.value,n=P.value;if(Xn.value===`picking`||!n&&!e){let e=t?.parentElement;return!Qn.value||!t||!e||e===document.documentElement?null:[t,e]}return e?Qn.value&&t&&t!==e?[e,t]:null:n?Qn.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function pf({guide:e}){return/* @__PURE__ */ R(x,{children:[e.extension&&/* @__PURE__ */ R(`div`,{class:`guide guide-extension`,style:mf(e.extension)}),/* @__PURE__ */ R(`div`,{class:`guide`,style:mf(e)}),/* @__PURE__ */ R(`span`,{class:`guide-value`,style:{transform:lf(hf(e))},children:e.value})]})}function mf(e){let t=hf(e);return cf(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function hf({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function gf(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function _f(e,t=`|`){return e.map(e=>Hf(e)).join(t)}function vf(e,t){return typeof t==`bigint`?t.toString():t}var yf=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function bf(e){return new yf(e)}function xf(e){return e==null}function Sf(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Cf(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function wf(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tf(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Ef(e){return Tf(e._zod.def)??e._zod.def.shape}function Df(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return wf(this,t,e),e},enumerable:!0,configurable:!0})}function Of(e,t,n){t in e?wf(e,t,n):e[t]=n}function kf(e,t,n,r){let i=Ef(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Df(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Of(e,a,r?r(n.value,a):n.value))}}function Af(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Df(e,n,()=>t[n]):Of(e,n,r.value))}}function jf(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Mf(e){return JSON.stringify(e)}function Nf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Pf=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ff(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let If=/* @__PURE__*/ bf(()=>{if(Ap.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Lf(e){if(Ff(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ff(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Rf(e){return Lf(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let zf=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Bf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vf(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw 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 Hf(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Uf(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let Wf={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gf={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function Kf(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return kf(i,e,qf(e,t)),Vf(e,jf(n,{shape:i,checks:[]}))}function qf(e,t){let n=Ef(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Jf(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(qf(e,t)),a={};return kf(a,e,Reflect.ownKeys(Ef(e)).filter(e=>!i.has(e))),Vf(e,jf(n,{shape:a,checks:[]}))}function Yf(e,t){if(!Lf(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Ef(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vf(e,jf(e._zod.def,{shape:Xf(e,t)}))}function Xf(e,t){let n={};return kf(n,e,Reflect.ownKeys(Ef(e))),Af(n,t),n}function Zf(e,t){if(!Lf(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vf(e,jf(e._zod.def,{shape:Xf(e,t)}))}function Qf(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return kf(n,e,Reflect.ownKeys(Ef(e))),kf(n,t,Reflect.ownKeys(Ef(t))),Vf(e,jf(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $f(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(qf(t,n)):void 0,o={};return kf(o,t,Reflect.ownKeys(Ef(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Vf(t,jf(t._zod.def,{shape:o,checks:[]}))}function ep(e,t,n){let r=n?new Set(qf(t,n)):void 0,i={};return kf(i,t,Reflect.ownKeys(Ef(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Vf(t,jf(t._zod.def,{shape:i}))}function tp(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function np(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rp(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ip(e){return typeof e==`string`?e:e?.message}function ap(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function op(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function sp(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ip(e.inst?._zod.def?.error?.(e))??ip(a?.(e))??ip(t?.error?.(e))??ip(n.customError?.(e))??ip(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let cp=/[\uD800-\uDBFF]/;function lp(e){let t=e.length;if(!cp.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function up(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function dp(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function fp(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function pp(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):_p(e,n,r.value)}}function mp(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function hp(e,t,n){return mp(e,t,n,!1)}function gp(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return mp(this,n,r(this))},set(e){mp(this,n,e)}})}return t}function _p(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:mp(this,t,n.bind(this))},set(e){mp(this,t,e)}})}function vp(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let yp,bp=!1,xp={configurable:!0,get(){bp=!0}};function V(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&yp!==e._zod){yp=void 0;return}yp=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,xp);let e=bp;bp=!1;try{let r=n(this);return bp?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),bp||=e,r}catch(n){throw delete this[t],bp||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Sp(e,t,n,r){let i=vp(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Cp(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var wp;let Tp={value:void 0,enumerable:!1},Ep=`captureStackTrace`in Error?Error:null;function Dp(e){let t=Ep;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ep=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function H(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Tp.value=new a(r);try{Object.defineProperty(n,"_zod",Tp)}finally{Tp.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),pp(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Dp(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Op=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wp=globalThis).__zod_globalConfig??(wp.__zod_globalConfig={});let Ap=globalThis.__zod_globalConfig;function jp(e){return e&&Object.assign(Ap,e),Ap}function Mp(){let e=this._zod;return e.message??=JSON.stringify(e.def,vf,2),e.message}function Np(e){this._zod.message=e}let Pp={get:Mp,set:Np,enumerable:!0,configurable:!0},Fp={value:void 0,enumerable:!1},Ip=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),Lp=(e,t)=>{e.name=`$ZodError`,Fp.value=t,Object.defineProperty(e,"issues",Fp),Fp.value=void 0,Object.defineProperty(e,"message",Pp);let n=Object.getPrototypeOf(e);Ip.has(n)||(Ip.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Rp=H(`$ZodError`,Lp);H(`$ZodError`,Lp,void 0,{Parent:Error});function zp(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Bp(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?zp(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Vp(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Hp(e,t){return{callee:t?.callee??e,Err:t?.Err}}let Up=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Op;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>sp(e,o,jp())));throw Pf(n,a?.callee??t),n}return s.value};return t},Wp=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>sp(e,o,jp())));throw Pf(n,a?.callee??t),n}return s.value};return t},Gp=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Op;return a.issues.length?Kp(e,a.issues,i):{success:!0,data:a.value}};function Kp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>sp(e,n,jp()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let qp=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Kp(e,a.issues,i):{success:!0,data:a.value}},Jp=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),Yp=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),Xp=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Jp)return!0;if(r.definite===!0&&n===void 0)return!1}return Zp(e,t,n)});function Zp(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Yp]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Op;return a.issues.length===0}let Qp=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},$p=e=>{let t=Up(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Hp(n,a))};return n},em=e=>{let t=Up(e),n=(e,r,i,a)=>t(e,r,i,Hp(n,a));return n},tm=e=>{let t=Wp(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Hp(n,a))};return n},nm=e=>{let t=Wp(e),n=async(e,r,i,a)=>await t(e,r,i,Hp(n,a));return n},rm=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gp(e)(t,n,i)},im=e=>(t,n,r)=>Gp(e)(t,n,r),am=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qp(e)(t,n,i)},om=e=>async(t,n,r)=>qp(e)(t,n,r),sm=/^[cC][0-9a-z]{6,}$/,cm=/^[0-9a-z]+$/,lm=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,um=/^[0-9a-vA-V]{20}$/,dm=/^[A-Za-z0-9]{27}$/,fm=/^[a-zA-Z0-9_-]{21}$/;function pm(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let mm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hm=/^([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})$/,gm=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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)$/,_m=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function vm(){return/* @__PURE__ */ RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let ym=/^(?:(?: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])$/,bm=/^(([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}|:))$/,xm=/^((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])$/,Sm=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wm=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Tm=/^https?$/,Em=/^\+[1-9]\d{6,14}$/,Dm=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Om(e){return RegExp(`^${e}$`)}let km=/*@__PURE__*/ Om(Dm);function Am(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jm(e){return RegExp(`^${Am(e)}$`)}function Mm(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Am({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Am({precision:e.precision})}`:n;return RegExp(`^${Dm}T(?:${r})$`)}let Nm=/^[\s\S]{0,}$/,Pm=/^-?\d+(?:\.\d+)?$/,Fm=/^(?:true|false)$/i,Im=/^[^A-Z]*$/,Lm=/^[^a-z]*$/,Rm=/*@__PURE__*/ H(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zm=e=>{let t=e.value;return!xf(t)&&t.length!==void 0},Bm={number:`number`,bigint:`bigint`,object:`date`},Vm=/*@__PURE__*/ H(`$ZodCheckLessThan`,(e,t)=>{Rm.init(e,t);let n=Bm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Bm[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hm=/*@__PURE__*/ H(`$ZodCheckGreaterThan`,(e,t)=>{Rm.init(e,t);let n=Bm[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bm[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Um=/*@__PURE__*/ H(`$ZodCheckMultipleOf`,(e,t)=>{Rm.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Cf(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wm=/*@__PURE__*/ H(`$ZodCheckNumberFormat`,(e,t)=>{Rm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Wf[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Gm=/*@__PURE__*/ H(`$ZodCheckMaxLength`,(e,t)=>{var n;Rm.init(e,t),(n=e._zod.def).when??(n.when=zm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?lp(r):i)<=t.maximum)return;let a=up(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Km=/*@__PURE__*/ H(`$ZodCheckMinLength`,(e,t)=>{var n;Rm.init(e,t),(n=e._zod.def).when??(n.when=zm),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?lp(r):i)>=t.minimum)return;let a=up(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qm=/*@__PURE__*/ H(`$ZodCheckLengthEquals`,(e,t)=>{var n;Rm.init(e,t),(n=e._zod.def).when??(n.when=zm),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?lp(r):i;if(a===t.length)return;let o=up(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Jm=/*@__PURE__*/ H(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Rm.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ym=/*@__PURE__*/ H(`$ZodCheckRegex`,(e,t)=>{Jm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xm=/*@__PURE__*/ H(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Im,Jm.init(e,t)}),Zm=/*@__PURE__*/ H(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Lm,Jm.init(e,t)}),Qm=/*@__PURE__*/ H(`$ZodCheckIncludes`,(e,t)=>{Rm.init(e,t);let n=Bf(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$m=/*@__PURE__*/ H(`$ZodCheckStartsWith`,(e,t)=>{Rm.init(e,t);let n=RegExp(`^${Bf(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),eh=/*@__PURE__*/ H(`$ZodCheckEndsWith`,(e,t)=>{Rm.init(e,t);let n=RegExp(`.*${Bf(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),th=/*@__PURE__*/ H(`$ZodCheckOverwrite`,(e,t)=>{Rm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var nh=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
70
70
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
71
- `)}\n};`)(...Object.values(this.closed))}};let th={major:4,minor:6,patch:6},U=/*@__PURE__*/ H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=th;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=$f(t),a;for(let o of n){if(o._zod.def.when){if(ep(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ep;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(ip(t.issues,n,e),i||=$f(t,n))});else{if(t.issues.length===n)continue;ip(t.issues,n,e),i||=$f(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if($f(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ep;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ep;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return pp(this,`~standard`,ih(this))},set"~standard"(e){fp(this,`~standard`,e)}}),nh=(e,t)=>e.issues.length?{issues:e.issues.map(e=>ap(e,t,kp()))}:{value:e.value};async function rh(e,t){let n={async:!0};return nh(await e._zod.run({value:t,issues:[]},n),n)}function ih(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return nh(r,n)}catch{}return rh(e,t)},vendor:`zod`,version:1}}let ah=/*@__PURE__*/ H(`$ZodString`,(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??jm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),W=/*@__PURE__*/ H(`$ZodStringFormat`,(e,t)=>{Km.init(e,t),ah.init(e,t)}),oh=/*@__PURE__*/ H(`$ZodGUID`,(e,t)=>{t.pattern??=pm,W.init(e,t)}),sh=/*@__PURE__*/ H(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=mm(e)}else t.pattern??=mm();W.init(e,t)}),ch=/*@__PURE__*/ H(`$ZodEmail`,(e,t)=>{t.pattern??=hm,W.init(e,t)});function lh(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function uh(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?lh(e)||2:dh(e,t)}function dh(e,t){if(!t.normalize&&t.protocol?.source===Cm.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let fh=/[\t\n\r]/g;function ph(e){return e.replace(fh,``)}function mh(e,t){return t.lastIndex=0,t.test(e.hostname)}function hh(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let gh=/*@__PURE__*/ H(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=uh(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ph(r);return}t.hostname&&!mh(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!hh(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ph(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),_h=/*@__PURE__*/ H(`$ZodEmoji`,(e,t)=>{t.pattern??=gm(),W.init(e,t)}),vh=/*@__PURE__*/ H(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?um:dm(t.length),W.init(e,t)}),yh=/*@__PURE__*/ H(`$ZodCUID`,(e,t)=>{t.pattern??=am,W.init(e,t)}),bh=/*@__PURE__*/ H(`$ZodCUID2`,(e,t)=>{t.pattern??=om,W.init(e,t)}),xh=/*@__PURE__*/ H(`$ZodULID`,(e,t)=>{t.pattern??=sm,W.init(e,t)}),Sh=/*@__PURE__*/ H(`$ZodXID`,(e,t)=>{t.pattern??=cm,W.init(e,t)}),Ch=/*@__PURE__*/ H(`$ZodKSUID`,(e,t)=>{t.pattern??=lm,W.init(e,t)}),wh=/*@__PURE__*/ H(`$ZodISODateTime`,(e,t)=>{t.pattern??=Am(t),W.init(e,t)}),Th=/*@__PURE__*/ H(`$ZodISODate`,(e,t)=>{t.pattern??=Dm,W.init(e,t)}),Eh=/*@__PURE__*/ H(`$ZodISOTime`,(e,t)=>{t.pattern??=km(t),W.init(e,t)}),Dh=/*@__PURE__*/ H(`$ZodISODuration`,(e,t)=>{t.pattern??=fm,W.init(e,t)}),Oh=/*@__PURE__*/ H(`$ZodIPv4`,(e,t)=>{t.pattern??=_m,W.init(e,t)}),kh=/^[0-9a-fA-F:.]+$/;function Ah(e){return kh.test(e)?lh(`http://[${e}]`):!1}let jh=/*@__PURE__*/ H(`$ZodIPv6`,(e,t)=>{t.pattern??=vm,W.init(e,t),e._zod.check=n=>{Ah(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Mh=/*@__PURE__*/ H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ym,W.init(e,t)});function Nh(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ah(n)}let Ph=/*@__PURE__*/ H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=bm,W.init(e,t),e._zod.check=n=>{Nh(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Fh(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Ih=/^[0-9a-zA-Z+/]*={0,2}$/,Lh=/*@__PURE__*/ H(`$ZodBase64`,(e,t)=>{t.pattern??=Ih,W.init(e,t),e._zod.check=n=>{Fh(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Rh=/^[A-Za-z0-9_-]*$/;function zh(e){if(!Rh.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Fh(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Bh=/*@__PURE__*/ H(`$ZodBase64URL`,(e,t)=>{t.pattern??=Rh,W.init(e,t),e._zod.check=n=>{zh(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Vh=/*@__PURE__*/ H(`$ZodE164`,(e,t)=>{t.pattern??=wm,W.init(e,t)});function Hh(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let Uh=/*@__PURE__*/ H(`$ZodJWT`,(e,t)=>{W.init(e,t),e._zod.check=n=>{Hh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Wh=/*@__PURE__*/ H(`$ZodNumber`,(e,t)=>{U.init(e,t),e._zod.pattern=Mm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Gh=/*@__PURE__*/ H(`$ZodNumberFormat`,(e,t)=>{Hm.init(e,t),Wh.init(e,t)}),Kh=/*@__PURE__*/ H(`$ZodBoolean`,(e,t)=>{U.init(e,t),e._zod.pattern=Nm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),qh=/*@__PURE__*/ H(`$ZodUnknown`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),Jh=/*@__PURE__*/ H(`$ZodNever`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Yh(e,t){let n=rp(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of rp(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,ip(n.issues,t,e),n}}return i(n,a)}}let Xh=e=>Array.isArray(e)?e.length:-1;function Zh(e,t,n){e.issues.length&&t.issues.push(...tp(n,e.issues)),t.value[n]=e.value}let Qh=/*@__PURE__*/ H(`$ZodArray`,(e,t)=>{U.init(e,t);let n=Op.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Zh(t,r,e)));else if(Zh(c,r,e),s&&c.issues.length!==0&&$f(c))break}return o.length?Promise.all(o).then(()=>r):r},Yh(e,Xh)});function $h(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...tp(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let eg=[];function tg(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:eg,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Vf(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ng(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if($f(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>$h(e,n,i,t,d,f))):$h(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let rg=/*@__PURE__*/ H(`$ZodObject`,(e,t)=>{U.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=vf(()=>tg(t));V(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Sf(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Nf,o=t.catchall,s,c=Op.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if($f(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>$h(n,t,e,r,a,o))):$h(s,t,e,r,a,o)}return o?ng(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),ig=/*@__PURE__*/ H(`$ZodObjectJIT`,(e,t)=>{rg.init(e,t);let n=e._zod.parse,r=vf(()=>tg(t)),i=Op.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new eh([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
71
+ `)}\n};`)(...Object.values(this.closed))}};let rh={major:4,minor:6,patch:6},U=/*@__PURE__*/ H(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rh;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tp(t),a;for(let o of n){if(o._zod.def.when){if(np(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Op;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(op(t.issues,n,e),i||=tp(t,n))});else{if(t.issues.length===n)continue;op(t.issues,n,e),i||=tp(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tp(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Op;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Op;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return hp(this,`~standard`,oh(this))},set"~standard"(e){mp(this,`~standard`,e)}}),ih=(e,t)=>e.issues.length?{issues:e.issues.map(e=>sp(e,t,jp()))}:{value:e.value};async function ah(e,t){let n={async:!0};return ih(await e._zod.run({value:t,issues:[]},n),n)}function oh(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ih(r,n)}catch{}return ah(e,t)},vendor:`zod`,version:1}}let sh=/*@__PURE__*/ H(`$ZodString`,(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??Nm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),W=/*@__PURE__*/ H(`$ZodStringFormat`,(e,t)=>{Jm.init(e,t),sh.init(e,t)}),ch=/*@__PURE__*/ H(`$ZodGUID`,(e,t)=>{t.pattern??=hm,W.init(e,t)}),lh=/*@__PURE__*/ H(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=gm(e)}else t.pattern??=gm();W.init(e,t)}),uh=/*@__PURE__*/ H(`$ZodEmail`,(e,t)=>{t.pattern??=_m,W.init(e,t)});function dh(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fh(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?dh(e)||2:ph(e,t)}function ph(e,t){if(!t.normalize&&t.protocol?.source===Tm.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let mh=/[\t\n\r]/g;function hh(e){return e.replace(mh,``)}function gh(e,t){return t.lastIndex=0,t.test(e.hostname)}function _h(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let vh=/*@__PURE__*/ H(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=fh(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=hh(r);return}t.hostname&&!gh(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!_h(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:hh(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),yh=/*@__PURE__*/ H(`$ZodEmoji`,(e,t)=>{t.pattern??=vm(),W.init(e,t)}),bh=/*@__PURE__*/ H(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?fm:pm(t.length),W.init(e,t)}),xh=/*@__PURE__*/ H(`$ZodCUID`,(e,t)=>{t.pattern??=sm,W.init(e,t)}),Sh=/*@__PURE__*/ H(`$ZodCUID2`,(e,t)=>{t.pattern??=cm,W.init(e,t)}),Ch=/*@__PURE__*/ H(`$ZodULID`,(e,t)=>{t.pattern??=lm,W.init(e,t)}),wh=/*@__PURE__*/ H(`$ZodXID`,(e,t)=>{t.pattern??=um,W.init(e,t)}),Th=/*@__PURE__*/ H(`$ZodKSUID`,(e,t)=>{t.pattern??=dm,W.init(e,t)}),Eh=/*@__PURE__*/ H(`$ZodISODateTime`,(e,t)=>{t.pattern??=Mm(t),W.init(e,t)}),Dh=/*@__PURE__*/ H(`$ZodISODate`,(e,t)=>{t.pattern??=km,W.init(e,t)}),Oh=/*@__PURE__*/ H(`$ZodISOTime`,(e,t)=>{t.pattern??=jm(t),W.init(e,t)}),kh=/*@__PURE__*/ H(`$ZodISODuration`,(e,t)=>{t.pattern??=mm,W.init(e,t)}),Ah=/*@__PURE__*/ H(`$ZodIPv4`,(e,t)=>{t.pattern??=ym,W.init(e,t)}),jh=/^[0-9a-fA-F:.]+$/;function Mh(e){return jh.test(e)?dh(`http://[${e}]`):!1}let Nh=/*@__PURE__*/ H(`$ZodIPv6`,(e,t)=>{t.pattern??=bm,W.init(e,t),e._zod.check=n=>{Mh(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ph=/*@__PURE__*/ H(`$ZodCIDRv4`,(e,t)=>{t.pattern??=xm,W.init(e,t)});function Fh(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Mh(n)}let Ih=/*@__PURE__*/ H(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Sm,W.init(e,t),e._zod.check=n=>{Fh(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Lh(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Rh=/^[0-9a-zA-Z+/]*={0,2}$/,zh=/*@__PURE__*/ H(`$ZodBase64`,(e,t)=>{t.pattern??=Rh,W.init(e,t),e._zod.check=n=>{Lh(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Bh=/^[A-Za-z0-9_-]*$/;function Vh(e){if(!Bh.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Lh(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Hh=/*@__PURE__*/ H(`$ZodBase64URL`,(e,t)=>{t.pattern??=Bh,W.init(e,t),e._zod.check=n=>{Vh(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Uh=/*@__PURE__*/ H(`$ZodE164`,(e,t)=>{t.pattern??=Em,W.init(e,t)});function Wh(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let Gh=/*@__PURE__*/ H(`$ZodJWT`,(e,t)=>{W.init(e,t),e._zod.check=n=>{Wh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Kh=/*@__PURE__*/ H(`$ZodNumber`,(e,t)=>{U.init(e,t),e._zod.pattern=Pm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),qh=/*@__PURE__*/ H(`$ZodNumberFormat`,(e,t)=>{Wm.init(e,t),Kh.init(e,t)}),Jh=/*@__PURE__*/ H(`$ZodBoolean`,(e,t)=>{U.init(e,t),e._zod.pattern=Fm,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Yh=/*@__PURE__*/ H(`$ZodUnknown`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),Xh=/*@__PURE__*/ H(`$ZodNever`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Zh(e,t){let n=ap(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of ap(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,op(n.issues,t,e),n}}return i(n,a)}}let Qh=e=>Array.isArray(e)?e.length:-1;function $h(e,t,n){e.issues.length&&t.issues.push(...rp(n,e.issues)),t.value[n]=e.value}let eg=/*@__PURE__*/ H(`$ZodArray`,(e,t)=>{U.init(e,t);let n=Ap.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>$h(t,r,e)));else if($h(c,r,e),s&&c.issues.length!==0&&tp(c))break}return o.length?Promise.all(o).then(()=>r):r},Zh(e,Qh)});function tg(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...rp(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let ng=[];function rg(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ng,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Uf(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ig(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(tp(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>tg(e,n,i,t,d,f))):tg(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let ag=/*@__PURE__*/ H(`$ZodObject`,(e,t)=>{U.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=bf(()=>rg(t));V(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||wf(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ff,o=t.catchall,s,c=Ap.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(tp(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>tg(n,t,e,r,a,o))):tg(s,t,e,r,a,o)}return o?ig(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),og=/*@__PURE__*/ H(`$ZodObjectJIT`,(e,t)=>{ag.init(e,t);let n=e._zod.parse,r=bf(()=>rg(t)),i=Ap.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new nh([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
72
72
  let ${e}_ab = false;
73
73
  for (let i = 0; i < ${e}.issues.length; i++) {
74
74
  const iss = ${e}.issues[i];
@@ -79,7 +79,7 @@ let la=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,ua=[`rsc://`,`file:///`,`webpack-internal://`
79
79
  if (${e}_ab && ctx && ctx.abortEarly) {
80
80
  payload.value = newResult;
81
81
  return payload;
82
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Af(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
82
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Mf(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
83
83
  const ${n}_present = ${i};
84
84
  if (!${n}.issues.length || ${n}_present) {
85
85
  if (${n}.issues.length) {${c(n,r)}
@@ -118,70 +118,70 @@ let la=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,ua=[`rsc://`,`file:///`,`webpack-internal://`
118
118
  newResult[${r}] = ${n}.value;
119
119
  }
120
120
 
121
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Nf,c=!Op.jitless,l=c&&Pf.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ng([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function ag(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!$f(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ap(e,r,kp())))}),t)}let og=/*@__PURE__*/ H(`$ZodUnion`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),V(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),V(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),V(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>bf(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ag(t,r,e,i)):ag(o,r,e,i)}});function sg(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let cg=/*@__PURE__*/ H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,og.init(e,t);let n=e._zod.parse;V(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Sf(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Cf(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=vf(()=>sg(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Nf(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),lg=/*@__PURE__*/ H(`$ZodIntersection`,(e,t)=>{U.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>dg(e,t,n)):dg(e,i,a)}});function ug(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ff(e)&&Ff(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ug(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ug(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function dg(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ug(t.value,n.value);if(!c.valid){if($f(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let fg=/*@__PURE__*/ H(`$ZodTuple`,(e,t)=>{U.init(e,t);let n=t.items,r=Op.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=pg(n,`optin`),l=pg(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=$f(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if($f(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>mg(t,i,e))):mg(r,i,e)}}return s.length?Promise.all(s).then(()=>hg(u,i,n,o,l)):hg(u,i,n,o,l)}});function pg(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function mg(e,t,n){e.issues.length&&t.issues.push(...tp(n,e.issues)),t.value[n]=e.value}function hg(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...tp(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let gg=/*@__PURE__*/ H(`$ZodEnum`,(e,t)=>{U.init(e,t);let n=mf(t.entries),r=new Set(n);e._zod.values=r,V(e,`pattern`,e=>{let t=mf(e.def.entries).filter(e=>Lf.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Rf(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_g=/*@__PURE__*/ H(`$ZodLiteral`,(e,t)=>{U.init(e,t);let n=new Set(t.values);e._zod.values=n,V(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Rf(e):e?Rf(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vg=/*@__PURE__*/ H(`$ZodTransform`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,Op.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Dp(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ep;return n.value=i,n}});function yg(e,t){return e.value=t.issues.length?void 0:t.value,e}let bg=/*@__PURE__*/ H(`$ZodOptional`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,V(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${bf(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>yg(e,t)):yg(e,r)}return t.innerType._zod.run(e,n)}}),xg=/*@__PURE__*/ H(`$ZodExactOptional`,(e,t)=>{bg.init(e,t),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sg=/*@__PURE__*/ H(`$ZodNullable`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin),V(e,`optout`,e=>e.def.innerType._zod.optout),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${bf(t.source)}|null)$`):void 0}),V(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Cg=/*@__PURE__*/ H(`$ZodDefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wg(e,t)):wg(r,t)}});function wg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Tg=/*@__PURE__*/ H(`$ZodPrefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Eg=/*@__PURE__*/ H(`$ZodNonOptional`,(e,t)=>{U.init(e,t),V(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dg(t,e)):Dg(i,e)}});function Dg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Og(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>ap(e,r,kp()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let kg=/*@__PURE__*/ H(`$ZodCatch`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),V(e,`optout`,e=>e.def.innerType._zod.optout),V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Og(e,r,t,n)):Og(e,r,t,n)}}),Ag=/*@__PURE__*/ H(`$ZodPipe`,(e,t)=>{U.init(e,t),V(e,`values`,e=>e.def.in._zod.values),V(e,`optin`,e=>e.def.in._zod.optin),V(e,`optout`,e=>e.def.out._zod.optout),V(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>jg(e,t.in,n)):jg(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>jg(e,t.out,n)):jg(r,t.out,n)}});function jg(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let Mg=/*@__PURE__*/ H(`$ZodReadonly`,(e,t)=>{U.init(e,t),V(e,`propValues`,e=>e.def.innerType._zod.propValues),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`optin`,e=>e.def.innerType?._zod?.optin),V(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ng):Ng(r)}});function Ng(e){return e.memo||(e.value=Object.freeze(e.value)),e}let Pg=/*@__PURE__*/ H(`$ZodCustom`,(e,t)=>{Im.init(e,t),U.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fg(t,n,r,e));Fg(i,n,r,e)}});function Fg(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(up(e))}}var Ig=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let Lg=`~memo`,Rg=[];function zg(e){return typeof e==`object`&&!!e}function Bg(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let Vg=/*@__PURE__*/ new WeakMap;function Hg(e,t,n){let r=Vg.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Hg(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Hg(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Cf(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Hg(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ug(e,i)}function Ug(e,t){return t!==1&&Vg.set(e,t===2),t}function Wg(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Gg,Kg=[],qg={alloc(e,t,n){let r=Gg;if(!r)return n;Gg=void 0;let i={value:n,issues:null};return r.set(t.value,i),Kg.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Yg(n,e.value))throw new Ig;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Hg(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!zg(l))return t(s,c);let u=c[Lg];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Lg]=u);let d;i===c?d=a:(d=Wg(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Bg(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Gg=d;let p=Kg.length,m=t(s,c);Gg=void 0;let h=Kg.length>p?Kg.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Bg(e.issues):Rg),e)):(h&&(h.issues=m.issues.length?Bg(m.issues):Rg),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Jg(){return qg}function Yg(e,t){let n=e[Lg]?.backEdges;return n!==void 0&&zg(t)&&n.has(t)}let Xg=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(lp(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Bf(e.values[0])}`:`Invalid option: expected one of ${hf(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${hf(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Zg(){return{localeError:Xg()}}var Qg,$g=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function e_(){return new $g}(Qg=globalThis).__zod_globalRegistry??(Qg.__zod_globalRegistry=e_());let t_=globalThis.__zod_globalRegistry;function n_(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
122
- function r_(e,t){return new e(n_({type:`string`,...B(t)}))}// @__NO_SIDE_EFFECTS__
123
- function i_(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
124
- function a_(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
125
- function o_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
126
- function s_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}// @__NO_SIDE_EFFECTS__
127
- function c_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}// @__NO_SIDE_EFFECTS__
128
- function l_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}// @__NO_SIDE_EFFECTS__
129
- function u_(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
130
- function d_(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
131
- function f_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
132
- function p_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
133
- function m_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
134
- function h_(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
135
- function g_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
136
- function __(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
137
- function v_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
138
- function y_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
139
- function b_(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
140
- function x_(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
141
- function S_(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
142
- function C_(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
143
- function w_(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
144
- function T_(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
145
- function E_(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}// @__NO_SIDE_EFFECTS__
146
- function D_(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}// @__NO_SIDE_EFFECTS__
147
- function O_(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}// @__NO_SIDE_EFFECTS__
148
- function k_(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}// @__NO_SIDE_EFFECTS__
149
- function A_(e,t){return new e(n_({type:`number`,checks:[],...B(t)}))}// @__NO_SIDE_EFFECTS__
150
- function j_(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}// @__NO_SIDE_EFFECTS__
151
- function M_(e,t){return new e({type:`boolean`,...B(t)})}// @__NO_SIDE_EFFECTS__
152
- function N_(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
153
- function P_(e,t){return new e({type:`never`,...B(t)})}// @__NO_SIDE_EFFECTS__
154
- function F_(e,t){return new zm({check:`less_than`,...B(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
155
- function I_(e,t){return new zm({check:`less_than`,...B(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
156
- function L_(e,t){return new Bm({check:`greater_than`,...B(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
157
- function R_(e,t){return new Bm({check:`greater_than`,...B(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
158
- function z_(e,t){return new Vm({check:`multiple_of`,...B(t),value:e})}// @__NO_SIDE_EFFECTS__
159
- function B_(e,t){return new Um({check:`max_length`,...B(t),maximum:e})}// @__NO_SIDE_EFFECTS__
160
- function V_(e,t){return new Wm({check:`min_length`,...B(t),minimum:e})}// @__NO_SIDE_EFFECTS__
161
- function H_(e,t){return new Gm({check:`length_equals`,...B(t),length:e})}// @__NO_SIDE_EFFECTS__
162
- function U_(e,t){return new qm({check:`string_format`,format:`regex`,...B(t),pattern:e})}// @__NO_SIDE_EFFECTS__
163
- function W_(e){return new Jm({check:`string_format`,format:`lowercase`,...B(e)})}// @__NO_SIDE_EFFECTS__
164
- function G_(e){return new Ym({check:`string_format`,format:`uppercase`,...B(e)})}// @__NO_SIDE_EFFECTS__
165
- function K_(e,t){return new Xm({check:`string_format`,format:`includes`,...B(t),includes:e})}// @__NO_SIDE_EFFECTS__
166
- function q_(e,t){return new Zm({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}// @__NO_SIDE_EFFECTS__
167
- function J_(e,t){return new Qm({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}// @__NO_SIDE_EFFECTS__
168
- function Y_(e){return new $m({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
169
- function X_(e){return/* @__PURE__ */ Y_(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
170
- function Z_(){return/* @__PURE__ */ Y_(e=>e.trim())}// @__NO_SIDE_EFFECTS__
171
- function Q_(){return/* @__PURE__ */ Y_(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
172
- function $_(){return/* @__PURE__ */ Y_(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
173
- function ev(){return/* @__PURE__ */ Y_(e=>jf(e))}// @__NO_SIDE_EFFECTS__
174
- function tv(e,t,n){return new e({type:`array`,element:t,...B(n)})}// @__NO_SIDE_EFFECTS__
175
- function nv(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}// @__NO_SIDE_EFFECTS__
176
- function rv(e,t){let n=/* @__PURE__ */ iv(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(up(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(up(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
177
- function iv(e,t){let n=new Im({check:`custom`,...B(t)});return n._zod.check=e,n}function av(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Sf(e,t,n[t]);return e}function ov(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??t_,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function sv(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function G(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,G(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&av(o.schema,c),t.io===`input`&&K(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function cv(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function lv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${cv(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+cv(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
121
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ff,c=!Ap.jitless,l=c&&If.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ig([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function sg(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!tp(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>sp(e,r,jp())))}),t)}let cg=/*@__PURE__*/ H(`$ZodUnion`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),V(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),V(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),V(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Sf(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>sg(t,r,e,i)):sg(o,r,e,i)}});function lg(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let ug=/*@__PURE__*/ H(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,cg.init(e,t);let n=e._zod.parse;V(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||wf(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Tf(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=bf(()=>lg(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Ff(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),dg=/*@__PURE__*/ H(`$ZodIntersection`,(e,t)=>{U.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>pg(e,t,n)):pg(e,i,a)}});function fg(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lf(e)&&Lf(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=fg(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fg(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pg(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=fg(t.value,n.value);if(!c.valid){if(tp(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let mg=/*@__PURE__*/ H(`$ZodTuple`,(e,t)=>{U.init(e,t);let n=t.items,r=Ap.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=hg(n,`optin`),l=hg(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=tp(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(tp(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>gg(t,i,e))):gg(r,i,e)}}return s.length?Promise.all(s).then(()=>_g(u,i,n,o,l)):_g(u,i,n,o,l)}});function hg(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function gg(e,t,n){e.issues.length&&t.issues.push(...rp(n,e.issues)),t.value[n]=e.value}function _g(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...rp(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let vg=/*@__PURE__*/ H(`$ZodEnum`,(e,t)=>{U.init(e,t);let n=gf(t.entries),r=new Set(n);e._zod.values=r,V(e,`pattern`,e=>{let t=gf(e.def.entries).filter(e=>zf.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Bf(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),yg=/*@__PURE__*/ H(`$ZodLiteral`,(e,t)=>{U.init(e,t);let n=new Set(t.values);e._zod.values=n,V(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Bf(e):e?Bf(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),bg=/*@__PURE__*/ H(`$ZodTransform`,(e,t)=>{U.init(e,t),e._zod.optin=`optional`,Ap.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kp(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Op;return n.value=i,n}});function xg(e,t){return e.value=t.issues.length?void 0:t.value,e}let Sg=/*@__PURE__*/ H(`$ZodOptional`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,V(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Sf(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>xg(e,t)):xg(e,r)}return t.innerType._zod.run(e,n)}}),Cg=/*@__PURE__*/ H(`$ZodExactOptional`,(e,t)=>{Sg.init(e,t),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wg=/*@__PURE__*/ H(`$ZodNullable`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin),V(e,`optout`,e=>e.def.innerType._zod.optout),V(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Sf(t.source)}|null)$`):void 0}),V(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Tg=/*@__PURE__*/ H(`$ZodDefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Eg(e,t)):Eg(r,t)}});function Eg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Dg=/*@__PURE__*/ H(`$ZodPrefault`,(e,t)=>{U.init(e,t),e._zod.optin=`defaulted`,V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Og=/*@__PURE__*/ H(`$ZodNonOptional`,(e,t)=>{U.init(e,t),V(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>kg(t,e)):kg(i,e)}});function kg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ag(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>sp(e,r,jp()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let jg=/*@__PURE__*/ H(`$ZodCatch`,(e,t)=>{U.init(e,t),V(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),V(e,`optout`,e=>e.def.innerType._zod.optout),V(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Ag(e,r,t,n)):Ag(e,r,t,n)}}),Mg=/*@__PURE__*/ H(`$ZodPipe`,(e,t)=>{U.init(e,t),V(e,`values`,e=>e.def.in._zod.values),V(e,`optin`,e=>e.def.in._zod.optin),V(e,`optout`,e=>e.def.out._zod.optout),V(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ng(e,t.in,n)):Ng(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ng(e,t.out,n)):Ng(r,t.out,n)}});function Ng(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let Pg=/*@__PURE__*/ H(`$ZodReadonly`,(e,t)=>{U.init(e,t),V(e,`propValues`,e=>e.def.innerType._zod.propValues),V(e,`values`,e=>e.def.innerType._zod.values),V(e,`optin`,e=>e.def.innerType?._zod?.optin),V(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Fg):Fg(r)}});function Fg(e){return e.memo||(e.value=Object.freeze(e.value)),e}let Ig=/*@__PURE__*/ H(`$ZodCustom`,(e,t)=>{Rm.init(e,t),U.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Lg(t,n,r,e));Lg(i,n,r,e)}});function Lg(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(fp(e))}}var Rg=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let zg=`~memo`,Bg=[];function Vg(e){return typeof e==`object`&&!!e}function Hg(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let Ug=/*@__PURE__*/ new WeakMap;function Wg(e,t,n){let r=Ug.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Wg(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Wg(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Tf(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Wg(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Gg(e,i)}function Gg(e,t){return t!==1&&Ug.set(e,t===2),t}function Kg(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let qg,Jg=[],Yg={alloc(e,t,n){let r=qg;if(!r)return n;qg=void 0;let i={value:n,issues:null};return r.set(t.value,i),Jg.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Zg(n,e.value))throw new Rg;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Wg(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!Vg(l))return t(s,c);let u=c[zg];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[zg]=u);let d;i===c?d=a:(d=Kg(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Hg(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;qg=d;let p=Jg.length,m=t(s,c);qg=void 0;let h=Jg.length>p?Jg.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Hg(e.issues):Bg),e)):(h&&(h.issues=m.issues.length?Hg(m.issues):Bg),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Xg(){return Yg}function Zg(e,t){let n=e[zg]?.backEdges;return n!==void 0&&Vg(t)&&n.has(t)}let Qg=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(dp(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Hf(e.values[0])}`:`Invalid option: expected one of ${_f(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${_f(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function $g(){return{localeError:Qg()}}var e_,t_=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function n_(){return new t_}(e_=globalThis).__zod_globalRegistry??(e_.__zod_globalRegistry=n_());let r_=globalThis.__zod_globalRegistry;function i_(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
122
+ function a_(e,t){return new e(i_({type:`string`,...B(t)}))}// @__NO_SIDE_EFFECTS__
123
+ function o_(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
124
+ function s_(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
125
+ function c_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
126
+ function l_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}// @__NO_SIDE_EFFECTS__
127
+ function u_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}// @__NO_SIDE_EFFECTS__
128
+ function d_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}// @__NO_SIDE_EFFECTS__
129
+ function f_(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
130
+ function p_(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
131
+ function m_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
132
+ function h_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
133
+ function g_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
134
+ function __(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
135
+ function v_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
136
+ function y_(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
137
+ function b_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
138
+ function x_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
139
+ function S_(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
140
+ function C_(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
141
+ function w_(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
142
+ function T_(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
143
+ function E_(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
144
+ function D_(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}// @__NO_SIDE_EFFECTS__
145
+ function O_(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}// @__NO_SIDE_EFFECTS__
146
+ function k_(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}// @__NO_SIDE_EFFECTS__
147
+ function A_(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}// @__NO_SIDE_EFFECTS__
148
+ function j_(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}// @__NO_SIDE_EFFECTS__
149
+ function M_(e,t){return new e(i_({type:`number`,checks:[],...B(t)}))}// @__NO_SIDE_EFFECTS__
150
+ function N_(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}// @__NO_SIDE_EFFECTS__
151
+ function P_(e,t){return new e({type:`boolean`,...B(t)})}// @__NO_SIDE_EFFECTS__
152
+ function F_(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
153
+ function I_(e,t){return new e({type:`never`,...B(t)})}// @__NO_SIDE_EFFECTS__
154
+ function L_(e,t){return new Vm({check:`less_than`,...B(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
155
+ function R_(e,t){return new Vm({check:`less_than`,...B(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
156
+ function z_(e,t){return new Hm({check:`greater_than`,...B(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
157
+ function B_(e,t){return new Hm({check:`greater_than`,...B(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
158
+ function V_(e,t){return new Um({check:`multiple_of`,...B(t),value:e})}// @__NO_SIDE_EFFECTS__
159
+ function H_(e,t){return new Gm({check:`max_length`,...B(t),maximum:e})}// @__NO_SIDE_EFFECTS__
160
+ function U_(e,t){return new Km({check:`min_length`,...B(t),minimum:e})}// @__NO_SIDE_EFFECTS__
161
+ function W_(e,t){return new qm({check:`length_equals`,...B(t),length:e})}// @__NO_SIDE_EFFECTS__
162
+ function G_(e,t){return new Ym({check:`string_format`,format:`regex`,...B(t),pattern:e})}// @__NO_SIDE_EFFECTS__
163
+ function K_(e){return new Xm({check:`string_format`,format:`lowercase`,...B(e)})}// @__NO_SIDE_EFFECTS__
164
+ function q_(e){return new Zm({check:`string_format`,format:`uppercase`,...B(e)})}// @__NO_SIDE_EFFECTS__
165
+ function J_(e,t){return new Qm({check:`string_format`,format:`includes`,...B(t),includes:e})}// @__NO_SIDE_EFFECTS__
166
+ function Y_(e,t){return new $m({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}// @__NO_SIDE_EFFECTS__
167
+ function X_(e,t){return new eh({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}// @__NO_SIDE_EFFECTS__
168
+ function Z_(e){return new th({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
169
+ function Q_(e){return/* @__PURE__ */ Z_(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
170
+ function $_(){return/* @__PURE__ */ Z_(e=>e.trim())}// @__NO_SIDE_EFFECTS__
171
+ function ev(){return/* @__PURE__ */ Z_(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
172
+ function tv(){return/* @__PURE__ */ Z_(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
173
+ function nv(){return/* @__PURE__ */ Z_(e=>Nf(e))}// @__NO_SIDE_EFFECTS__
174
+ function rv(e,t,n){return new e({type:`array`,element:t,...B(n)})}// @__NO_SIDE_EFFECTS__
175
+ function iv(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}// @__NO_SIDE_EFFECTS__
176
+ function av(e,t){let n=/* @__PURE__ */ ov(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(fp(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(fp(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
177
+ function ov(e,t){let n=new Rm({check:`custom`,...B(t)});return n._zod.check=e,n}function sv(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&wf(e,t,n[t]);return e}function cv(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??r_,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function lv(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function G(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,G(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&sv(o.schema,c),t.io===`input`&&K(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function uv(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function dv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${uv(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+uv(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
178
178
 
179
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function uv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;uv(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let dv=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),fv=[`oneOf`,`anyOf`];function pv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function mv(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!dv.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??pv(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Sf(n,r,e.length===1?e[0]:mv(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=pv(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function hv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of dv)if(t in e)return;let n=t.filter(e=>fv.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=mv(t);else{let e=n[0],i=fv.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>mv([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,av(e,r))}function gv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):av(i,s),av(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())uv(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])hv(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}av(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Sf(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:vv(t,`input`,e.processors),output:vv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function K(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return K(r.element,n);if(r.type===`set`)return K(r.valueType,n);if(r.type===`lazy`)return K(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return K(r.innerType,n);if(r.type===`intersection`)return K(r.left,n)||K(r.right,n);if(r.type===`record`||r.type===`map`)return K(r.keyType,n)||K(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:K(r.in,n)||K(r.out,n);if(r.type===`object`){for(let e in r.shape)if(K(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(K(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(K(e,n))return!0;return!!(r.rest&&K(r.rest,n))}return!1}let _v=(e,t={})=>n=>{let r=ov({...n,processors:t});return G(e,r),lv(r,e),gv(r,e)},vv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ov({...i??{},target:a,io:t,processors:n});return G(e,o),lv(o,e),gv(o,e)},yv=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},bv=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},xv=(e,t)=>{yv(e,`minimum`,t),bv(e,`maximum`,t)},Sv=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Cv=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},wv=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Tv=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ev=(e,t)=>yv(e,`minimum`,t.minimum),Dv=(e,t)=>bv(e,`maximum`,t.maximum),Ov=e=>(t,n)=>{Tv(t,n.format);let[r,i]=e[n.format];yv(t,`minimum`,r),bv(t,`maximum`,i)},kv={greater_than:(e,t)=>yv(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>bv(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Sv(e,t.value),number_format:Ov(Hf),bigint_format:Ov(Uf),min_length:Ev,max_length:Dv,length_equals:(e,t)=>xv(e,t.length),min_size:Ev,max_size:Dv,size_equals:(e,t)=>xv(e,t.size),string_format:(e,t)=>{Tv(e,t.format),t.pattern&&Cv(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>wv(e,t.mime)};function Av(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)kv[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&yv(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&yv(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&bv(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&bv(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Sv(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&wv(t,i.mime);for(let e of i.patterns??[])Cv(t,e);return t}let jv={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Mv=/* @__PURE__ */ new Map([[Ih,xm],[Rh,Sm]]),Nv=e=>Mv.get(e)??e,Pv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Av(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=jv[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Nv);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Fv=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Av(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):sv(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Iv=(e,t,n,r)=>{n.type=`boolean`},Lv=(e,t,n,r)=>{n.not={}},Rv=(e,t,n,r)=>{let i=e._zod.def,a=mf(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},zv=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(sv(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(sv(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Bv=(e,t,n,r)=>{sv(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Vv=(e,t,n,r)=>{sv(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Hv=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Av(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G(a.element,t,{...r,path:[...r.path,`items`]})};function Uv(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Uv(t.out):t.type===`catch`?Uv(t.innerType):e._zod.optin}let Wv=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&sv(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Sf(i.properties,e,G(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Uv(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Gv=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Kv=(e,t,n,r)=>{let i=e._zod.def,a=G(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},qv=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>G(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?G(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Uv(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Av(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)},Jv=(e,t,n,r)=>{let i=e._zod.def,a=G(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Yv=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xv=Symbol();function Zv(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(sv(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Xv):JSON.parse(o)}let Qv=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Zv(i.defaultValue,e,t,n,r);o!==Xv&&(n.default=o)},$v=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Zv(i.defaultValue,e,t,n,r);o!==Xv&&(n._prefault=o)},ey=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{sv(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ty=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G(o,t,r);let s=t.seen.get(e);s.ref=o},ny=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ry=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},iy=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function ay(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let oy=/*@__PURE__*/ H(`ZodError`,(e,t)=>{Ip.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);iy.has(n)||(iy.add(n),ay(n,`format`,e=>t=>zp(e,t)),ay(n,`flatten`,e=>t=>Rp(e,t)),ay(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,gf,2)}),ay(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,gf,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),sy=/* @__PURE__ */ Vp(oy),cy=/* @__PURE__ */ Hp(oy),ly=/* @__PURE__ */ Up(oy),uy=/* @__PURE__ */ Gp(oy),dy=/* @__PURE__ */ Zp(oy),fy=/* @__PURE__ */ Qp(oy),py=/* @__PURE__ */ $p(oy),my=/* @__PURE__ */ em(oy),hy=/* @__PURE__ */ tm(oy),gy=/* @__PURE__ */ nm(oy),_y=/* @__PURE__ */ rm(oy),vy=/* @__PURE__ */ im(oy);function yy(){Op.localeError||kp(Zg())}function by(){Op.memoizer||kp({memoizer:Jg()})}let q=/*@__PURE__*/ H(`ZodType`,(e,t)=>(yy(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(kf(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return zf(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Fb(e,t))},superRefine(e,t){return this.check(Ib(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Y_(e))},optional(){return _b(this)},exactOptional(){return yb(this)},nullable(){return xb(this)},nullish(){return _b(xb(this))},nonoptional(e){return Db(this,e)},array(){return tb(this)},or(e){return ib([this,e])},and(e){return cb(this,e)},transform(e){return jb(this,hb(e))},default(e){return Cb(this,e)},prefault(e){return Tb(this,e)},catch(e){return kb(this,e)},pipe(e){return jb(this,e)},readonly(){return Nb(this)},describe(e){let t=this.clone();return t_.add(t,{description:e}),t},meta(...e){if(e.length===0)return t_.get(this);let t=this.clone();return t_.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return pp(this,`~standard`,{...ih(this),jsonSchema:{input:vv(this,`input`),output:vv(this,`output`)}})},set"~standard"(e){fp(this,`~standard`,e)},parse:function e(t,n){return sy(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await cy(this,t,n,{callee:e})},safeParse(e,t){return ly(this,e,t)},async safeParseAsync(e,t){return uy(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){fp(this,`spa`,e)},validate(e,t){return Jp(this,e,t)},validateAsync(e,t){return Xp(this,e,t)},encode:function e(t,n){return dy(this,t,n,{callee:e})},decode:function e(t,n){return fy(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await py(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await my(this,t,n,{callee:e})},safeEncode(e,t){return hy(this,e,t)},safeDecode(e,t){return gy(this,e,t)},async safeEncodeAsync(e,t){return _y(this,e,t)},async safeDecodeAsync(e,t){return vy(this,e,t)},toJSONSchema(e){return _v(this,{})(e)},get description(){return t_.get(this)?.description},get _def(){return this._zod.def}}),xy=/*@__PURE__*/ H(`_ZodString`,(e,t)=>{ah.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pv(e,t,n,r)},/*@__PURE__*/ mp({format:e=>Av(e).format??null,minLength:e=>Av(e).minimum??null,maxLength:e=>Av(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ U_(...e))},includes(...e){return this.check(/* @__PURE__ */ K_(...e))},startsWith(...e){return this.check(/* @__PURE__ */ q_(...e))},endsWith(...e){return this.check(/* @__PURE__ */ J_(...e))},min(...e){return this.check(/* @__PURE__ */ V_(...e))},max(...e){return this.check(/* @__PURE__ */ B_(...e))},length(...e){return this.check(/* @__PURE__ */ H_(...e))},nonempty(...e){return this.check(/* @__PURE__ */ V_(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ W_(e))},uppercase(e){return this.check(/* @__PURE__ */ G_(e))},trim(){return this.check(/* @__PURE__ */ Z_())},normalize(...e){return this.check(/* @__PURE__ */ X_(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Q_())},toUpperCase(){return this.check(/* @__PURE__ */ $_())},slugify(){return this.check(/* @__PURE__ */ ev())}})),Sy=/*@__PURE__*/ H(`ZodString`,(e,t)=>{ah.init(e,t),xy.init(e,t)},{email(e){return this.check(/* @__PURE__ */ i_(Dy,e))},url(e){return this.check(/* @__PURE__ */ u_(Ay,e))},jwt(e){return this.check(/* @__PURE__ */ T_(Gy,e))},emoji(e){return this.check(/* @__PURE__ */ d_(jy,e))},guid(e){return this.check(/* @__PURE__ */ a_(Oy,e))},uuid(e){return this.check(/* @__PURE__ */ o_(ky,e))},uuidv4(e){return this.check(/* @__PURE__ */ s_(ky,e))},uuidv6(e){return this.check(/* @__PURE__ */ c_(ky,e))},uuidv7(e){return this.check(/* @__PURE__ */ l_(ky,e))},nanoid(e){return this.check(/* @__PURE__ */ f_(My,e))},cuid(e){return this.check(/* @__PURE__ */ p_(Ny,e))},cuid2(e){return this.check(/* @__PURE__ */ m_(Py,e))},ulid(e){return this.check(/* @__PURE__ */ h_(Fy,e))},base64(e){return this.check(/* @__PURE__ */ S_(Hy,e))},base64url(e){return this.check(/* @__PURE__ */ C_(Uy,e))},xid(e){return this.check(/* @__PURE__ */ g_(Iy,e))},ksuid(e){return this.check(/* @__PURE__ */ __(Ly,e))},ipv4(e){return this.check(/* @__PURE__ */ v_(Ry,e))},ipv6(e){return this.check(/* @__PURE__ */ y_(zy,e))},cidrv4(e){return this.check(/* @__PURE__ */ b_(By,e))},cidrv6(e){return this.check(/* @__PURE__ */ x_(Vy,e))},e164(e){return this.check(/* @__PURE__ */ w_(Wy,e))},datetime(e){return this.check(/* @__PURE__ */ E_(Cy,e))},date(e){return this.check(/* @__PURE__ */ D_(wy,e))},time(e){return this.check(/* @__PURE__ */ O_(Ty,e))},duration(e){return this.check(/* @__PURE__ */ k_(Ey,e))}});function J(e){return/* @__PURE__ */ r_(Sy,e)}let Y=/*@__PURE__*/ H(`ZodStringFormat`,(e,t)=>{W.init(e,t),xy.init(e,t)}),Cy=/*@__PURE__*/ H(`ZodISODateTime`,(e,t)=>{wh.init(e,t),Y.init(e,t)}),wy=/*@__PURE__*/ H(`ZodISODate`,(e,t)=>{Th.init(e,t),Y.init(e,t)}),Ty=/*@__PURE__*/ H(`ZodISOTime`,(e,t)=>{Eh.init(e,t),Y.init(e,t)}),Ey=/*@__PURE__*/ H(`ZodISODuration`,(e,t)=>{Dh.init(e,t),Y.init(e,t)}),Dy=/*@__PURE__*/ H(`ZodEmail`,(e,t)=>{ch.init(e,t),Y.init(e,t)}),Oy=/*@__PURE__*/ H(`ZodGUID`,(e,t)=>{oh.init(e,t),Y.init(e,t)}),ky=/*@__PURE__*/ H(`ZodUUID`,(e,t)=>{sh.init(e,t),Y.init(e,t)}),Ay=/*@__PURE__*/ H(`ZodURL`,(e,t)=>{gh.init(e,t),Y.init(e,t)}),jy=/*@__PURE__*/ H(`ZodEmoji`,(e,t)=>{_h.init(e,t),Y.init(e,t)}),My=/*@__PURE__*/ H(`ZodNanoID`,(e,t)=>{vh.init(e,t),Y.init(e,t)}),Ny=/*@__PURE__*/ H(`ZodCUID`,(e,t)=>{yh.init(e,t),Y.init(e,t)}),Py=/*@__PURE__*/ H(`ZodCUID2`,(e,t)=>{bh.init(e,t),Y.init(e,t)}),Fy=/*@__PURE__*/ H(`ZodULID`,(e,t)=>{xh.init(e,t),Y.init(e,t)}),Iy=/*@__PURE__*/ H(`ZodXID`,(e,t)=>{Sh.init(e,t),Y.init(e,t)}),Ly=/*@__PURE__*/ H(`ZodKSUID`,(e,t)=>{Ch.init(e,t),Y.init(e,t)}),Ry=/*@__PURE__*/ H(`ZodIPv4`,(e,t)=>{Oh.init(e,t),Y.init(e,t)}),zy=/*@__PURE__*/ H(`ZodIPv6`,(e,t)=>{jh.init(e,t),Y.init(e,t)}),By=/*@__PURE__*/ H(`ZodCIDRv4`,(e,t)=>{Mh.init(e,t),Y.init(e,t)}),Vy=/*@__PURE__*/ H(`ZodCIDRv6`,(e,t)=>{Ph.init(e,t),Y.init(e,t)}),Hy=/*@__PURE__*/ H(`ZodBase64`,(e,t)=>{Lh.init(e,t),Y.init(e,t)}),Uy=/*@__PURE__*/ H(`ZodBase64URL`,(e,t)=>{Bh.init(e,t),Y.init(e,t)}),Wy=/*@__PURE__*/ H(`ZodE164`,(e,t)=>{Vh.init(e,t),Y.init(e,t)}),Gy=/*@__PURE__*/ H(`ZodJWT`,(e,t)=>{Uh.init(e,t),Y.init(e,t)}),Ky=/*@__PURE__*/ H(`ZodNumber`,(e,t)=>{Wh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fv(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ mp({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Av(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Av(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Av(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Av(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ L_(e,t))},gte(e,t){return this.check(/* @__PURE__ */ R_(e,t))},min(e,t){return this.check(/* @__PURE__ */ R_(e,t))},lt(e,t){return this.check(/* @__PURE__ */ F_(e,t))},lte(e,t){return this.check(/* @__PURE__ */ I_(e,t))},max(e,t){return this.check(/* @__PURE__ */ I_(e,t))},int(e){return this.check(Jy(e))},safe(e){return this.check(Jy(e))},positive(e){return this.check(/* @__PURE__ */ L_(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ R_(0,e))},negative(e){return this.check(/* @__PURE__ */ F_(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ I_(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ z_(e,t))},step(e,t){return this.check(/* @__PURE__ */ z_(e,t))},finite(){return this}}));function X(e){return/* @__PURE__ */ A_(Ky,e)}let qy=/*@__PURE__*/ H(`ZodNumberFormat`,(e,t)=>{Gh.init(e,t),Ky.init(e,t)});function Jy(e){return/* @__PURE__ */ j_(qy,e)}let Yy=/*@__PURE__*/ H(`ZodBoolean`,(e,t)=>{Kh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iv(e,t,n,r)});function Z(e){return/* @__PURE__ */ M_(Yy,e)}let Xy=/*@__PURE__*/ H(`ZodUnknown`,(e,t)=>{qh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Zy(){return/* @__PURE__ */ N_(Xy)}let Qy=/*@__PURE__*/ H(`ZodNever`,(e,t)=>{Jh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lv(e,t,n,r)});function $y(e){return/* @__PURE__ */ P_(Qy,e)}let eb=/*@__PURE__*/ H(`ZodArray`,(e,t)=>{by(),Qh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hv(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ V_(e,t))},nonempty(e){return this.check(/* @__PURE__ */ V_(1,e))},max(e,t){return this.check(/* @__PURE__ */ B_(e,t))},length(e,t){return this.check(/* @__PURE__ */ H_(e,t))},unwrap(){return this.element}});function tb(e,t){return/* @__PURE__ */ tv(eb,e,t)}let nb=/*@__PURE__*/ H(`ZodObject`,(e,t)=>{by(),ig.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wv(e,t,n,r),bp(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return fb(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(kf(this._zod.def,{catchall:e}))},passthrough(){return this.clone(kf(this._zod.def,{catchall:Zy()}))},loose(){return this.clone(kf(this._zod.def,{catchall:Zy()}))},strict(){return this.clone(kf(this._zod.def,{catchall:$y()}))},strip(){return this.clone(kf(this._zod.def,{catchall:void 0}))},extend(e){return qf(this,e)},safeExtend(e){return Yf(this,e)},merge(e){return Xf(this,e)},pick(e){return Wf(this,e)},omit(e){return Kf(this,e)},partial(...e){return Zf(gb,this,e[0])},exactPartial(...e){return Zf(vb,this,e[0],`exactPartial`)},required(...e){return Qf(Eb,this,e[0])}});function Q(e,t){let n={type:`object`,shape:e??{},...B(t)};return new nb(n)}let rb=/*@__PURE__*/ H(`ZodUnion`,(e,t)=>{og.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gv(e,t,n,r),e.options=t.options});function ib(e,t){return new rb({type:`union`,options:e,...B(t)})}let ab=/*@__PURE__*/ H(`ZodDiscriminatedUnion`,(e,t)=>{rb.init(e,t),cg.init(e,t)});function ob(e,t,n){return new ab({type:`union`,options:t,discriminator:e,...B(n)})}let sb=/*@__PURE__*/ H(`ZodIntersection`,(e,t)=>{lg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kv(e,t,n,r)});function cb(e,t){return new sb({type:`intersection`,left:e,right:t})}let lb=/*@__PURE__*/ H(`ZodTuple`,(e,t)=>{by(),fg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qv(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new gb({type:`optional`,innerType:e}))})}});function ub(e,t,n){let r=t instanceof U;return new lb({type:`tuple`,items:e,rest:r?t:null,...B(r?n:t)})}let db=/*@__PURE__*/ H(`ZodEnum`,(e,t)=>{gg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rv(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new db({...t,checks:[],...B(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new db({...t,checks:[],...B(r),entries:i})}});function fb(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new db({type:`enum`,entries:n,...B(t)})}let pb=/*@__PURE__*/ H(`ZodLiteral`,(e,t)=>{_g.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zv(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $(e,t){return new pb({type:`literal`,values:Array.isArray(e)?e:[e],...B(t)})}let mb=/*@__PURE__*/ H(`ZodTransform`,(e,t)=>{by(),vg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vv(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Dp(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(up(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(up(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function hb(e){return new mb({type:`transform`,transform:e})}let gb=/*@__PURE__*/ H(`ZodOptional`,(e,t)=>{bg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _b(e){return new gb({type:`optional`,innerType:e})}let vb=/*@__PURE__*/ H(`ZodExactOptional`,(e,t)=>{xg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yb(e){return new vb({type:`optional`,innerType:e})}let bb=/*@__PURE__*/ H(`ZodNullable`,(e,t)=>{Sg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jv(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xb(e){return new bb({type:`nullable`,innerType:e})}let Sb=/*@__PURE__*/ H(`ZodDefault`,(e,t)=>{Cg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qv(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cb(e,t){return new Sb({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():If(t)}})}let wb=/*@__PURE__*/ H(`ZodPrefault`,(e,t)=>{Tg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$v(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tb(e,t){return new wb({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():If(t)}})}let Eb=/*@__PURE__*/ H(`ZodNonOptional`,(e,t)=>{Eg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yv(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Db(e,t){return new Eb({type:`nonoptional`,innerType:e,...B(t)})}let Ob=/*@__PURE__*/ H(`ZodCatch`,(e,t)=>{kg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ey(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kb(e,t){return new Ob({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:xp(t)})}let Ab=/*@__PURE__*/ H(`ZodPipe`,(e,t)=>{Ag.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.in=t.in,e.out=t.out});function jb(e,t){return new Ab({type:`pipe`,in:e,out:t})}let Mb=/*@__PURE__*/ H(`ZodReadonly`,(e,t)=>{Mg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ny(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nb(e){return new Mb({type:`readonly`,innerType:e})}let Pb=/*@__PURE__*/ H(`ZodCustom`,(e,t)=>{Pg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bv(e,t,n,r)});function Fb(e,t={}){return/* @__PURE__ */ nv(Pb,e,t)}function Ib(e,t){return/* @__PURE__ */ rv(e,t)}let Lb=Q({file:J(),line:X().int().optional(),column:X().int().optional()}),Rb=Q({name:J(),source:Lb.optional(),library:J().optional()}),zb=Q({x:X(),y:X(),width:X(),height:X()}),Bb=ub([X(),X(),X(),X()]),Vb=Q({margin:Bb,padding:Bb,border:Bb,gap:Q({row:X(),column:X()}).optional()}),Hb=Q({to:J(),selector:J().optional(),parent:Z().optional(),top:X().optional(),right:X().optional(),bottom:X().optional(),left:X().optional()}),Ub=Q({tagName:J(),selector:J(),html:J(),text:J().optional(),components:tb(Rb).default([]),rect:zb,viewport:Q({width:X(),height:X(),dpr:X()}),selection:J().optional(),box:Vb.optional(),spacing:Hb.optional()}),Wb=Q({selector:J(),offsetX:X().min(0).max(1),offsetY:X().min(0).max(1)}),Gb=Q({name:J(),mimeType:fb([`image/png`,`image/jpeg`,`image/webp`]),dataUrl:J().startsWith(`data:image/`).max(14e6)}),Kb=Q({projectKey:J().min(1).max(64),repo:J().min(3).max(200),branch:J().min(1).max(255),sha:J().min(7).max(64)}),qb=Q({code:J().min(1).max(32),key:J().min(1).max(32),alt:Z(),ctrl:Z(),meta:Z(),shift:Z()}),Jb=Q({comment:qb.nullable(),ruler:qb.nullable(),hidePins:qb.nullable(),hideDock:qb,measure:fb([`Alt`,`Control`,`Meta`,`Shift`]).nullable()}),Yb=Q({theme:fb([`dark`,`light`,`system`]).optional(),shortcuts:Jb.optional()}),Xb=1e4;ob(`type`,[Q({type:$(`hello`),protocol:$(1),pageUrl:J(),root:J().max(4096).optional(),build:Kb.optional(),token:J().min(1).max(4096).optional()}),Q({type:$(`thread.create`),id:J().min(1).max(64),pageUrl:J(),prompt:J().min(1),anchor:Wb,context:Ub,attachments:tb(Gb).max(4).default([]),providerThreadId:J().optional(),draft:Z().optional()}),Q({type:$(`thread.edit`),threadId:J(),prompt:J().min(1)}),Q({type:$(`drafts.send`),drafts:tb(Q({threadId:J(),number:X().int().positive()})).min(1)}),Q({type:$(`thread.open`),id:J().min(1).max(64),providerThreadId:J(),title:J().optional()}),Q({type:$(`provider.threads`)}),Q({type:$(`provider.models`)}),Q({type:$(`project.choices`)}),Q({type:$(`project.select`),root:J().min(1)}),Q({type:$(`provider.pair`)}),Q({type:$(`thread.reply`),threadId:J(),text:J().min(1),attachments:tb(Gb).max(4).default([])}),Q({type:$(`thread.interrupt`),threadId:J()}),Q({type:$(`thread.resolve`),threadId:J(),resolved:Z()}),Q({type:$(`thread.delete`),threadId:J()}),Q({type:$(`thread.move`),threadId:J(),anchor:Wb}),Q({type:$(`settings.update`),provider:J().min(1).optional(),batch:Z().optional(),ruler:Z().optional(),context:J().max(Xb).optional(),globalContext:J().max(Xb).optional()}),Q({type:$(`model.select`),model:J().min(1).nullable()}),Q({type:$(`update.start`)}),Q({type:$(`preferences.update`),preferences:Yb})]),Q({id:J(),label:J(),state:fb([`connecting`,`ready`,`unauthorized`,`unavailable`]),detail:J().optional(),target:J().optional(),canPair:Z().optional()});let Zb=Q({id:J(),label:J()});Q({provider:J(),providers:tb(Zb),model:J().optional(),batch:Z(),ruler:Z(),context:J(),globalContext:J().optional()});let Qb=fb([`ensemble`,`plugin`,`port`,`docker`]);Q({via:fb([...Qb.options,`picked`]),port:X().int().optional(),detected:Q({root:J(),via:Qb,port:X().int().optional()}).optional()});let $b=fb([`draft`,`starting`,`working`,`waiting`,`idle`,`error`]),ex=fb([`user`,`assistant`,`system`]),tx=Q({id:J(),role:ex,text:J(),streaming:Z().default(!1),createdAt:J()}),nx=Q({status:fb([`queued`,`pushed`,`deploying`,`live`,`deploy-failed`,`no-changes`,`failed`]),detail:J().optional(),queuePosition:X().int().nonnegative().optional(),commit:Q({sha:J(),url:J()}).optional(),pullRequest:Q({number:X().int(),url:J(),opened:Z().default(!1)}).optional(),previewUrl:J().optional(),logsUrl:J().optional()}),rx=fb([`running`,`done`,`failed`,`skipped`]),ix=Q({id:J(),label:J(),status:rx,detail:J().optional(),parentId:J().optional(),startedAt:J(),endedAt:J().optional()});Q({id:J(),title:J(),pageUrl:J().optional(),anchor:Wb.optional(),context:Ub.optional(),status:$b,statusDetail:J().optional(),resolved:Z().default(!1),messages:tb(tx),provider:Q({id:J(),threadId:J().optional(),url:J().optional(),archivable:Z().optional()}),delivery:nx.optional(),steps:tb(ix).optional(),createdAt:J(),updatedAt:J()}),Q({id:J(),title:J(),status:fb([`working`,`waiting`,`idle`,`error`]),updatedAt:J(),url:J().optional(),branch:J().optional(),pullRequest:Q({number:X(),url:J()}).optional(),background:fb([`working`,`monitoring`]).optional(),agent:J().optional()}),Q({id:J(),label:J(),group:J(),agent:J().optional()}),Q({name:J(),iconUrl:J().optional(),emoji:J().optional()});let ax=`https://tencil.dev/changelog`;function ox(e){return e&&/^\d+\.\d+\.\d+$/.test(e)?`${ax}/${e.replaceAll(`.`,`-`)}`:ax}function sx({tone:e,label:t}){let[n,r]=E(!1),i=D(void 0);Ie(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ R(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ R(`span`,{class:`status-dot status-${e}`,children:Dr.value>0&&/* @__PURE__ */ R(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ R(cx,{tone:e})]})}function cx({tone:e}){return/* @__PURE__ */ R(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ R(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ R(ud,{size:18}),/* @__PURE__ */ R(`strong`,{children:`Tencil`}),Jt.value&&/* @__PURE__ */ R(`span`,{class:`status-card-muted`,children:[`v`,Jt.value]})]}),/* @__PURE__ */ R(dx,{tone:e})]})}function lx(e=ux()){let t=Wt.value,n=Ut.value,r=Er.value.length,i=Dr.value,a=Ot.value,o=[{label:pn()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:rn.value?`Site not allowed`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:_n()},{label:`Project`,value:nn.value?`Not picked yet`:Gt.value?.name??`…`,title:Gt.value?.root},t?{label:`Agent`,tone:t.state===`ready`?`ok`:e,value:t.label,note:Ux(t)}:{label:`Agent`,value:`…`}];return t?.target&&o.push({label:`Workspace`,value:t.target}),a&&o.push({label:`Signed in`,value:a.login?`@${a.login}`:a.name,note:a.access===`read`?`view only`:void 0}),(i>0||r>0)&&o.push({label:`Pins`,value:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)}),o}function ux(){return Ut.value===`open`?`warn`:`error`}function dx({tone:e}){let t=Wt.value;return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`dl`,{class:`status-card-rows`,children:lx(e).map(e=>/* @__PURE__ */ R(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ R(`dt`,{children:e.label}),/* @__PURE__ */ R(`dd`,{title:e.title,children:[e.tone&&/* @__PURE__ */ R(`span`,{class:`status-card-tone tone-${e.tone}`}),e.value,e.note&&/* @__PURE__ */ R(`span`,{class:`status-card-muted`,children:e.note})]})]},e.label))}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ R(`p`,{class:`status-card-detail`,children:t.detail})]})}let fx=`https://github.com/tencildev/tencil`,px=`npx tencil@latest setup`,mx=j(()=>!pn()&&!!Yt.value?.latest&&Yt.value.state===`idle`),hx=A(!1),gx=A(!1);function _x(){let e=Jt.value;if(pn()||!e)return null;let t=Yt.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Zt.value;return/* @__PURE__ */ R(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ R(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ R(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ R(`div`,{class:`settings-update`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[/* @__PURE__ */ R(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ R(`a`,{href:ox(t.latest),target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ R(`p`,{class:`settings-help settings-progress`,children:yx(t)}),/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>N({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),/* @__PURE__ */ R(`div`,{class:`settings-links`,children:[/* @__PURE__ */ R(`a`,{class:`settings-link`,href:fx,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ R(gd,{}),`tencildev/tencil`]}),/* @__PURE__ */ R(`a`,{class:`settings-link`,href:ax,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ R(`a`,{class:`settings-link settings-star`,href:fx,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ R(hd,{}),`Give us a star`]})]}),t?.state===`failed`&&/* @__PURE__ */ R(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ R(`div`,{class:`settings-command`,children:[/* @__PURE__ */ R(`code`,{children:px}),/* @__PURE__ */ R(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(px).then(()=>{hx.value=!0,setTimeout(()=>{hx.value=!1},1500)})},children:hx.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ R(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ R(`summary`,{children:[/* @__PURE__ */ R(md,{}),`Debug`]}),/* @__PURE__ */ R(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ R(dx,{}),/* @__PURE__ */ R(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(vx()).then(()=>{gx.value=!0,setTimeout(()=>{gx.value=!1},1500)})},children:gx.value?`Copied`:`Copy for a bug report`})]})]})]})}function vx(){let e=Wt.value;return[`Tencil v${Jt.value??`?`}`,...lx().map(e=>`${e.label}: ${e.value}${e.note?` (${e.note})`:``}${e.title?` [${e.title}]`:``}`),...e&&e.state!==`ready`&&e.detail?[`Detail: ${e.detail}`]:[],`Page: ${location.origin}${location.pathname}`,`Browser: ${navigator.userAgent}`].join(`
180
- `)}function yx(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function bx(){let e=qt.value;return/* @__PURE__ */ R(`div`,{class:`settings-section overview`,children:e&&!pn()?/* @__PURE__ */ R(xx,{source:e}):/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function xx({source:e}){let[t,n]=E(!1),[r,i]=E(``),a=D(null);Ie(()=>{t&&a.current?.focus()},[t]);let o=e.via===`picked`,s=Kt.value,c=r.trim().toLowerCase(),l=Gt.value?.root,u=(s??[]).filter(e=>e.root!==l&&(!c||e.title.toLowerCase().includes(c)||e.root.toLowerCase().includes(c))),d=e=>{N({type:`project.select`,root:e}),n(!1),i(``)};return/* @__PURE__ */ R(`div`,{class:`overview-block`,children:[/* @__PURE__ */ R(`p`,{class:`settings-label`,children:`Project detection`}),/* @__PURE__ */ R(`div`,{class:`detection`,children:[/* @__PURE__ */ R(`span`,{class:`detection-badge${o?` detection-picked`:``}`,children:o?`Picked`:`Automatic`}),/* @__PURE__ */ R(`span`,{class:`settings-help detection-reason`,children:Sx(e)}),/* @__PURE__ */ R(`span`,{class:`detection-actions`,children:[e.detected&&/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-button`,onClick:()=>e.detected&&d(e.detected.root),children:`Use automatic`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-button`,"aria-expanded":t,onClick:()=>{t||(Kt.value=null,N({type:`project.choices`})),n(!t)},children:t?`Cancel`:`Change`})]})]}),t&&/* @__PURE__ */ R(`div`,{class:`detection-picker`,children:[/* @__PURE__ */ R(`input`,{class:`detection-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,ref:a,value:r,onInput:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u[0]&&d(u[0].root)}}),/* @__PURE__ */ R(`div`,{class:`detection-list`,children:s===null?/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Looking for projects…`}):u.length===0?/* @__PURE__ */ R(`p`,{class:`settings-help`,children:c?`No project matches “${r.trim()}”.`:`No other projects found.`}):u.map(e=>/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-option`,title:e.root,onClick:()=>d(e.root),children:[/* @__PURE__ */ R(`span`,{class:`detection-option-name`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`detection-option-root`,children:`‎`+e.root})]},e.root))}),/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Kept for this address while Tencil finds the same project here. When another app takes the port, detection decides again.`})]})]})}function Sx(e){if(e.via===`picked`)return e.detected?`You picked it instead of ${e.detected.root.split(/[\\/]/).filter(Boolean).pop()??`the detected project`}.`:`You picked it for this address: Tencil couldn't tell from the page.`;switch(e.via){case`plugin`:return`The git repository the Vite or Next.js plugin passed along.`;case`port`:return`The dev server listening on port ${e.port}.`;case`docker`:return`The Docker Compose project publishing port ${e.port}.`;default:return`The Ensemble thread whose dev server runs on port ${e.port}.`}}let Cx=[{action:`comment`,label:`Comment`},{action:`ruler`,label:`Ruler`},{action:`measure`,label:`Measure`,help:`Held while hovering, with the ruler on.`},{action:`hidePins`,label:`Hide pins`},{action:`hideDock`,label:`Hide the dock`,help:`Also brings a hidden dock back.`}],wx=[`comment`,`ruler`,`hidePins`,`hideDock`];function Tx(){let[e,t]=E(null),[n,r]=E(null),[i,a]=E(null),o=jn.value,s=e=>{Mn.value=e!==null,t(e)};Ie(()=>()=>{Mn.value=!1},[]);let c=()=>s(null),l=e=>{Nn(e),r(null),c()},u=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return c();if((t.key===`Backspace`||t.key===`Delete`)&&n)return e===`hideDock`?(r({action:e,text:`Can't clear this one: it's how a hidden dock comes back.`}),c()):l({...o,[e]:null});if(e===`measure`){if(zn(t.key))return l({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${An?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Un(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let s=wx.find(t=>t!==e&&Gn(o[t],i));if(s)return a({action:e,shortcut:i,other:s}),r(null),c();l({...o,[e]:i})},d=({action:e,shortcut:t,other:n})=>{let i=o[e];n===`hideDock`&&!i?r({action:e,text:`Give it a shortcut first: hide the dock needs one.`}):(Nn({...o,[e]:t,[n]:i}),r(null)),a(null)};return/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Click a shortcut and press the new keys. `,/* @__PURE__ */ R(`kbd`,{children:`Esc`}),` cancels,`,` `,/* @__PURE__ */ R(`kbd`,{children:An?`⌫`:`Backspace`}),` clears it.`]}),/* @__PURE__ */ R(`ul`,{class:`shortcut-list`,children:Cx.map(({action:t,label:l,help:f})=>{let p=o[t],m=e===t,h=p===null?null:typeof p==`string`?Vn(p):Bn(p);return/* @__PURE__ */ R(`li`,{class:`shortcut-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,id:`tencil-shortcut-${t}`,children:l}),f&&/* @__PURE__ */ R(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${t}`,"aria-describedby":`tencil-shortcut-${t}-value`,onClick:()=>{a(null),r(null),s(m?null:t)},onKeyDown:e=>{m&&u(t,e)},onBlur:()=>{m&&c()},children:/* @__PURE__ */ R(`span`,{id:`tencil-shortcut-${t}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ R(`kbd`,{children:h}):/* @__PURE__ */ R(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===t&&/* @__PURE__ */ R(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===t&&/* @__PURE__ */ R(`p`,{class:`shortcut-message`,role:`alert`,children:[Bn(i.shortcut),` is already used for`,` `,Cx.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ R(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>d(i),children:`Swap`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},t)})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-reset`,disabled:Ex(o),onClick:()=>{c(),a(null),r(null),Pn()},children:`Reset to defaults`})]})}function Ex(e){return Kn(e,kn)}let Dx={id:`agent`,label:`Agent`};function Ox(){let e=D(null);Vx(e);let t=[{id:`overview`,label:`Project`},Dx,{id:`tools`,label:`Tools`},{id:`context`,label:`Instructions`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...Ot.value?[{id:`account`,label:`Account`}]:[]],r=pn()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===er.value)??Dx,o=()=>{$n.value=!1},s=e=>{er.value=e};return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`settings-scrim`,onClick:o}),/* @__PURE__ */ R(`section`,{ref:e,class:`settings-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onKeyDown:t=>{t.key===`Escape`?(t.stopPropagation(),o()):t.key===`Tab`&&e.current&&Hx(t,e.current)},children:[/* @__PURE__ */ R(`nav`,{class:`settings-nav`,"aria-label":`Settings pages`,onKeyDown:t=>{let n=t.key===`ArrowDown`?1:t.key===`ArrowUp`?-1:0;if(!n)return;t.preventDefault();let r=i.indexOf(a),o=i[(r+n+i.length)%i.length];o&&(s(o.id),(e.current?.querySelector(`[data-page="${o.id}"]`))?.focus())},children:[/* @__PURE__ */ R(`strong`,{class:`settings-title`,children:[/* @__PURE__ */ R(ud,{size:18}),`Settings`]}),/* @__PURE__ */ R(kx,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ R(kx,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ R(kx,{title:`Tencil`,pages:r,current:a.id,onSelect:s})]}),/* @__PURE__ */ R(`div`,{class:`settings-page`,children:[/* @__PURE__ */ R(`header`,{class:`settings-header`,children:[/* @__PURE__ */ R(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ R(`h2`,{children:a.id===`overview`?Gt.value?.name??a.label:a.label}),/* @__PURE__ */ R(`span`,{class:`settings-scope`,children:Ax(a.id)})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ R(od,{})})]}),/* @__PURE__ */ R(`div`,{class:`settings-body`,children:/* @__PURE__ */ R(jx,{id:a.id})})]})]})]})}function kx({title:e,pages:t,current:n,onSelect:r}){return/* @__PURE__ */ R(`div`,{class:`settings-nav-group`,children:[e&&/* @__PURE__ */ R(`p`,{class:`settings-nav-title`,children:e}),t.map(e=>{let t=e.id===`about`&&mx.value;return/* @__PURE__ */ R(`button`,{type:`button`,"data-page":e.id,class:`settings-nav-item${e.id===n?` active`:``}${e.id===`overview`?` settings-nav-project`:``}`,"aria-current":e.id===n?`page`:void 0,"aria-label":t?`${e.label} (update available)`:void 0,tabIndex:e.id===n?0:-1,onClick:()=>r(e.id),children:[/* @__PURE__ */ R(`span`,{class:`settings-nav-label`,children:e.label}),t&&/* @__PURE__ */ R(`span`,{class:`settings-nav-dot`})]},e.id)})]})}function Ax(e){switch(e){case`overview`:return Gt.value?.root??``;case`agent`:case`tools`:return Gt.value?`Saved for ${Gt.value.name}, for everyone using its pins`:`Saved for this project`;case`context`:return`Sent to the agent with each new pin`;case`appearance`:case`shortcuts`:return pn()?`Saved in this browser`:`Saved on this computer, for all your projects`;case`dock`:return`Saved in this browser, for this site`;case`account`:return`Saved in this browser`;default:return`Runs on this machine, for all your projects`}}function jx({id:e}){switch(e){case`overview`:return/* @__PURE__ */ R(bx,{});case`agent`:return/* @__PURE__ */ R(Mx,{});case`tools`:return/* @__PURE__ */ R(Nx,{});case`context`:return/* @__PURE__ */ R(Px,{});case`appearance`:return/* @__PURE__ */ R(Lx,{});case`shortcuts`:return/* @__PURE__ */ R(Tx,{});case`dock`:return/* @__PURE__ */ R(Rx,{});case`account`:return/* @__PURE__ */ R(zx,{});default:return/* @__PURE__ */ R(_x,{})}}function Mx(){let e=M.value,t=Wt.value;return e?/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ R(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ R(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ R(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>N({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ R(Yu,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:Ux(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ R(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}):/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`})}function Nx(){let e=M.value;return e?/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(Bx,{label:`Batch mode`,checked:e.batch,onChange:or,help:/* @__PURE__ */ R(x,{children:[`Adds `,/* @__PURE__ */ R(dd,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ R(Bx,{label:`Ruler`,checked:e.ruler,onChange:hr,help:/* @__PURE__ */ R(x,{children:[`Adds `,/* @__PURE__ */ R(fd,{}),` to the toolbar.`,Hn.value.measure&&` With it on, hold ${Hn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`})}function Px(){let e=M.value;if(!e)return/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`});let t=Gt.value?.name;return/* @__PURE__ */ R(x,{children:[e.globalContext!==void 0&&/* @__PURE__ */ R(Fx,{id:`tencil-global-context`,label:`All projects`,help:`Applies to every project you use on this computer.`,placeholder:`Run /frontend-design before making UI changes.`,value:e.globalContext,onSave:t=>{N({type:`settings.update`,globalContext:t})&&(M.value={...e,globalContext:t})}}),/* @__PURE__ */ R(Fx,{id:`tencil-project-context`,label:t?`For ${t} only`:`This project only`,help:`Shared by everyone using this project's pins.`,placeholder:`Use Tailwind v4 classes. Avoid inline styles.`,value:e.context,onSave:t=>{N({type:`settings.update`,context:t})&&(M.value={...e,context:t})}})]})}function Fx({id:e,label:t,help:n,placeholder:r,value:i,onSave:a}){let[o,s]=E(i),c=D(!1),l=D(i),u=D(void 0),d=D(()=>{});return d.current=()=>{clearTimeout(u.current),o!==l.current&&(l.current=o,a(o))},Ie(()=>{c.current||(l.current=i,s(i))},[i]),Ie(()=>()=>d.current(),[]),/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`label`,{class:`settings-label`,for:e,children:t}),/* @__PURE__ */ R(`p`,{class:`settings-help`,id:`${e}-help`,children:n}),/* @__PURE__ */ R(`textarea`,{id:e,class:`settings-textarea`,rows:5,maxLength:Xb,placeholder:r,"aria-describedby":`${e}-help`,value:o,onFocus:()=>{c.current=!0},onBlur:()=>{c.current=!1,d.current()},onInput:e=>{s(e.currentTarget.value),clearTimeout(u.current),u.current=setTimeout(()=>d.current(),600)},onKeyDown:e=>{e.key!==`Escape`&&e.key!==`Tab`&&e.stopPropagation()}})]})}let Ix=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function Lx(){return/* @__PURE__ */ R(`div`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,id:`tencil-theme-label`,children:`Theme`}),/* @__PURE__ */ R(`span`,{class:`settings-help`,children:`Panels and the comment box. System follows your computer's setting.`})]}),/* @__PURE__ */ R(`fieldset`,{class:`segmented settings-segmented`,"aria-labelledby":`tencil-theme-label`,children:Ix.map(e=>/* @__PURE__ */ R(`label`,{class:Mr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ R(`input`,{type:`radio`,name:`tencil-theme`,checked:Mr.value===e.id,onChange:()=>Nr(e.id)}),e.label]},e.id))})]})}function Rx(){return/* @__PURE__ */ R(Bx,{label:`Hide the dock`,checked:lr.value,onChange:dr,help:/* @__PURE__ */ R(x,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ R(`kbd`,{children:Hn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function zx(){let e=Ot.value;return e?/* @__PURE__ */ R(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ R(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ R(`strong`,{children:e.login?`@${e.login}`:e.name})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>{It(mn()),hn()},children:`Sign out`})]}):null}function Bx({label:e,help:t,checked:n,onChange:r}){return/* @__PURE__ */ R(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,children:e}),/* @__PURE__ */ R(`span`,{class:`settings-help`,children:t})]}),/* @__PURE__ */ R(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:n,"aria-checked":n,onChange:e=>r(e.currentTarget.checked)})]})}function Vx(e){Ie(()=>{let t=Pc().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Hx(e,t){let n=[...t.querySelectorAll(`button:not([disabled]), input:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.tabIndex>=0),r=n[0],i=n[n.length-1],a=Pc().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function Ux(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function Wx({text:e,animate:t=!1}){let n=t?Yx(e):0;return/* @__PURE__ */ R(`div`,{class:`md`,children:Gx(e,{index:0,animateFrom:t?n-48:1/0})})}function Gx(e,t){let n=[],r=e.replace(/\r\n/g,`
179
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function fv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;fv(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let pv=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),mv=[`oneOf`,`anyOf`];function hv(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function gv(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!pv.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??hv(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}wf(n,r,e.length===1?e[0]:gv(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=hv(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function _v(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of pv)if(t in e)return;let n=t.filter(e=>mv.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=gv(t);else{let e=n[0],i=mv.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>gv([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,sv(e,r))}function vv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):sv(i,s),sv(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())fv(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])_v(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}sv(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,wf(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:bv(t,`input`,e.processors),output:bv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function K(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return K(r.element,n);if(r.type===`set`)return K(r.valueType,n);if(r.type===`lazy`)return K(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return K(r.innerType,n);if(r.type===`intersection`)return K(r.left,n)||K(r.right,n);if(r.type===`record`||r.type===`map`)return K(r.keyType,n)||K(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:K(r.in,n)||K(r.out,n);if(r.type===`object`){for(let e in r.shape)if(K(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(K(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(K(e,n))return!0;return!!(r.rest&&K(r.rest,n))}return!1}let yv=(e,t={})=>n=>{let r=cv({...n,processors:t});return G(e,r),dv(r,e),vv(r,e)},bv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=cv({...i??{},target:a,io:t,processors:n});return G(e,o),dv(o,e),vv(o,e)},xv=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Sv=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Cv=(e,t)=>{xv(e,`minimum`,t),Sv(e,`maximum`,t)},wv=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Tv=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Ev=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Dv=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ov=(e,t)=>xv(e,`minimum`,t.minimum),kv=(e,t)=>Sv(e,`maximum`,t.maximum),Av=e=>(t,n)=>{Dv(t,n.format);let[r,i]=e[n.format];xv(t,`minimum`,r),Sv(t,`maximum`,i)},jv={greater_than:(e,t)=>xv(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Sv(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>wv(e,t.value),number_format:Av(Wf),bigint_format:Av(Gf),min_length:Ov,max_length:kv,length_equals:(e,t)=>Cv(e,t.length),min_size:Ov,max_size:kv,size_equals:(e,t)=>Cv(e,t.size),string_format:(e,t)=>{Dv(e,t.format),t.pattern&&Tv(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ev(e,t.mime)};function Mv(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)jv[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&xv(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&xv(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Sv(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Sv(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&wv(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ev(t,i.mime);for(let e of i.patterns??[])Tv(t,e);return t}let Nv={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Pv=/* @__PURE__ */ new Map([[Rh,Cm],[Bh,wm]]),Fv=e=>Pv.get(e)??e,Iv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Mv(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Nv[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Fv);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Lv=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Mv(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):lv(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Rv=(e,t,n,r)=>{n.type=`boolean`},zv=(e,t,n,r)=>{n.not={}},Bv=(e,t,n,r)=>{let i=e._zod.def,a=gf(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Vv=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(lv(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(lv(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Hv=(e,t,n,r)=>{lv(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Uv=(e,t,n,r)=>{lv(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Wv=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Mv(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G(a.element,t,{...r,path:[...r.path,`items`]})};function Gv(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Gv(t.out):t.type===`catch`?Gv(t.innerType):e._zod.optin}let Kv=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&lv(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)wf(i.properties,e,G(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Gv(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qv=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Jv=(e,t,n,r)=>{let i=e._zod.def,a=G(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Yv=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>G(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?G(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Gv(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Mv(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)},Xv=(e,t,n,r)=>{let i=e._zod.def,a=G(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Zv=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qv=Symbol();function $v(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(lv(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Qv):JSON.parse(o)}let ey=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=$v(i.defaultValue,e,t,n,r);o!==Qv&&(n.default=o)},ty=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=$v(i.defaultValue,e,t,n,r);o!==Qv&&(n._prefault=o)},ny=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{lv(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ry=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G(o,t,r);let s=t.seen.get(e);s.ref=o},iy=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ay=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},oy=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function sy(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let cy=/*@__PURE__*/ H(`ZodError`,(e,t)=>{Rp.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);oy.has(n)||(oy.add(n),sy(n,`format`,e=>t=>Vp(e,t)),sy(n,`flatten`,e=>t=>Bp(e,t)),sy(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vf,2)}),sy(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vf,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ly=/* @__PURE__ */ Up(cy),uy=/* @__PURE__ */ Wp(cy),dy=/* @__PURE__ */ Gp(cy),fy=/* @__PURE__ */ qp(cy),py=/* @__PURE__ */ $p(cy),my=/* @__PURE__ */ em(cy),hy=/* @__PURE__ */ tm(cy),gy=/* @__PURE__ */ nm(cy),_y=/* @__PURE__ */ rm(cy),vy=/* @__PURE__ */ im(cy),yy=/* @__PURE__ */ am(cy),by=/* @__PURE__ */ om(cy);function xy(){Ap.localeError||jp($g())}function Sy(){Ap.memoizer||jp({memoizer:Xg()})}let q=/*@__PURE__*/ H(`ZodType`,(e,t)=>(xy(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(jf(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Vf(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Lb(e,t))},superRefine(e,t){return this.check(Rb(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Z_(e))},optional(){return yb(this)},exactOptional(){return xb(this)},nullable(){return Cb(this)},nullish(){return yb(Cb(this))},nonoptional(e){return kb(this,e)},array(){return rb(this)},or(e){return ob([this,e])},and(e){return ub(this,e)},transform(e){return Nb(this,_b(e))},default(e){return Tb(this,e)},prefault(e){return Db(this,e)},catch(e){return jb(this,e)},pipe(e){return Nb(this,e)},readonly(){return Fb(this)},describe(e){let t=this.clone();return r_.add(t,{description:e}),t},meta(...e){if(e.length===0)return r_.get(this);let t=this.clone();return r_.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return hp(this,`~standard`,{...oh(this),jsonSchema:{input:bv(this,`input`),output:bv(this,`output`)}})},set"~standard"(e){mp(this,`~standard`,e)},parse:function e(t,n){return ly(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await uy(this,t,n,{callee:e})},safeParse(e,t){return dy(this,e,t)},async safeParseAsync(e,t){return fy(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){mp(this,`spa`,e)},validate(e,t){return Xp(this,e,t)},validateAsync(e,t){return Qp(this,e,t)},encode:function e(t,n){return py(this,t,n,{callee:e})},decode:function e(t,n){return my(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await hy(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await gy(this,t,n,{callee:e})},safeEncode(e,t){return _y(this,e,t)},safeDecode(e,t){return vy(this,e,t)},async safeEncodeAsync(e,t){return yy(this,e,t)},async safeDecodeAsync(e,t){return by(this,e,t)},toJSONSchema(e){return yv(this,{})(e)},get description(){return r_.get(this)?.description},get _def(){return this._zod.def}}),Cy=/*@__PURE__*/ H(`_ZodString`,(e,t)=>{sh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iv(e,t,n,r)},/*@__PURE__*/ gp({format:e=>Mv(e).format??null,minLength:e=>Mv(e).minimum??null,maxLength:e=>Mv(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ G_(...e))},includes(...e){return this.check(/* @__PURE__ */ J_(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Y_(...e))},endsWith(...e){return this.check(/* @__PURE__ */ X_(...e))},min(...e){return this.check(/* @__PURE__ */ U_(...e))},max(...e){return this.check(/* @__PURE__ */ H_(...e))},length(...e){return this.check(/* @__PURE__ */ W_(...e))},nonempty(...e){return this.check(/* @__PURE__ */ U_(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ K_(e))},uppercase(e){return this.check(/* @__PURE__ */ q_(e))},trim(){return this.check(/* @__PURE__ */ $_())},normalize(...e){return this.check(/* @__PURE__ */ Q_(...e))},toLowerCase(){return this.check(/* @__PURE__ */ ev())},toUpperCase(){return this.check(/* @__PURE__ */ tv())},slugify(){return this.check(/* @__PURE__ */ nv())}})),wy=/*@__PURE__*/ H(`ZodString`,(e,t)=>{sh.init(e,t),Cy.init(e,t)},{email(e){return this.check(/* @__PURE__ */ o_(ky,e))},url(e){return this.check(/* @__PURE__ */ f_(My,e))},jwt(e){return this.check(/* @__PURE__ */ D_(qy,e))},emoji(e){return this.check(/* @__PURE__ */ p_(Ny,e))},guid(e){return this.check(/* @__PURE__ */ s_(Ay,e))},uuid(e){return this.check(/* @__PURE__ */ c_(jy,e))},uuidv4(e){return this.check(/* @__PURE__ */ l_(jy,e))},uuidv6(e){return this.check(/* @__PURE__ */ u_(jy,e))},uuidv7(e){return this.check(/* @__PURE__ */ d_(jy,e))},nanoid(e){return this.check(/* @__PURE__ */ m_(Py,e))},cuid(e){return this.check(/* @__PURE__ */ h_(Fy,e))},cuid2(e){return this.check(/* @__PURE__ */ g_(Iy,e))},ulid(e){return this.check(/* @__PURE__ */ __(Ly,e))},base64(e){return this.check(/* @__PURE__ */ w_(Wy,e))},base64url(e){return this.check(/* @__PURE__ */ T_(Gy,e))},xid(e){return this.check(/* @__PURE__ */ v_(Ry,e))},ksuid(e){return this.check(/* @__PURE__ */ y_(zy,e))},ipv4(e){return this.check(/* @__PURE__ */ b_(By,e))},ipv6(e){return this.check(/* @__PURE__ */ x_(Vy,e))},cidrv4(e){return this.check(/* @__PURE__ */ S_(Hy,e))},cidrv6(e){return this.check(/* @__PURE__ */ C_(Uy,e))},e164(e){return this.check(/* @__PURE__ */ E_(Ky,e))},datetime(e){return this.check(/* @__PURE__ */ O_(Ty,e))},date(e){return this.check(/* @__PURE__ */ k_(Ey,e))},time(e){return this.check(/* @__PURE__ */ A_(Dy,e))},duration(e){return this.check(/* @__PURE__ */ j_(Oy,e))}});function J(e){return/* @__PURE__ */ a_(wy,e)}let Y=/*@__PURE__*/ H(`ZodStringFormat`,(e,t)=>{W.init(e,t),Cy.init(e,t)}),Ty=/*@__PURE__*/ H(`ZodISODateTime`,(e,t)=>{Eh.init(e,t),Y.init(e,t)}),Ey=/*@__PURE__*/ H(`ZodISODate`,(e,t)=>{Dh.init(e,t),Y.init(e,t)}),Dy=/*@__PURE__*/ H(`ZodISOTime`,(e,t)=>{Oh.init(e,t),Y.init(e,t)}),Oy=/*@__PURE__*/ H(`ZodISODuration`,(e,t)=>{kh.init(e,t),Y.init(e,t)}),ky=/*@__PURE__*/ H(`ZodEmail`,(e,t)=>{uh.init(e,t),Y.init(e,t)}),Ay=/*@__PURE__*/ H(`ZodGUID`,(e,t)=>{ch.init(e,t),Y.init(e,t)}),jy=/*@__PURE__*/ H(`ZodUUID`,(e,t)=>{lh.init(e,t),Y.init(e,t)}),My=/*@__PURE__*/ H(`ZodURL`,(e,t)=>{vh.init(e,t),Y.init(e,t)}),Ny=/*@__PURE__*/ H(`ZodEmoji`,(e,t)=>{yh.init(e,t),Y.init(e,t)}),Py=/*@__PURE__*/ H(`ZodNanoID`,(e,t)=>{bh.init(e,t),Y.init(e,t)}),Fy=/*@__PURE__*/ H(`ZodCUID`,(e,t)=>{xh.init(e,t),Y.init(e,t)}),Iy=/*@__PURE__*/ H(`ZodCUID2`,(e,t)=>{Sh.init(e,t),Y.init(e,t)}),Ly=/*@__PURE__*/ H(`ZodULID`,(e,t)=>{Ch.init(e,t),Y.init(e,t)}),Ry=/*@__PURE__*/ H(`ZodXID`,(e,t)=>{wh.init(e,t),Y.init(e,t)}),zy=/*@__PURE__*/ H(`ZodKSUID`,(e,t)=>{Th.init(e,t),Y.init(e,t)}),By=/*@__PURE__*/ H(`ZodIPv4`,(e,t)=>{Ah.init(e,t),Y.init(e,t)}),Vy=/*@__PURE__*/ H(`ZodIPv6`,(e,t)=>{Nh.init(e,t),Y.init(e,t)}),Hy=/*@__PURE__*/ H(`ZodCIDRv4`,(e,t)=>{Ph.init(e,t),Y.init(e,t)}),Uy=/*@__PURE__*/ H(`ZodCIDRv6`,(e,t)=>{Ih.init(e,t),Y.init(e,t)}),Wy=/*@__PURE__*/ H(`ZodBase64`,(e,t)=>{zh.init(e,t),Y.init(e,t)}),Gy=/*@__PURE__*/ H(`ZodBase64URL`,(e,t)=>{Hh.init(e,t),Y.init(e,t)}),Ky=/*@__PURE__*/ H(`ZodE164`,(e,t)=>{Uh.init(e,t),Y.init(e,t)}),qy=/*@__PURE__*/ H(`ZodJWT`,(e,t)=>{Gh.init(e,t),Y.init(e,t)}),Jy=/*@__PURE__*/ H(`ZodNumber`,(e,t)=>{Kh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lv(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ gp({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Mv(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Mv(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Mv(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Mv(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ z_(e,t))},gte(e,t){return this.check(/* @__PURE__ */ B_(e,t))},min(e,t){return this.check(/* @__PURE__ */ B_(e,t))},lt(e,t){return this.check(/* @__PURE__ */ L_(e,t))},lte(e,t){return this.check(/* @__PURE__ */ R_(e,t))},max(e,t){return this.check(/* @__PURE__ */ R_(e,t))},int(e){return this.check(Xy(e))},safe(e){return this.check(Xy(e))},positive(e){return this.check(/* @__PURE__ */ z_(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ B_(0,e))},negative(e){return this.check(/* @__PURE__ */ L_(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ R_(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ V_(e,t))},step(e,t){return this.check(/* @__PURE__ */ V_(e,t))},finite(){return this}}));function X(e){return/* @__PURE__ */ M_(Jy,e)}let Yy=/*@__PURE__*/ H(`ZodNumberFormat`,(e,t)=>{qh.init(e,t),Jy.init(e,t)});function Xy(e){return/* @__PURE__ */ N_(Yy,e)}let Zy=/*@__PURE__*/ H(`ZodBoolean`,(e,t)=>{Jh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rv(e,t,n,r)});function Z(e){return/* @__PURE__ */ P_(Zy,e)}let Qy=/*@__PURE__*/ H(`ZodUnknown`,(e,t)=>{Yh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function $y(){return/* @__PURE__ */ F_(Qy)}let eb=/*@__PURE__*/ H(`ZodNever`,(e,t)=>{Xh.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zv(e,t,n,r)});function tb(e){return/* @__PURE__ */ I_(eb,e)}let nb=/*@__PURE__*/ H(`ZodArray`,(e,t)=>{Sy(),eg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wv(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ U_(e,t))},nonempty(e){return this.check(/* @__PURE__ */ U_(1,e))},max(e,t){return this.check(/* @__PURE__ */ H_(e,t))},length(e,t){return this.check(/* @__PURE__ */ W_(e,t))},unwrap(){return this.element}});function rb(e,t){return/* @__PURE__ */ rv(nb,e,t)}let ib=/*@__PURE__*/ H(`ZodObject`,(e,t)=>{Sy(),og.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kv(e,t,n,r),Sp(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return mb(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(jf(this._zod.def,{catchall:e}))},passthrough(){return this.clone(jf(this._zod.def,{catchall:$y()}))},loose(){return this.clone(jf(this._zod.def,{catchall:$y()}))},strict(){return this.clone(jf(this._zod.def,{catchall:tb()}))},strip(){return this.clone(jf(this._zod.def,{catchall:void 0}))},extend(e){return Yf(this,e)},safeExtend(e){return Zf(this,e)},merge(e){return Qf(this,e)},pick(e){return Kf(this,e)},omit(e){return Jf(this,e)},partial(...e){return $f(vb,this,e[0])},exactPartial(...e){return $f(bb,this,e[0],`exactPartial`)},required(...e){return ep(Ob,this,e[0])}});function Q(e,t){let n={type:`object`,shape:e??{},...B(t)};return new ib(n)}let ab=/*@__PURE__*/ H(`ZodUnion`,(e,t)=>{cg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qv(e,t,n,r),e.options=t.options});function ob(e,t){return new ab({type:`union`,options:e,...B(t)})}let sb=/*@__PURE__*/ H(`ZodDiscriminatedUnion`,(e,t)=>{ab.init(e,t),ug.init(e,t)});function cb(e,t,n){return new sb({type:`union`,options:t,discriminator:e,...B(n)})}let lb=/*@__PURE__*/ H(`ZodIntersection`,(e,t)=>{dg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jv(e,t,n,r)});function ub(e,t){return new lb({type:`intersection`,left:e,right:t})}let db=/*@__PURE__*/ H(`ZodTuple`,(e,t)=>{Sy(),mg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yv(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new vb({type:`optional`,innerType:e}))})}});function fb(e,t,n){let r=t instanceof U;return new db({type:`tuple`,items:e,rest:r?t:null,...B(r?n:t)})}let pb=/*@__PURE__*/ H(`ZodEnum`,(e,t)=>{vg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bv(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new pb({...t,checks:[],...B(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new pb({...t,checks:[],...B(r),entries:i})}});function mb(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new pb({type:`enum`,entries:n,...B(t)})}let hb=/*@__PURE__*/ H(`ZodLiteral`,(e,t)=>{yg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vv(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function $(e,t){return new hb({type:`literal`,values:Array.isArray(e)?e:[e],...B(t)})}let gb=/*@__PURE__*/ H(`ZodTransform`,(e,t)=>{Sy(),bg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uv(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kp(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(fp(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(fp(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function _b(e){return new gb({type:`transform`,transform:e})}let vb=/*@__PURE__*/ H(`ZodOptional`,(e,t)=>{Sg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ay(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yb(e){return new vb({type:`optional`,innerType:e})}let bb=/*@__PURE__*/ H(`ZodExactOptional`,(e,t)=>{Cg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ay(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xb(e){return new bb({type:`optional`,innerType:e})}let Sb=/*@__PURE__*/ H(`ZodNullable`,(e,t)=>{wg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xv(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cb(e){return new Sb({type:`nullable`,innerType:e})}let wb=/*@__PURE__*/ H(`ZodDefault`,(e,t)=>{Tg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ey(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tb(e,t){return new wb({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rf(t)}})}let Eb=/*@__PURE__*/ H(`ZodPrefault`,(e,t)=>{Dg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Db(e,t){return new Eb({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rf(t)}})}let Ob=/*@__PURE__*/ H(`ZodNonOptional`,(e,t)=>{Og.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zv(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kb(e,t){return new Ob({type:`nonoptional`,innerType:e,...B(t)})}let Ab=/*@__PURE__*/ H(`ZodCatch`,(e,t)=>{jg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ny(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jb(e,t){return new Ab({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Cp(t)})}let Mb=/*@__PURE__*/ H(`ZodPipe`,(e,t)=>{Mg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),e.in=t.in,e.out=t.out});function Nb(e,t){return new Mb({type:`pipe`,in:e,out:t})}let Pb=/*@__PURE__*/ H(`ZodReadonly`,(e,t)=>{Pg.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fb(e){return new Pb({type:`readonly`,innerType:e})}let Ib=/*@__PURE__*/ H(`ZodCustom`,(e,t)=>{Ig.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hv(e,t,n,r)});function Lb(e,t={}){return/* @__PURE__ */ iv(Ib,e,t)}function Rb(e,t){return/* @__PURE__ */ av(e,t)}let zb=Q({file:J(),line:X().int().optional(),column:X().int().optional()}),Bb=Q({name:J(),source:zb.optional(),library:J().optional()}),Vb=Q({x:X(),y:X(),width:X(),height:X()}),Hb=fb([X(),X(),X(),X()]),Ub=Q({margin:Hb,padding:Hb,border:Hb,gap:Q({row:X(),column:X()}).optional()}),Wb=Q({to:J(),selector:J().optional(),parent:Z().optional(),top:X().optional(),right:X().optional(),bottom:X().optional(),left:X().optional()}),Gb=Q({tagName:J(),selector:J(),html:J(),text:J().optional(),components:rb(Bb).default([]),rect:Vb,viewport:Q({width:X(),height:X(),dpr:X()}),selection:J().optional(),box:Ub.optional(),spacing:Wb.optional()}),Kb=Q({selector:J(),offsetX:X().min(0).max(1),offsetY:X().min(0).max(1)}),qb=Q({name:J(),mimeType:mb([`image/png`,`image/jpeg`,`image/webp`]),dataUrl:J().startsWith(`data:image/`).max(14e6)}),Jb=Q({projectKey:J().min(1).max(64),repo:J().min(3).max(200),branch:J().min(1).max(255),sha:J().min(7).max(64)}),Yb=Q({code:J().min(1).max(32),key:J().min(1).max(32),alt:Z(),ctrl:Z(),meta:Z(),shift:Z()}),Xb=Q({comment:Yb.nullable(),ruler:Yb.nullable(),hidePins:Yb.nullable(),hideDock:Yb,measure:mb([`Alt`,`Control`,`Meta`,`Shift`]).nullable()}),Zb=Q({theme:mb([`dark`,`light`,`system`]).optional(),shortcuts:Xb.optional()}),Qb=1e4;cb(`type`,[Q({type:$(`hello`),protocol:$(1),pageUrl:J(),root:J().max(4096).optional(),build:Jb.optional(),token:J().min(1).max(4096).optional()}),Q({type:$(`thread.create`),id:J().min(1).max(64),pageUrl:J(),prompt:J().min(1),anchor:Kb,context:Gb,attachments:rb(qb).max(4).default([]),providerThreadId:J().optional(),draft:Z().optional()}),Q({type:$(`thread.edit`),threadId:J(),prompt:J().min(1)}),Q({type:$(`drafts.send`),drafts:rb(Q({threadId:J(),number:X().int().positive()})).min(1)}),Q({type:$(`thread.open`),id:J().min(1).max(64),providerThreadId:J(),title:J().optional()}),Q({type:$(`provider.threads`)}),Q({type:$(`provider.models`)}),Q({type:$(`project.choices`)}),Q({type:$(`project.select`),root:J().min(1)}),Q({type:$(`provider.pair`)}),Q({type:$(`thread.reply`),threadId:J(),text:J().min(1),attachments:rb(qb).max(4).default([])}),Q({type:$(`thread.interrupt`),threadId:J()}),Q({type:$(`thread.resolve`),threadId:J(),resolved:Z()}),Q({type:$(`thread.delete`),threadId:J()}),Q({type:$(`thread.move`),threadId:J(),anchor:Kb}),Q({type:$(`settings.update`),provider:J().min(1).optional(),batch:Z().optional(),ruler:Z().optional(),context:J().max(Qb).optional(),globalContext:J().max(Qb).optional()}),Q({type:$(`model.select`),model:J().min(1).nullable()}),Q({type:$(`update.start`)}),Q({type:$(`preferences.update`),preferences:Zb})]),Q({id:J(),label:J(),state:mb([`connecting`,`ready`,`unauthorized`,`unavailable`]),detail:J().optional(),target:J().optional(),canPair:Z().optional()});let $b=Q({id:J(),label:J()});Q({provider:J(),providers:rb($b),model:J().optional(),batch:Z(),ruler:Z(),context:J(),globalContext:J().optional()});let ex=mb([`ensemble`,`plugin`,`port`,`docker`]);Q({via:mb([...ex.options,`picked`]),port:X().int().optional(),detected:Q({root:J(),via:ex,port:X().int().optional()}).optional()});let tx=mb([`draft`,`starting`,`working`,`waiting`,`idle`,`error`]),nx=mb([`user`,`assistant`,`system`]),rx=Q({id:J(),role:nx,text:J(),streaming:Z().default(!1),createdAt:J()}),ix=Q({status:mb([`queued`,`pushed`,`deploying`,`live`,`deploy-failed`,`no-changes`,`failed`]),detail:J().optional(),queuePosition:X().int().nonnegative().optional(),commit:Q({sha:J(),url:J()}).optional(),pullRequest:Q({number:X().int(),url:J(),opened:Z().default(!1)}).optional(),previewUrl:J().optional(),logsUrl:J().optional()}),ax=mb([`running`,`done`,`failed`,`skipped`]),ox=Q({id:J(),label:J(),status:ax,detail:J().optional(),parentId:J().optional(),startedAt:J(),endedAt:J().optional()});Q({id:J(),title:J(),pageUrl:J().optional(),anchor:Kb.optional(),context:Gb.optional(),status:tx,statusDetail:J().optional(),resolved:Z().default(!1),messages:rb(rx),provider:Q({id:J(),threadId:J().optional(),url:J().optional(),archivable:Z().optional()}),delivery:ix.optional(),steps:rb(ox).optional(),createdAt:J(),updatedAt:J()}),Q({id:J(),title:J(),status:mb([`working`,`waiting`,`idle`,`error`]),updatedAt:J(),url:J().optional(),branch:J().optional(),pullRequest:Q({number:X(),url:J()}).optional(),background:mb([`working`,`monitoring`]).optional(),agent:J().optional()}),Q({id:J(),label:J(),group:J(),agent:J().optional()}),Q({name:J(),iconUrl:J().optional(),emoji:J().optional()});let sx=`https://tencil.dev/changelog`;function cx(e){return e&&/^\d+\.\d+\.\d+$/.test(e)?`${sx}/${e.replaceAll(`.`,`-`)}`:sx}function lx({tone:e,label:t}){let[n,r]=E(!1),i=D(void 0);Ie(()=>()=>clearTimeout(i.current),[]);let a=e=>{clearTimeout(i.current),i.current=setTimeout(()=>r(!0),e)},o=()=>{clearTimeout(i.current),r(!1)};return/* @__PURE__ */ R(`span`,{class:`status`,onPointerEnter:()=>a(250),onPointerLeave:o,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`status-button`,"aria-label":`Tencil status: ${t}`,"aria-expanded":n,"aria-describedby":n?`tencil-status-card`:void 0,onFocus:()=>a(0),onBlur:o,onClick:()=>n?o():a(0),children:/* @__PURE__ */ R(`span`,{class:`status-dot status-${e}`,children:kr.value>0&&/* @__PURE__ */ R(`span`,{class:`status-ping`})})}),n&&/* @__PURE__ */ R(ux,{tone:e})]})}function ux({tone:e}){return/* @__PURE__ */ R(`div`,{class:`status-card`,role:`tooltip`,id:`tencil-status-card`,children:[/* @__PURE__ */ R(`div`,{class:`status-card-head`,children:[/* @__PURE__ */ R(fd,{size:18}),/* @__PURE__ */ R(`strong`,{children:`Tencil`}),Jt.value&&/* @__PURE__ */ R(`span`,{class:`status-card-muted`,children:[`v`,Jt.value]})]}),/* @__PURE__ */ R(px,{tone:e})]})}function dx(e=fx()){let t=Wt.value,n=Ut.value,r=Or.value.length,i=kr.value,a=Ot.value,o=[{label:mn()?`Tencil Cloud`:`Daemon`,tone:n===`open`?`ok`:e,value:n===`open`?`Connected`:rn.value?`Site not allowed`:n===`connecting`?`Connecting…`:`Offline`},{label:`Address`,value:yn()},{label:`Project`,value:nn.value?`Not picked yet`:Gt.value?.name??`…`,title:Gt.value?.root},t?{label:`Agent`,tone:t.state===`ready`?`ok`:e,value:t.label,note:Gx(t)}:{label:`Agent`,value:`…`}];return t?.target&&o.push({label:`Workspace`,value:t.target}),a&&o.push({label:`Signed in`,value:a.login?`@${a.login}`:a.name,note:a.access===`read`?`view only`:void 0}),(i>0||r>0)&&o.push({label:`Pins`,value:[i>0&&`${i} working`,r>0&&`${r} queued`].filter(Boolean).join(` · `)}),o}function fx(){return Ut.value===`open`?`warn`:`error`}function px({tone:e}){let t=Wt.value;return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`dl`,{class:`status-card-rows`,children:dx(e).map(e=>/* @__PURE__ */ R(`div`,{class:`status-card-row`,children:[/* @__PURE__ */ R(`dt`,{children:e.label}),/* @__PURE__ */ R(`dd`,{title:e.title,children:[e.tone&&/* @__PURE__ */ R(`span`,{class:`status-card-tone tone-${e.tone}`}),e.value,e.note&&/* @__PURE__ */ R(`span`,{class:`status-card-muted`,children:e.note})]})]},e.label))}),t&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ R(`p`,{class:`status-card-detail`,children:t.detail})]})}let mx=`https://github.com/tencildev/tencil`,hx=`npx tencil@latest setup`,gx=j(()=>!mn()&&!!Yt.value?.latest&&Yt.value.state===`idle`),_x=A(!1),vx=A(!1);function yx(){let e=Jt.value;if(mn()||!e)return null;let t=Yt.value,n=t?.state===`installing`||t?.state===`waiting`||t?.state===`restarting`,r=Zt.value;return/* @__PURE__ */ R(`section`,{class:`settings-section settings-about`,"aria-label":`About Tencil`,children:[/* @__PURE__ */ R(`div`,{class:`settings-about-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,children:`Tencil`}),/* @__PURE__ */ R(`span`,{class:`settings-version`,children:[`v`,e]})]}),r&&r!==e&&!t?.latest&&/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Updated from v`,r,`.`]}),t?.latest&&/* @__PURE__ */ R(`div`,{class:`settings-update`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[/* @__PURE__ */ R(`strong`,{children:[`Tencil `,t.latest,` is available.`]}),` `,/* @__PURE__ */ R(`a`,{href:cx(t.latest),target:`_blank`,rel:`noreferrer`,children:`What's new`})]}),n&&/* @__PURE__ */ R(`p`,{class:`settings-help settings-progress`,children:xx(t)}),/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action settings-update-button`,disabled:n,onClick:()=>N({type:`update.start`}),children:n?`Updating…`:t.state===`failed`?`Try again`:`Update`})]}),/* @__PURE__ */ R(`div`,{class:`settings-links`,children:[/* @__PURE__ */ R(`a`,{class:`settings-link`,href:mx,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ R(vd,{}),`tencildev/tencil`]}),/* @__PURE__ */ R(`a`,{class:`settings-link`,href:sx,target:`_blank`,rel:`noreferrer`,children:`Changelog`}),/* @__PURE__ */ R(`a`,{class:`settings-link settings-star`,href:mx,target:`_blank`,rel:`noreferrer`,children:[/* @__PURE__ */ R(_d,{}),`Give us a star`]})]}),t?.state===`failed`&&/* @__PURE__ */ R(`div`,{class:`settings-update-error`,role:`alert`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Couldn't update`,t.error?`: ${t.error}`:`.`,` Tencil `,e,` `,`is still running. Update from a terminal instead:`]}),/* @__PURE__ */ R(`div`,{class:`settings-command`,children:[/* @__PURE__ */ R(`code`,{children:hx}),/* @__PURE__ */ R(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(hx).then(()=>{_x.value=!0,setTimeout(()=>{_x.value=!1},1500)})},children:_x.value?`Copied`:`Copy`})]})]}),/* @__PURE__ */ R(`details`,{class:`settings-debug`,children:[/* @__PURE__ */ R(`summary`,{children:[/* @__PURE__ */ R(gd,{}),`Debug`]}),/* @__PURE__ */ R(`div`,{class:`settings-debug-body`,children:[/* @__PURE__ */ R(px,{}),/* @__PURE__ */ R(`button`,{type:`button`,class:`settings-copy`,onClick:()=>{navigator.clipboard?.writeText(bx()).then(()=>{vx.value=!0,setTimeout(()=>{vx.value=!1},1500)})},children:vx.value?`Copied`:`Copy for a bug report`})]})]})]})}function bx(){let e=Wt.value;return[`Tencil v${Jt.value??`?`}`,...dx().map(e=>`${e.label}: ${e.value}${e.note?` (${e.note})`:``}${e.title?` [${e.title}]`:``}`),...e&&e.state!==`ready`&&e.detail?[`Detail: ${e.detail}`]:[],`Page: ${location.origin}${location.pathname}`,`Browser: ${navigator.userAgent}`].join(`
180
+ `)}function xx(e){switch(e.state){case`installing`:return`Installing Tencil ${e.latest}…`;case`waiting`:{let t=e.running??1;return`Waiting for ${t} running ${t===1?`thread`:`threads`} to finish…`}default:return`Restarting on Tencil ${e.latest}…`}}function Sx(){let e=qt.value;return/* @__PURE__ */ R(`div`,{class:`settings-section overview`,children:e&&!mn()?/* @__PURE__ */ R(Cx,{source:e}):/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Pins on this page go to this project.`})})}function Cx({source:e}){let[t,n]=E(!1),[r,i]=E(``),a=D(null);Ie(()=>{t&&a.current?.focus()},[t]);let o=e.via===`picked`,s=Kt.value,c=r.trim().toLowerCase(),l=Gt.value?.root,u=(s??[]).filter(e=>e.root!==l&&(!c||e.title.toLowerCase().includes(c)||e.root.toLowerCase().includes(c))),d=e=>{N({type:`project.select`,root:e}),n(!1),i(``)};return/* @__PURE__ */ R(`div`,{class:`overview-block`,children:[/* @__PURE__ */ R(`p`,{class:`settings-label`,children:`Project detection`}),/* @__PURE__ */ R(`div`,{class:`detection`,children:[/* @__PURE__ */ R(`span`,{class:`detection-badge${o?` detection-picked`:``}`,children:o?`Picked`:`Automatic`}),/* @__PURE__ */ R(`span`,{class:`settings-help detection-reason`,children:wx(e)}),/* @__PURE__ */ R(`span`,{class:`detection-actions`,children:[e.detected&&/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-button`,onClick:()=>e.detected&&d(e.detected.root),children:`Use automatic`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-button`,"aria-expanded":t,onClick:()=>{t||(Kt.value=null,N({type:`project.choices`})),n(!t)},children:t?`Cancel`:`Change`})]})]}),t&&/* @__PURE__ */ R(`div`,{class:`detection-picker`,children:[/* @__PURE__ */ R(`input`,{class:`detection-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,ref:a,value:r,onInput:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u[0]&&d(u[0].root)}}),/* @__PURE__ */ R(`div`,{class:`detection-list`,children:s===null?/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Looking for projects…`}):u.length===0?/* @__PURE__ */ R(`p`,{class:`settings-help`,children:c?`No project matches “${r.trim()}”.`:`No other projects found.`}):u.map(e=>/* @__PURE__ */ R(`button`,{type:`button`,class:`detection-option`,title:e.root,onClick:()=>d(e.root),children:[/* @__PURE__ */ R(`span`,{class:`detection-option-name`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`detection-option-root`,children:`‎`+e.root})]},e.root))}),/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Kept for this address while Tencil finds the same project here. When another app takes the port, detection decides again.`})]})]})}function wx(e){if(e.via===`picked`)return e.detected?`You picked it instead of ${e.detected.root.split(/[\\/]/).filter(Boolean).pop()??`the detected project`}.`:`You picked it for this address: Tencil couldn't tell from the page.`;switch(e.via){case`plugin`:return`The git repository the Vite or Next.js plugin passed along.`;case`port`:return`The dev server listening on port ${e.port}.`;case`docker`:return`The Docker Compose project publishing port ${e.port}.`;default:return`The Ensemble thread whose dev server runs on port ${e.port}.`}}let Tx=[{action:`comment`,label:`Comment`},{action:`ruler`,label:`Ruler`},{action:`measure`,label:`Measure`,help:`Held while hovering, with the ruler on.`},{action:`hidePins`,label:`Hide pins`},{action:`hideDock`,label:`Hide the dock`,help:`Also brings a hidden dock back.`}],Ex=[`comment`,`ruler`,`hidePins`,`hideDock`];function Dx(){let[e,t]=E(null),[n,r]=E(null),[i,a]=E(null),o=Nn.value,s=e=>{Pn.value=e!==null,t(e)};Ie(()=>()=>{Pn.value=!1},[]);let c=()=>s(null),l=e=>{Fn(e),r(null),c()},u=(e,t)=>{t.preventDefault(),t.stopPropagation();let n=!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(t.key===`Escape`&&n)return c();if((t.key===`Backspace`||t.key===`Delete`)&&n)return e===`hideDock`?(r({action:e,text:`Can't clear this one: it's how a hidden dock comes back.`}),c()):l({...o,[e]:null});if(e===`measure`){if(Vn(t.key))return l({...o,measure:t.key});r({action:e,text:`Measure is held: press one key, ${Mn?`⌥, ⇧, ⌃ or ⌘`:`Alt, Shift, Ctrl or Win`}.`});return}let i=Gn(t);if(!i)return;if(`error`in i){r({action:e,text:i.error});return}let s=Ex.find(t=>t!==e&&qn(o[t],i));if(s)return a({action:e,shortcut:i,other:s}),r(null),c();l({...o,[e]:i})},d=({action:e,shortcut:t,other:n})=>{let i=o[e];n===`hideDock`&&!i?r({action:e,text:`Give it a shortcut first: hide the dock needs one.`}):(Fn({...o,[e]:t,[n]:i}),r(null)),a(null)};return/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`p`,{class:`settings-help`,children:[`Click a shortcut and press the new keys. `,/* @__PURE__ */ R(`kbd`,{children:`Esc`}),` cancels,`,` `,/* @__PURE__ */ R(`kbd`,{children:Mn?`⌫`:`Backspace`}),` clears it.`]}),/* @__PURE__ */ R(`ul`,{class:`shortcut-list`,children:Tx.map(({action:t,label:l,help:f})=>{let p=o[t],m=e===t,h=p===null?null:typeof p==`string`?Un(p):Hn(p);return/* @__PURE__ */ R(`li`,{class:`shortcut-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,id:`tencil-shortcut-${t}`,children:l}),f&&/* @__PURE__ */ R(`span`,{class:`settings-help`,children:f})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-key${m?` recording`:``}`,"aria-labelledby":`tencil-shortcut-${t}`,"aria-describedby":`tencil-shortcut-${t}-value`,onClick:()=>{a(null),r(null),s(m?null:t)},onKeyDown:e=>{m&&u(t,e)},onBlur:()=>{m&&c()},children:/* @__PURE__ */ R(`span`,{id:`tencil-shortcut-${t}-value`,children:m?`Press keys…`:h?/* @__PURE__ */ R(`kbd`,{children:h}):/* @__PURE__ */ R(`span`,{class:`shortcut-none`,children:`None`})})}),n?.action===t&&/* @__PURE__ */ R(`p`,{class:`shortcut-message`,role:`alert`,children:n.text}),i?.action===t&&/* @__PURE__ */ R(`p`,{class:`shortcut-message`,role:`alert`,children:[Hn(i.shortcut),` is already used for`,` `,Tx.find(e=>e.action===i.other)?.label,`.`,/* @__PURE__ */ R(`span`,{class:`shortcut-message-actions`,children:[/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>d(i),children:`Swap`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-cancel`,onClick:()=>a(null),children:`Cancel`})]})]})]},t)})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`shortcut-reset`,disabled:Ox(o),onClick:()=>{c(),a(null),r(null),In()},children:`Reset to defaults`})]})}function Ox(e){return Jn(e,jn)}let kx={id:`agent`,label:`Agent`};function Ax(){let e=D(null);Ux(e);let t=[{id:`overview`,label:`Project`},kx,{id:`tools`,label:`Tools`},{id:`context`,label:`Instructions`}],n=[{id:`appearance`,label:`Appearance`},{id:`shortcuts`,label:`Shortcuts`},{id:`dock`,label:`Dock`},...Ot.value?[{id:`account`,label:`Account`}]:[]],r=mn()?[]:[{id:`about`,label:`About`}],i=[...t,...n,...r],a=i.find(e=>e.id===nr.value)??kx,o=()=>{tr.value=!1},s=e=>{nr.value=e};return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`settings-scrim`,onClick:o}),/* @__PURE__ */ R(`section`,{ref:e,class:`settings-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,onKeyDown:t=>{t.key===`Escape`?(t.stopPropagation(),o()):t.key===`Tab`&&e.current&&Wx(t,e.current)},children:[/* @__PURE__ */ R(`nav`,{class:`settings-nav`,"aria-label":`Settings pages`,onKeyDown:t=>{let n=t.key===`ArrowDown`?1:t.key===`ArrowUp`?-1:0;if(!n)return;t.preventDefault();let r=i.indexOf(a),o=i[(r+n+i.length)%i.length];o&&(s(o.id),(e.current?.querySelector(`[data-page="${o.id}"]`))?.focus())},children:[/* @__PURE__ */ R(`strong`,{class:`settings-title`,children:[/* @__PURE__ */ R(fd,{size:18}),`Settings`]}),/* @__PURE__ */ R(jx,{pages:t,current:a.id,onSelect:s}),/* @__PURE__ */ R(jx,{title:`You`,pages:n,current:a.id,onSelect:s}),r.length>0&&/* @__PURE__ */ R(jx,{title:`Tencil`,pages:r,current:a.id,onSelect:s})]}),/* @__PURE__ */ R(`div`,{class:`settings-page`,children:[/* @__PURE__ */ R(`header`,{class:`settings-header`,children:[/* @__PURE__ */ R(`div`,{class:`settings-heading`,children:[/* @__PURE__ */ R(`h2`,{children:a.id===`overview`?Gt.value?.name??a.label:a.label}),/* @__PURE__ */ R(`span`,{class:`settings-scope`,children:Mx(a.id)})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,"aria-label":`Close settings`,onClick:o,children:/* @__PURE__ */ R(cd,{})})]}),/* @__PURE__ */ R(`div`,{class:`settings-body`,children:/* @__PURE__ */ R(Nx,{id:a.id})})]})]})]})}function jx({title:e,pages:t,current:n,onSelect:r}){return/* @__PURE__ */ R(`div`,{class:`settings-nav-group`,children:[e&&/* @__PURE__ */ R(`p`,{class:`settings-nav-title`,children:e}),t.map(e=>{let t=e.id===`about`&&gx.value;return/* @__PURE__ */ R(`button`,{type:`button`,"data-page":e.id,class:`settings-nav-item${e.id===n?` active`:``}${e.id===`overview`?` settings-nav-project`:``}`,"aria-current":e.id===n?`page`:void 0,"aria-label":t?`${e.label} (update available)`:void 0,tabIndex:e.id===n?0:-1,onClick:()=>r(e.id),children:[/* @__PURE__ */ R(`span`,{class:`settings-nav-label`,children:e.label}),t&&/* @__PURE__ */ R(`span`,{class:`settings-nav-dot`})]},e.id)})]})}function Mx(e){switch(e){case`overview`:return Gt.value?.root??``;case`agent`:case`tools`:return Gt.value?`Saved for ${Gt.value.name}, for everyone using its pins`:`Saved for this project`;case`context`:return`Sent to the agent with each new pin`;case`appearance`:case`shortcuts`:return mn()?`Saved in this browser`:`Saved on this computer, for all your projects`;case`dock`:return`Saved in this browser, for this site`;case`account`:return`Saved in this browser`;default:return`Runs on this machine, for all your projects`}}function Nx({id:e}){switch(e){case`overview`:return/* @__PURE__ */ R(Sx,{});case`agent`:return/* @__PURE__ */ R(Px,{});case`tools`:return/* @__PURE__ */ R(Fx,{});case`context`:return/* @__PURE__ */ R(Ix,{});case`appearance`:return/* @__PURE__ */ R(zx,{});case`shortcuts`:return/* @__PURE__ */ R(Dx,{});case`dock`:return/* @__PURE__ */ R(Bx,{});case`account`:return/* @__PURE__ */ R(Vx,{});default:return/* @__PURE__ */ R(yx,{})}}function Px(){let e=M.value,t=Wt.value;return e?/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`p`,{class:`settings-label`,id:`tencil-provider-label`,children:`Agent for new pins`}),/* @__PURE__ */ R(`fieldset`,{class:`settings-options`,"aria-labelledby":`tencil-provider-label`,children:e.providers.map(n=>{let r=n.id===e.provider;return/* @__PURE__ */ R(`label`,{class:`target-option${r?` selected`:``}`,children:[/* @__PURE__ */ R(`input`,{type:`radio`,name:`tencil-provider`,class:`settings-radio`,checked:r,onChange:()=>N({type:`settings.update`,provider:n.id})}),/* @__PURE__ */ R(Zu,{agent:n.id,size:14,decorative:!0}),/* @__PURE__ */ R(`span`,{class:`target-option-title`,children:n.label}),r&&t?.id===n.id&&/* @__PURE__ */ R(`span`,{class:`target-option-meta`,children:Gx(t)})]},n.id)})}),t&&t.id===e.provider&&t.state!==`ready`&&t.detail&&/* @__PURE__ */ R(`p`,{class:`settings-status`,children:t.detail}),/* @__PURE__ */ R(`p`,{class:`settings-help`,children:`Pins you already made keep their agent.`})]}):/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`})}function Fx(){let e=M.value;return e?/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(Hx,{label:`Batch mode`,checked:e.batch,onChange:cr,help:/* @__PURE__ */ R(x,{children:[`Adds `,/* @__PURE__ */ R(pd,{}),` to the comment box to queue comments and send them together.`]})}),/* @__PURE__ */ R(Hx,{label:`Ruler`,checked:e.ruler,onChange:_r,help:/* @__PURE__ */ R(x,{children:[`Adds `,/* @__PURE__ */ R(md,{}),` to the toolbar.`,Wn.value.measure&&` With it on, hold ${Wn.value.measure} to measure spacing on the page.`]})})]}):/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`})}function Ix(){let e=M.value;if(!e)return/* @__PURE__ */ R(`p`,{class:`empty`,children:`Connecting…`});let t=Gt.value?.name;return/* @__PURE__ */ R(x,{children:[e.globalContext!==void 0&&/* @__PURE__ */ R(Lx,{id:`tencil-global-context`,label:`All projects`,help:`Applies to every project you use on this computer.`,placeholder:`Run /frontend-design before making UI changes.`,value:e.globalContext,onSave:t=>{N({type:`settings.update`,globalContext:t})&&(M.value={...e,globalContext:t})}}),/* @__PURE__ */ R(Lx,{id:`tencil-project-context`,label:t?`For ${t} only`:`This project only`,help:`Shared by everyone using this project's pins.`,placeholder:`Use Tailwind v4 classes. Avoid inline styles.`,value:e.context,onSave:t=>{N({type:`settings.update`,context:t})&&(M.value={...e,context:t})}})]})}function Lx({id:e,label:t,help:n,placeholder:r,value:i,onSave:a}){let[o,s]=E(i),c=D(!1),l=D(i),u=D(void 0),d=D(()=>{});return d.current=()=>{clearTimeout(u.current),o!==l.current&&(l.current=o,a(o))},Ie(()=>{c.current||(l.current=i,s(i))},[i]),Ie(()=>()=>d.current(),[]),/* @__PURE__ */ R(`div`,{class:`settings-section`,children:[/* @__PURE__ */ R(`label`,{class:`settings-label`,for:e,children:t}),/* @__PURE__ */ R(`p`,{class:`settings-help`,id:`${e}-help`,children:n}),/* @__PURE__ */ R(`textarea`,{id:e,class:`settings-textarea`,rows:5,maxLength:Qb,placeholder:r,"aria-describedby":`${e}-help`,value:o,onFocus:()=>{c.current=!0},onBlur:()=>{c.current=!1,d.current()},onInput:e=>{s(e.currentTarget.value),clearTimeout(u.current),u.current=setTimeout(()=>d.current(),600)},onKeyDown:e=>{e.key!==`Escape`&&e.key!==`Tab`&&e.stopPropagation()}})]})}let Rx=[{id:`dark`,label:`Dark`},{id:`light`,label:`Light`},{id:`system`,label:`System`}];function zx(){return/* @__PURE__ */ R(`div`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,id:`tencil-theme-label`,children:`Theme`}),/* @__PURE__ */ R(`span`,{class:`settings-help`,children:`Panels and the comment box. System follows your computer's setting.`})]}),/* @__PURE__ */ R(`fieldset`,{class:`segmented settings-segmented`,"aria-labelledby":`tencil-theme-label`,children:Rx.map(e=>/* @__PURE__ */ R(`label`,{class:Pr.value===e.id?`active`:void 0,children:[/* @__PURE__ */ R(`input`,{type:`radio`,name:`tencil-theme`,checked:Pr.value===e.id,onChange:()=>Fr(e.id)}),e.label]},e.id))})]})}function Bx(){return/* @__PURE__ */ R(Hx,{label:`Hide the dock`,checked:dr.value,onChange:pr,help:/* @__PURE__ */ R(x,{children:[`Hides the toolbar, pins and panels on this site. Press`,` `,/* @__PURE__ */ R(`kbd`,{children:Wn.value.hideDock}),` anywhere on the page to bring them back, or to hide them again.`]})})}function Vx(){let e=Ot.value;return e?/* @__PURE__ */ R(`div`,{class:`settings-section settings-account`,children:[/* @__PURE__ */ R(`span`,{class:`settings-help`,children:[`Signed in to Tencil Cloud as`,` `,/* @__PURE__ */ R(`strong`,{children:e.login?`@${e.login}`:e.name})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>{It(hn()),gn()},children:`Sign out`})]}):null}function Hx({label:e,help:t,checked:n,onChange:r}){return/* @__PURE__ */ R(`label`,{class:`settings-section settings-switch-row`,children:[/* @__PURE__ */ R(`span`,{class:`settings-switch-text`,children:[/* @__PURE__ */ R(`span`,{class:`settings-label`,children:e}),/* @__PURE__ */ R(`span`,{class:`settings-help`,children:t})]}),/* @__PURE__ */ R(`input`,{type:`checkbox`,role:`switch`,class:`settings-switch`,checked:n,"aria-checked":n,onChange:e=>r(e.currentTarget.checked)})]})}function Ux(e){Ie(()=>{let t=Ic().shadowRoot?.activeElement;return e.current?.querySelector(`.settings-nav-item.active`)?.focus(),()=>{t instanceof HTMLElement&&t.isConnected&&t.focus()}},[])}function Wx(e,t){let n=[...t.querySelectorAll(`button:not([disabled]), input:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.tabIndex>=0),r=n[0],i=n[n.length-1],a=Ic().shadowRoot?.activeElement;e.shiftKey&&a===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r?.focus())}function Gx(e){switch(e.state){case`ready`:return`Ready`;case`unauthorized`:return e.canPair?`Not paired`:`Not signed in`;case`unavailable`:return`Unavailable`;default:return`Connecting…`}}function Kx({text:e,animate:t=!1}){let n=t?Zx(e):0;return/* @__PURE__ */ R(`div`,{class:`md`,children:qx(e,{index:0,animateFrom:t?n-48:1/0})})}function qx(e,t){let n=[],r=e.replace(/\r\n/g,`
181
181
  `).split(`
182
- `),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=Yx(e.join(`
182
+ `),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=Zx(e.join(`
183
183
  `)),n.push(/* @__PURE__ */ R(`pre`,{children:/* @__PURE__ */ R(`code`,{children:e.join(`
184
- `)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ R(`li`,{children:qx(e,t)},n));n.push(R(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ R(`p`,{class:`md-heading`,children:qx(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ R(`p`,{children:qx(s.join(` `),t)},a++))}return n}let Kx=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function qx(e,t){return e.split(Kx).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=Yx(e),/* @__PURE__ */ R(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ R(`strong`,{children:Jx(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ R(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:Jx(r[1],t)},n):Jx(e,t)})}function Jx(e,t){return t.animateFrom===1/0?(t.index+=Yx(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ R(`span`,{class:`w`,children:e},`w${n}`):e})}function Yx(e){let t=e.match(/\S+/g);return t?t.length:0}function Xx(){br.value;let e=F.value,t=e?Qt.value.get(e):void 0,n=D(null),[r,i]=E(320);if(Le(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=yr.value,o=a?.threadId===t.id?a.point:t.anchor?Ic(t.anchor):null,{left:s,top:c,origin:l}=o?zc(o,{width:380,height:r}):{left:window.innerWidth-380-(Qn.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ R(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ R(Qx,{thread:t}),t.status===`draft`?/* @__PURE__ */ R(Zx,{thread:t}):/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R($x,{thread:t},t.id),/* @__PURE__ */ R(nS,{thread:t},t.id),/* @__PURE__ */ R(Hd,{placeholder:At.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||At.value!==null,onSubmit:e=>{N({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{F.value=null}})]})]})}function Zx({thread:e}){let t=e.messages[0]?.text??``,n=Er.value.length;return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ R(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ R(`button`,{type:`button`,class:`stop`,onClick:vd,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ R(Hd,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&N({type:`thread.edit`,threadId:e.id,prompt:n}),F.value=null},onCancel:()=>{F.value=null}},`${e.id}:${t}`)]})}function Qx({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ R(`div`,{class:`thread-header`,children:[/* @__PURE__ */ R(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`span`,{class:`thread-number`,children:[`#`,_d.value.get(e.id)]}),/* @__PURE__ */ R(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ R(cd,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ R(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ R(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ R(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ R(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${xn(e.provider.id)}`,children:/* @__PURE__ */ R(ad,{})}),e.status!==`draft`&&/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{N({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(F.value=null)},children:e.resolved?/* @__PURE__ */ R(rd,{}):/* @__PURE__ */ R(nd,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{N({type:`thread.delete`,threadId:e.id}),F.value=null},children:/* @__PURE__ */ R(id,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{F.value=null},children:/* @__PURE__ */ R(od,{})})]})]})}function $x({thread:e}){let t=D(null),n=D(null),r=D(!0),[i,a]=E(!1),o=e.messages[e.messages.length-1];return Le(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Le(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ R(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ R(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ R(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ R(eS,{message:e},e.id))})})}function eS({message:e}){let[t]=E(e.streaming);return/* @__PURE__ */ R(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ R(Wx,{text:e.text,animate:t})})}function tS({text:e}){let t=[...e];return/* @__PURE__ */ R(`span`,{class:`shimmer`,children:[/* @__PURE__ */ R(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ R(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function nS({thread:e}){let[t,n]=E(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ R(x,{children:[t&&r.length>0&&/* @__PURE__ */ R(iS,{steps:r,follow:a}),/* @__PURE__ */ R(lS,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ R(`div`,{class:`status-line`,children:/* @__PURE__ */ R(rS,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,sS(r)?` · ${sS(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ R(uS,{delivery:e.delivery})]})}function rS({open:e,onToggle:t,children:n}){return/* @__PURE__ */ R(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ R(md,{})]})}function iS({steps:e,follow:t}){let n=D(null),r=D(!0);return Le(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ R(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ R(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ R(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ R(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ R(nd,{}):e.status===`failed`?/* @__PURE__ */ R(od,{}):`–`}),/* @__PURE__ */ R(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ R(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ R(`span`,{class:`step-time`,children:oS(e)})]},e.id))})}function aS(e){return e.findLast(e=>e.status===`running`)}function oS(e){return e.endedAt?cS((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function sS(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return cS((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function cS(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function lS({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ R(`div`,{class:`status-line`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(tS,{text:`Starting a thread in ${xn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ R(`div`,{class:`status-line`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),t?/* @__PURE__ */ R(rS,{...t,children:/* @__PURE__ */ R(tS,{text:`${aS(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ R(tS,{text:`Working…`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`stop`,onClick:()=>N({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ R(td,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ R(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ R(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ R(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function uS({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ R(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ R(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(tS,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(tS,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ R(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ R(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ R(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ R(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ R(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let dS=`tencil:dock`,fS=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],pS,mS=A(hS());function hS(){try{let e=localStorage.getItem(dS);return e&&fS.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function gS(e){mS.value=e;try{localStorage.setItem(dS,e)}catch{}}function _S(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function vS(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=SS(t);pS?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,yS,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=CS(t);xS(t,p,_S(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,yS,!0)}function yS(e){e.preventDefault()}function bS(e,t){let[n,r]=mS.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(gS(o),t.style.translate=``,!0):!1}function xS(e,t,n){gS(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),pS=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};pS=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),pS=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=CS(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function SS(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function CS(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let wS=A(null);function TS(){let e=()=>{let e=DS(),t=wS.value;OS(e,t)||(wS.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function ES(e,t){return!t||e.endsWith(`center`)||_S((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function DS(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function OS(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}function kS(){let[e,t]=E(``),n=nn.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>N({type:`project.select`,root:e});return/* @__PURE__ */ R(`div`,{class:`project-picker`,children:[/* @__PURE__ */ R(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ R(`p`,{class:`project-picker-empty`,children:an.value??`No projects found.`}):/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ R(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ R(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ R(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ R(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`project-picker-root`,children:`‎`+e.root})]},e.root))]})]})]})}function AS(){let e=NS(),t=Hn.value,n=Jn.value===`picking`,r=D(null);return/* @__PURE__ */ R(`div`,{ref:r,class:`toolbar-wrap dock-${mS.value}`,style:ES(mS.value,wS.value),children:[n&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint`,children:[`Click any element to pin a prompt`,mr.value&&t.measure&&` · ${t.measure} to measure`,` · Esc to cancel`]}),!n&&nn.value&&/* @__PURE__ */ R(kS,{}),!n&&!nn.value&&e.hint&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),!n&&!e.hint&&Zn.value&&!P.value&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint`,children:[`Hold `,t.measure,` and hover to measure`,t.comment&&` · ${t.comment} to comment`,` · Esc to clear`]}),/* @__PURE__ */ R(`div`,{class:`toolbar`,children:[/* @__PURE__ */ R(sx,{tone:e.tone,label:e.title}),/* @__PURE__ */ R(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>r.current&&vS(e,r.current),onKeyDown:e=>{r.current&&bS(e.key,r.current)&&e.preventDefault()}}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${n?` tool-active`:``}`,title:At.value??jS(`Comment`,t.comment),disabled:At.value!==null,onClick:()=>n?kr():Or(),children:[/* @__PURE__ */ R(Xu,{}),/* @__PURE__ */ R(`span`,{class:`tool-label`,children:`Comment`}),t.comment&&/* @__PURE__ */ R(`kbd`,{children:t.comment})]}),fr.value&&/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${pr.value?``:` tool-off`}`,title:pr.value?`${jS(`Ruler on`,t.ruler)}${t.measure?`: hold ${t.measure} to measure`:``}`:jS(`Ruler off`,t.ruler),"aria-label":`Ruler`,"aria-pressed":pr.value,onClick:gr,children:pr.value?/* @__PURE__ */ R(fd,{}):/* @__PURE__ */ R(pd,{})}),Er.value.length>0&&/* @__PURE__ */ R(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:Wt.value?.state!==`ready`,onClick:vd,children:[/* @__PURE__ */ R(ed,{}),/* @__PURE__ */ R(`span`,{class:`tool-label`,children:[`Send `,Er.value.length]})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${Qn.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{Qn.value=!Qn.value,$n.value=!1},children:[/* @__PURE__ */ R(Zu,{}),Tr.value>0&&/* @__PURE__ */ R(`span`,{class:`badge`,children:Tr.value})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool`,title:jS(nr.value?`Show pins`:`Hide pins`,t.hidePins),onClick:()=>{nr.value=!nr.value,nr.value&&kr()},children:nr.value?/* @__PURE__ */ R(Qu,{}):/* @__PURE__ */ R($u,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${$n.value?` tool-active`:``}`,title:`Settings`,"aria-label":mx.value?`Settings (update available)`:void 0,disabled:!Gt.value,onClick:()=>{$n.value=!$n.value,Qn.value=!1},children:[/* @__PURE__ */ R(ld,{}),mx.value&&/* @__PURE__ */ R(`span`,{class:`tool-dot`})]})]})]})}function jS(e,t){return t?`${e} (${t})`:e}let MS={label:`Switch agent`,run:()=>{er.value=`agent`,$n.value=!0,Qn.value=!1}};function NS(){if(Ut.value!==`open`){if(pn())return{tone:`error`,title:`Tencil Cloud unreachable`,hint:Ut.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`};let e=rn.value;return e?{tone:`warn`,title:`Site not allowed yet`,hint:`Tencil only talks to sites you allow. Allow ${new URL(e.origin).host}?`,action:{label:`Allow`,run:()=>window.open(e.approveUrl,`tencil-allow`)}}:{tone:`error`,title:`Tencil daemon offline`,hint:Ut.value===`connecting`?void 0:`The Tencil daemon stopped. Start it again with npx tencil start.`}}let e=Dt.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:kt.value?void 0:{label:`Sign in`,run:()=>PS(e.signIn)}};if(nn.value)return{tone:`warn`,title:`Pick this page's project`};let t=Wt.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>N({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:MS};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:MS};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function PS(e){Lt(mn(),e).then(hn,e=>{on.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function FS(){return RS(),lr.value?/* @__PURE__ */ R(`div`,{class:`root${Ir.value?` dark`:``}`,children:/* @__PURE__ */ R(LS,{})}):/* @__PURE__ */ R(`div`,{class:`root${Jn.value===`picking`?` picking`:``}${Ir.value?` dark`:``}`,children:[/* @__PURE__ */ R(Qd,{}),/* @__PURE__ */ R(cf,{}),/* @__PURE__ */ R(yd,{}),/* @__PURE__ */ R(Wd,{}),/* @__PURE__ */ R(Xx,{}),/* @__PURE__ */ R(Md,{}),/* @__PURE__ */ R(IS,{}),/* @__PURE__ */ R(AS,{}),$n.value&&Jn.value!==`picking`&&/* @__PURE__ */ R(Ox,{})]})}function IS(){let e=on.value,[t,n]=E(!1);return Ie(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ R(`div`,{class:`toast`,children:e.message})}function LS(){let e=ur.value,[t,n]=E(!1);return Ie(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),4e3);return()=>clearTimeout(t)},[e]),!e||!t?null:/* @__PURE__ */ R(`div`,{class:`toast toast-info`,role:`status`,children:[`Tencil is hidden. Press `,/* @__PURE__ */ R(`kbd`,{children:Hn.value.hideDock}),` to bring it back.`,/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>dr(!1),children:`Undo`})]})}function RS(){let e=Qt.value;Ie(()=>{let t=sessionStorage.getItem(jd);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(jd),F.value=t,Rd(n))},[e])}let zS=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function BS(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=()=>Jn.value===`picking`||Xn.value&&mr.value,i=null,a=null,o=()=>{if(!r()){Yn.value&&=null;return}Yn.value=!i||i.ours?null:n(i.x,i.y);let e=Zn.value?.element;e&&Yn.value&&Yn.value!==e&&(a=Yn.value)},s=(e,t,n)=>{kr(),Zn.value=null,P.value={element:e,label:uc(e),anchor:{selector:``,...t},context:lc(e),...n?{measuredTo:{...n,label:uc(n.element)}}:{}}},c=e=>{i={x:e.clientX,y:e.clientY,ours:t(e)},Xn.value=Rn(jn.value.measure,e),o()},l=e=>{Mn.value||e.key!==jn.value.measure||(Xn.value=e.type===`keydown`,mr.value&&e.preventDefault(),o())},u=()=>{Xn.value=!1,o()},d=e=>{if(!r()&&e.type===`pointerdown`&&!t(e)){$n.value=!1,(F.value?Qt.value.get(F.value):void 0)?.anchor&&(F.value=null);return}r()&&!t(e)&&(e.preventDefault(),e.stopImmediatePropagation())},f=i=>{if(!r()||t(i))return;i.preventDefault(),i.stopImmediatePropagation();let o=n(i.clientX,i.clientY);if(!o)return;let c=Lc(o,{x:i.clientX,y:i.clientY});if(Jn.value!==`picking`){let t=P.value;if(t)P.value={...t,measuredTo:o===t.element?void 0:{element:o,label:uc(o),parent:!1}};else{let t=Zn.value?.element===o;Zn.value=t?null:{element:o,offsets:c},a=null;let n=e.shadowRoot?.activeElement;n instanceof HTMLElement&&n.blur()}return}let l=o.parentElement,u=Rn(jn.value.measure,i)&&mr.value&&l&&l!==document.documentElement;s(o,c,u?{element:l,parent:!0}:void 0)},p=e=>{if(Mn.value)return;let n=jn.value;if(Ln(n.hideDock,e)&&!HS(e)){e.preventDefault(),dr(!lr.value);return}if(!(t(e)&&!VS(e)||lr.value)){if(e.key===`Escape`){if(Jn.value===`picking`)kr();else if(P.value)P.value=null;else if(Zn.value)Zn.value=null;else if(F.value)F.value=null;else if(Qn.value)Qn.value=!1;else return;e.preventDefault();return}if(!HS(e)){if(Ln(n.ruler,e)&&fr.value){e.preventDefault(),gr();return}if(Ln(n.hidePins,e)){e.preventDefault(),nr.value=!nr.value,nr.value&&kr();return}if(Ln(n.comment,e)){e.preventDefault(),nr.value=!1;let t=Zn.value;if(Jn.value===`picking`)kr();else if(t?.element.isConnected&&!P.value){let e=a?.isConnected?a:null;s(t.element,t.offsets,e?{element:e,parent:!1}:void 0)}else Or()}}}},m=0,h=()=>{m||=requestAnimationFrame(()=>{m=0,br.value++})},g=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||h()});g.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let _=setInterval(()=>{let e=Sr(location.href);e!==xr.value&&(xr.value=e,P.value=null,Zn.value=null,F.value=null)},400);window.addEventListener(`pointermove`,c,{capture:!0,passive:!0});for(let e of zS)window.addEventListener(e,d,!0);return window.addEventListener(`click`,f,!0),window.addEventListener(`keydown`,p,!0),window.addEventListener(`keydown`,l,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,u),window.addEventListener(`scroll`,h,{capture:!0,passive:!0}),window.addEventListener(`resize`,h,{passive:!0}),()=>{window.removeEventListener(`pointermove`,c,!0);for(let e of zS)window.removeEventListener(e,d,!0);window.removeEventListener(`click`,f,!0),window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keydown`,l,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,u),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h),g.disconnect(),clearInterval(_),cancelAnimationFrame(m)}}function VS(e){let t=e.composedPath()[0];return t instanceof Element&&t.closest(`.toolbar`)!==null}function HS(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}function US(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function WS(){let e=document.currentScript;if(e?.src)return new URL(e.src).searchParams.get(`root`)??void 0}function GS(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function KS(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function qS(e,t,n){KS();let r=document.createElement(`tencil-overlay`);r.setAttribute(`data-tencil`,``),r.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let i=r.attachShadow({mode:`open`}),a=document.createElement(`style`);a.textContent=`
184
+ `)})},a++));continue}if(/^\s*([-*]|\d+\.)\s+/.test(e)){let o=/^\s*\d+\./.test(e),s=[];for(;i<r.length&&/^\s*([-*]|\d+\.)\s+/.test(r[i]);)s.push(r[i++].replace(/^\s*([-*]|\d+\.)\s+/,``));let c=s.map((e,n)=>/* @__PURE__ */ R(`li`,{children:Yx(e,t)},n));n.push(R(o?`ol`:`ul`,{children:c},a++));continue}let o=e.match(/^#{1,6}\s+(.*)/);if(o){n.push(/* @__PURE__ */ R(`p`,{class:`md-heading`,children:Yx(o[1],t)},a++)),i++;continue}if(!e.trim()){i++;continue}let s=[];for(;i<r.length&&r[i].trim()&&!/^\s*(```|[-*]\s|\d+\.\s|#{1,6}\s)/.test(r[i]);)s.push(r[i++]);n.push(/* @__PURE__ */ R(`p`,{children:Yx(s.join(` `),t)},a++))}return n}let Jx=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\))/g;function Yx(e,t){return e.split(Jx).map((e,n)=>{if(e.startsWith("`")&&e.endsWith("`")&&e.length>1)return t.index+=Zx(e),/* @__PURE__ */ R(`code`,{children:e.slice(1,-1)},n);if(e.startsWith(`**`)&&e.endsWith(`**`)&&e.length>3)return/* @__PURE__ */ R(`strong`,{children:Xx(e.slice(2,-2),t)},n);let r=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);return r&&/^https?:\/\//.test(r[2])?/* @__PURE__ */ R(`a`,{href:r[2],target:`_blank`,rel:`noreferrer`,children:Xx(r[1],t)},n):Xx(e,t)})}function Xx(e,t){return t.animateFrom===1/0?(t.index+=Zx(e),e):e.split(/(\s+)/).map(e=>{if(!e||/^\s+$/.test(e))return e;let n=t.index++;return n>=t.animateFrom?/* @__PURE__ */ R(`span`,{class:`w`,children:e},`w${n}`):e})}function Zx(e){let t=e.match(/\S+/g);return t?t.length:0}function Qx(){Sr.value;let e=F.value,t=e?Qt.value.get(e):void 0,n=D(null),[r,i]=E(320);if(Le(()=>{n.current&&i(n.current.offsetHeight)}),!t)return null;let a=xr.value,o=a?.threadId===t.id?a.point:t.anchor?Rc(t.anchor):null,{left:s,top:c,origin:l}=o?Vc(o,{width:380,height:r}):{left:window.innerWidth-380-(er.value?372:16),top:16,origin:`top right`};return/* @__PURE__ */ R(`div`,{ref:n,class:`popover thread${o?``:` thread-docked`}`,style:{left:`${s}px`,top:`${c}px`,width:`380px`,transformOrigin:l},children:[/* @__PURE__ */ R(eS,{thread:t}),t.status===`draft`?/* @__PURE__ */ R($x,{thread:t}):/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(tS,{thread:t},t.id),/* @__PURE__ */ R(iS,{thread:t},t.id),/* @__PURE__ */ R(Wd,{placeholder:At.value??(t.provider.threadId?`Reply…`:`Waiting for the agent…`),disabled:!t.provider.threadId||At.value!==null,onSubmit:e=>{N({type:`thread.reply`,threadId:t.id,text:e})},onCancel:()=>{F.value=null}})]})]})}function $x({thread:e}){let t=e.messages[0]?.text??``,n=Or.value.length;return/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`div`,{class:`status-line status-queued`,children:[e.statusDetail?/* @__PURE__ */ R(`span`,{class:`status-error`,children:[`Couldn't send: `,e.statusDetail]}):`Queued with ${n===1?`no other comments`:`${n-1} other ${n===2?`comment`:`comments`}`}`,/* @__PURE__ */ R(`button`,{type:`button`,class:`stop`,onClick:bd,children:[`Send `,n===1?`it`:`all ${n}`,` now`]})]}),/* @__PURE__ */ R(Wd,{initialText:t,placeholder:`What should change here?`,onSubmit:n=>{n!==t&&N({type:`thread.edit`,threadId:e.id,prompt:n}),F.value=null},onCancel:()=>{F.value=null}},`${e.id}:${t}`)]})}function eS({thread:e}){let t=e.context,n=t?.components[0],r=n?.source;return/* @__PURE__ */ R(`div`,{class:`thread-header`,children:[/* @__PURE__ */ R(`div`,{class:`thread-heading`,children:t?/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`span`,{class:`thread-number`,children:[`#`,yd.value.get(e.id)]}),/* @__PURE__ */ R(`span`,{class:`chip`,title:t.selector,children:[/* @__PURE__ */ R(ud,{}),n?.name??`<${t.tagName}>`]}),r&&/* @__PURE__ */ R(`span`,{class:`thread-source`,title:r.file,children:[r.file.split(`/`).pop(),r.line?`:${r.line}`:``]})]}):/* @__PURE__ */ R(`span`,{class:`thread-title`,title:e.title,children:e.title})}),/* @__PURE__ */ R(`div`,{class:`thread-tools`,children:[e.provider.url&&/* @__PURE__ */ R(`a`,{class:`icon-button`,href:e.provider.url,target:`_blank`,rel:`noreferrer`,title:`Open in ${Cn(e.provider.id)}`,children:/* @__PURE__ */ R(sd,{})}),e.status!==`draft`&&/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:e.resolved?`Reopen`:`Resolve`,onClick:()=>{N({type:`thread.resolve`,threadId:e.id,resolved:!e.resolved}),e.resolved||(F.value=null)},children:e.resolved?/* @__PURE__ */ R(ad,{}):/* @__PURE__ */ R(id,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Delete pin (keeps the agent thread)`,onClick:()=>{N({type:`thread.delete`,threadId:e.id}),F.value=null},children:/* @__PURE__ */ R(od,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`icon-button`,title:`Close (Esc)`,onClick:()=>{F.value=null},children:/* @__PURE__ */ R(cd,{})})]})]})}function tS({thread:e}){let t=D(null),n=D(null),r=D(!0),[i,a]=E(!1),o=e.messages[e.messages.length-1];return Le(()=>{o?.role===`user`&&(r.current=!0)},[o?.id]),Le(()=>{let e=t.current,i=n.current;if(!e||!i)return;let a=()=>{r.current&&(e.scrollTop=e.scrollHeight)};a();let o=new ResizeObserver(a);return o.observe(e),o.observe(i),()=>o.disconnect()},[]),/* @__PURE__ */ R(`div`,{ref:t,class:`messages`,"data-scrolled":i||void 0,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24,a(t.scrollTop>4)},children:/* @__PURE__ */ R(`div`,{ref:n,class:`messages-list`,children:e.messages.map(e=>e.role===`user`?/* @__PURE__ */ R(`div`,{class:`message message-user`,children:e.text},e.id):/* @__PURE__ */ R(nS,{message:e},e.id))})})}function nS({message:e}){let[t]=E(e.streaming);return/* @__PURE__ */ R(`div`,{class:`message message-assistant`,children:/* @__PURE__ */ R(Kx,{text:e.text,animate:t})})}function rS({text:e}){let t=[...e];return/* @__PURE__ */ R(`span`,{class:`shimmer`,children:[/* @__PURE__ */ R(`span`,{class:`sr-only`,children:e}),t.map((e,n)=>/* @__PURE__ */ R(`span`,{"aria-hidden":`true`,style:{"--i":n,"--n":t.length},children:e},n))]})}function iS({thread:e}){let[t,n]=E(!1),r=e.steps??[],i=r.length>0?{open:t,onToggle:()=>n(!t)}:void 0,a=e.status===`working`;return/* @__PURE__ */ R(x,{children:[t&&r.length>0&&/* @__PURE__ */ R(oS,{steps:r,follow:a}),/* @__PURE__ */ R(dS,{thread:e,steps:i}),i&&!a&&/* @__PURE__ */ R(`div`,{class:`status-line`,children:/* @__PURE__ */ R(aS,{...i,children:[r.filter(e=>!e.parentId).length,` steps`,lS(r)?` · ${lS(r)}`:``]})}),e.delivery&&!a&&/* @__PURE__ */ R(fS,{delivery:e.delivery})]})}function aS({open:e,onToggle:t,children:n}){return/* @__PURE__ */ R(`button`,{type:`button`,class:`steps-toggle${e?` open`:``}`,"aria-expanded":e,title:e?`Hide steps`:`Show steps`,onClick:t,children:[n,/* @__PURE__ */ R(gd,{})]})}function oS({steps:e,follow:t}){let n=D(null),r=D(!0);return Le(()=>{let e=n.current;e&&t&&r.current&&(e.scrollTop=e.scrollHeight)}),/* @__PURE__ */ R(`ol`,{ref:n,class:`steps`,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<16},children:e.map(e=>/* @__PURE__ */ R(`li`,{class:`step step-${e.status}${e.parentId?` step-child`:``}`,title:e.detail?`${e.label}\n${e.detail}`:e.label,children:[/* @__PURE__ */ R(`span`,{class:`step-mark`,children:e.status===`running`?/* @__PURE__ */ R(`span`,{class:`live-dot`}):e.status===`done`?/* @__PURE__ */ R(id,{}):e.status===`failed`?/* @__PURE__ */ R(cd,{}):`–`}),/* @__PURE__ */ R(`span`,{class:`step-label`,children:[e.label,e.detail&&/* @__PURE__ */ R(`span`,{class:`step-detail`,children:e.detail})]}),e.endedAt&&/* @__PURE__ */ R(`span`,{class:`step-time`,children:cS(e)})]},e.id))})}function sS(e){return e.findLast(e=>e.status===`running`)}function cS(e){return e.endedAt?uS((Date.parse(e.endedAt)-Date.parse(e.startedAt))/1e3):``}function lS(e){let t=e[0],n=e.map(e=>e.endedAt).filter(e=>!!e);if(!t||n.length===0)return``;let r=n.reduce((e,t)=>e>t?e:t);return uS((Date.parse(r)-Date.parse(t.startedAt))/1e3)}function uS(e){return!Number.isFinite(e)||e<1?``:e<60?`${Math.round(e)}s`:`${Math.floor(e/60)}m ${String(Math.round(e%60)).padStart(2,`0`)}s`}function dS({thread:e,steps:t}){return e.status===`starting`?/* @__PURE__ */ R(`div`,{class:`status-line`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(rS,{text:`Starting a thread in ${Cn(e.provider.id)}…`})]}):e.status===`working`?/* @__PURE__ */ R(`div`,{class:`status-line`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),t?/* @__PURE__ */ R(aS,{...t,children:/* @__PURE__ */ R(rS,{text:`${sS(e.steps??[])?.label??`Working`}…`})}):/* @__PURE__ */ R(rS,{text:`Working…`}),/* @__PURE__ */ R(`button`,{type:`button`,class:`stop`,onClick:()=>N({type:`thread.interrupt`,threadId:e.id}),children:[/* @__PURE__ */ R(rd,{}),` Stop`]})]}):e.status===`waiting`?/* @__PURE__ */ R(`div`,{class:`status-line status-waiting`,children:[e.statusDetail??`Waiting for input`,e.provider.url&&/* @__PURE__ */ R(`a`,{href:e.provider.url,target:`_blank`,rel:`noreferrer`,children:`Open`})]}):e.status===`error`?/* @__PURE__ */ R(`div`,{class:`status-line status-error`,children:e.statusDetail??`Something went wrong`}):null}function fS({delivery:e}){let t=e.pullRequest,n=t&&/* @__PURE__ */ R(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:t.opened?`Opened #${t.number}`:`#${t.number}`}),r=e.commit&&/* @__PURE__ */ R(`a`,{class:`delivery-commit`,href:e.commit.url,target:`_blank`,rel:`noreferrer`,children:e.commit.sha.slice(0,7)});switch(e.status){case`queued`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(rS,{text:e.queuePosition?`Waiting, ${e.queuePosition} ahead on this branch`:`Waiting for the branch…`})]});case`pushed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{children:[`Pushed `,r]}),n]});case`deploying`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:[/* @__PURE__ */ R(`span`,{class:`live-dot`}),/* @__PURE__ */ R(rS,{text:`Deploying the preview…`}),n]});case`live`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery delivery-live`,children:[/* @__PURE__ */ R(`span`,{children:[`Live `,r]}),e.previewUrl?/* @__PURE__ */ R(`a`,{href:e.previewUrl,children:`Open the new preview`}):n]});case`deploy-failed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ R(`span`,{children:[`Preview deploy failed `,r]}),e.logsUrl?/* @__PURE__ */ R(`a`,{href:e.logsUrl,target:`_blank`,rel:`noreferrer`,children:`Logs`}):n]});case`no-changes`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery`,children:`No changes needed, nothing pushed`});case`failed`:return/* @__PURE__ */ R(`div`,{class:`status-line delivery status-error`,children:[/* @__PURE__ */ R(`span`,{class:`delivery-detail`,title:e.detail,children:[`Couldn't push`,e.detail?`: ${e.detail}`:``]}),n]})}}let pS=`tencil:dock`,mS=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],hS,gS=A(_S());function _S(){try{let e=localStorage.getItem(pS);return e&&mS.includes(e)?e:`bottom-center`}catch{return`bottom-center`}}function vS(e){gS.value=e;try{localStorage.setItem(pS,e)}catch{}}function yS(e,t,n,r){let i=e<n/3?`left`:e>n*2/3?`right`:`center`;return`${t<r/2?`top`:`bottom`}-${i}`}function bS(e,t){if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;try{n.setPointerCapture(e.pointerId)}catch{}let[r,i]=wS(t);hS?.(),t.style.transition=`none`,t.style.translate=`${r}px ${i}px`;let a=e.clientX,o=e.clientY,s=r!==0||i!==0,c=[],l=e=>{let n=e.clientX-a,l=e.clientY-o;!s&&Math.hypot(n,l)<3||(s=!0,t.dataset.dragging=``,t.style.translate=`${r+n}px ${i+l}px`,c=[...c.filter(t=>e.timeStamp-t.t<80),{x:e.clientX,y:e.clientY,t:e.timeStamp}])},u=e=>{if(n.removeEventListener(`pointermove`,l),n.removeEventListener(`pointerup`,u),n.removeEventListener(`pointercancel`,u),n.removeEventListener(`lostpointercapture`,u),window.removeEventListener(`dragstart`,xS,!0),delete t.dataset.dragging,!s){t.style.translate=``,t.style.transition=``;return}c=c.filter(t=>e.timeStamp-t.t<80);let r=c[0],i=c[c.length-1],a=r&&i?Math.max(1,i.t-r.t):1,o=e=>Math.max(-2.5,Math.min(2.5,e/a)),d=r&&i?o(i.x-r.x):0,f=r&&i?o(i.y-r.y):0,p=TS(t);CS(t,p,yS(p.left+p.width/2+d*120,p.top+p.height/2+f*120,window.innerWidth,window.innerHeight))};n.addEventListener(`pointermove`,l),n.addEventListener(`pointerup`,u),n.addEventListener(`pointercancel`,u),n.addEventListener(`lostpointercapture`,u),window.addEventListener(`dragstart`,xS,!0)}function xS(e){e.preventDefault()}function SS(e,t){let[n,r]=gS.value.split(`-`),i=[`left`,`center`,`right`],a=i.indexOf(r),o;return e===`ArrowLeft`&&a>0&&(o=`${n}-${i[a-1]}`),e===`ArrowRight`&&a<2&&(o=`${n}-${i[a+1]}`),e===`ArrowUp`&&n===`bottom`&&(o=`top-${r}`),e===`ArrowDown`&&n===`top`&&(o=`bottom-${r}`),o?(vS(o),t.style.translate=``,!0):!1}function CS(e,t,n){vS(n);let r=0,i,a=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),hS=void 0,e.style.transition=``,e.style.translate=``},o=t=>{t.target===e&&t.propertyName===`translate`&&a()};hS=()=>{cancelAnimationFrame(r),clearTimeout(i),e.removeEventListener(`transitionend`,o),hS=void 0},r=requestAnimationFrame(()=>{e.style.translate=``;let n=TS(e);if(e.style.translate=`${t.left-n.left}px ${t.top-n.top}px`,matchMedia(`(prefers-reduced-motion: reduce)`).matches){a();return}r=requestAnimationFrame(()=>{e.style.transition=`translate 340ms cubic-bezier(0.32, 0.72, 0, 1)`,e.style.translate=`0px 0px`,e.addEventListener(`transitionend`,o),i=setTimeout(a,440)})})}function wS(e){let t=getComputedStyle(e).translate;if(!t||t===`none`)return[0,0];let[n=`0`,r=`0`]=t.split(` `);return[Number.parseFloat(n)||0,Number.parseFloat(r)||0]}function TS(e){return(e.querySelector(`.toolbar`)??e).getBoundingClientRect()}let ES=A(null);function DS(){let e=()=>{let e=kS(),t=ES.value;AS(e,t)||(ES.value=e)};e();let t=setInterval(e,500);return window.addEventListener(`resize`,e,{passive:!0}),()=>{clearInterval(t),window.removeEventListener(`resize`,e)}}function OS(e,t){return!t||e.endsWith(`center`)||yS((t.left+t.right)/2,(t.top+t.bottom)/2,window.innerWidth,window.innerHeight)!==e?{}:e.endsWith(`left`)?{left:`${t.right+8}px`}:{right:`${window.innerWidth-t.left+8}px`}}function kS(){for(let e of document.querySelectorAll(`nextjs-portal`)){let t=e.shadowRoot?.getElementById(`devtools-indicator`);if(!t)continue;let n=t.getBoundingClientRect();if(n.width!==0&&n.height!==0)return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}return null}function AS(e,t){return!e||!t?e===t:Math.round(e.left)===Math.round(t.left)&&Math.round(e.top)===Math.round(t.top)&&Math.round(e.right)===Math.round(t.right)&&Math.round(e.bottom)===Math.round(t.bottom)}function jS(){let[e,t]=E(``),n=nn.value??[],r=e.trim().toLowerCase(),i=r?n.filter(e=>e.title.toLowerCase().includes(r)||e.root.toLowerCase().includes(r)):n,a=e=>N({type:`project.select`,root:e});return/* @__PURE__ */ R(`div`,{class:`project-picker`,children:[/* @__PURE__ */ R(`p`,{class:`project-picker-title`,children:`Which project is this page?`}),n.length===0?/* @__PURE__ */ R(`p`,{class:`project-picker-empty`,children:an.value??`No projects found.`}):/* @__PURE__ */ R(x,{children:[/* @__PURE__ */ R(`input`,{class:`project-picker-search`,type:`search`,placeholder:`Search projects`,"aria-label":`Search projects`,autoFocus:!0,value:e,onInput:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i[0]&&a(i[0].root)}}),/* @__PURE__ */ R(`div`,{class:`project-picker-list`,children:[i.length===0&&/* @__PURE__ */ R(`p`,{class:`project-picker-empty`,children:[`No project matches “`,e.trim(),`”.`]}),i.map(e=>/* @__PURE__ */ R(`button`,{type:`button`,class:`project-picker-option`,title:e.root,onClick:()=>a(e.root),children:[/* @__PURE__ */ R(`span`,{class:`project-picker-name`,children:e.title}),/* @__PURE__ */ R(`span`,{class:`project-picker-root`,children:`‎`+e.root})]},e.root))]})]})]})}function MS(){let e=FS(),t=Wn.value,n=Xn.value===`picking`,r=D(null);return/* @__PURE__ */ R(`div`,{ref:r,class:`toolbar-wrap dock-${gS.value}`,style:OS(gS.value,ES.value),children:[n&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint`,children:[`Click any element to pin a prompt`,gr.value&&t.measure&&` · ${t.measure} to measure`,` · Esc to cancel`]}),!n&&nn.value&&/* @__PURE__ */ R(jS,{}),!n&&!nn.value&&e.hint&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint hint-${e.tone}`,children:[e.hint,e.action&&/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:e.action.run,children:e.action.label})]}),!n&&!e.hint&&$n.value&&!P.value&&/* @__PURE__ */ R(`div`,{class:`toolbar-hint`,children:[`Hold `,t.measure,` and hover to measure`,t.comment&&` · ${t.comment} to comment`,` · Esc to clear`]}),/* @__PURE__ */ R(`div`,{class:`toolbar`,children:[/* @__PURE__ */ R(lx,{tone:e.tone,label:e.title}),/* @__PURE__ */ R(`button`,{type:`button`,class:`divider`,"aria-label":`Move toolbar (drag, or use arrow keys)`,title:`Drag to move`,onPointerDown:e=>r.current&&bS(e,r.current),onKeyDown:e=>{r.current&&SS(e.key,r.current)&&e.preventDefault()}}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${n?` tool-active`:``}`,title:At.value??NS(`Comment`,t.comment),disabled:At.value!==null,onClick:()=>n?jr():Ar(),children:[/* @__PURE__ */ R(Qu,{}),/* @__PURE__ */ R(`span`,{class:`tool-label`,children:`Comment`}),t.comment&&/* @__PURE__ */ R(`kbd`,{children:t.comment})]}),mr.value&&/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${hr.value?``:` tool-off`}`,title:hr.value?`${NS(`Ruler on`,t.ruler)}${t.measure?`: hold ${t.measure} to measure`:``}`:NS(`Ruler off`,t.ruler),"aria-label":`Ruler`,"aria-pressed":hr.value,onClick:vr,children:hr.value?/* @__PURE__ */ R(md,{}):/* @__PURE__ */ R(hd,{})}),Or.value.length>0&&/* @__PURE__ */ R(`button`,{type:`button`,class:`tool tool-send`,title:`Send the queued comments to the agent as one thread`,disabled:Wt.value?.state!==`ready`,onClick:bd,children:[/* @__PURE__ */ R(nd,{}),/* @__PURE__ */ R(`span`,{class:`tool-label`,children:[`Send `,Or.value.length]})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${er.value?` tool-active`:``}`,title:`Pins`,onClick:()=>{er.value=!er.value,tr.value=!1},children:[/* @__PURE__ */ R($u,{}),Dr.value>0&&/* @__PURE__ */ R(`span`,{class:`badge`,children:Dr.value})]}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool`,title:NS(ir.value?`Show pins`:`Hide pins`,t.hidePins),onClick:()=>{ir.value=!ir.value,ir.value&&jr()},children:ir.value?/* @__PURE__ */ R(ed,{}):/* @__PURE__ */ R(td,{})}),/* @__PURE__ */ R(`button`,{type:`button`,class:`tool${tr.value?` tool-active`:``}`,title:`Settings`,"aria-label":gx.value?`Settings (update available)`:void 0,disabled:!Gt.value,onClick:()=>{tr.value=!tr.value,er.value=!1},children:[/* @__PURE__ */ R(dd,{}),gx.value&&/* @__PURE__ */ R(`span`,{class:`tool-dot`})]})]})]})}function NS(e,t){return t?`${e} (${t})`:e}let PS={label:`Switch agent`,run:()=>{nr.value=`agent`,tr.value=!0,er.value=!1}};function FS(){if(Ut.value!==`open`){if(mn())return{tone:`error`,title:`Tencil Cloud unreachable`,hint:Ut.value===`connecting`?void 0:`Can't reach Tencil Cloud. Retrying…`};let e=rn.value;return e?{tone:`warn`,title:`Site not allowed yet`,hint:`Tencil only talks to sites you allow. Allow ${new URL(e.origin).host}?`,action:{label:`Allow`,run:()=>window.open(e.approveUrl,`tencil-allow`)}}:{tone:`error`,title:`Tencil daemon offline`,hint:Ut.value===`connecting`?void 0:`Run npx tencil start. The overlay will reconnect on its own.`,action:Ut.value===`connecting`?void 0:{label:`Retry`,run:_n}}}let e=Dt.value;if(e)return{tone:`warn`,title:`Sign in to Tencil Cloud`,hint:e.reason??`Sign in with GitHub to pin on this preview`,action:kt.value?void 0:{label:`Sign in`,run:()=>IS(e.signIn)}};if(nn.value)return{tone:`warn`,title:`Pick this page's project`};let t=Wt.value;if(!t)return{tone:`warn`,title:`Connecting…`};switch(t.state){case`ready`:return{tone:`ok`,title:`${t.label}${t.target?` · ${t.target}`:``}`};case`unauthorized`:return t.canPair?{tone:`warn`,title:`${t.label}: not paired`,hint:`Not paired with ${t.label}`,action:{label:`Pair`,run:()=>N({type:`provider.pair`})}}:{tone:`warn`,title:`${t.label}: not signed in`,hint:t.detail??`Sign in to ${t.label}`,action:PS};case`unavailable`:return{tone:`error`,title:t.detail??`${t.label} unavailable`,hint:t.detail??`${t.label} is unavailable`,action:PS};default:return{tone:`warn`,title:`Connecting to ${t.label}…`}}}function IS(e){Lt(hn(),e).then(gn,e=>{on.value={message:e instanceof Error?e.message:String(e),at:Date.now()}})}function LS(){return BS(),dr.value?/* @__PURE__ */ R(`div`,{class:`root${Rr.value?` dark`:``}`,children:/* @__PURE__ */ R(zS,{})}):/* @__PURE__ */ R(`div`,{class:`root${Xn.value===`picking`?` picking`:``}${Rr.value?` dark`:``}`,children:[/* @__PURE__ */ R(ef,{}),/* @__PURE__ */ R(uf,{}),/* @__PURE__ */ R(xd,{}),/* @__PURE__ */ R(Kd,{}),/* @__PURE__ */ R(Qx,{}),/* @__PURE__ */ R(Pd,{}),/* @__PURE__ */ R(RS,{}),/* @__PURE__ */ R(MS,{}),tr.value&&Xn.value!==`picking`&&/* @__PURE__ */ R(Ax,{})]})}function RS(){let e=on.value,[t,n]=E(!1);return Ie(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),5e3);return()=>clearTimeout(t)},[e?.at]),!e||!t?null:/* @__PURE__ */ R(`div`,{class:`toast`,children:e.message})}function zS(){let e=fr.value,[t,n]=E(!1);return Ie(()=>{if(!e)return;n(!0);let t=setTimeout(()=>n(!1),4e3);return()=>clearTimeout(t)},[e]),!e||!t?null:/* @__PURE__ */ R(`div`,{class:`toast toast-info`,role:`status`,children:[`Tencil is hidden. Press `,/* @__PURE__ */ R(`kbd`,{children:Wn.value.hideDock}),` to bring it back.`,/* @__PURE__ */ R(`button`,{type:`button`,class:`hint-action`,onClick:()=>pr(!1),children:`Undo`})]})}function BS(){let e=Qt.value;Ie(()=>{let t=sessionStorage.getItem(Nd);if(!t)return;let n=e.get(t);n&&(sessionStorage.removeItem(Nd),F.value=t,Bd(n))},[e])}let VS=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`dblclick`,`contextmenu`,`auxclick`];function HS(e){let t=t=>t.composedPath().includes(e),n=(t,n)=>{for(let r of document.elementsFromPoint(t,n)){if(r===e||e.contains(r))return null;if(r!==document.documentElement)return r}return null},r=()=>Xn.value===`picking`||Qn.value&&gr.value,i=null,a=null,o=()=>{if(!r()){Zn.value&&=null;return}Zn.value=!i||i.ours?null:n(i.x,i.y);let e=$n.value?.element;e&&Zn.value&&Zn.value!==e&&(a=Zn.value)},s=(e,t,n)=>{jr(),$n.value=null,P.value={element:e,label:fc(e),anchor:{selector:``,...t},context:dc(e),...n?{measuredTo:{...n,label:fc(n.element)}}:{}}},c=e=>{i={x:e.clientX,y:e.clientY,ours:t(e)},Qn.value=Bn(Nn.value.measure,e),o()},l=e=>{Pn.value||e.key!==Nn.value.measure||(Qn.value=e.type===`keydown`,gr.value&&e.preventDefault(),o())},u=()=>{Qn.value=!1,o()},d=e=>{if(!r()&&e.type===`pointerdown`&&!t(e)){tr.value=!1,(F.value?Qt.value.get(F.value):void 0)?.anchor&&(F.value=null);return}r()&&!t(e)&&(e.preventDefault(),e.stopImmediatePropagation())},f=i=>{if(!r()||t(i))return;i.preventDefault(),i.stopImmediatePropagation();let o=n(i.clientX,i.clientY);if(!o)return;let c=zc(o,{x:i.clientX,y:i.clientY});if(Xn.value!==`picking`){let t=P.value;if(t)P.value={...t,measuredTo:o===t.element?void 0:{element:o,label:fc(o),parent:!1}};else{let t=$n.value?.element===o;$n.value=t?null:{element:o,offsets:c},a=null;let n=e.shadowRoot?.activeElement;n instanceof HTMLElement&&n.blur()}return}let l=o.parentElement,u=Bn(Nn.value.measure,i)&&gr.value&&l&&l!==document.documentElement;s(o,c,u?{element:l,parent:!0}:void 0)},p=e=>{if(Pn.value)return;let n=Nn.value;if(zn(n.hideDock,e)&&!WS(e)){e.preventDefault(),pr(!dr.value);return}if(!(t(e)&&!US(e)||dr.value)){if(e.key===`Escape`){if(Xn.value===`picking`)jr();else if(P.value)P.value=null;else if($n.value)$n.value=null;else if(F.value)F.value=null;else if(er.value)er.value=!1;else return;e.preventDefault();return}if(!WS(e)){if(zn(n.ruler,e)&&mr.value){e.preventDefault(),vr();return}if(zn(n.hidePins,e)){e.preventDefault(),ir.value=!ir.value,ir.value&&jr();return}if(zn(n.comment,e)){e.preventDefault(),ir.value=!1;let t=$n.value;if(Xn.value===`picking`)jr();else if(t?.element.isConnected&&!P.value){let e=a?.isConnected?a:null;s(t.element,t.offsets,e?{element:e,parent:!1}:void 0)}else Ar()}}}},m=0,h=()=>{m||=requestAnimationFrame(()=>{m=0,Sr.value++})},g=new MutationObserver(t=>{t.every(t=>e.contains(t.target)||t.target===e)||h()});g.observe(document.body,{childList:!0,subtree:!0,attributes:!0});let _=setInterval(()=>{let e=wr(location.href);e!==Cr.value&&(Cr.value=e,P.value=null,$n.value=null,F.value=null)},400);window.addEventListener(`pointermove`,c,{capture:!0,passive:!0});for(let e of VS)window.addEventListener(e,d,!0);return window.addEventListener(`click`,f,!0),window.addEventListener(`keydown`,p,!0),window.addEventListener(`keydown`,l,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,u),window.addEventListener(`scroll`,h,{capture:!0,passive:!0}),window.addEventListener(`resize`,h,{passive:!0}),()=>{window.removeEventListener(`pointermove`,c,!0);for(let e of VS)window.removeEventListener(e,d,!0);window.removeEventListener(`click`,f,!0),window.removeEventListener(`keydown`,p,!0),window.removeEventListener(`keydown`,l,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,u),window.removeEventListener(`scroll`,h,!0),window.removeEventListener(`resize`,h),g.disconnect(),clearInterval(_),cancelAnimationFrame(m)}}function US(e){let t=e.composedPath()[0];return t instanceof Element&&t.closest(`.toolbar`)!==null}function WS(e){let t=e.composedPath()[0];return t instanceof HTMLElement?t.isContentEditable||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement:!1}let GS=[`pointerdown`,`mousedown`,`touchstart`,`touchend`,`click`,`focusin`,`wheel`,`touchmove`];function KS(e){let t=e=>e.stopPropagation(),n=t=>{t.relatedTarget===e&&!t.composedPath().includes(e)&&t.stopImmediatePropagation()},r=t=>{t.key===`Escape`&&t.composedPath().includes(e)&&t.preventDefault()};for(let n of GS)e.addEventListener(n,t);return window.addEventListener(`focusout`,n,!0),window.addEventListener(`keydown`,r,!0),()=>{for(let n of GS)e.removeEventListener(n,t);window.removeEventListener(`focusout`,n,!0),window.removeEventListener(`keydown`,r,!0)}}function qS(){let e=document.currentScript;return e?.dataset.bridge?e.dataset.bridge:e?.src?new URL(e.src).origin:`http://localhost:4747`}function JS(){let e=document.currentScript;if(e?.src)return new URL(e.src).searchParams.get(`root`)??void 0}function YS(){let e=document.currentScript?.dataset;if(e?.tencilProject&&e.tencilRepo&&e.tencilBranch&&e.tencilSha)return{projectKey:e.tencilProject,repo:e.tencilRepo,branch:e.tencilBranch,sha:e.tencilSha}}function XS(){try{CSS.registerProperty({name:`--tencil-rim`,syntax:`<angle>`,inherits:!1,initialValue:`0deg`})}catch{}}function ZS(e,t,n){XS();let r=document.createElement(`tencil-overlay`);r.setAttribute(`data-tencil`,``),r.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483646;display:block;contain:layout style;`;let i=r.attachShadow({mode:`open`}),a=document.createElement(`style`);a.textContent=`
185
185
  :host { all: initial; }
186
186
  * { box-sizing: border-box; }
187
187
 
@@ -1183,4 +1183,4 @@ kbd {
1183
1183
  @keyframes pin-dissolve { to { opacity: 0; } }
1184
1184
  .shimmer > span[aria-hidden], .status-ping, .live-dot { animation: none; }
1185
1185
  }
1186
- `;let o=document.querySelector(`script[nonce]`)?.nonce;o&&(a.nonce=o),i.append(a);let s=document.createElement(`div`);i.append(s),Nc(r),document.body.append(r);let c=new MutationObserver(()=>{r.isConnected||document.body.append(r)});c.observe(document.body,{childList:!0});let l=BS(r),u=TS();be(te(FS,{}),s),fn(e,t,n),lr.value&&console.info(`Tencil is hidden. Press ${Hn.value.hideDock} to show it.`),window.__TENCIL__={version:1,bridgeUrl:e,destroy(){c.disconnect(),l(),u(),be(null,s),r.remove(),window.__TENCIL__=void 0}}}if(typeof window<`u`&&!window.__TENCIL__){let e=US(),t=GS(),n=WS();document.body?qS(e,t,n):document.addEventListener(`DOMContentLoaded`,()=>qS(e,t,n),{once:!0})}})();
1186
+ `;let o=document.querySelector(`script[nonce]`)?.nonce;o&&(a.nonce=o),i.append(a);let s=document.createElement(`div`);i.append(s),Fc(r),document.body.append(r);let c=new MutationObserver(()=>{r.isConnected||document.body.append(r)});c.observe(document.body,{childList:!0});let l=HS(r),u=KS(r),d=DS();be(te(LS,{}),s),pn(e,t,n),dr.value&&console.info(`Tencil is hidden. Press ${Wn.value.hideDock} to show it.`),window.__TENCIL__={version:1,bridgeUrl:e,destroy(){c.disconnect(),l(),u(),d(),be(null,s),r.remove(),window.__TENCIL__=void 0}}}if(typeof window<`u`&&!window.__TENCIL__){let e=qS(),t=YS(),n=JS();document.body?ZS(e,t,n):document.addEventListener(`DOMContentLoaded`,()=>ZS(e,t,n),{once:!0})}})();