agent-canvas 0.2.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +42 -17
  2. package/bin/agent-canvas.js +7 -7
  3. package/bin/agent-canvas.ts +48 -37
  4. package/bin/lib/commands/daemon.ts +46 -43
  5. package/bin/lib/commands/exec.ts +100 -100
  6. package/bin/lib/commands/fetch.ts +15 -15
  7. package/bin/lib/commands/install.ts +36 -36
  8. package/bin/lib/commands/instructions.ts +51 -51
  9. package/bin/lib/commands/push.ts +115 -97
  10. package/bin/lib/commands/review.ts +190 -0
  11. package/bin/lib/commands/watch.ts +24 -24
  12. package/bin/lib/config.ts +12 -12
  13. package/bin/lib/daemon-lifecycle.ts +47 -51
  14. package/bin/lib/helpers.ts +82 -76
  15. package/bin/lib/instructions/app-review.md +88 -0
  16. package/bin/lib/instructions/component-checklist.md +7 -5
  17. package/bin/lib/instructions/component-custom.md +20 -14
  18. package/bin/lib/instructions/component-diff.md +4 -3
  19. package/bin/lib/instructions/component-item.md +18 -8
  20. package/bin/lib/instructions/component-markdown.md +4 -2
  21. package/bin/lib/instructions/component-mermaid.md +12 -6
  22. package/bin/lib/instructions/component-multichoice.md +6 -2
  23. package/bin/lib/instructions/component-note.md +1 -1
  24. package/bin/lib/instructions/component-priority.md +1 -1
  25. package/bin/lib/instructions/component-rangeinput.md +9 -2
  26. package/bin/lib/instructions/component-secretinput.md +12 -11
  27. package/bin/lib/instructions/component-svg.md +62 -16
  28. package/bin/lib/instructions/component-table.md +6 -6
  29. package/bin/lib/instructions/component-usefeedback.md +8 -8
  30. package/bin/lib/instructions/component-userinput.md +6 -2
  31. package/bin/lib/instructions/flow-feature.md +22 -5
  32. package/bin/lib/instructions/flow-plan.md +5 -5
  33. package/bin/lib/instructions/flow-runbook.md +28 -25
  34. package/bin/lib/instructions/overview.md +27 -18
  35. package/bin/lib/instructions/theming.md +5 -0
  36. package/daemon/build.ts +171 -152
  37. package/daemon/client/App.tsx +1205 -1077
  38. package/daemon/client/CompareView.tsx +478 -458
  39. package/daemon/client/FileBrowser.tsx +241 -203
  40. package/daemon/client/FileViewer.tsx +220 -211
  41. package/daemon/client/OverviewView.tsx +283 -267
  42. package/daemon/client/ReviewerIdentityDialog.tsx +72 -71
  43. package/daemon/client/RevisionSelect.tsx +111 -95
  44. package/daemon/client/SessionSwitcher.tsx +81 -81
  45. package/daemon/client/ShareDialog.tsx +211 -212
  46. package/daemon/client/apiSchemas.ts +78 -0
  47. package/daemon/client/canvas-runtime.ts +1 -1
  48. package/daemon/client/clientApi.ts +194 -206
  49. package/daemon/client/components/SecretInput.tsx +138 -138
  50. package/daemon/client/components/index.ts +2 -2
  51. package/daemon/client/domDiff.ts +341 -333
  52. package/daemon/client/errorMessage.ts +3 -0
  53. package/daemon/client/exportMarkdown.ts +222 -201
  54. package/daemon/client/lcs.ts +19 -14
  55. package/daemon/client/shareCrypto.ts +57 -57
  56. package/daemon/client/unifiedDiff.ts +660 -649
  57. package/daemon/dist/annotations-runtime.js +1 -1
  58. package/daemon/dist/client.css +2 -2
  59. package/daemon/dist/client.js +77 -80
  60. package/daemon/dist/components.js +59 -59
  61. package/daemon/dist/preact-compat.js +1 -1
  62. package/daemon/dist/review.js +361 -0
  63. package/daemon/dist/runtime.js +1 -1
  64. package/daemon/langMap.ts +24 -6
  65. package/daemon/review-widget/anchor.ts +187 -0
  66. package/daemon/review-widget/client.ts +95 -0
  67. package/daemon/review-widget/index.tsx +36 -0
  68. package/daemon/review-widget/markup.ts +71 -0
  69. package/daemon/review-widget/screenshot.ts +91 -0
  70. package/daemon/review-widget/source.ts +103 -0
  71. package/daemon/review-widget/styles.css +359 -0
  72. package/daemon/review-widget/text-modules.d.ts +4 -0
  73. package/daemon/review-widget/tsconfig.json +16 -0
  74. package/daemon/review-widget/widget.tsx +436 -0
  75. package/daemon/src/components.ts +3 -3
  76. package/daemon/src/handlers/api.ts +330 -328
  77. package/daemon/src/handlers/files.ts +112 -105
  78. package/daemon/src/handlers/static.ts +47 -46
  79. package/daemon/src/handlers/uploads.ts +61 -56
  80. package/daemon/src/paths.ts +13 -10
  81. package/daemon/src/remote-feedback.ts +192 -192
  82. package/daemon/src/review/markdown.ts +52 -0
  83. package/daemon/src/review/model.ts +132 -0
  84. package/daemon/src/review/proxy.ts +177 -0
  85. package/daemon/src/review/server.ts +199 -0
  86. package/daemon/src/review/store.ts +151 -0
  87. package/daemon/src/server.ts +127 -86
  88. package/daemon/src/share.ts +163 -169
  89. package/daemon/src/stubFetch.ts +7 -0
  90. package/daemon/tsconfig.json +19 -19
  91. package/package.json +47 -47
  92. package/skills/canvas/SKILL.md +9 -1
  93. package/bin/lib/commands/exec.test.ts +0 -27
  94. package/bin/lib/helpers.test.ts +0 -79
  95. package/daemon/src/remote-feedback.test.ts +0 -165
  96. package/daemon/src/secrets-api.test.ts +0 -123
  97. package/daemon/src/share-e2e.test.ts +0 -277
  98. package/daemon/src/share.test.ts +0 -289
