agent-canvas 0.9.0-dev.14 → 0.9.0-dev.15

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
- (()=>{var U8=Object.create;var{getPrototypeOf:A8,defineProperty:I0,getOwnPropertyNames:w8}=Object;var D8=Object.prototype.hasOwnProperty;function O8($){return this[$]}var b8,R8,L8=($,Q,J)=>{var q=$!=null&&typeof $==="object";if(q){var W=Q?b8??=new WeakMap:R8??=new WeakMap,Y=W.get($);if(Y)return Y}J=$!=null?U8(A8($)):{};let G=Q||!$||!$.__esModule?I0(J,"default",{value:$,enumerable:!0}):J;for(let X of w8($))if(!D8.call(G,X))I0(G,X,{get:O8.bind($,X),enumerable:!0});if(q)W.set($,G);return G};var S8=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var v8=($)=>$;function E8($,Q){this[$]=v8.bind(null,Q)}var k8=($,Q)=>{for(var J in Q)I0($,J,{get:Q[J],enumerable:!0,configurable:!0,set:E8.bind(Q,J)})};var Z4=S8((G2,X2)=>{(function($,Q){typeof G2==="object"&&typeof X2<"u"?X2.exports=Q():typeof define==="function"&&define.amd?define(Q):($=typeof globalThis<"u"?globalThis:$||self,$.resolveURI=Q())})(G2,function(){let $=/^[\w+.-]+:\/\//,Q=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,J=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function q(N){return $.test(N)}function W(N){return N.startsWith("//")}function Y(N){return N.startsWith("/")}function G(N){return N.startsWith("file:")}function X(N){return/^[.?#]/.test(N)}function H(N){let O=Q.exec(N);return j(O[1],O[2]||"",O[3],O[4]||"",O[5]||"/",O[6]||"",O[7]||"")}function B(N){let O=J.exec(N),U=O[2];return j("file:","",O[1]||"","",Y(U)?U:"/"+U,O[3]||"",O[4]||"")}function j(N,O,U,C,T,P,h){return{scheme:N,user:O,host:U,port:C,path:T,query:P,hash:h,type:7}}function A(N){if(W(N)){let U=H("http:"+N);return U.scheme="",U.type=6,U}if(Y(N)){let U=H("http://foo.com"+N);return U.scheme="",U.host="",U.type=5,U}if(G(N))return B(N);if(q(N))return H(N);let O=H("http://foo.com/"+N);return O.scheme="",O.host="",O.type=N?N.startsWith("?")?3:N.startsWith("#")?2:4:1,O}function z(N){if(N.endsWith("/.."))return N;let O=N.lastIndexOf("/");return N.slice(0,O+1)}function F(N,O){if(k(O,O.type),N.path==="/")N.path=O.path;else N.path=z(O.path)+N.path}function k(N,O){let U=O<=4,C=N.path.split("/"),T=1,P=0,h=!1;for(let u=1;u<C.length;u++){let o=C[u];if(!o){h=!0;continue}if(h=!1,o===".")continue;if(o===".."){if(P)h=!0,P--,T--;else if(U)C[T++]=o;continue}C[T++]=o,P++}let c="";for(let u=1;u<T;u++)c+="/"+C[u];if(!c||h&&!c.endsWith("/.."))c+="/";N.path=c}function I(N,O){if(!N&&!O)return"";let U=A(N),C=U.type;if(O&&C!==7){let P=A(O),h=P.type;switch(C){case 1:U.hash=P.hash;case 2:U.query=P.query;case 3:case 4:F(U,P);case 5:U.user=P.user,U.host=P.host,U.port=P.port;case 6:U.scheme=P.scheme}if(h>C)C=h}k(U,C);let T=U.query+U.hash;switch(C){case 2:case 3:return T;case 4:{let P=U.path.slice(1);if(!P)return T||".";if(X(O||N)&&!X(P))return"./"+P+T;return P+T}case 5:return U.path+T;default:return U.scheme+"//"+U.user+U.host+U.port+U.path+T}}return I})});var M0,f,C2,P8,z1,v2,f2,I2,T0,G0,p1,T2,Z0,g0,x0,C8,B0={},z0=[],f8=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j0=Array.isArray;function G1($,Q){for(var J in Q)$[J]=Q[J];return $}function y0($){$&&$.parentNode&&$.parentNode.removeChild($)}function I8($,Q,J){var q,W,Y,G={};for(Y in Q)Y=="key"?q=Q[Y]:Y=="ref"?W=Q[Y]:G[Y]=Q[Y];if(arguments.length>2&&(G.children=arguments.length>3?M0.call(arguments,2):J),typeof $=="function"&&$.defaultProps!=null)for(Y in $.defaultProps)G[Y]===void 0&&(G[Y]=$.defaultProps[Y]);return X0($,G,q,W,null)}function X0($,Q,J,q,W){var Y={type:$,props:Q,key:J,ref:q,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:W==null?++C2:W,__i:-1,__u:0};return W==null&&f.vnode!=null&&f.vnode(Y),Y}function Q1($){return $.children}function H0($,Q){this.props=$,this.context=Q}function w1($,Q){if(Q==null)return $.__?w1($.__,$.__i+1):null;for(var J;Q<$.__k.length;Q++)if((J=$.__k[Q])!=null&&J.__e!=null)return J.__e;return typeof $.type=="function"?w1($):null}function T8($){if($.__P&&$.__d){var Q=$.__v,J=Q.__e,q=[],W=[],Y=G1({},Q);Y.__v=Q.__v+1,f.vnode&&f.vnode(Y),h0($.__P,Y,Q,$.__n,$.__P.namespaceURI,32&Q.__u?[J]:null,q,J==null?w1(Q):J,!!(32&Q.__u),W),Y.__v=Q.__v,Y.__.__k[Y.__i]=Y,h2(q,Y,W),Q.__e=Q.__=null,Y.__e!=J&&g2(Y)}}function g2($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(Q){if(Q!=null&&Q.__e!=null)return $.__e=$.__c.base=Q.__e}),g2($)}function E2($){(!$.__d&&($.__d=!0)&&z1.push($)&&!_0.__r++||v2!=f.debounceRendering)&&((v2=f.debounceRendering)||f2)(_0)}function _0(){try{for(var $,Q=1;z1.length;)z1.length>Q&&z1.sort(I2),$=z1.shift(),Q=z1.length,T8($)}finally{z1.length=_0.__r=0}}function x2($,Q,J,q,W,Y,G,X,H,B,j){var A,z,F,k,I,N,O=q&&q.__k||z0,U=Q.length;for(H=g8(J,Q,O,H,U),A=0;A<U;A++)(F=J.__k[A])!=null&&(z=F.__i!=-1&&O[F.__i]||B0,F.__i=A,N=h0($,F,z,W,Y,G,X,H,B,j),k=F.__e,F.ref&&z.ref!=F.ref&&(z.ref&&m0(z.ref,null,F),j.push(F.ref,F.__c||k,F)),I==null&&k!=null&&(I=k),4&F.__u?(H=Z2(F,H,$),z.__e&&(z.__e=null)):typeof F.type=="function"&&N!==void 0?H=N:k&&(H=k.nextSibling),F.__u&=-7);return J.__e=I,H}function g8($,Q,J,q,W){var Y,G,X,H,B,j=J.length,A=j,z=0;for($.__k=Array(W),Y=0;Y<W;Y++)(G=Q[Y])!=null&&typeof G!="boolean"&&typeof G!="function"?(typeof G=="string"||typeof G=="number"||typeof G=="bigint"||G.constructor==String?G=$.__k[Y]=X0(null,G,null,null,null):j0(G)?G=$.__k[Y]=X0(Q1,{children:G},null,null,null):G.constructor===void 0&&G.__b>0?G=$.__k[Y]=X0(G.type,G.props,G.key,G.ref?G.ref:null,G.__v):$.__k[Y]=G,H=Y+z,G.__=$,G.__b=$.__b+1,X=null,(B=G.__i=x8(G,J,H,A))!=-1&&(A--,(X=J[B])&&(X.__u|=2)),X==null||X.__v==null?(B==-1&&(W>j?z--:W<j&&z++),typeof G.type!="function"&&(G.__u|=4)):B!=H&&(B==H-1?z--:B==H+1?z++:(B>H?z--:z++,G.__u|=4))):$.__k[Y]=null;if(A)for(Y=0;Y<j;Y++)(X=J[Y])!=null&&(2&X.__u)==0&&(X.__e==q&&(q=w1(X)),l2(X,X));return q}function Z2($,Q,J){var q,W;if(typeof $.type=="function"){for(q=$.__k,W=0;q&&W<q.length;W++)q[W]&&(q[W].__=$,Q=Z2(q[W],Q,J));return Q}$.__e!=Q&&(Q&&$.type&&!Q.parentNode&&(Q=w1($)),Q=J.insertBefore($.__e,Q||null));do Q=Q&&Q.nextSibling;while(Q!=null&&Q.nodeType==8);return Q}function x8($,Q,J,q){var W,Y,G,X=$.key,H=$.type,B=Q[J],j=B!=null&&(2&B.__u)==0;if(B===null&&X==null||j&&X==B.key&&H==B.type)return J;if(q>(j?1:0)){for(W=J-1,Y=J+1;W>=0||Y<Q.length;)if((B=Q[G=W>=0?W--:Y++])!=null&&(2&B.__u)==0&&X==B.key&&H==B.type)return G}return-1}function k2($,Q,J){Q[0]=="-"?$.setProperty(Q,J==null?"":J):$[Q]=J==null?"":typeof J!="number"||f8.test(Q)?J:J+"px"}function Y0($,Q,J,q,W){var Y,G;$:if(Q=="style")if(typeof J=="string")$.style.cssText=J;else{if(typeof q=="string"&&($.style.cssText=q=""),q)for(Q in q)J&&Q in J||k2($.style,Q,"");if(J)for(Q in J)q&&J[Q]==q[Q]||k2($.style,Q,J[Q])}else if(Q[0]=="o"&&Q[1]=="n")Y=Q!=(Q=Q.replace(T2,"$1")),G=Q.toLowerCase(),Q=G in $||Q=="onFocusOut"||Q=="onFocusIn"?G.slice(2):Q.slice(2),$.l||($.l={}),$.l[Q+Y]=J,J?q?J[p1]=q[p1]:(J[p1]=Z0,$.addEventListener(Q,Y?x0:g0,Y)):$.removeEventListener(Q,Y?x0:g0,Y);else{if(W=="http://www.w3.org/2000/svg")Q=Q.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(Q!="width"&&Q!="height"&&Q!="href"&&Q!="list"&&Q!="form"&&Q!="tabIndex"&&Q!="download"&&Q!="rowSpan"&&Q!="colSpan"&&Q!="role"&&Q!="popover"&&Q in $)try{$[Q]=J==null?"":J;break $}catch(X){}typeof J=="function"||(J==null||J===!1&&Q[4]!="-"?$.removeAttribute(Q):$.setAttribute(Q,Q=="popover"&&J==1?"":J))}}function P2($){return function(Q){if(this.l){var J=this.l[Q.type+$];if(Q[G0]==null)Q[G0]=Z0++;else if(Q[G0]<J[p1])return;return J(f.event?f.event(Q):Q)}}}function h0($,Q,J,q,W,Y,G,X,H,B){var j,A,z,F,k,I,N,O,U,C,T,P,h,c,u,o,i=Q.type;if(Q.constructor!==void 0)return null;128&J.__u&&(H=!!(32&J.__u),Y=[X=Q.__e=J.__e]),(j=f.__b)&&j(Q);$:if(typeof i=="function"){A=G.length;try{if(U=Q.props,C=i.prototype&&i.prototype.render,T=(j=i.contextType)&&q[j.__c],P=j?T?T.props.value:j.__:q,J.__c?O=(z=Q.__c=J.__c).__=z.__E:(C?Q.__c=z=new i(U,P):(Q.__c=z=new H0(U,P),z.constructor=i,z.render=y8),T&&T.sub(z),z.state||(z.state={}),z.__n=q,F=z.__d=!0,z.__h=[],z._sb=[]),C&&z.__s==null&&(z.__s=z.state),C&&i.getDerivedStateFromProps!=null&&(z.__s==z.state&&(z.__s=G1({},z.__s)),G1(z.__s,i.getDerivedStateFromProps(U,z.__s))),k=z.props,I=z.state,z.__v=Q,F)C&&i.getDerivedStateFromProps==null&&z.componentWillMount!=null&&z.componentWillMount(),C&&z.componentDidMount!=null&&z.__h.push(z.componentDidMount);else{if(C&&i.getDerivedStateFromProps==null&&U!==k&&z.componentWillReceiveProps!=null&&z.componentWillReceiveProps(U,P),Q.__v==J.__v||!z.__e&&z.shouldComponentUpdate!=null&&z.shouldComponentUpdate(U,z.__s,P)===!1){Q.__v!=J.__v&&(z.props=U,z.state=z.__s,z.__d=!1),Q.__e=J.__e,Q.__k=J.__k,Q.__k.some(function($1){$1&&($1.__=Q)}),z0.push.apply(z.__h,z._sb),z._sb=[],z.__h.length&&G.push(z),X=w1(J);break $}z.componentWillUpdate!=null&&z.componentWillUpdate(U,z.__s,P),C&&z.componentDidUpdate!=null&&z.__h.push(function(){z.componentDidUpdate(k,I,N)})}if(z.context=P,z.props=U,z.__P=$,z.__e=!1,h=f.__r,c=0,C)z.state=z.__s,z.__d=!1,h&&h(Q),j=z.render(z.props,z.state,z.context),z0.push.apply(z.__h,z._sb),z._sb=[];else do z.__d=!1,h&&h(Q),j=z.render(z.props,z.state,z.context),z.state=z.__s;while(z.__d&&++c<25);z.state=z.__s,z.getChildContext!=null&&(q=G1(G1({},q),z.getChildContext())),C&&!F&&z.getSnapshotBeforeUpdate!=null&&(N=z.getSnapshotBeforeUpdate(k,I)),u=j!=null&&j.type===Q1&&j.key==null?m2(j.props.children):j,X=x2($,j0(u)?u:[u],Q,J,q,W,Y,G,X,H,B),z.base=Q.__e,Q.__u&=-161,z.__h.length&&G.push(z),O&&(z.__E=z.__=null)}catch($1){if(G.length=A,Q.__v=null,H||Y!=null){if($1.then){for(Q.__u|=H?160:128;X&&X.nodeType==8&&X.nextSibling;)X=X.nextSibling;Y!=null&&(Y[Y.indexOf(X)]=null),Q.__e=X}else if(Y!=null)for(o=Y.length;o--;)y0(Y[o])}else Q.__e=J.__e;Q.__k==null&&(Q.__k=J.__k||[]),$1.then||y2(Q),f.__e($1,Q,J)}}else Y==null&&Q.__v==J.__v?(Q.__k=J.__k,Q.__e=J.__e):X=Q.__e=Z8(J.__e,Q,J,q,W,Y,G,H,B);return(j=f.diffed)&&j(Q),128&Q.__u?void 0:X}function y2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(y2))}function h2($,Q,J){for(var q=0;q<J.length;q++)m0(J[q],J[++q],J[++q]);f.__c&&f.__c(Q,$),$.some(function(W){try{$=W.__h,W.__h=[],$.some(function(Y){Y.call(W)})}catch(Y){f.__e(Y,W.__v)}})}function m2($){return typeof $!="object"||$==null||$.__b>0?$:j0($)?$.map(m2):$.constructor!==void 0?null:G1({},$)}function Z8($,Q,J,q,W,Y,G,X,H){var B,j,A,z,F,k,I,N=J.props||B0,O=Q.props,U=Q.type;if(U=="svg"?W="http://www.w3.org/2000/svg":U=="math"?W="http://www.w3.org/1998/Math/MathML":W||(W="http://www.w3.org/1999/xhtml"),Y!=null){for(B=0;B<Y.length;B++)if((F=Y[B])&&"setAttribute"in F==!!U&&(U?F.localName==U:F.nodeType==3)){$=F,Y[B]=null;break}}if($==null){if(U==null)return document.createTextNode(O);$=document.createElementNS(W,U,O.is&&O),X&&(f.__m&&f.__m(Q,Y),X=!1),Y=null}if(U==null)N===O||X&&$.data==O||($.data=O);else{if(Y=U=="textarea"&&O.defaultValue!=null?null:Y&&M0.call($.childNodes),!X&&Y!=null)for(N={},B=0;B<$.attributes.length;B++)N[(F=$.attributes[B]).name]=F.value;for(B in N)F=N[B],B=="dangerouslySetInnerHTML"?A=F:B=="children"||(B in O)||B=="value"&&("defaultValue"in O)||B=="checked"&&("defaultChecked"in O)||Y0($,B,null,F,W);for(B in O)F=O[B],B=="children"?z=F:B=="dangerouslySetInnerHTML"?j=F:B=="value"?k=F:B=="checked"?I=F:X&&typeof F!="function"||N[B]===F||Y0($,B,F,N[B],W);if(j)X||A&&(j.__html==A.__html||j.__html==$.innerHTML)||($.innerHTML=j.__html),Q.__k=[];else if(A&&($.innerHTML=""),x2(Q.type=="template"?$.content:$,j0(z)?z:[z],Q,J,q,U=="foreignObject"?"http://www.w3.org/1999/xhtml":W,Y,G,Y?Y[0]:J.__k&&w1(J,0),X,H),Y!=null)for(B=Y.length;B--;)y0(Y[B]);X&&U!="textarea"||(B="value",U=="progress"&&k==null?$.removeAttribute("value"):k!=null&&(k!==$[B]||U=="progress"&&!k||U=="option"&&k!=N[B])&&Y0($,B,k,N[B],W),B="checked",I!=null&&I!=$[B]&&Y0($,B,I,N[B],W))}return $}function m0($,Q,J){try{if(typeof $=="function"){var q=typeof $.__u=="function";q&&$.__u(),q&&Q==null||($.__u=$(Q))}else $.current=Q}catch(W){f.__e(W,J)}}function l2($,Q,J){var q,W;if(f.unmount&&f.unmount($),(q=$.ref)&&(q.current&&q.current!=$.__e||m0(q,null,Q)),(q=$.__c)!=null){if(q.componentWillUnmount)try{q.componentWillUnmount()}catch(Y){f.__e(Y,Q)}q.base=q.__P=q.__n=null}if(q=$.__k)for(W=0;W<q.length;W++)q[W]&&l2(q[W],Q,J||typeof $.type!="function");J||y0($.__e),$.__c=$.__=$.__e=void 0}function y8($,Q,J){return this.constructor($,J)}function c2($,Q,J){var q,W,Y,G;Q==document&&(Q=document.documentElement),f.__&&f.__($,Q),W=(q=typeof J=="function")?null:J&&J.__k||Q.__k,Y=[],G=[],h0(Q,$=(!q&&J||Q).__k=I8(Q1,null,[$]),W||B0,B0,Q.namespaceURI,!q&&J?[J]:W?null:Q.firstChild?M0.call(Q.childNodes):null,Y,!q&&J?J:W?W.__e:Q.firstChild,q,G),h2(Y,$,G),$.props.children=null}M0=z0.slice,f={__e:function($,Q,J,q){for(var W,Y,G;Q=Q.__;)if((W=Q.__c)&&!W.__)try{if((Y=W.constructor)&&Y.getDerivedStateFromError!=null&&(W.setState(Y.getDerivedStateFromError($)),G=W.__d),W.componentDidCatch!=null&&(W.componentDidCatch($,q||{}),G=W.__d),G)return W.__E=W}catch(X){$=X}throw $}},C2=0,P8=function($){return $!=null&&$.constructor===void 0},H0.prototype.setState=function($,Q){var J;J=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=G1({},this.state),typeof $=="function"&&($=$(G1({},J),this.props)),$&&G1(J,$),$!=null&&this.__v&&(Q&&this._sb.push(Q),E2(this))},H0.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),E2(this))},H0.prototype.render=Q1,z1=[],f2=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,I2=function($,Q){return $.__v.__b-Q.__v.__b},_0.__r=0,T0=Math.random().toString(8),G0="__d"+T0,p1="__a"+T0,T2=/(PointerCapture)$|Capture$/i,Z0=0,g0=P2(!1),x0=P2(!0),C8=0;async function u2($){let Q=m8($);return crypto.subtle.importKey("raw",Q,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function l0($,Q){let J=crypto.getRandomValues(new Uint8Array(12)),q=new TextEncoder().encode(Q),W=await crypto.subtle.encrypt({name:"AES-GCM",iv:J},$,q),Y=new Uint8Array(J.byteLength+W.byteLength);return Y.set(J,0),Y.set(new Uint8Array(W),J.byteLength),h8(Y)}async function c0($,Q){let J=p2(Q);if(J.byteLength<28)throw Error("Ciphertext too short");let q=J.subarray(0,12),W=J.subarray(12),Y=await crypto.subtle.decrypt({name:"AES-GCM",iv:q},$,W);return new TextDecoder().decode(Y)}function h8($){let Q="",J=32768;for(let q=0;q<$.byteLength;q+=J)Q+=String.fromCharCode.apply(null,Array.from($.subarray(q,q+J)));return btoa(Q)}function p2($){let Q=atob($),J=new Uint8Array(Q.length);for(let q=0;q<Q.length;q++)J[q]=Q.charCodeAt(q);return J}function m8($){let Q=$.replace(/-/g,"+").replace(/_/g,"/")+"===".slice(($.length+3)%4);return p2(Q)}var M={};k8(M,{void:()=>R6,util:()=>E,unknown:()=>O6,union:()=>E6,undefined:()=>A6,tuple:()=>C6,transformer:()=>l6,symbol:()=>U6,string:()=>e2,strictObject:()=>v6,setErrorMap:()=>u8,set:()=>T6,record:()=>f6,quotelessJson:()=>l8,promise:()=>m6,preprocess:()=>p6,pipeline:()=>d6,ostring:()=>i6,optional:()=>c6,onumber:()=>o6,oboolean:()=>n6,objectUtil:()=>u0,object:()=>S6,number:()=>$4,nullable:()=>u6,null:()=>w6,never:()=>b6,nativeEnum:()=>h6,nan:()=>K6,map:()=>I6,makeIssue:()=>d1,literal:()=>Z6,lazy:()=>x6,late:()=>j6,isValid:()=>_1,isDirty:()=>K0,isAsync:()=>v1,isAborted:()=>V0,intersection:()=>P6,instanceof:()=>V6,getParsedType:()=>J1,getErrorMap:()=>S1,function:()=>g6,enum:()=>y6,effect:()=>l6,discriminatedUnion:()=>k6,defaultErrorMap:()=>X1,datetimeRegex:()=>a2,date:()=>N6,custom:()=>t2,coerce:()=>r6,boolean:()=>Q4,bigint:()=>F6,array:()=>L6,any:()=>D6,addIssueToContext:()=>K,ZodVoid:()=>o1,ZodUnknown:()=>M1,ZodUnion:()=>I1,ZodUndefined:()=>C1,ZodType:()=>v,ZodTuple:()=>W1,ZodTransformer:()=>e,ZodSymbol:()=>i1,ZodString:()=>r,ZodSet:()=>R1,ZodSchema:()=>v,ZodRecord:()=>n1,ZodReadonly:()=>m1,ZodPromise:()=>L1,ZodPipeline:()=>s1,ZodParsedType:()=>V,ZodOptional:()=>s,ZodObject:()=>g,ZodNumber:()=>j1,ZodNullable:()=>B1,ZodNull:()=>f1,ZodNever:()=>q1,ZodNativeEnum:()=>Z1,ZodNaN:()=>a1,ZodMap:()=>r1,ZodLiteral:()=>x1,ZodLazy:()=>g1,ZodIssueCode:()=>_,ZodIntersection:()=>T1,ZodFunction:()=>k1,ZodFirstPartyTypeKind:()=>R,ZodError:()=>d,ZodEnum:()=>K1,ZodEffects:()=>e,ZodDiscriminatedUnion:()=>F0,ZodDefault:()=>y1,ZodDate:()=>O1,ZodCatch:()=>h1,ZodBranded:()=>N0,ZodBoolean:()=>P1,ZodBigInt:()=>V1,ZodArray:()=>a,ZodAny:()=>b1,Schema:()=>v,ParseStatus:()=>m,OK:()=>l,NEVER:()=>a6,INVALID:()=>b,EMPTY_PATH:()=>p8,DIRTY:()=>D1,BRAND:()=>M6});var E;(function($){$.assertEqual=(W)=>{};function Q(W){}$.assertIs=Q;function J(W){throw Error()}$.assertNever=J,$.arrayToEnum=(W)=>{let Y={};for(let G of W)Y[G]=G;return Y},$.getValidEnumValues=(W)=>{let Y=$.objectKeys(W).filter((X)=>typeof W[W[X]]!=="number"),G={};for(let X of Y)G[X]=W[X];return $.objectValues(G)},$.objectValues=(W)=>{return $.objectKeys(W).map(function(Y){return W[Y]})},$.objectKeys=typeof Object.keys==="function"?(W)=>Object.keys(W):(W)=>{let Y=[];for(let G in W)if(Object.prototype.hasOwnProperty.call(W,G))Y.push(G);return Y},$.find=(W,Y)=>{for(let G of W)if(Y(G))return G;return},$.isInteger=typeof Number.isInteger==="function"?(W)=>Number.isInteger(W):(W)=>typeof W==="number"&&Number.isFinite(W)&&Math.floor(W)===W;function q(W,Y=" | "){return W.map((G)=>typeof G==="string"?`'${G}'`:G).join(Y)}$.joinValues=q,$.jsonStringifyReplacer=(W,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(E||(E={}));var u0;(function($){$.mergeShapes=(Q,J)=>{return{...Q,...J}}})(u0||(u0={}));var V=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J1=($)=>{switch(typeof $){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN($)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray($))return V.array;if($===null)return V.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return V.promise;if(typeof Map<"u"&&$ instanceof Map)return V.map;if(typeof Set<"u"&&$ instanceof Set)return V.set;if(typeof Date<"u"&&$ instanceof Date)return V.date;return V.object;default:return V.unknown}};var _=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),l8=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class d extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(J)=>{this.issues=[...this.issues,J]},this.addIssues=(J=[])=>{this.issues=[...this.issues,...J]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=$}format($){let Q=$||function(W){return W.message},J={_errors:[]},q=(W)=>{for(let Y of W.issues)if(Y.code==="invalid_union")Y.unionErrors.map(q);else if(Y.code==="invalid_return_type")q(Y.returnTypeError);else if(Y.code==="invalid_arguments")q(Y.argumentsError);else if(Y.path.length===0)J._errors.push(Q(Y));else{let G=J,X=0;while(X<Y.path.length){let H=Y.path[X];if(X!==Y.path.length-1)G[H]=G[H]||{_errors:[]};else G[H]=G[H]||{_errors:[]},G[H]._errors.push(Q(Y));G=G[H],X++}}};return q(this),J}static assert($){if(!($ instanceof d))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(Q)=>Q.message){let Q={},J=[];for(let q of this.issues)if(q.path.length>0){let W=q.path[0];Q[W]=Q[W]||[],Q[W].push($(q))}else J.push($(q));return{formErrors:J,fieldErrors:Q}}get formErrors(){return this.flatten()}}d.create=($)=>{return new d($)};var c8=($,Q)=>{let J;switch($.code){case _.invalid_type:if($.received===V.undefined)J="Required";else J=`Expected ${$.expected}, received ${$.received}`;break;case _.invalid_literal:J=`Invalid literal value, expected ${JSON.stringify($.expected,E.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:J=`Unrecognized key(s) in object: ${E.joinValues($.keys,", ")}`;break;case _.invalid_union:J="Invalid input";break;case _.invalid_union_discriminator:J=`Invalid discriminator value. Expected ${E.joinValues($.options)}`;break;case _.invalid_enum_value:J=`Invalid enum value. Expected ${E.joinValues($.options)}, received '${$.received}'`;break;case _.invalid_arguments:J="Invalid function arguments";break;case _.invalid_return_type:J="Invalid function return type";break;case _.invalid_date:J="Invalid date";break;case _.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(J=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")J=`${J} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)J=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)J=`Invalid input: must end with "${$.validation.endsWith}"`;else E.assertNever($.validation);else if($.validation!=="regex")J=`Invalid ${$.validation}`;else J="Invalid";break;case _.too_small:if($.type==="array")J=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")J=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")J=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")J=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")J=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else J="Invalid input";break;case _.too_big:if($.type==="array")J=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")J=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")J=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")J=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")J=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else J="Invalid input";break;case _.custom:J="Invalid input";break;case _.invalid_intersection_types:J="Intersection results could not be merged";break;case _.not_multiple_of:J=`Number must be a multiple of ${$.multipleOf}`;break;case _.not_finite:J="Number must be finite";break;default:J=Q.defaultError,E.assertNever($)}return{message:J}},X1=c8;var d2=X1;function u8($){d2=$}function S1(){return d2}var d1=($)=>{let{data:Q,path:J,errorMaps:q,issueData:W}=$,Y=[...J,...W.path||[]],G={...W,path:Y};if(W.message!==void 0)return{...W,path:Y,message:W.message};let X="",H=q.filter((B)=>!!B).slice().reverse();for(let B of H)X=B(G,{data:Q,defaultError:X}).message;return{...W,path:Y,message:X}},p8=[];function K($,Q){let J=S1(),q=d1({issueData:Q,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,J,J===X1?void 0:X1].filter((W)=>!!W)});$.common.issues.push(q)}class m{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,Q){let J=[];for(let q of Q){if(q.status==="aborted")return b;if(q.status==="dirty")$.dirty();J.push(q.value)}return{status:$.value,value:J}}static async mergeObjectAsync($,Q){let J=[];for(let q of Q){let W=await q.key,Y=await q.value;J.push({key:W,value:Y})}return m.mergeObjectSync($,J)}static mergeObjectSync($,Q){let J={};for(let q of Q){let{key:W,value:Y}=q;if(W.status==="aborted")return b;if(Y.status==="aborted")return b;if(W.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(W.value!=="__proto__"&&(typeof Y.value<"u"||q.alwaysSet))J[W.value]=Y.value}return{status:$.value,value:J}}}var b=Object.freeze({status:"aborted"}),D1=($)=>({status:"dirty",value:$}),l=($)=>({status:"valid",value:$}),V0=($)=>$.status==="aborted",K0=($)=>$.status==="dirty",_1=($)=>$.status==="valid",v1=($)=>typeof Promise<"u"&&$ instanceof Promise;var D;(function($){$.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},$.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(D||(D={}));class t{constructor($,Q,J,q){this._cachedPath=[],this.parent=$,this.data=Q,this._path=J,this._key=q}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var i2=($,Q)=>{if(_1(Q))return{success:!0,data:Q.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let J=new d($.common.issues);return this._error=J,this._error}}}};function S($){if(!$)return{};let{errorMap:Q,invalid_type_error:J,required_error:q,description:W}=$;if(Q&&(J||q))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:W};return{errorMap:(G,X)=>{let{message:H}=$;if(G.code==="invalid_enum_value")return{message:H??X.defaultError};if(typeof X.data>"u")return{message:H??q??X.defaultError};if(G.code!=="invalid_type")return{message:X.defaultError};return{message:H??J??X.defaultError}},description:W}}class v{get description(){return this._def.description}_getType($){return J1($.data)}_getOrReturnCtx($,Q){return Q||{common:$.parent.common,data:$.data,parsedType:J1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new m,ctx:{common:$.parent.common,data:$.data,parsedType:J1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let Q=this._parse($);if(v1(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync($){let Q=this._parse($);return Promise.resolve(Q)}parse($,Q){let J=this.safeParse($,Q);if(J.success)return J.data;throw J.error}safeParse($,Q){let J={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:J1($)},q=this._parseSync({data:$,path:J.path,parent:J});return i2(J,q)}"~validate"($){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:J1($)};if(!this["~standard"].async)try{let J=this._parseSync({data:$,path:[],parent:Q});return _1(J)?{value:J.value}:{issues:Q.common.issues}}catch(J){if(J?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:Q}).then((J)=>_1(J)?{value:J.value}:{issues:Q.common.issues})}async parseAsync($,Q){let J=await this.safeParseAsync($,Q);if(J.success)return J.data;throw J.error}async safeParseAsync($,Q){let J={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:J1($)},q=this._parse({data:$,path:J.path,parent:J}),W=await(v1(q)?q:Promise.resolve(q));return i2(J,W)}refine($,Q){let J=(q)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(q);else return Q};return this._refinement((q,W)=>{let Y=$(q),G=()=>W.addIssue({code:_.custom,...J(q)});if(typeof Promise<"u"&&Y instanceof Promise)return Y.then((X)=>{if(!X)return G(),!1;else return!0});if(!Y)return G(),!1;else return!0})}refinement($,Q){return this._refinement((J,q)=>{if(!$(J))return q.addIssue(typeof Q==="function"?Q(J,q):Q),!1;else return!0})}_refinement($){return new e({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Q)=>this["~validate"](Q)}}optional(){return s.create(this,this._def)}nullable(){return B1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return a.create(this)}promise(){return L1.create(this,this._def)}or($){return I1.create([this,$],this._def)}and($){return T1.create(this,$,this._def)}transform($){return new e({...S(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:$}})}default($){let Q=typeof $==="function"?$:()=>$;return new y1({...S(this._def),innerType:this,defaultValue:Q,typeName:R.ZodDefault})}brand(){return new N0({typeName:R.ZodBranded,type:this,...S(this._def)})}catch($){let Q=typeof $==="function"?$:()=>$;return new h1({...S(this._def),innerType:this,catchValue:Q,typeName:R.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return s1.create(this,$)}readonly(){return m1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var d8=/^c[^\s-]{8,}$/i,i8=/^[0-9a-z]+$/,o8=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,r8=/^[a-z0-9_-]{21}$/i,a8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,t8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,e8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",p0,$6=/^(?:(?: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])$/,Q6=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,J6=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,q6=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Y6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,n2="((\\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])))",G6=new RegExp(`^${n2}$`);function r2($){let Q="[0-5]\\d";if($.precision)Q=`${Q}\\.\\d{${$.precision}}`;else if($.precision==null)Q=`${Q}(\\.\\d+)?`;let J=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${J}`}function X6($){return new RegExp(`^${r2($)}$`)}function a2($){let Q=`${n2}T${r2($)}`,J=[];if(J.push($.local?"Z?":"Z"),$.offset)J.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${J.join("|")})`,new RegExp(`^${Q}$`)}function H6($,Q){if((Q==="v4"||!Q)&&$6.test($))return!0;if((Q==="v6"||!Q)&&J6.test($))return!0;return!1}function B6($,Q){if(!a8.test($))return!1;try{let[J]=$.split(".");if(!J)return!1;let q=J.replace(/-/g,"+").replace(/_/g,"/").padEnd(J.length+(4-J.length%4)%4,"="),W=JSON.parse(atob(q));if(typeof W!=="object"||W===null)return!1;if("typ"in W&&W?.typ!=="JWT")return!1;if(!W.alg)return!1;if(Q&&W.alg!==Q)return!1;return!0}catch{return!1}}function z6($,Q){if((Q==="v4"||!Q)&&Q6.test($))return!0;if((Q==="v6"||!Q)&&q6.test($))return!0;return!1}class r extends v{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==V.string){let W=this._getOrReturnCtx($);return K(W,{code:_.invalid_type,expected:V.string,received:W.parsedType}),b}let J=new m,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.length<W.value)q=this._getOrReturnCtx($,q),K(q,{code:_.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),J.dirty()}else if(W.kind==="max"){if($.data.length>W.value)q=this._getOrReturnCtx($,q),K(q,{code:_.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),J.dirty()}else if(W.kind==="length"){let Y=$.data.length>W.value,G=$.data.length<W.value;if(Y||G){if(q=this._getOrReturnCtx($,q),Y)K(q,{code:_.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});else if(G)K(q,{code:_.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});J.dirty()}}else if(W.kind==="email"){if(!t8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"email",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="emoji"){if(!p0)p0=new RegExp(e8,"u");if(!p0.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"emoji",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="uuid"){if(!n8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"uuid",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="nanoid"){if(!r8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"nanoid",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="cuid"){if(!d8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"cuid",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="cuid2"){if(!i8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"cuid2",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="ulid"){if(!o8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"ulid",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="url")try{new URL($.data)}catch{q=this._getOrReturnCtx($,q),K(q,{validation:"url",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="regex"){if(W.regex.lastIndex=0,!W.regex.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"regex",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="trim")$.data=$.data.trim();else if(W.kind==="includes"){if(!$.data.includes(W.value,W.position))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:{includes:W.value,position:W.position},message:W.message}),J.dirty()}else if(W.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(W.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(W.kind==="startsWith"){if(!$.data.startsWith(W.value))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:{startsWith:W.value},message:W.message}),J.dirty()}else if(W.kind==="endsWith"){if(!$.data.endsWith(W.value))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:{endsWith:W.value},message:W.message}),J.dirty()}else if(W.kind==="datetime"){if(!a2(W).test($.data))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:"datetime",message:W.message}),J.dirty()}else if(W.kind==="date"){if(!G6.test($.data))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:"date",message:W.message}),J.dirty()}else if(W.kind==="time"){if(!X6(W).test($.data))q=this._getOrReturnCtx($,q),K(q,{code:_.invalid_string,validation:"time",message:W.message}),J.dirty()}else if(W.kind==="duration"){if(!s8.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"duration",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="ip"){if(!H6($.data,W.version))q=this._getOrReturnCtx($,q),K(q,{validation:"ip",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="jwt"){if(!B6($.data,W.alg))q=this._getOrReturnCtx($,q),K(q,{validation:"jwt",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="cidr"){if(!z6($.data,W.version))q=this._getOrReturnCtx($,q),K(q,{validation:"cidr",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="base64"){if(!W6.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"base64",code:_.invalid_string,message:W.message}),J.dirty()}else if(W.kind==="base64url"){if(!Y6.test($.data))q=this._getOrReturnCtx($,q),K(q,{validation:"base64url",code:_.invalid_string,message:W.message}),J.dirty()}else E.assertNever(W);return{status:J.value,value:$.data}}_regex($,Q,J){return this.refinement((q)=>$.test(q),{validation:Q,code:_.invalid_string,...D.errToObj(J)})}_addCheck($){return new r({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...D.errToObj($)})}url($){return this._addCheck({kind:"url",...D.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...D.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...D.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...D.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...D.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...D.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...D.errToObj($)})}base64($){return this._addCheck({kind:"base64",...D.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...D.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...D.errToObj($)})}ip($){return this._addCheck({kind:"ip",...D.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...D.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...D.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...D.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...D.errToObj($)})}regex($,Q){return this._addCheck({kind:"regex",regex:$,...D.errToObj(Q)})}includes($,Q){return this._addCheck({kind:"includes",value:$,position:Q?.position,...D.errToObj(Q?.message)})}startsWith($,Q){return this._addCheck({kind:"startsWith",value:$,...D.errToObj(Q)})}endsWith($,Q){return this._addCheck({kind:"endsWith",value:$,...D.errToObj(Q)})}min($,Q){return this._addCheck({kind:"min",value:$,...D.errToObj(Q)})}max($,Q){return this._addCheck({kind:"max",value:$,...D.errToObj(Q)})}length($,Q){return this._addCheck({kind:"length",value:$,...D.errToObj(Q)})}nonempty($){return this.min(1,D.errToObj($))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let Q of this._def.checks)if(Q.kind==="min"){if($===null||Q.value>$)$=Q.value}return $}get maxLength(){let $=null;for(let Q of this._def.checks)if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return $}}r.create=($)=>{return new r({checks:[],typeName:R.ZodString,coerce:$?.coerce??!1,...S($)})};function _6($,Q){let J=($.toString().split(".")[1]||"").length,q=(Q.toString().split(".")[1]||"").length,W=J>q?J:q,Y=Number.parseInt($.toFixed(W).replace(".","")),G=Number.parseInt(Q.toFixed(W).replace(".",""));return Y%G/10**W}class j1 extends v{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==V.number){let W=this._getOrReturnCtx($);return K(W,{code:_.invalid_type,expected:V.number,received:W.parsedType}),b}let J=void 0,q=new m;for(let W of this._def.checks)if(W.kind==="int"){if(!E.isInteger($.data))J=this._getOrReturnCtx($,J),K(J,{code:_.invalid_type,expected:"integer",received:"float",message:W.message}),q.dirty()}else if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)J=this._getOrReturnCtx($,J),K(J,{code:_.too_small,minimum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)J=this._getOrReturnCtx($,J),K(J,{code:_.too_big,maximum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if(_6($.data,W.value)!==0)J=this._getOrReturnCtx($,J),K(J,{code:_.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else if(W.kind==="finite"){if(!Number.isFinite($.data))J=this._getOrReturnCtx($,J),K(J,{code:_.not_finite,message:W.message}),q.dirty()}else E.assertNever(W);return{status:q.value,value:$.data}}gte($,Q){return this.setLimit("min",$,!0,D.toString(Q))}gt($,Q){return this.setLimit("min",$,!1,D.toString(Q))}lte($,Q){return this.setLimit("max",$,!0,D.toString(Q))}lt($,Q){return this.setLimit("max",$,!1,D.toString(Q))}setLimit($,Q,J,q){return new j1({...this._def,checks:[...this._def.checks,{kind:$,value:Q,inclusive:J,message:D.toString(q)}]})}_addCheck($){return new j1({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:D.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString($)})}multipleOf($,Q){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(Q)})}finite($){return this._addCheck({kind:"finite",message:D.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString($)})}get minValue(){let $=null;for(let Q of this._def.checks)if(Q.kind==="min"){if($===null||Q.value>$)$=Q.value}return $}get maxValue(){let $=null;for(let Q of this._def.checks)if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&E.isInteger($.value))}get isFinite(){let $=null,Q=null;for(let J of this._def.checks)if(J.kind==="finite"||J.kind==="int"||J.kind==="multipleOf")return!0;else if(J.kind==="min"){if(Q===null||J.value>Q)Q=J.value}else if(J.kind==="max"){if($===null||J.value<$)$=J.value}return Number.isFinite(Q)&&Number.isFinite($)}}j1.create=($)=>{return new j1({checks:[],typeName:R.ZodNumber,coerce:$?.coerce||!1,...S($)})};class V1 extends v{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==V.bigint)return this._getInvalidInput($);let J=void 0,q=new m;for(let W of this._def.checks)if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)J=this._getOrReturnCtx($,J),K(J,{code:_.too_small,type:"bigint",minimum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)J=this._getOrReturnCtx($,J),K(J,{code:_.too_big,type:"bigint",maximum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if($.data%W.value!==BigInt(0))J=this._getOrReturnCtx($,J),K(J,{code:_.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else E.assertNever(W);return{status:q.value,value:$.data}}_getInvalidInput($){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:V.bigint,received:Q.parsedType}),b}gte($,Q){return this.setLimit("min",$,!0,D.toString(Q))}gt($,Q){return this.setLimit("min",$,!1,D.toString(Q))}lte($,Q){return this.setLimit("max",$,!0,D.toString(Q))}lt($,Q){return this.setLimit("max",$,!1,D.toString(Q))}setLimit($,Q,J,q){return new V1({...this._def,checks:[...this._def.checks,{kind:$,value:Q,inclusive:J,message:D.toString(q)}]})}_addCheck($){return new V1({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString($)})}multipleOf($,Q){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(Q)})}get minValue(){let $=null;for(let Q of this._def.checks)if(Q.kind==="min"){if($===null||Q.value>$)$=Q.value}return $}get maxValue(){let $=null;for(let Q of this._def.checks)if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return $}}V1.create=($)=>{return new V1({checks:[],typeName:R.ZodBigInt,coerce:$?.coerce??!1,...S($)})};class P1 extends v{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==V.boolean){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.boolean,received:J.parsedType}),b}return l($.data)}}P1.create=($)=>{return new P1({typeName:R.ZodBoolean,coerce:$?.coerce||!1,...S($)})};class O1 extends v{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==V.date){let W=this._getOrReturnCtx($);return K(W,{code:_.invalid_type,expected:V.date,received:W.parsedType}),b}if(Number.isNaN($.data.getTime())){let W=this._getOrReturnCtx($);return K(W,{code:_.invalid_date}),b}let J=new m,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.getTime()<W.value)q=this._getOrReturnCtx($,q),K(q,{code:_.too_small,message:W.message,inclusive:!0,exact:!1,minimum:W.value,type:"date"}),J.dirty()}else if(W.kind==="max"){if($.data.getTime()>W.value)q=this._getOrReturnCtx($,q),K(q,{code:_.too_big,message:W.message,inclusive:!0,exact:!1,maximum:W.value,type:"date"}),J.dirty()}else E.assertNever(W);return{status:J.value,value:new Date($.data.getTime())}}_addCheck($){return new O1({...this._def,checks:[...this._def.checks,$]})}min($,Q){return this._addCheck({kind:"min",value:$.getTime(),message:D.toString(Q)})}max($,Q){return this._addCheck({kind:"max",value:$.getTime(),message:D.toString(Q)})}get minDate(){let $=null;for(let Q of this._def.checks)if(Q.kind==="min"){if($===null||Q.value>$)$=Q.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let Q of this._def.checks)if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return $!=null?new Date($):null}}O1.create=($)=>{return new O1({checks:[],coerce:$?.coerce||!1,typeName:R.ZodDate,...S($)})};class i1 extends v{_parse($){if(this._getType($)!==V.symbol){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.symbol,received:J.parsedType}),b}return l($.data)}}i1.create=($)=>{return new i1({typeName:R.ZodSymbol,...S($)})};class C1 extends v{_parse($){if(this._getType($)!==V.undefined){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.undefined,received:J.parsedType}),b}return l($.data)}}C1.create=($)=>{return new C1({typeName:R.ZodUndefined,...S($)})};class f1 extends v{_parse($){if(this._getType($)!==V.null){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.null,received:J.parsedType}),b}return l($.data)}}f1.create=($)=>{return new f1({typeName:R.ZodNull,...S($)})};class b1 extends v{constructor(){super(...arguments);this._any=!0}_parse($){return l($.data)}}b1.create=($)=>{return new b1({typeName:R.ZodAny,...S($)})};class M1 extends v{constructor(){super(...arguments);this._unknown=!0}_parse($){return l($.data)}}M1.create=($)=>{return new M1({typeName:R.ZodUnknown,...S($)})};class q1 extends v{_parse($){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:V.never,received:Q.parsedType}),b}}q1.create=($)=>{return new q1({typeName:R.ZodNever,...S($)})};class o1 extends v{_parse($){if(this._getType($)!==V.undefined){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.void,received:J.parsedType}),b}return l($.data)}}o1.create=($)=>{return new o1({typeName:R.ZodVoid,...S($)})};class a extends v{_parse($){let{ctx:Q,status:J}=this._processInputParams($),q=this._def;if(Q.parsedType!==V.array)return K(Q,{code:_.invalid_type,expected:V.array,received:Q.parsedType}),b;if(q.exactLength!==null){let Y=Q.data.length>q.exactLength.value,G=Q.data.length<q.exactLength.value;if(Y||G)K(Q,{code:Y?_.too_big:_.too_small,minimum:G?q.exactLength.value:void 0,maximum:Y?q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:q.exactLength.message}),J.dirty()}if(q.minLength!==null){if(Q.data.length<q.minLength.value)K(Q,{code:_.too_small,minimum:q.minLength.value,type:"array",inclusive:!0,exact:!1,message:q.minLength.message}),J.dirty()}if(q.maxLength!==null){if(Q.data.length>q.maxLength.value)K(Q,{code:_.too_big,maximum:q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:q.maxLength.message}),J.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((Y,G)=>{return q.type._parseAsync(new t(Q,Y,Q.path,G))})).then((Y)=>{return m.mergeArray(J,Y)});let W=[...Q.data].map((Y,G)=>{return q.type._parseSync(new t(Q,Y,Q.path,G))});return m.mergeArray(J,W)}get element(){return this._def.type}min($,Q){return new a({...this._def,minLength:{value:$,message:D.toString(Q)}})}max($,Q){return new a({...this._def,maxLength:{value:$,message:D.toString(Q)}})}length($,Q){return new a({...this._def,exactLength:{value:$,message:D.toString(Q)}})}nonempty($){return this.min(1,$)}}a.create=($,Q)=>{return new a({type:$,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...S(Q)})};function E1($){if($ instanceof g){let Q={};for(let J in $.shape){let q=$.shape[J];Q[J]=s.create(E1(q))}return new g({...$._def,shape:()=>Q})}else if($ instanceof a)return new a({...$._def,type:E1($.element)});else if($ instanceof s)return s.create(E1($.unwrap()));else if($ instanceof B1)return B1.create(E1($.unwrap()));else if($ instanceof W1)return W1.create($.items.map((Q)=>E1(Q)));else return $}class g extends v{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),Q=E.objectKeys($);return this._cached={shape:$,keys:Q},this._cached}_parse($){if(this._getType($)!==V.object){let H=this._getOrReturnCtx($);return K(H,{code:_.invalid_type,expected:V.object,received:H.parsedType}),b}let{status:J,ctx:q}=this._processInputParams($),{shape:W,keys:Y}=this._getCached(),G=[];if(!(this._def.catchall instanceof q1&&this._def.unknownKeys==="strip")){for(let H in q.data)if(!Y.includes(H))G.push(H)}let X=[];for(let H of Y){let B=W[H],j=q.data[H];X.push({key:{status:"valid",value:H},value:B._parse(new t(q,j,q.path,H)),alwaysSet:H in q.data})}if(this._def.catchall instanceof q1){let H=this._def.unknownKeys;if(H==="passthrough")for(let B of G)X.push({key:{status:"valid",value:B},value:{status:"valid",value:q.data[B]}});else if(H==="strict"){if(G.length>0)K(q,{code:_.unrecognized_keys,keys:G}),J.dirty()}else if(H==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let H=this._def.catchall;for(let B of G){let j=q.data[B];X.push({key:{status:"valid",value:B},value:H._parse(new t(q,j,q.path,B)),alwaysSet:B in q.data})}}if(q.common.async)return Promise.resolve().then(async()=>{let H=[];for(let B of X){let j=await B.key,A=await B.value;H.push({key:j,value:A,alwaysSet:B.alwaysSet})}return H}).then((H)=>{return m.mergeObjectSync(J,H)});else return m.mergeObjectSync(J,X)}get shape(){return this._def.shape()}strict($){return D.errToObj,new g({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(Q,J)=>{let q=this._def.errorMap?.(Q,J).message??J.defaultError;if(Q.code==="unrecognized_keys")return{message:D.errToObj($).message??q};return{message:q}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend($){return new g({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new g({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:R.ZodObject})}setKey($,Q){return this.augment({[$]:Q})}catchall($){return new g({...this._def,catchall:$})}pick($){let Q={};for(let J of E.objectKeys($))if($[J]&&this.shape[J])Q[J]=this.shape[J];return new g({...this._def,shape:()=>Q})}omit($){let Q={};for(let J of E.objectKeys(this.shape))if(!$[J])Q[J]=this.shape[J];return new g({...this._def,shape:()=>Q})}deepPartial(){return E1(this)}partial($){let Q={};for(let J of E.objectKeys(this.shape)){let q=this.shape[J];if($&&!$[J])Q[J]=q;else Q[J]=q.optional()}return new g({...this._def,shape:()=>Q})}required($){let Q={};for(let J of E.objectKeys(this.shape))if($&&!$[J])Q[J]=this.shape[J];else{let W=this.shape[J];while(W instanceof s)W=W._def.innerType;Q[J]=W}return new g({...this._def,shape:()=>Q})}keyof(){return s2(E.objectKeys(this.shape))}}g.create=($,Q)=>{return new g({shape:()=>$,unknownKeys:"strip",catchall:q1.create(),typeName:R.ZodObject,...S(Q)})};g.strictCreate=($,Q)=>{return new g({shape:()=>$,unknownKeys:"strict",catchall:q1.create(),typeName:R.ZodObject,...S(Q)})};g.lazycreate=($,Q)=>{return new g({shape:$,unknownKeys:"strip",catchall:q1.create(),typeName:R.ZodObject,...S(Q)})};class I1 extends v{_parse($){let{ctx:Q}=this._processInputParams($),J=this._def.options;function q(W){for(let G of W)if(G.result.status==="valid")return G.result;for(let G of W)if(G.result.status==="dirty")return Q.common.issues.push(...G.ctx.common.issues),G.result;let Y=W.map((G)=>new d(G.ctx.common.issues));return K(Q,{code:_.invalid_union,unionErrors:Y}),b}if(Q.common.async)return Promise.all(J.map(async(W)=>{let Y={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await W._parseAsync({data:Q.data,path:Q.path,parent:Y}),ctx:Y}})).then(q);else{let W=void 0,Y=[];for(let X of J){let H={...Q,common:{...Q.common,issues:[]},parent:null},B=X._parseSync({data:Q.data,path:Q.path,parent:H});if(B.status==="valid")return B;else if(B.status==="dirty"&&!W)W={result:B,ctx:H};if(H.common.issues.length)Y.push(H.common.issues)}if(W)return Q.common.issues.push(...W.ctx.common.issues),W.result;let G=Y.map((X)=>new d(X));return K(Q,{code:_.invalid_union,unionErrors:G}),b}}get options(){return this._def.options}}I1.create=($,Q)=>{return new I1({options:$,typeName:R.ZodUnion,...S(Q)})};var H1=($)=>{if($ instanceof g1)return H1($.schema);else if($ instanceof e)return H1($.innerType());else if($ instanceof x1)return[$.value];else if($ instanceof K1)return $.options;else if($ instanceof Z1)return E.objectValues($.enum);else if($ instanceof y1)return H1($._def.innerType);else if($ instanceof C1)return[void 0];else if($ instanceof f1)return[null];else if($ instanceof s)return[void 0,...H1($.unwrap())];else if($ instanceof B1)return[null,...H1($.unwrap())];else if($ instanceof N0)return H1($.unwrap());else if($ instanceof m1)return H1($.unwrap());else if($ instanceof h1)return H1($._def.innerType);else return[]};class F0 extends v{_parse($){let{ctx:Q}=this._processInputParams($);if(Q.parsedType!==V.object)return K(Q,{code:_.invalid_type,expected:V.object,received:Q.parsedType}),b;let J=this.discriminator,q=Q.data[J],W=this.optionsMap.get(q);if(!W)return K(Q,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[J]}),b;if(Q.common.async)return W._parseAsync({data:Q.data,path:Q.path,parent:Q});else return W._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,Q,J){let q=new Map;for(let W of Q){let Y=H1(W.shape[$]);if(!Y.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let G of Y){if(q.has(G))throw Error(`Discriminator property ${String($)} has duplicate value ${String(G)}`);q.set(G,W)}}return new F0({typeName:R.ZodDiscriminatedUnion,discriminator:$,options:Q,optionsMap:q,...S(J)})}}function d0($,Q){let J=J1($),q=J1(Q);if($===Q)return{valid:!0,data:$};else if(J===V.object&&q===V.object){let W=E.objectKeys(Q),Y=E.objectKeys($).filter((X)=>W.indexOf(X)!==-1),G={...$,...Q};for(let X of Y){let H=d0($[X],Q[X]);if(!H.valid)return{valid:!1};G[X]=H.data}return{valid:!0,data:G}}else if(J===V.array&&q===V.array){if($.length!==Q.length)return{valid:!1};let W=[];for(let Y=0;Y<$.length;Y++){let G=$[Y],X=Q[Y],H=d0(G,X);if(!H.valid)return{valid:!1};W.push(H.data)}return{valid:!0,data:W}}else if(J===V.date&&q===V.date&&+$===+Q)return{valid:!0,data:$};else return{valid:!1}}class T1 extends v{_parse($){let{status:Q,ctx:J}=this._processInputParams($),q=(W,Y)=>{if(V0(W)||V0(Y))return b;let G=d0(W.value,Y.value);if(!G.valid)return K(J,{code:_.invalid_intersection_types}),b;if(K0(W)||K0(Y))Q.dirty();return{status:Q.value,value:G.data}};if(J.common.async)return Promise.all([this._def.left._parseAsync({data:J.data,path:J.path,parent:J}),this._def.right._parseAsync({data:J.data,path:J.path,parent:J})]).then(([W,Y])=>q(W,Y));else return q(this._def.left._parseSync({data:J.data,path:J.path,parent:J}),this._def.right._parseSync({data:J.data,path:J.path,parent:J}))}}T1.create=($,Q,J)=>{return new T1({left:$,right:Q,typeName:R.ZodIntersection,...S(J)})};class W1 extends v{_parse($){let{status:Q,ctx:J}=this._processInputParams($);if(J.parsedType!==V.array)return K(J,{code:_.invalid_type,expected:V.array,received:J.parsedType}),b;if(J.data.length<this._def.items.length)return K(J,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&J.data.length>this._def.items.length)K(J,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let W=[...J.data].map((Y,G)=>{let X=this._def.items[G]||this._def.rest;if(!X)return null;return X._parse(new t(J,Y,J.path,G))}).filter((Y)=>!!Y);if(J.common.async)return Promise.all(W).then((Y)=>{return m.mergeArray(Q,Y)});else return m.mergeArray(Q,W)}get items(){return this._def.items}rest($){return new W1({...this._def,rest:$})}}W1.create=($,Q)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new W1({items:$,typeName:R.ZodTuple,rest:null,...S(Q)})};class n1 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:Q,ctx:J}=this._processInputParams($);if(J.parsedType!==V.object)return K(J,{code:_.invalid_type,expected:V.object,received:J.parsedType}),b;let q=[],W=this._def.keyType,Y=this._def.valueType;for(let G in J.data)q.push({key:W._parse(new t(J,G,J.path,G)),value:Y._parse(new t(J,J.data[G],J.path,G)),alwaysSet:G in J.data});if(J.common.async)return m.mergeObjectAsync(Q,q);else return m.mergeObjectSync(Q,q)}get element(){return this._def.valueType}static create($,Q,J){if(Q instanceof v)return new n1({keyType:$,valueType:Q,typeName:R.ZodRecord,...S(J)});return new n1({keyType:r.create(),valueType:$,typeName:R.ZodRecord,...S(Q)})}}class r1 extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:Q,ctx:J}=this._processInputParams($);if(J.parsedType!==V.map)return K(J,{code:_.invalid_type,expected:V.map,received:J.parsedType}),b;let q=this._def.keyType,W=this._def.valueType,Y=[...J.data.entries()].map(([G,X],H)=>{return{key:q._parse(new t(J,G,J.path,[H,"key"])),value:W._parse(new t(J,X,J.path,[H,"value"]))}});if(J.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let X of Y){let H=await X.key,B=await X.value;if(H.status==="aborted"||B.status==="aborted")return b;if(H.status==="dirty"||B.status==="dirty")Q.dirty();G.set(H.value,B.value)}return{status:Q.value,value:G}})}else{let G=new Map;for(let X of Y){let{key:H,value:B}=X;if(H.status==="aborted"||B.status==="aborted")return b;if(H.status==="dirty"||B.status==="dirty")Q.dirty();G.set(H.value,B.value)}return{status:Q.value,value:G}}}}r1.create=($,Q,J)=>{return new r1({valueType:Q,keyType:$,typeName:R.ZodMap,...S(J)})};class R1 extends v{_parse($){let{status:Q,ctx:J}=this._processInputParams($);if(J.parsedType!==V.set)return K(J,{code:_.invalid_type,expected:V.set,received:J.parsedType}),b;let q=this._def;if(q.minSize!==null){if(J.data.size<q.minSize.value)K(J,{code:_.too_small,minimum:q.minSize.value,type:"set",inclusive:!0,exact:!1,message:q.minSize.message}),Q.dirty()}if(q.maxSize!==null){if(J.data.size>q.maxSize.value)K(J,{code:_.too_big,maximum:q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:q.maxSize.message}),Q.dirty()}let W=this._def.valueType;function Y(X){let H=new Set;for(let B of X){if(B.status==="aborted")return b;if(B.status==="dirty")Q.dirty();H.add(B.value)}return{status:Q.value,value:H}}let G=[...J.data.values()].map((X,H)=>W._parse(new t(J,X,J.path,H)));if(J.common.async)return Promise.all(G).then((X)=>Y(X));else return Y(G)}min($,Q){return new R1({...this._def,minSize:{value:$,message:D.toString(Q)}})}max($,Q){return new R1({...this._def,maxSize:{value:$,message:D.toString(Q)}})}size($,Q){return this.min($,Q).max($,Q)}nonempty($){return this.min(1,$)}}R1.create=($,Q)=>{return new R1({valueType:$,minSize:null,maxSize:null,typeName:R.ZodSet,...S(Q)})};class k1 extends v{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:Q}=this._processInputParams($);if(Q.parsedType!==V.function)return K(Q,{code:_.invalid_type,expected:V.function,received:Q.parsedType}),b;function J(G,X){return d1({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,S1(),X1].filter((H)=>!!H),issueData:{code:_.invalid_arguments,argumentsError:X}})}function q(G,X){return d1({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,S1(),X1].filter((H)=>!!H),issueData:{code:_.invalid_return_type,returnTypeError:X}})}let W={errorMap:Q.common.contextualErrorMap},Y=Q.data;if(this._def.returns instanceof L1){let G=this;return l(async function(...X){let H=new d([]),B=await G._def.args.parseAsync(X,W).catch((z)=>{throw H.addIssue(J(X,z)),H}),j=await Reflect.apply(Y,this,B);return await G._def.returns._def.type.parseAsync(j,W).catch((z)=>{throw H.addIssue(q(j,z)),H})})}else{let G=this;return l(function(...X){let H=G._def.args.safeParse(X,W);if(!H.success)throw new d([J(X,H.error)]);let B=Reflect.apply(Y,this,H.data),j=G._def.returns.safeParse(B,W);if(!j.success)throw new d([q(B,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new k1({...this._def,args:W1.create($).rest(M1.create())})}returns($){return new k1({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,Q,J){return new k1({args:$?$:W1.create([]).rest(M1.create()),returns:Q||M1.create(),typeName:R.ZodFunction,...S(J)})}}class g1 extends v{get schema(){return this._def.getter()}_parse($){let{ctx:Q}=this._processInputParams($);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}}g1.create=($,Q)=>{return new g1({getter:$,typeName:R.ZodLazy,...S(Q)})};class x1 extends v{_parse($){if($.data!==this._def.value){let Q=this._getOrReturnCtx($);return K(Q,{received:Q.data,code:_.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:$.data}}get value(){return this._def.value}}x1.create=($,Q)=>{return new x1({value:$,typeName:R.ZodLiteral,...S(Q)})};function s2($,Q){return new K1({values:$,typeName:R.ZodEnum,...S(Q)})}class K1 extends v{_parse($){if(typeof $.data!=="string"){let Q=this._getOrReturnCtx($),J=this._def.values;return K(Q,{expected:E.joinValues(J),received:Q.parsedType,code:_.invalid_type}),b}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let Q=this._getOrReturnCtx($),J=this._def.values;return K(Q,{received:Q.data,code:_.invalid_enum_value,options:J}),b}return l($.data)}get options(){return this._def.values}get enum(){let $={};for(let Q of this._def.values)$[Q]=Q;return $}get Values(){let $={};for(let Q of this._def.values)$[Q]=Q;return $}get Enum(){let $={};for(let Q of this._def.values)$[Q]=Q;return $}extract($,Q=this._def){return K1.create($,{...this._def,...Q})}exclude($,Q=this._def){return K1.create(this.options.filter((J)=>!$.includes(J)),{...this._def,...Q})}}K1.create=s2;class Z1 extends v{_parse($){let Q=E.getValidEnumValues(this._def.values),J=this._getOrReturnCtx($);if(J.parsedType!==V.string&&J.parsedType!==V.number){let q=E.objectValues(Q);return K(J,{expected:E.joinValues(q),received:J.parsedType,code:_.invalid_type}),b}if(!this._cache)this._cache=new Set(E.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let q=E.objectValues(Q);return K(J,{received:J.data,code:_.invalid_enum_value,options:q}),b}return l($.data)}get enum(){return this._def.values}}Z1.create=($,Q)=>{return new Z1({values:$,typeName:R.ZodNativeEnum,...S(Q)})};class L1 extends v{unwrap(){return this._def.type}_parse($){let{ctx:Q}=this._processInputParams($);if(Q.parsedType!==V.promise&&Q.common.async===!1)return K(Q,{code:_.invalid_type,expected:V.promise,received:Q.parsedType}),b;let J=Q.parsedType===V.promise?Q.data:Promise.resolve(Q.data);return l(J.then((q)=>{return this._def.type.parseAsync(q,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}}L1.create=($,Q)=>{return new L1({type:$,typeName:R.ZodPromise,...S(Q)})};class e extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:Q,ctx:J}=this._processInputParams($),q=this._def.effect||null,W={addIssue:(Y)=>{if(K(J,Y),Y.fatal)Q.abort();else Q.dirty()},get path(){return J.path}};if(W.addIssue=W.addIssue.bind(W),q.type==="preprocess"){let Y=q.transform(J.data,W);if(J.common.async)return Promise.resolve(Y).then(async(G)=>{if(Q.value==="aborted")return b;let X=await this._def.schema._parseAsync({data:G,path:J.path,parent:J});if(X.status==="aborted")return b;if(X.status==="dirty")return D1(X.value);if(Q.value==="dirty")return D1(X.value);return X});else{if(Q.value==="aborted")return b;let G=this._def.schema._parseSync({data:Y,path:J.path,parent:J});if(G.status==="aborted")return b;if(G.status==="dirty")return D1(G.value);if(Q.value==="dirty")return D1(G.value);return G}}if(q.type==="refinement"){let Y=(G)=>{let X=q.refinement(G,W);if(J.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(J.common.async===!1){let G=this._def.schema._parseSync({data:J.data,path:J.path,parent:J});if(G.status==="aborted")return b;if(G.status==="dirty")Q.dirty();return Y(G.value),{status:Q.value,value:G.value}}else return this._def.schema._parseAsync({data:J.data,path:J.path,parent:J}).then((G)=>{if(G.status==="aborted")return b;if(G.status==="dirty")Q.dirty();return Y(G.value).then(()=>{return{status:Q.value,value:G.value}})})}if(q.type==="transform")if(J.common.async===!1){let Y=this._def.schema._parseSync({data:J.data,path:J.path,parent:J});if(!_1(Y))return b;let G=q.transform(Y.value,W);if(G instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:G}}else return this._def.schema._parseAsync({data:J.data,path:J.path,parent:J}).then((Y)=>{if(!_1(Y))return b;return Promise.resolve(q.transform(Y.value,W)).then((G)=>({status:Q.value,value:G}))});E.assertNever(q)}}e.create=($,Q,J)=>{return new e({schema:$,typeName:R.ZodEffects,effect:Q,...S(J)})};e.createWithPreprocess=($,Q,J)=>{return new e({schema:Q,effect:{type:"preprocess",transform:$},typeName:R.ZodEffects,...S(J)})};class s extends v{_parse($){if(this._getType($)===V.undefined)return l(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}s.create=($,Q)=>{return new s({innerType:$,typeName:R.ZodOptional,...S(Q)})};class B1 extends v{_parse($){if(this._getType($)===V.null)return l(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}B1.create=($,Q)=>{return new B1({innerType:$,typeName:R.ZodNullable,...S(Q)})};class y1 extends v{_parse($){let{ctx:Q}=this._processInputParams($),J=Q.data;if(Q.parsedType===V.undefined)J=this._def.defaultValue();return this._def.innerType._parse({data:J,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}}y1.create=($,Q)=>{return new y1({innerType:$,typeName:R.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...S(Q)})};class h1 extends v{_parse($){let{ctx:Q}=this._processInputParams($),J={...Q,common:{...Q.common,issues:[]}},q=this._def.innerType._parse({data:J.data,path:J.path,parent:{...J}});if(v1(q))return q.then((W)=>{return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new d(J.common.issues)},input:J.data})}});else return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new d(J.common.issues)},input:J.data})}}removeCatch(){return this._def.innerType}}h1.create=($,Q)=>{return new h1({innerType:$,typeName:R.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...S(Q)})};class a1 extends v{_parse($){if(this._getType($)!==V.nan){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:V.nan,received:J.parsedType}),b}return{status:"valid",value:$.data}}}a1.create=($)=>{return new a1({typeName:R.ZodNaN,...S($)})};var M6=Symbol("zod_brand");class N0 extends v{_parse($){let{ctx:Q}=this._processInputParams($),J=Q.data;return this._def.type._parse({data:J,path:Q.path,parent:Q})}unwrap(){return this._def.type}}class s1 extends v{_parse($){let{status:Q,ctx:J}=this._processInputParams($);if(J.common.async)return(async()=>{let W=await this._def.in._parseAsync({data:J.data,path:J.path,parent:J});if(W.status==="aborted")return b;if(W.status==="dirty")return Q.dirty(),D1(W.value);else return this._def.out._parseAsync({data:W.value,path:J.path,parent:J})})();else{let q=this._def.in._parseSync({data:J.data,path:J.path,parent:J});if(q.status==="aborted")return b;if(q.status==="dirty")return Q.dirty(),{status:"dirty",value:q.value};else return this._def.out._parseSync({data:q.value,path:J.path,parent:J})}}static create($,Q){return new s1({in:$,out:Q,typeName:R.ZodPipeline})}}class m1 extends v{_parse($){let Q=this._def.innerType._parse($),J=(q)=>{if(_1(q))q.value=Object.freeze(q.value);return q};return v1(Q)?Q.then((q)=>J(q)):J(Q)}unwrap(){return this._def.innerType}}m1.create=($,Q)=>{return new m1({innerType:$,typeName:R.ZodReadonly,...S(Q)})};function o2($,Q){let J=typeof $==="function"?$(Q):typeof $==="string"?{message:$}:$;return typeof J==="string"?{message:J}:J}function t2($,Q={},J){if($)return b1.create().superRefine((q,W)=>{let Y=$(q);if(Y instanceof Promise)return Y.then((G)=>{if(!G){let X=o2(Q,q),H=X.fatal??J??!0;W.addIssue({code:"custom",...X,fatal:H})}});if(!Y){let G=o2(Q,q),X=G.fatal??J??!0;W.addIssue({code:"custom",...G,fatal:X})}return});return b1.create()}var j6={object:g.lazycreate},R;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(R||(R={}));var V6=($,Q={message:`Input not instance of ${$.name}`})=>t2((J)=>J instanceof $,Q),e2=r.create,$4=j1.create,K6=a1.create,F6=V1.create,Q4=P1.create,N6=O1.create,U6=i1.create,A6=C1.create,w6=f1.create,D6=b1.create,O6=M1.create,b6=q1.create,R6=o1.create,L6=a.create,S6=g.create,v6=g.strictCreate,E6=I1.create,k6=F0.create,P6=T1.create,C6=W1.create,f6=n1.create,I6=r1.create,T6=R1.create,g6=k1.create,x6=g1.create,Z6=x1.create,y6=K1.create,h6=Z1.create,m6=L1.create,l6=e.create,c6=s.create,u6=B1.create,p6=e.createWithPreprocess,d6=s1.create,i6=()=>e2().optional(),o6=()=>$4().optional(),n6=()=>Q4().optional(),r6={string:($)=>r.create({...$,coerce:!0}),number:($)=>j1.create({...$,coerce:!0}),boolean:($)=>P1.create({...$,coerce:!0}),bigint:($)=>V1.create({...$,coerce:!0}),date:($)=>O1.create({...$,coerce:!0})};var a6=b;var i0=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;function s6($){let Q;try{Q=new URL($)}catch{return!1}if(Q.protocol!=="http:"&&Q.protocol!=="https:")return!1;return Q.hostname==="localhost"||Q.hostname==="127.0.0.1"||Q.hostname==="[::1]"||Q.hostname.endsWith(".localhost")}var F1=M.string().max(500),U0=4000,o0=1000,A0=1000,t6=M.object({label:F1,file:M.string().max(o0),line:M.number().int().positive(),column:M.number().int().nonnegative()}),l1=M.object({url:M.string().min(1).max(2000),selector:M.string().max(2000),role:F1.optional(),name:F1.optional(),text:F1.optional(),components:M.array(M.string().max(200)).max(20).optional(),sources:M.array(t6).max(10).optional(),context:F1.optional(),browser:M.object({name:F1,viewport:M.object({width:M.number().int().nonnegative(),height:M.number().int().nonnegative(),scale:M.number().positive()}),colorScheme:M.enum(["light","dark"])}).optional(),style:M.string().max(A0).optional(),html:M.string().max(U0).optional(),quote:M.object({exact:M.string().min(1).max(2000),before:F1,after:F1}).optional()}),n0=M.enum(["user","agent"]),e6=M.object({id:M.string(),author:n0,body:M.string().min(1).max(20000),createdAt:M.string()}),r0=M.enum(["open","queued","working","resolved"]),t1=M.object({id:M.string(),anchor:l1,state:r0,comments:M.array(e6).min(1),screenshot:M.string().optional(),createdAt:M.string(),updatedAt:M.string()}),W7=M.object({threads:M.array(t1)}),a0=M.string().trim().min(1).max(20000),J4="data:image/png;base64,",$$=M.string().startsWith(J4).max(8000000).transform(($)=>Uint8Array.from(atob($.slice(J4.length)),(Q)=>Q.charCodeAt(0))),Y7=M.object({anchor:l1,body:a0,send:M.boolean(),screenshot:$$.optional()}),G7=M.object({body:a0,send:M.boolean()}),X7=M.object({body:a0,resolve:M.boolean()}),q4=M.string().url().refine(($)=>s6($),"must be an http(s) URL on localhost"),H7=M.object({target:q4}),B7=M.object({target:q4,port:M.number().int().min(1).max(65535)});var W4=/^[a-f0-9]{24}$/,s0="agent-canvas-review",Q$=5;var J$=200,Y4=160000,w0=110000,G4=11000000;function N1($){return M.string().min(1).max($).regex(/^[A-Za-z0-9+/]+={0,2}$/,"must be base64 ciphertext")}var q$=M.string().refine(($)=>{let Q;try{Q=new URL($)}catch{return!1}if(Q.origin!==$)return!1;if(Q.protocol==="https:")return!0;return Q.protocol==="http:"&&(Q.hostname==="localhost"||Q.hostname==="127.0.0.1"||Q.hostname.endsWith(".localhost"))},"must be an origin such as https://app.example.com"),W$=M.object({id:M.string().max(64),author:n0,body:N1(w0),createdAt:M.string().max(64)}),t0=M.object({id:M.string().max(64),anchor:N1(Y4),state:r0,comments:M.array(W$).min(1).max(J$),screenshot:M.boolean(),createdAt:M.string().max(64),updatedAt:M.string().max(64)}),X4=M.object({threads:M.array(t0)}),j7=M.object({origins:M.array(q$).min(1).max(Q$)}),V7=M.object({projectId:M.string().regex(W4),agentToken:M.string().min(32)}),K7=M.object({anchor:N1(Y4),body:N1(w0),send:M.boolean(),screenshot:N1(G4).optional()}),F7=M.object({body:N1(w0),send:M.boolean()}),N7=M.object({body:N1(w0),resolve:M.boolean()}),U7=M.object({screenshot:N1(G4)}),H4="ping";var Y$=/^[A-Za-z0-9_-]{43}$/;function B4($){return`${$.projectId}.${$.key}`}function e0($){let[Q,J,...q]=$.split(".");if(Q===void 0||J===void 0||q.length>0)return null;if(!W4.test(Q)||!Y$.test(J))return null;return{projectId:Q,key:J}}var z4=M.object({threads:M.array(t1)});function _4($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function G$($){if(typeof $!=="string")return;let Q;try{Q=JSON.parse($)}catch{return}if(!_4(Q))return;if(Q.type==="agent-status"&&typeof Q.watching==="boolean")return{type:"agent-status",watching:Q.watching};if(Q.type==="reload"&&typeof Q.path==="string")return{type:"reload",path:Q.path};if(Q.type!=="threads")return;let J=z4.safeParse(Q);return J.success?{type:"threads",threads:J.data.threads}:void 0}class $2{daemonOrigin;project;offlineLabel="Daemon offline";socket=null;closed=!1;constructor($,Q){this.daemonOrigin=$;this.project=Q}connect($){let Q=`${this.daemonOrigin.replace(/^http/,"ws")}/ws/review/${encodeURIComponent(this.project)}`,J=new WebSocket(Q);this.socket=J,J.onopen=()=>{$.connected(!0),this.request("GET","/threads").then((q)=>{let W=z4.safeParse(q);if(W.success)$.threads(W.data.threads)})},J.onmessage=(q)=>{let W=G$(q.data);if(W?.type==="threads")$.threads(W.threads);if(W?.type==="agent-status")$.agentWatching(W.watching);if(W?.type==="reload")$.reload(W.path)},J.onclose=()=>{if($.connected(!1),!this.closed)setTimeout(()=>this.connect($),2000)}}close(){this.closed=!0,this.socket?.close()}createThread($,Q,J,q){return this.request("POST","/threads",{anchor:$,body:Q,send:J,...q===void 0?{}:{screenshot:q}})}comment($,Q,J){return this.request("POST",`/threads/${$}/comments`,{body:Q,send:J})}send($){return this.request("POST",`/threads/${$}/send`)}sendNotes(){return this.request("POST","/notes/send")}setResolved($,Q){return this.request("POST",`/threads/${$}/${Q?"resolve":"reopen"}`)}delete($){return this.request("DELETE",`/threads/${$}`)}async request($,Q,J){let q=await fetch(`${this.daemonOrigin}/api/review/${encodeURIComponent(this.project)}${Q}`,{method:$,...J===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}}),W=await q.json();if(!q.ok)throw Error(_4(W)&&typeof W.error==="string"?W.error:`Request failed (${q.status})`);return W}}function M4($,Q){return l0($,JSON.stringify(Q))}function D0($,Q){return l0($,Q)}async function j4($,Q,J){let q=JSON.parse(await c0($,Q.anchor)),W=await Promise.all(Q.comments.map(async(Y)=>({...Y,body:await c0($,Y.body)})));return t1.parse({id:Q.id,anchor:l1.parse(q),state:Q.state,comments:W,...J===void 0?{}:{screenshot:J},createdAt:Q.createdAt,updatedAt:Q.updatedAt})}var X$=30000,H$=M.discriminatedUnion("type",[M.object({type:M.literal("threads"),threads:M.array(t0)}),M.object({type:M.literal("agent-status"),watching:M.boolean()})]),B$=M.object({error:M.string()});class Q2{workerOrigin;projectId;key;offlineLabel="Offline";socket=null;keepalive=null;closed=!1;generation=0;constructor($,Q,J){this.workerOrigin=$;this.projectId=Q;this.key=J}connect($){let Q=new WebSocket(`${this.workerOrigin.replace(/^http/,"ws")}/review/${this.projectId}/ws`);this.socket=Q,Q.onopen=()=>{$.connected(!0),this.keepalive=setInterval(()=>Q.send(H4),X$),this.request("GET","/threads").then((J)=>this.publish(X4.parse(J).threads,$))},Q.onmessage=(J)=>{if(typeof J.data!=="string"||J.data==="pong")return;let q;try{q=JSON.parse(J.data)}catch{return}let W=H$.safeParse(q);if(!W.success)return;if(W.data.type==="threads")this.publish(W.data.threads,$);else $.agentWatching(W.data.watching)},Q.onclose=()=>{if(this.keepalive!==null)clearInterval(this.keepalive);if($.connected(!1),!this.closed)setTimeout(()=>this.connect($),2000)}}close(){this.closed=!0,this.socket?.close()}async createThread($,Q,J,q){return this.request("POST","/threads",{anchor:await M4(this.key,$),body:await D0(this.key,Q),send:J,...q===void 0?{}:{screenshot:await D0(this.key,q)}})}async comment($,Q,J){return this.request("POST",`/threads/${$}/comments`,{body:await D0(this.key,Q),send:J})}send($){return this.request("POST",`/threads/${$}/send`)}sendNotes(){return this.request("POST","/notes/send")}setResolved($,Q){return this.request("POST",`/threads/${$}/${Q?"resolve":"reopen"}`)}delete($){return this.request("DELETE",`/threads/${$}`)}publish($,Q){let J=++this.generation;Promise.allSettled($.map((q)=>j4(this.key,q))).then((q)=>{if(J!==this.generation)return;let W=[];for(let Y of q)if(Y.status==="fulfilled")W.push(Y.value);else console.warn("agent-canvas review: a thread did not open with this project key");Q.threads(W)})}async request($,Q,J){let q=await fetch(`${this.workerOrigin}/review/${this.projectId}${Q}`,{method:$,...J===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}}),W=await q.json();if(!q.ok){let Y=B$.safeParse(W);throw Error(Y.success?Y.data.error:`Request failed (${q.status})`)}return W}}var V4=`:host {
1
+ (()=>{var bs=Object.create;var{getPrototypeOf:ws,defineProperty:Nn,getOwnPropertyNames:ks}=Object;var Mn=Object.prototype.hasOwnProperty;function Ss(e){return this[e]}var Cs,Ts,Rs=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?Cs??=new WeakMap:Ts??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?bs(ws(e)):{};let i=t||!e||!e.__esModule||!Mn.call(e,"default")?Nn(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of ks(e))if(!Mn.call(i,a))Nn(i,a,{get:Ss.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var Es=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ur=Es(function(fn,hn){(function(e,t){typeof fn==="object"&&typeof hn<"u"?hn.exports=t():typeof define==="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.resolveURI=t())})(fn,function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(_){return e.test(_)}function s(_){return _.startsWith("//")}function o(_){return _.startsWith("/")}function i(_){return _.startsWith("file:")}function a(_){return/^[.?#]/.test(_)}function c(_){let b=t.exec(_);return f(b[1],b[2]||"",b[3],b[4]||"",b[5]||"/",b[6]||"",b[7]||"")}function l(_){let b=n.exec(_),g=b[2];return f("file:","",b[1]||"","",o(g)?g:"/"+g,b[3]||"",b[4]||"")}function f(_,b,g,O,L,A,F){return{scheme:_,user:b,host:g,port:O,path:L,query:A,hash:F,type:7}}function v(_){if(s(_)){let g=c("http:"+_);return g.scheme="",g.type=6,g}if(o(_)){let g=c("http://foo.com"+_);return g.scheme="",g.host="",g.type=5,g}if(i(_))return l(_);if(r(_))return c(_);let b=c("http://foo.com/"+_);return b.scheme="",b.host="",b.type=_?_.startsWith("?")?3:_.startsWith("#")?2:4:1,b}function u(_){if(_.endsWith("/.."))return _;let b=_.lastIndexOf("/");return _.slice(0,b+1)}function p(_,b){if(E(b,b.type),_.path==="/")_.path=b.path;else _.path=u(b.path)+_.path}function E(_,b){let g=b<=4,O=_.path.split("/"),L=1,A=0,F=!1;for(let q=1;q<O.length;q++){let X=O[q];if(!X){F=!0;continue}if(F=!1,X===".")continue;if(X===".."){if(A)F=!0,A--,L--;else if(g)O[L++]=X;continue}O[L++]=X,A++}let W="";for(let q=1;q<L;q++)W+="/"+O[q];if(!W||F&&!W.endsWith("/.."))W+="/";_.path=W}function M(_,b){if(!_&&!b)return"";let g=v(_),O=g.type;if(b&&O!==7){let A=v(b),F=A.type;switch(O){case 1:g.hash=A.hash;case 2:g.query=A.query;case 3:case 4:p(g,A);case 5:g.user=A.user,g.host=A.host,g.port=A.port;case 6:g.scheme=A.scheme}if(F>O)O=F}E(g,O);let L=g.query+g.hash;switch(O){case 2:case 3:return L;case 4:{let A=g.path.slice(1);if(!A)return L||".";if(a(b||_)&&!a(A))return"./"+A+L;return A+L}case 5:return g.path+L;default:return g.scheme+"//"+g.user+g.host+g.port+g.path+L}}return M})});var lt,P,Vn,As,fe,Ln,Un,Fn,Lt,rt,Ne,Bn,Dt,jt,$t,Os,it={},at=[],Ps=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ut=Array.isArray;function se(e,t){for(var n in t)e[n]=t[n];return e}function Vt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Is(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?lt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return st(e,i,r,s,null)}function st(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s==null?++Vn:s,__i:-1,__u:0};return s==null&&P.vnode!=null&&P.vnode(o),o}function Z(e){return e.children}function ot(e,t){this.props=e,this.context=t}function ye(e,t){if(t==null)return e.__?ye(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ye(e):null}function Ns(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],s=[],o=se({},t);o.__v=t.__v+1,P.vnode&&P.vnode(o),Ut(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n==null?ye(t):n,!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,Kn(r,o,s),t.__e=t.__=null,o.__e!=n&&zn(o)}}function zn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),zn(e)}function jn(e){(!e.__d&&(e.__d=!0)&&fe.push(e)&&!ct.__r++||Ln!=P.debounceRendering)&&((Ln=P.debounceRendering)||Un)(ct)}function ct(){try{for(var e,t=1;fe.length;)fe.length>t&&fe.sort(Fn),e=fe.shift(),t=fe.length,Ns(e)}finally{fe.length=ct.__r=0}}function Wn(e,t,n,r,s,o,i,a,c,l,f){var v,u,p,E,M,_,b=r&&r.__k||at,g=t.length;for(c=Ms(n,t,b,c,g),v=0;v<g;v++)(p=n.__k[v])!=null&&(u=p.__i!=-1&&b[p.__i]||it,p.__i=v,_=Ut(e,p,u,s,o,i,a,c,l,f),E=p.__e,p.ref&&u.ref!=p.ref&&(u.ref&&Ft(u.ref,null,p),f.push(p.ref,p.__c||E,p)),M==null&&E!=null&&(M=E),4&p.__u?(c=qn(p,c,e),u.__e&&(u.__e=null)):typeof p.type=="function"&&_!==void 0?c=_:E&&(c=E.nextSibling),p.__u&=-7);return n.__e=M,c}function Ms(e,t,n,r,s){var o,i,a,c,l,f=n.length,v=f,u=0;for(e.__k=Array(s),o=0;o<s;o++)(i=t[o])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[o]=st(null,i,null,null,null):ut(i)?i=e.__k[o]=st(Z,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[o]=st(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[o]=i,c=o+u,i.__=e,i.__b=e.__b+1,a=null,(l=i.__i=Ls(i,n,c,v))!=-1&&(v--,(a=n[l])&&(a.__u|=2)),a==null||a.__v==null?(l==-1&&(s>f?u--:s<f&&u++),typeof i.type!="function"&&(i.__u|=4)):l!=c&&(l==c-1?u--:l==c+1?u++:(l>c?u--:u++,i.__u|=4))):e.__k[o]=null;if(v)for(o=0;o<f;o++)(a=n[o])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=ye(a)),Xn(a,a));return r}function qn(e,t,n){var r,s;if(typeof e.type=="function"){for(r=e.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=e,t=qn(r[s],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ye(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ls(e,t,n,r){var s,o,i,{key:a,type:c}=e,l=t[n],f=l!=null&&(2&l.__u)==0;if(l===null&&a==null||f&&a==l.key&&c==l.type)return n;if(r>(f?1:0)){for(s=n-1,o=n+1;s>=0||o<t.length;)if((l=t[i=s>=0?s--:o++])!=null&&(2&l.__u)==0&&a==l.key&&c==l.type)return i}return-1}function $n(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Ps.test(t)?n:n+"px"}function nt(e,t,n,r,s){var o,i;e: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||$n(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||$n(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Bn,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[Ne]=r[Ne]:(n[Ne]=Dt,e.addEventListener(t,o?$t:jt,o)):e.removeEventListener(t,o?$t:jt,o);else{if(s=="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==null?"":n;break e}catch(a){}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Dn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[rt]==null)t[rt]=Dt++;else if(t[rt]<n[Ne])return;return n(P.event?P.event(t):t)}}}function Ut(e,t,n,r,s,o,i,a,c,l){var f,v,u,p,E,M,_,b,g,O,L,A,F,W,q,X,K=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[a=t.__e=n.__e]),(f=P.__b)&&f(t);e:if(typeof K=="function"){v=i.length;try{if(g=t.props,O=K.prototype&&K.prototype.render,L=(f=K.contextType)&&r[f.__c],A=f?L?L.props.value:f.__:r,n.__c?b=(u=t.__c=n.__c).__=u.__E:(O?t.__c=u=new K(g,A):(t.__c=u=new ot(g,A),u.constructor=K,u.render=$s),L&&L.sub(u),u.state||(u.state={}),u.__n=r,p=u.__d=!0,u.__h=[],u._sb=[]),O&&u.__s==null&&(u.__s=u.state),O&&K.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=se({},u.__s)),se(u.__s,K.getDerivedStateFromProps(g,u.__s))),E=u.props,M=u.state,u.__v=t,p)O&&K.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),O&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(O&&K.getDerivedStateFromProps==null&&g!==E&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(g,A),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(g,u.__s,A)===!1){t.__v!=n.__v&&(u.props=g,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(Q){Q&&(Q.__=t)}),at.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&i.push(u),a=ye(n);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(g,u.__s,A),O&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(E,M,_)})}if(u.context=A,u.props=g,u.__P=e,u.__e=!1,F=P.__r,W=0,O)u.state=u.__s,u.__d=!1,F&&F(t),f=u.render(u.props,u.state,u.context),at.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,F&&F(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++W<25);u.state=u.__s,u.getChildContext!=null&&(r=se(se({},r),u.getChildContext())),O&&!p&&u.getSnapshotBeforeUpdate!=null&&(_=u.getSnapshotBeforeUpdate(E,M)),q=f!=null&&f.type===Z&&f.key==null?Gn(f.props.children):f,a=Wn(e,ut(q)?q:[q],t,n,r,s,o,i,a,c,l),u.base=t.__e,t.__u&=-161,u.__h.length&&i.push(u),b&&(u.__E=u.__=null)}catch(Q){if(i.length=v,t.__v=null,c||o!=null){if(Q.then){for(t.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o!=null&&(o[o.indexOf(a)]=null),t.__e=a}else if(o!=null)for(X=o.length;X--;)Vt(o[X])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),Q.then||Hn(t),P.__e(Q,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=js(n.__e,t,n,r,s,o,i,c,l);return(f=P.diffed)&&f(t),128&t.__u?void 0:a}function Hn(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Hn))}function Kn(e,t,n){for(var r=0;r<n.length;r++)Ft(n[r],n[++r],n[++r]);P.__c&&P.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(o){o.call(s)})}catch(o){P.__e(o,s.__v)}})}function Gn(e){return typeof e!="object"||e==null||e.__b>0?e:ut(e)?e.map(Gn):e.constructor!==void 0?null:se({},e)}function js(e,t,n,r,s,o,i,a,c){var l,f,v,u,p,E,M,_=n.props||it,{props:b,type:g}=t;if(g=="svg"?s="http://www.w3.org/2000/svg":g=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((p=o[l])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(b);e=document.createElementNS(s,g,b.is&&b),a&&(P.__m&&P.__m(t,o),a=!1),o=null}if(g==null)_===b||a&&e.data==b||(e.data=b);else{if(o=g=="textarea"&&b.defaultValue!=null?null:o&&lt.call(e.childNodes),!a&&o!=null)for(_={},l=0;l<e.attributes.length;l++)_[(p=e.attributes[l]).name]=p.value;for(l in _)p=_[l],l=="dangerouslySetInnerHTML"?v=p:l=="children"||(l in b)||l=="value"&&("defaultValue"in b)||l=="checked"&&("defaultChecked"in b)||nt(e,l,null,p,s);for(l in b)p=b[l],l=="children"?u=p:l=="dangerouslySetInnerHTML"?f=p:l=="value"?E=p:l=="checked"?M=p:a&&typeof p!="function"||_[l]===p||nt(e,l,p,_[l],s);if(f)a||v&&(f.__html==v.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(v&&(e.innerHTML=""),Wn(t.type=="template"?e.content:e,ut(u)?u:[u],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":s,o,i,o?o[0]:n.__k&&ye(n,0),a,c),o!=null)for(l=o.length;l--;)Vt(o[l]);a&&g!="textarea"||(l="value",g=="progress"&&E==null?e.removeAttribute("value"):E!=null&&(E!==e[l]||g=="progress"&&!E||g=="option"&&E!=_[l])&&nt(e,l,E,_[l],s),l="checked",M!=null&&M!=e[l]&&nt(e,l,M,_[l],s))}return e}function Ft(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){P.__e(s,n)}}function Xn(e,t,n){var r,s;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ft(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){P.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&Xn(r[s],t,n||typeof e.type!="function");n||Vt(e.__e),e.__c=e.__=e.__e=void 0}function $s(e,t,n){return this.constructor(e,n)}function Yn(e,t,n){var r,s,o,i;t==document&&(t=document.documentElement),P.__&&P.__(e,t),s=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],i=[],Ut(t,e=(!r&&n||t).__k=Is(Z,null,[e]),s||it,it,t.namespaceURI,!r&&n?[n]:s?null:t.firstChild?lt.call(t.childNodes):null,o,!r&&n?n:s?s.__e:t.firstChild,r,i),Kn(o,e,i),e.props.children=null}lt=at.slice,P={__e:function(e,t,n,r){for(var s,o,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),i=s.__d),i)return s.__E=s}catch(a){e=a}throw e}},Vn=0,As=function(e){return e!=null&&e.constructor===void 0},ot.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=se({},this.state),typeof e=="function"&&(e=e(se({},n),this.props)),e&&se(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),jn(this))},ot.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),jn(this))},ot.prototype.render=Z,fe=[],Un=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fn=function(e,t){return e.__v.__b-t.__v.__b},ct.__r=0,Lt=Math.random().toString(8),rt="__d"+Lt,Ne="__a"+Lt,Bn=/(PointerCapture)$|Capture$/i,Dt=0,jt=Dn(!1),$t=Dn(!0),Os=0;async function Jn(e){let t=Vs(e);return crypto.subtle.importKey("raw",t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Bt(e,t){let n=crypto.getRandomValues(new Uint8Array(12)),r=new TextEncoder().encode(t),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,r),o=new Uint8Array(n.byteLength+s.byteLength);return o.set(n,0),o.set(new Uint8Array(s),n.byteLength),Ds(o)}async function zt(e,t){let n=Qn(t);if(n.byteLength<28)throw Error("Ciphertext too short");let r=n.subarray(0,12),s=n.subarray(12),o=await crypto.subtle.decrypt({name:"AES-GCM",iv:r},e,s);return new TextDecoder().decode(o)}function Ds(e){let t="",n=32768;for(let r=0;r<e.byteLength;r+=n)t+=String.fromCharCode.apply(null,Array.from(e.subarray(r,r+n)));return btoa(t)}function Qn(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Vs(e){let t=e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4);return Qn(t)}var R;(function(e){e.assertEqual=(s)=>{};function t(s){}e.assertIs=t;function n(s){throw Error()}e.assertNever=n,e.arrayToEnum=(s)=>{let o={};for(let i of s)o[i]=i;return o},e.getValidEnumValues=(s)=>{let o=e.objectKeys(s).filter((a)=>typeof s[s[a]]!=="number"),i={};for(let a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=(s)=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys==="function"?(s)=>Object.keys(s):(s)=>{let o=[];for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i))o.push(i);return o},e.find=(s,o)=>{for(let i of s)if(o(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(s)=>Number.isInteger(s):(s)=>typeof s==="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map((i)=>typeof i==="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>{if(typeof o==="bigint")return o.toString();return o}})(R||(R={}));var Zn;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Zn||(Zn={}));var m=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oe=(e)=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(e)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":if(Array.isArray(e))return m.array;if(e===null)return m.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return m.promise;if(typeof Map<"u"&&e instanceof Map)return m.map;if(typeof Set<"u"&&e instanceof Set)return m.set;if(typeof Date<"u"&&e instanceof Date)return m.date;return m.object;default:return m.unknown}};var d=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class G extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(n)=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},n={_errors:[]},r=(s)=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let i=n,a=0;while(a<o.path.length){let c=o.path[a];if(a!==o.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o));i=i[c],a++}}};return r(this),n}static assert(e){if(!(e instanceof G))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];t[s]=t[s]||[],t[s].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}G.create=(e)=>new G(e);var Us=(e,t)=>{let n;switch(e.code){case d.invalid_type:if(e.received===m.undefined)n="Required";else n=`Expected ${e.expected}, received ${e.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,R.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${R.joinValues(e.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${R.joinValues(e.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${R.joinValues(e.options)}, received '${e.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")n=`${n} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)n=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)n=`Invalid input: must end with "${e.validation.endsWith}"`;else R.assertNever(e.validation);else if(e.validation!=="regex")n=`Invalid ${e.validation}`;else n="Invalid";break;case d.too_small:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else n="Invalid input";break;case d.too_big:if(e.type==="array")n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else n="Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=t.defaultError,R.assertNever(e)}return{message:n}},he=Us;var Fs=he;function Me(){return Fs}var dt=(e)=>{let{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=r.filter((l)=>!!l).slice().reverse();for(let l of c)a=l(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}};function h(e,t){let n=Me(),r=dt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===he?void 0:he].filter((s)=>!!s)});e.common.issues.push(r)}class B{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return w;if(r.status==="dirty")e.dirty();n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let s=await r.key,o=await r.value;n.push({key:s,value:o})}return B.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:s,value:o}=r;if(s.status==="aborted")return w;if(o.status==="aborted")return w;if(s.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet))n[s.value]=o.value}return{status:e.value,value:n}}}var w=Object.freeze({status:"aborted"}),ke=(e)=>({status:"dirty",value:e}),z=(e)=>({status:"valid",value:e}),Wt=(e)=>e.status==="aborted",qt=(e)=>e.status==="dirty",xe=(e)=>e.status==="valid",Le=(e)=>typeof Promise<"u"&&e instanceof Promise;var x;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(x||(x={}));class J{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var er=(e,t)=>{if(xe(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new G(e.common.issues);return this._error=n,this._error}}}};function C(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:s};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??r??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??n??a.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return oe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new B,ctx:{common:e.parent.common,data:e.data,parsedType:oe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Le(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)},r=this._parseSync({data:e,path:n.path,parent:n});return er(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return xe(n)?{value:n.value}:{issues:t.common.issues}}catch(n){if(n?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((n)=>xe(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await(Le(r)?r:Promise.resolve(r));return er(n,s)}refine(e,t){let n=(r)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(r);else return t};return this._refinement((r,s)=>{let o=e(r),i=()=>s.addIssue({code:d.custom,...n(r)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((a)=>{if(!a)return i(),!1;else return!0});if(!o)return i(),!1;else return!0})}refinement(e,t){return this._refinement((n,r)=>{if(!e(n))return r.addIssue(typeof t==="function"?t(n,r):t),!1;else return!0})}_refinement(e){return new ne({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return te.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this)}promise(){return Ee.create(this,this._def)}or(e){return Ue.create([this,e],this._def)}and(e){return Fe.create(this,e,this._def)}transform(e){return new ne({...C(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new qe({...C(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new Xt({typeName:S.ZodBranded,type:this,...C(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new He({...C(this._def),innerType:this,catchValue:t,typeName:S.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return yt.create(this,e)}readonly(){return Ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var Bs=/^c[^\s-]{8,}$/i,zs=/^[0-9a-z]+$/,Ws=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hs=/^[a-z0-9_-]{21}$/i,Ks=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gs=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Xs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ys="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ht,Js=/^(?:(?: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])$/,Qs=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Zs=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,eo=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,to=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,no=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tr="((\\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])))",ro=new RegExp(`^${tr}$`);function nr(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function so(e){return new RegExp(`^${nr(e)}$`)}function oo(e){let t=`${tr}T${nr(e)}`,n=[];if(n.push(e.local?"Z?":"Z"),e.offset)n.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function io(e,t){if((t==="v4"||!t)&&Js.test(e))return!0;if((t==="v6"||!t)&&Zs.test(e))return!0;return!1}function ao(e,t){if(!Ks.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));if(typeof s!=="object"||s===null)return!1;if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&s.alg!==t)return!1;return!0}catch{return!1}}function co(e,t){if((t==="v4"||!t)&&Qs.test(e))return!0;if((t==="v6"||!t)&&eo.test(e))return!0;return!1}class ae extends T{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==m.string){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.string,received:s.parsedType}),w}let n=new B,r=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.length<s.value)r=this._getOrReturnCtx(e,r),h(r,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="max"){if(e.data.length>s.value)r=this._getOrReturnCtx(e,r),h(r,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;if(o||i){if(r=this._getOrReturnCtx(e,r),o)h(r,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});else if(i)h(r,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});n.dirty()}}else if(s.kind==="email"){if(!Xs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"email",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="emoji"){if(!Ht)Ht=new RegExp(Ys,"u");if(!Ht.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"emoji",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="uuid"){if(!qs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"uuid",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="nanoid"){if(!Hs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"nanoid",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="cuid"){if(!Bs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="cuid2"){if(!zs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid2",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="ulid"){if(!Ws.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"ulid",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),h(r,{validation:"url",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="regex"){if(s.regex.lastIndex=0,!s.regex.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"regex",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="trim")e.data=e.data.trim();else if(s.kind==="includes"){if(!e.data.includes(s.value,s.position))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()}else if(s.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(s.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(s.kind==="startsWith"){if(!e.data.startsWith(s.value))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()}else if(s.kind==="endsWith"){if(!e.data.endsWith(s.value))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()}else if(s.kind==="datetime"){if(!oo(s).test(e.data))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"datetime",message:s.message}),n.dirty()}else if(s.kind==="date"){if(!ro.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"date",message:s.message}),n.dirty()}else if(s.kind==="time"){if(!so(s).test(e.data))r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"time",message:s.message}),n.dirty()}else if(s.kind==="duration"){if(!Gs.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"duration",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="ip"){if(!io(e.data,s.version))r=this._getOrReturnCtx(e,r),h(r,{validation:"ip",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="jwt"){if(!ao(e.data,s.alg))r=this._getOrReturnCtx(e,r),h(r,{validation:"jwt",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="cidr"){if(!co(e.data,s.version))r=this._getOrReturnCtx(e,r),h(r,{validation:"cidr",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="base64"){if(!to.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"base64",code:d.invalid_string,message:s.message}),n.dirty()}else if(s.kind==="base64url"){if(!no.test(e.data))r=this._getOrReturnCtx(e,r),h(r,{validation:"base64url",code:d.invalid_string,message:s.message}),n.dirty()}else R.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement((r)=>e.test(r),{validation:t,code:d.invalid_string,...x.errToObj(n)})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...x.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...x.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...x.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new ae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ae({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}ae.create=(e)=>new ae({checks:[],typeName:S.ZodString,coerce:e?.coerce??!1,...C(e)});function lo(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}class Ce extends T{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==m.number){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.number,received:s.parsedType}),w}let n=void 0,r=new B;for(let s of this._def.checks)if(s.kind==="int"){if(!R.isInteger(e.data))n=this._getOrReturnCtx(e,n),h(n,{code:d.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()}else if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="multipleOf"){if(lo(e.data,s.value)!==0)n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()}else if(s.kind==="finite"){if(!Number.isFinite(e.data))n=this._getOrReturnCtx(e,n),h(n,{code:d.not_finite,message:s.message}),r.dirty()}else R.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new Ce({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new Ce({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;else if(n.kind==="min"){if(t===null||n.value>t)t=n.value}else if(n.kind==="max"){if(e===null||n.value<e)e=n.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ce.create=(e)=>new Ce({checks:[],typeName:S.ZodNumber,coerce:e?.coerce||!1,...C(e)});class Te extends T{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n=void 0,r=new B;for(let s of this._def.checks)if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()}else if(s.kind==="multipleOf"){if(e.data%s.value!==BigInt(0))n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()}else R.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),w}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Te.create=(e)=>new Te({checks:[],typeName:S.ZodBigInt,coerce:e?.coerce??!1,...C(e)});class ft extends T{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),w}return z(e.data)}}ft.create=(e)=>new ft({typeName:S.ZodBoolean,coerce:e?.coerce||!1,...C(e)});class $e extends T{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==m.date){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.date,received:s.parsedType}),w}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_date}),w}let n=new B,r=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.getTime()<s.value)r=this._getOrReturnCtx(e,r),h(r,{code:d.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()}else if(s.kind==="max"){if(e.data.getTime()>s.value)r=this._getOrReturnCtx(e,r),h(r,{code:d.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()}else R.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $e({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}$e.create=(e)=>new $e({checks:[],coerce:e?.coerce||!1,typeName:S.ZodDate,...C(e)});class ht extends T{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),w}return z(e.data)}}ht.create=(e)=>new ht({typeName:S.ZodSymbol,...C(e)});class De extends T{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),w}return z(e.data)}}De.create=(e)=>new De({typeName:S.ZodUndefined,...C(e)});class Ve extends T{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),w}return z(e.data)}}Ve.create=(e)=>new Ve({typeName:S.ZodNull,...C(e)});class pt extends T{constructor(){super(...arguments);this._any=!0}_parse(e){return z(e.data)}}pt.create=(e)=>new pt({typeName:S.ZodAny,...C(e)});class be extends T{constructor(){super(...arguments);this._unknown=!0}_parse(e){return z(e.data)}}be.create=(e)=>new be({typeName:S.ZodUnknown,...C(e)});class ce extends T{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),w}}ce.create=(e)=>new ce({typeName:S.ZodNever,...C(e)});class mt extends T{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),w}return z(e.data)}}mt.create=(e)=>new mt({typeName:S.ZodVoid,...C(e)});class ee extends T{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return h(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),w;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;if(o||i)h(t,{code:o?d.too_big:d.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty()}if(r.minLength!==null){if(t.data.length<r.minLength.value)h(t,{code:d.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()}if(r.maxLength!==null){if(t.data.length>r.maxLength.value)h(t,{code:d.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,i)=>r.type._parseAsync(new J(t,o,t.path,i)))).then((o)=>B.mergeArray(n,o));let s=[...t.data].map((o,i)=>r.type._parseSync(new J(t,o,t.path,i)));return B.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new ee({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new ee({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new ee({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}ee.create=(e,t)=>new ee({type:e,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...C(t)});function Se(e){if(e instanceof D){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=te.create(Se(r))}return new D({...e._def,shape:()=>t})}else if(e instanceof ee)return new ee({...e._def,type:Se(e.element)});else if(e instanceof te)return te.create(Se(e.unwrap()));else if(e instanceof pe)return pe.create(Se(e.unwrap()));else if(e instanceof le)return le.create(e.items.map((t)=>Se(t)));else return e}class D extends T{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=R.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){let c=this._getOrReturnCtx(e);return h(c,{code:d.invalid_type,expected:m.object,received:c.parsedType}),w}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof ce&&this._def.unknownKeys==="strip")){for(let c in r.data)if(!o.includes(c))i.push(c)}let a=[];for(let c of o){let l=s[c],f=r.data[c];a.push({key:{status:"valid",value:c},value:l._parse(new J(r,f,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof ce){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of i)a.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(c==="strict"){if(i.length>0)h(r,{code:d.unrecognized_keys,keys:i}),n.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of i){let f=r.data[l];a.push({key:{status:"valid",value:l},value:c._parse(new J(r,f,r.path,l)),alwaysSet:l in r.data})}}if(r.common.async)return Promise.resolve().then(async()=>{let c=[];for(let l of a){let f=await l.key,v=await l.value;c.push({key:f,value:v,alwaysSet:l.alwaysSet})}return c}).then((c)=>B.mergeObjectSync(n,c));else return B.mergeObjectSync(n,a)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new D({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;if(t.code==="unrecognized_keys")return{message:x.errToObj(e).message??r};return{message:r}}}:{}})}strip(){return new D({...this._def,unknownKeys:"strip"})}passthrough(){return new D({...this._def,unknownKeys:"passthrough"})}extend(e){return new D({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new D({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new D({...this._def,catchall:e})}pick(e){let t={};for(let n of R.objectKeys(e))if(e[n]&&this.shape[n])t[n]=this.shape[n];return new D({...this._def,shape:()=>t})}omit(e){let t={};for(let n of R.objectKeys(this.shape))if(!e[n])t[n]=this.shape[n];return new D({...this._def,shape:()=>t})}deepPartial(){return Se(this)}partial(e){let t={};for(let n of R.objectKeys(this.shape)){let r=this.shape[n];if(e&&!e[n])t[n]=r;else t[n]=r.optional()}return new D({...this._def,shape:()=>t})}required(e){let t={};for(let n of R.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];while(s instanceof te)s=s._def.innerType;t[n]=s}return new D({...this._def,shape:()=>t})}keyof(){return rr(R.objectKeys(this.shape))}}D.create=(e,t)=>new D({shape:()=>e,unknownKeys:"strip",catchall:ce.create(),typeName:S.ZodObject,...C(t)});D.strictCreate=(e,t)=>new D({shape:()=>e,unknownKeys:"strict",catchall:ce.create(),typeName:S.ZodObject,...C(t)});D.lazycreate=(e,t)=>new D({shape:e,unknownKeys:"strip",catchall:ce.create(),typeName:S.ZodObject,...C(t)});class Ue extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map((i)=>new G(i.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:o}),w}if(t.common.async)return Promise.all(n.map(async(s)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);else{let s=void 0,o=[];for(let a of n){let c={...t,common:{...t.common,issues:[]},parent:null},l=a._parseSync({data:t.data,path:t.path,parent:c});if(l.status==="valid")return l;else if(l.status==="dirty"&&!s)s={result:l,ctx:c};if(c.common.issues.length)o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map((a)=>new G(a));return h(t,{code:d.invalid_union,unionErrors:i}),w}}get options(){return this._def.options}}Ue.create=(e,t)=>new Ue({options:e,typeName:S.ZodUnion,...C(t)});var ie=(e)=>{if(e instanceof Be)return ie(e.schema);else if(e instanceof ne)return ie(e.innerType());else if(e instanceof ze)return[e.value];else if(e instanceof we)return e.options;else if(e instanceof We)return R.objectValues(e.enum);else if(e instanceof qe)return ie(e._def.innerType);else if(e instanceof De)return[void 0];else if(e instanceof Ve)return[null];else if(e instanceof te)return[void 0,...ie(e.unwrap())];else if(e instanceof pe)return[null,...ie(e.unwrap())];else if(e instanceof Xt)return ie(e.unwrap());else if(e instanceof Ke)return ie(e.unwrap());else if(e instanceof He)return ie(e._def.innerType);else return[]};class Gt extends T{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:d.invalid_type,expected:m.object,received:t.parsedType}),w;let n=this.discriminator,r=t.data[n],s=this.optionsMap.get(r);if(!s)return h(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w;if(t.common.async)return s._parseAsync({data:t.data,path:t.path,parent:t});else return s._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let s of t){let o=ie(s.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,s)}}return new Gt({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...C(n)})}}function Kt(e,t){let n=oe(e),r=oe(t);if(e===t)return{valid:!0,data:e};else if(n===m.object&&r===m.object){let s=R.objectKeys(t),o=R.objectKeys(e).filter((a)=>s.indexOf(a)!==-1),i={...e,...t};for(let a of o){let c=Kt(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===m.array&&r===m.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=t[o],c=Kt(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else if(n===m.date&&r===m.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Fe extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(s,o)=>{if(Wt(s)||Wt(o))return w;let i=Kt(s.value,o.value);if(!i.valid)return h(n,{code:d.invalid_intersection_types}),w;if(qt(s)||qt(o))t.dirty();return{status:t.value,value:i.data}};if(n.common.async)return Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>r(s,o));else return r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Fe.create=(e,t,n)=>new Fe({left:e,right:t,typeName:S.ZodIntersection,...C(n)});class le extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return h(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;if(!this._def.rest&&n.data.length>this._def.items.length)h(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let s=[...n.data].map((o,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new J(n,o,n.path,i))}).filter((o)=>!!o);if(n.common.async)return Promise.all(s).then((o)=>B.mergeArray(t,o));else return B.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new le({...this._def,rest:e})}}le.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new le({items:e,typeName:S.ZodTuple,rest:null,...C(t)})};class _t extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),w;let r=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)r.push({key:s._parse(new J(n,i,n.path,i)),value:o._parse(new J(n,n.data[i],n.path,i)),alwaysSet:i in n.data});if(n.common.async)return B.mergeObjectAsync(t,r);else return B.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){if(t instanceof T)return new _t({keyType:e,valueType:t,typeName:S.ZodRecord,...C(n)});return new _t({keyType:ae.create(),valueType:e,typeName:S.ZodRecord,...C(t)})}}class gt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),w;let r=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,a],c)=>({key:r._parse(new J(n,i,n.path,[c,"key"])),value:s._parse(new J(n,a,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of o){let c=await a.key,l=await a.value;if(c.status==="aborted"||l.status==="aborted")return w;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of o){let{key:c,value:l}=a;if(c.status==="aborted"||l.status==="aborted")return w;if(c.status==="dirty"||l.status==="dirty")t.dirty();i.set(c.value,l.value)}return{status:t.value,value:i}}}}gt.create=(e,t,n)=>new gt({valueType:t,keyType:e,typeName:S.ZodMap,...C(n)});class Re extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),w;let r=this._def;if(r.minSize!==null){if(n.data.size<r.minSize.value)h(n,{code:d.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()}if(r.maxSize!==null){if(n.data.size>r.maxSize.value)h(n,{code:d.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty()}let s=this._def.valueType;function o(a){let c=new Set;for(let l of a){if(l.status==="aborted")return w;if(l.status==="dirty")t.dirty();c.add(l.value)}return{status:t.value,value:c}}let i=[...n.data.values()].map((a,c)=>s._parse(new J(n,a,n.path,c)));if(n.common.async)return Promise.all(i).then((a)=>o(a));else return o(i)}min(e,t){return new Re({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new Re({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Re.create=(e,t)=>new Re({valueType:e,minSize:null,maxSize:null,typeName:S.ZodSet,...C(t)});class je extends T{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),w;function n(i,a){return dt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Me(),he].filter((c)=>!!c),issueData:{code:d.invalid_arguments,argumentsError:a}})}function r(i,a){return dt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Me(),he].filter((c)=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:a}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Ee){let i=this;return z(async function(...a){let c=new G([]),l=await i._def.args.parseAsync(a,s).catch((u)=>{throw c.addIssue(n(a,u)),c}),f=await Reflect.apply(o,this,l);return await i._def.returns._def.type.parseAsync(f,s).catch((u)=>{throw c.addIssue(r(f,u)),c})})}else{let i=this;return z(function(...a){let c=i._def.args.safeParse(a,s);if(!c.success)throw new G([n(a,c.error)]);let l=Reflect.apply(o,this,c.data),f=i._def.returns.safeParse(l,s);if(!f.success)throw new G([r(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new je({...this._def,args:le.create(e).rest(be.create())})}returns(e){return new je({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new je({args:e?e:le.create([]).rest(be.create()),returns:t||be.create(),typeName:S.ZodFunction,...C(n)})}}class Be extends T{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Be.create=(e,t)=>new Be({getter:e,typeName:S.ZodLazy,...C(t)});class ze extends T{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}ze.create=(e,t)=>new ze({value:e,typeName:S.ZodLiteral,...C(t)});function rr(e,t){return new we({values:e,typeName:S.ZodEnum,...C(t)})}class we extends T{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:R.joinValues(n),received:t.parsedType,code:d.invalid_type}),w}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:n}),w}return z(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return we.create(e,{...this._def,...t})}exclude(e,t=this._def){return we.create(this.options.filter((n)=>!e.includes(n)),{...this._def,...t})}}we.create=rr;class We extends T{_parse(e){let t=R.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let r=R.objectValues(t);return h(n,{expected:R.joinValues(r),received:n.parsedType,code:d.invalid_type}),w}if(!this._cache)this._cache=new Set(R.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let r=R.objectValues(t);return h(n,{received:n.data,code:d.invalid_enum_value,options:r}),w}return z(e.data)}get enum(){return this._def.values}}We.create=(e,t)=>new We({values:e,typeName:S.ZodNativeEnum,...C(t)});class Ee extends T{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),w;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return z(n.then((r)=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ee.create=(e,t)=>new Ee({type:e,typeName:S.ZodPromise,...C(t)});class ne extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:(o)=>{if(h(n,o),o.fatal)t.abort();else t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async(i)=>{if(t.value==="aborted")return w;let a=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});if(a.status==="aborted")return w;if(a.status==="dirty")return ke(a.value);if(t.value==="dirty")return ke(a.value);return a});else{if(t.value==="aborted")return w;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});if(i.status==="aborted")return w;if(i.status==="dirty")return ke(i.value);if(t.value==="dirty")return ke(i.value);return i}}if(r.type==="refinement"){let o=(i)=>{let a=r.refinement(i,s);if(n.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(i.status==="aborted")return w;if(i.status==="dirty")t.dirty();return o(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((i)=>{if(i.status==="aborted")return w;if(i.status==="dirty")t.dirty();return o(i.value).then(()=>({status:t.value,value:i.value}))})}if(r.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xe(o))return w;let i=r.transform(o.value,s);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((o)=>{if(!xe(o))return w;return Promise.resolve(r.transform(o.value,s)).then((i)=>({status:t.value,value:i}))});R.assertNever(r)}}ne.create=(e,t,n)=>new ne({schema:e,typeName:S.ZodEffects,effect:t,...C(n)});ne.createWithPreprocess=(e,t,n)=>new ne({schema:t,effect:{type:"preprocess",transform:e},typeName:S.ZodEffects,...C(n)});class te extends T{_parse(e){if(this._getType(e)===m.undefined)return z(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(e,t)=>new te({innerType:e,typeName:S.ZodOptional,...C(t)});class pe extends T{_parse(e){if(this._getType(e)===m.null)return z(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:S.ZodNullable,...C(t)});class qe extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;if(t.parsedType===m.undefined)n=this._def.defaultValue();return this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}qe.create=(e,t)=>new qe({innerType:e,typeName:S.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...C(t)});class He extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});if(Le(r))return r.then((s)=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new G(n.common.issues)},input:n.data})}));else return{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new G(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:S.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...C(t)});class vt extends T{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),w}return{status:"valid",value:e.data}}}vt.create=(e)=>new vt({typeName:S.ZodNaN,...C(e)});var la=Symbol("zod_brand");class Xt extends T{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class yt extends T{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});if(s.status==="aborted")return w;if(s.status==="dirty")return t.dirty(),ke(s.value);else return this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();else{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});if(r.status==="aborted")return w;if(r.status==="dirty")return t.dirty(),{status:"dirty",value:r.value};else return this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new yt({in:e,out:t,typeName:S.ZodPipeline})}}class Ke extends T{_parse(e){let t=this._def.innerType._parse(e),n=(r)=>{if(xe(r))r.value=Object.freeze(r.value);return r};return Le(t)?t.then((r)=>n(r)):n(t)}unwrap(){return this._def.innerType}}Ke.create=(e,t)=>new Ke({innerType:e,typeName:S.ZodReadonly,...C(t)});var ua={object:D.lazycreate},S;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(S||(S={}));var I=ae.create,Ae=Ce.create,da=vt.create,fa=Te.create,ue=ft.create,ha=$e.create,pa=ht.create,ma=De.create,_a=Ve.create,ga=pt.create,va=be.create,ya=ce.create,xa=mt.create,de=ee.create,{create:N,strictCreate:ba}=D,wa=Ue.create,uo=Gt.create,ka=Fe.create,Sa=le.create,Ca=_t.create,Ta=gt.create,Ra=Re.create,Ea=je.create,Aa=Be.create,sr=ze.create,Yt=we.create,Oa=We.create,Pa=Ee.create,Ia=ne.create,Na=te.create,Ma=pe.create,La=ne.createWithPreprocess,ja=yt.create;var Jt=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;function fo(e){let t;try{t=new URL(e)}catch{return!1}if(t.protocol!=="http:"&&t.protocol!=="https:")return!1;return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]"||t.hostname.endsWith(".localhost")}var me=I().max(500),xt=4000,Qt=1000,bt=1000,ho=N({label:me,file:I().max(Qt),line:Ae().int().positive(),column:Ae().int().nonnegative()}),Oe=N({url:I().min(1).max(2000),selector:I().max(2000),role:me.optional(),name:me.optional(),text:me.optional(),components:de(I().max(200)).max(20).optional(),sources:de(ho).max(10).optional(),context:me.optional(),browser:N({name:me,viewport:N({width:Ae().int().nonnegative(),height:Ae().int().nonnegative(),scale:Ae().positive()}),colorScheme:Yt(["light","dark"])}).optional(),style:I().max(bt).optional(),html:I().max(xt).optional(),quote:N({exact:I().min(1).max(2000),before:me,after:me}).optional()}),Zt=Yt(["user","agent"]),po=N({id:I(),author:Zt,body:I().min(1).max(20000),createdAt:I()}),en=Yt(["open","queued","working","resolved"]),Xe=N({id:I(),anchor:Oe,state:en,comments:de(po).min(1),screenshot:I().optional(),createdAt:I(),updatedAt:I()}),Fa=N({threads:de(Xe)}),tn=I().trim().min(1).max(20000),or="data:image/png;base64,",mo=I().startsWith(or).max(8000000).transform((e)=>Uint8Array.from(atob(e.slice(or.length)),(t)=>t.charCodeAt(0))),Ba=N({anchor:Oe,body:tn,send:ue(),screenshot:mo.optional()}),za=N({body:tn,send:ue()}),Wa=N({body:tn,resolve:ue()}),ir=I().url().refine((e)=>fo(e),"must be an http(s) URL on localhost"),qa=N({target:ir}),Ha=N({target:ir,port:Ae().int().min(1).max(65535)});var ar=/^[a-f0-9]{24}$/,nn="agent-canvas-review",_o=5;var go=200,cr=160000,wt=110000,lr=11000000;function _e(e){return I().min(1).max(e).regex(/^[A-Za-z0-9+/]+={0,2}$/,"must be base64 ciphertext")}var vo=I().refine((e)=>{let t;try{t=new URL(e)}catch{return!1}if(t.origin!==e)return!1;if(t.protocol==="https:")return!0;return t.protocol==="http:"&&(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname.endsWith(".localhost"))},"must be an origin such as https://app.example.com"),yo=N({id:I().max(64),author:Zt,body:_e(wt),createdAt:I().max(64)}),rn=N({id:I().max(64),anchor:_e(cr),state:en,comments:de(yo).min(1).max(go),screenshot:ue(),createdAt:I().max(64),updatedAt:I().max(64)}),ur=N({threads:de(rn)}),Ya=N({origins:de(vo).min(1).max(_o)}),Ja=N({projectId:I().regex(ar),agentToken:I().min(32)}),Qa=N({anchor:_e(cr),body:_e(wt),send:ue(),screenshot:_e(lr).optional()}),Za=N({body:_e(wt),send:ue()}),ec=N({body:_e(wt),resolve:ue()}),tc=N({screenshot:_e(lr)}),dr="ping";var xo=/^[A-Za-z0-9_-]{43}$/;function fr(e){return`${e.projectId}.${e.key}`}function sn(e){let[t,n,...r]=e.split(".");if(t===void 0||n===void 0||r.length>0)return null;if(!ar.test(t)||!xo.test(n))return null;return{projectId:t,key:n}}var hr=N({threads:de(Xe)});function pr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function bo(e){if(typeof e!=="string")return;let t;try{t=JSON.parse(e)}catch{return}if(!pr(t))return;if(t.type==="agent-status"&&typeof t.watching==="boolean")return{type:"agent-status",watching:t.watching};if(t.type==="reload"&&typeof t.path==="string")return{type:"reload",path:t.path};if(t.type!=="threads")return;let n=hr.safeParse(t);return n.success?{type:"threads",threads:n.data.threads}:void 0}class on{daemonOrigin;project;offlineLabel="Daemon offline";socket=null;closed=!1;constructor(e,t){this.daemonOrigin=e;this.project=t}connect(e){let t=`${this.daemonOrigin.replace(/^http/,"ws")}/ws/review/${encodeURIComponent(this.project)}`,n=new WebSocket(t);this.socket=n,n.onopen=()=>{e.connected(!0),this.request("GET","/threads").then((r)=>{let s=hr.safeParse(r);if(s.success)e.threads(s.data.threads)})},n.onmessage=(r)=>{let s=bo(r.data);if(s?.type==="threads")e.threads(s.threads);if(s?.type==="agent-status")e.agentWatching(s.watching);if(s?.type==="reload")e.reload(s.path)},n.onclose=()=>{if(e.connected(!1),!this.closed)setTimeout(()=>this.connect(e),2000)}}close(){this.closed=!0,this.socket?.close()}createThread(e,t,n,r){return this.request("POST","/threads",{anchor:e,body:t,send:n,...r===void 0?{}:{screenshot:r}})}comment(e,t,n){return this.request("POST",`/threads/${e}/comments`,{body:t,send:n})}send(e){return this.request("POST",`/threads/${e}/send`)}sendNotes(){return this.request("POST","/notes/send")}setResolved(e,t){return this.request("POST",`/threads/${e}/${t?"resolve":"reopen"}`)}delete(e){return this.request("DELETE",`/threads/${e}`)}async request(e,t,n){let r=await fetch(`${this.daemonOrigin}/api/review/${encodeURIComponent(this.project)}${t}`,{method:e,...n===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}}),s=await r.json();if(!r.ok)throw Error(pr(s)&&typeof s.error==="string"?s.error:`Request failed (${r.status})`);return s}}function mr(e,t){return Bt(e,JSON.stringify(t))}function kt(e,t){return Bt(e,t)}async function _r(e,t,n){let r=JSON.parse(await zt(e,t.anchor)),s=await Promise.all(t.comments.map(async(o)=>({...o,body:await zt(e,o.body)})));return Xe.parse({id:t.id,anchor:Oe.parse(r),state:t.state,comments:s,...n===void 0?{}:{screenshot:n},createdAt:t.createdAt,updatedAt:t.updatedAt})}var wo=30000,ko=uo("type",[N({type:sr("threads"),threads:de(rn)}),N({type:sr("agent-status"),watching:ue()})]),So=N({error:I()});class an{workerOrigin;projectId;key;offlineLabel="Offline";socket=null;keepalive=null;closed=!1;generation=0;constructor(e,t,n){this.workerOrigin=e;this.projectId=t;this.key=n}connect(e){let t=new WebSocket(`${this.workerOrigin.replace(/^http/,"ws")}/review/${this.projectId}/ws`);this.socket=t,t.onopen=()=>{e.connected(!0),this.keepalive=setInterval(()=>t.send(dr),wo),this.request("GET","/threads").then((n)=>this.publish(ur.parse(n).threads,e))},t.onmessage=(n)=>{if(typeof n.data!=="string"||n.data==="pong")return;let r;try{r=JSON.parse(n.data)}catch{return}let s=ko.safeParse(r);if(!s.success)return;if(s.data.type==="threads")this.publish(s.data.threads,e);else e.agentWatching(s.data.watching)},t.onclose=()=>{if(this.keepalive!==null)clearInterval(this.keepalive);if(e.connected(!1),!this.closed)setTimeout(()=>this.connect(e),2000)}}close(){this.closed=!0,this.socket?.close()}async createThread(e,t,n,r){return this.request("POST","/threads",{anchor:await mr(this.key,e),body:await kt(this.key,t),send:n,...r===void 0?{}:{screenshot:await kt(this.key,r)}})}async comment(e,t,n){return this.request("POST",`/threads/${e}/comments`,{body:await kt(this.key,t),send:n})}send(e){return this.request("POST",`/threads/${e}/send`)}sendNotes(){return this.request("POST","/notes/send")}setResolved(e,t){return this.request("POST",`/threads/${e}/${t?"resolve":"reopen"}`)}delete(e){return this.request("DELETE",`/threads/${e}`)}publish(e,t){let n=++this.generation;Promise.allSettled(e.map((r)=>_r(this.key,r))).then((r)=>{if(n!==this.generation)return;let s=[];for(let o of r)if(o.status==="fulfilled")s.push(o.value);else console.warn("agent-canvas review: a thread did not open with this project key");t.threads(s)})}async request(e,t,n){let r=await fetch(`${this.workerOrigin}/review/${this.projectId}${t}`,{method:e,...n===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}}),s=await r.json();if(!r.ok){let o=So.safeParse(s);throw Error(o.success?o.data.error:`Request failed (${r.status})`)}return s}}var gr=`:host {
2
2
  all: initial;
3
3
  --bg: #ffffff;
4
4
  --bg-muted: #f4f4f5;
@@ -387,5 +387,5 @@ textarea:focus {
387
387
  .panel > .error {
388
388
  padding: 0 12px 8px;
389
389
  }
390
- `;var e1,Z,J2,K4,$0=0,b4=[],y=f,F4=y.__b,N4=y.__r,U4=y.diffed,A4=y.__c,w4=y.unmount,D4=y.__;function W2($,Q){y.__h&&y.__h(Z,$,$0||Q),$0=0;var J=Z.__H||(Z.__H={__:[],__h:[]});return $>=J.__.length&&J.__.push({}),J.__[$]}function x($){return $0=1,_$(S4,$)}function _$($,Q,J){var q=W2(e1++,2);if(q.t=$,!q.__c&&(q.__=[J?J(Q):S4(void 0,Q),function(X){var H=q.__N?q.__N[0]:q.__[0],B=q.t(H,X);H!==B&&(q.__N=[B,q.__[1]],q.__c.setState({}))}],q.__c=Z,!Z.__f)){var W=function(X,H,B){if(!q.__c.__H)return!0;var j=!1,A=q.__c.props!==X;if(q.__c.__H.__.some(function(F){if(F.__N){j=!0;var k=F.__[0];F.__=F.__N,F.__N=void 0,k!==F.__[0]&&(A=!0)}}),Y){var z=Y.call(this,X,H,B);return j?z||A:z}return!j||A};Z.__f=!0;var{shouldComponentUpdate:Y,componentWillUpdate:G}=Z;Z.componentWillUpdate=function(X,H,B){if(this.__e){var j=Y;Y=void 0,W(X,H,B),Y=j}G&&G.call(this,X,H,B)},Z.shouldComponentUpdate=W}return q.__N||q.__}function Y1($,Q){var J=W2(e1++,3);!y.__s&&L4(J.__H,Q)&&(J.__=$,J.u=Q,Z.__H.__h.push(J))}function R4($){return $0=5,b0(function(){return{current:$}},[])}function b0($,Q){var J=W2(e1++,7);return L4(J.__H,Q)&&(J.__=$(),J.__H=Q,J.__h=$),J.__}function Q0($,Q){return $0=8,b0(function(){return $},Q)}function M$(){for(var $;$=b4.shift();){var Q=$.__H;if($.__P&&Q)try{Q.__h.some(O0),Q.__h.some(q2),Q.__h=[]}catch(J){Q.__h=[],y.__e(J,$.__v)}}}y.__b=function($){Z=null,F4&&F4($)},y.__=function($,Q){$&&Q.__k&&Q.__k.__m&&($.__m=Q.__k.__m),D4&&D4($,Q)},y.__r=function($){N4&&N4($),e1=0;var Q=(Z=$.__c).__H;Q&&(J2===Z?(Q.__h=[],Z.__h=[],Q.__.some(function(J){J.__N&&(J.__=J.__N),J.u=J.__N=void 0})):(Q.__h.some(O0),Q.__h.some(q2),Q.__h=[],e1=0)),J2=Z},y.diffed=function($){U4&&U4($);var Q=$.__c;Q&&Q.__H&&(Q.__H.__h.length&&(b4.push(Q)!==1&&K4===y.requestAnimationFrame||((K4=y.requestAnimationFrame)||j$)(M$)),Q.__H.__.some(function(J){J.u&&(J.__H=J.u,J.u=void 0)})),J2=Z=null},y.__c=function($,Q){Q.some(function(J){try{J.__h.some(O0),J.__h=J.__h.filter(function(q){return!q.__||q2(q)})}catch(q){Q.some(function(W){W.__h&&(W.__h=[])}),Q=[],y.__e(q,J.__v)}}),A4&&A4($,Q)},y.unmount=function($){w4&&w4($);var Q,J=$.__c;J&&J.__H&&(J.__H.__.some(function(q){try{O0(q)}catch(W){Q=W}}),J.__H=void 0,Q&&y.__e(Q,J.__v))};var O4=typeof requestAnimationFrame=="function";function j$($){var Q,J=function(){clearTimeout(q),O4&&cancelAnimationFrame(Q),setTimeout($)},q=setTimeout(J,35);O4&&(Q=requestAnimationFrame(J))}function O0($){var Q=Z,J=$.__c;typeof J=="function"&&($.__c=void 0,J()),Z=Q}function q2($){var Q=Z;$.__c=$.__(),Z=Q}function L4($,Q){return!$||$.length!==Q.length||Q.some(function(J,q){return J!==$[q]})}function S4($,Q){return typeof Q=="function"?Q($):Q}function v4($){return $.state==="open"&&$.comments.at(-1)?.author==="user"}var V$=[["Edge",/\bEdg(?:e|A|iOS)?\/(\d+)/],["Opera",/\bOPR\/(\d+)/],["Firefox",/\b(?:Firefox|FxiOS)\/(\d+)/],["Chrome",/\b(?:Chrome|CriOS)\/(\d+)/],["Safari",/\bVersion\/(\d+)[^ ]* (?:Mobile\/\S+ )?Safari\//]],K$=[["Android",/\bAndroid\b/],["iOS",/\b(?:iPhone|iPad|iPod)\b/],["Windows",/\bWindows\b/],["macOS",/\bMac OS X\b/],["Linux",/\bLinux\b/]];function F$($){let Q;for(let[W,Y]of V$){let G=Y.exec($)?.[1];if(G!==void 0){Q=`${W} ${G}`;break}}let J=K$.find(([,W])=>W.test($))?.[0],q=[Q,J].filter((W)=>W!==void 0);return q.length===0?$.slice(0,100):q.join(" · ")}function E4($){return{name:F$($.navigator.userAgent),viewport:{width:$.innerWidth,height:$.innerHeight,scale:$.devicePixelRatio},colorScheme:$.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}var Y2=8,k4=80,N$=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function P4($,Q){if($.tagName.toLowerCase()==="svg"){$.replaceChildren();return}let J=0;for(let q of[...$.childNodes]){if(q.nodeType===Node.TEXT_NODE){let W=q.textContent??"";if(W.trim()==="")q.remove();else if(W.length>k4)q.textContent=`${W.slice(0,k4)}…`;continue}if(!(q instanceof Element)||N$.has(q.tagName)){q.remove();continue}if(J++,Q===0||J>Y2)q.remove();else P4(q,Q-1)}if(Q===0&&J>0)$.append($.ownerDocument.createComment(` ${J} child elements cut `));else if(J>Y2)$.append($.ownerDocument.createComment(` ${J-Y2} more `))}function C4($){for(let J=5;J>=0;J--){let q=$.cloneNode(!0);if(!(q instanceof Element))return"";P4(q,J);let W=q.outerHTML;if(W.length<=U0)return W}let Q=$.cloneNode(!1);return Q instanceof Element?Q.outerHTML.slice(0,U0):""}function U$($){let Q=$.getAttribute("aria-label");if(Q!==null&&Q.trim()!=="")return Q.trim();let J=$.getAttribute("aria-labelledby"),Y=((J===null?null:$.ownerDocument.getElementById(J.split(/\s+/)[0]??""))??$.querySelector('h1, h2, h3, h4, legend, [role="heading"]'))?.textContent?.replace(/\s+/g," ").trim();return Y===void 0||Y===""?void 0:Y.slice(0,80)}var A$=[{selector:'dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]',kind:"Dialog"},{selector:'section, article, fieldset, form, [role="region"], [role="tabpanel"]',kind:"Section"}];function f4($){let Q=[],J=$.ownerDocument.querySelector("h1")?.textContent?.replace(/\s+/g," ").trim();if(J!==void 0&&J!=="")Q.push(`Page "${J.slice(0,80)}"`);for(let q of A$){let W=$.closest(q.selector),Y=W===null?void 0:U$(W);if(Y!==void 0&&!Q.includes(`Page "${Y}"`))Q.push(`${q.kind} "${Y}"`)}return Q.length===0?void 0:Q.join(" › ")}var w$=44;var I4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D$=new Uint8Array(64),g4=new Uint8Array(128);for(let $=0;$<I4.length;$++){let Q=I4.charCodeAt($);D$[$]=Q,g4[Q]=$}function J0($,Q){let J=0,q=0,W=0;do{let G=$.next();W=g4[G],J|=(W&31)<<q,q+=5}while(W&32);let Y=J&1;if(J>>>=1,Y)J=-2147483648|-J;return Q+J}function T4($,Q){if($.pos>=Q)return!1;return $.peek()!==w$}var O$=class{constructor($){this.pos=0,this.buffer=$}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf($){let{buffer:Q,pos:J}=this,q=Q.indexOf($,J);return q===-1?Q.length:q}};function x4($){let{length:Q}=$,J=new O$($),q=[],W=0,Y=0,G=0,X=0,H=0;do{let B=J.indexOf(";"),j=[],A=!0,z=0;W=0;while(J.pos<B){let F;if(W=J0(J,W),W<z)A=!1;if(z=W,T4(J,B))if(Y=J0(J,Y),G=J0(J,G),X=J0(J,X),T4(J,B))H=J0(J,H),F=[W,Y,G,X,H];else F=[W,Y,G,X];else F=[W];j.push(F),J.pos++}if(!A)b$(j);q.push(j),J.pos=B+1}while(J.pos<=Q);return q}function b$($){$.sort(R$)}function R$($,Q){return $[0]-Q[0]}var m4=L8(Z4(),1);function L$($){if(!$)return"";let Q=$.lastIndexOf("/");return $.slice(0,Q+1)}function S$($,Q){let J=L$($),q=Q?Q+"/":"";return(W)=>m4.default(q+(W||""),J)}var U1=0,v$=1,E$=2,k$=3,P$=4;function C$($,Q){let J=y4($,0);if(J===$.length)return $;if(!Q)$=$.slice();for(let q=J;q<$.length;q=y4($,q+1))$[q]=I$($[q],Q);return $}function y4($,Q){for(let J=Q;J<$.length;J++)if(!f$($[J]))return J;return $.length}function f$($){for(let Q=1;Q<$.length;Q++)if($[Q][U1]<$[Q-1][U1])return!1;return!0}function I$($,Q){if(!Q)$=$.slice();return $.sort(T$)}function T$($,Q){return $[U1]-Q[U1]}var L0=!1;function g$($,Q,J,q){while(J<=q){let W=J+(q-J>>1),Y=$[W][U1]-Q;if(Y===0)return L0=!0,W;if(Y<0)J=W+1;else q=W-1}return L0=!1,J-1}function x$($,Q,J){for(let q=J+1;q<$.length;J=q++)if($[q][U1]!==Q)break;return J}function Z$($,Q,J){for(let q=J-1;q>=0;J=q--)if($[q][U1]!==Q)break;return J}function y$(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function h$($,Q,J,q){let{lastKey:W,lastNeedle:Y,lastIndex:G}=J,X=0,H=$.length-1;if(q===W){if(Q===Y)return L0=G!==-1&&$[G][U1]===Q,G;if(Q>=Y)X=G===-1?0:G;else H=G}return J.lastKey=q,J.lastNeedle=Q,J.lastIndex=g$($,Q,X,H)}function m$($){return typeof $==="string"?JSON.parse($):$}var l$="`line` must be greater than 0 (lines start at line 1)",c$="`column` must be greater than or equal to 0 (columns start at column 0)",h4=-1,u$=1,l4=class{constructor($,Q){let J=typeof $==="string";if(!J&&$._decodedMemo)return $;let q=m$($),{version:W,file:Y,names:G,sourceRoot:X,sources:H,sourcesContent:B}=q;this.version=W,this.file=Y,this.names=G||[],this.sourceRoot=X,this.sources=H,this.sourcesContent=B,this.ignoreList=q.ignoreList||q.x_google_ignoreList||void 0;let j=S$(Q,X);this.resolvedSources=H.map(j);let{mappings:A}=q;if(typeof A==="string")this._encoded=A,this._decoded=void 0;else if(Array.isArray(A))this._encoded=void 0,this._decoded=C$(A,J);else if(q.sections)throw Error("TraceMap passed sectioned source map, please use FlattenMap export instead");else throw Error(`invalid source map: ${JSON.stringify(q)}`);this._decodedMemo=y$(),this._bySources=void 0,this._bySourceMemos=void 0}};function H2($){return $}function p$($){var Q;return(Q=H2($))._decoded||(Q._decoded=x4(H2($)._encoded))}function c4($,Q){let{line:J,column:q,bias:W}=Q;if(J--,J<0)throw Error(l$);if(q<0)throw Error(c$);let Y=p$($);if(J>=Y.length)return R0(null,null,null,null);let G=Y[J],X=d$(G,H2($)._decodedMemo,J,q,W||u$);if(X===-1)return R0(null,null,null,null);let H=G[X];if(H.length===1)return R0(null,null,null,null);let{names:B,resolvedSources:j}=$;return R0(j[H[v$]],H[E$]+1,H[k$],H.length===5?B[H[P$]]:null)}function R0($,Q,J,q){return{source:$,line:Q,column:J,name:q}}function d$($,Q,J,q,W){let Y=h$($,q,Q,J);if(L0)Y=(W===h4?x$:Z$)($,q,Y);else if(W===h4)Y++;if(Y===-1||Y===$.length)return-1;return Y}var i$=6,o$=3000,n$=/\bat (?:[\w$]+\.)*(?:jsxDEV|jsxs?|createElement|react_stack_bottom_frame)\b|\/node_modules\/(?:\.vite\/deps\/)?react(?:-dom)?[/_]/;function c1($){return typeof $==="object"&&$!==null}var r$=/^_c\d*$/;function S0($){if(typeof $==="string")return $;if(typeof $==="function")return $.name===""||r$.test($.name)?void 0:$.name.replace(/(?<=[a-z])\d+$/,"");if(c1($))return S0($.type)??S0($.render);return}var p4=/\/node_modules\//;function d4($){for(let Q of $.split(`
391
- `).slice(1)){if(n$.test(Q))continue;let J=Q.match(/\(?((?:https?|file):\/\/[^\s)]+):(\d+):(\d+)\)?\s*$/);if(J?.[1]!==void 0&&J[2]!==void 0&&J[3]!==void 0)return{url:J[1],line:Number(J[2]),column:Number(J[3])}}return}function B2($){let Q=Object.keys($).find((W)=>W.startsWith("__reactFiber$"));if(Q===void 0)return[];let J=[],q=Reflect.get($,Q);for(let W=0;c1(q)&&J.length<i$&&W<60;W++,q=q.return){let Y=S0(q.type);if(Y===void 0||J.length>0&&typeof q.type==="string")continue;let G=c1(q._debugStack)?q._debugStack.stack:void 0;if(typeof G!=="string")continue;let X=d4(G);if(X===void 0||p4.test(X.url))continue;let H=c1(q._debugOwner)?S0(q._debugOwner.type):void 0;J.push({label:H===void 0?`<${Y}>`:`<${Y}> in ${H}`,...X})}return J}function i4($){let Q=c1($._debugStack)?$._debugStack.stack:void 0;if(typeof Q!=="string")return!1;let J=d4(Q);return J!==void 0&&p4.test(J.url)}var u4=new Map;async function a$($){let J=[...(await fetch($).then((Y)=>Y.text())).matchAll(/\/\/[#@] sourceMappingURL=(\S+)/g)].at(-1)?.[1];if(J===void 0)return null;let q=new URL(J,$).href,W=await fetch(q).then((Y)=>Y.json());if(!c1(W)||W.version!==3)return null;return new l4(JSON.stringify(W),s$(W,q,$))}function s$($,Q,J){if(!Q.startsWith("data:"))return Q;let q=$.file;return typeof q==="string"&&q.startsWith("/")?new URL(q,"file:///").href:J}function t$($){let Q=u4.get($);if(Q===void 0)Q=a$($).catch(()=>null),u4.set($,Q);return Q}function e$($,Q){if(!URL.canParse($))return $;let J=new URL($);if(J.protocol==="file:")return decodeURIComponent(J.pathname);if(J.origin!==new URL(Q).origin)return $;let q=decodeURIComponent(J.pathname);return q.startsWith("/@fs/")?q.slice(4):q.slice(1)}async function $3($){let Q=await t$($.url);if(Q===null)return null;let J=c4(Q,{line:$.line,column:$.column-1});if(J.source===null||J.line===null)return null;let q=e$(J.source,$.url);if(q.length>o0)return null;return{label:$.label,file:q,line:J.line,column:J.column+1}}async function z2($){let Q=new Promise((q)=>setTimeout(()=>q(null),o$)),J=await Promise.race([Promise.all($.map((q)=>$3(q).catch(()=>null))),Q]);return J===null?[]:J.filter((q)=>q!==null)}var Q3="rgba(0, 0, 0, 0)";function v0($,Q){let[J,q,W,Y]=["top","right","bottom","left"].map((G)=>$.getPropertyValue(`${Q}-${G}`));if(J===q&&q===W&&W===Y)return J??"";if(J===W&&q===Y)return`${J} ${q}`;if(q===Y)return`${J} ${q} ${W}`;return`${J} ${q} ${W} ${Y}`}function o4($){let Q=$.getPropertyValue("row-gap"),J=$.getPropertyValue("column-gap");return Q===J?Q:`${Q} ${J}`}function n4($){let Q=$.getPropertyValue("display"),J=Q.endsWith("flex"),q=Q.endsWith("grid"),Y=[["display",Q,!0],["position",$.getPropertyValue("position"),$.getPropertyValue("position")!=="static"],["flex-direction",$.getPropertyValue("flex-direction"),J],["flex-wrap",$.getPropertyValue("flex-wrap"),J&&$.getPropertyValue("flex-wrap")!=="nowrap"],["grid-template-columns",$.getPropertyValue("grid-template-columns"),q],["align-items",$.getPropertyValue("align-items"),J||q],["justify-content",$.getPropertyValue("justify-content"),J||q],["gap",o4($),(J||q)&&o4($)!=="normal"],["width",$.getPropertyValue("width"),!0],["height",$.getPropertyValue("height"),!0],["margin",v0($,"margin"),v0($,"margin")!=="0px"],["padding",v0($,"padding"),v0($,"padding")!=="0px"],["font-size",$.getPropertyValue("font-size"),!0],["line-height",$.getPropertyValue("line-height"),!0],["font-weight",$.getPropertyValue("font-weight"),!0],["color",$.getPropertyValue("color"),!0],["background-color",$.getPropertyValue("background-color"),$.getPropertyValue("background-color")!==Q3]].filter(([,G,X])=>X&&G!=="").map(([G,X])=>`${G}: ${X}`).join("; ");return Y.length>A0?`${Y.slice(0,A0-1)}…`:Y}var J3=120,r4=40,q3=8;function u1($,Q=J3){let J=$.replace(/\s+/g," ").trim();return J.length>Q?`${J.slice(0,Q-1)}…`:J}function s4($){let Q=$.ownerDocument.createTreeWalker($,NodeFilter.SHOW_TEXT),J=[];for(let q=Q.nextNode();q!==null;q=Q.nextNode())J.push(q.textContent??"");return J.join(" ")}var W3={button:"button",select:"combobox",textarea:"textbox",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",img:"img",nav:"navigation",main:"main",dialog:"dialog",table:"table",tr:"row",th:"columnheader",td:"cell",li:"listitem",ul:"list",ol:"list",form:"form"},Y3={checkbox:"checkbox",radio:"radio",button:"button",submit:"button",range:"slider"};function M2($){let Q=$.getAttribute("role");if(Q!==null&&Q!=="")return Q.split(" ")[0];let J=$.tagName.toLowerCase();if(J==="a")return $.hasAttribute("href")?"link":void 0;if(J==="input")return Y3[$.getAttribute("type")??"text"]??"textbox";return W3[J]}function t4($){let Q=$.getAttribute("aria-label");if(Q!==null&&Q.trim()!=="")return u1(Q);let J=$.getAttribute("aria-labelledby");if(J!==null){let G=J.split(/\s+/).map((X)=>$.ownerDocument.getElementById(X)?.textContent??"").join(" ");if(G.trim()!=="")return u1(G)}if($.id!==""){let G=$.ownerDocument.querySelector(`label[for="${CSS.escape($.id)}"]`);if(G?.textContent!=null&&G.textContent.trim()!=="")return u1(G.textContent)}for(let G of["alt","title","placeholder"]){let X=$.getAttribute(G);if(X!==null&&X.trim()!=="")return u1(X)}let q=M2($),W=q==="button"||q==="link"||q==="heading"||q==="cell"||q==="columnheader"||q==="tab"||q==="menuitem"||q==="option",Y=s4($);if(W&&Y.trim()!=="")return u1(Y);return}function G3($){let Q=[],J=$;while(J!==null&&J.tagName.toLowerCase()!=="body"&&J.tagName.toLowerCase()!=="html"){if(J.id!==""&&J.ownerDocument.querySelectorAll(`#${CSS.escape(J.id)}`).length===1)return Q.unshift(`#${CSS.escape(J.id)}`),Q.join(" > ");let q=J.tagName.toLowerCase(),W=J.parentElement,Y=W===null?[]:[...W.children].filter((G)=>G.tagName===J?.tagName);Q.unshift(Y.length>1?`${q}:nth-of-type(${Y.indexOf(J)+1})`:q),J=W}return Q.unshift("body"),Q.join(" > ")}function e4($){return typeof $==="object"&&$!==null}function _2($){if(typeof $==="function"){let Q=Reflect.get($,"displayName");if(typeof Q==="string"&&Q!=="")return Q;return $.name===""?void 0:$.name}if(e4($))return _2($.type)??_2($.render);return}function X3($){let Q=Object.keys($).find((W)=>W.startsWith("__reactFiber$"));if(Q===void 0)return[];let J=[],q=Reflect.get($,Q);while(e4(q)&&J.length<40){let W=_2(q.type)?.replace(/(?<=[a-z])\d+$/,"");if(W!==void 0&&/^[A-Z]/.test(W)&&!W.endsWith("Provider")&&!i4(q)&&J[0]!==W)J.unshift(W);q=q.return}return J.slice(-q3)}function H3($,Q){let J=Q.toString().trim();if(J==="")return;let q=$.ownerDocument.createRange();q.selectNodeContents($),q.setEnd(Q.startContainer,Q.startOffset);let W=$.ownerDocument.createRange();return W.selectNodeContents($),W.setStart(Q.endContainer,Q.endOffset),{exact:J.slice(0,2000),before:q.toString().replace(/\s+/g," ").slice(-r4),after:W.toString().replace(/\s+/g," ").slice(0,r4)}}function $8($,Q,J){let q=M2($),W=t4($),Y=u1(s4($)),G=X3($),X=J===void 0?void 0:H3($,J),H=f4($),B=$.ownerDocument.defaultView,j=B===null?"":n4(B.getComputedStyle($));return{url:Q,selector:G3($),...q===void 0?{}:{role:q},...W===void 0?{}:{name:W},...Y===""?{}:{text:Y},...G.length===0?{}:{components:G},...X===void 0?{}:{quote:X},...H===void 0?{}:{context:H},...B===null?{}:{browser:E4(B)},...j===""?{}:{style:j},html:C4($)}}function a4($,Q){if(Q.role!==void 0&&M2($)!==Q.role)return!1;if(Q.name!==void 0&&t4($)!==Q.name)return!1;return!0}function E0($,Q){let J=null;try{J=$.querySelector(Q.selector)}catch{J=null}if(J!==null&&a4(J,Q))return J;if(Q.role!==void 0&&Q.name!==void 0){let q=[...$.body.querySelectorAll("*")].filter((W)=>a4(W,Q));if(q.length===1)return q[0]??null}return J}var Q8={width:480,height:160};function B3($){let Q=$;for(let J=$.parentElement;J!==null&&J!==$.ownerDocument.body;J=J.parentElement){let q=Q.getBoundingClientRect();if(q.width>=Q8.width&&q.height>=Q8.height)break;if(J.getBoundingClientRect().height>900)break;Q=J}return Q}function z3($,Q){return new Promise((J)=>{let q=setTimeout(J,1000),W=(Y)=>{if(Y===0){clearTimeout(q),J();return}$.requestVideoFrameCallback(()=>W(Y-1))};W(Q)})}function _3($){let Q=Math.max(0,$.left),J=Math.max(0,$.top);return{left:Q,top:J,width:Math.min(innerWidth,$.right)-Q,height:Math.min(innerHeight,$.bottom)-J}}async function J8($,Q){let J=Q.style.visibility;Q.style.visibility="hidden",$.scrollIntoView({block:"nearest",inline:"nearest"});let q;try{q=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:innerWidth*devicePixelRatio},height:{ideal:innerHeight*devicePixelRatio}},audio:!1,...{preferCurrentTab:!0,selfBrowserSurface:"include"}})}catch(W){throw Q.style.visibility=J,W}try{let[W]=q.getVideoTracks();if(W===void 0||W.getSettings().displaySurface!=="browser")throw Error("Share this tab to attach a screenshot");let Y=document.createElement("video");Y.muted=!0,Y.srcObject=q,await Y.play(),await z3(Y,2);let G=_3(B3($).getBoundingClientRect()),X=$.getBoundingClientRect(),H=Y.videoWidth/innerWidth,B=document.createElement("canvas");B.width=Math.round(G.width*H),B.height=Math.round(G.height*H);let j=B.getContext("2d");if(j===null)throw Error("Canvas is not available");return j.drawImage(Y,G.left*H,G.top*H,B.width,B.height,0,0,B.width,B.height),j.strokeStyle="#e11d48",j.lineWidth=3*H,j.strokeRect((X.left-G.left)*H,(X.top-G.top)*H,X.width*H,X.height*H),B.toDataURL("image/png")}finally{Q.style.visibility=J;for(let W of q.getTracks())W.stop()}}var M3=0;function w($,Q,J,q,W,Y){Q||(Q={});var G,X,H=Q;if("ref"in H)for(X in H={},Q)X=="ref"?G=Q[X]:H[X]=Q[X];var B={type:$,props:H,key:J,ref:G,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--M3,__i:-1,__u:0,__source:W,__self:Y};if(typeof $=="function"&&(G=$.defaultProps))for(X in G)H[X]===void 0&&(H[X]=G[X]);return f.vnode&&f.vnode(B),B}var j3=M.object({anchor:l1,body:M.string(),screenshot:M.boolean()}),j2="agent-canvas-review:draft";function q8($){try{if($===null)sessionStorage.removeItem(j2);else sessionStorage.setItem(j2,JSON.stringify($))}catch{}}function V3(){try{let $=sessionStorage.getItem(j2);if($===null)return null;let Q=j3.safeParse(JSON.parse($));return Q.success?Q.data:null}catch{return null}}var K3={open:"Note",queued:"Sent to Claude",working:"Claude is on it",resolved:"Resolved"},W8='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [contenteditable]',Y8="agent-canvas-review-picking",V2="agent-canvas-review:reveal";function F3($,Q){let J=new URL($);if(J.origin===location.origin&&J.pathname===location.pathname&&J.search===location.search){location.hash=J.hash;return}try{sessionStorage.setItem(V2,Q)}catch{}location.href=$}function N3(){try{let $=sessionStorage.getItem(V2);return sessionStorage.removeItem(V2),$}catch{return null}}function U3($){if(!$.endsWith(".html"))return!0;let Q=decodeURI(location.pathname);return $==="/index.html"||Q===$||Q.endsWith("/")&&`${Q}index.html`===$}function q0($){let Q=$.getBoundingClientRect();return{top:Q.top,left:Q.left,width:Q.width,height:Q.height}}function W0($){let Q=new URL($);return`${Q.origin}${Q.pathname}${Q.search}${Q.hash.split("?")[0]??""}`}function G8($){if($.quote!==void 0)return`“${$.quote.exact}”`;if($.role!==void 0&&$.name!==void 0)return`${$.role} “${$.name}”`;if($.text!==void 0)return $.text;return $.selector}function A3(){let[$,Q]=x(0);return Y1(()=>{let J=0,q=()=>{cancelAnimationFrame(J),J=requestAnimationFrame(()=>Q((Y)=>Y+1))};window.addEventListener("scroll",q,!0),window.addEventListener("resize",q);let W=setInterval(q,1000);return()=>{cancelAnimationFrame(J),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q),clearInterval(W)}},[]),$}function w3(){let[$,Q]=x(location.href);return Y1(()=>{let J=()=>Q(location.href);window.addEventListener("hashchange",J),window.addEventListener("popstate",J);let q=setInterval(J,400);return()=>{window.removeEventListener("hashchange",J),window.removeEventListener("popstate",J),clearInterval(q)}},[]),$}function D3($,Q,J,q,W){Y1(()=>{if(!Q)return;document.documentElement.classList.add(Y8);let Y=(A)=>A.composedPath().includes($),G=(A)=>A.target instanceof Element?A.target.closest(W8)??A.target:null,X=(A)=>{if(!Y(A))J(G(A))},H=(A)=>{if(Y(A))return;if(G(A)?.closest(W8))A.preventDefault(),A.stopPropagation()},B=(A)=>{if(Y(A))return;A.preventDefault(),A.stopPropagation();let z=window.getSelection(),F=z!==null&&z.rangeCount>0&&!z.isCollapsed?z.getRangeAt(0):void 0;if(F!==void 0){let I=F.commonAncestorContainer,N=I instanceof Element?I:I.parentElement;if(N!==null)return q(N,F)}let k=G(A);if(k!==null)q(k)},j=(A)=>{if(A.key==="Escape")W()};return document.addEventListener("mousemove",X,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("mousedown",H,!0),document.addEventListener("click",B,!0),document.addEventListener("keydown",j,!0),()=>{document.documentElement.classList.remove(Y8),document.removeEventListener("mousemove",X,!0),document.removeEventListener("pointerdown",H,!0),document.removeEventListener("mousedown",H,!0),document.removeEventListener("click",B,!0),document.removeEventListener("keydown",j,!0)}},[$,Q,J,q,W])}function O3($){let q=Math.min(Math.max(8,$.left),window.innerWidth-320-8),W=$.top+$.height+8;return{top:W+190<window.innerHeight?W:Math.max(8,$.top-190-8),left:q}}function b3($){let[Q,J]=x($.draft.body),[q,W]=x($.draft.screenshot),{onChange:Y}=$;Y1(()=>Y(Q,q),[Y,Q,q]);let[G,X]=x(!1),[H,B]=x(null),j=R4(null);Y1(()=>j.current?.focus(),[]);let A=async(z)=>{if(Q.trim()==="")return;X(!0),B(null);try{await $.onSubmit(Q,z,q)}catch(F){B(F instanceof Error?F.message:String(F)),X(!1)}};return w("div",{class:"popover",style:O3($.draft.box),children:[w("div",{class:"target",title:$.draft.anchor.selector,children:G8($.draft.anchor)},void 0,!1,void 0,this),$.draft.anchor.components!==void 0&&w("div",{class:"target",children:$.draft.anchor.components.slice(-3).join(" › ")},void 0,!1,void 0,this),w("textarea",{ref:j,value:Q,placeholder:"What should change here?",onInput:(z)=>J(z.currentTarget.value),onKeyDown:(z)=>{if(z.key==="Escape")$.onCancel();if(z.key==="Enter"&&(z.metaKey||z.ctrlKey))A(!0)}},void 0,!1,void 0,this),w("label",{class:"option",children:[w("input",{type:"checkbox",checked:q,onChange:(z)=>W(z.currentTarget.checked)},void 0,!1,void 0,this),"Attach a screenshot"]},void 0,!0,void 0,this),$.reloadPending&&w("div",{class:"reload-pending",children:[w("span",{children:"The application changed. It reloads once you save or cancel this comment."},void 0,!1,void 0,this),w("button",{type:"button",class:"ghost",onClick:()=>location.reload(),children:"Reload now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H!==null&&w("div",{class:"error",children:H},void 0,!1,void 0,this),w("div",{class:"actions",children:[w("button",{type:"button",class:"ghost",onClick:$.onCancel,children:"Cancel"},void 0,!1,void 0,this),w("button",{type:"button",disabled:G||Q.trim()==="",onClick:()=>void A(!1),children:"Save note"},void 0,!1,void 0,this),w("button",{type:"button",class:"primary",disabled:G||Q.trim()==="",onClick:()=>void A(!0),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w("div",{class:"hint",children:"Ctrl+Enter sends to Claude · Esc cancels"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function R3($){let{thread:Q,client:J}=$,[q,W]=x(null),[Y,G]=x(null),X=(B)=>{G(null),B().catch((j)=>G(j instanceof Error?j.message:String(j)))},H=(B)=>{if(q===null||q.trim()==="")return;X(()=>J.comment(Q.id,q,B).then(()=>W(null)))};return w("div",{class:`thread${$.number===null?"":" current"}${Q.state==="resolved"?" resolved":""}`,children:[w("div",{class:"thread-head",children:[w("button",{type:"button",class:"ghost",title:"Show in page","aria-label":"Show in page",onClick:$.onReveal,children:$.number===null?"↗":`#${$.number}`},void 0,!1,void 0,this),w("span",{class:"target",title:Q.anchor.url,children:G8(Q.anchor)},void 0,!1,void 0,this),w("span",{class:`badge ${Q.state}`,children:K3[Q.state]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.comments.map((B)=>w("div",{class:`comment ${B.author}`,children:[w("span",{class:"author",children:B.author==="user"?"You":"Claude"},void 0,!1,void 0,this),w("span",{class:"body",children:B.body},void 0,!1,void 0,this)]},B.id,!0,void 0,this)),q!==null&&w("textarea",{value:q,placeholder:"Reply…",onInput:(B)=>W(B.currentTarget.value),onKeyDown:(B)=>{if(B.key==="Enter"&&(B.metaKey||B.ctrlKey))H(!0)}},void 0,!1,void 0,this),Y!==null&&w("div",{class:"error",children:Y},void 0,!1,void 0,this),w("div",{class:"actions",children:q===null?w(Q1,{children:[w("button",{type:"button",class:"ghost",onClick:()=>X(()=>J.delete(Q.id)),children:"Delete"},void 0,!1,void 0,this),Q.state==="resolved"?w("button",{type:"button",onClick:()=>X(()=>J.setResolved(Q.id,!1)),children:"Reopen"},void 0,!1,void 0,this):w("button",{type:"button",onClick:()=>X(()=>J.setResolved(Q.id,!0)),children:"Resolve"},void 0,!1,void 0,this),w("button",{type:"button",onClick:()=>W(""),children:"Reply"},void 0,!1,void 0,this),Q.state==="open"&&w("button",{type:"button",class:"primary",onClick:()=>X(()=>J.send(Q.id)),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):w(Q1,{children:[w("button",{type:"button",class:"ghost",onClick:()=>W(null),children:"Cancel"},void 0,!1,void 0,this),w("button",{type:"button",disabled:q.trim()==="",onClick:()=>H(!1),children:"Reply"},void 0,!1,void 0,this),w("button",{type:"button",class:"primary",disabled:q.trim()==="",onClick:()=>H(!0),children:"Reply & send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X8($){let{client:Q,host:J}=$,[q,W]=x([]),[Y,G]=x(!1),[X,H]=x(!1),[B,j]=x(!1),[A,z]=x(null),[F,k]=x(null),[I,N]=x(V3),[O,U]=x(!1),[C,T]=x(!1),[P,h]=x(!1),[c,u]=x(!1),[o,i]=x(null),[$1,N2]=x(N3),[U2,A2]=x(null),z8=w3(),_8=A3();Y1(()=>{return Q.connect({threads:W,agentWatching:G,connected:H,reload:(L)=>{if(U3(L))U(!0)}}),()=>Q.close()},[Q]);let w2=Q0(()=>{j(!1),z(null)},[]),M8=Q0((L,p)=>{j(!1),z(null),window.getSelection()?.removeAllRanges(),N(null);let n=$8(L,location.href,p);k({anchor:n,box:q0(L),element:L,sources:z2(B2(L)),body:"",screenshot:!1})},[]),k0=Q0(()=>{k(null),q8(null)},[]),P0=F?.anchor,j8=Q0((L,p)=>{if(P0!==void 0)q8({anchor:P0,body:L,screenshot:p})},[P0]);D3(J,B,z,M8,w2);let V8=()=>{T(!1),k0(),j(!0)},A1=W0(z8),C0=b0(()=>q.filter((L)=>W0(L.anchor.url)===A1&&(!c||L.state!=="resolved")),[q,A1,c]),D2=P?q.filter((L)=>!c||L.state!=="resolved"):C0,O2=new Map(C0.map((L,p)=>[L.id,p+1])),b2=q.filter((L)=>L.state!=="resolved").length,f0=q.filter(v4).length,K8=()=>{i(null),Q.sendNotes().catch((L)=>i(L instanceof Error?L.message:String(L)))};Y1(()=>{if($1===null)return;let L=q.find((n)=>n.id===$1);if(L===void 0||W0(L.anchor.url)!==A1)return;let p=E0(document,L.anchor);if(p===null)return;p.scrollIntoView({block:"center",behavior:"smooth"}),N2(null),setTimeout(()=>A2(q0(p)),350),setTimeout(()=>A2(null),1600)},[$1,q,A1]),Y1(()=>{if(O&&F===null)location.reload()},[O,F]),Y1(()=>{if(I===null||F!==null||W0(I.anchor.url)!==A1)return;let L=E0(document,I.anchor);if(L===null)return;N(null),k({...I,box:q0(L),element:L,sources:z2(B2(L))})},[I,F,A1,_8]);let F8=(L)=>{if(N2(L.id),W0(L.anchor.url)!==A1)F3(L.anchor.url,L.id)},R2=!X?Q.offlineLabel:Y?"Claude is listening":"Claude is not listening",L2=A===null?null:q0(A);return w(Q1,{children:[L2!==null&&w("div",{class:"highlight",style:L2},void 0,!1,void 0,this),U2!==null&&w("div",{class:"highlight flash",style:U2},void 0,!1,void 0,this),C0.map((L)=>{let p=E0(document,L.anchor);if(p===null)return null;let n=q0(p);if(n.width===0&&n.height===0)return null;return w("button",{type:"button",class:`pin ${L.state}`,style:{top:Math.max(0,n.top-11),left:Math.max(0,n.left+n.width-11)},title:L.comments[0]?.body,onClick:()=>T(!0),children:O2.get(L.id)},L.id,!1,void 0,this)}),F!==null&&w(b3,{draft:F,reloadPending:O,onChange:j8,onCancel:k0,onSubmit:async(L,p,n)=>{let N8=n?await J8(F.element,J):void 0,S2=await F.sources;await Q.createThread(S2.length===0?F.anchor:{...F.anchor,sources:S2},L,p,N8),k0()}},void 0,!1,void 0,this),C&&w("aside",{class:"panel",children:[w("header",{children:[w("h2",{children:"Review"},void 0,!1,void 0,this),w("button",{type:"button",class:"ghost",onClick:()=>T(!1),children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w("div",{class:"tabs",children:[w("button",{type:"button",class:P?"":"active",onClick:()=>h(!1),children:"This page"},void 0,!1,void 0,this),w("button",{type:"button",class:P?"active":"",onClick:()=>h(!0),children:"All pages"},void 0,!1,void 0,this),w("button",{type:"button",class:c?"active":"",onClick:()=>u(!c),children:"Hide resolved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f0>0&&w("div",{class:"send-notes",children:w("button",{type:"button",class:"primary",onClick:K8,children:["Send ",f0===1?"1 note":`${f0} notes`," to Claude"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),o!==null&&w("div",{class:"error",children:o},void 0,!1,void 0,this),w("div",{class:"threads",children:[D2.length===0&&w("div",{class:"empty",children:"No comments yet. Click “Comment”, then an element or a text selection."},void 0,!1,void 0,this),D2.map((L)=>w(R3,{thread:L,number:O2.get(L.id)??null,client:Q,onReveal:()=>F8(L)},L.id,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w("div",{class:`toolbar${C?" beside-panel":""}`,children:[w("span",{class:"presence",title:R2,children:[w("span",{class:`dot ${!X?"off-line":Y?"on":""}`},void 0,!1,void 0,this),R2]},void 0,!0,void 0,this),w("button",{type:"button",class:B?"active":"",onClick:()=>B?w2():V8(),children:B?"Pick an element…":"Comment"},void 0,!1,void 0,this),w("button",{type:"button",class:C?"active":"",onClick:()=>T(!C),children:["Threads",b2>0?` (${b2})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var H8="agent-canvas-review",K2="agent-canvas-review:remote",L3="off";function S3(){let $=new URLSearchParams(location.hash.slice(1)).get(s0);if($!==null){if(history.replaceState(history.state,"",`${location.pathname}${location.search}`),$===L3){try{localStorage.removeItem(K2)}catch{}return null}let Q=e0($);if(Q===null)return console.error("agent-canvas review: the review link is malformed"),null;try{localStorage.setItem(K2,B4(Q))}catch{}return Q}try{let Q=localStorage.getItem(K2);return Q===null?null:e0(Q)}catch{return null}}function B8($){if(document.querySelector(H8)!==null)return;let Q=document.createElement("style");Q.textContent="html.agent-canvas-review-picking, html.agent-canvas-review-picking * { cursor: crosshair !important; }",document.head.append(Q);let J=document.createElement(H8);document.documentElement.append(J);let q=J.attachShadow({mode:"open"}),W=document.createElement("style");W.textContent=V4,q.append(W),c2(w(X8,{client:$,host:J},void 0,!1,void 0,this),q)}async function v3($){let Q=new URL($.src).origin,J=$.dataset.project;if(J!==void 0){if(!i0.test(J)){console.error(`agent-canvas review: data-project must match ${i0}, got "${J}"`);return}B8(new $2(Q,J));return}let q=S3();if(q===null)return;B8(new Q2(Q,q.projectId,await u2(q.key)))}var F2=document.currentScript;if(F2 instanceof HTMLScriptElement){if(v3(F2),F2.dataset.project===void 0)window.addEventListener("hashchange",()=>{if(new URLSearchParams(location.hash.slice(1)).has(s0))location.reload()})}else console.error("agent-canvas review: load review.js with a classic <script> tag");})();
390
+ `;var Ye,V,cn,vr,Je=0,Tr=[],U=P,{__b:yr,__r:xr,diffed:br,__c:wr,unmount:kr,__:Sr}=U;function un(e,t){U.__h&&U.__h(V,e,Je||t),Je=0;var n=V.__H||(V.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function j(e){return Je=1,To(Ar,e)}function To(e,t,n){var r=un(Ye++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ar(void 0,t),function(a){var c=r.__N?r.__N[0]:r.__[0],l=r.t(c,a);c!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=V,!V.__f)){var s=function(a,c,l){if(!r.__c.__H)return!0;var f=!1,v=r.__c.props!==a;if(r.__c.__H.__.some(function(p){if(p.__N){f=!0;var E=p.__[0];p.__=p.__N,p.__N=void 0,E!==p.__[0]&&(v=!0)}}),o){var u=o.call(this,a,c,l);return f?u||v:u}return!f||v};V.__f=!0;var o=V.shouldComponentUpdate,i=V.componentWillUpdate;V.componentWillUpdate=function(a,c,l){if(this.__e){var f=o;o=void 0,s(a,c,l),o=f}i&&i.call(this,a,c,l)},V.shouldComponentUpdate=s}return r.__N||r.__}function re(e,t){var n=un(Ye++,3);!U.__s&&Er(n.__H,t)&&(n.__=e,n.u=t,V.__H.__h.push(n))}function Rr(e){return Je=5,Ct(function(){return{current:e}},[])}function Ct(e,t){var n=un(Ye++,7);return Er(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qe(e,t){return Je=8,Ct(function(){return e},t)}function Ro(){for(var e;e=Tr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(St),t.__h.some(ln),t.__h=[]}catch(n){t.__h=[],U.__e(n,e.__v)}}}U.__b=function(e){V=null,yr&&yr(e)},U.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Sr&&Sr(e,t)},U.__r=function(e){xr&&xr(e),Ye=0;var t=(V=e.__c).__H;t&&(cn===V?(t.__h=[],V.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(St),t.__h.some(ln),t.__h=[],Ye=0)),cn=V},U.diffed=function(e){br&&br(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Tr.push(t)!==1&&vr===U.requestAnimationFrame||((vr=U.requestAnimationFrame)||Eo)(Ro)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),cn=V=null},U.__c=function(e,t){t.some(function(n){try{n.__h.some(St),n.__h=n.__h.filter(function(r){return!r.__||ln(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],U.__e(r,n.__v)}}),wr&&wr(e,t)},U.unmount=function(e){kr&&kr(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{St(r)}catch(s){t=s}}),n.__H=void 0,t&&U.__e(t,n.__v))};var Cr=typeof requestAnimationFrame=="function";function Eo(e){var t,n=function(){clearTimeout(r),Cr&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Cr&&(t=requestAnimationFrame(n))}function St(e){var t=V,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),V=t}function ln(e){var t=V;e.__c=e.__(),V=t}function Er(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ar(e,t){return typeof t=="function"?t(e):t}function Or(e){return e.state==="open"&&e.comments.at(-1)?.author==="user"}var Ao=[["Edge",/\bEdg(?:e|A|iOS)?\/(\d+)/],["Opera",/\bOPR\/(\d+)/],["Firefox",/\b(?:Firefox|FxiOS)\/(\d+)/],["Chrome",/\b(?:Chrome|CriOS)\/(\d+)/],["Safari",/\bVersion\/(\d+)[^ ]* (?:Mobile\/\S+ )?Safari\//]],Oo=[["Android",/\bAndroid\b/],["iOS",/\b(?:iPhone|iPad|iPod)\b/],["Windows",/\bWindows\b/],["macOS",/\bMac OS X\b/],["Linux",/\bLinux\b/]];function Po(e){let t;for(let[s,o]of Ao){let i=o.exec(e)?.[1];if(i!==void 0){t=`${s} ${i}`;break}}let n=Oo.find(([,s])=>s.test(e))?.[0],r=[t,n].filter((s)=>s!==void 0);return r.length===0?e.slice(0,100):r.join(" · ")}function Pr(e){return{name:Po(e.navigator.userAgent),viewport:{width:e.innerWidth,height:e.innerHeight,scale:e.devicePixelRatio},colorScheme:e.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}var dn=8,Ir=80,Io=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function Nr(e,t){if(e.tagName.toLowerCase()==="svg"){e.replaceChildren();return}let n=0;for(let r of[...e.childNodes]){if(r.nodeType===Node.TEXT_NODE){let s=r.textContent??"";if(s.trim()==="")r.remove();else if(s.length>Ir)r.textContent=`${s.slice(0,Ir)}…`;continue}if(!(r instanceof Element)||Io.has(r.tagName)){r.remove();continue}if(n++,t===0||n>dn)r.remove();else Nr(r,t-1)}if(t===0&&n>0)e.append(e.ownerDocument.createComment(` ${n} child elements cut `));else if(n>dn)e.append(e.ownerDocument.createComment(` ${n-dn} more `))}function Mr(e){for(let n=5;n>=0;n--){let r=e.cloneNode(!0);if(!(r instanceof Element))return"";Nr(r,n);let s=r.outerHTML;if(s.length<=xt)return s}let t=e.cloneNode(!1);return t instanceof Element?t.outerHTML.slice(0,xt):""}function No(e){let t=e.getAttribute("aria-label");if(t!==null&&t.trim()!=="")return t.trim();let n=e.getAttribute("aria-labelledby"),o=((n===null?null:e.ownerDocument.getElementById(n.split(/\s+/)[0]??""))??e.querySelector('h1, h2, h3, h4, legend, [role="heading"]'))?.textContent?.replace(/\s+/g," ").trim();return o===void 0||o===""?void 0:o.slice(0,80)}var Mo=[{selector:'dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]',kind:"Dialog"},{selector:'section, article, fieldset, form, [role="region"], [role="tabpanel"]',kind:"Section"}];function Lr(e){let t=[],n=e.ownerDocument.querySelector("h1")?.textContent?.replace(/\s+/g," ").trim();if(n!==void 0&&n!=="")t.push(`Page "${n.slice(0,80)}"`);for(let r of Mo){let s=e.closest(r.selector),o=s===null?void 0:No(s);if(o!==void 0&&!t.includes(`Page "${o}"`))t.push(`${r.kind} "${o}"`)}return t.length===0?void 0:t.join(" › ")}var Lo=44;var jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jo=new Uint8Array(64),Dr=new Uint8Array(128);for(let e=0;e<jr.length;e++){let t=jr.charCodeAt(e);jo[e]=t,Dr[t]=e}function Ze(e,t){let n=0,r=0,s=0;do{let i=e.next();s=Dr[i],n|=(s&31)<<r,r+=5}while(s&32);let o=n&1;if(n>>>=1,o)n=-2147483648|-n;return t+n}function $r(e,t){if(e.pos>=t)return!1;return e.peek()!==Lo}var $o=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 Vr(e){let{length:t}=e,n=new $o(e),r=[],s=0,o=0,i=0,a=0,c=0;do{let l=n.indexOf(";"),f=[],v=!0,u=0;s=0;while(n.pos<l){let p;if(s=Ze(n,s),s<u)v=!1;if(u=s,$r(n,l))if(o=Ze(n,o),i=Ze(n,i),a=Ze(n,a),$r(n,l))c=Ze(n,c),p=[s,o,i,a,c];else p=[s,o,i,a];else p=[s];f.push(p),n.pos++}if(!v)Do(f);r.push(f),n.pos=l+1}while(n.pos<=t);return r}function Do(e){e.sort(Vo)}function Vo(e,t){return e[0]-t[0]}var zr=Rs(Ur(),1);function Uo(e){if(!e)return"";let t=e.lastIndexOf("/");return e.slice(0,t+1)}function Fo(e,t){let n=Uo(e),r=t?t+"/":"";return(s)=>zr.default(r+(s||""),n)}var ge=0,Bo=1,zo=2,Wo=3,qo=4;function Ho(e,t){let n=Fr(e,0);if(n===e.length)return e;if(!t)e=e.slice();for(let r=n;r<e.length;r=Fr(e,r+1))e[r]=Go(e[r],t);return e}function Fr(e,t){for(let n=t;n<e.length;n++)if(!Ko(e[n]))return n;return e.length}function Ko(e){for(let t=1;t<e.length;t++)if(e[t][ge]<e[t-1][ge])return!1;return!0}function Go(e,t){if(!t)e=e.slice();return e.sort(Xo)}function Xo(e,t){return e[ge]-t[ge]}var Rt=!1;function Yo(e,t,n,r){while(n<=r){let s=n+(r-n>>1),o=e[s][ge]-t;if(o===0)return Rt=!0,s;if(o<0)n=s+1;else r=s-1}return Rt=!1,n-1}function Jo(e,t,n){for(let r=n+1;r<e.length;n=r++)if(e[r][ge]!==t)break;return n}function Qo(e,t,n){for(let r=n-1;r>=0;n=r--)if(e[r][ge]!==t)break;return n}function Zo(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function ei(e,t,n,r){let{lastKey:s,lastNeedle:o,lastIndex:i}=n,a=0,c=e.length-1;if(r===s){if(t===o)return Rt=i!==-1&&e[i][ge]===t,i;if(t>=o)a=i===-1?0:i;else c=i}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=Yo(e,t,a,c)}function ti(e){return typeof e==="string"?JSON.parse(e):e}var ni="`line` must be greater than 0 (lines start at line 1)",ri="`column` must be greater than or equal to 0 (columns start at column 0)",Br=-1,si=1,Wr=class{constructor(e,t){let n=typeof e==="string";if(!n&&e._decodedMemo)return e;let r=ti(e),{version:s,file:o,names:i,sourceRoot:a,sources:c,sourcesContent:l}=r;this.version=s,this.file=o,this.names=i||[],this.sourceRoot=a,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let f=Fo(t,a);this.resolvedSources=c.map(f);let{mappings:v}=r;if(typeof v==="string")this._encoded=v,this._decoded=void 0;else if(Array.isArray(v))this._encoded=void 0,this._decoded=Ho(v,n);else if(r.sections)throw Error("TraceMap passed sectioned source map, please use FlattenMap export instead");else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=Zo(),this._bySources=void 0,this._bySourceMemos=void 0}};function pn(e){return e}function oi(e){var t;return(t=pn(e))._decoded||(t._decoded=Vr(pn(e)._encoded))}function qr(e,t){let{line:n,column:r,bias:s}=t;if(n--,n<0)throw Error(ni);if(r<0)throw Error(ri);let o=oi(e);if(n>=o.length)return Tt(null,null,null,null);let i=o[n],a=ii(i,pn(e)._decodedMemo,n,r,s||si);if(a===-1)return Tt(null,null,null,null);let c=i[a];if(c.length===1)return Tt(null,null,null,null);let{names:l,resolvedSources:f}=e;return Tt(f[c[Bo]],c[zo]+1,c[Wo],c.length===5?l[c[qo]]:null)}function Tt(e,t,n,r){return{source:e,line:t,column:n,name:r}}function ii(e,t,n,r,s){let o=ei(e,r,t,n);if(Rt)o=(s===Br?Jo:Qo)(e,r,o);else if(s===Br)o++;if(o===-1||o===e.length)return-1;return o}var ai=6,ci=3000,li=/\bat (?:[\w$]+\.)*(?:jsxDEV|jsxs?|createElement|react_stack_bottom_frame)\b|\/node_modules\/(?:\.vite\/deps\/)?react(?:-dom)?[/_]/;function Pe(e){return typeof e==="object"&&e!==null}var ui=/^_c\d*$/;function Et(e){if(typeof e==="string")return e;if(typeof e==="function")return e.name===""||ui.test(e.name)?void 0:e.name.replace(/(?<=[a-z])\d+$/,"");if(Pe(e))return Et(e.type)??Et(e.render);return}var Kr=/\/node_modules\//;function Gr(e){for(let t of e.split(`
391
+ `).slice(1)){if(li.test(t))continue;let n=t.match(/\(?((?:https?|file):\/\/[^\s)]+):(\d+):(\d+)\)?\s*$/);if(n?.[1]!==void 0&&n[2]!==void 0&&n[3]!==void 0)return{url:n[1],line:Number(n[2]),column:Number(n[3])}}return}function mn(e){let t=Object.keys(e).find((s)=>s.startsWith("__reactFiber$"));if(t===void 0)return[];let n=[],r=Reflect.get(e,t);for(let s=0;Pe(r)&&n.length<ai&&s<60;s++,r=r.return){let o=Et(r.type);if(o===void 0||n.length>0&&typeof r.type==="string")continue;let i=Pe(r._debugStack)?r._debugStack.stack:void 0;if(typeof i!=="string")continue;let a=Gr(i);if(a===void 0||Kr.test(a.url))continue;let c=Pe(r._debugOwner)?Et(r._debugOwner.type):void 0;n.push({label:c===void 0?`<${o}>`:`<${o}> in ${c}`,...a})}return n}function Xr(e){let t=Pe(e._debugStack)?e._debugStack.stack:void 0;if(typeof t!=="string")return!1;let n=Gr(t);return n!==void 0&&Kr.test(n.url)}var Hr=new Map;async function di(e){let n=[...(await fetch(e).then((o)=>o.text())).matchAll(/\/\/[#@] sourceMappingURL=(\S+)/g)].at(-1)?.[1];if(n===void 0)return null;let r=new URL(n,e).href,s=await fetch(r).then((o)=>o.json());if(!Pe(s)||s.version!==3)return null;return new Wr(JSON.stringify(s),fi(s,r,e))}function fi(e,t,n){if(!t.startsWith("data:"))return t;let r=e.file;return typeof r==="string"&&r.startsWith("/")?new URL(r,"file:///").href:n}function hi(e){let t=Hr.get(e);if(t===void 0)t=di(e).catch(()=>null),Hr.set(e,t);return t}function pi(e,t){if(!URL.canParse(e))return e;let n=new URL(e);if(n.protocol==="file:")return decodeURIComponent(n.pathname);if(n.origin!==new URL(t).origin)return e;let r=decodeURIComponent(n.pathname);return r.startsWith("/@fs/")?r.slice(4):r.slice(1)}async function mi(e){let t=await hi(e.url);if(t===null)return null;let n=qr(t,{line:e.line,column:e.column-1});if(n.source===null||n.line===null)return null;let r=pi(n.source,e.url);if(r.length>Qt)return null;return{label:e.label,file:r,line:n.line,column:n.column+1}}async function _n(e){let t=new Promise((r)=>setTimeout(()=>r(null),ci)),n=await Promise.race([Promise.all(e.map((r)=>mi(r).catch(()=>null))),t]);return n===null?[]:n.filter((r)=>r!==null)}var _i="rgba(0, 0, 0, 0)";function At(e,t){let[n,r,s,o]=["top","right","bottom","left"].map((i)=>e.getPropertyValue(`${t}-${i}`));if(n===r&&r===s&&s===o)return n??"";if(n===s&&r===o)return`${n} ${r}`;if(r===o)return`${n} ${r} ${s}`;return`${n} ${r} ${s} ${o}`}function Yr(e){let t=e.getPropertyValue("row-gap"),n=e.getPropertyValue("column-gap");return t===n?t:`${t} ${n}`}function Jr(e){let t=e.getPropertyValue("display"),n=t.endsWith("flex"),r=t.endsWith("grid"),o=[["display",t,!0],["position",e.getPropertyValue("position"),e.getPropertyValue("position")!=="static"],["flex-direction",e.getPropertyValue("flex-direction"),n],["flex-wrap",e.getPropertyValue("flex-wrap"),n&&e.getPropertyValue("flex-wrap")!=="nowrap"],["grid-template-columns",e.getPropertyValue("grid-template-columns"),r],["align-items",e.getPropertyValue("align-items"),n||r],["justify-content",e.getPropertyValue("justify-content"),n||r],["gap",Yr(e),(n||r)&&Yr(e)!=="normal"],["width",e.getPropertyValue("width"),!0],["height",e.getPropertyValue("height"),!0],["margin",At(e,"margin"),At(e,"margin")!=="0px"],["padding",At(e,"padding"),At(e,"padding")!=="0px"],["font-size",e.getPropertyValue("font-size"),!0],["line-height",e.getPropertyValue("line-height"),!0],["font-weight",e.getPropertyValue("font-weight"),!0],["color",e.getPropertyValue("color"),!0],["background-color",e.getPropertyValue("background-color"),e.getPropertyValue("background-color")!==_i]].filter(([,i,a])=>a&&i!=="").map(([i,a])=>`${i}: ${a}`).join("; ");return o.length>bt?`${o.slice(0,bt-1)}…`:o}var gi=120,Qr=40,vi=8;function Ie(e,t=gi){let n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function es(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let r=t.nextNode();r!==null;r=t.nextNode())n.push(r.textContent??"");return n.join(" ")}var yi={button:"button",select:"combobox",textarea:"textbox",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",img:"img",nav:"navigation",main:"main",dialog:"dialog",table:"table",tr:"row",th:"columnheader",td:"cell",li:"listitem",ul:"list",ol:"list",form:"form"},xi={checkbox:"checkbox",radio:"radio",button:"button",submit:"button",range:"slider"};function vn(e){let t=e.getAttribute("role");if(t!==null&&t!=="")return t.split(" ")[0];let n=e.tagName.toLowerCase();if(n==="a")return e.hasAttribute("href")?"link":void 0;if(n==="input")return xi[e.getAttribute("type")??"text"]??"textbox";return yi[n]}function ts(e){let t=e.getAttribute("aria-label");if(t!==null&&t.trim()!=="")return Ie(t);let n=e.getAttribute("aria-labelledby");if(n!==null){let i=n.split(/\s+/).map((a)=>e.ownerDocument.getElementById(a)?.textContent??"").join(" ");if(i.trim()!=="")return Ie(i)}if(e.id!==""){let i=e.ownerDocument.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(i?.textContent!=null&&i.textContent.trim()!=="")return Ie(i.textContent)}for(let i of["alt","title","placeholder"]){let a=e.getAttribute(i);if(a!==null&&a.trim()!=="")return Ie(a)}let r=vn(e),s=r==="button"||r==="link"||r==="heading"||r==="cell"||r==="columnheader"||r==="tab"||r==="menuitem"||r==="option",o=es(e);if(s&&o.trim()!=="")return Ie(o);return}function bi(e){let t=[],n=e;while(n!==null&&n.tagName.toLowerCase()!=="body"&&n.tagName.toLowerCase()!=="html"){if(n.id!==""&&n.ownerDocument.querySelectorAll(`#${CSS.escape(n.id)}`).length===1)return t.unshift(`#${CSS.escape(n.id)}`),t.join(" > ");let r=n.tagName.toLowerCase(),s=n.parentElement,o=s===null?[]:[...s.children].filter((i)=>i.tagName===n?.tagName);t.unshift(o.length>1?`${r}:nth-of-type(${o.indexOf(n)+1})`:r),n=s}return t.unshift("body"),t.join(" > ")}function ns(e){return typeof e==="object"&&e!==null}function gn(e){if(typeof e==="function"){let t=Reflect.get(e,"displayName");if(typeof t==="string"&&t!=="")return t;return e.name===""?void 0:e.name}if(ns(e))return gn(e.type)??gn(e.render);return}function wi(e){let t=Object.keys(e).find((s)=>s.startsWith("__reactFiber$"));if(t===void 0)return[];let n=[],r=Reflect.get(e,t);while(ns(r)&&n.length<40){let s=gn(r.type)?.replace(/(?<=[a-z])\d+$/,"");if(s!==void 0&&/^[A-Z]/.test(s)&&!s.endsWith("Provider")&&!Xr(r)&&n[0]!==s)n.unshift(s);r=r.return}return n.slice(-vi)}function ki(e,t){let n=t.toString().trim();if(n==="")return;let r=e.ownerDocument.createRange();r.selectNodeContents(e),r.setEnd(t.startContainer,t.startOffset);let s=e.ownerDocument.createRange();return s.selectNodeContents(e),s.setStart(t.endContainer,t.endOffset),{exact:n.slice(0,2000),before:r.toString().replace(/\s+/g," ").slice(-Qr),after:s.toString().replace(/\s+/g," ").slice(0,Qr)}}function rs(e,t,n){let r=vn(e),s=ts(e),o=Ie(es(e)),i=wi(e),a=n===void 0?void 0:ki(e,n),c=Lr(e),l=e.ownerDocument.defaultView,f=l===null?"":Jr(l.getComputedStyle(e));return{url:t,selector:bi(e),...r===void 0?{}:{role:r},...s===void 0?{}:{name:s},...o===""?{}:{text:o},...i.length===0?{}:{components:i},...a===void 0?{}:{quote:a},...c===void 0?{}:{context:c},...l===null?{}:{browser:Pr(l)},...f===""?{}:{style:f},html:Mr(e)}}function Zr(e,t){if(t.role!==void 0&&vn(e)!==t.role)return!1;if(t.name!==void 0&&ts(e)!==t.name)return!1;return!0}function Ot(e,t){let n=null;try{n=e.querySelector(t.selector)}catch{n=null}if(n!==null&&Zr(n,t))return n;if(t.role!==void 0&&t.name!==void 0){let r=[...e.body.querySelectorAll("*")].filter((s)=>Zr(s,t));if(r.length===1)return r[0]??null}return n}var ss={width:480,height:160};function Si(e){let t=e;for(let n=e.parentElement;n!==null&&n!==e.ownerDocument.body;n=n.parentElement){let r=t.getBoundingClientRect();if(r.width>=ss.width&&r.height>=ss.height)break;if(n.getBoundingClientRect().height>900)break;t=n}return t}function Ci(e,t){return new Promise((n)=>{let r=setTimeout(n,1000),s=(o)=>{if(o===0){clearTimeout(r),n();return}e.requestVideoFrameCallback(()=>s(o-1))};s(t)})}function Ti(e){let t=Math.max(0,e.left),n=Math.max(0,e.top);return{left:t,top:n,width:Math.min(innerWidth,e.right)-t,height:Math.min(innerHeight,e.bottom)-n}}async function os(e,t){let n=t.style.visibility;t.style.visibility="hidden",e.scrollIntoView({block:"nearest",inline:"nearest"});let r;try{r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:innerWidth*devicePixelRatio},height:{ideal:innerHeight*devicePixelRatio}},audio:!1,...{preferCurrentTab:!0,selfBrowserSurface:"include"}})}catch(s){throw t.style.visibility=n,s}try{let[s]=r.getVideoTracks();if(s===void 0||s.getSettings().displaySurface!=="browser")throw Error("Share this tab to attach a screenshot");let o=document.createElement("video");o.muted=!0,o.srcObject=r,await o.play(),await Ci(o,2);let i=Ti(Si(e).getBoundingClientRect()),a=e.getBoundingClientRect(),c=o.videoWidth/innerWidth,l=document.createElement("canvas");l.width=Math.round(i.width*c),l.height=Math.round(i.height*c);let f=l.getContext("2d");if(f===null)throw Error("Canvas is not available");return f.drawImage(o,i.left*c,i.top*c,l.width,l.height,0,0,l.width,l.height),f.strokeStyle="#e11d48",f.lineWidth=3*c,f.strokeRect((a.left-i.left)*c,(a.top-i.top)*c,a.width*c,a.height*c),l.toDataURL("image/png")}finally{t.style.visibility=n;for(let s of r.getTracks())s.stop()}}var Ri=0;function y(e,t,n,r,s,o){t||(t={});var i,a,c=t;if("ref"in c)for(a in c={},t)a=="ref"?i=t[a]:c[a]=t[a];var l={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ri,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(i=e.defaultProps))for(a in i)c[a]===void 0&&(c[a]=i[a]);return P.vnode&&P.vnode(l),l}var Ei=N({anchor:Oe,body:I(),screenshot:ue()}),yn="agent-canvas-review:draft";function is(e){try{if(e===null)sessionStorage.removeItem(yn);else sessionStorage.setItem(yn,JSON.stringify(e))}catch{}}function Ai(){try{let e=sessionStorage.getItem(yn);if(e===null)return null;let t=Ei.safeParse(JSON.parse(e));return t.success?t.data:null}catch{return null}}var Oi={open:"Note",queued:"Sent to Claude",working:"Claude is on it",resolved:"Resolved"},as='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [contenteditable]',cs="agent-canvas-review-picking",xn="agent-canvas-review:reveal";function Pi(e,t){let n=new URL(e);if(n.origin===location.origin&&n.pathname===location.pathname&&n.search===location.search){location.hash=n.hash;return}try{sessionStorage.setItem(xn,t)}catch{}location.href=e}function Ii(){try{let e=sessionStorage.getItem(xn);return sessionStorage.removeItem(xn),e}catch{return null}}function Ni(e){if(!e.endsWith(".html"))return!0;let t=decodeURI(location.pathname);return e==="/index.html"||t===e||t.endsWith("/")&&`${t}index.html`===e}function et(e){let t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}function tt(e){let t=new URL(e);return`${t.origin}${t.pathname}${t.search}${t.hash.split("?")[0]??""}`}function ls(e){if(e.quote!==void 0)return`“${e.quote.exact}”`;if(e.role!==void 0&&e.name!==void 0)return`${e.role} “${e.name}”`;if(e.text!==void 0)return e.text;return e.selector}function Mi(){let[e,t]=j(0);return re(()=>{let n=0,r=()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>t((o)=>o+1))};window.addEventListener("scroll",r,!0),window.addEventListener("resize",r);let s=setInterval(r,1000);return()=>{cancelAnimationFrame(n),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",r),clearInterval(s)}},[]),e}function Li(){let[e,t]=j(location.href);return re(()=>{let n=()=>t(location.href);window.addEventListener("hashchange",n),window.addEventListener("popstate",n);let r=setInterval(n,400);return()=>{window.removeEventListener("hashchange",n),window.removeEventListener("popstate",n),clearInterval(r)}},[]),e}function ji(e,t,n,r,s){re(()=>{if(!t)return;document.documentElement.classList.add(cs);let o=(v)=>v.composedPath().includes(e),i=(v)=>v.target instanceof Element?v.target.closest(as)??v.target:null,a=(v)=>{if(!o(v))n(i(v))},c=(v)=>{if(o(v))return;if(i(v)?.closest(as))v.preventDefault(),v.stopPropagation()},l=(v)=>{if(o(v))return;v.preventDefault(),v.stopPropagation();let u=window.getSelection(),p=u!==null&&u.rangeCount>0&&!u.isCollapsed?u.getRangeAt(0):void 0;if(p!==void 0){let M=p.commonAncestorContainer,_=M instanceof Element?M:M.parentElement;if(_!==null)return r(_,p)}let E=i(v);if(E!==null)r(E)},f=(v)=>{if(v.key==="Escape")s()};return document.addEventListener("mousemove",a,!0),document.addEventListener("pointerdown",c,!0),document.addEventListener("mousedown",c,!0),document.addEventListener("click",l,!0),document.addEventListener("keydown",f,!0),()=>{document.documentElement.classList.remove(cs),document.removeEventListener("mousemove",a,!0),document.removeEventListener("pointerdown",c,!0),document.removeEventListener("mousedown",c,!0),document.removeEventListener("click",l,!0),document.removeEventListener("keydown",f,!0)}},[e,t,n,r,s])}function $i(e){let r=Math.min(Math.max(8,e.left),window.innerWidth-320-8),s=e.top+e.height+8;return{top:s+190<window.innerHeight?s:Math.max(8,e.top-190-8),left:r}}function Di(e){let[t,n]=j(e.draft.body),[r,s]=j(e.draft.screenshot),{onChange:o}=e;re(()=>o(t,r),[o,t,r]);let[i,a]=j(!1),[c,l]=j(null),f=Rr(null);re(()=>f.current?.focus(),[]);let v=async(u)=>{if(t.trim()==="")return;a(!0),l(null);try{await e.onSubmit(t,u,r)}catch(p){l(p instanceof Error?p.message:String(p)),a(!1)}};return y("div",{class:"popover",style:$i(e.draft.box),children:[y("div",{class:"target",title:e.draft.anchor.selector,children:ls(e.draft.anchor)},void 0,!1,void 0,this),e.draft.anchor.components!==void 0&&y("div",{class:"target",children:e.draft.anchor.components.slice(-3).join(" › ")},void 0,!1,void 0,this),y("textarea",{ref:f,value:t,placeholder:"What should change here?",onInput:(u)=>n(u.currentTarget.value),onKeyDown:(u)=>{if(u.key==="Escape")e.onCancel();if(u.key==="Enter"&&(u.metaKey||u.ctrlKey))v(!0)}},void 0,!1,void 0,this),y("label",{class:"option",children:[y("input",{type:"checkbox",checked:r,onChange:(u)=>s(u.currentTarget.checked)},void 0,!1,void 0,this),"Attach a screenshot"]},void 0,!0,void 0,this),e.reloadPending&&y("div",{class:"reload-pending",children:[y("span",{children:"The application changed. It reloads once you save or cancel this comment."},void 0,!1,void 0,this),y("button",{type:"button",class:"ghost",onClick:()=>location.reload(),children:"Reload now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c!==null&&y("div",{class:"error",children:c},void 0,!1,void 0,this),y("div",{class:"actions",children:[y("button",{type:"button",class:"ghost",onClick:e.onCancel,children:"Cancel"},void 0,!1,void 0,this),y("button",{type:"button",disabled:i||t.trim()==="",onClick:()=>void v(!1),children:"Save note"},void 0,!1,void 0,this),y("button",{type:"button",class:"primary",disabled:i||t.trim()==="",onClick:()=>void v(!0),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y("div",{class:"hint",children:"Ctrl+Enter sends to Claude · Esc cancels"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Vi(e){let{thread:t,client:n}=e,[r,s]=j(null),[o,i]=j(null),a=(l)=>{i(null),l().catch((f)=>i(f instanceof Error?f.message:String(f)))},c=(l)=>{if(r===null||r.trim()==="")return;a(()=>n.comment(t.id,r,l).then(()=>s(null)))};return y("div",{class:`thread${e.number===null?"":" current"}${t.state==="resolved"?" resolved":""}`,children:[y("div",{class:"thread-head",children:[y("button",{type:"button",class:"ghost",title:"Show in page","aria-label":"Show in page",onClick:e.onReveal,children:e.number===null?"↗":`#${e.number}`},void 0,!1,void 0,this),y("span",{class:"target",title:t.anchor.url,children:ls(t.anchor)},void 0,!1,void 0,this),y("span",{class:`badge ${t.state}`,children:Oi[t.state]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.comments.map((l)=>y("div",{class:`comment ${l.author}`,children:[y("span",{class:"author",children:l.author==="user"?"You":"Claude"},void 0,!1,void 0,this),y("span",{class:"body",children:l.body},void 0,!1,void 0,this)]},l.id,!0,void 0,this)),r!==null&&y("textarea",{value:r,placeholder:"Reply…",onInput:(l)=>s(l.currentTarget.value),onKeyDown:(l)=>{if(l.key==="Enter"&&(l.metaKey||l.ctrlKey))c(!0)}},void 0,!1,void 0,this),o!==null&&y("div",{class:"error",children:o},void 0,!1,void 0,this),y("div",{class:"actions",children:r===null?y(Z,{children:[y("button",{type:"button",class:"ghost",onClick:()=>a(()=>n.delete(t.id)),children:"Delete"},void 0,!1,void 0,this),t.state==="resolved"?y("button",{type:"button",onClick:()=>a(()=>n.setResolved(t.id,!1)),children:"Reopen"},void 0,!1,void 0,this):y("button",{type:"button",onClick:()=>a(()=>n.setResolved(t.id,!0)),children:"Resolve"},void 0,!1,void 0,this),y("button",{type:"button",onClick:()=>s(""),children:"Reply"},void 0,!1,void 0,this),t.state==="open"&&y("button",{type:"button",class:"primary",onClick:()=>a(()=>n.send(t.id)),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):y(Z,{children:[y("button",{type:"button",class:"ghost",onClick:()=>s(null),children:"Cancel"},void 0,!1,void 0,this),y("button",{type:"button",disabled:r.trim()==="",onClick:()=>c(!1),children:"Reply"},void 0,!1,void 0,this),y("button",{type:"button",class:"primary",disabled:r.trim()==="",onClick:()=>c(!0),children:"Reply & send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function us(e){let{client:t,host:n}=e,[r,s]=j([]),[o,i]=j(!1),[a,c]=j(!1),[l,f]=j(!1),[v,u]=j(null),[p,E]=j(null),[M,_]=j(Ai),[b,g]=j(!1),[O,L]=j(!1),[A,F]=j(!1),[W,q]=j(!1),[X,K]=j(null),[Q,kn]=j(Ii),[Sn,Cn]=j(null),hs=Li(),ps=Mi();re(()=>(t.connect({threads:s,agentWatching:i,connected:c,reload:(k)=>{if(Ni(k))g(!0)}}),()=>t.close()),[t]);let Tn=Qe(()=>{f(!1),u(null)},[]),ms=Qe((k,H)=>{f(!1),u(null),window.getSelection()?.removeAllRanges(),_(null);let Y=rs(k,location.href,H);E({anchor:Y,box:et(k),element:k,sources:_n(mn(k)),body:"",screenshot:!1})},[]),Pt=Qe(()=>{E(null),is(null)},[]),It=p?.anchor,_s=Qe((k,H)=>{if(It!==void 0)is({anchor:It,body:k,screenshot:H})},[It]);ji(n,l,u,ms,Tn);let gs=()=>{L(!1),Pt(),f(!0)},ve=tt(hs),Nt=Ct(()=>r.filter((k)=>tt(k.anchor.url)===ve&&(!W||k.state!=="resolved")),[r,ve,W]),Rn=A?r.filter((k)=>!W||k.state!=="resolved"):Nt,En=new Map(Nt.map((k,H)=>[k.id,H+1])),An=r.filter((k)=>k.state!=="resolved").length,Mt=r.filter(Or).length,vs=()=>{K(null),t.sendNotes().catch((k)=>K(k instanceof Error?k.message:String(k)))};re(()=>{if(Q===null)return;let k=r.find((Y)=>Y.id===Q);if(k===void 0||tt(k.anchor.url)!==ve)return;let H=Ot(document,k.anchor);if(H===null)return;H.scrollIntoView({block:"center",behavior:"smooth"}),kn(null),setTimeout(()=>Cn(et(H)),350),setTimeout(()=>Cn(null),1600)},[Q,r,ve]),re(()=>{if(b&&p===null)location.reload()},[b,p]),re(()=>{if(M===null||p!==null||tt(M.anchor.url)!==ve)return;let k=Ot(document,M.anchor);if(k===null)return;_(null),E({...M,box:et(k),element:k,sources:_n(mn(k))})},[M,p,ve,ps]);let ys=(k)=>{if(kn(k.id),tt(k.anchor.url)!==ve)Pi(k.anchor.url,k.id)},On=!a?t.offlineLabel:o?"Claude is listening":"Claude is not listening",Pn=v===null?null:et(v);return y(Z,{children:[Pn!==null&&y("div",{class:"highlight",style:Pn},void 0,!1,void 0,this),Sn!==null&&y("div",{class:"highlight flash",style:Sn},void 0,!1,void 0,this),Nt.map((k)=>{let H=Ot(document,k.anchor);if(H===null)return null;let Y=et(H);if(Y.width===0&&Y.height===0)return null;return y("button",{type:"button",class:`pin ${k.state}`,style:{top:Math.max(0,Y.top-11),left:Math.max(0,Y.left+Y.width-11)},title:k.comments[0]?.body,onClick:()=>L(!0),children:En.get(k.id)},k.id,!1,void 0,this)}),p!==null&&y(Di,{draft:p,reloadPending:b,onChange:_s,onCancel:Pt,onSubmit:async(k,H,Y)=>{let xs=Y?await os(p.element,n):void 0,In=await p.sources;await t.createThread(In.length===0?p.anchor:{...p.anchor,sources:In},k,H,xs),Pt()}},void 0,!1,void 0,this),O&&y("aside",{class:"panel",children:[y("header",{children:[y("h2",{children:"Review"},void 0,!1,void 0,this),y("button",{type:"button",class:"ghost",onClick:()=>L(!1),children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y("div",{class:"tabs",children:[y("button",{type:"button",class:A?"":"active",onClick:()=>F(!1),children:"This page"},void 0,!1,void 0,this),y("button",{type:"button",class:A?"active":"",onClick:()=>F(!0),children:"All pages"},void 0,!1,void 0,this),y("button",{type:"button",class:W?"active":"",onClick:()=>q(!W),children:"Hide resolved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Mt>0&&y("div",{class:"send-notes",children:y("button",{type:"button",class:"primary",onClick:vs,children:["Send ",Mt===1?"1 note":`${Mt} notes`," to Claude"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X!==null&&y("div",{class:"error",children:X},void 0,!1,void 0,this),y("div",{class:"threads",children:[Rn.length===0&&y("div",{class:"empty",children:"No comments yet. Click “Comment”, then an element or a text selection."},void 0,!1,void 0,this),Rn.map((k)=>y(Vi,{thread:k,number:En.get(k.id)??null,client:t,onReveal:()=>ys(k)},k.id,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y("div",{class:`toolbar${O?" beside-panel":""}`,children:[y("span",{class:"presence",title:On,children:[y("span",{class:`dot ${!a?"off-line":o?"on":""}`},void 0,!1,void 0,this),On]},void 0,!0,void 0,this),y("button",{type:"button",class:l?"active":"",onClick:()=>l?Tn():gs(),children:l?"Pick an element…":"Comment"},void 0,!1,void 0,this),y("button",{type:"button",class:O?"active":"",onClick:()=>L(!O),children:["Threads",An>0?` (${An})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var ds="agent-canvas-review",bn="agent-canvas-review:remote",Ui="off";function Fi(){let e=new URLSearchParams(location.hash.slice(1)).get(nn);if(e!==null){if(history.replaceState(history.state,"",`${location.pathname}${location.search}`),e===Ui){try{localStorage.removeItem(bn)}catch{}return null}let t=sn(e);if(t===null)return console.error("agent-canvas review: the review link is malformed"),null;try{localStorage.setItem(bn,fr(t))}catch{}return t}try{let t=localStorage.getItem(bn);return t===null?null:sn(t)}catch{return null}}function fs(e){if(document.querySelector(ds)!==null)return;let t=document.createElement("style");t.textContent="html.agent-canvas-review-picking, html.agent-canvas-review-picking * { cursor: crosshair !important; }",document.head.append(t);let n=document.createElement(ds);document.documentElement.append(n);let r=n.attachShadow({mode:"open"}),s=document.createElement("style");s.textContent=gr,r.append(s),Yn(y(us,{client:e,host:n},void 0,!1,void 0,this),r)}async function Bi(e){let t=new URL(e.src).origin,n=e.dataset.project;if(n!==void 0){if(!Jt.test(n)){console.error(`agent-canvas review: data-project must match ${Jt}, got "${n}"`);return}fs(new on(t,n));return}let r=Fi();if(r===null)return;fs(new an(t,r.projectId,await Jn(r.key)))}var wn=document.currentScript;if(wn instanceof HTMLScriptElement){if(Bi(wn),wn.dataset.project===void 0)window.addEventListener("hashchange",()=>{if(new URLSearchParams(location.hash.slice(1)).has(nn))location.reload()})}else console.error("agent-canvas review: load review.js with a classic <script> tag");})();