pmx-canvas 0.3.4 → 0.4.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 (39) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/Readme.md +11 -3
  3. package/dist/canvas/index.js +67 -67
  4. package/dist/types/client/index.d.ts +1 -1
  5. package/dist/types/client/nodes/ExtAppFrame.d.ts +10 -0
  6. package/dist/types/client/state/node-factory.d.ts +29 -0
  7. package/dist/types/client/uuid-polyfill.d.ts +0 -0
  8. package/dist/types/server/canvas-db.d.ts +0 -1
  9. package/dist/types/server/canvas-state.d.ts +14 -15
  10. package/dist/types/server/operations/composites.d.ts +6 -21
  11. package/dist/types/server/server.d.ts +1 -0
  12. package/docs/cli.md +5 -0
  13. package/docs/environment.md +2 -2
  14. package/docs/http-api.md +25 -1
  15. package/docs/mcp.md +21 -30
  16. package/docs/plans/plan-009-tech-debt-backlog.md +13 -12
  17. package/docs/screenshot.png +0 -0
  18. package/docs/tech-debt-assessment-2026-06.md +5 -5
  19. package/package.json +7 -7
  20. package/skills/pmx-canvas/SKILL.md +16 -6
  21. package/skills/pmx-canvas/evals/evals.json +2 -2
  22. package/skills/pmx-canvas/references/full-reference.md +17 -15
  23. package/src/cli/commands/history.ts +1 -1
  24. package/src/cli/commands/nodes.ts +31 -1
  25. package/src/cli/index.ts +8 -2
  26. package/src/cli/shared.ts +1 -0
  27. package/src/client/index.tsx +2 -0
  28. package/src/client/nodes/ExtAppFrame.tsx +17 -2
  29. package/src/client/state/node-factory.ts +72 -0
  30. package/src/client/state/sse-bridge.ts +209 -86
  31. package/src/client/uuid-polyfill.ts +14 -0
  32. package/src/server/canvas-db.ts +0 -8
  33. package/src/server/canvas-schema.ts +2 -8
  34. package/src/server/canvas-state.ts +51 -151
  35. package/src/server/index.ts +3 -9
  36. package/src/server/operations/composites.ts +24 -21
  37. package/src/server/operations/ops/snapshots.ts +6 -7
  38. package/src/server/operations/registry.ts +4 -1
  39. package/src/server/server.ts +170 -74
@@ -1,113 +1,113 @@
1
- var qP=Object.create;var{getPrototypeOf:FP,defineProperty:v2,getOwnPropertyNames:XP}=Object;var wP=Object.prototype.hasOwnProperty;function AP($){return this[$]}var ZP,MP,SP=($,v,U)=>{var _=$!=null&&typeof $==="object";if(_){var g=v?ZP??=new WeakMap:MP??=new WeakMap,z=g.get($);if(z)return z}U=$!=null?qP(FP($)):{};let J=v||!$||!$.__esModule?v2(U,"default",{value:$,enumerable:!0}):U;for(let b of XP($))if(!wP.call(J,b))v2(J,b,{get:AP.bind($,b),enumerable:!0});if(_)g.set($,J);return J};var QP=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var NP=($)=>$;function rP($,v){this[$]=NP.bind(null,v)}var ev=($,v)=>{for(var U in v)v2($,U,{get:v[U],enumerable:!0,configurable:!0,set:rP.bind(v,U)})};var xK=QP((hK)=>{Object.defineProperty(hK,"__esModule",{value:!0});var uK=/highlight-(?:text|source)-([a-z0-9]+)/;function DK($){$.addRule("highlightedCodeBlock",{filter:function(v){var U=v.firstChild;return v.nodeName==="DIV"&&uK.test(v.className)&&U&&U.nodeName==="PRE"},replacement:function(v,U,_){var g=U.className||"",z=(g.match(uK)||[null,""])[1];return`
1
+ var uP=Object.create;var{getPrototypeOf:yP,defineProperty:G2,getOwnPropertyNames:DP}=Object;var RP=Object.prototype.hasOwnProperty;function TP($){return this[$]}var jP,VP,CP=($,v,g)=>{var _=$!=null&&typeof $==="object";if(_){var U=v?jP??=new WeakMap:VP??=new WeakMap,z=U.get($);if(z)return z}g=$!=null?uP(yP($)):{};let J=v||!$||!$.__esModule?G2(g,"default",{value:$,enumerable:!0}):g;for(let b of DP($))if(!RP.call(J,b))G2(J,b,{get:TP.bind($,b),enumerable:!0});if(_)U.set($,J);return J};var fP=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var mP=($)=>$;function cP($,v){this[$]=mP.bind(null,v)}var ev=($,v)=>{for(var g in v)G2($,g,{get:v[g],enumerable:!0,configurable:!0,set:cP.bind(v,g)})};var sK=fP((aK)=>{Object.defineProperty(aK,"__esModule",{value:!0});var CK=/highlight-(?:text|source)-([a-z0-9]+)/;function mK($){$.addRule("highlightedCodeBlock",{filter:function(v){var g=v.firstChild;return v.nodeName==="DIV"&&CK.test(v.className)&&g&&g.nodeName==="PRE"},replacement:function(v,g,_){var U=g.className||"",z=(U.match(CK)||[null,""])[1];return`
2
2
 
3
3
  `+_.fence+z+`
4
- `+U.firstChild.textContent+`
4
+ `+g.firstChild.textContent+`
5
5
  `+_.fence+`
6
6
 
7
- `}})}function RK($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var sk=Array.prototype.indexOf,ek=Array.prototype.every,S6={},$H={left:":---",right:"---:",center:":---:"},j2=null,TK=null,yK=new WeakMap;function vH($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function jK($){return $?$H[$]:"---"}function VK($,v){var U={left:0,right:0,center:0,"":0},_="";for(var g=0;g<$.rows.length;++g){var z=$.rows[g];if(v<z.childNodes.length){var J=vH(z.childNodes[v]);if(++U[J],U[J]>U[_])_=J}}return _}S6.tableCell={filter:["th","td"],replacement:function($,v){if(C2(mK(v)))return $;return CK($,v)}};S6.tableRow={filter:"tr",replacement:function($,v){let U=mK(v);if(C2(U))return $;var _="";if(gH(v)){let J=EK(U);for(var g=0;g<J;g++){let b=g<v.childNodes.length?v.childNodes[g]:null;var z=jK(VK(U,g));_+=CK(z,b,g)}}return`
7
+ `}})}function cK($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var OH=Array.prototype.indexOf,KH=Array.prototype.every,N6={},WH={left:":---",right:"---:",center:":---:"},x2=null,EK=null,fK=new WeakMap;function BH($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function iK($){return $?WH[$]:"---"}function lK($,v){var g={left:0,right:0,center:0,"":0},_="";for(var U=0;U<$.rows.length;++U){var z=$.rows[U];if(v<z.childNodes.length){var J=BH(z.childNodes[v]);if(++g[J],g[J]>g[_])_=J}}return _}N6.tableCell={filter:["th","td"],replacement:function($,v){if(p2(oK(v)))return $;return xK($,v)}};N6.tableRow={filter:"tr",replacement:function($,v){let g=oK(v);if(p2(g))return $;var _="";if(PH(v)){let J=nK(g);for(var U=0;U<J;U++){let b=U<v.childNodes.length?v.childNodes[U]:null;var z=iK(lK(g,U));_+=xK(z,b,U)}}return`
8
8
  `+$+(_?`
9
- `+_:"")}};S6.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(cK(v,TK)){let b=v.outerHTML,O=zH(v);if(O===null||!O.classList.contains("joplin-table-wrapper"))return`
9
+ `+_:"")}};N6.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(pK(v,EK)){let b=v.outerHTML,O=IH(v);if(O===null||!O.classList.contains("joplin-table-wrapper"))return`
10
10
 
11
11
  <div class="joplin-table-wrapper">${b}</div>
12
12
 
13
- `;else return b}else{if(C2(v))return $;$=$.replace(/\n+/g,`
14
- `);var U=$.trim().split(`
15
- `);if(U.length>=2)U=U[1];var _=/\| :?---/.test(U),g=EK(v),z="";if(g&&!_){z="|"+" |".repeat(g)+`
16
- |`;for(var J=0;J<g;++J)z+=" "+jK(VK(v,J))+" |"}let b=v.caption?v.caption.textContent||"":"",O=b?`${b}
13
+ `;else return b}else{if(p2(v))return $;$=$.replace(/\n+/g,`
14
+ `);var g=$.trim().split(`
15
+ `);if(g.length>=2)g=g[1];var _=/\| :?---/.test(g),U=nK(v),z="";if(U&&!_){z="|"+" |".repeat(U)+`
16
+ |`;for(var J=0;J<U;++J)z+=" "+iK(lK(v,J))+" |"}let b=v.caption?v.caption.textContent||"":"",O=b?`${b}
17
17
 
18
18
  `:"",K=`${z}${$}`.trimStart();return`
19
19
 
20
20
  ${O}${K}
21
21
 
22
- `}}};S6.tableCaption={filter:["caption"],replacement:()=>""};S6.tableColgroup={filter:["colgroup","col"],replacement:()=>""};S6.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function gH($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||UH(v))&&ek.call($.childNodes,function(U){return U.nodeName==="TH"})}function UH($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function CK($,v=null,U=null){if(U===null)U=sk.call(v.parentNode.childNodes,v);var _=" ";if(U===0)_="| ";let g=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");g=g.replace(/\|+/g,"\\|");while(g.length<3)g+=" ";if(v)g=JH(g,v," ");return _+g+" |"}function fK($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let U=$.childNodes[v];if(U.nodeName==="TABLE")return!0;if(fK(U))return!0}return!1}var V2=($,v)=>{if(!$.childNodes)return!1;for(let U=0;U<$.childNodes.length;U++){let _=$.childNodes[U];if(v==="code"&&j2&&j2(_))return!0;if(v.includes(_.nodeName))return!0;if(V2(_,v))return!0}return!1},cK=($,v)=>{let U=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)U.push("TABLE");return V2($,"code")||V2($,U)};function C2($){let v=yK.get($);if(v!==void 0)return v;let U=_H($);return yK.set($,U),U}function _H($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(fK($))return!0;return!1}function zH($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function mK($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function JH($,v,U){let _=v.getAttribute("colspan")||1;for(let g=1;g<_;g++)$+=" | "+U.repeat(3);return $}function EK($){let v=0;for(let U=0;U<$.rows.length;U++){let g=$.rows[U].childNodes.length;if(g>v)v=g}return v}function iK($){j2=$.isCodeBlock,TK=$.options,$.keep(function(U){if(U.nodeName==="TABLE"&&cK(U,$.options))return!0;return!1});for(var v in S6)$.addRule(v,S6[v])}function lK($){$.addRule("taskListItems",{filter:function(v){let U=v.parentNode,_=U.parentNode;return v.type==="checkbox"&&(U.nodeName==="LI"||U.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,U){return(U.checked?"[x]":"[ ]")+" "}})}function bH($){$.use([DK,RK,iK,lK])}hK.gfm=bH;hK.highlightedCodeBlock=DK;hK.strikethrough=RK;hK.tables=iK;hK.taskListItems=lK});var aU,B$,pO,z2,I6,iO,oO,nO,tO,J2,g2,U2,uP,nU={},tU=[],yP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sU=Array.isArray;function $6($,v){for(var U in v)$[U]=v[U];return $}function b2($){$&&$.parentNode&&$.parentNode.removeChild($)}function DP($,v,U){var _,g,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?g=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?aU.call(arguments,2):U),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return oU($,J,_,g,null)}function oU($,v,U,_,g){var z={type:$,props:v,key:U,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:g==null?++pO:g,__i:-1,__u:0};return g==null&&B$.vnode!=null&&B$.vnode(z),z}function a$($){return $.children}function K4($,v){this.props=$,this.context=v}function W4($,v){if(v==null)return $.__?W4($.__,$.__i+1):null;for(var U;v<$.__k.length;v++)if((U=$.__k[v])!=null&&U.__e!=null)return U.__e;return typeof $.type=="function"?W4($):null}function RP($){if($.__P&&$.__d){var v=$.__v,U=v.__e,_=[],g=[],z=$6({},v);z.__v=v.__v+1,B$.vnode&&B$.vnode(z),G2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[U]:null,_,U==null?W4(v):U,!!(32&v.__u),g),z.__v=v.__v,z.__.__k[z.__i]=z,eO(_,z,g),v.__e=v.__=null,z.__e!=U&&dO(z)}}function dO($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(v){if(v!=null&&v.__e!=null)return $.__e=$.__c.base=v.__e}),dO($)}function lO($){(!$.__d&&($.__d=!0)&&I6.push($)&&!dU.__r++||iO!=B$.debounceRendering)&&((iO=B$.debounceRendering)||oO)(dU)}function dU(){try{for(var $,v=1;I6.length;)I6.length>v&&I6.sort(nO),$=I6.shift(),v=I6.length,RP($)}finally{I6.length=dU.__r=0}}function aO($,v,U,_,g,z,J,b,O,K,W){var B,k,P,F,I,H,Y,q=_&&_.__k||tU,w=v.length;for(O=TP(U,v,q,O,w),B=0;B<w;B++)(P=U.__k[B])!=null&&(k=P.__i!=-1&&q[P.__i]||nU,P.__i=B,H=G2($,P,k,g,z,J,b,O,K,W),F=P.__e,P.ref&&k.ref!=P.ref&&(k.ref&&O2(k.ref,null,P),W.push(P.ref,P.__c||F,P)),I==null&&F!=null&&(I=F),(Y=!!(4&P.__u))||k.__k===P.__k?O=sO(P,O,$,Y):typeof P.type=="function"&&H!==void 0?O=H:F&&(O=F.nextSibling),P.__u&=-7);return U.__e=I,O}function TP($,v,U,_,g){var z,J,b,O,K,W=U.length,B=W,k=0;for($.__k=Array(g),z=0;z<g;z++)(J=v[z])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=$.__k[z]=oU(null,J,null,null,null):sU(J)?J=$.__k[z]=oU(a$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=oU(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):$.__k[z]=J,O=z+k,J.__=$,J.__b=$.__b+1,b=null,(K=J.__i=jP(J,U,O,B))!=-1&&(B--,(b=U[K])&&(b.__u|=2)),b==null||b.__v==null?(K==-1&&(g>W?k--:g<W&&k++),typeof J.type!="function"&&(J.__u|=4)):K!=O&&(K==O-1?k--:K==O+1?k++:(K>O?k--:k++,J.__u|=4))):$.__k[z]=null;if(B)for(z=0;z<W;z++)(b=U[z])!=null&&(2&b.__u)==0&&(b.__e==_&&(_=W4(b)),v3(b,b));return _}function sO($,v,U,_){var g,z;if(typeof $.type=="function"){for(g=$.__k,z=0;g&&z<g.length;z++)g[z]&&(g[z].__=$,v=sO(g[z],v,U,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=W4($)),U.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function jP($,v,U,_){var g,z,J,b=$.key,O=$.type,K=v[U],W=K!=null&&(2&K.__u)==0;if(K===null&&b==null||W&&b==K.key&&O==K.type)return U;if(_>(W?1:0)){for(g=U-1,z=U+1;g>=0||z<v.length;)if((K=v[J=g>=0?g--:z++])!=null&&(2&K.__u)==0&&b==K.key&&O==K.type)return J}return-1}function hO($,v,U){v[0]=="-"?$.setProperty(v,U==null?"":U):$[v]=U==null?"":typeof U!="number"||yP.test(v)?U:U+"px"}function pU($,v,U,_,g){var z,J;$:if(v=="style")if(typeof U=="string")$.style.cssText=U;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)U&&v in U||hO($.style,v,"");if(U)for(v in U)_&&U[v]==_[v]||hO($.style,v,U[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(tO,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=U,U?_?U.u=_.u:(U.u=J2,$.addEventListener(v,z?U2:g2,z)):$.removeEventListener(v,z?U2:g2,z);else{if(g=="http://www.w3.org/2000/svg")v=v.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(v!="width"&&v!="height"&&v!="href"&&v!="list"&&v!="form"&&v!="tabIndex"&&v!="download"&&v!="rowSpan"&&v!="colSpan"&&v!="role"&&v!="popover"&&v in $)try{$[v]=U==null?"":U;break $}catch(b){}typeof U=="function"||(U==null||U===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&U==1?"":U))}}function xO($){return function(v){if(this.l){var U=this.l[v.type+$];if(v.t==null)v.t=J2++;else if(v.t<U.u)return;return U(B$.event?B$.event(v):v)}}}function G2($,v,U,_,g,z,J,b,O,K){var W,B,k,P,F,I,H,Y,q,w,N,C,p,r,n,e=v.type;if(v.constructor!==void 0)return null;128&U.__u&&(O=!!(32&U.__u),z=[b=v.__e=U.__e]),(W=B$.__b)&&W(v);$:if(typeof e=="function")try{if(Y=v.props,q=e.prototype&&e.prototype.render,w=(W=e.contextType)&&_[W.__c],N=W?w?w.props.value:W.__:_,U.__c?H=(B=v.__c=U.__c).__=B.__E:(q?v.__c=B=new e(Y,N):(v.__c=B=new K4(Y,N),B.constructor=e,B.render=CP),w&&w.sub(B),B.state||(B.state={}),B.__n=_,k=B.__d=!0,B.__h=[],B._sb=[]),q&&B.__s==null&&(B.__s=B.state),q&&e.getDerivedStateFromProps!=null&&(B.__s==B.state&&(B.__s=$6({},B.__s)),$6(B.__s,e.getDerivedStateFromProps(Y,B.__s))),P=B.props,F=B.state,B.__v=v,k)q&&e.getDerivedStateFromProps==null&&B.componentWillMount!=null&&B.componentWillMount(),q&&B.componentDidMount!=null&&B.__h.push(B.componentDidMount);else{if(q&&e.getDerivedStateFromProps==null&&Y!==P&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(Y,N),v.__v==U.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(Y,B.__s,N)===!1){v.__v!=U.__v&&(B.props=Y,B.state=B.__s,B.__d=!1),v.__e=U.__e,v.__k=U.__k,v.__k.some(function(u){u&&(u.__=v)}),tU.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(Y,B.__s,N),q&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(P,F,I)})}if(B.context=N,B.props=Y,B.__P=$,B.__e=!1,C=B$.__r,p=0,q)B.state=B.__s,B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),tU.push.apply(B.__h,B._sb),B._sb=[];else do B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),B.state=B.__s;while(B.__d&&++p<25);B.state=B.__s,B.getChildContext!=null&&(_=$6($6({},_),B.getChildContext())),q&&!k&&B.getSnapshotBeforeUpdate!=null&&(I=B.getSnapshotBeforeUpdate(P,F)),r=W!=null&&W.type===a$&&W.key==null?$3(W.props.children):W,b=aO($,sU(r)?r:[r],v,U,_,g,z,J,b,O,K),B.base=v.__e,v.__u&=-161,B.__h.length&&J.push(B),H&&(B.__E=B.__=null)}catch(u){if(v.__v=null,O||z!=null)if(u.then){for(v.__u|=O?160:128;b&&b.nodeType==8&&b.nextSibling;)b=b.nextSibling;z[z.indexOf(b)]=null,v.__e=b}else{for(n=z.length;n--;)b2(z[n]);_2(v)}else v.__e=U.__e,v.__k=U.__k,u.then||_2(v);B$.__e(u,v,U)}else z==null&&v.__v==U.__v?(v.__k=U.__k,v.__e=U.__e):b=v.__e=VP(U.__e,v,U,_,g,z,J,O,K);return(W=B$.diffed)&&W(v),128&v.__u?void 0:b}function _2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(_2))}function eO($,v,U){for(var _=0;_<U.length;_++)O2(U[_],U[++_],U[++_]);B$.__c&&B$.__c(v,$),$.some(function(g){try{$=g.__h,g.__h=[],$.some(function(z){z.call(g)})}catch(z){B$.__e(z,g.__v)}})}function $3($){return typeof $!="object"||$==null||$.__b>0?$:sU($)?$.map($3):$6({},$)}function VP($,v,U,_,g,z,J,b,O){var K,W,B,k,P,F,I,H=U.props||nU,Y=v.props,q=v.type;if(q=="svg"?g="http://www.w3.org/2000/svg":q=="math"?g="http://www.w3.org/1998/Math/MathML":g||(g="http://www.w3.org/1999/xhtml"),z!=null){for(K=0;K<z.length;K++)if((P=z[K])&&"setAttribute"in P==!!q&&(q?P.localName==q:P.nodeType==3)){$=P,z[K]=null;break}}if($==null){if(q==null)return document.createTextNode(Y);$=document.createElementNS(g,q,Y.is&&Y),b&&(B$.__m&&B$.__m(v,z),b=!1),z=null}if(q==null)H===Y||b&&$.data==Y||($.data=Y);else{if(z=z&&aU.call($.childNodes),!b&&z!=null)for(H={},K=0;K<$.attributes.length;K++)H[(P=$.attributes[K]).name]=P.value;for(K in H)P=H[K],K=="dangerouslySetInnerHTML"?B=P:K=="children"||(K in Y)||K=="value"&&("defaultValue"in Y)||K=="checked"&&("defaultChecked"in Y)||pU($,K,null,P,g);for(K in Y)P=Y[K],K=="children"?k=P:K=="dangerouslySetInnerHTML"?W=P:K=="value"?F=P:K=="checked"?I=P:b&&typeof P!="function"||H[K]===P||pU($,K,P,H[K],g);if(W)b||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),aO(v.type=="template"?$.content:$,sU(k)?k:[k],v,U,_,q=="foreignObject"?"http://www.w3.org/1999/xhtml":g,z,J,z?z[0]:U.__k&&W4(U,0),b,O),z!=null)for(K=z.length;K--;)b2(z[K]);b||(K="value",q=="progress"&&F==null?$.removeAttribute("value"):F!=null&&(F!==$[K]||q=="progress"&&!F||q=="option"&&F!=H[K])&&pU($,K,F,H[K],g),K="checked",I!=null&&I!=$[K]&&pU($,K,I,H[K],g))}return $}function O2($,v,U){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(g){B$.__e(g,U)}}function v3($,v,U){var _,g;if(B$.unmount&&B$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||O2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){B$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(g=0;g<_.length;g++)_[g]&&v3(_[g],v,U||typeof $.type!="function");U||b2($.__e),$.__c=$.__=$.__e=void 0}function CP($,v,U){return this.constructor($,U)}function g3($,v,U){var _,g,z,J;v==document&&(v=document.documentElement),B$.__&&B$.__($,v),g=(_=typeof U=="function")?null:U&&U.__k||v.__k,z=[],J=[],G2(v,$=(!_&&U||v).__k=DP(a$,null,[$]),g||nU,nU,v.namespaceURI,!_&&U?[U]:g?null:v.firstChild?aU.call(v.childNodes):null,z,!_&&U?U:g?g.__e:v.firstChild,_,J),eO(z,$,J)}aU=tU.slice,B$={__e:function($,v,U,_){for(var g,z,J;v=v.__;)if((g=v.__c)&&!g.__)try{if((z=g.constructor)&&z.getDerivedStateFromError!=null&&(g.setState(z.getDerivedStateFromError($)),J=g.__d),g.componentDidCatch!=null&&(g.componentDidCatch($,_||{}),J=g.__d),J)return g.__E=g}catch(b){$=b}throw $}},pO=0,z2=function($){return $!=null&&$.constructor===void 0},K4.prototype.setState=function($,v){var U;U=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$6({},this.state),typeof $=="function"&&($=$($6({},U),this.props)),$&&$6(U,$),$!=null&&this.__v&&(v&&this._sb.push(v),lO(this))},K4.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),lO(this))},K4.prototype.render=a$,I6=[],oO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nO=function($,v){return $.__v.__b-v.__v.__b},dU.__r=0,tO=/(PointerCapture)$|Capture$/i,J2=0,g2=xO(!1),U2=xO(!0),uP=0;var B4,f$,K2,U3,Mg=0,W3=[],E$=B$,_3=E$.__b,z3=E$.__r,J3=E$.diffed,b3=E$.__c,G3=E$.unmount,O3=E$.__;function $_($,v){E$.__h&&E$.__h(f$,$,Mg||v),Mg=0;var U=f$.__H||(f$.__H={__:[],__h:[]});return $>=U.__.length&&U.__.push({}),U.__[$]}function o($){return Mg=1,fP(B3,$)}function fP($,v,U){var _=$_(B4++,2);if(_.t=$,!_.__c&&(_.__=[U?U(v):B3(void 0,v),function(b){var O=_.__N?_.__N[0]:_.__[0],K=_.t(O,b);O!==K&&(_.__N=[K,_.__[1]],_.__c.setState({}))}],_.__c=f$,!f$.__f)){var g=function(b,O,K){if(!_.__c.__H)return!0;var W=_.__c.__H.__.filter(function(k){return k.__c});if(W.every(function(k){return!k.__N}))return!z||z.call(this,b,O,K);var B=_.__c.props!==b;return W.some(function(k){if(k.__N){var P=k.__[0];k.__=k.__N,k.__N=void 0,P!==k.__[0]&&(B=!0)}}),z&&z.call(this,b,O,K)||B};f$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:J}=f$;f$.componentWillUpdate=function(b,O,K){if(this.__e){var W=z;z=void 0,g(b,O,K),z=W}J&&J.call(this,b,O,K)},f$.shouldComponentUpdate=g}return _.__N||_.__}function c($,v){var U=$_(B4++,3);!E$.__s&&B2(U.__H,v)&&(U.__=$,U.u=v,f$.__H.__h.push(U))}function v_($,v){var U=$_(B4++,4);!E$.__s&&B2(U.__H,v)&&(U.__=$,U.u=v,f$.__h.push(U))}function y($){return Mg=5,n$(function(){return{current:$}},[])}function n$($,v){var U=$_(B4++,7);return B2(U.__H,v)&&(U.__=$(),U.__H=v,U.__h=$),U.__}function S($,v){return Mg=8,n$(function(){return $},v)}function cP(){for(var $;$=W3.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(eU),v.__h.some(W2),v.__h=[]}catch(U){v.__h=[],E$.__e(U,$.__v)}}}E$.__b=function($){f$=null,_3&&_3($)},E$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),O3&&O3($,v)},E$.__r=function($){z3&&z3($),B4=0;var v=(f$=$.__c).__H;v&&(K2===f$?(v.__h=[],f$.__h=[],v.__.some(function(U){U.__N&&(U.__=U.__N),U.u=U.__N=void 0})):(v.__h.some(eU),v.__h.some(W2),v.__h=[],B4=0)),K2=f$},E$.diffed=function($){J3&&J3($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(W3.push(v)!==1&&U3===E$.requestAnimationFrame||((U3=E$.requestAnimationFrame)||mP)(cP)),v.__H.__.some(function(U){U.u&&(U.__H=U.u),U.u=void 0})),K2=f$=null},E$.__c=function($,v){v.some(function(U){try{U.__h.some(eU),U.__h=U.__h.filter(function(_){return!_.__||W2(_)})}catch(_){v.some(function(g){g.__h&&(g.__h=[])}),v=[],E$.__e(_,U.__v)}}),b3&&b3($,v)},E$.unmount=function($){G3&&G3($);var v,U=$.__c;U&&U.__H&&(U.__H.__.some(function(_){try{eU(_)}catch(g){v=g}}),U.__H=void 0,v&&E$.__e(v,U.__v))};var K3=typeof requestAnimationFrame=="function";function mP($){var v,U=function(){clearTimeout(_),K3&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(U,35);K3&&(v=requestAnimationFrame(U))}function eU($){var v=f$,U=$.__c;typeof U=="function"&&($.__c=void 0,U()),f$=v}function W2($){var v=f$;$.__c=$.__(),f$=v}function B2($,v){return!$||$.length!==v.length||v.some(function(U,_){return U!==$[_]})}function B3($,v){return typeof v=="function"?v($):v}var EP=Symbol.for("preact-signals");function z_(){if(!(v6>1)){var $,v=!1;(function(){var g=U_;U_=void 0;while(g!==void 0){if(g.S.v===g.v)g.S.i=g.i;g=g.o}})();while(Sg!==void 0){var U=Sg;Sg=void 0,g_++;while(U!==void 0){var _=U.u;if(U.u=void 0,U.f&=-3,!(8&U.f)&&H3(U))try{U.c()}catch(g){if(!v)$=g,v=!0}U=_}}if(g_=0,v6--,v)throw $}else v6--}function g6($){if(v6>0)return $();P2=++iP,v6++;try{return $()}finally{z_()}}var F$=void 0;function k2($){var v=F$;F$=void 0;try{return $()}finally{F$=v}}var P3,Sg=void 0,v6=0,g_=0,iP=0,P2=0,U_=void 0,__=0;function k3($){if(F$!==void 0){var v=$.n;if(v===void 0||v.t!==F$){if(v={i:0,S:$,p:F$.s,n:void 0,t:F$,e:void 0,x:void 0,r:v},F$.s!==void 0)F$.s.n=v;if(F$.s=v,$.n=v,32&F$.f)$.S(v);return v}else if(v.i===-1){if(v.i=0,v.n!==void 0){if(v.n.p=v.p,v.p!==void 0)v.p.n=v.n;v.p=F$.s,v.n=void 0,F$.s.n=v,F$.s=v}return v}}}function o$($,v){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}o$.prototype.brand=EP;o$.prototype.h=function(){return!0};o$.prototype.S=function($){var v=this,U=this.t;if(U!==$&&$.e===void 0)if($.x=U,this.t=$,U!==void 0)U.e=$;else k2(function(){var _;(_=v.W)==null||_.call(v)})};o$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:U,x:_}=$;if(U!==void 0)U.x=_,$.e=void 0;if(_!==void 0)_.e=U,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)k2(function(){var g;(g=v.Z)==null||g.call(v)})}}};o$.prototype.subscribe=function($){var v=this;return Y6(function(){var U=v.value,_=F$;F$=void 0;try{$(U)}finally{F$=_}},{name:"sub"})};o$.prototype.valueOf=function(){return this.value};o$.prototype.toString=function(){return this.value+""};o$.prototype.toJSON=function(){return this.value};o$.prototype.peek=function(){var $=F$;F$=void 0;try{return this.value}finally{F$=$}};Object.defineProperty(o$.prototype,"value",{get:function(){var $=k3(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(g_>100)throw Error("Cycle detected");(function(U){if(v6!==0&&g_===0){if(U.l!==P2)U.l=P2,U_={S:U,v:U.v,i:U.i,o:U_}}})(this),this.v=$,this.i++,__++,v6++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{z_()}}}});function O$($,v){return new o$($,v)}function H3($){for(var v=$.s;v!==void 0;v=v.n)if(v.S.i!==v.i||!v.S.h()||v.S.i!==v.i)return!0;return!1}function L3($){for(var v=$.s;v!==void 0;v=v.n){var U=v.S.n;if(U!==void 0)v.r=U;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function I3($){var v=$.s,U=void 0;while(v!==void 0){var _=v.p;if(v.i===-1){if(v.S.U(v),_!==void 0)_.n=v.n;if(v.n!==void 0)v.n.p=_}else U=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=U}function p6($,v){o$.call(this,void 0),this.x=$,this.s=void 0,this.g=__-1,this.f=4,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}p6.prototype=new o$;p6.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===__)return!0;if(this.g=__,this.f|=1,this.i>0&&!H3(this))return this.f&=-2,!0;var $=F$;try{L3(this),F$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(U){this.v=U,this.f|=16,this.i++}return F$=$,I3(this),this.f&=-2,!0};p6.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var v=this.s;v!==void 0;v=v.n)v.S.S(v)}o$.prototype.S.call(this,$)};p6.prototype.U=function($){if(this.t!==void 0){if(o$.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var v=this.s;v!==void 0;v=v.n)v.S.U(v)}}};p6.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty(p6.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=k3(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function o6($,v){return new p6($,v)}function Y3($){var v=$.m;if($.m=void 0,typeof v=="function"){v6++;var U=F$;F$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,H2($),_}finally{F$=U,z_()}}}function H2($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,Y3($)}function lP($){if(F$!==this)throw Error("Out-of-order effect");if(I3(this),F$=$,this.f&=-2,8&this.f)H2(this);z_()}function P4($,v){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=v==null?void 0:v.name,P3)P3.push(this)}P4.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var v=this.x();if(typeof v=="function")this.m=v}finally{$()}};P4.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,Y3(this),L3(this),v6++;var $=F$;return F$=this,lP.bind(this,$)};P4.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=Sg,Sg=this};P4.prototype.d=function(){if(this.f|=8,!(1&this.f))H2(this)};P4.prototype.dispose=function(){this.d()};function Y6($,v){var U=new P4($,v);try{U.c()}catch(g){throw U.d(),g}var _=U.d.bind(U);return _[Symbol.dispose]=_,_}var L2,I2,J_,hP=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,q3=[],F3=[];Y6(function(){L2=this.N})();function k4($,v){B$[$]=v.bind(null,B$[$]||function(){})}function b_($){if(J_){var v=J_;J_=void 0,v()}J_=$&&$.S()}function X3($){var v=this,U=$.data,_=pP(U);_.value=U;var g=n$(function(){var b=v,O=v.__v;while(O=O.__)if(O.__c){O.__c.__$f|=4;break}var K=o6(function(){var P=_.value.value;return P===0?0:P===!0?"":P||""}),W=o6(function(){return!Array.isArray(K.value)&&!z2(K.value)}),B=Y6(function(){if(this.N=w3,W.value){var P=K.value;if(b.__v&&b.__v.__e&&b.__v.__e.nodeType===3)b.__v.__e.data=P}}),k=v.__$u.d;return v.__$u.d=function(){B(),k.call(this)},[W,K]},[]),z=g[0],J=g[1];return z.value?J.peek():J.value}X3.displayName="ReactiveTextNode";Object.defineProperties(o$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:X3},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});k4("__b",function($,v){if(typeof v.type=="string"){var U,_=v.props;for(var g in _)if(g!=="children"){var z=_[g];if(z instanceof o$){if(!U)v.__np=U={};U[g]=z,_[g]=z.peek()}}}$(v)});k4("__r",function($,v){if($(v),v.type!==a$){b_();var U,_=v.__c;if(_){if(_.__$f&=-2,(U=_.__$u)===void 0)_.__$u=U=function(g,z){var J;return Y6(function(){J=this},{name:z}),J.c=g,J}(function(){var g;if(hP)(g=U.y)==null||g.call(U);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}I2=_,b_(U)}});k4("__e",function($,v,U,_){b_(),I2=void 0,$(v,U,_)});k4("diffed",function($,v){b_(),I2=void 0;var U;if(typeof v.type=="string"&&(U=v.__e)){var{__np:_,props:g}=v;if(_){var z=U.U;if(z)for(var J in z){var b=z[J];if(b!==void 0&&!(J in _))b.d(),z[J]=void 0}else z={},U.U=z;for(var O in _){var K=z[O],W=_[O];if(K===void 0)K=xP(U,O,W),z[O]=K;else K.o(W,g)}for(var B in _)g[B]=_[B]}}$(v)});function xP($,v,U,_){var g=v in $&&$.ownerSVGElement===void 0,z=O$(U),J=U.peek();return{o:function(b,O){z.value=b,J=b.peek()},d:Y6(function(){this.N=w3;var b=z.value.value;if(J!==b)if(J=void 0,g)$[v]=b;else if(b!=null&&(b!==!1||v[4]==="-"))$.setAttribute(v,b);else $.removeAttribute(v);else J=void 0})}}k4("unmount",function($,v){if(typeof v.type=="string"){var U=v.__e;if(U){var _=U.U;if(_){U.U=void 0;for(var g in _){var z=_[g];if(z)z.d()}}}v.__np=void 0}else{var J=v.__c;if(J){var b=J.__$u;if(b)J.__$u=void 0,b.d()}}$(v)});k4("__h",function($,v,U,_){if(_<3||_===9)v.__$f|=2;$(v,U,_)});K4.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var U=this.__$u,_=U&&U.s!==void 0;for(var g in v)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(_||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(_||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var J in $)if(J!=="__source"&&$[J]!==this.props[J])return!0;for(var b in this.props)if(!(b in $))return!0;return!1};function pP($,v){return n$(function(){return O$($,v)},[])}var oP=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(U),cancelAnimationFrame(_),$()},U=setTimeout(v,35),_=requestAnimationFrame(v)},nP=function($){queueMicrotask(function(){queueMicrotask($)})};function tP(){g6(function(){var $;while($=q3.shift())L2.call($)})}function dP(){if(q3.push(this)===1)(B$.requestAnimationFrame||oP)(tP)}function aP(){g6(function(){var $;while($=F3.shift())L2.call($)})}function w3(){if(F3.push(this)===1)(B$.requestAnimationFrame||nP)(aP)}function A3($,v){var U=y($);U.current=$,c(function(){return Y6(function(){return this.N=dP,U.current()},v)},[])}var G_=O$(null),Qg=O$([]),L4=O$(new Set),I4=O$(new Set),O_=O$([]),K_=O$(new Set),q6=O$(!1),H4=O$(0);function Z3(){G_.value=null,Qg.value=[],L4.value=new Set,I4.value=new Set,O_.value=[],K_.value=new Set,q6.value=!1,H4.value=0}function W_(){q6.value=!0,H4.value=0}function B_(){q6.value=!1}function M3($,v,U){L4.value=new Set($),I4.value=new Set(v),O_.value=U}function P_($){G_.value=$}function S3($,v=6){if(Qg.value=[$,...Qg.value].slice(0,v),!q6.value)H4.value=Math.min(99,H4.value+1)}function k_($){K_.value=new Set($)}var s$={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",image:"IMG",html:"HTML",group:"GROUP"},H_=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","image","html"]);function Q3($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function N3($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:g}=Number;for(let z of $)v=Math.min(v,z.position.x),U=Math.min(U,z.position.y),_=Math.max(_,z.position.x+z.size.width),g=Math.max(g,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(U))return null;return{x:v-40,y:U-40-32,width:_-v+80,height:g-U+80+32}}function sP($){let v=$.filter((O)=>!O.pinned&&O.dockPosition===null),U=new Map(v.map((O)=>[O.id,O])),_=new Map,g=[],z=new Map;for(let O of v){if(O.type==="group")continue;let K=typeof O.data.parentGroup==="string"?O.data.parentGroup:"",W=K?U.get(K):void 0;if(!W||W.type!=="group")continue;if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=v.filter((O)=>O.type==="group").sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of J){let K=z.get(O.id)??[];if(K.length===0){let P=`unit:${O.id}`;g.push({id:P,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,P);continue}let W=K.map((P)=>({position:P.position,size:P.size})),B=N3(W);if(!B)continue;let k=`group:${O.id}`;g.push({id:k,memberIds:K.map((P)=>P.id),origin:{x:B.x,y:B.y},size:{width:B.width,height:B.height},sortKey:{x:B.x,y:B.y},groupId:O.id}),_.set(O.id,k);for(let P of K)_.set(P.id,k)}let b=v.filter((O)=>!_.has(O.id)).sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of b){let K=`unit:${O.id}`;g.push({id:K,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,K)}return{units:g,nodesById:U,nodeToUnit:_}}function eP($,v,U){let _=new Map,g=new Map,z=new Map,J=new Map;for(let b of $)_.set(b.id,new Set),g.set(b.id,new Set),z.set(b.id,0),J.set(b.id,0);for(let b of U){let O=v.get(b.from),K=v.get(b.to);if(!O||!K||O===K)continue;if(!_.get(O).has(K))_.get(O).add(K),J.set(O,(J.get(O)??0)+1),z.set(K,(z.get(K)??0)+1);g.get(O).add(K),g.get(K).add(O)}return{outgoing:_,undirected:g,indegree:z,outdegree:J}}function $k($,v){let U=new Map($.map((z)=>[z.id,z])),_=new Set,g=[];for(let z of $){if(_.has(z.id))continue;let J=[z.id],b=[];_.add(z.id);while(J.length>0){let K=J.pop();b.push(K);for(let W of v.get(K)??[]){if(_.has(W))continue;_.add(W),J.push(W)}}let O=b.map((K)=>U.get(K)).filter((K)=>K!==void 0).sort((K,W)=>K.sortKey.y-W.sortKey.y||K.sortKey.x-W.sortKey.x);g.push(O)}return g.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function vk($){let v=new Map,U=0,_=0,g=0,z=0,J=Math.max(900,Math.ceil(Math.sqrt($.reduce((b,O)=>b+O.size.width*O.size.height,0))));for(let b of $){if(U>0&&U+b.size.width>J)U=0,_+=g+72,g=0;v.set(b.id,{x:U,y:_}),U+=b.size.width+96,g=Math.max(g,b.size.height),z=Math.max(z,U-96)}return{positions:v,size:{width:Math.max(0,z),height:_+g},sortKey:$[0].sortKey}}function gk($,v,U,_,g){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((q)=>q.id)),J=$.filter((q)=>(_.get(q.id)??0)===0&&(g.get(q.id)??0)>0).sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.sortKey.y),b=J.length>0?J:[$.slice().sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.sortKey.y)[0]],O=new Map,K=b.map((q)=>q.id);for(let q of b)O.set(q.id,0);while(K.length>0){let q=K.shift(),w=O.get(q)??0;for(let N of U.get(q)??[]){if(!z.has(N)||O.has(N))continue;O.set(N,w+1),K.push(N)}}let W=0;for(let q of $){if(O.has(q.id))continue;O.set(q.id,W),W+=1}let B=new Map;for(let q of $){let w=O.get(q.id)??0;if(!B.has(w))B.set(w,[]);B.get(w).push(q)}let k=Array.from(B.keys()).sort((q,w)=>q-w);for(let q of k)B.get(q).sort((w,N)=>w.sortKey.y-N.sortKey.y||w.sortKey.x-N.sortKey.x);let P=new Map,F=new Map,I=0;for(let q of k){let w=B.get(q),N=w.reduce((p,r,n)=>p+r.size.height+(n>0?72:0),0),C=Math.max(...w.map((p)=>p.size.width));P.set(q,N),F.set(q,C),I=Math.max(I,N)}let H=new Map,Y=0;for(let q of k){let w=B.get(q),N=P.get(q)??0,C=F.get(q)??0,p=Math.max(0,(I-N)/2);for(let r of w)H.set(r.id,{x:Y,y:p}),p+=r.size.height+72;Y+=C+96}return{positions:H,size:{width:Math.max(0,Y-96),height:I},sortKey:$[0].sortKey}}function Uk($){let v=new Map,U=40,_=80,g=0;for(let z of $){if(U>40&&U+z.size.width>3200)U=40,_+=g+180,g=0;for(let[J,b]of z.positions.entries())v.set(J,{x:U+b.x,y:_+b.y});U+=z.size.width+220,g=Math.max(g,z.size.height)}return v}function Y2($,v,U){let{units:_,nodesById:g,nodeToUnit:z}=sP($),J=new Map,b=new Map;if(_.length===0)return{nodePositions:J,groupBounds:b};let{outgoing:O,undirected:K,indegree:W,outdegree:B}=eP(_,z,v),k=$k(_,K).map((F)=>U==="graph"?gk(F,O,K,W,B):vk(F)),P=Uk(k);for(let F of _){let I=P.get(F.id);if(!I)continue;let H=I.x-F.origin.x,Y=I.y-F.origin.y;if(F.groupId){let N=[];for(let p of F.memberIds){let r=g.get(p);if(!r)continue;let n={x:r.position.x+H,y:r.position.y+Y};J.set(p,n),N.push({position:n,size:r.size})}let C=N3(N);if(C)b.set(F.groupId,C);continue}let q=F.memberIds[0],w=g.get(q);if(!w)continue;J.set(q,{x:w.position.x+H,y:w.position.y+Y})}return{nodePositions:J,groupBounds:b}}function q2($,v){console.error(`[intent-bridge] ${$} failed`,v)}async function c$($,v,U,_){try{return await(await fetch(v,_)).json()}catch(g){return q2($,g),U}}async function _k($,v,U){try{return{ok:(await fetch(v,U)).ok}}catch(_){return q2($,_),{ok:!1}}}async function r3($,v,U){try{await fetch(v,U)}catch(_){q2($,_)}}async function u3($,v={}){return c$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function F2($){let U=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await c$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await r3("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:U,source:"browser"})}),!0}async function U6($){return(await c$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function Ng($){return c$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function y3($,v){return c$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function L_($){return _k("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function I_($){return c$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function D3(){return[]}async function rg($,v,U,_,g){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return c$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...U?{parentNodeId:U}:{},..._&&_.length>0?{contextNodeIds:_}:{},...g?{threadNodeId:g}:{}})})}async function R3($,v){return rg(v,void 0,void 0,void 0,$)}async function T3($,v={}){await r3("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function Y4($,v,U,_){return c$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:U,label:_})})}async function Ev($){return c$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function Zv($,v){return c$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function Y_($,v){return c$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v?{url:v}:{})})}async function q_($){return c$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function j3(){return c$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function V3($,v){return c$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function F_($){return c$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function C3($,v={}){return c$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function X_($){return c$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function f3($){return c$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function c3(){return c$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function m3($){return c$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function E3($){return c$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function i3($){return c$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function ug($,v){console.error(`[canvas-store] ${$} failed`,v)}var P$=O$({x:0,y:0,scale:1}),T=O$(new Map),m$=O$(new Map),F4=O$(new Map),D$=O$(null),n6=O$("connecting"),X4=O$(""),A_=O$(!1),T$=O$("dark"),t6=O$(!1),X6=O$(null),j$=O$(null),iv=O$(null),Mv=null,q4,l3=100,zk=2500,Z_=O$(null),uv=O$(null),w6=O$(null),i$=O$(new Set),R$=O$(new Set);function p3($,v){if(!$)return new Set;let U=new Set;for(let _ of v.values()){if(_.from===$)U.add(_.to);if(_.to===$)U.add(_.from)}return U}var o3=o6(()=>p3(D$.value,m$.value));function h3($,v){let U=new Set;for(let _ of $)if(v.has(_))U.add(_);return U}function x3($,v){if($.size!==v.size)return!1;for(let U of $)if(!v.has(U))return!1;return!0}function n3($){let v=new Set(i$.value);if(v.has($))v.delete($);else v.add($);i$.value=v}function t3($){i$.value=new Set($)}function jv(){if(i$.value.size===0)return;i$.value=new Set}function w4($){let v=new Set(R$.value);if(v.has($))v.delete($);else v.add($);R$.value=v,t$(),M_(v)}function d3($){let v=new Set(R$.value);for(let U of $)v.add(U);R$.value=v,t$(),M_(v)}function a3(){if(R$.value.size===0)return;R$.value=new Set,t$(),M_(new Set)}function s3($){R$.value=new Set($)}function e3(){let $=R$.value;if($.size===0)return[];return Array.from($).map((v)=>T.value.get(v)).filter((v)=>v!==void 0)}function M_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{ug("syncContextPinsToServer",v)})}var w_=1;function _6($){g6(()=>{let v=new Map(T.value);if($.zIndex>=w_)w_=$.zIndex+1;v.set($.id,$),T.value=v,D$.value=$.id})}function Pv($,v){w2($,v)}function w2($,v,U={}){let _=T.value.get($);if(!_)return;let g=new Map(T.value);if(_.type==="group"&&v.position&&U.skipGroupChildTranslation!==!0){let J=v.position.x-_.position.x,b=v.position.y-_.position.y;if(J!==0||b!==0){let O=Array.isArray(_.data.children)?_.data.children.filter((K)=>typeof K==="string"):[];for(let K of O){let W=g.get(K);if(!W||W.type==="group")continue;g.set(K,{...W,position:{x:W.position.x+J,y:W.position.y+b}})}}}g.set($,{..._,...v}),T.value=g;let z=g.get($)?.data.appCheckpoint?.updatedAt;if(iv.value===$&&z!==void 0&&z!==q4)X2($)}function v$($,v){let U=T.value.get($);if(!U)return;Pv($,{data:{...U.data,...v}})}function A4($){Jk($);let v=new Map(T.value);if(v.delete($),T.value=v,D$.value===$)D$.value=null;if(j$.value===$)j$.value=null;if(i$.value.has($)){let U=new Set(i$.value);U.delete($),i$.value=U}if(R$.value.has($)){let U=new Set(R$.value);U.delete($),R$.value=U,M_(U)}}function S_($){let v=new Map(m$.value);v.set($.id,$),m$.value=v}function $K($){let v=new Map(m$.value);v.delete($),m$.value=v}function Jk($){let v=!1,U=new Map(m$.value);for(let[_,g]of U)if(g.from===$||g.to===$)U.delete(_),v=!0;if(v)m$.value=U}function bk($){let v=new Map(F4.value);if(!v.delete($))return;F4.value=v}async function A2($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return ug("createAnnotationFromClient",v),{ok:!1}}}async function vK($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)bk($);return{ok:v.ok}}catch(v){return ug("removeAnnotationFromClient",v),{ok:!1}}}function Z4($,v){if(!T.value.get($))return;Pv($,{size:v})}function A6($){if(!T.value.get($))return;Pv($,{zIndex:w_++}),D$.value=$}function Z6($){let v=T.value.get($);if(!v)return;Pv($,{collapsed:!v.collapsed})}function gK(){for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)Pv($.id,{collapsed:!0})}var Q_=o6(()=>{for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function Z2($,v){if(!T.value.get($))return;Pv($,{dockPosition:v}),t$()}function M4($){let v=T.value.get($);if(!v)return;let U=P$.value,_=(window.innerWidth/2-U.x)/U.scale,g=(window.innerHeight/2-U.y)/U.scale;Pv($,{dockPosition:null,position:{x:_-v.size.width/2,y:g-v.size.height/2}}),t$()}function UK($){P$.value={...P$.value,...$}}function _K($){P$.value=$}function zK($){JK($)}function JK($,v={}){P$.value=$,t$(v),C3($,v)}function bK($,v={}){let U=new Map,_=1;for(let B of $.nodes)if(U.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let g=$.edges.filter((B)=>U.has(B.from)&&U.has(B.to)),z=new Map;for(let B of g)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let b=D$.value!==null&&U.has(D$.value)?D$.value:null,O=j$.value!==null&&U.has(j$.value)?j$.value:null,K=h3(i$.value,U),W=h3(R$.value,U);g6(()=>{if(v.applyViewport===!0&&$.viewport)P$.value=$.viewport;if(w_=_,T.value=U,m$.value=z,F4.value=J,D$.value=b,j$.value=O,!x3(i$.value,K))i$.value=K;if(!x3(R$.value,W))R$.value=W})}var F6=null;function Gk($){return 1-(1-$)**3}function lv($,v=300,U={}){if(F6!==null)cancelAnimationFrame(F6);let _={...P$.value},g=performance.now();function z(J){let b=J-g,O=Math.min(1,b/v),K=Gk(O);if(P$.value={x:_.x+($.x-_.x)*K,y:_.y+($.y-_.y)*K,scale:_.scale+($.scale-_.scale)*K},O<1)F6=requestAnimationFrame(z);else F6=null,JK($,U)}F6=requestAnimationFrame(z)}function S4(){if(F6!==null)cancelAnimationFrame(F6),F6=null}var GK="pmx-canvas-layout";function t$($={}){try{let v=Array.from(T.value.values()),U=v.map((g)=>({id:g.id,position:g.position,size:g.size,collapsed:g.collapsed,dockPosition:g.dockPosition})),_={viewport:P$.value,nodes:v.map((g)=>({id:g.id,type:g.type,position:g.position,size:g.size,collapsed:g.collapsed,pinned:g.pinned,dockPosition:g.dockPosition})),edges:Array.from(m$.value.values()).map((g)=>({id:g.id,from:g.from,to:g.to,type:g.type,label:g.label,style:g.style,animated:g.animated})),contextPinnedNodeIds:Array.from(R$.value)};localStorage.setItem(GK,JSON.stringify(_)),T3(U,$)}catch(v){ug("persistLayout",v)}}function OK(){try{let $=localStorage.getItem(GK);if(!$)return null;let v=JSON.parse($),U=Array.isArray(v.nodes)?v.nodes:[];if(U.length===0)return null;let _=new Map;for(let g of U){if(typeof g.id!=="string"||g.id.length===0)continue;_.set(g.id,{...g.position?{position:g.position}:{},...g.size?{size:g.size}:{},...g.collapsed!==void 0?{collapsed:g.collapsed}:{},...g.pinned!==void 0?{pinned:g.pinned}:{},...g.dockPosition!==void 0?{dockPosition:g.dockPosition}:{}})}return _.size>0?_:null}catch($){return ug("restoreLayout",$),null}}function N_($,v){let U=Array.from(T.value.values());if(U.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let P of U)_=Math.min(_,P.position.x),g=Math.min(g,P.position.y),z=Math.max(z,P.position.x+P.size.width),J=Math.max(J,P.position.y+P.size.height);let b=60,O=z-_+b*2,K=J-g+b*2,W=Math.min(1,Math.min($/O,v/K)),B=(_+z)/2,k=(g+J)/2;lv({x:$/2-B*W,y:v/2-k*W,scale:W})}function Yv($,v={}){let U=T.value.get($);if(!U)return;let _=P$.value,g=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2;lv({x:window.innerWidth/2-g*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),A6($)}function KK($=1){let v=Array.from(T.value.keys());if(v.length===0)return;let _=((D$.value?v.indexOf(D$.value):-1)+$+v.length)%v.length,g=v[_];A6(g),Yv(g)}function WK($){let v=D$.value;if(!v)return;let U=T.value.get(v);if(!U)return;let _=p3(v,m$.value);if(_.size===0)return;let g=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2,J=null,b=-1/0;for(let O of _){let K=T.value.get(O);if(!K)continue;let W=K.position.x+K.size.width/2,B=K.position.y+K.size.height/2,k=W-g,P=B-z,F=Math.sqrt(k*k+P*P);if(F<1)continue;let I;switch($){case"up":I=-P;break;case"down":I=P;break;case"left":I=-k;break;case"right":I=k;break}if(I<=0)continue;let H=I/F-F*0.001;if(H>b)b=H,J=O}if(J)Yv(J)}function z6($){if(!T.value.get($))return;if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,q4=void 0,A6($),j$.value=$}function X2($){if(Mv!==null)clearTimeout(Mv),Mv=null;if(j$.value===$)j$.value=null;if(iv.value===$)iv.value=null;q4=void 0}function d6(){let $=j$.value,v=$?T.value.get($):void 0;if($&&v&&Q3(v)){let U=$,_=Date.now();if(iv.value=U,q4=v.data.appCheckpoint?.updatedAt,Mv!==null)clearTimeout(Mv);let g=()=>{let J=T.value.get(U)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==q4){X2(U);return}if(Date.now()-_>=zk){X2(U);return}Mv=setTimeout(g,l3)};Mv=setTimeout(g,l3);return}if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,q4=void 0,j$.value=null}function r_(){let $=Y2(Array.from(T.value.values()),Array.from(m$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g6(()=>{for(let[v,U]of $.nodePositions.entries())Pv(v,{position:U});for(let[v,U]of $.groupBounds.entries())w2(v,{position:{x:U.x,y:U.y},size:{width:U.width,height:U.height}},{skipGroupChildTranslation:!0})}),t$()}function u_(){let $=Y2(Array.from(T.value.values()),Array.from(m$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g6(()=>{for(let[v,U]of $.nodePositions.entries())Pv(v,{position:U});for(let[v,U]of $.groupBounds.entries())w2(v,{position:{x:U.x,y:U.y},size:{width:U.width,height:U.height}},{skipGroupChildTranslation:!0})}),t$()}var Ok=0;function G($,v,U,_,g,z){v||(v={});var J,b,O=v;if("ref"in O)for(b in O={},v)b=="ref"?J=v[b]:O[b]=v[b];var K={type:$,props:O,key:U,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ok,__i:-1,__u:0,__source:g,__self:z};if(typeof $=="function"&&(J=$.defaultProps))for(b in J)O[b]===void 0&&(O[b]=J[b]);return B$.vnode&&B$.vnode(K),K}function Kk($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Wk(){gK(),W_()}function BK(){let $=Qg.value;if($.length===0)return null;let v=q6.value,U=H4.value;if(!v&&Q_.value)return null;if(!v)return G("button",{type:"button",class:"attention-history-tab",onClick:Wk,"aria-label":U>0?`Recent updates — ${U} new`:"Recent updates",title:U>0?`${U} new updates since last viewed`:"Recent updates",children:[G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),U>0&&G("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:U>9?"9+":U},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[G("div",{class:"attention-history-header",children:[G("div",{class:"attention-history-header-text",children:[G("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),G("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"attention-history-close",onClick:B_,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"attention-history-list",children:$.map((_)=>G("article",{class:`attention-history-entry attention-tone-${_.tone}`,children:[G("div",{class:"attention-history-meta",children:[G("span",{class:"attention-history-kind",children:_.title},void 0,!1,void 0,this),G("time",{class:"attention-history-time",dateTime:new Date(_.createdAt).toISOString(),children:Kk(_.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{class:"attention-history-detail",children:_.detail},void 0,!1,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PK(){let $=G_.value;if(!$)return null;return G("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:W_,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[G("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Bk=700,Pk=1600;function kk($){return $.replace(/\r\n?/g,`
22
+ `}}};N6.tableCaption={filter:["caption"],replacement:()=>""};N6.tableColgroup={filter:["colgroup","col"],replacement:()=>""};N6.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function PH($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||kH(v))&&KH.call($.childNodes,function(g){return g.nodeName==="TH"})}function kH($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function xK($,v=null,g=null){if(g===null)g=OH.call(v.parentNode.childNodes,v);var _=" ";if(g===0)_="| ";let U=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");U=U.replace(/\|+/g,"\\|");while(U.length<3)U+=" ";if(v)U=YH(U,v," ");return _+U+" |"}function hK($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let g=$.childNodes[v];if(g.nodeName==="TABLE")return!0;if(hK(g))return!0}return!1}var h2=($,v)=>{if(!$.childNodes)return!1;for(let g=0;g<$.childNodes.length;g++){let _=$.childNodes[g];if(v==="code"&&x2&&x2(_))return!0;if(v.includes(_.nodeName))return!0;if(h2(_,v))return!0}return!1},pK=($,v)=>{let g=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)g.push("TABLE");return h2($,"code")||h2($,g)};function p2($){let v=fK.get($);if(v!==void 0)return v;let g=HH($);return fK.set($,g),g}function HH($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(hK($))return!0;return!1}function IH($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function oK($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function YH($,v,g){let _=v.getAttribute("colspan")||1;for(let U=1;U<_;U++)$+=" | "+g.repeat(3);return $}function nK($){let v=0;for(let g=0;g<$.rows.length;g++){let U=$.rows[g].childNodes.length;if(U>v)v=U}return v}function tK($){x2=$.isCodeBlock,EK=$.options,$.keep(function(g){if(g.nodeName==="TABLE"&&pK(g,$.options))return!0;return!1});for(var v in N6)$.addRule(v,N6[v])}function dK($){$.addRule("taskListItems",{filter:function(v){let g=v.parentNode,_=g.parentNode;return v.type==="checkbox"&&(g.nodeName==="LI"||g.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,g){return(g.checked?"[x]":"[ ]")+" "}})}function LH($){$.use([mK,cK,tK,dK])}aK.gfm=LH;aK.highlightedCodeBlock=mK;aK.strikethrough=cK;aK.tables=tK;aK.taskListItems=dK});if(typeof crypto<"u"&&typeof crypto.randomUUID!=="function")crypto.randomUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let v=Math.random()*16|0;return($==="x"?v:v&3|8).toString(16)});var __,B$,vO,B2,L6,a3,UO,gO,_O,P2,O2,K2,EP,v_={},U_=[],iP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z_=Array.isArray;function $6($,v){for(var g in v)$[g]=v[g];return $}function k2($){$&&$.parentNode&&$.parentNode.removeChild($)}function lP($,v,g){var _,U,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?U=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?__.call(arguments,2):g),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return $_($,J,_,U,null)}function $_($,v,g,_,U){var z={type:$,props:v,key:g,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:U==null?++vO:U,__i:-1,__u:0};return U==null&&B$.vnode!=null&&B$.vnode(z),z}function a$($){return $.children}function H4($,v){this.props=$,this.context=v}function I4($,v){if(v==null)return $.__?I4($.__,$.__i+1):null;for(var g;v<$.__k.length;v++)if((g=$.__k[v])!=null&&g.__e!=null)return g.__e;return typeof $.type=="function"?I4($):null}function xP($){if($.__P&&$.__d){var v=$.__v,g=v.__e,_=[],U=[],z=$6({},v);z.__v=v.__v+1,B$.vnode&&B$.vnode(z),H2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[g]:null,_,g==null?I4(v):g,!!(32&v.__u),U),z.__v=v.__v,z.__.__k[z.__i]=z,GO(_,z,U),v.__e=v.__=null,z.__e!=g&&zO(z)}}function zO($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(v){if(v!=null&&v.__e!=null)return $.__e=$.__c.base=v.__e}),zO($)}function s3($){(!$.__d&&($.__d=!0)&&L6.push($)&&!g_.__r++||a3!=B$.debounceRendering)&&((a3=B$.debounceRendering)||UO)(g_)}function g_(){try{for(var $,v=1;L6.length;)L6.length>v&&L6.sort(gO),$=L6.shift(),v=L6.length,xP($)}finally{L6.length=g_.__r=0}}function JO($,v,g,_,U,z,J,b,O,K,W){var B,k,P,X,Y,H,L,q=_&&_.__k||U_,F=v.length;for(O=hP(g,v,q,O,F),B=0;B<F;B++)(P=g.__k[B])!=null&&(k=P.__i!=-1&&q[P.__i]||v_,P.__i=B,H=H2($,P,k,U,z,J,b,O,K,W),X=P.__e,P.ref&&k.ref!=P.ref&&(k.ref&&I2(k.ref,null,P),W.push(P.ref,P.__c||X,P)),Y==null&&X!=null&&(Y=X),(L=!!(4&P.__u))||k.__k===P.__k?O=bO(P,O,$,L):typeof P.type=="function"&&H!==void 0?O=H:X&&(O=X.nextSibling),P.__u&=-7);return g.__e=Y,O}function hP($,v,g,_,U){var z,J,b,O,K,W=g.length,B=W,k=0;for($.__k=Array(U),z=0;z<U;z++)(J=v[z])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=$.__k[z]=$_(null,J,null,null,null):z_(J)?J=$.__k[z]=$_(a$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=$_(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):$.__k[z]=J,O=z+k,J.__=$,J.__b=$.__b+1,b=null,(K=J.__i=pP(J,g,O,B))!=-1&&(B--,(b=g[K])&&(b.__u|=2)),b==null||b.__v==null?(K==-1&&(U>W?k--:U<W&&k++),typeof J.type!="function"&&(J.__u|=4)):K!=O&&(K==O-1?k--:K==O+1?k++:(K>O?k--:k++,J.__u|=4))):$.__k[z]=null;if(B)for(z=0;z<W;z++)(b=g[z])!=null&&(2&b.__u)==0&&(b.__e==_&&(_=I4(b)),KO(b,b));return _}function bO($,v,g,_){var U,z;if(typeof $.type=="function"){for(U=$.__k,z=0;U&&z<U.length;z++)U[z]&&(U[z].__=$,v=bO(U[z],v,g,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=I4($)),g.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function pP($,v,g,_){var U,z,J,b=$.key,O=$.type,K=v[g],W=K!=null&&(2&K.__u)==0;if(K===null&&b==null||W&&b==K.key&&O==K.type)return g;if(_>(W?1:0)){for(U=g-1,z=g+1;U>=0||z<v.length;)if((K=v[J=U>=0?U--:z++])!=null&&(2&K.__u)==0&&b==K.key&&O==K.type)return J}return-1}function e3($,v,g){v[0]=="-"?$.setProperty(v,g==null?"":g):$[v]=g==null?"":typeof g!="number"||iP.test(v)?g:g+"px"}function eg($,v,g,_,U){var z,J;$:if(v=="style")if(typeof g=="string")$.style.cssText=g;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)g&&v in g||e3($.style,v,"");if(g)for(v in g)_&&g[v]==_[v]||e3($.style,v,g[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(_O,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=g,g?_?g.u=_.u:(g.u=P2,$.addEventListener(v,z?K2:O2,z)):$.removeEventListener(v,z?K2:O2,z);else{if(U=="http://www.w3.org/2000/svg")v=v.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(v!="width"&&v!="height"&&v!="href"&&v!="list"&&v!="form"&&v!="tabIndex"&&v!="download"&&v!="rowSpan"&&v!="colSpan"&&v!="role"&&v!="popover"&&v in $)try{$[v]=g==null?"":g;break $}catch(b){}typeof g=="function"||(g==null||g===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&g==1?"":g))}}function $O($){return function(v){if(this.l){var g=this.l[v.type+$];if(v.t==null)v.t=P2++;else if(v.t<g.u)return;return g(B$.event?B$.event(v):v)}}}function H2($,v,g,_,U,z,J,b,O,K){var W,B,k,P,X,Y,H,L,q,F,N,C,p,r,n,e=v.type;if(v.constructor!==void 0)return null;128&g.__u&&(O=!!(32&g.__u),z=[b=v.__e=g.__e]),(W=B$.__b)&&W(v);$:if(typeof e=="function")try{if(L=v.props,q=e.prototype&&e.prototype.render,F=(W=e.contextType)&&_[W.__c],N=W?F?F.props.value:W.__:_,g.__c?H=(B=v.__c=g.__c).__=B.__E:(q?v.__c=B=new e(L,N):(v.__c=B=new H4(L,N),B.constructor=e,B.render=nP),F&&F.sub(B),B.state||(B.state={}),B.__n=_,k=B.__d=!0,B.__h=[],B._sb=[]),q&&B.__s==null&&(B.__s=B.state),q&&e.getDerivedStateFromProps!=null&&(B.__s==B.state&&(B.__s=$6({},B.__s)),$6(B.__s,e.getDerivedStateFromProps(L,B.__s))),P=B.props,X=B.state,B.__v=v,k)q&&e.getDerivedStateFromProps==null&&B.componentWillMount!=null&&B.componentWillMount(),q&&B.componentDidMount!=null&&B.__h.push(B.componentDidMount);else{if(q&&e.getDerivedStateFromProps==null&&L!==P&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(L,N),v.__v==g.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(L,B.__s,N)===!1){v.__v!=g.__v&&(B.props=L,B.state=B.__s,B.__d=!1),v.__e=g.__e,v.__k=g.__k,v.__k.some(function(u){u&&(u.__=v)}),U_.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(L,B.__s,N),q&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(P,X,Y)})}if(B.context=N,B.props=L,B.__P=$,B.__e=!1,C=B$.__r,p=0,q)B.state=B.__s,B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),U_.push.apply(B.__h,B._sb),B._sb=[];else do B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),B.state=B.__s;while(B.__d&&++p<25);B.state=B.__s,B.getChildContext!=null&&(_=$6($6({},_),B.getChildContext())),q&&!k&&B.getSnapshotBeforeUpdate!=null&&(Y=B.getSnapshotBeforeUpdate(P,X)),r=W!=null&&W.type===a$&&W.key==null?OO(W.props.children):W,b=JO($,z_(r)?r:[r],v,g,_,U,z,J,b,O,K),B.base=v.__e,v.__u&=-161,B.__h.length&&J.push(B),H&&(B.__E=B.__=null)}catch(u){if(v.__v=null,O||z!=null)if(u.then){for(v.__u|=O?160:128;b&&b.nodeType==8&&b.nextSibling;)b=b.nextSibling;z[z.indexOf(b)]=null,v.__e=b}else{for(n=z.length;n--;)k2(z[n]);W2(v)}else v.__e=g.__e,v.__k=g.__k,u.then||W2(v);B$.__e(u,v,g)}else z==null&&v.__v==g.__v?(v.__k=g.__k,v.__e=g.__e):b=v.__e=oP(g.__e,v,g,_,U,z,J,O,K);return(W=B$.diffed)&&W(v),128&v.__u?void 0:b}function W2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(W2))}function GO($,v,g){for(var _=0;_<g.length;_++)I2(g[_],g[++_],g[++_]);B$.__c&&B$.__c(v,$),$.some(function(U){try{$=U.__h,U.__h=[],$.some(function(z){z.call(U)})}catch(z){B$.__e(z,U.__v)}})}function OO($){return typeof $!="object"||$==null||$.__b>0?$:z_($)?$.map(OO):$6({},$)}function oP($,v,g,_,U,z,J,b,O){var K,W,B,k,P,X,Y,H=g.props||v_,L=v.props,q=v.type;if(q=="svg"?U="http://www.w3.org/2000/svg":q=="math"?U="http://www.w3.org/1998/Math/MathML":U||(U="http://www.w3.org/1999/xhtml"),z!=null){for(K=0;K<z.length;K++)if((P=z[K])&&"setAttribute"in P==!!q&&(q?P.localName==q:P.nodeType==3)){$=P,z[K]=null;break}}if($==null){if(q==null)return document.createTextNode(L);$=document.createElementNS(U,q,L.is&&L),b&&(B$.__m&&B$.__m(v,z),b=!1),z=null}if(q==null)H===L||b&&$.data==L||($.data=L);else{if(z=z&&__.call($.childNodes),!b&&z!=null)for(H={},K=0;K<$.attributes.length;K++)H[(P=$.attributes[K]).name]=P.value;for(K in H)P=H[K],K=="dangerouslySetInnerHTML"?B=P:K=="children"||(K in L)||K=="value"&&("defaultValue"in L)||K=="checked"&&("defaultChecked"in L)||eg($,K,null,P,U);for(K in L)P=L[K],K=="children"?k=P:K=="dangerouslySetInnerHTML"?W=P:K=="value"?X=P:K=="checked"?Y=P:b&&typeof P!="function"||H[K]===P||eg($,K,P,H[K],U);if(W)b||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),JO(v.type=="template"?$.content:$,z_(k)?k:[k],v,g,_,q=="foreignObject"?"http://www.w3.org/1999/xhtml":U,z,J,z?z[0]:g.__k&&I4(g,0),b,O),z!=null)for(K=z.length;K--;)k2(z[K]);b||(K="value",q=="progress"&&X==null?$.removeAttribute("value"):X!=null&&(X!==$[K]||q=="progress"&&!X||q=="option"&&X!=H[K])&&eg($,K,X,H[K],U),K="checked",Y!=null&&Y!=$[K]&&eg($,K,Y,H[K],U))}return $}function I2($,v,g){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(U){B$.__e(U,g)}}function KO($,v,g){var _,U;if(B$.unmount&&B$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||I2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){B$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(U=0;U<_.length;U++)_[U]&&KO(_[U],v,g||typeof $.type!="function");g||k2($.__e),$.__c=$.__=$.__e=void 0}function nP($,v,g){return this.constructor($,g)}function WO($,v,g){var _,U,z,J;v==document&&(v=document.documentElement),B$.__&&B$.__($,v),U=(_=typeof g=="function")?null:g&&g.__k||v.__k,z=[],J=[],H2(v,$=(!_&&g||v).__k=lP(a$,null,[$]),U||v_,v_,v.namespaceURI,!_&&g?[g]:U?null:v.firstChild?__.call(v.childNodes):null,z,!_&&g?g:U?U.__e:v.firstChild,_,J),GO(z,$,J)}__=U_.slice,B$={__e:function($,v,g,_){for(var U,z,J;v=v.__;)if((U=v.__c)&&!U.__)try{if((z=U.constructor)&&z.getDerivedStateFromError!=null&&(U.setState(z.getDerivedStateFromError($)),J=U.__d),U.componentDidCatch!=null&&(U.componentDidCatch($,_||{}),J=U.__d),J)return U.__E=U}catch(b){$=b}throw $}},vO=0,B2=function($){return $!=null&&$.constructor===void 0},H4.prototype.setState=function($,v){var g;g=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$6({},this.state),typeof $=="function"&&($=$($6({},g),this.props)),$&&$6(g,$),$!=null&&this.__v&&(v&&this._sb.push(v),s3(this))},H4.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),s3(this))},H4.prototype.render=a$,L6=[],UO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gO=function($,v){return $.__v.__b-v.__v.__b},g_.__r=0,_O=/(PointerCapture)$|Capture$/i,P2=0,O2=$O(!1),K2=$O(!0),EP=0;var Y4,f$,Y2,BO,yU=0,XO=[],E$=B$,PO=E$.__b,kO=E$.__r,HO=E$.diffed,IO=E$.__c,YO=E$.unmount,LO=E$.__;function b_($,v){E$.__h&&E$.__h(f$,$,yU||v),yU=0;var g=f$.__H||(f$.__H={__:[],__h:[]});return $>=g.__.length&&g.__.push({}),g.__[$]}function o($){return yU=1,tP(wO,$)}function tP($,v,g){var _=b_(Y4++,2);if(_.t=$,!_.__c&&(_.__=[g?g(v):wO(void 0,v),function(b){var O=_.__N?_.__N[0]:_.__[0],K=_.t(O,b);O!==K&&(_.__N=[K,_.__[1]],_.__c.setState({}))}],_.__c=f$,!f$.__f)){var U=function(b,O,K){if(!_.__c.__H)return!0;var W=_.__c.__H.__.filter(function(k){return k.__c});if(W.every(function(k){return!k.__N}))return!z||z.call(this,b,O,K);var B=_.__c.props!==b;return W.some(function(k){if(k.__N){var P=k.__[0];k.__=k.__N,k.__N=void 0,P!==k.__[0]&&(B=!0)}}),z&&z.call(this,b,O,K)||B};f$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:J}=f$;f$.componentWillUpdate=function(b,O,K){if(this.__e){var W=z;z=void 0,U(b,O,K),z=W}J&&J.call(this,b,O,K)},f$.shouldComponentUpdate=U}return _.__N||_.__}function m($,v){var g=b_(Y4++,3);!E$.__s&&q2(g.__H,v)&&(g.__=$,g.u=v,f$.__H.__h.push(g))}function G_($,v){var g=b_(Y4++,4);!E$.__s&&q2(g.__H,v)&&(g.__=$,g.u=v,f$.__h.push(g))}function y($){return yU=5,n$(function(){return{current:$}},[])}function n$($,v){var g=b_(Y4++,7);return q2(g.__H,v)&&(g.__=$(),g.__H=v,g.__h=$),g.__}function Q($,v){return yU=8,n$(function(){return $},v)}function dP(){for(var $;$=XO.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(J_),v.__h.some(L2),v.__h=[]}catch(g){v.__h=[],E$.__e(g,$.__v)}}}E$.__b=function($){f$=null,PO&&PO($)},E$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),LO&&LO($,v)},E$.__r=function($){kO&&kO($),Y4=0;var v=(f$=$.__c).__H;v&&(Y2===f$?(v.__h=[],f$.__h=[],v.__.some(function(g){g.__N&&(g.__=g.__N),g.u=g.__N=void 0})):(v.__h.some(J_),v.__h.some(L2),v.__h=[],Y4=0)),Y2=f$},E$.diffed=function($){HO&&HO($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(XO.push(v)!==1&&BO===E$.requestAnimationFrame||((BO=E$.requestAnimationFrame)||aP)(dP)),v.__H.__.some(function(g){g.u&&(g.__H=g.u),g.u=void 0})),Y2=f$=null},E$.__c=function($,v){v.some(function(g){try{g.__h.some(J_),g.__h=g.__h.filter(function(_){return!_.__||L2(_)})}catch(_){v.some(function(U){U.__h&&(U.__h=[])}),v=[],E$.__e(_,g.__v)}}),IO&&IO($,v)},E$.unmount=function($){YO&&YO($);var v,g=$.__c;g&&g.__H&&(g.__H.__.some(function(_){try{J_(_)}catch(U){v=U}}),g.__H=void 0,v&&E$.__e(v,g.__v))};var qO=typeof requestAnimationFrame=="function";function aP($){var v,g=function(){clearTimeout(_),qO&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(g,35);qO&&(v=requestAnimationFrame(g))}function J_($){var v=f$,g=$.__c;typeof g=="function"&&($.__c=void 0,g()),f$=v}function L2($){var v=f$;$.__c=$.__(),f$=v}function q2($,v){return!$||$.length!==v.length||v.some(function(g,_){return g!==$[_]})}function wO($,v){return typeof v=="function"?v($):v}var sP=Symbol.for("preact-signals");function B_(){if(!(v6>1)){var $,v=!1;(function(){var U=K_;K_=void 0;while(U!==void 0){if(U.S.v===U.v)U.S.i=U.i;U=U.o}})();while(DU!==void 0){var g=DU;DU=void 0,O_++;while(g!==void 0){var _=g.u;if(g.u=void 0,g.f&=-3,!(8&g.f)&&ZO(g))try{g.c()}catch(U){if(!v)$=U,v=!0}g=_}}if(O_=0,v6--,v)throw $}else v6--}function U6($){if(v6>0)return $();X2=++eP,v6++;try{return $()}finally{B_()}}var X$=void 0;function w2($){var v=X$;X$=void 0;try{return $()}finally{X$=v}}var FO,DU=void 0,v6=0,O_=0,eP=0,X2=0,K_=void 0,W_=0;function AO($){if(X$!==void 0){var v=$.n;if(v===void 0||v.t!==X$){if(v={i:0,S:$,p:X$.s,n:void 0,t:X$,e:void 0,x:void 0,r:v},X$.s!==void 0)X$.s.n=v;if(X$.s=v,$.n=v,32&X$.f)$.S(v);return v}else if(v.i===-1){if(v.i=0,v.n!==void 0){if(v.n.p=v.p,v.p!==void 0)v.p.n=v.n;v.p=X$.s,v.n=void 0,X$.s.n=v,X$.s=v}return v}}}function o$($,v){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}o$.prototype.brand=sP;o$.prototype.h=function(){return!0};o$.prototype.S=function($){var v=this,g=this.t;if(g!==$&&$.e===void 0)if($.x=g,this.t=$,g!==void 0)g.e=$;else w2(function(){var _;(_=v.W)==null||_.call(v)})};o$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:g,x:_}=$;if(g!==void 0)g.x=_,$.e=void 0;if(_!==void 0)_.e=g,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)w2(function(){var U;(U=v.Z)==null||U.call(v)})}}};o$.prototype.subscribe=function($){var v=this;return q6(function(){var g=v.value,_=X$;X$=void 0;try{$(g)}finally{X$=_}},{name:"sub"})};o$.prototype.valueOf=function(){return this.value};o$.prototype.toString=function(){return this.value+""};o$.prototype.toJSON=function(){return this.value};o$.prototype.peek=function(){var $=X$;X$=void 0;try{return this.value}finally{X$=$}};Object.defineProperty(o$.prototype,"value",{get:function(){var $=AO(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(O_>100)throw Error("Cycle detected");(function(g){if(v6!==0&&O_===0){if(g.l!==X2)g.l=X2,K_={S:g,v:g.v,i:g.i,o:K_}}})(this),this.v=$,this.i++,W_++,v6++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{B_()}}}});function O$($,v){return new o$($,v)}function ZO($){for(var v=$.s;v!==void 0;v=v.n)if(v.S.i!==v.i||!v.S.h()||v.S.i!==v.i)return!0;return!1}function MO($){for(var v=$.s;v!==void 0;v=v.n){var g=v.S.n;if(g!==void 0)v.r=g;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function QO($){var v=$.s,g=void 0;while(v!==void 0){var _=v.p;if(v.i===-1){if(v.S.U(v),_!==void 0)_.n=v.n;if(v.n!==void 0)v.n.p=_}else g=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=g}function s6($,v){o$.call(this,void 0),this.x=$,this.s=void 0,this.g=W_-1,this.f=4,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}s6.prototype=new o$;s6.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===W_)return!0;if(this.g=W_,this.f|=1,this.i>0&&!ZO(this))return this.f&=-2,!0;var $=X$;try{MO(this),X$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(g){this.v=g,this.f|=16,this.i++}return X$=$,QO(this),this.f&=-2,!0};s6.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var v=this.s;v!==void 0;v=v.n)v.S.S(v)}o$.prototype.S.call(this,$)};s6.prototype.U=function($){if(this.t!==void 0){if(o$.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var v=this.s;v!==void 0;v=v.n)v.S.U(v)}}};s6.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty(s6.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=AO(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function e6($,v){return new s6($,v)}function SO($){var v=$.m;if($.m=void 0,typeof v=="function"){v6++;var g=X$;X$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,F2($),_}finally{X$=g,B_()}}}function F2($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,SO($)}function $k($){if(X$!==this)throw Error("Out-of-order effect");if(QO(this),X$=$,this.f&=-2,8&this.f)F2(this);B_()}function L4($,v){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=v==null?void 0:v.name,FO)FO.push(this)}L4.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var v=this.x();if(typeof v=="function")this.m=v}finally{$()}};L4.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,SO(this),MO(this),v6++;var $=X$;return X$=this,$k.bind(this,$)};L4.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=DU,DU=this};L4.prototype.d=function(){if(this.f|=8,!(1&this.f))F2(this)};L4.prototype.dispose=function(){this.d()};function q6($,v){var g=new L4($,v);try{g.c()}catch(U){throw g.d(),U}var _=g.d.bind(g);return _[Symbol.dispose]=_,_}var A2,Z2,P_,vk=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,NO=[],rO=[];q6(function(){A2=this.N})();function q4($,v){B$[$]=v.bind(null,B$[$]||function(){})}function k_($){if(P_){var v=P_;P_=void 0,v()}P_=$&&$.S()}function uO($){var v=this,g=$.data,_=gk(g);_.value=g;var U=n$(function(){var b=v,O=v.__v;while(O=O.__)if(O.__c){O.__c.__$f|=4;break}var K=e6(function(){var P=_.value.value;return P===0?0:P===!0?"":P||""}),W=e6(function(){return!Array.isArray(K.value)&&!B2(K.value)}),B=q6(function(){if(this.N=yO,W.value){var P=K.value;if(b.__v&&b.__v.__e&&b.__v.__e.nodeType===3)b.__v.__e.data=P}}),k=v.__$u.d;return v.__$u.d=function(){B(),k.call(this)},[W,K]},[]),z=U[0],J=U[1];return z.value?J.peek():J.value}uO.displayName="ReactiveTextNode";Object.defineProperties(o$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:uO},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});q4("__b",function($,v){if(typeof v.type=="string"){var g,_=v.props;for(var U in _)if(U!=="children"){var z=_[U];if(z instanceof o$){if(!g)v.__np=g={};g[U]=z,_[U]=z.peek()}}}$(v)});q4("__r",function($,v){if($(v),v.type!==a$){k_();var g,_=v.__c;if(_){if(_.__$f&=-2,(g=_.__$u)===void 0)_.__$u=g=function(U,z){var J;return q6(function(){J=this},{name:z}),J.c=U,J}(function(){var U;if(vk)(U=g.y)==null||U.call(g);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}Z2=_,k_(g)}});q4("__e",function($,v,g,_){k_(),Z2=void 0,$(v,g,_)});q4("diffed",function($,v){k_(),Z2=void 0;var g;if(typeof v.type=="string"&&(g=v.__e)){var{__np:_,props:U}=v;if(_){var z=g.U;if(z)for(var J in z){var b=z[J];if(b!==void 0&&!(J in _))b.d(),z[J]=void 0}else z={},g.U=z;for(var O in _){var K=z[O],W=_[O];if(K===void 0)K=Uk(g,O,W),z[O]=K;else K.o(W,U)}for(var B in _)U[B]=_[B]}}$(v)});function Uk($,v,g,_){var U=v in $&&$.ownerSVGElement===void 0,z=O$(g),J=g.peek();return{o:function(b,O){z.value=b,J=b.peek()},d:q6(function(){this.N=yO;var b=z.value.value;if(J!==b)if(J=void 0,U)$[v]=b;else if(b!=null&&(b!==!1||v[4]==="-"))$.setAttribute(v,b);else $.removeAttribute(v);else J=void 0})}}q4("unmount",function($,v){if(typeof v.type=="string"){var g=v.__e;if(g){var _=g.U;if(_){g.U=void 0;for(var U in _){var z=_[U];if(z)z.d()}}}v.__np=void 0}else{var J=v.__c;if(J){var b=J.__$u;if(b)J.__$u=void 0,b.d()}}$(v)});q4("__h",function($,v,g,_){if(_<3||_===9)v.__$f|=2;$(v,g,_)});H4.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var g=this.__$u,_=g&&g.s!==void 0;for(var U in v)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(_||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(_||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var J in $)if(J!=="__source"&&$[J]!==this.props[J])return!0;for(var b in this.props)if(!(b in $))return!0;return!1};function gk($,v){return n$(function(){return O$($,v)},[])}var _k=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(g),cancelAnimationFrame(_),$()},g=setTimeout(v,35),_=requestAnimationFrame(v)},zk=function($){queueMicrotask(function(){queueMicrotask($)})};function Jk(){U6(function(){var $;while($=NO.shift())A2.call($)})}function bk(){if(NO.push(this)===1)(B$.requestAnimationFrame||_k)(Jk)}function Gk(){U6(function(){var $;while($=rO.shift())A2.call($)})}function yO(){if(rO.push(this)===1)(B$.requestAnimationFrame||zk)(Gk)}function DO($,v){var g=y($);g.current=$,m(function(){return q6(function(){return this.N=bk,g.current()},v)},[])}var H_=O$(null),RU=O$([]),w4=O$(new Set),F4=O$(new Set),I_=O$([]),Y_=O$(new Set),X6=O$(!1),X4=O$(0);function RO(){H_.value=null,RU.value=[],w4.value=new Set,F4.value=new Set,I_.value=[],Y_.value=new Set,X6.value=!1,X4.value=0}function L_(){X6.value=!0,X4.value=0}function q_(){X6.value=!1}function TO($,v,g){w4.value=new Set($),F4.value=new Set(v),I_.value=g}function X_($){H_.value=$}function jO($,v=6){if(RU.value=[$,...RU.value].slice(0,v),!X6.value)X4.value=Math.min(99,X4.value+1)}function w_($){Y_.value=new Set($)}var s$={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",image:"IMG",html:"HTML",group:"GROUP"},F_=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","image","html"]);function VO($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function CO($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:U}=Number;for(let z of $)v=Math.min(v,z.position.x),g=Math.min(g,z.position.y),_=Math.max(_,z.position.x+z.size.width),U=Math.max(U,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(g))return null;return{x:v-40,y:g-40-32,width:_-v+80,height:U-g+80+32}}function Ok($){let v=$.filter((O)=>!O.pinned&&O.dockPosition===null),g=new Map(v.map((O)=>[O.id,O])),_=new Map,U=[],z=new Map;for(let O of v){if(O.type==="group")continue;let K=typeof O.data.parentGroup==="string"?O.data.parentGroup:"",W=K?g.get(K):void 0;if(!W||W.type!=="group")continue;if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=v.filter((O)=>O.type==="group").sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of J){let K=z.get(O.id)??[];if(K.length===0){let P=`unit:${O.id}`;U.push({id:P,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,P);continue}let W=K.map((P)=>({position:P.position,size:P.size})),B=CO(W);if(!B)continue;let k=`group:${O.id}`;U.push({id:k,memberIds:K.map((P)=>P.id),origin:{x:B.x,y:B.y},size:{width:B.width,height:B.height},sortKey:{x:B.x,y:B.y},groupId:O.id}),_.set(O.id,k);for(let P of K)_.set(P.id,k)}let b=v.filter((O)=>!_.has(O.id)).sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of b){let K=`unit:${O.id}`;U.push({id:K,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,K)}return{units:U,nodesById:g,nodeToUnit:_}}function Kk($,v,g){let _=new Map,U=new Map,z=new Map,J=new Map;for(let b of $)_.set(b.id,new Set),U.set(b.id,new Set),z.set(b.id,0),J.set(b.id,0);for(let b of g){let O=v.get(b.from),K=v.get(b.to);if(!O||!K||O===K)continue;if(!_.get(O).has(K))_.get(O).add(K),J.set(O,(J.get(O)??0)+1),z.set(K,(z.get(K)??0)+1);U.get(O).add(K),U.get(K).add(O)}return{outgoing:_,undirected:U,indegree:z,outdegree:J}}function Wk($,v){let g=new Map($.map((z)=>[z.id,z])),_=new Set,U=[];for(let z of $){if(_.has(z.id))continue;let J=[z.id],b=[];_.add(z.id);while(J.length>0){let K=J.pop();b.push(K);for(let W of v.get(K)??[]){if(_.has(W))continue;_.add(W),J.push(W)}}let O=b.map((K)=>g.get(K)).filter((K)=>K!==void 0).sort((K,W)=>K.sortKey.y-W.sortKey.y||K.sortKey.x-W.sortKey.x);U.push(O)}return U.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function Bk($){let v=new Map,g=0,_=0,U=0,z=0,J=Math.max(900,Math.ceil(Math.sqrt($.reduce((b,O)=>b+O.size.width*O.size.height,0))));for(let b of $){if(g>0&&g+b.size.width>J)g=0,_+=U+72,U=0;v.set(b.id,{x:g,y:_}),g+=b.size.width+96,U=Math.max(U,b.size.height),z=Math.max(z,g-96)}return{positions:v,size:{width:Math.max(0,z),height:_+U},sortKey:$[0].sortKey}}function Pk($,v,g,_,U){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((q)=>q.id)),J=$.filter((q)=>(_.get(q.id)??0)===0&&(U.get(q.id)??0)>0).sort((q,F)=>q.sortKey.x-F.sortKey.x||q.sortKey.y-F.sortKey.y),b=J.length>0?J:[$.slice().sort((q,F)=>q.sortKey.x-F.sortKey.x||q.sortKey.y-F.sortKey.y)[0]],O=new Map,K=b.map((q)=>q.id);for(let q of b)O.set(q.id,0);while(K.length>0){let q=K.shift(),F=O.get(q)??0;for(let N of g.get(q)??[]){if(!z.has(N)||O.has(N))continue;O.set(N,F+1),K.push(N)}}let W=0;for(let q of $){if(O.has(q.id))continue;O.set(q.id,W),W+=1}let B=new Map;for(let q of $){let F=O.get(q.id)??0;if(!B.has(F))B.set(F,[]);B.get(F).push(q)}let k=Array.from(B.keys()).sort((q,F)=>q-F);for(let q of k)B.get(q).sort((F,N)=>F.sortKey.y-N.sortKey.y||F.sortKey.x-N.sortKey.x);let P=new Map,X=new Map,Y=0;for(let q of k){let F=B.get(q),N=F.reduce((p,r,n)=>p+r.size.height+(n>0?72:0),0),C=Math.max(...F.map((p)=>p.size.width));P.set(q,N),X.set(q,C),Y=Math.max(Y,N)}let H=new Map,L=0;for(let q of k){let F=B.get(q),N=P.get(q)??0,C=X.get(q)??0,p=Math.max(0,(Y-N)/2);for(let r of F)H.set(r.id,{x:L,y:p}),p+=r.size.height+72;L+=C+96}return{positions:H,size:{width:Math.max(0,L-96),height:Y},sortKey:$[0].sortKey}}function kk($){let v=new Map,g=40,_=80,U=0;for(let z of $){if(g>40&&g+z.size.width>3200)g=40,_+=U+180,U=0;for(let[J,b]of z.positions.entries())v.set(J,{x:g+b.x,y:_+b.y});g+=z.size.width+220,U=Math.max(U,z.size.height)}return v}function M2($,v,g){let{units:_,nodesById:U,nodeToUnit:z}=Ok($),J=new Map,b=new Map;if(_.length===0)return{nodePositions:J,groupBounds:b};let{outgoing:O,undirected:K,indegree:W,outdegree:B}=Kk(_,z,v),k=Wk(_,K).map((X)=>g==="graph"?Pk(X,O,K,W,B):Bk(X)),P=kk(k);for(let X of _){let Y=P.get(X.id);if(!Y)continue;let H=Y.x-X.origin.x,L=Y.y-X.origin.y;if(X.groupId){let N=[];for(let p of X.memberIds){let r=U.get(p);if(!r)continue;let n={x:r.position.x+H,y:r.position.y+L};J.set(p,n),N.push({position:n,size:r.size})}let C=CO(N);if(C)b.set(X.groupId,C);continue}let q=X.memberIds[0],F=U.get(q);if(!F)continue;J.set(q,{x:F.position.x+H,y:F.position.y+L})}return{nodePositions:J,groupBounds:b}}function Q2($,v){console.error(`[intent-bridge] ${$} failed`,v)}async function m$($,v,g,_){try{return await(await fetch(v,_)).json()}catch(U){return Q2($,U),g}}async function Hk($,v,g){try{return{ok:(await fetch(v,g)).ok}}catch(_){return Q2($,_),{ok:!1}}}async function fO($,v,g){try{await fetch(v,g)}catch(_){Q2($,_)}}async function mO($,v={}){return m$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function S2($){let g=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await m$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await fO("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:g,source:"browser"})}),!0}async function g6($){return(await m$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function TU($){return m$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function cO($,v){return m$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function A_($){return Hk("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function Z_($){return m$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function EO(){return[]}async function jU($,v,g,_,U){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return m$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...g?{parentNodeId:g}:{},..._&&_.length>0?{contextNodeIds:_}:{},...U?{threadNodeId:U}:{}})})}async function iO($,v){return jU(v,void 0,void 0,void 0,$)}async function lO($,v={}){await fO("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function A4($,v,g,_){return m$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:g,label:_})})}async function Ev($){return m$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function Zv($,v){return m$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function M_($,v){return m$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v?{url:v}:{})})}async function Q_($){return m$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function xO(){return m$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function hO($,v){return m$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function S_($){return m$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function pO($,v={}){return m$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function N_($){return m$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function oO($){return m$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function nO(){return m$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function tO($){return m$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function dO($){return m$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function aO($){return m$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function VU($,v){console.error(`[canvas-store] ${$} failed`,v)}var P$=O$({x:0,y:0,scale:1}),T=O$(new Map),c$=O$(new Map),M4=O$(new Map),D$=O$(null),lv=O$("connecting"),$4=O$(""),u_=O$(!1),T$=O$("dark"),F6=O$(!1),A6=O$(null),j$=O$(null),iv=O$(null),Mv=null,Z4,sO=100,Ik=2500,y_=O$(null),uv=O$(null),Z6=O$(null),i$=O$(new Set),R$=O$(new Set);function vK($,v){if(!$)return new Set;let g=new Set;for(let _ of v.values()){if(_.from===$)g.add(_.to);if(_.to===$)g.add(_.from)}return g}var UK=e6(()=>vK(D$.value,c$.value));function eO($,v){let g=new Set;for(let _ of $)if(v.has(_))g.add(_);return g}function $K($,v){if($.size!==v.size)return!1;for(let g of $)if(!v.has(g))return!1;return!0}function gK($){let v=new Set(i$.value);if(v.has($))v.delete($);else v.add($);i$.value=v}function _K($){i$.value=new Set($)}function jv(){if(i$.value.size===0)return;i$.value=new Set}function Q4($){let v=new Set(R$.value);if(v.has($))v.delete($);else v.add($);R$.value=v,t$(),D_(v)}function zK($){let v=new Set(R$.value);for(let g of $)v.add(g);R$.value=v,t$(),D_(v)}function JK(){if(R$.value.size===0)return;R$.value=new Set,t$(),D_(new Set)}function bK($){R$.value=new Set($)}function GK(){let $=R$.value;if($.size===0)return[];return Array.from($).map((v)=>T.value.get(v)).filter((v)=>v!==void 0)}function D_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{VU("syncContextPinsToServer",v)})}var r_=1;function _6($){U6(()=>{let v=new Map(T.value);if($.zIndex>=r_)r_=$.zIndex+1;v.set($.id,$),T.value=v,D$.value=$.id})}function Pv($,v){r2($,v)}function r2($,v,g={}){let _=T.value.get($);if(!_)return;let U=new Map(T.value);if(_.type==="group"&&v.position&&g.skipGroupChildTranslation!==!0){let J=v.position.x-_.position.x,b=v.position.y-_.position.y;if(J!==0||b!==0){let O=Array.isArray(_.data.children)?_.data.children.filter((K)=>typeof K==="string"):[];for(let K of O){let W=U.get(K);if(!W||W.type==="group")continue;U.set(K,{...W,position:{x:W.position.x+J,y:W.position.y+b}})}}}U.set($,{..._,...v}),T.value=U;let z=U.get($)?.data.appCheckpoint?.updatedAt;if(iv.value===$&&z!==void 0&&z!==Z4)N2($)}function v$($,v){let g=T.value.get($);if(!g)return;Pv($,{data:{...g.data,...v}})}function S4($){Yk($);let v=new Map(T.value);if(v.delete($),T.value=v,D$.value===$)D$.value=null;if(j$.value===$)j$.value=null;if(i$.value.has($)){let g=new Set(i$.value);g.delete($),i$.value=g}if(R$.value.has($)){let g=new Set(R$.value);g.delete($),R$.value=g,D_(g)}}function R_($){let v=new Map(c$.value);v.set($.id,$),c$.value=v}function OK($){let v=new Map(c$.value);v.delete($),c$.value=v}function Yk($){let v=!1,g=new Map(c$.value);for(let[_,U]of g)if(U.from===$||U.to===$)g.delete(_),v=!0;if(v)c$.value=g}function Lk($){let v=new Map(M4.value);if(!v.delete($))return;M4.value=v}async function u2($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return VU("createAnnotationFromClient",v),{ok:!1}}}async function KK($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)Lk($);return{ok:v.ok}}catch(v){return VU("removeAnnotationFromClient",v),{ok:!1}}}function N4($,v){if(!T.value.get($))return;Pv($,{size:v})}function M6($){if(!T.value.get($))return;Pv($,{zIndex:r_++}),D$.value=$}function Q6($){let v=T.value.get($);if(!v)return;Pv($,{collapsed:!v.collapsed})}function WK(){for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)Pv($.id,{collapsed:!0})}var T_=e6(()=>{for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function y2($,v){if(!T.value.get($))return;Pv($,{dockPosition:v}),t$()}function r4($){let v=T.value.get($);if(!v)return;let g=P$.value,_=(window.innerWidth/2-g.x)/g.scale,U=(window.innerHeight/2-g.y)/g.scale;Pv($,{dockPosition:null,position:{x:_-v.size.width/2,y:U-v.size.height/2}}),t$()}function BK($){P$.value={...P$.value,...$}}function PK($){P$.value=$}function kK($){HK($)}function HK($,v={}){P$.value=$,t$(v),pO($,v)}function IK($,v={}){let g=new Map,_=1;for(let B of $.nodes)if(g.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let U=$.edges.filter((B)=>g.has(B.from)&&g.has(B.to)),z=new Map;for(let B of U)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let b=D$.value!==null&&g.has(D$.value)?D$.value:null,O=j$.value!==null&&g.has(j$.value)?j$.value:null,K=eO(i$.value,g),W=eO(R$.value,g);U6(()=>{if(v.applyViewport===!0&&$.viewport)P$.value=$.viewport;if(r_=_,T.value=g,c$.value=z,M4.value=J,D$.value=b,j$.value=O,!$K(i$.value,K))i$.value=K;if(!$K(R$.value,W))R$.value=W})}var w6=null;function qk($){return 1-(1-$)**3}function xv($,v=300,g={}){if(w6!==null)cancelAnimationFrame(w6);let _={...P$.value},U=performance.now();function z(J){let b=J-U,O=Math.min(1,b/v),K=qk(O);if(P$.value={x:_.x+($.x-_.x)*K,y:_.y+($.y-_.y)*K,scale:_.scale+($.scale-_.scale)*K},O<1)w6=requestAnimationFrame(z);else w6=null,HK($,g)}w6=requestAnimationFrame(z)}function u4(){if(w6!==null)cancelAnimationFrame(w6),w6=null}var YK="pmx-canvas-layout";function t$($={}){try{let v=Array.from(T.value.values()),g=v.map((U)=>({id:U.id,position:U.position,size:U.size,collapsed:U.collapsed,dockPosition:U.dockPosition})),_={viewport:P$.value,nodes:v.map((U)=>({id:U.id,type:U.type,position:U.position,size:U.size,collapsed:U.collapsed,pinned:U.pinned,dockPosition:U.dockPosition})),edges:Array.from(c$.value.values()).map((U)=>({id:U.id,from:U.from,to:U.to,type:U.type,label:U.label,style:U.style,animated:U.animated})),contextPinnedNodeIds:Array.from(R$.value)};localStorage.setItem(YK,JSON.stringify(_)),lO(g,$)}catch(v){VU("persistLayout",v)}}function D2(){try{let $=localStorage.getItem(YK);if(!$)return null;let v=JSON.parse($),g=Array.isArray(v.nodes)?v.nodes:[];if(g.length===0)return null;let _=new Map;for(let U of g){if(typeof U.id!=="string"||U.id.length===0)continue;_.set(U.id,{...U.position?{position:U.position}:{},...U.size?{size:U.size}:{},...U.collapsed!==void 0?{collapsed:U.collapsed}:{},...U.pinned!==void 0?{pinned:U.pinned}:{},...U.dockPosition!==void 0?{dockPosition:U.dockPosition}:{}})}return _.size>0?_:null}catch($){return VU("restoreLayout",$),null}}function j_($,v){let g=Array.from(T.value.values());if(g.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let P of g)_=Math.min(_,P.position.x),U=Math.min(U,P.position.y),z=Math.max(z,P.position.x+P.size.width),J=Math.max(J,P.position.y+P.size.height);let b=60,O=z-_+b*2,K=J-U+b*2,W=Math.min(1,Math.min($/O,v/K)),B=(_+z)/2,k=(U+J)/2;xv({x:$/2-B*W,y:v/2-k*W,scale:W})}function Lv($,v={}){let g=T.value.get($);if(!g)return;let _=P$.value,U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2;xv({x:window.innerWidth/2-U*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),M6($)}function LK($=1){let v=Array.from(T.value.keys());if(v.length===0)return;let _=((D$.value?v.indexOf(D$.value):-1)+$+v.length)%v.length,U=v[_];M6(U),Lv(U)}function qK($){let v=D$.value;if(!v)return;let g=T.value.get(v);if(!g)return;let _=vK(v,c$.value);if(_.size===0)return;let U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2,J=null,b=-1/0;for(let O of _){let K=T.value.get(O);if(!K)continue;let W=K.position.x+K.size.width/2,B=K.position.y+K.size.height/2,k=W-U,P=B-z,X=Math.sqrt(k*k+P*P);if(X<1)continue;let Y;switch($){case"up":Y=-P;break;case"down":Y=P;break;case"left":Y=-k;break;case"right":Y=k;break}if(Y<=0)continue;let H=Y/X-X*0.001;if(H>b)b=H,J=O}if(J)Lv(J)}function z6($){if(!T.value.get($))return;if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,Z4=void 0,M6($),j$.value=$}function N2($){if(Mv!==null)clearTimeout(Mv),Mv=null;if(j$.value===$)j$.value=null;if(iv.value===$)iv.value=null;Z4=void 0}function v4(){let $=j$.value,v=$?T.value.get($):void 0;if($&&v&&VO(v)){let g=$,_=Date.now();if(iv.value=g,Z4=v.data.appCheckpoint?.updatedAt,Mv!==null)clearTimeout(Mv);let U=()=>{let J=T.value.get(g)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==Z4){N2(g);return}if(Date.now()-_>=Ik){N2(g);return}Mv=setTimeout(U,sO)};Mv=setTimeout(U,sO);return}if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,Z4=void 0,j$.value=null}function V_(){let $=M2(Array.from(T.value.values()),Array.from(c$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())r2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),t$()}function C_(){let $=M2(Array.from(T.value.values()),Array.from(c$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())r2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),t$()}var Xk=0;function G($,v,g,_,U,z){v||(v={});var J,b,O=v;if("ref"in O)for(b in O={},v)b=="ref"?J=v[b]:O[b]=v[b];var K={type:$,props:O,key:g,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Xk,__i:-1,__u:0,__source:U,__self:z};if(typeof $=="function"&&(J=$.defaultProps))for(b in J)O[b]===void 0&&(O[b]=J[b]);return B$.vnode&&B$.vnode(K),K}function wk($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Fk(){WK(),L_()}function XK(){let $=RU.value;if($.length===0)return null;let v=X6.value,g=X4.value;if(!v&&T_.value)return null;if(!v)return G("button",{type:"button",class:"attention-history-tab",onClick:Fk,"aria-label":g>0?`Recent updates — ${g} new`:"Recent updates",title:g>0?`${g} new updates since last viewed`:"Recent updates",children:[G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),g>0&&G("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:g>9?"9+":g},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[G("div",{class:"attention-history-header",children:[G("div",{class:"attention-history-header-text",children:[G("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),G("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"attention-history-close",onClick:q_,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"attention-history-list",children:$.map((_)=>G("article",{class:`attention-history-entry attention-tone-${_.tone}`,children:[G("div",{class:"attention-history-meta",children:[G("span",{class:"attention-history-kind",children:_.title},void 0,!1,void 0,this),G("time",{class:"attention-history-time",dateTime:new Date(_.createdAt).toISOString(),children:wk(_.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{class:"attention-history-detail",children:_.detail},void 0,!1,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wK(){let $=H_.value;if(!$)return null;return G("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:L_,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[G("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ak=700,Zk=1600;function Mk($){return $.replace(/\r\n?/g,`
23
23
  `).replace(/[ \t\f\v]+/g," ").replace(/\n\s+/g,`
24
24
  `).replace(/\s+\n/g,`
25
25
  `).replace(/\n{3,}/g,`
26
26
 
27
- `).trim()}function qv($,v){if(v<=0)return"";let U=kk($);if(U.length<=v)return U;if(v<=1)return U.slice(0,v);return`${U.slice(0,Math.max(0,v-1)).trimEnd()}…`}function y_($,v){if(typeof $==="string")return qv($,v);if($===null||$===void 0)return"";try{return qv(JSON.stringify($),v)}catch{return""}}function Hk($,v){let U=[],_=typeof $.url==="string"?$.url:"",g=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",J=typeof $.status==="string"?$.status:"",b=typeof $.statusCode==="number"?$.statusCode:null,O=typeof $.error==="string"?$.error:"",K=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(_)U.push(`URL: ${_}`);if(g)U.push(`Title: ${g}`);if(z)U.push(`Description: ${z}`);if(J||b!==null)U.push(`Fetch: ${J||"unknown"}${b!==null?` (${b})`:""}`);if(O)U.push(`Error: ${O}`);let W=U.join(`
27
+ `).trim()}function qv($,v){if(v<=0)return"";let g=Mk($);if(g.length<=v)return g;if(v<=1)return g.slice(0,v);return`${g.slice(0,Math.max(0,v-1)).trimEnd()}…`}function f_($,v){if(typeof $==="string")return qv($,v);if($===null||$===void 0)return"";try{return qv(JSON.stringify($),v)}catch{return""}}function Qk($,v){let g=[],_=typeof $.url==="string"?$.url:"",U=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",J=typeof $.status==="string"?$.status:"",b=typeof $.statusCode==="number"?$.statusCode:null,O=typeof $.error==="string"?$.error:"",K=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(_)g.push(`URL: ${_}`);if(U)g.push(`Title: ${U}`);if(z)g.push(`Description: ${z}`);if(J||b!==null)g.push(`Fetch: ${J||"unknown"}${b!==null?` (${b})`:""}`);if(O)g.push(`Error: ${O}`);let W=g.join(`
28
28
  `),B=Math.max(0,v-W.length-(W?2:0)),k=B>0?qv(K,B):"";if(W&&k)return`${W}
29
29
 
30
- ${k}`;if(W)return qv(W,v);return qv(K,v)}function Lk($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let U=Object.keys($).sort();return U.length>0?`Input keys: ${U.join(", ")}`:""}function Ik($,v){let U=[],_=typeof $.title==="string"?$.title:"",g=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",J=typeof $.serverName==="string"?$.serverName:"",b=typeof $.toolName==="string"?$.toolName:"",O=typeof $.resourceUri==="string"?$.resourceUri:"",K=typeof $.path==="string"?$.path:"",W=typeof $.url==="string"?$.url:"",B=typeof $.sessionStatus==="string"?$.sessionStatus:"",k=Lk($.toolInput);if(_)U.push(`App: ${_}`);if(g||z)U.push(`Mode: ${[g,z].filter(Boolean).join(" / ")}`);if(J||b)U.push(`Source: ${[J,b].filter(Boolean).join(" / ")}`);if(O)U.push(`Resource: ${O}`);if(K)U.push(`Path: ${K}`);if(W)U.push(`URL: ${W}`);if(B)U.push(`Session: ${B}`);if(k)U.push(k);if(U.length===0)return"MCP App node";return qv(U.join(`
31
- `),v)}function Yk($,v){let U=[],_=typeof $.content==="string"?$.content:"",g=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",J=typeof $.url==="string"?$.url:"",b=typeof $.projectPath==="string"?$.projectPath:"",O=typeof $.artifactBytes==="number"?$.artifactBytes:null,K=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,W=Array.isArray($.sourceFiles)?$.sourceFiles.filter((k)=>typeof k==="string"):[],B=Array.isArray($.deps)?$.deps.filter((k)=>typeof k==="string"):[];if(_)U.push(_);if(!_&&g)U.push(`Web artifact: ${g}`);if(W.length>0&&!_.includes("Source files:")){let k=K!==null?Math.max(0,K-W.length):0;U.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(O!==null&&!_.includes("Artifact bytes:"))U.push(`Artifact bytes: ${O}`);if(B.length>0&&!_.includes("Dependencies:"))U.push(`Dependencies: ${B.join(", ")}`);if(z)U.push(`Path: ${z}`);if(b)U.push(`Project: ${b}`);if(J)U.push(`URL: ${J}`);return U.length>0?qv(U.join(`
32
- `),v):"Web artifact node"}function qk($,v){let U=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",g=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)U.push(`HTML primitive: ${_}`);if(g)U.push(g);if(z!==void 0)U.push(`Data: ${y_(z,v)}`);return qv(U.join(`
33
- `),v)}function kK($,v={}){let U=v.defaultTextLength??Bk,_=v.webpageTextLength??Pk;switch($.type){case"markdown":{let g=$.data.rendered||$.data.content||"";return qv(g,U)}case"mcp-app":{if($.data.viewerType==="web-artifact")return Yk($.data,U);let g=$.data.chartConfig;if(g){let z=g.title||"Untitled chart",J=g.type||"unknown",b=Array.isArray(g.labels)?g.labels.join(", "):"";return qv(`Chart: ${z} (${J}). Labels: ${b}`,U)}return Ik($.data,U)}case"webpage":return Hk($.data,_);case"json-render":case"graph":{let g=$.data.graphConfig;if(g)return qv(`Graph: ${JSON.stringify(g)}`,U);return y_($.data.spec??{},U)}case"html":{if(typeof $.data.agentSummary==="string")return qv($.data.agentSummary,U);if(typeof $.data.htmlPrimitive==="string")return qk($.data,U);return y_({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},U)}case"prompt":case"response":{let g=$.data.text||$.data.content||"";return qv(g,U)}case"file":{let g=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=g?`Path: ${g}
34
-
35
- `:"",b=Math.max(0,U-J.length);return`${J}${qv(z,b)}`.trim()}default:return y_($.data,U)}}function Fk($,v){let U=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,g=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((U-g)**2+(_-z)**2)}function Xk($,v){let U=$.position.x+$.size.width,_=$.position.y+$.size.height,g=v.position.x+v.size.width,z=v.position.y+v.size.height,J=Math.max(0,Math.max($.position.x,v.position.x)-Math.min(U,g)),b=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+b**2)}function wk($){let v=[...$],U=100;return v.sort((_,g)=>{let z=Math.floor(_.position.y/100),J=Math.floor(g.position.y/100);if(z!==J)return z-J;return _.position.x-g.position.x}),v}function Ak($){let v=$.find((g)=>g.data.title&&typeof g.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let U={};for(let g of $)U[g.type]=(U[g.type]??0)+1;let _=Object.entries(U).map(([g,z])=>z===1?g:`${z} ${g}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function Zk($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function Mk($,v){let U=v.filter((g)=>Zk($.bounds,{x:g.position.x,y:g.position.y,width:g.size.width,height:g.size.height})),_=U.map((g)=>typeof g.data.title==="string"&&g.data.title.length>0?g.data.title:g.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:U.map((g)=>g.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function Sk($,v=200){if($.length===0)return[];let U=new Map,_=(O)=>{while(U.get(O)!==O){let K=U.get(O);U.set(O,U.get(K)),O=K}return O},g=(O,K)=>{let W=_(O),B=_(K);if(W!==B)U.set(W,B)};for(let O of $)U.set(O.id,O.id);for(let O=0;O<$.length;O++)for(let K=O+1;K<$.length;K++)if(Xk($[O],$[K])<=v)g($[O].id,$[K].id);let z=new Map;for(let O of $){let K=_(O.id);if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=[],b=0;for(let[,O]of z){if(O.length<2)continue;let K=O.map((Y)=>Y.position.x),W=O.map((Y)=>Y.position.y),B=O.map((Y)=>Y.position.x+Y.size.width),k=O.map((Y)=>Y.position.y+Y.size.height),P=Math.min(...K),F=Math.min(...W),I=Math.max(...B),H=Math.max(...k);J.push({id:`cluster-${b++}`,nodeIds:O.map((Y)=>Y.id),label:Ak(O),centroid:{x:Math.round((P+I)/2),y:Math.round((F+H)/2)},bounds:{x:P,y:F,width:I-P,height:H-F}})}return J.sort((O,K)=>{let W=Math.floor(O.centroid.y/200),B=Math.floor(K.centroid.y/200);if(W!==B)return W-B;return O.centroid.x-K.centroid.x}),J}function Qk($,v,U=5,_=600){let g=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return g.map((J)=>{let b=z.map((O)=>({node:O,distance:Fk(J,O)})).filter((O)=>O.distance<=_).sort((O,K)=>O.distance-K.distance).slice(0,U);return{pinnedNodeId:J.id,pinnedNodeTitle:J.data.title??null,neighbors:b.map((O)=>({id:O.node.id,type:O.node.type,title:O.node.data.title??null,distance:Math.round(O.distance)}))}})}function yg($,v,U,_=[]){let g=Sk($),z=new Map;for(let K of g)for(let W of K.nodeIds)z.set(W,K.id);let b=wk($).map((K,W)=>({id:K.id,type:K.type,title:K.data.title??null,content:kK(K,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(K.id)??null,readingOrder:W})),O=Qk($,U);return{totalNodes:$.length,clusters:g,nodesInReadingOrder:b,pinnedNeighborhoods:O,annotations:_.map((K)=>Mk(K,$))}}function Q4($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function D_($,v){return{id:$?.id??v,title:Q4($),nodeType:$?.type??"markdown"}}function HK($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:Q4(v.get($.from)),toTitle:Q4(v.get($.to))}}function R_($){return new Map($.map((v)=>[v.id,v]))}function LK($){return new Map($.map((v)=>[v.id,v]))}function Vv($){return Array.from($).sort((v,U)=>v.localeCompare(U))}function M2($,v){if($.length!==v.length)return!1;for(let U=0;U<$.length;U++)if($[U]!==v[U])return!1;return!0}function S2($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((U)=>typeof U==="string").sort((U,_)=>U.localeCompare(_))}function IK($){let v=new Map;for(let U of $.clusters){let _=[...U.nodeIds].sort((g,z)=>g.localeCompare(z));for(let g of _)v.set(g,_.filter((z)=>z!==g))}return v}function YK($){let v=new Map;for(let U of $.pinnedNeighborhoods)v.set(U.pinnedNodeId,U.neighbors.map((_)=>_.id).sort((_,g)=>_.localeCompare(g)));return v}function Nk($,v){let U=Vv(Array.from(v).filter((g)=>!$.has(g))),_=Vv(Array.from($).filter((g)=>!v.has(g)));return{added:U,removed:_}}function qK($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function rk($,v,U){if(!$||!U)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:U};let _=R_($.nodes),g=Vv(v).filter((O)=>_.has(O)),z=new Set(g),J=new Set,b=[];for(let O of U.pinnedNeighborhoods){if(!z.has(O.pinnedNodeId))continue;let K=Vv([O.pinnedNodeId,...O.neighbors.map((W)=>W.id)]).filter((W,B,k)=>k.indexOf(W)===B&&_.has(W));for(let W of K)if(!z.has(W))J.add(W);b.push({id:`region-${O.pinnedNodeId}`,primaryNodeId:O.pinnedNodeId,nodeIds:K})}if(b.length===0&&g.length>0)for(let O of g)b.push({id:`region-${O}`,primaryNodeId:O,nodeIds:[O]});return{layout:$,pinnedNodeIds:g,primaryFocusNodeIds:g,secondaryFocusNodeIds:Vv(J),regions:b,spatial:U}}class T_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return rk(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let v=$&&typeof $==="object"?$:{},U=Array.isArray(v.nodeIds)?v.nodeIds.filter((K)=>typeof K==="string"):[],_=qK($),g=new Set(U),{added:z,removed:J}=Nk(this.currentPins,g);if(this.currentPins=g,!this.currentLayout)return[];let b=R_(this.currentLayout.nodes),O={added:z.map((K)=>D_(b.get(K),K)),removed:J.map((K)=>D_(b.get(K),K))};if(this.previousSpatial=yg(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),O.added.length===0&&O.removed.length===0)return[];return[{type:"context-pin",..._,...O}]}handleLayoutUpdate($){let v=$&&typeof $==="object"?$:{},U=v.layout&&typeof v.layout==="object"?v.layout:null;if(!U)return[];let _=qK($);if(!this.currentLayout)return this.currentLayout=U,this.previousSpatial=yg(U.nodes,U.edges,this.currentPins,U.annotations??[]),[];let g=this.currentLayout,z=this.previousSpatial??yg(g.nodes,g.edges,this.currentPins,g.annotations??[]),J=yg(U.nodes,U.edges,this.currentPins,U.annotations??[]),b=[],O=R_(g.nodes),K=R_(U.nodes),W=LK(g.edges),B=LK(U.edges),k=Vv(Array.from(B.keys()).filter((Y)=>!W.has(Y))).map((Y)=>B.get(Y)).filter((Y)=>Y!==void 0);if(k.length>0)b.push({type:"connect",..._,edges:k.map((Y)=>HK(Y,K))});let P=Vv(Array.from(O.keys()).filter((Y)=>!K.has(Y))),F=Vv(Array.from(W.keys()).filter((Y)=>!B.has(Y)));if(P.length>0||F.length>0)b.push({type:"remove",..._,nodes:P.map((Y)=>D_(O.get(Y),Y)),edges:F.map((Y)=>W.get(Y)).filter((Y)=>Y!==void 0).map((Y)=>HK(Y,O))});let I=this.buildGroupEvent(O,K,_);if(I)b.push(I);let H=this.buildMoveEndEvent(g,U,O,K,z,J,_);if(H)b.push(H);return this.currentLayout=U,this.previousSpatial=J,b}buildGroupEvent($,v,U){let _=Vv(Array.from($.values()).filter((b)=>b.type==="group").map((b)=>b.id)),g=Vv(Array.from(v.values()).filter((b)=>b.type==="group").map((b)=>b.id)),z=g.filter((b)=>!_.includes(b)).map((b)=>{let O=v.get(b),K=S2(O);return{id:b,title:Q4(O),childCount:K.length}}),J=[];for(let b of g.filter((O)=>_.includes(O))){let O=S2($.get(b)),K=S2(v.get(b));if(M2(O,K))continue;J.push({id:b,title:Q4(v.get(b)),addedChildIds:K.filter((W)=>!O.includes(W)),removedChildIds:O.filter((W)=>!K.includes(W)),childCount:K.length})}if(z.length===0&&J.length===0)return null;return{type:"group",...U,created:z,updated:J}}buildMoveEndEvent($,v,U,_,g,z,J){let b=Vv(Array.from(_.keys()).filter((H)=>{let Y=U.get(H),q=_.get(H);if(!Y||!q)return!1;return Y.position.x!==q.position.x||Y.position.y!==q.position.y}));if(b.length===0)return null;let O=IK(g),K=IK(z),W=YK(g),B=YK(z),k=new Map,P=(H,Y)=>{let q=k.get(H)??new Set;q.add(Y),k.set(H,q)};for(let H of b){let Y=O.get(H)??[],q=K.get(H)??[];if(!M2(Y,q))if(Y.length===0&&q.length>0)P(H,"joined cluster");else if(Y.length>0&&q.length===0)P(H,"left cluster");else P(H,"cluster changed")}let F=new Set([...W.keys(),...B.keys()]);for(let H of F){let Y=W.get(H)??[],q=B.get(H)??[];if(M2(Y,q))continue;let w=Q4(_.get(H)??U.get(H))??H,N=q.filter((p)=>!Y.includes(p)),C=Y.filter((p)=>!q.includes(p));for(let p of N)if(b.includes(p))P(p,`entered pinned neighborhood of "${w}"`);for(let p of C)if(b.includes(p))P(p,`left pinned neighborhood of "${w}"`);if(b.includes(H))P(H,"pinned neighborhood changed")}let I=b.filter((H)=>(k.get(H)?.size??0)>0).map((H)=>{let Y=_.get(H);return{...D_(Y,H),reasons:Array.from(k.get(H)??[]).sort((q,w)=>q.localeCompare(w))}});if(I.length===0)return null;return{type:"move-end",...J,nodes:I}}}var u2=new T_,y2=[],Dg=null,N4=null,Q2="",N2=0;function XK($,v){return globalThis.setTimeout($,v)}function r2($){if($===null)return;globalThis.clearTimeout($)}function uk($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function M6($,v){return $&&$.trim().length>0?$.trim():v}function J6($,v=3){if($.length===0)return"";if($.length<=v)return $.join(", ");return`${$.slice(0,v).join(", ")} +${$.length-v}`}function yk($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function Cv($,v,U,_,g=Date.now()){return{id:`${$}-${g}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:U,nodeIds:yk(_),createdAt:g}}function FK($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let v=/^entered pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved into focus around ${v[1]}`;let U=/^left pinned neighborhood of "(.+)"$/.exec($);if(U)return`moved out of focus around ${U[1]}`;return $}function Dk($){let v=$.added.map((g)=>M6(g.title,g.id)),U=$.removed.map((g)=>M6(g.title,g.id));if(v.length===0&&U.length===0)return null;let _="";if(v.length>0&&U.length===0)_=`Now in focus: ${J6(v)}`;else if(U.length>0&&v.length===0)_=`Removed from focus: ${J6(U)}`;else{let g=[];if(v.length>0)g.push(`${J6(v)} added`);if(U.length>0)g.push(`${J6(U)} removed`);_=g.join(" · ")}return Cv("context","Context updated",_,[...$.added.map((g)=>g.id),...$.removed.map((g)=>g.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function Rk($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return Cv("relationship","Relationship added",`${M6(v.fromTitle,v.fromId)} linked to ${M6(v.toTitle,v.toId)}`,[v.fromId,v.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return Cv("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((v)=>[v.fromId,v.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function Tk($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>M6(_.title,_.id)),U=[];if(v.length>0)U.push(J6(v));if($.edges.length>0)U.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return Cv("remove","Items removed",U.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function jk($){if($.created.length>0){let v=$.created.map((U)=>M6(U.title,U.id));return Cv("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${v[0]} now frames ${$.created[0].childCount} items`:J6(v),$.created.map((U)=>U.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((U)=>M6(U.title,U.id));return Cv("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${v[0]} now holds ${$.updated[0].childCount} items`:J6(v),$.updated.map((U)=>U.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function Vk($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),U=$.nodes.map((z)=>M6(z.title,z.id)),_=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(v.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return Cv("neighborhood","Neighborhood changed",`${U[0]} ${FK($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return Cv("neighborhood","Neighborhood changed",J6(U),$.nodes.map((z)=>z.id),_)}let g=v.filter((z)=>z.includes("cluster"));if(g.length>0){let z=g.every((J)=>J==="joined cluster");if($.nodes.length===1)return Cv("cluster",z?"Cluster formed":"Cluster changed",`${U[0]} ${FK($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return Cv("cluster",z?"Cluster formed":"Cluster changed",J6(U),$.nodes.map((J)=>J.id),_)}return null}function Ck($){switch($.type){case"context-pin":return Dk($);case"connect":return Rk($);case"remove":return Tk($);case"group":return jk($);case"move-end":return Vk($)}}function fk(){let $=u2.getAttentionSnapshot();M3($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function wK(){if(Dg!==null)return;let $=y2.shift()??null;if(!$){P_(null);return}P_($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));Dg=XK(()=>{Dg=null,P_(null),wK()},v)}function AK($){y2.push($),wK()}function r4($,v,U="",_=[]){AK(Cv($,v,U,_))}function ck($){if(r2(N4),N4=null,k_([]),$.length===0)return;uk(()=>{k_($),N4=XK(()=>{N4=null,k_([])},900)})}function mk($){let v=`${$.tone}:${$.title}:${$.detail}`,U=$.createdAt;if(v===Q2&&U-N2<1200)return!0;return Q2=v,N2=U,!1}function ZK(){r2(Dg),r2(N4),Dg=null,N4=null,y2=[],Q2="",N2=0,u2=new T_,Z3()}function D2($){let v=u2.handleMessage($).map((U)=>Ck(U)).filter((U)=>U!==null);fk();for(let U of v){if(mk(U))continue;S3(U),AK(U),ck(U.nodeIds)}}async function j_($,v,U,_){let g=await F_({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...U?{payload:U}:{}});if(g.ok)r4("context",_,"",[$.id]);else r4("remove","AX action failed",g.error??g.code??"Unknown error",[$.id])}var MK={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function Ek($){let v=$.title||$.label||$.key||"Context",U=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",g=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",J=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:v,summary:U,pathDisplay:_,category:g,sourceKind:z,status:J,required:$.required===!0}}function fv($){return typeof $==="string"?$.trim():""}function ik($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function lk($){let v=fv($.title),U=fv($.content),_=ik(fv($.rendered)),g=U||_,z=fv($.path);if(!v&&!g&&!z)return null;return{title:v||"Context",summary:g,path:z}}function hk($){let v=fv($.data.title)||$.id,U=fv($.data.content)||fv($.data.excerpt)||fv($.data.description)||fv($.data.pageTitle)||"",_=fv($.data.path)||fv($.data.url);return{id:$.id,title:v,summary:U,kind:s$[$.type]??$.type,path:_}}function SK($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function xk($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function a6({node:$,expanded:v=!1,pinnedNodes:U=[]}){let _=$.data.cards??[],g=$.data.auxTabs??[],z=U.map(hk),J=z.length>0,b=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,O=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,K=typeof $.data.utilization==="number"?$.data.utilization:null,W=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,B=K!==null?Math.max(0,Math.min(100,Math.round(K*100))):null,k=xk(K??0),P=!J&&_.length===0&&g.length===0?lk($.data):null,F=async(I)=>{let H=typeof I.path==="string"?I.path.trim():"";if(!H)return;await L_(H)};return G("div",{style:{display:"flex",flexDirection:"column",gap:v?"10px":"6px",fontSize:v?"14px":"12px",maxWidth:v?"760px":void 0,margin:v?"0 auto":void 0,width:v?"100%":void 0,padding:v?"8px 0":void 0},children:[G("div",{style:{display:"flex",justifyContent:"flex-end"},children:G("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:MK,onClick:(I)=>{I.stopPropagation(),j_($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O!==null&&O>0&&G("div",{style:{marginBottom:"8px"},children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),G("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:G("div",{style:{height:"100%",width:`${Math.min(100,(K??0)*100)}%`,background:k,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[B,"% — ",SK(b)," / ",SK(O)," tokens",W!==null&&G(a$,{children:[" · ",W," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((I)=>G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:I.title},void 0,!1,void 0,this),I.summary&&G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:I.summary},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:I.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),I.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:I.path},void 0,!1,void 0,this),I.path.startsWith("/")&&G("button",{type:"button",onClick:()=>void L_(I.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this),!J&&_.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",_.length,")"]},void 0,!0,void 0,this),_.map((I)=>{let H=Ek(I);return G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:H.title},void 0,!1,void 0,this),G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:H.summary},void 0,!1,void 0,this),H.pathDisplay&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:H.pathDisplay},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:H.status},void 0,!1,void 0,this),H.category&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.category},void 0,!1,void 0,this),G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.sourceKind},void 0,!1,void 0,this),H.required&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.path&&G("div",{style:{marginTop:"6px"},children:G("button",{type:"button",onClick:()=>void F(I),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},I.key??H.pathDisplay??H.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&g.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:_.length>0?"8px":0},children:["References (",g.length,")"]},void 0,!0,void 0,this),g.map((I)=>G("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[I.url,I.reason&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",I.reason,")"]},void 0,!0,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this),P&&G("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:P.title},void 0,!1,void 0,this),P.summary&&G("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:P.summary},void 0,!1,void 0,this),P.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:P.path},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>void L_(P.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!J&&!P&&_.length===0&&g.length===0&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pk($){let v=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[v]??(v.toUpperCase()||"Text")}function V_({node:$,expanded:v=!1}){let U=$.data.path||$.data.content||"",_=$.data.title||U.split("/").pop()||"File",g=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,[b,O]=o(g??""),[K,W]=o(!g&&!!U),[B,k]=o(null);c(()=>{if(!U)return;if(g!==void 0){O(g),W(!1);return}let Y=!1;return W(!0),k(null),Ng(U).then(({content:q})=>{if(Y)return;if(!q&&q!==""){k("File not found"),W(!1);return}O(q),W(!1);let w=q.split(`
36
- `).length;v$($.id,{fileContent:q,lineCount:w}),Zv($.id,{data:{fileContent:q,lineCount:w}})}).catch(()=>{if(!Y)k("Failed to load file"),W(!1)}),()=>{Y=!0}},[U,g]),c(()=>{if(g!==void 0&&g!==b)O(g)},[g]);let P=S(()=>{if(!U)return;W(!0),k(null),v$($.id,{fileContent:void 0}),Zv($.id,{data:{fileContent:void 0}}),Ng(U).then(({content:Y})=>{O(Y),W(!1);let q=Y.split(`
37
- `).length,w=new Date().toISOString();v$($.id,{fileContent:Y,lineCount:q,updatedAt:w}),Zv($.id,{data:{fileContent:Y,lineCount:q,updatedAt:w}})}).catch(()=>{k("Failed to reload"),W(!1)})},[U,$.id]),F=pk(U),I=b.split(`
38
- `),H=`${String(I.length).length+1}ch`;if(!U)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:v?"13px":"11px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:F},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text-soft)",fontSize:v?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:U,children:U},void 0,!1,void 0,this),J!==void 0&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[J," lines"]},void 0,!0,void 0,this),z&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),G("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(Y)=>{Y.stopPropagation(),j_($,"ax.evidence.add",{kind:"file",title:U.split("/").pop()||U,ref:U},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),G("button",{type:"button",onClick:P,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"8px 0",background:v?"var(--c-panel-soft)":void 0,borderRadius:v?"0 0 8px 8px":void 0},children:[K&&G("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),B&&G("div",{style:{color:"var(--c-danger)",padding:"12px"},children:B},void 0,!1,void 0,this),!K&&!B&&G("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:I.map((Y,q)=>G("div",{style:{display:"flex",minHeight:"1.55em"},children:[G("span",{style:{width:H,minWidth:H,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:q+1},void 0,!1,void 0,this),G("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:Y||`
39
- `},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var ok=new Set(["title","__type","content","strictSize","arrangeLocked"]);function u4({node:$}){let v=$.data,_=(typeof v.content==="string"?v.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),g=Object.entries(v).filter(([z])=>!ok.has(z));if(_.length===0&&g.length===0)return G("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[_.length>0&&G("div",{style:{display:"flex",flexDirection:"column"},children:_.map((z,J)=>G("div",{style:{padding:"3px 0",borderBottom:J<_.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},J,!1,void 0,this))},void 0,!1,void 0,this),g.map(([z,J])=>G("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[G("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(b)=>b.toUpperCase())},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof J==="object"?JSON.stringify(J):String(J??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var R2=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Sv=R2?"⌘":"Ctrl";function C_($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.slice(U,_),J=g.slice(Math.max(0,U-v.length),U),b=g.slice(_,_+v.length);if(J===v&&b===v){let O=g.slice(0,U-v.length)+z+g.slice(_+v.length);hv($,O,U-v.length,_-v.length);return}if(z){let O=g.slice(0,U)+v+z+v+g.slice(_);hv($,O,U+v.length,_+v.length)}else{let O=g.slice(0,U)+v+v+g.slice(_);hv($,O,U+v.length,U+v.length)}}function Rg($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.lastIndexOf(`
40
- `,U-1)+1,J=g.indexOf(`
41
- `,_),b=J===-1?g.length:J,O=g.slice(z,b);if(O.startsWith(v)){let W=g.slice(0,z)+O.slice(v.length)+g.slice(b);hv($,W,Math.max(z,U-v.length),Math.max(z,_-v.length));return}let K=g.slice(0,z)+v+g.slice(z);hv($,K,U+v.length,_+v.length)}function nk($){let{selectionStart:v,selectionEnd:U,value:_}=$,g=_.slice(v,U);if(g){let z=_.slice(0,v)+`[${g}](url)`+_.slice(U),J=v+g.length+3;hv($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(U);hv($,z,v+1,v+5)}}function tk($){let{selectionStart:v,selectionEnd:U,value:_}=$,g=_.slice(v,U),z="```";if(g){let J=_.slice(0,v)+`\`\`\`
42
- ${g}
43
- \`\`\``+_.slice(U);hv($,J,v+3+1,v+3+1+g.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(U);hv($,J,v+3+1,v+3+1)}}function QK($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.lastIndexOf(`
44
- `,U-1)+1,J=g.indexOf(`
45
- `,_),b=J===-1?g.length:J,O=g.slice(z,b).split(`
46
- `),K=U,W=_,B=O.map((P,F)=>{if(v){if(P.startsWith(" ")){if(F===0)K=Math.max(z,K-2);return W-=2,P.slice(2)}else if(P.startsWith("\t")){if(F===0)K=Math.max(z,K-1);return W-=1,P.slice(1)}return P}else{if(F===0)K+=2;return W+=2," "+P}}),k=g.slice(0,z)+B.join(`
47
- `)+g.slice(b);hv($,k,K,W)}function hv($,v,U,_){let g=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(g)g.call($,v);else $.value=v;$.selectionStart=U,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var f_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>C_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>C_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>C_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>C_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:nk},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>Rg($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>Rg($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>Rg($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>Rg($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>Rg($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:tk}];function NK($,v){if(!($.metaKey||$.ctrlKey))return!1;let U=f_.find((_)=>_.shortcut===$.key);if(!U)return!1;return $.preventDefault(),U.action(v),!0}function rK($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),U=getComputedStyle($),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let W of _)v.style[W]=U[W];v.style.position="absolute",v.style.visibility="hidden",v.style.overflow="hidden",v.style.height="auto",v.style.top="0",v.style.left="0";let g=$.value,z=document.createTextNode(g.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=g.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(g.slice($.selectionEnd))),document.body.appendChild(v);let b=J.getBoundingClientRect(),O=v.getBoundingClientRect(),K=$.getBoundingClientRect();return document.body.removeChild(v),{top:K.top+(b.top-O.top)-$.scrollTop,left:K.left+(b.left-O.left)-$.scrollLeft,width:b.width}}var dk=f_.filter(($)=>$.shortcut),ak=f_.filter(($)=>!$.shortcut);function T2({textareaRef:$}){let[v,U]=o(!1),[_,g]=o({top:0,left:0}),z=y(null),J=y(null),b=S(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){U(!1);return}let B=rK(W);if(!B){U(!1);return}let k=380,P=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));g({top:B.top-40,left:P}),U(!0)},[$]);c(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(b,50)},k=()=>{J.current=setTimeout(()=>U(!1),200)},P=(F)=>{if(F.shiftKey||F.key.startsWith("Arrow"))B()};return W.addEventListener("select",B),W.addEventListener("mouseup",B),W.addEventListener("keyup",P),W.addEventListener("blur",k),()=>{if(W.removeEventListener("select",B),W.removeEventListener("mouseup",B),W.removeEventListener("keyup",P),W.removeEventListener("blur",k),J.current)clearTimeout(J.current)}},[$,b]);let O=S((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let K=R2?"⌘":"Ctrl";return G("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[dk.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:`${W.label} (${K}+${W.shortcut.toUpperCase()})`,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this)),G("div",{class:"md-format-divider"},void 0,!1,void 0,this),ak.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:W.label,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this))]},void 0,!0,void 0,this)}var b5=SP(xK(),1);function PH($){for(var v=1;v<arguments.length;v++){var U=arguments[v];for(var _ in U)if(Object.prototype.hasOwnProperty.call(U,_))$[_]=U[_]}return $}function E2($,v){return Array(v+1).join($)}function nK($){return $.replace(/^\n*/,"")}function tK($){var v=$.length;while(v>0&&$[v-1]===`
48
- `)v--;return $.substring(0,v)}function dK($){return tK(nK($))}var kH=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function i2($){return l2($,kH)}var aK=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function sK($){return l2($,aK)}function HH($){return $5($,aK)}var eK=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function LH($){return l2($,eK)}function IH($){return $5($,eK)}function l2($,v){return v.indexOf($.nodeName)>=0}function $5($,v){return $.getElementsByTagName&&v.some(function(U){return $.getElementsByTagName(U).length})}var YH=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function v5($){return YH.reduce(function(v,U){return v.replace(U[0],U[1])},$)}var Gv={};Gv.paragraph={filter:"p",replacement:function($){return`
30
+ ${k}`;if(W)return qv(W,v);return qv(K,v)}function Sk($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let g=Object.keys($).sort();return g.length>0?`Input keys: ${g.join(", ")}`:""}function Nk($,v){let g=[],_=typeof $.title==="string"?$.title:"",U=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",J=typeof $.serverName==="string"?$.serverName:"",b=typeof $.toolName==="string"?$.toolName:"",O=typeof $.resourceUri==="string"?$.resourceUri:"",K=typeof $.path==="string"?$.path:"",W=typeof $.url==="string"?$.url:"",B=typeof $.sessionStatus==="string"?$.sessionStatus:"",k=Sk($.toolInput);if(_)g.push(`App: ${_}`);if(U||z)g.push(`Mode: ${[U,z].filter(Boolean).join(" / ")}`);if(J||b)g.push(`Source: ${[J,b].filter(Boolean).join(" / ")}`);if(O)g.push(`Resource: ${O}`);if(K)g.push(`Path: ${K}`);if(W)g.push(`URL: ${W}`);if(B)g.push(`Session: ${B}`);if(k)g.push(k);if(g.length===0)return"MCP App node";return qv(g.join(`
31
+ `),v)}function rk($,v){let g=[],_=typeof $.content==="string"?$.content:"",U=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",J=typeof $.url==="string"?$.url:"",b=typeof $.projectPath==="string"?$.projectPath:"",O=typeof $.artifactBytes==="number"?$.artifactBytes:null,K=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,W=Array.isArray($.sourceFiles)?$.sourceFiles.filter((k)=>typeof k==="string"):[],B=Array.isArray($.deps)?$.deps.filter((k)=>typeof k==="string"):[];if(_)g.push(_);if(!_&&U)g.push(`Web artifact: ${U}`);if(W.length>0&&!_.includes("Source files:")){let k=K!==null?Math.max(0,K-W.length):0;g.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(O!==null&&!_.includes("Artifact bytes:"))g.push(`Artifact bytes: ${O}`);if(B.length>0&&!_.includes("Dependencies:"))g.push(`Dependencies: ${B.join(", ")}`);if(z)g.push(`Path: ${z}`);if(b)g.push(`Project: ${b}`);if(J)g.push(`URL: ${J}`);return g.length>0?qv(g.join(`
32
+ `),v):"Web artifact node"}function uk($,v){let g=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",U=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)g.push(`HTML primitive: ${_}`);if(U)g.push(U);if(z!==void 0)g.push(`Data: ${f_(z,v)}`);return qv(g.join(`
33
+ `),v)}function FK($,v={}){let g=v.defaultTextLength??Ak,_=v.webpageTextLength??Zk;switch($.type){case"markdown":{let U=$.data.rendered||$.data.content||"";return qv(U,g)}case"mcp-app":{if($.data.viewerType==="web-artifact")return rk($.data,g);let U=$.data.chartConfig;if(U){let z=U.title||"Untitled chart",J=U.type||"unknown",b=Array.isArray(U.labels)?U.labels.join(", "):"";return qv(`Chart: ${z} (${J}). Labels: ${b}`,g)}return Nk($.data,g)}case"webpage":return Qk($.data,_);case"json-render":case"graph":{let U=$.data.graphConfig;if(U)return qv(`Graph: ${JSON.stringify(U)}`,g);return f_($.data.spec??{},g)}case"html":{if(typeof $.data.agentSummary==="string")return qv($.data.agentSummary,g);if(typeof $.data.htmlPrimitive==="string")return uk($.data,g);return f_({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},g)}case"prompt":case"response":{let U=$.data.text||$.data.content||"";return qv(U,g)}case"file":{let U=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=U?`Path: ${U}
34
+
35
+ `:"",b=Math.max(0,g-J.length);return`${J}${qv(z,b)}`.trim()}default:return f_($.data,g)}}function yk($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((g-U)**2+(_-z)**2)}function Dk($,v){let g=$.position.x+$.size.width,_=$.position.y+$.size.height,U=v.position.x+v.size.width,z=v.position.y+v.size.height,J=Math.max(0,Math.max($.position.x,v.position.x)-Math.min(g,U)),b=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+b**2)}function Rk($){let v=[...$],g=100;return v.sort((_,U)=>{let z=Math.floor(_.position.y/100),J=Math.floor(U.position.y/100);if(z!==J)return z-J;return _.position.x-U.position.x}),v}function Tk($){let v=$.find((U)=>U.data.title&&typeof U.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let g={};for(let U of $)g[U.type]=(g[U.type]??0)+1;let _=Object.entries(g).map(([U,z])=>z===1?U:`${z} ${U}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function jk($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function Vk($,v){let g=v.filter((U)=>jk($.bounds,{x:U.position.x,y:U.position.y,width:U.size.width,height:U.size.height})),_=g.map((U)=>typeof U.data.title==="string"&&U.data.title.length>0?U.data.title:U.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:g.map((U)=>U.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function Ck($,v=200){if($.length===0)return[];let g=new Map,_=(O)=>{while(g.get(O)!==O){let K=g.get(O);g.set(O,g.get(K)),O=K}return O},U=(O,K)=>{let W=_(O),B=_(K);if(W!==B)g.set(W,B)};for(let O of $)g.set(O.id,O.id);for(let O=0;O<$.length;O++)for(let K=O+1;K<$.length;K++)if(Dk($[O],$[K])<=v)U($[O].id,$[K].id);let z=new Map;for(let O of $){let K=_(O.id);if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=[],b=0;for(let[,O]of z){if(O.length<2)continue;let K=O.map((L)=>L.position.x),W=O.map((L)=>L.position.y),B=O.map((L)=>L.position.x+L.size.width),k=O.map((L)=>L.position.y+L.size.height),P=Math.min(...K),X=Math.min(...W),Y=Math.max(...B),H=Math.max(...k);J.push({id:`cluster-${b++}`,nodeIds:O.map((L)=>L.id),label:Tk(O),centroid:{x:Math.round((P+Y)/2),y:Math.round((X+H)/2)},bounds:{x:P,y:X,width:Y-P,height:H-X}})}return J.sort((O,K)=>{let W=Math.floor(O.centroid.y/200),B=Math.floor(K.centroid.y/200);if(W!==B)return W-B;return O.centroid.x-K.centroid.x}),J}function fk($,v,g=5,_=600){let U=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return U.map((J)=>{let b=z.map((O)=>({node:O,distance:yk(J,O)})).filter((O)=>O.distance<=_).sort((O,K)=>O.distance-K.distance).slice(0,g);return{pinnedNodeId:J.id,pinnedNodeTitle:J.data.title??null,neighbors:b.map((O)=>({id:O.node.id,type:O.node.type,title:O.node.data.title??null,distance:Math.round(O.distance)}))}})}function CU($,v,g,_=[]){let U=Ck($),z=new Map;for(let K of U)for(let W of K.nodeIds)z.set(W,K.id);let b=Rk($).map((K,W)=>({id:K.id,type:K.type,title:K.data.title??null,content:FK(K,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(K.id)??null,readingOrder:W})),O=fk($,g);return{totalNodes:$.length,clusters:U,nodesInReadingOrder:b,pinnedNeighborhoods:O,annotations:_.map((K)=>Vk(K,$))}}function y4($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function m_($,v){return{id:$?.id??v,title:y4($),nodeType:$?.type??"markdown"}}function AK($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:y4(v.get($.from)),toTitle:y4(v.get($.to))}}function c_($){return new Map($.map((v)=>[v.id,v]))}function ZK($){return new Map($.map((v)=>[v.id,v]))}function Vv($){return Array.from($).sort((v,g)=>v.localeCompare(g))}function R2($,v){if($.length!==v.length)return!1;for(let g=0;g<$.length;g++)if($[g]!==v[g])return!1;return!0}function T2($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((g)=>typeof g==="string").sort((g,_)=>g.localeCompare(_))}function MK($){let v=new Map;for(let g of $.clusters){let _=[...g.nodeIds].sort((U,z)=>U.localeCompare(z));for(let U of _)v.set(U,_.filter((z)=>z!==U))}return v}function QK($){let v=new Map;for(let g of $.pinnedNeighborhoods)v.set(g.pinnedNodeId,g.neighbors.map((_)=>_.id).sort((_,U)=>_.localeCompare(U)));return v}function mk($,v){let g=Vv(Array.from(v).filter((U)=>!$.has(U))),_=Vv(Array.from($).filter((U)=>!v.has(U)));return{added:g,removed:_}}function SK($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function ck($,v,g){if(!$||!g)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:g};let _=c_($.nodes),U=Vv(v).filter((O)=>_.has(O)),z=new Set(U),J=new Set,b=[];for(let O of g.pinnedNeighborhoods){if(!z.has(O.pinnedNodeId))continue;let K=Vv([O.pinnedNodeId,...O.neighbors.map((W)=>W.id)]).filter((W,B,k)=>k.indexOf(W)===B&&_.has(W));for(let W of K)if(!z.has(W))J.add(W);b.push({id:`region-${O.pinnedNodeId}`,primaryNodeId:O.pinnedNodeId,nodeIds:K})}if(b.length===0&&U.length>0)for(let O of U)b.push({id:`region-${O}`,primaryNodeId:O,nodeIds:[O]});return{layout:$,pinnedNodeIds:U,primaryFocusNodeIds:U,secondaryFocusNodeIds:Vv(J),regions:b,spatial:g}}class E_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return ck(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let v=$&&typeof $==="object"?$:{},g=Array.isArray(v.nodeIds)?v.nodeIds.filter((K)=>typeof K==="string"):[],_=SK($),U=new Set(g),{added:z,removed:J}=mk(this.currentPins,U);if(this.currentPins=U,!this.currentLayout)return[];let b=c_(this.currentLayout.nodes),O={added:z.map((K)=>m_(b.get(K),K)),removed:J.map((K)=>m_(b.get(K),K))};if(this.previousSpatial=CU(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),O.added.length===0&&O.removed.length===0)return[];return[{type:"context-pin",..._,...O}]}handleLayoutUpdate($){let v=$&&typeof $==="object"?$:{},g=v.layout&&typeof v.layout==="object"?v.layout:null;if(!g)return[];let _=SK($);if(!this.currentLayout)return this.currentLayout=g,this.previousSpatial=CU(g.nodes,g.edges,this.currentPins,g.annotations??[]),[];let U=this.currentLayout,z=this.previousSpatial??CU(U.nodes,U.edges,this.currentPins,U.annotations??[]),J=CU(g.nodes,g.edges,this.currentPins,g.annotations??[]),b=[],O=c_(U.nodes),K=c_(g.nodes),W=ZK(U.edges),B=ZK(g.edges),k=Vv(Array.from(B.keys()).filter((L)=>!W.has(L))).map((L)=>B.get(L)).filter((L)=>L!==void 0);if(k.length>0)b.push({type:"connect",..._,edges:k.map((L)=>AK(L,K))});let P=Vv(Array.from(O.keys()).filter((L)=>!K.has(L))),X=Vv(Array.from(W.keys()).filter((L)=>!B.has(L)));if(P.length>0||X.length>0)b.push({type:"remove",..._,nodes:P.map((L)=>m_(O.get(L),L)),edges:X.map((L)=>W.get(L)).filter((L)=>L!==void 0).map((L)=>AK(L,O))});let Y=this.buildGroupEvent(O,K,_);if(Y)b.push(Y);let H=this.buildMoveEndEvent(U,g,O,K,z,J,_);if(H)b.push(H);return this.currentLayout=g,this.previousSpatial=J,b}buildGroupEvent($,v,g){let _=Vv(Array.from($.values()).filter((b)=>b.type==="group").map((b)=>b.id)),U=Vv(Array.from(v.values()).filter((b)=>b.type==="group").map((b)=>b.id)),z=U.filter((b)=>!_.includes(b)).map((b)=>{let O=v.get(b),K=T2(O);return{id:b,title:y4(O),childCount:K.length}}),J=[];for(let b of U.filter((O)=>_.includes(O))){let O=T2($.get(b)),K=T2(v.get(b));if(R2(O,K))continue;J.push({id:b,title:y4(v.get(b)),addedChildIds:K.filter((W)=>!O.includes(W)),removedChildIds:O.filter((W)=>!K.includes(W)),childCount:K.length})}if(z.length===0&&J.length===0)return null;return{type:"group",...g,created:z,updated:J}}buildMoveEndEvent($,v,g,_,U,z,J){let b=Vv(Array.from(_.keys()).filter((H)=>{let L=g.get(H),q=_.get(H);if(!L||!q)return!1;return L.position.x!==q.position.x||L.position.y!==q.position.y}));if(b.length===0)return null;let O=MK(U),K=MK(z),W=QK(U),B=QK(z),k=new Map,P=(H,L)=>{let q=k.get(H)??new Set;q.add(L),k.set(H,q)};for(let H of b){let L=O.get(H)??[],q=K.get(H)??[];if(!R2(L,q))if(L.length===0&&q.length>0)P(H,"joined cluster");else if(L.length>0&&q.length===0)P(H,"left cluster");else P(H,"cluster changed")}let X=new Set([...W.keys(),...B.keys()]);for(let H of X){let L=W.get(H)??[],q=B.get(H)??[];if(R2(L,q))continue;let F=y4(_.get(H)??g.get(H))??H,N=q.filter((p)=>!L.includes(p)),C=L.filter((p)=>!q.includes(p));for(let p of N)if(b.includes(p))P(p,`entered pinned neighborhood of "${F}"`);for(let p of C)if(b.includes(p))P(p,`left pinned neighborhood of "${F}"`);if(b.includes(H))P(H,"pinned neighborhood changed")}let Y=b.filter((H)=>(k.get(H)?.size??0)>0).map((H)=>{let L=_.get(H);return{...m_(L,H),reasons:Array.from(k.get(H)??[]).sort((q,F)=>q.localeCompare(F))}});if(Y.length===0)return null;return{type:"move-end",...J,nodes:Y}}}var f2=new E_,m2=[],fU=null,D4=null,j2="",V2=0;function rK($,v){return globalThis.setTimeout($,v)}function C2($){if($===null)return;globalThis.clearTimeout($)}function Ek($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function S6($,v){return $&&$.trim().length>0?$.trim():v}function J6($,v=3){if($.length===0)return"";if($.length<=v)return $.join(", ");return`${$.slice(0,v).join(", ")} +${$.length-v}`}function ik($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function Cv($,v,g,_,U=Date.now()){return{id:`${$}-${U}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:g,nodeIds:ik(_),createdAt:U}}function NK($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let v=/^entered pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved into focus around ${v[1]}`;let g=/^left pinned neighborhood of "(.+)"$/.exec($);if(g)return`moved out of focus around ${g[1]}`;return $}function lk($){let v=$.added.map((U)=>S6(U.title,U.id)),g=$.removed.map((U)=>S6(U.title,U.id));if(v.length===0&&g.length===0)return null;let _="";if(v.length>0&&g.length===0)_=`Now in focus: ${J6(v)}`;else if(g.length>0&&v.length===0)_=`Removed from focus: ${J6(g)}`;else{let U=[];if(v.length>0)U.push(`${J6(v)} added`);if(g.length>0)U.push(`${J6(g)} removed`);_=U.join(" · ")}return Cv("context","Context updated",_,[...$.added.map((U)=>U.id),...$.removed.map((U)=>U.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function xk($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return Cv("relationship","Relationship added",`${S6(v.fromTitle,v.fromId)} linked to ${S6(v.toTitle,v.toId)}`,[v.fromId,v.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return Cv("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((v)=>[v.fromId,v.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function hk($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>S6(_.title,_.id)),g=[];if(v.length>0)g.push(J6(v));if($.edges.length>0)g.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return Cv("remove","Items removed",g.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function pk($){if($.created.length>0){let v=$.created.map((g)=>S6(g.title,g.id));return Cv("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${v[0]} now frames ${$.created[0].childCount} items`:J6(v),$.created.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((g)=>S6(g.title,g.id));return Cv("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${v[0]} now holds ${$.updated[0].childCount} items`:J6(v),$.updated.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function ok($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),g=$.nodes.map((z)=>S6(z.title,z.id)),_=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(v.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return Cv("neighborhood","Neighborhood changed",`${g[0]} ${NK($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return Cv("neighborhood","Neighborhood changed",J6(g),$.nodes.map((z)=>z.id),_)}let U=v.filter((z)=>z.includes("cluster"));if(U.length>0){let z=U.every((J)=>J==="joined cluster");if($.nodes.length===1)return Cv("cluster",z?"Cluster formed":"Cluster changed",`${g[0]} ${NK($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return Cv("cluster",z?"Cluster formed":"Cluster changed",J6(g),$.nodes.map((J)=>J.id),_)}return null}function nk($){switch($.type){case"context-pin":return lk($);case"connect":return xk($);case"remove":return hk($);case"group":return pk($);case"move-end":return ok($)}}function tk(){let $=f2.getAttentionSnapshot();TO($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function uK(){if(fU!==null)return;let $=m2.shift()??null;if(!$){X_(null);return}X_($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));fU=rK(()=>{fU=null,X_(null),uK()},v)}function yK($){m2.push($),uK()}function R4($,v,g="",_=[]){yK(Cv($,v,g,_))}function dk($){if(C2(D4),D4=null,w_([]),$.length===0)return;Ek(()=>{w_($),D4=rK(()=>{D4=null,w_([])},900)})}function ak($){let v=`${$.tone}:${$.title}:${$.detail}`,g=$.createdAt;if(v===j2&&g-V2<1200)return!0;return j2=v,V2=g,!1}function c2(){C2(fU),C2(D4),fU=null,D4=null,m2=[],j2="",V2=0,f2=new E_,RO()}function E2($){let v=f2.handleMessage($).map((g)=>nk(g)).filter((g)=>g!==null);tk();for(let g of v){if(ak(g))continue;jO(g),yK(g),dk(g.nodeIds)}}async function i_($,v,g,_){let U=await S_({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...g?{payload:g}:{}});if(U.ok)R4("context",_,"",[$.id]);else R4("remove","AX action failed",U.error??U.code??"Unknown error",[$.id])}var DK={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function sk($){let v=$.title||$.label||$.key||"Context",g=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",U=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",J=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:v,summary:g,pathDisplay:_,category:U,sourceKind:z,status:J,required:$.required===!0}}function fv($){return typeof $==="string"?$.trim():""}function ek($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function $H($){let v=fv($.title),g=fv($.content),_=ek(fv($.rendered)),U=g||_,z=fv($.path);if(!v&&!U&&!z)return null;return{title:v||"Context",summary:U,path:z}}function vH($){let v=fv($.data.title)||$.id,g=fv($.data.content)||fv($.data.excerpt)||fv($.data.description)||fv($.data.pageTitle)||"",_=fv($.data.path)||fv($.data.url);return{id:$.id,title:v,summary:g,kind:s$[$.type]??$.type,path:_}}function RK($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function UH($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function U4({node:$,expanded:v=!1,pinnedNodes:g=[]}){let _=$.data.cards??[],U=$.data.auxTabs??[],z=g.map(vH),J=z.length>0,b=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,O=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,K=typeof $.data.utilization==="number"?$.data.utilization:null,W=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,B=K!==null?Math.max(0,Math.min(100,Math.round(K*100))):null,k=UH(K??0),P=!J&&_.length===0&&U.length===0?$H($.data):null,X=async(Y)=>{let H=typeof Y.path==="string"?Y.path.trim():"";if(!H)return;await A_(H)};return G("div",{style:{display:"flex",flexDirection:"column",gap:v?"10px":"6px",fontSize:v?"14px":"12px",maxWidth:v?"760px":void 0,margin:v?"0 auto":void 0,width:v?"100%":void 0,padding:v?"8px 0":void 0},children:[G("div",{style:{display:"flex",justifyContent:"flex-end"},children:G("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:DK,onClick:(Y)=>{Y.stopPropagation(),i_($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O!==null&&O>0&&G("div",{style:{marginBottom:"8px"},children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),G("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:G("div",{style:{height:"100%",width:`${Math.min(100,(K??0)*100)}%`,background:k,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[B,"% — ",RK(b)," / ",RK(O)," tokens",W!==null&&G(a$,{children:[" · ",W," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((Y)=>G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:Y.title},void 0,!1,void 0,this),Y.summary&&G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:Y.summary},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:Y.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:Y.path},void 0,!1,void 0,this),Y.path.startsWith("/")&&G("button",{type:"button",onClick:()=>void A_(Y.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this),!J&&_.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",_.length,")"]},void 0,!0,void 0,this),_.map((Y)=>{let H=sk(Y);return G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:H.title},void 0,!1,void 0,this),G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:H.summary},void 0,!1,void 0,this),H.pathDisplay&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:H.pathDisplay},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:H.status},void 0,!1,void 0,this),H.category&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.category},void 0,!1,void 0,this),G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.sourceKind},void 0,!1,void 0,this),H.required&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.path&&G("div",{style:{marginTop:"6px"},children:G("button",{type:"button",onClick:()=>void X(Y),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Y.key??H.pathDisplay??H.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&U.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:_.length>0?"8px":0},children:["References (",U.length,")"]},void 0,!0,void 0,this),U.map((Y)=>G("a",{href:Y.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[Y.url,Y.reason&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",Y.reason,")"]},void 0,!0,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this),P&&G("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:P.title},void 0,!1,void 0,this),P.summary&&G("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:P.summary},void 0,!1,void 0,this),P.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:P.path},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>void A_(P.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!J&&!P&&_.length===0&&U.length===0&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gH($){let v=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[v]??(v.toUpperCase()||"Text")}function l_({node:$,expanded:v=!1}){let g=$.data.path||$.data.content||"",_=$.data.title||g.split("/").pop()||"File",U=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,[b,O]=o(U??""),[K,W]=o(!U&&!!g),[B,k]=o(null);m(()=>{if(!g)return;if(U!==void 0){O(U),W(!1);return}let L=!1;return W(!0),k(null),TU(g).then(({content:q})=>{if(L)return;if(!q&&q!==""){k("File not found"),W(!1);return}O(q),W(!1);let F=q.split(`
36
+ `).length;v$($.id,{fileContent:q,lineCount:F}),Zv($.id,{data:{fileContent:q,lineCount:F}})}).catch(()=>{if(!L)k("Failed to load file"),W(!1)}),()=>{L=!0}},[g,U]),m(()=>{if(U!==void 0&&U!==b)O(U)},[U]);let P=Q(()=>{if(!g)return;W(!0),k(null),v$($.id,{fileContent:void 0}),Zv($.id,{data:{fileContent:void 0}}),TU(g).then(({content:L})=>{O(L),W(!1);let q=L.split(`
37
+ `).length,F=new Date().toISOString();v$($.id,{fileContent:L,lineCount:q,updatedAt:F}),Zv($.id,{data:{fileContent:L,lineCount:q,updatedAt:F}})}).catch(()=>{k("Failed to reload"),W(!1)})},[g,$.id]),X=gH(g),Y=b.split(`
38
+ `),H=`${String(Y.length).length+1}ch`;if(!g)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:v?"13px":"11px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:X},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text-soft)",fontSize:v?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:g,children:g},void 0,!1,void 0,this),J!==void 0&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[J," lines"]},void 0,!0,void 0,this),z&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),G("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(L)=>{L.stopPropagation(),i_($,"ax.evidence.add",{kind:"file",title:g.split("/").pop()||g,ref:g},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),G("button",{type:"button",onClick:P,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"8px 0",background:v?"var(--c-panel-soft)":void 0,borderRadius:v?"0 0 8px 8px":void 0},children:[K&&G("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),B&&G("div",{style:{color:"var(--c-danger)",padding:"12px"},children:B},void 0,!1,void 0,this),!K&&!B&&G("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:Y.map((L,q)=>G("div",{style:{display:"flex",minHeight:"1.55em"},children:[G("span",{style:{width:H,minWidth:H,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:q+1},void 0,!1,void 0,this),G("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:L||`
39
+ `},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var _H=new Set(["title","__type","content","strictSize","arrangeLocked"]);function T4({node:$}){let v=$.data,_=(typeof v.content==="string"?v.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),U=Object.entries(v).filter(([z])=>!_H.has(z));if(_.length===0&&U.length===0)return G("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[_.length>0&&G("div",{style:{display:"flex",flexDirection:"column"},children:_.map((z,J)=>G("div",{style:{padding:"3px 0",borderBottom:J<_.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},J,!1,void 0,this))},void 0,!1,void 0,this),U.map(([z,J])=>G("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[G("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(b)=>b.toUpperCase())},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof J==="object"?JSON.stringify(J):String(J??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var i2=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qv=i2?"⌘":"Ctrl";function x_($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.slice(g,_),J=U.slice(Math.max(0,g-v.length),g),b=U.slice(_,_+v.length);if(J===v&&b===v){let O=U.slice(0,g-v.length)+z+U.slice(_+v.length);hv($,O,g-v.length,_-v.length);return}if(z){let O=U.slice(0,g)+v+z+v+U.slice(_);hv($,O,g+v.length,_+v.length)}else{let O=U.slice(0,g)+v+v+U.slice(_);hv($,O,g+v.length,g+v.length)}}function mU($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
40
+ `,g-1)+1,J=U.indexOf(`
41
+ `,_),b=J===-1?U.length:J,O=U.slice(z,b);if(O.startsWith(v)){let W=U.slice(0,z)+O.slice(v.length)+U.slice(b);hv($,W,Math.max(z,g-v.length),Math.max(z,_-v.length));return}let K=U.slice(0,z)+v+U.slice(z);hv($,K,g+v.length,_+v.length)}function zH($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g);if(U){let z=_.slice(0,v)+`[${U}](url)`+_.slice(g),J=v+U.length+3;hv($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(g);hv($,z,v+1,v+5)}}function JH($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g),z="```";if(U){let J=_.slice(0,v)+`\`\`\`
42
+ ${U}
43
+ \`\`\``+_.slice(g);hv($,J,v+3+1,v+3+1+U.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(g);hv($,J,v+3+1,v+3+1)}}function TK($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
44
+ `,g-1)+1,J=U.indexOf(`
45
+ `,_),b=J===-1?U.length:J,O=U.slice(z,b).split(`
46
+ `),K=g,W=_,B=O.map((P,X)=>{if(v){if(P.startsWith(" ")){if(X===0)K=Math.max(z,K-2);return W-=2,P.slice(2)}else if(P.startsWith("\t")){if(X===0)K=Math.max(z,K-1);return W-=1,P.slice(1)}return P}else{if(X===0)K+=2;return W+=2," "+P}}),k=U.slice(0,z)+B.join(`
47
+ `)+U.slice(b);hv($,k,K,W)}function hv($,v,g,_){let U=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(U)U.call($,v);else $.value=v;$.selectionStart=g,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var h_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>x_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>x_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>x_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>x_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:zH},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>mU($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>mU($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>mU($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>mU($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>mU($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:JH}];function jK($,v){if(!($.metaKey||$.ctrlKey))return!1;let g=h_.find((_)=>_.shortcut===$.key);if(!g)return!1;return $.preventDefault(),g.action(v),!0}function VK($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),g=getComputedStyle($),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let W of _)v.style[W]=g[W];v.style.position="absolute",v.style.visibility="hidden",v.style.overflow="hidden",v.style.height="auto",v.style.top="0",v.style.left="0";let U=$.value,z=document.createTextNode(U.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=U.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(U.slice($.selectionEnd))),document.body.appendChild(v);let b=J.getBoundingClientRect(),O=v.getBoundingClientRect(),K=$.getBoundingClientRect();return document.body.removeChild(v),{top:K.top+(b.top-O.top)-$.scrollTop,left:K.left+(b.left-O.left)-$.scrollLeft,width:b.width}}var bH=h_.filter(($)=>$.shortcut),GH=h_.filter(($)=>!$.shortcut);function l2({textareaRef:$}){let[v,g]=o(!1),[_,U]=o({top:0,left:0}),z=y(null),J=y(null),b=Q(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){g(!1);return}let B=VK(W);if(!B){g(!1);return}let k=380,P=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));U({top:B.top-40,left:P}),g(!0)},[$]);m(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(b,50)},k=()=>{J.current=setTimeout(()=>g(!1),200)},P=(X)=>{if(X.shiftKey||X.key.startsWith("Arrow"))B()};return W.addEventListener("select",B),W.addEventListener("mouseup",B),W.addEventListener("keyup",P),W.addEventListener("blur",k),()=>{if(W.removeEventListener("select",B),W.removeEventListener("mouseup",B),W.removeEventListener("keyup",P),W.removeEventListener("blur",k),J.current)clearTimeout(J.current)}},[$,b]);let O=Q((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let K=i2?"⌘":"Ctrl";return G("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[bH.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:`${W.label} (${K}+${W.shortcut.toUpperCase()})`,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this)),G("div",{class:"md-format-divider"},void 0,!1,void 0,this),GH.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:W.label,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this))]},void 0,!0,void 0,this)}var k5=CP(sK(),1);function ZH($){for(var v=1;v<arguments.length;v++){var g=arguments[v];for(var _ in g)if(Object.prototype.hasOwnProperty.call(g,_))$[_]=g[_]}return $}function d2($,v){return Array(v+1).join($)}function v5($){return $.replace(/^\n*/,"")}function U5($){var v=$.length;while(v>0&&$[v-1]===`
48
+ `)v--;return $.substring(0,v)}function g5($){return U5(v5($))}var MH=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function a2($){return s2($,MH)}var _5=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function z5($){return s2($,_5)}function QH($){return b5($,_5)}var J5=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function SH($){return s2($,J5)}function NH($){return b5($,J5)}function s2($,v){return v.indexOf($.nodeName)>=0}function b5($,v){return $.getElementsByTagName&&v.some(function(g){return $.getElementsByTagName(g).length})}var rH=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function G5($){return rH.reduce(function(v,g){return v.replace(g[0],g[1])},$)}var Gv={};Gv.paragraph={filter:"p",replacement:function($){return`
49
49
 
50
50
  `+$+`
51
51
 
52
- `}};Gv.lineBreak={filter:"br",replacement:function($,v,U){return U.br+`
53
- `}};Gv.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,U){var _=Number(v.nodeName.charAt(1));if(U.headingStyle==="setext"&&_<3){var g=E2(_===1?"=":"-",$.length);return`
52
+ `}};Gv.lineBreak={filter:"br",replacement:function($,v,g){return g.br+`
53
+ `}};Gv.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,g){var _=Number(v.nodeName.charAt(1));if(g.headingStyle==="setext"&&_<3){var U=d2(_===1?"=":"-",$.length);return`
54
54
 
55
55
  `+$+`
56
- `+g+`
56
+ `+U+`
57
57
 
58
58
  `}else return`
59
59
 
60
- `+E2("#",_)+" "+$+`
60
+ `+d2("#",_)+" "+$+`
61
61
 
62
- `}};Gv.blockquote={filter:"blockquote",replacement:function($){return $=dK($).replace(/^/gm,"> "),`
62
+ `}};Gv.blockquote={filter:"blockquote",replacement:function($){return $=g5($).replace(/^/gm,"> "),`
63
63
 
64
64
  `+$+`
65
65
 
66
- `}};Gv.list={filter:["ul","ol"],replacement:function($,v){var U=v.parentNode;if(U.nodeName==="LI"&&U.lastElementChild===v)return`
66
+ `}};Gv.list={filter:["ul","ol"],replacement:function($,v){var g=v.parentNode;if(g.nodeName==="LI"&&g.lastElementChild===v)return`
67
67
  `+$;else return`
68
68
 
69
69
  `+$+`
70
70
 
71
- `}};Gv.listItem={filter:"li",replacement:function($,v,U){var _=U.bulletListMarker+" ",g=v.parentNode;if(g.nodeName==="OL"){var z=g.getAttribute("start"),J=Array.prototype.indexOf.call(g.children,v);_=(z?Number(z)+J:J+1)+". "}var b=/\n$/.test($);return $=dK($)+(b?`
71
+ `}};Gv.listItem={filter:"li",replacement:function($,v,g){var _=g.bulletListMarker+" ",U=v.parentNode;if(U.nodeName==="OL"){var z=U.getAttribute("start"),J=Array.prototype.indexOf.call(U.children,v);_=(z?Number(z)+J:J+1)+". "}var b=/\n$/.test($);return $=g5($)+(b?`
72
72
  `:""),$=$.replace(/\n/gm,`
73
73
  `+" ".repeat(_.length)),_+$+(v.nextSibling?`
74
- `:"")}};Gv.indentedCodeBlock={filter:function($,v){return v.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,U){return`
74
+ `:"")}};Gv.indentedCodeBlock={filter:function($,v){return v.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){return`
75
75
 
76
76
  `+v.firstChild.textContent.replace(/\n/g,`
77
77
  `)+`
78
78
 
79
- `}};Gv.fencedCodeBlock={filter:function($,v){return v.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,U){var _=v.firstChild.getAttribute("class")||"",g=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=U.fence.charAt(0),b=3,O=new RegExp("^"+J+"{3,}","gm"),K;while(K=O.exec(z))if(K[0].length>=b)b=K[0].length+1;var W=E2(J,b);return`
79
+ `}};Gv.fencedCodeBlock={filter:function($,v){return v.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){var _=v.firstChild.getAttribute("class")||"",U=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=g.fence.charAt(0),b=3,O=new RegExp("^"+J+"{3,}","gm"),K;while(K=O.exec(z))if(K[0].length>=b)b=K[0].length+1;var W=d2(J,b);return`
80
80
 
81
- `+W+g+`
81
+ `+W+U+`
82
82
  `+z.replace(/\n$/,"")+`
83
83
  `+W+`
84
84
 
85
- `}};Gv.horizontalRule={filter:"hr",replacement:function($,v,U){return`
85
+ `}};Gv.horizontalRule={filter:"hr",replacement:function($,v,g){return`
86
86
 
87
- `+U.hr+`
87
+ `+g.hr+`
88
88
 
89
- `}};Gv.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var U=h2(v.getAttribute("href")),_=x2(c_(v.getAttribute("title"))),g=_?' "'+_+'"':"";return"["+$+"]("+U+g+")"}};Gv.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,U){var _=h2(v.getAttribute("href")),g=c_(v.getAttribute("title"));if(g)g=' "'+x2(g)+'"';var z,J;switch(U.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+g;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+g;break;default:var b=this.references.length+1;z="["+$+"]["+b+"]",J="["+b+"]: "+_+g}return this.references.push(J),z},references:[],append:function($){var v="";if(this.references.length)v=`
89
+ `}};Gv.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var g=e2(v.getAttribute("href")),_=$z(p_(v.getAttribute("title"))),U=_?' "'+_+'"':"";return"["+$+"]("+g+U+")"}};Gv.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,g){var _=e2(v.getAttribute("href")),U=p_(v.getAttribute("title"));if(U)U=' "'+$z(U)+'"';var z,J;switch(g.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+U;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+U;break;default:var b=this.references.length+1;z="["+$+"]["+b+"]",J="["+b+"]: "+_+U}return this.references.push(J),z},references:[],append:function($){var v="";if(this.references.length)v=`
90
90
 
91
91
  `+this.references.join(`
92
92
  `)+`
93
93
 
94
- `,this.references=[];return v}};Gv.emphasis={filter:["em","i"],replacement:function($,v,U){if(!$.trim())return"";return U.emDelimiter+$+U.emDelimiter}};Gv.strong={filter:["strong","b"],replacement:function($,v,U){if(!$.trim())return"";return U.strongDelimiter+$+U.strongDelimiter}};Gv.code={filter:function($){var v=$.previousSibling||$.nextSibling,U=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!U},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",U="`",_=$.match(/`+/gm)||[];while(_.indexOf(U)!==-1)U=U+"`";return U+v+$+v+U}};Gv.image={filter:"img",replacement:function($,v){var U=v5(c_(v.getAttribute("alt"))),_=h2(v.getAttribute("src")||""),g=c_(v.getAttribute("title")),z=g?' "'+x2(g)+'"':"";return _?"!["+U+"]("+_+z+")":""}};function c_($){return $?$.replace(/(\n+\s*)+/g,`
95
- `):""}function h2($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function x2($){return $.replace(/"/g,"\\\"")}function g5($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var v in $.rules)this.array.push($.rules[v])}g5.prototype={add:function($,v){this.array.unshift(v)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var v;if(v=f2(this.array,$,this.options))return v;if(v=f2(this._keep,$,this.options))return v;if(v=f2(this._remove,$,this.options))return v;return this.defaultRule},forEach:function($){for(var v=0;v<this.array.length;v++)$(this.array[v],v)}};function f2($,v,U){for(var _=0;_<$.length;_++){var g=$[_];if(qH(g,v,U))return g}return}function qH($,v,U){var _=$.filter;if(typeof _==="string"){if(_===v.nodeName.toLowerCase())return!0}else if(Array.isArray(_)){if(_.indexOf(v.nodeName.toLowerCase())>-1)return!0}else if(typeof _==="function"){if(_.call($,v,U))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function FH($){var{element:v,isBlock:U,isVoid:_}=$,g=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||g(v))return;var z=null,J=!1,b=null,O=pK(b,v,g);while(O!==v){if(O.nodeType===3||O.nodeType===4){var K=O.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!J&&K[0]===" ")K=K.substr(1);if(!K){O=c2(O);continue}O.data=K,z=O}else if(O.nodeType===1){if(U(O)||O.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(O)||g(O))z=null,J=!0;else if(z)J=!1}else{O=c2(O);continue}var W=pK(b,O,g);b=O,O=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)c2(z)}}function c2($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function pK($,v,U){if($&&$.parentNode===v||U(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var p2=typeof window<"u"?window:{};function XH(){var $=p2.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(U){}return v}function wH(){var $=function(){};if(AH())$.prototype.parseFromString=function(v){var U=new window.ActiveXObject("htmlfile");return U.designMode="on",U.open(),U.write(v),U.close(),U};else $.prototype.parseFromString=function(v){var U=document.implementation.createHTMLDocument("");return U.open(),U.write(v),U.close(),U};return $}function AH(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(p2.ActiveXObject)$=!0}return $}var ZH=XH()?p2.DOMParser:wH();function MH($,v){var U;if(typeof $==="string"){var _=SH().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");U=_.getElementById("turndown-root")}else U=$.cloneNode(!0);return FH({element:U,isBlock:i2,isVoid:sK,isPre:v.preformattedCode?QH:null}),U}var m2;function SH(){return m2=m2||new ZH,m2}function QH($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function NH($,v){return $.isBlock=i2($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=rH($),$.flankingWhitespace=uH($,v),$}function rH($){return!sK($)&&!LH($)&&/^\s*$/i.test($.textContent)&&!HH($)&&!IH($)}function uH($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var U=yH($.textContent);if(U.leadingAscii&&oK("left",$,v))U.leading=U.leadingNonAscii;if(U.trailingAscii&&oK("right",$,v))U.trailing=U.trailingNonAscii;return{leading:U.leading,trailing:U.trailing}}function yH($){var v=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:v[1],leadingAscii:v[2],leadingNonAscii:v[3],trailing:v[4],trailingNonAscii:v[5],trailingAscii:v[6]}}function oK($,v,U){var _,g,z;if($==="left")_=v.previousSibling,g=/ $/;else _=v.nextSibling,g=/^ /;if(_){if(_.nodeType===3)z=g.test(_.nodeValue);else if(U.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!i2(_))z=g.test(_.textContent)}return z}var DH=Array.prototype.reduce;function Tg($){if(!(this instanceof Tg))return new Tg($);var v={rules:Gv,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(U,_){return _.isBlock?`
94
+ `,this.references=[];return v}};Gv.emphasis={filter:["em","i"],replacement:function($,v,g){if(!$.trim())return"";return g.emDelimiter+$+g.emDelimiter}};Gv.strong={filter:["strong","b"],replacement:function($,v,g){if(!$.trim())return"";return g.strongDelimiter+$+g.strongDelimiter}};Gv.code={filter:function($){var v=$.previousSibling||$.nextSibling,g=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!g},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",g="`",_=$.match(/`+/gm)||[];while(_.indexOf(g)!==-1)g=g+"`";return g+v+$+v+g}};Gv.image={filter:"img",replacement:function($,v){var g=G5(p_(v.getAttribute("alt"))),_=e2(v.getAttribute("src")||""),U=p_(v.getAttribute("title")),z=U?' "'+$z(U)+'"':"";return _?"!["+g+"]("+_+z+")":""}};function p_($){return $?$.replace(/(\n+\s*)+/g,`
95
+ `):""}function e2($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function $z($){return $.replace(/"/g,"\\\"")}function O5($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var v in $.rules)this.array.push($.rules[v])}O5.prototype={add:function($,v){this.array.unshift(v)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var v;if(v=o2(this.array,$,this.options))return v;if(v=o2(this._keep,$,this.options))return v;if(v=o2(this._remove,$,this.options))return v;return this.defaultRule},forEach:function($){for(var v=0;v<this.array.length;v++)$(this.array[v],v)}};function o2($,v,g){for(var _=0;_<$.length;_++){var U=$[_];if(uH(U,v,g))return U}return}function uH($,v,g){var _=$.filter;if(typeof _==="string"){if(_===v.nodeName.toLowerCase())return!0}else if(Array.isArray(_)){if(_.indexOf(v.nodeName.toLowerCase())>-1)return!0}else if(typeof _==="function"){if(_.call($,v,g))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function yH($){var{element:v,isBlock:g,isVoid:_}=$,U=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||U(v))return;var z=null,J=!1,b=null,O=eK(b,v,U);while(O!==v){if(O.nodeType===3||O.nodeType===4){var K=O.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!J&&K[0]===" ")K=K.substr(1);if(!K){O=n2(O);continue}O.data=K,z=O}else if(O.nodeType===1){if(g(O)||O.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(O)||U(O))z=null,J=!0;else if(z)J=!1}else{O=n2(O);continue}var W=eK(b,O,U);b=O,O=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)n2(z)}}function n2($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function eK($,v,g){if($&&$.parentNode===v||g(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var vz=typeof window<"u"?window:{};function DH(){var $=vz.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(g){}return v}function RH(){var $=function(){};if(TH())$.prototype.parseFromString=function(v){var g=new window.ActiveXObject("htmlfile");return g.designMode="on",g.open(),g.write(v),g.close(),g};else $.prototype.parseFromString=function(v){var g=document.implementation.createHTMLDocument("");return g.open(),g.write(v),g.close(),g};return $}function TH(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(vz.ActiveXObject)$=!0}return $}var jH=DH()?vz.DOMParser:RH();function VH($,v){var g;if(typeof $==="string"){var _=CH().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");g=_.getElementById("turndown-root")}else g=$.cloneNode(!0);return yH({element:g,isBlock:a2,isVoid:z5,isPre:v.preformattedCode?fH:null}),g}var t2;function CH(){return t2=t2||new jH,t2}function fH($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function mH($,v){return $.isBlock=a2($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=cH($),$.flankingWhitespace=EH($,v),$}function cH($){return!z5($)&&!SH($)&&/^\s*$/i.test($.textContent)&&!QH($)&&!NH($)}function EH($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var g=iH($.textContent);if(g.leadingAscii&&$5("left",$,v))g.leading=g.leadingNonAscii;if(g.trailingAscii&&$5("right",$,v))g.trailing=g.trailingNonAscii;return{leading:g.leading,trailing:g.trailing}}function iH($){var v=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:v[1],leadingAscii:v[2],leadingNonAscii:v[3],trailing:v[4],trailingNonAscii:v[5],trailingAscii:v[6]}}function $5($,v,g){var _,U,z;if($==="left")_=v.previousSibling,U=/ $/;else _=v.nextSibling,U=/^ /;if(_){if(_.nodeType===3)z=U.test(_.nodeValue);else if(g.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!a2(_))z=U.test(_.textContent)}return z}var lH=Array.prototype.reduce;function cU($){if(!(this instanceof cU))return new cU($);var v={rules:Gv,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(g,_){return _.isBlock?`
96
96
 
97
- `:""},keepReplacement:function(U,_){return _.isBlock?`
97
+ `:""},keepReplacement:function(g,_){return _.isBlock?`
98
98
 
99
99
  `+_.outerHTML+`
100
100
 
101
- `:_.outerHTML},defaultReplacement:function(U,_){return _.isBlock?`
101
+ `:_.outerHTML},defaultReplacement:function(g,_){return _.isBlock?`
102
102
 
103
- `+U+`
103
+ `+g+`
104
104
 
105
- `:U}};this.options=PH({},v,$),this.rules=new g5(this.options)}Tg.prototype={turndown:function($){if(!jH($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=U5.call(this,new MH($,this.options));return RH.call(this,v)},use:function($){if(Array.isArray($))for(var v=0;v<$.length;v++)this.use($[v]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,v){return this.rules.add($,v),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return v5($)}};function U5($){var v=this;return DH.call($.childNodes,function(U,_){_=new NH(_,v.options);var g="";if(_.nodeType===3)g=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)g=TH.call(v,_);return _5(U,g)},"")}function RH($){var v=this;return this.rules.forEach(function(U){if(typeof U.append==="function")$=_5($,U.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function TH($){var v=this.rules.forNode($),U=U5.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)U=U.trim();return _.leading+v.replacement(U,$,this.options)+_.trailing}function _5($,v){var U=tK($),_=nK(v),g=Math.max($.length-U.length,v.length-_.length),z=`
105
+ `:g}};this.options=ZH({},v,$),this.rules=new O5(this.options)}cU.prototype={turndown:function($){if(!pH($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=K5.call(this,new VH($,this.options));return xH.call(this,v)},use:function($){if(Array.isArray($))for(var v=0;v<$.length;v++)this.use($[v]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,v){return this.rules.add($,v),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return G5($)}};function K5($){var v=this;return lH.call($.childNodes,function(g,_){_=new mH(_,v.options);var U="";if(_.nodeType===3)U=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)U=hH.call(v,_);return W5(g,U)},"")}function xH($){var v=this;return this.rules.forEach(function(g){if(typeof g.append==="function")$=W5($,g.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function hH($){var v=this.rules.forNode($),g=K5.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)g=g.trim();return _.leading+v.replacement(g,$,this.options)+_.trailing}function W5($,v){var g=U5($),_=v5(v),U=Math.max($.length-g.length,v.length-_.length),z=`
106
106
 
107
- `.substring(0,g);return U+z+_}function jH($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function m_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function z5(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let U=v.toString(),_=document.createElement("code");_.textContent=U,v.deleteContents(),v.insertNode(_);let g=document.createRange();g.setStartAfter(_),g.setEndAfter(_),$.removeAllRanges(),$.addRange(g)}var E_=8,VH=[{kind:"exec",command:"bold",icon:"B",title:"Bold (⌘B)"},{kind:"exec",command:"italic",icon:"I",title:"Italic (⌘I)"},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:"Link (⌘K)",dividerBefore:!0}];function CH($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":z5();return;case"link":m_();return}}function J5({hostRef:$,onChange:v}){let[U,_]=o(!1),[g,z]=o({top:0,left:0}),[J,b]=o(0),O=y(null),K=y(null),W=S(()=>{let P=$.current;if(!P){_(!1);return}let F=window.getSelection();if(!F||F.rangeCount===0||F.isCollapsed){_(!1);return}let I=F.getRangeAt(0);if(!P.contains(I.commonAncestorContainer)){_(!1);return}let H=I.getBoundingClientRect();if(H.width===0&&H.height===0){_(!1);return}let Y=J||420,q=Math.max(E_,Math.min(H.left+H.width/2-Y/2,window.innerWidth-Y-E_)),w=Math.max(E_,H.top-E_-36);z({top:w,left:q}),_(!0)},[$,J]),B=S(()=>{if(K.current!==null)return;K.current=requestAnimationFrame(()=>{K.current=null,W()})},[W]);c(()=>{return document.addEventListener("selectionchange",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{if(document.removeEventListener("selectionchange",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),K.current!==null)cancelAnimationFrame(K.current)}},[B]),v_(()=>{if(!U)return;let P=O.current;if(!P)return;let F=P.getBoundingClientRect().width;if(F&&Math.abs(F-J)>1)b(F)},[U,J]);let k=S((P)=>{CH(P),v(),W()},[v,W]);if(!U)return null;return G("div",{ref:O,class:"md-inline-format-bar",style:{top:`${g.top}px`,left:`${g.left}px`},onMouseDown:(P)=>P.preventDefault(),children:VH.flatMap((P,F)=>{let I=G("button",{type:"button",class:"md-inline-format-btn",title:P.title,onClick:()=>k(P),children:P.icon},`btn-${F}`,!1,void 0,this);return P.dividerBefore?[G("span",{class:"md-inline-format-divider"},`div-${F}`,!1,void 0,this),I]:[I]})},void 0,!1,void 0,this)}var o2=null;function fH(){if(o2)return o2;let $=new Tg({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(b5.gfm),o2=$,$}function G5({initialHtml:$,className:v,onChange:U,onSave:_}){let g=y(null),z=y($);c(()=>{let B=g.current;if(!B)return;B.innerHTML=z.current},[]);let J=S(()=>{let B=g.current;if(!B)return"";return fH().turndown(B.innerHTML)},[]),b=S(()=>{U(J())},[U,J]),O=S(()=>{_?.(J())},[_,J]),K=S((B)=>{if(!(B.metaKey||B.ctrlKey))return;if(B.key==="s"){B.preventDefault(),O();return}if(B.key==="b"){B.preventDefault(),document.execCommand("bold"),b();return}if(B.key==="i"){B.preventDefault(),document.execCommand("italic"),b();return}if(B.key==="k")B.preventDefault(),m_(),b()},[b,O]),W=S((B)=>{let k=B.clipboardData?.getData("text/plain");if(k==null)return;B.preventDefault(),document.execCommand("insertText",!1,k),b()},[b]);return G(a$,{children:[G("div",{ref:g,class:v,contentEditable:!0,spellcheck:!1,onInput:b,onKeyDown:K,onPaste:W,onBlur:O},void 0,!1,void 0,this),G(J5,{hostRef:g,onChange:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function n2({html:$,className:v,style:U}){let _=y(null);return c(()=>{let g=_.current;if(!g)return;if(g.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,g.append(z.content.cloneNode(!0))},[$]),G("div",{ref:_,class:v,style:U},void 0,!1,void 0,this)}function i_({node:$,expanded:v=!1}){let U=$.data.path,[_,g]=o(""),[z,J]=o(""),[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(!1),[P,F]=o(!1),I=y(null),H=y(null),Y=y(""),q=y(null),w=$.data.reviewActive;c(()=>{let Q=!1;return(async()=>{let g$;if(U){let i=await Ng(U);if(Q)return;g$=i.content}else if($.data.content)g$=$.data.content;else{O(!0);return}g(g$);let m=await U6(g$);if(Q)return;J(m),O(!0),v$($.id,{content:g$,rendered:m})})(),()=>{Q=!0}},[U,$.id,$.data.content]);let N=S(async(Q)=>{let g$=Q.target.value;g(g$),F(!0);let m=await U6(g$);J(m)},[]),C=S(async(Q)=>{if(!U){let m=await U6(Q);J(m),F(!1),v$($.id,{content:Q,rendered:m}),await Zv($.id,{content:Q,data:{rendered:m}});return}k(!0);let g$=await y3(U,Q);if(k(!1),g$.ok){let m=await U6(Q);J(m),F(!1),v$($.id,{content:Q,rendered:m,savedAt:g$.updatedAt}),await Zv($.id,{content:Q,data:{rendered:m,savedAt:g$.updatedAt}})}},[U,$.id]),p=S(async()=>{if(!P)return;await C(_)},[P,_,C]),r=S((Q)=>{if((Q.metaKey||Q.ctrlKey)&&Q.key==="s"){Q.preventDefault(),p();return}let g$=I.current;if(g$&&NK(Q,g$))return;if(g$&&Q.key==="Tab")Q.preventDefault(),QK(g$,Q.shiftKey)},[p]);q.current=C;let n=S((Q)=>{if(g(Q),F(!0),Y.current=Q,H.current!==null)window.clearTimeout(H.current);H.current=window.setTimeout(()=>{H.current=null,C(Q)},800)},[C]),e=S((Q)=>{if(g(Q),Y.current=Q,H.current!==null)window.clearTimeout(H.current),H.current=null;C(Q)},[C]);c(()=>{return()=>{if(H.current===null)return;window.clearTimeout(H.current),H.current=null;let Q=q.current;if(Q)Q(Y.current)}},[$.id]);let u=w?G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(K&&v)return G("div",{class:"md-editor-expanded",onKeyDown:r,children:[G("div",{class:"md-editor-toolbar",children:[G("button",{type:"button",class:"md-toolbar-btn",onClick:()=>W(!1),children:"← Back to document"},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[U&&G("span",{class:"md-toolbar-path",children:U.split("/").pop()},void 0,!1,void 0,this),G("button",{type:"button",class:`md-toolbar-btn${P?" md-toolbar-btn-primary":""}`,onClick:p,disabled:!P||B,children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"md-editor-split",children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:I,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(T2,{textareaRef:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(n2,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(K)return G("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:r,children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:I,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(T2,{textareaRef:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(n2,{html:z,className:"md-preview"},void 0,!1,void 0,this),G("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[G("button",{type:"button",onClick:()=>W(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),G("button",{type:"button",onClick:p,disabled:!P||B,style:{padding:"4px 10px",fontSize:"11px",background:P?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${P?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:P?"var(--c-text)":"var(--c-dim)",cursor:P?"pointer":"default"},children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(v)return G("div",{style:{height:"100%",position:"relative"},children:[u,G("div",{class:"md-reader",children:b?G(G5,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:n,onSave:e},$.id,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"md-edit-fab",onClick:()=>W(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",position:"relative"},children:[u,G(n2,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"}},void 0,!1,void 0,this),!b&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),b&&!z&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>z6($.id),style:{position:"absolute",top:"4px",right:"4px",padding:"3px 8px",fontSize:"10px",background:"var(--c-panel-overlay)",border:"1px solid var(--c-line)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",opacity:0.7},onMouseEnter:(Q)=>{Q.target.style.opacity="1"},onMouseLeave:(Q)=>{Q.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var l_="pmx-canvas-ax",h_="pmx-canvas-ax-ack",xv="pmx-canvas-html-node",t2="pmx-canvas-ext-app-alive";var O5=37;function cH($){return $.type==="html"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function mH($){if($.type==="html")return $.data.presentation!==!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function K5($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function d2($){return!K5($)&&!cH($)}function W5($,v){if(!d2($)||v<=0)return null;return Math.min(v+37,600)}function a2($){return mH($)&&!K5($)}function B5($,v){if(!a2($)||v<=0)return null;let U=Math.min(v+37+24,1400);return U>$.size.height+8?U:null}var L={};ev(L,{xor:()=>x7,xid:()=>L7,void:()=>E7,uuidv7:()=>G7,uuidv6:()=>b7,uuidv4:()=>J7,uuid:()=>z7,util:()=>j,url:()=>O7,uppercase:()=>l4,unknown:()=>S$,union:()=>A$,undefined:()=>c7,ulid:()=>H7,uint64:()=>C7,uint32:()=>T7,tuple:()=>GG,trim:()=>t4,treeifyError:()=>Oz,transform:()=>H0,toUpperCase:()=>a4,toLowerCase:()=>d4,toJSONSchema:()=>l1,templateLiteral:()=>gW,symbol:()=>f7,superRefine:()=>TG,success:()=>e7,stringbool:()=>OW,stringFormat:()=>Q7,string:()=>Z,strictObject:()=>h7,startsWith:()=>x4,slugify:()=>s4,size:()=>g4,setErrorMap:()=>OY,set:()=>t7,safeParseAsync:()=>m9,safeParse:()=>c9,safeEncodeAsync:()=>o9,safeEncode:()=>x9,safeDecodeAsync:()=>n9,safeDecode:()=>p9,registry:()=>k1,regexes:()=>Dv,regex:()=>E4,refine:()=>RG,record:()=>N$,readonly:()=>QG,property:()=>c1,promise:()=>UW,prettifyError:()=>Kz,preprocess:()=>YU,prefault:()=>FG,positive:()=>j1,pipe:()=>KU,partialRecord:()=>p7,parseAsync:()=>f9,parse:()=>C9,overwrite:()=>cv,optional:()=>y$,object:()=>h,number:()=>I$,nullish:()=>s7,nullable:()=>OU,null:()=>bg,normalize:()=>n4,nonpositive:()=>C1,nonoptional:()=>XG,nonnegative:()=>f1,never:()=>k0,negative:()=>V1,nativeEnum:()=>d7,nanoid:()=>B7,nan:()=>$W,multipleOf:()=>y6,minSize:()=>tv,minLength:()=>G6,mime:()=>o4,meta:()=>bW,maxSize:()=>D6,maxLength:()=>U4,map:()=>n7,mac:()=>q7,lte:()=>Nv,lt:()=>ov,lowercase:()=>i4,looseRecord:()=>o7,looseObject:()=>$v,locales:()=>_U,literal:()=>t,length:()=>_4,lazy:()=>uG,ksuid:()=>I7,keyof:()=>l7,jwt:()=>S7,json:()=>KW,iso:()=>V6,ipv6:()=>F7,ipv4:()=>Y7,intersection:()=>Gg,int64:()=>V7,int32:()=>R7,int:()=>t1,instanceof:()=>GW,includes:()=>h4,httpUrl:()=>K7,hostname:()=>N7,hex:()=>r7,hash:()=>u7,guid:()=>_7,gte:()=>Hv,gt:()=>nv,globalRegistry:()=>e$,getErrorMap:()=>KY,function:()=>_W,fromJSONSchema:()=>BW,formatError:()=>hg,float64:()=>D7,float32:()=>y7,flattenError:()=>lg,file:()=>a7,exactOptional:()=>HG,enum:()=>vv,endsWith:()=>p4,encodeAsync:()=>l9,encode:()=>E9,emoji:()=>W7,email:()=>U7,e164:()=>M7,discriminatedUnion:()=>HU,describe:()=>JW,decodeAsync:()=>h9,decode:()=>i9,date:()=>i7,custom:()=>F0,cuid2:()=>k7,cuid:()=>P7,core:()=>O6,config:()=>l$,coerce:()=>VG,codec:()=>vW,clone:()=>kv,cidrv6:()=>w7,cidrv4:()=>X7,check:()=>zW,catch:()=>ZG,boolean:()=>h$,bigint:()=>j7,base64url:()=>Z7,base64:()=>A7,array:()=>J$,any:()=>m7,_function:()=>_W,_default:()=>YG,_ZodString:()=>d1,ZodXor:()=>_G,ZodXID:()=>U0,ZodVoid:()=>gG,ZodUnknown:()=>$G,ZodUnion:()=>kU,ZodUndefined:()=>a9,ZodUUID:()=>dv,ZodURL:()=>WU,ZodULID:()=>g0,ZodType:()=>_$,ZodTuple:()=>bG,ZodTransform:()=>PG,ZodTemplateLiteral:()=>NG,ZodSymbol:()=>d9,ZodSuccess:()=>wG,ZodStringFormat:()=>M$,ZodString:()=>gg,ZodSet:()=>KG,ZodRecord:()=>LU,ZodRealError:()=>wv,ZodReadonly:()=>SG,ZodPromise:()=>yG,ZodPrefault:()=>qG,ZodPipe:()=>Y0,ZodOptional:()=>L0,ZodObject:()=>PU,ZodNumberFormat:()=>z4,ZodNumber:()=>_g,ZodNullable:()=>LG,ZodNull:()=>s9,ZodNonOptional:()=>I0,ZodNever:()=>vG,ZodNanoID:()=>e1,ZodNaN:()=>MG,ZodMap:()=>OG,ZodMAC:()=>t9,ZodLiteral:()=>WG,ZodLazy:()=>rG,ZodKSUID:()=>_0,ZodJWT:()=>B0,ZodIssueCode:()=>GY,ZodIntersection:()=>JG,ZodISOTime:()=>o1,ZodISODuration:()=>n1,ZodISODateTime:()=>x1,ZodISODate:()=>p1,ZodIPv6:()=>J0,ZodIPv4:()=>z0,ZodGUID:()=>GU,ZodFunction:()=>DG,ZodFirstPartyTypeKind:()=>jG,ZodFile:()=>BG,ZodExactOptional:()=>kG,ZodError:()=>JY,ZodEnum:()=>vg,ZodEmoji:()=>s1,ZodEmail:()=>a1,ZodE164:()=>W0,ZodDiscriminatedUnion:()=>zG,ZodDefault:()=>IG,ZodDate:()=>BU,ZodCustomStringFormat:()=>Ug,ZodCustom:()=>IU,ZodCodec:()=>q0,ZodCatch:()=>AG,ZodCUID2:()=>v0,ZodCUID:()=>$0,ZodCIDRv6:()=>G0,ZodCIDRv4:()=>b0,ZodBoolean:()=>zg,ZodBigIntFormat:()=>P0,ZodBigInt:()=>Jg,ZodBase64URL:()=>K0,ZodBase64:()=>O0,ZodArray:()=>UG,ZodAny:()=>e9,TimePrecision:()=>B8,NEVER:()=>s2,$output:()=>J8,$input:()=>b8,$brand:()=>e2});var O6={};ev(O6,{version:()=>UJ,util:()=>j,treeifyError:()=>Oz,toJSONSchema:()=>l1,toDotPath:()=>Y5,safeParseAsync:()=>og,safeParse:()=>C4,safeEncodeAsync:()=>M5,safeEncode:()=>A5,safeDecodeAsync:()=>S5,safeDecode:()=>Z5,registry:()=>k1,regexes:()=>Dv,process:()=>X$,prettifyError:()=>Kz,parseAsync:()=>pg,parse:()=>xg,meta:()=>p8,locales:()=>_U,isValidJWT:()=>x5,isValidBase64URL:()=>h5,isValidBase64:()=>MJ,initializeContext:()=>R6,globalRegistry:()=>e$,globalConfig:()=>jg,formatError:()=>hg,flattenError:()=>lg,finalize:()=>j6,extractDefs:()=>T6,encodeAsync:()=>X5,encode:()=>q5,describe:()=>x8,decodeAsync:()=>w5,decode:()=>F5,createToJSONSchemaMethod:()=>n8,createStandardJSONSchemaMethod:()=>$g,config:()=>l$,clone:()=>kv,_xor:()=>VI,_xid:()=>M1,_void:()=>V8,_uuidv7:()=>q1,_uuidv6:()=>Y1,_uuidv4:()=>I1,_uuid:()=>L1,_url:()=>JU,_uppercase:()=>l4,_unknown:()=>T8,_union:()=>jI,_undefined:()=>y8,_ulid:()=>Z1,_uint64:()=>r8,_uint32:()=>A8,_tuple:()=>cI,_trim:()=>t4,_transform:()=>pI,_toUpperCase:()=>a4,_toLowerCase:()=>d4,_templateLiteral:()=>vY,_symbol:()=>u8,_superRefine:()=>h8,_success:()=>aI,_stringbool:()=>o8,_stringFormat:()=>e4,_string:()=>O8,_startsWith:()=>x4,_slugify:()=>s4,_size:()=>g4,_set:()=>iI,_safeParseAsync:()=>f4,_safeParse:()=>V4,_safeEncodeAsync:()=>e_,_safeEncode:()=>a_,_safeDecodeAsync:()=>$1,_safeDecode:()=>s_,_regex:()=>E4,_refine:()=>l8,_record:()=>mI,_readonly:()=>$Y,_property:()=>c1,_promise:()=>UY,_positive:()=>j1,_pipe:()=>eI,_parseAsync:()=>j4,_parse:()=>T4,_overwrite:()=>cv,_optional:()=>oI,_number:()=>I8,_nullable:()=>nI,_null:()=>D8,_normalize:()=>n4,_nonpositive:()=>C1,_nonoptional:()=>dI,_nonnegative:()=>f1,_never:()=>j8,_negative:()=>V1,_nativeEnum:()=>hI,_nanoid:()=>X1,_nan:()=>c8,_multipleOf:()=>y6,_minSize:()=>tv,_minLength:()=>G6,_min:()=>Hv,_mime:()=>o4,_maxSize:()=>D6,_maxLength:()=>U4,_max:()=>Nv,_map:()=>EI,_mac:()=>W8,_lte:()=>Nv,_lt:()=>ov,_lowercase:()=>i4,_literal:()=>xI,_length:()=>_4,_lazy:()=>gY,_ksuid:()=>S1,_jwt:()=>T1,_isoTime:()=>H8,_isoDuration:()=>L8,_isoDateTime:()=>P8,_isoDate:()=>k8,_ipv6:()=>N1,_ipv4:()=>Q1,_intersection:()=>fI,_int64:()=>N8,_int32:()=>w8,_int:()=>q8,_includes:()=>h4,_guid:()=>zU,_gte:()=>Hv,_gt:()=>nv,_float64:()=>X8,_float32:()=>F8,_file:()=>E8,_enum:()=>lI,_endsWith:()=>p4,_encodeAsync:()=>t_,_encode:()=>o_,_emoji:()=>F1,_email:()=>H1,_e164:()=>R1,_discriminatedUnion:()=>CI,_default:()=>tI,_decodeAsync:()=>d_,_decode:()=>n_,_date:()=>C8,_custom:()=>i8,_cuid2:()=>A1,_cuid:()=>w1,_coercedString:()=>K8,_coercedNumber:()=>Y8,_coercedDate:()=>f8,_coercedBoolean:()=>M8,_coercedBigint:()=>Q8,_cidrv6:()=>u1,_cidrv4:()=>r1,_check:()=>$7,_catch:()=>sI,_boolean:()=>Z8,_bigint:()=>S8,_base64url:()=>D1,_base64:()=>y1,_array:()=>m8,_any:()=>R8,TimePrecision:()=>B8,NEVER:()=>s2,JSONSchemaGenerator:()=>D9,JSONSchema:()=>v7,Doc:()=>_1,$output:()=>J8,$input:()=>b8,$constructor:()=>X,$brand:()=>e2,$ZodXor:()=>lJ,$ZodXID:()=>kJ,$ZodVoid:()=>cJ,$ZodUnknown:()=>CJ,$ZodUnion:()=>sg,$ZodUndefined:()=>TJ,$ZodUUID:()=>JJ,$ZodURL:()=>GJ,$ZodULID:()=>PJ,$ZodType:()=>$$,$ZodTuple:()=>B1,$ZodTransform:()=>sJ,$ZodTemplateLiteral:()=>Ob,$ZodSymbol:()=>RJ,$ZodSuccess:()=>_b,$ZodStringFormat:()=>Z$,$ZodString:()=>v4,$ZodSet:()=>nJ,$ZodRegistry:()=>G8,$ZodRecord:()=>pJ,$ZodRealError:()=>Xv,$ZodReadonly:()=>Gb,$ZodPromise:()=>Wb,$ZodPrefault:()=>gb,$ZodPipe:()=>bb,$ZodOptional:()=>P1,$ZodObjectJIT:()=>iJ,$ZodObject:()=>n5,$ZodNumberFormat:()=>yJ,$ZodNumber:()=>K1,$ZodNullable:()=>$b,$ZodNull:()=>jJ,$ZodNonOptional:()=>Ub,$ZodNever:()=>fJ,$ZodNanoID:()=>KJ,$ZodNaN:()=>Jb,$ZodMap:()=>oJ,$ZodMAC:()=>wJ,$ZodLiteral:()=>dJ,$ZodLazy:()=>Bb,$ZodKSUID:()=>HJ,$ZodJWT:()=>rJ,$ZodIntersection:()=>xJ,$ZodISOTime:()=>YJ,$ZodISODuration:()=>qJ,$ZodISODateTime:()=>LJ,$ZodISODate:()=>IJ,$ZodIPv6:()=>XJ,$ZodIPv4:()=>FJ,$ZodGUID:()=>zJ,$ZodFunction:()=>Kb,$ZodFile:()=>aJ,$ZodExactOptional:()=>eJ,$ZodError:()=>ig,$ZodEnum:()=>tJ,$ZodEncodeError:()=>s6,$ZodEmoji:()=>OJ,$ZodEmail:()=>bJ,$ZodE164:()=>NJ,$ZodDiscriminatedUnion:()=>hJ,$ZodDefault:()=>vb,$ZodDate:()=>mJ,$ZodCustomStringFormat:()=>uJ,$ZodCustom:()=>Pb,$ZodCodec:()=>eg,$ZodCheckUpperCase:()=>dz,$ZodCheckStringFormat:()=>c4,$ZodCheckStartsWith:()=>sz,$ZodCheckSizeEquals:()=>hz,$ZodCheckRegex:()=>nz,$ZodCheckProperty:()=>$J,$ZodCheckOverwrite:()=>gJ,$ZodCheckNumberFormat:()=>mz,$ZodCheckMultipleOf:()=>cz,$ZodCheckMinSize:()=>lz,$ZodCheckMinLength:()=>pz,$ZodCheckMimeType:()=>vJ,$ZodCheckMaxSize:()=>iz,$ZodCheckMaxLength:()=>xz,$ZodCheckLowerCase:()=>tz,$ZodCheckLessThan:()=>g1,$ZodCheckLengthEquals:()=>oz,$ZodCheckIncludes:()=>az,$ZodCheckGreaterThan:()=>U1,$ZodCheckEndsWith:()=>ez,$ZodCheckBigIntFormat:()=>Ez,$ZodCheck:()=>Q$,$ZodCatch:()=>zb,$ZodCUID2:()=>BJ,$ZodCUID:()=>WJ,$ZodCIDRv6:()=>ZJ,$ZodCIDRv4:()=>AJ,$ZodBoolean:()=>ag,$ZodBigIntFormat:()=>DJ,$ZodBigInt:()=>W1,$ZodBase64URL:()=>QJ,$ZodBase64:()=>SJ,$ZodAsyncError:()=>pv,$ZodArray:()=>EJ,$ZodAny:()=>VJ});var s2=Object.freeze({status:"aborted"});function X($,v,U){function _(b,O){if(!b._zod)Object.defineProperty(b,"_zod",{value:{def:O,constr:J,traits:new Set},enumerable:!1});if(b._zod.traits.has($))return;b._zod.traits.add($),v(b,O);let K=J.prototype,W=Object.keys(K);for(let B=0;B<W.length;B++){let k=W[B];if(!(k in b))b[k]=K[k].bind(b)}}let g=U?.Parent??Object;class z extends g{}Object.defineProperty(z,"name",{value:$});function J(b){var O;let K=U?.Parent?new z:this;_(K,b),(O=K._zod).deferred??(O.deferred=[]);for(let W of K._zod.deferred)W();return K}return Object.defineProperty(J,"init",{value:_}),Object.defineProperty(J,Symbol.hasInstance,{value:(b)=>{if(U?.Parent&&b instanceof U.Parent)return!0;return b?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var e2=Symbol("zod_brand");class pv extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class s6 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var jg={};function l$($){if($)Object.assign(jg,$);return jg}var j={};ev(j,{unwrapMessage:()=>Vg,uint8ArrayToHex:()=>WL,uint8ArrayToBase64url:()=>OL,uint8ArrayToBase64:()=>H5,stringifyPrimitive:()=>D,slugify:()=>gz,shallowClone:()=>_z,safeExtend:()=>UL,required:()=>JL,randomString:()=>dH,propertyKeyTypes:()=>cg,promiseAllObject:()=>tH,primitiveTypes:()=>zz,prefixIssues:()=>Qv,pick:()=>$L,partial:()=>zL,parsedType:()=>R,optionalKeys:()=>Jz,omit:()=>vL,objectClone:()=>pH,numKeys:()=>aH,nullish:()=>Q6,normalizeParams:()=>V,mergeDefs:()=>b6,merge:()=>_L,jsonStringifyReplacer:()=>y4,joinValues:()=>A,issue:()=>R4,isPlainObject:()=>r6,isObject:()=>e6,hexToUint8Array:()=>KL,getSizableOrigin:()=>mg,getParsedType:()=>sH,getLengthableOrigin:()=>Eg,getEnumValues:()=>Cg,getElementAtPath:()=>nH,floatSafeRemainder:()=>vz,finalizeIssue:()=>Fv,extend:()=>gL,escapeRegex:()=>yv,esc:()=>x_,defineLazy:()=>z$,createTransparentProxy:()=>eH,cloneDef:()=>oH,clone:()=>kv,cleanRegex:()=>fg,cleanEnum:()=>bL,captureStackTrace:()=>p_,cached:()=>D4,base64urlToUint8Array:()=>GL,base64ToUint8Array:()=>k5,assignProp:()=>N6,assertNotEqual:()=>iH,assertNever:()=>hH,assertIs:()=>lH,assertEqual:()=>EH,assert:()=>xH,allowsEval:()=>Uz,aborted:()=>u6,NUMBER_FORMAT_RANGES:()=>bz,Class:()=>L5,BIGINT_FORMAT_RANGES:()=>Gz});function EH($){return $}function iH($){return $}function lH($){}function hH($){throw Error("Unexpected value in exhaustive check")}function xH($){}function Cg($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,g])=>v.indexOf(+_)===-1).map(([_,g])=>g)}function A($,v="|"){return $.map((U)=>D(U)).join(v)}function y4($,v){if(typeof v==="bigint")return v.toString();return v}function D4($){return{get value(){{let U=$();return Object.defineProperty(this,"value",{value:U}),U}throw Error("cached value already set")}}}function Q6($){return $===null||$===void 0}function fg($){let v=$.startsWith("^")?1:0,U=$.endsWith("$")?$.length-1:$.length;return $.slice(v,U)}function vz($,v){let U=($.toString().split(".")[1]||"").length,_=v.toString(),g=(_.split(".")[1]||"").length;if(g===0&&/\d?e-\d?/.test(_)){let O=_.match(/\d?e-(\d?)/);if(O?.[1])g=Number.parseInt(O[1])}let z=U>g?U:g,J=Number.parseInt($.toFixed(z).replace(".","")),b=Number.parseInt(v.toFixed(z).replace(".",""));return J%b/10**z}var P5=Symbol("evaluating");function z$($,v,U){let _=void 0;Object.defineProperty($,v,{get(){if(_===P5)return;if(_===void 0)_=P5,_=U();return _},set(g){Object.defineProperty($,v,{value:g})},configurable:!0})}function pH($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function N6($,v,U){Object.defineProperty($,v,{value:U,writable:!0,enumerable:!0,configurable:!0})}function b6(...$){let v={};for(let U of $){let _=Object.getOwnPropertyDescriptors(U);Object.assign(v,_)}return Object.defineProperties({},v)}function oH($){return b6($._zod.def)}function nH($,v){if(!v)return $;return v.reduce((U,_)=>U?.[_],$)}function tH($){let v=Object.keys($),U=v.map((_)=>$[_]);return Promise.all(U).then((_)=>{let g={};for(let z=0;z<v.length;z++)g[v[z]]=_[z];return g})}function dH($=10){let U="";for(let _=0;_<$;_++)U+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return U}function x_($){return JSON.stringify($)}function gz($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var p_="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function e6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var Uz=D4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function r6($){if(e6($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let U=v.prototype;if(e6(U)===!1)return!1;if(Object.prototype.hasOwnProperty.call(U,"isPrototypeOf")===!1)return!1;return!0}function _z($){if(r6($))return{...$};if(Array.isArray($))return[...$];return $}function aH($){let v=0;for(let U in $)if(Object.prototype.hasOwnProperty.call($,U))v++;return v}var sH=($)=>{let v=typeof $;switch(v){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${v}`)}},cg=new Set(["string","number","symbol"]),zz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yv($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kv($,v,U){let _=new $._zod.constr(v??$._zod.def);if(!v||U?.parent)_._zod.parent=$;return _}function V($){let v=$;if(!v)return{};if(typeof v==="string")return{error:()=>v};if(v?.message!==void 0){if(v?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");v.error=v.message}if(delete v.message,typeof v.error==="string")return{...v,error:()=>v.error};return v}function eH($){let v;return new Proxy({},{get(U,_,g){return v??(v=$()),Reflect.get(v,_,g)},set(U,_,g,z){return v??(v=$()),Reflect.set(v,_,g,z)},has(U,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(U,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(U){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(U,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(U,_,g){return v??(v=$()),Reflect.defineProperty(v,_,g)}})}function D($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function Jz($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var bz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gz={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $L($,v){let U=$._zod.def,_=U.checks;if(_&&_.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={};for(let b in v){if(!(b in U.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;J[b]=U.shape[b]}return N6(this,"shape",J),J},checks:[]});return kv($,z)}function vL($,v){let U=$._zod.def,_=U.checks;if(_&&_.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={...$._zod.def.shape};for(let b in v){if(!(b in U.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;delete J[b]}return N6(this,"shape",J),J},checks:[]});return kv($,z)}function gL($,v){if(!r6(v))throw Error("Invalid input to extend: expected a plain object");let U=$._zod.def.checks;if(U&&U.length>0){let z=$._zod.def.shape;for(let J in v)if(Object.getOwnPropertyDescriptor(z,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let g=b6($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return N6(this,"shape",z),z}});return kv($,g)}function UL($,v){if(!r6(v))throw Error("Invalid input to safeExtend: expected a plain object");let U=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return N6(this,"shape",_),_}});return kv($,U)}function _L($,v){let U=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return N6(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return kv($,U)}function zL($,v,U){let g=v._zod.def.checks;if(g&&g.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=b6(v._zod.def,{get shape(){let b=v._zod.def.shape,O={...b};if(U)for(let K in U){if(!(K in b))throw Error(`Unrecognized key: "${K}"`);if(!U[K])continue;O[K]=$?new $({type:"optional",innerType:b[K]}):b[K]}else for(let K in b)O[K]=$?new $({type:"optional",innerType:b[K]}):b[K];return N6(this,"shape",O),O},checks:[]});return kv(v,J)}function JL($,v,U){let _=b6(v._zod.def,{get shape(){let g=v._zod.def.shape,z={...g};if(U)for(let J in U){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!U[J])continue;z[J]=new $({type:"nonoptional",innerType:g[J]})}else for(let J in g)z[J]=new $({type:"nonoptional",innerType:g[J]});return N6(this,"shape",z),z}});return kv(v,_)}function u6($,v=0){if($.aborted===!0)return!0;for(let U=v;U<$.issues.length;U++)if($.issues[U]?.continue!==!0)return!0;return!1}function Qv($,v){return v.map((U)=>{var _;return(_=U).path??(_.path=[]),U.path.unshift($),U})}function Vg($){return typeof $==="string"?$:$?.message}function Fv($,v,U){let _={...$,path:$.path??[]};if(!$.message){let g=Vg($.inst?._zod.def?.error?.($))??Vg(v?.error?.($))??Vg(U.customError?.($))??Vg(U.localeError?.($))??"Invalid input";_.message=g}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function mg($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function Eg($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function R($){let v=typeof $;switch(v){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let U=$;if(U&&Object.getPrototypeOf(U)!==Object.prototype&&"constructor"in U&&U.constructor)return U.constructor.name}}return v}function R4(...$){let[v,U,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:U,inst:_};return{...v}}function bL($){return Object.entries($).filter(([v,U])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function k5($){let v=atob($),U=new Uint8Array(v.length);for(let _=0;_<v.length;_++)U[_]=v.charCodeAt(_);return U}function H5($){let v="";for(let U=0;U<$.length;U++)v+=String.fromCharCode($[U]);return btoa(v)}function GL($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),U="=".repeat((4-v.length%4)%4);return k5(v+U)}function OL($){return H5($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function KL($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let U=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)U[_/2]=Number.parseInt(v.slice(_,_+2),16);return U}function WL($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class L5{constructor(...$){}}var I5=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,y4,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},ig=X("$ZodError",I5),Xv=X("$ZodError",I5,{Parent:Error});function lg($,v=(U)=>U.message){let U={},_=[];for(let g of $.issues)if(g.path.length>0)U[g.path[0]]=U[g.path[0]]||[],U[g.path[0]].push(v(g));else _.push(v(g));return{formErrors:_,fieldErrors:U}}function hg($,v=(U)=>U.message){let U={_errors:[]},_=(g)=>{for(let z of g.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>_({issues:J}));else if(z.code==="invalid_key")_({issues:z.issues});else if(z.code==="invalid_element")_({issues:z.issues});else if(z.path.length===0)U._errors.push(v(z));else{let J=U,b=0;while(b<z.path.length){let O=z.path[b];if(b!==z.path.length-1)J[O]=J[O]||{_errors:[]};else J[O]=J[O]||{_errors:[]},J[O]._errors.push(v(z));J=J[O],b++}}};return _($),U}function Oz($,v=(U)=>U.message){let U={errors:[]},_=(g,z=[])=>{var J,b;for(let O of g.issues)if(O.code==="invalid_union"&&O.errors.length)O.errors.map((K)=>_({issues:K},O.path));else if(O.code==="invalid_key")_({issues:O.issues},O.path);else if(O.code==="invalid_element")_({issues:O.issues},O.path);else{let K=[...z,...O.path];if(K.length===0){U.errors.push(v(O));continue}let W=U,B=0;while(B<K.length){let k=K[B],P=B===K.length-1;if(typeof k==="string")W.properties??(W.properties={}),(J=W.properties)[k]??(J[k]={errors:[]}),W=W.properties[k];else W.items??(W.items=[]),(b=W.items)[k]??(b[k]={errors:[]}),W=W.items[k];if(P)W.errors.push(v(O));B++}}};return _($),U}function Y5($){let v=[],U=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of U)if(typeof _==="number")v.push(`[${_}]`);else if(typeof _==="symbol")v.push(`[${JSON.stringify(String(_))}]`);else if(/[^\w$]/.test(_))v.push(`[${JSON.stringify(_)}]`);else{if(v.length)v.push(".");v.push(_)}return v.join("")}function Kz($){let v=[],U=[...$.issues].sort((_,g)=>(_.path??[]).length-(g.path??[]).length);for(let _ of U)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${Y5(_.path)}`);return v.join(`
108
- `)}var T4=($)=>(v,U,_,g)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:U,issues:[]},z);if(J instanceof Promise)throw new pv;if(J.issues.length){let b=new(g?.Err??$)(J.issues.map((O)=>Fv(O,z,l$())));throw p_(b,g?.callee),b}return J.value},xg=T4(Xv),j4=($)=>async(v,U,_,g)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:U,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let b=new(g?.Err??$)(J.issues.map((O)=>Fv(O,z,l$())));throw p_(b,g?.callee),b}return J.value},pg=j4(Xv),V4=($)=>(v,U,_)=>{let g=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:U,issues:[]},g);if(z instanceof Promise)throw new pv;return z.issues.length?{success:!1,error:new($??ig)(z.issues.map((J)=>Fv(J,g,l$())))}:{success:!0,data:z.value}},C4=V4(Xv),f4=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:U,issues:[]},g);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Fv(J,g,l$())))}:{success:!0,data:z.value}},og=f4(Xv),o_=($)=>(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return T4($)(v,U,g)},q5=o_(Xv),n_=($)=>(v,U,_)=>{return T4($)(v,U,_)},F5=n_(Xv),t_=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return j4($)(v,U,g)},X5=t_(Xv),d_=($)=>async(v,U,_)=>{return j4($)(v,U,_)},w5=d_(Xv),a_=($)=>(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return V4($)(v,U,g)},A5=a_(Xv),s_=($)=>(v,U,_)=>{return V4($)(v,U,_)},Z5=s_(Xv),e_=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return f4($)(v,U,g)},M5=e_(Xv),$1=($)=>async(v,U,_)=>{return f4($)(v,U,_)},S5=$1(Xv);var Dv={};ev(Dv,{xid:()=>kz,uuid7:()=>LL,uuid6:()=>HL,uuid4:()=>kL,uuid:()=>$4,uppercase:()=>fz,unicodeEmail:()=>Q5,undefined:()=>Vz,ulid:()=>Pz,time:()=>rz,string:()=>yz,sha512_hex:()=>CL,sha512_base64url:()=>cL,sha512_base64:()=>fL,sha384_hex:()=>TL,sha384_base64url:()=>VL,sha384_base64:()=>jL,sha256_hex:()=>yL,sha256_base64url:()=>RL,sha256_base64:()=>DL,sha1_hex:()=>NL,sha1_base64url:()=>uL,sha1_base64:()=>rL,rfc5322Email:()=>YL,number:()=>ng,null:()=>jz,nanoid:()=>Lz,md5_hex:()=>ML,md5_base64url:()=>QL,md5_base64:()=>SL,mac:()=>Az,lowercase:()=>Cz,ksuid:()=>Hz,ipv6:()=>wz,ipv4:()=>Xz,integer:()=>Rz,idnEmail:()=>qL,html5Email:()=>IL,hostname:()=>wL,hex:()=>ZL,guid:()=>Yz,extendedDuration:()=>PL,emoji:()=>Fz,email:()=>qz,e164:()=>Qz,duration:()=>Iz,domain:()=>AL,datetime:()=>uz,date:()=>Nz,cuid2:()=>Bz,cuid:()=>Wz,cidrv6:()=>Mz,cidrv4:()=>Zz,browserEmail:()=>FL,boolean:()=>Tz,bigint:()=>Dz,base64url:()=>v1,base64:()=>Sz});var Wz=/^[cC][^\s-]{8,}$/,Bz=/^[0-9a-z]+$/,Pz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kz=/^[0-9a-vA-V]{20}$/,Hz=/^[A-Za-z0-9]{27}$/,Lz=/^[a-zA-Z0-9_-]{21}$/,Iz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,PL=/^[-+]?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)?)??$/,Yz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$4=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},kL=$4(4),HL=$4(6),LL=$4(7),qz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,IL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,YL=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Q5=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qL=Q5,FL=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,XL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fz(){return new RegExp(XL,"u")}var Xz=/^(?:(?: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])$/,wz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Az=($)=>{let v=yv($??":");return new RegExp(`^(?:[0-9A-F]{2}${v}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${v}){5}[0-9a-f]{2}$`)},Zz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Mz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,v1=/^[A-Za-z0-9_-]*$/,wL=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,AL=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Qz=/^\+[1-9]\d{6,14}$/,N5="(?:(?:\\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])))",Nz=new RegExp(`^${N5}$`);function r5($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function rz($){return new RegExp(`^${r5($)}$`)}function uz($){let v=r5({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${U.join("|")})`;return new RegExp(`^${N5}T(?:${_})$`)}var yz=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},Dz=/^-?\d+n?$/,Rz=/^-?\d+$/,ng=/^-?\d+(?:\.\d+)?$/,Tz=/^(?:true|false)$/i,jz=/^null$/i;var Vz=/^undefined$/i;var Cz=/^[^A-Z]*$/,fz=/^[^a-z]*$/,ZL=/^[0-9a-fA-F]*$/;function tg($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function dg($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var ML=/^[0-9a-fA-F]{32}$/,SL=tg(22,"=="),QL=dg(22),NL=/^[0-9a-fA-F]{40}$/,rL=tg(27,"="),uL=dg(27),yL=/^[0-9a-fA-F]{64}$/,DL=tg(43,"="),RL=dg(43),TL=/^[0-9a-fA-F]{96}$/,jL=tg(64,""),VL=dg(64),CL=/^[0-9a-fA-F]{128}$/,fL=tg(86,"=="),cL=dg(86);var Q$=X("$ZodCheck",($,v)=>{var U;$._zod??($._zod={}),$._zod.def=v,(U=$._zod).onattach??(U.onattach=[])}),y5={number:"number",bigint:"bigint",object:"date"},g1=X("$ZodCheckLessThan",($,v)=>{Q$.init($,v);let U=y5[typeof v.value];$._zod.onattach.push((_)=>{let g=_._zod.bag,z=(v.inclusive?g.maximum:g.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)g.maximum=v.value;else g.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:U,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),U1=X("$ZodCheckGreaterThan",($,v)=>{Q$.init($,v);let U=y5[typeof v.value];$._zod.onattach.push((_)=>{let g=_._zod.bag,z=(v.inclusive?g.minimum:g.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)g.minimum=v.value;else g.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:U,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),cz=X("$ZodCheckMultipleOf",($,v)=>{Q$.init($,v),$._zod.onattach.push((U)=>{var _;(_=U._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(U)=>{if(typeof U.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof U.value==="bigint"?U.value%v.value===BigInt(0):vz(U.value,v.value)===0)return;U.issues.push({origin:typeof U.value,code:"not_multiple_of",divisor:v.value,input:U.value,inst:$,continue:!v.abort})}}),mz=X("$ZodCheckNumberFormat",($,v)=>{Q$.init($,v),v.format=v.format||"float64";let U=v.format?.includes("int"),_=U?"int":"number",[g,z]=bz[v.format];$._zod.onattach.push((J)=>{let b=J._zod.bag;if(b.format=v.format,b.minimum=g,b.maximum=z,U)b.pattern=Rz}),$._zod.check=(J)=>{let b=J.value;if(U){if(!Number.isInteger(b)){J.issues.push({expected:_,format:v.format,code:"invalid_type",continue:!1,input:b,inst:$});return}if(!Number.isSafeInteger(b)){if(b>0)J.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});else J.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});return}}if(b<g)J.issues.push({origin:"number",input:b,code:"too_small",minimum:g,inclusive:!0,inst:$,continue:!v.abort});if(b>z)J.issues.push({origin:"number",input:b,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!v.abort})}}),Ez=X("$ZodCheckBigIntFormat",($,v)=>{Q$.init($,v);let[U,_]=Gz[v.format];$._zod.onattach.push((g)=>{let z=g._zod.bag;z.format=v.format,z.minimum=U,z.maximum=_}),$._zod.check=(g)=>{let z=g.value;if(z<U)g.issues.push({origin:"bigint",input:z,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(z>_)g.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),iz=X("$ZodCheckMaxSize",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<g)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let g=_.value;if(g.size<=v.maximum)return;_.issues.push({origin:mg(g),code:"too_big",maximum:v.maximum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),lz=X("$ZodCheckMinSize",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>g)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let g=_.value;if(g.size>=v.minimum)return;_.issues.push({origin:mg(g),code:"too_small",minimum:v.minimum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),hz=X("$ZodCheckSizeEquals",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.minimum=v.size,g.maximum=v.size,g.size=v.size}),$._zod.check=(_)=>{let g=_.value,z=g.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:mg(g),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),xz=X("$ZodCheckMaxLength",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<g)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let g=_.value;if(g.length<=v.maximum)return;let J=Eg(g);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),pz=X("$ZodCheckMinLength",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>g)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let g=_.value;if(g.length>=v.minimum)return;let J=Eg(g);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),oz=X("$ZodCheckLengthEquals",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.minimum=v.length,g.maximum=v.length,g.length=v.length}),$._zod.check=(_)=>{let g=_.value,z=g.length;if(z===v.length)return;let J=Eg(g),b=z>v.length;_.issues.push({origin:J,...b?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),c4=X("$ZodCheckStringFormat",($,v)=>{var U,_;if(Q$.init($,v),$._zod.onattach.push((g)=>{let z=g._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(U=$._zod).check??(U.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:v.format,input:g.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),nz=X("$ZodCheckRegex",($,v)=>{c4.init($,v),$._zod.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:"regex",input:U.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),tz=X("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=Cz),c4.init($,v)}),dz=X("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=fz),c4.init($,v)}),az=X("$ZodCheckIncludes",($,v)=>{Q$.init($,v);let U=yv(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${U}`:U);v.pattern=_,$._zod.onattach.push((g)=>{let z=g._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(g)=>{if(g.value.includes(v.includes,v.position))return;g.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:g.value,inst:$,continue:!v.abort})}}),sz=X("$ZodCheckStartsWith",($,v)=>{Q$.init($,v);let U=new RegExp(`^${yv(v.prefix)}.*`);v.pattern??(v.pattern=U),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(U)}),$._zod.check=(_)=>{if(_.value.startsWith(v.prefix))return;_.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:v.prefix,input:_.value,inst:$,continue:!v.abort})}}),ez=X("$ZodCheckEndsWith",($,v)=>{Q$.init($,v);let U=new RegExp(`.*${yv(v.suffix)}$`);v.pattern??(v.pattern=U),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(U)}),$._zod.check=(_)=>{if(_.value.endsWith(v.suffix))return;_.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:v.suffix,input:_.value,inst:$,continue:!v.abort})}});function u5($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues))}var $J=X("$ZodCheckProperty",($,v)=>{Q$.init($,v),$._zod.check=(U)=>{let _=v.schema._zod.run({value:U.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((g)=>u5(g,U,v.property));u5(_,U,v.property);return}}),vJ=X("$ZodCheckMimeType",($,v)=>{Q$.init($,v);let U=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(U.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),gJ=X("$ZodCheckOverwrite",($,v)=>{Q$.init($,v),$._zod.check=(U)=>{U.value=v.tx(U.value)}});class _1{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let U=$.split(`
109
- `).filter((z)=>z),_=Math.min(...U.map((z)=>z.length-z.trimStart().length)),g=U.map((z)=>z.slice(_)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of g)this.content.push(z)}compile(){let $=Function,v=this?.args,_=[...(this?.content??[""]).map((g)=>` ${g}`)];return new $(...v,_.join(`
110
- `))}}var UJ={major:4,minor:3,patch:6};var $$=X("$ZodType",($,v)=>{var U;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=UJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let g of _)for(let z of g._zod.onattach)z($);if(_.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let g=(J,b,O)=>{let K=u6(J),W;for(let B of b){if(B._zod.def.when){if(!B._zod.def.when(J))continue}else if(K)continue;let k=J.issues.length,P=B._zod.check(J);if(P instanceof Promise&&O?.async===!1)throw new pv;if(W||P instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await P,J.issues.length===k)return;if(!K)K=u6(J,k)});else{if(J.issues.length===k)continue;if(!K)K=u6(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,b,O)=>{if(u6(J))return J.aborted=!0,J;let K=g(b,_,O);if(K instanceof Promise){if(O.async===!1)throw new pv;return K.then((W)=>$._zod.parse(W,O))}return $._zod.parse(K,O)};$._zod.run=(J,b)=>{if(b.skipChecks)return $._zod.parse(J,b);if(b.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...b,skipChecks:!0});if(K instanceof Promise)return K.then((W)=>{return z(W,J,b)});return z(K,J,b)}let O=$._zod.parse(J,b);if(O instanceof Promise){if(b.async===!1)throw new pv;return O.then((K)=>g(K,_,b))}return g(O,_,b)}}z$($,"~standard",()=>({validate:(g)=>{try{let z=C4($,g);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return og($,g).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),v4=X("$ZodString",($,v)=>{$$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??yz($._zod.bag),$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=String(U.value)}catch(g){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),Z$=X("$ZodStringFormat",($,v)=>{c4.init($,v),v4.init($,v)}),zJ=X("$ZodGUID",($,v)=>{v.pattern??(v.pattern=Yz),Z$.init($,v)}),JJ=X("$ZodUUID",($,v)=>{if(v.version){let _={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(_===void 0)throw Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=$4(_))}else v.pattern??(v.pattern=$4());Z$.init($,v)}),bJ=X("$ZodEmail",($,v)=>{v.pattern??(v.pattern=qz),Z$.init($,v)}),GJ=X("$ZodURL",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{try{let _=U.value.trim(),g=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(g.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:U.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(g.protocol.endsWith(":")?g.protocol.slice(0,-1):g.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:U.value,inst:$,continue:!v.abort})}if(v.normalize)U.value=g.href;else U.value=_;return}catch(_){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!v.abort})}}}),OJ=X("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=Fz()),Z$.init($,v)}),KJ=X("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=Lz),Z$.init($,v)}),WJ=X("$ZodCUID",($,v)=>{v.pattern??(v.pattern=Wz),Z$.init($,v)}),BJ=X("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=Bz),Z$.init($,v)}),PJ=X("$ZodULID",($,v)=>{v.pattern??(v.pattern=Pz),Z$.init($,v)}),kJ=X("$ZodXID",($,v)=>{v.pattern??(v.pattern=kz),Z$.init($,v)}),HJ=X("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=Hz),Z$.init($,v)}),LJ=X("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=uz(v)),Z$.init($,v)}),IJ=X("$ZodISODate",($,v)=>{v.pattern??(v.pattern=Nz),Z$.init($,v)}),YJ=X("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=rz(v)),Z$.init($,v)}),qJ=X("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=Iz),Z$.init($,v)}),FJ=X("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=Xz),Z$.init($,v),$._zod.bag.format="ipv4"}),XJ=X("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=wz),Z$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!v.abort})}}}),wJ=X("$ZodMAC",($,v)=>{v.pattern??(v.pattern=Az(v.delimiter)),Z$.init($,v),$._zod.bag.format="mac"}),AJ=X("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=Zz),Z$.init($,v)}),ZJ=X("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=Mz),Z$.init($,v),$._zod.check=(U)=>{let _=U.value.split("/");try{if(_.length!==2)throw Error();let[g,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${g}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!v.abort})}}});function MJ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var SJ=X("$ZodBase64",($,v)=>{v.pattern??(v.pattern=Sz),Z$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(U)=>{if(MJ(U.value))return;U.issues.push({code:"invalid_format",format:"base64",input:U.value,inst:$,continue:!v.abort})}});function h5($){if(!v1.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),U=v.padEnd(Math.ceil(v.length/4)*4,"=");return MJ(U)}var QJ=X("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=v1),Z$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(U)=>{if(h5(U.value))return;U.issues.push({code:"invalid_format",format:"base64url",input:U.value,inst:$,continue:!v.abort})}}),NJ=X("$ZodE164",($,v)=>{v.pattern??(v.pattern=Qz),Z$.init($,v)});function x5($,v=null){try{let U=$.split(".");if(U.length!==3)return!1;let[_]=U;if(!_)return!1;let g=JSON.parse(atob(_));if("typ"in g&&g?.typ!=="JWT")return!1;if(!g.alg)return!1;if(v&&(!("alg"in g)||g.alg!==v))return!1;return!0}catch{return!1}}var rJ=X("$ZodJWT",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{if(x5(U.value,v.alg))return;U.issues.push({code:"invalid_format",format:"jwt",input:U.value,inst:$,continue:!v.abort})}}),uJ=X("$ZodCustomStringFormat",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{if(v.fn(U.value))return;U.issues.push({code:"invalid_format",format:v.format,input:U.value,inst:$,continue:!v.abort})}}),K1=X("$ZodNumber",($,v)=>{$$.init($,v),$._zod.pattern=$._zod.bag.pattern??ng,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=Number(U.value)}catch(J){}let g=U.value;if(typeof g==="number"&&!Number.isNaN(g)&&Number.isFinite(g))return U;let z=typeof g==="number"?Number.isNaN(g)?"NaN":!Number.isFinite(g)?"Infinity":void 0:void 0;return U.issues.push({expected:"number",code:"invalid_type",input:g,inst:$,...z?{received:z}:{}}),U}}),yJ=X("$ZodNumberFormat",($,v)=>{mz.init($,v),K1.init($,v)}),ag=X("$ZodBoolean",($,v)=>{$$.init($,v),$._zod.pattern=Tz,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=Boolean(U.value)}catch(z){}let g=U.value;if(typeof g==="boolean")return U;return U.issues.push({expected:"boolean",code:"invalid_type",input:g,inst:$}),U}}),W1=X("$ZodBigInt",($,v)=>{$$.init($,v),$._zod.pattern=Dz,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=BigInt(U.value)}catch(g){}if(typeof U.value==="bigint")return U;return U.issues.push({expected:"bigint",code:"invalid_type",input:U.value,inst:$}),U}}),DJ=X("$ZodBigIntFormat",($,v)=>{Ez.init($,v),W1.init($,v)}),RJ=X("$ZodSymbol",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(typeof g==="symbol")return U;return U.issues.push({expected:"symbol",code:"invalid_type",input:g,inst:$}),U}}),TJ=X("$ZodUndefined",($,v)=>{$$.init($,v),$._zod.pattern=Vz,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(U,_)=>{let g=U.value;if(typeof g>"u")return U;return U.issues.push({expected:"undefined",code:"invalid_type",input:g,inst:$}),U}}),jJ=X("$ZodNull",($,v)=>{$$.init($,v),$._zod.pattern=jz,$._zod.values=new Set([null]),$._zod.parse=(U,_)=>{let g=U.value;if(g===null)return U;return U.issues.push({expected:"null",code:"invalid_type",input:g,inst:$}),U}}),VJ=X("$ZodAny",($,v)=>{$$.init($,v),$._zod.parse=(U)=>U}),CJ=X("$ZodUnknown",($,v)=>{$$.init($,v),$._zod.parse=(U)=>U}),fJ=X("$ZodNever",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{return U.issues.push({expected:"never",code:"invalid_type",input:U.value,inst:$}),U}}),cJ=X("$ZodVoid",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(typeof g>"u")return U;return U.issues.push({expected:"void",code:"invalid_type",input:g,inst:$}),U}}),mJ=X("$ZodDate",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=new Date(U.value)}catch(b){}let g=U.value,z=g instanceof Date;if(z&&!Number.isNaN(g.getTime()))return U;return U.issues.push({expected:"date",code:"invalid_type",input:g,...z?{received:"Invalid Date"}:{},inst:$}),U}});function R5($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues));v.value[U]=$.value}var EJ=X("$ZodArray",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!Array.isArray(g))return U.issues.push({expected:"array",code:"invalid_type",input:g,inst:$}),U;U.value=Array(g.length);let z=[];for(let J=0;J<g.length;J++){let b=g[J],O=v.element._zod.run({value:b,issues:[]},_);if(O instanceof Promise)z.push(O.then((K)=>R5(K,U,J)));else R5(O,U,J)}if(z.length)return Promise.all(z).then(()=>U);return U}});function O1($,v,U,_,g){if($.issues.length){if(g&&!(U in _))return;v.issues.push(...Qv(U,$.issues))}if($.value===void 0){if(U in _)v.value[U]=void 0}else v.value[U]=$.value}function p5($){let v=Object.keys($.shape);for(let _ of v)if(!$.shape?.[_]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${_}": expected a Zod schema`);let U=Jz($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(U)}}function o5($,v,U,_,g,z){let J=[],b=g.keySet,O=g.catchall._zod,K=O.def.type,W=O.optout==="optional";for(let B in v){if(b.has(B))continue;if(K==="never"){J.push(B);continue}let k=O.run({value:v[B],issues:[]},_);if(k instanceof Promise)$.push(k.then((P)=>O1(P,U,B,v,W)));else O1(k,U,B,v,W)}if(J.length)U.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return U;return Promise.all($).then(()=>{return U})}var n5=X("$ZodObject",($,v)=>{if($$.init($,v),!Object.getOwnPropertyDescriptor(v,"shape")?.get){let b=v.shape;Object.defineProperty(v,"shape",{get:()=>{let O={...b};return Object.defineProperty(v,"shape",{value:O}),O}})}let _=D4(()=>p5(v));z$($._zod,"propValues",()=>{let b=v.shape,O={};for(let K in b){let W=b[K]._zod;if(W.values){O[K]??(O[K]=new Set);for(let B of W.values)O[K].add(B)}}return O});let g=e6,z=v.catchall,J;$._zod.parse=(b,O)=>{J??(J=_.value);let K=b.value;if(!g(K))return b.issues.push({expected:"object",code:"invalid_type",input:K,inst:$}),b;b.value={};let W=[],B=J.shape;for(let k of J.keys){let P=B[k],F=P._zod.optout==="optional",I=P._zod.run({value:K[k],issues:[]},O);if(I instanceof Promise)W.push(I.then((H)=>O1(H,b,k,K,F)));else O1(I,b,k,K,F)}if(!z)return W.length?Promise.all(W).then(()=>b):b;return o5(W,K,b,O,_.value,$)}}),iJ=X("$ZodObjectJIT",($,v)=>{n5.init($,v);let U=$._zod.parse,_=D4(()=>p5(v)),g=(k)=>{let P=new _1(["shape","payload","ctx"]),F=_.value,I=(w)=>{let N=x_(w);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};P.write("const input = payload.value;");let H=Object.create(null),Y=0;for(let w of F.keys)H[w]=`key_${Y++}`;P.write("const newResult = {};");for(let w of F.keys){let N=H[w],C=x_(w),r=k[w]?._zod?.optout==="optional";if(P.write(`const ${N} = ${I(w)};`),r)P.write(`
107
+ `.substring(0,U);return g+z+_}function pH($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function o_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function B5(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let g=v.toString(),_=document.createElement("code");_.textContent=g,v.deleteContents(),v.insertNode(_);let U=document.createRange();U.setStartAfter(_),U.setEndAfter(_),$.removeAllRanges(),$.addRange(U)}var n_=8,oH=[{kind:"exec",command:"bold",icon:"B",title:"Bold (⌘B)"},{kind:"exec",command:"italic",icon:"I",title:"Italic (⌘I)"},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:"Link (⌘K)",dividerBefore:!0}];function nH($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":B5();return;case"link":o_();return}}function P5({hostRef:$,onChange:v}){let[g,_]=o(!1),[U,z]=o({top:0,left:0}),[J,b]=o(0),O=y(null),K=y(null),W=Q(()=>{let P=$.current;if(!P){_(!1);return}let X=window.getSelection();if(!X||X.rangeCount===0||X.isCollapsed){_(!1);return}let Y=X.getRangeAt(0);if(!P.contains(Y.commonAncestorContainer)){_(!1);return}let H=Y.getBoundingClientRect();if(H.width===0&&H.height===0){_(!1);return}let L=J||420,q=Math.max(n_,Math.min(H.left+H.width/2-L/2,window.innerWidth-L-n_)),F=Math.max(n_,H.top-n_-36);z({top:F,left:q}),_(!0)},[$,J]),B=Q(()=>{if(K.current!==null)return;K.current=requestAnimationFrame(()=>{K.current=null,W()})},[W]);m(()=>{return document.addEventListener("selectionchange",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{if(document.removeEventListener("selectionchange",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),K.current!==null)cancelAnimationFrame(K.current)}},[B]),G_(()=>{if(!g)return;let P=O.current;if(!P)return;let X=P.getBoundingClientRect().width;if(X&&Math.abs(X-J)>1)b(X)},[g,J]);let k=Q((P)=>{nH(P),v(),W()},[v,W]);if(!g)return null;return G("div",{ref:O,class:"md-inline-format-bar",style:{top:`${U.top}px`,left:`${U.left}px`},onMouseDown:(P)=>P.preventDefault(),children:oH.flatMap((P,X)=>{let Y=G("button",{type:"button",class:"md-inline-format-btn",title:P.title,onClick:()=>k(P),children:P.icon},`btn-${X}`,!1,void 0,this);return P.dividerBefore?[G("span",{class:"md-inline-format-divider"},`div-${X}`,!1,void 0,this),Y]:[Y]})},void 0,!1,void 0,this)}var Uz=null;function tH(){if(Uz)return Uz;let $=new cU({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(k5.gfm),Uz=$,$}function H5({initialHtml:$,className:v,onChange:g,onSave:_}){let U=y(null),z=y($);m(()=>{let B=U.current;if(!B)return;B.innerHTML=z.current},[]);let J=Q(()=>{let B=U.current;if(!B)return"";return tH().turndown(B.innerHTML)},[]),b=Q(()=>{g(J())},[g,J]),O=Q(()=>{_?.(J())},[_,J]),K=Q((B)=>{if(!(B.metaKey||B.ctrlKey))return;if(B.key==="s"){B.preventDefault(),O();return}if(B.key==="b"){B.preventDefault(),document.execCommand("bold"),b();return}if(B.key==="i"){B.preventDefault(),document.execCommand("italic"),b();return}if(B.key==="k")B.preventDefault(),o_(),b()},[b,O]),W=Q((B)=>{let k=B.clipboardData?.getData("text/plain");if(k==null)return;B.preventDefault(),document.execCommand("insertText",!1,k),b()},[b]);return G(a$,{children:[G("div",{ref:U,class:v,contentEditable:!0,spellcheck:!1,onInput:b,onKeyDown:K,onPaste:W,onBlur:O},void 0,!1,void 0,this),G(P5,{hostRef:U,onChange:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gz({html:$,className:v,style:g}){let _=y(null);return m(()=>{let U=_.current;if(!U)return;if(U.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,U.append(z.content.cloneNode(!0))},[$]),G("div",{ref:_,class:v,style:g},void 0,!1,void 0,this)}function t_({node:$,expanded:v=!1}){let g=$.data.path,[_,U]=o(""),[z,J]=o(""),[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(!1),[P,X]=o(!1),Y=y(null),H=y(null),L=y(""),q=y(null),F=$.data.reviewActive;m(()=>{let S=!1;return(async()=>{let U$;if(g){let i=await TU(g);if(S)return;U$=i.content}else if($.data.content)U$=$.data.content;else{O(!0);return}U(U$);let c=await g6(U$);if(S)return;J(c),O(!0),v$($.id,{content:U$,rendered:c})})(),()=>{S=!0}},[g,$.id,$.data.content]);let N=Q(async(S)=>{let U$=S.target.value;U(U$),X(!0);let c=await g6(U$);J(c)},[]),C=Q(async(S)=>{if(!g){let c=await g6(S);J(c),X(!1),v$($.id,{content:S,rendered:c}),await Zv($.id,{content:S,data:{rendered:c}});return}k(!0);let U$=await cO(g,S);if(k(!1),U$.ok){let c=await g6(S);J(c),X(!1),v$($.id,{content:S,rendered:c,savedAt:U$.updatedAt}),await Zv($.id,{content:S,data:{rendered:c,savedAt:U$.updatedAt}})}},[g,$.id]),p=Q(async()=>{if(!P)return;await C(_)},[P,_,C]),r=Q((S)=>{if((S.metaKey||S.ctrlKey)&&S.key==="s"){S.preventDefault(),p();return}let U$=Y.current;if(U$&&jK(S,U$))return;if(U$&&S.key==="Tab")S.preventDefault(),TK(U$,S.shiftKey)},[p]);q.current=C;let n=Q((S)=>{if(U(S),X(!0),L.current=S,H.current!==null)window.clearTimeout(H.current);H.current=window.setTimeout(()=>{H.current=null,C(S)},800)},[C]),e=Q((S)=>{if(U(S),L.current=S,H.current!==null)window.clearTimeout(H.current),H.current=null;C(S)},[C]);m(()=>{return()=>{if(H.current===null)return;window.clearTimeout(H.current),H.current=null;let S=q.current;if(S)S(L.current)}},[$.id]);let u=F?G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(K&&v)return G("div",{class:"md-editor-expanded",onKeyDown:r,children:[G("div",{class:"md-editor-toolbar",children:[G("button",{type:"button",class:"md-toolbar-btn",onClick:()=>W(!1),children:"← Back to document"},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[g&&G("span",{class:"md-toolbar-path",children:g.split("/").pop()},void 0,!1,void 0,this),G("button",{type:"button",class:`md-toolbar-btn${P?" md-toolbar-btn-primary":""}`,onClick:p,disabled:!P||B,children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"md-editor-split",children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:Y,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(l2,{textareaRef:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(gz,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(K)return G("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:r,children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:Y,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(l2,{textareaRef:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(gz,{html:z,className:"md-preview"},void 0,!1,void 0,this),G("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[G("button",{type:"button",onClick:()=>W(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),G("button",{type:"button",onClick:p,disabled:!P||B,style:{padding:"4px 10px",fontSize:"11px",background:P?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${P?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:P?"var(--c-text)":"var(--c-dim)",cursor:P?"pointer":"default"},children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(v)return G("div",{style:{height:"100%",position:"relative"},children:[u,G("div",{class:"md-reader",children:b?G(H5,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:n,onSave:e},$.id,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"md-edit-fab",onClick:()=>W(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",position:"relative"},children:[u,G(gz,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"}},void 0,!1,void 0,this),!b&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),b&&!z&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>z6($.id),style:{position:"absolute",top:"4px",right:"4px",padding:"3px 8px",fontSize:"10px",background:"var(--c-panel-overlay)",border:"1px solid var(--c-line)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",opacity:0.7},onMouseEnter:(S)=>{S.target.style.opacity="1"},onMouseLeave:(S)=>{S.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var d_="pmx-canvas-ax",a_="pmx-canvas-ax-ack",pv="pmx-canvas-html-node",_z="pmx-canvas-ext-app-alive";var I5=37;function dH($){return $.type==="html"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function aH($){if($.type==="html")return $.data.presentation!==!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function Y5($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function zz($){return!Y5($)&&!dH($)}function L5($,v){if(!zz($)||v<=0)return null;return Math.min(v+37,600)}function Jz($){return aH($)&&!Y5($)}function q5($,v){if(!Jz($)||v<=0)return null;let g=Math.min(v+37+24,1400);return g>$.size.height+8?g:null}var I={};ev(I,{xor:()=>s7,xid:()=>A7,void:()=>n7,uuidv7:()=>H7,uuidv6:()=>k7,uuidv4:()=>P7,uuid:()=>B7,util:()=>j,url:()=>I7,uppercase:()=>o4,unknown:()=>Q$,union:()=>A$,undefined:()=>p7,ulid:()=>F7,uint64:()=>x7,uint32:()=>E7,tuple:()=>YG,trim:()=>e4,treeifyError:()=>Lz,transform:()=>F0,toUpperCase:()=>vU,toLowerCase:()=>$U,toJSONSchema:()=>d1,templateLiteral:()=>OW,symbol:()=>h7,superRefine:()=>lG,success:()=>JW,stringbool:()=>IW,stringFormat:()=>T7,string:()=>Z,strictObject:()=>a7,startsWith:()=>t4,slugify:()=>UU,size:()=>b4,setErrorMap:()=>XL,set:()=>UW,safeParseAsync:()=>tb,safeParse:()=>nb,safeEncodeAsync:()=>UG,safeEncode:()=>$G,safeDecodeAsync:()=>gG,safeDecode:()=>vG,registry:()=>w1,regexes:()=>Dv,regex:()=>h4,refine:()=>iG,record:()=>N$,readonly:()=>VG,property:()=>p1,promise:()=>KW,prettifyError:()=>qz,preprocess:()=>Zg,prefault:()=>rG,positive:()=>i1,pipe:()=>Ig,partialRecord:()=>e7,parseAsync:()=>ob,parse:()=>pb,overwrite:()=>mv,optional:()=>y$,object:()=>x,number:()=>Y$,nullish:()=>zW,nullable:()=>Hg,null:()=>WU,normalize:()=>s4,nonpositive:()=>x1,nonoptional:()=>uG,nonnegative:()=>h1,never:()=>w0,negative:()=>l1,nativeEnum:()=>gW,nanoid:()=>q7,nan:()=>bW,multipleOf:()=>R6,minSize:()=>dv,minLength:()=>G6,mime:()=>a4,meta:()=>kW,maxSize:()=>T6,maxLength:()=>G4,map:()=>vW,mac:()=>Q7,lte:()=>Nv,lt:()=>nv,lowercase:()=>p4,looseRecord:()=>$W,looseObject:()=>$v,locales:()=>Kg,literal:()=>t,length:()=>O4,lazy:()=>mG,ksuid:()=>Z7,keyof:()=>d7,jwt:()=>R7,json:()=>YW,iso:()=>f6,ipv6:()=>S7,ipv4:()=>M7,intersection:()=>BU,int64:()=>l7,int32:()=>c7,int:()=>U0,instanceof:()=>HW,includes:()=>n4,httpUrl:()=>Y7,hostname:()=>j7,hex:()=>V7,hash:()=>C7,guid:()=>W7,gte:()=>Hv,gt:()=>tv,globalRegistry:()=>e$,getErrorMap:()=>wL,function:()=>WW,fromJSONSchema:()=>qW,formatError:()=>dU,float64:()=>m7,float32:()=>f7,flattenError:()=>tU,file:()=>_W,exactOptional:()=>ZG,enum:()=>vv,endsWith:()=>d4,encodeAsync:()=>sb,encode:()=>db,emoji:()=>L7,email:()=>K7,e164:()=>D7,discriminatedUnion:()=>wg,describe:()=>PW,decodeAsync:()=>eb,decode:()=>ab,date:()=>t7,custom:()=>S0,cuid2:()=>w7,cuid:()=>X7,core:()=>O6,config:()=>l$,coerce:()=>hG,codec:()=>GW,clone:()=>kv,cidrv6:()=>r7,cidrv4:()=>N7,check:()=>BW,catch:()=>RG,boolean:()=>x$,bigint:()=>i7,base64url:()=>y7,base64:()=>u7,array:()=>J$,any:()=>o7,_function:()=>WW,_default:()=>SG,_ZodString:()=>g0,ZodXor:()=>PG,ZodXID:()=>K0,ZodVoid:()=>WG,ZodUnknown:()=>OG,ZodUnion:()=>Xg,ZodUndefined:()=>JG,ZodUUID:()=>av,ZodURL:()=>Yg,ZodULID:()=>O0,ZodType:()=>_$,ZodTuple:()=>IG,ZodTransform:()=>FG,ZodTemplateLiteral:()=>CG,ZodSymbol:()=>zG,ZodSuccess:()=>yG,ZodStringFormat:()=>M$,ZodString:()=>JU,ZodSet:()=>qG,ZodRecord:()=>Fg,ZodRealError:()=>Fv,ZodReadonly:()=>jG,ZodPromise:()=>cG,ZodPrefault:()=>NG,ZodPipe:()=>M0,ZodOptional:()=>A0,ZodObject:()=>qg,ZodNumberFormat:()=>K4,ZodNumber:()=>GU,ZodNullable:()=>MG,ZodNull:()=>bG,ZodNonOptional:()=>Z0,ZodNever:()=>KG,ZodNanoID:()=>J0,ZodNaN:()=>TG,ZodMap:()=>LG,ZodMAC:()=>_G,ZodLiteral:()=>XG,ZodLazy:()=>fG,ZodKSUID:()=>W0,ZodJWT:()=>q0,ZodIssueCode:()=>qL,ZodIntersection:()=>HG,ZodISOTime:()=>$0,ZodISODuration:()=>v0,ZodISODateTime:()=>s1,ZodISODate:()=>e1,ZodIPv6:()=>P0,ZodIPv4:()=>B0,ZodGUID:()=>kg,ZodFunction:()=>EG,ZodFirstPartyTypeKind:()=>xG,ZodFile:()=>wG,ZodExactOptional:()=>AG,ZodError:()=>YL,ZodEnum:()=>zU,ZodEmoji:()=>z0,ZodEmail:()=>_0,ZodE164:()=>L0,ZodDiscriminatedUnion:()=>kG,ZodDefault:()=>QG,ZodDate:()=>Lg,ZodCustomStringFormat:()=>bU,ZodCustom:()=>Ag,ZodCodec:()=>Q0,ZodCatch:()=>DG,ZodCUID2:()=>G0,ZodCUID:()=>b0,ZodCIDRv6:()=>H0,ZodCIDRv4:()=>k0,ZodBoolean:()=>OU,ZodBigIntFormat:()=>X0,ZodBigInt:()=>KU,ZodBase64URL:()=>Y0,ZodBase64:()=>I0,ZodArray:()=>BG,ZodAny:()=>GG,TimePrecision:()=>w9,NEVER:()=>bz,$output:()=>H9,$input:()=>I9,$brand:()=>Gz});var O6={};ev(O6,{version:()=>BJ,util:()=>j,treeifyError:()=>Lz,toJSONSchema:()=>d1,toDotPath:()=>M5,safeParseAsync:()=>eU,safeParse:()=>E4,safeEncodeAsync:()=>D5,safeEncode:()=>u5,safeDecodeAsync:()=>R5,safeDecode:()=>y5,registry:()=>w1,regexes:()=>Dv,process:()=>w$,prettifyError:()=>qz,parseAsync:()=>sU,parse:()=>aU,meta:()=>vb,locales:()=>Kg,isValidJWT:()=>s5,isValidBase64URL:()=>a5,isValidBase64:()=>TJ,initializeContext:()=>j6,globalRegistry:()=>e$,globalConfig:()=>EU,formatError:()=>dU,flattenError:()=>tU,finalize:()=>C6,extractDefs:()=>V6,encodeAsync:()=>N5,encode:()=>Q5,describe:()=>$b,decodeAsync:()=>r5,decode:()=>S5,createToJSONSchemaMethod:()=>gb,createStandardJSONSchemaMethod:()=>_U,config:()=>l$,clone:()=>kv,_xor:()=>oY,_xid:()=>D1,_void:()=>h9,_uuidv7:()=>Q1,_uuidv6:()=>M1,_uuidv4:()=>Z1,_uuid:()=>A1,_url:()=>Bg,_uppercase:()=>o4,_unknown:()=>l9,_union:()=>pY,_undefined:()=>c9,_ulid:()=>y1,_uint64:()=>f9,_uint32:()=>D9,_tuple:()=>dY,_trim:()=>e4,_transform:()=>gL,_toUpperCase:()=>vU,_toLowerCase:()=>$U,_templateLiteral:()=>BL,_symbol:()=>m9,_superRefine:()=>e9,_success:()=>GL,_stringbool:()=>Ub,_stringFormat:()=>gU,_string:()=>L9,_startsWith:()=>t4,_slugify:()=>UU,_size:()=>b4,_set:()=>eY,_safeParseAsync:()=>i4,_safeParse:()=>c4,_safeEncodeAsync:()=>J1,_safeEncode:()=>_1,_safeDecodeAsync:()=>b1,_safeDecode:()=>z1,_regex:()=>h4,_refine:()=>s9,_record:()=>aY,_readonly:()=>WL,_property:()=>p1,_promise:()=>kL,_positive:()=>i1,_pipe:()=>KL,_parseAsync:()=>m4,_parse:()=>f4,_overwrite:()=>mv,_optional:()=>_L,_number:()=>Q9,_nullable:()=>zL,_null:()=>E9,_normalize:()=>s4,_nonpositive:()=>x1,_nonoptional:()=>bL,_nonnegative:()=>h1,_never:()=>x9,_negative:()=>l1,_nativeEnum:()=>vL,_nanoid:()=>N1,_nan:()=>n9,_multipleOf:()=>R6,_minSize:()=>dv,_minLength:()=>G6,_min:()=>Hv,_mime:()=>a4,_maxSize:()=>T6,_maxLength:()=>G4,_max:()=>Nv,_map:()=>sY,_mac:()=>X9,_lte:()=>Nv,_lt:()=>nv,_lowercase:()=>p4,_literal:()=>UL,_length:()=>O4,_lazy:()=>PL,_ksuid:()=>R1,_jwt:()=>E1,_isoTime:()=>Z9,_isoDuration:()=>M9,_isoDateTime:()=>F9,_isoDate:()=>A9,_ipv6:()=>j1,_ipv4:()=>T1,_intersection:()=>tY,_int64:()=>C9,_int32:()=>y9,_int:()=>N9,_includes:()=>n4,_guid:()=>Wg,_gte:()=>Hv,_gt:()=>tv,_float64:()=>u9,_float32:()=>r9,_file:()=>d9,_enum:()=>$L,_endsWith:()=>d4,_encodeAsync:()=>U1,_encode:()=>$1,_emoji:()=>S1,_email:()=>F1,_e164:()=>c1,_discriminatedUnion:()=>nY,_default:()=>JL,_decodeAsync:()=>g1,_decode:()=>v1,_date:()=>p9,_custom:()=>a9,_cuid2:()=>u1,_cuid:()=>r1,_coercedString:()=>q9,_coercedNumber:()=>S9,_coercedDate:()=>o9,_coercedBoolean:()=>T9,_coercedBigint:()=>V9,_cidrv6:()=>C1,_cidrv4:()=>V1,_check:()=>b7,_catch:()=>OL,_boolean:()=>R9,_bigint:()=>j9,_base64url:()=>m1,_base64:()=>f1,_array:()=>t9,_any:()=>i9,TimePrecision:()=>w9,NEVER:()=>bz,JSONSchemaGenerator:()=>Eb,JSONSchema:()=>G7,Doc:()=>W1,$output:()=>H9,$input:()=>I9,$constructor:()=>w,$brand:()=>Gz,$ZodXor:()=>sJ,$ZodXID:()=>AJ,$ZodVoid:()=>nJ,$ZodUnknown:()=>pJ,$ZodUnion:()=>_g,$ZodUndefined:()=>lJ,$ZodUUID:()=>HJ,$ZodURL:()=>YJ,$ZodULID:()=>FJ,$ZodType:()=>$$,$ZodTuple:()=>q1,$ZodTransform:()=>b8,$ZodTemplateLiteral:()=>L8,$ZodSymbol:()=>iJ,$ZodSuccess:()=>P8,$ZodStringFormat:()=>Z$,$ZodString:()=>J4,$ZodSet:()=>g8,$ZodRegistry:()=>Y9,$ZodRecord:()=>v8,$ZodRealError:()=>wv,$ZodReadonly:()=>Y8,$ZodPromise:()=>X8,$ZodPrefault:()=>W8,$ZodPipe:()=>I8,$ZodOptional:()=>X1,$ZodObjectJIT:()=>aJ,$ZodObject:()=>v7,$ZodNumberFormat:()=>cJ,$ZodNumber:()=>Y1,$ZodNullable:()=>O8,$ZodNull:()=>xJ,$ZodNonOptional:()=>B8,$ZodNever:()=>oJ,$ZodNanoID:()=>qJ,$ZodNaN:()=>H8,$ZodMap:()=>U8,$ZodMAC:()=>yJ,$ZodLiteral:()=>z8,$ZodLazy:()=>w8,$ZodKSUID:()=>ZJ,$ZodJWT:()=>fJ,$ZodIntersection:()=>$8,$ZodISOTime:()=>SJ,$ZodISODuration:()=>NJ,$ZodISODateTime:()=>MJ,$ZodISODate:()=>QJ,$ZodIPv6:()=>uJ,$ZodIPv4:()=>rJ,$ZodGUID:()=>kJ,$ZodFunction:()=>q8,$ZodFile:()=>J8,$ZodExactOptional:()=>G8,$ZodError:()=>nU,$ZodEnum:()=>_8,$ZodEncodeError:()=>g4,$ZodEmoji:()=>LJ,$ZodEmail:()=>IJ,$ZodE164:()=>CJ,$ZodDiscriminatedUnion:()=>eJ,$ZodDefault:()=>K8,$ZodDate:()=>tJ,$ZodCustomStringFormat:()=>mJ,$ZodCustom:()=>F8,$ZodCodec:()=>zg,$ZodCheckUpperCase:()=>zJ,$ZodCheckStringFormat:()=>l4,$ZodCheckStartsWith:()=>bJ,$ZodCheckSizeEquals:()=>ez,$ZodCheckRegex:()=>gJ,$ZodCheckProperty:()=>OJ,$ZodCheckOverwrite:()=>WJ,$ZodCheckNumberFormat:()=>tz,$ZodCheckMultipleOf:()=>nz,$ZodCheckMinSize:()=>sz,$ZodCheckMinLength:()=>vJ,$ZodCheckMimeType:()=>KJ,$ZodCheckMaxSize:()=>az,$ZodCheckMaxLength:()=>$J,$ZodCheckLowerCase:()=>_J,$ZodCheckLessThan:()=>O1,$ZodCheckLengthEquals:()=>UJ,$ZodCheckIncludes:()=>JJ,$ZodCheckGreaterThan:()=>K1,$ZodCheckEndsWith:()=>GJ,$ZodCheckBigIntFormat:()=>dz,$ZodCheck:()=>S$,$ZodCatch:()=>k8,$ZodCUID2:()=>wJ,$ZodCUID:()=>XJ,$ZodCIDRv6:()=>RJ,$ZodCIDRv4:()=>DJ,$ZodBoolean:()=>gg,$ZodBigIntFormat:()=>EJ,$ZodBigInt:()=>L1,$ZodBase64URL:()=>VJ,$ZodBase64:()=>jJ,$ZodAsyncError:()=>ov,$ZodArray:()=>dJ,$ZodAny:()=>hJ});var bz=Object.freeze({status:"aborted"});function w($,v,g){function _(b,O){if(!b._zod)Object.defineProperty(b,"_zod",{value:{def:O,constr:J,traits:new Set},enumerable:!1});if(b._zod.traits.has($))return;b._zod.traits.add($),v(b,O);let K=J.prototype,W=Object.keys(K);for(let B=0;B<W.length;B++){let k=W[B];if(!(k in b))b[k]=K[k].bind(b)}}let U=g?.Parent??Object;class z extends U{}Object.defineProperty(z,"name",{value:$});function J(b){var O;let K=g?.Parent?new z:this;_(K,b),(O=K._zod).deferred??(O.deferred=[]);for(let W of K._zod.deferred)W();return K}return Object.defineProperty(J,"init",{value:_}),Object.defineProperty(J,Symbol.hasInstance,{value:(b)=>{if(g?.Parent&&b instanceof g.Parent)return!0;return b?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var Gz=Symbol("zod_brand");class ov extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class g4 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var EU={};function l$($){if($)Object.assign(EU,$);return EU}var j={};ev(j,{unwrapMessage:()=>iU,uint8ArrayToHex:()=>FI,uint8ArrayToBase64url:()=>XI,uint8ArrayToBase64:()=>F5,stringifyPrimitive:()=>D,slugify:()=>Wz,shallowClone:()=>Pz,safeExtend:()=>kI,required:()=>YI,randomString:()=>bI,propertyKeyTypes:()=>hU,promiseAllObject:()=>JI,primitiveTypes:()=>kz,prefixIssues:()=>Sv,pick:()=>WI,partial:()=>II,parsedType:()=>R,optionalKeys:()=>Hz,omit:()=>BI,objectClone:()=>gI,numKeys:()=>GI,nullish:()=>r6,normalizeParams:()=>V,mergeDefs:()=>b6,merge:()=>HI,jsonStringifyReplacer:()=>j4,joinValues:()=>A,issue:()=>C4,isPlainObject:()=>y6,isObject:()=>_4,hexToUint8Array:()=>wI,getSizableOrigin:()=>pU,getParsedType:()=>OI,getLengthableOrigin:()=>oU,getEnumValues:()=>lU,getElementAtPath:()=>zI,floatSafeRemainder:()=>Kz,finalizeIssue:()=>Xv,extend:()=>PI,escapeRegex:()=>yv,esc:()=>s_,defineLazy:()=>z$,createTransparentProxy:()=>KI,cloneDef:()=>_I,clone:()=>kv,cleanRegex:()=>xU,cleanEnum:()=>LI,captureStackTrace:()=>e_,cached:()=>V4,base64urlToUint8Array:()=>qI,base64ToUint8Array:()=>w5,assignProp:()=>u6,assertNotEqual:()=>eH,assertNever:()=>vI,assertIs:()=>$I,assertEqual:()=>sH,assert:()=>UI,allowsEval:()=>Bz,aborted:()=>D6,NUMBER_FORMAT_RANGES:()=>Iz,Class:()=>A5,BIGINT_FORMAT_RANGES:()=>Yz});function sH($){return $}function eH($){return $}function $I($){}function vI($){throw Error("Unexpected value in exhaustive check")}function UI($){}function lU($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,U])=>v.indexOf(+_)===-1).map(([_,U])=>U)}function A($,v="|"){return $.map((g)=>D(g)).join(v)}function j4($,v){if(typeof v==="bigint")return v.toString();return v}function V4($){return{get value(){{let g=$();return Object.defineProperty(this,"value",{value:g}),g}throw Error("cached value already set")}}}function r6($){return $===null||$===void 0}function xU($){let v=$.startsWith("^")?1:0,g=$.endsWith("$")?$.length-1:$.length;return $.slice(v,g)}function Kz($,v){let g=($.toString().split(".")[1]||"").length,_=v.toString(),U=(_.split(".")[1]||"").length;if(U===0&&/\d?e-\d?/.test(_)){let O=_.match(/\d?e-(\d?)/);if(O?.[1])U=Number.parseInt(O[1])}let z=g>U?g:U,J=Number.parseInt($.toFixed(z).replace(".","")),b=Number.parseInt(v.toFixed(z).replace(".",""));return J%b/10**z}var X5=Symbol("evaluating");function z$($,v,g){let _=void 0;Object.defineProperty($,v,{get(){if(_===X5)return;if(_===void 0)_=X5,_=g();return _},set(U){Object.defineProperty($,v,{value:U})},configurable:!0})}function gI($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function u6($,v,g){Object.defineProperty($,v,{value:g,writable:!0,enumerable:!0,configurable:!0})}function b6(...$){let v={};for(let g of $){let _=Object.getOwnPropertyDescriptors(g);Object.assign(v,_)}return Object.defineProperties({},v)}function _I($){return b6($._zod.def)}function zI($,v){if(!v)return $;return v.reduce((g,_)=>g?.[_],$)}function JI($){let v=Object.keys($),g=v.map((_)=>$[_]);return Promise.all(g).then((_)=>{let U={};for(let z=0;z<v.length;z++)U[v[z]]=_[z];return U})}function bI($=10){let g="";for(let _=0;_<$;_++)g+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return g}function s_($){return JSON.stringify($)}function Wz($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var e_="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function _4($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var Bz=V4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function y6($){if(_4($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let g=v.prototype;if(_4(g)===!1)return!1;if(Object.prototype.hasOwnProperty.call(g,"isPrototypeOf")===!1)return!1;return!0}function Pz($){if(y6($))return{...$};if(Array.isArray($))return[...$];return $}function GI($){let v=0;for(let g in $)if(Object.prototype.hasOwnProperty.call($,g))v++;return v}var OI=($)=>{let v=typeof $;switch(v){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${v}`)}},hU=new Set(["string","number","symbol"]),kz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yv($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kv($,v,g){let _=new $._zod.constr(v??$._zod.def);if(!v||g?.parent)_._zod.parent=$;return _}function V($){let v=$;if(!v)return{};if(typeof v==="string")return{error:()=>v};if(v?.message!==void 0){if(v?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");v.error=v.message}if(delete v.message,typeof v.error==="string")return{...v,error:()=>v.error};return v}function KI($){let v;return new Proxy({},{get(g,_,U){return v??(v=$()),Reflect.get(v,_,U)},set(g,_,U,z){return v??(v=$()),Reflect.set(v,_,U,z)},has(g,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(g,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(g){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(g,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(g,_,U){return v??(v=$()),Reflect.defineProperty(v,_,U)}})}function D($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function Hz($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var Iz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Yz={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function WI($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={};for(let b in v){if(!(b in g.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;J[b]=g.shape[b]}return u6(this,"shape",J),J},checks:[]});return kv($,z)}function BI($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={...$._zod.def.shape};for(let b in v){if(!(b in g.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;delete J[b]}return u6(this,"shape",J),J},checks:[]});return kv($,z)}function PI($,v){if(!y6(v))throw Error("Invalid input to extend: expected a plain object");let g=$._zod.def.checks;if(g&&g.length>0){let z=$._zod.def.shape;for(let J in v)if(Object.getOwnPropertyDescriptor(z,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let U=b6($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return u6(this,"shape",z),z}});return kv($,U)}function kI($,v){if(!y6(v))throw Error("Invalid input to safeExtend: expected a plain object");let g=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return u6(this,"shape",_),_}});return kv($,g)}function HI($,v){let g=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return u6(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return kv($,g)}function II($,v,g){let U=v._zod.def.checks;if(U&&U.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=b6(v._zod.def,{get shape(){let b=v._zod.def.shape,O={...b};if(g)for(let K in g){if(!(K in b))throw Error(`Unrecognized key: "${K}"`);if(!g[K])continue;O[K]=$?new $({type:"optional",innerType:b[K]}):b[K]}else for(let K in b)O[K]=$?new $({type:"optional",innerType:b[K]}):b[K];return u6(this,"shape",O),O},checks:[]});return kv(v,J)}function YI($,v,g){let _=b6(v._zod.def,{get shape(){let U=v._zod.def.shape,z={...U};if(g)for(let J in g){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!g[J])continue;z[J]=new $({type:"nonoptional",innerType:U[J]})}else for(let J in U)z[J]=new $({type:"nonoptional",innerType:U[J]});return u6(this,"shape",z),z}});return kv(v,_)}function D6($,v=0){if($.aborted===!0)return!0;for(let g=v;g<$.issues.length;g++)if($.issues[g]?.continue!==!0)return!0;return!1}function Sv($,v){return v.map((g)=>{var _;return(_=g).path??(_.path=[]),g.path.unshift($),g})}function iU($){return typeof $==="string"?$:$?.message}function Xv($,v,g){let _={...$,path:$.path??[]};if(!$.message){let U=iU($.inst?._zod.def?.error?.($))??iU(v?.error?.($))??iU(g.customError?.($))??iU(g.localeError?.($))??"Invalid input";_.message=U}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function pU($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function oU($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function R($){let v=typeof $;switch(v){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let g=$;if(g&&Object.getPrototypeOf(g)!==Object.prototype&&"constructor"in g&&g.constructor)return g.constructor.name}}return v}function C4(...$){let[v,g,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:g,inst:_};return{...v}}function LI($){return Object.entries($).filter(([v,g])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function w5($){let v=atob($),g=new Uint8Array(v.length);for(let _=0;_<v.length;_++)g[_]=v.charCodeAt(_);return g}function F5($){let v="";for(let g=0;g<$.length;g++)v+=String.fromCharCode($[g]);return btoa(v)}function qI($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),g="=".repeat((4-v.length%4)%4);return w5(v+g)}function XI($){return F5($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wI($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let g=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)g[_/2]=Number.parseInt(v.slice(_,_+2),16);return g}function FI($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class A5{constructor(...$){}}var Z5=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,j4,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},nU=w("$ZodError",Z5),wv=w("$ZodError",Z5,{Parent:Error});function tU($,v=(g)=>g.message){let g={},_=[];for(let U of $.issues)if(U.path.length>0)g[U.path[0]]=g[U.path[0]]||[],g[U.path[0]].push(v(U));else _.push(v(U));return{formErrors:_,fieldErrors:g}}function dU($,v=(g)=>g.message){let g={_errors:[]},_=(U)=>{for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>_({issues:J}));else if(z.code==="invalid_key")_({issues:z.issues});else if(z.code==="invalid_element")_({issues:z.issues});else if(z.path.length===0)g._errors.push(v(z));else{let J=g,b=0;while(b<z.path.length){let O=z.path[b];if(b!==z.path.length-1)J[O]=J[O]||{_errors:[]};else J[O]=J[O]||{_errors:[]},J[O]._errors.push(v(z));J=J[O],b++}}};return _($),g}function Lz($,v=(g)=>g.message){let g={errors:[]},_=(U,z=[])=>{var J,b;for(let O of U.issues)if(O.code==="invalid_union"&&O.errors.length)O.errors.map((K)=>_({issues:K},O.path));else if(O.code==="invalid_key")_({issues:O.issues},O.path);else if(O.code==="invalid_element")_({issues:O.issues},O.path);else{let K=[...z,...O.path];if(K.length===0){g.errors.push(v(O));continue}let W=g,B=0;while(B<K.length){let k=K[B],P=B===K.length-1;if(typeof k==="string")W.properties??(W.properties={}),(J=W.properties)[k]??(J[k]={errors:[]}),W=W.properties[k];else W.items??(W.items=[]),(b=W.items)[k]??(b[k]={errors:[]}),W=W.items[k];if(P)W.errors.push(v(O));B++}}};return _($),g}function M5($){let v=[],g=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of g)if(typeof _==="number")v.push(`[${_}]`);else if(typeof _==="symbol")v.push(`[${JSON.stringify(String(_))}]`);else if(/[^\w$]/.test(_))v.push(`[${JSON.stringify(_)}]`);else{if(v.length)v.push(".");v.push(_)}return v.join("")}function qz($){let v=[],g=[...$.issues].sort((_,U)=>(_.path??[]).length-(U.path??[]).length);for(let _ of g)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${M5(_.path)}`);return v.join(`
108
+ `)}var f4=($)=>(v,g,_,U)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)throw new ov;if(J.issues.length){let b=new(U?.Err??$)(J.issues.map((O)=>Xv(O,z,l$())));throw e_(b,U?.callee),b}return J.value},aU=f4(wv),m4=($)=>async(v,g,_,U)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let b=new(U?.Err??$)(J.issues.map((O)=>Xv(O,z,l$())));throw e_(b,U?.callee),b}return J.value},sU=m4(wv),c4=($)=>(v,g,_)=>{let U=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)throw new ov;return z.issues.length?{success:!1,error:new($??nU)(z.issues.map((J)=>Xv(J,U,l$())))}:{success:!0,data:z.value}},E4=c4(wv),i4=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Xv(J,U,l$())))}:{success:!0,data:z.value}},eU=i4(wv),$1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return f4($)(v,g,U)},Q5=$1(wv),v1=($)=>(v,g,_)=>{return f4($)(v,g,_)},S5=v1(wv),U1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return m4($)(v,g,U)},N5=U1(wv),g1=($)=>async(v,g,_)=>{return m4($)(v,g,_)},r5=g1(wv),_1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return c4($)(v,g,U)},u5=_1(wv),z1=($)=>(v,g,_)=>{return c4($)(v,g,_)},y5=z1(wv),J1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return i4($)(v,g,U)},D5=J1(wv),b1=($)=>async(v,g,_)=>{return i4($)(v,g,_)},R5=b1(wv);var Dv={};ev(Dv,{xid:()=>Az,uuid7:()=>SI,uuid6:()=>QI,uuid4:()=>MI,uuid:()=>z4,uppercase:()=>oz,unicodeEmail:()=>T5,undefined:()=>hz,ulid:()=>Fz,time:()=>fz,string:()=>cz,sha512_hex:()=>nI,sha512_base64url:()=>dI,sha512_base64:()=>tI,sha384_hex:()=>hI,sha384_base64url:()=>oI,sha384_base64:()=>pI,sha256_hex:()=>iI,sha256_base64url:()=>xI,sha256_base64:()=>lI,sha1_hex:()=>mI,sha1_base64url:()=>EI,sha1_base64:()=>cI,rfc5322Email:()=>rI,number:()=>$g,null:()=>xz,nanoid:()=>Mz,md5_hex:()=>VI,md5_base64url:()=>fI,md5_base64:()=>CI,mac:()=>Dz,lowercase:()=>pz,ksuid:()=>Zz,ipv6:()=>yz,ipv4:()=>uz,integer:()=>iz,idnEmail:()=>uI,html5Email:()=>NI,hostname:()=>RI,hex:()=>jI,guid:()=>Sz,extendedDuration:()=>ZI,emoji:()=>rz,email:()=>Nz,e164:()=>Vz,duration:()=>Qz,domain:()=>TI,datetime:()=>mz,date:()=>Cz,cuid2:()=>wz,cuid:()=>Xz,cidrv6:()=>Tz,cidrv4:()=>Rz,browserEmail:()=>yI,boolean:()=>lz,bigint:()=>Ez,base64url:()=>G1,base64:()=>jz});var Xz=/^[cC][^\s-]{8,}$/,wz=/^[0-9a-z]+$/,Fz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Az=/^[0-9a-vA-V]{20}$/,Zz=/^[A-Za-z0-9]{27}$/,Mz=/^[a-zA-Z0-9_-]{21}$/,Qz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ZI=/^[-+]?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)?)??$/,Sz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,z4=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},MI=z4(4),QI=z4(6),SI=z4(7),Nz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,NI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rI=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,T5=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,uI=T5,yI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,DI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function rz(){return new RegExp(DI,"u")}var uz=/^(?:(?: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])$/,yz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dz=($)=>{let v=yv($??":");return new RegExp(`^(?:[0-9A-F]{2}${v}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${v}){5}[0-9a-f]{2}$`)},Rz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Tz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,G1=/^[A-Za-z0-9_-]*$/,RI=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,TI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Vz=/^\+[1-9]\d{6,14}$/,j5="(?:(?:\\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])))",Cz=new RegExp(`^${j5}$`);function V5($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function fz($){return new RegExp(`^${V5($)}$`)}function mz($){let v=V5({precision:$.precision}),g=["Z"];if($.local)g.push("");if($.offset)g.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${g.join("|")})`;return new RegExp(`^${j5}T(?:${_})$`)}var cz=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},Ez=/^-?\d+n?$/,iz=/^-?\d+$/,$g=/^-?\d+(?:\.\d+)?$/,lz=/^(?:true|false)$/i,xz=/^null$/i;var hz=/^undefined$/i;var pz=/^[^A-Z]*$/,oz=/^[^a-z]*$/,jI=/^[0-9a-fA-F]*$/;function vg($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function Ug($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var VI=/^[0-9a-fA-F]{32}$/,CI=vg(22,"=="),fI=Ug(22),mI=/^[0-9a-fA-F]{40}$/,cI=vg(27,"="),EI=Ug(27),iI=/^[0-9a-fA-F]{64}$/,lI=vg(43,"="),xI=Ug(43),hI=/^[0-9a-fA-F]{96}$/,pI=vg(64,""),oI=Ug(64),nI=/^[0-9a-fA-F]{128}$/,tI=vg(86,"=="),dI=Ug(86);var S$=w("$ZodCheck",($,v)=>{var g;$._zod??($._zod={}),$._zod.def=v,(g=$._zod).onattach??(g.onattach=[])}),f5={number:"number",bigint:"bigint",object:"date"},O1=w("$ZodCheckLessThan",($,v)=>{S$.init($,v);let g=f5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)U.maximum=v.value;else U.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:g,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),K1=w("$ZodCheckGreaterThan",($,v)=>{S$.init($,v);let g=f5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)U.minimum=v.value;else U.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:g,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),nz=w("$ZodCheckMultipleOf",($,v)=>{S$.init($,v),$._zod.onattach.push((g)=>{var _;(_=g._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(g)=>{if(typeof g.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof g.value==="bigint"?g.value%v.value===BigInt(0):Kz(g.value,v.value)===0)return;g.issues.push({origin:typeof g.value,code:"not_multiple_of",divisor:v.value,input:g.value,inst:$,continue:!v.abort})}}),tz=w("$ZodCheckNumberFormat",($,v)=>{S$.init($,v),v.format=v.format||"float64";let g=v.format?.includes("int"),_=g?"int":"number",[U,z]=Iz[v.format];$._zod.onattach.push((J)=>{let b=J._zod.bag;if(b.format=v.format,b.minimum=U,b.maximum=z,g)b.pattern=iz}),$._zod.check=(J)=>{let b=J.value;if(g){if(!Number.isInteger(b)){J.issues.push({expected:_,format:v.format,code:"invalid_type",continue:!1,input:b,inst:$});return}if(!Number.isSafeInteger(b)){if(b>0)J.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});else J.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});return}}if(b<U)J.issues.push({origin:"number",input:b,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(b>z)J.issues.push({origin:"number",input:b,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!v.abort})}}),dz=w("$ZodCheckBigIntFormat",($,v)=>{S$.init($,v);let[g,_]=Yz[v.format];$._zod.onattach.push((U)=>{let z=U._zod.bag;z.format=v.format,z.minimum=g,z.maximum=_}),$._zod.check=(U)=>{let z=U.value;if(z<g)U.issues.push({origin:"bigint",input:z,code:"too_small",minimum:g,inclusive:!0,inst:$,continue:!v.abort});if(z>_)U.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),az=w("$ZodCheckMaxSize",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.size<=v.maximum)return;_.issues.push({origin:pU(U),code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),sz=w("$ZodCheckMinSize",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.size>=v.minimum)return;_.issues.push({origin:pU(U),code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),ez=w("$ZodCheckSizeEquals",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.size,U.maximum=v.size,U.size=v.size}),$._zod.check=(_)=>{let U=_.value,z=U.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:pU(U),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),$J=w("$ZodCheckMaxLength",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.length<=v.maximum)return;let J=oU(U);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),vJ=w("$ZodCheckMinLength",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.length>=v.minimum)return;let J=oU(U);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),UJ=w("$ZodCheckLengthEquals",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.length,U.maximum=v.length,U.length=v.length}),$._zod.check=(_)=>{let U=_.value,z=U.length;if(z===v.length)return;let J=oU(U),b=z>v.length;_.issues.push({origin:J,...b?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),l4=w("$ZodCheckStringFormat",($,v)=>{var g,_;if(S$.init($,v),$._zod.onattach.push((U)=>{let z=U._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(g=$._zod).check??(g.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:v.format,input:U.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),gJ=w("$ZodCheckRegex",($,v)=>{l4.init($,v),$._zod.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:"regex",input:g.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),_J=w("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=pz),l4.init($,v)}),zJ=w("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=oz),l4.init($,v)}),JJ=w("$ZodCheckIncludes",($,v)=>{S$.init($,v);let g=yv(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${g}`:g);v.pattern=_,$._zod.onattach.push((U)=>{let z=U._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(U)=>{if(U.value.includes(v.includes,v.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:U.value,inst:$,continue:!v.abort})}}),bJ=w("$ZodCheckStartsWith",($,v)=>{S$.init($,v);let g=new RegExp(`^${yv(v.prefix)}.*`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.startsWith(v.prefix))return;_.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:v.prefix,input:_.value,inst:$,continue:!v.abort})}}),GJ=w("$ZodCheckEndsWith",($,v)=>{S$.init($,v);let g=new RegExp(`.*${yv(v.suffix)}$`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.endsWith(v.suffix))return;_.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:v.suffix,input:_.value,inst:$,continue:!v.abort})}});function C5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues))}var OJ=w("$ZodCheckProperty",($,v)=>{S$.init($,v),$._zod.check=(g)=>{let _=v.schema._zod.run({value:g.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((U)=>C5(U,g,v.property));C5(_,g,v.property);return}}),KJ=w("$ZodCheckMimeType",($,v)=>{S$.init($,v);let g=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(g.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),WJ=w("$ZodCheckOverwrite",($,v)=>{S$.init($,v),$._zod.check=(g)=>{g.value=v.tx(g.value)}});class W1{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let g=$.split(`
109
+ `).filter((z)=>z),_=Math.min(...g.map((z)=>z.length-z.trimStart().length)),U=g.map((z)=>z.slice(_)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of U)this.content.push(z)}compile(){let $=Function,v=this?.args,_=[...(this?.content??[""]).map((U)=>` ${U}`)];return new $(...v,_.join(`
110
+ `))}}var BJ={major:4,minor:3,patch:6};var $$=w("$ZodType",($,v)=>{var g;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=BJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let U of _)for(let z of U._zod.onattach)z($);if(_.length===0)(g=$._zod).deferred??(g.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,b,O)=>{let K=D6(J),W;for(let B of b){if(B._zod.def.when){if(!B._zod.def.when(J))continue}else if(K)continue;let k=J.issues.length,P=B._zod.check(J);if(P instanceof Promise&&O?.async===!1)throw new ov;if(W||P instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await P,J.issues.length===k)return;if(!K)K=D6(J,k)});else{if(J.issues.length===k)continue;if(!K)K=D6(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,b,O)=>{if(D6(J))return J.aborted=!0,J;let K=U(b,_,O);if(K instanceof Promise){if(O.async===!1)throw new ov;return K.then((W)=>$._zod.parse(W,O))}return $._zod.parse(K,O)};$._zod.run=(J,b)=>{if(b.skipChecks)return $._zod.parse(J,b);if(b.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...b,skipChecks:!0});if(K instanceof Promise)return K.then((W)=>{return z(W,J,b)});return z(K,J,b)}let O=$._zod.parse(J,b);if(O instanceof Promise){if(b.async===!1)throw new ov;return O.then((K)=>U(K,_,b))}return U(O,_,b)}}z$($,"~standard",()=>({validate:(U)=>{try{let z=E4($,U);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return eU($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),J4=w("$ZodString",($,v)=>{$$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??cz($._zod.bag),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=String(g.value)}catch(U){}if(typeof g.value==="string")return g;return g.issues.push({expected:"string",code:"invalid_type",input:g.value,inst:$}),g}}),Z$=w("$ZodStringFormat",($,v)=>{l4.init($,v),J4.init($,v)}),kJ=w("$ZodGUID",($,v)=>{v.pattern??(v.pattern=Sz),Z$.init($,v)}),HJ=w("$ZodUUID",($,v)=>{if(v.version){let _={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(_===void 0)throw Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=z4(_))}else v.pattern??(v.pattern=z4());Z$.init($,v)}),IJ=w("$ZodEmail",($,v)=>{v.pattern??(v.pattern=Nz),Z$.init($,v)}),YJ=w("$ZodURL",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{try{let _=g.value.trim(),U=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(U.hostname))g.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:g.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))g.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:g.value,inst:$,continue:!v.abort})}if(v.normalize)g.value=U.href;else g.value=_;return}catch(_){g.issues.push({code:"invalid_format",format:"url",input:g.value,inst:$,continue:!v.abort})}}}),LJ=w("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=rz()),Z$.init($,v)}),qJ=w("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=Mz),Z$.init($,v)}),XJ=w("$ZodCUID",($,v)=>{v.pattern??(v.pattern=Xz),Z$.init($,v)}),wJ=w("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=wz),Z$.init($,v)}),FJ=w("$ZodULID",($,v)=>{v.pattern??(v.pattern=Fz),Z$.init($,v)}),AJ=w("$ZodXID",($,v)=>{v.pattern??(v.pattern=Az),Z$.init($,v)}),ZJ=w("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=Zz),Z$.init($,v)}),MJ=w("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=mz(v)),Z$.init($,v)}),QJ=w("$ZodISODate",($,v)=>{v.pattern??(v.pattern=Cz),Z$.init($,v)}),SJ=w("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=fz(v)),Z$.init($,v)}),NJ=w("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=Qz),Z$.init($,v)}),rJ=w("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=uz),Z$.init($,v),$._zod.bag.format="ipv4"}),uJ=w("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=yz),Z$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(g)=>{try{new URL(`http://[${g.value}]`)}catch{g.issues.push({code:"invalid_format",format:"ipv6",input:g.value,inst:$,continue:!v.abort})}}}),yJ=w("$ZodMAC",($,v)=>{v.pattern??(v.pattern=Dz(v.delimiter)),Z$.init($,v),$._zod.bag.format="mac"}),DJ=w("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=Rz),Z$.init($,v)}),RJ=w("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=Tz),Z$.init($,v),$._zod.check=(g)=>{let _=g.value.split("/");try{if(_.length!==2)throw Error();let[U,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{g.issues.push({code:"invalid_format",format:"cidrv6",input:g.value,inst:$,continue:!v.abort})}}});function TJ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var jJ=w("$ZodBase64",($,v)=>{v.pattern??(v.pattern=jz),Z$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(g)=>{if(TJ(g.value))return;g.issues.push({code:"invalid_format",format:"base64",input:g.value,inst:$,continue:!v.abort})}});function a5($){if(!G1.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),g=v.padEnd(Math.ceil(v.length/4)*4,"=");return TJ(g)}var VJ=w("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=G1),Z$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(g)=>{if(a5(g.value))return;g.issues.push({code:"invalid_format",format:"base64url",input:g.value,inst:$,continue:!v.abort})}}),CJ=w("$ZodE164",($,v)=>{v.pattern??(v.pattern=Vz),Z$.init($,v)});function s5($,v=null){try{let g=$.split(".");if(g.length!==3)return!1;let[_]=g;if(!_)return!1;let U=JSON.parse(atob(_));if("typ"in U&&U?.typ!=="JWT")return!1;if(!U.alg)return!1;if(v&&(!("alg"in U)||U.alg!==v))return!1;return!0}catch{return!1}}var fJ=w("$ZodJWT",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(s5(g.value,v.alg))return;g.issues.push({code:"invalid_format",format:"jwt",input:g.value,inst:$,continue:!v.abort})}}),mJ=w("$ZodCustomStringFormat",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(v.fn(g.value))return;g.issues.push({code:"invalid_format",format:v.format,input:g.value,inst:$,continue:!v.abort})}}),Y1=w("$ZodNumber",($,v)=>{$$.init($,v),$._zod.pattern=$._zod.bag.pattern??$g,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Number(g.value)}catch(J){}let U=g.value;if(typeof U==="number"&&!Number.isNaN(U)&&Number.isFinite(U))return g;let z=typeof U==="number"?Number.isNaN(U)?"NaN":!Number.isFinite(U)?"Infinity":void 0:void 0;return g.issues.push({expected:"number",code:"invalid_type",input:U,inst:$,...z?{received:z}:{}}),g}}),cJ=w("$ZodNumberFormat",($,v)=>{tz.init($,v),Y1.init($,v)}),gg=w("$ZodBoolean",($,v)=>{$$.init($,v),$._zod.pattern=lz,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Boolean(g.value)}catch(z){}let U=g.value;if(typeof U==="boolean")return g;return g.issues.push({expected:"boolean",code:"invalid_type",input:U,inst:$}),g}}),L1=w("$ZodBigInt",($,v)=>{$$.init($,v),$._zod.pattern=Ez,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=BigInt(g.value)}catch(U){}if(typeof g.value==="bigint")return g;return g.issues.push({expected:"bigint",code:"invalid_type",input:g.value,inst:$}),g}}),EJ=w("$ZodBigIntFormat",($,v)=>{dz.init($,v),L1.init($,v)}),iJ=w("$ZodSymbol",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U==="symbol")return g;return g.issues.push({expected:"symbol",code:"invalid_type",input:U,inst:$}),g}}),lJ=w("$ZodUndefined",($,v)=>{$$.init($,v),$._zod.pattern=hz,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"undefined",code:"invalid_type",input:U,inst:$}),g}}),xJ=w("$ZodNull",($,v)=>{$$.init($,v),$._zod.pattern=xz,$._zod.values=new Set([null]),$._zod.parse=(g,_)=>{let U=g.value;if(U===null)return g;return g.issues.push({expected:"null",code:"invalid_type",input:U,inst:$}),g}}),hJ=w("$ZodAny",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),pJ=w("$ZodUnknown",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),oJ=w("$ZodNever",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return g.issues.push({expected:"never",code:"invalid_type",input:g.value,inst:$}),g}}),nJ=w("$ZodVoid",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"void",code:"invalid_type",input:U,inst:$}),g}}),tJ=w("$ZodDate",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=new Date(g.value)}catch(b){}let U=g.value,z=U instanceof Date;if(z&&!Number.isNaN(U.getTime()))return g;return g.issues.push({expected:"date",code:"invalid_type",input:U,...z?{received:"Invalid Date"}:{},inst:$}),g}});function c5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var dJ=w("$ZodArray",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!Array.isArray(U))return g.issues.push({expected:"array",code:"invalid_type",input:U,inst:$}),g;g.value=Array(U.length);let z=[];for(let J=0;J<U.length;J++){let b=U[J],O=v.element._zod.run({value:b,issues:[]},_);if(O instanceof Promise)z.push(O.then((K)=>c5(K,g,J)));else c5(O,g,J)}if(z.length)return Promise.all(z).then(()=>g);return g}});function I1($,v,g,_,U){if($.issues.length){if(U&&!(g in _))return;v.issues.push(...Sv(g,$.issues))}if($.value===void 0){if(g in _)v.value[g]=void 0}else v.value[g]=$.value}function e5($){let v=Object.keys($.shape);for(let _ of v)if(!$.shape?.[_]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${_}": expected a Zod schema`);let g=Hz($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(g)}}function $7($,v,g,_,U,z){let J=[],b=U.keySet,O=U.catchall._zod,K=O.def.type,W=O.optout==="optional";for(let B in v){if(b.has(B))continue;if(K==="never"){J.push(B);continue}let k=O.run({value:v[B],issues:[]},_);if(k instanceof Promise)$.push(k.then((P)=>I1(P,g,B,v,W)));else I1(k,g,B,v,W)}if(J.length)g.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return g;return Promise.all($).then(()=>{return g})}var v7=w("$ZodObject",($,v)=>{if($$.init($,v),!Object.getOwnPropertyDescriptor(v,"shape")?.get){let b=v.shape;Object.defineProperty(v,"shape",{get:()=>{let O={...b};return Object.defineProperty(v,"shape",{value:O}),O}})}let _=V4(()=>e5(v));z$($._zod,"propValues",()=>{let b=v.shape,O={};for(let K in b){let W=b[K]._zod;if(W.values){O[K]??(O[K]=new Set);for(let B of W.values)O[K].add(B)}}return O});let U=_4,z=v.catchall,J;$._zod.parse=(b,O)=>{J??(J=_.value);let K=b.value;if(!U(K))return b.issues.push({expected:"object",code:"invalid_type",input:K,inst:$}),b;b.value={};let W=[],B=J.shape;for(let k of J.keys){let P=B[k],X=P._zod.optout==="optional",Y=P._zod.run({value:K[k],issues:[]},O);if(Y instanceof Promise)W.push(Y.then((H)=>I1(H,b,k,K,X)));else I1(Y,b,k,K,X)}if(!z)return W.length?Promise.all(W).then(()=>b):b;return $7(W,K,b,O,_.value,$)}}),aJ=w("$ZodObjectJIT",($,v)=>{v7.init($,v);let g=$._zod.parse,_=V4(()=>e5(v)),U=(k)=>{let P=new W1(["shape","payload","ctx"]),X=_.value,Y=(F)=>{let N=s_(F);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};P.write("const input = payload.value;");let H=Object.create(null),L=0;for(let F of X.keys)H[F]=`key_${L++}`;P.write("const newResult = {};");for(let F of X.keys){let N=H[F],C=s_(F),r=k[F]?._zod?.optout==="optional";if(P.write(`const ${N} = ${Y(F)};`),r)P.write(`
111
111
  if (${N}.issues.length) {
112
112
  if (${C} in input) {
113
113
  payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
@@ -141,15 +141,15 @@ ${g}
141
141
  newResult[${C}] = ${N}.value;
142
142
  }
143
143
 
144
- `)}P.write("payload.value = newResult;"),P.write("return payload;");let q=P.compile();return(w,N)=>q(k,w,N)},z,J=e6,b=!jg.jitless,K=b&&Uz.value,W=v.catchall,B;$._zod.parse=(k,P)=>{B??(B=_.value);let F=k.value;if(!J(F))return k.issues.push({expected:"object",code:"invalid_type",input:F,inst:$}),k;if(b&&K&&P?.async===!1&&P.jitless!==!0){if(!z)z=g(v.shape);if(k=z(k,P),!W)return k;return o5([],F,k,P,B,$)}return U(k,P)}});function T5($,v,U,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let g=$.filter((z)=>!u6(z));if(g.length===1)return v.value=g[0].value,g[0];return v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:$.map((z)=>z.issues.map((J)=>Fv(J,_,l$())))}),v}var sg=X("$ZodUnion",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.options.some((g)=>g._zod.optin==="optional")?"optional":void 0),z$($._zod,"optout",()=>v.options.some((g)=>g._zod.optout==="optional")?"optional":void 0),z$($._zod,"values",()=>{if(v.options.every((g)=>g._zod.values))return new Set(v.options.flatMap((g)=>Array.from(g._zod.values)));return}),z$($._zod,"pattern",()=>{if(v.options.every((g)=>g._zod.pattern)){let g=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${g.map((z)=>fg(z.source)).join("|")})$`)}return});let U=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(g,z)=>{if(U)return _(g,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:g.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else{if(K.issues.length===0)return K;b.push(K)}}if(!J)return T5(b,g,$,z);return Promise.all(b).then((O)=>{return T5(O,g,$,z)})}});function j5($,v,U,_){let g=$.filter((z)=>z.issues.length===0);if(g.length===1)return v.value=g[0].value,v;if(g.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:$.map((z)=>z.issues.map((J)=>Fv(J,_,l$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:[],inclusive:!1});return v}var lJ=X("$ZodXor",($,v)=>{sg.init($,v),v.inclusive=!1;let U=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(g,z)=>{if(U)return _(g,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:g.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else b.push(K)}if(!J)return j5(b,g,$,z);return Promise.all(b).then((O)=>{return j5(O,g,$,z)})}}),hJ=X("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,sg.init($,v);let U=$._zod.parse;z$($._zod,"propValues",()=>{let g={};for(let z of v.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(z)}"`);for(let[b,O]of Object.entries(J)){if(!g[b])g[b]=new Set;for(let K of O)g[b].add(K)}}return g});let _=D4(()=>{let g=v.options,z=new Map;for(let J of g){let b=J._zod.propValues?.[v.discriminator];if(!b||b.size===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(J)}"`);for(let O of b){if(z.has(O))throw Error(`Duplicate discriminator value "${String(O)}"`);z.set(O,J)}}return z});$._zod.parse=(g,z)=>{let J=g.value;if(!e6(J))return g.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),g;let b=_.value.get(J?.[v.discriminator]);if(b)return b._zod.run(g,z);if(v.unionFallback)return U(g,z);return g.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),g}}),xJ=X("$ZodIntersection",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value,z=v.left._zod.run({value:g,issues:[]},_),J=v.right._zod.run({value:g,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([O,K])=>{return V5(U,O,K)});return V5(U,z,J)}});function _J($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(r6($)&&r6(v)){let U=Object.keys(v),_=Object.keys($).filter((z)=>U.indexOf(z)!==-1),g={...$,...v};for(let z of _){let J=_J($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};g[z]=J.data}return{valid:!0,data:g}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let _=0;_<$.length;_++){let g=$[_],z=v[_],J=_J(g,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};U.push(J.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function V5($,v,U){let _=new Map,g;for(let b of v.issues)if(b.code==="unrecognized_keys"){g??(g=b);for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).l=!0}}else $.issues.push(b);for(let b of U.issues)if(b.code==="unrecognized_keys")for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).r=!0}else $.issues.push(b);let z=[..._].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(z.length&&g)$.issues.push({...g,keys:z});if(u6($))return $;let J=_J(v.value,U.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var B1=X("$ZodTuple",($,v)=>{$$.init($,v);let U=v.items;$._zod.parse=(_,g)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],b=[...U].reverse().findIndex((W)=>W._zod.optin!=="optional"),O=b===-1?0:U.length-b;if(!v.rest){let W=z.length>U.length,B=z.length<O-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:U.length,inclusive:!0}:{code:"too_small",minimum:U.length},input:z,inst:$,origin:"array"}),_}let K=-1;for(let W of U){if(K++,K>=z.length){if(K>=O)continue}let B=W._zod.run({value:z[K],issues:[]},g);if(B instanceof Promise)J.push(B.then((k)=>z1(k,_,K)));else z1(B,_,K)}if(v.rest){let W=z.slice(U.length);for(let B of W){K++;let k=v.rest._zod.run({value:B,issues:[]},g);if(k instanceof Promise)J.push(k.then((P)=>z1(P,_,K)));else z1(k,_,K)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function z1($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues));v.value[U]=$.value}var pJ=X("$ZodRecord",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!r6(g))return U.issues.push({expected:"record",code:"invalid_type",input:g,inst:$}),U;let z=[],J=v.keyType._zod.values;if(J){U.value={};let b=new Set;for(let K of J)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){b.add(typeof K==="number"?K.toString():K);let W=v.valueType._zod.run({value:g[K],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)U.issues.push(...Qv(K,B.issues));U.value[K]=B.value}));else{if(W.issues.length)U.issues.push(...Qv(K,W.issues));U.value[K]=W.value}}let O;for(let K in g)if(!b.has(K))O=O??[],O.push(K);if(O&&O.length>0)U.issues.push({code:"unrecognized_keys",input:g,inst:$,keys:O})}else{U.value={};for(let b of Reflect.ownKeys(g)){if(b==="__proto__")continue;let O=v.keyType._zod.run({value:b,issues:[]},_);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&ng.test(b)&&O.issues.length){let B=v.keyType._zod.run({value:Number(b),issues:[]},_);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)O=B}if(O.issues.length){if(v.mode==="loose")U.value[b]=g[b];else U.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((B)=>Fv(B,_,l$())),input:b,path:[b],inst:$});continue}let W=v.valueType._zod.run({value:g[b],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)U.issues.push(...Qv(b,B.issues));U.value[O.value]=B.value}));else{if(W.issues.length)U.issues.push(...Qv(b,W.issues));U.value[O.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>U);return U}}),oJ=X("$ZodMap",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!(g instanceof Map))return U.issues.push({expected:"map",code:"invalid_type",input:g,inst:$}),U;let z=[];U.value=new Map;for(let[J,b]of g){let O=v.keyType._zod.run({value:J,issues:[]},_),K=v.valueType._zod.run({value:b,issues:[]},_);if(O instanceof Promise||K instanceof Promise)z.push(Promise.all([O,K]).then(([W,B])=>{C5(W,B,U,J,g,$,_)}));else C5(O,K,U,J,g,$,_)}if(z.length)return Promise.all(z).then(()=>U);return U}});function C5($,v,U,_,g,z,J){if($.issues.length)if(cg.has(typeof _))U.issues.push(...Qv(_,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:g,inst:z,issues:$.issues.map((b)=>Fv(b,J,l$()))});if(v.issues.length)if(cg.has(typeof _))U.issues.push(...Qv(_,v.issues));else U.issues.push({origin:"map",code:"invalid_element",input:g,inst:z,key:_,issues:v.issues.map((b)=>Fv(b,J,l$()))});U.value.set($.value,v.value)}var nJ=X("$ZodSet",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!(g instanceof Set))return U.issues.push({input:g,inst:$,expected:"set",code:"invalid_type"}),U;let z=[];U.value=new Set;for(let J of g){let b=v.valueType._zod.run({value:J,issues:[]},_);if(b instanceof Promise)z.push(b.then((O)=>f5(O,U)));else f5(b,U)}if(z.length)return Promise.all(z).then(()=>U);return U}});function f5($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var tJ=X("$ZodEnum",($,v)=>{$$.init($,v);let U=Cg(v.entries),_=new Set(U);$._zod.values=_,$._zod.pattern=new RegExp(`^(${U.filter((g)=>cg.has(typeof g)).map((g)=>typeof g==="string"?yv(g):g.toString()).join("|")})$`),$._zod.parse=(g,z)=>{let J=g.value;if(_.has(J))return g;return g.issues.push({code:"invalid_value",values:U,input:J,inst:$}),g}}),dJ=X("$ZodLiteral",($,v)=>{if($$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let U=new Set(v.values);$._zod.values=U,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?yv(_):_?yv(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,g)=>{let z=_.value;if(U.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),aJ=X("$ZodFile",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(g instanceof File)return U;return U.issues.push({expected:"file",code:"invalid_type",input:g,inst:$}),U}}),sJ=X("$ZodTransform",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6($.constructor.name);let g=v.transform(U.value,U);if(_.async)return(g instanceof Promise?g:Promise.resolve(g)).then((J)=>{return U.value=J,U});if(g instanceof Promise)throw new pv;return U.value=g,U}});function c5($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var P1=X("$ZodOptional",($,v)=>{$$.init($,v),$._zod.optin="optional",$._zod.optout="optional",z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,void 0]):void 0}),z$($._zod,"pattern",()=>{let U=v.innerType._zod.pattern;return U?new RegExp(`^(${fg(U.source)})?$`):void 0}),$._zod.parse=(U,_)=>{if(v.innerType._zod.optin==="optional"){let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>c5(z,U.value));return c5(g,U.value)}if(U.value===void 0)return U;return v.innerType._zod.run(U,_)}}),eJ=X("$ZodExactOptional",($,v)=>{P1.init($,v),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(U,_)=>{return v.innerType._zod.run(U,_)}}),$b=X("$ZodNullable",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"pattern",()=>{let U=v.innerType._zod.pattern;return U?new RegExp(`^(${fg(U.source)}|null)$`):void 0}),z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(U,_)=>{if(U.value===null)return U;return v.innerType._zod.run(U,_)}}),vb=X("$ZodDefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);if(U.value===void 0)return U.value=v.defaultValue,U;let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>m5(z,v));return m5(g,v)}});function m5($,v){if($.value===void 0)$.value=v.defaultValue;return $}var gb=X("$ZodPrefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);if(U.value===void 0)U.value=v.defaultValue;return v.innerType._zod.run(U,_)}}),Ub=X("$ZodNonOptional",($,v)=>{$$.init($,v),z$($._zod,"values",()=>{let U=v.innerType._zod.values;return U?new Set([...U].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(U,_)=>{let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>E5(z,$));return E5(g,$)}});function E5($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var _b=X("$ZodSuccess",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6("ZodSuccess");let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>{return U.value=z.issues.length===0,U});return U.value=g.issues.length===0,U}}),zb=X("$ZodCatch",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>{if(U.value=z.value,z.issues.length)U.value=v.catchValue({...U,error:{issues:z.issues.map((J)=>Fv(J,_,l$()))},input:U.value}),U.issues=[];return U});if(U.value=g.value,g.issues.length)U.value=v.catchValue({...U,error:{issues:g.issues.map((z)=>Fv(z,_,l$()))},input:U.value}),U.issues=[];return U}}),Jb=X("$ZodNaN",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(typeof U.value!=="number"||!Number.isNaN(U.value))return U.issues.push({input:U.value,inst:$,expected:"nan",code:"invalid_type"}),U;return U}}),bb=X("$ZodPipe",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(U,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>J1(J,v.in,_));return J1(z,v.in,_)}let g=v.in._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>J1(z,v.out,_));return J1(g,v.out,_)}});function J1($,v,U){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},U)}var eg=X("$ZodCodec",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(U,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>b1(J,v,_));return b1(z,v,_)}else{let z=v.out._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>b1(J,v,_));return b1(z,v,_)}}});function b1($,v,U){if($.issues.length)return $.aborted=!0,$;if((U.direction||"forward")==="forward"){let g=v.transform($.value,$);if(g instanceof Promise)return g.then((z)=>G1($,z,v.out,U));return G1($,g,v.out,U)}else{let g=v.reverseTransform($.value,$);if(g instanceof Promise)return g.then((z)=>G1($,z,v.in,U));return G1($,g,v.in,U)}}function G1($,v,U,_){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:v,issues:$.issues},_)}var Gb=X("$ZodReadonly",($,v)=>{$$.init($,v),z$($._zod,"propValues",()=>v.innerType._zod.propValues),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"optin",()=>v.innerType?._zod?.optin),z$($._zod,"optout",()=>v.innerType?._zod?.optout),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then(i5);return i5(g)}});function i5($){return $.value=Object.freeze($.value),$}var Ob=X("$ZodTemplateLiteral",($,v)=>{$$.init($,v);let U=[];for(let _ of v.parts)if(typeof _==="object"&&_!==null){if(!_._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[..._._zod.traits].shift()}`);let g=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!g)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=g.startsWith("^")?1:0,J=g.endsWith("$")?g.length-1:g.length;U.push(g.slice(z,J))}else if(_===null||zz.has(typeof _))U.push(yv(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${U.join("")}$`),$._zod.parse=(_,g)=>{if(typeof _.value!=="string")return _.issues.push({input:_.value,inst:$,expected:"string",code:"invalid_type"}),_;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(_.value))return _.issues.push({input:_.value,inst:$,code:"invalid_format",format:v.format??"template_literal",pattern:$._zod.pattern.source}),_;return _}}),Kb=X("$ZodFunction",($,v)=>{return $$.init($,v),$._def=v,$._zod.def=v,$.implement=(U)=>{if(typeof U!=="function")throw Error("implement() must be called with a function");return function(..._){let g=$._def.input?xg($._def.input,_):_,z=Reflect.apply(U,this,g);if($._def.output)return xg($._def.output,z);return z}},$.implementAsync=(U)=>{if(typeof U!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let g=$._def.input?await pg($._def.input,_):_,z=await Reflect.apply(U,this,g);if($._def.output)return await pg($._def.output,z);return z}},$._zod.parse=(U,_)=>{if(typeof U.value!=="function")return U.issues.push({code:"invalid_type",expected:"function",input:U.value,inst:$}),U;if($._def.output&&$._def.output._zod.def.type==="promise")U.value=$.implementAsync(U.value);else U.value=$.implement(U.value);return U},$.input=(...U)=>{let _=$.constructor;if(Array.isArray(U[0]))return new _({type:"function",input:new B1({type:"tuple",items:U[0],rest:U[1]}),output:$._def.output});return new _({type:"function",input:U[0],output:$._def.output})},$.output=(U)=>{return new $.constructor({type:"function",input:$._def.input,output:U})},$}),Wb=X("$ZodPromise",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{return Promise.resolve(U.value).then((g)=>v.innerType._zod.run({value:g,issues:[]},_))}}),Bb=X("$ZodLazy",($,v)=>{$$.init($,v),z$($._zod,"innerType",()=>v.getter()),z$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),z$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),z$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),z$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(U,_)=>{return $._zod.innerType._zod.run(U,_)}}),Pb=X("$ZodCustom",($,v)=>{Q$.init($,v),$$.init($,v),$._zod.parse=(U,_)=>{return U},$._zod.check=(U)=>{let _=U.value,g=v.fn(_);if(g instanceof Promise)return g.then((z)=>l5(z,U,_,$));l5(g,U,_,$);return}});function l5($,v,U,_){if(!$){let g={code:"custom",input:U,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)g.params=_._zod.def.params;v.issues.push(R4(g))}}var _U={};ev(_U,{zhTW:()=>_8,zhCN:()=>U8,yo:()=>z8,vi:()=>g8,uz:()=>v8,ur:()=>$8,uk:()=>UU,ua:()=>eb,tr:()=>sb,th:()=>ab,ta:()=>db,sv:()=>tb,sl:()=>nb,ru:()=>ob,pt:()=>pb,ps:()=>hb,pl:()=>xb,ota:()=>lb,no:()=>ib,nl:()=>Eb,ms:()=>mb,mk:()=>cb,lt:()=>fb,ko:()=>Cb,km:()=>vU,kh:()=>Vb,ka:()=>jb,ja:()=>Tb,it:()=>Rb,is:()=>Db,id:()=>yb,hy:()=>ub,hu:()=>rb,he:()=>Nb,frCA:()=>Qb,fr:()=>Sb,fi:()=>Mb,fa:()=>Zb,es:()=>Ab,eo:()=>wb,en:()=>$U,de:()=>Xb,da:()=>Fb,cs:()=>qb,ca:()=>Yb,bg:()=>Ib,be:()=>Lb,az:()=>Hb,ar:()=>kb});var EL=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(g){return $[g]??null}let U={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${g.expected}، ولكن تم إدخال ${b}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${b}`}case"invalid_value":if(g.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${D(g.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${g.origin??"القيمة"} ${z} ${g.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${g.origin??"القيمة"} ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`أصغر من اللازم: يفترض لـ ${g.origin} أن يكون ${z} ${g.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${g.origin} أن يكون ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${g.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${U[z.format]??g.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${g.divisor}`;case"unrecognized_keys":return`معرف${g.keys.length>1?"ات":""} غريب${g.keys.length>1?"ة":""}: ${A(g.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${g.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${g.origin}`;default:return"مدخل غير مقبول"}}};function kb(){return{localeError:EL()}}var iL=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function v(g){return $[g]??null}let U={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Yanlış dəyər: gözlənilən instanceof ${g.expected}, daxil olan ${b}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${b}`}case"invalid_value":if(g.values.length===1)return`Yanlış dəyər: gözlənilən ${D(g.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Çox böyük: gözlənilən ${g.origin??"dəyər"} ${z}${g.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${g.origin??"dəyər"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Çox kiçik: gözlənilən ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${U[z.format]??g.format}`}case"not_multiple_of":return`Yanlış ədəd: ${g.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${g.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Hb(){return{localeError:iL()}}function t5($,v,U,_){let g=Math.abs($),z=g%10,J=g%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return U;return _}var lL=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function v(g){return $[g]??null}let U={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},_={nan:"NaN",number:"лік",array:"масіў"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Няправільны ўвод: чакаўся instanceof ${g.expected}, атрымана ${b}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${b}`}case"invalid_value":if(g.values.length===1)return`Няправільны ўвод: чакалася ${D(g.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=t5(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${g.origin??"значэнне"} павінна ${J.verb} ${z}${g.maximum.toString()} ${O}`}return`Занадта вялікі: чакалася, што ${g.origin??"значэнне"} павінна быць ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=t5(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${g.origin} павінна ${J.verb} ${z}${g.minimum.toString()} ${O}`}return`Занадта малы: чакалася, што ${g.origin} павінна быць ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${U[z.format]??g.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${g.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${g.keys.length>1?"ключы":"ключ"}: ${A(g.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${g.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${g.origin}`;default:return"Няправільны ўвод"}}};function Lb(){return{localeError:lL()}}var hL=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(g){return $[g]??null}let U={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},_={nan:"NaN",number:"число",array:"масив"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Невалиден вход: очакван instanceof ${g.expected}, получен ${b}`;return`Невалиден вход: очакван ${z}, получен ${b}`}case"invalid_value":if(g.values.length===1)return`Невалиден вход: очакван ${D(g.values[0])}`;return`Невалидна опция: очаквано едно от ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Твърде голямо: очаква се ${g.origin??"стойност"} да съдържа ${z}${g.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${g.origin??"стойност"} да бъде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Твърде малко: очаква се ${g.origin} да съдържа ${z}${g.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${g.origin} да бъде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let J="Невалиден";if(z.format==="emoji")J="Невалидно";if(z.format==="datetime")J="Невалидно";if(z.format==="date")J="Невалидна";if(z.format==="time")J="Невалидно";if(z.format==="duration")J="Невалидна";return`${J} ${U[z.format]??g.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${g.divisor}`;case"unrecognized_keys":return`Неразпознат${g.keys.length>1?"и":""} ключ${g.keys.length>1?"ове":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${g.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${g.origin}`;default:return"Невалиден вход"}}};function Ib(){return{localeError:hL()}}var xL=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(g){return $[g]??null}let U={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Tipus invàlid: s'esperava instanceof ${g.expected}, s'ha rebut ${b}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${b}`}case"invalid_value":if(g.values.length===1)return`Valor invàlid: s'esperava ${D(g.values[0])}`;return`Opció invàlida: s'esperava una de ${A(g.values," o ")}`;case"too_big":{let z=g.inclusive?"com a màxim":"menys de",J=v(g.origin);if(J)return`Massa gran: s'esperava que ${g.origin??"el valor"} contingués ${z} ${g.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${g.origin??"el valor"} fos ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"com a mínim":"més de",J=v(g.origin);if(J)return`Massa petit: s'esperava que ${g.origin} contingués ${z} ${g.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${g.origin} fos ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${U[z.format]??g.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${g.divisor}`;case"unrecognized_keys":return`Clau${g.keys.length>1?"s":""} no reconeguda${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${g.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${g.origin}`;default:return"Entrada invàlida"}}};function Yb(){return{localeError:xL()}}var pL=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function v(g){return $[g]??null}let U={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},_={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Neplatný vstup: očekáváno instanceof ${g.expected}, obdrženo ${b}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${b}`}case"invalid_value":if(g.values.length===1)return`Neplatný vstup: očekáváno ${D(g.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Hodnota je příliš velká: ${g.origin??"hodnota"} musí mít ${z}${g.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${g.origin??"hodnota"} musí být ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Hodnota je příliš malá: ${g.origin??"hodnota"} musí mít ${z}${g.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${g.origin??"hodnota"} musí být ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${U[z.format]??g.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${g.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(g.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${g.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${g.origin}`;default:return"Neplatný vstup"}}};function qb(){return{localeError:pL()}}var oL=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(g){return $[g]??null}let U={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ugyldigt input: forventede instanceof ${g.expected}, fik ${b}`;return`Ugyldigt input: forventede ${z}, fik ${b}`}case"invalid_value":if(g.values.length===1)return`Ugyldig værdi: forventede ${D(g.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`For stor: forventede ${b??"value"} ${J.verb} ${z} ${g.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${b??"value"} havde ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`For lille: forventede ${b} ${J.verb} ${z} ${g.minimum.toString()} ${J.unit}`;return`For lille: forventede ${b} havde ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??g.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${g.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${g.origin}`;default:return"Ugyldigt input"}}};function Fb(){return{localeError:oL()}}var nL=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function v(g){return $[g]??null}let U={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},_={nan:"NaN",number:"Zahl",array:"Array"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ungültige Eingabe: erwartet instanceof ${g.expected}, erhalten ${b}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${b}`}case"invalid_value":if(g.values.length===1)return`Ungültige Eingabe: erwartet ${D(g.values[0])}`;return`Ungültige Option: erwartet eine von ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Zu groß: erwartet, dass ${g.origin??"Wert"} ${z}${g.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${g.origin??"Wert"} ${z}${g.maximum.toString()} ist`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Zu klein: erwartet, dass ${g.origin} ${z}${g.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${g.origin} ${z}${g.minimum.toString()} ist`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${U[z.format]??g.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${g.divisor} sein`;case"unrecognized_keys":return`${g.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${g.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${g.origin}`;default:return"Ungültige Eingabe"}}};function Xb(){return{localeError:nL()}}var tL=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function v(g){return $[g]??null}let U={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;return`Invalid input: expected ${z}, received ${b}`}case"invalid_value":if(g.values.length===1)return`Invalid input: expected ${D(g.values[0])}`;return`Invalid option: expected one of ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Too big: expected ${g.origin??"value"} to have ${z}${g.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${g.origin??"value"} to be ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Too small: expected ${g.origin} to have ${z}${g.minimum.toString()} ${J.unit}`;return`Too small: expected ${g.origin} to be ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${U[z.format]??g.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${g.divisor}`;case"unrecognized_keys":return`Unrecognized key${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Invalid key in ${g.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${g.origin}`;default:return"Invalid input"}}};function $U(){return{localeError:tL()}}var dL=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(g){return $[g]??null}let U={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},_={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Nevalida enigo: atendiĝis instanceof ${g.expected}, riceviĝis ${b}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${b}`}case"invalid_value":if(g.values.length===1)return`Nevalida enigo: atendiĝis ${D(g.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Tro granda: atendiĝis ke ${g.origin??"valoro"} havu ${z}${g.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${g.origin??"valoro"} havu ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Tro malgranda: atendiĝis ke ${g.origin} havu ${z}${g.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${g.origin} estu ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${U[z.format]??g.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${g.divisor}`;case"unrecognized_keys":return`Nekonata${g.keys.length>1?"j":""} ŝlosilo${g.keys.length>1?"j":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${g.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${g.origin}`;default:return"Nevalida enigo"}}};function wb(){return{localeError:dL()}}var aL=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(g){return $[g]??null}let U={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrada inválida: se esperaba instanceof ${g.expected}, recibido ${b}`;return`Entrada inválida: se esperaba ${z}, recibido ${b}`}case"invalid_value":if(g.values.length===1)return`Entrada inválida: se esperaba ${D(g.values[0])}`;return`Opción inválida: se esperaba una de ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`Demasiado grande: se esperaba que ${b??"valor"} tuviera ${z}${g.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${b??"valor"} fuera ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`Demasiado pequeño: se esperaba que ${b} tuviera ${z}${g.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${b} fuera ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${U[z.format]??g.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${g.divisor}`;case"unrecognized_keys":return`Llave${g.keys.length>1?"s":""} desconocida${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[g.origin]??g.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[g.origin]??g.origin}`;default:return"Entrada inválida"}}};function Ab(){return{localeError:aL()}}var sL=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(g){return $[g]??null}let U={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},_={nan:"NaN",number:"عدد",array:"آرایه"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ورودی نامعتبر: می‌بایست instanceof ${g.expected} می‌بود، ${b} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${b} دریافت شد`}case"invalid_value":if(g.values.length===1)return`ورودی نامعتبر: می‌بایست ${D(g.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${A(g.values,"|")} می‌بود`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`خیلی بزرگ: ${g.origin??"مقدار"} باید ${z}${g.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${g.origin??"مقدار"} باید ${z}${g.maximum.toString()} باشد`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`خیلی کوچک: ${g.origin} باید ${z}${g.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${g.origin} باید ${z}${g.minimum.toString()} باشد`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${U[z.format]??g.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${g.divisor} باشد`;case"unrecognized_keys":return`کلید${g.keys.length>1?"های":""} ناشناس: ${A(g.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${g.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${g.origin}`;default:return"ورودی نامعتبر"}}};function Zb(){return{localeError:sL()}}var eL=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function v(g){return $[g]??null}let U={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Virheellinen tyyppi: odotettiin instanceof ${g.expected}, oli ${b}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${b}`}case"invalid_value":if(g.values.length===1)return`Virheellinen syöte: täytyy olla ${D(g.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${g.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${g.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${U[z.format]??g.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${g.divisor} monikerta`;case"unrecognized_keys":return`${g.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(g.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Mb(){return{localeError:eL()}}var $I=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(g){return $[g]??null}let U={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN",number:"nombre",array:"tableau"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrée invalide : instanceof ${g.expected} attendu, ${b} reçu`;return`Entrée invalide : ${z} attendu, ${b} reçu`}case"invalid_value":if(g.values.length===1)return`Entrée invalide : ${D(g.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(g.values,"|")} attendue`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Trop grand : ${g.origin??"valeur"} doit ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${g.origin??"valeur"} doit être ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Trop petit : ${g.origin} doit ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Trop petit : ${g.origin} doit être ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${U[z.format]??g.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${g.divisor}`;case"unrecognized_keys":return`Clé${g.keys.length>1?"s":""} non reconnue${g.keys.length>1?"s":""} : ${A(g.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${g.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${g.origin}`;default:return"Entrée invalide"}}};function Sb(){return{localeError:$I()}}var vI=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(g){return $[g]??null}let U={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrée invalide : attendu instanceof ${g.expected}, reçu ${b}`;return`Entrée invalide : attendu ${z}, reçu ${b}`}case"invalid_value":if(g.values.length===1)return`Entrée invalide : attendu ${D(g.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"≤":"<",J=v(g.origin);if(J)return`Trop grand : attendu que ${g.origin??"la valeur"} ait ${z}${g.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${g.origin??"la valeur"} soit ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"≥":">",J=v(g.origin);if(J)return`Trop petit : attendu que ${g.origin} ait ${z}${g.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${g.origin} soit ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${U[z.format]??g.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${g.divisor}`;case"unrecognized_keys":return`Clé${g.keys.length>1?"s":""} non reconnue${g.keys.length>1?"s":""} : ${A(g.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${g.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${g.origin}`;default:return"Entrée invalide"}}};function Qb(){return{localeError:vI()}}var gI=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},v={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},U=(K)=>K?$[K]:void 0,_=(K)=>{let W=U(K);if(W)return W.label;return K??$.unknown.label},g=(K)=>`ה${_(K)}`,z=(K)=>{return(U(K)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},J=(K)=>{if(!K)return null;return v[K]??null},b={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},O={nan:"NaN"};return(K)=>{switch(K.code){case"invalid_type":{let W=K.expected,B=O[W??""]??_(W),k=R(K.input),P=O[k]??$[k]?.label??k;if(/^[A-Z]/.test(K.expected))return`קלט לא תקין: צריך להיות instanceof ${K.expected}, התקבל ${P}`;return`קלט לא תקין: צריך להיות ${B}, התקבל ${P}`}case"invalid_value":{if(K.values.length===1)return`ערך לא תקין: הערך חייב להיות ${D(K.values[0])}`;let W=K.values.map((P)=>D(P));if(K.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let B=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${B}`}case"too_big":{let W=J(K.origin),B=g(K.origin??"value");if(K.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${K.maximum.toString()} ${W?.unit??""} ${K.inclusive?"או פחות":"לכל היותר"}`.trim();if(K.origin==="number"){let F=K.inclusive?`קטן או שווה ל-${K.maximum}`:`קטן מ-${K.maximum}`;return`גדול מדי: ${B} צריך להיות ${F}`}if(K.origin==="array"||K.origin==="set"){let F=K.origin==="set"?"צריכה":"צריך",I=K.inclusive?`${K.maximum} ${W?.unit??""} או פחות`:`פחות מ-${K.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${F} להכיל ${I}`.trim()}let k=K.inclusive?"<=":"<",P=z(K.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${B} ${P} ${k}${K.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${B} ${P} ${k}${K.maximum.toString()}`}case"too_small":{let W=J(K.origin),B=g(K.origin??"value");if(K.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${K.minimum.toString()} ${W?.unit??""} ${K.inclusive?"או יותר":"לפחות"}`.trim();if(K.origin==="number"){let F=K.inclusive?`גדול או שווה ל-${K.minimum}`:`גדול מ-${K.minimum}`;return`קטן מדי: ${B} צריך להיות ${F}`}if(K.origin==="array"||K.origin==="set"){let F=K.origin==="set"?"צריכה":"צריך";if(K.minimum===1&&K.inclusive){let H=K.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${F} להכיל ${H}`}let I=K.inclusive?`${K.minimum} ${W?.unit??""} או יותר`:`יותר מ-${K.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${F} להכיל ${I}`.trim()}let k=K.inclusive?">=":">",P=z(K.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${B} ${P} ${k}${K.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${B} ${P} ${k}${K.minimum.toString()}`}case"invalid_format":{let W=K;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let B=b[W.format],k=B?.label??W.format,F=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${F}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${K.divisor}`;case"unrecognized_keys":return`מפתח${K.keys.length>1?"ות":""} לא מזוה${K.keys.length>1?"ים":"ה"}: ${A(K.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${g(K.origin??"array")}`;default:return"קלט לא תקין"}}};function Nb(){return{localeError:gI()}}var UI=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(g){return $[g]??null}let U={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},_={nan:"NaN",number:"szám",array:"tömb"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Érvénytelen bemenet: a várt érték instanceof ${g.expected}, a kapott érték ${b}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${b}`}case"invalid_value":if(g.values.length===1)return`Érvénytelen bemenet: a várt érték ${D(g.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Túl nagy: ${g.origin??"érték"} mérete túl nagy ${z}${g.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${g.origin??"érték"} túl nagy: ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Túl kicsi: a bemeneti érték ${g.origin} mérete túl kicsi ${z}${g.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${g.origin} túl kicsi ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${U[z.format]??g.format}`}case"not_multiple_of":return`Érvénytelen szám: ${g.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${g.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${g.origin}`;default:return"Érvénytelen bemenet"}}};function rb(){return{localeError:UI()}}function d5($,v,U){return Math.abs($)===1?v:U}function m4($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],U=$[$.length-1];return $+(v.includes(U)?"ն":"ը")}var _I=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(g){return $[g]??null}let U={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},_={nan:"NaN",number:"թիվ",array:"զանգված"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${g.expected}, ստացվել է ${b}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${b}`}case"invalid_value":if(g.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${D(g.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=d5(b,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${m4(g.origin??"արժեք")} կունենա ${z}${g.maximum.toString()} ${O}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${m4(g.origin??"արժեք")} լինի ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=d5(b,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${m4(g.origin)} կունենա ${z}${g.minimum.toString()} ${O}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${m4(g.origin)} լինի ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${U[z.format]??g.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${g.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${g.keys.length>1?"ներ":""}. ${A(g.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${m4(g.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${m4(g.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function ub(){return{localeError:_I()}}var zI=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(g){return $[g]??null}let U={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input tidak valid: diharapkan instanceof ${g.expected}, diterima ${b}`;return`Input tidak valid: diharapkan ${z}, diterima ${b}`}case"invalid_value":if(g.values.length===1)return`Input tidak valid: diharapkan ${D(g.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Terlalu besar: diharapkan ${g.origin??"value"} memiliki ${z}${g.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${g.origin??"value"} menjadi ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Terlalu kecil: diharapkan ${g.origin} memiliki ${z}${g.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${g.origin} menjadi ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${U[z.format]??g.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${g.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${g.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${g.origin}`;default:return"Input tidak valid"}}};function yb(){return{localeError:zI()}}var JI=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function v(g){return $[g]??null}let U={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},_={nan:"NaN",number:"númer",array:"fylki"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera instanceof ${g.expected}`;return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera ${z}`}case"invalid_value":if(g.values.length===1)return`Rangt gildi: gert ráð fyrir ${D(g.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Of stórt: gert er ráð fyrir að ${g.origin??"gildi"} hafi ${z}${g.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${g.origin??"gildi"} sé ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Of lítið: gert er ráð fyrir að ${g.origin} hafi ${z}${g.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${g.origin} sé ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${U[z.format]??g.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${g.divisor}`;case"unrecognized_keys":return`Óþekkt ${g.keys.length>1?"ir lyklar":"ur lykill"}: ${A(g.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${g.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${g.origin}`;default:return"Rangt gildi"}}};function Db(){return{localeError:JI()}}var bI=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(g){return $[g]??null}let U={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"numero",array:"vettore"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input non valido: atteso instanceof ${g.expected}, ricevuto ${b}`;return`Input non valido: atteso ${z}, ricevuto ${b}`}case"invalid_value":if(g.values.length===1)return`Input non valido: atteso ${D(g.values[0])}`;return`Opzione non valida: atteso uno tra ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Troppo grande: ${g.origin??"valore"} deve avere ${z}${g.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${g.origin??"valore"} deve essere ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Troppo piccolo: ${g.origin} deve avere ${z}${g.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${g.origin} deve essere ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${U[z.format]??g.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${g.divisor}`;case"unrecognized_keys":return`Chiav${g.keys.length>1?"i":"e"} non riconosciut${g.keys.length>1?"e":"a"}: ${A(g.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${g.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${g.origin}`;default:return"Input non valido"}}};function Rb(){return{localeError:bI()}}var GI=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(g){return $[g]??null}let U={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},_={nan:"NaN",number:"数値",array:"配列"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`無効な入力: instanceof ${g.expected}が期待されましたが、${b}が入力されました`;return`無効な入力: ${z}が期待されましたが、${b}が入力されました`}case"invalid_value":if(g.values.length===1)return`無効な入力: ${D(g.values[0])}が期待されました`;return`無効な選択: ${A(g.values,"、")}のいずれかである必要があります`;case"too_big":{let z=g.inclusive?"以下である":"より小さい",J=v(g.origin);if(J)return`大きすぎる値: ${g.origin??"値"}は${g.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${g.origin??"値"}は${g.maximum.toString()}${z}必要があります`}case"too_small":{let z=g.inclusive?"以上である":"より大きい",J=v(g.origin);if(J)return`小さすぎる値: ${g.origin}は${g.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${g.origin}は${g.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${U[z.format]??g.format}`}case"not_multiple_of":return`無効な数値: ${g.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${g.keys.length>1?"群":""}: ${A(g.keys,"、")}`;case"invalid_key":return`${g.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${g.origin}内の無効な値`;default:return"無効な入力"}}};function Tb(){return{localeError:GI()}}var OI=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(g){return $[g]??null}let U={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},_={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${g.expected}, მიღებული ${b}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${b}`}case"invalid_value":if(g.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${D(g.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(g.values,"|")}-დან`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${g.origin??"მნიშვნელობა"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${g.origin??"მნიშვნელობა"} იყოს ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${g.origin} იყოს ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${U[z.format]??g.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${g.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${g.keys.length>1?"ები":"ი"}: ${A(g.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${g.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${g.origin}-ში`;default:return"არასწორი შეყვანა"}}};function jb(){return{localeError:OI()}}var KI=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(g){return $[g]??null}let U={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},_={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${g.expected} ប៉ុន្តែទទួលបាន ${b}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${b}`}case"invalid_value":if(g.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${D(g.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ធំពេក៖ ត្រូវការ ${g.origin??"តម្លៃ"} ${z} ${g.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${g.origin??"តម្លៃ"} ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`តូចពេក៖ ត្រូវការ ${g.origin} ${z} ${g.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${g.origin} ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${U[z.format]??g.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${g.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(g.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${g.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${g.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function vU(){return{localeError:KI()}}function Vb(){return vU()}var WI=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(g){return $[g]??null}let U={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`잘못된 입력: 예상 타입은 instanceof ${g.expected}, 받은 타입은 ${b}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${b}입니다`}case"invalid_value":if(g.values.length===1)return`잘못된 입력: 값은 ${D(g.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(g.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=g.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",b=v(g.origin),O=b?.unit??"요소";if(b)return`${g.origin??"값"}이 너무 큽니다: ${g.maximum.toString()}${O} ${z}${J}`;return`${g.origin??"값"}이 너무 큽니다: ${g.maximum.toString()} ${z}${J}`}case"too_small":{let z=g.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",b=v(g.origin),O=b?.unit??"요소";if(b)return`${g.origin??"값"}이 너무 작습니다: ${g.minimum.toString()}${O} ${z}${J}`;return`${g.origin??"값"}이 너무 작습니다: ${g.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${U[z.format]??g.format}`}case"not_multiple_of":return`잘못된 숫자: ${g.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(g.keys,", ")}`;case"invalid_key":return`잘못된 키: ${g.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${g.origin}`;default:return"잘못된 입력"}}};function Cb(){return{localeError:WI()}}var gU=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function a5($){let v=Math.abs($),U=v%10,_=v%100;if(_>=11&&_<=19||U===0)return"many";if(U===1)return"one";return"few"}var BI=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function v(g,z,J,b){let O=$[g]??null;if(O===null)return O;return{unit:O.unit[z],verb:O.verb[b][J?"inclusive":"notInclusive"]}}let U={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},_={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Gautas tipas ${b}, o tikėtasi - instanceof ${g.expected}`;return`Gautas tipas ${b}, o tikėtasi - ${z}`}case"invalid_value":if(g.values.length===1)return`Privalo būti ${D(g.values[0])}`;return`Privalo būti vienas iš ${A(g.values,"|")} pasirinkimų`;case"too_big":{let z=_[g.origin]??g.origin,J=v(g.origin,a5(Number(g.maximum)),g.inclusive??!1,"smaller");if(J?.verb)return`${gU(z??g.origin??"reikšmė")} ${J.verb} ${g.maximum.toString()} ${J.unit??"elementų"}`;let b=g.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${gU(z??g.origin??"reikšmė")} turi būti ${b} ${g.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[g.origin]??g.origin,J=v(g.origin,a5(Number(g.minimum)),g.inclusive??!1,"bigger");if(J?.verb)return`${gU(z??g.origin??"reikšmė")} ${J.verb} ${g.minimum.toString()} ${J.unit??"elementų"}`;let b=g.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${gU(z??g.origin??"reikšmė")} turi būti ${b} ${g.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${U[z.format]??g.format}`}case"not_multiple_of":return`Skaičius privalo būti ${g.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${g.keys.length>1?"i":"as"} rakt${g.keys.length>1?"ai":"as"}: ${A(g.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[g.origin]??g.origin;return`${gU(z??g.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function fb(){return{localeError:BI()}}var PI=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(g){return $[g]??null}let U={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},_={nan:"NaN",number:"број",array:"низа"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Грешен внес: се очекува instanceof ${g.expected}, примено ${b}`;return`Грешен внес: се очекува ${z}, примено ${b}`}case"invalid_value":if(g.values.length===1)return`Invalid input: expected ${D(g.values[0])}`;return`Грешана опција: се очекува една ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Премногу голем: се очекува ${g.origin??"вредноста"} да има ${z}${g.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${g.origin??"вредноста"} да биде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Премногу мал: се очекува ${g.origin} да има ${z}${g.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${g.origin} да биде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${U[z.format]??g.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(g.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${g.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${g.origin}`;default:return"Грешен внес"}}};function cb(){return{localeError:PI()}}var kI=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(g){return $[g]??null}let U={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"nombor"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input tidak sah: dijangka instanceof ${g.expected}, diterima ${b}`;return`Input tidak sah: dijangka ${z}, diterima ${b}`}case"invalid_value":if(g.values.length===1)return`Input tidak sah: dijangka ${D(g.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Terlalu besar: dijangka ${g.origin??"nilai"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${g.origin??"nilai"} adalah ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Terlalu kecil: dijangka ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${g.origin} adalah ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${U[z.format]??g.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${g.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(g.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${g.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${g.origin}`;default:return"Input tidak sah"}}};function mb(){return{localeError:kI()}}var HI=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(g){return $[g]??null}let U={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},_={nan:"NaN",number:"getal"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ongeldige invoer: verwacht instanceof ${g.expected}, ontving ${b}`;return`Ongeldige invoer: verwacht ${z}, ontving ${b}`}case"invalid_value":if(g.values.length===1)return`Ongeldige invoer: verwacht ${D(g.values[0])}`;return`Ongeldige optie: verwacht één van ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=g.origin==="date"?"laat":g.origin==="string"?"lang":"groot";if(J)return`Te ${b}: verwacht dat ${g.origin??"waarde"} ${z}${g.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${b}: verwacht dat ${g.origin??"waarde"} ${z}${g.maximum.toString()} is`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=g.origin==="date"?"vroeg":g.origin==="string"?"kort":"klein";if(J)return`Te ${b}: verwacht dat ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${b}: verwacht dat ${g.origin} ${z}${g.minimum.toString()} is`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${U[z.format]??g.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${g.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${g.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${g.origin}`;default:return"Ongeldige invoer"}}};function Eb(){return{localeError:HI()}}var LI=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(g){return $[g]??null}let U={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"tall",array:"liste"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ugyldig input: forventet instanceof ${g.expected}, fikk ${b}`;return`Ugyldig input: forventet ${z}, fikk ${b}`}case"invalid_value":if(g.values.length===1)return`Ugyldig verdi: forventet ${D(g.values[0])}`;return`Ugyldig valg: forventet en av ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`For stor(t): forventet ${g.origin??"value"} til å ha ${z}${g.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${g.origin??"value"} til å ha ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`For lite(n): forventet ${g.origin} til å ha ${z}${g.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${g.origin} til å ha ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${U[z.format]??g.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${g.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${g.origin}`;default:return"Ugyldig input"}}};function ib(){return{localeError:LI()}}var II=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function v(g){return $[g]??null}let U={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},_={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Fâsit giren: umulan instanceof ${g.expected}, alınan ${b}`;return`Fâsit giren: umulan ${z}, alınan ${b}`}case"invalid_value":if(g.values.length===1)return`Fâsit giren: umulan ${D(g.values[0])}`;return`Fâsit tercih: mûteberler ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Fazla büyük: ${g.origin??"value"}, ${z}${g.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${g.origin??"value"}, ${z}${g.maximum.toString()} olmalıydı.`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Fazla küçük: ${g.origin}, ${z}${g.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${g.origin}, ${z}${g.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${U[z.format]??g.format}`}case"not_multiple_of":return`Fâsit sayı: ${g.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${g.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function lb(){return{localeError:II()}}var YI=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(g){return $[g]??null}let U={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},_={nan:"NaN",number:"عدد",array:"ارې"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ناسم ورودي: باید instanceof ${g.expected} وای, مګر ${b} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${b} ترلاسه شو`}case"invalid_value":if(g.values.length===1)return`ناسم ورودي: باید ${D(g.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(g.values,"|")} څخه وای`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ډیر لوی: ${g.origin??"ارزښت"} باید ${z}${g.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${g.origin??"ارزښت"} باید ${z}${g.maximum.toString()} وي`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`ډیر کوچنی: ${g.origin} باید ${z}${g.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${g.origin} باید ${z}${g.minimum.toString()} وي`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${U[z.format]??g.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${g.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${g.keys.length>1?"کلیډونه":"کلیډ"}: ${A(g.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${g.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${g.origin} کې`;default:return"ناسمه ورودي"}}};function hb(){return{localeError:YI()}}var qI=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function v(g){return $[g]??null}let U={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},_={nan:"NaN",number:"liczba",array:"tablica"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${g.expected}, otrzymano ${b}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${b}`}case"invalid_value":if(g.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${D(g.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Za duża wartość: oczekiwano, że ${g.origin??"wartość"} będzie mieć ${z}${g.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${g.origin??"wartość"} będzie wynosić ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Za mała wartość: oczekiwano, że ${g.origin??"wartość"} będzie mieć ${z}${g.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${g.origin??"wartość"} będzie wynosić ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${U[z.format]??g.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${g.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${g.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${g.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function xb(){return{localeError:qI()}}var FI=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(g){return $[g]??null}let U={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",number:"número",null:"nulo"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Tipo inválido: esperado instanceof ${g.expected}, recebido ${b}`;return`Tipo inválido: esperado ${z}, recebido ${b}`}case"invalid_value":if(g.values.length===1)return`Entrada inválida: esperado ${D(g.values[0])}`;return`Opção inválida: esperada uma das ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Muito grande: esperado que ${g.origin??"valor"} tivesse ${z}${g.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${g.origin??"valor"} fosse ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Muito pequeno: esperado que ${g.origin} tivesse ${z}${g.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${g.origin} fosse ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${U[z.format]??g.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${g.divisor}`;case"unrecognized_keys":return`Chave${g.keys.length>1?"s":""} desconhecida${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Chave inválida em ${g.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${g.origin}`;default:return"Campo inválido"}}};function pb(){return{localeError:FI()}}function s5($,v,U,_){let g=Math.abs($),z=g%10,J=g%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return U;return _}var XI=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function v(g){return $[g]??null}let U={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},_={nan:"NaN",number:"число",array:"массив"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Неверный ввод: ожидалось instanceof ${g.expected}, получено ${b}`;return`Неверный ввод: ожидалось ${z}, получено ${b}`}case"invalid_value":if(g.values.length===1)return`Неверный ввод: ожидалось ${D(g.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=s5(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${g.origin??"значение"} будет иметь ${z}${g.maximum.toString()} ${O}`}return`Слишком большое значение: ожидалось, что ${g.origin??"значение"} будет ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=s5(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${g.origin} будет иметь ${z}${g.minimum.toString()} ${O}`}return`Слишком маленькое значение: ожидалось, что ${g.origin} будет ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${U[z.format]??g.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${g.divisor}`;case"unrecognized_keys":return`Нераспознанн${g.keys.length>1?"ые":"ый"} ключ${g.keys.length>1?"и":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${g.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${g.origin}`;default:return"Неверные входные данные"}}};function ob(){return{localeError:XI()}}var wI=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(g){return $[g]??null}let U={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},_={nan:"NaN",number:"število",array:"tabela"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Neveljaven vnos: pričakovano instanceof ${g.expected}, prejeto ${b}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${b}`}case"invalid_value":if(g.values.length===1)return`Neveljaven vnos: pričakovano ${D(g.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Preveliko: pričakovano, da bo ${g.origin??"vrednost"} imelo ${z}${g.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${g.origin??"vrednost"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Premajhno: pričakovano, da bo ${g.origin} imelo ${z}${g.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${U[z.format]??g.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${g.divisor}`;case"unrecognized_keys":return`Neprepoznan${g.keys.length>1?"i ključi":" ključ"}: ${A(g.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${g.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${g.origin}`;default:return"Neveljaven vnos"}}};function nb(){return{localeError:wI()}}var AI=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function v(g){return $[g]??null}let U={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},_={nan:"NaN",number:"antal",array:"lista"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ogiltig inmatning: förväntat instanceof ${g.expected}, fick ${b}`;return`Ogiltig inmatning: förväntat ${z}, fick ${b}`}case"invalid_value":if(g.values.length===1)return`Ogiltig inmatning: förväntat ${D(g.values[0])}`;return`Ogiltigt val: förväntade en av ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`För stor(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${g.origin??"värdet"} att ha ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`För lite(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${U[z.format]??g.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${g.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${g.origin??"värdet"}`;default:return"Ogiltig input"}}};function tb(){return{localeError:AI()}}var ZI=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(g){return $[g]??null}let U={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${g.expected}, பெறப்பட்டது ${b}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${b}`}case"invalid_value":if(g.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${D(g.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(g.values,"|")} இல் ஒன்று`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${g.origin??"மதிப்பு"} ${z}${g.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${g.origin??"மதிப்பு"} ${z}${g.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${g.origin} ${z}${g.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${U[z.format]??g.format}`}case"not_multiple_of":return`தவறான எண்: ${g.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${g.keys.length>1?"கள்":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${g.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function db(){return{localeError:ZI()}}var MI=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(g){return $[g]??null}let U={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},_={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${g.expected} แต่ได้รับ ${b}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${b}`}case"invalid_value":if(g.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${D(g.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(g.origin);if(J)return`เกินกำหนด: ${g.origin??"ค่า"} ควรมี${z} ${g.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${g.origin??"ค่า"} ควรมี${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"อย่างน้อย":"มากกว่า",J=v(g.origin);if(J)return`น้อยกว่ากำหนด: ${g.origin} ควรมี${z} ${g.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${g.origin} ควรมี${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${U[z.format]??g.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${g.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(g.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${g.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${g.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function ab(){return{localeError:MI()}}var SI=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(g){return $[g]??null}let U={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Geçersiz değer: beklenen instanceof ${g.expected}, alınan ${b}`;return`Geçersiz değer: beklenen ${z}, alınan ${b}`}case"invalid_value":if(g.values.length===1)return`Geçersiz değer: beklenen ${D(g.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Çok büyük: beklenen ${g.origin??"değer"} ${z}${g.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${g.origin??"değer"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Çok küçük: beklenen ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${U[z.format]??g.format}`}case"not_multiple_of":return`Geçersiz sayı: ${g.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${g.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function sb(){return{localeError:SI()}}var QI=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(g){return $[g]??null}let U={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},_={nan:"NaN",number:"число",array:"масив"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Неправильні вхідні дані: очікується instanceof ${g.expected}, отримано ${b}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${b}`}case"invalid_value":if(g.values.length===1)return`Неправильні вхідні дані: очікується ${D(g.values[0])}`;return`Неправильна опція: очікується одне з ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Занадто велике: очікується, що ${g.origin??"значення"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${g.origin??"значення"} буде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Занадто мале: очікується, що ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${g.origin} буде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${U[z.format]??g.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${g.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${g.keys.length>1?"і":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${g.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${g.origin}`;default:return"Неправильні вхідні дані"}}};function UU(){return{localeError:QI()}}function eb(){return UU()}var NI=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(g){return $[g]??null}let U={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},_={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`غلط ان پٹ: instanceof ${g.expected} متوقع تھا، ${b} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${b} موصول ہوا`}case"invalid_value":if(g.values.length===1)return`غلط ان پٹ: ${D(g.values[0])} متوقع تھا`;return`غلط آپشن: ${A(g.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`بہت بڑا: ${g.origin??"ویلیو"} کے ${z}${g.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${g.origin??"ویلیو"} کا ${z}${g.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`بہت چھوٹا: ${g.origin} کے ${z}${g.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${g.origin} کا ${z}${g.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${U[z.format]??g.format}`}case"not_multiple_of":return`غلط نمبر: ${g.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${g.keys.length>1?"ز":""}: ${A(g.keys,"، ")}`;case"invalid_key":return`${g.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${g.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function $8(){return{localeError:NI()}}var rI=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function v(g){return $[g]??null}let U={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},_={nan:"NaN",number:"raqam",array:"massiv"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${g.expected}, qabul qilingan ${b}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${b}`}case"invalid_value":if(g.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${D(g.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Juda katta: kutilgan ${g.origin??"qiymat"} ${z}${g.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${g.origin??"qiymat"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Juda kichik: kutilgan ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${U[z.format]??g.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${g.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${g.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function v8(){return{localeError:rI()}}var uI=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function v(g){return $[g]??null}let U={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},_={nan:"NaN",number:"số",array:"mảng"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${g.expected}, nhận được ${b}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${b}`}case"invalid_value":if(g.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${D(g.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Quá lớn: mong đợi ${g.origin??"giá trị"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${g.origin??"giá trị"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Quá nhỏ: mong đợi ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${U[z.format]??g.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${g.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(g.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${g.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${g.origin}`;default:return"Đầu vào không hợp lệ"}}};function g8(){return{localeError:uI()}}var yI=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(g){return $[g]??null}let U={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},_={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`无效输入:期望 instanceof ${g.expected},实际接收 ${b}`;return`无效输入:期望 ${z},实际接收 ${b}`}case"invalid_value":if(g.values.length===1)return`无效输入:期望 ${D(g.values[0])}`;return`无效选项:期望以下之一 ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`数值过大:期望 ${g.origin??"值"} ${z}${g.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${g.origin??"值"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`数值过小:期望 ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${U[z.format]??g.format}`}case"not_multiple_of":return`无效数字:必须是 ${g.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${g.origin} 中包含无效值(value)`;default:return"无效输入"}}};function U8(){return{localeError:yI()}}var DI=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(g){return $[g]??null}let U={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},_={nan:"NaN"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`無效的輸入值:預期為 instanceof ${g.expected},但收到 ${b}`;return`無效的輸入值:預期為 ${z},但收到 ${b}`}case"invalid_value":if(g.values.length===1)return`無效的輸入值:預期為 ${D(g.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`數值過大:預期 ${g.origin??"值"} 應為 ${z}${g.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${g.origin??"值"} 應為 ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`數值過小:預期 ${g.origin} 應為 ${z}${g.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${g.origin} 應為 ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${U[z.format]??g.format}`}case"not_multiple_of":return`無效的數字:必須為 ${g.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${g.keys.length>1?"們":""}:${A(g.keys,"、")}`;case"invalid_key":return`${g.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${g.origin} 中有無效的值`;default:return"無效的輸入值"}}};function _8(){return{localeError:DI()}}var RI=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(g){return $[g]??null}let U={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},_={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${g.expected}, àmọ̀ a rí ${b}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${b}`}case"invalid_value":if(g.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${D(g.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${g.origin??"iye"} ${J.verb} ${z}${g.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${g.maximum}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${g.origin} ${J.verb} ${z}${g.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${g.minimum}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${U[z.format]??g.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${g.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(g.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${g.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${g.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function z8(){return{localeError:RI()}}var e5,J8=Symbol("ZodOutput"),b8=Symbol("ZodInput");class G8{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let U=v[0];if(this._map.set($,U),U&&typeof U==="object"&&"id"in U)this._idmap.set(U.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let v=this._map.get($);if(v&&typeof v==="object"&&"id"in v)this._idmap.delete(v.id);return this._map.delete($),this}get($){let v=$._zod.parent;if(v){let U={...this.get(v)??{}};delete U.id;let _={...U,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function k1(){return new G8}(e5=globalThis).__zod_globalRegistry??(e5.__zod_globalRegistry=k1());var e$=globalThis.__zod_globalRegistry;function O8($,v){return new $({type:"string",...V(v)})}function K8($,v){return new $({type:"string",coerce:!0,...V(v)})}function H1($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...V(v)})}function zU($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...V(v)})}function L1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...V(v)})}function I1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(v)})}function Y1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...V(v)})}function q1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...V(v)})}function JU($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...V(v)})}function F1($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...V(v)})}function X1($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(v)})}function w1($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...V(v)})}function A1($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(v)})}function Z1($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...V(v)})}function M1($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...V(v)})}function S1($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(v)})}function Q1($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(v)})}function N1($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(v)})}function W8($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...V(v)})}function r1($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(v)})}function u1($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(v)})}function y1($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...V(v)})}function D1($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...V(v)})}function R1($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...V(v)})}function T1($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...V(v)})}var B8={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function P8($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(v)})}function k8($,v){return new $({type:"string",format:"date",check:"string_format",...V(v)})}function H8($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...V(v)})}function L8($,v){return new $({type:"string",format:"duration",check:"string_format",...V(v)})}function I8($,v){return new $({type:"number",checks:[],...V(v)})}function Y8($,v){return new $({type:"number",coerce:!0,checks:[],...V(v)})}function q8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...V(v)})}function F8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...V(v)})}function X8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...V(v)})}function w8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...V(v)})}function A8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...V(v)})}function Z8($,v){return new $({type:"boolean",...V(v)})}function M8($,v){return new $({type:"boolean",coerce:!0,...V(v)})}function S8($,v){return new $({type:"bigint",...V(v)})}function Q8($,v){return new $({type:"bigint",coerce:!0,...V(v)})}function N8($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...V(v)})}function r8($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...V(v)})}function u8($,v){return new $({type:"symbol",...V(v)})}function y8($,v){return new $({type:"undefined",...V(v)})}function D8($,v){return new $({type:"null",...V(v)})}function R8($){return new $({type:"any"})}function T8($){return new $({type:"unknown"})}function j8($,v){return new $({type:"never",...V(v)})}function V8($,v){return new $({type:"void",...V(v)})}function C8($,v){return new $({type:"date",...V(v)})}function f8($,v){return new $({type:"date",coerce:!0,...V(v)})}function c8($,v){return new $({type:"nan",...V(v)})}function ov($,v){return new g1({check:"less_than",...V(v),value:$,inclusive:!1})}function Nv($,v){return new g1({check:"less_than",...V(v),value:$,inclusive:!0})}function nv($,v){return new U1({check:"greater_than",...V(v),value:$,inclusive:!1})}function Hv($,v){return new U1({check:"greater_than",...V(v),value:$,inclusive:!0})}function j1($){return nv(0,$)}function V1($){return ov(0,$)}function C1($){return Nv(0,$)}function f1($){return Hv(0,$)}function y6($,v){return new cz({check:"multiple_of",...V(v),value:$})}function D6($,v){return new iz({check:"max_size",...V(v),maximum:$})}function tv($,v){return new lz({check:"min_size",...V(v),minimum:$})}function g4($,v){return new hz({check:"size_equals",...V(v),size:$})}function U4($,v){return new xz({check:"max_length",...V(v),maximum:$})}function G6($,v){return new pz({check:"min_length",...V(v),minimum:$})}function _4($,v){return new oz({check:"length_equals",...V(v),length:$})}function E4($,v){return new nz({check:"string_format",format:"regex",...V(v),pattern:$})}function i4($){return new tz({check:"string_format",format:"lowercase",...V($)})}function l4($){return new dz({check:"string_format",format:"uppercase",...V($)})}function h4($,v){return new az({check:"string_format",format:"includes",...V(v),includes:$})}function x4($,v){return new sz({check:"string_format",format:"starts_with",...V(v),prefix:$})}function p4($,v){return new ez({check:"string_format",format:"ends_with",...V(v),suffix:$})}function c1($,v,U){return new $J({check:"property",property:$,schema:v,...V(U)})}function o4($,v){return new vJ({check:"mime_type",mime:$,...V(v)})}function cv($){return new gJ({check:"overwrite",tx:$})}function n4($){return cv((v)=>v.normalize($))}function t4(){return cv(($)=>$.trim())}function d4(){return cv(($)=>$.toLowerCase())}function a4(){return cv(($)=>$.toUpperCase())}function s4(){return cv(($)=>gz($))}function m8($,v,U){return new $({type:"array",element:v,...V(U)})}function jI($,v,U){return new $({type:"union",options:v,...V(U)})}function VI($,v,U){return new $({type:"union",options:v,inclusive:!1,...V(U)})}function CI($,v,U,_){return new $({type:"union",options:U,discriminator:v,...V(_)})}function fI($,v,U){return new $({type:"intersection",left:v,right:U})}function cI($,v,U,_){let g=U instanceof $$;return new $({type:"tuple",items:v,rest:g?U:null,...V(g?_:U)})}function mI($,v,U,_){return new $({type:"record",keyType:v,valueType:U,...V(_)})}function EI($,v,U,_){return new $({type:"map",keyType:v,valueType:U,...V(_)})}function iI($,v,U){return new $({type:"set",valueType:v,...V(U)})}function lI($,v,U){let _=Array.isArray(v)?Object.fromEntries(v.map((g)=>[g,g])):v;return new $({type:"enum",entries:_,...V(U)})}function hI($,v,U){return new $({type:"enum",entries:v,...V(U)})}function xI($,v,U){return new $({type:"literal",values:Array.isArray(v)?v:[v],...V(U)})}function E8($,v){return new $({type:"file",...V(v)})}function pI($,v){return new $({type:"transform",transform:v})}function oI($,v){return new $({type:"optional",innerType:v})}function nI($,v){return new $({type:"nullable",innerType:v})}function tI($,v,U){return new $({type:"default",innerType:v,get defaultValue(){return typeof U==="function"?U():_z(U)}})}function dI($,v,U){return new $({type:"nonoptional",innerType:v,...V(U)})}function aI($,v){return new $({type:"success",innerType:v})}function sI($,v,U){return new $({type:"catch",innerType:v,catchValue:typeof U==="function"?U:()=>U})}function eI($,v,U){return new $({type:"pipe",in:v,out:U})}function $Y($,v){return new $({type:"readonly",innerType:v})}function vY($,v,U){return new $({type:"template_literal",parts:v,...V(U)})}function gY($,v){return new $({type:"lazy",getter:v})}function UY($,v){return new $({type:"promise",innerType:v})}function i8($,v,U){let _=V(U);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function l8($,v,U){return new $({type:"custom",check:"custom",fn:v,...V(U)})}function h8($){let v=$7((U)=>{return U.addIssue=(_)=>{if(typeof _==="string")U.issues.push(R4(_,U.value,v._zod.def));else{let g=_;if(g.fatal)g.continue=!1;g.code??(g.code="custom"),g.input??(g.input=U.value),g.inst??(g.inst=v),g.continue??(g.continue=!v._zod.def.abort),U.issues.push(R4(g))}},$(U.value,U)});return v}function $7($,v){let U=new Q$({check:"custom",...V(v)});return U._zod.check=$,U}function x8($){let v=new Q$({check:"describe"});return v._zod.onattach=[(U)=>{let _=e$.get(U)??{};e$.add(U,{..._,description:$})}],v._zod.check=()=>{},v}function p8($){let v=new Q$({check:"meta"});return v._zod.onattach=[(U)=>{let _=e$.get(U)??{};e$.add(U,{..._,...$})}],v._zod.check=()=>{},v}function o8($,v){let U=V(v),_=U.truthy??["true","1","yes","on","y","enabled"],g=U.falsy??["false","0","no","off","n","disabled"];if(U.case!=="sensitive")_=_.map((P)=>typeof P==="string"?P.toLowerCase():P),g=g.map((P)=>typeof P==="string"?P.toLowerCase():P);let z=new Set(_),J=new Set(g),b=$.Codec??eg,O=$.Boolean??ag,W=new($.String??v4)({type:"string",error:U.error}),B=new O({type:"boolean",error:U.error}),k=new b({type:"pipe",in:W,out:B,transform:(P,F)=>{let I=P;if(U.case!=="sensitive")I=I.toLowerCase();if(z.has(I))return!0;else if(J.has(I))return!1;else return F.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:F.value,inst:k,continue:!1}),{}},reverseTransform:(P,F)=>{if(P===!0)return _[0]||"true";else return g[0]||"false"},error:U.error});return k}function e4($,v,U,_={}){let g=V(_),z={...V(_),check:"string_format",type:"string",format:v,fn:typeof U==="function"?U:(b)=>U.test(b),...g};if(U instanceof RegExp)z.pattern=U;return new $(z)}function R6($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??e$,target:v,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function X$($,v,U={path:[],schemaPath:[]}){var _;let g=$._zod.def,z=v.seen.get($);if(z){if(z.count++,U.schemaPath.includes($))z.cycle=U.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:U.path};v.seen.set($,J);let b=$._zod.toJSONSchema?.();if(b)J.schema=b;else{let W={...U,schemaPath:[...U.schemaPath,$],path:U.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,P=v.processors[g.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${g.type}`);P($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;X$(B,v,W),v.seen.get(B).isParent=!0}}let O=v.metadataRegistry.get($);if(O)Object.assign(J.schema,O);if(v.io==="input"&&Lv($))delete J.schema.examples,delete J.schema.default;if(v.io==="input"&&J.schema._prefault)(_=J.schema).default??(_.default=J.schema._prefault);return delete J.schema._prefault,v.seen.get($).schema}function T6($,v){let U=$.seen.get(v);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let _=new Map;for(let J of $.seen.entries()){let b=$.metadataRegistry.get(J[0])?.id;if(b){let O=_.get(b);if(O&&O!==J[0])throw Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);_.set(b,J[0])}}let g=(J)=>{let b=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((F)=>F);if(B)return{ref:k(B)};let P=J[1].defId??J[1].schema.id??`schema${$.counter++}`;return J[1].defId=P,{defId:P,ref:`${k("__shared")}#/${b}/${P}`}}if(J[1]===U)return{ref:"#"};let K=`${"#"}/${b}/`,W=J[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:K+W}},z=(J)=>{if(J[1].schema.$ref)return;let b=J[1],{ref:O,defId:K}=g(J);if(b.def={...b.schema},K)b.defId=K;let W=b.schema;for(let B in W)delete W[B];W.$ref=O};if($.cycles==="throw")for(let J of $.seen.entries()){let b=J[1];if(b.cycle)throw Error(`Cycle detected: #/${b.cycle?.join("/")}/<root>
144
+ `)}P.write("payload.value = newResult;"),P.write("return payload;");let q=P.compile();return(F,N)=>q(k,F,N)},z,J=_4,b=!EU.jitless,K=b&&Bz.value,W=v.catchall,B;$._zod.parse=(k,P)=>{B??(B=_.value);let X=k.value;if(!J(X))return k.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),k;if(b&&K&&P?.async===!1&&P.jitless!==!0){if(!z)z=U(v.shape);if(k=z(k,P),!W)return k;return $7([],X,k,P,B,$)}return g(k,P)}});function E5($,v,g,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let U=$.filter((z)=>!D6(z));if(U.length===1)return v.value=U[0].value,U[0];return v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,l$())))}),v}var _g=w("$ZodUnion",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),z$($._zod,"optout",()=>v.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),z$($._zod,"values",()=>{if(v.options.every((U)=>U._zod.values))return new Set(v.options.flatMap((U)=>Array.from(U._zod.values)));return}),z$($._zod,"pattern",()=>{if(v.options.every((U)=>U._zod.pattern)){let U=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${U.map((z)=>xU(z.source)).join("|")})$`)}return});let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:U.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else{if(K.issues.length===0)return K;b.push(K)}}if(!J)return E5(b,U,$,z);return Promise.all(b).then((O)=>{return E5(O,U,$,z)})}});function i5($,v,g,_){let U=$.filter((z)=>z.issues.length===0);if(U.length===1)return v.value=U[0].value,v;if(U.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,l$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:[],inclusive:!1});return v}var sJ=w("$ZodXor",($,v)=>{_g.init($,v),v.inclusive=!1;let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:U.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else b.push(K)}if(!J)return i5(b,U,$,z);return Promise.all(b).then((O)=>{return i5(O,U,$,z)})}}),eJ=w("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,_g.init($,v);let g=$._zod.parse;z$($._zod,"propValues",()=>{let U={};for(let z of v.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(z)}"`);for(let[b,O]of Object.entries(J)){if(!U[b])U[b]=new Set;for(let K of O)U[b].add(K)}}return U});let _=V4(()=>{let U=v.options,z=new Map;for(let J of U){let b=J._zod.propValues?.[v.discriminator];if(!b||b.size===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(J)}"`);for(let O of b){if(z.has(O))throw Error(`Duplicate discriminator value "${String(O)}"`);z.set(O,J)}}return z});$._zod.parse=(U,z)=>{let J=U.value;if(!_4(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let b=_.value.get(J?.[v.discriminator]);if(b)return b._zod.run(U,z);if(v.unionFallback)return g(U,z);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),U}}),$8=w("$ZodIntersection",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value,z=v.left._zod.run({value:U,issues:[]},_),J=v.right._zod.run({value:U,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([O,K])=>{return l5(g,O,K)});return l5(g,z,J)}});function PJ($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(y6($)&&y6(v)){let g=Object.keys(v),_=Object.keys($).filter((z)=>g.indexOf(z)!==-1),U={...$,...v};for(let z of _){let J=PJ($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};U[z]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let g=[];for(let _=0;_<$.length;_++){let U=$[_],z=v[_],J=PJ(U,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};g.push(J.data)}return{valid:!0,data:g}}return{valid:!1,mergeErrorPath:[]}}function l5($,v,g){let _=new Map,U;for(let b of v.issues)if(b.code==="unrecognized_keys"){U??(U=b);for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).l=!0}}else $.issues.push(b);for(let b of g.issues)if(b.code==="unrecognized_keys")for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).r=!0}else $.issues.push(b);let z=[..._].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(z.length&&U)$.issues.push({...U,keys:z});if(D6($))return $;let J=PJ(v.value,g.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var q1=w("$ZodTuple",($,v)=>{$$.init($,v);let g=v.items;$._zod.parse=(_,U)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],b=[...g].reverse().findIndex((W)=>W._zod.optin!=="optional"),O=b===-1?0:g.length-b;if(!v.rest){let W=z.length>g.length,B=z.length<O-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:g.length,inclusive:!0}:{code:"too_small",minimum:g.length},input:z,inst:$,origin:"array"}),_}let K=-1;for(let W of g){if(K++,K>=z.length){if(K>=O)continue}let B=W._zod.run({value:z[K],issues:[]},U);if(B instanceof Promise)J.push(B.then((k)=>B1(k,_,K)));else B1(B,_,K)}if(v.rest){let W=z.slice(g.length);for(let B of W){K++;let k=v.rest._zod.run({value:B,issues:[]},U);if(k instanceof Promise)J.push(k.then((P)=>B1(P,_,K)));else B1(k,_,K)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function B1($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var v8=w("$ZodRecord",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!y6(U))return g.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),g;let z=[],J=v.keyType._zod.values;if(J){g.value={};let b=new Set;for(let K of J)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){b.add(typeof K==="number"?K.toString():K);let W=v.valueType._zod.run({value:U[K],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(K,B.issues));g.value[K]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(K,W.issues));g.value[K]=W.value}}let O;for(let K in U)if(!b.has(K))O=O??[],O.push(K);if(O&&O.length>0)g.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:O})}else{g.value={};for(let b of Reflect.ownKeys(U)){if(b==="__proto__")continue;let O=v.keyType._zod.run({value:b,issues:[]},_);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&$g.test(b)&&O.issues.length){let B=v.keyType._zod.run({value:Number(b),issues:[]},_);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)O=B}if(O.issues.length){if(v.mode==="loose")g.value[b]=U[b];else g.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((B)=>Xv(B,_,l$())),input:b,path:[b],inst:$});continue}let W=v.valueType._zod.run({value:U[b],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(b,B.issues));g.value[O.value]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(b,W.issues));g.value[O.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>g);return g}}),U8=w("$ZodMap",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Map))return g.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),g;let z=[];g.value=new Map;for(let[J,b]of U){let O=v.keyType._zod.run({value:J,issues:[]},_),K=v.valueType._zod.run({value:b,issues:[]},_);if(O instanceof Promise||K instanceof Promise)z.push(Promise.all([O,K]).then(([W,B])=>{x5(W,B,g,J,U,$,_)}));else x5(O,K,g,J,U,$,_)}if(z.length)return Promise.all(z).then(()=>g);return g}});function x5($,v,g,_,U,z,J){if($.issues.length)if(hU.has(typeof _))g.issues.push(...Sv(_,$.issues));else g.issues.push({code:"invalid_key",origin:"map",input:U,inst:z,issues:$.issues.map((b)=>Xv(b,J,l$()))});if(v.issues.length)if(hU.has(typeof _))g.issues.push(...Sv(_,v.issues));else g.issues.push({origin:"map",code:"invalid_element",input:U,inst:z,key:_,issues:v.issues.map((b)=>Xv(b,J,l$()))});g.value.set($.value,v.value)}var g8=w("$ZodSet",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Set))return g.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),g;let z=[];g.value=new Set;for(let J of U){let b=v.valueType._zod.run({value:J,issues:[]},_);if(b instanceof Promise)z.push(b.then((O)=>h5(O,g)));else h5(b,g)}if(z.length)return Promise.all(z).then(()=>g);return g}});function h5($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var _8=w("$ZodEnum",($,v)=>{$$.init($,v);let g=lU(v.entries),_=new Set(g);$._zod.values=_,$._zod.pattern=new RegExp(`^(${g.filter((U)=>hU.has(typeof U)).map((U)=>typeof U==="string"?yv(U):U.toString()).join("|")})$`),$._zod.parse=(U,z)=>{let J=U.value;if(_.has(J))return U;return U.issues.push({code:"invalid_value",values:g,input:J,inst:$}),U}}),z8=w("$ZodLiteral",($,v)=>{if($$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let g=new Set(v.values);$._zod.values=g,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?yv(_):_?yv(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,U)=>{let z=_.value;if(g.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),J8=w("$ZodFile",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(U instanceof File)return g;return g.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),g}}),b8=w("$ZodTransform",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4($.constructor.name);let U=v.transform(g.value,g);if(_.async)return(U instanceof Promise?U:Promise.resolve(U)).then((J)=>{return g.value=J,g});if(U instanceof Promise)throw new ov;return g.value=U,g}});function p5($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var X1=w("$ZodOptional",($,v)=>{$$.init($,v),$._zod.optin="optional",$._zod.optout="optional",z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,void 0]):void 0}),z$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${xU(g.source)})?$`):void 0}),$._zod.parse=(g,_)=>{if(v.innerType._zod.optin==="optional"){let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>p5(z,g.value));return p5(U,g.value)}if(g.value===void 0)return g;return v.innerType._zod.run(g,_)}}),G8=w("$ZodExactOptional",($,v)=>{X1.init($,v),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(g,_)=>{return v.innerType._zod.run(g,_)}}),O8=w("$ZodNullable",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${xU(g.source)}|null)$`):void 0}),z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(g,_)=>{if(g.value===null)return g;return v.innerType._zod.run(g,_)}}),K8=w("$ZodDefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)return g.value=v.defaultValue,g;let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>o5(z,v));return o5(U,v)}});function o5($,v){if($.value===void 0)$.value=v.defaultValue;return $}var W8=w("$ZodPrefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)g.value=v.defaultValue;return v.innerType._zod.run(g,_)}}),B8=w("$ZodNonOptional",($,v)=>{$$.init($,v),z$($._zod,"values",()=>{let g=v.innerType._zod.values;return g?new Set([...g].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(g,_)=>{let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>n5(z,$));return n5(U,$)}});function n5($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var P8=w("$ZodSuccess",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4("ZodSuccess");let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{return g.value=z.issues.length===0,g});return g.value=U.issues.length===0,g}}),k8=w("$ZodCatch",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{if(g.value=z.value,z.issues.length)g.value=v.catchValue({...g,error:{issues:z.issues.map((J)=>Xv(J,_,l$()))},input:g.value}),g.issues=[];return g});if(g.value=U.value,U.issues.length)g.value=v.catchValue({...g,error:{issues:U.issues.map((z)=>Xv(z,_,l$()))},input:g.value}),g.issues=[];return g}}),H8=w("$ZodNaN",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(typeof g.value!=="number"||!Number.isNaN(g.value))return g.issues.push({input:g.value,inst:$,expected:"nan",code:"invalid_type"}),g;return g}}),I8=w("$ZodPipe",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>P1(J,v.in,_));return P1(z,v.in,_)}let U=v.in._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>P1(z,v.out,_));return P1(U,v.out,_)}});function P1($,v,g){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},g)}var zg=w("$ZodCodec",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>k1(J,v,_));return k1(z,v,_)}else{let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>k1(J,v,_));return k1(z,v,_)}}});function k1($,v,g){if($.issues.length)return $.aborted=!0,$;if((g.direction||"forward")==="forward"){let U=v.transform($.value,$);if(U instanceof Promise)return U.then((z)=>H1($,z,v.out,g));return H1($,U,v.out,g)}else{let U=v.reverseTransform($.value,$);if(U instanceof Promise)return U.then((z)=>H1($,z,v.in,g));return H1($,U,v.in,g)}}function H1($,v,g,_){if($.issues.length)return $.aborted=!0,$;return g._zod.run({value:v,issues:$.issues},_)}var Y8=w("$ZodReadonly",($,v)=>{$$.init($,v),z$($._zod,"propValues",()=>v.innerType._zod.propValues),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"optin",()=>v.innerType?._zod?.optin),z$($._zod,"optout",()=>v.innerType?._zod?.optout),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then(t5);return t5(U)}});function t5($){return $.value=Object.freeze($.value),$}var L8=w("$ZodTemplateLiteral",($,v)=>{$$.init($,v);let g=[];for(let _ of v.parts)if(typeof _==="object"&&_!==null){if(!_._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[..._._zod.traits].shift()}`);let U=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!U)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=U.startsWith("^")?1:0,J=U.endsWith("$")?U.length-1:U.length;g.push(U.slice(z,J))}else if(_===null||kz.has(typeof _))g.push(yv(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${g.join("")}$`),$._zod.parse=(_,U)=>{if(typeof _.value!=="string")return _.issues.push({input:_.value,inst:$,expected:"string",code:"invalid_type"}),_;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(_.value))return _.issues.push({input:_.value,inst:$,code:"invalid_format",format:v.format??"template_literal",pattern:$._zod.pattern.source}),_;return _}}),q8=w("$ZodFunction",($,v)=>{return $$.init($,v),$._def=v,$._zod.def=v,$.implement=(g)=>{if(typeof g!=="function")throw Error("implement() must be called with a function");return function(..._){let U=$._def.input?aU($._def.input,_):_,z=Reflect.apply(g,this,U);if($._def.output)return aU($._def.output,z);return z}},$.implementAsync=(g)=>{if(typeof g!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let U=$._def.input?await sU($._def.input,_):_,z=await Reflect.apply(g,this,U);if($._def.output)return await sU($._def.output,z);return z}},$._zod.parse=(g,_)=>{if(typeof g.value!=="function")return g.issues.push({code:"invalid_type",expected:"function",input:g.value,inst:$}),g;if($._def.output&&$._def.output._zod.def.type==="promise")g.value=$.implementAsync(g.value);else g.value=$.implement(g.value);return g},$.input=(...g)=>{let _=$.constructor;if(Array.isArray(g[0]))return new _({type:"function",input:new q1({type:"tuple",items:g[0],rest:g[1]}),output:$._def.output});return new _({type:"function",input:g[0],output:$._def.output})},$.output=(g)=>{return new $.constructor({type:"function",input:$._def.input,output:g})},$}),X8=w("$ZodPromise",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return Promise.resolve(g.value).then((U)=>v.innerType._zod.run({value:U,issues:[]},_))}}),w8=w("$ZodLazy",($,v)=>{$$.init($,v),z$($._zod,"innerType",()=>v.getter()),z$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),z$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),z$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),z$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(g,_)=>{return $._zod.innerType._zod.run(g,_)}}),F8=w("$ZodCustom",($,v)=>{S$.init($,v),$$.init($,v),$._zod.parse=(g,_)=>{return g},$._zod.check=(g)=>{let _=g.value,U=v.fn(_);if(U instanceof Promise)return U.then((z)=>d5(z,g,_,$));d5(U,g,_,$);return}});function d5($,v,g,_){if(!$){let U={code:"custom",input:g,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)U.params=_._zod.def.params;v.issues.push(C4(U))}}var Kg={};ev(Kg,{zhTW:()=>P9,zhCN:()=>B9,yo:()=>k9,vi:()=>W9,uz:()=>K9,ur:()=>O9,uk:()=>Og,ua:()=>G9,tr:()=>b9,th:()=>J9,ta:()=>z9,sv:()=>_9,sl:()=>g9,ru:()=>U9,pt:()=>v9,ps:()=>e8,pl:()=>$9,ota:()=>s8,no:()=>a8,nl:()=>d8,ms:()=>t8,mk:()=>n8,lt:()=>o8,ko:()=>p8,km:()=>bg,kh:()=>h8,ka:()=>x8,ja:()=>l8,it:()=>i8,is:()=>E8,id:()=>c8,hy:()=>m8,hu:()=>f8,he:()=>C8,frCA:()=>V8,fr:()=>j8,fi:()=>T8,fa:()=>R8,es:()=>D8,eo:()=>y8,en:()=>Jg,de:()=>u8,da:()=>r8,cs:()=>N8,ca:()=>S8,bg:()=>Q8,be:()=>M8,az:()=>Z8,ar:()=>A8});var sI=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(U){return $[U]??null}let g={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${U.expected}، ولكن تم إدخال ${b}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${b}`}case"invalid_value":if(U.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${D(U.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${U.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${g[z.format]??U.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${U.divisor}`;case"unrecognized_keys":return`معرف${U.keys.length>1?"ات":""} غريب${U.keys.length>1?"ة":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${U.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${U.origin}`;default:return"مدخل غير مقبول"}}};function A8(){return{localeError:sI()}}var eI=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Yanlış dəyər: gözlənilən instanceof ${U.expected}, daxil olan ${b}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${b}`}case"invalid_value":if(U.values.length===1)return`Yanlış dəyər: gözlənilən ${D(U.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${g[z.format]??U.format}`}case"not_multiple_of":return`Yanlış ədəd: ${U.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${U.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Z8(){return{localeError:eI()}}function U7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var $Y=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function v(U){return $[U]??null}let g={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},_={nan:"NaN",number:"лік",array:"масіў"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Няправільны ўвод: чакаўся instanceof ${U.expected}, атрымана ${b}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${b}`}case"invalid_value":if(U.values.length===1)return`Няправільны ўвод: чакалася ${D(U.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=U7(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна ${J.verb} ${z}${U.maximum.toString()} ${O}`}return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна быць ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=U7(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${U.origin} павінна ${J.verb} ${z}${U.minimum.toString()} ${O}`}return`Занадта малы: чакалася, што ${U.origin} павінна быць ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${g[z.format]??U.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${U.keys.length>1?"ключы":"ключ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${U.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${U.origin}`;default:return"Няправільны ўвод"}}};function M8(){return{localeError:$Y()}}var vY=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(U){return $[U]??null}let g={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Невалиден вход: очакван instanceof ${U.expected}, получен ${b}`;return`Невалиден вход: очакван ${z}, получен ${b}`}case"invalid_value":if(U.values.length===1)return`Невалиден вход: очакван ${D(U.values[0])}`;return`Невалидна опция: очаквано едно от ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Твърде голямо: очаква се ${U.origin??"стойност"} да съдържа ${z}${U.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${U.origin??"стойност"} да бъде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Твърде малко: очаква се ${U.origin} да съдържа ${z}${U.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${U.origin} да бъде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let J="Невалиден";if(z.format==="emoji")J="Невалидно";if(z.format==="datetime")J="Невалидно";if(z.format==="date")J="Невалидна";if(z.format==="time")J="Невалидно";if(z.format==="duration")J="Невалидна";return`${J} ${g[z.format]??U.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${U.divisor}`;case"unrecognized_keys":return`Неразпознат${U.keys.length>1?"и":""} ключ${U.keys.length>1?"ове":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${U.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${U.origin}`;default:return"Невалиден вход"}}};function Q8(){return{localeError:vY()}}var UY=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipus invàlid: s'esperava instanceof ${U.expected}, s'ha rebut ${b}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${b}`}case"invalid_value":if(U.values.length===1)return`Valor invàlid: s'esperava ${D(U.values[0])}`;return`Opció invàlida: s'esperava una de ${A(U.values," o ")}`;case"too_big":{let z=U.inclusive?"com a màxim":"menys de",J=v(U.origin);if(J)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingués ${z} ${U.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"com a mínim":"més de",J=v(U.origin);if(J)return`Massa petit: s'esperava que ${U.origin} contingués ${z} ${U.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${g[z.format]??U.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${U.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${U.origin}`;default:return"Entrada invàlida"}}};function S8(){return{localeError:UY()}}var gY=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function v(U){return $[U]??null}let g={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},_={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neplatný vstup: očekáváno instanceof ${U.expected}, obdrženo ${b}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${b}`}case"invalid_value":if(U.values.length===1)return`Neplatný vstup: očekáváno ${D(U.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí mít ${z}${U.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí být ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí mít ${z}${U.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí být ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${g[z.format]??U.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${U.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(U.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${U.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${U.origin}`;default:return"Neplatný vstup"}}};function N8(){return{localeError:gY()}}var _Y=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldigt input: forventede instanceof ${U.expected}, fik ${b}`;return`Ugyldigt input: forventede ${z}, fik ${b}`}case"invalid_value":if(U.values.length===1)return`Ugyldig værdi: forventede ${D(U.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`For stor: forventede ${b??"value"} ${J.verb} ${z} ${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${b??"value"} havde ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`For lille: forventede ${b} ${J.verb} ${z} ${U.minimum.toString()} ${J.unit}`;return`For lille: forventede ${b} havde ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${U.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${U.origin}`;default:return"Ugyldigt input"}}};function r8(){return{localeError:_Y()}}var zY=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function v(U){return $[U]??null}let g={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},_={nan:"NaN",number:"Zahl",array:"Array"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ungültige Eingabe: erwartet instanceof ${U.expected}, erhalten ${b}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${b}`}case"invalid_value":if(U.values.length===1)return`Ungültige Eingabe: erwartet ${D(U.values[0])}`;return`Ungültige Option: erwartet eine von ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ist`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ist`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${U.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${U.origin}`;default:return"Ungültige Eingabe"}}};function u8(){return{localeError:zY()}}var JY=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;return`Invalid input: expected ${z}, received ${b}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Invalid option: expected one of ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Too big: expected ${U.origin??"value"} to have ${z}${U.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Too small: expected ${U.origin} to have ${z}${U.minimum.toString()} ${J.unit}`;return`Too small: expected ${U.origin} to be ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function Jg(){return{localeError:JY()}}var bY=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(U){return $[U]??null}let g={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},_={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nevalida enigo: atendiĝis instanceof ${U.expected}, riceviĝis ${b}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${b}`}case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendiĝis ${D(U.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Tro malgranda: atendiĝis ke ${U.origin} havu ${z}${U.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${U.origin} estu ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${g[z.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} ŝlosilo${U.keys.length>1?"j":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function y8(){return{localeError:bY()}}var GY=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrada inválida: se esperaba instanceof ${U.expected}, recibido ${b}`;return`Entrada inválida: se esperaba ${z}, recibido ${b}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: se esperaba ${D(U.values[0])}`;return`Opción inválida: se esperaba una de ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`Demasiado grande: se esperaba que ${b??"valor"} tuviera ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${b??"valor"} fuera ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`Demasiado pequeño: se esperaba que ${b} tuviera ${z}${U.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${b} fuera ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${g[z.format]??U.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[U.origin]??U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[U.origin]??U.origin}`;default:return"Entrada inválida"}}};function D8(){return{localeError:GY()}}var OY=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(U){return $[U]??null}let g={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},_={nan:"NaN",number:"عدد",array:"آرایه"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ورودی نامعتبر: می‌بایست instanceof ${U.expected} می‌بود، ${b} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${b} دریافت شد`}case"invalid_value":if(U.values.length===1)return`ورودی نامعتبر: می‌بایست ${D(U.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${A(U.values,"|")} می‌بود`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} باشد`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} باشد`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${g[z.format]??U.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${U.divisor} باشد`;case"unrecognized_keys":return`کلید${U.keys.length>1?"های":""} ناشناس: ${A(U.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${U.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${U.origin}`;default:return"ورودی نامعتبر"}}};function R8(){return{localeError:OY()}}var KY=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function v(U){return $[U]??null}let g={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Virheellinen tyyppi: odotettiin instanceof ${U.expected}, oli ${b}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${b}`}case"invalid_value":if(U.values.length===1)return`Virheellinen syöte: täytyy olla ${D(U.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${U.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${U.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${g[z.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(U.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function T8(){return{localeError:KY()}}var WY=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN",number:"nombre",array:"tableau"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : instanceof ${U.expected} attendu, ${b} reçu`;return`Entrée invalide : ${z} attendu, ${b} reçu`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : ${D(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(U.values,"|")} attendue`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Trop grand : ${U.origin??"valeur"} doit ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${U.origin??"valeur"} doit être ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Trop petit : ${U.origin} doit ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : ${U.origin} doit être ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function j8(){return{localeError:WY()}}var BY=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : attendu instanceof ${U.expected}, reçu ${b}`;return`Entrée invalide : attendu ${z}, reçu ${b}`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : attendu ${D(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"≤":"<",J=v(U.origin);if(J)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${z}${U.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"≥":">",J=v(U.origin);if(J)return`Trop petit : attendu que ${U.origin} ait ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${U.origin} soit ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function V8(){return{localeError:BY()}}var PY=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},v={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},g=(K)=>K?$[K]:void 0,_=(K)=>{let W=g(K);if(W)return W.label;return K??$.unknown.label},U=(K)=>`ה${_(K)}`,z=(K)=>{return(g(K)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},J=(K)=>{if(!K)return null;return v[K]??null},b={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},O={nan:"NaN"};return(K)=>{switch(K.code){case"invalid_type":{let W=K.expected,B=O[W??""]??_(W),k=R(K.input),P=O[k]??$[k]?.label??k;if(/^[A-Z]/.test(K.expected))return`קלט לא תקין: צריך להיות instanceof ${K.expected}, התקבל ${P}`;return`קלט לא תקין: צריך להיות ${B}, התקבל ${P}`}case"invalid_value":{if(K.values.length===1)return`ערך לא תקין: הערך חייב להיות ${D(K.values[0])}`;let W=K.values.map((P)=>D(P));if(K.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let B=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${B}`}case"too_big":{let W=J(K.origin),B=U(K.origin??"value");if(K.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${K.maximum.toString()} ${W?.unit??""} ${K.inclusive?"או פחות":"לכל היותר"}`.trim();if(K.origin==="number"){let X=K.inclusive?`קטן או שווה ל-${K.maximum}`:`קטן מ-${K.maximum}`;return`גדול מדי: ${B} צריך להיות ${X}`}if(K.origin==="array"||K.origin==="set"){let X=K.origin==="set"?"צריכה":"צריך",Y=K.inclusive?`${K.maximum} ${W?.unit??""} או פחות`:`פחות מ-${K.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${X} להכיל ${Y}`.trim()}let k=K.inclusive?"<=":"<",P=z(K.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${B} ${P} ${k}${K.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${B} ${P} ${k}${K.maximum.toString()}`}case"too_small":{let W=J(K.origin),B=U(K.origin??"value");if(K.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${K.minimum.toString()} ${W?.unit??""} ${K.inclusive?"או יותר":"לפחות"}`.trim();if(K.origin==="number"){let X=K.inclusive?`גדול או שווה ל-${K.minimum}`:`גדול מ-${K.minimum}`;return`קטן מדי: ${B} צריך להיות ${X}`}if(K.origin==="array"||K.origin==="set"){let X=K.origin==="set"?"צריכה":"צריך";if(K.minimum===1&&K.inclusive){let H=K.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${X} להכיל ${H}`}let Y=K.inclusive?`${K.minimum} ${W?.unit??""} או יותר`:`יותר מ-${K.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${X} להכיל ${Y}`.trim()}let k=K.inclusive?">=":">",P=z(K.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${B} ${P} ${k}${K.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${B} ${P} ${k}${K.minimum.toString()}`}case"invalid_format":{let W=K;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let B=b[W.format],k=B?.label??W.format,X=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${X}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${K.divisor}`;case"unrecognized_keys":return`מפתח${K.keys.length>1?"ות":""} לא מזוה${K.keys.length>1?"ים":"ה"}: ${A(K.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${U(K.origin??"array")}`;default:return"קלט לא תקין"}}};function C8(){return{localeError:PY()}}var kY=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(U){return $[U]??null}let g={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},_={nan:"NaN",number:"szám",array:"tömb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Érvénytelen bemenet: a várt érték instanceof ${U.expected}, a kapott érték ${b}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${b}`}case"invalid_value":if(U.values.length===1)return`Érvénytelen bemenet: a várt érték ${D(U.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Túl nagy: ${U.origin??"érték"} mérete túl nagy ${z}${U.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${U.origin??"érték"} túl nagy: ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Túl kicsi: a bemeneti érték ${U.origin} mérete túl kicsi ${z}${U.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${U.origin} túl kicsi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${g[z.format]??U.format}`}case"not_multiple_of":return`Érvénytelen szám: ${U.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${U.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${U.origin}`;default:return"Érvénytelen bemenet"}}};function f8(){return{localeError:kY()}}function g7($,v,g){return Math.abs($)===1?v:g}function x4($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],g=$[$.length-1];return $+(v.includes(g)?"ն":"ը")}var HY=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(U){return $[U]??null}let g={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},_={nan:"NaN",number:"թիվ",array:"զանգված"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${U.expected}, ստացվել է ${b}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${b}`}case"invalid_value":if(U.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${D(U.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=g7(b,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${x4(U.origin??"արժեք")} կունենա ${z}${U.maximum.toString()} ${O}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${x4(U.origin??"արժեք")} լինի ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=g7(b,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${x4(U.origin)} կունենա ${z}${U.minimum.toString()} ${O}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${x4(U.origin)} լինի ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${g[z.format]??U.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${U.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${U.keys.length>1?"ներ":""}. ${A(U.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${x4(U.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${x4(U.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function m8(){return{localeError:HY()}}var IY=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak valid: diharapkan instanceof ${U.expected}, diterima ${b}`;return`Input tidak valid: diharapkan ${z}, diterima ${b}`}case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${D(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${g[z.format]??U.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${U.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${U.origin}`;default:return"Input tidak valid"}}};function c8(){return{localeError:IY()}}var YY=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function v(U){return $[U]??null}let g={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},_={nan:"NaN",number:"númer",array:"fylki"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera instanceof ${U.expected}`;return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera ${z}`}case"invalid_value":if(U.values.length===1)return`Rangt gildi: gert ráð fyrir ${D(U.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} hafi ${z}${U.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} sé ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Of lítið: gert er ráð fyrir að ${U.origin} hafi ${z}${U.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${U.origin} sé ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${g[z.format]??U.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${U.divisor}`;case"unrecognized_keys":return`Óþekkt ${U.keys.length>1?"ir lyklar":"ur lykill"}: ${A(U.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${U.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${U.origin}`;default:return"Rangt gildi"}}};function E8(){return{localeError:YY()}}var LY=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(U){return $[U]??null}let g={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"numero",array:"vettore"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input non valido: atteso instanceof ${U.expected}, ricevuto ${b}`;return`Input non valido: atteso ${z}, ricevuto ${b}`}case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${D(U.values[0])}`;return`Opzione non valida: atteso uno tra ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Troppo grande: ${U.origin??"valore"} deve avere ${z}${U.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Troppo piccolo: ${U.origin} deve avere ${z}${U.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${U.divisor}`;case"unrecognized_keys":return`Chiav${U.keys.length>1?"i":"e"} non riconosciut${U.keys.length>1?"e":"a"}: ${A(U.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${U.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${U.origin}`;default:return"Input non valido"}}};function i8(){return{localeError:LY()}}var qY=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(U){return $[U]??null}let g={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},_={nan:"NaN",number:"数値",array:"配列"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無効な入力: instanceof ${U.expected}が期待されましたが、${b}が入力されました`;return`無効な入力: ${z}が期待されましたが、${b}が入力されました`}case"invalid_value":if(U.values.length===1)return`無効な入力: ${D(U.values[0])}が期待されました`;return`無効な選択: ${A(U.values,"、")}のいずれかである必要があります`;case"too_big":{let z=U.inclusive?"以下である":"より小さい",J=v(U.origin);if(J)return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${z}必要があります`}case"too_small":{let z=U.inclusive?"以上である":"より大きい",J=v(U.origin);if(J)return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${g[z.format]??U.format}`}case"not_multiple_of":return`無効な数値: ${U.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${U.keys.length>1?"群":""}: ${A(U.keys,"、")}`;case"invalid_key":return`${U.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${U.origin}内の無効な値`;default:return"無効な入力"}}};function l8(){return{localeError:qY()}}var XY=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(U){return $[U]??null}let g={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},_={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${U.expected}, მიღებული ${b}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${b}`}case"invalid_value":if(U.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${D(U.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(U.values,"|")}-დან`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} იყოს ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} იყოს ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${g[z.format]??U.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${U.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${U.keys.length>1?"ები":"ი"}: ${A(U.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${U.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${U.origin}-ში`;default:return"არასწორი შეყვანა"}}};function x8(){return{localeError:XY()}}var wY=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(U){return $[U]??null}let g={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},_={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${U.expected} ប៉ុន្តែទទួលបាន ${b}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${b}`}case"invalid_value":if(U.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${D(U.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${g[z.format]??U.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${U.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(U.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function bg(){return{localeError:wY()}}function h8(){return bg()}var FY=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`잘못된 입력: 예상 타입은 instanceof ${U.expected}, 받은 타입은 ${b}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${b}입니다`}case"invalid_value":if(U.values.length===1)return`잘못된 입력: 값은 ${D(U.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(U.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=U.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",b=v(U.origin),O=b?.unit??"요소";if(b)return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()}${O} ${z}${J}`;return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()} ${z}${J}`}case"too_small":{let z=U.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",b=v(U.origin),O=b?.unit??"요소";if(b)return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()}${O} ${z}${J}`;return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${g[z.format]??U.format}`}case"not_multiple_of":return`잘못된 숫자: ${U.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(U.keys,", ")}`;case"invalid_key":return`잘못된 키: ${U.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${U.origin}`;default:return"잘못된 입력"}}};function p8(){return{localeError:FY()}}var Gg=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function _7($){let v=Math.abs($),g=v%10,_=v%100;if(_>=11&&_<=19||g===0)return"many";if(g===1)return"one";return"few"}var AY=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function v(U,z,J,b){let O=$[U]??null;if(O===null)return O;return{unit:O.unit[z],verb:O.verb[b][J?"inclusive":"notInclusive"]}}let g={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},_={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Gautas tipas ${b}, o tikėtasi - instanceof ${U.expected}`;return`Gautas tipas ${b}, o tikėtasi - ${z}`}case"invalid_value":if(U.values.length===1)return`Privalo būti ${D(U.values[0])}`;return`Privalo būti vienas iš ${A(U.values,"|")} pasirinkimų`;case"too_big":{let z=_[U.origin]??U.origin,J=v(U.origin,_7(Number(U.maximum)),U.inclusive??!1,"smaller");if(J?.verb)return`${Gg(z??U.origin??"reikšmė")} ${J.verb} ${U.maximum.toString()} ${J.unit??"elementų"}`;let b=U.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Gg(z??U.origin??"reikšmė")} turi būti ${b} ${U.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[U.origin]??U.origin,J=v(U.origin,_7(Number(U.minimum)),U.inclusive??!1,"bigger");if(J?.verb)return`${Gg(z??U.origin??"reikšmė")} ${J.verb} ${U.minimum.toString()} ${J.unit??"elementų"}`;let b=U.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Gg(z??U.origin??"reikšmė")} turi būti ${b} ${U.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${g[z.format]??U.format}`}case"not_multiple_of":return`Skaičius privalo būti ${U.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${U.keys.length>1?"i":"as"} rakt${U.keys.length>1?"ai":"as"}: ${A(U.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[U.origin]??U.origin;return`${Gg(z??U.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function o8(){return{localeError:AY()}}var ZY=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(U){return $[U]??null}let g={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},_={nan:"NaN",number:"број",array:"низа"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Грешен внес: се очекува instanceof ${U.expected}, примено ${b}`;return`Грешен внес: се очекува ${z}, примено ${b}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Грешана опција: се очекува една ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Премногу голем: се очекува ${U.origin??"вредноста"} да има ${z}${U.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${U.origin??"вредноста"} да биде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Премногу мал: се очекува ${U.origin} да има ${z}${U.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${U.origin} да биде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(U.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${U.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${U.origin}`;default:return"Грешен внес"}}};function n8(){return{localeError:ZY()}}var MY=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"nombor"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak sah: dijangka instanceof ${U.expected}, diterima ${b}`;return`Input tidak sah: dijangka ${z}, diterima ${b}`}case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${D(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: dijangka ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${g[z.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${U.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${U.origin}`;default:return"Input tidak sah"}}};function t8(){return{localeError:MY()}}var QY=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(U){return $[U]??null}let g={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},_={nan:"NaN",number:"getal"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ongeldige invoer: verwacht instanceof ${U.expected}, ontving ${b}`;return`Ongeldige invoer: verwacht ${z}, ontving ${b}`}case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${D(U.values[0])}`;return`Ongeldige optie: verwacht één van ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=U.origin==="date"?"laat":U.origin==="string"?"lang":"groot";if(J)return`Te ${b}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${b}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} is`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=U.origin==="date"?"vroeg":U.origin==="string"?"kort":"klein";if(J)return`Te ${b}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${b}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} is`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${U.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${U.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${U.origin}`;default:return"Ongeldige invoer"}}};function d8(){return{localeError:QY()}}var SY=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"tall",array:"liste"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldig input: forventet instanceof ${U.expected}, fikk ${b}`;return`Ugyldig input: forventet ${z}, fikk ${b}`}case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${D(U.values[0])}`;return`Ugyldig valg: forventet en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function a8(){return{localeError:SY()}}var NY=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},_={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Fâsit giren: umulan instanceof ${U.expected}, alınan ${b}`;return`Fâsit giren: umulan ${z}, alınan ${b}`}case"invalid_value":if(U.values.length===1)return`Fâsit giren: umulan ${D(U.values[0])}`;return`Fâsit tercih: mûteberler ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} olmalıydı.`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${g[z.format]??U.format}`}case"not_multiple_of":return`Fâsit sayı: ${U.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${U.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function s8(){return{localeError:NY()}}var rY=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(U){return $[U]??null}let g={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},_={nan:"NaN",number:"عدد",array:"ارې"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ناسم ورودي: باید instanceof ${U.expected} وای, مګر ${b} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${b} ترلاسه شو`}case"invalid_value":if(U.values.length===1)return`ناسم ورودي: باید ${D(U.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(U.values,"|")} څخه وای`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} وي`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} وي`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${g[z.format]??U.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${U.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${U.keys.length>1?"کلیډونه":"کلیډ"}: ${A(U.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${U.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${U.origin} کې`;default:return"ناسمه ورودي"}}};function e8(){return{localeError:rY()}}var uY=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function v(U){return $[U]??null}let g={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},_={nan:"NaN",number:"liczba",array:"tablica"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${U.expected}, otrzymano ${b}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${b}`}case"invalid_value":if(U.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${D(U.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Za duża wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Za mała wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${g[z.format]??U.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${U.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${U.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function $9(){return{localeError:uY()}}var yY=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(U){return $[U]??null}let g={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",number:"número",null:"nulo"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipo inválido: esperado instanceof ${U.expected}, recebido ${b}`;return`Tipo inválido: esperado ${z}, recebido ${b}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: esperado ${D(U.values[0])}`;return`Opção inválida: esperada uma das ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Muito pequeno: esperado que ${U.origin} tivesse ${z}${U.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${g[z.format]??U.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Chave inválida em ${U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${U.origin}`;default:return"Campo inválido"}}};function v9(){return{localeError:yY()}}function z7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var DY=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function v(U){return $[U]??null}let g={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},_={nan:"NaN",number:"число",array:"массив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неверный ввод: ожидалось instanceof ${U.expected}, получено ${b}`;return`Неверный ввод: ожидалось ${z}, получено ${b}`}case"invalid_value":if(U.values.length===1)return`Неверный ввод: ожидалось ${D(U.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=z7(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет иметь ${z}${U.maximum.toString()} ${O}`}return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=z7(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${U.origin} будет иметь ${z}${U.minimum.toString()} ${O}`}return`Слишком маленькое значение: ожидалось, что ${U.origin} будет ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${g[z.format]??U.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспознанн${U.keys.length>1?"ые":"ый"} ключ${U.keys.length>1?"и":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${U.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${U.origin}`;default:return"Неверные входные данные"}}};function U9(){return{localeError:DY()}}var RY=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(U){return $[U]??null}let g={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},_={nan:"NaN",number:"število",array:"tabela"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neveljaven vnos: pričakovano instanceof ${U.expected}, prejeto ${b}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${b}`}case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pričakovano ${D(U.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} imelo ${z}${U.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Premajhno: pričakovano, da bo ${U.origin} imelo ${z}${U.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${g[z.format]??U.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i ključi":" ključ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function g9(){return{localeError:RY()}}var TY=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function v(U){return $[U]??null}let g={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},_={nan:"NaN",number:"antal",array:"lista"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ogiltig inmatning: förväntat instanceof ${U.expected}, fick ${b}`;return`Ogiltig inmatning: förväntat ${z}, fick ${b}`}case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: förväntat ${D(U.values[0])}`;return`Ogiltigt val: förväntade en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`För stor(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${g[z.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${U.origin??"värdet"}`;default:return"Ogiltig input"}}};function _9(){return{localeError:TY()}}var jY=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(U){return $[U]??null}let g={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${U.expected}, பெறப்பட்டது ${b}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${b}`}case"invalid_value":if(U.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${D(U.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(U.values,"|")} இல் ஒன்று`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${g[z.format]??U.format}`}case"not_multiple_of":return`தவறான எண்: ${U.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${U.keys.length>1?"கள்":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${U.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function z9(){return{localeError:jY()}}var VY=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(U){return $[U]??null}let g={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},_={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${U.expected} แต่ได้รับ ${b}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${b}`}case"invalid_value":if(U.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${D(U.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(U.origin);if(J)return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"อย่างน้อย":"มากกว่า",J=v(U.origin);if(J)return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${g[z.format]??U.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${U.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(U.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${U.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${U.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function J9(){return{localeError:VY()}}var CY=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(U){return $[U]??null}let g={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Geçersiz değer: beklenen instanceof ${U.expected}, alınan ${b}`;return`Geçersiz değer: beklenen ${z}, alınan ${b}`}case"invalid_value":if(U.values.length===1)return`Geçersiz değer: beklenen ${D(U.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${g[z.format]??U.format}`}case"not_multiple_of":return`Geçersiz sayı: ${U.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${U.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function b9(){return{localeError:CY()}}var fY=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(U){return $[U]??null}let g={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неправильні вхідні дані: очікується instanceof ${U.expected}, отримано ${b}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${b}`}case"invalid_value":if(U.values.length===1)return`Неправильні вхідні дані: очікується ${D(U.values[0])}`;return`Неправильна опція: очікується одне з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Занадто велике: очікується, що ${U.origin??"значення"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${U.origin??"значення"} буде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Занадто мале: очікується, що ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${U.origin} буде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${g[z.format]??U.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${U.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${U.keys.length>1?"і":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${U.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${U.origin}`;default:return"Неправильні вхідні дані"}}};function Og(){return{localeError:fY()}}function G9(){return Og()}var mY=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(U){return $[U]??null}let g={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},_={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`غلط ان پٹ: instanceof ${U.expected} متوقع تھا، ${b} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${b} موصول ہوا`}case"invalid_value":if(U.values.length===1)return`غلط ان پٹ: ${D(U.values[0])} متوقع تھا`;return`غلط آپشن: ${A(U.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`بہت بڑا: ${U.origin??"ویلیو"} کے ${z}${U.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${U.origin??"ویلیو"} کا ${z}${U.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`بہت چھوٹا: ${U.origin} کے ${z}${U.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${U.origin} کا ${z}${U.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${g[z.format]??U.format}`}case"not_multiple_of":return`غلط نمبر: ${U.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${U.keys.length>1?"ز":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`${U.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${U.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function O9(){return{localeError:mY()}}var cY=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function v(U){return $[U]??null}let g={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},_={nan:"NaN",number:"raqam",array:"massiv"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${U.expected}, qabul qilingan ${b}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${b}`}case"invalid_value":if(U.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${D(U.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${g[z.format]??U.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${U.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${U.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function K9(){return{localeError:cY()}}var EY=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function v(U){return $[U]??null}let g={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},_={nan:"NaN",number:"số",array:"mảng"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${U.expected}, nhận được ${b}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${b}`}case"invalid_value":if(U.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${D(U.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Quá nhỏ: mong đợi ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${g[z.format]??U.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${U.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(U.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${U.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${U.origin}`;default:return"Đầu vào không hợp lệ"}}};function W9(){return{localeError:EY()}}var iY=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(U){return $[U]??null}let g={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},_={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`无效输入:期望 instanceof ${U.expected},实际接收 ${b}`;return`无效输入:期望 ${z},实际接收 ${b}`}case"invalid_value":if(U.values.length===1)return`无效输入:期望 ${D(U.values[0])}`;return`无效选项:期望以下之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${g[z.format]??U.format}`}case"not_multiple_of":return`无效数字:必须是 ${U.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${U.origin} 中包含无效值(value)`;default:return"无效输入"}}};function B9(){return{localeError:iY()}}var lY=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(U){return $[U]??null}let g={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無效的輸入值:預期為 instanceof ${U.expected},但收到 ${b}`;return`無效的輸入值:預期為 ${z},但收到 ${b}`}case"invalid_value":if(U.values.length===1)return`無效的輸入值:預期為 ${D(U.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${g[z.format]??U.format}`}case"not_multiple_of":return`無效的數字:必須為 ${U.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${U.keys.length>1?"們":""}:${A(U.keys,"、")}`;case"invalid_key":return`${U.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${U.origin} 中有無效的值`;default:return"無效的輸入值"}}};function P9(){return{localeError:lY()}}var xY=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(U){return $[U]??null}let g={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},_={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${U.expected}, àmọ̀ a rí ${b}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${b}`}case"invalid_value":if(U.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${D(U.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${U.origin??"iye"} ${J.verb} ${z}${U.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${U.maximum}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${U.origin} ${J.verb} ${z}${U.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${U.minimum}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${g[z.format]??U.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${U.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(U.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${U.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${U.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function k9(){return{localeError:xY()}}var J7,H9=Symbol("ZodOutput"),I9=Symbol("ZodInput");class Y9{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let g=v[0];if(this._map.set($,g),g&&typeof g==="object"&&"id"in g)this._idmap.set(g.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let v=this._map.get($);if(v&&typeof v==="object"&&"id"in v)this._idmap.delete(v.id);return this._map.delete($),this}get($){let v=$._zod.parent;if(v){let g={...this.get(v)??{}};delete g.id;let _={...g,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function w1(){return new Y9}(J7=globalThis).__zod_globalRegistry??(J7.__zod_globalRegistry=w1());var e$=globalThis.__zod_globalRegistry;function L9($,v){return new $({type:"string",...V(v)})}function q9($,v){return new $({type:"string",coerce:!0,...V(v)})}function F1($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...V(v)})}function Wg($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...V(v)})}function A1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...V(v)})}function Z1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(v)})}function M1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...V(v)})}function Q1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...V(v)})}function Bg($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...V(v)})}function S1($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...V(v)})}function N1($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(v)})}function r1($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...V(v)})}function u1($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(v)})}function y1($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...V(v)})}function D1($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...V(v)})}function R1($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(v)})}function T1($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(v)})}function j1($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(v)})}function X9($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...V(v)})}function V1($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(v)})}function C1($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(v)})}function f1($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...V(v)})}function m1($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...V(v)})}function c1($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...V(v)})}function E1($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...V(v)})}var w9={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function F9($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(v)})}function A9($,v){return new $({type:"string",format:"date",check:"string_format",...V(v)})}function Z9($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...V(v)})}function M9($,v){return new $({type:"string",format:"duration",check:"string_format",...V(v)})}function Q9($,v){return new $({type:"number",checks:[],...V(v)})}function S9($,v){return new $({type:"number",coerce:!0,checks:[],...V(v)})}function N9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...V(v)})}function r9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...V(v)})}function u9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...V(v)})}function y9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...V(v)})}function D9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...V(v)})}function R9($,v){return new $({type:"boolean",...V(v)})}function T9($,v){return new $({type:"boolean",coerce:!0,...V(v)})}function j9($,v){return new $({type:"bigint",...V(v)})}function V9($,v){return new $({type:"bigint",coerce:!0,...V(v)})}function C9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...V(v)})}function f9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...V(v)})}function m9($,v){return new $({type:"symbol",...V(v)})}function c9($,v){return new $({type:"undefined",...V(v)})}function E9($,v){return new $({type:"null",...V(v)})}function i9($){return new $({type:"any"})}function l9($){return new $({type:"unknown"})}function x9($,v){return new $({type:"never",...V(v)})}function h9($,v){return new $({type:"void",...V(v)})}function p9($,v){return new $({type:"date",...V(v)})}function o9($,v){return new $({type:"date",coerce:!0,...V(v)})}function n9($,v){return new $({type:"nan",...V(v)})}function nv($,v){return new O1({check:"less_than",...V(v),value:$,inclusive:!1})}function Nv($,v){return new O1({check:"less_than",...V(v),value:$,inclusive:!0})}function tv($,v){return new K1({check:"greater_than",...V(v),value:$,inclusive:!1})}function Hv($,v){return new K1({check:"greater_than",...V(v),value:$,inclusive:!0})}function i1($){return tv(0,$)}function l1($){return nv(0,$)}function x1($){return Nv(0,$)}function h1($){return Hv(0,$)}function R6($,v){return new nz({check:"multiple_of",...V(v),value:$})}function T6($,v){return new az({check:"max_size",...V(v),maximum:$})}function dv($,v){return new sz({check:"min_size",...V(v),minimum:$})}function b4($,v){return new ez({check:"size_equals",...V(v),size:$})}function G4($,v){return new $J({check:"max_length",...V(v),maximum:$})}function G6($,v){return new vJ({check:"min_length",...V(v),minimum:$})}function O4($,v){return new UJ({check:"length_equals",...V(v),length:$})}function h4($,v){return new gJ({check:"string_format",format:"regex",...V(v),pattern:$})}function p4($){return new _J({check:"string_format",format:"lowercase",...V($)})}function o4($){return new zJ({check:"string_format",format:"uppercase",...V($)})}function n4($,v){return new JJ({check:"string_format",format:"includes",...V(v),includes:$})}function t4($,v){return new bJ({check:"string_format",format:"starts_with",...V(v),prefix:$})}function d4($,v){return new GJ({check:"string_format",format:"ends_with",...V(v),suffix:$})}function p1($,v,g){return new OJ({check:"property",property:$,schema:v,...V(g)})}function a4($,v){return new KJ({check:"mime_type",mime:$,...V(v)})}function mv($){return new WJ({check:"overwrite",tx:$})}function s4($){return mv((v)=>v.normalize($))}function e4(){return mv(($)=>$.trim())}function $U(){return mv(($)=>$.toLowerCase())}function vU(){return mv(($)=>$.toUpperCase())}function UU(){return mv(($)=>Wz($))}function t9($,v,g){return new $({type:"array",element:v,...V(g)})}function pY($,v,g){return new $({type:"union",options:v,...V(g)})}function oY($,v,g){return new $({type:"union",options:v,inclusive:!1,...V(g)})}function nY($,v,g,_){return new $({type:"union",options:g,discriminator:v,...V(_)})}function tY($,v,g){return new $({type:"intersection",left:v,right:g})}function dY($,v,g,_){let U=g instanceof $$;return new $({type:"tuple",items:v,rest:U?g:null,...V(U?_:g)})}function aY($,v,g,_){return new $({type:"record",keyType:v,valueType:g,...V(_)})}function sY($,v,g,_){return new $({type:"map",keyType:v,valueType:g,...V(_)})}function eY($,v,g){return new $({type:"set",valueType:v,...V(g)})}function $L($,v,g){let _=Array.isArray(v)?Object.fromEntries(v.map((U)=>[U,U])):v;return new $({type:"enum",entries:_,...V(g)})}function vL($,v,g){return new $({type:"enum",entries:v,...V(g)})}function UL($,v,g){return new $({type:"literal",values:Array.isArray(v)?v:[v],...V(g)})}function d9($,v){return new $({type:"file",...V(v)})}function gL($,v){return new $({type:"transform",transform:v})}function _L($,v){return new $({type:"optional",innerType:v})}function zL($,v){return new $({type:"nullable",innerType:v})}function JL($,v,g){return new $({type:"default",innerType:v,get defaultValue(){return typeof g==="function"?g():Pz(g)}})}function bL($,v,g){return new $({type:"nonoptional",innerType:v,...V(g)})}function GL($,v){return new $({type:"success",innerType:v})}function OL($,v,g){return new $({type:"catch",innerType:v,catchValue:typeof g==="function"?g:()=>g})}function KL($,v,g){return new $({type:"pipe",in:v,out:g})}function WL($,v){return new $({type:"readonly",innerType:v})}function BL($,v,g){return new $({type:"template_literal",parts:v,...V(g)})}function PL($,v){return new $({type:"lazy",getter:v})}function kL($,v){return new $({type:"promise",innerType:v})}function a9($,v,g){let _=V(g);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function s9($,v,g){return new $({type:"custom",check:"custom",fn:v,...V(g)})}function e9($){let v=b7((g)=>{return g.addIssue=(_)=>{if(typeof _==="string")g.issues.push(C4(_,g.value,v._zod.def));else{let U=_;if(U.fatal)U.continue=!1;U.code??(U.code="custom"),U.input??(U.input=g.value),U.inst??(U.inst=v),U.continue??(U.continue=!v._zod.def.abort),g.issues.push(C4(U))}},$(g.value,g)});return v}function b7($,v){let g=new S$({check:"custom",...V(v)});return g._zod.check=$,g}function $b($){let v=new S$({check:"describe"});return v._zod.onattach=[(g)=>{let _=e$.get(g)??{};e$.add(g,{..._,description:$})}],v._zod.check=()=>{},v}function vb($){let v=new S$({check:"meta"});return v._zod.onattach=[(g)=>{let _=e$.get(g)??{};e$.add(g,{..._,...$})}],v._zod.check=()=>{},v}function Ub($,v){let g=V(v),_=g.truthy??["true","1","yes","on","y","enabled"],U=g.falsy??["false","0","no","off","n","disabled"];if(g.case!=="sensitive")_=_.map((P)=>typeof P==="string"?P.toLowerCase():P),U=U.map((P)=>typeof P==="string"?P.toLowerCase():P);let z=new Set(_),J=new Set(U),b=$.Codec??zg,O=$.Boolean??gg,W=new($.String??J4)({type:"string",error:g.error}),B=new O({type:"boolean",error:g.error}),k=new b({type:"pipe",in:W,out:B,transform:(P,X)=>{let Y=P;if(g.case!=="sensitive")Y=Y.toLowerCase();if(z.has(Y))return!0;else if(J.has(Y))return!1;else return X.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:X.value,inst:k,continue:!1}),{}},reverseTransform:(P,X)=>{if(P===!0)return _[0]||"true";else return U[0]||"false"},error:g.error});return k}function gU($,v,g,_={}){let U=V(_),z={...V(_),check:"string_format",type:"string",format:v,fn:typeof g==="function"?g:(b)=>g.test(b),...U};if(g instanceof RegExp)z.pattern=g;return new $(z)}function j6($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??e$,target:v,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function w$($,v,g={path:[],schemaPath:[]}){var _;let U=$._zod.def,z=v.seen.get($);if(z){if(z.count++,g.schemaPath.includes($))z.cycle=g.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:g.path};v.seen.set($,J);let b=$._zod.toJSONSchema?.();if(b)J.schema=b;else{let W={...g,schemaPath:[...g.schemaPath,$],path:g.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,P=v.processors[U.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${U.type}`);P($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;w$(B,v,W),v.seen.get(B).isParent=!0}}let O=v.metadataRegistry.get($);if(O)Object.assign(J.schema,O);if(v.io==="input"&&Iv($))delete J.schema.examples,delete J.schema.default;if(v.io==="input"&&J.schema._prefault)(_=J.schema).default??(_.default=J.schema._prefault);return delete J.schema._prefault,v.seen.get($).schema}function V6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=new Map;for(let J of $.seen.entries()){let b=$.metadataRegistry.get(J[0])?.id;if(b){let O=_.get(b);if(O&&O!==J[0])throw Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);_.set(b,J[0])}}let U=(J)=>{let b=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((X)=>X);if(B)return{ref:k(B)};let P=J[1].defId??J[1].schema.id??`schema${$.counter++}`;return J[1].defId=P,{defId:P,ref:`${k("__shared")}#/${b}/${P}`}}if(J[1]===g)return{ref:"#"};let K=`${"#"}/${b}/`,W=J[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:K+W}},z=(J)=>{if(J[1].schema.$ref)return;let b=J[1],{ref:O,defId:K}=U(J);if(b.def={...b.schema},K)b.defId=K;let W=b.schema;for(let B in W)delete W[B];W.$ref=O};if($.cycles==="throw")for(let J of $.seen.entries()){let b=J[1];if(b.cycle)throw Error(`Cycle detected: #/${b.cycle?.join("/")}/<root>
145
145
 
146
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of $.seen.entries()){let b=J[1];if(v===J[0]){z(J);continue}if($.external){let K=$.external.registry.get(J[0])?.id;if(v!==J[0]&&K){z(J);continue}}if($.metadataRegistry.get(J[0])?.id){z(J);continue}if(b.cycle){z(J);continue}if(b.count>1){if($.reused==="ref"){z(J);continue}}}}function j6($,v){let U=$.seen.get(v);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let _=(J)=>{let b=$.seen.get(J);if(b.ref===null)return;let O=b.def??b.schema,K={...O},W=b.ref;if(b.ref=null,W){_(W);let k=$.seen.get(W),P=k.schema;if(P.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))O.allOf=O.allOf??[],O.allOf.push(P);else Object.assign(O,P);if(Object.assign(O,K),J._zod.parent===W)for(let I in O){if(I==="$ref"||I==="allOf")continue;if(!(I in K))delete O[I]}if(P.$ref&&k.def)for(let I in O){if(I==="$ref"||I==="allOf")continue;if(I in k.def&&JSON.stringify(O[I])===JSON.stringify(k.def[I]))delete O[I]}}let B=J._zod.parent;if(B&&B!==W){_(B);let k=$.seen.get(B);if(k?.schema.$ref){if(O.$ref=k.schema.$ref,k.def)for(let P in O){if(P==="$ref"||P==="allOf")continue;if(P in k.def&&JSON.stringify(O[P])===JSON.stringify(k.def[P]))delete O[P]}}}$.override({zodSchema:J,jsonSchema:O,path:b.path??[]})};for(let J of[...$.seen.entries()].reverse())_(J[0]);let g={};if($.target==="draft-2020-12")g.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")g.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")g.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let J=$.external.registry.get(v)?.id;if(!J)throw Error("Schema is missing an `id` property");g.$id=$.external.uri(J)}Object.assign(g,U.def??U.schema);let z=$.external?.defs??{};for(let J of $.seen.entries()){let b=J[1];if(b.def&&b.defId)z[b.defId]=b.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")g.$defs=z;else g.definitions=z;try{let J=JSON.parse(JSON.stringify(g));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:$g(v,"input",$.processors),output:$g(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function Lv($,v){let U=v??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return Lv(_.element,U);if(_.type==="set")return Lv(_.valueType,U);if(_.type==="lazy")return Lv(_.getter(),U);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return Lv(_.innerType,U);if(_.type==="intersection")return Lv(_.left,U)||Lv(_.right,U);if(_.type==="record"||_.type==="map")return Lv(_.keyType,U)||Lv(_.valueType,U);if(_.type==="pipe")return Lv(_.in,U)||Lv(_.out,U);if(_.type==="object"){for(let g in _.shape)if(Lv(_.shape[g],U))return!0;return!1}if(_.type==="union"){for(let g of _.options)if(Lv(g,U))return!0;return!1}if(_.type==="tuple"){for(let g of _.items)if(Lv(g,U))return!0;if(_.rest&&Lv(_.rest,U))return!0;return!1}return!1}var n8=($,v={})=>(U)=>{let _=R6({...U,processors:v});return X$($,_),T6(_,$),j6(_,$)},$g=($,v,U={})=>(_)=>{let{libraryOptions:g,target:z}=_??{},J=R6({...g??{},target:z,io:v,processors:U});return X$($,J),T6(J,$),j6(J,$)};var _Y={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},t8=($,v,U,_)=>{let g=U;g.type="string";let{minimum:z,maximum:J,format:b,patterns:O,contentEncoding:K}=$._zod.bag;if(typeof z==="number")g.minLength=z;if(typeof J==="number")g.maxLength=J;if(b){if(g.format=_Y[b]??b,g.format==="")delete g.format;if(b==="time")delete g.format}if(K)g.contentEncoding=K;if(O&&O.size>0){let W=[...O];if(W.length===1)g.pattern=W[0].source;else if(W.length>1)g.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},d8=($,v,U,_)=>{let g=U,{minimum:z,maximum:J,format:b,multipleOf:O,exclusiveMaximum:K,exclusiveMinimum:W}=$._zod.bag;if(typeof b==="string"&&b.includes("int"))g.type="integer";else g.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")g.minimum=W,g.exclusiveMinimum=!0;else g.exclusiveMinimum=W;if(typeof z==="number"){if(g.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete g.minimum;else delete g.exclusiveMinimum}if(typeof K==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")g.maximum=K,g.exclusiveMaximum=!0;else g.exclusiveMaximum=K;if(typeof J==="number"){if(g.maximum=J,typeof K==="number"&&v.target!=="draft-04")if(K<=J)delete g.maximum;else delete g.exclusiveMaximum}if(typeof O==="number")g.multipleOf=O},a8=($,v,U,_)=>{U.type="boolean"},s8=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},e8=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},$9=($,v,U,_)=>{if(v.target==="openapi-3.0")U.type="string",U.nullable=!0,U.enum=[null];else U.type="null"},v9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},g9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},U9=($,v,U,_)=>{U.not={}},_9=($,v,U,_)=>{},z9=($,v,U,_)=>{},J9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},b9=($,v,U,_)=>{let g=$._zod.def,z=Cg(g.entries);if(z.every((J)=>typeof J==="number"))U.type="number";if(z.every((J)=>typeof J==="string"))U.type="string";U.enum=z},G9=($,v,U,_)=>{let g=$._zod.def,z=[];for(let J of g.values)if(J===void 0){if(v.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(v.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(J));else z.push(J);if(z.length===0);else if(z.length===1){let J=z[0];if(U.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")U.enum=[J];else U.const=J}else{if(z.every((J)=>typeof J==="number"))U.type="number";if(z.every((J)=>typeof J==="string"))U.type="string";if(z.every((J)=>typeof J==="boolean"))U.type="boolean";if(z.every((J)=>J===null))U.type="null";U.enum=z}},O9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},K9=($,v,U,_)=>{let g=U,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");g.type="string",g.pattern=z.source},W9=($,v,U,_)=>{let g=U,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:b,mime:O}=$._zod.bag;if(J!==void 0)z.minLength=J;if(b!==void 0)z.maxLength=b;if(O)if(O.length===1)z.contentMediaType=O[0],Object.assign(g,z);else Object.assign(g,z),g.anyOf=O.map((K)=>({contentMediaType:K}));else Object.assign(g,z)},B9=($,v,U,_)=>{U.type="boolean"},P9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},k9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},H9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},L9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},I9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Y9=($,v,U,_)=>{let g=U,z=$._zod.def,{minimum:J,maximum:b}=$._zod.bag;if(typeof J==="number")g.minItems=J;if(typeof b==="number")g.maxItems=b;g.type="array",g.items=X$(z.element,v,{..._,path:[..._.path,"items"]})},q9=($,v,U,_)=>{let g=U,z=$._zod.def;g.type="object",g.properties={};let J=z.shape;for(let K in J)g.properties[K]=X$(J[K],v,{..._,path:[..._.path,"properties",K]});let b=new Set(Object.keys(J)),O=new Set([...b].filter((K)=>{let W=z.shape[K]._zod;if(v.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(O.size>0)g.required=Array.from(O);if(z.catchall?._zod.def.type==="never")g.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")g.additionalProperties=!1}else if(z.catchall)g.additionalProperties=X$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},E1=($,v,U,_)=>{let g=$._zod.def,z=g.inclusive===!1,J=g.options.map((b,O)=>X$(b,v,{..._,path:[..._.path,z?"oneOf":"anyOf",O]}));if(z)U.oneOf=J;else U.anyOf=J},F9=($,v,U,_)=>{let g=$._zod.def,z=X$(g.left,v,{..._,path:[..._.path,"allOf",0]}),J=X$(g.right,v,{..._,path:[..._.path,"allOf",1]}),b=(K)=>("allOf"in K)&&Object.keys(K).length===1,O=[...b(z)?z.allOf:[z],...b(J)?J.allOf:[J]];U.allOf=O},X9=($,v,U,_)=>{let g=U,z=$._zod.def;g.type="array";let J=v.target==="draft-2020-12"?"prefixItems":"items",b=v.target==="draft-2020-12"?"items":v.target==="openapi-3.0"?"items":"additionalItems",O=z.items.map((k,P)=>X$(k,v,{..._,path:[..._.path,J,P]})),K=z.rest?X$(z.rest,v,{..._,path:[..._.path,b,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(g.prefixItems=O,K)g.items=K}else if(v.target==="openapi-3.0"){if(g.items={anyOf:O},K)g.items.anyOf.push(K);if(g.minItems=O.length,!K)g.maxItems=O.length}else if(g.items=O,K)g.additionalItems=K;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")g.minItems=W;if(typeof B==="number")g.maxItems=B},w9=($,v,U,_)=>{let g=U,z=$._zod.def;g.type="object";let J=z.keyType,O=J._zod.bag?.patterns;if(z.mode==="loose"&&O&&O.size>0){let W=X$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});g.patternProperties={};for(let B of O)g.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")g.propertyNames=X$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});g.additionalProperties=X$(z.valueType,v,{..._,path:[..._.path,"additionalProperties"]})}let K=J._zod.values;if(K){let W=[...K].filter((B)=>typeof B==="string"||typeof B==="number");if(W.length>0)g.required=W}},A9=($,v,U,_)=>{let g=$._zod.def,z=X$(g.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=g.innerType,U.nullable=!0;else U.anyOf=[z,{type:"null"}]},Z9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},M9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType,U.default=JSON.parse(JSON.stringify(g.defaultValue))},S9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);if(z.ref=g.innerType,v.io==="input")U._prefault=JSON.parse(JSON.stringify(g.defaultValue))},Q9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType;let J;try{J=g.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}U.default=J},N9=($,v,U,_)=>{let g=$._zod.def,z=v.io==="input"?g.in._zod.def.type==="transform"?g.out:g.in:g.out;X$(z,v,_);let J=v.seen.get($);J.ref=z},r9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType,U.readOnly=!0},u9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},i1=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},y9=($,v,U,_)=>{let g=$._zod.innerType;X$(g,v,_);let z=v.seen.get($);z.ref=g},m1={string:t8,number:d8,boolean:a8,bigint:s8,symbol:e8,null:$9,undefined:v9,void:g9,never:U9,any:_9,unknown:z9,date:J9,enum:b9,literal:G9,nan:O9,template_literal:K9,file:W9,success:B9,custom:P9,function:k9,transform:H9,map:L9,set:I9,array:Y9,object:q9,union:E1,intersection:F9,tuple:X9,record:w9,nullable:A9,nonoptional:Z9,default:M9,prefault:S9,catch:Q9,pipe:N9,readonly:r9,promise:u9,optional:i1,lazy:y9};function l1($,v){if("_idmap"in $){let _=$,g=R6({...v,processors:m1}),z={};for(let O of _._idmap.entries()){let[K,W]=O;X$(W,g)}let J={},b={registry:_,uri:v?.uri,defs:z};g.external=b;for(let O of _._idmap.entries()){let[K,W]=O;T6(g,W),J[K]=j6(g,W)}if(Object.keys(z).length>0){let O=g.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[O]:z}}return{schemas:J}}let U=R6({...v,processors:m1});return X$($,U),T6(U,$),j6(U,$)}class D9{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";this.ctx=R6({processors:m1,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return X$($,this.ctx,v)}emit($,v){if(v){if(v.cycles)this.ctx.cycles=v.cycles;if(v.reused)this.ctx.reused=v.reused;if(v.external)this.ctx.external=v.external}T6(this.ctx,$);let U=j6(this.ctx,$),{"~standard":_,...g}=U;return g}}var v7={};var bU={};ev(bU,{xor:()=>x7,xid:()=>L7,void:()=>E7,uuidv7:()=>G7,uuidv6:()=>b7,uuidv4:()=>J7,uuid:()=>z7,url:()=>O7,unknown:()=>S$,union:()=>A$,undefined:()=>c7,ulid:()=>H7,uint64:()=>C7,uint32:()=>T7,tuple:()=>GG,transform:()=>H0,templateLiteral:()=>gW,symbol:()=>f7,superRefine:()=>TG,success:()=>e7,stringbool:()=>OW,stringFormat:()=>Q7,string:()=>Z,strictObject:()=>h7,set:()=>t7,refine:()=>RG,record:()=>N$,readonly:()=>QG,promise:()=>UW,preprocess:()=>YU,prefault:()=>FG,pipe:()=>KU,partialRecord:()=>p7,optional:()=>y$,object:()=>h,number:()=>I$,nullish:()=>s7,nullable:()=>OU,null:()=>bg,nonoptional:()=>XG,never:()=>k0,nativeEnum:()=>d7,nanoid:()=>B7,nan:()=>$W,meta:()=>bW,map:()=>n7,mac:()=>q7,looseRecord:()=>o7,looseObject:()=>$v,literal:()=>t,lazy:()=>uG,ksuid:()=>I7,keyof:()=>l7,jwt:()=>S7,json:()=>KW,ipv6:()=>F7,ipv4:()=>Y7,intersection:()=>Gg,int64:()=>V7,int32:()=>R7,int:()=>t1,instanceof:()=>GW,httpUrl:()=>K7,hostname:()=>N7,hex:()=>r7,hash:()=>u7,guid:()=>_7,function:()=>_W,float64:()=>D7,float32:()=>y7,file:()=>a7,exactOptional:()=>HG,enum:()=>vv,emoji:()=>W7,email:()=>U7,e164:()=>M7,discriminatedUnion:()=>HU,describe:()=>JW,date:()=>i7,custom:()=>F0,cuid2:()=>k7,cuid:()=>P7,codec:()=>vW,cidrv6:()=>w7,cidrv4:()=>X7,check:()=>zW,catch:()=>ZG,boolean:()=>h$,bigint:()=>j7,base64url:()=>Z7,base64:()=>A7,array:()=>J$,any:()=>m7,_function:()=>_W,_default:()=>YG,_ZodString:()=>d1,ZodXor:()=>_G,ZodXID:()=>U0,ZodVoid:()=>gG,ZodUnknown:()=>$G,ZodUnion:()=>kU,ZodUndefined:()=>a9,ZodUUID:()=>dv,ZodURL:()=>WU,ZodULID:()=>g0,ZodType:()=>_$,ZodTuple:()=>bG,ZodTransform:()=>PG,ZodTemplateLiteral:()=>NG,ZodSymbol:()=>d9,ZodSuccess:()=>wG,ZodStringFormat:()=>M$,ZodString:()=>gg,ZodSet:()=>KG,ZodRecord:()=>LU,ZodReadonly:()=>SG,ZodPromise:()=>yG,ZodPrefault:()=>qG,ZodPipe:()=>Y0,ZodOptional:()=>L0,ZodObject:()=>PU,ZodNumberFormat:()=>z4,ZodNumber:()=>_g,ZodNullable:()=>LG,ZodNull:()=>s9,ZodNonOptional:()=>I0,ZodNever:()=>vG,ZodNanoID:()=>e1,ZodNaN:()=>MG,ZodMap:()=>OG,ZodMAC:()=>t9,ZodLiteral:()=>WG,ZodLazy:()=>rG,ZodKSUID:()=>_0,ZodJWT:()=>B0,ZodIntersection:()=>JG,ZodIPv6:()=>J0,ZodIPv4:()=>z0,ZodGUID:()=>GU,ZodFunction:()=>DG,ZodFile:()=>BG,ZodExactOptional:()=>kG,ZodEnum:()=>vg,ZodEmoji:()=>s1,ZodEmail:()=>a1,ZodE164:()=>W0,ZodDiscriminatedUnion:()=>zG,ZodDefault:()=>IG,ZodDate:()=>BU,ZodCustomStringFormat:()=>Ug,ZodCustom:()=>IU,ZodCodec:()=>q0,ZodCatch:()=>AG,ZodCUID2:()=>v0,ZodCUID:()=>$0,ZodCIDRv6:()=>G0,ZodCIDRv4:()=>b0,ZodBoolean:()=>zg,ZodBigIntFormat:()=>P0,ZodBigInt:()=>Jg,ZodBase64URL:()=>K0,ZodBase64:()=>O0,ZodArray:()=>UG,ZodAny:()=>e9});var h1={};ev(h1,{uppercase:()=>l4,trim:()=>t4,toUpperCase:()=>a4,toLowerCase:()=>d4,startsWith:()=>x4,slugify:()=>s4,size:()=>g4,regex:()=>E4,property:()=>c1,positive:()=>j1,overwrite:()=>cv,normalize:()=>n4,nonpositive:()=>C1,nonnegative:()=>f1,negative:()=>V1,multipleOf:()=>y6,minSize:()=>tv,minLength:()=>G6,mime:()=>o4,maxSize:()=>D6,maxLength:()=>U4,lte:()=>Nv,lt:()=>ov,lowercase:()=>i4,length:()=>_4,includes:()=>h4,gte:()=>Hv,gt:()=>nv,endsWith:()=>p4});var V6={};ev(V6,{time:()=>j9,duration:()=>V9,datetime:()=>R9,date:()=>T9,ZodISOTime:()=>o1,ZodISODuration:()=>n1,ZodISODateTime:()=>x1,ZodISODate:()=>p1});var x1=X("ZodISODateTime",($,v)=>{LJ.init($,v),M$.init($,v)});function R9($){return P8(x1,$)}var p1=X("ZodISODate",($,v)=>{IJ.init($,v),M$.init($,v)});function T9($){return k8(p1,$)}var o1=X("ZodISOTime",($,v)=>{YJ.init($,v),M$.init($,v)});function j9($){return H8(o1,$)}var n1=X("ZodISODuration",($,v)=>{qJ.init($,v),M$.init($,v)});function V9($){return L8(n1,$)}var g7=($,v)=>{ig.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(U)=>hg($,U)},flatten:{value:(U)=>lg($,U)},addIssue:{value:(U)=>{$.issues.push(U),$.message=JSON.stringify($.issues,y4,2)}},addIssues:{value:(U)=>{$.issues.push(...U),$.message=JSON.stringify($.issues,y4,2)}},isEmpty:{get(){return $.issues.length===0}}})},JY=X("ZodError",g7),wv=X("ZodError",g7,{Parent:Error});var C9=T4(wv),f9=j4(wv),c9=V4(wv),m9=f4(wv),E9=o_(wv),i9=n_(wv),l9=t_(wv),h9=d_(wv),x9=a_(wv),p9=s_(wv),o9=e_(wv),n9=$1(wv);var _$=X("ZodType",($,v)=>{return $$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:$g($,"input"),output:$g($,"output")}}),$.toJSONSchema=n8($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...U)=>{return $.clone(j.mergeDefs(v,{checks:[...v.checks??[],...U.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(U,_)=>kv($,U,_),$.brand=()=>$,$.register=(U,_)=>{return U.add($,_),$},$.parse=(U,_)=>C9($,U,_,{callee:$.parse}),$.safeParse=(U,_)=>c9($,U,_),$.parseAsync=async(U,_)=>f9($,U,_,{callee:$.parseAsync}),$.safeParseAsync=async(U,_)=>m9($,U,_),$.spa=$.safeParseAsync,$.encode=(U,_)=>E9($,U,_),$.decode=(U,_)=>i9($,U,_),$.encodeAsync=async(U,_)=>l9($,U,_),$.decodeAsync=async(U,_)=>h9($,U,_),$.safeEncode=(U,_)=>x9($,U,_),$.safeDecode=(U,_)=>p9($,U,_),$.safeEncodeAsync=async(U,_)=>o9($,U,_),$.safeDecodeAsync=async(U,_)=>n9($,U,_),$.refine=(U,_)=>$.check(RG(U,_)),$.superRefine=(U)=>$.check(TG(U)),$.overwrite=(U)=>$.check(cv(U)),$.optional=()=>y$($),$.exactOptional=()=>HG($),$.nullable=()=>OU($),$.nullish=()=>y$(OU($)),$.nonoptional=(U)=>XG($,U),$.array=()=>J$($),$.or=(U)=>A$([$,U]),$.and=(U)=>Gg($,U),$.transform=(U)=>KU($,H0(U)),$.default=(U)=>YG($,U),$.prefault=(U)=>FG($,U),$.catch=(U)=>ZG($,U),$.pipe=(U)=>KU($,U),$.readonly=()=>QG($),$.describe=(U)=>{let _=$.clone();return e$.add(_,{description:U}),_},Object.defineProperty($,"description",{get(){return e$.get($)?.description},configurable:!0}),$.meta=(...U)=>{if(U.length===0)return e$.get($);let _=$.clone();return e$.add(_,U[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(U)=>U($),$}),d1=X("_ZodString",($,v)=>{v4.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>t8($,_,g,z);let U=$._zod.bag;$.format=U.format??null,$.minLength=U.minimum??null,$.maxLength=U.maximum??null,$.regex=(..._)=>$.check(E4(..._)),$.includes=(..._)=>$.check(h4(..._)),$.startsWith=(..._)=>$.check(x4(..._)),$.endsWith=(..._)=>$.check(p4(..._)),$.min=(..._)=>$.check(G6(..._)),$.max=(..._)=>$.check(U4(..._)),$.length=(..._)=>$.check(_4(..._)),$.nonempty=(..._)=>$.check(G6(1,..._)),$.lowercase=(_)=>$.check(i4(_)),$.uppercase=(_)=>$.check(l4(_)),$.trim=()=>$.check(t4()),$.normalize=(..._)=>$.check(n4(..._)),$.toLowerCase=()=>$.check(d4()),$.toUpperCase=()=>$.check(a4()),$.slugify=()=>$.check(s4())}),gg=X("ZodString",($,v)=>{v4.init($,v),d1.init($,v),$.email=(U)=>$.check(H1(a1,U)),$.url=(U)=>$.check(JU(WU,U)),$.jwt=(U)=>$.check(T1(B0,U)),$.emoji=(U)=>$.check(F1(s1,U)),$.guid=(U)=>$.check(zU(GU,U)),$.uuid=(U)=>$.check(L1(dv,U)),$.uuidv4=(U)=>$.check(I1(dv,U)),$.uuidv6=(U)=>$.check(Y1(dv,U)),$.uuidv7=(U)=>$.check(q1(dv,U)),$.nanoid=(U)=>$.check(X1(e1,U)),$.guid=(U)=>$.check(zU(GU,U)),$.cuid=(U)=>$.check(w1($0,U)),$.cuid2=(U)=>$.check(A1(v0,U)),$.ulid=(U)=>$.check(Z1(g0,U)),$.base64=(U)=>$.check(y1(O0,U)),$.base64url=(U)=>$.check(D1(K0,U)),$.xid=(U)=>$.check(M1(U0,U)),$.ksuid=(U)=>$.check(S1(_0,U)),$.ipv4=(U)=>$.check(Q1(z0,U)),$.ipv6=(U)=>$.check(N1(J0,U)),$.cidrv4=(U)=>$.check(r1(b0,U)),$.cidrv6=(U)=>$.check(u1(G0,U)),$.e164=(U)=>$.check(R1(W0,U)),$.datetime=(U)=>$.check(R9(U)),$.date=(U)=>$.check(T9(U)),$.time=(U)=>$.check(j9(U)),$.duration=(U)=>$.check(V9(U))});function Z($){return O8(gg,$)}var M$=X("ZodStringFormat",($,v)=>{Z$.init($,v),d1.init($,v)}),a1=X("ZodEmail",($,v)=>{bJ.init($,v),M$.init($,v)});function U7($){return H1(a1,$)}var GU=X("ZodGUID",($,v)=>{zJ.init($,v),M$.init($,v)});function _7($){return zU(GU,$)}var dv=X("ZodUUID",($,v)=>{JJ.init($,v),M$.init($,v)});function z7($){return L1(dv,$)}function J7($){return I1(dv,$)}function b7($){return Y1(dv,$)}function G7($){return q1(dv,$)}var WU=X("ZodURL",($,v)=>{GJ.init($,v),M$.init($,v)});function O7($){return JU(WU,$)}function K7($){return JU(WU,{protocol:/^https?$/,hostname:Dv.domain,...j.normalizeParams($)})}var s1=X("ZodEmoji",($,v)=>{OJ.init($,v),M$.init($,v)});function W7($){return F1(s1,$)}var e1=X("ZodNanoID",($,v)=>{KJ.init($,v),M$.init($,v)});function B7($){return X1(e1,$)}var $0=X("ZodCUID",($,v)=>{WJ.init($,v),M$.init($,v)});function P7($){return w1($0,$)}var v0=X("ZodCUID2",($,v)=>{BJ.init($,v),M$.init($,v)});function k7($){return A1(v0,$)}var g0=X("ZodULID",($,v)=>{PJ.init($,v),M$.init($,v)});function H7($){return Z1(g0,$)}var U0=X("ZodXID",($,v)=>{kJ.init($,v),M$.init($,v)});function L7($){return M1(U0,$)}var _0=X("ZodKSUID",($,v)=>{HJ.init($,v),M$.init($,v)});function I7($){return S1(_0,$)}var z0=X("ZodIPv4",($,v)=>{FJ.init($,v),M$.init($,v)});function Y7($){return Q1(z0,$)}var t9=X("ZodMAC",($,v)=>{wJ.init($,v),M$.init($,v)});function q7($){return W8(t9,$)}var J0=X("ZodIPv6",($,v)=>{XJ.init($,v),M$.init($,v)});function F7($){return N1(J0,$)}var b0=X("ZodCIDRv4",($,v)=>{AJ.init($,v),M$.init($,v)});function X7($){return r1(b0,$)}var G0=X("ZodCIDRv6",($,v)=>{ZJ.init($,v),M$.init($,v)});function w7($){return u1(G0,$)}var O0=X("ZodBase64",($,v)=>{SJ.init($,v),M$.init($,v)});function A7($){return y1(O0,$)}var K0=X("ZodBase64URL",($,v)=>{QJ.init($,v),M$.init($,v)});function Z7($){return D1(K0,$)}var W0=X("ZodE164",($,v)=>{NJ.init($,v),M$.init($,v)});function M7($){return R1(W0,$)}var B0=X("ZodJWT",($,v)=>{rJ.init($,v),M$.init($,v)});function S7($){return T1(B0,$)}var Ug=X("ZodCustomStringFormat",($,v)=>{uJ.init($,v),M$.init($,v)});function Q7($,v,U={}){return e4(Ug,$,v,U)}function N7($){return e4(Ug,"hostname",Dv.hostname,$)}function r7($){return e4(Ug,"hex",Dv.hex,$)}function u7($,v){let U=v?.enc??"hex",_=`${$}_${U}`,g=Dv[_];if(!g)throw Error(`Unrecognized hash format: ${_}`);return e4(Ug,_,g,v)}var _g=X("ZodNumber",($,v)=>{K1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>d8($,_,g,z),$.gt=(_,g)=>$.check(nv(_,g)),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.lt=(_,g)=>$.check(ov(_,g)),$.lte=(_,g)=>$.check(Nv(_,g)),$.max=(_,g)=>$.check(Nv(_,g)),$.int=(_)=>$.check(t1(_)),$.safe=(_)=>$.check(t1(_)),$.positive=(_)=>$.check(nv(0,_)),$.nonnegative=(_)=>$.check(Hv(0,_)),$.negative=(_)=>$.check(ov(0,_)),$.nonpositive=(_)=>$.check(Nv(0,_)),$.multipleOf=(_,g)=>$.check(y6(_,g)),$.step=(_,g)=>$.check(y6(_,g)),$.finite=()=>$;let U=$._zod.bag;$.minValue=Math.max(U.minimum??Number.NEGATIVE_INFINITY,U.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(U.maximum??Number.POSITIVE_INFINITY,U.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(U.format??"").includes("int")||Number.isSafeInteger(U.multipleOf??0.5),$.isFinite=!0,$.format=U.format??null});function I$($){return I8(_g,$)}var z4=X("ZodNumberFormat",($,v)=>{yJ.init($,v),_g.init($,v)});function t1($){return q8(z4,$)}function y7($){return F8(z4,$)}function D7($){return X8(z4,$)}function R7($){return w8(z4,$)}function T7($){return A8(z4,$)}var zg=X("ZodBoolean",($,v)=>{ag.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>a8($,U,_,g)});function h$($){return Z8(zg,$)}var Jg=X("ZodBigInt",($,v)=>{W1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>s8($,_,g,z),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.gt=(_,g)=>$.check(nv(_,g)),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.lt=(_,g)=>$.check(ov(_,g)),$.lte=(_,g)=>$.check(Nv(_,g)),$.max=(_,g)=>$.check(Nv(_,g)),$.positive=(_)=>$.check(nv(BigInt(0),_)),$.negative=(_)=>$.check(ov(BigInt(0),_)),$.nonpositive=(_)=>$.check(Nv(BigInt(0),_)),$.nonnegative=(_)=>$.check(Hv(BigInt(0),_)),$.multipleOf=(_,g)=>$.check(y6(_,g));let U=$._zod.bag;$.minValue=U.minimum??null,$.maxValue=U.maximum??null,$.format=U.format??null});function j7($){return S8(Jg,$)}var P0=X("ZodBigIntFormat",($,v)=>{DJ.init($,v),Jg.init($,v)});function V7($){return N8(P0,$)}function C7($){return r8(P0,$)}var d9=X("ZodSymbol",($,v)=>{RJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>e8($,U,_,g)});function f7($){return u8(d9,$)}var a9=X("ZodUndefined",($,v)=>{TJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>v9($,U,_,g)});function c7($){return y8(a9,$)}var s9=X("ZodNull",($,v)=>{jJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>$9($,U,_,g)});function bg($){return D8(s9,$)}var e9=X("ZodAny",($,v)=>{VJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>_9($,U,_,g)});function m7(){return R8(e9)}var $G=X("ZodUnknown",($,v)=>{CJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>z9($,U,_,g)});function S$(){return T8($G)}var vG=X("ZodNever",($,v)=>{fJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>U9($,U,_,g)});function k0($){return j8(vG,$)}var gG=X("ZodVoid",($,v)=>{cJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>g9($,U,_,g)});function E7($){return V8(gG,$)}var BU=X("ZodDate",($,v)=>{mJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>J9($,_,g,z),$.min=(_,g)=>$.check(Hv(_,g)),$.max=(_,g)=>$.check(Nv(_,g));let U=$._zod.bag;$.minDate=U.minimum?new Date(U.minimum):null,$.maxDate=U.maximum?new Date(U.maximum):null});function i7($){return C8(BU,$)}var UG=X("ZodArray",($,v)=>{EJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Y9($,U,_,g),$.element=v.element,$.min=(U,_)=>$.check(G6(U,_)),$.nonempty=(U)=>$.check(G6(1,U)),$.max=(U,_)=>$.check(U4(U,_)),$.length=(U,_)=>$.check(_4(U,_)),$.unwrap=()=>$.element});function J$($,v){return m8(UG,$,v)}function l7($){let v=$._zod.def.shape;return vv(Object.keys(v))}var PU=X("ZodObject",($,v)=>{iJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>q9($,U,_,g),j.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>vv(Object.keys($._zod.def.shape)),$.catchall=(U)=>$.clone({...$._zod.def,catchall:U}),$.passthrough=()=>$.clone({...$._zod.def,catchall:S$()}),$.loose=()=>$.clone({...$._zod.def,catchall:S$()}),$.strict=()=>$.clone({...$._zod.def,catchall:k0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(U)=>{return j.extend($,U)},$.safeExtend=(U)=>{return j.safeExtend($,U)},$.merge=(U)=>j.merge($,U),$.pick=(U)=>j.pick($,U),$.omit=(U)=>j.omit($,U),$.partial=(...U)=>j.partial(L0,$,U[0]),$.required=(...U)=>j.required(I0,$,U[0])});function h($,v){let U={type:"object",shape:$??{},...j.normalizeParams(v)};return new PU(U)}function h7($,v){return new PU({type:"object",shape:$,catchall:k0(),...j.normalizeParams(v)})}function $v($,v){return new PU({type:"object",shape:$,catchall:S$(),...j.normalizeParams(v)})}var kU=X("ZodUnion",($,v)=>{sg.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>E1($,U,_,g),$.options=v.options});function A$($,v){return new kU({type:"union",options:$,...j.normalizeParams(v)})}var _G=X("ZodXor",($,v)=>{kU.init($,v),lJ.init($,v),$._zod.processJSONSchema=(U,_,g)=>E1($,U,_,g),$.options=v.options});function x7($,v){return new _G({type:"union",options:$,inclusive:!1,...j.normalizeParams(v)})}var zG=X("ZodDiscriminatedUnion",($,v)=>{kU.init($,v),hJ.init($,v)});function HU($,v,U){return new zG({type:"union",options:v,discriminator:$,...j.normalizeParams(U)})}var JG=X("ZodIntersection",($,v)=>{xJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>F9($,U,_,g)});function Gg($,v){return new JG({type:"intersection",left:$,right:v})}var bG=X("ZodTuple",($,v)=>{B1.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>X9($,U,_,g),$.rest=(U)=>$.clone({...$._zod.def,rest:U})});function GG($,v,U){let _=v instanceof $$,g=_?U:v;return new bG({type:"tuple",items:$,rest:_?v:null,...j.normalizeParams(g)})}var LU=X("ZodRecord",($,v)=>{pJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>w9($,U,_,g),$.keyType=v.keyType,$.valueType=v.valueType});function N$($,v,U){return new LU({type:"record",keyType:$,valueType:v,...j.normalizeParams(U)})}function p7($,v,U){let _=kv($);return _._zod.values=void 0,new LU({type:"record",keyType:_,valueType:v,...j.normalizeParams(U)})}function o7($,v,U){return new LU({type:"record",keyType:$,valueType:v,mode:"loose",...j.normalizeParams(U)})}var OG=X("ZodMap",($,v)=>{oJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>L9($,U,_,g),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...U)=>$.check(tv(...U)),$.nonempty=(U)=>$.check(tv(1,U)),$.max=(...U)=>$.check(D6(...U)),$.size=(...U)=>$.check(g4(...U))});function n7($,v,U){return new OG({type:"map",keyType:$,valueType:v,...j.normalizeParams(U)})}var KG=X("ZodSet",($,v)=>{nJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>I9($,U,_,g),$.min=(...U)=>$.check(tv(...U)),$.nonempty=(U)=>$.check(tv(1,U)),$.max=(...U)=>$.check(D6(...U)),$.size=(...U)=>$.check(g4(...U))});function t7($,v){return new KG({type:"set",valueType:$,...j.normalizeParams(v)})}var vg=X("ZodEnum",($,v)=>{tJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>b9($,_,g,z),$.enum=v.entries,$.options=Object.values(v.entries);let U=new Set(Object.keys(v.entries));$.extract=(_,g)=>{let z={};for(let J of _)if(U.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new vg({...v,checks:[],...j.normalizeParams(g),entries:z})},$.exclude=(_,g)=>{let z={...v.entries};for(let J of _)if(U.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new vg({...v,checks:[],...j.normalizeParams(g),entries:z})}});function vv($,v){let U=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new vg({type:"enum",entries:U,...j.normalizeParams(v)})}function d7($,v){return new vg({type:"enum",entries:$,...j.normalizeParams(v)})}var WG=X("ZodLiteral",($,v)=>{dJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>G9($,U,_,g),$.values=new Set(v.values),Object.defineProperty($,"value",{get(){if(v.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return v.values[0]}})});function t($,v){return new WG({type:"literal",values:Array.isArray($)?$:[$],...j.normalizeParams(v)})}var BG=X("ZodFile",($,v)=>{aJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>W9($,U,_,g),$.min=(U,_)=>$.check(tv(U,_)),$.max=(U,_)=>$.check(D6(U,_)),$.mime=(U,_)=>$.check(o4(Array.isArray(U)?U:[U],_))});function a7($){return E8(BG,$)}var PG=X("ZodTransform",($,v)=>{sJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>H9($,U,_,g),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6($.constructor.name);U.addIssue=(z)=>{if(typeof z==="string")U.issues.push(j.issue(z,U.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=U.value),J.inst??(J.inst=$),U.issues.push(j.issue(J))}};let g=v.transform(U.value,U);if(g instanceof Promise)return g.then((z)=>{return U.value=z,U});return U.value=g,U}});function H0($){return new PG({type:"transform",transform:$})}var L0=X("ZodOptional",($,v)=>{P1.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>i1($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function y$($){return new L0({type:"optional",innerType:$})}var kG=X("ZodExactOptional",($,v)=>{eJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>i1($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function HG($){return new kG({type:"optional",innerType:$})}var LG=X("ZodNullable",($,v)=>{$b.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>A9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function OU($){return new LG({type:"nullable",innerType:$})}function s7($){return y$(OU($))}var IG=X("ZodDefault",($,v)=>{vb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>M9($,U,_,g),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function YG($,v){return new IG({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var qG=X("ZodPrefault",($,v)=>{gb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>S9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function FG($,v){return new qG({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var I0=X("ZodNonOptional",($,v)=>{Ub.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Z9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function XG($,v){return new I0({type:"nonoptional",innerType:$,...j.normalizeParams(v)})}var wG=X("ZodSuccess",($,v)=>{_b.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>B9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function e7($){return new wG({type:"success",innerType:$})}var AG=X("ZodCatch",($,v)=>{zb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Q9($,U,_,g),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function ZG($,v){return new AG({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var MG=X("ZodNaN",($,v)=>{Jb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>O9($,U,_,g)});function $W($){return c8(MG,$)}var Y0=X("ZodPipe",($,v)=>{bb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>N9($,U,_,g),$.in=v.in,$.out=v.out});function KU($,v){return new Y0({type:"pipe",in:$,out:v})}var q0=X("ZodCodec",($,v)=>{Y0.init($,v),eg.init($,v)});function vW($,v,U){return new q0({type:"pipe",in:$,out:v,transform:U.decode,reverseTransform:U.encode})}var SG=X("ZodReadonly",($,v)=>{Gb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>r9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function QG($){return new SG({type:"readonly",innerType:$})}var NG=X("ZodTemplateLiteral",($,v)=>{Ob.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>K9($,U,_,g)});function gW($,v){return new NG({type:"template_literal",parts:$,...j.normalizeParams(v)})}var rG=X("ZodLazy",($,v)=>{Bb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>y9($,U,_,g),$.unwrap=()=>$._zod.def.getter()});function uG($){return new rG({type:"lazy",getter:$})}var yG=X("ZodPromise",($,v)=>{Wb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>u9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function UW($){return new yG({type:"promise",innerType:$})}var DG=X("ZodFunction",($,v)=>{Kb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>k9($,U,_,g)});function _W($){return new DG({type:"function",input:Array.isArray($?.input)?GG($?.input):$?.input??J$(S$()),output:$?.output??S$()})}var IU=X("ZodCustom",($,v)=>{Pb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>P9($,U,_,g)});function zW($){let v=new Q$({check:"custom"});return v._zod.check=$,v}function F0($,v){return i8(IU,$??(()=>!0),v)}function RG($,v={}){return l8(IU,$,v)}function TG($){return h8($)}var JW=x8,bW=p8;function GW($,v={}){let U=new IU({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...j.normalizeParams(v)});return U._zod.bag.Class=$,U._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:U,path:[...U._zod.def.path??[]]})},U}var OW=(...$)=>o8({Codec:q0,Boolean:zg,String:gg},...$);function KW($){let v=uG(()=>{return A$([Z($),I$(),h$(),bg(),J$(v),N$(Z(),v)])});return v}function YU($,v){return KU(H0($),v)}var GY={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function OY($){l$({customError:$})}function KY(){return l$().customError}var jG;(function($){})(jG||(jG={}));var E={...bU,...h1,iso:V6},WY=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function BY($,v){let U=$.$schema;if(U==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(U==="http://json-schema.org/draft-07/schema#")return"draft-7";if(U==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function PY($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let U=$.slice(1).split("/").filter(Boolean);if(U.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(U[0]===_){let g=U[1];if(!g||!v.defs[g])throw Error(`Reference not found: ${$}`);return v.defs[g]}throw Error(`Reference not found: ${$}`)}function WW($,v){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return E.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let g=$.$ref;if(v.refs.has(g))return v.refs.get(g);if(v.processing.has(g))return E.lazy(()=>{if(!v.refs.has(g))throw Error(`Circular reference not resolved: ${g}`);return v.refs.get(g)});v.processing.add(g);let z=PY(g,v),J=Ov(z,v);return v.refs.set(g,J),v.processing.delete(g),J}if($.enum!==void 0){let g=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&g.length===1&&g[0]===null)return E.null();if(g.length===0)return E.never();if(g.length===1)return E.literal(g[0]);if(g.every((J)=>typeof J==="string"))return E.enum(g);let z=g.map((J)=>E.literal(J));if(z.length<2)return z[0];return E.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return E.literal($.const);let U=$.type;if(Array.isArray(U)){let g=U.map((z)=>{let J={...$,type:z};return WW(J,v)});if(g.length===0)return E.never();if(g.length===1)return g[0];return E.union(g)}if(!U)return E.any();let _;switch(U){case"string":{let g=E.string();if($.format){let z=$.format;if(z==="email")g=g.check(E.email());else if(z==="uri"||z==="uri-reference")g=g.check(E.url());else if(z==="uuid"||z==="guid")g=g.check(E.uuid());else if(z==="date-time")g=g.check(E.iso.datetime());else if(z==="date")g=g.check(E.iso.date());else if(z==="time")g=g.check(E.iso.time());else if(z==="duration")g=g.check(E.iso.duration());else if(z==="ipv4")g=g.check(E.ipv4());else if(z==="ipv6")g=g.check(E.ipv6());else if(z==="mac")g=g.check(E.mac());else if(z==="cidr")g=g.check(E.cidrv4());else if(z==="cidr-v6")g=g.check(E.cidrv6());else if(z==="base64")g=g.check(E.base64());else if(z==="base64url")g=g.check(E.base64url());else if(z==="e164")g=g.check(E.e164());else if(z==="jwt")g=g.check(E.jwt());else if(z==="emoji")g=g.check(E.emoji());else if(z==="nanoid")g=g.check(E.nanoid());else if(z==="cuid")g=g.check(E.cuid());else if(z==="cuid2")g=g.check(E.cuid2());else if(z==="ulid")g=g.check(E.ulid());else if(z==="xid")g=g.check(E.xid());else if(z==="ksuid")g=g.check(E.ksuid())}if(typeof $.minLength==="number")g=g.min($.minLength);if(typeof $.maxLength==="number")g=g.max($.maxLength);if($.pattern)g=g.regex(new RegExp($.pattern));_=g;break}case"number":case"integer":{let g=U==="integer"?E.number().int():E.number();if(typeof $.minimum==="number")g=g.min($.minimum);if(typeof $.maximum==="number")g=g.max($.maximum);if(typeof $.exclusiveMinimum==="number")g=g.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")g=g.gt($.minimum);if(typeof $.exclusiveMaximum==="number")g=g.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")g=g.lt($.maximum);if(typeof $.multipleOf==="number")g=g.multipleOf($.multipleOf);_=g;break}case"boolean":{_=E.boolean();break}case"null":{_=E.null();break}case"object":{let g={},z=$.properties||{},J=new Set($.required||[]);for(let[O,K]of Object.entries(z)){let W=Ov(K,v);g[O]=J.has(O)?W:W.optional()}if($.propertyNames){let O=Ov($.propertyNames,v),K=$.additionalProperties&&typeof $.additionalProperties==="object"?Ov($.additionalProperties,v):E.any();if(Object.keys(g).length===0){_=E.record(O,K);break}let W=E.object(g).passthrough(),B=E.looseRecord(O,K);_=E.intersection(W,B);break}if($.patternProperties){let O=$.patternProperties,K=Object.keys(O),W=[];for(let k of K){let P=Ov(O[k],v),F=E.string().regex(new RegExp(k));W.push(E.looseRecord(F,P))}let B=[];if(Object.keys(g).length>0)B.push(E.object(g).passthrough());if(B.push(...W),B.length===0)_=E.object({}).passthrough();else if(B.length===1)_=B[0];else{let k=E.intersection(B[0],B[1]);for(let P=2;P<B.length;P++)k=E.intersection(k,B[P]);_=k}break}let b=E.object(g);if($.additionalProperties===!1)_=b.strict();else if(typeof $.additionalProperties==="object")_=b.catchall(Ov($.additionalProperties,v));else _=b.passthrough();break}case"array":{let{prefixItems:g,items:z}=$;if(g&&Array.isArray(g)){let J=g.map((O)=>Ov(O,v)),b=z&&typeof z==="object"&&!Array.isArray(z)?Ov(z,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(Array.isArray(z)){let J=z.map((O)=>Ov(O,v)),b=$.additionalItems&&typeof $.additionalItems==="object"?Ov($.additionalItems,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(z!==void 0){let J=Ov(z,v),b=E.array(J);if(typeof $.minItems==="number")b=b.min($.minItems);if(typeof $.maxItems==="number")b=b.max($.maxItems);_=b}else _=E.array(E.any());break}default:throw Error(`Unsupported type: ${U}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function Ov($,v){if(typeof $==="boolean")return $?E.any():E.never();let U=WW($,v),_=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let b=$.anyOf.map((K)=>Ov(K,v)),O=E.union(b);U=_?E.intersection(U,O):O}if($.oneOf&&Array.isArray($.oneOf)){let b=$.oneOf.map((K)=>Ov(K,v)),O=E.xor(b);U=_?E.intersection(U,O):O}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)U=_?U:E.any();else{let b=_?U:Ov($.allOf[0],v),O=_?0:1;for(let K=O;K<$.allOf.length;K++)b=E.intersection(b,Ov($.allOf[K],v));U=b}if($.nullable===!0&&v.version==="openapi-3.0")U=E.nullable(U);if($.readOnly===!0)U=E.readonly(U);let g={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let b of z)if(b in $)g[b]=$[b];let J=["contentEncoding","contentMediaType","contentSchema"];for(let b of J)if(b in $)g[b]=$[b];for(let b of Object.keys($))if(!WY.has(b))g[b]=$[b];if(Object.keys(g).length>0)v.registry.add(U,g);return U}function BW($,v){if(typeof $==="boolean")return $?E.any():E.never();let U=BY($,v?.defaultTarget),_=$.$defs||$.definitions||{},g={version:U,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??e$};return Ov($,g)}var VG={};ev(VG,{string:()=>kY,number:()=>HY,date:()=>YY,boolean:()=>LY,bigint:()=>IY});function kY($){return K8(gg,$)}function HY($){return Y8(_g,$)}function LY($){return M8(zg,$)}function IY($){return Q8(Jg,$)}function YY($){return f8(BU,$)}l$($U());var C6="io.modelcontextprotocol/related-task",w0="2.0",gv=F0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),PW=A$([Z(),I$().int()]),kW=Z(),cQ=$v({ttl:A$([I$(),bg()]).optional(),pollInterval:I$().optional()}),qY=h({ttl:I$().optional()}),FY=h({taskId:Z()}),CG=$v({progressToken:PW.optional(),[C6]:FY.optional()}),rv=h({_meta:CG.optional()}),qU=rv.extend({task:qY.optional()}),HW=($)=>qU.safeParse($).success,Uv=h({method:Z(),params:rv.loose().optional()}),Rv=h({_meta:CG.optional()}),Tv=h({method:Z(),params:Rv.loose().optional()}),_v=$v({_meta:CG.optional()}),Kg=A$([Z(),I$().int()]),LW=h({jsonrpc:t(w0),id:Kg,...Uv.shape}).strict(),fG=($)=>LW.safeParse($).success,IW=h({jsonrpc:t(w0),...Tv.shape}).strict(),YW=($)=>IW.safeParse($).success,cG=h({jsonrpc:t(w0),id:Kg,result:_v}).strict(),FU=($)=>cG.safeParse($).success;var w$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(w$||(w$={}));var mG=h({jsonrpc:t(w0),id:Kg.optional(),error:h({code:I$().int(),message:Z(),data:S$().optional()})}).strict();var qW=($)=>mG.safeParse($).success;var FW=A$([LW,IW,cG,mG]),mQ=A$([cG,mG]),A0=_v.strict(),XY=Rv.extend({requestId:Kg.optional(),reason:Z().optional()}),Z0=Tv.extend({method:t("notifications/cancelled"),params:XY}),wY=h({src:Z(),mimeType:Z().optional(),sizes:J$(Z()).optional(),theme:vv(["light","dark"]).optional()}),XU=h({icons:J$(wY).optional()}),Og=h({name:Z(),title:Z().optional()}),wU=Og.extend({...Og.shape,...XU.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),AY=Gg(h({applyDefaults:h$().optional()}),N$(Z(),S$())),ZY=YU(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},Gg(h({form:AY.optional(),url:gv.optional()}),N$(Z(),S$()).optional())),MY=$v({list:gv.optional(),cancel:gv.optional(),requests:$v({sampling:$v({createMessage:gv.optional()}).optional(),elicitation:$v({create:gv.optional()}).optional()}).optional()}),SY=$v({list:gv.optional(),cancel:gv.optional(),requests:$v({tools:$v({call:gv.optional()}).optional()}).optional()}),QY=h({experimental:N$(Z(),gv).optional(),sampling:h({context:gv.optional(),tools:gv.optional()}).optional(),elicitation:ZY.optional(),roots:h({listChanged:h$().optional()}).optional(),tasks:MY.optional()}),NY=rv.extend({protocolVersion:Z(),capabilities:QY,clientInfo:wU}),rY=Uv.extend({method:t("initialize"),params:NY});var uY=h({experimental:N$(Z(),gv).optional(),logging:gv.optional(),completions:gv.optional(),prompts:h({listChanged:h$().optional()}).optional(),resources:h({subscribe:h$().optional(),listChanged:h$().optional()}).optional(),tools:h({listChanged:h$().optional()}).optional(),tasks:SY.optional()}),yY=_v.extend({protocolVersion:Z(),capabilities:uY,serverInfo:wU,instructions:Z().optional()}),DY=Tv.extend({method:t("notifications/initialized"),params:Rv.optional()});var f6=Uv.extend({method:t("ping"),params:rv.optional()}),RY=h({progress:I$(),total:y$(I$()),message:y$(Z())}),TY=h({...Rv.shape,...RY.shape,progressToken:PW}),M0=Tv.extend({method:t("notifications/progress"),params:TY}),jY=rv.extend({cursor:kW.optional()}),AU=Uv.extend({params:jY.optional()}),ZU=_v.extend({nextCursor:kW.optional()}),VY=vv(["working","input_required","completed","failed","cancelled"]),MU=h({taskId:Z(),status:VY,ttl:A$([I$(),bg()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:y$(I$()),statusMessage:y$(Z())}),S0=_v.extend({task:MU}),CY=Rv.merge(MU),SU=Tv.extend({method:t("notifications/tasks/status"),params:CY}),Q0=Uv.extend({method:t("tasks/get"),params:rv.extend({taskId:Z()})}),N0=_v.merge(MU),r0=Uv.extend({method:t("tasks/result"),params:rv.extend({taskId:Z()})}),EQ=_v.loose(),u0=AU.extend({method:t("tasks/list")}),y0=ZU.extend({tasks:J$(MU)}),D0=Uv.extend({method:t("tasks/cancel"),params:rv.extend({taskId:Z()})}),XW=_v.merge(MU),wW=h({uri:Z(),mimeType:y$(Z()),_meta:N$(Z(),S$()).optional()}),AW=wW.extend({text:Z()}),EG=Z().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),ZW=wW.extend({blob:EG}),QU=vv(["user","assistant"]),Wg=h({audience:J$(QU).optional(),priority:I$().min(0).max(1).optional(),lastModified:V6.datetime({offset:!0}).optional()}),MW=h({...Og.shape,...XU.shape,uri:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:Wg.optional(),_meta:y$($v({}))}),fY=h({...Og.shape,...XU.shape,uriTemplate:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:Wg.optional(),_meta:y$($v({}))}),iG=AU.extend({method:t("resources/list")}),NU=ZU.extend({resources:J$(MW)}),lG=AU.extend({method:t("resources/templates/list")}),hG=ZU.extend({resourceTemplates:J$(fY)}),xG=rv.extend({uri:Z()}),cY=xG,pG=Uv.extend({method:t("resources/read"),params:cY}),rU=_v.extend({contents:J$(A$([AW,ZW]))}),oG=Tv.extend({method:t("notifications/resources/list_changed"),params:Rv.optional()}),mY=xG,EY=Uv.extend({method:t("resources/subscribe"),params:mY}),iY=xG,lY=Uv.extend({method:t("resources/unsubscribe"),params:iY}),hY=Rv.extend({uri:Z()}),xY=Tv.extend({method:t("notifications/resources/updated"),params:hY}),pY=h({name:Z(),description:y$(Z()),required:y$(h$())}),oY=h({...Og.shape,...XU.shape,description:y$(Z()),arguments:y$(J$(pY)),_meta:y$($v({}))}),nG=AU.extend({method:t("prompts/list")}),tG=ZU.extend({prompts:J$(oY)}),nY=rv.extend({name:Z(),arguments:N$(Z(),Z()).optional()}),tY=Uv.extend({method:t("prompts/get"),params:nY}),dG=h({type:t("text"),text:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),aG=h({type:t("image"),data:EG,mimeType:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),sG=h({type:t("audio"),data:EG,mimeType:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),dY=h({type:t("tool_use"),name:Z(),id:Z(),input:N$(Z(),S$()),_meta:N$(Z(),S$()).optional()}),eG=h({type:t("resource"),resource:A$([AW,ZW]),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),$O=MW.extend({type:t("resource_link")}),Bg=A$([dG,aG,sG,$O,eG]),aY=h({role:QU,content:Bg}),sY=_v.extend({description:Z().optional(),messages:J$(aY)}),vO=Tv.extend({method:t("notifications/prompts/list_changed"),params:Rv.optional()}),eY=h({title:Z().optional(),readOnlyHint:h$().optional(),destructiveHint:h$().optional(),idempotentHint:h$().optional(),openWorldHint:h$().optional()}),$q=h({taskSupport:vv(["required","optional","forbidden"]).optional()}),R0=h({...Og.shape,...XU.shape,description:Z().optional(),inputSchema:h({type:t("object"),properties:N$(Z(),gv).optional(),required:J$(Z()).optional()}).catchall(S$()),outputSchema:h({type:t("object"),properties:N$(Z(),gv).optional(),required:J$(Z()).optional()}).catchall(S$()).optional(),annotations:eY.optional(),execution:$q.optional(),_meta:N$(Z(),S$()).optional()}),uU=AU.extend({method:t("tools/list")}),vq=ZU.extend({tools:J$(R0)}),c6=_v.extend({content:J$(Bg).default([]),structuredContent:N$(Z(),S$()).optional(),isError:h$().optional()}),iQ=c6.or(_v.extend({toolResult:S$()})),gq=qU.extend({name:Z(),arguments:N$(Z(),S$()).optional()}),yU=Uv.extend({method:t("tools/call"),params:gq}),gO=Tv.extend({method:t("notifications/tools/list_changed"),params:Rv.optional()}),lQ=h({autoRefresh:h$().default(!0),debounceMs:I$().int().nonnegative().default(300)}),SW=vv(["debug","info","notice","warning","error","critical","alert","emergency"]),Uq=rv.extend({level:SW}),_q=Uv.extend({method:t("logging/setLevel"),params:Uq}),zq=Rv.extend({level:SW,logger:Z().optional(),data:S$()}),UO=Tv.extend({method:t("notifications/message"),params:zq}),Jq=h({name:Z().optional()}),bq=h({hints:J$(Jq).optional(),costPriority:I$().min(0).max(1).optional(),speedPriority:I$().min(0).max(1).optional(),intelligencePriority:I$().min(0).max(1).optional()}),Gq=h({mode:vv(["auto","required","none"]).optional()}),Oq=h({type:t("tool_result"),toolUseId:Z().describe("The unique identifier for the corresponding tool call."),content:J$(Bg).default([]),structuredContent:h({}).loose().optional(),isError:h$().optional(),_meta:N$(Z(),S$()).optional()}),Kq=HU("type",[dG,aG,sG]),X0=HU("type",[dG,aG,sG,dY,Oq]),Wq=h({role:QU,content:A$([X0,J$(X0)]),_meta:N$(Z(),S$()).optional()}),Bq=qU.extend({messages:J$(Wq),modelPreferences:bq.optional(),systemPrompt:Z().optional(),includeContext:vv(["none","thisServer","allServers"]).optional(),temperature:I$().optional(),maxTokens:I$().int(),stopSequences:J$(Z()).optional(),metadata:gv.optional(),tools:J$(R0).optional(),toolChoice:Gq.optional()}),Pq=Uv.extend({method:t("sampling/createMessage"),params:Bq}),kq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens"]).or(Z())),role:QU,content:Kq}),Hq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens","toolUse"]).or(Z())),role:QU,content:A$([X0,J$(X0)])}),Lq=h({type:t("boolean"),title:Z().optional(),description:Z().optional(),default:h$().optional()}),Iq=h({type:t("string"),title:Z().optional(),description:Z().optional(),minLength:I$().optional(),maxLength:I$().optional(),format:vv(["email","uri","date","date-time"]).optional(),default:Z().optional()}),Yq=h({type:vv(["number","integer"]),title:Z().optional(),description:Z().optional(),minimum:I$().optional(),maximum:I$().optional(),default:I$().optional()}),qq=h({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),default:Z().optional()}),Fq=h({type:t("string"),title:Z().optional(),description:Z().optional(),oneOf:J$(h({const:Z(),title:Z()})),default:Z().optional()}),Xq=h({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),enumNames:J$(Z()).optional(),default:Z().optional()}),wq=A$([qq,Fq]),Aq=h({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:h({type:t("string"),enum:J$(Z())}),default:J$(Z()).optional()}),Zq=h({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:h({anyOf:J$(h({const:Z(),title:Z()}))}),default:J$(Z()).optional()}),Mq=A$([Aq,Zq]),Sq=A$([Xq,wq,Mq]),Qq=A$([Sq,Lq,Iq,Yq]),Nq=qU.extend({mode:t("form").optional(),message:Z(),requestedSchema:h({type:t("object"),properties:N$(Z(),Qq),required:J$(Z()).optional()})}),rq=qU.extend({mode:t("url"),message:Z(),elicitationId:Z(),url:Z().url()}),uq=A$([Nq,rq]),yq=Uv.extend({method:t("elicitation/create"),params:uq}),Dq=Rv.extend({elicitationId:Z()}),Rq=Tv.extend({method:t("notifications/elicitation/complete"),params:Dq}),Tq=_v.extend({action:vv(["accept","decline","cancel"]),content:YU(($)=>$===null?void 0:$,N$(Z(),A$([Z(),I$(),h$(),J$(Z())])).optional())}),jq=h({type:t("ref/resource"),uri:Z()});var Vq=h({type:t("ref/prompt"),name:Z()}),Cq=rv.extend({ref:A$([Vq,jq]),argument:h({name:Z(),value:Z()}),context:h({arguments:N$(Z(),Z()).optional()}).optional()}),fq=Uv.extend({method:t("completion/complete"),params:Cq});var cq=_v.extend({completion:$v({values:J$(Z()).max(100),total:y$(I$().int()),hasMore:y$(h$())})}),mq=h({uri:Z().startsWith("file://"),name:Z().optional(),_meta:N$(Z(),S$()).optional()}),Eq=Uv.extend({method:t("roots/list"),params:rv.optional()}),iq=_v.extend({roots:J$(mq)}),lq=Tv.extend({method:t("notifications/roots/list_changed"),params:Rv.optional()}),hQ=A$([f6,rY,fq,_q,tY,nG,iG,lG,pG,EY,lY,yU,uU,Q0,r0,u0,D0]),xQ=A$([Z0,M0,DY,lq,SU]),pQ=A$([A0,kq,Hq,Tq,iq,N0,y0,S0]),oQ=A$([f6,Pq,yq,Eq,Q0,r0,u0,D0]),nQ=A$([Z0,M0,UO,xY,oG,gO,vO,SU,Rq]),tQ=A$([A0,yY,cq,sY,tG,NU,hG,rU,c6,vq,N0,y0,S0]);class k$ extends Error{constructor($,v,U){super(`MCP error ${$}: ${v}`);this.code=$,this.data=U,this.name="McpError"}static fromError($,v,U){if($===w$.UrlElicitationRequired&&U){let _=U;if(_.elicitations)return new QW(_.elicitations,v)}return new k$($,v,U)}}class QW extends k${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(w$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function T0($){return!!$._zod}function j0($,v){if(T0($))return C4($,v);return $.safeParse(v)}function NW($){if(!$)return;let v;if(T0($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function rW($){if(T0($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let U=$._def;if(U){if(U.value!==void 0)return U.value;if(Array.isArray(U.values)&&U.values.length>0)return U.values[0]}let _=$.value;if(_!==void 0)return _;return}function m6($){return $==="completed"||$==="failed"||$==="cancelled"}var hq=Symbol("Let zodToJsonSchema decide on which parser to use");var RN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _O($){let U=NW($)?.method;if(!U)throw Error("Schema is missing a method literal");let _=rW(U);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function zO($,v){let U=j0($,v);if(!U.success)throw U.error;return U.data}var dq=60000;class RU{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Z0,(v)=>{this._oncancel(v)}),this.setNotificationHandler(M0,(v)=>{this._onprogress(v)}),this.setRequestHandler(f6,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(Q0,async(v,U)=>{let _=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!_)throw new k$(w$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(r0,async(v,U)=>{let _=async()=>{let g=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(g,U.sessionId)){if(J.type==="response"||J.type==="error"){let b=J.message,O=b.id,K=this._requestResolvers.get(O);if(K)if(this._requestResolvers.delete(O),J.type==="response")K(b);else{let W=b,B=new k$(W.error.code,W.error.message,W.error.data);K(B)}else{let W=J.type==="response"?"Response":"Error";this._onerror(Error(`${W} handler missing for request ${O}`))}continue}await this._transport?.send(J.message,{relatedRequestId:U.requestId})}}let z=await this._taskStore.getTask(g,U.sessionId);if(!z)throw new k$(w$.InvalidParams,`Task not found: ${g}`);if(!m6(z.status))return await this._waitForTaskUpdate(g,U.signal),await _();if(m6(z.status)){let J=await this._taskStore.getTaskResult(g,U.sessionId);return this._clearTaskQueue(g),{...J,_meta:{...J._meta,[C6]:{taskId:g}}}}return await _()};return await _()}),this.setRequestHandler(u0,async(v,U)=>{try{let{tasks:_,nextCursor:g}=await this._taskStore.listTasks(v.params?.cursor,U.sessionId);return{tasks:_,nextCursor:g,_meta:{}}}catch(_){throw new k$(w$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(D0,async(v,U)=>{try{let _=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!_)throw new k$(w$.InvalidParams,`Task not found: ${v.params.taskId}`);if(m6(_.status))throw new k$(w$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",U.sessionId),this._clearTaskQueue(v.params.taskId);let g=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!g)throw new k$(w$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...g}}catch(_){if(_ instanceof k$)throw _;throw new k$(w$.InvalidRequest,`Failed to cancel task: ${_ instanceof Error?_.message:String(_)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,v,U,_,g=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:U,resetTimeoutOnProgress:g,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let U=Date.now()-v.startTime;if(v.maxTotalTimeout&&U>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),k$.fromError(w$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:U});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout($){let v=this._timeoutInfo.get($);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let v=this.transport?.onclose;this._transport.onclose=()=>{v?.(),this._onclose()};let U=this.transport?.onerror;this._transport.onerror=(g)=>{U?.(g),this._onerror(g)};let _=this._transport?.onmessage;this._transport.onmessage=(g,z)=>{if(_?.(g,z),FU(g)||qW(g))this._onresponse(g);else if(fG(g))this._onrequest(g,z);else if(YW(g))this._onnotification(g);else this._onerror(Error(`Unknown message type: ${JSON.stringify(g)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let U of this._timeoutInfo.values())clearTimeout(U.timeoutId);this._timeoutInfo.clear();for(let U of this._requestHandlerAbortControllers.values())U.abort();this._requestHandlerAbortControllers.clear();let v=k$.fromError(w$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let U of $.values())U(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((U)=>this._onerror(Error(`Uncaught error in notification handler: ${U}`)))}_onrequest($,v){let U=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,g=$.params?._meta?.[C6]?.taskId;if(U===void 0){let K={jsonrpc:"2.0",id:$.id,error:{code:w$.MethodNotFound,message:"Method not found"}};if(g&&this._taskMessageQueue)this._enqueueTaskMessage(g,{type:"error",message:K,timestamp:Date.now()},_?.sessionId).catch((W)=>this._onerror(Error(`Failed to enqueue error response: ${W}`)));else _?.send(K).catch((W)=>this._onerror(Error(`Failed to send an error response: ${W}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let J=HW($.params)?$.params.task:void 0,b=this._taskStore?this.requestTaskStore($,_?.sessionId):void 0,O={signal:z.signal,sessionId:_?.sessionId,_meta:$.params?._meta,sendNotification:async(K)=>{if(z.signal.aborted)return;let W={relatedRequestId:$.id};if(g)W.relatedTask={taskId:g};await this.notification(K,W)},sendRequest:async(K,W,B)=>{if(z.signal.aborted)throw new k$(w$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(g&&!k.relatedTask)k.relatedTask={taskId:g};let P=k.relatedTask?.taskId??g;if(P&&b)await b.updateTaskStatus(P,"input_required");return await this.request(K,W,k)},authInfo:v?.authInfo,requestId:$.id,requestInfo:v?.requestInfo,taskId:g,taskStore:b,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>U($,O)).then(async(K)=>{if(z.signal.aborted)return;let W={result:K,jsonrpc:"2.0",id:$.id};if(g&&this._taskMessageQueue)await this._enqueueTaskMessage(g,{type:"response",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)},async(K)=>{if(z.signal.aborted)return;let W={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(K.code)?K.code:w$.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(g&&this._taskMessageQueue)await this._enqueueTaskMessage(g,{type:"error",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:v,...U}=$.params,_=Number(v),g=this._progressHandlers.get(_);if(!g){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(_),J=this._timeoutInfo.get(_);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(_)}catch(b){this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),z(b);return}g(U)}_onresponse($){let v=Number($.id),U=this._requestResolvers.get(v);if(U){if(this._requestResolvers.delete(v),FU($))U($);else{let z=new k$($.error.code,$.error.message,$.error.data);U(z)}return}let _=this._responseHandlers.get(v);if(_===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(v),this._cleanupTimeout(v);let g=!1;if(FU($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")g=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!g)this._progressHandlers.delete(v);if(FU($))_($);else{let z=k$.fromError($.error.code,$.error.message,$.error.data);_(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,v,U){let{task:_}=U??{};if(!_){try{yield{type:"result",result:await this.request($,v,U)}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(w$.InternalError,String(z))}}return}let g;try{let z=await this.request($,S0,U);if(z.task)g=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new k$(w$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:g},U);if(yield{type:"taskStatus",task:J},m6(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:g},v,U)};else if(J.status==="failed")yield{type:"error",error:new k$(w$.InternalError,`Task ${g} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k$(w$.InternalError,`Task ${g} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:g},v,U)};return}let b=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((O)=>setTimeout(O,b)),U?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(w$.InternalError,String(z))}}}request($,v,U){let{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z,task:J,relatedTask:b}=U??{};return new Promise((O,K)=>{let W=(Y)=>{K(Y)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(Y){W(Y);return}U?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(U?.onprogress)this._progressHandlers.set(B,U.onprogress),k.params={...$.params,_meta:{...$.params?._meta||{},progressToken:B}};if(J)k.params={...k.params,task:J};if(b)k.params={...k.params,_meta:{...k.params?._meta||{},[C6]:b}};let P=(Y)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(Y)}},{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let q=Y instanceof k$?Y:new k$(w$.RequestTimeout,String(Y));K(q)};this._responseHandlers.set(B,(Y)=>{if(U?.signal?.aborted)return;if(Y instanceof Error)return K(Y);try{let q=j0(v,Y.result);if(!q.success)K(q.error);else O(q.data)}catch(q){K(q)}}),U?.signal?.addEventListener("abort",()=>{P(U?.signal?.reason)});let F=U?.timeout??dq,I=()=>P(k$.fromError(w$.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(B,F,U?.maxTotalTimeout,I,U?.resetTimeoutOnProgress??!1);let H=b?.taskId;if(H){let Y=(q)=>{let w=this._responseHandlers.get(B);if(w)w(q);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,Y),this._enqueueTaskMessage(H,{type:"request",message:k,timestamp:Date.now()}).catch((q)=>{this._cleanupTimeout(B),K(q)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z}).catch((Y)=>{this._cleanupTimeout(B),K(Y)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},N0,v)}async getTaskResult($,v,U){return this.request({method:"tasks/result",params:$},v,U)}async listTasks($,v){return this.request({method:"tasks/list",params:$},y0,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},XW,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let U=v?.relatedTask?.taskId;if(U){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[C6]:v.relatedTask}}};await this._enqueueTaskMessage(U,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!v?.relatedRequestId&&!v?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let J={...$,jsonrpc:"2.0"};if(v?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[C6]:v.relatedTask}}};this._transport?.send(J,v).catch((b)=>this._onerror(b))});return}let z={...$,jsonrpc:"2.0"};if(v?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[C6]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let U=_O($);this.assertRequestHandlerCapability(U),this._requestHandlers.set(U,(_,g)=>{let z=zO($,_);return Promise.resolve(v(z,g))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let U=_O($);this._notificationHandlers.set(U,(_)=>{let g=zO($,_);return Promise.resolve(v(g))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,U){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let _=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,v,U,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let U=await this._taskMessageQueue.dequeueAll($,v);for(let _ of U)if(_.type==="request"&&fG(_.message)){let g=_.message.id,z=this._requestResolvers.get(g);if(z)z(new k$(w$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(g);else this._onerror(Error(`Resolver missing for request ${g} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let U=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)U=_.pollInterval}catch{}return new Promise((_,g)=>{if(v.aborted){g(new k$(w$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,U);v.addEventListener("abort",()=>{clearTimeout(z),g(new k$(w$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let U=this._taskStore;if(!U)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await U.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let g=await U.getTask(_,v);if(!g)throw new k$(w$.InvalidParams,"Failed to retrieve task: Task not found");return g},storeTaskResult:async(_,g,z)=>{await U.storeTaskResult(_,g,z,v);let J=await U.getTask(_,v);if(J){let b=SU.parse({method:"notifications/tasks/status",params:J});if(await this.notification(b),m6(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return U.getTaskResult(_,v)},updateTaskStatus:async(_,g,z)=>{let J=await U.getTask(_,v);if(!J)throw new k$(w$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(m6(J.status))throw new k$(w$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${g}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await U.updateTaskStatus(_,g,z,v);let b=await U.getTask(_,v);if(b){let O=SU.parse({method:"notifications/tasks/status",params:b});if(await this.notification(O),m6(b.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return U.listTasks(_,v)}}}}var JO="2026-01-26";var aq="ui/notifications/tool-input-partial";var sq=L.union([L.literal("light"),L.literal("dark")]).describe("Color theme preference for the host environment."),TU=L.union([L.literal("inline"),L.literal("fullscreen"),L.literal("pip")]).describe("Display mode for UI presentation."),eq=L.union([L.literal("--color-background-primary"),L.literal("--color-background-secondary"),L.literal("--color-background-tertiary"),L.literal("--color-background-inverse"),L.literal("--color-background-ghost"),L.literal("--color-background-info"),L.literal("--color-background-danger"),L.literal("--color-background-success"),L.literal("--color-background-warning"),L.literal("--color-background-disabled"),L.literal("--color-text-primary"),L.literal("--color-text-secondary"),L.literal("--color-text-tertiary"),L.literal("--color-text-inverse"),L.literal("--color-text-ghost"),L.literal("--color-text-info"),L.literal("--color-text-danger"),L.literal("--color-text-success"),L.literal("--color-text-warning"),L.literal("--color-text-disabled"),L.literal("--color-border-primary"),L.literal("--color-border-secondary"),L.literal("--color-border-tertiary"),L.literal("--color-border-inverse"),L.literal("--color-border-ghost"),L.literal("--color-border-info"),L.literal("--color-border-danger"),L.literal("--color-border-success"),L.literal("--color-border-warning"),L.literal("--color-border-disabled"),L.literal("--color-ring-primary"),L.literal("--color-ring-secondary"),L.literal("--color-ring-inverse"),L.literal("--color-ring-info"),L.literal("--color-ring-danger"),L.literal("--color-ring-success"),L.literal("--color-ring-warning"),L.literal("--font-sans"),L.literal("--font-mono"),L.literal("--font-weight-normal"),L.literal("--font-weight-medium"),L.literal("--font-weight-semibold"),L.literal("--font-weight-bold"),L.literal("--font-text-xs-size"),L.literal("--font-text-sm-size"),L.literal("--font-text-md-size"),L.literal("--font-text-lg-size"),L.literal("--font-heading-xs-size"),L.literal("--font-heading-sm-size"),L.literal("--font-heading-md-size"),L.literal("--font-heading-lg-size"),L.literal("--font-heading-xl-size"),L.literal("--font-heading-2xl-size"),L.literal("--font-heading-3xl-size"),L.literal("--font-text-xs-line-height"),L.literal("--font-text-sm-line-height"),L.literal("--font-text-md-line-height"),L.literal("--font-text-lg-line-height"),L.literal("--font-heading-xs-line-height"),L.literal("--font-heading-sm-line-height"),L.literal("--font-heading-md-line-height"),L.literal("--font-heading-lg-line-height"),L.literal("--font-heading-xl-line-height"),L.literal("--font-heading-2xl-line-height"),L.literal("--font-heading-3xl-line-height"),L.literal("--border-radius-xs"),L.literal("--border-radius-sm"),L.literal("--border-radius-md"),L.literal("--border-radius-lg"),L.literal("--border-radius-xl"),L.literal("--border-radius-full"),L.literal("--border-width-regular"),L.literal("--shadow-hairline"),L.literal("--shadow-sm"),L.literal("--shadow-md"),L.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),$F=L.record(eq.describe(`Style variables for theming MCP apps.
146
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of $.seen.entries()){let b=J[1];if(v===J[0]){z(J);continue}if($.external){let K=$.external.registry.get(J[0])?.id;if(v!==J[0]&&K){z(J);continue}}if($.metadataRegistry.get(J[0])?.id){z(J);continue}if(b.cycle){z(J);continue}if(b.count>1){if($.reused==="ref"){z(J);continue}}}}function C6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=(J)=>{let b=$.seen.get(J);if(b.ref===null)return;let O=b.def??b.schema,K={...O},W=b.ref;if(b.ref=null,W){_(W);let k=$.seen.get(W),P=k.schema;if(P.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))O.allOf=O.allOf??[],O.allOf.push(P);else Object.assign(O,P);if(Object.assign(O,K),J._zod.parent===W)for(let Y in O){if(Y==="$ref"||Y==="allOf")continue;if(!(Y in K))delete O[Y]}if(P.$ref&&k.def)for(let Y in O){if(Y==="$ref"||Y==="allOf")continue;if(Y in k.def&&JSON.stringify(O[Y])===JSON.stringify(k.def[Y]))delete O[Y]}}let B=J._zod.parent;if(B&&B!==W){_(B);let k=$.seen.get(B);if(k?.schema.$ref){if(O.$ref=k.schema.$ref,k.def)for(let P in O){if(P==="$ref"||P==="allOf")continue;if(P in k.def&&JSON.stringify(O[P])===JSON.stringify(k.def[P]))delete O[P]}}}$.override({zodSchema:J,jsonSchema:O,path:b.path??[]})};for(let J of[...$.seen.entries()].reverse())_(J[0]);let U={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let J=$.external.registry.get(v)?.id;if(!J)throw Error("Schema is missing an `id` property");U.$id=$.external.uri(J)}Object.assign(U,g.def??g.schema);let z=$.external?.defs??{};for(let J of $.seen.entries()){let b=J[1];if(b.def&&b.defId)z[b.defId]=b.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")U.$defs=z;else U.definitions=z;try{let J=JSON.parse(JSON.stringify(U));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:_U(v,"input",$.processors),output:_U(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function Iv($,v){let g=v??{seen:new Set};if(g.seen.has($))return!1;g.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return Iv(_.element,g);if(_.type==="set")return Iv(_.valueType,g);if(_.type==="lazy")return Iv(_.getter(),g);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return Iv(_.innerType,g);if(_.type==="intersection")return Iv(_.left,g)||Iv(_.right,g);if(_.type==="record"||_.type==="map")return Iv(_.keyType,g)||Iv(_.valueType,g);if(_.type==="pipe")return Iv(_.in,g)||Iv(_.out,g);if(_.type==="object"){for(let U in _.shape)if(Iv(_.shape[U],g))return!0;return!1}if(_.type==="union"){for(let U of _.options)if(Iv(U,g))return!0;return!1}if(_.type==="tuple"){for(let U of _.items)if(Iv(U,g))return!0;if(_.rest&&Iv(_.rest,g))return!0;return!1}return!1}var gb=($,v={})=>(g)=>{let _=j6({...g,processors:v});return w$($,_),V6(_,$),C6(_,$)},_U=($,v,g={})=>(_)=>{let{libraryOptions:U,target:z}=_??{},J=j6({...U??{},target:z,io:v,processors:g});return w$($,J),V6(J,$),C6(J,$)};var HL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_b=($,v,g,_)=>{let U=g;U.type="string";let{minimum:z,maximum:J,format:b,patterns:O,contentEncoding:K}=$._zod.bag;if(typeof z==="number")U.minLength=z;if(typeof J==="number")U.maxLength=J;if(b){if(U.format=HL[b]??b,U.format==="")delete U.format;if(b==="time")delete U.format}if(K)U.contentEncoding=K;if(O&&O.size>0){let W=[...O];if(W.length===1)U.pattern=W[0].source;else if(W.length>1)U.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},zb=($,v,g,_)=>{let U=g,{minimum:z,maximum:J,format:b,multipleOf:O,exclusiveMaximum:K,exclusiveMinimum:W}=$._zod.bag;if(typeof b==="string"&&b.includes("int"))U.type="integer";else U.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.minimum=W,U.exclusiveMinimum=!0;else U.exclusiveMinimum=W;if(typeof z==="number"){if(U.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete U.minimum;else delete U.exclusiveMinimum}if(typeof K==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.maximum=K,U.exclusiveMaximum=!0;else U.exclusiveMaximum=K;if(typeof J==="number"){if(U.maximum=J,typeof K==="number"&&v.target!=="draft-04")if(K<=J)delete U.maximum;else delete U.exclusiveMaximum}if(typeof O==="number")U.multipleOf=O},Jb=($,v,g,_)=>{g.type="boolean"},bb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Gb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Ob=($,v,g,_)=>{if(v.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null"},Kb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Wb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Bb=($,v,g,_)=>{g.not={}},Pb=($,v,g,_)=>{},kb=($,v,g,_)=>{},Hb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Ib=($,v,g,_)=>{let U=$._zod.def,z=lU(U.entries);if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";g.enum=z},Yb=($,v,g,_)=>{let U=$._zod.def,z=[];for(let J of U.values)if(J===void 0){if(v.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(v.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(J));else z.push(J);if(z.length===0);else if(z.length===1){let J=z[0];if(g.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")g.enum=[J];else g.const=J}else{if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";if(z.every((J)=>typeof J==="boolean"))g.type="boolean";if(z.every((J)=>J===null))g.type="null";g.enum=z}},Lb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},qb=($,v,g,_)=>{let U=g,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");U.type="string",U.pattern=z.source},Xb=($,v,g,_)=>{let U=g,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:b,mime:O}=$._zod.bag;if(J!==void 0)z.minLength=J;if(b!==void 0)z.maxLength=b;if(O)if(O.length===1)z.contentMediaType=O[0],Object.assign(U,z);else Object.assign(U,z),U.anyOf=O.map((K)=>({contentMediaType:K}));else Object.assign(U,z)},wb=($,v,g,_)=>{g.type="boolean"},Fb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Ab=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Zb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Mb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Qb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Sb=($,v,g,_)=>{let U=g,z=$._zod.def,{minimum:J,maximum:b}=$._zod.bag;if(typeof J==="number")U.minItems=J;if(typeof b==="number")U.maxItems=b;U.type="array",U.items=w$(z.element,v,{..._,path:[..._.path,"items"]})},Nb=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object",U.properties={};let J=z.shape;for(let K in J)U.properties[K]=w$(J[K],v,{..._,path:[..._.path,"properties",K]});let b=new Set(Object.keys(J)),O=new Set([...b].filter((K)=>{let W=z.shape[K]._zod;if(v.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(O.size>0)U.required=Array.from(O);if(z.catchall?._zod.def.type==="never")U.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")U.additionalProperties=!1}else if(z.catchall)U.additionalProperties=w$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},n1=($,v,g,_)=>{let U=$._zod.def,z=U.inclusive===!1,J=U.options.map((b,O)=>w$(b,v,{..._,path:[..._.path,z?"oneOf":"anyOf",O]}));if(z)g.oneOf=J;else g.anyOf=J},rb=($,v,g,_)=>{let U=$._zod.def,z=w$(U.left,v,{..._,path:[..._.path,"allOf",0]}),J=w$(U.right,v,{..._,path:[..._.path,"allOf",1]}),b=(K)=>("allOf"in K)&&Object.keys(K).length===1,O=[...b(z)?z.allOf:[z],...b(J)?J.allOf:[J]];g.allOf=O},ub=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="array";let J=v.target==="draft-2020-12"?"prefixItems":"items",b=v.target==="draft-2020-12"?"items":v.target==="openapi-3.0"?"items":"additionalItems",O=z.items.map((k,P)=>w$(k,v,{..._,path:[..._.path,J,P]})),K=z.rest?w$(z.rest,v,{..._,path:[..._.path,b,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(U.prefixItems=O,K)U.items=K}else if(v.target==="openapi-3.0"){if(U.items={anyOf:O},K)U.items.anyOf.push(K);if(U.minItems=O.length,!K)U.maxItems=O.length}else if(U.items=O,K)U.additionalItems=K;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")U.minItems=W;if(typeof B==="number")U.maxItems=B},yb=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object";let J=z.keyType,O=J._zod.bag?.patterns;if(z.mode==="loose"&&O&&O.size>0){let W=w$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});U.patternProperties={};for(let B of O)U.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")U.propertyNames=w$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});U.additionalProperties=w$(z.valueType,v,{..._,path:[..._.path,"additionalProperties"]})}let K=J._zod.values;if(K){let W=[...K].filter((B)=>typeof B==="string"||typeof B==="number");if(W.length>0)U.required=W}},Db=($,v,g,_)=>{let U=$._zod.def,z=w$(U.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=U.innerType,g.nullable=!0;else g.anyOf=[z,{type:"null"}]},Rb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},Tb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.default=JSON.parse(JSON.stringify(U.defaultValue))},jb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);if(z.ref=U.innerType,v.io==="input")g._prefault=JSON.parse(JSON.stringify(U.defaultValue))},Vb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType;let J;try{J=U.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=J},Cb=($,v,g,_)=>{let U=$._zod.def,z=v.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;w$(z,v,_);let J=v.seen.get($);J.ref=z},fb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.readOnly=!0},mb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},t1=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},cb=($,v,g,_)=>{let U=$._zod.innerType;w$(U,v,_);let z=v.seen.get($);z.ref=U},o1={string:_b,number:zb,boolean:Jb,bigint:bb,symbol:Gb,null:Ob,undefined:Kb,void:Wb,never:Bb,any:Pb,unknown:kb,date:Hb,enum:Ib,literal:Yb,nan:Lb,template_literal:qb,file:Xb,success:wb,custom:Fb,function:Ab,transform:Zb,map:Mb,set:Qb,array:Sb,object:Nb,union:n1,intersection:rb,tuple:ub,record:yb,nullable:Db,nonoptional:Rb,default:Tb,prefault:jb,catch:Vb,pipe:Cb,readonly:fb,promise:mb,optional:t1,lazy:cb};function d1($,v){if("_idmap"in $){let _=$,U=j6({...v,processors:o1}),z={};for(let O of _._idmap.entries()){let[K,W]=O;w$(W,U)}let J={},b={registry:_,uri:v?.uri,defs:z};U.external=b;for(let O of _._idmap.entries()){let[K,W]=O;V6(U,W),J[K]=C6(U,W)}if(Object.keys(z).length>0){let O=U.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[O]:z}}return{schemas:J}}let g=j6({...v,processors:o1});return w$($,g),V6(g,$),C6(g,$)}class Eb{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";this.ctx=j6({processors:o1,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return w$($,this.ctx,v)}emit($,v){if(v){if(v.cycles)this.ctx.cycles=v.cycles;if(v.reused)this.ctx.reused=v.reused;if(v.external)this.ctx.external=v.external}V6(this.ctx,$);let g=C6(this.ctx,$),{"~standard":_,...U}=g;return U}}var G7={};var Pg={};ev(Pg,{xor:()=>s7,xid:()=>A7,void:()=>n7,uuidv7:()=>H7,uuidv6:()=>k7,uuidv4:()=>P7,uuid:()=>B7,url:()=>I7,unknown:()=>Q$,union:()=>A$,undefined:()=>p7,ulid:()=>F7,uint64:()=>x7,uint32:()=>E7,tuple:()=>YG,transform:()=>F0,templateLiteral:()=>OW,symbol:()=>h7,superRefine:()=>lG,success:()=>JW,stringbool:()=>IW,stringFormat:()=>T7,string:()=>Z,strictObject:()=>a7,set:()=>UW,refine:()=>iG,record:()=>N$,readonly:()=>VG,promise:()=>KW,preprocess:()=>Zg,prefault:()=>rG,pipe:()=>Ig,partialRecord:()=>e7,optional:()=>y$,object:()=>x,number:()=>Y$,nullish:()=>zW,nullable:()=>Hg,null:()=>WU,nonoptional:()=>uG,never:()=>w0,nativeEnum:()=>gW,nanoid:()=>q7,nan:()=>bW,meta:()=>kW,map:()=>vW,mac:()=>Q7,looseRecord:()=>$W,looseObject:()=>$v,literal:()=>t,lazy:()=>mG,ksuid:()=>Z7,keyof:()=>d7,jwt:()=>R7,json:()=>YW,ipv6:()=>S7,ipv4:()=>M7,intersection:()=>BU,int64:()=>l7,int32:()=>c7,int:()=>U0,instanceof:()=>HW,httpUrl:()=>Y7,hostname:()=>j7,hex:()=>V7,hash:()=>C7,guid:()=>W7,function:()=>WW,float64:()=>m7,float32:()=>f7,file:()=>_W,exactOptional:()=>ZG,enum:()=>vv,emoji:()=>L7,email:()=>K7,e164:()=>D7,discriminatedUnion:()=>wg,describe:()=>PW,date:()=>t7,custom:()=>S0,cuid2:()=>w7,cuid:()=>X7,codec:()=>GW,cidrv6:()=>r7,cidrv4:()=>N7,check:()=>BW,catch:()=>RG,boolean:()=>x$,bigint:()=>i7,base64url:()=>y7,base64:()=>u7,array:()=>J$,any:()=>o7,_function:()=>WW,_default:()=>SG,_ZodString:()=>g0,ZodXor:()=>PG,ZodXID:()=>K0,ZodVoid:()=>WG,ZodUnknown:()=>OG,ZodUnion:()=>Xg,ZodUndefined:()=>JG,ZodUUID:()=>av,ZodURL:()=>Yg,ZodULID:()=>O0,ZodType:()=>_$,ZodTuple:()=>IG,ZodTransform:()=>FG,ZodTemplateLiteral:()=>CG,ZodSymbol:()=>zG,ZodSuccess:()=>yG,ZodStringFormat:()=>M$,ZodString:()=>JU,ZodSet:()=>qG,ZodRecord:()=>Fg,ZodReadonly:()=>jG,ZodPromise:()=>cG,ZodPrefault:()=>NG,ZodPipe:()=>M0,ZodOptional:()=>A0,ZodObject:()=>qg,ZodNumberFormat:()=>K4,ZodNumber:()=>GU,ZodNullable:()=>MG,ZodNull:()=>bG,ZodNonOptional:()=>Z0,ZodNever:()=>KG,ZodNanoID:()=>J0,ZodNaN:()=>TG,ZodMap:()=>LG,ZodMAC:()=>_G,ZodLiteral:()=>XG,ZodLazy:()=>fG,ZodKSUID:()=>W0,ZodJWT:()=>q0,ZodIntersection:()=>HG,ZodIPv6:()=>P0,ZodIPv4:()=>B0,ZodGUID:()=>kg,ZodFunction:()=>EG,ZodFile:()=>wG,ZodExactOptional:()=>AG,ZodEnum:()=>zU,ZodEmoji:()=>z0,ZodEmail:()=>_0,ZodE164:()=>L0,ZodDiscriminatedUnion:()=>kG,ZodDefault:()=>QG,ZodDate:()=>Lg,ZodCustomStringFormat:()=>bU,ZodCustom:()=>Ag,ZodCodec:()=>Q0,ZodCatch:()=>DG,ZodCUID2:()=>G0,ZodCUID:()=>b0,ZodCIDRv6:()=>H0,ZodCIDRv4:()=>k0,ZodBoolean:()=>OU,ZodBigIntFormat:()=>X0,ZodBigInt:()=>KU,ZodBase64URL:()=>Y0,ZodBase64:()=>I0,ZodArray:()=>BG,ZodAny:()=>GG});var a1={};ev(a1,{uppercase:()=>o4,trim:()=>e4,toUpperCase:()=>vU,toLowerCase:()=>$U,startsWith:()=>t4,slugify:()=>UU,size:()=>b4,regex:()=>h4,property:()=>p1,positive:()=>i1,overwrite:()=>mv,normalize:()=>s4,nonpositive:()=>x1,nonnegative:()=>h1,negative:()=>l1,multipleOf:()=>R6,minSize:()=>dv,minLength:()=>G6,mime:()=>a4,maxSize:()=>T6,maxLength:()=>G4,lte:()=>Nv,lt:()=>nv,lowercase:()=>p4,length:()=>O4,includes:()=>n4,gte:()=>Hv,gt:()=>tv,endsWith:()=>d4});var f6={};ev(f6,{time:()=>xb,duration:()=>hb,datetime:()=>ib,date:()=>lb,ZodISOTime:()=>$0,ZodISODuration:()=>v0,ZodISODateTime:()=>s1,ZodISODate:()=>e1});var s1=w("ZodISODateTime",($,v)=>{MJ.init($,v),M$.init($,v)});function ib($){return F9(s1,$)}var e1=w("ZodISODate",($,v)=>{QJ.init($,v),M$.init($,v)});function lb($){return A9(e1,$)}var $0=w("ZodISOTime",($,v)=>{SJ.init($,v),M$.init($,v)});function xb($){return Z9($0,$)}var v0=w("ZodISODuration",($,v)=>{NJ.init($,v),M$.init($,v)});function hb($){return M9(v0,$)}var O7=($,v)=>{nU.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(g)=>dU($,g)},flatten:{value:(g)=>tU($,g)},addIssue:{value:(g)=>{$.issues.push(g),$.message=JSON.stringify($.issues,j4,2)}},addIssues:{value:(g)=>{$.issues.push(...g),$.message=JSON.stringify($.issues,j4,2)}},isEmpty:{get(){return $.issues.length===0}}})},YL=w("ZodError",O7),Fv=w("ZodError",O7,{Parent:Error});var pb=f4(Fv),ob=m4(Fv),nb=c4(Fv),tb=i4(Fv),db=$1(Fv),ab=v1(Fv),sb=U1(Fv),eb=g1(Fv),$G=_1(Fv),vG=z1(Fv),UG=J1(Fv),gG=b1(Fv);var _$=w("ZodType",($,v)=>{return $$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:_U($,"input"),output:_U($,"output")}}),$.toJSONSchema=gb($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...g)=>{return $.clone(j.mergeDefs(v,{checks:[...v.checks??[],...g.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(g,_)=>kv($,g,_),$.brand=()=>$,$.register=(g,_)=>{return g.add($,_),$},$.parse=(g,_)=>pb($,g,_,{callee:$.parse}),$.safeParse=(g,_)=>nb($,g,_),$.parseAsync=async(g,_)=>ob($,g,_,{callee:$.parseAsync}),$.safeParseAsync=async(g,_)=>tb($,g,_),$.spa=$.safeParseAsync,$.encode=(g,_)=>db($,g,_),$.decode=(g,_)=>ab($,g,_),$.encodeAsync=async(g,_)=>sb($,g,_),$.decodeAsync=async(g,_)=>eb($,g,_),$.safeEncode=(g,_)=>$G($,g,_),$.safeDecode=(g,_)=>vG($,g,_),$.safeEncodeAsync=async(g,_)=>UG($,g,_),$.safeDecodeAsync=async(g,_)=>gG($,g,_),$.refine=(g,_)=>$.check(iG(g,_)),$.superRefine=(g)=>$.check(lG(g)),$.overwrite=(g)=>$.check(mv(g)),$.optional=()=>y$($),$.exactOptional=()=>ZG($),$.nullable=()=>Hg($),$.nullish=()=>y$(Hg($)),$.nonoptional=(g)=>uG($,g),$.array=()=>J$($),$.or=(g)=>A$([$,g]),$.and=(g)=>BU($,g),$.transform=(g)=>Ig($,F0(g)),$.default=(g)=>SG($,g),$.prefault=(g)=>rG($,g),$.catch=(g)=>RG($,g),$.pipe=(g)=>Ig($,g),$.readonly=()=>VG($),$.describe=(g)=>{let _=$.clone();return e$.add(_,{description:g}),_},Object.defineProperty($,"description",{get(){return e$.get($)?.description},configurable:!0}),$.meta=(...g)=>{if(g.length===0)return e$.get($);let _=$.clone();return e$.add(_,g[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(g)=>g($),$}),g0=w("_ZodString",($,v)=>{J4.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>_b($,_,U,z);let g=$._zod.bag;$.format=g.format??null,$.minLength=g.minimum??null,$.maxLength=g.maximum??null,$.regex=(..._)=>$.check(h4(..._)),$.includes=(..._)=>$.check(n4(..._)),$.startsWith=(..._)=>$.check(t4(..._)),$.endsWith=(..._)=>$.check(d4(..._)),$.min=(..._)=>$.check(G6(..._)),$.max=(..._)=>$.check(G4(..._)),$.length=(..._)=>$.check(O4(..._)),$.nonempty=(..._)=>$.check(G6(1,..._)),$.lowercase=(_)=>$.check(p4(_)),$.uppercase=(_)=>$.check(o4(_)),$.trim=()=>$.check(e4()),$.normalize=(..._)=>$.check(s4(..._)),$.toLowerCase=()=>$.check($U()),$.toUpperCase=()=>$.check(vU()),$.slugify=()=>$.check(UU())}),JU=w("ZodString",($,v)=>{J4.init($,v),g0.init($,v),$.email=(g)=>$.check(F1(_0,g)),$.url=(g)=>$.check(Bg(Yg,g)),$.jwt=(g)=>$.check(E1(q0,g)),$.emoji=(g)=>$.check(S1(z0,g)),$.guid=(g)=>$.check(Wg(kg,g)),$.uuid=(g)=>$.check(A1(av,g)),$.uuidv4=(g)=>$.check(Z1(av,g)),$.uuidv6=(g)=>$.check(M1(av,g)),$.uuidv7=(g)=>$.check(Q1(av,g)),$.nanoid=(g)=>$.check(N1(J0,g)),$.guid=(g)=>$.check(Wg(kg,g)),$.cuid=(g)=>$.check(r1(b0,g)),$.cuid2=(g)=>$.check(u1(G0,g)),$.ulid=(g)=>$.check(y1(O0,g)),$.base64=(g)=>$.check(f1(I0,g)),$.base64url=(g)=>$.check(m1(Y0,g)),$.xid=(g)=>$.check(D1(K0,g)),$.ksuid=(g)=>$.check(R1(W0,g)),$.ipv4=(g)=>$.check(T1(B0,g)),$.ipv6=(g)=>$.check(j1(P0,g)),$.cidrv4=(g)=>$.check(V1(k0,g)),$.cidrv6=(g)=>$.check(C1(H0,g)),$.e164=(g)=>$.check(c1(L0,g)),$.datetime=(g)=>$.check(ib(g)),$.date=(g)=>$.check(lb(g)),$.time=(g)=>$.check(xb(g)),$.duration=(g)=>$.check(hb(g))});function Z($){return L9(JU,$)}var M$=w("ZodStringFormat",($,v)=>{Z$.init($,v),g0.init($,v)}),_0=w("ZodEmail",($,v)=>{IJ.init($,v),M$.init($,v)});function K7($){return F1(_0,$)}var kg=w("ZodGUID",($,v)=>{kJ.init($,v),M$.init($,v)});function W7($){return Wg(kg,$)}var av=w("ZodUUID",($,v)=>{HJ.init($,v),M$.init($,v)});function B7($){return A1(av,$)}function P7($){return Z1(av,$)}function k7($){return M1(av,$)}function H7($){return Q1(av,$)}var Yg=w("ZodURL",($,v)=>{YJ.init($,v),M$.init($,v)});function I7($){return Bg(Yg,$)}function Y7($){return Bg(Yg,{protocol:/^https?$/,hostname:Dv.domain,...j.normalizeParams($)})}var z0=w("ZodEmoji",($,v)=>{LJ.init($,v),M$.init($,v)});function L7($){return S1(z0,$)}var J0=w("ZodNanoID",($,v)=>{qJ.init($,v),M$.init($,v)});function q7($){return N1(J0,$)}var b0=w("ZodCUID",($,v)=>{XJ.init($,v),M$.init($,v)});function X7($){return r1(b0,$)}var G0=w("ZodCUID2",($,v)=>{wJ.init($,v),M$.init($,v)});function w7($){return u1(G0,$)}var O0=w("ZodULID",($,v)=>{FJ.init($,v),M$.init($,v)});function F7($){return y1(O0,$)}var K0=w("ZodXID",($,v)=>{AJ.init($,v),M$.init($,v)});function A7($){return D1(K0,$)}var W0=w("ZodKSUID",($,v)=>{ZJ.init($,v),M$.init($,v)});function Z7($){return R1(W0,$)}var B0=w("ZodIPv4",($,v)=>{rJ.init($,v),M$.init($,v)});function M7($){return T1(B0,$)}var _G=w("ZodMAC",($,v)=>{yJ.init($,v),M$.init($,v)});function Q7($){return X9(_G,$)}var P0=w("ZodIPv6",($,v)=>{uJ.init($,v),M$.init($,v)});function S7($){return j1(P0,$)}var k0=w("ZodCIDRv4",($,v)=>{DJ.init($,v),M$.init($,v)});function N7($){return V1(k0,$)}var H0=w("ZodCIDRv6",($,v)=>{RJ.init($,v),M$.init($,v)});function r7($){return C1(H0,$)}var I0=w("ZodBase64",($,v)=>{jJ.init($,v),M$.init($,v)});function u7($){return f1(I0,$)}var Y0=w("ZodBase64URL",($,v)=>{VJ.init($,v),M$.init($,v)});function y7($){return m1(Y0,$)}var L0=w("ZodE164",($,v)=>{CJ.init($,v),M$.init($,v)});function D7($){return c1(L0,$)}var q0=w("ZodJWT",($,v)=>{fJ.init($,v),M$.init($,v)});function R7($){return E1(q0,$)}var bU=w("ZodCustomStringFormat",($,v)=>{mJ.init($,v),M$.init($,v)});function T7($,v,g={}){return gU(bU,$,v,g)}function j7($){return gU(bU,"hostname",Dv.hostname,$)}function V7($){return gU(bU,"hex",Dv.hex,$)}function C7($,v){let g=v?.enc??"hex",_=`${$}_${g}`,U=Dv[_];if(!U)throw Error(`Unrecognized hash format: ${_}`);return gU(bU,_,U,v)}var GU=w("ZodNumber",($,v)=>{Y1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>zb($,_,U,z),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.int=(_)=>$.check(U0(_)),$.safe=(_)=>$.check(U0(_)),$.positive=(_)=>$.check(tv(0,_)),$.nonnegative=(_)=>$.check(Hv(0,_)),$.negative=(_)=>$.check(nv(0,_)),$.nonpositive=(_)=>$.check(Nv(0,_)),$.multipleOf=(_,U)=>$.check(R6(_,U)),$.step=(_,U)=>$.check(R6(_,U)),$.finite=()=>$;let g=$._zod.bag;$.minValue=Math.max(g.minimum??Number.NEGATIVE_INFINITY,g.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(g.maximum??Number.POSITIVE_INFINITY,g.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(g.format??"").includes("int")||Number.isSafeInteger(g.multipleOf??0.5),$.isFinite=!0,$.format=g.format??null});function Y$($){return Q9(GU,$)}var K4=w("ZodNumberFormat",($,v)=>{cJ.init($,v),GU.init($,v)});function U0($){return N9(K4,$)}function f7($){return r9(K4,$)}function m7($){return u9(K4,$)}function c7($){return y9(K4,$)}function E7($){return D9(K4,$)}var OU=w("ZodBoolean",($,v)=>{gg.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Jb($,g,_,U)});function x$($){return R9(OU,$)}var KU=w("ZodBigInt",($,v)=>{L1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>bb($,_,U,z),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.positive=(_)=>$.check(tv(BigInt(0),_)),$.negative=(_)=>$.check(nv(BigInt(0),_)),$.nonpositive=(_)=>$.check(Nv(BigInt(0),_)),$.nonnegative=(_)=>$.check(Hv(BigInt(0),_)),$.multipleOf=(_,U)=>$.check(R6(_,U));let g=$._zod.bag;$.minValue=g.minimum??null,$.maxValue=g.maximum??null,$.format=g.format??null});function i7($){return j9(KU,$)}var X0=w("ZodBigIntFormat",($,v)=>{EJ.init($,v),KU.init($,v)});function l7($){return C9(X0,$)}function x7($){return f9(X0,$)}var zG=w("ZodSymbol",($,v)=>{iJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Gb($,g,_,U)});function h7($){return m9(zG,$)}var JG=w("ZodUndefined",($,v)=>{lJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Kb($,g,_,U)});function p7($){return c9(JG,$)}var bG=w("ZodNull",($,v)=>{xJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Ob($,g,_,U)});function WU($){return E9(bG,$)}var GG=w("ZodAny",($,v)=>{hJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Pb($,g,_,U)});function o7(){return i9(GG)}var OG=w("ZodUnknown",($,v)=>{pJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>kb($,g,_,U)});function Q$(){return l9(OG)}var KG=w("ZodNever",($,v)=>{oJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Bb($,g,_,U)});function w0($){return x9(KG,$)}var WG=w("ZodVoid",($,v)=>{nJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Wb($,g,_,U)});function n7($){return h9(WG,$)}var Lg=w("ZodDate",($,v)=>{tJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>Hb($,_,U,z),$.min=(_,U)=>$.check(Hv(_,U)),$.max=(_,U)=>$.check(Nv(_,U));let g=$._zod.bag;$.minDate=g.minimum?new Date(g.minimum):null,$.maxDate=g.maximum?new Date(g.maximum):null});function t7($){return p9(Lg,$)}var BG=w("ZodArray",($,v)=>{dJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Sb($,g,_,U),$.element=v.element,$.min=(g,_)=>$.check(G6(g,_)),$.nonempty=(g)=>$.check(G6(1,g)),$.max=(g,_)=>$.check(G4(g,_)),$.length=(g,_)=>$.check(O4(g,_)),$.unwrap=()=>$.element});function J$($,v){return t9(BG,$,v)}function d7($){let v=$._zod.def.shape;return vv(Object.keys(v))}var qg=w("ZodObject",($,v)=>{aJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Nb($,g,_,U),j.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>vv(Object.keys($._zod.def.shape)),$.catchall=(g)=>$.clone({...$._zod.def,catchall:g}),$.passthrough=()=>$.clone({...$._zod.def,catchall:Q$()}),$.loose=()=>$.clone({...$._zod.def,catchall:Q$()}),$.strict=()=>$.clone({...$._zod.def,catchall:w0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(g)=>{return j.extend($,g)},$.safeExtend=(g)=>{return j.safeExtend($,g)},$.merge=(g)=>j.merge($,g),$.pick=(g)=>j.pick($,g),$.omit=(g)=>j.omit($,g),$.partial=(...g)=>j.partial(A0,$,g[0]),$.required=(...g)=>j.required(Z0,$,g[0])});function x($,v){let g={type:"object",shape:$??{},...j.normalizeParams(v)};return new qg(g)}function a7($,v){return new qg({type:"object",shape:$,catchall:w0(),...j.normalizeParams(v)})}function $v($,v){return new qg({type:"object",shape:$,catchall:Q$(),...j.normalizeParams(v)})}var Xg=w("ZodUnion",($,v)=>{_g.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>n1($,g,_,U),$.options=v.options});function A$($,v){return new Xg({type:"union",options:$,...j.normalizeParams(v)})}var PG=w("ZodXor",($,v)=>{Xg.init($,v),sJ.init($,v),$._zod.processJSONSchema=(g,_,U)=>n1($,g,_,U),$.options=v.options});function s7($,v){return new PG({type:"union",options:$,inclusive:!1,...j.normalizeParams(v)})}var kG=w("ZodDiscriminatedUnion",($,v)=>{Xg.init($,v),eJ.init($,v)});function wg($,v,g){return new kG({type:"union",options:v,discriminator:$,...j.normalizeParams(g)})}var HG=w("ZodIntersection",($,v)=>{$8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>rb($,g,_,U)});function BU($,v){return new HG({type:"intersection",left:$,right:v})}var IG=w("ZodTuple",($,v)=>{q1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>ub($,g,_,U),$.rest=(g)=>$.clone({...$._zod.def,rest:g})});function YG($,v,g){let _=v instanceof $$,U=_?g:v;return new IG({type:"tuple",items:$,rest:_?v:null,...j.normalizeParams(U)})}var Fg=w("ZodRecord",($,v)=>{v8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>yb($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType});function N$($,v,g){return new Fg({type:"record",keyType:$,valueType:v,...j.normalizeParams(g)})}function e7($,v,g){let _=kv($);return _._zod.values=void 0,new Fg({type:"record",keyType:_,valueType:v,...j.normalizeParams(g)})}function $W($,v,g){return new Fg({type:"record",keyType:$,valueType:v,mode:"loose",...j.normalizeParams(g)})}var LG=w("ZodMap",($,v)=>{U8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Mb($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(T6(...g)),$.size=(...g)=>$.check(b4(...g))});function vW($,v,g){return new LG({type:"map",keyType:$,valueType:v,...j.normalizeParams(g)})}var qG=w("ZodSet",($,v)=>{g8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Qb($,g,_,U),$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(T6(...g)),$.size=(...g)=>$.check(b4(...g))});function UW($,v){return new qG({type:"set",valueType:$,...j.normalizeParams(v)})}var zU=w("ZodEnum",($,v)=>{_8.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>Ib($,_,U,z),$.enum=v.entries,$.options=Object.values(v.entries);let g=new Set(Object.keys(v.entries));$.extract=(_,U)=>{let z={};for(let J of _)if(g.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new zU({...v,checks:[],...j.normalizeParams(U),entries:z})},$.exclude=(_,U)=>{let z={...v.entries};for(let J of _)if(g.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new zU({...v,checks:[],...j.normalizeParams(U),entries:z})}});function vv($,v){let g=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new zU({type:"enum",entries:g,...j.normalizeParams(v)})}function gW($,v){return new zU({type:"enum",entries:$,...j.normalizeParams(v)})}var XG=w("ZodLiteral",($,v)=>{z8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Yb($,g,_,U),$.values=new Set(v.values),Object.defineProperty($,"value",{get(){if(v.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return v.values[0]}})});function t($,v){return new XG({type:"literal",values:Array.isArray($)?$:[$],...j.normalizeParams(v)})}var wG=w("ZodFile",($,v)=>{J8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Xb($,g,_,U),$.min=(g,_)=>$.check(dv(g,_)),$.max=(g,_)=>$.check(T6(g,_)),$.mime=(g,_)=>$.check(a4(Array.isArray(g)?g:[g],_))});function _W($){return d9(wG,$)}var FG=w("ZodTransform",($,v)=>{b8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Zb($,g,_,U),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4($.constructor.name);g.addIssue=(z)=>{if(typeof z==="string")g.issues.push(j.issue(z,g.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=g.value),J.inst??(J.inst=$),g.issues.push(j.issue(J))}};let U=v.transform(g.value,g);if(U instanceof Promise)return U.then((z)=>{return g.value=z,g});return g.value=U,g}});function F0($){return new FG({type:"transform",transform:$})}var A0=w("ZodOptional",($,v)=>{X1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>t1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function y$($){return new A0({type:"optional",innerType:$})}var AG=w("ZodExactOptional",($,v)=>{G8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>t1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function ZG($){return new AG({type:"optional",innerType:$})}var MG=w("ZodNullable",($,v)=>{O8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Db($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function Hg($){return new MG({type:"nullable",innerType:$})}function zW($){return y$(Hg($))}var QG=w("ZodDefault",($,v)=>{K8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Tb($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function SG($,v){return new QG({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var NG=w("ZodPrefault",($,v)=>{W8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>jb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function rG($,v){return new NG({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var Z0=w("ZodNonOptional",($,v)=>{B8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Rb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function uG($,v){return new Z0({type:"nonoptional",innerType:$,...j.normalizeParams(v)})}var yG=w("ZodSuccess",($,v)=>{P8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>wb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function JW($){return new yG({type:"success",innerType:$})}var DG=w("ZodCatch",($,v)=>{k8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Vb($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function RG($,v){return new DG({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var TG=w("ZodNaN",($,v)=>{H8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Lb($,g,_,U)});function bW($){return n9(TG,$)}var M0=w("ZodPipe",($,v)=>{I8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Cb($,g,_,U),$.in=v.in,$.out=v.out});function Ig($,v){return new M0({type:"pipe",in:$,out:v})}var Q0=w("ZodCodec",($,v)=>{M0.init($,v),zg.init($,v)});function GW($,v,g){return new Q0({type:"pipe",in:$,out:v,transform:g.decode,reverseTransform:g.encode})}var jG=w("ZodReadonly",($,v)=>{Y8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>fb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function VG($){return new jG({type:"readonly",innerType:$})}var CG=w("ZodTemplateLiteral",($,v)=>{L8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>qb($,g,_,U)});function OW($,v){return new CG({type:"template_literal",parts:$,...j.normalizeParams(v)})}var fG=w("ZodLazy",($,v)=>{w8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>cb($,g,_,U),$.unwrap=()=>$._zod.def.getter()});function mG($){return new fG({type:"lazy",getter:$})}var cG=w("ZodPromise",($,v)=>{X8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>mb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function KW($){return new cG({type:"promise",innerType:$})}var EG=w("ZodFunction",($,v)=>{q8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Ab($,g,_,U)});function WW($){return new EG({type:"function",input:Array.isArray($?.input)?YG($?.input):$?.input??J$(Q$()),output:$?.output??Q$()})}var Ag=w("ZodCustom",($,v)=>{F8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Fb($,g,_,U)});function BW($){let v=new S$({check:"custom"});return v._zod.check=$,v}function S0($,v){return a9(Ag,$??(()=>!0),v)}function iG($,v={}){return s9(Ag,$,v)}function lG($){return e9($)}var PW=$b,kW=vb;function HW($,v={}){let g=new Ag({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...j.normalizeParams(v)});return g._zod.bag.Class=$,g._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:g,path:[...g._zod.def.path??[]]})},g}var IW=(...$)=>Ub({Codec:Q0,Boolean:OU,String:JU},...$);function YW($){let v=mG(()=>{return A$([Z($),Y$(),x$(),WU(),J$(v),N$(Z(),v)])});return v}function Zg($,v){return Ig(F0($),v)}var qL={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function XL($){l$({customError:$})}function wL(){return l$().customError}var xG;(function($){})(xG||(xG={}));var E={...Pg,...a1,iso:f6},FL=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function AL($,v){let g=$.$schema;if(g==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(g==="http://json-schema.org/draft-07/schema#")return"draft-7";if(g==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function ZL($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let g=$.slice(1).split("/").filter(Boolean);if(g.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(g[0]===_){let U=g[1];if(!U||!v.defs[U])throw Error(`Reference not found: ${$}`);return v.defs[U]}throw Error(`Reference not found: ${$}`)}function LW($,v){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return E.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let U=$.$ref;if(v.refs.has(U))return v.refs.get(U);if(v.processing.has(U))return E.lazy(()=>{if(!v.refs.has(U))throw Error(`Circular reference not resolved: ${U}`);return v.refs.get(U)});v.processing.add(U);let z=ZL(U,v),J=Ov(z,v);return v.refs.set(U,J),v.processing.delete(U),J}if($.enum!==void 0){let U=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&U.length===1&&U[0]===null)return E.null();if(U.length===0)return E.never();if(U.length===1)return E.literal(U[0]);if(U.every((J)=>typeof J==="string"))return E.enum(U);let z=U.map((J)=>E.literal(J));if(z.length<2)return z[0];return E.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return E.literal($.const);let g=$.type;if(Array.isArray(g)){let U=g.map((z)=>{let J={...$,type:z};return LW(J,v)});if(U.length===0)return E.never();if(U.length===1)return U[0];return E.union(U)}if(!g)return E.any();let _;switch(g){case"string":{let U=E.string();if($.format){let z=$.format;if(z==="email")U=U.check(E.email());else if(z==="uri"||z==="uri-reference")U=U.check(E.url());else if(z==="uuid"||z==="guid")U=U.check(E.uuid());else if(z==="date-time")U=U.check(E.iso.datetime());else if(z==="date")U=U.check(E.iso.date());else if(z==="time")U=U.check(E.iso.time());else if(z==="duration")U=U.check(E.iso.duration());else if(z==="ipv4")U=U.check(E.ipv4());else if(z==="ipv6")U=U.check(E.ipv6());else if(z==="mac")U=U.check(E.mac());else if(z==="cidr")U=U.check(E.cidrv4());else if(z==="cidr-v6")U=U.check(E.cidrv6());else if(z==="base64")U=U.check(E.base64());else if(z==="base64url")U=U.check(E.base64url());else if(z==="e164")U=U.check(E.e164());else if(z==="jwt")U=U.check(E.jwt());else if(z==="emoji")U=U.check(E.emoji());else if(z==="nanoid")U=U.check(E.nanoid());else if(z==="cuid")U=U.check(E.cuid());else if(z==="cuid2")U=U.check(E.cuid2());else if(z==="ulid")U=U.check(E.ulid());else if(z==="xid")U=U.check(E.xid());else if(z==="ksuid")U=U.check(E.ksuid())}if(typeof $.minLength==="number")U=U.min($.minLength);if(typeof $.maxLength==="number")U=U.max($.maxLength);if($.pattern)U=U.regex(new RegExp($.pattern));_=U;break}case"number":case"integer":{let U=g==="integer"?E.number().int():E.number();if(typeof $.minimum==="number")U=U.min($.minimum);if(typeof $.maximum==="number")U=U.max($.maximum);if(typeof $.exclusiveMinimum==="number")U=U.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")U=U.gt($.minimum);if(typeof $.exclusiveMaximum==="number")U=U.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")U=U.lt($.maximum);if(typeof $.multipleOf==="number")U=U.multipleOf($.multipleOf);_=U;break}case"boolean":{_=E.boolean();break}case"null":{_=E.null();break}case"object":{let U={},z=$.properties||{},J=new Set($.required||[]);for(let[O,K]of Object.entries(z)){let W=Ov(K,v);U[O]=J.has(O)?W:W.optional()}if($.propertyNames){let O=Ov($.propertyNames,v),K=$.additionalProperties&&typeof $.additionalProperties==="object"?Ov($.additionalProperties,v):E.any();if(Object.keys(U).length===0){_=E.record(O,K);break}let W=E.object(U).passthrough(),B=E.looseRecord(O,K);_=E.intersection(W,B);break}if($.patternProperties){let O=$.patternProperties,K=Object.keys(O),W=[];for(let k of K){let P=Ov(O[k],v),X=E.string().regex(new RegExp(k));W.push(E.looseRecord(X,P))}let B=[];if(Object.keys(U).length>0)B.push(E.object(U).passthrough());if(B.push(...W),B.length===0)_=E.object({}).passthrough();else if(B.length===1)_=B[0];else{let k=E.intersection(B[0],B[1]);for(let P=2;P<B.length;P++)k=E.intersection(k,B[P]);_=k}break}let b=E.object(U);if($.additionalProperties===!1)_=b.strict();else if(typeof $.additionalProperties==="object")_=b.catchall(Ov($.additionalProperties,v));else _=b.passthrough();break}case"array":{let{prefixItems:U,items:z}=$;if(U&&Array.isArray(U)){let J=U.map((O)=>Ov(O,v)),b=z&&typeof z==="object"&&!Array.isArray(z)?Ov(z,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(Array.isArray(z)){let J=z.map((O)=>Ov(O,v)),b=$.additionalItems&&typeof $.additionalItems==="object"?Ov($.additionalItems,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(z!==void 0){let J=Ov(z,v),b=E.array(J);if(typeof $.minItems==="number")b=b.min($.minItems);if(typeof $.maxItems==="number")b=b.max($.maxItems);_=b}else _=E.array(E.any());break}default:throw Error(`Unsupported type: ${g}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function Ov($,v){if(typeof $==="boolean")return $?E.any():E.never();let g=LW($,v),_=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let b=$.anyOf.map((K)=>Ov(K,v)),O=E.union(b);g=_?E.intersection(g,O):O}if($.oneOf&&Array.isArray($.oneOf)){let b=$.oneOf.map((K)=>Ov(K,v)),O=E.xor(b);g=_?E.intersection(g,O):O}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)g=_?g:E.any();else{let b=_?g:Ov($.allOf[0],v),O=_?0:1;for(let K=O;K<$.allOf.length;K++)b=E.intersection(b,Ov($.allOf[K],v));g=b}if($.nullable===!0&&v.version==="openapi-3.0")g=E.nullable(g);if($.readOnly===!0)g=E.readonly(g);let U={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let b of z)if(b in $)U[b]=$[b];let J=["contentEncoding","contentMediaType","contentSchema"];for(let b of J)if(b in $)U[b]=$[b];for(let b of Object.keys($))if(!FL.has(b))U[b]=$[b];if(Object.keys(U).length>0)v.registry.add(g,U);return g}function qW($,v){if(typeof $==="boolean")return $?E.any():E.never();let g=AL($,v?.defaultTarget),_=$.$defs||$.definitions||{},U={version:g,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??e$};return Ov($,U)}var hG={};ev(hG,{string:()=>ML,number:()=>QL,date:()=>rL,boolean:()=>SL,bigint:()=>NL});function ML($){return q9(JU,$)}function QL($){return S9(GU,$)}function SL($){return T9(OU,$)}function NL($){return V9(KU,$)}function rL($){return o9(Lg,$)}l$(Jg());var m6="io.modelcontextprotocol/related-task",r0="2.0",Uv=S0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),XW=A$([Z(),Y$().int()]),wW=Z(),sS=$v({ttl:A$([Y$(),WU()]).optional(),pollInterval:Y$().optional()}),uL=x({ttl:Y$().optional()}),yL=x({taskId:Z()}),pG=$v({progressToken:XW.optional(),[m6]:yL.optional()}),rv=x({_meta:pG.optional()}),Mg=rv.extend({task:uL.optional()}),FW=($)=>Mg.safeParse($).success,gv=x({method:Z(),params:rv.loose().optional()}),Rv=x({_meta:pG.optional()}),Tv=x({method:Z(),params:Rv.loose().optional()}),_v=$v({_meta:pG.optional()}),kU=A$([Z(),Y$().int()]),AW=x({jsonrpc:t(r0),id:kU,...gv.shape}).strict(),oG=($)=>AW.safeParse($).success,ZW=x({jsonrpc:t(r0),...Tv.shape}).strict(),MW=($)=>ZW.safeParse($).success,nG=x({jsonrpc:t(r0),id:kU,result:_v}).strict(),Qg=($)=>nG.safeParse($).success;var F$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(F$||(F$={}));var tG=x({jsonrpc:t(r0),id:kU.optional(),error:x({code:Y$().int(),message:Z(),data:Q$().optional()})}).strict();var QW=($)=>tG.safeParse($).success;var SW=A$([AW,ZW,nG,tG]),eS=A$([nG,tG]),u0=_v.strict(),DL=Rv.extend({requestId:kU.optional(),reason:Z().optional()}),y0=Tv.extend({method:t("notifications/cancelled"),params:DL}),RL=x({src:Z(),mimeType:Z().optional(),sizes:J$(Z()).optional(),theme:vv(["light","dark"]).optional()}),Sg=x({icons:J$(RL).optional()}),PU=x({name:Z(),title:Z().optional()}),Ng=PU.extend({...PU.shape,...Sg.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),TL=BU(x({applyDefaults:x$().optional()}),N$(Z(),Q$())),jL=Zg(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},BU(x({form:TL.optional(),url:Uv.optional()}),N$(Z(),Q$()).optional())),VL=$v({list:Uv.optional(),cancel:Uv.optional(),requests:$v({sampling:$v({createMessage:Uv.optional()}).optional(),elicitation:$v({create:Uv.optional()}).optional()}).optional()}),CL=$v({list:Uv.optional(),cancel:Uv.optional(),requests:$v({tools:$v({call:Uv.optional()}).optional()}).optional()}),fL=x({experimental:N$(Z(),Uv).optional(),sampling:x({context:Uv.optional(),tools:Uv.optional()}).optional(),elicitation:jL.optional(),roots:x({listChanged:x$().optional()}).optional(),tasks:VL.optional()}),mL=rv.extend({protocolVersion:Z(),capabilities:fL,clientInfo:Ng}),cL=gv.extend({method:t("initialize"),params:mL});var EL=x({experimental:N$(Z(),Uv).optional(),logging:Uv.optional(),completions:Uv.optional(),prompts:x({listChanged:x$().optional()}).optional(),resources:x({subscribe:x$().optional(),listChanged:x$().optional()}).optional(),tools:x({listChanged:x$().optional()}).optional(),tasks:CL.optional()}),iL=_v.extend({protocolVersion:Z(),capabilities:EL,serverInfo:Ng,instructions:Z().optional()}),lL=Tv.extend({method:t("notifications/initialized"),params:Rv.optional()});var c6=gv.extend({method:t("ping"),params:rv.optional()}),xL=x({progress:Y$(),total:y$(Y$()),message:y$(Z())}),hL=x({...Rv.shape,...xL.shape,progressToken:XW}),D0=Tv.extend({method:t("notifications/progress"),params:hL}),pL=rv.extend({cursor:wW.optional()}),rg=gv.extend({params:pL.optional()}),ug=_v.extend({nextCursor:wW.optional()}),oL=vv(["working","input_required","completed","failed","cancelled"]),yg=x({taskId:Z(),status:oL,ttl:A$([Y$(),WU()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:y$(Y$()),statusMessage:y$(Z())}),R0=_v.extend({task:yg}),nL=Rv.merge(yg),Dg=Tv.extend({method:t("notifications/tasks/status"),params:nL}),T0=gv.extend({method:t("tasks/get"),params:rv.extend({taskId:Z()})}),j0=_v.merge(yg),V0=gv.extend({method:t("tasks/result"),params:rv.extend({taskId:Z()})}),$N=_v.loose(),C0=rg.extend({method:t("tasks/list")}),f0=ug.extend({tasks:J$(yg)}),m0=gv.extend({method:t("tasks/cancel"),params:rv.extend({taskId:Z()})}),NW=_v.merge(yg),rW=x({uri:Z(),mimeType:y$(Z()),_meta:N$(Z(),Q$()).optional()}),uW=rW.extend({text:Z()}),dG=Z().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),yW=rW.extend({blob:dG}),Rg=vv(["user","assistant"]),HU=x({audience:J$(Rg).optional(),priority:Y$().min(0).max(1).optional(),lastModified:f6.datetime({offset:!0}).optional()}),DW=x({...PU.shape,...Sg.shape,uri:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:HU.optional(),_meta:y$($v({}))}),tL=x({...PU.shape,...Sg.shape,uriTemplate:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:HU.optional(),_meta:y$($v({}))}),aG=rg.extend({method:t("resources/list")}),Tg=ug.extend({resources:J$(DW)}),sG=rg.extend({method:t("resources/templates/list")}),eG=ug.extend({resourceTemplates:J$(tL)}),$3=rv.extend({uri:Z()}),dL=$3,v3=gv.extend({method:t("resources/read"),params:dL}),jg=_v.extend({contents:J$(A$([uW,yW]))}),U3=Tv.extend({method:t("notifications/resources/list_changed"),params:Rv.optional()}),aL=$3,sL=gv.extend({method:t("resources/subscribe"),params:aL}),eL=$3,$q=gv.extend({method:t("resources/unsubscribe"),params:eL}),vq=Rv.extend({uri:Z()}),Uq=Tv.extend({method:t("notifications/resources/updated"),params:vq}),gq=x({name:Z(),description:y$(Z()),required:y$(x$())}),_q=x({...PU.shape,...Sg.shape,description:y$(Z()),arguments:y$(J$(gq)),_meta:y$($v({}))}),g3=rg.extend({method:t("prompts/list")}),_3=ug.extend({prompts:J$(_q)}),zq=rv.extend({name:Z(),arguments:N$(Z(),Z()).optional()}),Jq=gv.extend({method:t("prompts/get"),params:zq}),z3=x({type:t("text"),text:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),J3=x({type:t("image"),data:dG,mimeType:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),b3=x({type:t("audio"),data:dG,mimeType:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),bq=x({type:t("tool_use"),name:Z(),id:Z(),input:N$(Z(),Q$()),_meta:N$(Z(),Q$()).optional()}),G3=x({type:t("resource"),resource:A$([uW,yW]),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),O3=DW.extend({type:t("resource_link")}),IU=A$([z3,J3,b3,O3,G3]),Gq=x({role:Rg,content:IU}),Oq=_v.extend({description:Z().optional(),messages:J$(Gq)}),K3=Tv.extend({method:t("notifications/prompts/list_changed"),params:Rv.optional()}),Kq=x({title:Z().optional(),readOnlyHint:x$().optional(),destructiveHint:x$().optional(),idempotentHint:x$().optional(),openWorldHint:x$().optional()}),Wq=x({taskSupport:vv(["required","optional","forbidden"]).optional()}),c0=x({...PU.shape,...Sg.shape,description:Z().optional(),inputSchema:x({type:t("object"),properties:N$(Z(),Uv).optional(),required:J$(Z()).optional()}).catchall(Q$()),outputSchema:x({type:t("object"),properties:N$(Z(),Uv).optional(),required:J$(Z()).optional()}).catchall(Q$()).optional(),annotations:Kq.optional(),execution:Wq.optional(),_meta:N$(Z(),Q$()).optional()}),Vg=rg.extend({method:t("tools/list")}),Bq=ug.extend({tools:J$(c0)}),E6=_v.extend({content:J$(IU).default([]),structuredContent:N$(Z(),Q$()).optional(),isError:x$().optional()}),vN=E6.or(_v.extend({toolResult:Q$()})),Pq=Mg.extend({name:Z(),arguments:N$(Z(),Q$()).optional()}),Cg=gv.extend({method:t("tools/call"),params:Pq}),W3=Tv.extend({method:t("notifications/tools/list_changed"),params:Rv.optional()}),UN=x({autoRefresh:x$().default(!0),debounceMs:Y$().int().nonnegative().default(300)}),RW=vv(["debug","info","notice","warning","error","critical","alert","emergency"]),kq=rv.extend({level:RW}),Hq=gv.extend({method:t("logging/setLevel"),params:kq}),Iq=Rv.extend({level:RW,logger:Z().optional(),data:Q$()}),B3=Tv.extend({method:t("notifications/message"),params:Iq}),Yq=x({name:Z().optional()}),Lq=x({hints:J$(Yq).optional(),costPriority:Y$().min(0).max(1).optional(),speedPriority:Y$().min(0).max(1).optional(),intelligencePriority:Y$().min(0).max(1).optional()}),qq=x({mode:vv(["auto","required","none"]).optional()}),Xq=x({type:t("tool_result"),toolUseId:Z().describe("The unique identifier for the corresponding tool call."),content:J$(IU).default([]),structuredContent:x({}).loose().optional(),isError:x$().optional(),_meta:N$(Z(),Q$()).optional()}),wq=wg("type",[z3,J3,b3]),N0=wg("type",[z3,J3,b3,bq,Xq]),Fq=x({role:Rg,content:A$([N0,J$(N0)]),_meta:N$(Z(),Q$()).optional()}),Aq=Mg.extend({messages:J$(Fq),modelPreferences:Lq.optional(),systemPrompt:Z().optional(),includeContext:vv(["none","thisServer","allServers"]).optional(),temperature:Y$().optional(),maxTokens:Y$().int(),stopSequences:J$(Z()).optional(),metadata:Uv.optional(),tools:J$(c0).optional(),toolChoice:qq.optional()}),Zq=gv.extend({method:t("sampling/createMessage"),params:Aq}),Mq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens"]).or(Z())),role:Rg,content:wq}),Qq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens","toolUse"]).or(Z())),role:Rg,content:A$([N0,J$(N0)])}),Sq=x({type:t("boolean"),title:Z().optional(),description:Z().optional(),default:x$().optional()}),Nq=x({type:t("string"),title:Z().optional(),description:Z().optional(),minLength:Y$().optional(),maxLength:Y$().optional(),format:vv(["email","uri","date","date-time"]).optional(),default:Z().optional()}),rq=x({type:vv(["number","integer"]),title:Z().optional(),description:Z().optional(),minimum:Y$().optional(),maximum:Y$().optional(),default:Y$().optional()}),uq=x({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),default:Z().optional()}),yq=x({type:t("string"),title:Z().optional(),description:Z().optional(),oneOf:J$(x({const:Z(),title:Z()})),default:Z().optional()}),Dq=x({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),enumNames:J$(Z()).optional(),default:Z().optional()}),Rq=A$([uq,yq]),Tq=x({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:Y$().optional(),maxItems:Y$().optional(),items:x({type:t("string"),enum:J$(Z())}),default:J$(Z()).optional()}),jq=x({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:Y$().optional(),maxItems:Y$().optional(),items:x({anyOf:J$(x({const:Z(),title:Z()}))}),default:J$(Z()).optional()}),Vq=A$([Tq,jq]),Cq=A$([Dq,Rq,Vq]),fq=A$([Cq,Sq,Nq,rq]),mq=Mg.extend({mode:t("form").optional(),message:Z(),requestedSchema:x({type:t("object"),properties:N$(Z(),fq),required:J$(Z()).optional()})}),cq=Mg.extend({mode:t("url"),message:Z(),elicitationId:Z(),url:Z().url()}),Eq=A$([mq,cq]),iq=gv.extend({method:t("elicitation/create"),params:Eq}),lq=Rv.extend({elicitationId:Z()}),xq=Tv.extend({method:t("notifications/elicitation/complete"),params:lq}),hq=_v.extend({action:vv(["accept","decline","cancel"]),content:Zg(($)=>$===null?void 0:$,N$(Z(),A$([Z(),Y$(),x$(),J$(Z())])).optional())}),pq=x({type:t("ref/resource"),uri:Z()});var oq=x({type:t("ref/prompt"),name:Z()}),nq=rv.extend({ref:A$([oq,pq]),argument:x({name:Z(),value:Z()}),context:x({arguments:N$(Z(),Z()).optional()}).optional()}),tq=gv.extend({method:t("completion/complete"),params:nq});var dq=_v.extend({completion:$v({values:J$(Z()).max(100),total:y$(Y$().int()),hasMore:y$(x$())})}),aq=x({uri:Z().startsWith("file://"),name:Z().optional(),_meta:N$(Z(),Q$()).optional()}),sq=gv.extend({method:t("roots/list"),params:rv.optional()}),eq=_v.extend({roots:J$(aq)}),$X=Tv.extend({method:t("notifications/roots/list_changed"),params:Rv.optional()}),gN=A$([c6,cL,tq,Hq,Jq,g3,aG,sG,v3,sL,$q,Cg,Vg,T0,V0,C0,m0]),_N=A$([y0,D0,lL,$X,Dg]),zN=A$([u0,Mq,Qq,hq,eq,j0,f0,R0]),JN=A$([c6,Zq,iq,sq,T0,V0,C0,m0]),bN=A$([y0,D0,B3,Uq,U3,W3,K3,Dg,xq]),GN=A$([u0,iL,dq,Oq,_3,Tg,eG,jg,E6,Bq,j0,f0,R0]);class k$ extends Error{constructor($,v,g){super(`MCP error ${$}: ${v}`);this.code=$,this.data=g,this.name="McpError"}static fromError($,v,g){if($===F$.UrlElicitationRequired&&g){let _=g;if(_.elicitations)return new TW(_.elicitations,v)}return new k$($,v,g)}}class TW extends k${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(F$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function E0($){return!!$._zod}function i0($,v){if(E0($))return E4($,v);return $.safeParse(v)}function jW($){if(!$)return;let v;if(E0($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function VW($){if(E0($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let g=$._def;if(g){if(g.value!==void 0)return g.value;if(Array.isArray(g.values)&&g.values.length>0)return g.values[0]}let _=$.value;if(_!==void 0)return _;return}function i6($){return $==="completed"||$==="failed"||$==="cancelled"}var vX=Symbol("Let zodToJsonSchema decide on which parser to use");var pN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function P3($){let g=jW($)?.method;if(!g)throw Error("Schema is missing a method literal");let _=VW(g);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function k3($,v){let g=i0($,v);if(!g.success)throw g.error;return g.data}var bX=60000;class mg{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(y0,(v)=>{this._oncancel(v)}),this.setNotificationHandler(D0,(v)=>{this._onprogress(v)}),this.setRequestHandler(c6,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(T0,async(v,g)=>{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new k$(F$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(V0,async(v,g)=>{let _=async()=>{let U=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(U,g.sessionId)){if(J.type==="response"||J.type==="error"){let b=J.message,O=b.id,K=this._requestResolvers.get(O);if(K)if(this._requestResolvers.delete(O),J.type==="response")K(b);else{let W=b,B=new k$(W.error.code,W.error.message,W.error.data);K(B)}else{let W=J.type==="response"?"Response":"Error";this._onerror(Error(`${W} handler missing for request ${O}`))}continue}await this._transport?.send(J.message,{relatedRequestId:g.requestId})}}let z=await this._taskStore.getTask(U,g.sessionId);if(!z)throw new k$(F$.InvalidParams,`Task not found: ${U}`);if(!i6(z.status))return await this._waitForTaskUpdate(U,g.signal),await _();if(i6(z.status)){let J=await this._taskStore.getTaskResult(U,g.sessionId);return this._clearTaskQueue(U),{...J,_meta:{...J._meta,[m6]:{taskId:U}}}}return await _()};return await _()}),this.setRequestHandler(C0,async(v,g)=>{try{let{tasks:_,nextCursor:U}=await this._taskStore.listTasks(v.params?.cursor,g.sessionId);return{tasks:_,nextCursor:U,_meta:{}}}catch(_){throw new k$(F$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(m0,async(v,g)=>{try{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new k$(F$.InvalidParams,`Task not found: ${v.params.taskId}`);if(i6(_.status))throw new k$(F$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",g.sessionId),this._clearTaskQueue(v.params.taskId);let U=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!U)throw new k$(F$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...U}}catch(_){if(_ instanceof k$)throw _;throw new k$(F$.InvalidRequest,`Failed to cancel task: ${_ instanceof Error?_.message:String(_)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,v,g,_,U=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:g,resetTimeoutOnProgress:U,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let g=Date.now()-v.startTime;if(v.maxTotalTimeout&&g>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),k$.fromError(F$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:g});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout($){let v=this._timeoutInfo.get($);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let v=this.transport?.onclose;this._transport.onclose=()=>{v?.(),this._onclose()};let g=this.transport?.onerror;this._transport.onerror=(U)=>{g?.(U),this._onerror(U)};let _=this._transport?.onmessage;this._transport.onmessage=(U,z)=>{if(_?.(U,z),Qg(U)||QW(U))this._onresponse(U);else if(oG(U))this._onrequest(U,z);else if(MW(U))this._onnotification(U);else this._onerror(Error(`Unknown message type: ${JSON.stringify(U)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();for(let g of this._requestHandlerAbortControllers.values())g.abort();this._requestHandlerAbortControllers.clear();let v=k$.fromError(F$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let g of $.values())g(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest($,v){let g=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,U=$.params?._meta?.[m6]?.taskId;if(g===void 0){let K={jsonrpc:"2.0",id:$.id,error:{code:F$.MethodNotFound,message:"Method not found"}};if(U&&this._taskMessageQueue)this._enqueueTaskMessage(U,{type:"error",message:K,timestamp:Date.now()},_?.sessionId).catch((W)=>this._onerror(Error(`Failed to enqueue error response: ${W}`)));else _?.send(K).catch((W)=>this._onerror(Error(`Failed to send an error response: ${W}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let J=FW($.params)?$.params.task:void 0,b=this._taskStore?this.requestTaskStore($,_?.sessionId):void 0,O={signal:z.signal,sessionId:_?.sessionId,_meta:$.params?._meta,sendNotification:async(K)=>{if(z.signal.aborted)return;let W={relatedRequestId:$.id};if(U)W.relatedTask={taskId:U};await this.notification(K,W)},sendRequest:async(K,W,B)=>{if(z.signal.aborted)throw new k$(F$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(U&&!k.relatedTask)k.relatedTask={taskId:U};let P=k.relatedTask?.taskId??U;if(P&&b)await b.updateTaskStatus(P,"input_required");return await this.request(K,W,k)},authInfo:v?.authInfo,requestId:$.id,requestInfo:v?.requestInfo,taskId:U,taskStore:b,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>g($,O)).then(async(K)=>{if(z.signal.aborted)return;let W={result:K,jsonrpc:"2.0",id:$.id};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"response",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)},async(K)=>{if(z.signal.aborted)return;let W={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(K.code)?K.code:F$.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"error",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:v,...g}=$.params,_=Number(v),U=this._progressHandlers.get(_);if(!U){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(_),J=this._timeoutInfo.get(_);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(_)}catch(b){this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),z(b);return}U(g)}_onresponse($){let v=Number($.id),g=this._requestResolvers.get(v);if(g){if(this._requestResolvers.delete(v),Qg($))g($);else{let z=new k$($.error.code,$.error.message,$.error.data);g(z)}return}let _=this._responseHandlers.get(v);if(_===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(v),this._cleanupTimeout(v);let U=!1;if(Qg($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")U=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!U)this._progressHandlers.delete(v);if(Qg($))_($);else{let z=k$.fromError($.error.code,$.error.message,$.error.data);_(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,v,g){let{task:_}=g??{};if(!_){try{yield{type:"result",result:await this.request($,v,g)}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(F$.InternalError,String(z))}}return}let U;try{let z=await this.request($,R0,g);if(z.task)U=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new k$(F$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:U},g);if(yield{type:"taskStatus",task:J},i6(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};else if(J.status==="failed")yield{type:"error",error:new k$(F$.InternalError,`Task ${U} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k$(F$.InternalError,`Task ${U} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};return}let b=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((O)=>setTimeout(O,b)),g?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(F$.InternalError,String(z))}}}request($,v,g){let{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z,task:J,relatedTask:b}=g??{};return new Promise((O,K)=>{let W=(L)=>{K(L)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(L){W(L);return}g?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(g?.onprogress)this._progressHandlers.set(B,g.onprogress),k.params={...$.params,_meta:{...$.params?._meta||{},progressToken:B}};if(J)k.params={...k.params,task:J};if(b)k.params={...k.params,_meta:{...k.params?._meta||{},[m6]:b}};let P=(L)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(L)}},{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((F)=>this._onerror(Error(`Failed to send cancellation: ${F}`)));let q=L instanceof k$?L:new k$(F$.RequestTimeout,String(L));K(q)};this._responseHandlers.set(B,(L)=>{if(g?.signal?.aborted)return;if(L instanceof Error)return K(L);try{let q=i0(v,L.result);if(!q.success)K(q.error);else O(q.data)}catch(q){K(q)}}),g?.signal?.addEventListener("abort",()=>{P(g?.signal?.reason)});let X=g?.timeout??bX,Y=()=>P(k$.fromError(F$.RequestTimeout,"Request timed out",{timeout:X}));this._setupTimeout(B,X,g?.maxTotalTimeout,Y,g?.resetTimeoutOnProgress??!1);let H=b?.taskId;if(H){let L=(q)=>{let F=this._responseHandlers.get(B);if(F)F(q);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,L),this._enqueueTaskMessage(H,{type:"request",message:k,timestamp:Date.now()}).catch((q)=>{this._cleanupTimeout(B),K(q)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((L)=>{this._cleanupTimeout(B),K(L)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},j0,v)}async getTaskResult($,v,g){return this.request({method:"tasks/result",params:$},v,g)}async listTasks($,v){return this.request({method:"tasks/list",params:$},f0,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},NW,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let g=v?.relatedTask?.taskId;if(g){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[m6]:v.relatedTask}}};await this._enqueueTaskMessage(g,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!v?.relatedRequestId&&!v?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let J={...$,jsonrpc:"2.0"};if(v?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[m6]:v.relatedTask}}};this._transport?.send(J,v).catch((b)=>this._onerror(b))});return}let z={...$,jsonrpc:"2.0"};if(v?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[m6]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let g=P3($);this.assertRequestHandlerCapability(g),this._requestHandlers.set(g,(_,U)=>{let z=k3($,_);return Promise.resolve(v(z,U))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let g=P3($);this._notificationHandlers.set(g,(_)=>{let U=k3($,_);return Promise.resolve(v(U))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,g){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let _=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,v,g,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let g=await this._taskMessageQueue.dequeueAll($,v);for(let _ of g)if(_.type==="request"&&oG(_.message)){let U=_.message.id,z=this._requestResolvers.get(U);if(z)z(new k$(F$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(U);else this._onerror(Error(`Resolver missing for request ${U} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let g=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)g=_.pollInterval}catch{}return new Promise((_,U)=>{if(v.aborted){U(new k$(F$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,g);v.addEventListener("abort",()=>{clearTimeout(z),U(new k$(F$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let g=this._taskStore;if(!g)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await g.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let U=await g.getTask(_,v);if(!U)throw new k$(F$.InvalidParams,"Failed to retrieve task: Task not found");return U},storeTaskResult:async(_,U,z)=>{await g.storeTaskResult(_,U,z,v);let J=await g.getTask(_,v);if(J){let b=Dg.parse({method:"notifications/tasks/status",params:J});if(await this.notification(b),i6(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return g.getTaskResult(_,v)},updateTaskStatus:async(_,U,z)=>{let J=await g.getTask(_,v);if(!J)throw new k$(F$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(i6(J.status))throw new k$(F$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${U}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await g.updateTaskStatus(_,U,z,v);let b=await g.getTask(_,v);if(b){let O=Dg.parse({method:"notifications/tasks/status",params:b});if(await this.notification(O),i6(b.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return g.listTasks(_,v)}}}}var H3="2026-01-26";var GX="ui/notifications/tool-input-partial";var OX=I.union([I.literal("light"),I.literal("dark")]).describe("Color theme preference for the host environment."),cg=I.union([I.literal("inline"),I.literal("fullscreen"),I.literal("pip")]).describe("Display mode for UI presentation."),KX=I.union([I.literal("--color-background-primary"),I.literal("--color-background-secondary"),I.literal("--color-background-tertiary"),I.literal("--color-background-inverse"),I.literal("--color-background-ghost"),I.literal("--color-background-info"),I.literal("--color-background-danger"),I.literal("--color-background-success"),I.literal("--color-background-warning"),I.literal("--color-background-disabled"),I.literal("--color-text-primary"),I.literal("--color-text-secondary"),I.literal("--color-text-tertiary"),I.literal("--color-text-inverse"),I.literal("--color-text-ghost"),I.literal("--color-text-info"),I.literal("--color-text-danger"),I.literal("--color-text-success"),I.literal("--color-text-warning"),I.literal("--color-text-disabled"),I.literal("--color-border-primary"),I.literal("--color-border-secondary"),I.literal("--color-border-tertiary"),I.literal("--color-border-inverse"),I.literal("--color-border-ghost"),I.literal("--color-border-info"),I.literal("--color-border-danger"),I.literal("--color-border-success"),I.literal("--color-border-warning"),I.literal("--color-border-disabled"),I.literal("--color-ring-primary"),I.literal("--color-ring-secondary"),I.literal("--color-ring-inverse"),I.literal("--color-ring-info"),I.literal("--color-ring-danger"),I.literal("--color-ring-success"),I.literal("--color-ring-warning"),I.literal("--font-sans"),I.literal("--font-mono"),I.literal("--font-weight-normal"),I.literal("--font-weight-medium"),I.literal("--font-weight-semibold"),I.literal("--font-weight-bold"),I.literal("--font-text-xs-size"),I.literal("--font-text-sm-size"),I.literal("--font-text-md-size"),I.literal("--font-text-lg-size"),I.literal("--font-heading-xs-size"),I.literal("--font-heading-sm-size"),I.literal("--font-heading-md-size"),I.literal("--font-heading-lg-size"),I.literal("--font-heading-xl-size"),I.literal("--font-heading-2xl-size"),I.literal("--font-heading-3xl-size"),I.literal("--font-text-xs-line-height"),I.literal("--font-text-sm-line-height"),I.literal("--font-text-md-line-height"),I.literal("--font-text-lg-line-height"),I.literal("--font-heading-xs-line-height"),I.literal("--font-heading-sm-line-height"),I.literal("--font-heading-md-line-height"),I.literal("--font-heading-lg-line-height"),I.literal("--font-heading-xl-line-height"),I.literal("--font-heading-2xl-line-height"),I.literal("--font-heading-3xl-line-height"),I.literal("--border-radius-xs"),I.literal("--border-radius-sm"),I.literal("--border-radius-md"),I.literal("--border-radius-lg"),I.literal("--border-radius-xl"),I.literal("--border-radius-full"),I.literal("--border-width-regular"),I.literal("--shadow-hairline"),I.literal("--shadow-sm"),I.literal("--shadow-md"),I.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),WX=I.record(KX.describe(`Style variables for theming MCP apps.
147
147
 
148
148
  Individual style keys are optional - hosts may provide any subset of these values.
149
149
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
150
150
 
151
151
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
152
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),L.union([L.string(),L.undefined()]).describe(`Style variables for theming MCP apps.
152
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),I.union([I.string(),I.undefined()]).describe(`Style variables for theming MCP apps.
153
153
 
154
154
  Individual style keys are optional - hosts may provide any subset of these values.
155
155
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -161,10 +161,10 @@ Individual style keys are optional - hosts may provide any subset of these value
161
161
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
162
162
 
163
163
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
164
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),vF=L.object({method:L.literal("ui/open-link"),params:L.object({url:L.string().describe("URL to open in the host's browser")})}),gF=L.object({isError:L.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),UF=L.object({isError:L.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),_F=L.object({isError:L.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),zF=L.object({method:L.literal("ui/notifications/sandbox-proxy-ready"),params:L.object({})}),bO=L.object({connectDomains:L.array(L.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
164
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),BX=I.object({method:I.literal("ui/open-link"),params:I.object({url:I.string().describe("URL to open in the host's browser")})}),PX=I.object({isError:I.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),kX=I.object({isError:I.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),HX=I.object({isError:I.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),IX=I.object({method:I.literal("ui/notifications/sandbox-proxy-ready"),params:I.object({})}),I3=I.object({connectDomains:I.array(I.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
165
165
 
166
166
  - Maps to CSP \`connect-src\` directive
167
- - Empty or omitted → no network connections (secure default)`),resourceDomains:L.array(L.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:L.array(L.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:L.array(L.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),GO=L.object({camera:L.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:L.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:L.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:L.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),JF=L.object({method:L.literal("ui/notifications/size-changed"),params:L.object({width:L.number().optional().describe("New width in pixels."),height:L.number().optional().describe("New height in pixels.")})}),bF=L.object({method:L.literal("ui/notifications/tool-input"),params:L.object({arguments:L.record(L.string(),L.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),GF=L.object({method:L.literal("ui/notifications/tool-input-partial"),params:L.object({arguments:L.record(L.string(),L.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),OF=L.object({method:L.literal("ui/notifications/tool-cancelled"),params:L.object({reason:L.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),KF=L.object({fonts:L.string().optional()}),WF=L.object({variables:$F.optional().describe("CSS variables for theming the app."),css:KF.optional().describe("CSS blocks that apps can inject.")}),BF=L.object({method:L.literal("ui/resource-teardown"),params:L.object({})}),PF=L.record(L.string(),L.unknown()),uW=L.object({text:L.object({}).optional().describe("Host supports text content blocks."),image:L.object({}).optional().describe("Host supports image content blocks."),audio:L.object({}).optional().describe("Host supports audio content blocks."),resource:L.object({}).optional().describe("Host supports resource content blocks."),resourceLink:L.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:L.object({}).optional().describe("Host supports structured content.")}),kF=L.object({method:L.literal("ui/notifications/request-teardown"),params:L.object({}).optional()}),HF=L.object({experimental:L.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:L.object({}).optional().describe("Host supports opening external URLs."),downloadFile:L.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:L.object({listChanged:L.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:L.object({listChanged:L.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:L.object({}).optional().describe("Host accepts log messages."),sandbox:L.object({permissions:GO.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:bO.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:uW.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:uW.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),LF=L.object({experimental:L.object({}).optional().describe("Experimental features (structure TBD)."),tools:L.object({listChanged:L.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:L.array(TU).optional().describe("Display modes the app supports.")}),IF=L.object({method:L.literal("ui/notifications/initialized"),params:L.object({}).optional()}),jy=L.object({csp:bO.optional().describe("Content Security Policy configuration for UI resources."),permissions:GO.optional().describe("Sandbox permissions requested by the UI resource."),domain:L.string().optional().describe(`Dedicated origin for view sandbox.
167
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:I.array(I.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:I.array(I.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:I.array(I.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Y3=I.object({camera:I.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:I.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:I.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:I.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),YX=I.object({method:I.literal("ui/notifications/size-changed"),params:I.object({width:I.number().optional().describe("New width in pixels."),height:I.number().optional().describe("New height in pixels.")})}),LX=I.object({method:I.literal("ui/notifications/tool-input"),params:I.object({arguments:I.record(I.string(),I.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),qX=I.object({method:I.literal("ui/notifications/tool-input-partial"),params:I.object({arguments:I.record(I.string(),I.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),XX=I.object({method:I.literal("ui/notifications/tool-cancelled"),params:I.object({reason:I.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),wX=I.object({fonts:I.string().optional()}),FX=I.object({variables:WX.optional().describe("CSS variables for theming the app."),css:wX.optional().describe("CSS blocks that apps can inject.")}),AX=I.object({method:I.literal("ui/resource-teardown"),params:I.object({})}),ZX=I.record(I.string(),I.unknown()),CW=I.object({text:I.object({}).optional().describe("Host supports text content blocks."),image:I.object({}).optional().describe("Host supports image content blocks."),audio:I.object({}).optional().describe("Host supports audio content blocks."),resource:I.object({}).optional().describe("Host supports resource content blocks."),resourceLink:I.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:I.object({}).optional().describe("Host supports structured content.")}),MX=I.object({method:I.literal("ui/notifications/request-teardown"),params:I.object({}).optional()}),QX=I.object({experimental:I.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:I.object({}).optional().describe("Host supports opening external URLs."),downloadFile:I.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:I.object({listChanged:I.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:I.object({listChanged:I.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:I.object({}).optional().describe("Host accepts log messages."),sandbox:I.object({permissions:Y3.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:I3.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:CW.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:CW.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),SX=I.object({experimental:I.object({}).optional().describe("Experimental features (structure TBD)."),tools:I.object({listChanged:I.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:I.array(cg).optional().describe("Display modes the app supports.")}),NX=I.object({method:I.literal("ui/notifications/initialized"),params:I.object({}).optional()}),ny=I.object({csp:I3.optional().describe("Content Security Policy configuration for UI resources."),permissions:Y3.optional().describe("Sandbox permissions requested by the UI resource."),domain:I.string().optional().describe(`Dedicated origin for view sandbox.
168
168
 
169
169
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
170
170
 
@@ -172,16 +172,16 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
172
172
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
173
173
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
174
174
 
175
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:L.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
175
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:I.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
176
176
 
177
177
  Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
178
178
 
179
179
  - \`true\`: request visible border + background
180
180
  - \`false\`: request no visible border + background
181
- - omitted: host decides border`)}),yW=L.object({method:L.literal("ui/request-display-mode"),params:L.object({mode:TU.describe("The display mode being requested.")})}),YF=L.object({mode:TU.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),qF=L.union([L.literal("model"),L.literal("app")]).describe("Tool visibility scope - who can access the tool."),Vy=L.object({resourceUri:L.string().optional(),visibility:L.array(qF).optional().describe(`Who can access this tool. Default: ["model", "app"]
181
+ - omitted: host decides border`)}),fW=I.object({method:I.literal("ui/request-display-mode"),params:I.object({mode:cg.describe("The display mode being requested.")})}),rX=I.object({mode:cg.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),uX=I.union([I.literal("model"),I.literal("app")]).describe("Tool visibility scope - who can access the tool."),ty=I.object({resourceUri:I.string().optional(),visibility:I.array(uX).optional().describe(`Who can access this tool. Default: ["model", "app"]
182
182
  - "model": Tool visible to and callable by the agent
183
- - "app": Tool callable by the app from this server only`)}),Cy=L.object({mimeTypes:L.array(L.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),FF=L.object({method:L.literal("ui/download-file"),params:L.object({contents:L.array(L.union([eG,$O])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),XF=L.object({method:L.literal("ui/message"),params:L.object({role:L.literal("user").describe('Message role, currently only "user" is supported.'),content:L.array(Bg).describe("Message content blocks (text, image, etc.).")})}),fy=L.object({method:L.literal("ui/notifications/sandbox-resource-ready"),params:L.object({html:L.string().describe("HTML content to load into the inner iframe."),sandbox:L.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:bO.optional().describe("CSP configuration from resource metadata."),permissions:GO.optional().describe("Sandbox permissions from resource metadata.")})}),wF=L.object({method:L.literal("ui/notifications/tool-result"),params:c6.describe("Standard MCP tool execution result.")}),DW=L.object({toolInfo:L.object({id:Kg.optional().describe("JSON-RPC id of the tools/call request."),tool:R0.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:sq.optional().describe("Current color theme preference."),styles:WF.optional().describe("Style configuration for theming the app."),displayMode:TU.optional().describe("How the UI is currently displayed."),availableDisplayModes:L.array(TU).optional().describe("Display modes the host supports."),containerDimensions:L.union([L.object({height:L.number().describe("Fixed container height in pixels.")}),L.object({maxHeight:L.union([L.number(),L.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(L.union([L.object({width:L.number().describe("Fixed container width in pixels.")}),L.object({maxWidth:L.union([L.number(),L.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
184
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:L.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:L.string().optional().describe("User's timezone in IANA format."),userAgent:L.string().optional().describe("Host application identifier."),platform:L.union([L.literal("web"),L.literal("desktop"),L.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:L.object({touch:L.boolean().optional().describe("Whether the device supports touch input."),hover:L.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:L.object({top:L.number().describe("Top safe area inset in pixels."),right:L.number().describe("Right safe area inset in pixels."),bottom:L.number().describe("Bottom safe area inset in pixels."),left:L.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),AF=L.object({method:L.literal("ui/notifications/host-context-changed"),params:DW.describe("Partial context update containing only changed fields.")}),ZF=L.object({method:L.literal("ui/update-model-context"),params:L.object({content:L.array(Bg).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:L.record(L.string(),L.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),MF=L.object({method:L.literal("ui/initialize"),params:L.object({appInfo:wU.describe("App identification (name and version)."),appCapabilities:LF.describe("Features and capabilities this app provides."),protocolVersion:L.string().describe("Protocol version this app supports.")})}),SF=L.object({protocolVersion:L.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:wU.describe("Host application identification and version."),hostCapabilities:HF.describe("Features and capabilities provided by the host."),hostContext:DW.describe("Rich context about the host environment.")}).passthrough();class V0{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(U)=>{if(v&&U.source!==this.eventSource){console.debug("Ignoring message from unknown source",U);return}let _=FW.safeParse(U.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(U.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,U);else console.error("Failed to parse message",_.error.message,U),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==aq)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class QF extends RU{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},U={autoResize:!0}){super(U);this._appInfo=$,this._capabilities=v,this.options=U,this.setRequestHandler(f6,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(bF,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(GF,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(wF,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(OF,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(AF,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(BF,(v,U)=>$(v.params,U))}set oncalltool($){this.setRequestHandler(yU,(v,U)=>$(v.params,U))}set onlisttools($){this.setRequestHandler(uU,(v,U)=>$(v.params,U))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,v){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},c6,v)}async readServerResource($,v){return await this.request({method:"resources/read",params:$},rU,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},NU,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},_F,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},A0,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},gF,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},UF,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},YF,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,U=0,_=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,J=z.style.width,b=z.style.height;z.style.width="fit-content",z.style.height="max-content";let O=z.getBoundingClientRect();z.style.width=J,z.style.height=b;let K=window.innerWidth-z.clientWidth,W=Math.ceil(O.width+K),B=Math.ceil(O.height);if(W!==v||B!==U)v=W,U=B,this.sendSizeChanged({width:W,height:B})})};_();let g=new ResizeObserver(_);return g.observe(document.documentElement),g.observe(document.body),()=>g.disconnect()}async connect($=new V0(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let U=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:JO}},SF,v);if(U===void 0)throw Error(`Server sent invalid initialize result: ${U}`);if(this._hostCapabilities=U.hostCapabilities,this._hostInfo=U.hostInfo,this._hostContext=U.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(U){throw this.close(),U}}}function RW($){if(!$)return"";let v=[];if($.camera)v.push("camera");if($.microphone)v.push("microphone");if($.geolocation)v.push("geolocation");if($.clipboardWrite)v.push("clipboard-write");return v.join("; ")}var NF=[JO];class OO extends RU{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,U,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=U,this._hostContext=_?.hostContext||{},this.setRequestHandler(MF,(g)=>this._oninitialize(g)),this.setRequestHandler(f6,(g,z)=>{return this.onping?.(g.params,z),{}}),this.setRequestHandler(yW,(g)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(JF,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(zF,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(IF,(v)=>$(v.params))}set onmessage($){this.setRequestHandler(XF,async(v,U)=>{return $(v.params,U)})}set onopenlink($){this.setRequestHandler(vF,async(v,U)=>{return $(v.params,U)})}set ondownloadfile($){this.setRequestHandler(FF,async(v,U)=>{return $(v.params,U)})}set onrequestteardown($){this.setNotificationHandler(kF,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(yW,async(v,U)=>{return $(v.params,U)})}set onloggingmessage($){this.setNotificationHandler(UO,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(ZF,async(v,U)=>{return $(v.params,U)})}set oncalltool($){this.setRequestHandler(yU,async(v,U)=>{return $(v.params,U)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(iG,async(v,U)=>{return $(v.params,U)})}set onlistresourcetemplates($){this.setRequestHandler(lG,async(v,U)=>{return $(v.params,U)})}set onreadresource($){this.setRequestHandler(pG,async(v,U)=>{return $(v.params,U)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(nG,async(v,U)=>{return $(v.params,U)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let v=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:NF.includes(v)?v:JO,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},U=!1;for(let _ of Object.keys($)){let g=this._hostContext[_],z=$[_];if(rF(g,z))continue;v[_]=z,U=!0}if(U)this._hostContext=$,this.sendHostContextChange(v)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,v){return this.request({method:"ui/resource-teardown",params:$},PF,v)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let v=this._client.getServerCapabilities();if(!v)throw Error("Client server capabilities not available");if(v.tools){if(this.oncalltool=async(U,_)=>{return this._client.request({method:"tools/call",params:U},c6,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(gO,(U)=>this.sendToolListChanged(U.params))}if(v.resources){if(this.onlistresources=async(U,_)=>{return this._client.request({method:"resources/list",params:U},NU,{signal:_.signal})},this.onlistresourcetemplates=async(U,_)=>{return this._client.request({method:"resources/templates/list",params:U},hG,{signal:_.signal})},this.onreadresource=async(U,_)=>{return this._client.request({method:"resources/read",params:U},rU,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(oG,(U)=>this.sendResourceListChanged(U.params))}if(v.prompts){if(this.onlistprompts=async(U,_)=>{return this._client.request({method:"prompts/list",params:U},tG,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(vO,(U)=>this.sendPromptListChanged(U.params))}}return super.connect($)}}function rF($,v){return JSON.stringify($)===JSON.stringify(v)}function KO($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function uF($){return KO($)&&Array.isArray($.content)&&$.content.every((v)=>KO(v)&&typeof v.type==="string")}function yF(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function DF($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(v){return console.debug("[ext-app-tool-result] stringify failed",v),String($)}}function WO($){let v=$.success===!1;if(uF($.result))return{...$.result,isError:$.result.isError===!0||v};let U=KO($.result)?$.result:null,_=yF($.detailedContent,$.content,U?.detailedContent,U?.content,U?.textResultForLlm,U?.text,U?.message,typeof $.result==="string"?$.result:void 0,$.error)??DF($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function TW($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let U=JSON.stringify($),_=JSON.stringify(v);if(U===void 0||_===void 0)return!1;if(Math.abs(U.length-_.length)>2000000)return!1;return U===_}catch{return!1}}function jW($,v){switch($){case"html":return typeof v.html==="string"&&v.html.length>0||typeof v.content==="string"&&v.content.length>0;case"json-render":case"graph":return!0;case"mcp-app":return v.viewerType==="web-artifact"&&typeof v.path==="string"&&v.path.length>0||typeof v.url==="string"&&v.url.length>0;case"webpage":return typeof v.url==="string"&&v.url.length>0;default:return!1}}var BO="allow-scripts allow-popups allow-popups-to-escape-sandbox";function VW($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function RF($,v){let U=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await U.json();if(!U.ok||!VW(_)||!_.ok||typeof _.url!=="string"){let g=VW(_)&&_.error?_.error:`Frame document request failed with HTTP ${U.status}`;throw Error(g)}return _.url}function CW($,v){let[U,_]=o(null);return c(()=>{if(_(null),!$)return;let g=!1;return RF($,v).then((z)=>{if(!g)_(z)}).catch((z)=>{console.error("[iframe-document] failed to create frame document:",z)}),()=>{g=!0}},[$,v]),n$(()=>({attributes:U?{src:U}:{},ready:Boolean(U),key:U??""}),[U])}function Pg($){let{enabled:v,token:U,nodeId:_,sourceSurface:g,iframeRef:z}=$;c(()=>{if(!v||!U)return;function J(b){if(b.source!==z.current?.contentWindow)return;let O=b.data;if(!O||O.source!==l_||O.token!==U||O.nodeId!==_)return;let K=O.interaction;if(!K||typeof K.type!=="string")return;let W=K.type;F_({type:W,sourceNodeId:_,sourceSurface:g,...K.payload&&typeof K.payload==="object"?{payload:K.payload}:{}}).then((B)=>{if(B.ok)r4("context","AX interaction",W,[_]);else r4("remove","AX interaction rejected",B.error??B.code??"",[_]);z.current?.contentWindow?.postMessage({source:h_,token:U,...O.correlationId?{correlationId:O.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,U,_,g])}async function J4($,v){let _=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();if(!_.ok)throw Error(_.error??`Request failed: ${$}`);return _.result}function PO($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var TF=1000,jF=7000;function b4($,v){if(typeof window>"u")return;let U=window;if(U.__PMX_EXTAPP_LOG??=[],U.__PMX_EXTAPP_LOG.length<500)U.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});VF({t:Date.now(),nodeId:$,event:v})}var fW=[],kO=null;function VF($){if(fW.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),kO)return;kO=setTimeout(()=>{kO=null;let v=fW.splice(0);if(v.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:v})}).catch(()=>{})},1500)}var cW=Promise.resolve();function CF($){cW=cW.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,TF))}).catch(()=>{})}function fF($,v){return v?$==="done":$==="ready"||$==="done"}function cF($,v){let U=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",g=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${g}:${z}:${U}`}function mF($,v){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!v,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:v};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function mW($,v,U){if(await $.sendToolInput({arguments:v}),U)await $.sendToolResult(U)}function EF($){return typeof $==="string"&&$.trim().length>0?$.trim():BO}function iF($,v){return`<script data-pmx-canvas-ax-bridge>
183
+ - "app": Tool callable by the app from this server only`)}),dy=I.object({mimeTypes:I.array(I.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),yX=I.object({method:I.literal("ui/download-file"),params:I.object({contents:I.array(I.union([G3,O3])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),DX=I.object({method:I.literal("ui/message"),params:I.object({role:I.literal("user").describe('Message role, currently only "user" is supported.'),content:I.array(IU).describe("Message content blocks (text, image, etc.).")})}),ay=I.object({method:I.literal("ui/notifications/sandbox-resource-ready"),params:I.object({html:I.string().describe("HTML content to load into the inner iframe."),sandbox:I.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:I3.optional().describe("CSP configuration from resource metadata."),permissions:Y3.optional().describe("Sandbox permissions from resource metadata.")})}),RX=I.object({method:I.literal("ui/notifications/tool-result"),params:E6.describe("Standard MCP tool execution result.")}),mW=I.object({toolInfo:I.object({id:kU.optional().describe("JSON-RPC id of the tools/call request."),tool:c0.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:OX.optional().describe("Current color theme preference."),styles:FX.optional().describe("Style configuration for theming the app."),displayMode:cg.optional().describe("How the UI is currently displayed."),availableDisplayModes:I.array(cg).optional().describe("Display modes the host supports."),containerDimensions:I.union([I.object({height:I.number().describe("Fixed container height in pixels.")}),I.object({maxHeight:I.union([I.number(),I.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(I.union([I.object({width:I.number().describe("Fixed container width in pixels.")}),I.object({maxWidth:I.union([I.number(),I.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
184
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:I.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:I.string().optional().describe("User's timezone in IANA format."),userAgent:I.string().optional().describe("Host application identifier."),platform:I.union([I.literal("web"),I.literal("desktop"),I.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:I.object({touch:I.boolean().optional().describe("Whether the device supports touch input."),hover:I.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:I.object({top:I.number().describe("Top safe area inset in pixels."),right:I.number().describe("Right safe area inset in pixels."),bottom:I.number().describe("Bottom safe area inset in pixels."),left:I.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),TX=I.object({method:I.literal("ui/notifications/host-context-changed"),params:mW.describe("Partial context update containing only changed fields.")}),jX=I.object({method:I.literal("ui/update-model-context"),params:I.object({content:I.array(IU).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:I.record(I.string(),I.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),VX=I.object({method:I.literal("ui/initialize"),params:I.object({appInfo:Ng.describe("App identification (name and version)."),appCapabilities:SX.describe("Features and capabilities this app provides."),protocolVersion:I.string().describe("Protocol version this app supports.")})}),CX=I.object({protocolVersion:I.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ng.describe("Host application identification and version."),hostCapabilities:QX.describe("Features and capabilities provided by the host."),hostContext:mW.describe("Rich context about the host environment.")}).passthrough();class l0{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(g)=>{if(v&&g.source!==this.eventSource){console.debug("Ignoring message from unknown source",g);return}let _=SW.safeParse(g.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(g.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,g);else console.error("Failed to parse message",_.error.message,g),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==GX)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class fX extends mg{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},g={autoResize:!0}){super(g);this._appInfo=$,this._capabilities=v,this.options=g,this.setRequestHandler(c6,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(LX,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(qX,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(RX,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(XX,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(TX,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(AX,(v,g)=>$(v.params,g))}set oncalltool($){this.setRequestHandler(Cg,(v,g)=>$(v.params,g))}set onlisttools($){this.setRequestHandler(Vg,(v,g)=>$(v.params,g))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,v){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},E6,v)}async readServerResource($,v){return await this.request({method:"resources/read",params:$},jg,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},Tg,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},HX,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},u0,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},PX,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},kX,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},rX,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,g=0,_=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,J=z.style.width,b=z.style.height;z.style.width="fit-content",z.style.height="max-content";let O=z.getBoundingClientRect();z.style.width=J,z.style.height=b;let K=window.innerWidth-z.clientWidth,W=Math.ceil(O.width+K),B=Math.ceil(O.height);if(W!==v||B!==g)v=W,g=B,this.sendSizeChanged({width:W,height:B})})};_();let U=new ResizeObserver(_);return U.observe(document.documentElement),U.observe(document.body),()=>U.disconnect()}async connect($=new l0(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let g=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:H3}},CX,v);if(g===void 0)throw Error(`Server sent invalid initialize result: ${g}`);if(this._hostCapabilities=g.hostCapabilities,this._hostInfo=g.hostInfo,this._hostContext=g.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(g){throw this.close(),g}}}function cW($){if(!$)return"";let v=[];if($.camera)v.push("camera");if($.microphone)v.push("microphone");if($.geolocation)v.push("geolocation");if($.clipboardWrite)v.push("clipboard-write");return v.join("; ")}var mX=[H3];class L3 extends mg{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,g,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=g,this._hostContext=_?.hostContext||{},this.setRequestHandler(VX,(U)=>this._oninitialize(U)),this.setRequestHandler(c6,(U,z)=>{return this.onping?.(U.params,z),{}}),this.setRequestHandler(fW,(U)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(YX,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(IX,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(NX,(v)=>$(v.params))}set onmessage($){this.setRequestHandler(DX,async(v,g)=>{return $(v.params,g)})}set onopenlink($){this.setRequestHandler(BX,async(v,g)=>{return $(v.params,g)})}set ondownloadfile($){this.setRequestHandler(yX,async(v,g)=>{return $(v.params,g)})}set onrequestteardown($){this.setNotificationHandler(MX,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(fW,async(v,g)=>{return $(v.params,g)})}set onloggingmessage($){this.setNotificationHandler(B3,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(jX,async(v,g)=>{return $(v.params,g)})}set oncalltool($){this.setRequestHandler(Cg,async(v,g)=>{return $(v.params,g)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(aG,async(v,g)=>{return $(v.params,g)})}set onlistresourcetemplates($){this.setRequestHandler(sG,async(v,g)=>{return $(v.params,g)})}set onreadresource($){this.setRequestHandler(v3,async(v,g)=>{return $(v.params,g)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(g3,async(v,g)=>{return $(v.params,g)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let v=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:mX.includes(v)?v:H3,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},g=!1;for(let _ of Object.keys($)){let U=this._hostContext[_],z=$[_];if(cX(U,z))continue;v[_]=z,g=!0}if(g)this._hostContext=$,this.sendHostContextChange(v)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,v){return this.request({method:"ui/resource-teardown",params:$},ZX,v)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let v=this._client.getServerCapabilities();if(!v)throw Error("Client server capabilities not available");if(v.tools){if(this.oncalltool=async(g,_)=>{return this._client.request({method:"tools/call",params:g},E6,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(W3,(g)=>this.sendToolListChanged(g.params))}if(v.resources){if(this.onlistresources=async(g,_)=>{return this._client.request({method:"resources/list",params:g},Tg,{signal:_.signal})},this.onlistresourcetemplates=async(g,_)=>{return this._client.request({method:"resources/templates/list",params:g},eG,{signal:_.signal})},this.onreadresource=async(g,_)=>{return this._client.request({method:"resources/read",params:g},jg,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(U3,(g)=>this.sendResourceListChanged(g.params))}if(v.prompts){if(this.onlistprompts=async(g,_)=>{return this._client.request({method:"prompts/list",params:g},_3,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(K3,(g)=>this.sendPromptListChanged(g.params))}}return super.connect($)}}function cX($,v){return JSON.stringify($)===JSON.stringify(v)}function q3($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function EX($){return q3($)&&Array.isArray($.content)&&$.content.every((v)=>q3(v)&&typeof v.type==="string")}function iX(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function lX($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(v){return console.debug("[ext-app-tool-result] stringify failed",v),String($)}}function X3($){let v=$.success===!1;if(EX($.result))return{...$.result,isError:$.result.isError===!0||v};let g=q3($.result)?$.result:null,_=iX($.detailedContent,$.content,g?.detailedContent,g?.content,g?.textResultForLlm,g?.text,g?.message,typeof $.result==="string"?$.result:void 0,$.error)??lX($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function EW($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let g=JSON.stringify($),_=JSON.stringify(v);if(g===void 0||_===void 0)return!1;if(Math.abs(g.length-_.length)>2000000)return!1;return g===_}catch{return!1}}function iW($,v){switch($){case"html":return typeof v.html==="string"&&v.html.length>0||typeof v.content==="string"&&v.content.length>0;case"json-render":case"graph":return!0;case"mcp-app":return v.viewerType==="web-artifact"&&typeof v.path==="string"&&v.path.length>0||typeof v.url==="string"&&v.url.length>0;case"webpage":return typeof v.url==="string"&&v.url.length>0;default:return!1}}var w3="allow-scripts allow-popups allow-popups-to-escape-sandbox";function lW($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function xX($,v){let g=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await g.json();if(!g.ok||!lW(_)||!_.ok||typeof _.url!=="string"){let U=lW(_)&&_.error?_.error:`Frame document request failed with HTTP ${g.status}`;throw Error(U)}return _.url}function xW($,v){let[g,_]=o(null);return m(()=>{if(_(null),!$)return;let U=!1;return xX($,v).then((z)=>{if(!U)_(z)}).catch((z)=>{console.error("[iframe-document] failed to create frame document:",z)}),()=>{U=!0}},[$,v]),n$(()=>({attributes:g?{src:g}:{},ready:Boolean(g),key:g??""}),[g])}function YU($){let{enabled:v,token:g,nodeId:_,sourceSurface:U,iframeRef:z}=$;m(()=>{if(!v||!g)return;function J(b){if(b.source!==z.current?.contentWindow)return;let O=b.data;if(!O||O.source!==d_||O.token!==g||O.nodeId!==_)return;let K=O.interaction;if(!K||typeof K.type!=="string")return;let W=K.type;S_({type:W,sourceNodeId:_,sourceSurface:U,...K.payload&&typeof K.payload==="object"?{payload:K.payload}:{}}).then((B)=>{if(B.ok)R4("context","AX interaction",W,[_]);else R4("remove","AX interaction rejected",B.error??B.code??"",[_]);z.current?.contentWindow?.postMessage({source:a_,token:g,...O.correlationId?{correlationId:O.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,g,_,U])}async function W4($,v){let _=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();if(!_.ok)throw Error(_.error??`Request failed: ${$}`);return _.result}function F3($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var hX=1000,pX=7000;function B4($,v){if(typeof window>"u")return;let g=window;if(g.__PMX_EXTAPP_LOG??=[],g.__PMX_EXTAPP_LOG.length<500)g.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});oX({t:Date.now(),nodeId:$,event:v})}var hW=[],A3=null;function oX($){if(hW.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),A3)return;A3=setTimeout(()=>{A3=null;let v=hW.splice(0);if(v.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:v})}).catch(()=>{})},1500)}var pW=Promise.resolve();function nX($){pW=pW.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,hX))}).catch(()=>{})}function tX($,v){return v?$==="done":$==="ready"||$==="done"}function dX($,v){let g=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",U=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${U}:${z}:${g}`}function aX($,v){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!v,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:v};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function oW($,v,g){if(await $.sendToolInput({arguments:v}),g)await $.sendToolResult(g)}function sX($){return typeof $==="string"&&$.trim().length>0?$.trim():w3}function eX($,v){return`<script data-pmx-canvas-ax-bridge>
185
185
  (function () {
186
186
  const PMX_AX_TOKEN = ${JSON.stringify($)};
187
187
  const PMX_AX_NODE_ID = ${JSON.stringify(v)};
@@ -199,7 +199,7 @@ container holding the app. Specify either width or maxWidth, and either height o
199
199
  }, 10000);
200
200
  pending.set(correlationId, function (result) { clearTimeout(timer); resolve(result); });
201
201
  window.parent.postMessage({
202
- source: '${l_}',
202
+ source: '${d_}',
203
203
  token: PMX_AX_TOKEN,
204
204
  nodeId: PMX_AX_NODE_ID,
205
205
  correlationId: correlationId,
@@ -212,7 +212,7 @@ container holding the app. Specify either width or maxWidth, and either height o
212
212
  };
213
213
  window.addEventListener('message', function (event) {
214
214
  const m = event.data;
215
- if (!m || m.source !== '${h_}' || m.token !== PMX_AX_TOKEN) return;
215
+ if (!m || m.source !== '${a_}' || m.token !== PMX_AX_TOKEN) return;
216
216
  const result = m.result || { ok: false };
217
217
  const resolver = m.correlationId ? pending.get(m.correlationId) : undefined;
218
218
  if (resolver) { pending.delete(m.correlationId); resolver(result); }
@@ -222,7 +222,7 @@ container holding the app. Specify either width or maxWidth, and either height o
222
222
  try { window.dispatchEvent(new CustomEvent('pmx-ax-ack', { detail: { result: result, interaction: m.interaction || null } })); } catch (e) {}
223
223
  });
224
224
  })();
225
- </script>`}function lF($,v){return`<script data-pmx-canvas-boot-beacon>
226
- window.parent.postMessage({ source: '${t2}', token: ${JSON.stringify($)}, nodeId: ${JSON.stringify(v)} }, '*');
227
- </script>`}function hF($,v){if(!v)return $;let U=/<head\b[^>]*>/i.exec($);if(U?.index!==void 0){let g=U.index+U[0].length;return`${$.slice(0,g)}${v}${$.slice(g)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let g=_.index+_[0].length;return`${$.slice(0,g)}${v}${$.slice(g)}`}return`${v}${$}`}function kg($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function HO($,v){let U=$?.getBoundingClientRect();return{width:kg($?.clientWidth??0,kg(U?.width??0,v.width)),height:kg($?.clientHeight??0,kg(U?.height??0,v.height))}}function xF($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function pF($,v){return Math.max(kg($,1),kg(v,1))}function EW({node:$,expanded:v=!1}){let U=y(null),_=y(null),g=y(null),z=y(null),J=y({}),b=y(void 0),O=y(!1),K=y(void 0),W=y(null),B=y(!1),k=y(null),P=y(!1),F=y(0),I=y(!1),H=y(!1),Y=y([]),q=y(!1),w=y(!1),N=y(!1),[C,p]=o("loading"),[r,n]=o(null),[e,u]=o(0),Q=$.data.html,g$=$.data.serverName,m=$.data.appSessionId,i=$.data.toolInput??{},H$=$.data.toolResult,q$=$.data.toolName??"ext-app",x$=$.data.toolDefinition,M=$.data.toolCallId,x=typeof M==="string"||typeof M==="number"?M:void 0,s=$.data.resourceMeta,d=$.data.sessionStatus,b$=$.data.sessionError,U$=$.size.height,l=$.id,f=cF($,e),a=H$!=null,G$=EF(null),V$=$.data.axCapabilities?.enabled===!0&&typeof Q==="string"&&Q.length>0,C$=n$(()=>`ax-${crypto.randomUUID()}`,[]),Kv=V$?iF(C$,l):"",Wv=typeof Q==="string"&&Q.length>0?lF(C$,l):"",P6=CW(hF(Q??"",Wv+Kv),G$);c(()=>{function W$(r$){if(r$.source!==U.current?.contentWindow)return;let p$=r$.data;if(!p$||p$.source!==t2||p$.token!==C$||p$.nodeId!==l)return;H.current=!0}return window.addEventListener("message",W$),()=>window.removeEventListener("message",W$)},[C$,l]),Pg({enabled:V$,token:C$,nodeId:l,sourceSurface:"mcp-app",iframeRef:U});let lU=3,k6=(W$)=>{if(F.current>=lU){b4(l,`remount-cap-hit (${W$})`);return}if(q.current)return;F.current+=1,q.current=!0,b4(l,`remount-queued #${F.current} (${W$})`),CF({remount:()=>{if(q.current=!1,N.current||j$.value===l)return b4(l,"remount-skipped"),!1;return w.current=typeof document<"u"&&document.visibilityState==="hidden",b4(l,`remount-run #${F.current}`),p("loading"),u((r$)=>r$+1),!0},awaitBoot:()=>new Promise((r$)=>{let p$=window.setTimeout(bv,jF);function bv(){window.clearTimeout(p$),r$()}Y.current.push(bv)})})};c(()=>{if(v||P.current)return;if(!fF(C,a))return;if(typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;P.current=!0,k6("post-boot-repaint")},[C,a]),c(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;function W$(){if(document.visibilityState!=="visible")return;if(!w.current||N.current)return;w.current=!1,F.current=0,b4(l,"visible-again-rearm"),k6("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",W$),()=>document.removeEventListener("visibilitychange",W$)},[v,l]);let hU=6000;c(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;if(!P6.ready)return;let W$=window.setTimeout(()=>{if(I.current||H.current||N.current)return;k6("boot-watchdog")},hU);return()=>window.clearTimeout(W$)},[f,P6.ready,v]),c(()=>()=>{N.current=!0;for(let W$ of Y.current.splice(0))W$()},[]);let sv=(W$)=>W$==="light"?"light":"dark",Av=v||j$.value===l;J.current=i,b.current=H$;let Zg=d==="error"?b$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",e0=(W$)=>{let r$=b.current;if(!W$||!B.current||!r$)return null;if(K.current===r$)return null;if(K.current&&TW(K.current,r$))return K.current=r$,null;if(W.current)return W.current;let p$=W$.sendToolResult(r$).then(()=>{K.current=r$,O.current=!0,p("done")}).catch((bv)=>{let H6=bv instanceof Error?bv.message:String(bv);throw n(`Tool result delivery failed: ${H6}`),bv}).finally(()=>{W.current=null});return W.current=p$,p$};if(c(()=>{if(!Q||!P6.ready)return;let W$=U.current;if(!W$)return;let r$=!1,p$=null,bv=null,H6=null,l6=null;O.current=!1,K.current=void 0,W.current=null,B.current=!1,I.current=!1,H.current=!1;let xU=()=>{if(!p$)return;clearTimeout(p$),p$=null};return(async()=>{if(!Q)return;let L6=W$.contentWindow;if(!L6)throw Error("Ext-app iframe window is unavailable");let h6=(L$=j$.value===l?"fullscreen":"inline")=>({theme:sv(T$.value),platform:"web",containerDimensions:HO(W$,{width:$.size.width,height:U$}),displayMode:L$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...x$?{toolInfo:{id:x,tool:x$}}:{}}),YP=()=>{if(H6!==null)return;H6=requestAnimationFrame(()=>{if(H6=null,r$||!B.current)return;u$.setHostContext?.(h6())})},cO=()=>{if(l6!==null)return;l6=requestAnimationFrame(()=>{l6=requestAnimationFrame(()=>{if(l6=null,r$||!B.current)return;u$.sendHostContextChange?.(h6())})})},u$=new OO(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:h6(Av?"fullscreen":"inline")});u$.onsizechange=async({height:L$})=>{if(xF(L$,j$.value===l)){let Bv=HO(W$.parentElement??W$,{width:$.size.width,height:U$}),mv=pF(L$,Bv.height);W$.style.height=`${mv}px`;let x6=T.value.get(l)?.size??$.size,EO=Math.max(x6.height,mv+O5);if(Math.abs(EO-x6.height)>8){if(Z4(l,{width:x6.width,height:EO}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{t$({recordHistory:!1}),z.current=null},0)}}return{}},u$.onopenlink=async({url:L$})=>{return window.open(L$,"_blank","noopener"),{}},u$.onsandboxready=async()=>{await u$.sendSandboxResourceReady({html:Q,sandbox:BO,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},u$.onrequestdisplaymode=async({mode:L$})=>{let{nextMode:Bv,shouldExpand:mv,shouldCollapse:x6}=mF(L$,Av);if(mv)z6(l);else if(x6)d6();return{mode:Bv}},u$.oncalltool=async(L$)=>{if(!m)throw Error(Zg);try{let Bv=await J4("/api/ext-app/call-tool",{sessionId:m,nodeId:l,serverName:g$,toolName:L$.name,arguments:L$.arguments??{}});return n(null),Bv}catch(Bv){let mv=Bv instanceof Error?Bv.message:String(Bv);throw n(`Tool call failed: ${mv}`),Bv}},u$.setRequestHandler(uU,async()=>{if(!m)return{tools:[]};return J4("/api/ext-app/list-tools",{sessionId:m})}),u$.onlistresources=async()=>m?J4("/api/ext-app/list-resources",{sessionId:m}):{resources:[]},u$.onlistresourcetemplates=async()=>m?J4("/api/ext-app/list-resource-templates",{sessionId:m}):{resourceTemplates:[]},u$.onreadresource=async(L$)=>{if(!m)throw Error(Zg);return J4("/api/ext-app/read-resource",{sessionId:m,uri:L$.uri})},u$.onlistprompts=async()=>m?J4("/api/ext-app/list-prompts",{sessionId:m}):{prompts:[]},u$.onupdatemodelcontext=async(L$)=>{if(!m)return{};return await J4("/api/ext-app/model-context",{nodeId:l,...Array.isArray(L$.content)?{content:L$.content}:{},...L$.structuredContent&&typeof L$.structuredContent==="object"?{structuredContent:L$.structuredContent}:{}}),{}};let $2=new V0(L6,L6);if(u$.oninitialized=()=>{if(r$)return;xU(),B.current=!0,I.current=!0,b4(l,"initialized"),p("ready"),n(null),Promise.resolve(u$.sendHostContextChange(h6(Av?"fullscreen":"inline"))).then(()=>mW(u$,J.current,void 0)).then(()=>e0(u$)).then(()=>{b4(l,"settled");for(let L$ of Y.current.splice(0))L$();cO()}).catch((L$)=>{let Bv=L$ instanceof Error?L$.message:String(L$);n(`Bridge bootstrap failed: ${Bv}`)})},p$=setTimeout(()=>{if(r$||B.current)return;let L$=b.current,Bv=h6(Av?"fullscreen":"inline");B.current=!0,u$.setHostContext?.(Bv),Promise.resolve(u$.sendHostContextChange(Bv)).then(()=>mW(u$,J.current,L$)).then(()=>{if(O.current=Boolean(L$),L$)K.current=L$;p(L$?"done":"ready"),n(null),cO()}).catch((mv)=>{let x6=mv instanceof Error?mv.message:String(mv);n(`Bridge bootstrap fallback failed: ${x6}`)})},1200),await u$.connect($2),r$){xU(),await $2.close();return}if(_.current=u$,g.current=$2,bv=new ResizeObserver(YP),bv.observe(W$),W$.parentElement)bv.observe(W$.parentElement);let mO=!0;k.current=T$.subscribe((L$)=>{if(mO){mO=!1;return}if(r$)return;u$.setHostContext?.({...h6(),theme:sv(L$)}),u$.sendHostContextChange?.(h6())}),e0(u$)})().catch((L6)=>{xU(),console.error("[ext-app] Bridge init failed:",L6),n(L6?.message??"Bridge initialization failed")}),()=>{if(r$=!0,xU(),bv?.disconnect(),bv=null,H6!==null)cancelAnimationFrame(H6),H6=null;if(l6!==null)cancelAnimationFrame(l6),l6=null;if(B.current=!1,W.current=null,k.current?.(),k.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(_.current=null,g.current)g.current.close().catch((L6)=>{console.error("[ext-app] transport close failed:",L6)}),g.current=null}},[f,P6.key]),c(()=>{if(H$&&_.current&&(C==="ready"||C==="done"))e0(_.current)},[H$,C]),c(()=>{let W$=_.current;if(U.current)U.current.style.height="100%";if(!W$||!B.current)return;let r$=null,p$=null;return r$=requestAnimationFrame(()=>{r$=null,p$=requestAnimationFrame(()=>{if(p$=null,!B.current)return;let bv={theme:sv(T$.value),platform:"web",containerDimensions:HO(U.current,{width:$.size.width,height:U$}),displayMode:Av?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};W$.setHostContext?.(bv),W$.sendHostContextChange?.(bv)})}),()=>{if(r$!==null)cancelAnimationFrame(r$);if(p$!==null)cancelAnimationFrame(p$)}},[Av,U$]),!Q)return G("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[G("div",{style:{opacity:0.6},children:["Loading ",q$," viewer..."]},void 0,!0,void 0,this),G("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[d&&d!=="ready"&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:d==="error"?"var(--c-danger-12)":"var(--c-warn-10)",color:d==="error"?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${d==="error"?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:Zg},void 0,!1,void 0,this),r&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{style:{flex:1},children:r},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>{n(null),p("loading"),u((W$)=>W$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>n(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[G("iframe",{ref:U,...P6.attributes,sandbox:G$,allow:RW(s?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:Av&&C!=="loading"?"auto":"none"},title:`Ext App: ${q$}`},f,!1,void 0,this),C==="loading"&&!r&&G("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[G("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("div",{children:["Connecting to ",q$,"..."]},void 0,!0,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!Av&&G("button",{type:"button",onClick:(W$)=>{W$.stopPropagation(),z6(l)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C0($,v,U){let _=y($);_.current=$;let g=y(null);c(()=>{if(!U)return;function z(J){if(J.source!==v.current?.contentWindow)return;let b=J.data;if(!b||b.source!=="pmx-canvas-frame"||b.type!=="content-height"||b.token!==U)return;let O=_.current,K=typeof b.height==="number"?b.height:0,W=B5(O,K);if(W===null)return;if(Z4(O.id,{width:O.size.width,height:W}),g.current!==null)window.clearTimeout(g.current);g.current=window.setTimeout(()=>{t$({recordHistory:!1}),g.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),g.current!==null)window.clearTimeout(g.current),g.current=null}},[$.id,U])}function oF($,v,U,_,g,z,J){if(!$)return $;try{let b=new URL($,window.location.origin);if(b.searchParams.set("theme",T$.value==="light"?"light":"dark"),v)b.searchParams.set("display","expanded");if(typeof U==="number")b.searchParams.set("v",String(U));if(_)b.searchParams.set("axToken",_);if(g)b.searchParams.set("axNodeId",g);if(z)b.searchParams.set("frameToken",z);if(J)b.searchParams.set("fit","content");return b.toString()}catch{return $}}function nF($,v=window.location.origin){if(!$)return!1;try{let U=new URL(v).origin,_=new URL($,U);return _.origin===U&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function E6({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return G(EW,{node:$,expanded:v},void 0,!1,void 0,this);return G(tF,{node:$,expanded:v},void 0,!1,void 0,this)}function tF({node:$,expanded:v}){let U=y(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",g=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,b=(g||_)&&(_?z===!0:z!==!1),O=_?"mcp-app":"json-render",K=n$(()=>b?`ax-${crypto.randomUUID()}`:"",[b]),W=a2($)&&!v,B=n$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);C0($,U,B),Pg({enabled:b&&Boolean(K),token:K,nodeId:$.id,sourceSurface:O,iframeRef:U});let k=X6.value,P=()=>{if(!b||!K||k==null)return;U.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:K,state:k},"*")};c(P,[b,K,k]);let F=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,I=oF($.data.url||"",v,F,K||void 0,b?$.id:void 0,B||void 0,W),H=$.data.sourceServer||"",Y=$.data.hostMode||"hosted",q=$.data.fallbackReason,w=$.data.trustedDomain===!0||nF(I);if(Y==="fallback")return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&G("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",q]},void 0,!0,void 0,this),G("a",{href:I,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:I},void 0,!1,void 0,this),H&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",H]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",display:"flex",flexDirection:"column",...v?{flex:1,minHeight:0,width:"100%"}:{}},children:[!w&&G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),G("iframe",{ref:U,src:I,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:"lazy",onLoad:P,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${H}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var jU=null;function d$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function f0(){if(jU)return jU;return jU={bg:d$("--c-bg"),panel:d$("--c-panel"),panelSoft:d$("--c-panel-soft"),line:d$("--c-line"),text:d$("--c-text"),textSoft:d$("--c-text-soft"),muted:d$("--c-muted"),dim:d$("--c-dim"),accent:d$("--c-accent"),ok:d$("--c-ok"),warn:d$("--c-warn"),warnAlt:d$("--c-warn-alt"),danger:d$("--c-danger"),purple:d$("--c-purple"),thinking:d$("--c-thinking"),subagent:d$("--c-subagent"),font:d$("--font"),mono:d$("--mono")},jU}function Hg(){jU=null}var c0={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function LO($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let U=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(U)return U;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function Lg({node:$}){let v=LO($),U=$.data.detail||"",_=$.data.message||"",g=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,b=c0[v]??"var(--c-muted)",O=v!=="idle";return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[G("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:b,boxShadow:O?`0 0 8px ${b}`:"none",animation:O?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{fontWeight:600,color:b,textTransform:"uppercase",letterSpacing:"0.05em"},children:v},void 0,!1,void 0,this),U&&G("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[G("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),G("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&J.state!=="completed"&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[G("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),G("span",{children:J.name},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",J.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_&&G("div",{style:{color:g==="warn"?"var(--c-warn)":g==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ig($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function iW($){if(typeof $==="string"){let g=Ig($);return g?{title:"Evidence warning",detail:g}:null}if(!$||typeof $!=="object")return null;let v=$,U=Ig(v.title)??"Evidence warning",_=Ig(v.detail);return _?{title:U,detail:_}:null}function dF($){let v=[],U=iW($.data.warning);if(U)v.push(U);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=iW(z);if(J)v.push(J)}let g=Ig($.data.validationStatus)?.toLowerCase();if(g==="failed"||g==="invalid")v.push({title:"Image failed validation",detail:Ig($.data.validationMessage)??"Review this image before using it as evidence."});return v}function aF($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((U)=>Ig(U)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((U)=>v.includes(U))}function lW($){let v=dF($);if(v.length>0)return v;if(aF($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function m0({node:$,expanded:v=!1}){let U=$.data.src||"",_=$.data.alt||$.data.title||"Image",g=$.data.caption||"",z=lW($),J=U.startsWith("data:")||U.startsWith("http://")||U.startsWith("https://")?U:`/api/canvas/image/${$.id}`,[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(1),[P,F]=o({x:0,y:0}),[I,H]=o({w:0,h:0}),Y=y(null),q=y(!1),w=y({x:0,y:0}),N=S((m)=>{let i=m.target;H({w:i.naturalWidth,h:i.naturalHeight}),O(!0),W(!1)},[]),C=S(()=>{W(!0),O(!1)},[]);c(()=>{k(1),F({x:0,y:0})},[U]);let p=S((m)=>{m.preventDefault(),m.stopPropagation();let i=m.deltaY>0?0.9:1.1;k((H$)=>Math.max(0.25,Math.min(10,H$*i)))},[]),r=S((m)=>{if(B<=1)return;m.stopPropagation(),q.current=!0,w.current={x:m.clientX,y:m.clientY},m.target.setPointerCapture(m.pointerId)},[B]),n=S((m)=>{if(!q.current)return;let i=m.clientX-w.current.x,H$=m.clientY-w.current.y;w.current={x:m.clientX,y:m.clientY},F((q$)=>({x:q$.x+i,y:q$.y+H$}))},[]),e=S(()=>{q.current=!1},[]),u=S(()=>{k(1),F({x:0,y:0})},[]);if(!U)return G("div",{class:"image-node-empty",children:[G("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),G("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let Q=I.w>0?`${I.w}×${I.h}`:"",g$=Math.round(B*100);return G("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:Y,children:[z.length>0&&G("div",{class:"image-node-warning-stack",children:z.map((m)=>G("div",{class:"image-node-warning",children:[G("span",{class:"image-node-warning-title",children:m.title},void 0,!1,void 0,this),G("span",{class:"image-node-warning-detail",children:m.detail},void 0,!1,void 0,this)]},`${m.title}-${m.detail}`,!0,void 0,this))},void 0,!1,void 0,this),G("div",{class:"image-node-viewport",onWheel:p,onPointerDown:r,onPointerMove:n,onPointerUp:e,style:{cursor:B>1?"grab":"default"},children:[!b&&!K&&G("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),K&&G("div",{class:"image-node-error",children:[G("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),G("div",{children:"Failed to load image"},void 0,!1,void 0,this),G("div",{class:"image-node-error-path",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("img",{src:J,alt:_,onLoad:N,onError:C,draggable:!1,style:{transform:`translate(${P.x}px, ${P.y}px) scale(${B})`,opacity:b?1:0,display:K?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(g||Q||B!==1)&&G("div",{class:"image-node-footer",children:[g&&G("span",{class:"image-node-caption",children:g},void 0,!1,void 0,this),G("span",{class:"image-node-meta",children:[Q&&G("span",{children:Q},void 0,!1,void 0,this),B!==1&&G("button",{type:"button",class:"image-node-zoom-reset",onClick:u,title:"Reset zoom",children:[g$,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function hW({node:$}){let v=$.data.children??[],U=T.value,_=v.filter((b)=>U.has(b)),g=_.length,z={};for(let b of _){let O=U.get(b);if(O)z[O.type]=(z[O.type]??0)+1}let J=Object.entries(z).map(([b,O])=>`${O} ${b}`).join(", ");return G("div",{class:"group-node-body",children:[G("div",{class:"group-summary",children:[G("span",{class:"group-child-count",children:[g," node",g!==1?"s":""]},void 0,!0,void 0,this),J&&G("span",{class:"group-type-summary",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g===0&&G("div",{class:"group-empty-hint",children:"Drag nodes here or use the selection bar to group nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sF($){try{return new URL($).host}catch{return $}}function eF($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function E0({node:$,expanded:v=!1}){let U=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",g=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",J=typeof $.data.status==="string"?$.data.status:"idle",b=typeof $.data.error==="string"?$.data.error:"",O=eF(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),K=typeof $.data.statusCode==="number"?$.data.statusCode:null,W=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",B=$.data.frameBlocked===!0,k=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[P,F]=o(!1),[I,H]=o(v);c(()=>{if(v)H(!0)},[v]);let Y=S(async()=>{if(!U||P)return;F(!0);try{await Y_($.id)}finally{F(!1)}},[$.id,P,U]);if(!U)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let q=J==="ready"?"var(--c-ok)":J==="error"?"var(--c-danger)":"var(--c-warn)";return G("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[G("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[G("div",{style:{minWidth:0,flex:1},children:[G("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:sF(U)},void 0,!1,void 0,this),G("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||U},void 0,!1,void 0,this),G("a",{href:U,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:q,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[G("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:q}},void 0,!1,void 0,this),J]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(g||W)&&G("div",{style:{display:"grid",gridTemplateColumns:W&&v?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[W&&v&&G("img",{src:W,alt:_||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),g&&G("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[G("button",{type:"button",onClick:Y,disabled:P,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:P?"progress":"pointer",fontSize:"12px"},children:P||J==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),v&&!B&&G("button",{type:"button",onClick:()=>H((w)=>!w),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:I?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>window.open(U,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),G("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:k||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&I&&!B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),G("iframe",{class:"webpage-node-iframe",title:_||$.data.title||U,src:U,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:v?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(O||K!==null)&&G("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[O&&G("span",{children:["Fetched ",O]},void 0,!0,void 0,this),K!==null&&G("span",{children:["HTTP ",K]},void 0,!0,void 0,this),B&&G("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&G("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:b},void 0,!1,void 0,this),G("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:v?"14px":"10px"},children:z?G("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:v?"14px":"12px"},children:z},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:J==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xW($){let v=5381;for(let U=0;U<$.length;U+=1)v=(v<<5)+v+$.charCodeAt(U)|0;return(v>>>0).toString(36)}function IO($,v={}){let U=new URLSearchParams;if(U.set("theme",v.theme??T$.value),v.themeToken)U.set("themeToken",v.themeToken);if(v.present)U.set("present","1");if(v.presentToken)U.set("presentToken",v.presentToken);if(v.v)U.set("v",v.v);if(v.axToken)U.set("axToken",v.axToken);if(v.frameToken)U.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${U.toString()}`}function i0($){return jW($.type,$.data)}async function l0($){let v=IO($.id);if(!(await V3($.id,v)).opened)window.open(v,"_blank","noopener")}function pW($){return $.type==="html"&&$.data.presentation===!0}function VU({node:$,expanded:v=!1,presentation:U=!1,presentationExitToken:_,autoFocus:g=!1}){let z=y(null),J=T$.value,b=n$(()=>`theme-${crypto.randomUUID()}`,[]),O=n$(()=>`ax-${crypto.randomUUID()}`,[]),K=n$(()=>`frame-${crypto.randomUUID()}`,[]),W=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",B=n$(()=>xW(W),[W]),k=n$(()=>W?IO($.id,{theme:J,themeToken:b,present:U,presentToken:_,v:B,axToken:O,frameToken:K}):"",[W,U,_,b,B,$.id,O,K]);C0($,z,v?"":K),Pg({enabled:!0,token:O,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),c(()=>{if(z.current?.contentWindow?.postMessage({source:xv,type:"theme-update",token:b,theme:J},"*"),g)z.current?.focus()},[J,b]);let P=$.data.axCapabilities,F=P?.enabled===!0&&(!Array.isArray(P.allowed)||P.allowed.length>0),I=X6.value;c(()=>{if(!F||I==null)return;z.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:O,state:I},"*")},[F,I,O]),c(()=>{if(!g)return;let Y=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(Y)},[g,k]);let H=()=>{if(z.current?.contentWindow?.postMessage({source:xv,type:"theme-update",token:b,theme:J},"*"),F&&X6.value!=null)z.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:O,state:X6.value},"*");if(g)z.current?.focus()};if(!W)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return G("iframe",{ref:z,class:U?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",src:k,tabIndex:g?0:void 0,onLoad:H,style:{width:"100%",height:"100%",minHeight:U?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:U?0:"6px",display:"block"}},void 0,!1,void 0,this)}var YO=null;async function oW(){if(!YO)YO=await D3();return YO}function nW($,v){if(!$)return null;let U=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===U);if(_)return _.name;let g=v.filter((z)=>z.name.toLowerCase().startsWith(U));return g.length===1?g[0].name:null}function $X($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function vX({html:$}){let v=y(null);return c(()=>{let U=v.current;if(!U)return;if(U.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,U.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function gX($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function tW({count:$}){if($===0)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function dW({message:$,onDismiss:v}){if(!$)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[G("span",{style:{flex:1},children:$},void 0,!1,void 0,this),G("button",{type:"button",onClick:v,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function h0({node:$,expanded:v=!1}){let U=Array.isArray($.data.turns)?$.data.turns:[],_=U.length===0,g=$.data.text||"",z=$.data.status||"draft",J=_?z:$.data.threadStatus||"draft",b=J==="draft",O=J==="pending"||J==="sending",K=J==="streaming",W=J==="answered",[B,k]=o(""),[P,F]=o(""),[I,H]=o(null),[Y,q]=o(new Map),w=y(null),N=y(null),C=U[U.length-1],p=`${U.length}:${C?.role??""}:${C?.status??""}:${Math.floor((C?.text?.length??0)/200)}`;c(()=>{if(v&&b&&w.current)w.current.focus()},[v,b]),c(()=>{if(!p)return;if(N.current)N.current.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},[p]);let r=y(null),n=y(U);n.current=U,c(()=>{let i=U.some((q$)=>q$.role==="assistant"&&q$.status==="streaming"),H$=()=>{let q$=!1,M=n.current.map((x,s)=>({turn:x,index:s})).filter(({turn:x})=>x.role==="assistant"&&x.text);if(M.length===0)return;return Promise.all(M.map(async({turn:x,index:s})=>{let d=await U6(x.text);return{index:s,html:$X(d)}})).then((x)=>{if(q$)return;let s=new Map;for(let d of x)s.set(d.index,d.html);q(s)}),()=>{q$=!0}};if(!i){if(r.current)clearTimeout(r.current),r.current=null;return H$()}if(r.current)clearTimeout(r.current);return r.current=setTimeout(()=>{r.current=null,H$()},400),()=>{if(r.current)clearTimeout(r.current),r.current=null}},[U]);let e=S(async()=>{let i=B.trim();if(!i)return;let H$=B;H(null),v$($.id,{turns:[{role:"user",text:i,status:"pending"}],threadStatus:"pending",text:i}),k("");let q$=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await rg(i,$.position,$.id,q$,$.id)).ok)v$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),k(H$),H("Failed to send prompt. Your draft has been restored.")},[B,$.id,$.position,$.data.contextNodeIds]),u=S(async()=>{let i=P.trim();if(!i)return;let H$=P;H(null);let q$=Array.isArray($.data.turns)?[...$.data.turns]:[];if(q$.push({role:"user",text:i,status:"pending"}),v$($.id,{turns:q$,threadStatus:"pending"}),F(""),!(await R3($.id,i)).ok)q$.pop(),v$($.id,{turns:q$,threadStatus:"answered"}),F(H$),H("Failed to send reply. Your draft has been restored.")},[P,$.id,$.data.turns]),Q=S((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),e();return}if(i.key==="Tab"&&B.startsWith("/")){i.preventDefault();let H$=B.slice(1).split(/\s/)[0];if(H$)oW().then((q$)=>{let x$=nW(H$,q$);if(x$)k(`/${x$}`)})}},[e,B]),g$=S((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),u();return}if(i.key==="Tab"&&P.startsWith("/")){i.preventDefault();let H$=P.slice(1).split(/\s/)[0];if(H$)oW().then((q$)=>{let x$=nW(H$,q$);if(x$)F(`/${x$}`)})}},[u,P]),m=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(b&&U.length===0)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[G(tW,{count:m},void 0,!1,void 0,this),G(dW,{message:I,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("textarea",{ref:w,value:B,onInput:(i)=>k(i.target.value),onKeyDown:Q,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:e,disabled:!B.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(_)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:g},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:O?"Sending…":W?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G(tW,{count:m},void 0,!1,void 0,this),G(dW,{message:I,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("div",{ref:N,style:{flex:1,overflow:"auto",minHeight:0},children:U.map((i,H$)=>G("div",{children:[H$>0&&G("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),i.role==="user"?G("div",{class:"thread-turn-user",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),G("div",{style:{fontSize:v?"15px":"13px",lineHeight:v?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{class:"thread-turn-assistant",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:`status-dot${i.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),i.status==="streaming"&&!i.text&&G("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),G("div",{class:v?"md-reader-content":void 0,style:{fontSize:v?void 0:"13px",lineHeight:v?void 0:"1.55",opacity:i.text?1:0.4},children:Y.get(H$)?G(a$,{children:[G(vX,{html:Y.get(H$)??""},void 0,!1,void 0,this),i.status==="streaming"&&G("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:i.status==="streaming"?"Waiting for response…":i.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},gX(i,H$),!0,void 0,this))},void 0,!1,void 0,this),G("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:W?"6px":0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:K?"var(--c-accent)":O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:K?"Streaming…":O?"Sending…":W?"Answered":J},void 0,!1,void 0,this),G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[U.length," turn",U.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&G("div",{class:"thread-reply-area",children:[G("textarea",{value:P,onInput:(i)=>F(i.target.value),onKeyDown:g$,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:u,disabled:!P.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:P.trim()?"var(--c-accent)":"var(--c-line)",color:P.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:P.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function UX($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function _X({html:$}){let v=y(null);return c(()=>{let U=v.current;if(!U)return;if(U.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,U.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function x0({node:$,expanded:v=!1}){let U=$.data.content||"",_=$.data.status||"streaming",[g,z]=o(""),J=_==="streaming",b=_==="complete";c(()=>{if(!U){z("");return}let K=!1;return U6(U).then((W)=>{if(!K)z(UX(W))}),()=>{K=!0}},[U]);let O=S(()=>{rg("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return G("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[J&&G("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),G("div",{class:v?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:U?1:0.4,transition:"opacity 0.2s ease"},children:g?G("div",{class:v?"md-reader-content":void 0,children:G(_X,{html:g},void 0,!1,void 0,this)},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:J?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:J?"var(--c-accent)":b?"var(--c-ok)":"var(--c-muted)"},children:J?"Streaming…":b?"Complete":_},void 0,!1,void 0,this),b&&G("button",{type:"button",onClick:O,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function aW($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var sW={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},zX={running:"⠋",success:"✓",failed:"✕"},JX={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function p0({node:$}){let{toolName:v,category:U,status:_,duration:g,resultSummary:z,error:J}=aW($.data),b=sW[U]??sW.other,O=zX[_]??"◌",K=JX[_]??"var(--c-muted)",W=_==="running",B=J?J.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[G("span",{style:{fontSize:"14px",color:K,flexShrink:0,animation:W?"pulse 1.5s infinite":"none"},children:O},void 0,!1,void 0,this),G("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[G("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:b,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v},void 0,!1,void 0,this),B&&G("div",{style:{fontSize:"10px",color:J?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&G("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FO($){let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function bX($){let v=$.map((O)=>FO(O)).filter((O)=>O!==null);if(v.length===0)return null;let U=Math.min(...v.map((O)=>O.left)),_=Math.min(...v.map((O)=>O.top)),g=Math.max(...v.map((O)=>O.left+O.width)),z=Math.max(...v.map((O)=>O.top+O.height)),J=54,b=46;return{left:U-J,top:_-b,width:g-U+J*2,height:z-_+b*2}}function qO($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function eW(){let $=Array.from(L4.value),v=Array.from(I4.value),U=O_.value;if($.length===0&&v.length===0)return null;return G("div",{class:"attention-field-layer","aria-hidden":"true",children:[U.map((_)=>{let g=bX(_.nodeIds);if(!g)return null;return G("div",{class:"attention-field-region",style:qO(g,42)},_.id,!1,void 0,this)}),v.map((_)=>{let g=FO(_);if(!g)return null;return G("div",{class:"attention-field-node attention-field-secondary",style:qO({left:g.left-18,top:g.top-18,width:g.width+36,height:g.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let g=FO(_);if(!g)return null;return G("div",{class:"attention-field-node attention-field-primary",style:qO({left:g.left-24,top:g.top-24,width:g.width+48,height:g.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Iv=O$(new Map),Yg=O$(null),GX=480,OX=320,CU=new Map,W6=null;function XO($){Iv.value=$,WX()}function wO($){let v=CU.get($);if(v)clearTimeout(v),CU.delete($)}function $B($){wO($.id);let v=new Map(Iv.value);v.set($.id,{...$,phase:"forming"}),XO(v)}function KX($){if(wO($),!Iv.value.has($))return;let v=new Map(Iv.value);v.delete($),XO(v)}function vB($,v,U,_){let g=Iv.value.get($);if(!g||g.phase===v)return;let z=new Map(Iv.value);z.set($,{...g,phase:v,..._?{settledNodeId:_}:{}}),XO(z),wO($),CU.set($,setTimeout(()=>KX($),U))}function gB($,v){vB($,"settling",GX,v)}function AO($){vB($,"dissolving",OX)}function UB(){for(let $ of CU.values())clearTimeout($);if(CU.clear(),W6)clearInterval(W6),W6=null;Yg.value=null,Iv.value=new Map}function WX(){if(W6||Iv.value.size===0)return;W6=setInterval(()=>{let $=Date.now();for(let v of Iv.value.values())if(v.phase==="forming"&&v.expiresAt<=$)AO(v.id);if(Iv.value.size===0&&W6)clearInterval(W6),W6=null},1000),W6.unref?.()}var BX={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function Y$({size:$=16,children:v,...U}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",...BX,...U,children:v},void 0,!1,void 0,this)}function JB($){return G(Y$,{...$,children:[G("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),G("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),G("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),G("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bB($){return G(Y$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"4.5",x2:"8",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"9.5",x2:"8",y2:"11.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"6.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"9.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function GB($){return G(Y$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),G("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function OB($){return G(Y$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KB($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),G("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function WB($){return G(Y$,{...$,children:[G("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BB($){return G(Y$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),G("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PB($){return G(Y$,{...$,children:G("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function kB($){return G(Y$,{...$,children:[G("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),G("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),G("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HB($){return G(Y$,{...$,children:[G("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),G("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),G("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LB($){return G(Y$,{...$,children:[G("path",{d:"M3 4h10"},void 0,!1,void 0,this),G("path",{d:"M8 4v8"},void 0,!1,void 0,this),G("path",{d:"M6 12h4"},void 0,!1,void 0,this),G("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),G("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IB($){return G(Y$,{...$,children:[G("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YB($){return G(Y$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qB($){return G(Y$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FB($){return G(Y$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XB($){return G(Y$,{...$,children:[G("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wB({size:$=22,class:v}){return G("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:v,"aria-hidden":"true",children:[G("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),G("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),G("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),G("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _B($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HX($){return G(Y$,{...$,children:[G("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),G("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),G("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zB($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),G("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IX($){return G(Y$,{...$,children:[G("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),G("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),G("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XX($){return G(Y$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),G("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),G("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),G("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),G("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MX($){return G(Y$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),G("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fU($){switch($){case"markdown":return _B;case"prompt":return PX;case"response":return kX;case"file":return HX;case"image":return LX;case"webpage":return zB;case"context":return IX;case"group":return YX;case"status":return qX;case"trace":return FX;case"ledger":return XX;case"mcp-app":return wX;case"ext-app":return AX;case"json-render":return ZX;case"graph":return MX;case"html":return zB;default:return _B}}var AB={width:260,height:150},SX={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function MO($){return!!$&&$ in s$}function B6($){if(!$)return null;let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function ZO($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function cU($){if(typeof $.confidence!=="number")return 0.82;return 0.4+Math.max(0,Math.min(1,$.confidence))*0.55}function ZB($,v){let U=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+U} ${$.y}, ${v.x-U} ${v.y}, ${v.x} ${v.y}`}function SO({intent:$}){let v=MO($.nodeType)?fU($.nodeType):null,U=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return G("div",{class:"intent-info",onMouseEnter:()=>Yg.value=$.id,onMouseLeave:()=>{if(Yg.value===$.id)Yg.value=null},children:[G("div",{class:"intent-chip",children:[typeof $.seq==="number"&&G("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),v&&G("span",{class:"intent-chip-icon","aria-hidden":"true",children:G(v,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"intent-chip-label",children:U},void 0,!1,void 0,this),_&&G("span",{class:"intent-confidence",children:_},void 0,!1,void 0,this),$.phase==="forming"&&G("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(g)=>{g.stopPropagation(),F2($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&G("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MB({intent:$,rect:v}){let U=MO($.nodeType)?fU($.nodeType):null,_=MO($.nodeType)?s$[$.nodeType]:"Node";return G("div",{class:`intent-ghost intent-ghost-box is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:cU($)},children:[G("div",{class:"intent-ghost-titlebar",children:[G("span",{class:"intent-ghost-icon","aria-hidden":"true",children:U?G(U,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),G("span",{class:"intent-ghost-badge",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(SO,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SB({intent:$,rect:v,variant:U}){return G("div",{class:`intent-ghost intent-ghost-${U} is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:cU($)},children:[U==="edit"&&G("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),G(SO,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QX($){let v=$.phase==="settling"?B6($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let U=$.nodeType&&SX[$.nodeType]||AB,_=v??{left:$.position.x,top:$.position.y,...U};return G(MB,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=B6($.nodeId)??AB,g=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return G(MB,{intent:$,rect:g},$.id,!1,void 0,this)}case"remove":{let U=v??B6($.nodeId);if(!U)return null;return G(SB,{intent:$,rect:U,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let U=v??B6($.nodeId);if(!U)return null;return G(SB,{intent:$,rect:U,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let U=B6($.edge.from),_=B6($.edge.to);if(!U||!_)return null;let g={x:(U.left+U.width/2+_.left+_.width/2)/2,y:(U.top+U.height/2+_.top+_.height/2)/2},z={left:g.x-110,top:g.y-18,width:220,height:36};return G("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:cU($)},children:G(SO,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function QB(){let $=Array.from(Iv.value.values());if(c(()=>{function v(U){if(U.key!=="Escape")return;let _=Yg.value;if(!_)return;let g=Iv.value.get(_);if(!g||g.phase!=="forming")return;U.stopImmediatePropagation(),U.preventDefault(),F2(g)}return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]),$.length===0)return null;return G("div",{class:"intent-layer",children:[G("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[G("defs",{children:G("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:G("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((v)=>{if(v.kind==="connect"&&v.edge){let U=B6(v.edge.from),_=B6(v.edge.to);if(!U||!_)return null;return G("path",{d:ZB(ZO(U),ZO(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:cU(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let U=B6(v.nodeId);if(!U)return null;let _=U,g={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return G("path",{d:ZB(ZO(U),g),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:cU(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(QX)]},void 0,!0,void 0,this)}var qg=8,G4=O$(null),Fg=[],Xg=[],uB=null;function NB($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function rB($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function NX($,v){let U=new Map(v.map((b)=>[b.id,b])),_=new Set([$]),g=U.get($);if(!g)return _;let z=NB(g);while(z&&!_.has(z))_.add(z),z=NB(U.get(z));if(g.type!=="group")return _;let J=[...rB(g)];while(J.length>0){let b=J.pop();if(!b||_.has(b))continue;_.add(b);let O=U.get(b);if(O?.type==="group")J.push(...rB(O))}return _}function yB($,v){Fg=[],Xg=[],uB=$;let U=Array.from(v),_=NX($,U);for(let g of U){if(_.has(g.id)||g.dockPosition!==null)continue;let z=g.position.x,J=g.position.x+g.size.width,b=g.position.x+g.size.width/2,O=g.position.y,K=g.position.y+g.size.height,W=g.position.y+g.size.height/2;Fg.push({val:z,minY:O,maxY:K}),Fg.push({val:J,minY:O,maxY:K}),Fg.push({val:b,minY:O,maxY:K}),Xg.push({val:O,minX:z,maxX:J}),Xg.push({val:K,minX:z,maxX:J}),Xg.push({val:W,minX:z,maxX:J})}}function DB(){Fg=[],Xg=[],uB=null}function RB($,v,U,_){let g=[$,$+U/2,$+U],z=[v,v+_/2,v+_],J=[0,U/2,U],b=[0,_/2,_],O=null,K=qg+1,W=null;for(let I=0;I<3;I++){let H=g[I];for(let Y of Fg){let q=Math.abs(H-Y.val);if(q<K)K=q,O=Y.val-J[I],W={axis:"x",pos:Y.val,from:Math.min(Y.minY,v),to:Math.max(Y.maxY,v+_)}}}let B=null,k=qg+1,P=null;for(let I=0;I<3;I++){let H=z[I];for(let Y of Xg){let q=Math.abs(H-Y.val);if(q<k)k=q,B=Y.val-b[I],P={axis:"y",pos:Y.val,from:Math.min(Y.minX,$),to:Math.max(Y.maxX,$+U)}}}let F=[];if(W&&K<=qg)F.push(W);if(P&&k<=qg)F.push(P);return{x:O!==null&&K<=qg?O:$,y:B!==null&&k<=qg?B:v,guides:F}}function TB({nodeId:$,viewport:v,onMove:U,onDragEnd:_}){let g=y(!1),z=y({x:0,y:0}),J=y({x:0,y:0});return S((O,K,W)=>{O.stopPropagation(),O.preventDefault(),g.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:O.clientX,y:O.clientY},J.current={x:K,y:W};let B=null,k=null,P=()=>{if(k=null,!g.current||!B)return;let H=B;B=null;let Y=v.value.scale,q=(H.x-z.current.x)/Y,w=(H.y-z.current.y)/Y;U($,J.current.x+q,J.current.y+w)},F=(H)=>{if(!g.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},I=()=>{if(k!==null)window.cancelAnimationFrame(k),P();g.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",I),document.removeEventListener("pointercancel",I),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",I),document.addEventListener("pointercancel",I)},[$,v,U,_])}var rX=200,uX=100;function jB({nodeId:$,viewport:v,onResize:U,onResizeEnd:_}){let g=y(!1),z=y({x:0,y:0}),J=y({w:0,h:0});return S((O,K,W)=>{O.stopPropagation(),O.preventDefault(),g.current=!0,z.current={x:O.clientX,y:O.clientY},J.current={w:K,h:W},document.documentElement.classList.add("is-node-resizing");let B=null,k=null,P=()=>{if(k=null,!g.current||!B)return;let H=B;B=null;let Y=v.value.scale,q=(H.x-z.current.x)/Y,w=(H.y-z.current.y)/Y;U($,Math.max(rX,J.current.w+q),Math.max(uX,J.current.h+w))},F=(H)=>{if(!g.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},I=()=>{if(k!==null)window.cancelAnimationFrame(k),P();g.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",I),document.removeEventListener("pointercancel",I),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",I),document.addEventListener("pointercancel",I)},[$,v,U,_])}function VB({node:$,children:v,onContextMenu:U}){let _=D$.value===$.id,g=i$.value.has($.id),z=R$.value.has($.id),J=L4.value.has($.id),b=!J&&I4.value.has($.id),O=K_.value.has($.id),K=!_&&o3.value.has($.id),W=w6.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[P,F]=o(!1),I=y(null),H=S((f,a,G$)=>{let K$=RB(a,G$,$.size.width,$.size.height),V$=T.value.get(f);if(V$?.position.x===K$.x&&V$.position.y===K$.y){G4.value=K$.guides.length>0?K$.guides:null;return}Pv(f,{position:{x:K$.x,y:K$.y}}),G4.value=K$.guides.length>0?K$.guides:null},[$.size.width,$.size.height]),Y=S(()=>{DB(),G4.value=null,t$()},[]),q=TB({nodeId:$.id,viewport:P$,onMove:H,onDragEnd:Y}),w=S((f,a,G$)=>{let K$=T.value.get(f);if(K$?.size.width===a&&K$.size.height===G$)return;Pv(f,{size:{width:a,height:G$}})},[]),N=S(()=>{v$($.id,{userResized:!0}),Zv($.id,{data:{userResized:!0}}),t$()},[$.id]),C=jB({nodeId:$.id,viewport:P$,onResize:w,onResizeEnd:N}),p=S((f)=>{if(P)return;A6($.id),yB($.id,T.value.values()),q(f,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,q,P]),r=S((f)=>{if(f.stopPropagation(),f.shiftKey){n3($.id);return}A6($.id)},[$.id]),n=S((f)=>{if(U)U(f,$.id)},[U,$.id]),e=S((f)=>{f.stopPropagation(),F(!0),requestAnimationFrame(()=>I.current?.focus())},[]),u=$.data.title||s$[$.type],Q=S((f)=>{let a=f.trim();if(a&&a!==u)v$($.id,{title:a}),Zv($.id,{title:a});F(!1)},[$.id,u]),g$=y(null),m=y(!1),i=y(null);c(()=>{if(m.current||!d2($))return;let f=g$.current;if(!f)return;let a=new ResizeObserver(()=>{if(m.current){a.disconnect();return}let G$=f.scrollHeight,K$=W5($,G$);if(K$===null)return;if(Math.abs(K$-$.size.height)>8){if(Z4($.id,{width:$.size.width,height:K$}),i.current!==null)window.clearTimeout(i.current);i.current=window.setTimeout(()=>{t$({recordHistory:!1}),i.current=null},0)}m.current=!0,a.disconnect()});return a.observe(f),()=>{if(a.disconnect(),i.current!==null)window.clearTimeout(i.current),i.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.dockPosition,$.size.width,$.size.height]);let H$=$.pinned,q$=$.type==="trace",x$=q$&&$.data.status==="running",M=$.type==="group",x=$.data.strictSize===!0,s=Math.max(P$.value.scale,0.01),d=s<1?Math.min(2.2,1/s):1,b$=M&&$.data.color?$.data.color:void 0,U$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":d.toFixed(3),...b$?{"--group-color":b$}:{}},l=["canvas-node",_?"active":"",K?"neighbor":"",B?"search-match":"",k?"search-dimmed":"",g?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",b?"attention-focus-secondary":"",O?"attention-pulse":"",H$?"pinned":"",q$?"trace-node":"",x$?"trace-running":"",M?"group-node":"",x?"strict-size":""].filter(Boolean).join(" ");return G("div",{class:l,style:U$,onPointerDown:r,onContextMenu:n,children:[G("div",{class:"node-titlebar",onPointerDown:p,children:[G("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let f=fU($.type);return G(f,{size:Math.round(14*d)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),G("span",{class:"node-type-badge",children:s$[$.type]},void 0,!1,void 0,this),P?G("input",{ref:I,class:"node-title-input",value:u,onBlur:(f)=>Q(f.target.value),onKeyDown:(f)=>{if(f.key==="Enter")Q(f.target.value);if(f.key==="Escape")F(!1)},onClick:(f)=>f.stopPropagation()},void 0,!1,void 0,this):G("span",{class:"node-title",onDblClick:e,title:"Double-click to rename",children:u},void 0,!1,void 0,this),G("div",{class:"node-controls",children:[H$&&G("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(f)=>{f.stopPropagation(),w4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),i0($)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),l0($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),H_.has($.type)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),z6($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),Z6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),A4($.id),q_($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{ref:g$,class:"node-body",children:v},void 0,!1,void 0,this),!$.collapsed&&G("div",{class:"node-resize-handle",onPointerDown:(f)=>C(f,$.size.width,$.size.height)},void 0,!1,void 0,this),["top","right","bottom","left"].map((f)=>G("div",{class:`node-port node-port-${f}`,onPointerDown:(a)=>{a.stopPropagation(),a.preventDefault();let G$=$.position.x+$.size.width/2,K$=$.position.y+$.size.height/2,V$=$.size.width/2,C$=$.size.height/2,Kv,Wv;switch(f){case"top":Kv=G$,Wv=K$-C$;break;case"bottom":Kv=G$,Wv=K$+C$;break;case"left":Kv=G$-V$,Wv=K$;break;case"right":Kv=G$+V$,Wv=K$;break}uv.value={fromId:$.id,fromX:Kv,fromY:Wv,cursorX:Kv,cursorY:Wv}}},f,!1,void 0,this))]},void 0,!0,void 0,this)}var yX={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-dim)"},DX=new Set(["depends-on","flow"]);function RX($){if($.style==="dashed")return"8 4";if($.style==="dotted")return"3 3";if($.type==="references"&&!$.style)return"8 4";return}function CB($,v){let U=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,g=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=g-U,b=z-_,O=$.size.width/2,K=$.size.height/2,W=Math.abs(b/(J||0.001)),B=K/(O||0.001);if(W>B){let P=b>0?1:-1;return{x:U+K/W*(J>0?1:-1),y:_+K*P}}let k=J>0?1:-1;return{x:U+O*k,y:_+W*O*(b>0?1:-1)}}function TX($,v,U,_,g,z,J,b){return{x:0.125*$+0.375*U+0.375*g+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*b}}function jX({edge:$,fromNode:v,toNode:U,focused:_,dimmed:g}){let z=CB(v,U),J=CB(U,v),b=J.x-z.x,O=J.y-z.y,K=Math.sqrt(b*b+O*O),W=Math.min(K*0.25,80),B=b/(K||1),k=O/(K||1),P=z.x+B*W,F=z.y+k*W,I=J.x-B*W,H=J.y-k*W,Y=`M ${z.x} ${z.y} C ${P} ${F}, ${I} ${H}, ${J.x} ${J.y}`,q=yX[$.type],w=DX.has($.type),N=RX($),C=$.label?TX(z.x,z.y,P,F,I,H,J.x,J.y):null,p=`edge-path-${$.id}`;return G("g",{children:[G("path",{d:Y,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&G("path",{d:Y,fill:"none",stroke:q,"stroke-width":"6","stroke-dasharray":N,opacity:"0.15",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{id:p,d:Y,fill:"none",stroke:q,"stroke-width":_?2.5:1.5,"stroke-dasharray":N,"marker-end":w?"url(#edge-arrow)":void 0,opacity:g?0.2:_?1:0.75,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&G("circle",{r:"3",fill:q,opacity:"0.9",children:G("animateMotion",{dur:"2s",repeatCount:"indefinite",children:G("mpath",{href:`#${p}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&$.label&&G("g",{transform:`translate(${C.x}, ${C.y})`,children:[G("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8),y:"-10",width:$.label.length*7+16,height:"20",rx:"4"},void 0,!1,void 0,this),G("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)","font-size":"11",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function fB({nodes:$,edges:v}){let U=$.value,_=Array.from(v.value.values()),g=D$.value,z=g!==null,J=w6.value,b=J!==null;if(_.length===0)return null;let O=96,K=Array.from(U.values()),W=Math.min(...K.map((H)=>H.position.x))-O,B=Math.min(...K.map((H)=>H.position.y))-O,k=Math.max(...K.map((H)=>H.position.x+H.size.width))+O,P=Math.max(...K.map((H)=>H.position.y+H.size.height))+O,F=Math.max(1,k-W),I=Math.max(1,P-B);return G("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${W} ${B} ${F} ${I}`,width:F,height:I,style:{position:"absolute",top:`${B}px`,left:`${W}px`,pointerEvents:"none",overflow:"visible"},children:[G("title",{children:"Canvas connections"},void 0,!1,void 0,this),G("defs",{children:G("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:G("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((H)=>{let Y=U.get(H.from),q=U.get(H.to);if(!Y||!q)return null;let w=z&&(H.from===g||H.to===g),N=b&&!(J.has(H.from)||J.has(H.to));return G(jX,{edge:H,fromNode:Y,toNode:q,focused:w,dimmed:z&&!w||N},H.id,!1,void 0,this)}),uv.value&&(()=>{let H=uv.value,Y=H.cursorX-H.fromX,q=H.cursorY-H.fromY,w=Math.sqrt(Y*Y+q*q),N=Math.min(w*0.25,80),C=Y/(w||1),p=q/(w||1),r=`M ${H.fromX} ${H.fromY} C ${H.fromX+C*N} ${H.fromY+p*N}, ${H.cursorX-C*N} ${H.cursorY-p*N}, ${H.cursorX} ${H.cursorY}`;return G("g",{children:[G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"6",opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"2","stroke-dasharray":"6 4",opacity:"0.8"},void 0,!1,void 0,this),G("circle",{cx:H.cursorX,cy:H.cursorY,r:"5",fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function VX($){let[v,...U]=$;if(!v)return"";return U.reduce((_,g)=>`${_} L ${g.x} ${g.y}`,`M ${v.x} ${v.y}`)}function QO({annotations:$}){if($.length===0)return null;return G("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let U=v.color==="currentColor"?"var(--c-annotation)":v.color;if(v.type==="text"){let _=v.points[0];if(!_||!v.text)return null;return G("text",{x:_.x,y:_.y,fill:U,"font-size":v.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:v.text},v.id,!1,void 0,this)}return G("path",{d:VX(v.points),fill:"none",stroke:U,"stroke-width":v.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},v.id,!1,void 0,this)})},void 0,!1,void 0,this)}var CX=0.1,fX=4,cB=1;function mB($){return Math.min(fX,Math.max(CX,$))}function EB({viewport:$,onViewportChange:v,onViewportCommit:U,disabled:_=!1}){let g=y(null),z=y(!1),J=y({x:0,y:0}),b=y(0),O=y(null),K=S((H)=>{if(O.current!==null)window.clearTimeout(O.current);O.current=window.setTimeout(()=>{O.current=null,U(H)},140)},[U]),W=S((H)=>{if(_)return;H.preventDefault();let Y=$.value;if(H.ctrlKey||H.metaKey){let q=g.current?.getBoundingClientRect();if(!q)return;let w=H.clientX-q.left,N=H.clientY-q.top,C=-H.deltaY*0.002,p=mB(Y.scale*(1+C)),r=p/Y.scale,n={x:w-r*(w-Y.x),y:N-r*(N-Y.y),scale:p};v(n),K(n)}else{let q={x:Y.x-H.deltaX*cB,y:Y.y-H.deltaY*cB,scale:Y.scale};v(q),K(q)}},[_,$,v,K]),B=S((H)=>{if(_)return;let Y=g.current;if(!Y||H.target!==Y)return;z.current=!0,J.current={x:H.clientX,y:H.clientY},Y.setPointerCapture(H.pointerId)},[_]),k=S((H)=>{if(!z.current)return;if(_)return;let Y=H.clientX-J.current.x,q=H.clientY-J.current.y;J.current={x:H.clientX,y:H.clientY};let w=$.value;v({x:w.x+Y,y:w.y+q,scale:w.scale})},[_,$,v]),P=S(()=>{if(z.current)U($.value);z.current=!1},[U,$]),F=S((H)=>{if(_)return;if(H.touches.length!==2){b.current=0;return}H.preventDefault();let Y=H.touches[0],q=H.touches[1],w=Math.hypot(q.clientX-Y.clientX,q.clientY-Y.clientY),N=(Y.clientX+q.clientX)/2,C=(Y.clientY+q.clientY)/2;if(b.current>0){let p=$.value,r=g.current?.getBoundingClientRect();if(!r)return;let n=N-r.left,e=C-r.top,u=w/b.current,Q=mB(p.scale*u),g$=Q/p.scale,m={x:n-g$*(n-p.x),y:e-g$*(e-p.y),scale:Q};v(m),K(m)}b.current=w},[_,$,v,K]),I=S(()=>{if(O.current!==null)window.clearTimeout(O.current),O.current=null;U($.value),b.current=0},[U,$]);return c(()=>{let H=g.current;if(!H)return;return H.addEventListener("wheel",W,{passive:!1}),H.addEventListener("pointerdown",B),H.addEventListener("pointermove",k),H.addEventListener("pointerup",P),H.addEventListener("pointercancel",P),H.addEventListener("touchmove",F,{passive:!1}),H.addEventListener("touchend",I),()=>{if(O.current!==null)window.clearTimeout(O.current);H.removeEventListener("wheel",W),H.removeEventListener("pointerdown",B),H.removeEventListener("pointermove",k),H.removeEventListener("pointerup",P),H.removeEventListener("pointercancel",P),H.removeEventListener("touchmove",F),H.removeEventListener("touchend",I)}},[W,B,k,P,F,I]),g}function cX($){switch($.type){case"markdown":return G(i_,{node:$},void 0,!1,void 0,this);case"mcp-app":return G(E6,{node:$},void 0,!1,void 0,this);case"webpage":return G(E0,{node:$},void 0,!1,void 0,this);case"json-render":return G(E6,{node:$},void 0,!1,void 0,this);case"graph":return G(E6,{node:$},void 0,!1,void 0,this);case"prompt":return G(h0,{node:$},void 0,!1,void 0,this);case"response":return G(x0,{node:$},void 0,!1,void 0,this);case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"trace":return G(p0,{node:$},void 0,!1,void 0,this);case"file":return G(V_,{node:$},void 0,!1,void 0,this);case"image":return G(m0,{node:$},void 0,!1,void 0,this);case"html":return G(VU,{node:$},void 0,!1,void 0,this);case"group":return G(hW,{node:$},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function mX($,v,U){let _=U.x-v.x,g=U.y-v.y,z=_*_+g*g;if(z===0)return Math.hypot($.x-v.x,$.y-v.y);let J=Math.max(0,Math.min(1,(($.x-v.x)*_+($.y-v.y)*g)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*g))}function EX($,v,U){for(let _=$.length-1;_>=0;_--){let g=$[_];if(!g)continue;let z=U+g.width;if(v.x<g.bounds.x-z||v.x>g.bounds.x+g.bounds.width+z||v.y<g.bounds.y-z||v.y>g.bounds.y+g.bounds.height+z)continue;if(g.type==="text")return g;for(let J=1;J<g.points.length;J++){let b=g.points[J-1],O=g.points[J];if(b&&O&&mX(v,b,O)<=U+g.width/2)return g}}return null}var NO="currentColor",iB=4,lB=24,iX=14,lX=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),hX=new Set(["md","mdx","markdown"]),hB={width:520,height:420};function xX($){let v=$.trim();if(!v||/\s/.test(v))return null;let U=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(U);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function rO($){let v=$.trim();if(!v)return[];let U=v.includes(`
228
- `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,g=[];for(let z of U){let J=z.trim();if(!J||J.startsWith("#"))continue;let b=xX(J);if(!b||_.has(b))continue;_.add(b),g.push(b)}return g}function pX($){let v=rO($.getData("text/uri-list"));if(v.length>0)return v;return rO($.getData("text/plain"))}function oX($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function xB($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function nX($){let v=$.split(".").pop()?.toLowerCase()??"";if(lX.has(v))return"image";if(hX.has(v))return"markdown";return"file"}function tX($,v){let U=[],_=0;for(let g of $){if(g.dockPosition!==null)continue;if(v&&g.id===v)continue;if(g.type==="group")U.splice(_++,0,g);else U.push(g)}return U}function pB({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:U=!1,annotationTool:_=null}){let g=P$.value,z=y(!1),J=y(!1),b=y([]),[O,K]=o(null),[W,B]=o(null),[k,P]=o(null),F=y(null),[I,H]=o(!1),Y=y(0),q=y(null),w=EB({viewport:P$,disabled:U,onViewportChange:(M)=>{if(z.current||U)return;S4(),UK(M)},onViewportCommit:(M)=>{if(z.current||U)return;S4(),zK(M)}}),N=S((M)=>{F.current=M,P(M)},[]),C=S(async(M,x,s)=>{if(M.length===0)return;let{width:d,height:b$}=hB,U$=24,l=Math.ceil(Math.sqrt(M.length)),f=Math.ceil(M.length/l),a=l*d+Math.max(0,l-1)*U$,G$=f*b$+Math.max(0,f-1)*U$;for(let K$=0;K$<M.length;K$++){let V$=K$%l,C$=Math.floor(K$/l),Kv=x-a/2+V$*(d+U$),Wv=s-G$/2+C$*(b$+U$);await Ev({type:"webpage",content:M[K$],x:Kv,y:Wv,width:d,height:b$})}},[]),p=S((M)=>{let x=w.current;if(!x)return;if(_==="eraser"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation();let f=x.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale},K$=EX(Array.from(F4.value.values()),G$,iX/a.scale);if(K$)vK(K$.id);return}if(_==="text"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv();let f=x.getBoundingClientRect(),a=P$.value;N({x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale,value:""});return}if(_==="pen"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv(),J.current=!0;let f=x.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale};b.current=[G$],B({id:"draft-annotation",type:"freehand",points:[G$],bounds:{x:0,y:0,width:0,height:0},color:NO,width:iB,createdAt:""}),x.setPointerCapture(M.pointerId);return}if(M.target!==x)return;if(!M.shiftKey){if(!q.current)D$.value=null,jv();return}M.preventDefault(),M.stopPropagation(),z.current=!0;let s=x.getBoundingClientRect(),d=M.clientX-s.left,b$=M.clientY-s.top,U$={startX:d,startY:b$,currentX:d,currentY:b$};q.current=U$,K(U$),x.setPointerCapture(M.pointerId)},[_,w]),r=S((M)=>{if(J.current){let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),U$=P$.value,l={x:(M.clientX-b$.left-U$.x)/U$.scale,y:(M.clientY-b$.top-U$.y)/U$.scale},f=b.current.at(-1);if(f&&Math.hypot(l.x-f.x,l.y-f.y)<2)return;b.current=[...b.current,l],B((a)=>a?{...a,points:b.current}:null);return}if(!z.current||!q.current)return;let x=w.current?.getBoundingClientRect();if(!x)return;let s={...q.current,currentX:M.clientX-x.left,currentY:M.clientY-x.top};q.current=s,K(s)},[w]),n=S((M)=>{if(J.current){J.current=!1;let l=b.current;if(b.current=[],B(null),l.length>=2)A2({points:l,color:NO,width:iB});let f=w.current;if(f?.hasPointerCapture(M.pointerId))f.releasePointerCapture(M.pointerId);return}let x=q.current;if(!z.current||!x)return;z.current=!1,q.current=null;let s=Math.min(x.startX,x.currentX),d=Math.max(x.startX,x.currentX),b$=Math.min(x.startY,x.currentY),U$=Math.max(x.startY,x.currentY);if(d-s>5||U$-b$>5){let l=P$.value,f=(s-l.x)/l.scale,a=(d-l.x)/l.scale,G$=(b$-l.y)/l.scale,K$=(U$-l.y)/l.scale,V$=[];for(let C$ of T.value.values()){if(C$.dockPosition!==null)continue;let Kv=C$.position.x,Wv=C$.position.y;if(Kv+C$.size.width>f&&Kv<a&&Wv+C$.size.height>G$&&Wv<K$)V$.push(C$.id)}if(V$.length>0)t3(V$)}K(null)},[]);c(()=>{if(U)return;if(!J.current&&!W&&!k)return;J.current=!1,b.current=[],B(null),N(null)},[U,W,N,k]);let e=S(()=>{let M=F.current;if(!M)return;let x=M.value.trim();if(N(null),!x)return;let s={x:M.x,y:M.y};A2({type:"text",points:[s],color:NO,width:lB,text:x})},[N]);c(()=>{if(_!=="text"&&k)N(null)},[_,N,k]),c(()=>{function M(s){if(!uv.value)return;let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),U$=P$.value;uv.value={...uv.value,cursorX:(s.clientX-b$.left-U$.x)/U$.scale,cursorY:(s.clientY-b$.top-U$.y)/U$.scale}}function x(s){let d=uv.value;if(!d)return;uv.value=null;let b$=w.current;if(!b$)return;let U$=b$.getBoundingClientRect(),l=P$.value,f=(s.clientX-U$.left-l.x)/l.scale,a=(s.clientY-U$.top-l.y)/l.scale;for(let G$ of T.value.values()){if(G$.id===d.fromId||G$.dockPosition!==null)continue;if(f>=G$.position.x&&f<=G$.position.x+G$.size.width&&a>=G$.position.y&&a<=G$.position.y+G$.size.height){Y4(d.fromId,G$.id,"relation");return}}}return document.addEventListener("pointermove",M),document.addEventListener("pointerup",x),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",x)}},[w]);let u=S((M)=>{if(U)return;let x=w.current;if(!x||M.target!==x)return;let s=x.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,U$=(M.clientY-s.top-d.y)/d.scale,l=520,f=360;Ev({type:"markdown",title:"New note",x:b$-l/2,y:U$-f/2,width:l,height:f})},[U,w]),Q=S((M)=>{if(U)return;if(!v)return;let x=w.current;if(!x)return;if((M.target instanceof Element?M.target:null)?.closest(".canvas-node"))return;let d=x.getBoundingClientRect(),b$=P$.value,U$=(M.clientX-d.left-b$.x)/b$.scale,l=(M.clientY-d.top-b$.y)/b$.scale;v(M,U$,l)},[U,w,v]),g$=S((M)=>{if(M.preventDefault(),Y.current++,M.dataTransfer?.types.includes("Files")||oX(M.dataTransfer))H(!0)},[]),m=S((M)=>{if(M.preventDefault(),M.dataTransfer)M.dataTransfer.dropEffect="copy"},[]),i=S((M)=>{if(M.preventDefault(),Y.current--,Y.current<=0)Y.current=0,H(!1)},[]),H$=S(async(M)=>{M.preventDefault(),H(!1),Y.current=0;let x=w.current;if(!x||!M.dataTransfer)return;let s=x.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,U$=(M.clientY-s.top-d.y)/d.scale,l=Array.from(M.dataTransfer.files);if(l.length===0){let V$=pX(M.dataTransfer);await C(V$,b$,U$);return}let f=400,a=300,G$=20,K$=Math.ceil(Math.sqrt(l.length));for(let V$=0;V$<l.length;V$++){let C$=l[V$],Kv=V$%K$,Wv=Math.floor(V$/K$),P6=b$-K$*(f+G$)/2+Kv*(f+G$),lU=U$-a/2+Wv*(a+G$),k6=nX(C$.name),hU=C$.name;if(k6==="image"){let sv=new FileReader,Av=await new Promise((Zg)=>{sv.onload=()=>Zg(sv.result),sv.readAsDataURL(C$)});await Ev({type:"image",title:hU,content:Av,x:P6,y:lU,width:f,height:a})}else{let sv=await C$.text(),Av=k6==="markdown"||k6==="file";await Ev({type:k6,title:hU,content:sv,x:P6,y:lU,width:Av?720:f,height:Av?500:a})}}},[w,C]);c(()=>{let M=async(x)=>{if(x.defaultPrevented)return;if(xB(x.target instanceof Element?x.target:null))return;if(xB(document.activeElement))return;let s=x.clipboardData?.getData("text/plain")??"",d=rO(s);if(d.length===0)return;let b$=w.current;if(!b$)return;x.preventDefault();let U$=b$.getBoundingClientRect(),l=P$.value,f=(U$.width/2-l.x)/l.scale,a=(U$.height/2-l.y)/l.scale;await C(d,f,a)};return document.addEventListener("paste",M),()=>{document.removeEventListener("paste",M)}},[w,C]);let q$=tX(T.value.values(),j$.value),x$=null;if(O){let M=Math.min(O.startX,O.currentX),x=Math.min(O.startY,O.currentY),s=Math.abs(O.currentX-O.startX),d=Math.abs(O.currentY-O.startY);x$={position:"absolute",left:`${M}px`,top:`${x}px`,width:`${s}px`,height:`${d}px`,pointerEvents:"none"}}return G("div",{class:"canvas-viewport",ref:w,tabIndex:0,onPointerDown:p,onPointerMove:r,onPointerUp:n,onContextMenu:Q,onDblClick:u,onDragEnter:g$,onDragOver:m,onDragLeave:i,onDrop:H$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":U||uv.value||z.current?"crosshair":"grab"},children:[G("div",{style:{transform:`matrix(${g.scale}, 0, 0, ${g.scale}, ${g.x}, ${g.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[G(eW,{},void 0,!1,void 0,this),G(QB,{},void 0,!1,void 0,this),G(fB,{nodes:T,edges:m$},void 0,!1,void 0,this),G(QO,{annotations:Array.from(F4.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&G(QO,{annotations:[W]},void 0,!1,void 0,this),q$.map((M)=>G(VB,{node:M,onContextMenu:$,children:cX(M)},M.id,!1,void 0,this)),G4.value&&G("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:G4.value.map((M,x)=>M.axis==="x"?G("line",{x1:M.pos,y1:M.from-20,x2:M.pos,y2:M.to+20,class:"snap-guide-line"},x,!1,void 0,this):G("line",{x1:M.from-20,y1:M.pos,x2:M.to+20,y2:M.pos,class:"snap-guide-line"},x,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&G("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),k&&G("input",{class:"annotation-text-input",value:k.value,autoFocus:!0,style:{left:`${k.x*g.scale+g.x}px`,top:`${k.y*g.scale+g.y}px`,fontSize:`${lB*g.scale}px`},onInput:(M)=>N({...k,value:M.target.value}),onBlur:e,onPointerDown:(M)=>M.stopPropagation(),onKeyDown:(M)=>{if(M.key==="Enter")M.preventDefault(),e();if(M.key==="Escape")M.preventDefault(),N(null)}},void 0,!1,void 0,this),x$&&G("div",{class:"lasso-rect",style:x$},void 0,!1,void 0,this),I&&G("div",{class:"drop-zone-overlay",children:G("div",{class:"drop-zone-indicator",children:[G("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),G("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},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 dX($,v){let U=$.toLowerCase(),_=v.toLowerCase(),g=[],z=0,J=0,b=-1;for(let O=0;O<_.length&&z<U.length;O++)if(_[O]===U[z]){if(g.push(O),J+=b===O-1?10:1,O===0||_[O-1]===" "||_[O-1]==="-"||_[O-1]==="_")J+=5;b=O,z++}return{match:z===U.length,score:J,indices:g}}function aX($,v){if(v.length===0)return $;let U=[],_=0;for(let g of v){if(g>_)U.push($.slice(_,g));U.push(G("mark",{children:$[g]},g,!1,void 0,this)),_=g+1}if(_<$.length)U.push($.slice(_));return U}var uO={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function sX($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let U=v.slice(5).trim(),g=Object.keys(s$).find((J)=>J.startsWith(U));if(g)return{typeFilter:g,remaining:""};let z=uO[U];if(z)return{typeFilter:z,remaining:""}}if(uO[v])return{typeFilter:uO[v],remaining:""};return{typeFilter:null,remaining:$}}function oB({onClose:$,onToggleMinimap:v}){let[U,_]=o(""),[g,z]=o(0),J=y(null),b=y(null);c(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let O=S(()=>{let I=[];for(let Y of T.value.values()){let q=Y.data.title||s$[Y.type],w=Y.data.content||Y.data.path||"";I.push({id:`node:${Y.id}`,kind:"node",label:q,description:w.length>80?w.slice(0,80)+"...":w||void 0,badge:s$[Y.type],nodeType:Y.type,action:()=>{Yv(Y.id),$()}})}let H=[{label:"New note (markdown node)",badge:"CREATE",action:()=>{Ev({type:"markdown",title:"New note",width:520,height:360}),$()}},{label:"Fit all nodes",badge:"VIEW",action:()=>{N_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{r_(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{u_(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let Y=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",Y),Hg(),T$.value=Y,I_(Y),$()}}];for(let Y of H)I.push({id:`action:${Y.label}`,kind:"action",label:Y.label,badge:Y.badge,badgeClass:"command-palette-badge--action",action:Y.action});return I},[$,v]),{typeFilter:K,remaining:W}=sX(U),B=O(),k;if(!U.trim())k=B.map((I)=>({...I,score:0,indices:[]}));else{k=[];for(let I of B){if(K){if(I.kind!=="node"||I.nodeType!==K)continue;if(!W){k.push({...I,score:0,indices:[]});continue}}let H=dX(W||U,I.label);if(H.match)k.push({...I,score:H.score,indices:H.indices})}k.sort((I,H)=>H.score-I.score)}c(()=>{if(!U.trim()){w6.value=null;return}let I=new Set;for(let H of k)if(H.kind==="node")I.add(H.id.slice(5));w6.value=I.size>0?I:null},[U,k]),c(()=>{return()=>{w6.value=null}},[]);let P=Math.min(g,Math.max(0,k.length-1)),F=S((I)=>{if(I.key==="ArrowDown")I.preventDefault(),z((H)=>Math.min(H+1,k.length-1));else if(I.key==="ArrowUp")I.preventDefault(),z((H)=>Math.max(H-1,0));else if(I.key==="Enter"){if(I.preventDefault(),k[P])k[P].action()}else if(I.key==="Escape")I.preventDefault(),I.stopPropagation(),$()},[k,P,$]);return c(()=>{let I=b.current;if(!I)return;I.children[P]?.scrollIntoView({block:"nearest"})},[P]),c(()=>{z(0)},[U]),G("div",{class:"command-palette-backdrop",onMouseDown:$,children:G("div",{class:"command-palette",onMouseDown:(I)=>I.stopPropagation(),children:[G("input",{ref:J,type:"text",class:"command-palette-input",value:U,onInput:(I)=>_(I.target.value),onKeyDown:F,placeholder:`Search nodes and actions... (${Sv}+K)`},void 0,!1,void 0,this),G("div",{class:"command-palette-hint",children:[G("span",{children:[G("kbd",{children:"↑"},void 0,!1,void 0,this),G("kbd",{children:"↓"},void 0,!1,void 0,this)," navigate"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"↵"},void 0,!1,void 0,this)," select"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"esc"},void 0,!1,void 0,this)," close"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"type:"},void 0,!1,void 0,this)," filter by type"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"command-palette-results",ref:b,children:[k.length===0&&G("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),k.map((I,H)=>G("button",{type:"button",class:`command-palette-item${H===P?" selected":""}`,onMouseEnter:()=>z(H),onClick:()=>I.action(),children:[G("span",{class:`command-palette-badge${I.badgeClass?` ${I.badgeClass}`:""}`,children:I.badge},void 0,!1,void 0,this),G("span",{class:"command-palette-label",children:I.indices.length>0?aX(I.label,I.indices):I.label},void 0,!1,void 0,this),I.description&&G("span",{class:"command-palette-desc",children:I.description},void 0,!1,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function nB(){let[$,v]=o(null),U=S((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=S((z,J,b)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:b})},[]),g=S(()=>v(null),[]);return c(()=>{if(!$)return;let z=()=>v(null),J=(b)=>{if(b.key==="Escape")v(null)};return document.addEventListener("click",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("click",z),document.removeEventListener("keydown",J)}},[$]),{menu:$,openNodeMenu:U,openCanvasMenu:_,closeMenu:g}}var eX="#4bbcFF",$w=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function tB({menu:$,onClose:v}){let U;if($.kind==="node"){let b=T.value.get($.nodeId);if(!b)return null;U=Jw(b)}else U=zw($.canvasX,$.canvasY);let _=new Map,g=U.some((b)=>b.render)?U.length*32+168:U.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-g));return G("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${J}px`,zIndex:1e4},onPointerDown:(b)=>b.stopPropagation(),onClick:(b)=>b.stopPropagation(),children:U.map((b)=>{let O=b.separator?"separator":b.render?"custom":`${b.label??"item"}:${b.shortcut??""}`,K=(_.get(O)??0)+1;_.set(O,K);let W=`${O}:${K}`;if(b.separator)return G("div",{class:"context-menu-separator"},W,!1,void 0,this);if(b.render)return G("div",{class:"context-menu-custom",children:b.render(v)},W,!1,void 0,this);return G("button",{type:"button",class:"context-menu-item",onClick:()=>{b.action?.(),v()},children:[G("span",{class:"context-menu-label",children:b.label},void 0,!1,void 0,this),b.shortcut&&G("span",{class:"context-menu-shortcut",children:b.shortcut},void 0,!1,void 0,this)]},W,!0,void 0,this)})},void 0,!1,void 0,this)}function vw($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function o0($){let v=$.trim().toLowerCase(),U=v.match(/^#([0-9a-f]{3})$/);if(U){let[_,g,z]=U[1].split("");return`#${_}${_}${g}${g}${z}${z}`}return v}function dB($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return o0($.data.color)}function gw($){let v=dB($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:o0(eX)}function yO($,v){let U=v?o0(v):null;Pv($.id,{data:{...$.data,color:U}}),Zv($.id,{data:{color:U}})}function Uw($,v){let U=dB($);return G("div",{class:"context-menu-section",children:[G("div",{class:"context-menu-section-header",children:[G("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-menu-reset",onClick:()=>{yO($,null),v()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-menu-color-grid",children:$w.map((_)=>{let g=o0(_.value);return G("button",{type:"button",class:`context-menu-color-swatch${U===g?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{yO($,_.value),v()},children:[G("span",{class:"context-menu-color-dot",style:{"--swatch-color":_.value}},void 0,!1,void 0,this),G("span",{children:_.label},void 0,!1,void 0,this)]},_.value,!0,void 0,this)})},void 0,!1,void 0,this),G("label",{class:"context-menu-color-custom",children:[G("span",{children:"Custom"},void 0,!1,void 0,this),G("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:gw($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{yO($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RO($,v,U,_){return{x:$-U/2,y:v-_/2}}function _w($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function DO($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let U=v.trim();if(!U)return;let _=RO($.canvasX,$.canvasY,$.width,$.height);if(!(await Ev({type:$.type,...$.type!=="webpage"?{title:_w(U,$.titleFallback)}:{},content:U,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function zw($,v){return[{label:"New note",action:()=>{let g=RO($,v,520,360);Ev({type:"markdown",title:"New note",x:g.x,y:g.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{DO({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:v,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{DO({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:v,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{DO({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:v,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let g=RO($,v,600,400);X_({title:"Group",x:g.x,y:g.y,width:600,height:400})}}]}function Jw($){let v=[],U=vw($);if(v.push({label:"Focus",action:()=>Yv($.id)}),H_.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>z6($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>Z6($.id)});let _=R$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>w4($.id)}),v.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let J=!$.pinned;Pv($.id,{pinned:J}),Zv($.id,{pinned:J}),t$()}});let g=Z_.value;if(g&&g.from!==$.id){let J=T.value.get(g.from),b=J?(J.data.title||J.id).slice(0,20):g.from;v.push({label:`Connect from "${b}"`,action:()=>{Y4(g.from,$.id,"relation"),Z_.value=null}})}v.push({label:g?"Connect from here (replace)":"Connect from here",action:()=>{Z_.value={from:$.id}}});let z=Array.from(m$.value.values()).filter((J)=>J.from===$.id||J.to===$.id).length;if(z>0)v.push({label:`${z} edge${z!==1?"s":""} connected`});if(v.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&U)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(U)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(U)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let J=$.data.chartConfig.title||"chart";v.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let J=$.data.url;if(v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank")}}),v.push({label:"Focus in TUI",action:()=>u3("mcp-app-focus",{url:J})}),$.type==="json-render"||$.type==="graph")v.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let J=typeof $.data.url==="string"?$.data.url:"";v.push({label:"Refresh webpage",action:()=>{Y_($.id)}}),v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank","noopener")}}),v.push({label:"Copy URL",action:()=>{if(J)navigator.clipboard.writeText(J)}})}if($.type==="group"){let J=$.data.children??[];if(v.push({separator:!0}),v.push({render:(b)=>Uw($,b)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>f3($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>M4($.id)});else v.push({label:"Dock left of toolbar",action:()=>Z2($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>Z2($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{A4($.id),q_($.id)}}),v}function aB(){let $=R$.value.size;if($===0||q6.value||Q_.value)return null;return G("div",{class:"context-pin-bar",children:[G("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),G("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:a3,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sB({node:$}){let v=LO($),U=$.data.activeTool,_=$.data.subagent,g=c0[v]??"var(--c-muted)";return G("span",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1,minWidth:0},children:[G("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:g,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{color:g,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),U&&G("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",U]},void 0,!0,void 0,this),_&&_.state!=="completed"&&G("span",{style:{color:"var(--c-subagent)",fontSize:"10px"},children:["⠉ ",_.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bw($){switch($.type){case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$},void 0,!1,void 0,this);default:return null}}function Gw($){let v=Array.isArray($.data.cards)?$.data.cards:[],U=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+U.length}function Ow({node:$}){let v=e3(),U=v.length>0?v.length:Gw($),_=U>0,g=$.collapsed===!0,z=()=>{B_(),Z6($.id)};if(g)return G("div",{class:"docked-node docked-node--collapsed","data-docked-node":"true",children:G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:"Context"},void 0,!1,void 0,this),_&&G("span",{class:"docked-node-count","aria-hidden":"true",children:U>99?"99+":U},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${U} item${U===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${U} item${U===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),M4($.id)},title:"Undock to canvas","aria-label":"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return G("aside",{class:"context-dock-panel","data-docked-node":"true","aria-label":"Agent context",children:[G("div",{class:"context-dock-header",children:[G("div",{class:"context-dock-header-text",children:[G("span",{class:"context-dock-title",children:"Context"},void 0,!1,void 0,this),G("span",{class:"context-dock-subtitle",children:_?`${U} item${U===1?"":"s"} in agent context`:"Active agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-controls",children:[G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),M4($.id)},"aria-label":"Undock to canvas",title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),Z6($.id)},"aria-label":"Collapse context panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-body",children:G(a6,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TO({node:$}){if($.type==="context")return G(Ow,{node:$},void 0,!1,void 0,this);return G("div",{class:`docked-node${$.collapsed?" docked-node--collapsed":""}`,"data-docked-node":"true",children:[G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:s$[$.type]??$.type},void 0,!1,void 0,this),$.type==="status"&&$.collapsed&&G(sB,{node:$},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),Z6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),M4($.id)},title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{class:"docked-node-body",children:bw($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eB($,v){switch($.type){case"markdown":return G(i_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return G(E0,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return G(h0,{node:$},void 0,!1,void 0,this);case"response":return G(x0,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"trace":return G(p0,{node:$},void 0,!1,void 0,this);case"file":return G(V_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return G(m0,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return G(VU,{node:$,expanded:v},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function $P($){switch($.type){case"markdown":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function Kw($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function Ww($,v){return $!==null&&typeof $==="object"&&$.source===xv&&$.type==="presentation-exit"&&$.token===v}function Bw($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function vP($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function gP(){let $=j$.value,v=$?T.value.get($):void 0,[U,_]=o(!1),[g,z]=o(!1),[J,b]=o(""),O=y(null),K=y(null),W=S(()=>{z(!1),d6()},[]),B=S(()=>{b(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=S((u)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:xv,token:J,...u},"*")},[J]),P=S(()=>{z(!1)},[]),F=S((u)=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),z(!1);return}if(u.key==="Tab"&&!vP(u.target)){u.preventDefault(),u.stopPropagation(),K.current?.focus();return}if((u.key===" "||u.key==="Enter")&&vP(u.target))return;if(!Bw(u.key))return;u.preventDefault(),u.stopPropagation(),k({type:"presentation-key",key:u.key})},[k]),I=S((u)=>{if(u.target.classList.contains("expanded-overlay-backdrop"))d6()},[]),H=S(()=>{if(!v)return;let u=$P(v);if(!u)return;navigator.clipboard.writeText(u).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),Y=S(()=>{if(!$)return;w4($)},[$]);if(c(()=>{z(!1)},[$]),v_(()=>{if(!g)return;let u=()=>{let m=O.current;if(!m||m.contains(document.activeElement))return;m.focus()},Q=[0,50,150].map((m)=>window.setTimeout(u,m)),g$=(m)=>{if(!Ww(m.data,J))return;z(!1)};return document.addEventListener("keydown",F,!0),window.addEventListener("message",g$),()=>{Q.forEach((m)=>{window.clearTimeout(m)}),document.removeEventListener("keydown",F,!0),window.removeEventListener("message",g$)}},[F,J,g]),!v)return null;let q=v.data.title||v.data.path?.split("/").pop()||s$[v.type],w=$P(v),N=Kw(w),C=$?R$.value.has($):!1,p=w.length>0,r=iv.value===$,n=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",e=pW(v);return G("div",{class:"expanded-overlay-backdrop",onPointerDown:I,style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(10,14,30,0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"32px",pointerEvents:r?"none":"auto"},children:G("div",{class:"expanded-overlay-panel",style:{flex:1,maxWidth:"1200px",display:"flex",flexDirection:"column",background:"var(--c-panel)",border:`1px solid ${C?"var(--c-warn)":"var(--c-accent)"}`,borderRadius:"var(--radius)",boxShadow:`0 0 0 1px ${C?"var(--c-warn)":"var(--c-accent)"}, 0 24px 80px rgba(0,0,0,0.6)`,overflow:"hidden"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",background:"var(--c-panel-glass)",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--c-accent-12)",color:"var(--c-accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:s$[v.type]},void 0,!1,void 0,this),G("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"var(--c-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q},void 0,!1,void 0,this),G("div",{class:"expanded-actions",children:[G("button",{type:"button",class:`expanded-action-btn ${C?"expanded-action-active":""}`,onClick:Y,title:C?"Remove from context":"Pin as context",children:C?"✦ In context":"✦ Pin as context"},void 0,!1,void 0,this),p&&G("button",{type:"button",class:"expanded-action-btn",onClick:H,title:"Copy content to clipboard",children:U?"Copied!":"Copy"},void 0,!1,void 0,this),i0(v)&&G("button",{type:"button",class:"expanded-action-btn",onClick:()=>void l0(v),title:"Open as a full-page site in the system browser",children:"Open as site"},void 0,!1,void 0,this),e&&G("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:B,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this),N>0&&G("span",{class:"expanded-meta",children:[N.toLocaleString()," word",N!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("span",{style:{fontSize:"10px",color:r?"var(--c-warn)":"var(--c-muted)"},children:r?"Saving edits...":"Esc to close"},void 0,!1,void 0,this),G("button",{type:"button",onClick:W,style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 6px",fontSize:"16px",lineHeight:1,borderRadius:"4px"},onMouseEnter:(u)=>{u.target.style.color="var(--c-text)"},onMouseLeave:(u)=>{u.target.style.color="var(--c-muted)"},title:"Close (Esc)",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"16px",minHeight:0,...n?{display:"flex",flexDirection:"column"}:{}},children:n?G("div",{style:{flex:1,minHeight:0,display:"flex"},children:eB(v,!0)},void 0,!1,void 0,this):eB(v,!0)},void 0,!1,void 0,this),e&&g&&G("div",{ref:O,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${q}`,tabIndex:-1,onKeyDownCapture:F,children:[G("button",{ref:K,type:"button",class:"html-presentation-exit",onClick:P,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),G("div",{class:"html-presentation-stage",children:G(VU,{node:v,expanded:!0,presentation:!0,presentationExitToken:J},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var wg=180,Ag=120,n0=20;function Pw(){let $=f0();return{markdown:$.accent,"mcp-app":$.ok,webpage:$.warn,"json-render":$.ok,graph:$.purple,prompt:$.accent,response:$.ok,status:$.warn,context:$.muted,ledger:$.dim,trace:$.purple,file:$.accent,image:$.ok,html:$.warn,group:$.dim}}function kw(){let $=f0();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function UP($,v,U,_){let g=Array.from($.values()),z=0,J=0,b=1000,O=800;if(g.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let H of g)z=Math.min(z,H.position.x),J=Math.min(J,H.position.y),b=Math.max(b,H.position.x+H.size.width),O=Math.max(O,H.position.y+H.size.height)}let K=-v.x/v.scale,W=-v.y/v.scale,B=K+U/v.scale,k=W+_/v.scale,P={minX:Math.min(z,K)-n0,minY:Math.min(J,W)-n0,maxX:Math.max(b,B)+n0,maxY:Math.max(O,k)+n0},F=P.maxX-P.minX||1,I=P.maxY-P.minY||1;return{bounds:P,scale:Math.min(wg/F,Ag/I)}}function _P({viewport:$,nodes:v,edges:U,onNavigate:_,containerWidth:g,containerHeight:z}){let J=y(null),b=y(!1),O=y(null),K=y(null),W=S(()=>{let I=J.current;if(!I)return;let H=I.getContext("2d");if(!H)return;let Y=v.value,q=U.value,w=$.value,N=window.devicePixelRatio||1;I.width=wg*N,I.height=Ag*N,H.scale(N,N),H.clearRect(0,0,wg,Ag);let C=f0();H.fillStyle=C.panel+"d9",H.fillRect(0,0,wg,Ag);let p=UP(Y,w,g,z);O.current=p;let{bounds:r,scale:n}=p,e=(M)=>(M-r.minX)*n,u=(M)=>(M-r.minY)*n,Q=Array.from(Y.values()),g$=Pw();for(let M of Q)H.fillStyle=g$[M.type]??C.muted,H.globalAlpha=0.6,H.fillRect(e(M.position.x),u(M.position.y),Math.max(4,M.size.width*n),Math.max(3,M.size.height*n));let m=kw();for(let M of q.values()){let x=Y.get(M.from),s=Y.get(M.to);if(!x||!s)continue;let d=e(x.position.x+x.size.width/2),b$=u(x.position.y+x.size.height/2),U$=e(s.position.x+s.size.width/2),l=u(s.position.y+s.size.height/2);H.beginPath(),H.moveTo(d,b$),H.lineTo(U$,l),H.strokeStyle=m[M.type]??C.muted,H.globalAlpha=0.3,H.lineWidth=0.5,H.stroke()}let i=-w.x/w.scale,H$=-w.y/w.scale,q$=g/w.scale,x$=z/w.scale;H.globalAlpha=1,H.strokeStyle=C.accent,H.lineWidth=1.5,H.strokeRect(e(i),u(H$),q$*n,x$*n)},[v,U,$,g,z]),B=y(W);B.current=W;let k=S(()=>{if(K.current!==null)return;K.current=window.requestAnimationFrame(()=>{K.current=null,B.current()})},[]);A3(()=>{T$.value,v.value,U.value,$.value,k()}),c(()=>{k()},[g,z,k]),c(()=>()=>{if(K.current!==null)window.cancelAnimationFrame(K.current),K.current=null},[]);let P=S((I)=>{let H=J.current;if(!H)return;let Y=H.getBoundingClientRect(),q=I.clientX-Y.left,w=I.clientY-Y.top,N=O.current??UP(v.value,$.value,g,z);O.current=N;let{bounds:C,scale:p}=N,r=$.value,n=g/r.scale,e=z/r.scale,u=q/p+C.minX,Q=w/p+C.minY;_(-(u-n/2)*r.scale,-(Q-e/2)*r.scale)},[v,$,g,z,_]),F=S((I)=>{I.stopPropagation(),b.current=!0,P(I);let H=(q)=>{if(b.current)P(q)},Y=()=>{b.current=!1,document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",Y)};document.addEventListener("pointermove",H),document.addEventListener("pointerup",Y)},[P]);return G("div",{style:{position:"fixed",bottom:"16px",right:"16px",zIndex:9998,border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",overflow:"hidden",boxShadow:"0 4px 16px var(--c-shadow)"},children:G("canvas",{ref:J,width:wg,height:Ag,style:{width:`${wg}px`,height:`${Ag}px`,display:"block",cursor:"pointer"},onPointerDown:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zP(){let $=i$.value.size,v=S(()=>{let g=Array.from(i$.value);if(g.length===0)return;d3(g),jv()},[]),U=S(()=>{let g=Array.from(i$.value);if(g.length===0)return;X_({title:"Group",childIds:g}),jv()},[]),_=S(()=>{let g=Array.from(i$.value);for(let z=0;z<g.length;z++)for(let J=z+1;J<g.length;J++)Y4(g[z],g[J],"relation");jv()},[]);if($===0)return null;return G("div",{class:"selection-bar",children:[G("span",{class:"selection-bar-count",children:["✦"," ",$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-pin-ctx",onClick:v,children:"Pin as context"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:U,children:"Group"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:_,children:"Connect"},void 0,!1,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-clear",onClick:jv,title:"Clear selection",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Hw=[{title:"Navigation",shortcuts:[{keys:`${Sv}+K`,desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:`${Sv}+0`,desc:"Reset viewport to origin"},{keys:`${Sv}++ / ${Sv}+−`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Shift+Drag",desc:"Lasso select multiple nodes"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in toolbar)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function JP({onClose:$}){return G("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:G("div",{class:"shortcut-overlay",onMouseDown:(v)=>v.stopPropagation(),children:[G("div",{class:"shortcut-overlay-header",children:[G("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),G("span",{class:"shortcut-overlay-hint",children:["Press ",G("kbd",{children:"?"},void 0,!1,void 0,this)," or ",G("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"shortcut-overlay-body",children:Hw.map((v)=>G("div",{class:"shortcut-group",children:[G("div",{class:"shortcut-group-title",children:v.title},void 0,!1,void 0,this),v.shortcuts.map((U)=>G("div",{class:"shortcut-row",children:[G("kbd",{class:"shortcut-keys",children:U.keys},void 0,!1,void 0,this),G("span",{class:"shortcut-desc",children:U.desc},void 0,!1,void 0,this)]},U.keys,!0,void 0,this))]},v.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Lw($){let v=Date.now()-new Date($).getTime(),U=Math.floor(v/60000);if(U<1)return"just now";if(U<60)return`${U}m ago`;let _=Math.floor(U/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function bP({open:$,onClose:v,anchorRef:U}){let[_,g]=o([]),[z,J]=o(!1),[b,O]=o(!1),[K,W]=o(null),[B,k]=o(""),[P,F]=o(null),I=y(null),H=y(null);c(()=>{if(!$)return;J(!0),c3().then((r)=>{g(r),J(!1)})},[$]),c(()=>{if($)setTimeout(()=>H.current?.focus(),50)},[$]),c(()=>{if(!$)return;let r=(n)=>{let e=I.current,u=U.current;if(e&&!e.contains(n.target)&&u&&!u.contains(n.target))v()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[$,v]),c(()=>{if(!$)return;let r=(n)=>{if(n.key==="Escape")v()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[$,v]);let Y=S(async()=>{let r=B.trim();if(!r)return;O(!0);let n=await m3(r);if(O(!1),n.ok&&n.snapshot)g((e)=>[n.snapshot,...e]),k("")},[B]),q=S(async(r)=>{F(null),W(r);let n=await E3(r);if(W(null),n.ok)v()},[v]),w=S(async(r)=>{if((await i3(r)).ok)g((e)=>e.filter((u)=>u.id!==r));F(null)},[]);if(!$)return null;let N=U.current?.getBoundingClientRect(),C=N?Math.max(8,N.left-120):100,p=N?N.bottom+8:48;return G("div",{ref:I,class:"snapshot-panel",style:{left:`${C}px`,top:`${p}px`},children:[G("div",{class:"snapshot-panel-header",children:[G("span",{class:"snapshot-panel-title",children:"Snapshots"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-panel-close",onClick:v,title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-save-form",children:[G("input",{ref:H,type:"text",class:"snapshot-name-input",value:B,onInput:(r)=>k(r.target.value),onKeyDown:(r)=>{if(r.key==="Enter")Y()},placeholder:"Snapshot name...",maxLength:80,disabled:b},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-save-btn",onClick:Y,disabled:!B.trim()||b,children:b?"...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),G("div",{class:"snapshot-list",children:[z&&G("div",{class:"snapshot-empty",children:"Loading..."},void 0,!1,void 0,this),!z&&_.length===0&&G("div",{class:"snapshot-empty",children:"No snapshots yet. Save one to capture the current canvas state."},void 0,!1,void 0,this),!z&&_.map((r)=>G("div",{class:"snapshot-item",children:[G("div",{class:"snapshot-item-info",children:[G("span",{class:"snapshot-item-name",children:r.name},void 0,!1,void 0,this),G("span",{class:"snapshot-item-meta",children:[r.nodeCount," node",r.nodeCount!==1?"s":"",r.edgeCount>0?` · ${r.edgeCount} edge${r.edgeCount!==1?"s":""}`:""," · ",Lw(r.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-actions",children:P?.id===r.id?G(a$,{children:[G("button",{type:"button",class:`snapshot-action-btn ${P.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>P.action==="delete"?w(r.id):q(r.id),title:P.action==="delete"?"Confirm delete":"Confirm restore",disabled:K!==null,children:P.action==="delete"?"Delete":K===r.id?"Restoring...":"Confirm"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn",onClick:()=>F(null),title:"Cancel",disabled:K!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(a$,{children:[G("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>F({id:r.id,action:"restore"}),title:"Restore this snapshot",disabled:K!==null,children:K===r.id?"Restoring...":"Restore"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>F({id:r.id,action:"delete"}),title:"Delete this snapshot",disabled:K!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},r.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function GP($,v,U,_,g){return $.x<_.position.x+_.size.width+g&&$.x+v+g>_.position.x&&$.y<_.position.y+_.size.height+g&&$.y+U+g>_.position.y}function Iw($,v,U,_,g){return _.some((z)=>GP($,v,U,z,g))}function Yw($,v,U,_,g){return _.find((z)=>GP($,v,U,z,g))}function t0($,v,U,_=24){if($.length===0)return{x:40,y:80};let g=$[$.length-1],z={x:g.position.x+g.size.width+_,y:g.position.y};if(!Iw(z,v,U,$,_))return z;let J=40,b=80,O=3000,K=b;for(let B=0;B<20;B++){let k=J;while(k+v<O){let I=Yw({x:k,y:K},v,U,$,_);if(!I)return{x:k,y:K};k=I.position.x+I.size.width+_}K=$.filter((I)=>I.position.y<=K+U+_&&I.position.y+I.size.height+_>K).reduce((I,H)=>Math.max(I,H.position.y+H.size.height),K)+_}let W=$.reduce((B,k)=>Math.max(B,k.position.y+k.size.height),0);return{x:J,y:W+_}}var mU=null,VO=null,jO=0,i6=null,a0=new Map;function EU($){let v=0;for(let U=0;U<$.length;U++)v=(v<<5)-v+$.charCodeAt(U)|0;return Math.abs(v).toString(36)}function s0($){if(!VO)return $;let v=VO.get($.id);if(!v)return $;return{...$,position:v.position??$.position,size:v.size??$.size,collapsed:v.collapsed??$.collapsed,pinned:v.pinned??$.pinned,dockPosition:v.dockPosition!==void 0?v.dockPosition:$.dockPosition}}var av={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function iU($,v,U,_=null){let g=av[v];return s0({id:$,type:v,position:{x:g.x,y:g.y},size:{width:g.w,height:g.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_,data:U})}function qw(){return t0([...T.value.values()],av.markdown.w,av.markdown.h)}function O4(){if(!T.value.has("status-main"))_6(iU("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function Fw($,v){let U=`md-${EU($)}`;if(T.value.get(U))v$(U,{path:$,title:v}),D$.value=U;else{let g=qw(),z=iU(U,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=g,_6(z),!z.dockPosition)Yv(U)}}function Xw($){if(T.value.get("context-main"))v$("context-main",{cards:$});else if($.length>0){let _=iU("context-main","context",{cards:$});_6(_)}}function ww($){let v=$.url,U=`mcp-${EU(v)}`;if(T.value.get(U))v$(U,$);else _6(iU(U,"mcp-app",$)),Yv(U)}function Aw($){let v=$.toolCallId,_=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(v.startsWith("ext-app-")?v:`ext-app-${v}`);if(T.value.get(_)){v$(_,$);return}let{serverName:z,toolName:J}=$;if(z&&J){for(let[H,Y]of T.value.entries())if(Y.type==="mcp-app"&&Y.data.mode==="ext-app"&&Y.data.serverName===z&&Y.data.toolName===J&&!Y.data.toolResult){v$(H,{...$});return}}let{_x:b,_y:O,_width:K,_height:W}=$,B=av["mcp-app"],k=K??B.w,P=W??B.h,F=b===void 0||O===void 0?t0([...T.value.values()],k,P):null,I=s0({id:_,type:"mcp-app",position:{x:b??F?.x??B.x,y:O??F?.y??B.y},size:{width:k,height:P},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{mode:"ext-app",...$}});if(_6(I),!I.dockPosition)Yv(_,{recordHistory:!1})}function Zw($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(T.value.has(v))return v;let U=`ext-app-${$}`;if(U!==v&&T.value.has(U))return U;for(let[_,g]of T.value.entries())if(g.type==="mcp-app"&&g.data.mode==="ext-app"&&g.data.toolCallId===$)return _;return null}function KP($){let v=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(v&&T.value.has(v))return v;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return Zw($.toolCallId)}function WP($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let U=null;for(let[_,g]of T.value.entries())if(g.type==="mcp-app"&&g.data.mode==="ext-app"&&g.data.serverName===$&&g.data.toolName===v&&!g.data.toolResult){if(U)return null;U=_}return U}function BP($){if(T.value.get("ledger-main"))v$("ledger-main",$);else{let _=iU("ledger-main","ledger",$,"right");_.collapsed=!0,_6(_)}}function PP($){if(!($==="dark"||$==="light"||$==="high-contrast"))return;if(document.documentElement.setAttribute("data-theme",$),Hg(),T$.value!==$)T$.value=$}function Mw($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="image"||$==="html"||$==="group"}function Sw($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function CO($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.x!=="number"||typeof v.y!=="number")return null;return{x:v.x,y:v.y}}function kP($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.width!=="number"||typeof v.height!=="number")return null;return{width:v.width,height:v.height}}function Qw($){let v=CO($),U=kP($);return v&&U?{...v,...U}:null}function Nw($){if(typeof $.id!=="string"||!$.id)return null;if(!Mw($.type))return null;let v=CO($.position),U=kP($.size);if(!v||!U)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,g=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:U,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:g}}function rw($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!Sw($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function uw($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>CO(_)).filter((_)=>_!==null),U=Qw($.bounds);if(v.length<($.type==="text"?1:2)||!U)return null;return{id:$.id,type:$.type,points:v,bounds:U,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}function yw($){if(X4.value=$.sessionId||"",n6.value="connected",typeof $.theme==="string")PP($.theme);if($.ledgerSummary)BP($.ledgerSummary)}function Dw($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,U=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(Fw(v,U),$.ledgerSummary)BP($.ledgerSummary)}function Rw($){O4(),v$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function Tw($){O4(),v$("status-main",{phase:$.phase,detail:$.detail})}function jw($){let v=$.cards??[];Xw(v)}function Vw($){if(typeof $.url==="string"&&$.url)ww({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function Cw($){let v=$.sessions??[];for(let U of v){let _=U.url;if(!_)continue;let g=`mcp-${EU(_)}`;if(T.value.has(g))v$(g,{sessionState:U.state,lastSeenAt:U.lastSeenAt})}}function fw($){if(typeof $.url==="string"&&$.url){let v=`mcp-${EU($.url)}`;if(T.value.has(v))v$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function cw($){let U=T.value.get("context-main");if(!U)return;let _=(U.data.auxTabs??[]).concat($);v$("context-main",{auxTabs:_})}function mw($){if(T.value.has("context-main"))if($.mode==="all")v$("context-main",{auxTabs:[]});else{let _=T.value.get("context-main");if(!_)return;let g=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);v$("context-main",{auxTabs:g})}}function Ew($){O4(),v$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function iw($){O4(),v$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function lw($){O4(),v$("status-main",{activeTool:null})}function hw($){if($.state==="active"&&$.path){let U=`md-${EU($.path)}`;if(T.value.has(U))v$(U,{reviewActive:!0})}}function xw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;Aw({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function pw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=KP($)??WP($.serverName,$.toolName);if(!v)return;if(T.value.has(v))v$(v,{html:$.html})}function ow($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=KP($)??WP($.serverName,$.toolName);if(!v)return;if(T.value.has(v)){if($.success===!1){A4(v);return}v$(v,{toolResult:WO({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function nw($){O4(),v$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function tw($){let v=$.nodeId;if(!v)return;let U=$.text||"",_=$.position,g=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&T.value.has($.threadNodeId)){let J=$.threadNodeId,b=T.value.get(J);if(!b)return;let O=Array.isArray(b.data.turns)?[...b.data.turns]:[],K=O[O.length-1];if(!K||K.role!=="user"||K.text!==U)O.push({role:"user",text:U,status:"pending"});v$(J,{turns:O,threadStatus:"pending"});return}if(!T.value.has(v)){let J=_??av.prompt;_6(s0({id:v,type:"prompt",position:{x:J.x,y:J.y},size:{width:av.prompt.w,height:400},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{text:U,turns:U?[{role:"user",text:U,status:"pending"}]:[],threadStatus:U?"pending":"draft",status:U?"pending":"draft",parentNodeId:g,contextNodeIds:z}})),Yv(v)}if(g&&T.value.has(g))S_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",style:"dashed"})}function dw($){let{nodeId:v,status:U}=$;if(v&&T.value.has(v))v$(v,{status:U})}function aw($){let{responseNodeId:v,promptNodeId:U}=$;if(!v)return;let _=U?T.value.get(U):void 0;if(_&&Array.isArray(_.data.turns)){a0.set(v,U);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),v$(U,{turns:z,threadStatus:"streaming",_activeResponseId:v}),Yv(U);return}let g=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:av.response.x,y:av.response.y};if(!T.value.has(v))_6(s0({id:v,type:"response",position:g,size:{width:av.response.w,height:av.response.h},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{content:"",status:"streaming",promptNodeId:U}}));if(U)S_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",animated:!0});Yv(v)}function sw($){let v=$.responseNodeId;if(!v)return;let U=a0.get(v);if(U){let _=T.value.get(U);if(_&&Array.isArray(_.data.turns)){let g=[..._.data.turns],z=g[g.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";v$(U,{turns:g,threadStatus:"streaming"})}return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"streaming"})}function ew($){let v=$.responseNodeId;if(!v)return;let U=a0.get(v);if(U){let z=T.value.get(U);if(z&&Array.isArray(z.data.turns)){let J=[...z.data.turns],b=J[J.length-1];if(b&&b.role==="assistant")b.text=$.content,b.status="complete";v$(U,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}a0.delete(v);return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"complete"});let g=T.value.get(v)?.data.promptNodeId;if(g){let z=`edge-${g}-${v}`,J=m$.value.get(z);if(J)$K(z),S_({...J,animated:!1})}}function $A($){let v=$.layout;if(!v?.nodes)return;let U=!t6.value;t6.value=!0;let _=v.nodes.map(Nw).filter((b)=>b!==null),g=Array.isArray(v.edges)?v.edges.map(rw).filter((b)=>b!==null):Array.from(m$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(uw).filter((b)=>b!==null):void 0,J=v.viewport?{x:typeof v.viewport.x==="number"?v.viewport.x:0,y:typeof v.viewport.y==="number"?v.viewport.y:0,scale:typeof v.viewport.scale==="number"?v.viewport.scale:1}:void 0;S4(),bK({...J?{viewport:J}:{},nodes:_,edges:g,...z?{annotations:z}:{}},{applyViewport:U}),D2({event:"canvas-layout-update",data:$})}function vA($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function gA($){let v=$.nodeId;if(v&&T.value.has(v)){if($.noPan===!0){A6(v);return}Yv(v)}}function UA($){let v=$.viewport;if(!v)return;let U=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,g=typeof v.scale==="number"?v.scale:1;S4(),_K({x:U,y:_,scale:g})}function _A($){if(T.value.get("context-main"))v$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function zA($){A_.value=$.enabled===!0}function JA($){if(typeof $.theme==="string")PP($.theme)}function bA($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((U)=>typeof U==="string"):[];s3(v),D2({event:"context-pins-changed",data:$})}var d0=null;function OP(){if(d0)clearTimeout(d0);d0=setTimeout(()=>{d0=null,j3().then(($)=>{X6.value=$})},150)}function GA($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;$B(v)}function OA($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)gB(v,typeof $.nodeId==="string"?$.nodeId:void 0);else AO(v)}var KA={connected:yw,"workbench-open":Dw,"canvas-status":Rw,"execution-phase":Tw,"context-cards":jw,"mcp-app-candidate":Vw,"mcp-app-host-snapshot":Cw,"mcp-app-host-fallback":fw,"aux-open":cw,"aux-close":mw,"assistant-complete":Ew,"tool-start":iw,"tool-complete":lw,"review-state":hw,"subagent-status":nw,"ext-app-open":xw,"ext-app-update":pw,"ext-app-result":ow,"context-pins-changed":bA,"canvas-layout-update":$A,"canvas-focus-node":gA,"canvas-viewport-update":UA,"context-usage":_A,"trace-state":zA,"theme-changed":JA,"canvas-prompt-created":tw,"canvas-prompt-status":dw,"canvas-response-start":aw,"canvas-response-delta":sw,"canvas-response-complete":ew,"ax-state-changed":OP,"ax-event-created":OP,"ax-intent":GA,"ax-intent-clear":OA};function fO(){if(VO=OK(),O4(),t6.value=!1,ZK(),UB(),i6)clearTimeout(i6),i6=null;let $=X4.value,v=$?`/api/workbench/events?session=${$}`:"/api/workbench/events";n6.value="connecting";let U=new EventSource(v);mU=U;for(let[_,g]of Object.entries(KA))U.addEventListener(_,(z)=>{try{g(JSON.parse(z.data))}catch(J){console.warn(`[sse-bridge] Failed to parse "${_}" event:`,J)}});return U.onopen=()=>{if(mU!==U)return;jO=0,n6.value="connected"},U.onerror=()=>{if(mU!==U)return;n6.value="disconnected",U.close(),mU=null,jO+=1,i6=setTimeout(()=>{i6=null,fO()},vA(jO))},()=>{if(i6)clearTimeout(i6),i6=null;U.close(),mU=null}}function WA($,v){console.error(`[app] ${$} failed`,v)}function HP($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((U)=>{WA("sendIntent",U)})}function Jv({label:$,detail:v,shortcut:U,align:_="center",children:g}){return G("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[g,G("span",{class:"toolbar-tooltip",role:"tooltip",children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||U)&&G("span",{class:"toolbar-tooltip-meta",children:[v&&G("span",{children:v},void 0,!1,void 0,this),U&&G("kbd",{class:"toolbar-tooltip-shortcut",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function BA({minimapVisible:$,onToggleMinimap:v,snapshotOpen:U,onToggleSnapshot:_,snapshotBtnRef:g,onOpenPalette:z,onOpenShortcuts:J,annotationTool:b,onToggleAnnotationMode:O,onToggleAnnotationEraser:K,onToggleTextAnnotation:W}){let B=n6.value,k=t6.value,P=P$.value,F=T.value.size,I=m$.value.size,H=A_.value,Y=Array.from(T.value.values()).filter((C)=>C.type==="trace").length,q=B==="connected"&&!k?"syncing":B,w=q.charAt(0).toUpperCase()+q.slice(1),N=k?[`${F} node${F!==1?"s":""}`,...I>0?[`${I} edge${I!==1?"s":""}`]:[],...Y>0?[`${Y} trace${Y!==1?"s":""}`]:H?["trace armed"]:[]].join(" · "):"Syncing canvas…";return G("div",{class:"toolbar-group",children:[G("div",{class:"canvas-toolbar",children:[G(Jv,{label:"PMX Canvas",detail:"Focus Field · spatial workbench for coding agents",align:"start",children:G("span",{class:"canvas-brand","aria-label":"PMX Canvas",children:G(wB,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Canvas status",detail:k?w:"Syncing canvas from server",align:"start",children:G("span",{class:`connection-dot ${B}`,"aria-label":`Canvas status: ${q}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"11px",color:"var(--c-muted)"},children:X4.value?X4.value.slice(0,12):"…"},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Fit canvas",detail:"Frame every node on screen",children:G("button",{type:"button",onClick:()=>N_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:G(JB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Reset view",shortcut:`${Sv}+0`,children:G("button",{type:"button",onClick:()=>lv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:G(bB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom in",shortcut:`${Sv}++`,children:G("button",{type:"button",onClick:()=>lv({...P,scale:Math.min(4,P.scale*1.25)},150),"aria-label":"Zoom in",children:G(GB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom out",shortcut:`${Sv}+-`,children:G("button",{type:"button",onClick:()=>lv({...P,scale:Math.max(0.1,P.scale/1.25)},150),"aria-label":"Zoom out",children:G(OB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)",minWidth:"36px",textAlign:"center"},children:[Math.round(P.scale*100),"%"]},void 0,!0,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Arrange layout",detail:I>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:G("button",{type:"button",onClick:()=>I>0?u_():r_(),"aria-label":"Arrange layout",children:G(KB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:$?"Hide minimap":"Show minimap",detail:"Quickly navigate large canvases",children:G("button",{type:"button",onClick:v,"aria-label":$?"Hide minimap":"Show minimap",style:{color:$?"var(--c-accent)":void 0},children:G(WB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:`Switch to ${T$.value==="dark"?"light":"dark"} theme`,detail:`Current theme: ${T$.value}`,children:G("button",{type:"button",onClick:()=>{let C=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",C),Hg(),T$.value=C,I_(C)},"aria-label":`Switch to ${T$.value==="dark"?"light":"dark"} theme`,children:T$.value==="dark"?G(BB,{},void 0,!1,void 0,this):G(PB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Snapshots",detail:"Capture and restore canvas states",align:"end",children:G("button",{ref:g,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:U?"var(--c-accent)":void 0},children:G(IB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"canvas-toolbar",children:[G(Jv,{label:H?"Disable trace":"Enable trace",detail:H?"Stop collecting new trace nodes":"Capture agent execution on the canvas",children:G("button",{type:"button",onClick:()=>HP("trace-toggle",{enabled:!H}),"aria-label":H?"Disable trace":"Enable trace",style:{color:H?"var(--c-purple)":void 0},children:G(YB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||Y>0)&&G(Jv,{label:"Clear trace",detail:Y>0?`Remove ${Y} trace node${Y===1?"":"s"}`:"Trace is enabled but still empty",children:G("button",{type:"button",onClick:()=>HP("trace-clear"),"aria-label":"Clear trace",children:G(qB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:b==="pen"?"Stop annotating":"Annotate canvas",detail:"Draw directly on the canvas for human-visible markup",children:G("button",{type:"button",onClick:O,"aria-label":b==="pen"?"Stop annotating":"Annotate canvas","aria-pressed":b==="pen",style:{color:b==="pen"?"var(--c-accent)":void 0},children:G(kB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="eraser"?"Stop erasing":"Erase annotations",detail:"Click a drawn annotation to remove it",children:G("button",{type:"button",onClick:K,"aria-label":b==="eraser"?"Stop erasing":"Erase annotations","aria-pressed":b==="eraser",style:{color:b==="eraser"?"var(--c-accent)":void 0},children:G(HB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="text"?"Stop text annotations":"Text annotations",detail:"Click anywhere to type an intent note",children:G("button",{type:"button",onClick:W,"aria-label":b==="text"?"Stop text annotations":"Text annotations","aria-pressed":b==="text",style:{color:b==="text"?"var(--c-accent)":void 0},children:G(LB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Search nodes and actions",shortcut:`${Sv}+K`,children:G("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:G(FB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Keyboard shortcuts",shortcut:"?",align:"end",children:G("button",{type:"button",onClick:J,"aria-label":"Keyboard shortcuts",children:G(XB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)"},children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function PA({onOpenPalette:$}){return G("div",{class:"welcome-card",children:[G("div",{class:"welcome-icon",children:"◇"},void 0,!1,void 0,this),G("div",{class:"welcome-title",children:"Shape What The Agent Sees"},void 0,!1,void 0,this),G("div",{class:"welcome-subtitle",children:"Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The board will reflect the active focus."},void 0,!1,void 0,this),G("div",{class:"welcome-hints",children:[G("button",{type:"button",class:"welcome-hint",onClick:$,children:[G("kbd",{children:[Sv,"+K"]},void 0,!0,void 0,this),G("span",{children:"Create a note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Drop files"},void 0,!1,void 0,this),G("span",{children:"Add evidence to the board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"✦"},void 0,!1,void 0,this),G("span",{children:"Pin important nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Move nearby"},void 0,!1,void 0,this),G("span",{children:"Shape the focus field"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-footer",children:"The canvas is a shared attention surface, not just an editor."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LP(){let[$,v]=o(!0),[U,_]=o(!1),[g,z]=o(!1),[J,b]=o(!1),[O,K]=o(null),W=y(null),{menu:B,openNodeMenu:k,openCanvasMenu:P,closeMenu:F}=nB(),I=t6.value,H=S(()=>v((u)=>!u),[]),Y=S(()=>_((u)=>!u),[]),q=S(()=>_(!1),[]),w=S(()=>K((u)=>u==="pen"?null:"pen"),[]),N=S(()=>K((u)=>u==="eraser"?null:"eraser"),[]),C=S(()=>K((u)=>u==="text"?null:"text"),[]),p=S((u,Q)=>{lv({x:u,y:Q,scale:P$.value.scale},200)},[]);c(()=>{return fO()},[]),c(()=>{let u=(Q)=>{let g$=Q.metaKey||Q.ctrlKey;if(g$&&Q.key==="k"){Q.preventDefault(),z((i)=>!i);return}if(Q.key==="Escape"&&O){Q.preventDefault(),K(null);return}if(Q.key==="Escape"&&j$.value&&!iv.value){Q.preventDefault(),d6();return}if(Q.key==="Escape"&&g){Q.preventDefault(),z(!1);return}if(Q.key==="Escape"&&J){Q.preventDefault(),b(!1);return}let m=Q.target?.tagName;if(m==="INPUT"||m==="TEXTAREA")return;if(Q.key==="?"||Q.key==="/"&&Q.shiftKey){Q.preventDefault(),b((i)=>!i);return}if(g$&&Q.key==="0")Q.preventDefault(),lv({x:0,y:0,scale:1},250);else if(g$&&(Q.key==="="||Q.key==="+")){Q.preventDefault();let i=P$.value;lv({...i,scale:Math.min(4,i.scale*1.25)},150)}else if(g$&&Q.key==="-"){Q.preventDefault();let i=P$.value;lv({...i,scale:Math.max(0.1,i.scale/1.25)},150)}else if(Q.key==="Escape"){if(i$.value.size>0){jv();return}D$.value=null,F()}else if(Q.key==="Tab")Q.preventDefault(),KK(Q.shiftKey?-1:1);else if(D$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(Q.key)){Q.preventDefault();let i=Q.key.replace("Arrow","").toLowerCase();WK(i)}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[O,F,g,J]),c(()=>{if(!I)return;let u=window.__pmxCanvasBootstrapReady;if(typeof u==="function")u()},[I]);let r=Array.from(T.value.values()),n=r.filter((u)=>u.dockPosition==="left"),e=r.filter((u)=>u.dockPosition==="right").sort((u,Q)=>{let g$={context:0,ledger:1};return(g$[u.type]??2)-(g$[Q.type]??2)});return G("div",{style:{width:"100%",height:"100%",position:"relative"},children:[G("div",{class:"hud-layer",children:[G("div",{class:"hud-left",children:n.map((u)=>G(TO,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this),G(BA,{minimapVisible:$,onToggleMinimap:H,snapshotOpen:U,onToggleSnapshot:Y,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>b((u)=>!u),annotationTool:O,onToggleAnnotationMode:w,onToggleAnnotationEraser:N,onToggleTextAnnotation:C},void 0,!1,void 0,this),G("div",{class:"hud-right",children:e.map((u)=>G(TO,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(PK,{},void 0,!1,void 0,this),G(BK,{},void 0,!1,void 0,this),G(pB,{onNodeContextMenu:k,onCanvasContextMenu:P,annotationMode:O!==null,annotationTool:O},void 0,!1,void 0,this),I&&r.filter((u)=>!u.dockPosition).length===0&&Iv.value.size===0&&G(PA,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),i$.value.size>0&&G(zP,{},void 0,!1,void 0,this),R$.value.size>0&&G(aB,{},void 0,!1,void 0,this),j$.value&&G(gP,{},void 0,!1,void 0,this),G(bP,{open:U,onClose:q,anchorRef:W},void 0,!1,void 0,this),$&&G(_P,{viewport:P$,nodes:T,edges:m$,onNavigate:p,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&G(tB,{menu:B,onClose:F},void 0,!1,void 0,this),g&&G(oB,{onClose:()=>z(!1),onToggleMinimap:H},void 0,!1,void 0,this),J&&G(JP,{onClose:()=>b(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var IP=document.getElementById("app");if(IP)g3(G(LP,{},void 0,!1,void 0,this),IP);
225
+ </script>`}function $w($,v){return`<script data-pmx-canvas-boot-beacon>
226
+ window.parent.postMessage({ source: '${_z}', token: ${JSON.stringify($)}, nodeId: ${JSON.stringify(v)} }, '*');
227
+ </script>`}function nW(){return"<style data-pmx-canvas-ext-app-base>html, body { background: transparent !important; }</style>"}function tW($,v){if(!v)return $;let g=/<head\b[^>]*>/i.exec($);if(g?.index!==void 0){let U=g.index+g[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let U=_.index+_[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}return`${v}${$}`}function LU($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function Z3($,v){let g=$?.getBoundingClientRect();return{width:LU($?.clientWidth??0,LU(g?.width??0,v.width)),height:LU($?.clientHeight??0,LU(g?.height??0,v.height))}}function vw($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function Uw($,v){return Math.max(LU($,1),LU(v,1))}function dW({node:$,expanded:v=!1}){let g=y(null),_=y(null),U=y(null),z=y(null),J=y({}),b=y(void 0),O=y(!1),K=y(void 0),W=y(null),B=y(!1),k=y(null),P=y(!1),X=y(0),Y=y(!1),H=y(!1),L=y([]),q=y(!1),F=y(!1),N=y(!1),[C,p]=o("loading"),[r,n]=o(null),[e,u]=o(0),S=$.data.html,U$=$.data.serverName,c=$.data.appSessionId,i=$.data.toolInput??{},H$=$.data.toolResult,q$=$.data.toolName??"ext-app",h$=$.data.toolDefinition,M=$.data.toolCallId,h=typeof M==="string"||typeof M==="number"?M:void 0,s=$.data.resourceMeta,d=$.data.sessionStatus,b$=$.data.sessionError,g$=$.size.height,l=$.id,f=dX($,e),a=H$!=null,G$=sX(null),V$=$.data.axCapabilities?.enabled===!0&&typeof S==="string"&&S.length>0,C$=n$(()=>`ax-${crypto.randomUUID()}`,[]),Kv=V$?eX(C$,l):"",Wv=typeof S==="string"&&S.length>0?$w(C$,l):"",k6=xW(tW(S??"",nW()+Wv+Kv),G$);m(()=>{function W$(r$){if(r$.source!==g.current?.contentWindow)return;let p$=r$.data;if(!p$||p$.source!==_z||p$.token!==C$||p$.nodeId!==l)return;H.current=!0}return window.addEventListener("message",W$),()=>window.removeEventListener("message",W$)},[C$,l]),YU({enabled:V$,token:C$,nodeId:l,sourceSurface:"mcp-app",iframeRef:g});let dg=3,H6=(W$)=>{if(X.current>=dg){B4(l,`remount-cap-hit (${W$})`);return}if(q.current)return;X.current+=1,q.current=!0,B4(l,`remount-queued #${X.current} (${W$})`),nX({remount:()=>{if(q.current=!1,N.current||j$.value===l)return B4(l,"remount-skipped"),!1;return F.current=typeof document<"u"&&document.visibilityState==="hidden",B4(l,`remount-run #${X.current}`),p("loading"),u((r$)=>r$+1),!0},awaitBoot:()=>new Promise((r$)=>{let p$=window.setTimeout(bv,pX);function bv(){window.clearTimeout(p$),r$()}L.current.push(bv)})})};m(()=>{if(v||P.current)return;if(!tX(C,a))return;if(typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;P.current=!0,H6("post-boot-repaint")},[C,a]),m(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;function W$(){if(document.visibilityState!=="visible")return;if(!F.current||N.current)return;F.current=!1,X.current=0,B4(l,"visible-again-rearm"),H6("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",W$),()=>document.removeEventListener("visibilitychange",W$)},[v,l]);let ag=6000;m(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;if(!k6.ready)return;let W$=window.setTimeout(()=>{if(Y.current||H.current||N.current)return;H6("boot-watchdog")},ag);return()=>window.clearTimeout(W$)},[f,k6.ready,v]),m(()=>()=>{N.current=!0;for(let W$ of L.current.splice(0))W$()},[]);let sv=(W$)=>W$==="light"?"light":"dark",Av=v||j$.value===l;J.current=i,b.current=H$;let uU=d==="error"?b$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",J2=(W$)=>{let r$=b.current;if(!W$||!B.current||!r$)return null;if(K.current===r$)return null;if(K.current&&EW(K.current,r$))return K.current=r$,null;if(W.current)return W.current;let p$=W$.sendToolResult(r$).then(()=>{K.current=r$,O.current=!0,p("done")}).catch((bv)=>{let I6=bv instanceof Error?bv.message:String(bv);throw n(`Tool result delivery failed: ${I6}`),bv}).finally(()=>{W.current=null});return W.current=p$,p$};if(m(()=>{if(!S||!k6.ready)return;let W$=g.current;if(!W$)return;let r$=!1,p$=null,bv=null,I6=null,t6=null;O.current=!1,K.current=void 0,W.current=null,B.current=!1,Y.current=!1,H.current=!1;let sg=()=>{if(!p$)return;clearTimeout(p$),p$=null};return(async()=>{if(!S)return;let Y6=W$.contentWindow;if(!Y6)throw Error("Ext-app iframe window is unavailable");let d6=(I$=j$.value===l?"fullscreen":"inline")=>({theme:sv(T$.value),platform:"web",containerDimensions:Z3(W$,{width:$.size.width,height:g$}),displayMode:I$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...h$?{toolInfo:{id:h,tool:h$}}:{}}),rP=()=>{if(I6!==null)return;I6=requestAnimationFrame(()=>{if(I6=null,r$||!B.current)return;u$.setHostContext?.(d6())})},n3=()=>{if(t6!==null)return;t6=requestAnimationFrame(()=>{t6=requestAnimationFrame(()=>{if(t6=null,r$||!B.current)return;u$.sendHostContextChange?.(d6())})})},u$=new L3(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:d6(Av?"fullscreen":"inline")});u$.onsizechange=async({height:I$})=>{if(vw(I$,j$.value===l)){let Bv=Z3(W$.parentElement??W$,{width:$.size.width,height:g$}),cv=Uw(I$,Bv.height);W$.style.height=`${cv}px`;let a6=T.value.get(l)?.size??$.size,d3=Math.max(a6.height,cv+I5);if(Math.abs(d3-a6.height)>8){if(N4(l,{width:a6.width,height:d3}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{t$({recordHistory:!1}),z.current=null},0)}}return{}},u$.onopenlink=async({url:I$})=>{return window.open(I$,"_blank","noopener"),{}},u$.onsandboxready=async()=>{await u$.sendSandboxResourceReady({html:tW(S,nW()),sandbox:w3,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},u$.onrequestdisplaymode=async({mode:I$})=>{let{nextMode:Bv,shouldExpand:cv,shouldCollapse:a6}=aX(I$,Av);if(cv)z6(l);else if(a6)v4();return{mode:Bv}},u$.oncalltool=async(I$)=>{if(!c)throw Error(uU);try{let Bv=await W4("/api/ext-app/call-tool",{sessionId:c,nodeId:l,serverName:U$,toolName:I$.name,arguments:I$.arguments??{}});return n(null),Bv}catch(Bv){let cv=Bv instanceof Error?Bv.message:String(Bv);throw n(`Tool call failed: ${cv}`),Bv}},u$.setRequestHandler(Vg,async()=>{if(!c)return{tools:[]};return W4("/api/ext-app/list-tools",{sessionId:c})}),u$.onlistresources=async()=>c?W4("/api/ext-app/list-resources",{sessionId:c}):{resources:[]},u$.onlistresourcetemplates=async()=>c?W4("/api/ext-app/list-resource-templates",{sessionId:c}):{resourceTemplates:[]},u$.onreadresource=async(I$)=>{if(!c)throw Error(uU);return W4("/api/ext-app/read-resource",{sessionId:c,uri:I$.uri})},u$.onlistprompts=async()=>c?W4("/api/ext-app/list-prompts",{sessionId:c}):{prompts:[]},u$.onupdatemodelcontext=async(I$)=>{if(!c)return{};return await W4("/api/ext-app/model-context",{nodeId:l,...Array.isArray(I$.content)?{content:I$.content}:{},...I$.structuredContent&&typeof I$.structuredContent==="object"?{structuredContent:I$.structuredContent}:{}}),{}};let b2=new l0(Y6,Y6);if(u$.oninitialized=()=>{if(r$)return;sg(),B.current=!0,Y.current=!0,B4(l,"initialized"),p("ready"),n(null),Promise.resolve(u$.sendHostContextChange(d6(Av?"fullscreen":"inline"))).then(()=>oW(u$,J.current,void 0)).then(()=>J2(u$)).then(()=>{B4(l,"settled");for(let I$ of L.current.splice(0))I$();n3()}).catch((I$)=>{let Bv=I$ instanceof Error?I$.message:String(I$);n(`Bridge bootstrap failed: ${Bv}`)})},p$=setTimeout(()=>{if(r$||B.current)return;let I$=b.current,Bv=d6(Av?"fullscreen":"inline");B.current=!0,u$.setHostContext?.(Bv),Promise.resolve(u$.sendHostContextChange(Bv)).then(()=>oW(u$,J.current,I$)).then(()=>{if(O.current=Boolean(I$),I$)K.current=I$;p(I$?"done":"ready"),n(null),n3()}).catch((cv)=>{let a6=cv instanceof Error?cv.message:String(cv);n(`Bridge bootstrap fallback failed: ${a6}`)})},1200),await u$.connect(b2),r$){sg(),await b2.close();return}if(_.current=u$,U.current=b2,bv=new ResizeObserver(rP),bv.observe(W$),W$.parentElement)bv.observe(W$.parentElement);let t3=!0;k.current=T$.subscribe((I$)=>{if(t3){t3=!1;return}if(r$)return;u$.setHostContext?.({...d6(),theme:sv(I$)}),u$.sendHostContextChange?.(d6())}),J2(u$)})().catch((Y6)=>{sg(),console.error("[ext-app] Bridge init failed:",Y6),n(Y6?.message??"Bridge initialization failed")}),()=>{if(r$=!0,sg(),bv?.disconnect(),bv=null,I6!==null)cancelAnimationFrame(I6),I6=null;if(t6!==null)cancelAnimationFrame(t6),t6=null;if(B.current=!1,W.current=null,k.current?.(),k.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(_.current=null,U.current)U.current.close().catch((Y6)=>{console.error("[ext-app] transport close failed:",Y6)}),U.current=null}},[f,k6.key]),m(()=>{if(H$&&_.current&&(C==="ready"||C==="done"))J2(_.current)},[H$,C]),m(()=>{let W$=_.current;if(g.current)g.current.style.height="100%";if(!W$||!B.current)return;let r$=null,p$=null;return r$=requestAnimationFrame(()=>{r$=null,p$=requestAnimationFrame(()=>{if(p$=null,!B.current)return;let bv={theme:sv(T$.value),platform:"web",containerDimensions:Z3(g.current,{width:$.size.width,height:g$}),displayMode:Av?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};W$.setHostContext?.(bv),W$.sendHostContextChange?.(bv)})}),()=>{if(r$!==null)cancelAnimationFrame(r$);if(p$!==null)cancelAnimationFrame(p$)}},[Av,g$]),!S)return G("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[G("div",{style:{opacity:0.6},children:["Loading ",q$," viewer..."]},void 0,!0,void 0,this),G("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[d&&d!=="ready"&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:d==="error"?"var(--c-danger-12)":"var(--c-warn-10)",color:d==="error"?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${d==="error"?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:uU},void 0,!1,void 0,this),r&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{style:{flex:1},children:r},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>{n(null),p("loading"),u((W$)=>W$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>n(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[G("iframe",{ref:g,...k6.attributes,sandbox:G$,allow:cW(s?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:Av&&C!=="loading"?"auto":"none"},title:`Ext App: ${q$}`},f,!1,void 0,this),C==="loading"&&!r&&G("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[G("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("div",{children:["Connecting to ",q$,"..."]},void 0,!0,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!Av&&G("button",{type:"button",onClick:(W$)=>{W$.stopPropagation(),z6(l)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function x0($,v,g){let _=y($);_.current=$;let U=y(null);m(()=>{if(!g)return;function z(J){if(J.source!==v.current?.contentWindow)return;let b=J.data;if(!b||b.source!=="pmx-canvas-frame"||b.type!=="content-height"||b.token!==g)return;let O=_.current,K=typeof b.height==="number"?b.height:0,W=q5(O,K);if(W===null)return;if(N4(O.id,{width:O.size.width,height:W}),U.current!==null)window.clearTimeout(U.current);U.current=window.setTimeout(()=>{t$({recordHistory:!1}),U.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),U.current!==null)window.clearTimeout(U.current),U.current=null}},[$.id,g])}function gw($,v,g,_,U,z,J){if(!$)return $;try{let b=new URL($,window.location.origin);if(b.searchParams.set("theme",T$.value==="light"?"light":"dark"),v)b.searchParams.set("display","expanded");if(typeof g==="number")b.searchParams.set("v",String(g));if(_)b.searchParams.set("axToken",_);if(U)b.searchParams.set("axNodeId",U);if(z)b.searchParams.set("frameToken",z);if(J)b.searchParams.set("fit","content");return b.toString()}catch{return $}}function _w($,v=window.location.origin){if(!$)return!1;try{let g=new URL(v).origin,_=new URL($,g);return _.origin===g&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function l6({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return G(dW,{node:$,expanded:v},void 0,!1,void 0,this);return G(zw,{node:$,expanded:v},void 0,!1,void 0,this)}function zw({node:$,expanded:v}){let g=y(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",U=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,b=(U||_)&&(_?z===!0:z!==!1),O=_?"mcp-app":"json-render",K=n$(()=>b?`ax-${crypto.randomUUID()}`:"",[b]),W=Jz($)&&!v,B=n$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);x0($,g,B),YU({enabled:b&&Boolean(K),token:K,nodeId:$.id,sourceSurface:O,iframeRef:g});let k=A6.value,P=()=>{if(!b||!K||k==null)return;g.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:K,state:k},"*")};m(P,[b,K,k]);let X=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,Y=gw($.data.url||"",v,X,K||void 0,b?$.id:void 0,B||void 0,W),H=$.data.sourceServer||"",L=$.data.hostMode||"hosted",q=$.data.fallbackReason,F=$.data.trustedDomain===!0||_w(Y);if(L==="fallback")return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&G("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",q]},void 0,!0,void 0,this),G("a",{href:Y,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:Y},void 0,!1,void 0,this),H&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",H]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",display:"flex",flexDirection:"column",...v?{flex:1,minHeight:0,width:"100%"}:{}},children:[!F&&G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),G("iframe",{ref:g,src:Y,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:"lazy",onLoad:P,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${H}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Eg=null;function d$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function h0(){if(Eg)return Eg;return Eg={bg:d$("--c-bg"),panel:d$("--c-panel"),panelSoft:d$("--c-panel-soft"),line:d$("--c-line"),text:d$("--c-text"),textSoft:d$("--c-text-soft"),muted:d$("--c-muted"),dim:d$("--c-dim"),accent:d$("--c-accent"),ok:d$("--c-ok"),warn:d$("--c-warn"),warnAlt:d$("--c-warn-alt"),danger:d$("--c-danger"),purple:d$("--c-purple"),thinking:d$("--c-thinking"),subagent:d$("--c-subagent"),font:d$("--font"),mono:d$("--mono")},Eg}function qU(){Eg=null}var p0={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function M3($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let g=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(g)return g;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function XU({node:$}){let v=M3($),g=$.data.detail||"",_=$.data.message||"",U=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,b=p0[v]??"var(--c-muted)",O=v!=="idle";return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[G("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:b,boxShadow:O?`0 0 8px ${b}`:"none",animation:O?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{fontWeight:600,color:b,textTransform:"uppercase",letterSpacing:"0.05em"},children:v},void 0,!1,void 0,this),g&&G("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[G("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),G("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&J.state!=="completed"&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[G("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),G("span",{children:J.name},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",J.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_&&G("div",{style:{color:U==="warn"?"var(--c-warn)":U==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wU($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function aW($){if(typeof $==="string"){let U=wU($);return U?{title:"Evidence warning",detail:U}:null}if(!$||typeof $!=="object")return null;let v=$,g=wU(v.title)??"Evidence warning",_=wU(v.detail);return _?{title:g,detail:_}:null}function Jw($){let v=[],g=aW($.data.warning);if(g)v.push(g);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=aW(z);if(J)v.push(J)}let U=wU($.data.validationStatus)?.toLowerCase();if(U==="failed"||U==="invalid")v.push({title:"Image failed validation",detail:wU($.data.validationMessage)??"Review this image before using it as evidence."});return v}function bw($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((g)=>wU(g)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((g)=>v.includes(g))}function sW($){let v=Jw($);if(v.length>0)return v;if(bw($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function o0({node:$,expanded:v=!1}){let g=$.data.src||"",_=$.data.alt||$.data.title||"Image",U=$.data.caption||"",z=sW($),J=g.startsWith("data:")||g.startsWith("http://")||g.startsWith("https://")?g:`/api/canvas/image/${$.id}`,[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(1),[P,X]=o({x:0,y:0}),[Y,H]=o({w:0,h:0}),L=y(null),q=y(!1),F=y({x:0,y:0}),N=Q((c)=>{let i=c.target;H({w:i.naturalWidth,h:i.naturalHeight}),O(!0),W(!1)},[]),C=Q(()=>{W(!0),O(!1)},[]);m(()=>{k(1),X({x:0,y:0})},[g]);let p=Q((c)=>{c.preventDefault(),c.stopPropagation();let i=c.deltaY>0?0.9:1.1;k((H$)=>Math.max(0.25,Math.min(10,H$*i)))},[]),r=Q((c)=>{if(B<=1)return;c.stopPropagation(),q.current=!0,F.current={x:c.clientX,y:c.clientY},c.target.setPointerCapture(c.pointerId)},[B]),n=Q((c)=>{if(!q.current)return;let i=c.clientX-F.current.x,H$=c.clientY-F.current.y;F.current={x:c.clientX,y:c.clientY},X((q$)=>({x:q$.x+i,y:q$.y+H$}))},[]),e=Q(()=>{q.current=!1},[]),u=Q(()=>{k(1),X({x:0,y:0})},[]);if(!g)return G("div",{class:"image-node-empty",children:[G("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),G("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let S=Y.w>0?`${Y.w}×${Y.h}`:"",U$=Math.round(B*100);return G("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:L,children:[z.length>0&&G("div",{class:"image-node-warning-stack",children:z.map((c)=>G("div",{class:"image-node-warning",children:[G("span",{class:"image-node-warning-title",children:c.title},void 0,!1,void 0,this),G("span",{class:"image-node-warning-detail",children:c.detail},void 0,!1,void 0,this)]},`${c.title}-${c.detail}`,!0,void 0,this))},void 0,!1,void 0,this),G("div",{class:"image-node-viewport",onWheel:p,onPointerDown:r,onPointerMove:n,onPointerUp:e,style:{cursor:B>1?"grab":"default"},children:[!b&&!K&&G("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),K&&G("div",{class:"image-node-error",children:[G("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),G("div",{children:"Failed to load image"},void 0,!1,void 0,this),G("div",{class:"image-node-error-path",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("img",{src:J,alt:_,onLoad:N,onError:C,draggable:!1,style:{transform:`translate(${P.x}px, ${P.y}px) scale(${B})`,opacity:b?1:0,display:K?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(U||S||B!==1)&&G("div",{class:"image-node-footer",children:[U&&G("span",{class:"image-node-caption",children:U},void 0,!1,void 0,this),G("span",{class:"image-node-meta",children:[S&&G("span",{children:S},void 0,!1,void 0,this),B!==1&&G("button",{type:"button",class:"image-node-zoom-reset",onClick:u,title:"Reset zoom",children:[U$,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function eW({node:$}){let v=$.data.children??[],g=T.value,_=v.filter((b)=>g.has(b)),U=_.length,z={};for(let b of _){let O=g.get(b);if(O)z[O.type]=(z[O.type]??0)+1}let J=Object.entries(z).map(([b,O])=>`${O} ${b}`).join(", ");return G("div",{class:"group-node-body",children:[G("div",{class:"group-summary",children:[G("span",{class:"group-child-count",children:[U," node",U!==1?"s":""]},void 0,!0,void 0,this),J&&G("span",{class:"group-type-summary",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U===0&&G("div",{class:"group-empty-hint",children:"Drag nodes here or use the selection bar to group nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Gw($){try{return new URL($).host}catch{return $}}function Ow($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function n0({node:$,expanded:v=!1}){let g=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",U=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",J=typeof $.data.status==="string"?$.data.status:"idle",b=typeof $.data.error==="string"?$.data.error:"",O=Ow(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),K=typeof $.data.statusCode==="number"?$.data.statusCode:null,W=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",B=$.data.frameBlocked===!0,k=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[P,X]=o(!1),[Y,H]=o(v);m(()=>{if(v)H(!0)},[v]);let L=Q(async()=>{if(!g||P)return;X(!0);try{await M_($.id)}finally{X(!1)}},[$.id,P,g]);if(!g)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let q=J==="ready"?"var(--c-ok)":J==="error"?"var(--c-danger)":"var(--c-warn)";return G("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[G("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[G("div",{style:{minWidth:0,flex:1},children:[G("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:Gw(g)},void 0,!1,void 0,this),G("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||g},void 0,!1,void 0,this),G("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:q,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[G("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:q}},void 0,!1,void 0,this),J]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(U||W)&&G("div",{style:{display:"grid",gridTemplateColumns:W&&v?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[W&&v&&G("img",{src:W,alt:_||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),U&&G("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[G("button",{type:"button",onClick:L,disabled:P,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:P?"progress":"pointer",fontSize:"12px"},children:P||J==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),v&&!B&&G("button",{type:"button",onClick:()=>H((F)=>!F),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:Y?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>window.open(g,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),G("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:k||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&Y&&!B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),G("iframe",{class:"webpage-node-iframe",title:_||$.data.title||g,src:g,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:v?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(O||K!==null)&&G("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[O&&G("span",{children:["Fetched ",O]},void 0,!0,void 0,this),K!==null&&G("span",{children:["HTTP ",K]},void 0,!0,void 0,this),B&&G("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&G("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:b},void 0,!1,void 0,this),G("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:v?"14px":"10px"},children:z?G("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:v?"14px":"12px"},children:z},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:J==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $B($){let v=5381;for(let g=0;g<$.length;g+=1)v=(v<<5)+v+$.charCodeAt(g)|0;return(v>>>0).toString(36)}function Q3($,v={}){let g=new URLSearchParams;if(g.set("theme",v.theme??T$.value),v.themeToken)g.set("themeToken",v.themeToken);if(v.present)g.set("present","1");if(v.presentToken)g.set("presentToken",v.presentToken);if(v.v)g.set("v",v.v);if(v.axToken)g.set("axToken",v.axToken);if(v.frameToken)g.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${g.toString()}`}function t0($){return iW($.type,$.data)}async function d0($){let v=Q3($.id);if(!(await hO($.id,v)).opened)window.open(v,"_blank","noopener")}function vB($){return $.type==="html"&&$.data.presentation===!0}function ig({node:$,expanded:v=!1,presentation:g=!1,presentationExitToken:_,autoFocus:U=!1}){let z=y(null),J=T$.value,b=n$(()=>`theme-${crypto.randomUUID()}`,[]),O=n$(()=>`ax-${crypto.randomUUID()}`,[]),K=n$(()=>`frame-${crypto.randomUUID()}`,[]),W=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",B=n$(()=>$B(W),[W]),k=n$(()=>W?Q3($.id,{theme:J,themeToken:b,present:g,presentToken:_,v:B,axToken:O,frameToken:K}):"",[W,g,_,b,B,$.id,O,K]);x0($,z,v?"":K),YU({enabled:!0,token:O,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),m(()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:b,theme:J},"*"),U)z.current?.focus()},[J,b]);let P=$.data.axCapabilities,X=P?.enabled===!0&&(!Array.isArray(P.allowed)||P.allowed.length>0),Y=A6.value;m(()=>{if(!X||Y==null)return;z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:O,state:Y},"*")},[X,Y,O]),m(()=>{if(!U)return;let L=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(L)},[U,k]);let H=()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:b,theme:J},"*"),X&&A6.value!=null)z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:O,state:A6.value},"*");if(U)z.current?.focus()};if(!W)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return G("iframe",{ref:z,class:g?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",src:k,tabIndex:U?0:void 0,onLoad:H,style:{width:"100%",height:"100%",minHeight:g?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:g?0:"6px",display:"block"}},void 0,!1,void 0,this)}var S3=null;async function UB(){if(!S3)S3=await EO();return S3}function gB($,v){if(!$)return null;let g=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===g);if(_)return _.name;let U=v.filter((z)=>z.name.toLowerCase().startsWith(g));return U.length===1?U[0].name:null}function Kw($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function Ww({html:$}){let v=y(null);return m(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function Bw($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function _B({count:$}){if($===0)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function zB({message:$,onDismiss:v}){if(!$)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[G("span",{style:{flex:1},children:$},void 0,!1,void 0,this),G("button",{type:"button",onClick:v,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function a0({node:$,expanded:v=!1}){let g=Array.isArray($.data.turns)?$.data.turns:[],_=g.length===0,U=$.data.text||"",z=$.data.status||"draft",J=_?z:$.data.threadStatus||"draft",b=J==="draft",O=J==="pending"||J==="sending",K=J==="streaming",W=J==="answered",[B,k]=o(""),[P,X]=o(""),[Y,H]=o(null),[L,q]=o(new Map),F=y(null),N=y(null),C=g[g.length-1],p=`${g.length}:${C?.role??""}:${C?.status??""}:${Math.floor((C?.text?.length??0)/200)}`;m(()=>{if(v&&b&&F.current)F.current.focus()},[v,b]),m(()=>{if(!p)return;if(N.current)N.current.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},[p]);let r=y(null),n=y(g);n.current=g,m(()=>{let i=g.some((q$)=>q$.role==="assistant"&&q$.status==="streaming"),H$=()=>{let q$=!1,M=n.current.map((h,s)=>({turn:h,index:s})).filter(({turn:h})=>h.role==="assistant"&&h.text);if(M.length===0)return;return Promise.all(M.map(async({turn:h,index:s})=>{let d=await g6(h.text);return{index:s,html:Kw(d)}})).then((h)=>{if(q$)return;let s=new Map;for(let d of h)s.set(d.index,d.html);q(s)}),()=>{q$=!0}};if(!i){if(r.current)clearTimeout(r.current),r.current=null;return H$()}if(r.current)clearTimeout(r.current);return r.current=setTimeout(()=>{r.current=null,H$()},400),()=>{if(r.current)clearTimeout(r.current),r.current=null}},[g]);let e=Q(async()=>{let i=B.trim();if(!i)return;let H$=B;H(null),v$($.id,{turns:[{role:"user",text:i,status:"pending"}],threadStatus:"pending",text:i}),k("");let q$=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await jU(i,$.position,$.id,q$,$.id)).ok)v$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),k(H$),H("Failed to send prompt. Your draft has been restored.")},[B,$.id,$.position,$.data.contextNodeIds]),u=Q(async()=>{let i=P.trim();if(!i)return;let H$=P;H(null);let q$=Array.isArray($.data.turns)?[...$.data.turns]:[];if(q$.push({role:"user",text:i,status:"pending"}),v$($.id,{turns:q$,threadStatus:"pending"}),X(""),!(await iO($.id,i)).ok)q$.pop(),v$($.id,{turns:q$,threadStatus:"answered"}),X(H$),H("Failed to send reply. Your draft has been restored.")},[P,$.id,$.data.turns]),S=Q((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),e();return}if(i.key==="Tab"&&B.startsWith("/")){i.preventDefault();let H$=B.slice(1).split(/\s/)[0];if(H$)UB().then((q$)=>{let h$=gB(H$,q$);if(h$)k(`/${h$}`)})}},[e,B]),U$=Q((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),u();return}if(i.key==="Tab"&&P.startsWith("/")){i.preventDefault();let H$=P.slice(1).split(/\s/)[0];if(H$)UB().then((q$)=>{let h$=gB(H$,q$);if(h$)X(`/${h$}`)})}},[u,P]),c=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(b&&g.length===0)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[G(_B,{count:c},void 0,!1,void 0,this),G(zB,{message:Y,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("textarea",{ref:F,value:B,onInput:(i)=>k(i.target.value),onKeyDown:S,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:e,disabled:!B.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(_)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:U},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:O?"Sending…":W?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G(_B,{count:c},void 0,!1,void 0,this),G(zB,{message:Y,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("div",{ref:N,style:{flex:1,overflow:"auto",minHeight:0},children:g.map((i,H$)=>G("div",{children:[H$>0&&G("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),i.role==="user"?G("div",{class:"thread-turn-user",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),G("div",{style:{fontSize:v?"15px":"13px",lineHeight:v?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{class:"thread-turn-assistant",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:`status-dot${i.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),i.status==="streaming"&&!i.text&&G("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),G("div",{class:v?"md-reader-content":void 0,style:{fontSize:v?void 0:"13px",lineHeight:v?void 0:"1.55",opacity:i.text?1:0.4},children:L.get(H$)?G(a$,{children:[G(Ww,{html:L.get(H$)??""},void 0,!1,void 0,this),i.status==="streaming"&&G("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:i.status==="streaming"?"Waiting for response…":i.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Bw(i,H$),!0,void 0,this))},void 0,!1,void 0,this),G("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:W?"6px":0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:K?"var(--c-accent)":O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:K?"Streaming…":O?"Sending…":W?"Answered":J},void 0,!1,void 0,this),G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[g.length," turn",g.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&G("div",{class:"thread-reply-area",children:[G("textarea",{value:P,onInput:(i)=>X(i.target.value),onKeyDown:U$,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:u,disabled:!P.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:P.trim()?"var(--c-accent)":"var(--c-line)",color:P.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:P.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pw($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function kw({html:$}){let v=y(null);return m(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function s0({node:$,expanded:v=!1}){let g=$.data.content||"",_=$.data.status||"streaming",[U,z]=o(""),J=_==="streaming",b=_==="complete";m(()=>{if(!g){z("");return}let K=!1;return g6(g).then((W)=>{if(!K)z(Pw(W))}),()=>{K=!0}},[g]);let O=Q(()=>{jU("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return G("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[J&&G("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),G("div",{class:v?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:g?1:0.4,transition:"opacity 0.2s ease"},children:U?G("div",{class:v?"md-reader-content":void 0,children:G(kw,{html:U},void 0,!1,void 0,this)},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:J?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:J?"var(--c-accent)":b?"var(--c-ok)":"var(--c-muted)"},children:J?"Streaming…":b?"Complete":_},void 0,!1,void 0,this),b&&G("button",{type:"button",onClick:O,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function JB($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var bB={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},Hw={running:"⠋",success:"✓",failed:"✕"},Iw={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function e0({node:$}){let{toolName:v,category:g,status:_,duration:U,resultSummary:z,error:J}=JB($.data),b=bB[g]??bB.other,O=Hw[_]??"◌",K=Iw[_]??"var(--c-muted)",W=_==="running",B=J?J.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[G("span",{style:{fontSize:"14px",color:K,flexShrink:0,animation:W?"pulse 1.5s infinite":"none"},children:O},void 0,!1,void 0,this),G("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[G("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:b,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v},void 0,!1,void 0,this),B&&G("div",{style:{fontSize:"10px",color:J?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&G("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r3($){let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function Yw($){let v=$.map((O)=>r3(O)).filter((O)=>O!==null);if(v.length===0)return null;let g=Math.min(...v.map((O)=>O.left)),_=Math.min(...v.map((O)=>O.top)),U=Math.max(...v.map((O)=>O.left+O.width)),z=Math.max(...v.map((O)=>O.top+O.height)),J=54,b=46;return{left:g-J,top:_-b,width:U-g+J*2,height:z-_+b*2}}function N3($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function GB(){let $=Array.from(w4.value),v=Array.from(F4.value),g=I_.value;if($.length===0&&v.length===0)return null;return G("div",{class:"attention-field-layer","aria-hidden":"true",children:[g.map((_)=>{let U=Yw(_.nodeIds);if(!U)return null;return G("div",{class:"attention-field-region",style:N3(U,42)},_.id,!1,void 0,this)}),v.map((_)=>{let U=r3(_);if(!U)return null;return G("div",{class:"attention-field-node attention-field-secondary",style:N3({left:U.left-18,top:U.top-18,width:U.width+36,height:U.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let U=r3(_);if(!U)return null;return G("div",{class:"attention-field-node attention-field-primary",style:N3({left:U.left-24,top:U.top-24,width:U.width+48,height:U.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Yv=O$(new Map),FU=O$(null),Lw=480,qw=320,lg=new Map,W6=null;function u3($){Yv.value=$,ww()}function y3($){let v=lg.get($);if(v)clearTimeout(v),lg.delete($)}function OB($){y3($.id);let v=new Map(Yv.value);v.set($.id,{...$,phase:"forming"}),u3(v)}function Xw($){if(y3($),!Yv.value.has($))return;let v=new Map(Yv.value);v.delete($),u3(v)}function KB($,v,g,_){let U=Yv.value.get($);if(!U||U.phase===v)return;let z=new Map(Yv.value);z.set($,{...U,phase:v,..._?{settledNodeId:_}:{}}),u3(z),y3($),lg.set($,setTimeout(()=>Xw($),g))}function WB($,v){KB($,"settling",Lw,v)}function D3($){KB($,"dissolving",qw)}function R3(){for(let $ of lg.values())clearTimeout($);if(lg.clear(),W6)clearInterval(W6),W6=null;FU.value=null,Yv.value=new Map}function ww(){if(W6||Yv.value.size===0)return;W6=setInterval(()=>{let $=Date.now();for(let v of Yv.value.values())if(v.phase==="forming"&&v.expiresAt<=$)D3(v.id);if(Yv.value.size===0&&W6)clearInterval(W6),W6=null},1000),W6.unref?.()}var Fw={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function L$({size:$=16,children:v,...g}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",...Fw,...g,children:v},void 0,!1,void 0,this)}function kB($){return G(L$,{...$,children:[G("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),G("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),G("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),G("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HB($){return G(L$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"4.5",x2:"8",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"9.5",x2:"8",y2:"11.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"6.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"9.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),G("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),G("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),G("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wB($){return G(L$,{...$,children:G("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function FB($){return G(L$,{...$,children:[G("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),G("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),G("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AB($){return G(L$,{...$,children:[G("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),G("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),G("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZB($){return G(L$,{...$,children:[G("path",{d:"M3 4h10"},void 0,!1,void 0,this),G("path",{d:"M8 4v8"},void 0,!1,void 0,this),G("path",{d:"M6 12h4"},void 0,!1,void 0,this),G("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),G("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uB({size:$=22,class:v}){return G("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:v,"aria-hidden":"true",children:[G("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),G("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),G("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),G("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Aw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Zw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Mw($){return G(L$,{...$,children:[G("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),G("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Qw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),G("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),G("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Sw($){return G(L$,{...$,children:[G("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),G("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),G("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yw($){return G(L$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Dw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),G("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),G("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),G("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Tw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),G("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function jw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),G("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xg($){switch($){case"markdown":return BB;case"prompt":return Aw;case"response":return Zw;case"file":return Mw;case"image":return Qw;case"webpage":return PB;case"context":return Sw;case"group":return Nw;case"status":return rw;case"trace":return uw;case"ledger":return yw;case"mcp-app":return Dw;case"ext-app":return Rw;case"json-render":return Tw;case"graph":return jw;case"html":return PB;default:return BB}}var yB={width:260,height:150},Vw={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function j3($){return!!$&&$ in s$}function B6($){if(!$)return null;let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function T3($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function hg($){if(typeof $.confidence!=="number")return 0.82;return 0.4+Math.max(0,Math.min(1,$.confidence))*0.55}function DB($,v){let g=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+g} ${$.y}, ${v.x-g} ${v.y}, ${v.x} ${v.y}`}function V3({intent:$}){let v=j3($.nodeType)?xg($.nodeType):null,g=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return G("div",{class:"intent-info",onMouseEnter:()=>FU.value=$.id,onMouseLeave:()=>{if(FU.value===$.id)FU.value=null},children:[G("div",{class:"intent-chip",children:[typeof $.seq==="number"&&G("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),v&&G("span",{class:"intent-chip-icon","aria-hidden":"true",children:G(v,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"intent-chip-label",children:g},void 0,!1,void 0,this),_&&G("span",{class:"intent-confidence",children:_},void 0,!1,void 0,this),$.phase==="forming"&&G("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(U)=>{U.stopPropagation(),S2($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&G("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RB({intent:$,rect:v}){let g=j3($.nodeType)?xg($.nodeType):null,_=j3($.nodeType)?s$[$.nodeType]:"Node";return G("div",{class:`intent-ghost intent-ghost-box is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:hg($)},children:[G("div",{class:"intent-ghost-titlebar",children:[G("span",{class:"intent-ghost-icon","aria-hidden":"true",children:g?G(g,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),G("span",{class:"intent-ghost-badge",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(V3,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TB({intent:$,rect:v,variant:g}){return G("div",{class:`intent-ghost intent-ghost-${g} is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:hg($)},children:[g==="edit"&&G("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),G(V3,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Cw($){let v=$.phase==="settling"?B6($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let g=$.nodeType&&Vw[$.nodeType]||yB,_=v??{left:$.position.x,top:$.position.y,...g};return G(RB,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=B6($.nodeId)??yB,U=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return G(RB,{intent:$,rect:U},$.id,!1,void 0,this)}case"remove":{let g=v??B6($.nodeId);if(!g)return null;return G(TB,{intent:$,rect:g,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let g=v??B6($.nodeId);if(!g)return null;return G(TB,{intent:$,rect:g,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let g=B6($.edge.from),_=B6($.edge.to);if(!g||!_)return null;let U={x:(g.left+g.width/2+_.left+_.width/2)/2,y:(g.top+g.height/2+_.top+_.height/2)/2},z={left:U.x-110,top:U.y-18,width:220,height:36};return G("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:hg($)},children:G(V3,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function jB(){let $=Array.from(Yv.value.values());if(m(()=>{function v(g){if(g.key!=="Escape")return;let _=FU.value;if(!_)return;let U=Yv.value.get(_);if(!U||U.phase!=="forming")return;g.stopImmediatePropagation(),g.preventDefault(),S2(U)}return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]),$.length===0)return null;return G("div",{class:"intent-layer",children:[G("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[G("defs",{children:G("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:G("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((v)=>{if(v.kind==="connect"&&v.edge){let g=B6(v.edge.from),_=B6(v.edge.to);if(!g||!_)return null;return G("path",{d:DB(T3(g),T3(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:hg(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let g=B6(v.nodeId);if(!g)return null;let _=g,U={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return G("path",{d:DB(T3(g),U),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:hg(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(Cw)]},void 0,!0,void 0,this)}var AU=8,P4=O$(null),ZU=[],MU=[],fB=null;function VB($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function CB($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function fw($,v){let g=new Map(v.map((b)=>[b.id,b])),_=new Set([$]),U=g.get($);if(!U)return _;let z=VB(U);while(z&&!_.has(z))_.add(z),z=VB(g.get(z));if(U.type!=="group")return _;let J=[...CB(U)];while(J.length>0){let b=J.pop();if(!b||_.has(b))continue;_.add(b);let O=g.get(b);if(O?.type==="group")J.push(...CB(O))}return _}function mB($,v){ZU=[],MU=[],fB=$;let g=Array.from(v),_=fw($,g);for(let U of g){if(_.has(U.id)||U.dockPosition!==null)continue;let z=U.position.x,J=U.position.x+U.size.width,b=U.position.x+U.size.width/2,O=U.position.y,K=U.position.y+U.size.height,W=U.position.y+U.size.height/2;ZU.push({val:z,minY:O,maxY:K}),ZU.push({val:J,minY:O,maxY:K}),ZU.push({val:b,minY:O,maxY:K}),MU.push({val:O,minX:z,maxX:J}),MU.push({val:K,minX:z,maxX:J}),MU.push({val:W,minX:z,maxX:J})}}function cB(){ZU=[],MU=[],fB=null}function EB($,v,g,_){let U=[$,$+g/2,$+g],z=[v,v+_/2,v+_],J=[0,g/2,g],b=[0,_/2,_],O=null,K=AU+1,W=null;for(let Y=0;Y<3;Y++){let H=U[Y];for(let L of ZU){let q=Math.abs(H-L.val);if(q<K)K=q,O=L.val-J[Y],W={axis:"x",pos:L.val,from:Math.min(L.minY,v),to:Math.max(L.maxY,v+_)}}}let B=null,k=AU+1,P=null;for(let Y=0;Y<3;Y++){let H=z[Y];for(let L of MU){let q=Math.abs(H-L.val);if(q<k)k=q,B=L.val-b[Y],P={axis:"y",pos:L.val,from:Math.min(L.minX,$),to:Math.max(L.maxX,$+g)}}}let X=[];if(W&&K<=AU)X.push(W);if(P&&k<=AU)X.push(P);return{x:O!==null&&K<=AU?O:$,y:B!==null&&k<=AU?B:v,guides:X}}function iB({nodeId:$,viewport:v,onMove:g,onDragEnd:_}){let U=y(!1),z=y({x:0,y:0}),J=y({x:0,y:0});return Q((O,K,W)=>{O.stopPropagation(),O.preventDefault(),U.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:O.clientX,y:O.clientY},J.current={x:K,y:W};let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let L=v.value.scale,q=(H.x-z.current.x)/L,F=(H.y-z.current.y)/L;g($,J.current.x+q,J.current.y+F)},X=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},Y=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},[$,v,g,_])}var mw=200,cw=100;function lB({nodeId:$,viewport:v,onResize:g,onResizeEnd:_}){let U=y(!1),z=y({x:0,y:0}),J=y({w:0,h:0});return Q((O,K,W)=>{O.stopPropagation(),O.preventDefault(),U.current=!0,z.current={x:O.clientX,y:O.clientY},J.current={w:K,h:W},document.documentElement.classList.add("is-node-resizing");let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let L=v.value.scale,q=(H.x-z.current.x)/L,F=(H.y-z.current.y)/L;g($,Math.max(mw,J.current.w+q),Math.max(cw,J.current.h+F))},X=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},Y=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},[$,v,g,_])}function xB({node:$,children:v,onContextMenu:g}){let _=D$.value===$.id,U=i$.value.has($.id),z=R$.value.has($.id),J=w4.value.has($.id),b=!J&&F4.value.has($.id),O=Y_.value.has($.id),K=!_&&UK.value.has($.id),W=Z6.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[P,X]=o(!1),Y=y(null),H=Q((f,a,G$)=>{let K$=EB(a,G$,$.size.width,$.size.height),V$=T.value.get(f);if(V$?.position.x===K$.x&&V$.position.y===K$.y){P4.value=K$.guides.length>0?K$.guides:null;return}Pv(f,{position:{x:K$.x,y:K$.y}}),P4.value=K$.guides.length>0?K$.guides:null},[$.size.width,$.size.height]),L=Q(()=>{cB(),P4.value=null,t$()},[]),q=iB({nodeId:$.id,viewport:P$,onMove:H,onDragEnd:L}),F=Q((f,a,G$)=>{let K$=T.value.get(f);if(K$?.size.width===a&&K$.size.height===G$)return;Pv(f,{size:{width:a,height:G$}})},[]),N=Q(()=>{v$($.id,{userResized:!0}),Zv($.id,{data:{userResized:!0}}),t$()},[$.id]),C=lB({nodeId:$.id,viewport:P$,onResize:F,onResizeEnd:N}),p=Q((f)=>{if(P)return;M6($.id),mB($.id,T.value.values()),q(f,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,q,P]),r=Q((f)=>{if(f.stopPropagation(),f.shiftKey){gK($.id);return}M6($.id)},[$.id]),n=Q((f)=>{if(g)g(f,$.id)},[g,$.id]),e=Q((f)=>{f.stopPropagation(),X(!0),requestAnimationFrame(()=>Y.current?.focus())},[]),u=$.data.title||s$[$.type],S=Q((f)=>{let a=f.trim();if(a&&a!==u)v$($.id,{title:a}),Zv($.id,{title:a});X(!1)},[$.id,u]),U$=y(null),c=y(!1),i=y(null);m(()=>{if(c.current||!zz($))return;let f=U$.current;if(!f)return;let a=new ResizeObserver(()=>{if(c.current){a.disconnect();return}let G$=f.scrollHeight,K$=L5($,G$);if(K$===null)return;if(Math.abs(K$-$.size.height)>8){if(N4($.id,{width:$.size.width,height:K$}),i.current!==null)window.clearTimeout(i.current);i.current=window.setTimeout(()=>{t$({recordHistory:!1}),i.current=null},0)}c.current=!0,a.disconnect()});return a.observe(f),()=>{if(a.disconnect(),i.current!==null)window.clearTimeout(i.current),i.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.dockPosition,$.size.width,$.size.height]);let H$=$.pinned,q$=$.type==="trace",h$=q$&&$.data.status==="running",M=$.type==="group",h=$.data.strictSize===!0,s=Math.max(P$.value.scale,0.01),d=s<1?Math.min(2.2,1/s):1,b$=M&&$.data.color?$.data.color:void 0,g$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":d.toFixed(3),...b$?{"--group-color":b$}:{}},l=["canvas-node",_?"active":"",K?"neighbor":"",B?"search-match":"",k?"search-dimmed":"",U?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",b?"attention-focus-secondary":"",O?"attention-pulse":"",H$?"pinned":"",q$?"trace-node":"",h$?"trace-running":"",M?"group-node":"",h?"strict-size":""].filter(Boolean).join(" ");return G("div",{class:l,style:g$,onPointerDown:r,onContextMenu:n,children:[G("div",{class:"node-titlebar",onPointerDown:p,children:[G("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let f=xg($.type);return G(f,{size:Math.round(14*d)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),G("span",{class:"node-type-badge",children:s$[$.type]},void 0,!1,void 0,this),P?G("input",{ref:Y,class:"node-title-input",value:u,onBlur:(f)=>S(f.target.value),onKeyDown:(f)=>{if(f.key==="Enter")S(f.target.value);if(f.key==="Escape")X(!1)},onClick:(f)=>f.stopPropagation()},void 0,!1,void 0,this):G("span",{class:"node-title",onDblClick:e,title:"Double-click to rename",children:u},void 0,!1,void 0,this),G("div",{class:"node-controls",children:[H$&&G("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(f)=>{f.stopPropagation(),Q4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),t0($)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),d0($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),F_.has($.type)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),z6($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),Q6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),S4($.id),Q_($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{ref:U$,class:"node-body",children:v},void 0,!1,void 0,this),!$.collapsed&&G("div",{class:"node-resize-handle",onPointerDown:(f)=>C(f,$.size.width,$.size.height)},void 0,!1,void 0,this),["top","right","bottom","left"].map((f)=>G("div",{class:`node-port node-port-${f}`,onPointerDown:(a)=>{a.stopPropagation(),a.preventDefault();let G$=$.position.x+$.size.width/2,K$=$.position.y+$.size.height/2,V$=$.size.width/2,C$=$.size.height/2,Kv,Wv;switch(f){case"top":Kv=G$,Wv=K$-C$;break;case"bottom":Kv=G$,Wv=K$+C$;break;case"left":Kv=G$-V$,Wv=K$;break;case"right":Kv=G$+V$,Wv=K$;break}uv.value={fromId:$.id,fromX:Kv,fromY:Wv,cursorX:Kv,cursorY:Wv}}},f,!1,void 0,this))]},void 0,!0,void 0,this)}var Ew={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-dim)"},iw=new Set(["depends-on","flow"]);function lw($){if($.style==="dashed")return"8 4";if($.style==="dotted")return"3 3";if($.type==="references"&&!$.style)return"8 4";return}function hB($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=U-g,b=z-_,O=$.size.width/2,K=$.size.height/2,W=Math.abs(b/(J||0.001)),B=K/(O||0.001);if(W>B){let P=b>0?1:-1;return{x:g+K/W*(J>0?1:-1),y:_+K*P}}let k=J>0?1:-1;return{x:g+O*k,y:_+W*O*(b>0?1:-1)}}function xw($,v,g,_,U,z,J,b){return{x:0.125*$+0.375*g+0.375*U+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*b}}function hw({edge:$,fromNode:v,toNode:g,focused:_,dimmed:U}){let z=hB(v,g),J=hB(g,v),b=J.x-z.x,O=J.y-z.y,K=Math.sqrt(b*b+O*O),W=Math.min(K*0.25,80),B=b/(K||1),k=O/(K||1),P=z.x+B*W,X=z.y+k*W,Y=J.x-B*W,H=J.y-k*W,L=`M ${z.x} ${z.y} C ${P} ${X}, ${Y} ${H}, ${J.x} ${J.y}`,q=Ew[$.type],F=iw.has($.type),N=lw($),C=$.label?xw(z.x,z.y,P,X,Y,H,J.x,J.y):null,p=`edge-path-${$.id}`;return G("g",{children:[G("path",{d:L,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&G("path",{d:L,fill:"none",stroke:q,"stroke-width":"6","stroke-dasharray":N,opacity:"0.15",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{id:p,d:L,fill:"none",stroke:q,"stroke-width":_?2.5:1.5,"stroke-dasharray":N,"marker-end":F?"url(#edge-arrow)":void 0,opacity:U?0.2:_?1:0.75,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&G("circle",{r:"3",fill:q,opacity:"0.9",children:G("animateMotion",{dur:"2s",repeatCount:"indefinite",children:G("mpath",{href:`#${p}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&$.label&&G("g",{transform:`translate(${C.x}, ${C.y})`,children:[G("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8),y:"-10",width:$.label.length*7+16,height:"20",rx:"4"},void 0,!1,void 0,this),G("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)","font-size":"11",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pB({nodes:$,edges:v}){let g=$.value,_=Array.from(v.value.values()),U=D$.value,z=U!==null,J=Z6.value,b=J!==null;if(_.length===0)return null;let O=96,K=Array.from(g.values()),W=Math.min(...K.map((H)=>H.position.x))-O,B=Math.min(...K.map((H)=>H.position.y))-O,k=Math.max(...K.map((H)=>H.position.x+H.size.width))+O,P=Math.max(...K.map((H)=>H.position.y+H.size.height))+O,X=Math.max(1,k-W),Y=Math.max(1,P-B);return G("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${W} ${B} ${X} ${Y}`,width:X,height:Y,style:{position:"absolute",top:`${B}px`,left:`${W}px`,pointerEvents:"none",overflow:"visible"},children:[G("title",{children:"Canvas connections"},void 0,!1,void 0,this),G("defs",{children:G("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:G("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((H)=>{let L=g.get(H.from),q=g.get(H.to);if(!L||!q)return null;let F=z&&(H.from===U||H.to===U),N=b&&!(J.has(H.from)||J.has(H.to));return G(hw,{edge:H,fromNode:L,toNode:q,focused:F,dimmed:z&&!F||N},H.id,!1,void 0,this)}),uv.value&&(()=>{let H=uv.value,L=H.cursorX-H.fromX,q=H.cursorY-H.fromY,F=Math.sqrt(L*L+q*q),N=Math.min(F*0.25,80),C=L/(F||1),p=q/(F||1),r=`M ${H.fromX} ${H.fromY} C ${H.fromX+C*N} ${H.fromY+p*N}, ${H.cursorX-C*N} ${H.cursorY-p*N}, ${H.cursorX} ${H.cursorY}`;return G("g",{children:[G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"6",opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"2","stroke-dasharray":"6 4",opacity:"0.8"},void 0,!1,void 0,this),G("circle",{cx:H.cursorX,cy:H.cursorY,r:"5",fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function pw($){let[v,...g]=$;if(!v)return"";return g.reduce((_,U)=>`${_} L ${U.x} ${U.y}`,`M ${v.x} ${v.y}`)}function C3({annotations:$}){if($.length===0)return null;return G("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let g=v.color==="currentColor"?"var(--c-annotation)":v.color;if(v.type==="text"){let _=v.points[0];if(!_||!v.text)return null;return G("text",{x:_.x,y:_.y,fill:g,"font-size":v.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:v.text},v.id,!1,void 0,this)}return G("path",{d:pw(v.points),fill:"none",stroke:g,"stroke-width":v.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},v.id,!1,void 0,this)})},void 0,!1,void 0,this)}var ow=0.1,nw=4,oB=1;function nB($){return Math.min(nw,Math.max(ow,$))}function tB({viewport:$,onViewportChange:v,onViewportCommit:g,disabled:_=!1}){let U=y(null),z=y(!1),J=y({x:0,y:0}),b=y(0),O=y(null),K=Q((H)=>{if(O.current!==null)window.clearTimeout(O.current);O.current=window.setTimeout(()=>{O.current=null,g(H)},140)},[g]),W=Q((H)=>{if(_)return;H.preventDefault();let L=$.value;if(H.ctrlKey||H.metaKey){let q=U.current?.getBoundingClientRect();if(!q)return;let F=H.clientX-q.left,N=H.clientY-q.top,C=-H.deltaY*0.002,p=nB(L.scale*(1+C)),r=p/L.scale,n={x:F-r*(F-L.x),y:N-r*(N-L.y),scale:p};v(n),K(n)}else{let q={x:L.x-H.deltaX*oB,y:L.y-H.deltaY*oB,scale:L.scale};v(q),K(q)}},[_,$,v,K]),B=Q((H)=>{if(_)return;let L=U.current;if(!L||H.target!==L)return;z.current=!0,J.current={x:H.clientX,y:H.clientY},L.setPointerCapture(H.pointerId)},[_]),k=Q((H)=>{if(!z.current)return;if(_)return;let L=H.clientX-J.current.x,q=H.clientY-J.current.y;J.current={x:H.clientX,y:H.clientY};let F=$.value;v({x:F.x+L,y:F.y+q,scale:F.scale})},[_,$,v]),P=Q(()=>{if(z.current)g($.value);z.current=!1},[g,$]),X=Q((H)=>{if(_)return;if(H.touches.length!==2){b.current=0;return}H.preventDefault();let L=H.touches[0],q=H.touches[1],F=Math.hypot(q.clientX-L.clientX,q.clientY-L.clientY),N=(L.clientX+q.clientX)/2,C=(L.clientY+q.clientY)/2;if(b.current>0){let p=$.value,r=U.current?.getBoundingClientRect();if(!r)return;let n=N-r.left,e=C-r.top,u=F/b.current,S=nB(p.scale*u),U$=S/p.scale,c={x:n-U$*(n-p.x),y:e-U$*(e-p.y),scale:S};v(c),K(c)}b.current=F},[_,$,v,K]),Y=Q(()=>{if(O.current!==null)window.clearTimeout(O.current),O.current=null;g($.value),b.current=0},[g,$]);return m(()=>{let H=U.current;if(!H)return;return H.addEventListener("wheel",W,{passive:!1}),H.addEventListener("pointerdown",B),H.addEventListener("pointermove",k),H.addEventListener("pointerup",P),H.addEventListener("pointercancel",P),H.addEventListener("touchmove",X,{passive:!1}),H.addEventListener("touchend",Y),()=>{if(O.current!==null)window.clearTimeout(O.current);H.removeEventListener("wheel",W),H.removeEventListener("pointerdown",B),H.removeEventListener("pointermove",k),H.removeEventListener("pointerup",P),H.removeEventListener("pointercancel",P),H.removeEventListener("touchmove",X),H.removeEventListener("touchend",Y)}},[W,B,k,P,X,Y]),U}function tw($){switch($.type){case"markdown":return G(t_,{node:$},void 0,!1,void 0,this);case"mcp-app":return G(l6,{node:$},void 0,!1,void 0,this);case"webpage":return G(n0,{node:$},void 0,!1,void 0,this);case"json-render":return G(l6,{node:$},void 0,!1,void 0,this);case"graph":return G(l6,{node:$},void 0,!1,void 0,this);case"prompt":return G(a0,{node:$},void 0,!1,void 0,this);case"response":return G(s0,{node:$},void 0,!1,void 0,this);case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"trace":return G(e0,{node:$},void 0,!1,void 0,this);case"file":return G(l_,{node:$},void 0,!1,void 0,this);case"image":return G(o0,{node:$},void 0,!1,void 0,this);case"html":return G(ig,{node:$},void 0,!1,void 0,this);case"group":return G(eW,{node:$},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function dw($,v,g){let _=g.x-v.x,U=g.y-v.y,z=_*_+U*U;if(z===0)return Math.hypot($.x-v.x,$.y-v.y);let J=Math.max(0,Math.min(1,(($.x-v.x)*_+($.y-v.y)*U)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*U))}function aw($,v,g){for(let _=$.length-1;_>=0;_--){let U=$[_];if(!U)continue;let z=g+U.width;if(v.x<U.bounds.x-z||v.x>U.bounds.x+U.bounds.width+z||v.y<U.bounds.y-z||v.y>U.bounds.y+U.bounds.height+z)continue;if(U.type==="text")return U;for(let J=1;J<U.points.length;J++){let b=U.points[J-1],O=U.points[J];if(b&&O&&dw(v,b,O)<=g+U.width/2)return U}}return null}var f3="currentColor",dB=4,aB=24,sw=14,ew=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),$F=new Set(["md","mdx","markdown"]),sB={width:520,height:420};function vF($){let v=$.trim();if(!v||/\s/.test(v))return null;let g=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(g);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function m3($){let v=$.trim();if(!v)return[];let g=v.includes(`
228
+ `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,U=[];for(let z of g){let J=z.trim();if(!J||J.startsWith("#"))continue;let b=vF(J);if(!b||_.has(b))continue;_.add(b),U.push(b)}return U}function UF($){let v=m3($.getData("text/uri-list"));if(v.length>0)return v;return m3($.getData("text/plain"))}function gF($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function eB($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function _F($){let v=$.split(".").pop()?.toLowerCase()??"";if(ew.has(v))return"image";if($F.has(v))return"markdown";return"file"}function zF($,v){let g=[],_=0;for(let U of $){if(U.dockPosition!==null)continue;if(v&&U.id===v)continue;if(U.type==="group")g.splice(_++,0,U);else g.push(U)}return g}function $P({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:g=!1,annotationTool:_=null}){let U=P$.value,z=y(!1),J=y(!1),b=y([]),[O,K]=o(null),[W,B]=o(null),[k,P]=o(null),X=y(null),[Y,H]=o(!1),L=y(0),q=y(null),F=tB({viewport:P$,disabled:g,onViewportChange:(M)=>{if(z.current||g)return;u4(),BK(M)},onViewportCommit:(M)=>{if(z.current||g)return;u4(),kK(M)}}),N=Q((M)=>{X.current=M,P(M)},[]),C=Q(async(M,h,s)=>{if(M.length===0)return;let{width:d,height:b$}=sB,g$=24,l=Math.ceil(Math.sqrt(M.length)),f=Math.ceil(M.length/l),a=l*d+Math.max(0,l-1)*g$,G$=f*b$+Math.max(0,f-1)*g$;for(let K$=0;K$<M.length;K$++){let V$=K$%l,C$=Math.floor(K$/l),Kv=h-a/2+V$*(d+g$),Wv=s-G$/2+C$*(b$+g$);await Ev({type:"webpage",content:M[K$],x:Kv,y:Wv,width:d,height:b$})}},[]),p=Q((M)=>{let h=F.current;if(!h)return;if(_==="eraser"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation();let f=h.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale},K$=aw(Array.from(M4.value.values()),G$,sw/a.scale);if(K$)KK(K$.id);return}if(_==="text"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv();let f=h.getBoundingClientRect(),a=P$.value;N({x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale,value:""});return}if(_==="pen"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv(),J.current=!0;let f=h.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale};b.current=[G$],B({id:"draft-annotation",type:"freehand",points:[G$],bounds:{x:0,y:0,width:0,height:0},color:f3,width:dB,createdAt:""}),h.setPointerCapture(M.pointerId);return}if(M.target!==h)return;if(!M.shiftKey){if(!q.current)D$.value=null,jv();return}M.preventDefault(),M.stopPropagation(),z.current=!0;let s=h.getBoundingClientRect(),d=M.clientX-s.left,b$=M.clientY-s.top,g$={startX:d,startY:b$,currentX:d,currentY:b$};q.current=g$,K(g$),h.setPointerCapture(M.pointerId)},[_,F]),r=Q((M)=>{if(J.current){let d=F.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=P$.value,l={x:(M.clientX-b$.left-g$.x)/g$.scale,y:(M.clientY-b$.top-g$.y)/g$.scale},f=b.current.at(-1);if(f&&Math.hypot(l.x-f.x,l.y-f.y)<2)return;b.current=[...b.current,l],B((a)=>a?{...a,points:b.current}:null);return}if(!z.current||!q.current)return;let h=F.current?.getBoundingClientRect();if(!h)return;let s={...q.current,currentX:M.clientX-h.left,currentY:M.clientY-h.top};q.current=s,K(s)},[F]),n=Q((M)=>{if(J.current){J.current=!1;let l=b.current;if(b.current=[],B(null),l.length>=2)u2({points:l,color:f3,width:dB});let f=F.current;if(f?.hasPointerCapture(M.pointerId))f.releasePointerCapture(M.pointerId);return}let h=q.current;if(!z.current||!h)return;z.current=!1,q.current=null;let s=Math.min(h.startX,h.currentX),d=Math.max(h.startX,h.currentX),b$=Math.min(h.startY,h.currentY),g$=Math.max(h.startY,h.currentY);if(d-s>5||g$-b$>5){let l=P$.value,f=(s-l.x)/l.scale,a=(d-l.x)/l.scale,G$=(b$-l.y)/l.scale,K$=(g$-l.y)/l.scale,V$=[];for(let C$ of T.value.values()){if(C$.dockPosition!==null)continue;let Kv=C$.position.x,Wv=C$.position.y;if(Kv+C$.size.width>f&&Kv<a&&Wv+C$.size.height>G$&&Wv<K$)V$.push(C$.id)}if(V$.length>0)_K(V$)}K(null)},[]);m(()=>{if(g)return;if(!J.current&&!W&&!k)return;J.current=!1,b.current=[],B(null),N(null)},[g,W,N,k]);let e=Q(()=>{let M=X.current;if(!M)return;let h=M.value.trim();if(N(null),!h)return;let s={x:M.x,y:M.y};u2({type:"text",points:[s],color:f3,width:aB,text:h})},[N]);m(()=>{if(_!=="text"&&k)N(null)},[_,N,k]),m(()=>{function M(s){if(!uv.value)return;let d=F.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=P$.value;uv.value={...uv.value,cursorX:(s.clientX-b$.left-g$.x)/g$.scale,cursorY:(s.clientY-b$.top-g$.y)/g$.scale}}function h(s){let d=uv.value;if(!d)return;uv.value=null;let b$=F.current;if(!b$)return;let g$=b$.getBoundingClientRect(),l=P$.value,f=(s.clientX-g$.left-l.x)/l.scale,a=(s.clientY-g$.top-l.y)/l.scale;for(let G$ of T.value.values()){if(G$.id===d.fromId||G$.dockPosition!==null)continue;if(f>=G$.position.x&&f<=G$.position.x+G$.size.width&&a>=G$.position.y&&a<=G$.position.y+G$.size.height){A4(d.fromId,G$.id,"relation");return}}}return document.addEventListener("pointermove",M),document.addEventListener("pointerup",h),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",h)}},[F]);let u=Q((M)=>{if(g)return;let h=F.current;if(!h||M.target!==h)return;let s=h.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,g$=(M.clientY-s.top-d.y)/d.scale,l=520,f=360;Ev({type:"markdown",title:"New note",x:b$-l/2,y:g$-f/2,width:l,height:f})},[g,F]),S=Q((M)=>{if(g)return;if(!v)return;let h=F.current;if(!h)return;if((M.target instanceof Element?M.target:null)?.closest(".canvas-node"))return;let d=h.getBoundingClientRect(),b$=P$.value,g$=(M.clientX-d.left-b$.x)/b$.scale,l=(M.clientY-d.top-b$.y)/b$.scale;v(M,g$,l)},[g,F,v]),U$=Q((M)=>{if(M.preventDefault(),L.current++,M.dataTransfer?.types.includes("Files")||gF(M.dataTransfer))H(!0)},[]),c=Q((M)=>{if(M.preventDefault(),M.dataTransfer)M.dataTransfer.dropEffect="copy"},[]),i=Q((M)=>{if(M.preventDefault(),L.current--,L.current<=0)L.current=0,H(!1)},[]),H$=Q(async(M)=>{M.preventDefault(),H(!1),L.current=0;let h=F.current;if(!h||!M.dataTransfer)return;let s=h.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,g$=(M.clientY-s.top-d.y)/d.scale,l=Array.from(M.dataTransfer.files);if(l.length===0){let V$=UF(M.dataTransfer);await C(V$,b$,g$);return}let f=400,a=300,G$=20,K$=Math.ceil(Math.sqrt(l.length));for(let V$=0;V$<l.length;V$++){let C$=l[V$],Kv=V$%K$,Wv=Math.floor(V$/K$),k6=b$-K$*(f+G$)/2+Kv*(f+G$),dg=g$-a/2+Wv*(a+G$),H6=_F(C$.name),ag=C$.name;if(H6==="image"){let sv=new FileReader,Av=await new Promise((uU)=>{sv.onload=()=>uU(sv.result),sv.readAsDataURL(C$)});await Ev({type:"image",title:ag,content:Av,x:k6,y:dg,width:f,height:a})}else{let sv=await C$.text(),Av=H6==="markdown"||H6==="file";await Ev({type:H6,title:ag,content:sv,x:k6,y:dg,width:Av?720:f,height:Av?500:a})}}},[F,C]);m(()=>{let M=async(h)=>{if(h.defaultPrevented)return;if(eB(h.target instanceof Element?h.target:null))return;if(eB(document.activeElement))return;let s=h.clipboardData?.getData("text/plain")??"",d=m3(s);if(d.length===0)return;let b$=F.current;if(!b$)return;h.preventDefault();let g$=b$.getBoundingClientRect(),l=P$.value,f=(g$.width/2-l.x)/l.scale,a=(g$.height/2-l.y)/l.scale;await C(d,f,a)};return document.addEventListener("paste",M),()=>{document.removeEventListener("paste",M)}},[F,C]);let q$=zF(T.value.values(),j$.value),h$=null;if(O){let M=Math.min(O.startX,O.currentX),h=Math.min(O.startY,O.currentY),s=Math.abs(O.currentX-O.startX),d=Math.abs(O.currentY-O.startY);h$={position:"absolute",left:`${M}px`,top:`${h}px`,width:`${s}px`,height:`${d}px`,pointerEvents:"none"}}return G("div",{class:"canvas-viewport",ref:F,tabIndex:0,onPointerDown:p,onPointerMove:r,onPointerUp:n,onContextMenu:S,onDblClick:u,onDragEnter:U$,onDragOver:c,onDragLeave:i,onDrop:H$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":g||uv.value||z.current?"crosshair":"grab"},children:[G("div",{style:{transform:`matrix(${U.scale}, 0, 0, ${U.scale}, ${U.x}, ${U.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[G(GB,{},void 0,!1,void 0,this),G(jB,{},void 0,!1,void 0,this),G(pB,{nodes:T,edges:c$},void 0,!1,void 0,this),G(C3,{annotations:Array.from(M4.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&G(C3,{annotations:[W]},void 0,!1,void 0,this),q$.map((M)=>G(xB,{node:M,onContextMenu:$,children:tw(M)},M.id,!1,void 0,this)),P4.value&&G("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:P4.value.map((M,h)=>M.axis==="x"?G("line",{x1:M.pos,y1:M.from-20,x2:M.pos,y2:M.to+20,class:"snap-guide-line"},h,!1,void 0,this):G("line",{x1:M.from-20,y1:M.pos,x2:M.to+20,y2:M.pos,class:"snap-guide-line"},h,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&G("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),k&&G("input",{class:"annotation-text-input",value:k.value,autoFocus:!0,style:{left:`${k.x*U.scale+U.x}px`,top:`${k.y*U.scale+U.y}px`,fontSize:`${aB*U.scale}px`},onInput:(M)=>N({...k,value:M.target.value}),onBlur:e,onPointerDown:(M)=>M.stopPropagation(),onKeyDown:(M)=>{if(M.key==="Enter")M.preventDefault(),e();if(M.key==="Escape")M.preventDefault(),N(null)}},void 0,!1,void 0,this),h$&&G("div",{class:"lasso-rect",style:h$},void 0,!1,void 0,this),Y&&G("div",{class:"drop-zone-overlay",children:G("div",{class:"drop-zone-indicator",children:[G("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),G("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},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 JF($,v){let g=$.toLowerCase(),_=v.toLowerCase(),U=[],z=0,J=0,b=-1;for(let O=0;O<_.length&&z<g.length;O++)if(_[O]===g[z]){if(U.push(O),J+=b===O-1?10:1,O===0||_[O-1]===" "||_[O-1]==="-"||_[O-1]==="_")J+=5;b=O,z++}return{match:z===g.length,score:J,indices:U}}function bF($,v){if(v.length===0)return $;let g=[],_=0;for(let U of v){if(U>_)g.push($.slice(_,U));g.push(G("mark",{children:$[U]},U,!1,void 0,this)),_=U+1}if(_<$.length)g.push($.slice(_));return g}var c3={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function GF($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let g=v.slice(5).trim(),U=Object.keys(s$).find((J)=>J.startsWith(g));if(U)return{typeFilter:U,remaining:""};let z=c3[g];if(z)return{typeFilter:z,remaining:""}}if(c3[v])return{typeFilter:c3[v],remaining:""};return{typeFilter:null,remaining:$}}function vP({onClose:$,onToggleMinimap:v}){let[g,_]=o(""),[U,z]=o(0),J=y(null),b=y(null);m(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let O=Q(()=>{let Y=[];for(let L of T.value.values()){let q=L.data.title||s$[L.type],F=L.data.content||L.data.path||"";Y.push({id:`node:${L.id}`,kind:"node",label:q,description:F.length>80?F.slice(0,80)+"...":F||void 0,badge:s$[L.type],nodeType:L.type,action:()=>{Lv(L.id),$()}})}let H=[{label:"New note (markdown node)",badge:"CREATE",action:()=>{Ev({type:"markdown",title:"New note",width:520,height:360}),$()}},{label:"Fit all nodes",badge:"VIEW",action:()=>{j_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{V_(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{C_(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let L=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",L),qU(),T$.value=L,Z_(L),$()}}];for(let L of H)Y.push({id:`action:${L.label}`,kind:"action",label:L.label,badge:L.badge,badgeClass:"command-palette-badge--action",action:L.action});return Y},[$,v]),{typeFilter:K,remaining:W}=GF(g),B=O(),k;if(!g.trim())k=B.map((Y)=>({...Y,score:0,indices:[]}));else{k=[];for(let Y of B){if(K){if(Y.kind!=="node"||Y.nodeType!==K)continue;if(!W){k.push({...Y,score:0,indices:[]});continue}}let H=JF(W||g,Y.label);if(H.match)k.push({...Y,score:H.score,indices:H.indices})}k.sort((Y,H)=>H.score-Y.score)}m(()=>{if(!g.trim()){Z6.value=null;return}let Y=new Set;for(let H of k)if(H.kind==="node")Y.add(H.id.slice(5));Z6.value=Y.size>0?Y:null},[g,k]),m(()=>{return()=>{Z6.value=null}},[]);let P=Math.min(U,Math.max(0,k.length-1)),X=Q((Y)=>{if(Y.key==="ArrowDown")Y.preventDefault(),z((H)=>Math.min(H+1,k.length-1));else if(Y.key==="ArrowUp")Y.preventDefault(),z((H)=>Math.max(H-1,0));else if(Y.key==="Enter"){if(Y.preventDefault(),k[P])k[P].action()}else if(Y.key==="Escape")Y.preventDefault(),Y.stopPropagation(),$()},[k,P,$]);return m(()=>{let Y=b.current;if(!Y)return;Y.children[P]?.scrollIntoView({block:"nearest"})},[P]),m(()=>{z(0)},[g]),G("div",{class:"command-palette-backdrop",onMouseDown:$,children:G("div",{class:"command-palette",onMouseDown:(Y)=>Y.stopPropagation(),children:[G("input",{ref:J,type:"text",class:"command-palette-input",value:g,onInput:(Y)=>_(Y.target.value),onKeyDown:X,placeholder:`Search nodes and actions... (${Qv}+K)`},void 0,!1,void 0,this),G("div",{class:"command-palette-hint",children:[G("span",{children:[G("kbd",{children:"↑"},void 0,!1,void 0,this),G("kbd",{children:"↓"},void 0,!1,void 0,this)," navigate"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"↵"},void 0,!1,void 0,this)," select"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"esc"},void 0,!1,void 0,this)," close"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"type:"},void 0,!1,void 0,this)," filter by type"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"command-palette-results",ref:b,children:[k.length===0&&G("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),k.map((Y,H)=>G("button",{type:"button",class:`command-palette-item${H===P?" selected":""}`,onMouseEnter:()=>z(H),onClick:()=>Y.action(),children:[G("span",{class:`command-palette-badge${Y.badgeClass?` ${Y.badgeClass}`:""}`,children:Y.badge},void 0,!1,void 0,this),G("span",{class:"command-palette-label",children:Y.indices.length>0?bF(Y.label,Y.indices):Y.label},void 0,!1,void 0,this),Y.description&&G("span",{class:"command-palette-desc",children:Y.description},void 0,!1,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function UP(){let[$,v]=o(null),g=Q((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=Q((z,J,b)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:b})},[]),U=Q(()=>v(null),[]);return m(()=>{if(!$)return;let z=()=>v(null),J=(b)=>{if(b.key==="Escape")v(null)};return document.addEventListener("click",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("click",z),document.removeEventListener("keydown",J)}},[$]),{menu:$,openNodeMenu:g,openCanvasMenu:_,closeMenu:U}}var OF="#4bbcFF",KF=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function gP({menu:$,onClose:v}){let g;if($.kind==="node"){let b=T.value.get($.nodeId);if(!b)return null;g=IF(b)}else g=HF($.canvasX,$.canvasY);let _=new Map,U=g.some((b)=>b.render)?g.length*32+168:g.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-U));return G("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${J}px`,zIndex:1e4},onPointerDown:(b)=>b.stopPropagation(),onClick:(b)=>b.stopPropagation(),children:g.map((b)=>{let O=b.separator?"separator":b.render?"custom":`${b.label??"item"}:${b.shortcut??""}`,K=(_.get(O)??0)+1;_.set(O,K);let W=`${O}:${K}`;if(b.separator)return G("div",{class:"context-menu-separator"},W,!1,void 0,this);if(b.render)return G("div",{class:"context-menu-custom",children:b.render(v)},W,!1,void 0,this);return G("button",{type:"button",class:"context-menu-item",onClick:()=>{b.action?.(),v()},children:[G("span",{class:"context-menu-label",children:b.label},void 0,!1,void 0,this),b.shortcut&&G("span",{class:"context-menu-shortcut",children:b.shortcut},void 0,!1,void 0,this)]},W,!0,void 0,this)})},void 0,!1,void 0,this)}function WF($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function $2($){let v=$.trim().toLowerCase(),g=v.match(/^#([0-9a-f]{3})$/);if(g){let[_,U,z]=g[1].split("");return`#${_}${_}${U}${U}${z}${z}`}return v}function _P($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return $2($.data.color)}function BF($){let v=_P($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:$2(OF)}function E3($,v){let g=v?$2(v):null;Pv($.id,{data:{...$.data,color:g}}),Zv($.id,{data:{color:g}})}function PF($,v){let g=_P($);return G("div",{class:"context-menu-section",children:[G("div",{class:"context-menu-section-header",children:[G("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-menu-reset",onClick:()=>{E3($,null),v()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-menu-color-grid",children:KF.map((_)=>{let U=$2(_.value);return G("button",{type:"button",class:`context-menu-color-swatch${g===U?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{E3($,_.value),v()},children:[G("span",{class:"context-menu-color-dot",style:{"--swatch-color":_.value}},void 0,!1,void 0,this),G("span",{children:_.label},void 0,!1,void 0,this)]},_.value,!0,void 0,this)})},void 0,!1,void 0,this),G("label",{class:"context-menu-color-custom",children:[G("span",{children:"Custom"},void 0,!1,void 0,this),G("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:BF($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{E3($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function l3($,v,g,_){return{x:$-g/2,y:v-_/2}}function kF($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function i3($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let g=v.trim();if(!g)return;let _=l3($.canvasX,$.canvasY,$.width,$.height);if(!(await Ev({type:$.type,...$.type!=="webpage"?{title:kF(g,$.titleFallback)}:{},content:g,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function HF($,v){return[{label:"New note",action:()=>{let U=l3($,v,520,360);Ev({type:"markdown",title:"New note",x:U.x,y:U.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{i3({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:v,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{i3({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:v,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{i3({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:v,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let U=l3($,v,600,400);N_({title:"Group",x:U.x,y:U.y,width:600,height:400})}}]}function IF($){let v=[],g=WF($);if(v.push({label:"Focus",action:()=>Lv($.id)}),F_.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>z6($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>Q6($.id)});let _=R$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>Q4($.id)}),v.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let J=!$.pinned;Pv($.id,{pinned:J}),Zv($.id,{pinned:J}),t$()}});let U=y_.value;if(U&&U.from!==$.id){let J=T.value.get(U.from),b=J?(J.data.title||J.id).slice(0,20):U.from;v.push({label:`Connect from "${b}"`,action:()=>{A4(U.from,$.id,"relation"),y_.value=null}})}v.push({label:U?"Connect from here (replace)":"Connect from here",action:()=>{y_.value={from:$.id}}});let z=Array.from(c$.value.values()).filter((J)=>J.from===$.id||J.to===$.id).length;if(z>0)v.push({label:`${z} edge${z!==1?"s":""} connected`});if(v.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&g)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(g)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(g)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let J=$.data.chartConfig.title||"chart";v.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let J=$.data.url;if(v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank")}}),v.push({label:"Focus in TUI",action:()=>mO("mcp-app-focus",{url:J})}),$.type==="json-render"||$.type==="graph")v.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let J=typeof $.data.url==="string"?$.data.url:"";v.push({label:"Refresh webpage",action:()=>{M_($.id)}}),v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank","noopener")}}),v.push({label:"Copy URL",action:()=>{if(J)navigator.clipboard.writeText(J)}})}if($.type==="group"){let J=$.data.children??[];if(v.push({separator:!0}),v.push({render:(b)=>PF($,b)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>oO($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>r4($.id)});else v.push({label:"Dock left of toolbar",action:()=>y2($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>y2($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{S4($.id),Q_($.id)}}),v}function zP(){let $=R$.value.size;if($===0||X6.value||T_.value)return null;return G("div",{class:"context-pin-bar",children:[G("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),G("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:JK,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JP({node:$}){let v=M3($),g=$.data.activeTool,_=$.data.subagent,U=p0[v]??"var(--c-muted)";return G("span",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1,minWidth:0},children:[G("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:U,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{color:U,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),g&&G("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",g]},void 0,!0,void 0,this),_&&_.state!=="completed"&&G("span",{style:{color:"var(--c-subagent)",fontSize:"10px"},children:["⠉ ",_.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function YF($){switch($.type){case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$},void 0,!1,void 0,this);default:return null}}function LF($){let v=Array.isArray($.data.cards)?$.data.cards:[],g=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+g.length}function qF({node:$}){let v=GK(),g=v.length>0?v.length:LF($),_=g>0,U=$.collapsed===!0,z=()=>{q_(),Q6($.id)};if(U)return G("div",{class:"docked-node docked-node--collapsed","data-docked-node":"true",children:G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:"Context"},void 0,!1,void 0,this),_&&G("span",{class:"docked-node-count","aria-hidden":"true",children:g>99?"99+":g},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${g} item${g===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${g} item${g===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),r4($.id)},title:"Undock to canvas","aria-label":"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return G("aside",{class:"context-dock-panel","data-docked-node":"true","aria-label":"Agent context",children:[G("div",{class:"context-dock-header",children:[G("div",{class:"context-dock-header-text",children:[G("span",{class:"context-dock-title",children:"Context"},void 0,!1,void 0,this),G("span",{class:"context-dock-subtitle",children:_?`${g} item${g===1?"":"s"} in agent context`:"Active agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-controls",children:[G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),r4($.id)},"aria-label":"Undock to canvas",title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),Q6($.id)},"aria-label":"Collapse context panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-body",children:G(U4,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function x3({node:$}){if($.type==="context")return G(qF,{node:$},void 0,!1,void 0,this);return G("div",{class:`docked-node${$.collapsed?" docked-node--collapsed":""}`,"data-docked-node":"true",children:[G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:s$[$.type]??$.type},void 0,!1,void 0,this),$.type==="status"&&$.collapsed&&G(JP,{node:$},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),Q6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),r4($.id)},title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{class:"docked-node-body",children:YF($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bP($,v){switch($.type){case"markdown":return G(t_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return G(n0,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return G(a0,{node:$},void 0,!1,void 0,this);case"response":return G(s0,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"trace":return G(e0,{node:$},void 0,!1,void 0,this);case"file":return G(l_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return G(o0,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return G(ig,{node:$,expanded:v},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function GP($){switch($.type){case"markdown":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function XF($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function wF($,v){return $!==null&&typeof $==="object"&&$.source===pv&&$.type==="presentation-exit"&&$.token===v}function FF($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function OP($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function KP(){let $=j$.value,v=$?T.value.get($):void 0,[g,_]=o(!1),[U,z]=o(!1),[J,b]=o(""),O=y(null),K=y(null),W=Q(()=>{z(!1),v4()},[]),B=Q(()=>{b(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=Q((u)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:pv,token:J,...u},"*")},[J]),P=Q(()=>{z(!1)},[]),X=Q((u)=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),z(!1);return}if(u.key==="Tab"&&!OP(u.target)){u.preventDefault(),u.stopPropagation(),K.current?.focus();return}if((u.key===" "||u.key==="Enter")&&OP(u.target))return;if(!FF(u.key))return;u.preventDefault(),u.stopPropagation(),k({type:"presentation-key",key:u.key})},[k]),Y=Q((u)=>{if(u.target.classList.contains("expanded-overlay-backdrop"))v4()},[]),H=Q(()=>{if(!v)return;let u=GP(v);if(!u)return;navigator.clipboard.writeText(u).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),L=Q(()=>{if(!$)return;Q4($)},[$]);if(m(()=>{z(!1)},[$]),G_(()=>{if(!U)return;let u=()=>{let c=O.current;if(!c||c.contains(document.activeElement))return;c.focus()},S=[0,50,150].map((c)=>window.setTimeout(u,c)),U$=(c)=>{if(!wF(c.data,J))return;z(!1)};return document.addEventListener("keydown",X,!0),window.addEventListener("message",U$),()=>{S.forEach((c)=>{window.clearTimeout(c)}),document.removeEventListener("keydown",X,!0),window.removeEventListener("message",U$)}},[X,J,U]),!v)return null;let q=v.data.title||v.data.path?.split("/").pop()||s$[v.type],F=GP(v),N=XF(F),C=$?R$.value.has($):!1,p=F.length>0,r=iv.value===$,n=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",e=vB(v);return G("div",{class:"expanded-overlay-backdrop",onPointerDown:Y,style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(10,14,30,0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"32px",pointerEvents:r?"none":"auto"},children:G("div",{class:"expanded-overlay-panel",style:{flex:1,maxWidth:"1200px",display:"flex",flexDirection:"column",background:"var(--c-panel)",border:`1px solid ${C?"var(--c-warn)":"var(--c-accent)"}`,borderRadius:"var(--radius)",boxShadow:`0 0 0 1px ${C?"var(--c-warn)":"var(--c-accent)"}, 0 24px 80px rgba(0,0,0,0.6)`,overflow:"hidden"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",background:"var(--c-panel-glass)",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--c-accent-12)",color:"var(--c-accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:s$[v.type]},void 0,!1,void 0,this),G("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"var(--c-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q},void 0,!1,void 0,this),G("div",{class:"expanded-actions",children:[G("button",{type:"button",class:`expanded-action-btn ${C?"expanded-action-active":""}`,onClick:L,title:C?"Remove from context":"Pin as context",children:C?"✦ In context":"✦ Pin as context"},void 0,!1,void 0,this),p&&G("button",{type:"button",class:"expanded-action-btn",onClick:H,title:"Copy content to clipboard",children:g?"Copied!":"Copy"},void 0,!1,void 0,this),t0(v)&&G("button",{type:"button",class:"expanded-action-btn",onClick:()=>void d0(v),title:"Open as a full-page site in the system browser",children:"Open as site"},void 0,!1,void 0,this),e&&G("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:B,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this),N>0&&G("span",{class:"expanded-meta",children:[N.toLocaleString()," word",N!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("span",{style:{fontSize:"10px",color:r?"var(--c-warn)":"var(--c-muted)"},children:r?"Saving edits...":"Esc to close"},void 0,!1,void 0,this),G("button",{type:"button",onClick:W,style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 6px",fontSize:"16px",lineHeight:1,borderRadius:"4px"},onMouseEnter:(u)=>{u.target.style.color="var(--c-text)"},onMouseLeave:(u)=>{u.target.style.color="var(--c-muted)"},title:"Close (Esc)",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"16px",minHeight:0,...n?{display:"flex",flexDirection:"column"}:{}},children:n?G("div",{style:{flex:1,minHeight:0,display:"flex"},children:bP(v,!0)},void 0,!1,void 0,this):bP(v,!0)},void 0,!1,void 0,this),e&&U&&G("div",{ref:O,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${q}`,tabIndex:-1,onKeyDownCapture:X,children:[G("button",{ref:K,type:"button",class:"html-presentation-exit",onClick:P,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),G("div",{class:"html-presentation-stage",children:G(ig,{node:v,expanded:!0,presentation:!0,presentationExitToken:J},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var QU=180,SU=120,v2=20;function AF(){let $=h0();return{markdown:$.accent,"mcp-app":$.ok,webpage:$.warn,"json-render":$.ok,graph:$.purple,prompt:$.accent,response:$.ok,status:$.warn,context:$.muted,ledger:$.dim,trace:$.purple,file:$.accent,image:$.ok,html:$.warn,group:$.dim}}function ZF(){let $=h0();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function WP($,v,g,_){let U=Array.from($.values()),z=0,J=0,b=1000,O=800;if(U.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let H of U)z=Math.min(z,H.position.x),J=Math.min(J,H.position.y),b=Math.max(b,H.position.x+H.size.width),O=Math.max(O,H.position.y+H.size.height)}let K=-v.x/v.scale,W=-v.y/v.scale,B=K+g/v.scale,k=W+_/v.scale,P={minX:Math.min(z,K)-v2,minY:Math.min(J,W)-v2,maxX:Math.max(b,B)+v2,maxY:Math.max(O,k)+v2},X=P.maxX-P.minX||1,Y=P.maxY-P.minY||1;return{bounds:P,scale:Math.min(QU/X,SU/Y)}}function BP({viewport:$,nodes:v,edges:g,onNavigate:_,containerWidth:U,containerHeight:z}){let J=y(null),b=y(!1),O=y(null),K=y(null),W=Q(()=>{let Y=J.current;if(!Y)return;let H=Y.getContext("2d");if(!H)return;let L=v.value,q=g.value,F=$.value,N=window.devicePixelRatio||1;Y.width=QU*N,Y.height=SU*N,H.scale(N,N),H.clearRect(0,0,QU,SU);let C=h0();H.fillStyle=C.panel+"d9",H.fillRect(0,0,QU,SU);let p=WP(L,F,U,z);O.current=p;let{bounds:r,scale:n}=p,e=(M)=>(M-r.minX)*n,u=(M)=>(M-r.minY)*n,S=Array.from(L.values()),U$=AF();for(let M of S)H.fillStyle=U$[M.type]??C.muted,H.globalAlpha=0.6,H.fillRect(e(M.position.x),u(M.position.y),Math.max(4,M.size.width*n),Math.max(3,M.size.height*n));let c=ZF();for(let M of q.values()){let h=L.get(M.from),s=L.get(M.to);if(!h||!s)continue;let d=e(h.position.x+h.size.width/2),b$=u(h.position.y+h.size.height/2),g$=e(s.position.x+s.size.width/2),l=u(s.position.y+s.size.height/2);H.beginPath(),H.moveTo(d,b$),H.lineTo(g$,l),H.strokeStyle=c[M.type]??C.muted,H.globalAlpha=0.3,H.lineWidth=0.5,H.stroke()}let i=-F.x/F.scale,H$=-F.y/F.scale,q$=U/F.scale,h$=z/F.scale;H.globalAlpha=1,H.strokeStyle=C.accent,H.lineWidth=1.5,H.strokeRect(e(i),u(H$),q$*n,h$*n)},[v,g,$,U,z]),B=y(W);B.current=W;let k=Q(()=>{if(K.current!==null)return;K.current=window.requestAnimationFrame(()=>{K.current=null,B.current()})},[]);DO(()=>{T$.value,v.value,g.value,$.value,k()}),m(()=>{k()},[U,z,k]),m(()=>()=>{if(K.current!==null)window.cancelAnimationFrame(K.current),K.current=null},[]);let P=Q((Y)=>{let H=J.current;if(!H)return;let L=H.getBoundingClientRect(),q=Y.clientX-L.left,F=Y.clientY-L.top,N=O.current??WP(v.value,$.value,U,z);O.current=N;let{bounds:C,scale:p}=N,r=$.value,n=U/r.scale,e=z/r.scale,u=q/p+C.minX,S=F/p+C.minY;_(-(u-n/2)*r.scale,-(S-e/2)*r.scale)},[v,$,U,z,_]),X=Q((Y)=>{Y.stopPropagation(),b.current=!0,P(Y);let H=(q)=>{if(b.current)P(q)},L=()=>{b.current=!1,document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",L)};document.addEventListener("pointermove",H),document.addEventListener("pointerup",L)},[P]);return G("div",{style:{position:"fixed",bottom:"16px",right:"16px",zIndex:9998,border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",overflow:"hidden",boxShadow:"0 4px 16px var(--c-shadow)"},children:G("canvas",{ref:J,width:QU,height:SU,style:{width:`${QU}px`,height:`${SU}px`,display:"block",cursor:"pointer"},onPointerDown:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function PP(){let $=i$.value.size,v=Q(()=>{let U=Array.from(i$.value);if(U.length===0)return;zK(U),jv()},[]),g=Q(()=>{let U=Array.from(i$.value);if(U.length===0)return;N_({title:"Group",childIds:U}),jv()},[]),_=Q(()=>{let U=Array.from(i$.value);for(let z=0;z<U.length;z++)for(let J=z+1;J<U.length;J++)A4(U[z],U[J],"relation");jv()},[]);if($===0)return null;return G("div",{class:"selection-bar",children:[G("span",{class:"selection-bar-count",children:["✦"," ",$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-pin-ctx",onClick:v,children:"Pin as context"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:g,children:"Group"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:_,children:"Connect"},void 0,!1,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-clear",onClick:jv,title:"Clear selection",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var MF=[{title:"Navigation",shortcuts:[{keys:`${Qv}+K`,desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:`${Qv}+0`,desc:"Reset viewport to origin"},{keys:`${Qv}++ / ${Qv}+−`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Shift+Drag",desc:"Lasso select multiple nodes"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in toolbar)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function kP({onClose:$}){return G("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:G("div",{class:"shortcut-overlay",onMouseDown:(v)=>v.stopPropagation(),children:[G("div",{class:"shortcut-overlay-header",children:[G("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),G("span",{class:"shortcut-overlay-hint",children:["Press ",G("kbd",{children:"?"},void 0,!1,void 0,this)," or ",G("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"shortcut-overlay-body",children:MF.map((v)=>G("div",{class:"shortcut-group",children:[G("div",{class:"shortcut-group-title",children:v.title},void 0,!1,void 0,this),v.shortcuts.map((g)=>G("div",{class:"shortcut-row",children:[G("kbd",{class:"shortcut-keys",children:g.keys},void 0,!1,void 0,this),G("span",{class:"shortcut-desc",children:g.desc},void 0,!1,void 0,this)]},g.keys,!0,void 0,this))]},v.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function QF($){let v=Date.now()-new Date($).getTime(),g=Math.floor(v/60000);if(g<1)return"just now";if(g<60)return`${g}m ago`;let _=Math.floor(g/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function HP({open:$,onClose:v,anchorRef:g}){let[_,U]=o([]),[z,J]=o(!1),[b,O]=o(!1),[K,W]=o(null),[B,k]=o(""),[P,X]=o(null),Y=y(null),H=y(null);m(()=>{if(!$)return;J(!0),nO().then((r)=>{U(r),J(!1)})},[$]),m(()=>{if($)setTimeout(()=>H.current?.focus(),50)},[$]),m(()=>{if(!$)return;let r=(n)=>{let e=Y.current,u=g.current;if(e&&!e.contains(n.target)&&u&&!u.contains(n.target))v()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[$,v]),m(()=>{if(!$)return;let r=(n)=>{if(n.key==="Escape")v()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[$,v]);let L=Q(async()=>{let r=B.trim();if(!r)return;O(!0);let n=await tO(r);if(O(!1),n.ok&&n.snapshot)U((e)=>[n.snapshot,...e]),k("")},[B]),q=Q(async(r)=>{X(null),W(r);let n=await dO(r);if(W(null),n.ok)v()},[v]),F=Q(async(r)=>{if((await aO(r)).ok)U((e)=>e.filter((u)=>u.id!==r));X(null)},[]);if(!$)return null;let N=g.current?.getBoundingClientRect(),C=N?Math.max(8,N.left-120):100,p=N?N.bottom+8:48;return G("div",{ref:Y,class:"snapshot-panel",style:{left:`${C}px`,top:`${p}px`},children:[G("div",{class:"snapshot-panel-header",children:[G("span",{class:"snapshot-panel-title",children:"Snapshots"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-panel-close",onClick:v,title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-save-form",children:[G("input",{ref:H,type:"text",class:"snapshot-name-input",value:B,onInput:(r)=>k(r.target.value),onKeyDown:(r)=>{if(r.key==="Enter")L()},placeholder:"Snapshot name...",maxLength:80,disabled:b},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-save-btn",onClick:L,disabled:!B.trim()||b,children:b?"...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),G("div",{class:"snapshot-list",children:[z&&G("div",{class:"snapshot-empty",children:"Loading..."},void 0,!1,void 0,this),!z&&_.length===0&&G("div",{class:"snapshot-empty",children:"No snapshots yet. Save one to capture the current canvas state."},void 0,!1,void 0,this),!z&&_.map((r)=>G("div",{class:"snapshot-item",children:[G("div",{class:"snapshot-item-info",children:[G("span",{class:"snapshot-item-name",children:r.name},void 0,!1,void 0,this),G("span",{class:"snapshot-item-meta",children:[r.nodeCount," node",r.nodeCount!==1?"s":"",r.edgeCount>0?` · ${r.edgeCount} edge${r.edgeCount!==1?"s":""}`:""," · ",QF(r.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-actions",children:P?.id===r.id?G(a$,{children:[G("button",{type:"button",class:`snapshot-action-btn ${P.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>P.action==="delete"?F(r.id):q(r.id),title:P.action==="delete"?"Confirm delete":"Confirm restore",disabled:K!==null,children:P.action==="delete"?"Delete":K===r.id?"Restoring...":"Confirm"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn",onClick:()=>X(null),title:"Cancel",disabled:K!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(a$,{children:[G("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>X({id:r.id,action:"restore"}),title:"Restore this snapshot",disabled:K!==null,children:K===r.id?"Restoring...":"Restore"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>X({id:r.id,action:"delete"}),title:"Delete this snapshot",disabled:K!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},r.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IP($,v,g,_,U){return $.x<_.position.x+_.size.width+U&&$.x+v+U>_.position.x&&$.y<_.position.y+_.size.height+U&&$.y+g+U>_.position.y}function SF($,v,g,_,U){return _.some((z)=>IP($,v,g,z,U))}function NF($,v,g,_,U){return _.find((z)=>IP($,v,g,z,U))}function U2($,v,g,_=24){if($.length===0)return{x:40,y:80};let U=$[$.length-1],z={x:U.position.x+U.size.width+_,y:U.position.y};if(!SF(z,v,g,$,_))return z;let J=40,b=80,O=3000,K=b;for(let B=0;B<20;B++){let k=J;while(k+v<O){let Y=NF({x:k,y:K},v,g,$,_);if(!Y)return{x:k,y:K};k=Y.position.x+Y.size.width+_}K=$.filter((Y)=>Y.position.y<=K+g+_&&Y.position.y+Y.size.height+_>K).reduce((Y,H)=>Math.max(Y,H.position.y+H.size.height),K)+_}let W=$.reduce((B,k)=>Math.max(B,k.position.y+k.size.height),0);return{x:J,y:W+_}}var x6={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function pg($,v,g,_={}){let U=x6[v];return{id:$,type:v,position:_.position??{x:U.x,y:U.y},size:_.size??{width:U.w,height:U.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_.dockPosition??null,data:g}}var k4=null,_2=null,h3=0,h6=null,rF=3000,uF=2000,yF=5000,og=!1,P6=null,NU=null,o6=0,p6=null;function DF(){if(typeof location>"u")return null;let $=new URLSearchParams(location.search).get("transport");return $==="poll"||$==="sse"?$:null}var rU=new Map;function ng($){let v=0;for(let g=0;g<$.length;g++)v=(v<<5)-v+$.charCodeAt(g)|0;return Math.abs(v).toString(36)}function z2($){if(!_2)return $;let v=_2.get($.id);if(!v)return $;return{...$,position:v.position??$.position,size:v.size??$.size,collapsed:v.collapsed??$.collapsed,pinned:v.pinned??$.pinned,dockPosition:v.dockPosition!==void 0?v.dockPosition:$.dockPosition}}function tg($,v,g,_=null){return z2(pg($,v,g,{dockPosition:_}))}function RF(){return U2([...T.value.values()],x6.markdown.w,x6.markdown.h)}function n6(){if(!T.value.has("status-main"))_6(tg("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function TF($,v){let g=`md-${ng($)}`;if(T.value.get(g))v$(g,{path:$,title:v}),D$.value=g;else{let U=RF(),z=tg(g,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=U,_6(z),!z.dockPosition)Lv(g)}}function jF($){if(T.value.get("context-main"))v$("context-main",{cards:$});else if($.length>0){let _=tg("context-main","context",{cards:$});_6(_)}}function VF($){let v=$.url,g=`mcp-${ng(v)}`;if(T.value.get(g))v$(g,$);else _6(tg(g,"mcp-app",$)),Lv(g)}function CF($){let v=$.toolCallId,_=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(v.startsWith("ext-app-")?v:`ext-app-${v}`);if(T.value.get(_)){v$(_,$);return}let{serverName:z,toolName:J}=$;if(z&&J){for(let[H,L]of T.value.entries())if(L.type==="mcp-app"&&L.data.mode==="ext-app"&&L.data.serverName===z&&L.data.toolName===J&&!L.data.toolResult){v$(H,{...$});return}}let{_x:b,_y:O,_width:K,_height:W}=$,B=x6["mcp-app"],k=K??B.w,P=W??B.h,X=b===void 0||O===void 0?U2([...T.value.values()],k,P):null,Y=z2(pg(_,"mcp-app",{mode:"ext-app",...$},{position:{x:b??X?.x??B.x,y:O??X?.y??B.y},size:{width:k,height:P}}));if(_6(Y),!Y.dockPosition)Lv(_,{recordHistory:!1})}function fF($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(T.value.has(v))return v;let g=`ext-app-${$}`;if(g!==v&&T.value.has(g))return g;for(let[_,U]of T.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.toolCallId===$)return _;return null}function qP($){let v=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(v&&T.value.has(v))return v;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return fF($.toolCallId)}function XP($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let g=null;for(let[_,U]of T.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.serverName===$&&U.data.toolName===v&&!U.data.toolResult){if(g)return null;g=_}return g}function wP($){if(T.value.get("ledger-main"))v$("ledger-main",$);else{let _=tg("ledger-main","ledger",$,"right");_.collapsed=!0,_6(_)}}function FP($){if(!($==="dark"||$==="light"||$==="high-contrast"))return;if(document.documentElement.setAttribute("data-theme",$),qU(),T$.value!==$)T$.value=$}function mF($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="image"||$==="html"||$==="group"}function cF($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function p3($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.x!=="number"||typeof v.y!=="number")return null;return{x:v.x,y:v.y}}function AP($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.width!=="number"||typeof v.height!=="number")return null;return{width:v.width,height:v.height}}function EF($){let v=p3($),g=AP($);return v&&g?{...v,...g}:null}function iF($){if(typeof $.id!=="string"||!$.id)return null;if(!mF($.type))return null;let v=p3($.position),g=AP($.size);if(!v||!g)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,U=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:g,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:U}}function lF($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!cF($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function xF($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>p3(_)).filter((_)=>_!==null),g=EF($.bounds);if(v.length<($.type==="text"?1:2)||!g)return null;return{id:$.id,type:$.type,points:v,bounds:g,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}function hF($){if($4.value=$.sessionId||"",lv.value="connected",typeof $.theme==="string")FP($.theme);if($.ledgerSummary)wP($.ledgerSummary)}function pF($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,g=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(TF(v,g),$.ledgerSummary)wP($.ledgerSummary)}function oF($){n6(),v$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function nF($){n6(),v$("status-main",{phase:$.phase,detail:$.detail})}function tF($){let v=$.cards??[];jF(v)}function dF($){if(typeof $.url==="string"&&$.url)VF({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function aF($){let v=$.sessions??[];for(let g of v){let _=g.url;if(!_)continue;let U=`mcp-${ng(_)}`;if(T.value.has(U))v$(U,{sessionState:g.state,lastSeenAt:g.lastSeenAt})}}function sF($){if(typeof $.url==="string"&&$.url){let v=`mcp-${ng($.url)}`;if(T.value.has(v))v$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function eF($){let g=T.value.get("context-main");if(!g)return;let _=(g.data.auxTabs??[]).concat($);v$("context-main",{auxTabs:_})}function $A($){if(T.value.has("context-main"))if($.mode==="all")v$("context-main",{auxTabs:[]});else{let _=T.value.get("context-main");if(!_)return;let U=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);v$("context-main",{auxTabs:U})}}function vA($){n6(),v$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function UA($){n6(),v$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function gA($){n6(),v$("status-main",{activeTool:null})}function _A($){if($.state==="active"&&$.path){let g=`md-${ng($.path)}`;if(T.value.has(g))v$(g,{reviewActive:!0})}}function zA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;CF({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function JA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=qP($)??XP($.serverName,$.toolName);if(!v)return;if(T.value.has(v))v$(v,{html:$.html})}function bA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=qP($)??XP($.serverName,$.toolName);if(!v)return;if(T.value.has(v)){if($.success===!1){S4(v);return}v$(v,{toolResult:X3({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function GA($){n6(),v$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function OA($){let v=$.nodeId;if(!v)return;let g=$.text||"",_=$.position,U=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&T.value.has($.threadNodeId)){let J=$.threadNodeId,b=T.value.get(J);if(!b)return;let O=Array.isArray(b.data.turns)?[...b.data.turns]:[],K=O[O.length-1];if(!K||K.role!=="user"||K.text!==g)O.push({role:"user",text:g,status:"pending"});v$(J,{turns:O,threadStatus:"pending"});return}if(!T.value.has(v)){let J=_??x6.prompt;_6(z2(pg(v,"prompt",{text:g,turns:g?[{role:"user",text:g,status:"pending"}]:[],threadStatus:g?"pending":"draft",status:g?"pending":"draft",parentNodeId:U,contextNodeIds:z},{position:{x:J.x,y:J.y}}))),Lv(v)}if(U&&T.value.has(U))R_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",style:"dashed"})}function KA($){let{nodeId:v,status:g}=$;if(v&&T.value.has(v))v$(v,{status:g})}function WA($){let{responseNodeId:v,promptNodeId:g}=$;if(!v)return;let _=g?T.value.get(g):void 0;if(_&&Array.isArray(_.data.turns)){rU.set(v,g);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),v$(g,{turns:z,threadStatus:"streaming",_activeResponseId:v}),Lv(g);return}let U=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:x6.response.x,y:x6.response.y};if(!T.value.has(v))_6(z2(pg(v,"response",{content:"",status:"streaming",promptNodeId:g},{position:U})));if(g)R_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",animated:!0});Lv(v)}function BA($){let v=$.responseNodeId;if(!v)return;let g=rU.get(v);if(g){let _=T.value.get(g);if(_&&Array.isArray(_.data.turns)){let U=[..._.data.turns],z=U[U.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";v$(g,{turns:U,threadStatus:"streaming"})}return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"streaming"})}function PA($){let v=$.responseNodeId;if(!v)return;let g=rU.get(v);if(g){let z=T.value.get(g);if(z&&Array.isArray(z.data.turns)){let J=[...z.data.turns],b=J[J.length-1];if(b&&b.role==="assistant")b.text=$.content,b.status="complete";v$(g,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}rU.delete(v);return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"complete"});let U=T.value.get(v)?.data.promptNodeId;if(U){let z=`edge-${U}-${v}`,J=c$.value.get(z);if(J)OK(z),R_({...J,animated:!1})}}function kA($){let v=$.layout;if(!v?.nodes)return;let g=!F6.value;F6.value=!0;let _=v.nodes.map(iF).filter((b)=>b!==null),U=Array.isArray(v.edges)?v.edges.map(lF).filter((b)=>b!==null):Array.from(c$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(xF).filter((b)=>b!==null):void 0,J=v.viewport?{x:typeof v.viewport.x==="number"?v.viewport.x:0,y:typeof v.viewport.y==="number"?v.viewport.y:0,scale:typeof v.viewport.scale==="number"?v.viewport.scale:1}:void 0;u4(),IK({...J?{viewport:J}:{},nodes:_,edges:U,...z?{annotations:z}:{}},{applyViewport:g}),E2({event:"canvas-layout-update",data:$})}function HA($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function IA($){let v=$.nodeId;if(v&&T.value.has(v)){if($.noPan===!0){M6(v);return}Lv(v)}}function YA($){let v=$.viewport;if(!v)return;let g=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,U=typeof v.scale==="number"?v.scale:1;u4(),PK({x:g,y:_,scale:U})}function LA($){if(T.value.get("context-main"))v$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function qA($){u_.value=$.enabled===!0}function XA($){if(typeof $.theme==="string")FP($.theme)}function wA($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((g)=>typeof g==="string"):[];bK(v),E2({event:"context-pins-changed",data:$})}var g2=null;function YP(){if(g2)clearTimeout(g2);g2=setTimeout(()=>{g2=null,xO().then(($)=>{A6.value=$})},150)}function FA($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;OB(v)}function AA($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)WB(v,typeof $.nodeId==="string"?$.nodeId:void 0);else D3(v)}var ZP={connected:hF,"workbench-open":pF,"canvas-status":oF,"execution-phase":nF,"context-cards":tF,"mcp-app-candidate":dF,"mcp-app-host-snapshot":aF,"mcp-app-host-fallback":sF,"aux-open":eF,"aux-close":$A,"assistant-complete":vA,"tool-start":UA,"tool-complete":gA,"review-state":_A,"subagent-status":GA,"ext-app-open":zA,"ext-app-update":JA,"ext-app-result":bA,"context-pins-changed":wA,"canvas-layout-update":kA,"canvas-focus-node":IA,"canvas-viewport-update":YA,"context-usage":LA,"trace-state":qA,"theme-changed":XA,"canvas-prompt-created":OA,"canvas-prompt-status":KA,"canvas-response-start":WA,"canvas-response-delta":BA,"canvas-response-complete":PA,"ax-state-changed":YP,"ax-event-created":YP,"ax-intent":FA,"ax-intent-clear":AA};function MP($,v){let g=ZP[$];if(!g)return;let _=g;try{_(v)}catch(U){console.warn(`[sse-bridge] Handler for "${$}" failed:`,U)}}function LP(){og=!0,o6+=1;let $=o6;lv.value="connecting";let v=null,g=!1,_=async()=>{if($!==o6)return;try{let U=new URLSearchParams;if(NU!==null)U.set("since",String(NU));let z=$4.value;if(z)U.set("session",z);let J=U.toString(),b=await fetch(`/api/workbench/poll${J?`?${J}`:""}`);if($!==o6)return;if(!b.ok)throw Error(`poll failed with HTTP ${b.status}`);let O=await b.json();if($!==o6)return;if(!O.ok)throw Error("poll returned ok: false");let K=v;if(v=O.sessionId??null,K!==null&&O.sessionId&&K!==O.sessionId&&!O.snapshot){NU=null,P6=setTimeout(()=>void _(),0);return}if(O.snapshot&&g)_2=D2(),n6(),F6.value=!1,c2(),R3(),rU.clear();for(let W of O.events)MP(W.event,W.payload);g=!0,NU=O.seq,lv.value="connected",P6=setTimeout(()=>void _(),uF)}catch(U){if($!==o6)return;console.warn("[sse-bridge] poll transport error:",U),lv.value="disconnected",P6=setTimeout(()=>void _(),yF)}};return _(),()=>{if(o6+=1,og=!1,NU=null,P6)clearTimeout(P6),P6=null}}function o3(){if(_2=D2(),n6(),F6.value=!1,c2(),R3(),rU.clear(),h6)clearTimeout(h6),h6=null;let $=DF();if($==="poll"||og)return LP();let v=$4.value,g=v?`/api/workbench/events?session=${v}`:"/api/workbench/events";lv.value="connecting";let _=new EventSource(g);k4=_;let U=!1;if(p6)clearTimeout(p6);if(p6=null,$!=="sse")p6=setTimeout(()=>{if(p6=null,U||k4!==_)return;console.warn("[sse-bridge] No SSE event within watchdog window — switching to polling transport."),_.close(),k4=null,LP()},rF);for(let[z]of Object.entries(ZP))_.addEventListener(z,(J)=>{U=!0;try{MP(z,JSON.parse(J.data))}catch(b){console.warn(`[sse-bridge] Failed to parse "${z}" event:`,b)}});return _.onopen=()=>{if(k4!==_)return;h3=0,lv.value="connected"},_.onerror=()=>{if(k4!==_)return;lv.value="disconnected",_.close(),k4=null,h3+=1,h6=setTimeout(()=>{h6=null,o3()},HA(h3))},()=>{if(h6)clearTimeout(h6),h6=null;if(p6)clearTimeout(p6),p6=null;if(og){if(o6+=1,og=!1,NU=null,P6)clearTimeout(P6),P6=null}_.close(),k4=null}}function ZA($,v){console.error(`[app] ${$} failed`,v)}function QP($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((g)=>{ZA("sendIntent",g)})}function Jv({label:$,detail:v,shortcut:g,align:_="center",children:U}){return G("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[U,G("span",{class:"toolbar-tooltip",role:"tooltip",children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||g)&&G("span",{class:"toolbar-tooltip-meta",children:[v&&G("span",{children:v},void 0,!1,void 0,this),g&&G("kbd",{class:"toolbar-tooltip-shortcut",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function MA({minimapVisible:$,onToggleMinimap:v,snapshotOpen:g,onToggleSnapshot:_,snapshotBtnRef:U,onOpenPalette:z,onOpenShortcuts:J,annotationTool:b,onToggleAnnotationMode:O,onToggleAnnotationEraser:K,onToggleTextAnnotation:W}){let B=lv.value,k=F6.value,P=P$.value,X=T.value.size,Y=c$.value.size,H=u_.value,L=Array.from(T.value.values()).filter((C)=>C.type==="trace").length,q=B==="connected"&&!k?"syncing":B,F=q.charAt(0).toUpperCase()+q.slice(1),N=k?[`${X} node${X!==1?"s":""}`,...Y>0?[`${Y} edge${Y!==1?"s":""}`]:[],...L>0?[`${L} trace${L!==1?"s":""}`]:H?["trace armed"]:[]].join(" · "):"Syncing canvas…";return G("div",{class:"toolbar-group",children:[G("div",{class:"canvas-toolbar",children:[G(Jv,{label:"PMX Canvas",detail:"Focus Field · spatial workbench for coding agents",align:"start",children:G("span",{class:"canvas-brand","aria-label":"PMX Canvas",children:G(uB,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Canvas status",detail:k?F:"Syncing canvas from server",align:"start",children:G("span",{class:`connection-dot ${B}`,"aria-label":`Canvas status: ${q}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"11px",color:"var(--c-muted)"},children:$4.value?$4.value.slice(0,12):"…"},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Fit canvas",detail:"Frame every node on screen",children:G("button",{type:"button",onClick:()=>j_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:G(kB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Reset view",shortcut:`${Qv}+0`,children:G("button",{type:"button",onClick:()=>xv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:G(HB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom in",shortcut:`${Qv}++`,children:G("button",{type:"button",onClick:()=>xv({...P,scale:Math.min(4,P.scale*1.25)},150),"aria-label":"Zoom in",children:G(IB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom out",shortcut:`${Qv}+-`,children:G("button",{type:"button",onClick:()=>xv({...P,scale:Math.max(0.1,P.scale/1.25)},150),"aria-label":"Zoom out",children:G(YB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)",minWidth:"36px",textAlign:"center"},children:[Math.round(P.scale*100),"%"]},void 0,!0,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Arrange layout",detail:Y>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:G("button",{type:"button",onClick:()=>Y>0?C_():V_(),"aria-label":"Arrange layout",children:G(LB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:$?"Hide minimap":"Show minimap",detail:"Quickly navigate large canvases",children:G("button",{type:"button",onClick:v,"aria-label":$?"Hide minimap":"Show minimap",style:{color:$?"var(--c-accent)":void 0},children:G(qB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:`Switch to ${T$.value==="dark"?"light":"dark"} theme`,detail:`Current theme: ${T$.value}`,children:G("button",{type:"button",onClick:()=>{let C=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",C),qU(),T$.value=C,Z_(C)},"aria-label":`Switch to ${T$.value==="dark"?"light":"dark"} theme`,children:T$.value==="dark"?G(XB,{},void 0,!1,void 0,this):G(wB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Snapshots",detail:"Capture and restore canvas states",align:"end",children:G("button",{ref:U,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:g?"var(--c-accent)":void 0},children:G(MB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"canvas-toolbar",children:[G(Jv,{label:H?"Disable trace":"Enable trace",detail:H?"Stop collecting new trace nodes":"Capture agent execution on the canvas",children:G("button",{type:"button",onClick:()=>QP("trace-toggle",{enabled:!H}),"aria-label":H?"Disable trace":"Enable trace",style:{color:H?"var(--c-purple)":void 0},children:G(QB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||L>0)&&G(Jv,{label:"Clear trace",detail:L>0?`Remove ${L} trace node${L===1?"":"s"}`:"Trace is enabled but still empty",children:G("button",{type:"button",onClick:()=>QP("trace-clear"),"aria-label":"Clear trace",children:G(SB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:b==="pen"?"Stop annotating":"Annotate canvas",detail:"Draw directly on the canvas for human-visible markup",children:G("button",{type:"button",onClick:O,"aria-label":b==="pen"?"Stop annotating":"Annotate canvas","aria-pressed":b==="pen",style:{color:b==="pen"?"var(--c-accent)":void 0},children:G(FB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="eraser"?"Stop erasing":"Erase annotations",detail:"Click a drawn annotation to remove it",children:G("button",{type:"button",onClick:K,"aria-label":b==="eraser"?"Stop erasing":"Erase annotations","aria-pressed":b==="eraser",style:{color:b==="eraser"?"var(--c-accent)":void 0},children:G(AB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="text"?"Stop text annotations":"Text annotations",detail:"Click anywhere to type an intent note",children:G("button",{type:"button",onClick:W,"aria-label":b==="text"?"Stop text annotations":"Text annotations","aria-pressed":b==="text",style:{color:b==="text"?"var(--c-accent)":void 0},children:G(ZB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Search nodes and actions",shortcut:`${Qv}+K`,children:G("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:G(NB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Keyboard shortcuts",shortcut:"?",align:"end",children:G("button",{type:"button",onClick:J,"aria-label":"Keyboard shortcuts",children:G(rB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)"},children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function QA({onOpenPalette:$}){return G("div",{class:"welcome-card",children:[G("div",{class:"welcome-icon",children:"◇"},void 0,!1,void 0,this),G("div",{class:"welcome-title",children:"Shape What The Agent Sees"},void 0,!1,void 0,this),G("div",{class:"welcome-subtitle",children:"Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The board will reflect the active focus."},void 0,!1,void 0,this),G("div",{class:"welcome-hints",children:[G("button",{type:"button",class:"welcome-hint",onClick:$,children:[G("kbd",{children:[Qv,"+K"]},void 0,!0,void 0,this),G("span",{children:"Create a note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Drop files"},void 0,!1,void 0,this),G("span",{children:"Add evidence to the board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"✦"},void 0,!1,void 0,this),G("span",{children:"Pin important nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Move nearby"},void 0,!1,void 0,this),G("span",{children:"Shape the focus field"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-footer",children:"The canvas is a shared attention surface, not just an editor."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SP(){let[$,v]=o(!0),[g,_]=o(!1),[U,z]=o(!1),[J,b]=o(!1),[O,K]=o(null),W=y(null),{menu:B,openNodeMenu:k,openCanvasMenu:P,closeMenu:X}=UP(),Y=F6.value,H=Q(()=>v((u)=>!u),[]),L=Q(()=>_((u)=>!u),[]),q=Q(()=>_(!1),[]),F=Q(()=>K((u)=>u==="pen"?null:"pen"),[]),N=Q(()=>K((u)=>u==="eraser"?null:"eraser"),[]),C=Q(()=>K((u)=>u==="text"?null:"text"),[]),p=Q((u,S)=>{xv({x:u,y:S,scale:P$.value.scale},200)},[]);m(()=>{return o3()},[]),m(()=>{let u=(S)=>{let U$=S.metaKey||S.ctrlKey;if(U$&&S.key==="k"){S.preventDefault(),z((i)=>!i);return}if(S.key==="Escape"&&O){S.preventDefault(),K(null);return}if(S.key==="Escape"&&j$.value&&!iv.value){S.preventDefault(),v4();return}if(S.key==="Escape"&&U){S.preventDefault(),z(!1);return}if(S.key==="Escape"&&J){S.preventDefault(),b(!1);return}let c=S.target?.tagName;if(c==="INPUT"||c==="TEXTAREA")return;if(S.key==="?"||S.key==="/"&&S.shiftKey){S.preventDefault(),b((i)=>!i);return}if(U$&&S.key==="0")S.preventDefault(),xv({x:0,y:0,scale:1},250);else if(U$&&(S.key==="="||S.key==="+")){S.preventDefault();let i=P$.value;xv({...i,scale:Math.min(4,i.scale*1.25)},150)}else if(U$&&S.key==="-"){S.preventDefault();let i=P$.value;xv({...i,scale:Math.max(0.1,i.scale/1.25)},150)}else if(S.key==="Escape"){if(i$.value.size>0){jv();return}D$.value=null,X()}else if(S.key==="Tab")S.preventDefault(),LK(S.shiftKey?-1:1);else if(D$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(S.key)){S.preventDefault();let i=S.key.replace("Arrow","").toLowerCase();qK(i)}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[O,X,U,J]),m(()=>{if(!Y)return;let u=window.__pmxCanvasBootstrapReady;if(typeof u==="function")u()},[Y]);let r=Array.from(T.value.values()),n=r.filter((u)=>u.dockPosition==="left"),e=r.filter((u)=>u.dockPosition==="right").sort((u,S)=>{let U$={context:0,ledger:1};return(U$[u.type]??2)-(U$[S.type]??2)});return G("div",{style:{width:"100%",height:"100%",position:"relative"},children:[G("div",{class:"hud-layer",children:[G("div",{class:"hud-left",children:n.map((u)=>G(x3,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this),G(MA,{minimapVisible:$,onToggleMinimap:H,snapshotOpen:g,onToggleSnapshot:L,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>b((u)=>!u),annotationTool:O,onToggleAnnotationMode:F,onToggleAnnotationEraser:N,onToggleTextAnnotation:C},void 0,!1,void 0,this),G("div",{class:"hud-right",children:e.map((u)=>G(x3,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(wK,{},void 0,!1,void 0,this),G(XK,{},void 0,!1,void 0,this),G($P,{onNodeContextMenu:k,onCanvasContextMenu:P,annotationMode:O!==null,annotationTool:O},void 0,!1,void 0,this),Y&&r.filter((u)=>!u.dockPosition).length===0&&Yv.value.size===0&&G(QA,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),i$.value.size>0&&G(PP,{},void 0,!1,void 0,this),R$.value.size>0&&G(zP,{},void 0,!1,void 0,this),j$.value&&G(KP,{},void 0,!1,void 0,this),G(HP,{open:g,onClose:q,anchorRef:W},void 0,!1,void 0,this),$&&G(BP,{viewport:P$,nodes:T,edges:c$,onNavigate:p,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&G(gP,{menu:B,onClose:X},void 0,!1,void 0,this),U&&G(vP,{onClose:()=>z(!1),onToggleMinimap:H},void 0,!1,void 0,this),J&&G(kP,{onClose:()=>b(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var NP=document.getElementById("app");if(NP)WO(G(SP,{},void 0,!1,void 0,this),NP);