@@ -0,0 +1,361 @@
1
+ (()=>{var D4=Object.create;var{getPrototypeOf:S4,defineProperty:U0,getOwnPropertyNames:L4}=Object;var v4=Object.prototype.hasOwnProperty;function E4($){return this[$]}var k4,f4,C4=($,J,Q)=>{var W=$!=null&&typeof $==="object";if(W){var Y=J?k4??=new WeakMap:f4??=new WeakMap,q=Y.get($);if(q)return q}Q=$!=null?D4(S4($)):{};let X=J||!$||!$.__esModule?U0(Q,"default",{value:$,enumerable:!0}):Q;for(let G of L4($))if(!v4.call(X,G))U0(X,G,{get:E4.bind($,G),enumerable:!0});if(W)Y.set($,X);return X};var P4=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports);var I4=($)=>$;function T4($,J){this[$]=I4.bind(null,J)}var g4=($,J)=>{for(var Q in J)U0($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:T4.bind(J,Q)})};var X4=P4((u0,d0)=>{(function($,J){typeof u0==="object"&&typeof d0<"u"?d0.exports=J():typeof define==="function"&&define.amd?define(J):($=typeof globalThis<"u"?globalThis:$||self,$.resolveURI=J())})(u0,function(){let $=/^[\w+.-]+:\/\//,J=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,Q=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function W(V){return $.test(V)}function Y(V){return V.startsWith("//")}function q(V){return V.startsWith("/")}function X(V){return V.startsWith("file:")}function G(V){return/^[.?#]/.test(V)}function H(V){let U=J.exec(V);return j(U[1],U[2]||"",U[3],U[4]||"",U[5]||"/",U[6]||"",U[7]||"")}function B(V){let U=Q.exec(V),F=U[2];return j("file:","",U[1]||"","",q(F)?F:"/"+F,U[3]||"",U[4]||"")}function j(V,U,F,f,g,C,y){return{scheme:V,user:U,host:F,port:f,path:g,query:C,hash:y,type:7}}function A(V){if(Y(V)){let F=H("http:"+V);return F.scheme="",F.type=6,F}if(q(V)){let F=H("http://foo.com"+V);return F.scheme="",F.host="",F.type=5,F}if(X(V))return B(V);if(W(V))return H(V);let U=H("http://foo.com/"+V);return U.scheme="",U.host="",U.type=V?V.startsWith("?")?3:V.startsWith("#")?2:4:1,U}function z(V){if(V.endsWith("/.."))return V;let U=V.lastIndexOf("/");return V.slice(0,U+1)}function w(V,U){if(k(U,U.type),V.path==="/")V.path=U.path;else V.path=z(U.path)+V.path}function k(V,U){let F=U<=4,f=V.path.split("/"),g=1,C=0,y=!1;for(let c=1;c<f.length;c++){let o=f[c];if(!o){y=!0;continue}if(y=!1,o===".")continue;if(o===".."){if(C)y=!0,C--,g--;else if(F)f[g++]=o;continue}f[g++]=o,C++}let i="";for(let c=1;c<g;c++)i+="/"+f[c];if(!i||y&&!i.endsWith("/.."))i+="/";V.path=i}function I(V,U){if(!V&&!U)return"";let F=A(V),f=F.type;if(U&&f!==7){let C=A(U),y=C.type;switch(f){case 1:F.hash=C.hash;case 2:F.query=C.query;case 3:case 4:w(F,C);case 5:F.user=C.user,F.host=C.host,F.port=C.port;case 6:F.scheme=C.scheme}if(y>f)f=y}k(F,f);let g=F.query+F.hash;switch(f){case 2:case 3:return g;case 4:{let C=F.path.slice(1);if(!C)return g||".";if(G(U||V)&&!G(C))return"./"+C+g;return C+g}case 5:return F.path+g;default:return F.scheme+"//"+F.user+F.host+F.port+F.path+g}}return I})});var X0,P,Y2,x4,B1,$2,q2,X2,O0,$0,l1,G2,S0,R0,D0,h4,W0={},Y0=[],Z4=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,G0=Array.isArray;function Y1($,J){for(var Q in J)$[Q]=J[Q];return $}function L0($){$&&$.parentNode&&$.parentNode.removeChild($)}function y4($,J,Q){var W,Y,q,X={};for(q in J)q=="key"?W=J[q]:q=="ref"?Y=J[q]:X[q]=J[q];if(arguments.length>2&&(X.children=arguments.length>3?X0.call(arguments,2):Q),typeof $=="function"&&$.defaultProps!=null)for(q in $.defaultProps)X[q]===void 0&&(X[q]=$.defaultProps[q]);return J0($,X,W,Y,null)}function J0($,J,Q,W,Y){var q={type:$,props:J,key:Q,ref:W,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:Y==null?++Y2:Y,__i:-1,__u:0};return Y==null&&P.vnode!=null&&P.vnode(q),q}function e($){return $.children}function Q0($,J){this.props=$,this.context=J}function A1($,J){if(J==null)return $.__?A1($.__,$.__i+1):null;for(var Q;J<$.__k.length;J++)if((Q=$.__k[J])!=null&&Q.__e!=null)return Q.__e;return typeof $.type=="function"?A1($):null}function m4($){if($.__P&&$.__d){var J=$.__v,Q=J.__e,W=[],Y=[],q=Y1({},J);q.__v=J.__v+1,P.vnode&&P.vnode(q),v0($.__P,q,J,$.__n,$.__P.namespaceURI,32&J.__u?[Q]:null,W,Q==null?A1(J):Q,!!(32&J.__u),Y),q.__v=J.__v,q.__.__k[q.__i]=q,M2(W,q,Y),J.__e=J.__=null,q.__e!=Q&&H2(q)}}function H2($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(J){if(J!=null&&J.__e!=null)return $.__e=$.__c.base=J.__e}),H2($)}function J2($){(!$.__d&&($.__d=!0)&&B1.push($)&&!q0.__r++||$2!=P.debounceRendering)&&(($2=P.debounceRendering)||q2)(q0)}function q0(){try{for(var $,J=1;B1.length;)B1.length>J&&B1.sort(X2),$=B1.shift(),J=B1.length,m4($)}finally{B1.length=q0.__r=0}}function B2($,J,Q,W,Y,q,X,G,H,B,j){var A,z,w,k,I,V,U=W&&W.__k||Y0,F=J.length;for(H=l4(Q,J,U,H,F),A=0;A<F;A++)(w=Q.__k[A])!=null&&(z=w.__i!=-1&&U[w.__i]||W0,w.__i=A,V=v0($,w,z,Y,q,X,G,H,B,j),k=w.__e,w.ref&&z.ref!=w.ref&&(z.ref&&E0(z.ref,null,w),j.push(w.ref,w.__c||k,w)),I==null&&k!=null&&(I=k),4&w.__u?(H=z2(w,H,$),z.__e&&(z.__e=null)):typeof w.type=="function"&&V!==void 0?H=V:k&&(H=k.nextSibling),w.__u&=-7);return Q.__e=I,H}function l4($,J,Q,W,Y){var q,X,G,H,B,j=Q.length,A=j,z=0;for($.__k=Array(Y),q=0;q<Y;q++)(X=J[q])!=null&&typeof X!="boolean"&&typeof X!="function"?(typeof X=="string"||typeof X=="number"||typeof X=="bigint"||X.constructor==String?X=$.__k[q]=J0(null,X,null,null,null):G0(X)?X=$.__k[q]=J0(e,{children:X},null,null,null):X.constructor===void 0&&X.__b>0?X=$.__k[q]=J0(X.type,X.props,X.key,X.ref?X.ref:null,X.__v):$.__k[q]=X,H=q+z,X.__=$,X.__b=$.__b+1,G=null,(B=X.__i=c4(X,Q,H,A))!=-1&&(A--,(G=Q[B])&&(G.__u|=2)),G==null||G.__v==null?(B==-1&&(Y>j?z--:Y<j&&z++),typeof X.type!="function"&&(X.__u|=4)):B!=H&&(B==H-1?z--:B==H+1?z++:(B>H?z--:z++,X.__u|=4))):$.__k[q]=null;if(A)for(q=0;q<j;q++)(G=Q[q])!=null&&(2&G.__u)==0&&(G.__e==W&&(W=A1(G)),K2(G,G));return W}function z2($,J,Q){var W,Y;if(typeof $.type=="function"){for(W=$.__k,Y=0;W&&Y<W.length;Y++)W[Y]&&(W[Y].__=$,J=z2(W[Y],J,Q));return J}$.__e!=J&&(J&&$.type&&!J.parentNode&&(J=A1($)),J=Q.insertBefore($.__e,J||null));do J=J&&J.nextSibling;while(J!=null&&J.nodeType==8);return J}function c4($,J,Q,W){var Y,q,X,G=$.key,H=$.type,B=J[Q],j=B!=null&&(2&B.__u)==0;if(B===null&&G==null||j&&G==B.key&&H==B.type)return Q;if(W>(j?1:0)){for(Y=Q-1,q=Q+1;Y>=0||q<J.length;)if((B=J[X=Y>=0?Y--:q++])!=null&&(2&B.__u)==0&&G==B.key&&H==B.type)return X}return-1}function Q2($,J,Q){J[0]=="-"?$.setProperty(J,Q==null?"":Q):$[J]=Q==null?"":typeof Q!="number"||Z4.test(J)?Q:Q+"px"}function e1($,J,Q,W,Y){var q,X;$:if(J=="style")if(typeof Q=="string")$.style.cssText=Q;else{if(typeof W=="string"&&($.style.cssText=W=""),W)for(J in W)Q&&J in Q||Q2($.style,J,"");if(Q)for(J in Q)W&&Q[J]==W[J]||Q2($.style,J,Q[J])}else if(J[0]=="o"&&J[1]=="n")q=J!=(J=J.replace(G2,"$1")),X=J.toLowerCase(),J=X in $||J=="onFocusOut"||J=="onFocusIn"?X.slice(2):J.slice(2),$.l||($.l={}),$.l[J+q]=Q,Q?W?Q[l1]=W[l1]:(Q[l1]=S0,$.addEventListener(J,q?D0:R0,q)):$.removeEventListener(J,q?D0:R0,q);else{if(Y=="http://www.w3.org/2000/svg")J=J.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(J!="width"&&J!="height"&&J!="href"&&J!="list"&&J!="form"&&J!="tabIndex"&&J!="download"&&J!="rowSpan"&&J!="colSpan"&&J!="role"&&J!="popover"&&J in $)try{$[J]=Q==null?"":Q;break $}catch(G){}typeof Q=="function"||(Q==null||Q===!1&&J[4]!="-"?$.removeAttribute(J):$.setAttribute(J,J=="popover"&&Q==1?"":Q))}}function W2($){return function(J){if(this.l){var Q=this.l[J.type+$];if(J[$0]==null)J[$0]=S0++;else if(J[$0]<Q[l1])return;return Q(P.event?P.event(J):J)}}}function v0($,J,Q,W,Y,q,X,G,H,B){var j,A,z,w,k,I,V,U,F,f,g,C,y,i,c,o,u=J.type;if(J.constructor!==void 0)return null;128&Q.__u&&(H=!!(32&Q.__u),q=[G=J.__e=Q.__e]),(j=P.__b)&&j(J);$:if(typeof u=="function"){A=X.length;try{if(F=J.props,f=u.prototype&&u.prototype.render,g=(j=u.contextType)&&W[j.__c],C=j?g?g.props.value:j.__:W,Q.__c?U=(z=J.__c=Q.__c).__=z.__E:(f?J.__c=z=new u(F,C):(J.__c=z=new Q0(F,C),z.constructor=u,z.render=u4),g&&g.sub(z),z.state||(z.state={}),z.__n=W,w=z.__d=!0,z.__h=[],z._sb=[]),f&&z.__s==null&&(z.__s=z.state),f&&u.getDerivedStateFromProps!=null&&(z.__s==z.state&&(z.__s=Y1({},z.__s)),Y1(z.__s,u.getDerivedStateFromProps(F,z.__s))),k=z.props,I=z.state,z.__v=J,w)f&&u.getDerivedStateFromProps==null&&z.componentWillMount!=null&&z.componentWillMount(),f&&z.componentDidMount!=null&&z.__h.push(z.componentDidMount);else{if(f&&u.getDerivedStateFromProps==null&&F!==k&&z.componentWillReceiveProps!=null&&z.componentWillReceiveProps(F,C),J.__v==Q.__v||!z.__e&&z.shouldComponentUpdate!=null&&z.shouldComponentUpdate(F,z.__s,C)===!1){J.__v!=Q.__v&&(z.props=F,z.state=z.__s,z.__d=!1),J.__e=Q.__e,J.__k=Q.__k,J.__k.some(function(H1){H1&&(H1.__=J)}),Y0.push.apply(z.__h,z._sb),z._sb=[],z.__h.length&&X.push(z),G=A1(Q);break $}z.componentWillUpdate!=null&&z.componentWillUpdate(F,z.__s,C),f&&z.componentDidUpdate!=null&&z.__h.push(function(){z.componentDidUpdate(k,I,V)})}if(z.context=C,z.props=F,z.__P=$,z.__e=!1,y=P.__r,i=0,f)z.state=z.__s,z.__d=!1,y&&y(J),j=z.render(z.props,z.state,z.context),Y0.push.apply(z.__h,z._sb),z._sb=[];else do z.__d=!1,y&&y(J),j=z.render(z.props,z.state,z.context),z.state=z.__s;while(z.__d&&++i<25);z.state=z.__s,z.getChildContext!=null&&(W=Y1(Y1({},W),z.getChildContext())),f&&!w&&z.getSnapshotBeforeUpdate!=null&&(V=z.getSnapshotBeforeUpdate(k,I)),c=j!=null&&j.type===e&&j.key==null?j2(j.props.children):j,G=B2($,G0(c)?c:[c],J,Q,W,Y,q,X,G,H,B),z.base=J.__e,J.__u&=-161,z.__h.length&&X.push(z),U&&(z.__E=z.__=null)}catch(H1){if(X.length=A,J.__v=null,H||q!=null){if(H1.then){for(J.__u|=H?160:128;G&&G.nodeType==8&&G.nextSibling;)G=G.nextSibling;q!=null&&(q[q.indexOf(G)]=null),J.__e=G}else if(q!=null)for(o=q.length;o--;)L0(q[o])}else J.__e=Q.__e;J.__k==null&&(J.__k=Q.__k||[]),H1.then||_2(J),P.__e(H1,J,Q)}}else q==null&&J.__v==Q.__v?(J.__k=Q.__k,J.__e=Q.__e):G=J.__e=p4(Q.__e,J,Q,W,Y,q,X,H,B);return(j=P.diffed)&&j(J),128&J.__u?void 0:G}function _2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(_2))}function M2($,J,Q){for(var W=0;W<Q.length;W++)E0(Q[W],Q[++W],Q[++W]);P.__c&&P.__c(J,$),$.some(function(Y){try{$=Y.__h,Y.__h=[],$.some(function(q){q.call(Y)})}catch(q){P.__e(q,Y.__v)}})}function j2($){return typeof $!="object"||$==null||$.__b>0?$:G0($)?$.map(j2):$.constructor!==void 0?null:Y1({},$)}function p4($,J,Q,W,Y,q,X,G,H){var B,j,A,z,w,k,I,V=Q.props||W0,U=J.props,F=J.type;if(F=="svg"?Y="http://www.w3.org/2000/svg":F=="math"?Y="http://www.w3.org/1998/Math/MathML":Y||(Y="http://www.w3.org/1999/xhtml"),q!=null){for(B=0;B<q.length;B++)if((w=q[B])&&"setAttribute"in w==!!F&&(F?w.localName==F:w.nodeType==3)){$=w,q[B]=null;break}}if($==null){if(F==null)return document.createTextNode(U);$=document.createElementNS(Y,F,U.is&&U),G&&(P.__m&&P.__m(J,q),G=!1),q=null}if(F==null)V===U||G&&$.data==U||($.data=U);else{if(q=F=="textarea"&&U.defaultValue!=null?null:q&&X0.call($.childNodes),!G&&q!=null)for(V={},B=0;B<$.attributes.length;B++)V[(w=$.attributes[B]).name]=w.value;for(B in V)w=V[B],B=="dangerouslySetInnerHTML"?A=w:B=="children"||(B in U)||B=="value"&&("defaultValue"in U)||B=="checked"&&("defaultChecked"in U)||e1($,B,null,w,Y);for(B in U)w=U[B],B=="children"?z=w:B=="dangerouslySetInnerHTML"?j=w:B=="value"?k=w:B=="checked"?I=w:G&&typeof w!="function"||V[B]===w||e1($,B,w,V[B],Y);if(j)G||A&&(j.__html==A.__html||j.__html==$.innerHTML)||($.innerHTML=j.__html),J.__k=[];else if(A&&($.innerHTML=""),B2(J.type=="template"?$.content:$,G0(z)?z:[z],J,Q,W,F=="foreignObject"?"http://www.w3.org/1999/xhtml":Y,q,X,q?q[0]:Q.__k&&A1(Q,0),G,H),q!=null)for(B=q.length;B--;)L0(q[B]);G&&F!="textarea"||(B="value",F=="progress"&&k==null?$.removeAttribute("value"):k!=null&&(k!==$[B]||F=="progress"&&!k||F=="option"&&k!=V[B])&&e1($,B,k,V[B],Y),B="checked",I!=null&&I!=$[B]&&e1($,B,I,V[B],Y))}return $}function E0($,J,Q){try{if(typeof $=="function"){var W=typeof $.__u=="function";W&&$.__u(),W&&J==null||($.__u=$(J))}else $.current=J}catch(Y){P.__e(Y,Q)}}function K2($,J,Q){var W,Y;if(P.unmount&&P.unmount($),(W=$.ref)&&(W.current&&W.current!=$.__e||E0(W,null,J)),(W=$.__c)!=null){if(W.componentWillUnmount)try{W.componentWillUnmount()}catch(q){P.__e(q,J)}W.base=W.__P=W.__n=null}if(W=$.__k)for(Y=0;Y<W.length;Y++)W[Y]&&K2(W[Y],J,Q||typeof $.type!="function");Q||L0($.__e),$.__c=$.__=$.__e=void 0}function u4($,J,Q){return this.constructor($,Q)}function V2($,J,Q){var W,Y,q,X;J==document&&(J=document.documentElement),P.__&&P.__($,J),Y=(W=typeof Q=="function")?null:Q&&Q.__k||J.__k,q=[],X=[],v0(J,$=(!W&&Q||J).__k=y4(e,null,[$]),Y||W0,W0,J.namespaceURI,!W&&Q?[Q]:Y?null:J.firstChild?X0.call(J.childNodes):null,q,!W&&Q?Q:Y?Y.__e:J.firstChild,W,X),M2(q,$,X),$.props.children=null}X0=Y0.slice,P={__e:function($,J,Q,W){for(var Y,q,X;J=J.__;)if((Y=J.__c)&&!Y.__)try{if((q=Y.constructor)&&q.getDerivedStateFromError!=null&&(Y.setState(q.getDerivedStateFromError($)),X=Y.__d),Y.componentDidCatch!=null&&(Y.componentDidCatch($,W||{}),X=Y.__d),X)return Y.__E=Y}catch(G){$=G}throw $}},Y2=0,x4=function($){return $!=null&&$.constructor===void 0},Q0.prototype.setState=function($,J){var Q;Q=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Y1({},this.state),typeof $=="function"&&($=$(Y1({},Q),this.props)),$&&Y1(Q,$),$!=null&&this.__v&&(J&&this._sb.push(J),J2(this))},Q0.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),J2(this))},Q0.prototype.render=e,B1=[],q2=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,X2=function($,J){return $.__v.__b-J.__v.__b},q0.__r=0,O0=Math.random().toString(8),$0="__d"+O0,l1="__a"+O0,G2=/(PointerCapture)$|Capture$/i,S0=0,R0=W2(!1),D0=W2(!0),h4=0;var D={};g4(D,{void:()=>E8,util:()=>v,unknown:()=>L8,union:()=>P8,undefined:()=>R8,tuple:()=>g8,transformer:()=>d8,symbol:()=>O8,string:()=>D2,strictObject:()=>C8,setErrorMap:()=>o4,set:()=>Z8,record:()=>x8,quotelessJson:()=>d4,promise:()=>u8,preprocess:()=>r8,pipeline:()=>a8,ostring:()=>n8,optional:()=>i8,onumber:()=>s8,oboolean:()=>t8,objectUtil:()=>k0,object:()=>f8,number:()=>S2,nullable:()=>o8,null:()=>D8,never:()=>v8,nativeEnum:()=>p8,nan:()=>N8,map:()=>h8,makeIssue:()=>c1,literal:()=>l8,lazy:()=>m8,late:()=>F8,isValid:()=>z1,isDirty:()=>B0,isAsync:()=>S1,isAborted:()=>H0,intersection:()=>T8,instanceof:()=>w8,getParsedType:()=>$1,getErrorMap:()=>D1,function:()=>y8,enum:()=>c8,effect:()=>d8,discriminatedUnion:()=>I8,defaultErrorMap:()=>q1,datetimeRegex:()=>U2,date:()=>U8,custom:()=>R2,coerce:()=>e8,boolean:()=>L2,bigint:()=>b8,array:()=>k8,any:()=>S8,addIssueToContext:()=>K,ZodVoid:()=>u1,ZodUnknown:()=>_1,ZodUnion:()=>C1,ZodUndefined:()=>k1,ZodType:()=>L,ZodTuple:()=>Q1,ZodTransformer:()=>t,ZodSymbol:()=>p1,ZodString:()=>r,ZodSet:()=>b1,ZodSchema:()=>L,ZodRecord:()=>d1,ZodReadonly:()=>Z1,ZodPromise:()=>U1,ZodPipeline:()=>r1,ZodParsedType:()=>M,ZodOptional:()=>n,ZodObject:()=>T,ZodNumber:()=>M1,ZodNullable:()=>G1,ZodNull:()=>f1,ZodNever:()=>J1,ZodNativeEnum:()=>g1,ZodNaN:()=>o1,ZodMap:()=>i1,ZodLiteral:()=>T1,ZodLazy:()=>I1,ZodIssueCode:()=>_,ZodIntersection:()=>P1,ZodFunction:()=>v1,ZodFirstPartyTypeKind:()=>R,ZodError:()=>p,ZodEnum:()=>K1,ZodEffects:()=>t,ZodDiscriminatedUnion:()=>z0,ZodDefault:()=>x1,ZodDate:()=>w1,ZodCatch:()=>h1,ZodBranded:()=>_0,ZodBoolean:()=>E1,ZodBigInt:()=>j1,ZodArray:()=>a,ZodAny:()=>N1,Schema:()=>L,ParseStatus:()=>m,OK:()=>l,NEVER:()=>$6,INVALID:()=>O,EMPTY_PATH:()=>r4,DIRTY:()=>F1,BRAND:()=>A8});var v;(function($){$.assertEqual=(Y)=>{};function J(Y){}$.assertIs=J;function Q(Y){throw Error()}$.assertNever=Q,$.arrayToEnum=(Y)=>{let q={};for(let X of Y)q[X]=X;return q},$.getValidEnumValues=(Y)=>{let q=$.objectKeys(Y).filter((G)=>typeof Y[Y[G]]!=="number"),X={};for(let G of q)X[G]=Y[G];return $.objectValues(X)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(q){return Y[q]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let q=[];for(let X in Y)if(Object.prototype.hasOwnProperty.call(Y,X))q.push(X);return q},$.find=(Y,q)=>{for(let X of Y)if(q(X))return X;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function W(Y,q=" | "){return Y.map((X)=>typeof X==="string"?`'${X}'`:X).join(q)}$.joinValues=W,$.jsonStringifyReplacer=(Y,q)=>{if(typeof q==="bigint")return q.toString();return q}})(v||(v={}));var k0;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(k0||(k0={}));var M=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$1=($)=>{switch(typeof $){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN($)?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($))return M.array;if($===null)return M.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return M.promise;if(typeof Map<"u"&&$ instanceof Map)return M.map;if(typeof Set<"u"&&$ instanceof Set)return M.set;if(typeof Date<"u"&&$ instanceof Date)return M.date;return M.object;default:return M.unknown}};var _=v.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"]),d4=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class p extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(Y){return Y.message},Q={_errors:[]},W=(Y)=>{for(let q of Y.issues)if(q.code==="invalid_union")q.unionErrors.map(W);else if(q.code==="invalid_return_type")W(q.returnTypeError);else if(q.code==="invalid_arguments")W(q.argumentsError);else if(q.path.length===0)Q._errors.push(J(q));else{let X=Q,G=0;while(G<q.path.length){let H=q.path[G];if(G!==q.path.length-1)X[H]=X[H]||{_errors:[]};else X[H]=X[H]||{_errors:[]},X[H]._errors.push(J(q));X=X[H],G++}}};return W(this),Q}static assert($){if(!($ instanceof p))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let W of this.issues)if(W.path.length>0){let Y=W.path[0];J[Y]=J[Y]||[],J[Y].push($(W))}else Q.push($(W));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}p.create=($)=>{return new p($)};var i4=($,J)=>{let Q;switch($.code){case _.invalid_type:if($.received===M.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case _.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,v.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:Q=`Unrecognized key(s) in object: ${v.joinValues($.keys,", ")}`;break;case _.invalid_union:Q="Invalid input";break;case _.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${v.joinValues($.options)}`;break;case _.invalid_enum_value:Q=`Invalid enum value. Expected ${v.joinValues($.options)}, received '${$.received}'`;break;case _.invalid_arguments:Q="Invalid function arguments";break;case _.invalid_return_type:Q="Invalid function return type";break;case _.invalid_date:Q="Invalid date";break;case _.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else v.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case _.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case _.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case _.custom:Q="Invalid input";break;case _.invalid_intersection_types:Q="Intersection results could not be merged";break;case _.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case _.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,v.assertNever($)}return{message:Q}},q1=i4;var A2=q1;function o4($){A2=$}function D1(){return A2}var c1=($)=>{let{data:J,path:Q,errorMaps:W,issueData:Y}=$,q=[...Q,...Y.path||[]],X={...Y,path:q};if(Y.message!==void 0)return{...Y,path:q,message:Y.message};let G="",H=W.filter((B)=>!!B).slice().reverse();for(let B of H)G=B(X,{data:J,defaultError:G}).message;return{...Y,path:q,message:G}},r4=[];function K($,J){let Q=D1(),W=c1({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===q1?void 0:q1].filter((Y)=>!!Y)});$.common.issues.push(W)}class m{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let W of J){if(W.status==="aborted")return O;if(W.status==="dirty")$.dirty();Q.push(W.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let W of J){let Y=await W.key,q=await W.value;Q.push({key:Y,value:q})}return m.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let W of J){let{key:Y,value:q}=W;if(Y.status==="aborted")return O;if(q.status==="aborted")return O;if(Y.status==="dirty")$.dirty();if(q.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof q.value<"u"||W.alwaysSet))Q[Y.value]=q.value}return{status:$.value,value:Q}}}var O=Object.freeze({status:"aborted"}),F1=($)=>({status:"dirty",value:$}),l=($)=>({status:"valid",value:$}),H0=($)=>$.status==="aborted",B0=($)=>$.status==="dirty",z1=($)=>$.status==="valid",S1=($)=>typeof Promise<"u"&&$ instanceof Promise;var N;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(N||(N={}));class s{constructor($,J,Q,W){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=W}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 F2=($,J)=>{if(z1(J))return{success:!0,data:J.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 Q=new p($.common.issues);return this._error=Q,this._error}}}};function S($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:W,description:Y}=$;if(J&&(Q||W))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:Y};return{errorMap:(X,G)=>{let{message:H}=$;if(X.code==="invalid_enum_value")return{message:H??G.defaultError};if(typeof G.data>"u")return{message:H??W??G.defaultError};if(X.code!=="invalid_type")return{message:G.defaultError};return{message:H??Q??G.defaultError}},description:Y}}class L{get description(){return this._def.description}_getType($){return $1($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:$1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new m,ctx:{common:$.parent.common,data:$.data,parsedType:$1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(S1(J))throw Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:$1($)},W=this._parseSync({data:$,path:Q.path,parent:Q});return F2(Q,W)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:$1($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return z1(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>z1(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:$1($)},W=this._parse({data:$,path:Q.path,parent:Q}),Y=await(S1(W)?W:Promise.resolve(W));return F2(Q,Y)}refine($,J){let Q=(W)=>{if(typeof J==="string"||typeof J>"u")return{message:J};else if(typeof J==="function")return J(W);else return J};return this._refinement((W,Y)=>{let q=$(W),X=()=>Y.addIssue({code:_.custom,...Q(W)});if(typeof Promise<"u"&&q instanceof Promise)return q.then((G)=>{if(!G)return X(),!1;else return!0});if(!q)return X(),!1;else return!0})}refinement($,J){return this._refinement((Q,W)=>{if(!$(Q))return W.addIssue(typeof J==="function"?J(Q,W):J),!1;else return!0})}_refinement($){return new t({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:(J)=>this["~validate"](J)}}optional(){return n.create(this,this._def)}nullable(){return G1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return a.create(this)}promise(){return U1.create(this,this._def)}or($){return C1.create([this,$],this._def)}and($){return P1.create(this,$,this._def)}transform($){return new t({...S(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new x1({...S(this._def),innerType:this,defaultValue:J,typeName:R.ZodDefault})}brand(){return new _0({typeName:R.ZodBranded,type:this,...S(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new h1({...S(this._def),innerType:this,catchValue:J,typeName:R.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return r1.create(this,$)}readonly(){return Z1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var a4=/^c[^\s-]{8,}$/i,n4=/^[0-9a-z]+$/,s4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,t4=/^[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,e4=/^[a-z0-9_-]{21}$/i,$8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J8=/^[-+]?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)?)??$/,Q8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,W8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",f0,Y8=/^(?:(?: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])$/,q8=/^(?:(?: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])$/,X8=/^(([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]))$/,G8=/^(([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])$/,H8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B8=/^([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])))",z8=new RegExp(`^${N2}$`);function b2($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function _8($){return new RegExp(`^${b2($)}$`)}function U2($){let J=`${N2}T${b2($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function M8($,J){if((J==="v4"||!J)&&Y8.test($))return!0;if((J==="v6"||!J)&&X8.test($))return!0;return!1}function j8($,J){if(!$8.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let W=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(W));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(J&&Y.alg!==J)return!1;return!0}catch{return!1}}function K8($,J){if((J==="v4"||!J)&&q8.test($))return!0;if((J==="v6"||!J)&&G8.test($))return!0;return!1}class r extends L{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==M.string){let Y=this._getOrReturnCtx($);return K(Y,{code:_.invalid_type,expected:M.string,received:Y.parsedType}),O}let Q=new m,W=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)W=this._getOrReturnCtx($,W),K(W,{code:_.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)W=this._getOrReturnCtx($,W),K(W,{code:_.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let q=$.data.length>Y.value,X=$.data.length<Y.value;if(q||X){if(W=this._getOrReturnCtx($,W),q)K(W,{code:_.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(X)K(W,{code:_.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!Q8.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"email",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!f0)f0=new RegExp(W8,"u");if(!f0.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"emoji",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!t4.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"uuid",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!e4.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"nanoid",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!a4.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"cuid",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!n4.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"cuid2",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!s4.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"ulid",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{W=this._getOrReturnCtx($,W),K(W,{validation:"url",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"regex",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!U2(Y).test($.data))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!z8.test($.data))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!_8(Y).test($.data))W=this._getOrReturnCtx($,W),K(W,{code:_.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!J8.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"duration",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!M8($.data,Y.version))W=this._getOrReturnCtx($,W),K(W,{validation:"ip",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!j8($.data,Y.alg))W=this._getOrReturnCtx($,W),K(W,{validation:"jwt",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!K8($.data,Y.version))W=this._getOrReturnCtx($,W),K(W,{validation:"cidr",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!H8.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"base64",code:_.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!B8.test($.data))W=this._getOrReturnCtx($,W),K(W,{validation:"base64url",code:_.invalid_string,message:Y.message}),Q.dirty()}else v.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((W)=>$.test(W),{validation:J,code:_.invalid_string,...N.errToObj(Q)})}_addCheck($){return new r({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...N.errToObj($)})}url($){return this._addCheck({kind:"url",...N.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...N.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...N.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...N.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...N.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...N.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...N.errToObj($)})}base64($){return this._addCheck({kind:"base64",...N.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...N.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...N.errToObj($)})}ip($){return this._addCheck({kind:"ip",...N.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...N.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,...N.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,...N.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...N.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...N.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...N.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...N.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...N.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...N.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...N.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...N.errToObj(J)})}nonempty($){return this.min(1,N.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 J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}r.create=($)=>{return new r({checks:[],typeName:R.ZodString,coerce:$?.coerce??!1,...S($)})};function V8($,J){let Q=($.toString().split(".")[1]||"").length,W=(J.toString().split(".")[1]||"").length,Y=Q>W?Q:W,q=Number.parseInt($.toFixed(Y).replace(".","")),X=Number.parseInt(J.toFixed(Y).replace(".",""));return q%X/10**Y}class M1 extends L{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($)!==M.number){let Y=this._getOrReturnCtx($);return K(Y,{code:_.invalid_type,expected:M.number,received:Y.parsedType}),O}let Q=void 0,W=new m;for(let Y of this._def.checks)if(Y.kind==="int"){if(!v.isInteger($.data))Q=this._getOrReturnCtx($,Q),K(Q,{code:_.invalid_type,expected:"integer",received:"float",message:Y.message}),W.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),K(Q,{code:_.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),W.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),K(Q,{code:_.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),W.dirty()}else if(Y.kind==="multipleOf"){if(V8($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),K(Q,{code:_.not_multiple_of,multipleOf:Y.value,message:Y.message}),W.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),K(Q,{code:_.not_finite,message:Y.message}),W.dirty()}else v.assertNever(Y);return{status:W.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,N.toString(J))}gt($,J){return this.setLimit("min",$,!1,N.toString(J))}lte($,J){return this.setLimit("max",$,!0,N.toString(J))}lt($,J){return this.setLimit("max",$,!1,N.toString(J))}setLimit($,J,Q,W){return new M1({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:N.toString(W)}]})}_addCheck($){return new M1({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:N.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:N.toString(J)})}finite($){return this._addCheck({kind:"finite",message:N.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&v.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}M1.create=($)=>{return new M1({checks:[],typeName:R.ZodNumber,coerce:$?.coerce||!1,...S($)})};class j1 extends L{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($)!==M.bigint)return this._getInvalidInput($);let Q=void 0,W=new m;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),K(Q,{code:_.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),W.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),K(Q,{code:_.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),W.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),K(Q,{code:_.not_multiple_of,multipleOf:Y.value,message:Y.message}),W.dirty()}else v.assertNever(Y);return{status:W.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:M.bigint,received:J.parsedType}),O}gte($,J){return this.setLimit("min",$,!0,N.toString(J))}gt($,J){return this.setLimit("min",$,!1,N.toString(J))}lte($,J){return this.setLimit("max",$,!0,N.toString(J))}lt($,J){return this.setLimit("max",$,!1,N.toString(J))}setLimit($,J,Q,W){return new j1({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:N.toString(W)}]})}_addCheck($){return new j1({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:N.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}j1.create=($)=>{return new j1({checks:[],typeName:R.ZodBigInt,coerce:$?.coerce??!1,...S($)})};class E1 extends L{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==M.boolean){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.boolean,received:Q.parsedType}),O}return l($.data)}}E1.create=($)=>{return new E1({typeName:R.ZodBoolean,coerce:$?.coerce||!1,...S($)})};class w1 extends L{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==M.date){let Y=this._getOrReturnCtx($);return K(Y,{code:_.invalid_type,expected:M.date,received:Y.parsedType}),O}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return K(Y,{code:_.invalid_date}),O}let Q=new m,W=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)W=this._getOrReturnCtx($,W),K(W,{code:_.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)W=this._getOrReturnCtx($,W),K(W,{code:_.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else v.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new w1({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:N.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:N.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}w1.create=($)=>{return new w1({checks:[],coerce:$?.coerce||!1,typeName:R.ZodDate,...S($)})};class p1 extends L{_parse($){if(this._getType($)!==M.symbol){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.symbol,received:Q.parsedType}),O}return l($.data)}}p1.create=($)=>{return new p1({typeName:R.ZodSymbol,...S($)})};class k1 extends L{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.undefined,received:Q.parsedType}),O}return l($.data)}}k1.create=($)=>{return new k1({typeName:R.ZodUndefined,...S($)})};class f1 extends L{_parse($){if(this._getType($)!==M.null){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.null,received:Q.parsedType}),O}return l($.data)}}f1.create=($)=>{return new f1({typeName:R.ZodNull,...S($)})};class N1 extends L{constructor(){super(...arguments);this._any=!0}_parse($){return l($.data)}}N1.create=($)=>{return new N1({typeName:R.ZodAny,...S($)})};class _1 extends L{constructor(){super(...arguments);this._unknown=!0}_parse($){return l($.data)}}_1.create=($)=>{return new _1({typeName:R.ZodUnknown,...S($)})};class J1 extends L{_parse($){let J=this._getOrReturnCtx($);return K(J,{code:_.invalid_type,expected:M.never,received:J.parsedType}),O}}J1.create=($)=>{return new J1({typeName:R.ZodNever,...S($)})};class u1 extends L{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.void,received:Q.parsedType}),O}return l($.data)}}u1.create=($)=>{return new u1({typeName:R.ZodVoid,...S($)})};class a extends L{_parse($){let{ctx:J,status:Q}=this._processInputParams($),W=this._def;if(J.parsedType!==M.array)return K(J,{code:_.invalid_type,expected:M.array,received:J.parsedType}),O;if(W.exactLength!==null){let q=J.data.length>W.exactLength.value,X=J.data.length<W.exactLength.value;if(q||X)K(J,{code:q?_.too_big:_.too_small,minimum:X?W.exactLength.value:void 0,maximum:q?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Q.dirty()}if(W.minLength!==null){if(J.data.length<W.minLength.value)K(J,{code:_.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Q.dirty()}if(W.maxLength!==null){if(J.data.length>W.maxLength.value)K(J,{code:_.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((q,X)=>{return W.type._parseAsync(new s(J,q,J.path,X))})).then((q)=>{return m.mergeArray(Q,q)});let Y=[...J.data].map((q,X)=>{return W.type._parseSync(new s(J,q,J.path,X))});return m.mergeArray(Q,Y)}get element(){return this._def.type}min($,J){return new a({...this._def,minLength:{value:$,message:N.toString(J)}})}max($,J){return new a({...this._def,maxLength:{value:$,message:N.toString(J)}})}length($,J){return new a({...this._def,exactLength:{value:$,message:N.toString(J)}})}nonempty($){return this.min(1,$)}}a.create=($,J)=>{return new a({type:$,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...S(J)})};function L1($){if($ instanceof T){let J={};for(let Q in $.shape){let W=$.shape[Q];J[Q]=n.create(L1(W))}return new T({...$._def,shape:()=>J})}else if($ instanceof a)return new a({...$._def,type:L1($.element)});else if($ instanceof n)return n.create(L1($.unwrap()));else if($ instanceof G1)return G1.create(L1($.unwrap()));else if($ instanceof Q1)return Q1.create($.items.map((J)=>L1(J)));else return $}class T extends L{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(),J=v.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==M.object){let H=this._getOrReturnCtx($);return K(H,{code:_.invalid_type,expected:M.object,received:H.parsedType}),O}let{status:Q,ctx:W}=this._processInputParams($),{shape:Y,keys:q}=this._getCached(),X=[];if(!(this._def.catchall instanceof J1&&this._def.unknownKeys==="strip")){for(let H in W.data)if(!q.includes(H))X.push(H)}let G=[];for(let H of q){let B=Y[H],j=W.data[H];G.push({key:{status:"valid",value:H},value:B._parse(new s(W,j,W.path,H)),alwaysSet:H in W.data})}if(this._def.catchall instanceof J1){let H=this._def.unknownKeys;if(H==="passthrough")for(let B of X)G.push({key:{status:"valid",value:B},value:{status:"valid",value:W.data[B]}});else if(H==="strict"){if(X.length>0)K(W,{code:_.unrecognized_keys,keys:X}),Q.dirty()}else if(H==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let H=this._def.catchall;for(let B of X){let j=W.data[B];G.push({key:{status:"valid",value:B},value:H._parse(new s(W,j,W.path,B)),alwaysSet:B in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let H=[];for(let B of G){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(Q,H)});else return m.mergeObjectSync(Q,G)}get shape(){return this._def.shape()}strict($){return N.errToObj,new T({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let W=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:N.errToObj($).message??W};return{message:W}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend($){return new T({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new T({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:R.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new T({...this._def,catchall:$})}pick($){let J={};for(let Q of v.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new T({...this._def,shape:()=>J})}omit($){let J={};for(let Q of v.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new T({...this._def,shape:()=>J})}deepPartial(){return L1(this)}partial($){let J={};for(let Q of v.objectKeys(this.shape)){let W=this.shape[Q];if($&&!$[Q])J[Q]=W;else J[Q]=W.optional()}return new T({...this._def,shape:()=>J})}required($){let J={};for(let Q of v.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof n)Y=Y._def.innerType;J[Q]=Y}return new T({...this._def,shape:()=>J})}keyof(){return O2(v.objectKeys(this.shape))}}T.create=($,J)=>{return new T({shape:()=>$,unknownKeys:"strip",catchall:J1.create(),typeName:R.ZodObject,...S(J)})};T.strictCreate=($,J)=>{return new T({shape:()=>$,unknownKeys:"strict",catchall:J1.create(),typeName:R.ZodObject,...S(J)})};T.lazycreate=($,J)=>{return new T({shape:$,unknownKeys:"strip",catchall:J1.create(),typeName:R.ZodObject,...S(J)})};class C1 extends L{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function W(Y){for(let X of Y)if(X.result.status==="valid")return X.result;for(let X of Y)if(X.result.status==="dirty")return J.common.issues.push(...X.ctx.common.issues),X.result;let q=Y.map((X)=>new p(X.ctx.common.issues));return K(J,{code:_.invalid_union,unionErrors:q}),O}if(J.common.async)return Promise.all(Q.map(async(Y)=>{let q={...J,common:{...J.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:J.data,path:J.path,parent:q}),ctx:q}})).then(W);else{let Y=void 0,q=[];for(let G of Q){let H={...J,common:{...J.common,issues:[]},parent:null},B=G._parseSync({data:J.data,path:J.path,parent:H});if(B.status==="valid")return B;else if(B.status==="dirty"&&!Y)Y={result:B,ctx:H};if(H.common.issues.length)q.push(H.common.issues)}if(Y)return J.common.issues.push(...Y.ctx.common.issues),Y.result;let X=q.map((G)=>new p(G));return K(J,{code:_.invalid_union,unionErrors:X}),O}}get options(){return this._def.options}}C1.create=($,J)=>{return new C1({options:$,typeName:R.ZodUnion,...S(J)})};var X1=($)=>{if($ instanceof I1)return X1($.schema);else if($ instanceof t)return X1($.innerType());else if($ instanceof T1)return[$.value];else if($ instanceof K1)return $.options;else if($ instanceof g1)return v.objectValues($.enum);else if($ instanceof x1)return X1($._def.innerType);else if($ instanceof k1)return[void 0];else if($ instanceof f1)return[null];else if($ instanceof n)return[void 0,...X1($.unwrap())];else if($ instanceof G1)return[null,...X1($.unwrap())];else if($ instanceof _0)return X1($.unwrap());else if($ instanceof Z1)return X1($.unwrap());else if($ instanceof h1)return X1($._def.innerType);else return[]};class z0 extends L{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==M.object)return K(J,{code:_.invalid_type,expected:M.object,received:J.parsedType}),O;let Q=this.discriminator,W=J.data[Q],Y=this.optionsMap.get(W);if(!Y)return K(J,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),O;if(J.common.async)return Y._parseAsync({data:J.data,path:J.path,parent:J});else return Y._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let W=new Map;for(let Y of J){let q=X1(Y.shape[$]);if(!q.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let X of q){if(W.has(X))throw Error(`Discriminator property ${String($)} has duplicate value ${String(X)}`);W.set(X,Y)}}return new z0({typeName:R.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:W,...S(Q)})}}function C0($,J){let Q=$1($),W=$1(J);if($===J)return{valid:!0,data:$};else if(Q===M.object&&W===M.object){let Y=v.objectKeys(J),q=v.objectKeys($).filter((G)=>Y.indexOf(G)!==-1),X={...$,...J};for(let G of q){let H=C0($[G],J[G]);if(!H.valid)return{valid:!1};X[G]=H.data}return{valid:!0,data:X}}else if(Q===M.array&&W===M.array){if($.length!==J.length)return{valid:!1};let Y=[];for(let q=0;q<$.length;q++){let X=$[q],G=J[q],H=C0(X,G);if(!H.valid)return{valid:!1};Y.push(H.data)}return{valid:!0,data:Y}}else if(Q===M.date&&W===M.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class P1 extends L{_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=(Y,q)=>{if(H0(Y)||H0(q))return O;let X=C0(Y.value,q.value);if(!X.valid)return K(Q,{code:_.invalid_intersection_types}),O;if(B0(Y)||B0(q))J.dirty();return{status:J.value,value:X.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,q])=>W(Y,q));else return W(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}P1.create=($,J,Q)=>{return new P1({left:$,right:J,typeName:R.ZodIntersection,...S(Q)})};class Q1 extends L{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.array)return K(Q,{code:_.invalid_type,expected:M.array,received:Q.parsedType}),O;if(Q.data.length<this._def.items.length)return K(Q,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;if(!this._def.rest&&Q.data.length>this._def.items.length)K(Q,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let Y=[...Q.data].map((q,X)=>{let G=this._def.items[X]||this._def.rest;if(!G)return null;return G._parse(new s(Q,q,Q.path,X))}).filter((q)=>!!q);if(Q.common.async)return Promise.all(Y).then((q)=>{return m.mergeArray(J,q)});else return m.mergeArray(J,Y)}get items(){return this._def.items}rest($){return new Q1({...this._def,rest:$})}}Q1.create=($,J)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q1({items:$,typeName:R.ZodTuple,rest:null,...S(J)})};class d1 extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.object)return K(Q,{code:_.invalid_type,expected:M.object,received:Q.parsedType}),O;let W=[],Y=this._def.keyType,q=this._def.valueType;for(let X in Q.data)W.push({key:Y._parse(new s(Q,X,Q.path,X)),value:q._parse(new s(Q,Q.data[X],Q.path,X)),alwaysSet:X in Q.data});if(Q.common.async)return m.mergeObjectAsync(J,W);else return m.mergeObjectSync(J,W)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof L)return new d1({keyType:$,valueType:J,typeName:R.ZodRecord,...S(Q)});return new d1({keyType:r.create(),valueType:$,typeName:R.ZodRecord,...S(J)})}}class i1 extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.map)return K(Q,{code:_.invalid_type,expected:M.map,received:Q.parsedType}),O;let W=this._def.keyType,Y=this._def.valueType,q=[...Q.data.entries()].map(([X,G],H)=>{return{key:W._parse(new s(Q,X,Q.path,[H,"key"])),value:Y._parse(new s(Q,G,Q.path,[H,"value"]))}});if(Q.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let G of q){let H=await G.key,B=await G.value;if(H.status==="aborted"||B.status==="aborted")return O;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}})}else{let X=new Map;for(let G of q){let{key:H,value:B}=G;if(H.status==="aborted"||B.status==="aborted")return O;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}}}}i1.create=($,J,Q)=>{return new i1({valueType:J,keyType:$,typeName:R.ZodMap,...S(Q)})};class b1 extends L{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.set)return K(Q,{code:_.invalid_type,expected:M.set,received:Q.parsedType}),O;let W=this._def;if(W.minSize!==null){if(Q.data.size<W.minSize.value)K(Q,{code:_.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),J.dirty()}if(W.maxSize!==null){if(Q.data.size>W.maxSize.value)K(Q,{code:_.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),J.dirty()}let Y=this._def.valueType;function q(G){let H=new Set;for(let B of G){if(B.status==="aborted")return O;if(B.status==="dirty")J.dirty();H.add(B.value)}return{status:J.value,value:H}}let X=[...Q.data.values()].map((G,H)=>Y._parse(new s(Q,G,Q.path,H)));if(Q.common.async)return Promise.all(X).then((G)=>q(G));else return q(X)}min($,J){return new b1({...this._def,minSize:{value:$,message:N.toString(J)}})}max($,J){return new b1({...this._def,maxSize:{value:$,message:N.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}b1.create=($,J)=>{return new b1({valueType:$,minSize:null,maxSize:null,typeName:R.ZodSet,...S(J)})};class v1 extends L{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==M.function)return K(J,{code:_.invalid_type,expected:M.function,received:J.parsedType}),O;function Q(X,G){return c1({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,D1(),q1].filter((H)=>!!H),issueData:{code:_.invalid_arguments,argumentsError:G}})}function W(X,G){return c1({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,D1(),q1].filter((H)=>!!H),issueData:{code:_.invalid_return_type,returnTypeError:G}})}let Y={errorMap:J.common.contextualErrorMap},q=J.data;if(this._def.returns instanceof U1){let X=this;return l(async function(...G){let H=new p([]),B=await X._def.args.parseAsync(G,Y).catch((z)=>{throw H.addIssue(Q(G,z)),H}),j=await Reflect.apply(q,this,B);return await X._def.returns._def.type.parseAsync(j,Y).catch((z)=>{throw H.addIssue(W(j,z)),H})})}else{let X=this;return l(function(...G){let H=X._def.args.safeParse(G,Y);if(!H.success)throw new p([Q(G,H.error)]);let B=Reflect.apply(q,this,H.data),j=X._def.returns.safeParse(B,Y);if(!j.success)throw new p([W(B,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new v1({...this._def,args:Q1.create($).rest(_1.create())})}returns($){return new v1({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new v1({args:$?$:Q1.create([]).rest(_1.create()),returns:J||_1.create(),typeName:R.ZodFunction,...S(Q)})}}class I1 extends L{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}I1.create=($,J)=>{return new I1({getter:$,typeName:R.ZodLazy,...S(J)})};class T1 extends L{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return K(J,{received:J.data,code:_.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:$.data}}get value(){return this._def.value}}T1.create=($,J)=>{return new T1({value:$,typeName:R.ZodLiteral,...S(J)})};function O2($,J){return new K1({values:$,typeName:R.ZodEnum,...S(J)})}class K1 extends L{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return K(J,{expected:v.joinValues(Q),received:J.parsedType,code:_.invalid_type}),O}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return K(J,{received:J.data,code:_.invalid_enum_value,options:Q}),O}return l($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return K1.create($,{...this._def,...J})}exclude($,J=this._def){return K1.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}K1.create=O2;class g1 extends L{_parse($){let J=v.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==M.string&&Q.parsedType!==M.number){let W=v.objectValues(J);return K(Q,{expected:v.joinValues(W),received:Q.parsedType,code:_.invalid_type}),O}if(!this._cache)this._cache=new Set(v.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let W=v.objectValues(J);return K(Q,{received:Q.data,code:_.invalid_enum_value,options:W}),O}return l($.data)}get enum(){return this._def.values}}g1.create=($,J)=>{return new g1({values:$,typeName:R.ZodNativeEnum,...S(J)})};class U1 extends L{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==M.promise&&J.common.async===!1)return K(J,{code:_.invalid_type,expected:M.promise,received:J.parsedType}),O;let Q=J.parsedType===M.promise?J.data:Promise.resolve(J.data);return l(Q.then((W)=>{return this._def.type.parseAsync(W,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}U1.create=($,J)=>{return new U1({type:$,typeName:R.ZodPromise,...S(J)})};class t extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),W=this._def.effect||null,Y={addIssue:(q)=>{if(K(Q,q),q.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),W.type==="preprocess"){let q=W.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(q).then(async(X)=>{if(J.value==="aborted")return O;let G=await this._def.schema._parseAsync({data:X,path:Q.path,parent:Q});if(G.status==="aborted")return O;if(G.status==="dirty")return F1(G.value);if(J.value==="dirty")return F1(G.value);return G});else{if(J.value==="aborted")return O;let X=this._def.schema._parseSync({data:q,path:Q.path,parent:Q});if(X.status==="aborted")return O;if(X.status==="dirty")return F1(X.value);if(J.value==="dirty")return F1(X.value);return X}}if(W.type==="refinement"){let q=(X)=>{let G=W.refinement(X,Y);if(Q.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return O;if(X.status==="dirty")J.dirty();return q(X.value),{status:J.value,value:X.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(X.status==="aborted")return O;if(X.status==="dirty")J.dirty();return q(X.value).then(()=>{return{status:J.value,value:X.value}})})}if(W.type==="transform")if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!z1(q))return O;let X=W.transform(q.value,Y);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:X}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(!z1(q))return O;return Promise.resolve(W.transform(q.value,Y)).then((X)=>({status:J.value,value:X}))});v.assertNever(W)}}t.create=($,J,Q)=>{return new t({schema:$,typeName:R.ZodEffects,effect:J,...S(Q)})};t.createWithPreprocess=($,J,Q)=>{return new t({schema:J,effect:{type:"preprocess",transform:$},typeName:R.ZodEffects,...S(Q)})};class n extends L{_parse($){if(this._getType($)===M.undefined)return l(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}n.create=($,J)=>{return new n({innerType:$,typeName:R.ZodOptional,...S(J)})};class G1 extends L{_parse($){if(this._getType($)===M.null)return l(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}G1.create=($,J)=>{return new G1({innerType:$,typeName:R.ZodNullable,...S(J)})};class x1 extends L{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===M.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}x1.create=($,J)=>{return new x1({innerType:$,typeName:R.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...S(J)})};class h1 extends L{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},W=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(S1(W))return W.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new p(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new p(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}h1.create=($,J)=>{return new h1({innerType:$,typeName:R.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...S(J)})};class o1 extends L{_parse($){if(this._getType($)!==M.nan){let Q=this._getOrReturnCtx($);return K(Q,{code:_.invalid_type,expected:M.nan,received:Q.parsedType}),O}return{status:"valid",value:$.data}}}o1.create=($)=>{return new o1({typeName:R.ZodNaN,...S($)})};var A8=Symbol("zod_brand");class _0 extends L{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class r1 extends L{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return O;if(Y.status==="dirty")return J.dirty(),F1(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let W=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return O;if(W.status==="dirty")return J.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Q.path,parent:Q})}}static create($,J){return new r1({in:$,out:J,typeName:R.ZodPipeline})}}class Z1 extends L{_parse($){let J=this._def.innerType._parse($),Q=(W)=>{if(z1(W))W.value=Object.freeze(W.value);return W};return S1(J)?J.then((W)=>Q(W)):Q(J)}unwrap(){return this._def.innerType}}Z1.create=($,J)=>{return new Z1({innerType:$,typeName:R.ZodReadonly,...S(J)})};function w2($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function R2($,J={},Q){if($)return N1.create().superRefine((W,Y)=>{let q=$(W);if(q instanceof Promise)return q.then((X)=>{if(!X){let G=w2(J,W),H=G.fatal??Q??!0;Y.addIssue({code:"custom",...G,fatal:H})}});if(!q){let X=w2(J,W),G=X.fatal??Q??!0;Y.addIssue({code:"custom",...X,fatal:G})}return});return N1.create()}var F8={object:T.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 w8=($,J={message:`Input not instance of ${$.name}`})=>R2((Q)=>Q instanceof $,J),D2=r.create,S2=M1.create,N8=o1.create,b8=j1.create,L2=E1.create,U8=w1.create,O8=p1.create,R8=k1.create,D8=f1.create,S8=N1.create,L8=_1.create,v8=J1.create,E8=u1.create,k8=a.create,f8=T.create,C8=T.strictCreate,P8=C1.create,I8=z0.create,T8=P1.create,g8=Q1.create,x8=d1.create,h8=i1.create,Z8=b1.create,y8=v1.create,m8=I1.create,l8=T1.create,c8=K1.create,p8=g1.create,u8=U1.create,d8=t.create,i8=n.create,o8=G1.create,r8=t.createWithPreprocess,a8=r1.create,n8=()=>D2().optional(),s8=()=>S2().optional(),t8=()=>L2().optional(),e8={string:($)=>r.create({...$,coerce:!0}),number:($)=>M1.create({...$,coerce:!0}),boolean:($)=>E1.create({...$,coerce:!0}),bigint:($)=>j1.create({...$,coerce:!0}),date:($)=>w1.create({...$,coerce:!0})};var $6=O;var P0=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;function J6($){let J;try{J=new URL($)}catch{return!1}if(J.protocol!=="http:"&&J.protocol!=="https:")return!1;return J.hostname==="localhost"||J.hostname==="127.0.0.1"||J.hostname==="[::1]"||J.hostname.endsWith(".localhost")}var O1=D.string().max(500),M0=4000,Q6=D.object({label:O1,file:D.string().max(1000),line:D.number().int().positive(),column:D.number().int().nonnegative()}),E2=D.object({url:D.string().min(1).max(2000),selector:D.string().max(2000),role:O1.optional(),name:O1.optional(),text:O1.optional(),components:D.array(D.string().max(200)).max(20).optional(),sources:D.array(Q6).max(10).optional(),context:O1.optional(),html:D.string().max(M0).optional(),quote:D.object({exact:D.string().min(1).max(2000),before:O1,after:O1}).optional()}),W6=D.enum(["user","agent"]),Y6=D.object({id:D.string(),author:W6,body:D.string().min(1).max(20000),createdAt:D.string()}),q6=D.enum(["open","queued","working","resolved"]),I0=D.object({id:D.string(),anchor:E2,state:q6,comments:D.array(Y6).min(1),screenshot:D.string().optional(),createdAt:D.string(),updatedAt:D.string()}),d$=D.object({threads:D.array(I0)}),T0=D.string().trim().min(1).max(20000),v2="data:image/png;base64,",X6=D.string().startsWith(v2).max(8000000).transform(($)=>Uint8Array.from(atob($.slice(v2.length)),(J)=>J.charCodeAt(0))),i$=D.object({anchor:E2,body:T0,send:D.boolean(),screenshot:X6.optional()}),o$=D.object({body:T0,send:D.boolean()}),r$=D.object({body:T0,resolve:D.boolean()}),k2=D.string().url().refine(($)=>J6($),"must be an http(s) URL on localhost"),a$=D.object({target:k2}),n$=D.object({target:k2,port:D.number().int().min(1).max(65535)});var f2=D.object({threads:D.array(I0)});function C2($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function G6($){if(typeof $!=="string")return;let J;try{J=JSON.parse($)}catch{return}if(!C2(J))return;if(J.type==="agent-status"&&typeof J.watching==="boolean")return{type:"agent-status",watching:J.watching};if(J.type!=="threads")return;let Q=f2.safeParse(J);return Q.success?{type:"threads",threads:Q.data.threads}:void 0}class g0{daemonOrigin;project;socket=null;closed=!1;constructor($,J){this.daemonOrigin=$;this.project=J}connect($){let J=`${this.daemonOrigin.replace(/^http/,"ws")}/ws/review/${encodeURIComponent(this.project)}`,Q=new WebSocket(J);this.socket=Q,Q.onopen=()=>{$.connected(!0),this.request("GET","/threads").then((W)=>{let Y=f2.safeParse(W);if(Y.success)$.threads(Y.data.threads)})},Q.onmessage=(W)=>{let Y=G6(W.data);if(Y?.type==="threads")$.threads(Y.threads);if(Y?.type==="agent-status")$.agentWatching(Y.watching)},Q.onclose=()=>{if($.connected(!1),!this.closed)setTimeout(()=>this.connect($),2000)}}close(){this.closed=!0,this.socket?.close()}createThread($,J,Q,W){return this.request("POST","/threads",{anchor:$,body:J,send:Q,...W===void 0?{}:{screenshot:W}})}comment($,J,Q){return this.request("POST",`/threads/${$}/comments`,{body:J,send:Q})}send($){return this.request("POST",`/threads/${$}/send`)}setResolved($,J){return this.request("POST",`/threads/${$}/${J?"resolve":"reopen"}`)}delete($){return this.request("DELETE",`/threads/${$}`)}async request($,J,Q){let W=await fetch(`${this.daemonOrigin}/api/review/${encodeURIComponent(this.project)}${J}`,{method:$,...Q===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)}}),Y=await W.json();if(!W.ok)throw Error(C2(Y)&&typeof Y.error==="string"?Y.error:`Request failed (${W.status})`);return Y}}var P2=`:host {
2
+ all: initial;
3
+ --bg: #ffffff;
4
+ --bg-muted: #f4f4f5;
5
+ --text: #18181b;
6
+ --text-muted: #71717a;
7
+ --border: #e4e4e7;
8
+ --accent: #6d28d9;
9
+ --accent-text: #ffffff;
10
+ --accent-soft: #ede9fe;
11
+ --ok: #15803d;
12
+ --ok-soft: #dcfce7;
13
+ --warn: #b45309;
14
+ --warn-soft: #fef3c7;
15
+ --shadow: 0 8px 28px rgba(24, 24, 27, 0.18), 0 1px 3px rgba(24, 24, 27, 0.12);
16
+ font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
17
+ font-size: 13px;
18
+ line-height: 1.45;
19
+ color: var(--text);
20
+ }
21
+
22
+ @media (prefers-color-scheme: dark) {
23
+ :host {
24
+ --bg: #18181b;
25
+ --bg-muted: #27272a;
26
+ --text: #f4f4f5;
27
+ --text-muted: #a1a1aa;
28
+ --border: #3f3f46;
29
+ --accent: #a78bfa;
30
+ --accent-text: #18181b;
31
+ --accent-soft: #2e1065;
32
+ --ok: #4ade80;
33
+ --ok-soft: #14532d;
34
+ --warn: #fbbf24;
35
+ --warn-soft: #451a03;
36
+ }
37
+ }
38
+
39
+ * {
40
+ box-sizing: border-box;
41
+ }
42
+
43
+ button {
44
+ font: inherit;
45
+ color: inherit;
46
+ cursor: pointer;
47
+ border: 1px solid var(--border);
48
+ background: var(--bg);
49
+ border-radius: 6px;
50
+ padding: 4px 10px;
51
+ }
52
+
53
+ button:hover {
54
+ background: var(--bg-muted);
55
+ }
56
+
57
+ button.primary {
58
+ background: var(--accent);
59
+ border-color: var(--accent);
60
+ color: var(--accent-text);
61
+ }
62
+
63
+ button.primary:hover {
64
+ filter: brightness(1.08);
65
+ }
66
+
67
+ button.ghost {
68
+ border-color: transparent;
69
+ background: transparent;
70
+ color: var(--text-muted);
71
+ }
72
+
73
+ button:disabled {
74
+ opacity: 0.5;
75
+ cursor: default;
76
+ }
77
+
78
+ textarea {
79
+ font: inherit;
80
+ color: inherit;
81
+ width: 100%;
82
+ min-height: 72px;
83
+ resize: vertical;
84
+ padding: 8px;
85
+ border: 1px solid var(--border);
86
+ border-radius: 6px;
87
+ background: var(--bg);
88
+ }
89
+
90
+ textarea:focus {
91
+ outline: 2px solid var(--accent);
92
+ outline-offset: -1px;
93
+ }
94
+
95
+ .toolbar {
96
+ position: fixed;
97
+ right: 16px;
98
+ bottom: 16px;
99
+ z-index: 2147483646;
100
+ display: flex;
101
+ align-items: center;
102
+ gap: 6px;
103
+ padding: 6px;
104
+ background: var(--bg);
105
+ border: 1px solid var(--border);
106
+ border-radius: 10px;
107
+ box-shadow: var(--shadow);
108
+ }
109
+
110
+ .toolbar.beside-panel {
111
+ right: calc(min(380px, 100vw) + 16px);
112
+ }
113
+
114
+ .toolbar button.active {
115
+ background: var(--accent);
116
+ border-color: var(--accent);
117
+ color: var(--accent-text);
118
+ }
119
+
120
+ .presence {
121
+ display: flex;
122
+ align-items: center;
123
+ gap: 6px;
124
+ padding: 0 6px;
125
+ color: var(--text-muted);
126
+ font-size: 12px;
127
+ }
128
+
129
+ .dot {
130
+ width: 8px;
131
+ height: 8px;
132
+ border-radius: 50%;
133
+ background: var(--text-muted);
134
+ }
135
+
136
+ .dot.on {
137
+ background: var(--ok);
138
+ }
139
+
140
+ .dot.off-line {
141
+ background: var(--warn);
142
+ }
143
+
144
+ .highlight {
145
+ position: fixed;
146
+ z-index: 2147483644;
147
+ pointer-events: none;
148
+ border: 2px solid var(--accent);
149
+ background: color-mix(in srgb, var(--accent) 10%, transparent);
150
+ border-radius: 3px;
151
+ }
152
+
153
+ .highlight.flash {
154
+ animation: flash 1.2s ease-out;
155
+ }
156
+
157
+ @keyframes flash {
158
+ from {
159
+ background: color-mix(in srgb, var(--accent) 35%, transparent);
160
+ }
161
+ }
162
+
163
+ .pin {
164
+ position: fixed;
165
+ z-index: 2147483645;
166
+ min-width: 22px;
167
+ height: 22px;
168
+ padding: 0 6px;
169
+ border-radius: 11px 11px 11px 2px;
170
+ border: 2px solid var(--bg);
171
+ background: var(--accent);
172
+ color: var(--accent-text);
173
+ font-size: 11px;
174
+ font-weight: 600;
175
+ line-height: 18px;
176
+ text-align: center;
177
+ box-shadow: var(--shadow);
178
+ }
179
+
180
+ .pin.queued,
181
+ .pin.working {
182
+ background: var(--warn);
183
+ color: var(--bg);
184
+ }
185
+
186
+ .pin.resolved {
187
+ background: var(--ok);
188
+ color: var(--bg);
189
+ opacity: 0.7;
190
+ }
191
+
192
+ .popover {
193
+ position: fixed;
194
+ z-index: 2147483647;
195
+ width: 320px;
196
+ padding: 10px;
197
+ background: var(--bg);
198
+ border: 1px solid var(--border);
199
+ border-radius: 10px;
200
+ box-shadow: var(--shadow);
201
+ display: flex;
202
+ flex-direction: column;
203
+ gap: 8px;
204
+ }
205
+
206
+ .target {
207
+ color: var(--text-muted);
208
+ font-size: 12px;
209
+ overflow: hidden;
210
+ text-overflow: ellipsis;
211
+ white-space: nowrap;
212
+ }
213
+
214
+ .actions {
215
+ display: flex;
216
+ justify-content: flex-end;
217
+ gap: 6px;
218
+ flex-wrap: wrap;
219
+ }
220
+
221
+ .option {
222
+ display: flex;
223
+ align-items: center;
224
+ gap: 6px;
225
+ color: var(--text-muted);
226
+ font-size: 12px;
227
+ cursor: pointer;
228
+ }
229
+
230
+ .hint {
231
+ color: var(--text-muted);
232
+ font-size: 11px;
233
+ }
234
+
235
+ .panel {
236
+ position: fixed;
237
+ top: 0;
238
+ right: 0;
239
+ bottom: 0;
240
+ z-index: 2147483646;
241
+ width: min(380px, 100vw);
242
+ display: flex;
243
+ flex-direction: column;
244
+ background: var(--bg);
245
+ border-left: 1px solid var(--border);
246
+ box-shadow: var(--shadow);
247
+ }
248
+
249
+ .panel header {
250
+ display: flex;
251
+ align-items: center;
252
+ gap: 8px;
253
+ padding: 12px;
254
+ border-bottom: 1px solid var(--border);
255
+ }
256
+
257
+ .panel header h2 {
258
+ flex: 1;
259
+ margin: 0;
260
+ font-size: 14px;
261
+ font-weight: 600;
262
+ }
263
+
264
+ .tabs {
265
+ display: flex;
266
+ gap: 4px;
267
+ padding: 8px 12px;
268
+ border-bottom: 1px solid var(--border);
269
+ }
270
+
271
+ .tabs button.active {
272
+ background: var(--bg-muted);
273
+ font-weight: 600;
274
+ }
275
+
276
+ .threads {
277
+ flex: 1;
278
+ overflow-y: auto;
279
+ padding: 12px;
280
+ display: flex;
281
+ flex-direction: column;
282
+ gap: 10px;
283
+ }
284
+
285
+ .empty {
286
+ color: var(--text-muted);
287
+ text-align: center;
288
+ padding: 24px 8px;
289
+ }
290
+
291
+ .thread {
292
+ border: 1px solid var(--border);
293
+ border-radius: 8px;
294
+ padding: 10px;
295
+ display: flex;
296
+ flex-direction: column;
297
+ gap: 8px;
298
+ }
299
+
300
+ .thread.current {
301
+ border-color: var(--accent);
302
+ }
303
+
304
+ .thread-head {
305
+ display: flex;
306
+ align-items: center;
307
+ gap: 6px;
308
+ }
309
+
310
+ .thread-head .target {
311
+ flex: 1;
312
+ }
313
+
314
+ .badge {
315
+ font-size: 11px;
316
+ font-weight: 600;
317
+ padding: 1px 6px;
318
+ border-radius: 4px;
319
+ background: var(--bg-muted);
320
+ color: var(--text-muted);
321
+ white-space: nowrap;
322
+ }
323
+
324
+ .badge.queued,
325
+ .badge.working {
326
+ background: var(--warn-soft);
327
+ color: var(--warn);
328
+ }
329
+
330
+ .badge.resolved {
331
+ background: var(--ok-soft);
332
+ color: var(--ok);
333
+ }
334
+
335
+ .comment {
336
+ display: flex;
337
+ flex-direction: column;
338
+ gap: 2px;
339
+ }
340
+
341
+ .comment .author {
342
+ font-size: 11px;
343
+ font-weight: 600;
344
+ color: var(--text-muted);
345
+ }
346
+
347
+ .comment.agent .author {
348
+ color: var(--accent);
349
+ }
350
+
351
+ .comment .body {
352
+ white-space: pre-wrap;
353
+ overflow-wrap: anywhere;
354
+ }
355
+
356
+ .error {
357
+ color: var(--warn);
358
+ font-size: 12px;
359
+ }
360
+ `;var a1,x,x0,I2,n1=0,l2=[],h=P,T2=h.__b,g2=h.__r,x2=h.diffed,h2=h.__c,Z2=h.unmount,y2=h.__;function Z0($,J){h.__h&&h.__h(x,$,n1||J),n1=0;var Q=x.__H||(x.__H={__:[],__h:[]});return $>=Q.__.length&&Q.__.push({}),Q.__[$]}function Z($){return n1=1,B6(u2,$)}function B6($,J,Q){var W=Z0(a1++,2);if(W.t=$,!W.__c&&(W.__=[Q?Q(J):u2(void 0,J),function(G){var H=W.__N?W.__N[0]:W.__[0],B=W.t(H,G);H!==B&&(W.__N=[B,W.__[1]],W.__c.setState({}))}],W.__c=x,!x.__f)){var Y=function(G,H,B){if(!W.__c.__H)return!0;var j=!1,A=W.__c.props!==G;if(W.__c.__H.__.some(function(w){if(w.__N){j=!0;var k=w.__[0];w.__=w.__N,w.__N=void 0,k!==w.__[0]&&(A=!0)}}),q){var z=q.call(this,G,H,B);return j?z||A:z}return!j||A};x.__f=!0;var{shouldComponentUpdate:q,componentWillUpdate:X}=x;x.componentWillUpdate=function(G,H,B){if(this.__e){var j=q;q=void 0,Y(G,H,B),q=j}X&&X.call(this,G,H,B)},x.shouldComponentUpdate=Y}return W.__N||W.__}function R1($,J){var Q=Z0(a1++,3);!h.__s&&p2(Q.__H,J)&&(Q.__=$,Q.u=J,x.__H.__h.push(Q))}function c2($){return n1=5,K0(function(){return{current:$}},[])}function K0($,J){var Q=Z0(a1++,7);return p2(Q.__H,J)&&(Q.__=$(),Q.__H=J,Q.__h=$),Q.__}function y0($,J){return n1=8,K0(function(){return $},J)}function z6(){for(var $;$=l2.shift();){var J=$.__H;if($.__P&&J)try{J.__h.some(j0),J.__h.some(h0),J.__h=[]}catch(Q){J.__h=[],h.__e(Q,$.__v)}}}h.__b=function($){x=null,T2&&T2($)},h.__=function($,J){$&&J.__k&&J.__k.__m&&($.__m=J.__k.__m),y2&&y2($,J)},h.__r=function($){g2&&g2($),a1=0;var J=(x=$.__c).__H;J&&(x0===x?(J.__h=[],x.__h=[],J.__.some(function(Q){Q.__N&&(Q.__=Q.__N),Q.u=Q.__N=void 0})):(J.__h.some(j0),J.__h.some(h0),J.__h=[],a1=0)),x0=x},h.diffed=function($){x2&&x2($);var J=$.__c;J&&J.__H&&(J.__H.__h.length&&(l2.push(J)!==1&&I2===h.requestAnimationFrame||((I2=h.requestAnimationFrame)||_6)(z6)),J.__H.__.some(function(Q){Q.u&&(Q.__H=Q.u,Q.u=void 0)})),x0=x=null},h.__c=function($,J){J.some(function(Q){try{Q.__h.some(j0),Q.__h=Q.__h.filter(function(W){return!W.__||h0(W)})}catch(W){J.some(function(Y){Y.__h&&(Y.__h=[])}),J=[],h.__e(W,Q.__v)}}),h2&&h2($,J)},h.unmount=function($){Z2&&Z2($);var J,Q=$.__c;Q&&Q.__H&&(Q.__H.__.some(function(W){try{j0(W)}catch(Y){J=Y}}),Q.__H=void 0,J&&h.__e(J,Q.__v))};var m2=typeof requestAnimationFrame=="function";function _6($){var J,Q=function(){clearTimeout(W),m2&&cancelAnimationFrame(J),setTimeout($)},W=setTimeout(Q,35);m2&&(J=requestAnimationFrame(Q))}function j0($){var J=x,Q=$.__c;typeof Q=="function"&&($.__c=void 0,Q()),x=J}function h0($){var J=x;$.__c=$.__(),x=J}function p2($,J){return!$||$.length!==J.length||J.some(function(Q,W){return Q!==$[W]})}function u2($,J){return typeof J=="function"?J($):J}var m0=8,d2=80,M6=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function i2($,J){if($.tagName.toLowerCase()==="svg"){$.replaceChildren();return}let Q=0;for(let W of[...$.childNodes]){if(W.nodeType===Node.TEXT_NODE){let Y=W.textContent??"";if(Y.trim()==="")W.remove();else if(Y.length>d2)W.textContent=`${Y.slice(0,d2)}…`;continue}if(!(W instanceof Element)||M6.has(W.tagName)){W.remove();continue}if(Q++,J===0||Q>m0)W.remove();else i2(W,J-1)}if(J===0&&Q>0)$.append($.ownerDocument.createComment(` ${Q} child elements cut `));else if(Q>m0)$.append($.ownerDocument.createComment(` ${Q-m0} more `))}function o2($){for(let Q=5;Q>=0;Q--){let W=$.cloneNode(!0);if(!(W instanceof Element))return"";i2(W,Q);let Y=W.outerHTML;if(Y.length<=M0)return Y}let J=$.cloneNode(!1);return J instanceof Element?J.outerHTML.slice(0,M0):""}function j6($){let J=$.getAttribute("aria-label");if(J!==null&&J.trim()!=="")return J.trim();let Q=$.getAttribute("aria-labelledby"),q=((Q===null?null:$.ownerDocument.getElementById(Q.split(/\s+/)[0]??""))??$.querySelector('h1, h2, h3, h4, legend, [role="heading"]'))?.textContent?.replace(/\s+/g," ").trim();return q===void 0||q===""?void 0:q.slice(0,80)}var K6=[{selector:'dialog, [role="dialog"], [role="alertdialog"], [aria-modal="true"]',kind:"Dialog"},{selector:'section, article, fieldset, form, [role="region"], [role="tabpanel"]',kind:"Section"}];function r2($){let J=[],Q=$.ownerDocument.querySelector("h1")?.textContent?.replace(/\s+/g," ").trim();if(Q!==void 0&&Q!=="")J.push(`Page "${Q.slice(0,80)}"`);for(let W of K6){let Y=$.closest(W.selector),q=Y===null?void 0:j6(Y);if(q!==void 0&&!J.includes(`Page "${q}"`))J.push(`${W.kind} "${q}"`)}return J.length===0?void 0:J.join(" › ")}var V6=120,a2=40,A6=8;function y1($,J=V6){let Q=$.replace(/\s+/g," ").trim();return Q.length>J?`${Q.slice(0,J-1)}…`:Q}var F6={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"},w6={checkbox:"checkbox",radio:"radio",button:"button",submit:"button",range:"slider"};function c0($){let J=$.getAttribute("role");if(J!==null&&J!=="")return J.split(" ")[0];let Q=$.tagName.toLowerCase();if(Q==="a")return $.hasAttribute("href")?"link":void 0;if(Q==="input")return w6[$.getAttribute("type")??"text"]??"textbox";return F6[Q]}function s2($){let J=$.getAttribute("aria-label");if(J!==null&&J.trim()!=="")return y1(J);let Q=$.getAttribute("aria-labelledby");if(Q!==null){let q=Q.split(/\s+/).map((X)=>$.ownerDocument.getElementById(X)?.textContent??"").join(" ");if(q.trim()!=="")return y1(q)}if($.id!==""){let q=$.ownerDocument.querySelector(`label[for="${CSS.escape($.id)}"]`);if(q?.textContent!=null&&q.textContent.trim()!=="")return y1(q.textContent)}for(let q of["alt","title","placeholder"]){let X=$.getAttribute(q);if(X!==null&&X.trim()!=="")return y1(X)}let W=c0($);if((W==="button"||W==="link"||W==="heading"||W==="cell"||W==="columnheader"||W==="tab"||W==="menuitem"||W==="option")&&$.textContent!==null&&$.textContent.trim()!=="")return y1($.textContent);return}function N6($){let J=[],Q=$;while(Q!==null&&Q.tagName.toLowerCase()!=="body"&&Q.tagName.toLowerCase()!=="html"){if(Q.id!==""&&Q.ownerDocument.querySelectorAll(`#${CSS.escape(Q.id)}`).length===1)return J.unshift(`#${CSS.escape(Q.id)}`),J.join(" > ");let W=Q.tagName.toLowerCase(),Y=Q.parentElement,q=Y===null?[]:[...Y.children].filter((X)=>X.tagName===Q?.tagName);J.unshift(q.length>1?`${W}:nth-of-type(${q.indexOf(Q)+1})`:W),Q=Y}return J.unshift("body"),J.join(" > ")}function t2($){return typeof $==="object"&&$!==null}function l0($){if(typeof $==="function"){let J=Reflect.get($,"displayName");if(typeof J==="string"&&J!=="")return J;return $.name===""?void 0:$.name}if(t2($))return l0($.type)??l0($.render);return}function b6($){let J=Object.keys($).find((Y)=>Y.startsWith("__reactFiber$"));if(J===void 0)return[];let Q=[],W=Reflect.get($,J);while(t2(W)&&Q.length<40){let Y=l0(W.type)?.replace(/(?<=[a-z])\d+$/,"");if(Y!==void 0&&/^[A-Z]/.test(Y)&&!Y.endsWith("Provider")&&Q[0]!==Y)Q.unshift(Y);W=W.return}return Q.slice(-A6)}function U6($,J){let Q=J.toString().trim();if(Q==="")return;let W=$.ownerDocument.createRange();W.selectNodeContents($),W.setEnd(J.startContainer,J.startOffset);let Y=$.ownerDocument.createRange();return Y.selectNodeContents($),Y.setStart(J.endContainer,J.endOffset),{exact:Q.slice(0,2000),before:W.toString().replace(/\s+/g," ").slice(-a2),after:Y.toString().replace(/\s+/g," ").slice(0,a2)}}function e2($,J,Q){let W=c0($),Y=s2($),q=$.textContent===null?"":y1($.textContent),X=b6($),G=Q===void 0?void 0:U6($,Q),H=r2($);return{url:J,selector:N6($),...W===void 0?{}:{role:W},...Y===void 0?{}:{name:Y},...q===""?{}:{text:q},...X.length===0?{}:{components:X},...G===void 0?{}:{quote:G},...H===void 0?{}:{context:H},html:o2($)}}function n2($,J){if(J.role!==void 0&&c0($)!==J.role)return!1;if(J.name!==void 0&&s2($)!==J.name)return!1;return!0}function p0($,J){let Q=null;try{Q=$.querySelector(J.selector)}catch{Q=null}if(Q!==null&&n2(Q,J))return Q;if(J.role!==void 0&&J.name!==void 0){let W=[...$.body.querySelectorAll("*")].filter((Y)=>n2(Y,J));if(W.length===1)return W[0]??null}return Q}var $4={width:480,height:160};function O6($){let J=$;for(let Q=$.parentElement;Q!==null&&Q!==$.ownerDocument.body;Q=Q.parentElement){let W=J.getBoundingClientRect();if(W.width>=$4.width&&W.height>=$4.height)break;if(Q.getBoundingClientRect().height>900)break;J=Q}return J}function R6($,J){return new Promise((Q)=>{let W=setTimeout(Q,1000),Y=(q)=>{if(q===0){clearTimeout(W),Q();return}$.requestVideoFrameCallback(()=>Y(q-1))};Y(J)})}function D6($){let J=Math.max(0,$.left),Q=Math.max(0,$.top);return{left:J,top:Q,width:Math.min(innerWidth,$.right)-J,height:Math.min(innerHeight,$.bottom)-Q}}async function J4($,J){let Q=J.style.visibility;J.style.visibility="hidden",$.scrollIntoView({block:"nearest",inline:"nearest"});let W;try{W=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:innerWidth*devicePixelRatio},height:{ideal:innerHeight*devicePixelRatio}},audio:!1,...{preferCurrentTab:!0,selfBrowserSurface:"include"}})}catch(Y){throw J.style.visibility=Q,Y}try{let[Y]=W.getVideoTracks();if(Y===void 0||Y.getSettings().displaySurface!=="browser")throw Error("Share this tab to attach a screenshot");let q=document.createElement("video");q.muted=!0,q.srcObject=W,await q.play(),await R6(q,2);let X=D6(O6($).getBoundingClientRect()),G=$.getBoundingClientRect(),H=q.videoWidth/innerWidth,B=document.createElement("canvas");B.width=Math.round(X.width*H),B.height=Math.round(X.height*H);let j=B.getContext("2d");if(j===null)throw Error("Canvas is not available");return j.drawImage(q,X.left*H,X.top*H,B.width,B.height,0,0,B.width,B.height),j.strokeStyle="#e11d48",j.lineWidth=3*H,j.strokeRect((G.left-X.left)*H,(G.top-X.top)*H,G.width*H,G.height*H),B.toDataURL("image/png")}finally{J.style.visibility=Q;for(let Y of W.getTracks())Y.stop()}}var S6=44;var Q4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L6=new Uint8Array(64),Y4=new Uint8Array(128);for(let $=0;$<Q4.length;$++){let J=Q4.charCodeAt($);L6[$]=J,Y4[J]=$}function s1($,J){let Q=0,W=0,Y=0;do{let X=$.next();Y=Y4[X],Q|=(Y&31)<<W,W+=5}while(Y&32);let q=Q&1;if(Q>>>=1,q)Q=-2147483648|-Q;return J+Q}function W4($,J){if($.pos>=J)return!1;return $.peek()!==S6}var v6=class{constructor($){this.pos=0,this.buffer=$}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf($){let{buffer:J,pos:Q}=this,W=J.indexOf($,Q);return W===-1?J.length:W}};function q4($){let{length:J}=$,Q=new v6($),W=[],Y=0,q=0,X=0,G=0,H=0;do{let B=Q.indexOf(";"),j=[],A=!0,z=0;Y=0;while(Q.pos<B){let w;if(Y=s1(Q,Y),Y<z)A=!1;if(z=Y,W4(Q,B))if(q=s1(Q,q),X=s1(Q,X),G=s1(Q,G),W4(Q,B))H=s1(Q,H),w=[Y,q,X,G,H];else w=[Y,q,X,G];else w=[Y];j.push(w),Q.pos++}if(!A)E6(j);W.push(j),Q.pos=B+1}while(Q.pos<=J);return W}function E6($){$.sort(k6)}function k6($,J){return $[0]-J[0]}var B4=C4(X4(),1);function f6($){if(!$)return"";let J=$.lastIndexOf("/");return $.slice(0,J+1)}function C6($,J){let Q=f6($),W=J?J+"/":"";return(Y)=>B4.default(W+(Y||""),Q)}var V1=0,P6=1,I6=2,T6=3,g6=4;function x6($,J){let Q=G4($,0);if(Q===$.length)return $;if(!J)$=$.slice();for(let W=Q;W<$.length;W=G4($,W+1))$[W]=Z6($[W],J);return $}function G4($,J){for(let Q=J;Q<$.length;Q++)if(!h6($[Q]))return Q;return $.length}function h6($){for(let J=1;J<$.length;J++)if($[J][V1]<$[J-1][V1])return!1;return!0}function Z6($,J){if(!J)$=$.slice();return $.sort(y6)}function y6($,J){return $[V1]-J[V1]}var A0=!1;function m6($,J,Q,W){while(Q<=W){let Y=Q+(W-Q>>1),q=$[Y][V1]-J;if(q===0)return A0=!0,Y;if(q<0)Q=Y+1;else W=Y-1}return A0=!1,Q-1}function l6($,J,Q){for(let W=Q+1;W<$.length;Q=W++)if($[W][V1]!==J)break;return Q}function c6($,J,Q){for(let W=Q-1;W>=0;Q=W--)if($[W][V1]!==J)break;return Q}function p6(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function u6($,J,Q,W){let{lastKey:Y,lastNeedle:q,lastIndex:X}=Q,G=0,H=$.length-1;if(W===Y){if(J===q)return A0=X!==-1&&$[X][V1]===J,X;if(J>=q)G=X===-1?0:X;else H=X}return Q.lastKey=W,Q.lastNeedle=J,Q.lastIndex=m6($,J,G,H)}function d6($){return typeof $==="string"?JSON.parse($):$}var i6="`line` must be greater than 0 (lines start at line 1)",o6="`column` must be greater than or equal to 0 (columns start at column 0)",H4=-1,r6=1,z4=class{constructor($,J){let Q=typeof $==="string";if(!Q&&$._decodedMemo)return $;let W=d6($),{version:Y,file:q,names:X,sourceRoot:G,sources:H,sourcesContent:B}=W;this.version=Y,this.file=q,this.names=X||[],this.sourceRoot=G,this.sources=H,this.sourcesContent=B,this.ignoreList=W.ignoreList||W.x_google_ignoreList||void 0;let j=C6(J,G);this.resolvedSources=H.map(j);let{mappings:A}=W;if(typeof A==="string")this._encoded=A,this._decoded=void 0;else if(Array.isArray(A))this._encoded=void 0,this._decoded=x6(A,Q);else if(W.sections)throw Error("TraceMap passed sectioned source map, please use FlattenMap export instead");else throw Error(`invalid source map: ${JSON.stringify(W)}`);this._decodedMemo=p6(),this._bySources=void 0,this._bySourceMemos=void 0}};function i0($){return $}function a6($){var J;return(J=i0($))._decoded||(J._decoded=q4(i0($)._encoded))}function _4($,J){let{line:Q,column:W,bias:Y}=J;if(Q--,Q<0)throw Error(i6);if(W<0)throw Error(o6);let q=a6($);if(Q>=q.length)return V0(null,null,null,null);let X=q[Q],G=n6(X,i0($)._decodedMemo,Q,W,Y||r6);if(G===-1)return V0(null,null,null,null);let H=X[G];if(H.length===1)return V0(null,null,null,null);let{names:B,resolvedSources:j}=$;return V0(j[H[P6]],H[I6]+1,H[T6],H.length===5?B[H[g6]]:null)}function V0($,J,Q,W){return{source:$,line:J,column:Q,name:W}}function n6($,J,Q,W,Y){let q=u6($,W,J,Q);if(A0)q=(Y===H4?l6:c6)($,W,q);else if(Y===H4)q++;if(q===-1||q===$.length)return-1;return q}var s6=6,t6=3000,e6=/\bat (?:[\w$]+\.)*(?:jsxDEV|jsxs?|createElement|react_stack_bottom_frame)\b|\/node_modules\/(?:\.vite\/deps\/)?react(?:-dom)?[/_]/;function t1($){return typeof $==="object"&&$!==null}function F0($){if(typeof $==="string")return $;if(typeof $==="function")return $.name===""?void 0:$.name.replace(/(?<=[a-z])\d+$/,"");if(t1($))return F0($.type)??F0($.render);return}function $$($){for(let J of $.split(`
361
+ `).slice(1)){if(e6.test(J))continue;let Q=J.match(/\(?((?:https?|file):\/\/[^\s)]+):(\d+):(\d+)\)?\s*$/);if(Q?.[1]!==void 0&&Q[2]!==void 0&&Q[3]!==void 0)return{url:Q[1],line:Number(Q[2]),column:Number(Q[3])}}return}function j4($){let J=Object.keys($).find((Y)=>Y.startsWith("__reactFiber$"));if(J===void 0)return[];let Q=[],W=Reflect.get($,J);for(let Y=0;t1(W)&&Q.length<s6&&Y<60;Y++,W=W.return){let q=F0(W.type);if(q===void 0||Q.length>0&&typeof W.type==="string")continue;let X=t1(W._debugStack)?W._debugStack.stack:void 0;if(typeof X!=="string")continue;let G=$$(X);if(G===void 0)continue;let H=t1(W._debugOwner)?F0(W._debugOwner.type):void 0;Q.push({label:H===void 0?`<${q}>`:`<${q}> in ${H}`,...G})}return Q}var M4=new Map;async function J$($){let Q=[...(await fetch($).then((q)=>q.text())).matchAll(/\/\/[#@] sourceMappingURL=(\S+)/g)].at(-1)?.[1];if(Q===void 0)return null;let W=new URL(Q,$).href,Y=await fetch(W).then((q)=>q.json());if(!t1(Y)||Y.version!==3)return null;return new z4(JSON.stringify(Y),W)}function Q$($){let J=M4.get($);if(J===void 0)J=J$($).catch(()=>null),M4.set($,J);return J}function W$($){return $.startsWith("file://")?decodeURIComponent(new URL($).pathname):$}async function Y$($){let J=await Q$($.url);if(J===null)return null;let Q=_4(J,{line:$.line,column:$.column-1});if(Q.source===null||Q.line===null)return null;return{label:$.label,file:W$(Q.source),line:Q.line,column:Q.column+1}}async function K4($){let J=new Promise((W)=>setTimeout(()=>W(null),t6)),Q=await Promise.race([Promise.all($.map((W)=>Y$(W).catch(()=>null))),J]);return Q===null?[]:Q.filter((W)=>W!==null)}var q$=0;function b($,J,Q,W,Y,q){J||(J={});var X,G,H=J;if("ref"in H)for(G in H={},J)G=="ref"?X=J[G]:H[G]=J[G];var B={type:$,props:H,key:Q,ref:X,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--q$,__i:-1,__u:0,__source:Y,__self:q};if(typeof $=="function"&&(X=$.defaultProps))for(G in X)H[G]===void 0&&(H[G]=X[G]);return P.vnode&&P.vnode(B),B}var X$={open:"Note",queued:"Sent to Claude",working:"Claude is on it",resolved:"Resolved"},V4='a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [contenteditable]',A4="agent-canvas-review-picking",o0="agent-canvas-review:reveal";function G$($,J){let Q=new URL($);if(Q.origin===location.origin&&Q.pathname===location.pathname&&Q.search===location.search){location.hash=Q.hash;return}try{sessionStorage.setItem(o0,J)}catch{}location.href=$}function H$(){try{let $=sessionStorage.getItem(o0);return sessionStorage.removeItem(o0),$}catch{return null}}function w0($){let J=$.getBoundingClientRect();return{top:J.top,left:J.left,width:J.width,height:J.height}}function N0($){let J=new URL($);return`${J.origin}${J.pathname}${J.search}${J.hash.split("?")[0]??""}`}function F4($){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 B$(){let[$,J]=Z(0);return R1(()=>{let Q=0,W=()=>{cancelAnimationFrame(Q),Q=requestAnimationFrame(()=>J((q)=>q+1))};window.addEventListener("scroll",W,!0),window.addEventListener("resize",W);let Y=setInterval(W,1000);return()=>{cancelAnimationFrame(Q),window.removeEventListener("scroll",W,!0),window.removeEventListener("resize",W),clearInterval(Y)}},[]),$}function z$(){let[$,J]=Z(location.href);return R1(()=>{let Q=()=>J(location.href);window.addEventListener("hashchange",Q),window.addEventListener("popstate",Q);let W=setInterval(Q,400);return()=>{window.removeEventListener("hashchange",Q),window.removeEventListener("popstate",Q),clearInterval(W)}},[]),$}function _$($,J,Q,W,Y){R1(()=>{if(!J)return;document.documentElement.classList.add(A4);let q=(A)=>A.composedPath().includes($),X=(A)=>A.target instanceof Element?A.target.closest(V4)??A.target:null,G=(A)=>{if(!q(A))Q(X(A))},H=(A)=>{if(q(A))return;if(X(A)?.closest(V4))A.preventDefault(),A.stopPropagation()},B=(A)=>{if(q(A))return;A.preventDefault(),A.stopPropagation();let z=window.getSelection(),w=z!==null&&z.rangeCount>0&&!z.isCollapsed?z.getRangeAt(0):void 0;if(w!==void 0){let I=w.commonAncestorContainer,V=I instanceof Element?I:I.parentElement;if(V!==null)return W(V,w)}let k=X(A);if(k!==null)W(k)},j=(A)=>{if(A.key==="Escape")Y()};return document.addEventListener("mousemove",G,!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(A4),document.removeEventListener("mousemove",G,!0),document.removeEventListener("pointerdown",H,!0),document.removeEventListener("mousedown",H,!0),document.removeEventListener("click",B,!0),document.removeEventListener("keydown",j,!0)}},[$,J,Q,W,Y])}function M$($){let W=Math.min(Math.max(8,$.left),window.innerWidth-320-8),Y=$.top+$.height+8;return{top:Y+190<window.innerHeight?Y:Math.max(8,$.top-190-8),left:W}}function j$($){let[J,Q]=Z(""),[W,Y]=Z(!1),[q,X]=Z(!1),[G,H]=Z(null),B=c2(null);R1(()=>B.current?.focus(),[]);let j=async(A)=>{if(J.trim()==="")return;X(!0),H(null);try{await $.onSubmit(J,A,W)}catch(z){H(z instanceof Error?z.message:String(z)),X(!1)}};return b("div",{class:"popover",style:M$($.draft.box),children:[b("div",{class:"target",title:$.draft.anchor.selector,children:F4($.draft.anchor)},void 0,!1,void 0,this),$.draft.anchor.components!==void 0&&b("div",{class:"target",children:$.draft.anchor.components.slice(-3).join(" › ")},void 0,!1,void 0,this),b("textarea",{ref:B,value:J,placeholder:"What should change here?",onInput:(A)=>Q(A.currentTarget.value),onKeyDown:(A)=>{if(A.key==="Escape")$.onCancel();if(A.key==="Enter"&&(A.metaKey||A.ctrlKey))j(!0)}},void 0,!1,void 0,this),b("label",{class:"option",children:[b("input",{type:"checkbox",checked:W,onChange:(A)=>Y(A.currentTarget.checked)},void 0,!1,void 0,this),"Attach a screenshot"]},void 0,!0,void 0,this),G!==null&&b("div",{class:"error",children:G},void 0,!1,void 0,this),b("div",{class:"actions",children:[b("button",{type:"button",class:"ghost",onClick:$.onCancel,children:"Cancel"},void 0,!1,void 0,this),b("button",{type:"button",disabled:q||J.trim()==="",onClick:()=>void j(!1),children:"Save note"},void 0,!1,void 0,this),b("button",{type:"button",class:"primary",disabled:q||J.trim()==="",onClick:()=>void j(!0),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"hint",children:"Ctrl+Enter sends to Claude · Esc cancels"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function K$($){let{thread:J,client:Q}=$,[W,Y]=Z(null),[q,X]=Z(null),G=(B)=>{X(null),B().catch((j)=>X(j instanceof Error?j.message:String(j)))},H=(B)=>{if(W===null||W.trim()==="")return;G(()=>Q.comment(J.id,W,B).then(()=>Y(null)))};return b("div",{class:`thread${$.number===null?"":" current"}`,children:[b("div",{class:"thread-head",children:[b("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),b("span",{class:"target",title:J.anchor.url,children:F4(J.anchor)},void 0,!1,void 0,this),b("span",{class:`badge ${J.state}`,children:X$[J.state]},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.comments.map((B)=>b("div",{class:`comment ${B.author}`,children:[b("span",{class:"author",children:B.author==="user"?"You":"Claude"},void 0,!1,void 0,this),b("span",{class:"body",children:B.body},void 0,!1,void 0,this)]},B.id,!0,void 0,this)),W!==null&&b("textarea",{value:W,placeholder:"Reply…",onInput:(B)=>Y(B.currentTarget.value),onKeyDown:(B)=>{if(B.key==="Enter"&&(B.metaKey||B.ctrlKey))H(!0)}},void 0,!1,void 0,this),q!==null&&b("div",{class:"error",children:q},void 0,!1,void 0,this),b("div",{class:"actions",children:W===null?b(e,{children:[b("button",{type:"button",class:"ghost",onClick:()=>G(()=>Q.delete(J.id)),children:"Delete"},void 0,!1,void 0,this),J.state==="resolved"?b("button",{type:"button",onClick:()=>G(()=>Q.setResolved(J.id,!1)),children:"Reopen"},void 0,!1,void 0,this):b("button",{type:"button",onClick:()=>G(()=>Q.setResolved(J.id,!0)),children:"Resolve"},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>Y(""),children:"Reply"},void 0,!1,void 0,this),J.state==="open"&&b("button",{type:"button",class:"primary",onClick:()=>G(()=>Q.send(J.id)),children:"Send to Claude"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):b(e,{children:[b("button",{type:"button",class:"ghost",onClick:()=>Y(null),children:"Cancel"},void 0,!1,void 0,this),b("button",{type:"button",disabled:W.trim()==="",onClick:()=>H(!1),children:"Reply"},void 0,!1,void 0,this),b("button",{type:"button",class:"primary",disabled:W.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 w4($){let{client:J,host:Q}=$,[W,Y]=Z([]),[q,X]=Z(!1),[G,H]=Z(!1),[B,j]=Z(!1),[A,z]=Z(null),[w,k]=Z(null),[I,V]=Z(!1),[U,F]=Z(!1),[f,g]=Z(!1),[C,y]=Z(H$),[i,c]=Z(null),o=z$();B$(),R1(()=>{return J.connect({threads:Y,agentWatching:X,connected:H}),()=>J.close()},[J]);let u=y0(()=>{j(!1),z(null)},[]),H1=y0((E,d)=>{j(!1),z(null),window.getSelection()?.removeAllRanges(),k({anchor:e2(E,location.href,d),box:w0(E),element:E,sources:K4(j4(E))})},[]);_$(Q,B,z,H1,u);let U4=()=>{V(!1),k(null),j(!0)},m1=N0(o),b0=K0(()=>W.filter((E)=>N0(E.anchor.url)===m1&&(f||E.state!=="resolved")),[W,m1,f]),r0=U?W.filter((E)=>f||E.state!=="resolved"):b0,a0=new Map(b0.map((E,d)=>[E.id,d+1])),n0=W.filter((E)=>E.state!=="resolved").length;R1(()=>{if(C===null)return;let E=W.find((W1)=>W1.id===C);if(E===void 0||N0(E.anchor.url)!==m1)return;let d=p0(document,E.anchor);if(d===null)return;d.scrollIntoView({block:"center",behavior:"smooth"}),y(null),setTimeout(()=>c(w0(d)),350),setTimeout(()=>c(null),1600)},[C,W,m1]);let O4=(E)=>{if(y(E.id),N0(E.anchor.url)!==m1)G$(E.anchor.url,E.id)},s0=!G?"Daemon offline":q?"Claude is listening":"Claude is not listening",t0=A===null?null:w0(A);return b(e,{children:[t0!==null&&b("div",{class:"highlight",style:t0},void 0,!1,void 0,this),i!==null&&b("div",{class:"highlight flash",style:i},void 0,!1,void 0,this),b0.map((E)=>{let d=p0(document,E.anchor);if(d===null)return null;let W1=w0(d);if(W1.width===0&&W1.height===0)return null;return b("button",{type:"button",class:`pin ${E.state}`,style:{top:Math.max(0,W1.top-11),left:Math.max(0,W1.left+W1.width-11)},title:E.comments[0]?.body,onClick:()=>V(!0),children:a0.get(E.id)},E.id,!1,void 0,this)}),w!==null&&b(j$,{draft:w,onCancel:()=>k(null),onSubmit:async(E,d,W1)=>{let R4=W1?await J4(w.element,Q):void 0,e0=await w.sources;await J.createThread(e0.length===0?w.anchor:{...w.anchor,sources:e0},E,d,R4),k(null)}},void 0,!1,void 0,this),I&&b("aside",{class:"panel",children:[b("header",{children:[b("h2",{children:"Review"},void 0,!1,void 0,this),b("button",{type:"button",class:"ghost",onClick:()=>V(!1),children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"tabs",children:[b("button",{type:"button",class:U?"":"active",onClick:()=>F(!1),children:"This page"},void 0,!1,void 0,this),b("button",{type:"button",class:U?"active":"",onClick:()=>F(!0),children:"All pages"},void 0,!1,void 0,this),b("button",{type:"button",class:f?"active":"",onClick:()=>g(!f),children:"Resolved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"threads",children:[r0.length===0&&b("div",{class:"empty",children:"No comments yet. Click “Comment”, then an element or a text selection."},void 0,!1,void 0,this),r0.map((E)=>b(K$,{thread:E,number:a0.get(E.id)??null,client:J,onReveal:()=>O4(E)},E.id,!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:`toolbar${I?" beside-panel":""}`,children:[b("span",{class:"presence",title:s0,children:[b("span",{class:`dot ${!G?"off-line":q?"on":""}`},void 0,!1,void 0,this),s0]},void 0,!0,void 0,this),b("button",{type:"button",class:B?"active":"",onClick:()=>B?u():U4(),children:B?"Pick an element…":"Comment"},void 0,!1,void 0,this),b("button",{type:"button",class:I?"active":"",onClick:()=>V(!I),children:["Threads",n0>0?` (${n0})`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var N4="agent-canvas-review";function V$($){let J=$.dataset.project??"";if(!P0.test(J)){console.error(`agent-canvas review: data-project must match ${P0}, got "${J}"`);return}if(document.querySelector(N4)!==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 W=document.createElement(N4);document.documentElement.append(W);let Y=W.attachShadow({mode:"open"}),q=document.createElement("style");q.textContent=P2,Y.append(q),V2(b(w4,{client:new g0(new URL($.src).origin,J),host:W},void 0,!1,void 0,this),Y)}var b4=document.currentScript;if(b4 instanceof HTMLScriptElement)V$(b4);else console.error("agent-canvas review: load review.js with a classic <script> tag");})();
@@ -1 +1 @@
1
- import{createContext as o,useContext as r,useEffect as i}from"react";import{SessionContext as A}from"@fabrika/annotations/runtime";var p=o(null);function s(){return r(p)}function d(e){let{registerResponse:t}=s();i(()=>{t(e)},[e,t])}function x(e,t,n){let{setFeedbackEntry:a,removeFeedbackEntry:l}=s();i(()=>(a(e,{id:e,markdown:t,label:n?.label,required:n?.required}),()=>l(e)),[e,t,n?.label,n?.required])}var c=o("");function g(){return r(c)}var b=o({setActiveView:()=>{}});export{b as ActiveViewCtx,p as AnnotationCtx,c as CanvasFileCtx,A as SessionContext,s as useAnnotations,g as useCanvasFile,x as useFeedback,d as useResponseRegistration};
1
+ import{createContext as z,useContext as B,useEffect as D}from"react";import{SessionContext as U}from"@fabrika/annotations/runtime";var J=z(null);function G(){return B(J)}function M(h){let{registerResponse:j}=G();D(()=>{j(h)},[h,j])}function N(h,j,q){let{setFeedbackEntry:H,removeFeedbackEntry:I}=G();D(()=>{return H(h,{id:h,markdown:j,label:q?.label,required:q?.required}),()=>I(h)},[h,j,q?.label,q?.required])}var K=z("");function O(){return B(K)}var Q=z({setActiveView:()=>{}});export{M as useResponseRegistration,N as useFeedback,O as useCanvasFile,G as useAnnotations,U as SessionContext,K as CanvasFileCtx,J as AnnotationCtx,Q as ActiveViewCtx};