@clawos-dev/clawd 0.2.431 → 0.2.432
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.
package/dist/cli.cjs
CHANGED
|
@@ -62634,7 +62634,7 @@ function computeMethodAccess(args) {
|
|
|
62634
62634
|
}
|
|
62635
62635
|
|
|
62636
62636
|
// src/version.ts
|
|
62637
|
-
var version = "0.2.
|
|
62637
|
+
var version = "0.2.432".length > 0 ? "0.2.432" : "dev";
|
|
62638
62638
|
|
|
62639
62639
|
// src/cli-probe/probe.ts
|
|
62640
62640
|
var fs65 = __toESM(require("fs"), 1);
|
|
@@ -64789,6 +64789,7 @@ function withMaster(members) {
|
|
|
64789
64789
|
return members.some((m2) => !m2.deviceId && m2.personaId === MASTER_PERSONA_ID) ? members : [{ personaId: MASTER_PERSONA_ID }, ...members];
|
|
64790
64790
|
}
|
|
64791
64791
|
function buildChannelHandlers(deps) {
|
|
64792
|
+
const announceChanged = (channelId) => deps.broadcast({ type: "channel:changed", channelId });
|
|
64792
64793
|
return {
|
|
64793
64794
|
"channel:list": async () => ({
|
|
64794
64795
|
response: ChannelListResultSchema.parse({ channels: deps.channelStore.list() })
|
|
@@ -64800,6 +64801,7 @@ function buildChannelHandlers(deps) {
|
|
|
64800
64801
|
memberPersonas: withMaster(args.memberPersonas),
|
|
64801
64802
|
memberContactDeviceIds: args.memberContactDeviceIds
|
|
64802
64803
|
});
|
|
64804
|
+
announceChanged(channel.id);
|
|
64803
64805
|
return { response: ChannelResultSchema.parse({ channel }) };
|
|
64804
64806
|
},
|
|
64805
64807
|
"channel:update": async (frame) => {
|
|
@@ -64813,6 +64815,7 @@ function buildChannelHandlers(deps) {
|
|
|
64813
64815
|
if (!channel) {
|
|
64814
64816
|
throw new ClawdError(ERROR_CODES.INVALID_PARAM, `channel not found: ${args.channelId}`);
|
|
64815
64817
|
}
|
|
64818
|
+
announceChanged(args.channelId);
|
|
64816
64819
|
return { response: ChannelResultSchema.parse({ channel }) };
|
|
64817
64820
|
},
|
|
64818
64821
|
"channel:delete": async (frame) => {
|
|
@@ -64828,6 +64831,7 @@ function buildChannelHandlers(deps) {
|
|
|
64828
64831
|
}
|
|
64829
64832
|
const removedTopics = deps.topicStore.removeByChannel(channelId);
|
|
64830
64833
|
deps.channelStore.remove(channelId);
|
|
64834
|
+
announceChanged(channelId);
|
|
64831
64835
|
return { response: ChannelDeleteResultSchema.parse({ ok: true, removedTopics }) };
|
|
64832
64836
|
}
|
|
64833
64837
|
};
|
|
@@ -64864,6 +64868,7 @@ function buildTopicHandlers(deps) {
|
|
|
64864
64868
|
if (!t) throw new ClawdError(ERROR_CODES.INVALID_PARAM, `topic not found: ${topicId}`);
|
|
64865
64869
|
return t;
|
|
64866
64870
|
};
|
|
64871
|
+
const announceChanged = (topic) => deps.broadcast({ type: "channel:changed", channelId: topic.channelId, topicId: topic.id });
|
|
64867
64872
|
const linesOf = (t) => {
|
|
64868
64873
|
const records = deps.dispatchStore.list({ sourceSessionId: t.masterSessionId });
|
|
64869
64874
|
const inCreationOrder = records.slice().sort((a, b2) => a.createdAt < b2.createdAt ? -1 : a.createdAt > b2.createdAt ? 1 : 0);
|
|
@@ -64911,6 +64916,7 @@ function buildTopicHandlers(deps) {
|
|
|
64911
64916
|
...args.title ? { title: args.title } : {},
|
|
64912
64917
|
masterSessionId: sessionId
|
|
64913
64918
|
});
|
|
64919
|
+
announceChanged(topic);
|
|
64914
64920
|
return {
|
|
64915
64921
|
response: TopicCreateResultSchema.parse({
|
|
64916
64922
|
topicId: topic.id,
|
|
@@ -64928,11 +64934,12 @@ function buildTopicHandlers(deps) {
|
|
|
64928
64934
|
boundaries: args.boundaries,
|
|
64929
64935
|
acceptanceCriteria: args.acceptanceCriteria
|
|
64930
64936
|
});
|
|
64937
|
+
announceChanged(topic);
|
|
64931
64938
|
return { response: TopicResultSchema.parse({ topic }) };
|
|
64932
64939
|
},
|
|
64933
64940
|
"topic:append": async (frame) => {
|
|
64934
64941
|
const args = TopicAppendArgsSchema.parse(frame);
|
|
64935
|
-
mustGet(args.topicId);
|
|
64942
|
+
const topic = mustGet(args.topicId);
|
|
64936
64943
|
deps.topicStore.appendActivity(args.topicId, {
|
|
64937
64944
|
actor: "master",
|
|
64938
64945
|
action: args.action,
|
|
@@ -64940,6 +64947,7 @@ function buildTopicHandlers(deps) {
|
|
|
64940
64947
|
reason: args.reason,
|
|
64941
64948
|
...args.artifacts ? { artifacts: args.artifacts } : {}
|
|
64942
64949
|
});
|
|
64950
|
+
announceChanged(topic);
|
|
64943
64951
|
return { response: { ok: true } };
|
|
64944
64952
|
},
|
|
64945
64953
|
"topic:reject": async (frame) => {
|
|
@@ -64953,6 +64961,7 @@ function buildTopicHandlers(deps) {
|
|
|
64953
64961
|
target: args.lineId,
|
|
64954
64962
|
reason: args.reason
|
|
64955
64963
|
});
|
|
64964
|
+
announceChanged(topic);
|
|
64956
64965
|
return {
|
|
64957
64966
|
response: TopicRejectResultSchema.parse({
|
|
64958
64967
|
rejectCount,
|
|
@@ -64994,6 +65003,7 @@ function buildTopicHandlers(deps) {
|
|
|
64994
65003
|
(n, m2) => n + (m2.overrideCount ?? 0),
|
|
64995
65004
|
0
|
|
64996
65005
|
);
|
|
65006
|
+
announceChanged(topic);
|
|
64997
65007
|
return {
|
|
64998
65008
|
response: TopicAcceptResultSchema.parse({
|
|
64999
65009
|
acceptedLines,
|
|
@@ -65008,12 +65018,14 @@ function buildTopicHandlers(deps) {
|
|
|
65008
65018
|
const args = TopicCloseArgsSchema.parse(frame);
|
|
65009
65019
|
mustGet(args.topicId);
|
|
65010
65020
|
const topic = deps.topicStore.setState(args.topicId, args.state);
|
|
65021
|
+
announceChanged(topic);
|
|
65011
65022
|
return { response: TopicResultSchema.parse({ topic }) };
|
|
65012
65023
|
},
|
|
65013
65024
|
"topic:rename": async (frame) => {
|
|
65014
65025
|
const args = TopicRenameArgsSchema.parse(frame);
|
|
65015
65026
|
mustGet(args.topicId);
|
|
65016
65027
|
const topic = deps.topicStore.rename(args.topicId, args.title);
|
|
65028
|
+
announceChanged(topic);
|
|
65017
65029
|
return { response: TopicResultSchema.parse({ topic }) };
|
|
65018
65030
|
},
|
|
65019
65031
|
"topic:delete": async (frame) => {
|
|
@@ -65036,6 +65048,7 @@ function buildTopicHandlers(deps) {
|
|
|
65036
65048
|
}
|
|
65037
65049
|
}
|
|
65038
65050
|
deps.topicStore.remove(topicId);
|
|
65051
|
+
announceChanged(topic);
|
|
65039
65052
|
return {
|
|
65040
65053
|
response: TopicDeleteResultSchema.parse({
|
|
65041
65054
|
ok: true,
|
|
@@ -65679,7 +65692,12 @@ function buildMethodHandlers(deps) {
|
|
|
65679
65692
|
resolvePersonaRoot: deps.resolvePersonaRoot,
|
|
65680
65693
|
broadcastSessionFrame: deps.broadcastSessionFrame
|
|
65681
65694
|
}),
|
|
65682
|
-
...buildChannelHandlers({
|
|
65695
|
+
...buildChannelHandlers({
|
|
65696
|
+
channelStore: deps.channelStore,
|
|
65697
|
+
topicStore: deps.topicStore,
|
|
65698
|
+
// channel:* 是 owner-only,广播面跟授权面对齐(同 contact:* 用法)
|
|
65699
|
+
broadcast: deps.broadcastToOwners
|
|
65700
|
+
}),
|
|
65683
65701
|
...buildMasterHandlers({
|
|
65684
65702
|
authorityTablePath: import_node_path66.default.join(deps.masterDataDir, "master-authority.json")
|
|
65685
65703
|
}),
|
|
@@ -65689,6 +65707,8 @@ function buildMethodHandlers(deps) {
|
|
|
65689
65707
|
dispatchStore: deps.dispatchStore,
|
|
65690
65708
|
createMasterSession: deps.createMasterSession,
|
|
65691
65709
|
deleteSession: deps.deleteSession,
|
|
65710
|
+
// 与 channel:* 同一个 callback:频道与话题共用 channel:changed 一帧
|
|
65711
|
+
broadcast: deps.broadcastToOwners,
|
|
65692
65712
|
logger: deps.logger
|
|
65693
65713
|
}),
|
|
65694
65714
|
...buildShiftHandlers({
|
|
@@ -66709,7 +66729,13 @@ async function startDaemon(config) {
|
|
|
66709
66729
|
// 反查得到话题后按建线先后领一个稳定的线号。派的不是话题线(反查不到话题)时 no-op。
|
|
66710
66730
|
onLineClaimed: ({ sourceSessionId, lineId }) => {
|
|
66711
66731
|
const topic = topicStore.getByMasterSession(sourceSessionId);
|
|
66712
|
-
if (topic)
|
|
66732
|
+
if (!topic) return;
|
|
66733
|
+
topicStore.claimLineOrdinal(topic.id, lineId);
|
|
66734
|
+
wsServer?.broadcastToOwners({
|
|
66735
|
+
type: "channel:changed",
|
|
66736
|
+
channelId: topic.channelId,
|
|
66737
|
+
topicId: topic.id
|
|
66738
|
+
});
|
|
66713
66739
|
}
|
|
66714
66740
|
});
|
|
66715
66741
|
const here = typeof __dirname === "string" ? __dirname : import_node_path70.default.dirname((0, import_node_url4.fileURLToPath)(import_meta7.url));
|
|
@@ -92,7 +92,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
92
92
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
93
93
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
94
94
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
95
|
-
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var uw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const nO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},rO={motionBase:!0,motionUnit:!0},iO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},pT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=uw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=fT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=uw(l,["theme"]);let d=u;c&&(d=pT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function mT(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(dT),s=`${eO}-${t||""}`,o=n||uT,[a,l,c]=WL(o,[Kc,e],{salt:s,override:r,getComputedToken:pT,formatToken:fT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:nO,ignore:rO,preserve:iO}});return[o,c,t?l:"",a,i]}const sO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),oO=e=>({[`.${e}`]:Object.assign(Object.assign({},sO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),aO=(e,t)=>{const[n,r]=mT();return xD({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>oO(e))},lO=Object.assign({},ol),{useId:dw}=lO,cO=()=>"",uO=typeof dw>"u"?cO:dw;function dO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Fh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Fh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=uO();return AN(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!xL(c,d,!0)}))}var hO=["children"],gT=g.createContext({});function fO(e){var t=e.children,n=jv(e,hO);return g.createElement(gT.Provider,{value:n},t)}var pO=function(e){LN(n,e);var t=ON(n);function n(){return ul(this,n),t.apply(this,arguments)}return dl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function mO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=n0(function(){return i.current}),o=n0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var cs="none",od="appear",ad="enter",ld="leave",hw="none",jr="prepare",ya="start",ba="active",z_="end",vT="prepared";function fw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function gO(e,t){var n={animationend:fw("Animation","AnimationEnd"),transitionend:fw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var vO=gO(Ki(),typeof window<"u"?window:{}),xT={};if(Ki()){var xO=document.createElement("div");xT=xO.style}var cd={};function _T(e){if(cd[e])return cd[e];var t=vO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in xT)return cd[e]=t[s],cd[e]}return""}var yT=_T("animationend"),bT=_T("transitionend"),wT=!!(yT&&bT),pw=yT||"animationend",mw=bT||"transitionend";function gw(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const _O=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(mw,e),i.removeEventListener(pw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(mw,e),i.addEventListener(pw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var ST=Ki()?g.useLayoutEffect:g.useEffect;const yO=function(){var e=g.useRef(null);function t(){Mv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Mv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var bO=[jr,ya,ba,z_],wO=[jr,vT],kT=!1,SO=!0;function CT(e){return e===ba||e===z_}const kO=function(e,t,n){var r=r0(hw),i=et(r,2),s=i[0],o=i[1],a=yO(),l=et(a,2),c=l[0],u=l[1];function d(){o(jr,!0)}var f=t?wO:bO;return ST(function(){if(s!==hw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===kT?o(m,!0):m&&c(function(b){function x(){b.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function CO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,b=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,k=r.onAppearEnd,C=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,z=r0(),I=et(z,2),O=I[0],M=I[1],R=mO(cs),A=et(R,2),L=A[0],$=A[1],F=r0(null),D=et(F,2),B=D[0],E=D[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function te(){return n()}var ie=g.useRef(!1);function K(){$(cs),E(null,!0)}var xe=n0(function(Qe){var ot=L();if(ot!==cs){var _t=te();if(!(Qe&&!Qe.deadline&&Qe.target!==_t)){var vn=ie.current,cn;ot===od&&vn?cn=k==null?void 0:k(_t,Qe):ot===ad&&vn?cn=C==null?void 0:C(_t,Qe):ot===ld&&vn&&(cn=N==null?void 0:N(_t,Qe)),vn&&cn!==!1&&K()}}}),Pe=_O(xe),ce=et(Pe,1),Re=ce[0],$e=function(ot){switch(ot){case od:return ke(ke(ke({},jr,f),ya,v),ba,_);case ad:return ke(ke(ke({},jr,p),ya,b),ba,y);case ld:return ke(ke(ke({},jr,m),ya,x),ba,S);default:return{}}},Fe=g.useMemo(function(){return $e(H)},[H]),be=kO(H,!e,function(Qe){if(Qe===jr){var ot=Fe[jr];return ot?ot(te()):kT}if(qe in Fe){var _t;E(((_t=Fe[qe])===null||_t===void 0?void 0:_t.call(Fe,te(),null))||null)}return qe===ba&&H!==cs&&(Re(te()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){xe({deadline:!0})},u))),qe===vT&&K(),SO}),rt=et(be,2),pt=rt[0],qe=rt[1],Et=CT(qe);ie.current=Et;var Zt=g.useRef(null);ST(function(){if(!(q.current&&Zt.current===t)){M(t);var Qe=q.current;q.current=!0;var ot;!Qe&&t&&a&&(ot=od),Qe&&t&&s&&(ot=ad),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(ot=ld);var _t=$e(ot);ot&&(e||_t[jr])?($(ot),pt()):$(cs),Zt.current=t}},[t]),g.useEffect(function(){(H===od&&!a||H===ad&&!s||H===ld&&!c)&&$(cs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var mt=g.useRef(!1);g.useEffect(function(){O&&(mt.current=!0),O!==void 0&&H===cs&&((mt.current||O)&&(T==null||T(O)),mt.current=!0)},[O,H]);var xt=B;return Fe[jr]&&qe===ya&&(xt=He({transition:"none"},xt)),[H,qe,xt,O??t]}function EO(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(gT),b=v.motion,x=n(i,b),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:tL(y.current)}catch{return null}}var k=CO(x,a,S,i),C=et(k,4),N=C[0],T=C[1],z=C[2],I=C[3],O=g.useRef(I);I&&(O.current=!0);var M=g.useCallback(function(D){_.current=D,sL(s,D)},[s]),R,A=He(He({},m),{},{visible:a});if(!d)R=null;else if(N===cs)I?R=d(He({},A),M):!c&&O.current&&p?R=d(He(He({},A),{},{className:p}),M):u||!c&&!p?R=d(He(He({},A),{},{style:{display:"none"}}),M):R=null;else{var L;T===jr?L="prepare":CT(T)?L="active":T===ya&&(L="start");var $=gw(f,"".concat(N,"-").concat(L));R=d(He(He({},A),{},{className:Uj(gw(f,N),ke(ke({},$,$&&L),f,typeof f=="string")),style:z}),M)}if(g.isValidElement(R)&&oL(R)){var F=aL(R);F||(R=g.cloneElement(R,{ref:M}))}return g.createElement(pO,{ref:y},R)});return r.displayName="CSSMotion",r}const NO=EO(wT);var i0="add",s0="keep",o0="remove",Im="removed";function TO(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function a0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(TO)}function IO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=a0(e),o=a0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:i0})})),r=d),n.push(He(He({},f),{},{status:s0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:o0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:i0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==o0}),n.forEach(function(u){u.key===c&&(u.status=s0)})}),n}var PO=["component","children","onVisibleChanged","onAllRemoved"],RO=["status"],MO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function AO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NO,n=function(r){LN(s,r);var i=ON(s);function s(){var o;ul(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),ke(Pv(o),"state",{keyEntities:[]}),ke(Pv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Im})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Im}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return dl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=jv(c,PO),m=u||g.Fragment,v={};return MO.forEach(function(b){v[b]=p[b],delete p[b]}),delete p.keys,g.createElement(m,p,l.map(function(b,x){var _=b.status,y=jv(b,RO),S=_===i0||_===s0;return g.createElement(t,Bh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(C){f==null||f(C,{key:y.key}),C||a.removeKey(y.key)}}),function(k,C){return d(He(He({},k),{},{index:x}),C)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=a0(c),f=IO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var b=v.key;return p.key===b});return!(m&&m.status===Im&&p.status===o0)})}}}]),s}(g.Component);return ke(n,"defaultProps",{component:"div"}),n}AO(wT);const vw=g.createContext(!0);function jO(e){const t=g.useContext(vw),{children:n}=e,[,r]=mT(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(vw.Provider,{value:i},g.createElement(fO,{motion:i},n)):n}const LO=()=>null;var DO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const OO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let ET;function BO(){return ET||e0}function zO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const $O=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(ET=t),r&&zO(r)&&GD(BO(),r)},FO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:b,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:k,statistic:C,spin:N,calendar:T,carousel:z,cascader:I,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,layout:E,list:H,mentions:q,modal:j,progress:te,result:ie,slider:K,breadcrumb:xe,menu:Pe,pagination:ce,input:Re,textArea:$e,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:Z,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Tr,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:es,treeSelect:El}=e,Xs=g.useCallback((Tt,G)=>{const{prefixCls:ge}=e;if(G)return G;const _e=ge||x.getPrefixCls("");return Tt?`${_e}-${Tt}`:_e},[x.getPrefixCls,e.prefixCls]),bi=_||x.iconPrefixCls||hT,Ko=n||x.csp;aO(bi,Ko);const Go=dO(y,x.theme,{prefixCls:Xs("")}),Ys={csp:Ko,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||b,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Xs,iconPrefixCls:bi,theme:Go,segmented:k,statistic:C,spin:N,calendar:T,carousel:z,cascader:I,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,input:Re,textArea:$e,layout:E,list:H,mentions:q,modal:j,progress:te,result:ie,slider:K,breadcrumb:xe,menu:Pe,pagination:ce,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:Z,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Tr,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:es,treeSelect:El},ts=Object.assign({},x);Object.keys(Ys).forEach(Tt=>{Ys[Tt]!==void 0&&(ts[Tt]=Ys[Tt])}),OO.forEach(Tt=>{const G=e[Tt];G&&(ts[Tt]=G)}),typeof r<"u"&&(ts.button=Object.assign({autoInsertSpace:r},ts.button));const Ir=AN(()=>ts,ts,(Tt,G)=>{const ge=Object.keys(Tt),_e=Object.keys(G);return ge.length!==_e.length||ge.some(Ge=>Tt[Ge]!==G[Ge])}),{layer:zu}=g.useContext(Zf),Vp=g.useMemo(()=>({prefixCls:bi,csp:Ko,layer:zu?"antd":void 0}),[bi,Ko,zu]);let Lt=g.createElement(g.Fragment,null,g.createElement(LO,{dropdownMatchSelectWidth:p}),t);const Qs=g.useMemo(()=>{var Tt,G,ge,_e;return ED(((Tt=tp.Form)===null||Tt===void 0?void 0:Tt.defaultValidateMessages)||{},((ge=(G=Ir.locale)===null||G===void 0?void 0:G.Form)===null||ge===void 0?void 0:ge.defaultValidateMessages)||{},((_e=Ir.form)===null||_e===void 0?void 0:_e.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Ir,o==null?void 0:o.validateMessages]);Object.keys(Qs).length>0&&(Lt=g.createElement(TD.Provider,{value:Qs},Lt)),a&&(Lt=g.createElement(RD,{locale:a,_ANT_MARK__:PD},Lt)),Lt=g.createElement(wD.Provider,{value:Vp},Lt),l&&(Lt=g.createElement(YD,{size:l},Lt)),Lt=g.createElement(jO,null,Lt);const qp=g.useMemo(()=>{const Tt=Go||{},{algorithm:G,token:ge,components:_e,cssVar:Ge}=Tt,Wr=DO(Tt,["algorithm","token","components","cssVar"]),Nl=G&&(!Array.isArray(G)||G.length>0)?Dv(G):uT,Kp={};Object.entries(_e||{}).forEach(([l4,c4])=>{const wi=Object.assign({},c4);"algorithm"in wi&&(wi.algorithm===!0?wi.theme=Nl:(Array.isArray(wi.algorithm)||typeof wi.algorithm=="function")&&(wi.theme=Dv(wi.algorithm)),delete wi.algorithm),Kp[l4]=wi});const C1=Object.assign(Object.assign({},Kc),ge);return Object.assign(Object.assign({},Wr),{theme:Nl,token:C1,components:Kp,override:Object.assign({override:C1},Kp),cssVar:Ge})},[Go]);return y&&(Lt=g.createElement(dT.Provider,{value:qp},Lt)),Ir.warning&&(Lt=g.createElement(ND.Provider,{value:Ir.warning},Lt)),S!==void 0&&(Lt=g.createElement(XD,{disabled:S},Lt)),g.createElement(np.Provider,{value:Ir},Lt)},fl=e=>{const t=g.useContext(np),n=g.useContext(oT);return g.createElement(FO,Object.assign({parentContext:t,legacyLocale:n},e))};fl.ConfigContext=np;fl.SizeContext=Gc;fl.config=$O;fl.useConfig=QD;Object.defineProperty(fl,"SizeContext",{get:()=>Gc});const dr=(e,t)=>new St(e).setA(t).toRgbString(),Qo=(e,t)=>new St(e).lighten(t).toHexString(),HO=e=>{const t=Va(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},UO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:dr(r,.85),colorTextSecondary:dr(r,.65),colorTextTertiary:dr(r,.45),colorTextQuaternary:dr(r,.25),colorFill:dr(r,.18),colorFillSecondary:dr(r,.12),colorFillTertiary:dr(r,.08),colorFillQuaternary:dr(r,.04),colorBgSolid:dr(r,.95),colorBgSolidHover:dr(r,1),colorBgSolidActive:dr(r,.9),colorBgElevated:Qo(n,12),colorBgContainer:Qo(n,8),colorBgLayout:Qo(n,0),colorBgSpotlight:Qo(n,26),colorBgBlur:dr(r,.04),colorBorder:Qo(n,26),colorBorderSecondary:Qo(n,19)}},WO=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=Va(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=cT(e,{generateColorPalettes:HO,generateNeutralColorPalettes:UO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},xw={defaultSeed:Fh.token,defaultAlgorithm:B_,darkAlgorithm:WO};function _w({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(fl,{theme:{algorithm:n.mode==="dark"?xw.darkAlgorithm:xw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Xe;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Xe||(Xe={}));var yw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yw||(yw={}));const de=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fs=e=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(e)?de.array:e===null?de.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?de.promise:typeof Map<"u"&&e instanceof Map?de.map:typeof Set<"u"&&e instanceof Set?de.set:typeof Date<"u"&&e instanceof Date?de.date:de.object;default:return de.unknown}},X=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Hi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Hi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Hi.create=e=>new Hi(e);const l0=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===de.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let VO=l0;function qO(){return VO}const KO=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=qO(),r=KO({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l0?void 0:l0].filter(i=>!!i)});e.common.issues.push(r)}class An{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ee;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return An.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jl=e=>({status:"dirty",value:e}),Er=e=>({status:"valid",value:e}),bw=e=>e.status==="aborted",ww=e=>e.status==="dirty",qa=e=>e.status==="valid",Hh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class di{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sw=(e,t)=>{if(qa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Hi(e.common.issues);return this._error=n,this._error}}};function je(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return fs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new An,ctx:{common:t.parent.common,data:t.data,parsedType:fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Sw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return qa(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>qa(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Hh(i)?i:Promise.resolve(i));return Sw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Eo({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Di.create(this,this._def)}nullable(){return No.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ai.create(this)}promise(){return Gh.create(this,this._def)}or(t){return Wh.create([this,t],this._def)}and(t){return Vh.create(this,t,this._def)}transform(t){return new Eo({...je(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Xh({...je(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new PT({typeName:Ne.ZodBranded,type:this,...je(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Yh({...je(this._def),innerType:this,catchValue:n,typeName:Ne.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return Qh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const GO=/^c[^\s-]{8,}$/i,XO=/^[0-9a-z]+$/,YO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,QO=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ZO=/^[a-z0-9_-]{21}$/i,JO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e6=/^[-+]?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)?)??$/,t6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,n6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pm;const r6=/^(?:(?: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])$/,i6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,s6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,o6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,NT="((\\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])))",c6=new RegExp(`^${NT}$`);function TT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function u6(e){return new RegExp(`^${TT(e)}$`)}function d6(e){let t=`${NT}T${TT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function h6(e,t){return!!((t==="v4"||!t)&&r6.test(e)||(t==="v6"||!t)&&s6.test(e))}function f6(e,t){if(!JO.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function p6(e,t){return!!((t==="v4"||!t)&&i6.test(e)||(t==="v6"||!t)&&o6.test(e))}class Mi extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==de.string){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.string,received:s.parsedType}),Ee}const r=new An;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")t6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Pm||(Pm=new RegExp(n6,"u")),Pm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")QO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")ZO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")GO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")XO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")YO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?d6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?c6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?u6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?e6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?h6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?f6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?p6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Mi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Mi.create=e=>new Mi({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...je(e)});function m6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ka extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==de.number){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.number,received:s.parsedType}),Ee}let r;const i=new An;for(const s of this._def.checks)s.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?m6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_finite,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ka({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ka({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ka.create=e=>new Ka({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...je(e)});class Xc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==de.bigint)return this._getInvalidInput(t);let r;const i=new An;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Xc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Xc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xc.create=e=>new Xc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...je(e)});class c0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==de.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.boolean,received:r.parsedType}),Ee}return Er(t.data)}}c0.create=e=>new c0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...je(e)});class Uh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==de.date){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_date}),Ee}const r=new An;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Uh.create=e=>new Uh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...je(e)});class kw extends Ve{_parse(t){if(this._getType(t)!==de.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.symbol,received:r.parsedType}),Ee}return Er(t.data)}}kw.create=e=>new kw({typeName:Ne.ZodSymbol,...je(e)});class u0 extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.undefined,received:r.parsedType}),Ee}return Er(t.data)}}u0.create=e=>new u0({typeName:Ne.ZodUndefined,...je(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==de.null){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.null,received:r.parsedType}),Ee}return Er(t.data)}}d0.create=e=>new d0({typeName:Ne.ZodNull,...je(e)});class Cw extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Er(t.data)}}Cw.create=e=>new Cw({typeName:Ne.ZodAny,...je(e)});class h0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Er(t.data)}}h0.create=e=>new h0({typeName:Ne.ZodUnknown,...je(e)});class Ds extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.never,received:n.parsedType}),Ee}}Ds.create=e=>new Ds({typeName:Ne.ZodNever,...je(e)});class Ew extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.void,received:r.parsedType}),Ee}return Er(t.data)}}Ew.create=e=>new Ew({typeName:Ne.ZodVoid,...je(e)});class ai extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==de.array)return se(n,{code:X.invalid_type,expected:de.array,received:n.parsedType}),Ee;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new di(n,o,n.path,a)))).then(o=>An.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new di(n,o,n.path,a)));return An.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ai({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new ai({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new ai({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}ai.create=(e,t)=>new ai({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...je(t)});function oa(e){if(e instanceof $t){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Di.create(oa(r))}return new $t({...e._def,shape:()=>t})}else return e instanceof ai?new ai({...e._def,type:oa(e.element)}):e instanceof Di?Di.create(oa(e.unwrap())):e instanceof No?No.create(oa(e.unwrap())):e instanceof ko?ko.create(e.items.map(t=>oa(t))):e}class $t extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==de.object){const c=this._getOrReturnCtx(t);return se(c,{code:X.invalid_type,expected:de.object,received:c.parsedType}),Ee}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ds&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new di(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ds){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new di(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>An.mergeObjectSync(r,c)):An.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new $t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(t){return new $t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new $t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ne.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new $t({...this._def,catchall:t})}pick(t){const n={};for(const r of Xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return oa(this)}partial(t){const n={};for(const r of Xe.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new $t({...this._def,shape:()=>n})}required(t){const n={};for(const r of Xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Di;)s=s._def.innerType;n[r]=s}return new $t({...this._def,shape:()=>n})}keyof(){return IT(Xe.objectKeys(this.shape))}}$t.create=(e,t)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});$t.strictCreate=(e,t)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});$t.lazycreate=(e,t)=>new $t({shape:e,unknownKeys:"strip",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});class Wh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Hi(a.ctx.common.issues));return se(n,{code:X.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Hi(l));return se(n,{code:X.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Wh.create=(e,t)=>new Wh({options:e,typeName:Ne.ZodUnion,...je(t)});const Ei=e=>e instanceof p0?Ei(e.schema):e instanceof Eo?Ei(e.innerType()):e instanceof Kh?[e.value]:e instanceof Co?e.options:e instanceof m0?Xe.objectValues(e.enum):e instanceof Xh?Ei(e._def.innerType):e instanceof u0?[void 0]:e instanceof d0?[null]:e instanceof Di?[void 0,...Ei(e.unwrap())]:e instanceof No?[null,...Ei(e.unwrap())]:e instanceof PT||e instanceof Qh?Ei(e.unwrap()):e instanceof Yh?Ei(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.object)return se(n,{code:X.invalid_type,expected:de.object,received:n.parsedType}),Ee;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ei(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...je(r)})}}function f0(e,t){const n=fs(e),r=fs(t);if(e===t)return{valid:!0,data:e};if(n===de.object&&r===de.object){const i=Xe.objectKeys(t),s=Xe.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=f0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===de.array&&r===de.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=f0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===de.date&&r===de.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(bw(s)||bw(o))return Ee;const a=f0(s.value,o.value);return a.valid?((ww(s)||ww(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:X.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vh.create=(e,t,n)=>new Vh({left:e,right:t,typeName:Ne.ZodIntersection,...je(n)});class ko extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.array)return se(r,{code:X.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new di(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>An.mergeArray(n,o)):An.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new ko({...this._def,rest:t})}}ko.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:e,typeName:Ne.ZodTuple,rest:null,...je(t)})};class qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.object)return se(r,{code:X.invalid_type,expected:de.object,received:r.parsedType}),Ee;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new di(r,a,r.path,a)),value:o._parse(new di(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?An.mergeObjectAsync(n,i):An.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new qh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...je(r)}):new qh({keyType:Mi.create(),valueType:t,typeName:Ne.ZodRecord,...je(n)})}}class Nw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.map)return se(r,{code:X.invalid_type,expected:de.map,received:r.parsedType}),Ee;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new di(r,a,r.path,[c,"key"])),value:s._parse(new di(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Nw.create=(e,t,n)=>new Nw({valueType:t,keyType:e,typeName:Ne.ZodMap,...je(n)});class Yc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.set)return se(r,{code:X.invalid_type,expected:de.set,received:r.parsedType}),Ee;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new di(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Yc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Yc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Yc.create=(e,t)=>new Yc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...je(t)});class p0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}p0.create=(e,t)=>new p0({getter:e,typeName:Ne.ZodLazy,...je(t)});class Kh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}Kh.create=(e,t)=>new Kh({value:e,typeName:Ne.ZodLiteral,...je(t)});function IT(e,t){return new Co({values:e,typeName:Ne.ZodEnum,...je(t)})}class Co extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Xe.joinValues(r),received:n.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:X.invalid_enum_value,options:r}),Ee}return Er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Co.create(t,{...this._def,...n})}exclude(t,n=this._def){return Co.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Co.create=IT;class m0 extends Ve{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==de.string&&r.parsedType!==de.number){const i=Xe.objectValues(n);return se(r,{expected:Xe.joinValues(i),received:r.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Xe.objectValues(n);return se(r,{received:r.data,code:X.invalid_enum_value,options:i}),Ee}return Er(t.data)}get enum(){return this._def.values}}m0.create=(e,t)=>new m0({values:e,typeName:Ne.ZodNativeEnum,...je(t)});class Gh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.promise&&n.common.async===!1)return se(n,{code:X.invalid_type,expected:de.promise,received:n.parsedType}),Ee;const r=n.parsedType===de.promise?n.data:Promise.resolve(n.data);return Er(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gh.create=(e,t)=>new Gh({type:e,typeName:Ne.ZodPromise,...je(t)});class Eo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jl(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jl(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qa(o))return Ee;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>qa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Ee);Xe.assertNever(i)}}Eo.create=(e,t,n)=>new Eo({schema:e,typeName:Ne.ZodEffects,effect:t,...je(n)});Eo.createWithPreprocess=(e,t,n)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...je(n)});class Di extends Ve{_parse(t){return this._getType(t)===de.undefined?Er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Di.create=(e,t)=>new Di({innerType:e,typeName:Ne.ZodOptional,...je(t)});class No extends Ve{_parse(t){return this._getType(t)===de.null?Er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}No.create=(e,t)=>new No({innerType:e,typeName:Ne.ZodNullable,...je(t)});class Xh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===de.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...je(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Yh.create=(e,t)=>new Yh({innerType:e,typeName:Ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...je(t)});class Tw extends Ve{_parse(t){if(this._getType(t)!==de.nan){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tw.create=e=>new Tw({typeName:Ne.ZodNaN,...je(e)});class PT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jl(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ne.ZodPipeline})}}class Qh extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qa(i)&&(i.value=Object.freeze(i.value)),i);return Hh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Qh.create=(e,t)=>new Qh({innerType:e,typeName:Ne.ZodReadonly,...je(t)});var Ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));const w=Mi.create,V=Ka.create,ye=c0.create,Rs=h0.create;Ds.create;const re=ai.create,P=$t.create;Wh.create;const gi=$_.create;Vh.create;ko.create;const Ws=qh.create,J=Kh.create,Le=Co.create;Gh.create;Di.create;No.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const g6=["owner"],v6=["agent","owner","user-upload"],RT=P({id:w().min(1),relPath:w().min(1),from:Le(v6),label:w().optional(),size:V().int().nonnegative(),mime:w().min(1),addedAt:V().int().nonnegative(),lastEditedAt:V().int().nonnegative().optional(),stale:ye().optional()});P({sessionId:w().min(1),relPath:w().min(1),ttlSeconds:V().int().positive().nullable().optional(),view:Le(["raw","md-rendered"]).optional()});P({url:w().min(1),expiresAt:V().int().nonnegative().nullable()});P({sessionId:w().min(1),relPath:w().min(1),label:w().optional(),origin:J("agent").optional()});P({entry:RT});P({sessionId:w().min(1),relPath:w().min(1)});P({removed:J(!0)});P({sessionId:w().min(1)});P({entries:re(RT)});P({attachmentId:w().min(1),url:w().min(1),relPath:w().min(1),sizeBytes:V().int().nonnegative(),mimeType:w().min(1)});const x6=gi("type",[P({type:J("persona"),id:w().min(1)}).strict(),P({type:J("chat"),id:w().min(1)}).strict(),P({type:J("*")}).strict()]),_6=Le(["read","send","admin"]),H_=P({resource:x6,actions:re(_6).min(1)}).strict(),y6=P({id:w().min(1),secretHash:w().regex(/^[a-f0-9]{64}$/),displayName:w(),grants:re(H_),issuedAt:V().int().nonnegative(),expiresAt:V().int().positive().optional(),maxUses:V().int().positive().optional(),usedCount:V().int().nonnegative(),peerOwnerId:w().min(1).optional(),firstUsedByPeerAt:V().int().positive().optional(),peerDisplayName:w().optional()}).strict(),b6=y6.omit({secretHash:!0});P({type:J("whoami:ok"),owner:P({id:w(),kind:Le(["owner","guest"]),displayName:w(),ownerId:w(),provider:w()}).strict(),capability:b6,grantedPersonas:re(P({id:w().min(1),displayName:w()}).strict())}).strict();P({selfUrl:w().min(1)});P({type:J("contact:handshake:ok"),owner:P({id:w(),ownerId:w(),provider:w(),displayName:w()}),grants:re(H_)});P({deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:setRemoteAccess:ok"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:remote-access-updated"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();const w6=P({deviceId:w().min(1),ownerId:w().min(1),provider:w().min(1),displayName:w(),remoteUrl:w().min(1),connectToken:w(),grants:re(H_),addedAt:V().int().nonnegative(),pinnedAt:V().int().nullable().default(null),remoteAccessAllowed:ye().default(!1),note:w().default("")}).strict(),MT=w6;P({deviceId:w().min(1)}).strict();P({type:J("contact:remove:ok"),deviceId:w().min(1)}).strict();P({type:J("contact:list:ok"),contacts:re(MT)}).strict();P({type:J("contact:added"),contact:MT}).strict();P({type:J("contact:removed"),deviceId:w().min(1)}).strict();P({deviceId:w().min(1),pinned:ye()}).strict();P({deviceId:w().min(1),note:w()}).strict();P({type:J("contact:setNote:ok"),deviceId:w().min(1),note:w()}).strict();P({type:J("contact:pin:ok"),deviceId:w().min(1),pinnedAt:V().int().nullable()}).strict();P({type:J("contact:pinned"),deviceId:w().min(1),pinnedAt:V().int().nullable()}).strict();const S6=P({deviceId:w().min(1),name:w().min(1),url:w().min(1)});P({type:J("device:list:ok"),devices:re(S6)});P({deviceId:w().min(1),url:w().min(1).optional(),name:w().optional()});P({type:J("device:connect:ok"),deviceId:w(),name:w(),url:w()});const AT=P({ownerId:w().min(1),provider:w().min(1),displayName:w().min(1),avatarUrl:w().optional(),unionId:w().optional()});P({type:J("auth:login:start:ok"),authUrl:w().min(1),state:w().min(1)});P({type:J("auth:getIdentity:ok"),identity:AT.nullable(),deviceId:w().min(1),ttcTokenExpiresAt:V().nullable().optional()});P({type:J("auth:logout:ok")});P({type:J("auth:login:done"),identity:AT});P({type:J("auth:login:failed"),reason:w()});const U_=gi("kind",[P({kind:J("success"),text:w(),brief:w().optional(),filePaths:re(w()).optional()}),P({kind:J("failure"),reason:w(),brief:w().optional()})]);P({targetPersona:w().min(1).optional(),dispatchId:w().min(1).optional(),prompt:w(),brief:w().optional(),targetDeviceId:w().min(1).optional(),model:w().min(1).optional(),tool:w().min(1).optional(),sessionLabel:w().min(1).max(60).optional(),meta:Ws(Rs()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});P({dispatchId:w().min(1),outcome:U_});const k6=["running","completed","failed"],W_=Le(k6),C6=P({dispatchId:w().min(1),sourceSessionId:w().min(1),sourcePersonaId:w().min(1).optional(),targetPersonaId:w().min(1),workerSessionId:w().min(1).optional(),taskText:w(),taskBrief:w().optional(),round:V().int().positive().optional(),status:W_,outcome:U_.optional(),meta:Ws(Rs()).optional(),createdAt:w().min(1),completedAt:w().min(1).optional(),deliveredAt:w().min(1).optional()});P({sourceSessionId:w().min(1).optional()});P({records:re(C6)});P({dispatchId:w().min(1)});P({type:J("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const E6=/^[a-z0-9][a-z0-9-]*$/;Le(["stopped","starting","running","crashed","invalid"]);const N6=new Set(["localhost","127.0.0.1"]);function T6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&N6.has(t.hostname))}const ud=P({id:w().regex(E6),name:w().min(1),version:w().min(1),apiVersion:J("1"),runtime:P({startCommand:w().min(1)}).passthrough().optional(),entry:P({url:w().url().refine(T6,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),I6=gi("kind",[P({kind:J("local"),port:V().int().min(1).max(65535)}),P({kind:J("hosted"),url:w().url()})]);gi("state",[P({extId:w(),manifest:ud,state:J("stopped")}),P({extId:w(),manifest:ud,state:J("starting")}),P({extId:w(),manifest:ud,state:J("running"),target:I6}),P({extId:w(),manifest:ud,state:J("crashed")}),P({extId:w(),manifest:Rs().nullable(),state:J("invalid"),invalidReason:w().min(1)})]);P({snapshotHash:w().min(1),version:w().min(1),publishedAt:V()});const P6=gi("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1)})]);gi("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1),snapshotHash:w().min(1)})]);P({extId:w().min(1),name:w().min(1),version:w().min(1),contentHash:w().min(1),publishedAt:V()});const R6=gi("kind",[P({kind:J("clean")}),P({kind:J("ready-new-version"),fromVersion:w().min(1),toVersion:w().min(1)}),P({kind:J("error-same-hash"),version:w().min(1)}),P({kind:J("error-version-not-bumped"),localVersion:w().min(1),publishedVersion:w().min(1)}),P({kind:J("error-version-regression"),localVersion:w().min(1),publishedVersion:w().min(1)})]);P({localManifest:P({name:w().min(1),version:w().min(1),contentHash:w().min(1)}),publishState:gi("kind",[P({kind:J("unpublished")}),P({kind:J("published"),version:w().min(1),contentHash:w().min(1),publishedAt:V()})]),check:R6});P({extId:w().min(1),newVersion:w().min(1).nullish()});P({extId:w().min(1)});P({extId:w().min(1),snapshotHash:w().min(1)});P({channelRef:P6,snapshotHash:w().min(1),zipBase64:w().min(1)});P({id:w().min(1),peerDeviceId:w().min(1),senderDeviceId:w().min(1),text:w().min(1),createdAt:V().int().nonnegative(),readBy:Ws(w().min(1),V().int().positive()).default({}),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1).optional(),id:w().min(1),text:w().min(1),createdAt:V().int().nonnegative(),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1),sinceCreatedAt:V().int().nonnegative().optional()}).strict();P({peerDeviceId:w().min(1),upToCreatedAt:V().int().nonnegative()}).strict();P({peerDeviceId:w().min(1).optional(),text:w().min(1)});P({peerDeviceId:w().min(1).optional(),command:w().min(1),timeoutMs:V().int().positive().optional()}).strict();P({type:J("peerExec:run:ok"),stdout:w(),stderr:w(),exitCode:V().int().nullable(),timedOut:ye(),stdoutTruncated:ye(),stderrTruncated:ye()}).strict();const jT=gi("kind",[P({kind:J("at"),at:w().min(1)}),P({kind:J("every"),everyMs:V().int().positive(),anchorMs:V().int().nonnegative().optional()}),P({kind:J("cron"),expr:w().min(1),tz:w().min(1).optional()})]),xu=w().trim().min(1);P({personaId:xu,name:w().min(1),schedule:jT,prompt:w().min(1),targetPersona:w().min(1).optional(),timeoutMs:V().int().positive().optional()});P({personaId:xu,onlyMine:ye().optional()});P({personaId:xu,shiftId:w().min(1)});const M6=P({name:w().min(1).optional(),schedule:jT.optional(),prompt:w().min(1).optional(),targetPersona:w().min(1).optional(),timeoutMs:V().int().positive().optional(),enabled:ye().optional()});P({personaId:xu,shiftId:w().min(1),patch:M6});P({personaId:xu,shiftId:w().min(1),limit:V().int().positive().optional()});const A6="persona-master",V_=P({personaId:w().min(1),deviceId:w().min(1).optional()}),LT=P({id:w().min(1),name:w().min(1),memberPersonas:re(V_),memberContactDeviceIds:re(w().min(1)),createdAt:w().min(1),updatedAt:w().min(1)}),DT=w().trim().min(1);P({name:DT,memberPersonas:re(V_).default([]),memberContactDeviceIds:re(w().min(1)).default([])});P({channelId:w().min(1),name:DT.optional(),memberPersonas:re(V_).optional(),memberContactDeviceIds:re(w().min(1)).optional()});P({channelId:w().min(1)});P({channels:re(LT)});P({channel:LT});P({ok:J(!0),removedTopics:V().int().min(0)});const Sn=w().trim().min(1),j6=["planning","running","done"],L6=Le(j6),D6=P({at:w().min(1),actor:w().min(1),action:w().min(1),target:w().optional(),reason:w().min(1),artifacts:re(Sn).optional()}),O6=P({rejectCount:V().int().min(0),accepted:ye().default(!1),ordinal:V().int().min(1).optional(),overrideCount:V().int().min(0).optional()}),q_=P({id:w().min(1),channelId:w().min(1),title:w(),masterSessionId:w().min(1),goal:w(),boundaries:w(),acceptanceCriteria:re(w()),activity:re(D6),lineMeta:Ws(O6),nextLineOrdinal:V().int().min(1).optional(),state:L6,createdAt:w().min(1),updatedAt:w().min(1)}),B6=P({lineId:w().min(1),dispatchId:w().min(1),workerSessionId:w().optional(),assignee:w().min(1),focus:w(),status:W_,acceptance:re(w()),rejectCount:V().int().min(0),accepted:ye(),ordinal:V().int().min(1).nullable()});P({channelId:w().min(1)});P({topicId:w().min(1).optional(),sessionId:w().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:w().min(1),title:Sn.optional()});P({topicId:w().min(1),title:Sn.optional(),goal:Sn,boundaries:w(),acceptanceCriteria:re(Sn).min(1)});P({topicId:w().min(1),action:Sn,target:Sn.optional(),reason:Sn,artifacts:re(Sn).optional()});P({topicId:w().min(1),lineId:Sn,reason:Sn});P({topicId:w().min(1),lineId:Sn,reason:Sn,artifacts:re(Sn).optional(),watcherVerdict:Le(["pass","fail"]),overrideReason:Sn.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});P({topicId:w().min(1),state:Le(["done"])});P({topicId:w().min(1),title:Sn});P({topicId:w().min(1)});const z6=q_.extend({lineCount:V().int().min(0)});P({topics:re(z6)});P({topic:q_,lines:re(B6)});P({topicId:w().min(1),masterSessionId:w().min(1)});P({rejectCount:V().int().min(1),needsOwnerAttention:ye()});P({acceptedLines:V().int().min(1),totalLines:V().int().min(1),allAccepted:ye(),overrides:V().int().min(0),needsOwnerAttention:ye()});P({topic:q_});P({ok:J(!0),removedMasterSessionId:w().min(1).nullable(),removedWorkerSessionIds:re(w().min(1))});const $6=["ask","allow","deny"],OT=Le($6),F6=P({id:w().min(1),desc:w().min(1),action:OT});P({rules:re(F6)});P({ruleId:w().min(1)});P({action:OT,desc:w(),source:w().min(1)});const H6=["created","review-requested"],BT=/^[A-Za-z0-9._-]+$/,pl=w().min(1).regex(BT),ml=w().min(1).regex(BT),_u=V().int().positive();P({role:Le(H6)});P({owner:pl,repo:ml,number:_u});P({owner:pl,repo:ml,number:_u,expectedHeadSha:w().min(1)});P({owner:pl,repo:ml,number:_u,body:w().min(1)});P({owner:pl,repo:ml,number:_u,ready:ye()});P({owner:pl,repo:ml});P({owner:pl,repo:ml,number:_u,reviewers:re(w().min(1)).min(1)});P({personaId:w().min(1)});const U6=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],W6=Le(U6);P({personaId:w().min(1),appId:w().min(1),appSecret:w().min(1),botName:w().min(1).optional()});const V6=P({chatId:w().min(1),chatName:w().optional(),lastActiveAt:V().int().optional()}),q6=P({state:Le(["unbound","provisioning","bound","broken"]),appId:w().optional(),botName:w().optional(),brokenReason:w().optional(),qrUrl:w().optional(),errorReason:W6.optional(),groups:re(V6)});q6.extend({personaId:w().min(1)});P({});P({onboardingCompletedAt:V()});P({});P({tools:re(P({id:Le(["claude","codex"]),available:ye(),version:w().optional(),path:w().optional()}))});P({});const K6=P({tool:Le(["claude","codex"]),cwd:w(),toolSessionId:w(),label:w().optional(),createdAt:w(),updatedAt:w(),turns:V()});P({candidates:re(K6)});P({});P({registered:ye()});const G6=P({personaId:w(),label:w(),model:w().optional(),effort:w().optional(),public:ye(),iconKey:w().optional(),tool:w().optional(),createdAt:V(),updatedAt:V()}).strict(),X6=P({name:w().min(1),description:w().optional()}),Y6=P({id:w().min(1)}),Q6=P({permissions:P({defaultMode:w().optional(),allow:re(w()).optional(),deny:re(w()).optional()}).optional(),sandbox:P({enabled:ye().optional(),autoAllowBashIfSandboxed:ye().optional(),allowUnsandboxedCommands:ye().optional(),excludedCommands:re(w()).optional(),filesystem:P({denyRead:re(w()).optional(),allowRead:re(w()).optional(),denyWrite:re(w()).optional(),allowWrite:re(w()).optional()}).optional(),network:P({allowedDomains:re(w()).optional(),allowLocalBinding:ye().optional()}).optional()}).optional()});G6.extend({personality:w().optional(),personalityLocal:w().optional(),personalityManaged:ye().optional(),skills:re(X6).optional(),plugins:re(Y6).optional(),sandboxSettings:Q6.nullable().optional()});P({slug:w().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:w().min(1),personality:w(),model:w().optional(),effort:w().optional(),tool:w().optional(),public:ye().optional(),iconKey:w().optional()}).strict();P({personaId:w().min(1)});P({personaId:w().min(1),patch:P({label:w().min(1).optional(),model:w().optional(),effort:w().optional(),tool:w().optional(),personality:w().optional(),personalityLocal:w().optional(),public:ye().optional(),iconKey:w().nullable().optional()}).strict()}).strict();P({writableRoots:re(w()).optional(),denyRead:re(w()).optional(),network:ye().optional()}).strict();const zT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],$T=["idle","running","running-idle","stopped","error","observing"],Z6=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function rp(e){return e==="dispatch-task"||e==="dispatch-result"}const J6=["builtin","global","project","plugin"],eB=["builtin","global","project","policy","plugin"],FT=Le(["owner","guest"]);P({id:w().min(1),kind:FT,displayName:w(),feishuUnionId:w().optional()}).strict();const tB=P({did:w().min(1),displayName:w(),feishuUnionId:w().optional(),principal:FT}).strict(),nB=Le($T),rB=P({inputTokens:V().int().nonnegative(),outputTokens:V().int().nonnegative(),cacheReadTokens:V().int().nonnegative().optional(),cacheCreateTokens:V().int().nonnegative().optional()}),HT={gitBranch:w().optional(),resolvedModel:w().optional(),resolvedEffort:w().optional(),contextUsage:rB.optional(),contextWindowSize:V().int().positive().optional(),aiLabel:w().optional()},iB=P(HT),UT=P({value:w(),label:w(),description:w().optional()}),sB=P({id:w().min(1),label:w().min(1),description:w().optional(),contextWindowSize:V().int().positive(),default:ye().optional(),efforts:re(UT).optional(),defaultEffort:w().optional()}),oB=P({id:w().min(1),label:w().min(1),description:w().optional()}),aB=P({name:w().min(1),type:Le(["string","select","toggle"]),label:w().min(1),description:w().optional(),options:re(UT).optional(),default:Rs().optional(),scope:Le(["core","tool-specific"])});P({tool:w().min(1)});const lB=P({rewind:ye(),subagents:ye(),tui:ye(),observe:ye(),fileSharing:ye(),fork:ye()});P({tool:w().min(1),toolSessionIdLabel:w().optional(),models:re(sB),permissionModes:re(oB),configSchema:re(aB),features:lB});const cB=P({tool:w().min(1),pattern:w().min(1),createdAt:w().min(1).optional()});P({sessionId:w().min(1),cwd:w().min(1),tool:J("claude").or(w().min(1)).default("claude"),toolSessionId:w().optional(),label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),...HT,aiLabelGeneratedAt:w().optional(),permissionRules:re(cB).optional(),pinnedAt:V().int().nonnegative().nullable().optional(),archivedAt:V().int().nonnegative().nullable().optional(),pinSortOrder:V().int().nullable().optional(),unreadAt:w().min(1).nullable().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional(),appBuilderProject:w().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:w().min(1).optional(),creatorPrincipalId:w().min(1).optional(),creatorDisplayName:w().min(1).optional(),creatorFeishuUnionId:w().min(1).optional(),originOwnerPrincipalId:w().min(1).optional(),originOwnerPersonaId:w().min(1).optional(),dispatchedFromSessionId:w().min(1).optional(),shiftFiredFromSessionId:w().min(1).optional(),larkChatId:w().min(1).optional(),larkChatName:w().min(1).optional(),larkChatType:Le(["p2p","group"]).optional(),createdAt:w().min(1),updatedAt:w().min(1)});const $n={seq:V().int().nonnegative().optional(),ts:w().optional(),uuid:w().optional()},uB=Le(Z6),dB=P({readCount:V().int().nonnegative().optional(),searchCount:V().int().nonnegative().optional(),bashCount:V().int().nonnegative().optional(),editFileCount:V().int().nonnegative().optional(),linesAdded:V().int().nonnegative().optional(),linesRemoved:V().int().nonnegative().optional(),otherToolCount:V().int().nonnegative().optional()}),hB=P({oldStart:V().int().nonnegative(),oldLines:V().int().nonnegative(),newStart:V().int().nonnegative(),newLines:V().int().nonnegative(),lines:re(w())}),fB=P({agentId:w().optional(),agentType:w().optional(),status:w().optional(),prompt:w().optional(),filePath:w().optional(),structuredPatch:re(hB).optional(),stats:P({durationMs:V().int().nonnegative().optional(),tokens:V().int().nonnegative().optional(),toolUseCount:V().int().nonnegative().optional(),toolStats:dB.optional()}).optional()}),pB=P({path:w(),content:w(),mtimeMs:V().optional()}),mB=P({label:w().min(1),description:w().optional()}),WT=P({question:w().min(1),multiSelect:ye(),options:re(mB).min(1)}),gB=["completed","interrupted"];gi("kind",[P({...$n,kind:J("session_init"),toolSessionId:w().optional()}),P({...$n,kind:J("thinking"),text:w(),partialId:w().optional()}),P({...$n,kind:J("text"),text:w(),partialId:w().optional()}),P({...$n,kind:J("user_text"),text:w(),meta:uB.optional(),taskId:w().optional(),parentToolUseId:w().optional(),sender:tB.optional()}),P({...$n,kind:J("tool_call"),toolUseId:w(),tool:w(),toolKind:w().optional(),input:Rs()}),P({...$n,kind:J("tool_result"),toolUseId:w(),output:Rs().optional(),error:w().optional(),toolResultExtra:fB.optional(),sourceToolAssistantUUID:w().optional(),askQuestionAnswers:Ws(w(),w()).optional()}),P({...$n,kind:J("attachment_memories"),memories:re(pB)}),P({...$n,kind:J("permission_request"),requestId:w(),tool:w(),input:Rs(),toolUseId:w().optional()}),P({...$n,kind:J("ask_user_question"),toolUseId:w(),questions:re(WT)}),P({...$n,kind:J("turn_end"),durationMs:V().int().nonnegative().optional(),reason:Le(gB).optional()}),P({...$n,kind:J("subagent_progress"),toolUseId:w(),agentId:w(),status:Le(["started","running","completed","failed"]),description:w().optional(),lastToolName:w().optional(),prompt:w().optional(),stats:P({durationMs:V().int().nonnegative().optional(),tokens:V().int().nonnegative().optional(),toolUseCount:V().int().nonnegative().optional()}).optional()}),P({...$n,kind:J("error"),message:w()}),P({...$n,kind:J("meta_update"),patch:iB}),P({...$n,kind:J("meta-text"),text:w(),metaSource:Le(["cc","owner"]).optional()})]);P({cwd:w().min(1).optional(),tool:w().optional(),label:w().optional(),aiLabel:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:w().min(1),name:w().min(1),createdAt:w().datetime(),pinnedAt:V().optional()});P({path:w().min(1),pinnedAt:V().nullable()});P({path:w().min(1)});P({path:w().min(1).optional(),name:w().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:w().min(1),tool:w().min(1),toolSessionId:w().min(1),label:w().optional(),aiLabel:w().optional(),iconKey:w().optional(),createdAt:w().datetime(),updatedAt:w().datetime(),ownerPersonaId:w().min(1).optional()});P({originOnly:ye().optional(),ownerPersonaId:w().min(1).optional(),limit:V().int().positive().optional(),offset:V().int().nonnegative().optional()});P({sessionId:w().min(1)});P({sessionId:w().min(1),patch:P({label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),cwd:w().optional(),iconKey:w().optional(),ephemeral:J(!1).optional()})});P({id:w().min(1),text:w(),queuedAt:V(),senderDisplayName:w().optional()});P({sessionId:w().min(1),text:w(),queueWhileRunning:ye().optional()});P({sessionId:w().min(1),id:w().min(1).optional()});P({sessionId:w().min(1),userMessageId:w().min(1),dryRun:ye().optional()});P({canRewind:ye(),error:w().optional(),filesChanged:re(w()).optional(),insertions:V().int().nonnegative().optional(),deletions:V().int().nonnegative().optional()});P({sessionId:w().min(1),userMessageId:w().min(1)});const vB=P({oldStart:V().int().nonnegative(),oldLines:V().int().nonnegative(),newStart:V().int().nonnegative(),newLines:V().int().nonnegative(),lines:re(w())}),xB=P({filePath:w().min(1),hunks:re(vB),insertions:V().int().nonnegative(),deletions:V().int().nonnegative(),status:Le(["modified","added","deleted"]).optional()});P({canRewind:ye(),error:w().optional(),files:re(xB),totalInsertions:V().int().nonnegative(),totalDeletions:V().int().nonnegative()});P({userMessageIds:re(w())});P({sessionId:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),messageUuid:w().min(1),targetCwd:w().min(1).optional()});P({forkedToolSessionId:w().min(1),forkedFilePath:w().min(1)});P({sessionId:w().min(1),toolSessionId:w().min(1),jsonlPath:w().optional()});P({sessionId:w().min(1),afterSeq:V().int().min(-1)});P({sessionId:w().min(1),permissionRequestId:w().min(1),allow:ye(),permanent:ye().optional(),pattern:w().optional()});P({projectPath:w().min(1)});P({sessionId:w().min(1),limit:V().int().positive().max(5e3).optional(),offset:V().int().nonnegative().optional(),slim:ye().optional()});P({cwd:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),subagentId:w().min(1)});P({cwd:w().min(1).optional(),path:w().optional(),showHidden:ye().optional()});P({cwd:w().min(1),path:w().min(1)});P({cwd:w().min(1),tool:w().optional()});P({name:w().min(1),source:Le(J6),path:w().optional(),description:w().optional(),plugin:w().optional()});const _B=P({name:w().min(1),source:Le(eB),path:w().optional(),description:w().optional(),whenToUse:w().optional(),plugin:w().optional()});P({cwd:w().min(1),tool:w().optional()});P({agents:re(_B)});P({sessionId:w().optional()});P({sessionId:w().min(1).optional()});P({sessionId:w().min(1),pinned:ye()});P({sessionId:w().min(1),archived:ye()});P({type:J("peerSession:upsert:ok")});P({sessionId:w().min(1)});P({type:J("peerSession:remove:ok")});P({orderedIds:re(w().min(1)).min(1)});P({cwd:w().min(1)});P({isGitRoot:ye(),gitRoot:w().nullable()});P({cwd:w().min(1)});P({branch:w().nullable()});P({cwd:w().min(1)});P({branches:re(w()),head:w().nullable()});const yB=P({cwd:w().min(1),updatedAt:w().min(1)});P({dirs:re(yB)});P({type:J("session:question"),sessionId:w().min(1),toolUseId:w().min(1),requestId:w().min(1),questions:re(WT).min(1)});P({type:J("session:question:cleared"),sessionId:w().min(1),toolUseId:w().min(1),answers:Ws(w(),w()).optional()});P({sessionId:w().min(1),toolUseId:w().min(1),answers:Ws(w(),w())});P({ok:J(!0)});P({sessionId:w().min(1),toolUseId:w().min(1)});P({ok:J(!0)});const VT=P({name:w().min(1),version:w().min(1),instanceId:w().min(1),deviceLabel:w().transform(e=>e.trim().slice(0,64)).optional()});P({type:J("auth"),token:w().min(1),scheme:J("bearer").optional(),clientInfo:VT.optional()});P({type:J("auth:ok"),version:w().min(1).optional(),protocolVersion:V().int().nonnegative().optional()});const bB=P({clientId:w().min(1),connectedAt:V().int().nonnegative(),self:ye(),clientInfo:VT.optional()});P({type:J("device:connections:ok"),connections:re(bB)});P({type:J("tunnel:ready"),url:w().min(1),subdomain:w().min(1)});P({type:J("tunnel:exited"),code:V().int().nullable(),subdomain:w().nullable(),url:w().nullable()});P({type:J("tunnel:unavailable"),reason:w().min(1),failedAt:w().min(1)});const wB=P({sessionId:w().min(1),status:nB,freshSpawn:ye(),pendingPermissionRequestIds:re(w().min(1)),pendingQuestionToolUseIds:re(w().min(1))});P({type:J("info"),version:w(),protocolVersion:V(),hostname:w(),os:w(),tools:re(P({id:w(),available:ye()})),runningSessions:re(wB),tokenRole:Le(g6).optional(),isLoopback:ye().optional(),httpBaseUrl:w().optional(),httpToken:w().optional(),daemonSource:Le(["ota","packaged"]).optional(),globalCliVersion:w().nullable().optional()});const SB=6173,kB=6272,gl=/^[a-z][a-z0-9-]{0,39}$/,yu=P({name:w().regex(gl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:V().int().min(SB).max(kB),createdAt:w().datetime(),devCommand:w().min(1),prodUrl:w().url().optional(),readyPattern:w().optional(),publishJob:P({jobId:w().min(1),stage:Le(["build","deploy","verify"]),startedAt:V().int().nonnegative()}).optional()}),CB=["install-pending","installing","starting-dev-server","running","stopped","failed"],qT=Le(CB),K_=yu.extend({isRunning:ye(),boundSessionId:w().nullable(),stage:qT.optional(),stageReason:w().optional(),publishJob:P({jobId:w().min(1),stage:Le(["build","deploy","verify"]),startedAt:V().int().nonnegative(),status:Le(["in-flight","interrupted"])}).optional()});P({}).strict();P({projects:re(K_)}).strict();P({sessionId:w().min(1)}).strict();P({project:K_.nullable()}).strict();P({sessionId:w().min(1),name:w().min(1)}).strict();P({project:yu}).strict();P({name:w()}).strict();P({}).strict();P({name:w(),newPort:V().int()}).strict();P({project:yu}).strict();P({name:w().regex(gl),url:w().url()}).strict();P({project:yu}).strict();P({sessionId:w().min(1),force:ye().optional()}).strict();P({project:yu}).strict();const EB=["installing","failed"];P({sessionId:w().min(1),stage:Le(EB),reason:w().optional()}).strict();P({ok:J(!0)}).strict();P({sessionId:w().min(1)}).strict();P({ok:J(!0)}).strict();P({type:J("appBuilder:project-updated"),project:K_,stage:qT,stageReason:w().optional()}).strict();P({name:w().regex(gl)});P({jobId:w().min(1),status:Le(["started","already-publishing"])}).strict();P({name:w().regex(gl)});P({ok:J(!0)}).strict();P({type:J("appBuilder:publish-progress"),name:w().regex(gl),jobId:w().min(1),stage:Le(["build","deploy","verify"]),status:Le(["started","completed"])}).strict();P({type:J("appBuilder:publish-failed"),name:w().regex(gl),jobId:w().min(1),stage:Le(["build","deploy","verify","unknown"]),errorSummary:w()}).strict();P({});P({method:w().min(1).optional()});const NB=["allowed","conditional","denied"],TB=Le(NB),IB=P({name:w().min(1),status:TB,description:w().min(1),args:re(P({name:w(),required:ye()})).nullable(),argsSchema:Ws(Rs()).optional(),reason:w().optional()});P({type:J("meta:methods"),methods:re(IB)});const Iw=1,PB=["daemon","main","renderer"],RB=Le(PB),MB=["debug","info","warn","error"],AB=Le(MB);P({ts:V().int(),source:RB,level:AB,msg:w(),ownerPrincipalId:w(),deviceId:w(),appVersion:w(),daemonVersion:w().optional(),os:w(),meta_json:w().optional(),sessionId:w().optional()});P({v:J(1),visitorId:w().min(1),displayName:w(),provider:w(),iat:V(),exp:V()});const jB=P({visitorId:w(),displayName:w(),avatarUrl:w().optional(),provider:w(),firstSeen:V(),lastSeen:V()});P({visitors:re(jB)});const LB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,DB=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,OB="clawd-dispatch-task",BB="clawd-dispatch-result",Pw=120;function zB(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?OB:BB,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:$B(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function $B(e,t,n){var c;const r=KB(t),i=g0(qB(Rm(n,"detail")??n)),s=(c=Rm(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?g0(s):FB(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:VB(Rm(n,"files"))}}function FB(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Pw?`${n.slice(0,Pw)}…`:n}const HB="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",UB=new RegExp(`<\\\\(\\\\*)(/?)(${HB})\\b`,"g");function WB(e){return g0(e)}function g0(e){return e.replace(UB,"<$1$2$3")}function Rm(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function VB(e){return e?e.split(`
|
|
95
|
+
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var uw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const nO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},rO={motionBase:!0,motionUnit:!0},iO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},pT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=uw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=fT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=uw(l,["theme"]);let d=u;c&&(d=pT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function mT(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(dT),s=`${eO}-${t||""}`,o=n||uT,[a,l,c]=WL(o,[Kc,e],{salt:s,override:r,getComputedToken:pT,formatToken:fT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:nO,ignore:rO,preserve:iO}});return[o,c,t?l:"",a,i]}const sO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),oO=e=>({[`.${e}`]:Object.assign(Object.assign({},sO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),aO=(e,t)=>{const[n,r]=mT();return xD({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>oO(e))},lO=Object.assign({},ol),{useId:dw}=lO,cO=()=>"",uO=typeof dw>"u"?cO:dw;function dO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Fh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Fh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=uO();return AN(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!xL(c,d,!0)}))}var hO=["children"],gT=g.createContext({});function fO(e){var t=e.children,n=jv(e,hO);return g.createElement(gT.Provider,{value:n},t)}var pO=function(e){LN(n,e);var t=ON(n);function n(){return ul(this,n),t.apply(this,arguments)}return dl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function mO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=n0(function(){return i.current}),o=n0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var cs="none",od="appear",ad="enter",ld="leave",hw="none",jr="prepare",ya="start",ba="active",z_="end",vT="prepared";function fw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function gO(e,t){var n={animationend:fw("Animation","AnimationEnd"),transitionend:fw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var vO=gO(Ki(),typeof window<"u"?window:{}),xT={};if(Ki()){var xO=document.createElement("div");xT=xO.style}var cd={};function _T(e){if(cd[e])return cd[e];var t=vO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in xT)return cd[e]=t[s],cd[e]}return""}var yT=_T("animationend"),bT=_T("transitionend"),wT=!!(yT&&bT),pw=yT||"animationend",mw=bT||"transitionend";function gw(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const _O=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(mw,e),i.removeEventListener(pw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(mw,e),i.addEventListener(pw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var ST=Ki()?g.useLayoutEffect:g.useEffect;const yO=function(){var e=g.useRef(null);function t(){Mv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Mv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var bO=[jr,ya,ba,z_],wO=[jr,vT],kT=!1,SO=!0;function CT(e){return e===ba||e===z_}const kO=function(e,t,n){var r=r0(hw),i=et(r,2),s=i[0],o=i[1],a=yO(),l=et(a,2),c=l[0],u=l[1];function d(){o(jr,!0)}var f=t?wO:bO;return ST(function(){if(s!==hw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===kT?o(m,!0):m&&c(function(b){function x(){b.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function CO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,b=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,k=r.onAppearEnd,C=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,z=r0(),I=et(z,2),O=I[0],M=I[1],R=mO(cs),A=et(R,2),L=A[0],$=A[1],F=r0(null),D=et(F,2),B=D[0],E=D[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function te(){return n()}var ie=g.useRef(!1);function K(){$(cs),E(null,!0)}var xe=n0(function(Qe){var ot=L();if(ot!==cs){var _t=te();if(!(Qe&&!Qe.deadline&&Qe.target!==_t)){var vn=ie.current,cn;ot===od&&vn?cn=k==null?void 0:k(_t,Qe):ot===ad&&vn?cn=C==null?void 0:C(_t,Qe):ot===ld&&vn&&(cn=N==null?void 0:N(_t,Qe)),vn&&cn!==!1&&K()}}}),Pe=_O(xe),ce=et(Pe,1),Re=ce[0],$e=function(ot){switch(ot){case od:return ke(ke(ke({},jr,f),ya,v),ba,_);case ad:return ke(ke(ke({},jr,p),ya,b),ba,y);case ld:return ke(ke(ke({},jr,m),ya,x),ba,S);default:return{}}},Fe=g.useMemo(function(){return $e(H)},[H]),be=kO(H,!e,function(Qe){if(Qe===jr){var ot=Fe[jr];return ot?ot(te()):kT}if(qe in Fe){var _t;E(((_t=Fe[qe])===null||_t===void 0?void 0:_t.call(Fe,te(),null))||null)}return qe===ba&&H!==cs&&(Re(te()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){xe({deadline:!0})},u))),qe===vT&&K(),SO}),rt=et(be,2),pt=rt[0],qe=rt[1],Et=CT(qe);ie.current=Et;var Zt=g.useRef(null);ST(function(){if(!(q.current&&Zt.current===t)){M(t);var Qe=q.current;q.current=!0;var ot;!Qe&&t&&a&&(ot=od),Qe&&t&&s&&(ot=ad),(Qe&&!t&&c||!Qe&&d&&!t&&c)&&(ot=ld);var _t=$e(ot);ot&&(e||_t[jr])?($(ot),pt()):$(cs),Zt.current=t}},[t]),g.useEffect(function(){(H===od&&!a||H===ad&&!s||H===ld&&!c)&&$(cs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var mt=g.useRef(!1);g.useEffect(function(){O&&(mt.current=!0),O!==void 0&&H===cs&&((mt.current||O)&&(T==null||T(O)),mt.current=!0)},[O,H]);var xt=B;return Fe[jr]&&qe===ya&&(xt=He({transition:"none"},xt)),[H,qe,xt,O??t]}function EO(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(gT),b=v.motion,x=n(i,b),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:tL(y.current)}catch{return null}}var k=CO(x,a,S,i),C=et(k,4),N=C[0],T=C[1],z=C[2],I=C[3],O=g.useRef(I);I&&(O.current=!0);var M=g.useCallback(function(D){_.current=D,sL(s,D)},[s]),R,A=He(He({},m),{},{visible:a});if(!d)R=null;else if(N===cs)I?R=d(He({},A),M):!c&&O.current&&p?R=d(He(He({},A),{},{className:p}),M):u||!c&&!p?R=d(He(He({},A),{},{style:{display:"none"}}),M):R=null;else{var L;T===jr?L="prepare":CT(T)?L="active":T===ya&&(L="start");var $=gw(f,"".concat(N,"-").concat(L));R=d(He(He({},A),{},{className:Uj(gw(f,N),ke(ke({},$,$&&L),f,typeof f=="string")),style:z}),M)}if(g.isValidElement(R)&&oL(R)){var F=aL(R);F||(R=g.cloneElement(R,{ref:M}))}return g.createElement(pO,{ref:y},R)});return r.displayName="CSSMotion",r}const NO=EO(wT);var i0="add",s0="keep",o0="remove",Im="removed";function TO(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function a0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(TO)}function IO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=a0(e),o=a0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:i0})})),r=d),n.push(He(He({},f),{},{status:s0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:o0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:i0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==o0}),n.forEach(function(u){u.key===c&&(u.status=s0)})}),n}var PO=["component","children","onVisibleChanged","onAllRemoved"],RO=["status"],MO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function AO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NO,n=function(r){LN(s,r);var i=ON(s);function s(){var o;ul(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),ke(Pv(o),"state",{keyEntities:[]}),ke(Pv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Im})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Im}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return dl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=jv(c,PO),m=u||g.Fragment,v={};return MO.forEach(function(b){v[b]=p[b],delete p[b]}),delete p.keys,g.createElement(m,p,l.map(function(b,x){var _=b.status,y=jv(b,RO),S=_===i0||_===s0;return g.createElement(t,Bh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(C){f==null||f(C,{key:y.key}),C||a.removeKey(y.key)}}),function(k,C){return d(He(He({},k),{},{index:x}),C)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=a0(c),f=IO(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var b=v.key;return p.key===b});return!(m&&m.status===Im&&p.status===o0)})}}}]),s}(g.Component);return ke(n,"defaultProps",{component:"div"}),n}AO(wT);const vw=g.createContext(!0);function jO(e){const t=g.useContext(vw),{children:n}=e,[,r]=mT(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(vw.Provider,{value:i},g.createElement(fO,{motion:i},n)):n}const LO=()=>null;var DO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const OO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let ET;function BO(){return ET||e0}function zO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const $O=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(ET=t),r&&zO(r)&&GD(BO(),r)},FO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:b,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:k,statistic:C,spin:N,calendar:T,carousel:z,cascader:I,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,layout:E,list:H,mentions:q,modal:j,progress:te,result:ie,slider:K,breadcrumb:xe,menu:Pe,pagination:ce,input:Re,textArea:$e,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:Z,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Tr,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:es,treeSelect:El}=e,Xs=g.useCallback((Tt,G)=>{const{prefixCls:ge}=e;if(G)return G;const _e=ge||x.getPrefixCls("");return Tt?`${_e}-${Tt}`:_e},[x.getPrefixCls,e.prefixCls]),bi=_||x.iconPrefixCls||hT,Ko=n||x.csp;aO(bi,Ko);const Go=dO(y,x.theme,{prefixCls:Xs("")}),Ys={csp:Ko,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||b,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Xs,iconPrefixCls:bi,theme:Go,segmented:k,statistic:C,spin:N,calendar:T,carousel:z,cascader:I,collapse:O,typography:M,checkbox:R,descriptions:A,divider:L,drawer:$,skeleton:F,steps:D,image:B,input:Re,textArea:$e,layout:E,list:H,mentions:q,modal:j,progress:te,result:ie,slider:K,breadcrumb:xe,menu:Pe,pagination:ce,empty:Fe,badge:be,radio:rt,rate:pt,switch:qe,transfer:Et,avatar:Zt,message:mt,tag:xt,table:Qe,card:ot,tabs:_t,timeline:vn,timePicker:cn,upload:U,notification:Z,tree:ve,colorPicker:Te,datePicker:De,rangePicker:Nt,flex:un,wave:Wt,dropdown:Jt,warning:le,tour:we,tooltip:ut,popover:jt,popconfirm:Tr,floatButton:oe,floatButtonGroup:Je,variant:dn,inputNumber:es,treeSelect:El},ts=Object.assign({},x);Object.keys(Ys).forEach(Tt=>{Ys[Tt]!==void 0&&(ts[Tt]=Ys[Tt])}),OO.forEach(Tt=>{const G=e[Tt];G&&(ts[Tt]=G)}),typeof r<"u"&&(ts.button=Object.assign({autoInsertSpace:r},ts.button));const Ir=AN(()=>ts,ts,(Tt,G)=>{const ge=Object.keys(Tt),_e=Object.keys(G);return ge.length!==_e.length||ge.some(Ge=>Tt[Ge]!==G[Ge])}),{layer:zu}=g.useContext(Zf),Vp=g.useMemo(()=>({prefixCls:bi,csp:Ko,layer:zu?"antd":void 0}),[bi,Ko,zu]);let Lt=g.createElement(g.Fragment,null,g.createElement(LO,{dropdownMatchSelectWidth:p}),t);const Qs=g.useMemo(()=>{var Tt,G,ge,_e;return ED(((Tt=tp.Form)===null||Tt===void 0?void 0:Tt.defaultValidateMessages)||{},((ge=(G=Ir.locale)===null||G===void 0?void 0:G.Form)===null||ge===void 0?void 0:ge.defaultValidateMessages)||{},((_e=Ir.form)===null||_e===void 0?void 0:_e.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[Ir,o==null?void 0:o.validateMessages]);Object.keys(Qs).length>0&&(Lt=g.createElement(TD.Provider,{value:Qs},Lt)),a&&(Lt=g.createElement(RD,{locale:a,_ANT_MARK__:PD},Lt)),Lt=g.createElement(wD.Provider,{value:Vp},Lt),l&&(Lt=g.createElement(YD,{size:l},Lt)),Lt=g.createElement(jO,null,Lt);const qp=g.useMemo(()=>{const Tt=Go||{},{algorithm:G,token:ge,components:_e,cssVar:Ge}=Tt,Wr=DO(Tt,["algorithm","token","components","cssVar"]),Nl=G&&(!Array.isArray(G)||G.length>0)?Dv(G):uT,Kp={};Object.entries(_e||{}).forEach(([l4,c4])=>{const wi=Object.assign({},c4);"algorithm"in wi&&(wi.algorithm===!0?wi.theme=Nl:(Array.isArray(wi.algorithm)||typeof wi.algorithm=="function")&&(wi.theme=Dv(wi.algorithm)),delete wi.algorithm),Kp[l4]=wi});const C1=Object.assign(Object.assign({},Kc),ge);return Object.assign(Object.assign({},Wr),{theme:Nl,token:C1,components:Kp,override:Object.assign({override:C1},Kp),cssVar:Ge})},[Go]);return y&&(Lt=g.createElement(dT.Provider,{value:qp},Lt)),Ir.warning&&(Lt=g.createElement(ND.Provider,{value:Ir.warning},Lt)),S!==void 0&&(Lt=g.createElement(XD,{disabled:S},Lt)),g.createElement(np.Provider,{value:Ir},Lt)},fl=e=>{const t=g.useContext(np),n=g.useContext(oT);return g.createElement(FO,Object.assign({parentContext:t,legacyLocale:n},e))};fl.ConfigContext=np;fl.SizeContext=Gc;fl.config=$O;fl.useConfig=QD;Object.defineProperty(fl,"SizeContext",{get:()=>Gc});const dr=(e,t)=>new St(e).setA(t).toRgbString(),Qo=(e,t)=>new St(e).lighten(t).toHexString(),HO=e=>{const t=Va(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},UO=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:dr(r,.85),colorTextSecondary:dr(r,.65),colorTextTertiary:dr(r,.45),colorTextQuaternary:dr(r,.25),colorFill:dr(r,.18),colorFillSecondary:dr(r,.12),colorFillTertiary:dr(r,.08),colorFillQuaternary:dr(r,.04),colorBgSolid:dr(r,.95),colorBgSolidHover:dr(r,1),colorBgSolidActive:dr(r,.9),colorBgElevated:Qo(n,12),colorBgContainer:Qo(n,8),colorBgLayout:Qo(n,0),colorBgSpotlight:Qo(n,26),colorBgBlur:dr(r,.04),colorBorder:Qo(n,26),colorBorderSecondary:Qo(n,19)}},WO=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=Va(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=cT(e,{generateColorPalettes:HO,generateNeutralColorPalettes:UO});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},xw={defaultSeed:Fh.token,defaultAlgorithm:B_,darkAlgorithm:WO};function _w({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(fl,{theme:{algorithm:n.mode==="dark"?xw.darkAlgorithm:xw.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Xe;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Xe||(Xe={}));var yw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yw||(yw={}));const de=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fs=e=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(e)?de.array:e===null?de.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?de.promise:typeof Map<"u"&&e instanceof Map?de.map:typeof Set<"u"&&e instanceof Set?de.set:typeof Date<"u"&&e instanceof Date?de.date:de.object;default:return de.unknown}},X=Xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Hi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Hi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Hi.create=e=>new Hi(e);const l0=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===de.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,Xe.assertNever(e)}return{message:n}};let VO=l0;function qO(){return VO}const KO=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=qO(),r=KO({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===l0?void 0:l0].filter(i=>!!i)});e.common.issues.push(r)}class An{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ee;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return An.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Ee=Object.freeze({status:"aborted"}),Jl=e=>({status:"dirty",value:e}),Er=e=>({status:"valid",value:e}),bw=e=>e.status==="aborted",ww=e=>e.status==="dirty",qa=e=>e.status==="valid",Hh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class di{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Sw=(e,t)=>{if(qa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Hi(e.common.issues);return this._error=n,this._error}}};function je(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return fs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new An,ctx:{common:t.parent.common,data:t.data,parsedType:fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Sw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return qa(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>qa(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Hh(i)?i:Promise.resolve(i));return Sw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Eo({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Di.create(this,this._def)}nullable(){return No.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ai.create(this)}promise(){return Gh.create(this,this._def)}or(t){return Wh.create([this,t],this._def)}and(t){return Vh.create(this,t,this._def)}transform(t){return new Eo({...je(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Xh({...je(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new PT({typeName:Ne.ZodBranded,type:this,...je(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Yh({...je(this._def),innerType:this,catchValue:n,typeName:Ne.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return Qh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const GO=/^c[^\s-]{8,}$/i,XO=/^[0-9a-z]+$/,YO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,QO=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ZO=/^[a-z0-9_-]{21}$/i,JO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e6=/^[-+]?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)?)??$/,t6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,n6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pm;const r6=/^(?:(?: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])$/,i6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,s6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,o6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,NT="((\\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])))",c6=new RegExp(`^${NT}$`);function TT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function u6(e){return new RegExp(`^${TT(e)}$`)}function d6(e){let t=`${NT}T${TT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function h6(e,t){return!!((t==="v4"||!t)&&r6.test(e)||(t==="v6"||!t)&&s6.test(e))}function f6(e,t){if(!JO.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function p6(e,t){return!!((t==="v4"||!t)&&i6.test(e)||(t==="v6"||!t)&&o6.test(e))}class Mi extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==de.string){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.string,received:s.parsedType}),Ee}const r=new An;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")t6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Pm||(Pm=new RegExp(n6,"u")),Pm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")QO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")ZO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")GO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")XO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")YO.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?d6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?c6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?u6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?e6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?h6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?f6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?p6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Mi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Mi.create=e=>new Mi({checks:[],typeName:Ne.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...je(e)});function m6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ka extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==de.number){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.number,received:s.parsedType}),Ee}let r;const i=new An;for(const s of this._def.checks)s.kind==="int"?Xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?m6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_finite,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ka({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ka({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ka.create=e=>new Ka({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...je(e)});class Xc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==de.bigint)return this._getInvalidInput(t);let r;const i=new An;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Xe.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Xc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Xc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Xc.create=e=>new Xc({checks:[],typeName:Ne.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...je(e)});class c0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==de.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.boolean,received:r.parsedType}),Ee}return Er(t.data)}}c0.create=e=>new c0({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...je(e)});class Uh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==de.date){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_type,expected:de.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:X.invalid_date}),Ee}const r=new An;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Xe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Uh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Uh.create=e=>new Uh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...je(e)});class kw extends Ve{_parse(t){if(this._getType(t)!==de.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.symbol,received:r.parsedType}),Ee}return Er(t.data)}}kw.create=e=>new kw({typeName:Ne.ZodSymbol,...je(e)});class u0 extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.undefined,received:r.parsedType}),Ee}return Er(t.data)}}u0.create=e=>new u0({typeName:Ne.ZodUndefined,...je(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==de.null){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.null,received:r.parsedType}),Ee}return Er(t.data)}}d0.create=e=>new d0({typeName:Ne.ZodNull,...je(e)});class Cw extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Er(t.data)}}Cw.create=e=>new Cw({typeName:Ne.ZodAny,...je(e)});class h0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Er(t.data)}}h0.create=e=>new h0({typeName:Ne.ZodUnknown,...je(e)});class Ds extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:X.invalid_type,expected:de.never,received:n.parsedType}),Ee}}Ds.create=e=>new Ds({typeName:Ne.ZodNever,...je(e)});class Ew extends Ve{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.void,received:r.parsedType}),Ee}return Er(t.data)}}Ew.create=e=>new Ew({typeName:Ne.ZodVoid,...je(e)});class ai extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==de.array)return se(n,{code:X.invalid_type,expected:de.array,received:n.parsedType}),Ee;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new di(n,o,n.path,a)))).then(o=>An.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new di(n,o,n.path,a)));return An.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ai({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new ai({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new ai({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}ai.create=(e,t)=>new ai({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...je(t)});function oa(e){if(e instanceof $t){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Di.create(oa(r))}return new $t({...e._def,shape:()=>t})}else return e instanceof ai?new ai({...e._def,type:oa(e.element)}):e instanceof Di?Di.create(oa(e.unwrap())):e instanceof No?No.create(oa(e.unwrap())):e instanceof ko?ko.create(e.items.map(t=>oa(t))):e}class $t extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==de.object){const c=this._getOrReturnCtx(t);return se(c,{code:X.invalid_type,expected:de.object,received:c.parsedType}),Ee}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ds&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new di(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ds){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new di(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>An.mergeObjectSync(r,c)):An.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new $t({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new $t({...this._def,unknownKeys:"strip"})}passthrough(){return new $t({...this._def,unknownKeys:"passthrough"})}extend(t){return new $t({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new $t({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ne.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new $t({...this._def,catchall:t})}pick(t){const n={};for(const r of Xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new $t({...this._def,shape:()=>n})}deepPartial(){return oa(this)}partial(t){const n={};for(const r of Xe.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new $t({...this._def,shape:()=>n})}required(t){const n={};for(const r of Xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Di;)s=s._def.innerType;n[r]=s}return new $t({...this._def,shape:()=>n})}keyof(){return IT(Xe.objectKeys(this.shape))}}$t.create=(e,t)=>new $t({shape:()=>e,unknownKeys:"strip",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});$t.strictCreate=(e,t)=>new $t({shape:()=>e,unknownKeys:"strict",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});$t.lazycreate=(e,t)=>new $t({shape:e,unknownKeys:"strip",catchall:Ds.create(),typeName:Ne.ZodObject,...je(t)});class Wh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Hi(a.ctx.common.issues));return se(n,{code:X.invalid_union,unionErrors:o}),Ee}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Hi(l));return se(n,{code:X.invalid_union,unionErrors:a}),Ee}}get options(){return this._def.options}}Wh.create=(e,t)=>new Wh({options:e,typeName:Ne.ZodUnion,...je(t)});const Ei=e=>e instanceof p0?Ei(e.schema):e instanceof Eo?Ei(e.innerType()):e instanceof Kh?[e.value]:e instanceof Co?e.options:e instanceof m0?Xe.objectValues(e.enum):e instanceof Xh?Ei(e._def.innerType):e instanceof u0?[void 0]:e instanceof d0?[null]:e instanceof Di?[void 0,...Ei(e.unwrap())]:e instanceof No?[null,...Ei(e.unwrap())]:e instanceof PT||e instanceof Qh?Ei(e.unwrap()):e instanceof Yh?Ei(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.object)return se(n,{code:X.invalid_type,expected:de.object,received:n.parsedType}),Ee;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ei(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...je(r)})}}function f0(e,t){const n=fs(e),r=fs(t);if(e===t)return{valid:!0,data:e};if(n===de.object&&r===de.object){const i=Xe.objectKeys(t),s=Xe.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=f0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===de.array&&r===de.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=f0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===de.date&&r===de.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Vh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(bw(s)||bw(o))return Ee;const a=f0(s.value,o.value);return a.valid?((ww(s)||ww(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:X.invalid_intersection_types}),Ee)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Vh.create=(e,t,n)=>new Vh({left:e,right:t,typeName:Ne.ZodIntersection,...je(n)});class ko extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.array)return se(r,{code:X.invalid_type,expected:de.array,received:r.parsedType}),Ee;if(r.data.length<this._def.items.length)return se(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new di(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>An.mergeArray(n,o)):An.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new ko({...this._def,rest:t})}}ko.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ko({items:e,typeName:Ne.ZodTuple,rest:null,...je(t)})};class qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.object)return se(r,{code:X.invalid_type,expected:de.object,received:r.parsedType}),Ee;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new di(r,a,r.path,a)),value:o._parse(new di(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?An.mergeObjectAsync(n,i):An.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new qh({keyType:t,valueType:n,typeName:Ne.ZodRecord,...je(r)}):new qh({keyType:Mi.create(),valueType:t,typeName:Ne.ZodRecord,...je(n)})}}class Nw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.map)return se(r,{code:X.invalid_type,expected:de.map,received:r.parsedType}),Ee;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new di(r,a,r.path,[c,"key"])),value:s._parse(new di(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ee;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Nw.create=(e,t,n)=>new Nw({valueType:t,keyType:e,typeName:Ne.ZodMap,...je(n)});class Yc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.set)return se(r,{code:X.invalid_type,expected:de.set,received:r.parsedType}),Ee;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ee;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new di(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Yc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Yc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Yc.create=(e,t)=>new Yc({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...je(t)});class p0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}p0.create=(e,t)=>new p0({getter:e,typeName:Ne.ZodLazy,...je(t)});class Kh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}Kh.create=(e,t)=>new Kh({value:e,typeName:Ne.ZodLiteral,...je(t)});function IT(e,t){return new Co({values:e,typeName:Ne.ZodEnum,...je(t)})}class Co extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Xe.joinValues(r),received:n.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:X.invalid_enum_value,options:r}),Ee}return Er(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Co.create(t,{...this._def,...n})}exclude(t,n=this._def){return Co.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Co.create=IT;class m0 extends Ve{_parse(t){const n=Xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==de.string&&r.parsedType!==de.number){const i=Xe.objectValues(n);return se(r,{expected:Xe.joinValues(i),received:r.parsedType,code:X.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Xe.objectValues(n);return se(r,{received:r.data,code:X.invalid_enum_value,options:i}),Ee}return Er(t.data)}get enum(){return this._def.values}}m0.create=(e,t)=>new m0({values:e,typeName:Ne.ZodNativeEnum,...je(t)});class Gh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.promise&&n.common.async===!1)return se(n,{code:X.invalid_type,expected:de.promise,received:n.parsedType}),Ee;const r=n.parsedType===de.promise?n.data:Promise.resolve(n.data);return Er(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gh.create=(e,t)=>new Gh({type:e,typeName:Ne.ZodPromise,...je(t)});class Eo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Ee;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Ee:l.status==="dirty"||n.value==="dirty"?Jl(l.value):l});{if(n.value==="aborted")return Ee;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Ee:a.status==="dirty"||n.value==="dirty"?Jl(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ee:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qa(o))return Ee;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>qa(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Ee);Xe.assertNever(i)}}Eo.create=(e,t,n)=>new Eo({schema:e,typeName:Ne.ZodEffects,effect:t,...je(n)});Eo.createWithPreprocess=(e,t,n)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...je(n)});class Di extends Ve{_parse(t){return this._getType(t)===de.undefined?Er(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Di.create=(e,t)=>new Di({innerType:e,typeName:Ne.ZodOptional,...je(t)});class No extends Ve{_parse(t){return this._getType(t)===de.null?Er(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}No.create=(e,t)=>new No({innerType:e,typeName:Ne.ZodNullable,...je(t)});class Xh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===de.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Xh.create=(e,t)=>new Xh({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...je(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Hi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Yh.create=(e,t)=>new Yh({innerType:e,typeName:Ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...je(t)});class Tw extends Ve{_parse(t){if(this._getType(t)!==de.nan){const r=this._getOrReturnCtx(t);return se(r,{code:X.invalid_type,expected:de.nan,received:r.parsedType}),Ee}return{status:"valid",value:t.data}}}Tw.create=e=>new Tw({typeName:Ne.ZodNaN,...je(e)});class PT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),Jl(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ee:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ne.ZodPipeline})}}class Qh extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(qa(i)&&(i.value=Object.freeze(i.value)),i);return Hh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Qh.create=(e,t)=>new Qh({innerType:e,typeName:Ne.ZodReadonly,...je(t)});var Ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));const w=Mi.create,V=Ka.create,ye=c0.create,Rs=h0.create;Ds.create;const re=ai.create,P=$t.create;Wh.create;const gi=$_.create;Vh.create;ko.create;const Ws=qh.create,J=Kh.create,Le=Co.create;Gh.create;Di.create;No.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const g6=["owner"],v6=["agent","owner","user-upload"],RT=P({id:w().min(1),relPath:w().min(1),from:Le(v6),label:w().optional(),size:V().int().nonnegative(),mime:w().min(1),addedAt:V().int().nonnegative(),lastEditedAt:V().int().nonnegative().optional(),stale:ye().optional()});P({sessionId:w().min(1),relPath:w().min(1),ttlSeconds:V().int().positive().nullable().optional(),view:Le(["raw","md-rendered"]).optional()});P({url:w().min(1),expiresAt:V().int().nonnegative().nullable()});P({sessionId:w().min(1),relPath:w().min(1),label:w().optional(),origin:J("agent").optional()});P({entry:RT});P({sessionId:w().min(1),relPath:w().min(1)});P({removed:J(!0)});P({sessionId:w().min(1)});P({entries:re(RT)});P({attachmentId:w().min(1),url:w().min(1),relPath:w().min(1),sizeBytes:V().int().nonnegative(),mimeType:w().min(1)});const x6=gi("type",[P({type:J("persona"),id:w().min(1)}).strict(),P({type:J("chat"),id:w().min(1)}).strict(),P({type:J("*")}).strict()]),_6=Le(["read","send","admin"]),H_=P({resource:x6,actions:re(_6).min(1)}).strict(),y6=P({id:w().min(1),secretHash:w().regex(/^[a-f0-9]{64}$/),displayName:w(),grants:re(H_),issuedAt:V().int().nonnegative(),expiresAt:V().int().positive().optional(),maxUses:V().int().positive().optional(),usedCount:V().int().nonnegative(),peerOwnerId:w().min(1).optional(),firstUsedByPeerAt:V().int().positive().optional(),peerDisplayName:w().optional()}).strict(),b6=y6.omit({secretHash:!0});P({type:J("whoami:ok"),owner:P({id:w(),kind:Le(["owner","guest"]),displayName:w(),ownerId:w(),provider:w()}).strict(),capability:b6,grantedPersonas:re(P({id:w().min(1),displayName:w()}).strict())}).strict();P({selfUrl:w().min(1)});P({type:J("contact:handshake:ok"),owner:P({id:w(),ownerId:w(),provider:w(),displayName:w()}),grants:re(H_)});P({deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:setRemoteAccess:ok"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();P({type:J("contact:remote-access-updated"),deviceId:w().min(1),remoteAccessAllowed:ye()}).strict();const w6=P({deviceId:w().min(1),ownerId:w().min(1),provider:w().min(1),displayName:w(),remoteUrl:w().min(1),connectToken:w(),grants:re(H_),addedAt:V().int().nonnegative(),pinnedAt:V().int().nullable().default(null),remoteAccessAllowed:ye().default(!1),note:w().default("")}).strict(),MT=w6;P({deviceId:w().min(1)}).strict();P({type:J("contact:remove:ok"),deviceId:w().min(1)}).strict();P({type:J("contact:list:ok"),contacts:re(MT)}).strict();P({type:J("contact:added"),contact:MT}).strict();P({type:J("contact:removed"),deviceId:w().min(1)}).strict();P({deviceId:w().min(1),pinned:ye()}).strict();P({deviceId:w().min(1),note:w()}).strict();P({type:J("contact:setNote:ok"),deviceId:w().min(1),note:w()}).strict();P({type:J("contact:pin:ok"),deviceId:w().min(1),pinnedAt:V().int().nullable()}).strict();P({type:J("contact:pinned"),deviceId:w().min(1),pinnedAt:V().int().nullable()}).strict();const S6=P({deviceId:w().min(1),name:w().min(1),url:w().min(1)});P({type:J("device:list:ok"),devices:re(S6)});P({deviceId:w().min(1),url:w().min(1).optional(),name:w().optional()});P({type:J("device:connect:ok"),deviceId:w(),name:w(),url:w()});const AT=P({ownerId:w().min(1),provider:w().min(1),displayName:w().min(1),avatarUrl:w().optional(),unionId:w().optional()});P({type:J("auth:login:start:ok"),authUrl:w().min(1),state:w().min(1)});P({type:J("auth:getIdentity:ok"),identity:AT.nullable(),deviceId:w().min(1),ttcTokenExpiresAt:V().nullable().optional()});P({type:J("auth:logout:ok")});P({type:J("auth:login:done"),identity:AT});P({type:J("auth:login:failed"),reason:w()});const U_=gi("kind",[P({kind:J("success"),text:w(),brief:w().optional(),filePaths:re(w()).optional()}),P({kind:J("failure"),reason:w(),brief:w().optional()})]);P({targetPersona:w().min(1).optional(),dispatchId:w().min(1).optional(),prompt:w(),brief:w().optional(),targetDeviceId:w().min(1).optional(),model:w().min(1).optional(),tool:w().min(1).optional(),sessionLabel:w().min(1).max(60).optional(),meta:Ws(Rs()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});P({dispatchId:w().min(1),outcome:U_});const k6=["running","completed","failed"],W_=Le(k6),C6=P({dispatchId:w().min(1),sourceSessionId:w().min(1),sourcePersonaId:w().min(1).optional(),targetPersonaId:w().min(1),workerSessionId:w().min(1).optional(),taskText:w(),taskBrief:w().optional(),round:V().int().positive().optional(),status:W_,outcome:U_.optional(),meta:Ws(Rs()).optional(),createdAt:w().min(1),completedAt:w().min(1).optional(),deliveredAt:w().min(1).optional()});P({sourceSessionId:w().min(1).optional()});P({records:re(C6)});P({dispatchId:w().min(1)});P({type:J("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const E6=/^[a-z0-9][a-z0-9-]*$/;Le(["stopped","starting","running","crashed","invalid"]);const N6=new Set(["localhost","127.0.0.1"]);function T6(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&N6.has(t.hostname))}const ud=P({id:w().regex(E6),name:w().min(1),version:w().min(1),apiVersion:J("1"),runtime:P({startCommand:w().min(1)}).passthrough().optional(),entry:P({url:w().url().refine(T6,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),I6=gi("kind",[P({kind:J("local"),port:V().int().min(1).max(65535)}),P({kind:J("hosted"),url:w().url()})]);gi("state",[P({extId:w(),manifest:ud,state:J("stopped")}),P({extId:w(),manifest:ud,state:J("starting")}),P({extId:w(),manifest:ud,state:J("running"),target:I6}),P({extId:w(),manifest:ud,state:J("crashed")}),P({extId:w(),manifest:Rs().nullable(),state:J("invalid"),invalidReason:w().min(1)})]);P({snapshotHash:w().min(1),version:w().min(1),publishedAt:V()});const P6=gi("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1)})]);gi("kind",[P({kind:J("p2p-tunnel"),ownerPrincipalId:w().min(1),extId:w().min(1),snapshotHash:w().min(1)})]);P({extId:w().min(1),name:w().min(1),version:w().min(1),contentHash:w().min(1),publishedAt:V()});const R6=gi("kind",[P({kind:J("clean")}),P({kind:J("ready-new-version"),fromVersion:w().min(1),toVersion:w().min(1)}),P({kind:J("error-same-hash"),version:w().min(1)}),P({kind:J("error-version-not-bumped"),localVersion:w().min(1),publishedVersion:w().min(1)}),P({kind:J("error-version-regression"),localVersion:w().min(1),publishedVersion:w().min(1)})]);P({localManifest:P({name:w().min(1),version:w().min(1),contentHash:w().min(1)}),publishState:gi("kind",[P({kind:J("unpublished")}),P({kind:J("published"),version:w().min(1),contentHash:w().min(1),publishedAt:V()})]),check:R6});P({extId:w().min(1),newVersion:w().min(1).nullish()});P({extId:w().min(1)});P({extId:w().min(1),snapshotHash:w().min(1)});P({channelRef:P6,snapshotHash:w().min(1),zipBase64:w().min(1)});P({id:w().min(1),peerDeviceId:w().min(1),senderDeviceId:w().min(1),text:w().min(1),createdAt:V().int().nonnegative(),readBy:Ws(w().min(1),V().int().positive()).default({}),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1).optional(),id:w().min(1),text:w().min(1),createdAt:V().int().nonnegative(),origin:P({kind:J("persona"),personaId:w().min(1)}).optional()}).strict();P({peerDeviceId:w().min(1),sinceCreatedAt:V().int().nonnegative().optional()}).strict();P({peerDeviceId:w().min(1),upToCreatedAt:V().int().nonnegative()}).strict();P({peerDeviceId:w().min(1).optional(),text:w().min(1)});P({peerDeviceId:w().min(1).optional(),command:w().min(1),timeoutMs:V().int().positive().optional()}).strict();P({type:J("peerExec:run:ok"),stdout:w(),stderr:w(),exitCode:V().int().nullable(),timedOut:ye(),stdoutTruncated:ye(),stderrTruncated:ye()}).strict();const jT=gi("kind",[P({kind:J("at"),at:w().min(1)}),P({kind:J("every"),everyMs:V().int().positive(),anchorMs:V().int().nonnegative().optional()}),P({kind:J("cron"),expr:w().min(1),tz:w().min(1).optional()})]),xu=w().trim().min(1);P({personaId:xu,name:w().min(1),schedule:jT,prompt:w().min(1),targetPersona:w().min(1).optional(),timeoutMs:V().int().positive().optional()});P({personaId:xu,onlyMine:ye().optional()});P({personaId:xu,shiftId:w().min(1)});const M6=P({name:w().min(1).optional(),schedule:jT.optional(),prompt:w().min(1).optional(),targetPersona:w().min(1).optional(),timeoutMs:V().int().positive().optional(),enabled:ye().optional()});P({personaId:xu,shiftId:w().min(1),patch:M6});P({personaId:xu,shiftId:w().min(1),limit:V().int().positive().optional()});const A6="persona-master",V_=P({personaId:w().min(1),deviceId:w().min(1).optional()}),LT=P({id:w().min(1),name:w().min(1),memberPersonas:re(V_),memberContactDeviceIds:re(w().min(1)),createdAt:w().min(1),updatedAt:w().min(1)}),DT=w().trim().min(1);P({name:DT,memberPersonas:re(V_).default([]),memberContactDeviceIds:re(w().min(1)).default([])});P({channelId:w().min(1),name:DT.optional(),memberPersonas:re(V_).optional(),memberContactDeviceIds:re(w().min(1)).optional()});P({channelId:w().min(1)});P({channels:re(LT)});P({channel:LT});P({ok:J(!0),removedTopics:V().int().min(0)});const Sn=w().trim().min(1),j6=["planning","running","done"],L6=Le(j6),D6=P({at:w().min(1),actor:w().min(1),action:w().min(1),target:w().optional(),reason:w().min(1),artifacts:re(Sn).optional()}),O6=P({rejectCount:V().int().min(0),accepted:ye().default(!1),ordinal:V().int().min(1).optional(),overrideCount:V().int().min(0).optional()}),q_=P({id:w().min(1),channelId:w().min(1),title:w(),masterSessionId:w().min(1),goal:w(),boundaries:w(),acceptanceCriteria:re(w()),activity:re(D6),lineMeta:Ws(O6),nextLineOrdinal:V().int().min(1).optional(),state:L6,createdAt:w().min(1),updatedAt:w().min(1)}),B6=P({lineId:w().min(1),dispatchId:w().min(1),workerSessionId:w().optional(),assignee:w().min(1),focus:w(),status:W_,acceptance:re(w()),rejectCount:V().int().min(0),accepted:ye(),ordinal:V().int().min(1).nullable()});P({channelId:w().min(1)});P({topicId:w().min(1).optional(),sessionId:w().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:w().min(1),title:Sn.optional()});P({topicId:w().min(1),title:Sn.optional(),goal:Sn,boundaries:w(),acceptanceCriteria:re(Sn).min(1)});P({topicId:w().min(1),action:Sn,target:Sn.optional(),reason:Sn,artifacts:re(Sn).optional()});P({topicId:w().min(1),lineId:Sn,reason:Sn});P({topicId:w().min(1),lineId:Sn,reason:Sn,artifacts:re(Sn).optional(),watcherVerdict:Le(["pass","fail"]),overrideReason:Sn.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});P({topicId:w().min(1),state:Le(["done"])});P({topicId:w().min(1),title:Sn});P({topicId:w().min(1)});const z6=q_.extend({lineCount:V().int().min(0)});P({topics:re(z6)});P({topic:q_,lines:re(B6)});P({topicId:w().min(1),masterSessionId:w().min(1)});P({rejectCount:V().int().min(1),needsOwnerAttention:ye()});P({acceptedLines:V().int().min(1),totalLines:V().int().min(1),allAccepted:ye(),overrides:V().int().min(0),needsOwnerAttention:ye()});P({topic:q_});P({ok:J(!0),removedMasterSessionId:w().min(1).nullable(),removedWorkerSessionIds:re(w().min(1))});const $6=["ask","allow","deny"],OT=Le($6),F6=P({id:w().min(1),desc:w().min(1),action:OT});P({rules:re(F6)});P({ruleId:w().min(1)});P({action:OT,desc:w(),source:w().min(1)});const H6=["created","review-requested"],BT=/^[A-Za-z0-9._-]+$/,pl=w().min(1).regex(BT),ml=w().min(1).regex(BT),_u=V().int().positive();P({role:Le(H6)});P({owner:pl,repo:ml,number:_u});P({owner:pl,repo:ml,number:_u,expectedHeadSha:w().min(1)});P({owner:pl,repo:ml,number:_u,body:w().min(1)});P({owner:pl,repo:ml,number:_u,ready:ye()});P({owner:pl,repo:ml});P({owner:pl,repo:ml,number:_u,reviewers:re(w().min(1)).min(1)});P({personaId:w().min(1)});const U6=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],W6=Le(U6);P({personaId:w().min(1),appId:w().min(1),appSecret:w().min(1),botName:w().min(1).optional()});const V6=P({chatId:w().min(1),chatName:w().optional(),lastActiveAt:V().int().optional()}),q6=P({state:Le(["unbound","provisioning","bound","broken"]),appId:w().optional(),botName:w().optional(),brokenReason:w().optional(),qrUrl:w().optional(),errorReason:W6.optional(),groups:re(V6)});q6.extend({personaId:w().min(1)});P({});P({onboardingCompletedAt:V()});P({});P({tools:re(P({id:Le(["claude","codex"]),available:ye(),version:w().optional(),path:w().optional()}))});P({});const K6=P({tool:Le(["claude","codex"]),cwd:w(),toolSessionId:w(),label:w().optional(),createdAt:w(),updatedAt:w(),turns:V()});P({candidates:re(K6)});P({});P({registered:ye()});const G6=P({personaId:w(),label:w(),model:w().optional(),effort:w().optional(),public:ye(),iconKey:w().optional(),tool:w().optional(),createdAt:V(),updatedAt:V()}).strict(),X6=P({name:w().min(1),description:w().optional()}),Y6=P({id:w().min(1)}),Q6=P({permissions:P({defaultMode:w().optional(),allow:re(w()).optional(),deny:re(w()).optional()}).optional(),sandbox:P({enabled:ye().optional(),autoAllowBashIfSandboxed:ye().optional(),allowUnsandboxedCommands:ye().optional(),excludedCommands:re(w()).optional(),filesystem:P({denyRead:re(w()).optional(),allowRead:re(w()).optional(),denyWrite:re(w()).optional(),allowWrite:re(w()).optional()}).optional(),network:P({allowedDomains:re(w()).optional(),allowLocalBinding:ye().optional()}).optional()}).optional()});G6.extend({personality:w().optional(),personalityLocal:w().optional(),personalityManaged:ye().optional(),skills:re(X6).optional(),plugins:re(Y6).optional(),sandboxSettings:Q6.nullable().optional()});P({slug:w().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:w().min(1),personality:w(),model:w().optional(),effort:w().optional(),tool:w().optional(),public:ye().optional(),iconKey:w().optional()}).strict();P({personaId:w().min(1)});P({personaId:w().min(1),patch:P({label:w().min(1).optional(),model:w().optional(),effort:w().optional(),tool:w().optional(),personality:w().optional(),personalityLocal:w().optional(),public:ye().optional(),iconKey:w().nullable().optional()}).strict()}).strict();P({writableRoots:re(w()).optional(),denyRead:re(w()).optional(),network:ye().optional()}).strict();const zT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],$T=["idle","running","running-idle","stopped","error","observing"],Z6=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function rp(e){return e==="dispatch-task"||e==="dispatch-result"}const J6=["builtin","global","project","plugin"],eB=["builtin","global","project","policy","plugin"],FT=Le(["owner","guest"]);P({id:w().min(1),kind:FT,displayName:w(),feishuUnionId:w().optional()}).strict();const tB=P({did:w().min(1),displayName:w(),feishuUnionId:w().optional(),principal:FT}).strict(),nB=Le($T),rB=P({inputTokens:V().int().nonnegative(),outputTokens:V().int().nonnegative(),cacheReadTokens:V().int().nonnegative().optional(),cacheCreateTokens:V().int().nonnegative().optional()}),HT={gitBranch:w().optional(),resolvedModel:w().optional(),resolvedEffort:w().optional(),contextUsage:rB.optional(),contextWindowSize:V().int().positive().optional(),aiLabel:w().optional()},iB=P(HT),UT=P({value:w(),label:w(),description:w().optional()}),sB=P({id:w().min(1),label:w().min(1),description:w().optional(),contextWindowSize:V().int().positive(),default:ye().optional(),efforts:re(UT).optional(),defaultEffort:w().optional()}),oB=P({id:w().min(1),label:w().min(1),description:w().optional()}),aB=P({name:w().min(1),type:Le(["string","select","toggle"]),label:w().min(1),description:w().optional(),options:re(UT).optional(),default:Rs().optional(),scope:Le(["core","tool-specific"])});P({tool:w().min(1)});const lB=P({rewind:ye(),subagents:ye(),tui:ye(),observe:ye(),fileSharing:ye(),fork:ye()});P({tool:w().min(1),toolSessionIdLabel:w().optional(),models:re(sB),permissionModes:re(oB),configSchema:re(aB),features:lB});const cB=P({tool:w().min(1),pattern:w().min(1),createdAt:w().min(1).optional()});P({sessionId:w().min(1),cwd:w().min(1),tool:J("claude").or(w().min(1)).default("claude"),toolSessionId:w().optional(),label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),...HT,aiLabelGeneratedAt:w().optional(),permissionRules:re(cB).optional(),pinnedAt:V().int().nonnegative().nullable().optional(),archivedAt:V().int().nonnegative().nullable().optional(),pinSortOrder:V().int().nullable().optional(),unreadAt:w().min(1).nullable().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional(),appBuilderProject:w().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:w().min(1).optional(),creatorPrincipalId:w().min(1).optional(),creatorDisplayName:w().min(1).optional(),creatorFeishuUnionId:w().min(1).optional(),originOwnerPrincipalId:w().min(1).optional(),originOwnerPersonaId:w().min(1).optional(),dispatchedFromSessionId:w().min(1).optional(),shiftFiredFromSessionId:w().min(1).optional(),larkChatId:w().min(1).optional(),larkChatName:w().min(1).optional(),larkChatType:Le(["p2p","group"]).optional(),createdAt:w().min(1),updatedAt:w().min(1)});const $n={seq:V().int().nonnegative().optional(),ts:w().optional(),uuid:w().optional()},uB=Le(Z6),dB=P({readCount:V().int().nonnegative().optional(),searchCount:V().int().nonnegative().optional(),bashCount:V().int().nonnegative().optional(),editFileCount:V().int().nonnegative().optional(),linesAdded:V().int().nonnegative().optional(),linesRemoved:V().int().nonnegative().optional(),otherToolCount:V().int().nonnegative().optional()}),hB=P({oldStart:V().int().nonnegative(),oldLines:V().int().nonnegative(),newStart:V().int().nonnegative(),newLines:V().int().nonnegative(),lines:re(w())}),fB=P({agentId:w().optional(),agentType:w().optional(),status:w().optional(),prompt:w().optional(),filePath:w().optional(),structuredPatch:re(hB).optional(),stats:P({durationMs:V().int().nonnegative().optional(),tokens:V().int().nonnegative().optional(),toolUseCount:V().int().nonnegative().optional(),toolStats:dB.optional()}).optional()}),pB=P({path:w(),content:w(),mtimeMs:V().optional()}),mB=P({label:w().min(1),description:w().optional()}),WT=P({question:w().min(1),multiSelect:ye(),options:re(mB).min(1)}),gB=["completed","interrupted"];gi("kind",[P({...$n,kind:J("session_init"),toolSessionId:w().optional()}),P({...$n,kind:J("thinking"),text:w(),partialId:w().optional()}),P({...$n,kind:J("text"),text:w(),partialId:w().optional()}),P({...$n,kind:J("user_text"),text:w(),meta:uB.optional(),taskId:w().optional(),parentToolUseId:w().optional(),sender:tB.optional()}),P({...$n,kind:J("tool_call"),toolUseId:w(),tool:w(),toolKind:w().optional(),input:Rs()}),P({...$n,kind:J("tool_result"),toolUseId:w(),output:Rs().optional(),error:w().optional(),toolResultExtra:fB.optional(),sourceToolAssistantUUID:w().optional(),askQuestionAnswers:Ws(w(),w()).optional()}),P({...$n,kind:J("attachment_memories"),memories:re(pB)}),P({...$n,kind:J("permission_request"),requestId:w(),tool:w(),input:Rs(),toolUseId:w().optional()}),P({...$n,kind:J("ask_user_question"),toolUseId:w(),questions:re(WT)}),P({...$n,kind:J("turn_end"),durationMs:V().int().nonnegative().optional(),reason:Le(gB).optional()}),P({...$n,kind:J("subagent_progress"),toolUseId:w(),agentId:w(),status:Le(["started","running","completed","failed"]),description:w().optional(),lastToolName:w().optional(),prompt:w().optional(),stats:P({durationMs:V().int().nonnegative().optional(),tokens:V().int().nonnegative().optional(),toolUseCount:V().int().nonnegative().optional()}).optional()}),P({...$n,kind:J("error"),message:w()}),P({...$n,kind:J("meta_update"),patch:iB}),P({...$n,kind:J("meta-text"),text:w(),metaSource:Le(["cc","owner"]).optional()})]);P({cwd:w().min(1).optional(),tool:w().optional(),label:w().optional(),aiLabel:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),iconKey:w().optional(),forkedFromSessionId:w().min(1).optional(),ephemeral:ye().optional(),ownerPersonaId:w().min(1).optional(),projectPath:w().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:w().min(1),name:w().min(1),createdAt:w().datetime(),pinnedAt:V().optional()});P({path:w().min(1),pinnedAt:V().nullable()});P({path:w().min(1)});P({path:w().min(1).optional(),name:w().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:w().min(1),tool:w().min(1),toolSessionId:w().min(1),label:w().optional(),aiLabel:w().optional(),iconKey:w().optional(),createdAt:w().datetime(),updatedAt:w().datetime(),ownerPersonaId:w().min(1).optional()});P({originOnly:ye().optional(),ownerPersonaId:w().min(1).optional(),limit:V().int().positive().optional(),offset:V().int().nonnegative().optional()});P({sessionId:w().min(1)});P({sessionId:w().min(1),patch:P({label:w().optional(),model:w().optional(),permissionMode:w().optional(),effort:w().optional(),cwd:w().optional(),iconKey:w().optional(),ephemeral:J(!1).optional()})});P({id:w().min(1),text:w(),queuedAt:V(),senderDisplayName:w().optional()});P({sessionId:w().min(1),text:w(),queueWhileRunning:ye().optional()});P({sessionId:w().min(1),id:w().min(1).optional()});P({sessionId:w().min(1),userMessageId:w().min(1),dryRun:ye().optional()});P({canRewind:ye(),error:w().optional(),filesChanged:re(w()).optional(),insertions:V().int().nonnegative().optional(),deletions:V().int().nonnegative().optional()});P({sessionId:w().min(1),userMessageId:w().min(1)});const vB=P({oldStart:V().int().nonnegative(),oldLines:V().int().nonnegative(),newStart:V().int().nonnegative(),newLines:V().int().nonnegative(),lines:re(w())}),xB=P({filePath:w().min(1),hunks:re(vB),insertions:V().int().nonnegative(),deletions:V().int().nonnegative(),status:Le(["modified","added","deleted"]).optional()});P({canRewind:ye(),error:w().optional(),files:re(xB),totalInsertions:V().int().nonnegative(),totalDeletions:V().int().nonnegative()});P({userMessageIds:re(w())});P({sessionId:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),messageUuid:w().min(1),targetCwd:w().min(1).optional()});P({forkedToolSessionId:w().min(1),forkedFilePath:w().min(1)});P({sessionId:w().min(1),toolSessionId:w().min(1),jsonlPath:w().optional()});P({sessionId:w().min(1),afterSeq:V().int().min(-1)});P({sessionId:w().min(1),permissionRequestId:w().min(1),allow:ye(),permanent:ye().optional(),pattern:w().optional()});P({projectPath:w().min(1)});P({sessionId:w().min(1),limit:V().int().positive().max(5e3).optional(),offset:V().int().nonnegative().optional(),slim:ye().optional()});P({cwd:w().min(1),toolSessionId:w().min(1)});P({cwd:w().min(1),toolSessionId:w().min(1),subagentId:w().min(1)});P({cwd:w().min(1).optional(),path:w().optional(),showHidden:ye().optional()});P({cwd:w().min(1),path:w().min(1)});P({cwd:w().min(1),tool:w().optional()});P({name:w().min(1),source:Le(J6),path:w().optional(),description:w().optional(),plugin:w().optional()});const _B=P({name:w().min(1),source:Le(eB),path:w().optional(),description:w().optional(),whenToUse:w().optional(),plugin:w().optional()});P({cwd:w().min(1),tool:w().optional()});P({agents:re(_B)});P({sessionId:w().optional()});P({sessionId:w().min(1).optional()});P({sessionId:w().min(1),pinned:ye()});P({sessionId:w().min(1),archived:ye()});P({type:J("peerSession:upsert:ok")});P({sessionId:w().min(1)});P({type:J("peerSession:remove:ok")});P({orderedIds:re(w().min(1)).min(1)});P({cwd:w().min(1)});P({isGitRoot:ye(),gitRoot:w().nullable()});P({cwd:w().min(1)});P({branch:w().nullable()});P({cwd:w().min(1)});P({branches:re(w()),head:w().nullable()});const yB=P({cwd:w().min(1),updatedAt:w().min(1)});P({dirs:re(yB)});P({type:J("session:question"),sessionId:w().min(1),toolUseId:w().min(1),requestId:w().min(1),questions:re(WT).min(1)});P({type:J("session:question:cleared"),sessionId:w().min(1),toolUseId:w().min(1),answers:Ws(w(),w()).optional()});P({sessionId:w().min(1),toolUseId:w().min(1),answers:Ws(w(),w())});P({ok:J(!0)});P({sessionId:w().min(1),toolUseId:w().min(1)});P({ok:J(!0)});const VT=P({name:w().min(1),version:w().min(1),instanceId:w().min(1),deviceLabel:w().transform(e=>e.trim().slice(0,64)).optional()});P({type:J("auth"),token:w().min(1),scheme:J("bearer").optional(),clientInfo:VT.optional()});P({type:J("auth:ok"),version:w().min(1).optional(),protocolVersion:V().int().nonnegative().optional()});const bB=P({clientId:w().min(1),connectedAt:V().int().nonnegative(),self:ye(),clientInfo:VT.optional()});P({type:J("device:connections:ok"),connections:re(bB)});P({type:J("tunnel:ready"),url:w().min(1),subdomain:w().min(1)});P({type:J("tunnel:exited"),code:V().int().nullable(),subdomain:w().nullable(),url:w().nullable()});P({type:J("tunnel:unavailable"),reason:w().min(1),failedAt:w().min(1)});const wB=P({sessionId:w().min(1),status:nB,freshSpawn:ye(),pendingPermissionRequestIds:re(w().min(1)),pendingQuestionToolUseIds:re(w().min(1))});P({type:J("info"),version:w(),protocolVersion:V(),hostname:w(),os:w(),tools:re(P({id:w(),available:ye()})),runningSessions:re(wB),tokenRole:Le(g6).optional(),isLoopback:ye().optional(),httpBaseUrl:w().optional(),httpToken:w().optional(),daemonSource:Le(["ota","packaged"]).optional(),globalCliVersion:w().nullable().optional()});const SB=6173,kB=6272,gl=/^[a-z][a-z0-9-]{0,39}$/,yu=P({name:w().regex(gl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:V().int().min(SB).max(kB),createdAt:w().datetime(),devCommand:w().min(1),prodUrl:w().url().optional(),readyPattern:w().optional(),publishJob:P({jobId:w().min(1),stage:Le(["build","deploy","verify"]),startedAt:V().int().nonnegative()}).optional()}),CB=["install-pending","installing","starting-dev-server","running","stopped","failed"],qT=Le(CB),K_=yu.extend({isRunning:ye(),boundSessionId:w().nullable(),stage:qT.optional(),stageReason:w().optional(),publishJob:P({jobId:w().min(1),stage:Le(["build","deploy","verify"]),startedAt:V().int().nonnegative(),status:Le(["in-flight","interrupted"])}).optional()});P({}).strict();P({projects:re(K_)}).strict();P({sessionId:w().min(1)}).strict();P({project:K_.nullable()}).strict();P({sessionId:w().min(1),name:w().min(1)}).strict();P({project:yu}).strict();P({name:w()}).strict();P({}).strict();P({name:w(),newPort:V().int()}).strict();P({project:yu}).strict();P({name:w().regex(gl),url:w().url()}).strict();P({project:yu}).strict();P({sessionId:w().min(1),force:ye().optional()}).strict();P({project:yu}).strict();const EB=["installing","failed"];P({sessionId:w().min(1),stage:Le(EB),reason:w().optional()}).strict();P({ok:J(!0)}).strict();P({sessionId:w().min(1)}).strict();P({ok:J(!0)}).strict();P({type:J("appBuilder:project-updated"),project:K_,stage:qT,stageReason:w().optional()}).strict();P({name:w().regex(gl)});P({jobId:w().min(1),status:Le(["started","already-publishing"])}).strict();P({name:w().regex(gl)});P({ok:J(!0)}).strict();P({type:J("appBuilder:publish-progress"),name:w().regex(gl),jobId:w().min(1),stage:Le(["build","deploy","verify"]),status:Le(["started","completed"])}).strict();P({type:J("appBuilder:publish-failed"),name:w().regex(gl),jobId:w().min(1),stage:Le(["build","deploy","verify","unknown"]),errorSummary:w()}).strict();P({});P({method:w().min(1).optional()});const NB=["allowed","conditional","denied"],TB=Le(NB),IB=P({name:w().min(1),status:TB,description:w().min(1),args:re(P({name:w(),required:ye()})).nullable(),argsSchema:Ws(Rs()).optional(),reason:w().optional()});P({type:J("meta:methods"),methods:re(IB)});const Iw=1,PB=["daemon","main","renderer"],RB=Le(PB),MB=["debug","info","warn","error"],AB=Le(MB);P({ts:V().int(),source:RB,level:AB,msg:w(),ownerPrincipalId:w(),deviceId:w(),appVersion:w(),daemonVersion:w().optional(),os:w(),meta_json:w().optional(),sessionId:w().optional()});P({v:J(1),visitorId:w().min(1),displayName:w(),provider:w(),iat:V(),exp:V()});const jB=P({visitorId:w(),displayName:w(),avatarUrl:w().optional(),provider:w(),firstSeen:V(),lastSeen:V()});P({visitors:re(jB)});const LB=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,DB=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,OB="clawd-dispatch-task",BB="clawd-dispatch-result",Pw=120;function zB(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?OB:BB,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:$B(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function $B(e,t,n){var c;const r=KB(t),i=g0(qB(Rm(n,"detail")??n)),s=(c=Rm(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?g0(s):FB(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:VB(Rm(n,"files"))}}function FB(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Pw?`${n.slice(0,Pw)}…`:n}const HB="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",UB=new RegExp(`<\\\\(\\\\*)(/?)(${HB})\\b`,"g");function WB(e){return g0(e)}function g0(e){return e.replace(UB,"<$1$2$3")}function Rm(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function VB(e){return e?e.split(`
|
|
96
96
|
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function qB(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function KB(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=GB(r[2]??"");return t}function GB(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const XB=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let Si=null;function YB(){if(Si!==null)return Si;if(typeof window>"u")return Si=!1,!1;if(XB.has(window.location.hostname)||window.location.protocol==="file:")return Si=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){Si=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{Si=sessionStorage.getItem("debug")==="1"}catch{Si=!1}return Si}function Me(e,...t){YB()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function dd(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const QB=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},ZB=new Set(["auth:ok","pong","error"]),Rw=new Set(zT.filter(e=>!ZB.has(e)));let JB=0;const Mw=()=>`r${++JB}`;function ez(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??QB;let u=null,d=!1,f=0,p=null,m=null,v=null,b=null,x=!1,_="disconnected";const y=new Map,S=new Map;let k=null;const C=(B,E)=>{var H;B==="ready"&&(k=E),(H=S.get(B))==null||H.forEach(q=>{try{q(E)}catch{}})},N=B=>{_!==B&&(_=B,C("status",B))},T=(B,E)=>{const H=S.get(B)??new Set;if(H.add(E),S.set(B,H),B==="ready"&&k!==null)try{E(k)}catch{}return()=>H.delete(E)},z=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),b&&(clearTimeout(b),b=null)},I=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},O=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:Mw()}))},o),I()},M=B=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(B));y.clear()},R=[],A=()=>{if(R.length===0)return;const B=R.splice(0);for(const E of B)(u==null?void 0:u.readyState)===1&&!x?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},L=B=>{if(R.length===0)return;const E=R.splice(0);for(const H of E)clearTimeout(H.timer),H.reject(new Error(B))},$=()=>{if(d)return;const B=c(f);if(B<0){L("connection closed: not reconnecting");return}C("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,D()},B)},F=B=>{I();const E=String(B.type??"");if(E==="auth:ok"){Me("daemon-client","auth:ok received → connected",{url:t}),b&&(clearTimeout(b),b=null),x=!1,f=0,N("connected"),C("daemon:connected",{url:t}),O(),A();return}if(E==="pong")return;if(E==="ready"){const q=Number(B.protocolVersion??-1);q!==Iw&&C("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:Iw}),C("ready",B);return}const H=B.requestId;if(typeof H=="string"&&y.has(H)){const q=y.get(H);if(y.delete(H),clearTimeout(q.timer),E==="error"){const j=String(B.code??"ERR"),te=String(B.message??"unknown");q.reject(new Error(`${j}: ${te}`))}else Rw.has(E)&&C(E,B),q.resolve(B);return}Rw.has(E)&&C(E,B)},D=()=>{p&&(clearTimeout(p),p=null),Me("daemon-client","connect →",{url:t,token:dd(n),attempt:f}),N("connecting");let B;try{B=new WebSocket(t)}catch(E){N("disconnected"),C("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=B,x=!!n,B.onopen=()=>{if(B!==u){Me("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){Me("daemon-client","onopen → send auth frame",{token:dd(n)});const E={type:"auth",token:n};r!=null&&r.principalId&&(E.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(E.selfDisplayName=r.displayName),i&&(E.clientInfo=i),B.send(JSON.stringify(E)),b=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else Me("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,N("connected"),C("daemon:connected",{url:t}),O(),A()},B.onclose=E=>{if(B!==u){Me("daemon-client","onclose → stale, ignore",{code:E.code,reason:E.reason});return}const H=E.reason||(E.code===1008?"auth failed":`close ${E.code}`);if(Me("daemon-client","onclose →",{code:E.code,reason:H,awaitingAuth:x,manualStop:d}),z(),M(`connection closed: ${H}`),u=null,E.code===4401?N("revoked"):N("disconnected"),C("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){L(`connection closed: ${H}`);return}d?L(`connection closed: ${H}`):$()},B.onerror=()=>{},B.onmessage=E=>{if(B!==u)return;let H;try{H=JSON.parse(String(E.data))}catch{return}F(H)}};return{start(){d=!1,f=0,D()},stop(){d=!0,p&&(clearTimeout(p),p=null),z();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,M("shutdown"),L("shutdown"),N("disconnected")},switchProfile(B){Me("daemon-client","switchProfile →",{url:B.url,token:dd(B.authToken)},"prev:",{url:t,token:dd(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),z(),M("switch profile"),L("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,D()},request(B,E){return new Promise((H,q)=>{const j=Mw(),te=setTimeout(()=>{y.delete(j);const K=R.findIndex(xe=>xe.timer===te);K>=0&&R.splice(K,1),q(new Error(`request timeout: ${B}`))},s),ie=()=>{y.set(j,{resolve:K=>H(K),reject:q,timer:te}),u.send(JSON.stringify({...E,type:B,requestId:j}))};(u==null?void 0:u.readyState)===1&&!x?ie():d||u==null&&p==null?(clearTimeout(te),q(new Error("NOT_CONNECTED"))):R.push({doSend:ie,reject:q,timer:te})})},on:T,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function tz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function nz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:tz(e.token),name:e.name}:null}function hd(e){return e?Array.isArray(e)?e.map(nz):{_notArray:typeof e,_value:e}:null}function Aw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const rz="ws://127.0.0.1:18790",jw="daemon:profiles",Lw="daemon:active-profile-id";function iz(){return Math.random().toString(36).slice(2,10)}function sz(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=new URLSearchParams(t.slice(n+1)).get("token")??void 0;return{url:r,token:i}}function oz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function KT(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{Me("profile-store","persist →",hd(t.profiles),"active:",t.activeId),await e.kv.set(jw,t.profiles),await e.kv.set(Lw,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(jw);c=Aw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Lw);u=Aw(d)??null}catch{u=null}if(Me("profile-store","ensureLoaded read kv →","profiles:",hd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(oz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,Me("profile-store","ensureLoaded → use kv profiles",hd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:rz}],activeId:"default"},Me("profile-store","ensureLoaded → fallback synthesized default (NO token)",hd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var b;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=sz(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??iz(),m={id:p,name:((b=l.name)==null?void 0:b.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const Dw="clawd.client-instance-id";let az={name:"clawd-web",version:"unknown"};function lz(){let e=null;try{e=localStorage.getItem(Dw),e||(e=crypto.randomUUID(),localStorage.setItem(Dw,e))}catch{e=e??crypto.randomUUID()}return{...az,instanceId:e}}function Ow(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const GT=g.createContext(null);function cz({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=KT(e),o=await s.load(),a=o.profiles.find(c=>c.id===o.activeId)??o.profiles[0];if(!a)throw new Error("DaemonProvider: profile store has no profiles after load");return Me("daemon-context","bootstrap → createDaemonClient",{id:a.id,url:a.url,token:Ow(a.token)}),{client:ez({url:a.url,authToken:a.token,clientInfo:lz()}),store:s}},[e]);return g.useEffect(()=>{let s=!0,o=null,a=null;return i().then(l=>{s&&(l.client.start(),o=l,r(l),a=l.store.subscribe(()=>{const c=l.store.getActive();if(!c){Me("daemon-context","subscribe → no active profile, skip switchProfile");return}Me("daemon-context","subscribe → switchProfile",{id:c.id,url:c.url,token:Ow(c.token)}),l.client.switchProfile({url:c.url,authToken:c.token})}))}),()=>{s=!1,a==null||a(),o==null||o.client.stop()}},[i]),n?h.jsx(GT.Provider,{value:n,children:t}):null}function vi(){const e=g.useContext(GT);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function uz(){const e=vi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";Me("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function dz(){const e=vi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const XT=g.createContext(null);function hz({cache:e,children:t}){return g.createElement(XT.Provider,{value:e},t)}function zo(){const e=g.useContext(XT);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function hi(e){const t=zo(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const YT={actionsLevel:"none",httpBaseUrl:null,httpToken:null},QT=g.createContext(YT);function ip(){return g.useContext(QT)}function fz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:YT}function pz(){const e=hi("daemon-info");return g.useMemo(()=>fz(e),[e])}function mz({children:e}){const t=pz();return Ze.createElement(QT.Provider,{value:t},e)}function gz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function vz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function xz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function _z(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of zT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function ZT(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const yz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:ZT(e)});function bz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>yz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function wz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const Qc={sessionId:null,events:[],lastSeq:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function Mm(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function JT(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...Qc,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=[...e.events,t.event],o=i>e.lastSeq?i:e.lastSeq,a=Mm(e.pendingPermissions,t.event);return{...e,events:s,lastSeq:o,pendingPermissions:a}}case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>Mm(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;typeof u=="number"&&i.add(u)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=[...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),l=s.reduce((c,u)=>Mm(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...Qc,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const Sz="session/";function kz(e){return{sid:e.slice(Sz.length)}}const Cz=new Set($T);function eI(e){return Cz.has(e)}function Bw(e){return eI(e)?e:"idle"}function Ez(e,t){return{start(n){const{sid:r}=kz(n);let i=!1,s=-1;const o=f=>{t(n,p=>JT(p??Qc,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],b=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:b}),s=b;else{const x=m.bufferStartSeq??0,_=b<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:b}),s=Math.max(s,b)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:Bw(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;Me("session-events","push session:event",{sid:r,kind:m.event.kind,seq:v,lastSeqBefore:s}),o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!eI(m.status)){Me("session-events","push session:status drop",{sid:r,status:m.status});return}Me("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;Me("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;Me("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:Bw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Nz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function Tz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Nz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function Iz(){return{start(){return()=>{}}}}function Pz(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Rz(e){const t=_z(e),n=xz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,bz(t,i)),n.register(/^sessions$/,wz(t,i)),n.register(/^session\//,Ez(t,i)),n.register(/^personas$/,Pz(t,i)),n.register(/^persona-detail\//,Iz()),n.register(/^daemon-info$/,Tz(t,i));const s=vz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class G_{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}appBuilderListProjects(){return this.client.request("appBuilder:listProjects",{})}appBuilderGetProject(t){return this.client.request("appBuilder:getProject",{sessionId:t})}appBuilderUpdateProjectPort(t,n){return this.client.request("appBuilder:updateProjectPort",{name:t,newPort:n})}appBuilderStartDevServer(t,n){return this.client.request("appBuilder:startDevServer",{sessionId:t,...n!=null&&n.force?{force:!0}:{}})}appBuilderStopDevServer(t){return this.client.request("appBuilder:stopDevServer",{sessionId:t})}appBuilderPublish(t){return this.client.request("appBuilder:publish",{name:t})}appBuilderDismissPublishJob(t){return this.client.request("appBuilder:dismissPublishJob",{name:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude"){return this.client.request("capabilities:get",{tool:t})}shiftList(){return this.client.request("shift:list")}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function Mz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Az(e){const t=zo(),n=hi(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function vl(){const e=vi();return g.useMemo(()=>new G_(e),[e])}function tI(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,tool:e.tool,public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt}}function nI(){const e=zo(),t=vl(),n=hi("personas")??[],r=g.useMemo(()=>n.map(s=>tI(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:hi("personas")!==void 0,refresh:i}}function rI(e){const{raw:t}=nI(),n=zo(),r=vl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?tI(i):null,o=g.useCallback(async()=>{if(!e)return;const a=await r.personaList();n.setData("personas",()=>a.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function jz(e){const t=vl(),n=zo(),r=e?`persona-detail/${e}`:"",i=hi(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){Me("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,loaded:i!==void 0,refresh:s}}function iI(){const e=zo(),t=vl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Lz(){const e=vl(),t=iI();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Dz(){const e=vl(),t=iI();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const zw="clawd:sidebar:tree-collapsed";function Oz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function Bz(e){const t=Oz(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function zz(){const e=I_(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(zw);if(l)return;n(Bz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(zw,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const X_=g.createContext(null);function $z(){const e=g.useContext(X_);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
97
97
|
* @license lucide-react v0.577.0 - ISC
|
|
98
98
|
*
|
package/dist/share-ui/guest.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Clawd 分享</title>
|
|
7
|
-
<script type="module" crossorigin src="/share-ui/assets/guest-
|
|
7
|
+
<script type="module" crossorigin src="/share-ui/assets/guest-C030eLoJ.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/share-ui/assets/guest-Dhztg3h0.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="margin: 0">
|