@kubitnodes/stellaris 0.3.23 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/cli/index.js +479 -164
  2. package/dist/server/index.js +598 -191
  3. package/package.json +1 -1
  4. package/web/dist/assets/{BackLink-DGYs80bb.js → BackLink-DKMw_rHu.js} +1 -1
  5. package/web/dist/assets/{Button-f4jgBZY1.js → Button-BYJGqZ3Q.js} +1 -1
  6. package/web/dist/assets/{ChannelForms-q9zdj4p2.js → ChannelForms-CkYupEL2.js} +1 -1
  7. package/web/dist/assets/ChannelView-BIXouQMX.js +2 -0
  8. package/web/dist/assets/CitizenView-C3AMFixP.js +2 -0
  9. package/web/dist/assets/CitizensView-CYFS3f9U.js +1 -0
  10. package/web/dist/assets/{CliIcon-CLHaA65A.js → CliIcon-DVX5iLhG.js} +1 -1
  11. package/web/dist/assets/CronsView-BGCcO7bH.js +1 -0
  12. package/web/dist/assets/{KnowledgeView-Cxfi2-Pt.js → KnowledgeView-DLLYjd1G.js} +1 -1
  13. package/web/dist/assets/Markdown--whKJBYV.js +30 -0
  14. package/web/dist/assets/{MessageItem-Bk9eBp1U.js → MessageItem-BvDOeJci.js} +1 -1
  15. package/web/dist/assets/{MetricsView-CTEH6rJn.js → MetricsView-B-KUNOZm.js} +1 -1
  16. package/web/dist/assets/NeedsYouView-Dee_bOKj.js +1 -0
  17. package/web/dist/assets/{Overview-CS9HCSmm.js → Overview-DFiHDFnA.js} +1 -1
  18. package/web/dist/assets/{Pane-CJYRVkwh.js → Pane-DTmByqgA.js} +1 -1
  19. package/web/dist/assets/{Picker-DoxCN6C7.js → Picker-DsHm4f7s.js} +1 -1
  20. package/web/dist/assets/{ProjectView-CJ3r4UdN.js → ProjectView-DsRXW-qk.js} +1 -1
  21. package/web/dist/assets/ProposalView-B-4P1S-s.js +1 -0
  22. package/web/dist/assets/{ProposalsView-B-cOxTsQ.js → ProposalsView-uEuj-ooV.js} +1 -1
  23. package/web/dist/assets/Quota-D8WDWp5H.js +1 -0
  24. package/web/dist/assets/{RunnersView-DlQruhwp.js → RunnersView-BB3q65rG.js} +1 -1
  25. package/web/dist/assets/SkillFileList-DhdEcFQA.js +2 -0
  26. package/web/dist/assets/SkillView-vAv7zvtJ.js +1 -0
  27. package/web/dist/assets/SocietyView-Dv4phSkz.js +1 -0
  28. package/web/dist/assets/{StickyList-MVP34ytV.js → StickyList-C4fC_KJv.js} +1 -1
  29. package/web/dist/assets/SubjectThread-BEXt-tub.js +1 -0
  30. package/web/dist/assets/{TaskFileView-GZ0eQFUb.js → TaskFileView-B9sex0tS.js} +2 -2
  31. package/web/dist/assets/{TaskView-DppFelLW.js → TaskView-BCT388kb.js} +2 -2
  32. package/web/dist/assets/{TasksView-DDNXzeG4.js → TasksView-CuPay34-.js} +1 -1
  33. package/web/dist/assets/{ThreadForms-C846TvtS.js → ThreadForms-DzoRDeBh.js} +1 -1
  34. package/web/dist/assets/ThreadItem-CDVppcOZ.js +1 -0
  35. package/web/dist/assets/ThreadView-B4F10_j1.js +1 -0
  36. package/web/dist/assets/citizen-BPIJzKdn.js +1 -0
  37. package/web/dist/assets/{compose-BmqQmcZH.js → compose-BUhbVoI-.js} +1 -1
  38. package/web/dist/assets/format-CvfmDNoY.js +55 -0
  39. package/web/dist/assets/{governance-Cr5OlQnw.js → governance-Bba0OHvJ.js} +1 -1
  40. package/web/dist/assets/index-Bj8MlyAn.css +2 -0
  41. package/web/dist/assets/index-DD3J11PT.js +23 -0
  42. package/web/dist/assets/{mentions-D5hNgtg6.js → mentions-D838wlfQ.js} +1 -1
  43. package/web/dist/assets/{tasks-R3YgpYTe.js → tasks-CTaxXtGL.js} +1 -1
  44. package/web/dist/assets/useMatch-B8j0hm1q.js +1 -0
  45. package/web/dist/index.html +9 -9
  46. package/web/dist/assets/ChannelView-CGs_aWL3.js +0 -2
  47. package/web/dist/assets/CitizenView-gcIo_sKt.js +0 -2
  48. package/web/dist/assets/CitizensView-DZ7S8vnJ.js +0 -1
  49. package/web/dist/assets/CronsView-1wns6Uwv.js +0 -1
  50. package/web/dist/assets/Markdown-BhtIFcWc.js +0 -30
  51. package/web/dist/assets/NeedsYouView-2VNqH2Sb.js +0 -1
  52. package/web/dist/assets/ProposalView-DLn9dNPp.js +0 -2
  53. package/web/dist/assets/Quota-Bo7UdWTV.js +0 -1
  54. package/web/dist/assets/SocietyView-Bl4ErnV8.js +0 -1
  55. package/web/dist/assets/SubjectThread-BFFnHxIF.js +0 -1
  56. package/web/dist/assets/ThreadItem-C8cou6wD.js +0 -1
  57. package/web/dist/assets/ThreadView-DvSGDYoD.js +0 -1
  58. package/web/dist/assets/citizen-B2Dlbcpe.js +0 -1
  59. package/web/dist/assets/format-DT52SbbR.js +0 -55
  60. package/web/dist/assets/index-BTVy_xFF.js +0 -23
  61. package/web/dist/assets/index-DzV6CCnG.css +0 -2
  62. package/web/dist/assets/useMatch-pEF6RJ6Q.js +0 -1
@@ -0,0 +1,55 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var ee={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,te={};function ne(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}ne.prototype.isReactComponent={},ne.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},ne.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function _(){}_.prototype=ne.prototype;function re(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}var ie=re.prototype=new _;ie.constructor=re,g(ie,ne.prototype),ie.isPureReactComponent=!0;var ae=Array.isArray;function oe(){}var v={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function y(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ce(e,t){return y(e.type,t,e.props)}function b(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function le(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ue=/\/+/g;function de(e,t){return typeof e==`object`&&e&&e.key!=null?le(``+e.key):t.toString(36)}function fe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(oe,oe):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function x(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,x(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+de(e,0):a,ae(o)?(i=``,c!=null&&(i=c.replace(ue,`$&/`)+`/`),x(o,r,i,``,function(e){return e})):o!=null&&(b(o)&&(o=ce(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ue,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ae(e))for(var u=0;u<e.length;u++)a=e[u],s=l+de(a,u),c+=x(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+de(a,u++),c+=x(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return x(fe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function pe(e,t,n){if(e==null)return e;var r=[],i=0;return x(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function me(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var S=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function he(e){var t=v.T,n={};n.types=t===null?null:t.types,v.T=n;try{var r=e(),i=v.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(oe,S)}catch(e){S(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),v.T=t}}function ge(e){var t=v.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else he(ge.bind(null,e))}var C={map:pe,forEach:function(e,t,n){pe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return pe(e,function(){t++}),t},toArray:function(e){return pe(e,function(e){return e})||[]},only:function(e){if(!b(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=C,e.Component=ne,e.Fragment=r,e.Profiler=a,e.PureComponent=re,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=v,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return v.H.useMemoCache(e)}},e.addTransitionType=ge,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!se.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return y(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)se.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return y(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=b,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:me}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=he,e.unstable_useCacheRefresh=function(){return v.H.useCacheRefresh()},e.use=function(e){return v.H.use(e)},e.useActionState=function(e,t,n){return v.H.useActionState(e,t,n)},e.useCallback=function(e,t){return v.H.useCallback(e,t)},e.useContext=function(e){return v.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return v.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return v.H.useEffect(e,t)},e.useEffectEvent=function(e){return v.H.useEffectEvent(e)},e.useId=function(){return v.H.useId()},e.useImperativeHandle=function(e,t,n){return v.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return v.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return v.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return v.H.useMemo(e,t)},e.useOptimistic=function(e,t){return v.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return v.H.useReducer(e,t,n)},e.useRef=function(e){return v.H.useRef(e)},e.useState=function(e){return v.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return v.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return v.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),p=o(((e,t)=>{t.exports=f()})),m=l(d(),1),h=p(),ee=m.createContext(void 0),g=e=>{let t=m.useContext(ee);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},te=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,h.jsx)(ee.Provider,{value:e,children:t})),ne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=ne;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function re(e){setTimeout(e,0)}var ie=typeof window>`u`||`Deno`in globalThis;function ae(){}function oe(e,t){return typeof e==`function`?e(t):e}function v(e){return typeof e==`number`&&e>=0&&e!==1/0}function se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function y(e,t){return typeof e==`function`?e(t):e}function ce(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==le(o,t.options))return!1}else if(!de(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function b(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ue(t.options.mutationKey)!==ue(a))return!1}else if(!de(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function le(e,t){return(t?.queryKeyHashFn||ue)(e)}function ue(e){return JSON.stringify(e,(e,t)=>S(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function de(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!de(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!de(e[r],t[r]))return!1;return!0}return!1}var fe=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=me(e)&&me(t);if(!r&&!(S(e)&&S(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:fe.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function pe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function me(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function S(e){if(!he(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!he(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function he(e){return Object.prototype.toString.call(e)===`[object Object]`}function ge(e){return new Promise(t=>{_.setTimeout(t,e)})}function C(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function _e(e){return e}function ve(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ye(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var be=Symbol();function xe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===be?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Se(e,t){return typeof e==`function`?e(...t):!!e}function Ce(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var we=()=>ie,Te=()=>we(),Ee=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},De=new class extends Ee{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Oe=re;function ke(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Oe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Ae=ke(),je=new class extends Ee{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Me(e){return Math.min(1e3*2**e,3e4)}function Ne(e){return(e??`online`)!==`online`||je.isOnline()}var Pe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Fe(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ae);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Pe(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>De.isFocused()&&(e.networkMode===`always`||je.isOnline())&&e.canRun(),p=()=>Ne(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},ee=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),g=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Te()?0:3),a=e.retryDelay??Me,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),ge(o).then(()=>f()?void 0:ee()).then(()=>{t?h(r):g()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?g():ee().then(g),s)}}var Ie=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),v(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Te()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function Le(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ce(e,()=>t.signal,()=>n=!0)},u=xe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ye:ve;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ze:Re,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Re(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Re(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ze(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Be=class extends Ie{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ue(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ue(this.options);e.data!==void 0&&(this.setState(He(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=C(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===be||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>y(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!se(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=xe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Le(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Fe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Pe&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Pe){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ve(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...He(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Ae.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ve(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ne(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function He(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ue(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var We=class extends Ee{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ke(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qe(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qe(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof y(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!pe(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Je(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return pe(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#h(e){return!Te()&&y(this.options.enabled,this.#t)!==!1&&v(e)}#g(){this.#b();let e=y(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=se(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return y(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||De.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ke(e,t),o=i&&Je(e,n,t,r);(a||o)&&(l={...l,...Ve(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=C(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=C(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:Ye(e,t),refetch:this.refetch,isEnabled:y(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),pe(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Ae.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ge(e,t){return y(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||y(t.retryOnMount,e)!==!1)}function Ke(e,t){return Ge(e,t)||e.state.data!==void 0&&qe(e,t,t.refetchOnMount)}function qe(e,t,n){if(y(t.enabled,e)!==!1&&y(t.staleTime,e)!==`static`){let r=y(n,e);return r===`always`||r!==!1&&Ye(e,t)}return!1}function Je(e,t,n,r){return(e!==t||y(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ye(e,n)}function Ye(e,t){return y(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function Xe(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Ze=class extends Ee{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Ae.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!pe(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Xe(e,n).forEach(e=>{e.destroy()}),Xe(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=x(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new We(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Ae.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Qe=m.createContext(!1),$e=()=>m.useContext(Qe);Qe.Provider;function et(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var tt=m.createContext(et()),nt=()=>m.useContext(tt),rt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Se(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},it=e=>{m.useEffect(()=>{e.clearReset()},[e])},at=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Se(n,[e.error,r])),ot=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},st=(e,t)=>e?.suspense&&t.isPending,ct=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function lt({queries:e,...t},n){let r=g(n),i=$e(),a=nt(),o=t.subscribed!==!1,s=m.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{ot(e);let t=r.getQueryCache().get(e.queryHash);rt(e,a,t)}),it(a);let[c]=m.useState(()=>new Ze(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;m.useSyncExternalStore(m.useCallback(e=>f?c.subscribe(Ae.batchCalls(e)):ae,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>st(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&st(n,e)?ct(n,new We(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let h=l.find((e,t)=>{let n=s[t];return n&&at({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function ut(e,t,n){let r=$e(),i=nt(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ot(o),rt(o,i,s),it(i);let[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(m.useSyncExternalStore(m.useCallback(e=>{let t=d?l.subscribe(Ae.batchCalls(e)):ae;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),st(o,u))throw ct(o,l,i);if(at({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function w(e,t){return ut(e,We,t)}function dt(e){return e[e.length-1]}function ft(e,t){return typeof e==`function`?e(t):e}var pt=Object.prototype.hasOwnProperty;function mt(e){for(let t in e)if(pt.call(e,t))return!0;return!1}var ht=()=>Object.create(null),gt=(e,t)=>_t(e,t,!0);function _t(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(vt(e)&&vt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&dt(a)!==`${o-1}`||c&&dt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?_t(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?_t(d,o,n,r):o,i&&=u===d&&(a[l]===f||pt.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?ht():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?_t(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function vt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function yt(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!yt(a,o,n,r))return!1}return!0}if(vt(e)&&vt(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!yt(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!yt(e[a],t[a],n,r)))return!1;return i===0}return!1}function bt(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var xt=/[\x00-\x1f\x7f"<>`{}]/g;function St(e){return e.replace(xt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Ct(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return St(t)}var wt=[`http:`,`https:`,`mailto:`,`tel:`];function Tt(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var Et=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Dt(e,t){if(!e)return!1;if(Et.test(e))return!0;let n=Tt(e);return n?!t.has(n):!1}function Ot(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=Ct(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=Ct(r?e.slice(r):e)}return t}function kt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function At(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function jt(e){return e.replace(/\/{2,}/g,`/`)}function Mt(e){return e===`/`?e:e.replace(/^\/+/,``)}function Nt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Pt(e){return Nt(Mt(e))}function Ft(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function It(e,t,n=`never`,r){if(t.includes(`//`)&&(t=jt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=jt(e)),o=e.split(`/`);o.length>1&&dt(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(dt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?jt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Lt(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function Rt(e){return e==null||e===``}function zt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Bt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&Rt(f)){if(c===`/`&&!d)continue;f=``}o+=c+zt(s,f,r)+(d||``)}}return o+a||`/`}var Vt=`Error preloading route! ☝️`,Ht=()=>!0,Ut=()=>!1;function Wt({children:e,fallback:t=null}){return(0,h.jsx)(m.Fragment,{children:Gt()?e:t})}function Gt(e=!0){return m.useSyncExternalStore(Kt,Ht,e?Ut:Ht)}function Kt(){return()=>{}}var qt=m.createContext(null);function Jt(e){return m.useContext(qt)}var Yt=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Xt=o(((e,t)=>{t.exports=Yt()})),Zt=o((e=>{var t=d(),n=Xt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Qt=o(((e,t)=>{t.exports=Zt()}))();function $t(e,t){return e===t}function en(e,t=e=>e,n){let r=n?.compare??$t,i=(0,m.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,m.useCallback)(()=>e.get(),[e]);return(0,Qt.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function tn(...e){let t=m.useRef(e),n=t.current;return e.forEach((e,t)=>{yt(n[t],e,!1,!0)||(n[t]=e)}),t.current}function nn(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(Vt)})}var rn={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function an(e,t){let n=typeof e==`string`&&Tt(e);if(n)return t.has(n)?e:null}function on(e,t,n,r,i){let a=Ft(e.pathname,r),o=Ft(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!yt(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function sn(e,t,n){let r=Jt(),i=m.useRef(null),a=m.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:h,ignoreBlocker:ee,disabled:g,target:te,onClick:ne,onBlur:_,onFocus:re,onMouseEnter:ie,onMouseLeave:ae,onTouchStart:oe}=e,v=Gt(!!o?.includeHash),[se,y,ce]=tn(e.search,e.params,o),[b,le]=m.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,se,y,e.state,e.mask,e.unsafeRelative]),ue=m.useCallback(e=>{let t=an(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];b._fromLocation||(le._fromLocation=e);let n=r.buildLocation(le),i=gn(n,r,g);return[i,!g&&(!i||Tt(i))?void 0:on(e,n,ce,r.basepath,v)]},[ce,g,v,b,le,r,s]),[de,fe]=en(r.stores.location,ue,rn),x=fe===void 0?de:void 0,pe=g||de===void 0,me=m.useRef(!1),S=e.reloadDocument||x||pe?!1:c??r.options.defaultPreload,he=l??r.options.defaultPreloadDelay??0,ge=m.useCallback(e=>{let t=e?.isIntersecting;if(!(t??S===`intent`)){t===!1&&mn(i);return}if(!he){nn(r,b);return}pn.has(i)||pn.set(i,setTimeout(()=>{pn.delete(i),nn(r,b)},he))},[r,b,i,S,he]);m.useEffect(()=>{if(!S)return;S===`render`&&!me.current&&(me.current=!0,nn(r,b));let e=!0,t;return S===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&ge(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),mn(i)}},[r,b,S,ge,i]);let C=dn(e,n);if(C.ref=t?a:i,x)return C.href=x,C;let _e=e=>{let t=te??e.currentTarget.getAttribute(`target`);!pe&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...b,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:h,ignoreBlocker:ee}))},ve=()=>{S===`intent`&&nn(r,b)},ye=()=>{S===`intent`&&mn(i)};return C.onClick=hn(ne,_e),C.onBlur=hn(_,ye),C.onFocus=hn(re,ge),C.onMouseEnter=hn(ie,ge),C.onMouseLeave=hn(ae,ye),C.onTouchStart=hn(oe,ve),fn(C,e,fe,de,pe,n)}var cn={},ln={className:`active`},un=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function dn(e,t){let n={};for(let r in e)un.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function fn(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=ft(n?o:s,{})??(n?ln:cn);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var pn=new WeakMap,mn=e=>{clearTimeout(pn.get(e)),pn.delete(e)},hn=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function gn(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!Dt(i,t.protocolAllowlist))return i}var _n=m.memo(m.forwardRef((e,t)=>{let n=e._asChild||`a`,r=sn(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return m.createElement(n,r,i)}),vn);function vn(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!un.has(r)||!yt(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}function yn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function bn(e,t=`|`){return e.map(e=>Wn(e)).join(t)}function xn(e,t){return typeof t==`bigint`?t.toString():t}var Sn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Cn(e){return new Sn(e)}function wn(e){return e==null}function Tn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function En(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function On(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function kn(e){return On(e._zod.def)??e._zod.def.shape}function An(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Dn(this,t,e),e},enumerable:!0,configurable:!0})}function jn(e,t,n){t in e?Dn(e,t,n):e[t]=n}function Mn(e,t,n,r){let i=kn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?An(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):jn(e,a,r?r(n.value,a):n.value))}}function Nn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?An(e,n,()=>t[n]):jn(e,n,r.value))}}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Pn(e){return JSON.stringify(e)}function Fn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var In=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ln(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Rn=Cn(()=>{if(Nr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function zn(e){if(Ln(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ln(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Bn(e){return zn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Vn=new Set([`string`,`number`,`symbol`]);function Hn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Un(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function E(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Wn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Gn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Kn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},qn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Jn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Mn(i,e,Yn(e,t)),Un(e,T(n,{shape:i,checks:[]}))}function Yn(e,t){let n=kn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Xn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Yn(e,t)),a={};return Mn(a,e,Reflect.ownKeys(kn(e)).filter(e=>!i.has(e))),Un(e,T(n,{shape:a,checks:[]}))}function Zn(e,t){if(!zn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=kn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Un(e,T(e._zod.def,{shape:Qn(e,t)}))}function Qn(e,t){let n={};return Mn(n,e,Reflect.ownKeys(kn(e))),Nn(n,t),n}function $n(e,t){if(!zn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Un(e,T(e._zod.def,{shape:Qn(e,t)}))}function er(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Mn(n,e,Reflect.ownKeys(kn(e))),Mn(n,t,Reflect.ownKeys(kn(t))),Un(e,T(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function tr(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Yn(t,n)):void 0,o={};return Mn(o,t,Reflect.ownKeys(kn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Un(t,T(t._zod.def,{shape:o,checks:[]}))}function nr(e,t,n){let r=n?new Set(Yn(t,n)):void 0,i={};return Mn(i,t,Reflect.ownKeys(kn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Un(t,T(t._zod.def,{shape:i}))}function rr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ir(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ar(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function or(e){return typeof e==`string`?e:e?.message}function sr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function cr(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:or(e.inst?._zod.def?.error?.(e))??or(a?.(e))??or(t?.error?.(e))??or(n.customError?.(e))??or(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var lr=/[\uD800-\uDBFF]/;function ur(e){let t=e.length;if(!lr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function dr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function fr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function pr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function mr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):vr(e,n,r.value)}}function hr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function gr(e,t,n){return hr(e,t,n,!1)}function _r(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return hr(this,n,r(this))},set(e){hr(this,n,e)}})}return t}function vr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:hr(this,t,n.bind(this))},set(e){hr(this,t,e)}})}function yr(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var br,xr=!1,Sr={configurable:!0,get(){xr=!0}};function D(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&br!==e._zod){br=void 0;return}br=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Sr);let e=xr;xr=!1;try{let r=n(this);return xr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),xr||=e,r}catch(n){throw delete this[t],xr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Cr(e,t,n,r){let i=yr(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var wr=`~constantCatch`;function Tr(e){let t=()=>e;return t[wr]=!0,t}var Er,Dr=Object.freeze({status:`aborted`}),Or={value:void 0,enumerable:!1},kr=`captureStackTrace`in Error?Error:null;function Ar(e){let t=kr;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return kr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function O(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Or.value=new a(r);try{Object.defineProperty(n,"_zod",Or)}finally{Or.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),mr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ar(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var jr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Mr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Er=globalThis).__zod_globalConfig??(Er.__zod_globalConfig={});var Nr=globalThis.__zod_globalConfig;function Pr(e){return e&&Object.assign(Nr,e),Nr}function Fr(){let e=this._zod;return e.message??=JSON.stringify(e.def,xn,2),e.message}function Ir(e){this._zod.message=e}var Lr={get:Fr,set:Ir,enumerable:!0,configurable:!0},Rr={value:void 0,enumerable:!1},zr=new WeakSet([Object.prototype,Error.prototype]),Br=(e,t)=>{e.name=`$ZodError`,Rr.value=t,Object.defineProperty(e,"issues",Rr),Rr.value=void 0,Object.defineProperty(e,"message",Lr);let n=Object.getPrototypeOf(e);zr.has(n)||(zr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Vr=O(`$ZodError`,Br);O(`$ZodError`,Br,void 0,{Parent:Error});function Hr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Ur(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Hr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Wr(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Gr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Kr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new jr;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>cr(e,o,Pr())));throw In(n,a?.callee??t),n}return s.value};return t},qr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>cr(e,o,Pr())));throw In(n,a?.callee??t),n}return s.value};return t},Jr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new jr;return a.issues.length?Yr(e,a.issues,i):{success:!0,data:a.value}};function Yr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>cr(e,n,Pr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Xr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Yr(e,a.issues,i):{success:!0,data:a.value}},Zr=Symbol.for(`zod.compile.invalid`),Qr=Symbol.for(`zod.compile.fallback`),$r=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Zr)return!0;if(r.definite===!0&&n===void 0)return!1}return ei(e,t,n)});function ei(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Qr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new jr;return a.issues.length===0}var ti=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ni=e=>{let t=Kr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Gr(n,a))};return n},ri=e=>{let t=Kr(e),n=(e,r,i,a)=>t(e,r,i,Gr(n,a));return n},ii=e=>{let t=qr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Gr(n,a))};return n},ai=e=>{let t=qr(e),n=async(e,r,i,a)=>await t(e,r,i,Gr(n,a));return n},oi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Jr(e)(t,n,i)},si=e=>(t,n,r)=>Jr(e)(t,n,r),ci=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Xr(e)(t,n,i)},li=e=>async(t,n,r)=>Xr(e)(t,n,r),ui=/^[cC][0-9a-z]{6,}$/,di=/^[0-9a-z]+$/,fi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pi=/^[0-9a-vA-V]{20}$/,mi=/^[A-Za-z0-9]{27}$/,hi=/^[a-zA-Z0-9_-]{21}$/;function gi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _i=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xi=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Si(){return new RegExp(xi,`u`)}var Ci=/^(?:(?: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])$/,wi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ti=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ei=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Di=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Oi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ki=/^https?$/,Ai=/^\+[1-9]\d{6,14}$/,ji=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Mi(e){return RegExp(`^${e}$`)}var Ni=Mi(ji);function Pi(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fi(e){return RegExp(`^${Pi(e)}$`)}function Ii(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Pi({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Pi({precision:e.precision})}`:n;return RegExp(`^${ji}T(?:${r})$`)}var Li=/^[\s\S]{0,}$/,Ri=/^-?\d+$/,zi=/^-?\d+(?:\.\d+)?$/,Bi=/^(?:true|false)$/i,Vi=/^[^A-Z]*$/,Hi=/^[^a-z]*$/,k=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ui=e=>{let t=e.value;return!wn(t)&&t.length!==void 0},Wi={number:`number`,bigint:`bigint`,object:`date`},Gi=O(`$ZodCheckLessThan`,(e,t)=>{k.init(e,t);let n=Wi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Wi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ki=O(`$ZodCheckGreaterThan`,(e,t)=>{k.init(e,t);let n=Wi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Wi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qi=O(`$ZodCheckMultipleOf`,(e,t)=>{k.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):En(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ji=O(`$ZodCheckNumberFormat`,(e,t)=>{k.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Kn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Yi=O(`$ZodCheckMaxLength`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ur(r):i)<=t.maximum)return;let a=dr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xi=O(`$ZodCheckMinLength`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ur(r):i)>=t.minimum)return;let a=dr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zi=O(`$ZodCheckLengthEquals`,(e,t)=>{var n;k.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ur(r):i;if(a===t.length)return;let o=dr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qi=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;k.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$i=O(`$ZodCheckRegex`,(e,t)=>{Qi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ea=O(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Vi,Qi.init(e,t)}),ta=O(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Hi,Qi.init(e,t)}),na=O(`$ZodCheckIncludes`,(e,t)=>{k.init(e,t);let n=Hn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ra=O(`$ZodCheckStartsWith`,(e,t)=>{k.init(e,t);let n=RegExp(`^${Hn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ia=O(`$ZodCheckEndsWith`,(e,t)=>{k.init(e,t);let n=RegExp(`.*${Hn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),aa=O(`$ZodCheckOverwrite`,(e,t)=>{k.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),oa=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},sa={major:4,minor:6,patch:5},A=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sa;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=rr(t),a;for(let o of n){if(o._zod.def.when){if(ir(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new jr;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(sr(t.issues,n,e),i||=rr(t,n))});else{if(t.issues.length===n)continue;sr(t.issues,n,e),i||=rr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(rr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new jr;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new jr;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return gr(this,`~standard`,ua(this))},set"~standard"(e){hr(this,`~standard`,e)}}),ca=(e,t)=>e.issues.length?{issues:e.issues.map(e=>cr(e,t,Pr()))}:{value:e.value};async function la(e,t){let n={async:!0};return ca(await e._zod.run({value:t,issues:[]},n),n)}function ua(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ca(r,n)}catch{}return la(e,t)},vendor:`zod`,version:1}}var da=O(`$ZodString`,(e,t)=>{A.init(e,t),e._zod.pattern=t.pattern??Li,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),j=O(`$ZodStringFormat`,(e,t)=>{Qi.init(e,t),da.init(e,t)}),fa=O(`$ZodGUID`,(e,t)=>{t.pattern??=vi,j.init(e,t)}),pa=O(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=yi(e)}else t.pattern??=yi();j.init(e,t)}),ma=O(`$ZodEmail`,(e,t)=>{t.pattern??=bi,j.init(e,t)});function ha(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ga(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?ha(e)||2:_a(e,t)}function _a(e,t){if(!t.normalize&&t.protocol?.source===ki.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var va=/[\t\n\r]/g;function ya(e){return e.replace(va,``)}function ba(e,t){return t.lastIndex=0,t.test(e.hostname)}function xa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Sa=O(`$ZodURL`,(e,t)=>{j.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=ga(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ya(r);return}t.hostname&&!ba(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!xa(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ya(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ca=O(`$ZodEmoji`,(e,t)=>{t.pattern??=Si(),j.init(e,t)}),wa=O(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?hi:gi(t.length),j.init(e,t)}),Ta=O(`$ZodCUID`,(e,t)=>{t.pattern??=ui,j.init(e,t)}),Ea=O(`$ZodCUID2`,(e,t)=>{t.pattern??=di,j.init(e,t)}),Da=O(`$ZodULID`,(e,t)=>{t.pattern??=fi,j.init(e,t)}),Oa=O(`$ZodXID`,(e,t)=>{t.pattern??=pi,j.init(e,t)}),ka=O(`$ZodKSUID`,(e,t)=>{t.pattern??=mi,j.init(e,t)}),Aa=O(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ii(t),j.init(e,t)}),ja=O(`$ZodISODate`,(e,t)=>{t.pattern??=Ni,j.init(e,t)}),Ma=O(`$ZodISOTime`,(e,t)=>{t.pattern??=Fi(t),j.init(e,t)}),Na=O(`$ZodISODuration`,(e,t)=>{t.pattern??=_i,j.init(e,t)}),Pa=O(`$ZodIPv4`,(e,t)=>{t.pattern??=Ci,j.init(e,t)}),Fa=/^[0-9a-fA-F:.]+$/;function Ia(e){return Fa.test(e)?ha(`http://[${e}]`):!1}var La=O(`$ZodIPv6`,(e,t)=>{t.pattern??=wi,j.init(e,t),e._zod.check=n=>{Ia(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ra=O(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ti,j.init(e,t)});function za(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ia(n)}var Ba=O(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ei,j.init(e,t),e._zod.check=n=>{za(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Va(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ha=/^[0-9a-zA-Z+/]*={0,2}$/,Ua=O(`$ZodBase64`,(e,t)=>{t.pattern??=Ha,j.init(e,t),e._zod.check=n=>{Va(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Wa=/^[A-Za-z0-9_-]*$/;function Ga(e){if(!Wa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Va(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ka=O(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wa,j.init(e,t),e._zod.check=n=>{Ga(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),qa=O(`$ZodE164`,(e,t)=>{t.pattern??=Ai,j.init(e,t)});function Ja(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ya=O(`$ZodJWT`,(e,t)=>{j.init(e,t),e._zod.check=n=>{Ja(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Xa=O(`$ZodNumber`,(e,t)=>{A.init(e,t),e._zod.pattern=zi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Za=O(`$ZodNumberFormat`,(e,t)=>{Ji.init(e,t),Xa.init(e,t)}),Qa=O(`$ZodBoolean`,(e,t)=>{A.init(e,t),e._zod.pattern=Bi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),$a=O(`$ZodUnknown`,(e,t)=>{A.init(e,t),e._zod.parse=e=>e}),eo=O(`$ZodNever`,(e,t)=>{A.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function to(e,t,n){e.issues.length&&t.issues.push(...ar(n,e.issues)),t.value[n]=e.value}var no=O(`$ZodArray`,(e,t)=>{A.init(e,t);let n=Nr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>to(t,r,e)));else if(to(c,r,e),s&&c.issues.length!==0&&rr(c))break}return o.length?Promise.all(o).then(()=>r):r}});function ro(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ar(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var io=[];function ao(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:io,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Gn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function oo(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(rr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ro(e,n,i,t,d,f))):ro(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var so=O(`$ZodObject`,(e,t)=>{A.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Cn(()=>ao(t));D(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Dn(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ln,o=t.catchall,s,c=Nr.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(rr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>ro(n,t,e,r,a,o))):ro(s,t,e,r,a,o)}return o?oo(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),co=O(`$ZodObjectJIT`,(e,t)=>{so.init(e,t);let n=e._zod.parse,r=Cn(()=>ao(t)),i=Nr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new oa([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Pn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${i};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${i}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${i};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ln,c=!Nr.jitless,l=c&&Rn.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?oo([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function lo(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!rr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>cr(e,r,Pr())))}),t)}var uo=O(`$ZodUnion`,(e,t)=>{A.init(e,t),D(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),D(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),D(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),D(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Tn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>lo(t,r,e,i)):lo(o,r,e,i)}});function fo(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var po=O(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,uo.init(e,t);let n=e._zod.parse;D(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Dn(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=On(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Cn(()=>fo(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Ln(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),mo=O(`$ZodIntersection`,(e,t)=>{A.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>go(e,t,n)):go(e,i,a)}});function ho(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(zn(e)&&zn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ho(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ho(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function go(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ho(t.value,n.value);if(!c.valid){if(rr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var _o=O(`$ZodRecord`,(e,t)=>{A.init(e,t);let n=Nr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!zn(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>cr(e,i,Pr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ar(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ar(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&zi.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>cr(e,i,Pr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ar(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ar(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),vo=O(`$ZodEnum`,(e,t)=>{A.init(e,t);let n=yn(t.entries),r=new Set(n);e._zod.values=r,D(e,`pattern`,e=>{let t=yn(e.def.entries).filter(e=>Vn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Hn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),yo=O(`$ZodLiteral`,(e,t)=>{A.init(e,t);let n=new Set(t.values);e._zod.values=n,D(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Hn(e):e?Hn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),bo=O(`$ZodTransform`,(e,t)=>{A.init(e,t),e._zod.optin=`optional`,Nr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new jr;return n.value=i,n}});function xo(e,t){return e.value=t.issues.length?void 0:t.value,e}var So=O(`$ZodOptional`,(e,t)=>{A.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,D(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),D(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Tn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>xo(e,t)):xo(e,r)}return t.innerType._zod.run(e,n)}}),Co=O(`$ZodExactOptional`,(e,t)=>{So.init(e,t),D(e,`values`,e=>e.def.innerType._zod.values),D(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wo=O(`$ZodNullable`,(e,t)=>{A.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin),D(e,`optout`,e=>e.def.innerType._zod.optout),D(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Tn(t.source)}|null)$`):void 0}),D(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),To=O(`$ZodDefault`,(e,t)=>{A.init(e,t),e._zod.optin=`defaulted`,D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Eo(e,t)):Eo(r,t)}});function Eo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Do=O(`$ZodPrefault`,(e,t)=>{A.init(e,t),e._zod.optin=`defaulted`,D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Oo=O(`$ZodNonOptional`,(e,t)=>{A.init(e,t),D(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ko(t,e)):ko(i,e)}});function ko(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ao(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>cr(e,r,Pr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var jo=O(`$ZodCatch`,(e,t)=>{A.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),D(e,`optout`,e=>e.def.innerType._zod.optout),D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Ao(e,r,t,n)):Ao(e,r,t,n)}}),Mo=O(`$ZodPipe`,(e,t)=>{A.init(e,t),D(e,`values`,e=>e.def.in._zod.values),D(e,`optin`,e=>e.def.in._zod.optin),D(e,`optout`,e=>e.def.out._zod.optout),D(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>No(e,t.in,n)):No(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>No(e,t.out,n)):No(r,t.out,n)}});function No(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Po=O(`$ZodPreprocess`,(e,t)=>{Mo.init(e,t)}),Fo=O(`$ZodReadonly`,(e,t)=>{A.init(e,t),D(e,`propValues`,e=>e.def.innerType._zod.propValues),D(e,`values`,e=>e.def.innerType._zod.values),D(e,`optin`,e=>e.def.innerType?._zod?.optin),D(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Io):Io(r)}});function Io(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Lo=O(`$ZodCustom`,(e,t)=>{k.init(e,t),A.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ro(t,n,r,e));Ro(i,n,r,e)}});function Ro(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(pr(e))}}var zo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Bo=`~memo`,Vo=[];function Ho(e){return typeof e==`object`&&!!e}function Uo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Wo=new WeakMap,Go=0,Ko=1,qo=2;function Jo(e,t,n){let r=Wo.get(e);if(r!==void 0)return r?qo:Go;if(t.has(e))return qo;t.add(e);let i=Go,a=e=>{if(i!==qo&&e?._zod){let r=Jo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Go;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ko:o.value?._zod?Jo(o.value,t,n):Go;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=On(c);s(e?o(e,!0):Ko),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Jo(r,t,!1):Ko);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Yo(e,i)}function Yo(e,t){return t!==Ko&&Wo.set(e,t===qo),t}function Xo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Zo,Qo=[],$o={alloc(e,t,n){let r=Zo;if(!r)return n;Zo=void 0;let i={value:n,issues:null};return r.set(t.value,i),Qo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ts(n,e.value))throw new zo;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Jo(e,new Set,!1);if(i===Go)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===qo||r?n=!0:r=!0}let l=s.value;if(!Ho(l))return t(s,c);let u=c[Bo];u||(u={buckets:new WeakMap,backEdges:void 0},c[Bo]=u);let d;i===c?d=a:(d=Xo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Uo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Zo=d;let p=Qo.length,m=t(s,c);Zo=void 0;let h=Qo.length>p?Qo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Uo(e.issues):Vo),e)):(h&&(h.issues=m.issues.length?Uo(m.issues):Vo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function es(){return $o}function ts(e,t){let n=e[Bo]?.backEdges;return n!==void 0&&Ho(t)&&n.has(t)}var ns=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(fr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Wn(e.values[0])}`:`Invalid option: expected one of ${bn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${bn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function rs(){return{localeError:ns()}}var is,as=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function os(){return new as}(is=globalThis).__zod_globalRegistry??(is.__zod_globalRegistry=os());var ss=globalThis.__zod_globalRegistry;function cs(e){return e.checks&&=[...e.checks],e}function ls(e,t){return new e(cs({type:`string`,...E(t)}))}function us(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...E(t)})}function ds(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...E(t)})}function fs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...E(t)})}function ps(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...E(t)})}function ms(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...E(t)})}function hs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...E(t)})}function gs(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...E(t)})}function _s(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...E(t)})}function vs(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...E(t)})}function ys(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...E(t)})}function bs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...E(t)})}function xs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...E(t)})}function Ss(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...E(t)})}function Cs(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...E(t)})}function ws(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...E(t)})}function Ts(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...E(t)})}function Es(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...E(t)})}function Ds(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...E(t)})}function Os(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...E(t)})}function ks(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...E(t)})}function As(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...E(t)})}function js(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...E(t)})}function Ms(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...E(t)})}function Ns(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...E(t)})}function Ps(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...E(t)})}function Fs(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...E(t)})}function Is(e,t){return new e(cs({type:`number`,checks:[],...E(t)}))}function Ls(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...E(t)})}function Rs(e,t){return new e({type:`boolean`,...E(t)})}function zs(e){return new e({type:`unknown`})}function Bs(e,t){return new e({type:`never`,...E(t)})}function Vs(e,t){return new Gi({check:`less_than`,...E(t),value:e,inclusive:!1})}function Hs(e,t){return new Gi({check:`less_than`,...E(t),value:e,inclusive:!0})}function Us(e,t){return new Ki({check:`greater_than`,...E(t),value:e,inclusive:!1})}function Ws(e,t){return new Ki({check:`greater_than`,...E(t),value:e,inclusive:!0})}function Gs(e,t){return new qi({check:`multiple_of`,...E(t),value:e})}function Ks(e,t){return new Yi({check:`max_length`,...E(t),maximum:e})}function qs(e,t){return new Xi({check:`min_length`,...E(t),minimum:e})}function Js(e,t){return new Zi({check:`length_equals`,...E(t),length:e})}function Ys(e,t){return new $i({check:`string_format`,format:`regex`,...E(t),pattern:e})}function Xs(e){return new ea({check:`string_format`,format:`lowercase`,...E(e)})}function Zs(e){return new ta({check:`string_format`,format:`uppercase`,...E(e)})}function Qs(e,t){return new na({check:`string_format`,format:`includes`,...E(t),includes:e})}function $s(e,t){return new ra({check:`string_format`,format:`starts_with`,...E(t),prefix:e})}function ec(e,t){return new ia({check:`string_format`,format:`ends_with`,...E(t),suffix:e})}function tc(e){return new aa({check:`overwrite`,tx:e})}function nc(e){return tc(t=>t.normalize(e))}function rc(){return tc(e=>e.trim())}function ic(){return tc(e=>e.toLowerCase())}function ac(){return tc(e=>e.toUpperCase())}function oc(){return tc(e=>Fn(e))}function sc(e,t,n){return new e({type:`array`,element:t,...E(n)})}function cc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...E(n)})}function lc(e,t){let n=uc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(pr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(pr(r))}},e(t.value,t)),t);return n}function uc(e,t){let n=new k({check:`custom`,...E(t)});return n._zod.check=e,n}function dc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Dn(e,t,n[t]);return e}function fc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ss,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function pc(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function M(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,M(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&dc(o.schema,c),t.io===`input`&&N(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function mc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function hc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${mc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+mc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function gc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;gc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var _c=new Set([`type`,`properties`,`required`,`additionalProperties`]),vc=[`oneOf`,`anyOf`];function yc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function bc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!_c.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??yc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Dn(n,r,e.length===1?e[0]:bc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=yc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function xc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of _c)if(t in e)return;let n=t.filter(e=>vc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=bc(t);else{let e=n[0],i=vc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>bc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,dc(e,r))}function Sc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):dc(i,s),dc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())gc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])xc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}dc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Dn(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:wc(t,`input`,e.processors),output:wc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function N(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return N(r.element,n);if(r.type===`set`)return N(r.valueType,n);if(r.type===`lazy`)return N(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return N(r.innerType,n);if(r.type===`intersection`)return N(r.left,n)||N(r.right,n);if(r.type===`record`||r.type===`map`)return N(r.keyType,n)||N(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:N(r.in,n)||N(r.out,n);if(r.type===`object`){for(let e in r.shape)if(N(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(N(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(N(e,n))return!0;return!!(r.rest&&N(r.rest,n))}return!1}var Cc=(e,t={})=>n=>{let r=fc({...n,processors:t});return M(e,r),hc(r,e),Sc(r,e)},wc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=fc({...i??{},target:a,io:t,processors:n});return M(e,o),hc(o,e),Sc(o,e)},Tc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Ec=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Dc=(e,t)=>{Tc(e,`minimum`,t),Ec(e,`maximum`,t)},Oc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},kc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ac=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},jc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Mc=(e,t)=>Tc(e,`minimum`,t.minimum),Nc=(e,t)=>Ec(e,`maximum`,t.maximum),Pc=e=>(t,n)=>{jc(t,n.format);let[r,i]=e[n.format];Tc(t,`minimum`,r),Ec(t,`maximum`,i)},Fc={greater_than:(e,t)=>Tc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Ec(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Oc(e,t.value),number_format:Pc(Kn),bigint_format:Pc(qn),min_length:Mc,max_length:Nc,length_equals:(e,t)=>Dc(e,t.length),min_size:Mc,max_size:Nc,size_equals:(e,t)=>Dc(e,t.size),string_format:(e,t)=>{jc(e,t.format),t.pattern&&kc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ac(e,t.mime)};function Ic(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Fc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Tc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Tc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Ec(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Ec(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Oc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ac(t,i.mime);for(let e of i.patterns??[])kc(t,e);return t}var Lc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Rc=new Map([[Ha,Di],[Wa,Oi]]),zc=e=>Rc.get(e)??e,Bc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Ic(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Lc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(zc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Vc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ic(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):pc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Hc=(e,t,n,r)=>{n.type=`boolean`},Uc=(e,t,n,r)=>{n.not={}},Wc=(e,t,n,r)=>{let i=e._zod.def,a=yn(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Gc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(pc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(pc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Kc=(e,t,n,r)=>{pc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},qc=(e,t,n,r)=>{pc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Jc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Ic(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=M(a.element,t,{...r,path:[...r.path,`items`]})};function Yc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Yc(t.out):t.type===`catch`?Yc(t.innerType):e._zod.optin}var Xc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&pc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Dn(i.properties,e,M(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Yc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=M(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>M(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qc=(e,t,n,r)=>{let i=e._zod.def,a=M(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=M(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function $c(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=$c(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>$c(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?zi:Ri).source),p):p}var el=new WeakMap;function tl(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of el.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=$c(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var nl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Ic(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=M(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Dn(i.patternProperties,zc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=M(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=el.get(t);n||(n=[],el.set(t,n),t.deferred.push(()=>tl(t))),n.push(e)}i.additionalProperties=M(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Yc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},rl=(e,t,n,r)=>{let i=e._zod.def,a=M(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},il=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},al=Symbol();function ol(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(pc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),al):JSON.parse(o)}var sl=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ol(i.defaultValue,e,t,n,r);o!==al&&(n.default=o)},cl=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ol(i.defaultValue,e,t,n,r);o!==al&&(n._prefault=o)},ll=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{pc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ul=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;M(o,t,r);let s=t.seen.get(e);s.ref=o},dl=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fl=(e,t,n,r)=>{let i=e._zod.def;M(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pl=new WeakSet([Object.prototype,Error.prototype]);function ml(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var hl=O(`ZodError`,(e,t)=>{Vr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);pl.has(n)||(pl.add(n),ml(n,`format`,e=>t=>Wr(e,t)),ml(n,`flatten`,e=>t=>Ur(e,t)),ml(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xn,2)}),ml(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),gl=Kr(hl),_l=qr(hl),vl=Jr(hl),yl=Xr(hl),bl=ni(hl),xl=ri(hl),Sl=ii(hl),Cl=ai(hl),wl=oi(hl),Tl=si(hl),El=ci(hl),Dl=li(hl);function Ol(){Nr.localeError||Pr(rs())}function kl(){Nr.memoizer||Pr({memoizer:es()})}var P=O(`ZodType`,(e,t)=>(Ol(),A.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Un(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(qu(e,t))},superRefine(e,t){return this.check(Ju(e,t))},overwrite(e){return this.check(tc(e))},optional(){return Ou(this)},exactOptional(){return Au(this)},nullable(){return Mu(this)},nullish(){return Ou(Mu(this))},nonoptional(e){return Ru(this,e)},array(){return z(this)},or(e){return hu([this,e])},and(e){return yu(this,e)},transform(e){return Hu(this,Eu(e))},default(e){return Pu(this,e)},prefault(e){return Iu(this,e)},catch(e){return Bu(this,e)},pipe(e){return Hu(this,e)},readonly(){return Gu(this)},describe(e){let t=this.clone();return ss.add(t,{description:e}),t},meta(...e){if(e.length===0)return ss.get(this);let t=this.clone();return ss.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return gr(this,`~standard`,{...ua(this),jsonSchema:{input:wc(this,`input`),output:wc(this,`output`)}})},set"~standard"(e){hr(this,`~standard`,e)},parse:function e(t,n){return gl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},safeParse(e,t){return vl(this,e,t)},async safeParseAsync(e,t){return yl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){hr(this,`spa`,e)},validate(e,t){return $r(this,e,t)},validateAsync(e,t){return ti(this,e,t)},encode:function e(t,n){return bl(this,t,n,{callee:e})},decode:function e(t,n){return xl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Sl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Cl(this,t,n,{callee:e})},safeEncode(e,t){return wl(this,e,t)},safeDecode(e,t){return Tl(this,e,t)},async safeEncodeAsync(e,t){return El(this,e,t)},async safeDecodeAsync(e,t){return Dl(this,e,t)},toJSONSchema(e){return Cc(this,{})(e)},get description(){return ss.get(this)?.description},get _def(){return this._zod.def}}),Al=O(`_ZodString`,(e,t)=>{da.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r)},_r({format:e=>Ic(e).format??null,minLength:e=>Ic(e).minimum??null,maxLength:e=>Ic(e).maximum??null},{regex(...e){return this.check(Ys(...e))},includes(...e){return this.check(Qs(...e))},startsWith(...e){return this.check($s(...e))},endsWith(...e){return this.check(ec(...e))},min(...e){return this.check(qs(...e))},max(...e){return this.check(Ks(...e))},length(...e){return this.check(Js(...e))},nonempty(...e){return this.check(qs(1,...e))},lowercase(e){return this.check(Xs(e))},uppercase(e){return this.check(Zs(e))},trim(){return this.check(rc())},normalize(...e){return this.check(nc(...e))},toLowerCase(){return this.check(ic())},toUpperCase(){return this.check(ac())},slugify(){return this.check(oc())}})),jl=O(`ZodString`,(e,t)=>{da.init(e,t),Al.init(e,t)},{email(e){return this.check(us(Il,e))},url(e){return this.check(gs(Bl,e))},jwt(e){return this.check(js(nu,e))},emoji(e){return this.check(_s(Hl,e))},guid(e){return this.check(ds(Ll,e))},uuid(e){return this.check(fs(Rl,e))},uuidv4(e){return this.check(ps(Rl,e))},uuidv6(e){return this.check(ms(Rl,e))},uuidv7(e){return this.check(hs(Rl,e))},nanoid(e){return this.check(vs(Ul,e))},cuid(e){return this.check(ys(Wl,e))},cuid2(e){return this.check(bs(Gl,e))},ulid(e){return this.check(xs(Kl,e))},base64(e){return this.check(Os($l,e))},base64url(e){return this.check(ks(eu,e))},xid(e){return this.check(Ss(ql,e))},ksuid(e){return this.check(Cs(Jl,e))},ipv4(e){return this.check(ws(Yl,e))},ipv6(e){return this.check(Ts(Xl,e))},cidrv4(e){return this.check(Es(Zl,e))},cidrv6(e){return this.check(Ds(Ql,e))},e164(e){return this.check(As(tu,e))},datetime(e){return this.check(Ms(Ml,e))},date(e){return this.check(Ns(Nl,e))},time(e){return this.check(Ps(Pl,e))},duration(e){return this.check(Fs(Fl,e))}});function F(e){return ls(jl,e)}var I=O(`ZodStringFormat`,(e,t)=>{j.init(e,t),Al.init(e,t)}),Ml=O(`ZodISODateTime`,(e,t)=>{Aa.init(e,t),I.init(e,t)}),Nl=O(`ZodISODate`,(e,t)=>{ja.init(e,t),I.init(e,t)}),Pl=O(`ZodISOTime`,(e,t)=>{Ma.init(e,t),I.init(e,t)}),Fl=O(`ZodISODuration`,(e,t)=>{Na.init(e,t),I.init(e,t)}),Il=O(`ZodEmail`,(e,t)=>{ma.init(e,t),I.init(e,t)}),Ll=O(`ZodGUID`,(e,t)=>{fa.init(e,t),I.init(e,t)}),Rl=O(`ZodUUID`,(e,t)=>{pa.init(e,t),I.init(e,t)});function zl(e){return fs(Rl,e)}var Bl=O(`ZodURL`,(e,t)=>{Sa.init(e,t),I.init(e,t)});function Vl(e){return gs(Bl,e)}var Hl=O(`ZodEmoji`,(e,t)=>{Ca.init(e,t),I.init(e,t)}),Ul=O(`ZodNanoID`,(e,t)=>{wa.init(e,t),I.init(e,t)}),Wl=O(`ZodCUID`,(e,t)=>{Ta.init(e,t),I.init(e,t)}),Gl=O(`ZodCUID2`,(e,t)=>{Ea.init(e,t),I.init(e,t)}),Kl=O(`ZodULID`,(e,t)=>{Da.init(e,t),I.init(e,t)}),ql=O(`ZodXID`,(e,t)=>{Oa.init(e,t),I.init(e,t)}),Jl=O(`ZodKSUID`,(e,t)=>{ka.init(e,t),I.init(e,t)}),Yl=O(`ZodIPv4`,(e,t)=>{Pa.init(e,t),I.init(e,t)}),Xl=O(`ZodIPv6`,(e,t)=>{La.init(e,t),I.init(e,t)}),Zl=O(`ZodCIDRv4`,(e,t)=>{Ra.init(e,t),I.init(e,t)}),Ql=O(`ZodCIDRv6`,(e,t)=>{Ba.init(e,t),I.init(e,t)}),$l=O(`ZodBase64`,(e,t)=>{Ua.init(e,t),I.init(e,t)}),eu=O(`ZodBase64URL`,(e,t)=>{Ka.init(e,t),I.init(e,t)}),tu=O(`ZodE164`,(e,t)=>{qa.init(e,t),I.init(e,t)}),nu=O(`ZodJWT`,(e,t)=>{Ya.init(e,t),I.init(e,t)}),ru=O(`ZodNumber`,(e,t)=>{Xa.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.isFinite=!0},_r({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Ic(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Ic(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Ic(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Ic(e).format??null},{gt(e,t){return this.check(Us(e,t))},gte(e,t){return this.check(Ws(e,t))},min(e,t){return this.check(Ws(e,t))},lt(e,t){return this.check(Vs(e,t))},lte(e,t){return this.check(Hs(e,t))},max(e,t){return this.check(Hs(e,t))},int(e){return this.check(au(e))},safe(e){return this.check(au(e))},positive(e){return this.check(Us(0,e))},nonnegative(e){return this.check(Ws(0,e))},negative(e){return this.check(Vs(0,e))},nonpositive(e){return this.check(Hs(0,e))},multipleOf(e,t){return this.check(Gs(e,t))},step(e,t){return this.check(Gs(e,t))},finite(){return this}}));function L(e){return Is(ru,e)}var iu=O(`ZodNumberFormat`,(e,t)=>{Za.init(e,t),ru.init(e,t)});function au(e){return Ls(iu,e)}var ou=O(`ZodBoolean`,(e,t)=>{Qa.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r)});function R(e){return Rs(ou,e)}var su=O(`ZodUnknown`,(e,t)=>{$a.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function cu(){return zs(su)}var lu=O(`ZodNever`,(e,t)=>{eo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r)});function uu(e){return Bs(lu,e)}var du=O(`ZodArray`,(e,t)=>{kl(),no.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(qs(e,t))},nonempty(e){return this.check(qs(1,e))},max(e,t){return this.check(Ks(e,t))},length(e,t){return this.check(Js(e,t))},unwrap(){return this.element}});function z(e,t){return sc(du,e,t)}var fu=O(`ZodObject`,(e,t)=>{kl(),co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xc(e,t,n,r),Cr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:cu()}))},loose(){return this.clone(T(this._zod.def,{catchall:cu()}))},strict(){return this.clone(T(this._zod.def,{catchall:uu()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return Zn(this,e)},safeExtend(e){return $n(this,e)},merge(e){return er(this,e)},pick(e){return Jn(this,e)},omit(e){return Xn(this,e)},partial(...e){return tr(Du,this,e[0])},exactPartial(...e){return tr(ku,this,e[0],`exactPartial`)},required(...e){return nr(Lu,this,e[0])}});function B(e,t){return new fu({type:`object`,shape:e??{},...E(t)})}function pu(e,t){return new fu({type:`object`,shape:e,catchall:uu(),...E(t)})}var mu=O(`ZodUnion`,(e,t)=>{uo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.options=t.options});function hu(e,t){return new mu({type:`union`,options:e,...E(t)})}var gu=O(`ZodDiscriminatedUnion`,(e,t)=>{mu.init(e,t),po.init(e,t)});function _u(e,t,n){return new gu({type:`union`,options:t,discriminator:e,...E(n)})}var vu=O(`ZodIntersection`,(e,t)=>{mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r)});function yu(e,t){return new vu({type:`intersection`,left:e,right:t})}var bu=O(`ZodRecord`,(e,t)=>{kl(),_o.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nl(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xu(e,t,n){return!t||!t._zod?new bu({type:`record`,keyType:F(),valueType:e,...E(t)}):new bu({type:`record`,keyType:e,valueType:t,...E(n)})}function Su(e,t,n){return new bu({type:`record`,keyType:e,valueType:t,...E(n),partial:!0})}var Cu=O(`ZodEnum`,(e,t)=>{vo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Cu({...t,checks:[],...E(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Cu({...t,checks:[],...E(r),entries:i})}});function V(e,t){return new Cu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...E(t)})}var wu=O(`ZodLiteral`,(e,t)=>{yo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function H(e,t){return new wu({type:`literal`,values:Array.isArray(e)?e:[e],...E(t)})}var Tu=O(`ZodTransform`,(e,t)=>{kl(),bo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Mr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(pr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(pr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Eu(e){return new Tu({type:`transform`,transform:e})}var Du=O(`ZodOptional`,(e,t)=>{So.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ou(e){return new Du({type:`optional`,innerType:e})}var ku=O(`ZodExactOptional`,(e,t)=>{Co.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Au(e){return new ku({type:`optional`,innerType:e})}var ju=O(`ZodNullable`,(e,t)=>{wo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mu(e){return new ju({type:`nullable`,innerType:e})}var Nu=O(`ZodDefault`,(e,t)=>{To.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pu(e,t){return new Nu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Bn(t)}})}var Fu=O(`ZodPrefault`,(e,t)=>{Do.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Iu(e,t){return new Fu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Bn(t)}})}var Lu=O(`ZodNonOptional`,(e,t)=>{Oo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ru(e,t){return new Lu({type:`nonoptional`,innerType:e,...E(t)})}var zu=O(`ZodCatch`,(e,t)=>{jo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bu(e,t){return new zu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Tr(t)})}var Vu=O(`ZodPipe`,(e,t)=>{Mo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ul(e,t,n,r),e.in=t.in,e.out=t.out});function Hu(e,t){return new Vu({type:`pipe`,in:e,out:t})}var Uu=O(`ZodPreprocess`,(e,t)=>{Vu.init(e,t),Po.init(e,t)}),Wu=O(`ZodReadonly`,(e,t)=>{Fo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gu(e){return new Wu({type:`readonly`,innerType:e})}var Ku=O(`ZodCustom`,(e,t)=>{Lo.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r)});function qu(e,t={}){return cc(Ku,e,t)}function Ju(e,t){return lc(e,t)}function Yu(e,t){return new Uu({type:`pipe`,in:Eu(e),out:t})}function Xu(e){return Ms(Ml,e)}var U=F().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),W=F().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),G=F().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function Zu(e){let t=e.indexOf(`/`);return t===-1?{project:null,channel:e}:{project:e.slice(0,t),channel:e.slice(t+1)}}function Qu(e,t){return e===null?t:`${e}/${t}`}var K=Yu(e=>e instanceof Date?e.toISOString():e,Xu()),$u=V(`post_message.read_inbox.search.open_thread.close_thread.create_task.claim_task.release_task.update_task.get_task.subscribe.unsubscribe.propose.approve.reject.create_project.join_project.leave_project.write_knowledge.plan_task.advance_task.configure_project.archive_project.remove_knowledge.create_channel.archive_channel.update_dashboard.create_cron.update_cron.remove_cron.remove_skill.upload_image`.split(`.`)),ed=V([`user_post`,`ops_event`,`heartbeat`]),td=B({name:U,purpose:F().min(1),verbs:z($u),wakeTriggers:z(ed).default([`heartbeat`]),reviewDate:F().optional(),maxReplicas:L().int().min(1).default(1),backlogThreshold:L().positive().default(3),resident:R().default(!1),societyScope:R().default(!1),reflects:R().default(!0)}),nd=`user`,rd=`user`,id=[`post_message`,`upload_image`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`join_project`,`leave_project`,`write_knowledge`,`remove_knowledge`,`plan_task`,`advance_task`,`update_dashboard`,`create_cron`,`update_cron`,`remove_cron`],ad=[`approve`,`reject`],od=[`create_project`],sd=[`configure_project`,`create_channel`,`archive_channel`],cd=[`archive_project`],ld=[`remove_skill`];[...id,...ad,...od,...sd,...cd,...ld],[...id,...ad,...sd,...ld],[...id,...od,...sd];function ud(e){return Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)}function dd(e,t){return e.y===t.y&&e.m===t.m&&e.d===t.d&&e.h===t.h&&e.i===t.i&&e.s===t.s}function fd(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`Invalid ISO8601 passed to timezone parser.`);let r=e.substring(9);return r.includes(`Z`)||r.includes(`+`)||r.includes(`-`)?gd(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):gd(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}function pd(e,t,n){return md(fd(e,t),n)}function md(e,t){let n=new Date(ud(e)),r=hd(n,e.tz),i=ud(e)-ud(r),a=new Date(n.getTime()+i),o=hd(a,e.tz);if(dd(o,e)){let t=new Date(a.getTime()-36e5);return dd(hd(t,e.tz),e)?t:a}let s=new Date(a.getTime()+ud(e)-ud(o));if(dd(hd(s,e.tz),e))return s;if(t)throw Error(`Invalid date passed to fromTZ()`);return a.getTime()>s.getTime()?a:s}function hd(e,t){let n,r;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:!1}),r=n.formatToParts(e)}catch(e){let n=e instanceof Error?e.message:String(e);throw RangeError(`toTZ: Invalid timezone '${t}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${n}`)}let i={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let e of r)(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`||e.type===`minute`||e.type===`second`)&&(i[e.type]=parseInt(e.value,10));if(isNaN(i.year)||isNaN(i.month)||isNaN(i.day)||isNaN(i.hour)||isNaN(i.minute)||isNaN(i.second))throw Error(`toTZ: Failed to parse all date components from timezone '${t}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(i)}`);return i.hour===24&&(i.hour=0),{y:i.year,m:i.month,d:i.day,h:i.hour,i:i.minute,s:i.second,tz:t}}function gd(e,t,n,r,i,a,o){return{y:e,m:t,d:n,h:r,i,s:a,tz:o}}var _d=[1,2,4,8,16],vd=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(e,t,n){this.pattern=e,this.timezone=t,this.mode=n?.mode??`auto`,this.alternativeWeekdays=n?.alternativeWeekdays??!1,this.sloppyRanges=n?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.match(/\S+/g)||[``],t=e.length;if(e.length<5||e.length>7)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five, six, or seven space separated parts are required.`);if(this.mode!==`auto`){let e;switch(this.mode){case`5-part`:e=5;break;case`6-part`:e=6;break;case`7-part`:e=7;break;case`5-or-6-parts`:e=[5,6];break;case`6-or-7-parts`:e=[6,7];break;default:e=0}if(!(Array.isArray(e)?e.includes(t):t===e)){let n=Array.isArray(e)?e.join(` or `):e.toString();throw TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${t} parts.`)}}if(e.length===5&&e.unshift(`0`),e.length===6&&e.push(`*`),e[3].toUpperCase()===`LW`?(this.lastWeekday=!0,e[3]=``):e[3].toUpperCase().indexOf(`L`)>=0&&(e[3]=e[3].replace(/L/gi,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[6]==`*`&&(this.starYear=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(e[5]):this.replaceAlphaDays(e[5])),e[5].startsWith(`+`)&&(this.useAndLogic=!0,e[5]=e[5].substring(1),e[5]===``))throw TypeError(`CronPattern: Day-of-week field cannot be empty after '+' modifier.`);switch(e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0&&(e[0]=e[0].replace(/\?/g,`*`),e[1]=e[1].replace(/\?/g,`*`),e[2]=e[2].replace(/\?/g,`*`),e[3]=e[3].replace(/\?/g,`*`),e[4]=e[4].replace(/\?/g,`*`),e[5]=e[5].replace(/\?/g,`*`),e[6]&&=e[6].replace(/\?/g,`*`)),this.mode){case`5-part`:e[0]=`0`,e[6]=`*`;break;case`6-part`:e[6]=`*`;break;case`5-or-6-parts`:e[6]=`*`}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1);let n=this.alternativeWeekdays?-1:0;this.partToArray(`dayOfWeek`,e[5],n,63),this.partToArray(`year`,e[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth,o=e===`day`&&this.lastWeekday;if(t===``&&!a&&!o)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let s=t.split(`,`);if(s.length>1)for(let t=0;t<s.length;t++)this.partToArray(e,s[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===3?/[^/*0-9,\-WwLl]+/:t===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=e.toUpperCase().includes(`W`);if(t!==`day`&&a)throw TypeError(`CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.`);a&&(t=`nearestWeekdays`);let o=parseInt(i[0],10)+n;if(isNaN(o))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,o,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`||e===`nearestWeekdays`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`){if(t<0||t>=12)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`year`&&(t<1||t>=1e4))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t+` (supported range: 1-9999)`);this[e][t]=n}validateNotNaN(e,t){if(isNaN(e))throw TypeError(t)}validateRange(e,t,n,r,i){if(e>t)throw TypeError(`CronPattern: From value is larger than to value: '`+i+`'`);if(n!==void 0){if(n===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(n>this[r].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[r].length+`)`)}}handleRangeWithStepping(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in ranges with stepping.`);let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);this.validateNotNaN(l,`CronPattern: Syntax error, illegal lower range (NaN)`),this.validateNotNaN(u,`CronPattern: Syntax error, illegal upper range (NaN)`),this.validateNotNaN(d,`CronPattern: Syntax error, illegal stepping: (NaN)`),this.validateRange(l,u,d,t,e);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}else if(n.toUpperCase().endsWith(`L`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)`);r=`L`,n=n.slice(0,-1)}return[n,r]}handleRange(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in a range.`);let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;this.validateNotNaN(o,`CronPattern: Syntax error, illegal lower range (NaN)`),this.validateNotNaN(s,`CronPattern: Syntax error, illegal upper range (NaN)`),this.validateRange(o,s,void 0,t,e);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in parts with stepping.`);let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);if(this.sloppyRanges)a[0]===``&&(a[0]=`*`);else{if(a[0]===``)throw TypeError(`CronPattern: Syntax error, stepping with missing prefix ('`+e+`') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.`);if(a[0]!==`*`)throw TypeError(`CronPattern: Syntax error, stepping with numeric prefix ('`+e+`') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.`)}let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);this.validateNotNaN(s,`CronPattern: Syntax error, illegal stepping: (NaN)`),this.validateRange(0,this[t].length-1,s,t,e);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaDaysQuartz(e){return e.replace(/sun/gi,`1`).replace(/mon/gi,`2`).replace(/tue/gi,`3`).replace(/wed/gi,`4`).replace(/thu/gi,`5`).replace(/fri/gi,`6`).replace(/sat/gi,`7`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();if(t===`@yearly`||t===`@annually`)return`0 0 1 1 *`;if(t===`@monthly`)return`0 0 1 * *`;if(t===`@weekly`)return`0 0 * * 0`;if(t===`@daily`||t===`@midnight`)return`0 0 * * *`;if(t===`@hourly`)return`0 * * * *`;if(t===`@reboot`)throw TypeError(`CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.`);return e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t.toUpperCase()===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|32;else if(t===63)this.dayOfWeek[e]=63;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|_d[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},yd=[31,28,31,30,31,30,31,31,30,31,30,31],q=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],J=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date){if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`)}else if(t==null)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}getLastDayOfMonth(e,t){return t===1?new Date(Date.UTC(e,t+1,0)).getUTCDate():yd[t]}getLastWeekday(e,t){let n=this.getLastDayOfMonth(e,t),r=new Date(Date.UTC(e,t,n)).getUTCDay();return r===0?n-2:r===6?n-1:n}getNearestWeekday(e,t,n){let r=this.getLastDayOfMonth(e,t);if(n>r)return-1;let i=new Date(Date.UTC(e,t,n)).getUTCDay();return i===0?n===r?n-2:n+1:i===6?n===1?n+2:n-1:n}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&63&&_d[a-1]&r)return!0;if(r&32){let r=this.getLastDayOfMonth(e,t);for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0){if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let t=hd(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}catch(e){let t=e instanceof Error?e.message:String(e);throw TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${t}`)}}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>yd[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}return!1}fromString(e){if(typeof this.tz==`number`){let t=pd(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(pd(e,this.tz))}findNext(e,t,n,r){return this._findMatch(e,t,n,r,1)}_findMatch(e,t,n,r,i){let a=this[t],o;n.lastDayOfMonth&&(o=this.getLastDayOfMonth(this.year,this.month));let s=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,c=this[t]+r,l=i===1?e=>e<n[t].length:e=>e>=0;for(let u=c;l(u);u+=i){let i=n[t][u];if(t===`day`&&!i){for(let e=0;e<n.nearestWeekdays.length;e++)if(n.nearestWeekdays[e]){let t=this.getNearestWeekday(this.year,this.month,e-r);if(t===-1)continue;if(t===u-r){i=1;break}}}if(t===`day`&&n.lastWeekday){let e=this.getLastWeekday(this.year,this.month);u-r===e&&(i=1)}if(t===`day`&&n.lastDayOfMonth&&u-r==o&&(i=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(s+(u-r-1))%7];if(t&&t&63)t=+!!this.isNthWeekdayOfMonth(this.year,this.month,u-r,t);else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);n.useAndLogic?i&&=t:!e.domAndDow&&!n.starDOM?i||=t:i&&=t}if(i)return this[t]=u-r,a===this[t]?1:2}return 3}recurse(e,t,n){if(n===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let t=-1;for(let n=this.year+1;n<e.year.length&&n<1e4;n++)if(e.year[n]===1){t=n;break}if(t===-1)return null;this.year=t,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let r=this.findNext(t,q[n][0],e,q[n][2]);if(r>1){let i=n+1;for(;i<q.length;)this[q[i][0]]=-q[i][2],i++;if(r===3){if(this[q[n][1]]++,this[q[n][0]]=-q[n][2],this.apply(),n===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,t,0)}if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=q.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}decrement(e,t){return this.second-=t.interval!==void 0&&t.interval>1?t.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,t,0,0)}recurseBackward(e,t,n,r=0){if(r>1e4)return null;if(n===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let t=-1;for(let n=this.year-1;n>=0;n--)if(e.year[n]===1){t=n;break}if(t===-1)return null;this.year=t,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let i=this.findPrevious(t,q[n][0],e,q[n][2]);if(i>1){let a=n+1;for(;a<q.length;){let t=q[a][0],n=q[a][2],r=this.getMaxPatternValue(t,e,n);this[t]=r,a++}if(i===3){if(this[q[n][1]]--,n===0){let e=this.getLastDayOfMonth(this.year,this.month);this.day>e&&(this.day=e)}if(n===1){if(this.day<=0)this.day=1;else{let e=this.year,t=this.month;for(;t<0;)t+=12,e--;for(;t>11;)t-=12,e++;let n=t===1?new Date(Date.UTC(e,t+1,0)).getUTCDate():yd[t];this.day>n&&(this.day=n)}}this.apply();let i=q[n][0],a=q[n][2],o=this.getMaxPatternValue(i,e,a);if(i===`day`){let e=this.getLastDayOfMonth(this.year,this.month);this[i]=Math.min(o,e)}else this[i]=o;if(this.apply(),n===0){let t=q[1][2],n=this.getMaxPatternValue(`day`,e,t),r=this.getLastDayOfMonth(this.year,this.month),i=Math.min(n,r);i!==this.day&&(this.day=i,this.hour=this.getMaxPatternValue(`hour`,e,q[2][2]),this.minute=this.getMaxPatternValue(`minute`,e,q[3][2]),this.second=this.getMaxPatternValue(`second`,e,q[4][2]))}if(n===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,t,0,r+1)}if(this.apply())return this.recurseBackward(e,t,n-1,r+1)}return n+=1,n>=q.length?this:this.year<0?null:this.recurseBackward(e,t,n,r+1)}getMaxPatternValue(e,t,n){if(e===`day`&&t.lastDayOfMonth||e===`day`&&!t.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let r=t[e].length-1;r>=0;r--)if(t[e][r])return r-n;return t[e].length-1-n}findPrevious(e,t,n,r){return this._findMatch(e,t,n,r,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):md(gd(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,t){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let n=0;n<q.length;n++){let r=q[n][0],i=q[n][2],a=this[r];if(a+i<0||a+i>=e[r].length)return!1;let o=e[r][a+i];if(r===`day`){if(!o){for(let t=0;t<e.nearestWeekdays.length;t++)if(e.nearestWeekdays[t]){let e=this.getNearestWeekday(this.year,this.month,t-i);if(e!==-1&&e===a){o=1;break}}}if(e.lastWeekday&&a===this.getLastWeekday(this.year,this.month)&&(o=1),e.lastDayOfMonth&&a===this.getLastDayOfMonth(this.year,this.month)&&(o=1),!e.starDOW){let n=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),r=e.dayOfWeek[(n+(a-1))%7];r&&r&63&&(r=+!!this.isNthWeekdayOfMonth(this.year,this.month,a,r)),e.useAndLogic?o&&=r:!t.domAndDow&&!e.starDOM?o||=r:o&&=r}}if(!o)return!1}return!0}};function bd(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode!==void 0&&e.domAndDow===void 0?e.domAndDow=!e.legacyMode:e.domAndDow===void 0&&(e.domAndDow=!1),e.legacyMode=!e.domAndDow,e.paused=e.paused!==void 0&&e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch!==void 0&&e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.dayOffset=e.dayOffset===void 0?0:parseInt(e.dayOffset.toString(),10),e.unref=e.unref!==void 0&&e.unref,e.mode=e.mode===void 0?`auto`:e.mode,e.alternativeWeekdays=e.alternativeWeekdays!==void 0&&e.alternativeWeekdays,e.sloppyRanges=e.sloppyRanges!==void 0&&e.sloppyRanges,![`auto`,`5-part`,`6-part`,`7-part`,`5-or-6-parts`,`6-or-7-parts`].includes(e.mode))throw Error(`CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.`);if(e.startAt&&(e.startAt=new J(e.startAt,e.timezone)),e.stopAt&&(e.stopAt=new J(e.stopAt,e.timezone)),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);if(e.dayOffset!==void 0&&e.dayOffset!==0&&isNaN(e.dayOffset))throw Error(`CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.`);return e}function xd(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function Sd(e){return xd(e)}function Cd(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var wd=3e4,Td=[],Ed=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(e){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let t=this.options.dayOffset*24*60*60*1e3;return new Date(e.getTime()+t)}return e}constructor(e,t,n){let r,i;if(xd(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(xd(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=bd(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new vd(`* * * * *`,void 0,{mode:`auto`})},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new J(e,this.getTz()):this._states.pattern=new vd(e,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(Td.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);Td.push(this)}return i!==void 0&&Sd(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?this.applyDayOffset(t.getDate(!1)):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=t||this._states.currentRun||void 0;return this._enumerateRuns(e,n,`next`)}previousRuns(e,t){return this._enumerateRuns(e,t||void 0,`previous`)}_enumerateRuns(e,t,n){let r=[],i=t?new J(t,this.getTz()):null,a=n===`next`?this._next:this._previous;for(;e--;){let e=a.call(this,i);if(!e)break;let t=e.getDate(!1);r.push(this.applyDayOffset(t)),i=e}return r}match(e){if(this._states.once){let t=new J(e,this.getTz());t.ms=0;let n=new J(this._states.once,this.getTz());return n.ms=0,t.getTime()===n.getTime()}let t=new J(e,this.getTz());return t.ms=0,t.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof J||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new J(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=Td.indexOf(this);e>=0&&Td.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>wd&&(t=wd),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&Cd(this._states.currentTimeout),this)}async _trigger(e){this._states.blocking=!0,this._states.currentRun=new J(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(xd(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new J(e,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&xd(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new J(e,this.getTz()),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new J(e,this.getTz());return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_previous(e){let t=new J(e,this.getTz());this.options.stopAt&&t.getTime()>this.options.stopAt.getTime()&&(t=this.options.stopAt);let n=new J(t,this.getTz());return this._states.once?this._states.once.getTime()<t.getTime()?this._states.once:null:(n=n.decrement(this._states.pattern,this.options),n===null||this.options.startAt&&n.getTime()<this.options.startAt.getTime()?null:n)}_calculatePreviousRun(e,t){let n=new J(void 0,this.getTz()),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new J(r,this.getTz()).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},Dd=9e5,Od=6e4,kd=200;function Ad(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).resolvedOptions().timeZone}catch{return null}}var jd=F().trim().min(1).max(64).transform((e,t)=>{let n=Ad(e);return n===null?(t.addIssue({code:`custom`,message:`${e} is not a time zone; name one as IANA does, such as Europe/Berlin, America/New_York, or UTC`}),Dr):n});function Md(e,t){return new Ed(e,{mode:`5-part`,timezone:t,paused:!0})}function Nd(e){try{return Md(e,`UTC`),null}catch(e){return e instanceof Error?e.message:String(e)}}var Pd=F().trim().min(1).max(120).superRefine((e,t)=>{let n=Nd(e);n!==null&&t.addIssue({code:`custom`,message:`not a five-field cron expression (minute, hour, day of month, month, day of week): ${n}`})}),Fd=hu([B({cron:Pd,timezone:jd.optional()}),B({at:K})]),Id=B({turnId:W,at:K,outcome:V([`completed`,`failed`,`stopped`])}),Ld=B({id:W,title:F().trim().min(1).max(120),agent:U,scope:U,thread:W.optional(),channel:U.optional(),place:U.optional(),schedule:Fd,createdBy:U,createdAt:K,since:K,paused:B({at:K,by:U}).optional(),lastFiredAt:K.optional(),lastSkippedAt:K.optional(),lastRun:Id.optional(),failures:L().int().nonnegative().default(0),ended:B({at:K,by:U,reason:F().min(1)}).optional()});function Rd(e){return`at`in e}function zd(e,t){return Rd(e)?t:e.timezone??t}function Bd(e,t,n,r){if(Rd(e)){let t=new Date(e.at);return t>n&&r>0?[t]:[]}return Md(e.cron,zd(e,t)).nextRuns(r,n)}function Vd(e,t,n){let r=Bd(e,t,n,kd),i=null;for(let e=1;e<r.length;e+=1){let t=(r[e]?.getTime()??0)-(r[e-1]?.getTime()??0);i=i===null?t:Math.min(i,t)}return i}function Hd(e,t,n=Dd){if(e.ended!==void 0||e.paused!==void 0)return null;let r=e.lastFiredAt===void 0?null:Date.parse(e.lastFiredAt),i=Date.parse(e.since);if(Rd(e.schedule))return r!==null&&r>=i?null:new Date(e.schedule.at);let a=Math.max(i,r===null?i:r+n-Od,e.lastSkippedAt===void 0?i:Date.parse(e.lastSkippedAt));return Bd(e.schedule,t,new Date(a),1)[0]??null}function Ud(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,weekday:`long`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r=e=>n.find(t=>t.type===e)?.value??``;return`${r(`weekday`)} ${r(`year`)}-${r(`month`)}-${r(`day`)} ${r(`hour`)}:${r(`minute`)}`}var Wd=B({key:F().min(1).max(80),label:F().min(1).max(80).optional(),minutes:L().int().positive().nullable().default(null),usedPercent:L().nonnegative().nullable().default(null),resetsAt:K.nullable().default(null),observedAt:K}),Gd=V([`allowed`,`warning`,`limited`,`none`]),Kd=B({hasCredits:R(),unlimited:R(),balance:F().max(40).nullable()}),qd=B({enabled:R(),monthlyLimit:L().nonnegative().nullable(),usedCredits:L().nonnegative().nullable(),currency:F().min(1).max(8).nullable()}),Jd=B({observedAt:K,source:V([`turn`,`read`]),status:Gd,limitedUntil:K.nullable().default(null),limitedBy:F().min(1).max(80).nullable().default(null),plan:F().min(1).max(40).nullable().default(null),windows:z(Wd).max(24).default([]),credits:Kd.nullable().default(null),extraUsage:qd.nullable().default(null)});function Yd(e,t){return e.resetsAt===null||Date.parse(e.resetsAt)>t.getTime()}function Xd(e,t){if(e.status===`none`)return`none`;if(e.status===`limited`&&(e.limitedUntil===null||Date.parse(e.limitedUntil)>t.getTime()))return`limited`;let n=e.windows.some(e=>Yd(e,t)&&e.usedPercent!==null&&e.usedPercent>=80);return e.status===`warning`||n?`warning`:`ok`}var Zd={five_hour:`5h`,seven_day:`7d`,seven_day_opus:`7d opus`,seven_day_sonnet:`7d sonnet`,seven_day_oauth_apps:`7d apps`,seven_day_overage_included:`7d extra`,overage:`extra usage`};function Qd(e){if(e.label!==void 0){let t=e.label.toLowerCase();return e.minutes===10080?`7d ${t}`:t}let t=Zd[e.key];return t===void 0?e.minutes===null?e.key:e.minutes%1440==0?`${e.minutes/1440}d`:e.minutes%60==0?`${e.minutes/60}h`:`${e.minutes}m`:t}function $d(e){return e.windows.map(e=>`${e.key}=${e.usedPercent===null?`?`:Math.round(e.usedPercent)}@${e.resetsAt===null?`?`:Math.round(Date.parse(e.resetsAt)/6e4)}`).toSorted().join(`,`)}function ef(e,t){return e.windows.some(e=>e.resetsAt!==null)&&e.plan===t.plan&&e.status===t.status&&e.limitedUntil===t.limitedUntil&&$d(e)===$d(t)}var tf=`asks`,nf=[`general`,`governance`,tf],rf=[`general`];function af(e,t){return(e===null?nf:rf).includes(t)}var of=`society`,Y=V([`claude`,`codex`]),sf=B({name:U,at:K,by:U,reason:F().min(1)}),cf=B({name:F().min(1),version:H(1),createdAt:K,channels:z(U),archivedChannels:z(sf).default([]),timezone:jd.default(`UTC`)}),lf=V([`none`,`merge`,`ghpr`]),uf=F().trim().regex(/^https:\/\/github\.com\/([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)\/pull\/([1-9]\d*)\/?$/,`a pull request's address, https://github.com/<owner>/<repo>/pull/<number>`),df=F().trim().min(1).max(300).regex(/^[^\n]+$/,`a merge commit's subject is one line`),ff=B({url:uf,number:L().int().positive(),subject:df.optional(),body:F().max(2e4).optional(),linkedBy:U,linkedAt:K,closed:B({at:K,ok:R(),detail:F()}).optional()}),pf=F().trim().min(1).max(100).regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,`a branch name is letters, digits, and . _ / -`).refine(e=>!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)&&!e.endsWith(`.`)&&!e.endsWith(`.lock`),`not a branch name git takes`).refine(e=>!e.startsWith(`task/`)&&!e.startsWith(`agent/`),`task/ and agent/ hold the board's own branches`),mf=F().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),hf={name:F().trim().min(1).max(120),role:U.optional(),agent:U.optional(),gate:R().default(!1)};function gf(e){return e.role===void 0||e.agent===void 0}var _f={message:`a stage names a role or an agent, not both`},vf=B(hf).refine(gf,_f),yf=B({id:mf.optional(),...hf}).refine(gf,_f),bf=B({slug:U,name:F().min(1),repo:F().nullable(),defaultBranch:F().min(1),channels:z(U),archivedChannels:z(sf).default([]),members:z(U),approvers:z(U),requiredCapabilities:z(F()),createdAt:K,onDone:lf.default(`none`),runner:U.optional(),archived:B({at:K,by:U,reason:F().min(1)}).optional()}),xf=hu([B({action:V([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:mf,to:mf.nullable()}),B({action:V([`approved`,`rejected`])})]);function Sf(e){return`stage`in e}var Cf=_u(`kind`,[B({kind:H(`knowledge`),action:V([`written`,`updated`,`removed`]),topic:U,project:U.nullable()})]),wf=B({id:W,author:U,channel:G,thread:W.optional(),task:W.optional(),closes:W.optional(),step:xf.optional(),notice:Cf.optional(),ts:K,mentions:z(U)}),Tf=wf.pick({id:!0,author:!0,channel:!0,thread:!0,ts:!0}),Ef=V([`open`,`claimed`,`done`,`abandoned`]),Df=V([`open`,`closed`]),Of=B({kind:V([`task`,`proposal`]),id:W}),kf=B({id:W,channel:G,title:F().min(1).max(200),subject:Of.optional(),state:Df,openedBy:U,openedAt:K,closedBy:U.optional(),closedAt:K.optional()}),Af=B({id:mf,name:F().min(1),role:U.optional(),agent:U.optional(),gate:R().default(!1),holders:z(U).default([]),completedBy:U.optional(),completedAt:K.optional()}),jf=B({from:mf,by:U,at:K}),Mf=B({id:W,project:U,channel:U.default(`general`),title:F().min(1),status:Ef,createdBy:U,createdAt:K,updatedAt:K,claimedBy:U.optional(),leaseExpiresAt:K.optional(),parentId:W.optional(),blockedBy:z(W),requiredCapabilities:z(F()),stages:z(Af).min(1),stage:mf,stageSince:K,stageSeq:L().int().positive(),onDone:lf.default(`none`),pullRequest:ff.optional(),completing:R().default(!1),returned:jf.optional()});function Nf(e,t){return e.stages.findIndex(e=>e.id===t)}function Pf(e){return e.stages.find(t=>t.id===e.stage)}var Ff=F().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),If=F().trim().min(1).max(32).regex(/^[a-z][a-z0-9_-]*$/,`an effort is one lowercase word, such as high`),Lf=B({id:If,description:F().default(``)}),Rf=B({runner:U,cli:Y,models:z(B({id:Ff,name:F(),description:F().default(``),isDefault:R().default(!1),efforts:z(Lf).default([]),defaultEffort:If.optional()}))}),zf=V([`active`,`retired`]),Bf=B({name:U,role:U,cli:Y.nullable(),model:F().optional(),effort:F().optional(),homeRunner:U.optional(),memberships:z(U),subscriptions:z(G),status:zf,createdAt:K,tokenHash:F().min(1),retiredAt:K.optional(),retiredReason:F().optional()}),Vf=B({name:U,role:U,cli:Y.nullable(),homeRunner:U.optional(),status:zf,resident:R().default(!1),model:F().optional(),lastModel:F().optional(),effort:F().optional(),skills:z(U).default([]),memberships:z(U),subscriptions:z(G),claimsHeld:L().int().nonnegative().default(0),tasksDone:L().int().nonnegative().default(0),lastTurnAt:K.optional(),lastTurnOutcome:F().optional(),createdAt:K,retiredAt:K.optional()}),Hf=V([`linux`,`windows`,`darwin`]),Uf=V([`name`,`email`]),Wf=B({name:U,os:Hf,clis:z(Y),capabilities:z(F()),version:F().optional(),gitIdentityMissing:z(Uf).optional(),status:V([`connected`,`disconnected`]),lastSeen:K.optional(),quotas:Su(Y,Jd).optional()}),Gf=V([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),Kf=V([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),qf=B({name:U,role:U,cli:Y,model:F().optional(),homeRunner:U.optional(),memberships:z(U).default([]),subscriptions:z(G).default([]),seedInstructions:F().optional()}),Jf=B({project:U.nullable().default(null),name:U,purpose:F().min(1)}),Yf=B({role:U,changes:pu({maxReplicas:L().int().min(1).optional(),backlogThreshold:L().positive().optional(),wakeTriggers:z(ed).optional(),verbs:z($u).optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),{message:`a reallocation changes at least one of maxReplicas, backlogThreshold, wakeTriggers, verbs`}),description:F().min(1)}),Xf=B({description:F().min(1)});function Zf(e,t){return{...e,...t.maxReplicas===void 0?{}:{maxReplicas:t.maxReplicas},...t.backlogThreshold===void 0?{}:{backlogThreshold:t.backlogThreshold},...t.wakeTriggers===void 0?{}:{wakeTriggers:[...t.wakeTriggers]},...t.verbs===void 0?{}:{verbs:[...t.verbs]}}}function Qf(e){return e.length===0?`none`:e.join(`, `)}function $f(e,t){let n=[];t.maxReplicas!==void 0&&t.maxReplicas!==e.maxReplicas&&n.push(`maxReplicas ${e.maxReplicas} → ${t.maxReplicas}`),t.backlogThreshold!==void 0&&t.backlogThreshold!==e.backlogThreshold&&n.push(`backlogThreshold ${e.backlogThreshold} → ${t.backlogThreshold}`);let r=t.wakeTriggers;if(r!==void 0&&(r.length!==e.wakeTriggers.length||r.some(t=>!e.wakeTriggers.includes(t)))&&n.push(`wakeTriggers ${Qf(e.wakeTriggers)} → ${Qf(r)}`),t.verbs!==void 0){let r=t.verbs,i=r.filter(t=>!e.verbs.includes(t)).map(e=>`+${e}`),a=e.verbs.filter(e=>!r.includes(e)).map(e=>`−${e}`);i.length+a.length>0&&n.push(`verbs ${[...i,...a].join(` `)}`)}return n}var ep=B({agent:U,reason:F().min(1)}),tp=B({project:U,reason:F().min(1)}),np=B({name:U,summary:F().min(1).max(200),body:F().min(1).optional()}),rp={role:[nd],member:[nd],retirement:[nd],archive:[nd],channel:[nd,`steward`],reallocation:[nd,`steward`],skill:[nd,`steward`]},ip=[`verbs`,`maxReplicas`];function ap(e,t){if(e===`reallocation`){let e=Yf.safeParse(t);if(e.success&&ip.some(t=>e.data.changes[t]!==void 0))return[nd]}return rp[e]}function op(e){let t=[];return e.maxReplicas!==void 0&&t.push(`up to ${e.maxReplicas} per project`),e.backlogThreshold!==void 0&&t.push(`backlog threshold ${e.backlogThreshold}`),e.wakeTriggers!==void 0&&t.push(e.wakeTriggers.length===0?`no ambient wakes`:`wakes on ${e.wakeTriggers.join(`, `)}`),e.verbs!==void 0&&t.push(`${e.verbs.length} verbs`),t.join(`, `)}function sp(e,t){switch(e){case`member`:{let e=qf.safeParse(t);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`member ${n} as ${r} on ${i}${a.length===0?``:` for ${a.join(`, `)}`}`}case`role`:{let e=td.safeParse(t);if(!e.success)break;let{name:n,verbs:r,maxReplicas:i}=e.data;return`role ${n} (${r.length} verbs, up to ${i} per project)`}case`channel`:{let e=Jf.safeParse(t);if(!e.success)break;return`channel ${Qu(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=ep.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=Yf.safeParse(t);if(e.success){let{role:t,changes:n,description:r}=e.data;return`reallocation of role ${t} (${op(n)}): ${r}`}let n=Xf.safeParse(t);if(!n.success)break;return`reallocation: ${n.data.description}`}case`skill`:{let e=np.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=tp.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var cp=B({name:U,summary:F().default(``),scope:V([`own`,`society`]),path:F().min(1)}),lp=B({name:U,reason:F().min(1),removedBy:U,removedAt:K}),up=B({path:F().min(1),file:F().min(1),since:K}),dp=F().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),fp=B({path:F().min(1),status:V([`added`,`modified`,`deleted`]),added:L().int().nonnegative().nullable(),removed:L().int().nonnegative().nullable()}),pp=B({changes:z(B({commit:dp,at:K,kind:V([`turn`,`board`,`merge`]),author:F(),turnId:W.optional(),subject:F(),files:z(fp)})),more:R()}),mp=fp.pick({path:!0,status:!0}).extend({patch:F().nullable(),truncated:R()}),hp=B({topic:U,project:U.nullable(),revision:L().int().min(0),updatedBy:U,updatedAt:K}),gp=B({topic:U,project:U.nullable(),removedBy:U,removedAt:K}),_p=B({project:U,revision:L().int().min(0),updatedBy:U.optional(),updatedAt:K.optional(),body:F()}),vp=B({scope:U,thread:W.optional(),channel:U.optional(),place:U.optional()}),yp=B({path:F().min(1),size:L().int().nonnegative(),executable:R()}),bp=B({commit:dp,takenAt:K,files:z(yp)}),xp=yp.extend({text:F().nullable(),truncated:R()}),Sp=B({id:W,kind:Gf,proposedBy:U,status:Kf,createdAt:K,filedFrom:vp.optional(),skillFiles:bp.optional(),decidedBy:U.optional(),decidedAt:K.optional(),reason:F().optional(),charter:xu(F(),cu()),provisionedAt:K.optional(),provision:xu(F(),cu()).optional()}),Cp=B({id:W,proposalId:W,decidedBy:U,outcome:V([`approved`,`rejected`]),reason:F().optional(),ts:K}),wp=V([`png`,`jpeg`,`gif`,`webp`]),Tp=F().min(1).max(4096).refine(e=>!e.includes(`\0`),{message:`a path with no NUL character`}),Ep=`image:`;function Dp(e){if(!e.startsWith(`image:`))return null;let t=e.slice(6);return W.safeParse(t).success?t:null}B({id:W,type:wp,size:L().int().positive(),markdown:F()});var Op=Xu({offset:!0}),kp=F().trim().min(1).max(120),Ap=F().trim().min(1).max(4e3);B({channel:G.optional(),body:F().min(1),thread_id:W.optional()}),B({since_cursor:W.nullable().optional(),limit:L().int().positive().max(200).default(50),advance:R().default(!0)}),B({query:F().min(1),project:U.optional(),channel:G.optional(),limit:L().int().positive().max(100).default(20)}),B({task_id:W.optional(),proposal_id:W.optional(),channel:G.optional(),title:F().min(1).max(200).optional()}),B({thread_id:W,summary:F().min(1)}),B({project:U,title:F().min(1).max(200),body:F().default(``),parent_id:W.optional(),required_capabilities:z(F()).default([]),stages:z(vf).min(1).optional(),channel:U.default(`general`)}),B({task_id:W}),B({task_id:W}),B({task_id:W,stage:mf.optional(),status:V([`abandoned`]).optional(),note:F().min(1).optional(),blocked_by:z(W).optional(),pull_request:B({url:uf,merge_subject:df.optional(),merge_body:F().max(2e4).optional()}).nullable().optional()}),B({task_id:W}),B({channel:G}),B({channel:G}),B({kind:Gf,charter:xu(F(),cu()),rationale:F().default(``)}),B({proposal_id:W,reason:F().optional()}),B({proposal_id:W,reason:F().min(1)}),B({slug:U,name:F().min(1).optional(),repo:F().min(1).nullable().default(null),default_branch:pf.default(`main`),on_done:lf.optional()}),B({project:U,agent:U.optional()}),B({project:U,agent:U.optional()}),B({project:U.nullable().default(null),topic:U,body:F().min(1),revision:L().int().min(0)}),B({project:U.nullable().default(null),topic:U}),B({task_id:W,stages:z(yf),on_done:lf.optional()}),B({task_id:W,note:F().min(1).optional()}),B({project:U,on_done:lf.optional(),name:F().trim().min(1).max(120).optional(),default_branch:pf.optional()}),B({project:U,reason:F().min(1)}),B({project:U.nullable().default(null),name:U,purpose:F().min(1)}),B({channel:G,reason:F().min(1)}),B({project:U,body:F().min(1),revision:L().int().min(0)}),B({title:kp,note:Ap,cron:Pd.optional(),timezone:jd.optional(),at:Op.optional(),agent:U.optional(),project:U.optional(),thread_id:W.optional(),channel:U.optional()}),B({cron_id:W,paused:R().optional(),title:kp.optional(),note:Ap.optional(),cron:Pd.optional(),timezone:jd.nullable().optional(),at:Op.optional()}),B({cron_id:W,reason:F().trim().min(1)}),B({name:U,reason:F().trim().min(1)}),B({path:Tp});var jp=B({id:W,ts:K,type:V(`society.initialized,project.added,project.configured,project.archived,project.placed,agent.added,agent.configured,agent.placed,message.posted,thread.opened,thread.closed,task.created,task.claimed,task.released,task.updated,task.planned,task.advanced,task.moved,task.completing,task.completed,task.reopened,lease.expired,subscription.changed,proposal.created,proposal.decided,proposal.provisioned,proposal.files_taken,channel.added,channel.archived,role.added,agent.retired,agent.joined,agent.left,knowledge.written,knowledge.removed,dashboard.updated,skill.promoted,skill.removed,runner.added,user.signed_in,user.signed_out,user.token_rotated,runner.changed,runner.quota,ops.signal,paused.changed,wake.requested,turn.started,turn.steered,turn.stopped,turn.completed,turn.failed,merge.completed,merge.failed,pull_request.closed,pull_request.close_failed,workspace.leftovers,society.configured,cron.created,cron.updated,cron.fired,cron.skipped,cron.ended,image.uploaded`.split(`,`)),actor:U,payload:xu(F(),cu())}),Mp=B({inputTokens:L().int().nonnegative(),outputTokens:L().int().nonnegative(),cacheReadTokens:L().int().nonnegative().default(0),cacheWriteTokens:L().int().nonnegative().default(0)});function Np(e,t){return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,cacheReadTokens:e.cacheReadTokens+t.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens+t.cacheWriteTokens}}var Pp=B({summary:F().min(1),claimsHeld:z(W).default([]),blockedOn:z(F()).default([]),needsUserDecision:R().default(!1),memoryUpdated:R().default(!1)}),Fp=V([`completed`,`timeout`,`error`,`interrupted`,`blocked`,`stopped`]),Ip=V([`lost`,`retry`]),Lp=_u(`type`,[B({type:H(`turn_started`),agent:U,session:F(),runner:U,model:F().optional()}),B({type:H(`steered`),steer:F().min(1),messages:z(W).optional(),text:F().optional()}),B({type:H(`text`),delta:F()}),B({type:H(`tool_call`),name:F(),input:cu()}),B({type:H(`tool_result`),name:F(),ok:R(),output:F().optional()}),B({type:H(`approval_requested`),kind:F(),detail:cu()}),B({type:H(`turn_completed`),usage:Mp,costUsd:L().nonnegative(),status:Pp.nullable(),exitReason:Fp}),B({type:H(`error`),message:F()})]),Rp=B({ts:K,event:Lp}),zp=B({seq:L().int().positive(),ts:K,agent:U,project:U,thread:W.optional(),channel:U.optional(),place:U.optional(),event:Lp});B({protocol:L().int().positive(),version:F().min(1),os:Hf,clis:z(Y),residentClis:z(Y).default([]),steerableClis:z(Y).default([]),stoppableClis:z(Y).default([]),branchReads:R().default(!1),branchChanges:R().default(!1),quotaReads:R().default(!1),imageReads:R().default(!1),capabilities:z(F()).default([]),gitIdentityMissing:z(Uf).optional(),slots:L().int().positive().nullable(),turns:z(W).default([])}),B({name:U,version:F()}),B({protocol:L().int().positive(),version:F().min(1).max(64),hostname:F().min(1).max(253),os:Hf,clis:z(Y).max(8),capabilities:z(F().min(1).max(64)).max(32).default([])}),B({deviceCode:F().min(1),userCode:F().min(1),expiresAt:K,intervalMs:L().int().positive()}),B({deviceCode:F().min(1)}),_u(`status`,[B({status:H(`pending`)}),B({status:H(`approved`),name:U,token:F().min(1)}),B({status:H(`denied`)})]);var Bp=B({userCode:F().min(1),hostname:F(),os:Hf,clis:z(Y),capabilities:z(F()),version:F(),requestedAt:K,expiresAt:K}),Vp=B({slug:U,origin:F().nullable(),defaultBranch:F().min(1),boardLands:R()}),Hp=_u(`kind`,[B({kind:H(`home`),thread:W.optional(),channel:U.optional(),place:U.optional()}),B({kind:H(`project`),repo:Vp,branches:z(F().min(1)),thread:W.optional(),channel:U.optional()}),B({kind:H(`task`),repo:Vp,taskId:W,holder:U.optional()})]),Up=B({turnId:W,agent:U,role:U,cli:Y,model:F().optional(),effort:F().optional(),scope:U,thread:W.optional(),channel:U.optional(),place:U.optional(),session:F().min(1).nullable(),costSoFarUsd:L().nonnegative(),instructions:F(),prompt:F(),mcp:B({url:F().min(1),token:F().min(1)}),limits:B({timeoutMs:L().int().positive().nullable(),maxTurns:L().int().positive().nullable()}),resident:B({key:F().min(1),idleMs:L().int().positive()}).optional(),workspace:Hp}),Wp=B({branch:F().min(1),head:F().min(1)}),Gp=B({branch:F().min(1),agent:U,commits:z(F()),total:L().int().positive()});B({entries:z(Rp)}),B({exitReason:Fp,status:Pp.nullable(),error:F().nullable(),usage:Mp,costUsd:L().nonnegative(),sessionCostUsd:L().nonnegative().optional(),session:F().min(1).nullable(),resumeFailed:Ip.optional(),model:F().nullable(),work:Wp.nullable(),leftovers:R().default(!1),stuck:z(Gp).optional(),quota:Jd.optional()}),B({dropWorkspace:R()});var Kp=B({repo:Vp,branch:F().min(1),pullRequest:B({url:F().min(1),subject:F().min(1).optional(),body:F().optional()}).optional()}),qp=B({repo:Vp,url:F().min(1),comment:F().min(1)});B({ok:R(),detail:F()});var Jp=8388608,Yp=F().max(4096).refine(e=>e===``||e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&!e.includes(`\0`)),{message:"a path inside the branch, with no empty, `.`, or `..` segment"}),Xp=F().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/),Zp=B({repo:Vp,branch:Xp,path:Yp}),Qp=B({id:F().min(1),at:K,author:F()}),$p=_u(`kind`,[B({kind:H(`file`),path:Yp,commit:Qp,size:L().int().nonnegative(),content:F().nullable()}),B({kind:H(`dir`),path:Yp,commit:Qp,entries:z(B({name:F().min(1),kind:V([`file`,`dir`]),size:L().int().nonnegative().nullable()}))})]),em=B({repo:Vp,branch:Xp}),tm=B({path:F().min(1),status:V([`added`,`modified`,`deleted`]),added:L().int().nonnegative().nullable(),removed:L().int().nonnegative().nullable(),lastChange:B({author:F(),at:K}).optional()}),nm=B({head:Qp,files:z(tm),total:L().int().nonnegative()}),rm=B({repo:Vp,branch:Xp,path:Yp.min(1)}),im=B({head:Qp,path:Yp,status:tm.shape.status,patch:F().nullable(),truncated:R()}),am=B({turnId:W,path:Tp}),om=V([`missing`,`outside`,`not_image`,`too_big`]);_u(`kind`,[B({kind:H(`image`),type:wp,size:L().int().positive(),content:F()}),B({kind:H(`refused`),why:om,detail:F()})]);var sm=_u(`kind`,[B({kind:H(`thread`),id:W}),B({kind:H(`channel`),scope:U,name:U}),B({kind:H(`place`),project:U})]),cm=B({agent:U,scope:U,conversation:sm});B({workspaces:z(cm)}),B({kept:z(cm)});var lm=B({id:zl(),text:F().min(1)});_u(`type`,[B({type:H(`turn`),job:Up}),B({type:H(`land`),request:F().min(1),land:Kp}),B({type:H(`close`),request:F().min(1),close:qp}),B({type:H(`models`),request:F().min(1),cli:Y}),B({type:H(`quota`),request:F().min(1),cli:Y}),B({type:H(`file`),request:F().min(1),read:Zp}),B({type:H(`changes`),request:F().min(1),read:em}),B({type:H(`diff`),request:F().min(1),read:rm}),B({type:H(`image`),request:F().min(1),read:am}),B({type:H(`steer`),request:F().min(1),turnId:W,steer:lm}),B({type:H(`stop`),request:F().min(1),turnId:W}),B({type:H(`sweep`),request:F().min(1),conversation:sm})]),_u(`ok`,[B({ok:H(!0),value:cu()}),B({ok:H(!1),error:F()})]),B({warm:z(F())}),B({files:xu(F(),F())}),B({paths:z(F())}),B({files:xu(F(),F())});var um=B({kind:V([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`,`closing`,`cron`]),from:U.optional(),fromUser:R().default(!1),reason:F().default(``),taskId:W.optional(),messageId:W.optional(),channel:G.optional(),cronId:W.optional()});B({agent:U,project:U,thread:B({id:W,task:R()}).optional(),channel:U.optional(),place:U.optional(),trigger:um,priority:L().int().min(0).max(2),onboarding:R().default(!1),crons:z(W).optional()});function dm(e){return e.thread===void 0?e.channel===void 0?e.place===void 0?void 0:`~${e.place}`:`#${e.channel}`:e.thread}function fm(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function pm(e){let[t,n,r,i]=e.split(`/`);return t===void 0||n===void 0||i!==void 0?null:r===void 0?{agent:t,scope:n}:r.startsWith(`#`)?{agent:t,scope:n,channel:r.slice(1)}:r.startsWith(`~`)?{agent:t,scope:n,place:r.slice(1)}:{agent:t,scope:n,thread:r}}B({id:W.optional(),agent:U,project:U,thread:W.optional(),channel:U.optional(),place:U.optional(),runner:U,cli:Y.nullable(),session:F().nullable(),trigger:um,startedAt:K,endedAt:K.nullable(),exitReason:Fp.nullable(),status:Pp.nullable(),error:F().nullable(),usage:Mp.nullable(),costUsd:L().nonnegative().default(0),sessionCostUsd:L().nonnegative().optional(),toolCalls:L().int().nonnegative().default(0),model:F().nullable().default(null),work:Wp.optional(),stoppedBy:U.optional(),resumeFailed:Ip.optional(),resumeRetries:L().int().positive().optional(),sessionDropped:R().optional(),crons:z(W).optional()});var mm=B({turnId:W,agent:U,scope:U,thread:W.optional(),channel:U.optional(),place:U.optional(),cli:Y,askedIn:G.optional(),steerable:R(),stoppable:R()});B({claude:F().optional(),codex:F().optional(),runner:U.optional()}),B({agent:U,project:U,reason:F().default(`manual wake`),kind:V([`manual`,`reflection`]).default(`manual`)});var hm=B({id:W,turnId:W.optional(),ts:K,outcome:V([`completed`,`failed`]),project:U,thread:W.optional(),channel:U.optional(),place:U.optional(),trigger:F(),exitReason:F().nullable(),costUsd:L(),usage:Mp.optional(),model:F().nullable(),summary:F().nullable(),error:F().nullable(),startedAt:K.optional(),toolCalls:L().int().nonnegative().optional()}),gm=V([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`,`stuck_workspace`,`cron_failing`]),_m=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],vm=B({kind:gm,key:F().min(1),summary:F().min(1),value:L(),threshold:L().optional(),project:U.optional(),agent:U.optional(),role:U.optional(),taskId:W.optional()}),ym=V([`24h`,`7d`,`all`]),X=L().int().nonnegative(),bm=L().nonnegative(),xm=B({window:ym,since:K.nullable(),until:K,idle:B({turns:X,idle:X,unknown:X,byTrigger:z(B({trigger:F(),turns:X,idle:X})),byAgent:z(B({agent:U,role:U.nullable(),turns:X,idle:X}))}),sentBack:B({finished:X,sendBacks:X,tasksSentBack:X,byStage:z(B({project:U,stage:F(),count:X})),bySender:z(B({agent:U,count:X}))}),messages:B({finished:X,messages:X,byProject:z(B({project:U,finished:X,messages:X})),busiest:z(B({taskId:W,title:F(),project:U,messages:X}))}),latency:B({mentions:X,unanswered:X,medianMs:bm.nullable(),slowestMs:bm.nullable(),byAgent:z(B({agent:U,mentions:X,medianMs:bm,slowestMs:bm}))}),decisions:B({total:X,byDay:z(B({day:F(),proposals:X,answers:X,stages:X}))}),blocked:z(B({taskId:W,title:F().nullable(),project:U.nullable(),summary:F(),firstAt:K,lastAt:K,holds:R()}))}),Sm=B({agent:U,turns:X,withUsage:X,usage:Mp.nullable()}),Cm=B({window:ym,since:K.nullable(),until:K,citizens:z(Sm)}),wm=V([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),Tm=B({clientId:F().min(1),clientSecret:F().min(1),users:z(F().min(1)).min(1)});B({dataDir:F().min(1),host:F().min(1),port:L().int().positive().max(65535),publicUrl:F().min(1).nullable(),logLevel:wm,concurrency:L().int().positive().nullable(),turnTimeoutMs:L().int().positive().nullable(),toolRounds:L().int().positive().nullable(),residentIdleMs:L().int().positive(),github:Tm.nullable(),trustedProxies:L().int().min(0).max(16)}),B({serverUrl:F().url(),token:F().min(1).nullable(),dataDir:F().min(1),logLevel:wm,slots:L().int().positive().nullable(),clis:z(Y).min(1),capabilities:z(F())});var Em=`stellaris.token`;function Dm(){return localStorage.getItem(Em)}function Om(e){localStorage.setItem(Em,e)}function km(){localStorage.removeItem(Em)}var Am=B({github:R()});async function jm(){try{let e=Am.safeParse(await(await fetch(`/auth/config`)).json());return e.success?e.data:{github:!1}}catch{return{github:!1}}}var Mm=class extends Error{status;constructor(e,t){super(t),this.status=e}},Nm=B({name:U,role:U,signIn:B({login:F().min(1),avatarUrl:Vl()}).optional()}),Pm=Vf.extend({profile:F()}).array(),Fm=B({paused:R(),running:z(F()),pending:z(F()),resident:z(F()),signals:z(F()),turns:z(mm).default([])});function Im(e){return e.flatMap(e=>{let t=pm(e);return t===null?[]:[t]})}var Lm=wf.extend({body:F()}),Rm=Lm.array(),zm=B({ref:G,project:U.nullable(),name:U,messages:L().int(),lastMessageId:W.nullable(),lastAt:F().nullable(),archived:sf.optional()}),Bm=kf.extend({body:F()}),Vm=Bm.extend({messages:L().int(),lastMessageId:W.nullable(),lastAuthor:U.nullable().default(null)}),Hm=B({thread:Bm,messages:Rm}),Um=B({message:Lm,thread:Bm.nullable()}),Wm=Mf.extend({body:F()}),Gm=Sp.extend({body:F()}),Km=hp.extend({body:F()}),qm=Ld.extend({note:F()}),Jm=B({body:F()});function Ym(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}function Xm(e){return e.split(`/`).filter(e=>e!==``).map(e=>`/${encodeURIComponent(e)}`).join(``)}var Zm=B({message:F()});async function Qm(e,t){let n;try{n=await fetch(e,{headers:{authorization:`Bearer ${t}`}})}catch{throw new Mm(0,`The board server is not reachable.`)}if(!n.ok){let t=Zm.safeParse(await n.json().catch(()=>null));throw new Mm(n.status,t.success?t.data.message:`${e} answered ${n.status}`)}return n}async function Z(e,t,n){return n.parse(await(await Qm(e,t)).json())}async function $m(e,t){let n=await(await Qm(e,t)).blob();return new Promise((t,r)=>{let i=new FileReader;i.addEventListener(`load`,()=>typeof i.result==`string`?t(i.result):r(new Mm(0,`${e} could not be read`))),i.addEventListener(`error`,()=>r(new Mm(0,`${e} could not be read`))),i.readAsDataURL(n)})}async function eh(e,t,n,r,i){let a;try{a=await fetch(t,{method:e,headers:{authorization:`Bearer ${n}`,"content-type":`application/json`},body:JSON.stringify(r)})}catch{throw new Mm(0,`The board server is not reachable.`)}if(!a.ok){let e=Zm.safeParse(await a.json().catch(()=>null));throw new Mm(a.status,e.success?e.data.message:`${t} answered ${a.status}`)}return i.parse(await a.json())}function Q(e,t,n,r){return eh(`POST`,`/api/verbs/${e}`,t,n,r)}var th=B({paused:R()}),nh=B({version:F()}),rh=B({id:W,ts:F(),signal:vm}),ih=Bf.omit({tokenHash:!0}),ah=B({signedOut:R()}),oh=B({denied:R()}),sh=B({stopped:R()});function ch(e){return{me:()=>Z(`/api/me`,e,Nm),signOut:()=>eh(`DELETE`,`/api/sign-in`,e,{},ah),society:()=>Z(`/api/society`,e,cf),version:async()=>(await Z(`/api/version`,e,nh)).version,members:()=>Z(`/api/members`,e,Pm),projects:()=>Z(`/api/projects`,e,bf.array()),roles:()=>Z(`/api/roles`,e,td.array()),scheduler:()=>Z(`/api/scheduler`,e,Fm),signals:t=>Z(`/api/signals?limit=${t}`,e,rh.array()),metrics:t=>Z(`/api/metrics?window=${t}`,e,xm),tokens:t=>Z(`/api/tokens?window=${t}`,e,Cm),channels:()=>Z(`/api/channels`,e,zm.array()),channel:t=>Z(`/api/channels/${Ym(t)}`,e,Rm),threads:()=>Z(`/api/threads`,e,Vm.array()),requests:()=>Z(`/api/requests`,e,Um.array()),thread:t=>Z(`/api/threads/${encodeURIComponent(t)}`,e,Hm),tasks:t=>Z(`/api/projects/${encodeURIComponent(t)}/tasks`,e,Wm.array()),task:t=>Z(`/api/tasks/${encodeURIComponent(t)}`,e,Wm),taskFile:(t,n)=>Z(`/api/tasks/${encodeURIComponent(t)}/files${Xm(n)}`,e,$p),image:t=>$m(`/api/images/${encodeURIComponent(t)}`,e),taskChanges:t=>Z(`/api/tasks/${encodeURIComponent(t)}/changes`,e,nm),taskDiff:(t,n)=>Z(`/api/tasks/${encodeURIComponent(t)}/diff${Xm(n)}`,e,im),proposals:()=>Z(`/api/proposals`,e,Gm.array()),crons:()=>Z(`/api/crons`,e,qm.array()),createCron:t=>Q(`create_cron`,e,t,qm),pauseCron:(t,n)=>Q(`update_cron`,e,{cron_id:t,paused:n},qm),removeCron:(t,n)=>Q(`remove_cron`,e,{cron_id:t,reason:n},qm),setTimezone:t=>eh(`PUT`,`/api/society/timezone`,e,{timezone:t},cf),proposal:t=>Z(`/api/proposals/${encodeURIComponent(t)}`,e,Gm),messages:t=>Z(`/api/messages?ids=${t.join(`,`)}`,e,Tf.array()),proposalFiles:t=>Z(`/api/proposals/${encodeURIComponent(t)}/files`,e,xp.array()),skills:()=>Z(`/api/skills`,e,cp.array()),skillFiles:t=>Z(`/api/skills/${encodeURIComponent(t)}/files`,e,xp.array()),turns:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/turns?limit=${n}`,e,hm.array()),transcript:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/turns/${encodeURIComponent(n)}`,e,Rp.array()),memory:t=>Z(`/api/agents/${encodeURIComponent(t)}/memory`,e,Jm),agentSkills:t=>Z(`/api/agents/${encodeURIComponent(t)}/skills`,e,cp.array()),history:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/history?limit=${n}`,e,pp),change:(t,n)=>Z(`/api/agents/${encodeURIComponent(t)}/history/${encodeURIComponent(n)}`,e,mp.array()),conflicts:t=>Z(`/api/agents/${encodeURIComponent(t)}/conflicts`,e,up.array()),dashboard:t=>Z(`/api/projects/${encodeURIComponent(t)}/dashboard`,e,_p),knowledge:t=>Z(t===`society`?`/api/society/knowledge`:`/api/projects/${encodeURIComponent(t)}/knowledge`,e,Km.array()),sendMessage:t=>Q(`post_message`,e,t,Lm),openThread:t=>Q(`open_thread`,e,t,Bm),closeThread:t=>Q(`close_thread`,e,t,Lm),approve:t=>Q(`approve`,e,t,Cp),reject:t=>Q(`reject`,e,t,Cp),advanceTask:t=>Q(`advance_task`,e,t,Wm),configureProject:(t,n)=>Q(`configure_project`,e,{project:t,...n},bf),createChannel:t=>Q(`create_channel`,e,t,G),archiveChannel:t=>Q(`archive_channel`,e,t,sf),removeKnowledge:t=>Q(`remove_knowledge`,e,t,gp),removeSkill:t=>Q(`remove_skill`,e,t,lp),wake:t=>eh(`POST`,`/api/wake`,e,t,jp),setPaused:t=>eh(`POST`,t?`/api/pause`:`/api/resume`,e,{},th),stopTurn:t=>eh(`POST`,`/api/turns/${encodeURIComponent(t)}/stop`,e,{},sh),agentModels:t=>Z(`/api/agents/${encodeURIComponent(t)}/models`,e,Rf),runners:()=>Z(`/api/runners`,e,Wf.array()),readQuota:(t,n)=>eh(`POST`,`/api/runners/${encodeURIComponent(t)}/quota/${n}`,e,{},Jd),enrollments:()=>Z(`/api/enrollments`,e,Bp.array()),approveEnrollment:(t,n)=>eh(`POST`,`/api/enrollments/${encodeURIComponent(t)}/approve`,e,{name:n},Wf),denyEnrollment:t=>eh(`POST`,`/api/enrollments/${encodeURIComponent(t)}/deny`,e,{},oh),setRunner:(t,n)=>eh(`PUT`,`/api/agents/${encodeURIComponent(t)}/runner`,e,{runner:n},ih),setModel:(t,n)=>eh(`PUT`,`/api/agents/${encodeURIComponent(t)}/model`,e,{model:n},ih),setEffort:(t,n)=>eh(`PUT`,`/api/agents/${encodeURIComponent(t)}/effort`,e,{effort:n},ih)}}var lh=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(lh);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function uh(){let{api:e}=$();return w({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function dh(){let{api:e}=$();return w({queryKey:[`server-version`],queryFn:e.version,staleTime:1/0})}function fh(){let{api:e}=$();return w({queryKey:[`me`],queryFn:e.me,staleTime:1/0})}function ph(){let{api:e}=$();return w({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function mh(){let{api:e}=$();return w({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function hh(){let{api:e}=$();return w({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function gh(){let{api:e}=$();return w({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function _h(){let{api:e}=$();return w({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function vh(e){let{api:t}=$();return w({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function yh(e){let{api:t}=$();return w({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function bh(e){let{api:t}=$();return w({queryKey:[`tokens`,e],queryFn:()=>t.tokens(e),refetchInterval:6e4})}function xh(){let{api:e}=$();return w({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function Sh(){let{api:e}=$();return w({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function Ch(e){let{api:t}=$();return w({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function wh(e){return e.flatMap(e=>e.data??[])}function Th(){let{api:e}=$();return lt({queries:(mh().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:wh})}function Eh(e){let{api:t}=$();return w({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function Dh(e){let{api:t}=$();return w({queryKey:[`thread`,e],queryFn:()=>t.thread(e??``),enabled:e!==null})}function Oh(e,t){let{api:n}=$();return w({queryKey:[`task-file`,e,t],queryFn:()=>n.taskFile(e,t),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof Mm&&(t.status===404||t.status===503))})}function kh(e){let{api:t}=$();return w({queryKey:[`image`,e],queryFn:()=>t.image(e),staleTime:1/0,retry:(e,t)=>e<1&&!(t instanceof Mm&&t.status>=400&&t.status<500)})}function Ah(e){let{api:t}=$();return w({queryKey:[`task-changes`,e],queryFn:()=>t.taskChanges(e),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof Mm&&(t.status===404||t.status===503))})}function jh(e,t){let{api:n}=$();return w({queryKey:[`task-diff`,e,t],queryFn:()=>n.taskDiff(e,t),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof Mm&&(t.status===404||t.status===503))})}function Mh(){let{api:e}=$();return w({queryKey:[`crons`],queryFn:e.crons,refetchInterval:6e4})}function Nh(){let{api:e}=$();return w({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function Ph(e){let{api:t}=$();return w({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function Fh(e,t){let{api:n}=$();return w({queryKey:[`proposal`,e,`files`],queryFn:()=>n.proposalFiles(e),enabled:t})}function Ih(){let{api:e}=$();return w({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function Lh(e){let{api:t}=$();return w({queryKey:[`skills`,e,`files`],queryFn:()=>t.skillFiles(e),staleTime:6e4,retry:(e,t)=>e<1&&!(t instanceof Mm&&t.status===404)})}function Rh(e,t){let{api:n}=$();return w({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function zh(e,t){let{api:n}=$();return w({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function Bh(e){let{api:t}=$();return w({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function Vh(e){let{api:t}=$();return w({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function Hh(e,t){let{api:n}=$();return w({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:_e})}function Uh(e,t,n){let{api:r}=$();return w({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function Wh(e){let{api:t}=$();return w({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function Gh(e){let{api:t}=$();return w({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:12e4})}function Kh(e){let{api:t}=$();return w({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function qh(){let{api:e}=$();return w({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function Jh(){let{api:e}=$();return w({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function Yh(e){let{api:t}=$();return w({queryKey:[`models`,`agent`,e],queryFn:()=>t.agentModels(e),staleTime:6e5,retry:!1})}function Xh(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Zh=[[`day`,86400],[`hour`,3600],[`minute`,60]],Qh=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function $h(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of Zh)if(Math.abs(n)>=t)return Qh.format(Math.round(n/t),e);return`just now`}function eg(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function tg(e,t=220){let n=(e.split(/\n\s*\n/).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))??``).replaceAll(/[*_`>]/g,``).replaceAll(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}export{ym as $,Wt as $t,$ as A,Ee as An,Qd as At,Dh as B,Se as Bn,nd as Bt,Fh as C,w as Cn,Sf as Ct,qh as D,je as Dn,Xd as Dt,hh as E,Fe as En,Nf as Et,Eh as F,ce as Fn,Ud as Ft,kh as G,d as Gn,R as Gt,bh as H,te as Hn,Qu as Ht,Ah as I,ae as In,Hd as It,km as J,l as Jn,F as Jt,Mm as K,o as Kn,B as Kt,jh as L,de as Ln,Vd as Lt,Lh as M,ue as Mn,Ad as Mt,Ih as N,le as Nn,Nd as Nt,gh as O,Ae as On,ef as Ot,uh as P,b as Pn,Bd as Pt,Dm as Q,qt as Qt,Oh as R,y as Rn,td as Rt,Ph as S,_t as Sn,af as St,_h as T,Ie as Tn,$f as Tt,zh as U,g as Un,Zu as Ut,Sh as V,be as Vn,W as Vt,Rh as W,p as Wn,z as Wt,Im as X,en as Xt,ch as Y,_n as Yt,Om as Z,Jt as Zt,ph as _,Dt as _n,of as _t,Yh as a,Mt as an,jp as at,Xh as b,gt as bn,Pf as bt,xh as c,At as cn,Ep as ct,Jh as d,yt as dn,tp as dt,jt as en,_m as et,Uh as f,kt as fn,Jf as ft,fh as g,pt as gn,ep as gt,Kh as h,mt as hn,Yf as ht,lh as i,Pt as in,Jp as it,vh as j,oe as jn,Dd as jt,dh as k,De as kn,Yd as kt,Mh as l,ht as ln,Dp as lt,Hh as m,Tt as mn,qf as mt,tg as n,Bt as nn,pm as nt,Vh as o,Nt as on,zp as ot,Wh as p,ft as pn,Xf as pt,jm as q,s as qn,xu as qt,eg as r,It as rn,fm as rt,Th as s,wt as sn,Np as st,$h as t,Lt as tn,dm as tt,Gh as u,Ot as un,tf as ut,Bh as v,bt as vn,np as vt,Nh as w,Be as wn,ap as wt,mh as x,Et as xn,sp as xt,yh as y,dt as yn,Zf as yt,Ch as z,pe as zn,rd as zt};
@@ -1 +1 @@
1
- import{Ct as e,Lt as t,Vt as n,_t as r,bt as i,dt as a,ft as o,ht as s,mt as c,pt as l,ut as u,wt as d}from"./format-DT52SbbR.js";import{s as f}from"./tasks-R3YgpYTe.js";var p=[{group:`yours`,label:`Waiting on you`},{group:`others`,label:`Waiting on others`},{group:`decided`,label:`Decided`}];function m(e){let t=i(e.kind,e.charter);return t.charAt(0).toUpperCase()+t.slice(1)}function h(t){return t.status===`proposed`&&t.proposedBy!==`user`&&e(t.kind,t.charter).includes(`user`)}function g(e){return e.status===`proposed`?h(e)?`yours`:`others`:`decided`}function _(e){return p.map(({group:t})=>{let n=e.filter(e=>g(e)===t);return{group:t,proposals:t===`decided`?n.toSorted((e,t)=>(t.decidedAt??t.createdAt).localeCompare(e.decidedAt??e.createdAt)):n.toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}}).filter(e=>e.proposals.length>0)}var v=new Intl.ListFormat(`en`,{type:`disjunction`});function y(t,n){let r=e(t.kind,t.charter).flatMap(e=>e===`user`?t.proposedBy===`user`?[]:[`you`]:[e===n?`another ${e}`:`the ${e}`]);return r.length===0?`nobody`:v.format(r)}function b(e){let n=t.safeParse(e.charter);return e.kind===`role`&&n.success?n.data:null}function x(e){return e===void 0?`unset`:typeof e==`boolean`?e?`yes`:`no`:Array.isArray(e)?e.length===0?`none`:e.join(`, `):typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e)}var S=[[`wakeTriggers`,`wake triggers`],[`maxReplicas`,`replicas per project`],[`backlogThreshold`,`backlog per member before scaling`],[`resident`,`warm session`],[`societyScope`,`society role`],[`reflects`,`reflects`],[`reviewDate`,`review date`]];function C(e,t){return{verbsAdded:t.verbs.filter(t=>!e.verbs.includes(t)),verbsRemoved:e.verbs.filter(e=>!t.verbs.includes(e)),purposeChanged:e.purpose.trim()!==t.purpose.trim(),changes:S.flatMap(([n,r])=>{let i=x(e[n]),a=x(t[n]);return i===a?[]:[{field:r,from:i,to:a}]})}}function w(e){return e.replace(/^\s*---\n[\s\S]*?\n---[ \t]*\n?/,``).trim()}function T(e,t){switch(e.kind){case`member`:{let t=l.safeParse(e.charter);if(!t.success)break;let{name:n,role:r,cli:i,memberships:a}=t.data;return`Creates the citizen ${n} (${r}, ${i})${a.length===0?``:` in ${a.join(`, `)}`} and starts its first turn.`}case`role`:{let n=b(e);if(n===null)break;if(!t.roles.some(e=>e.name===n.name))return`Adds the role ${n.name}; nobody holds it until a member proposal is approved.`;let r=t.members.filter(e=>e.role===n.name&&e.status===`active`).length;return r===0?`Rewrites the ${n.name} charter; no active member holds the role.`:`Rewrites the ${n.name} charter for ${r===1?`its member`:`its ${r} members`}, from their next turn.`}case`channel`:{let t=a.safeParse(e.charter);if(!t.success)break;return`Creates #${n(t.data.project,t.data.name)}.`}case`retirement`:{let t=s.safeParse(e.charter);if(!t.success)break;return`Retires ${t.data.agent}: its stages go back to open and its home is archived, not deleted.`}case`skill`:{let n=r.safeParse(e.charter);if(!n.success)break;return t.skills.some(e=>e.name===n.data.name)?`Replaces the society's ${n.data.name} skill with ${n.data.body===void 0?`these files`:`this text`}.`:`Publishes ${n.data.name} to the society's skills, which every citizen's instructions list.`}case`archive`:{let t=u.safeParse(e.charter);if(!t.success)break;return`Archives ${t.data.project}: its members leave, its open threads close, and it takes no more work; its channels, tasks, and history stay readable.`}case`reallocation`:{let n=c.safeParse(e.charter);if(!n.success){if(!o.safeParse(e.charter).success)break;return`Records the decision; a reallocation from before reallocations changed roles applies nothing.`}let r=t.roles.find(e=>e.name===n.data.role);if(r===void 0)return`No role ${n.data.role} exists; approving it will fail.`;let i=d(r,n.data.changes);if(i.length===0)return`The ${r.name} role has these values already; approving it will fail.`;let a=t.members.filter(e=>e.role===r.name&&e.status===`active`).length,s=a===0?`; no active member holds the role`:` for ${a===1?`its member`:`its ${a} members`}, from their next turn`;return`Changes the ${r.name} charter (${i.join(`; `)})${s}.`}}return`The charter does not parse as its kind; approving it will fail.`}function E(e){let t=f(e);if(t===`landing`||t===`done`||t===`abandoned`)return null;let n=e.stages.find(t=>t.id===e.stage);return n===void 0||n.agent!==`user`&&n.role!==`user`?null:e.status===`open`||e.claimedBy===`user`?n:null}function D(e){let t=(e,t)=>e.since.localeCompare(t.since),n=e.proposals.filter(h).map(e=>({kind:`proposal`,since:e.createdAt,proposal:e})),r=e.tasks.flatMap(e=>{let t=E(e);return t===null?[]:[{kind:`stage`,since:e.stageSince,task:e,stage:t}]}),i=e.requests.map(({message:e,thread:t})=>({kind:`request`,since:e.ts,message:e,thread:t}));return[...n.toSorted(t),...r.toSorted(t),...i.toSorted(t)]}export{D as a,C as c,h as d,_ as i,w as l,T as n,m as o,y as r,b as s,p as t,E as u};
1
+ import{Ht as e,Rt as t,Tt as n,dt as r,ft as i,gt as a,ht as o,mt as s,pt as c,vt as l,wt as u,xt as d}from"./format-CvfmDNoY.js";import{s as f}from"./tasks-CTaxXtGL.js";var p=[{group:`yours`,label:`Waiting on you`},{group:`others`,label:`Waiting on others`},{group:`decided`,label:`Decided`}];function m(e){let t=d(e.kind,e.charter);return t.charAt(0).toUpperCase()+t.slice(1)}function h(e){return e.status===`proposed`&&e.proposedBy!==`user`&&u(e.kind,e.charter).includes(`user`)}function g(e){return e.status===`proposed`?h(e)?`yours`:`others`:`decided`}function _(e){return p.map(({group:t})=>{let n=e.filter(e=>g(e)===t);return{group:t,proposals:t===`decided`?n.toSorted((e,t)=>(t.decidedAt??t.createdAt).localeCompare(e.decidedAt??e.createdAt)):n.toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}}).filter(e=>e.proposals.length>0)}var v=new Intl.ListFormat(`en`,{type:`disjunction`});function y(e,t){let n=u(e.kind,e.charter).flatMap(n=>n===`user`?e.proposedBy===`user`?[]:[`you`]:[n===t?`another ${n}`:`the ${n}`]);return n.length===0?`nobody`:v.format(n)}function b(e){let n=t.safeParse(e.charter);return e.kind===`role`&&n.success?n.data:null}function x(e){return e===void 0?`unset`:typeof e==`boolean`?e?`yes`:`no`:Array.isArray(e)?e.length===0?`none`:e.join(`, `):typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e)}var S=[[`wakeTriggers`,`wake triggers`],[`maxReplicas`,`replicas per project`],[`backlogThreshold`,`backlog per member before scaling`],[`resident`,`warm session`],[`societyScope`,`society role`],[`reflects`,`reflects`],[`reviewDate`,`review date`]];function C(e,t){return{verbsAdded:t.verbs.filter(t=>!e.verbs.includes(t)),verbsRemoved:e.verbs.filter(e=>!t.verbs.includes(e)),purposeChanged:e.purpose.trim()!==t.purpose.trim(),changes:S.flatMap(([n,r])=>{let i=x(e[n]),a=x(t[n]);return i===a?[]:[{field:r,from:i,to:a}]})}}function w(e){return e.replace(/^\s*---\n[\s\S]*?\n---[ \t]*\n?/,``).trim()}function T(t,u){switch(t.kind){case`member`:{let e=s.safeParse(t.charter);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`Creates the citizen ${n} (${r}, ${i})${a.length===0?``:` in ${a.join(`, `)}`} and starts its first turn.`}case`role`:{let e=b(t);if(e===null)break;if(!u.roles.some(t=>t.name===e.name))return`Adds the role ${e.name}; nobody holds it until a member proposal is approved.`;let n=u.members.filter(t=>t.role===e.name&&t.status===`active`).length;return n===0?`Rewrites the ${e.name} charter; no active member holds the role.`:`Rewrites the ${e.name} charter for ${n===1?`its member`:`its ${n} members`}, from their next turn.`}case`channel`:{let n=i.safeParse(t.charter);if(!n.success)break;return`Creates #${e(n.data.project,n.data.name)}.`}case`retirement`:{let e=a.safeParse(t.charter);if(!e.success)break;return`Retires ${e.data.agent}: its stages go back to open and its home is archived, not deleted.`}case`skill`:{let e=l.safeParse(t.charter);if(!e.success)break;return u.skills.some(t=>t.name===e.data.name)?`Replaces the society's ${e.data.name} skill with ${e.data.body===void 0?`these files`:`this text`}.`:`Publishes ${e.data.name} to the society's skills, which every citizen's instructions list.`}case`archive`:{let e=r.safeParse(t.charter);if(!e.success)break;return`Archives ${e.data.project}: its members leave, its open threads close, and it takes no more work; its channels, tasks, and history stay readable.`}case`reallocation`:{let e=o.safeParse(t.charter);if(!e.success){if(!c.safeParse(t.charter).success)break;return`Records the decision; a reallocation from before reallocations changed roles applies nothing.`}let r=u.roles.find(t=>t.name===e.data.role);if(r===void 0)return`No role ${e.data.role} exists; approving it will fail.`;let i=n(r,e.data.changes);if(i.length===0)return`The ${r.name} role has these values already; approving it will fail.`;let a=u.members.filter(e=>e.role===r.name&&e.status===`active`).length,s=a===0?`; no active member holds the role`:` for ${a===1?`its member`:`its ${a} members`}, from their next turn`;return`Changes the ${r.name} charter (${i.join(`; `)})${s}.`}}return`The charter does not parse as its kind; approving it will fail.`}function E(e){let t=f(e);if(t===`landing`||t===`done`||t===`abandoned`)return null;let n=e.stages.find(t=>t.id===e.stage);return n===void 0||n.agent!==`user`&&n.role!==`user`?null:e.status===`open`||e.claimedBy===`user`?n:null}function D(e){let t=(e,t)=>e.since.localeCompare(t.since),n=e.proposals.filter(h).map(e=>({kind:`proposal`,since:e.createdAt,proposal:e})),r=e.tasks.flatMap(e=>{let t=E(e);return t===null?[]:[{kind:`stage`,since:e.stageSince,task:e,stage:t}]}),i=e.requests.map(({message:e,thread:t})=>({kind:`request`,since:e.ts,message:e,thread:t}));return[...n.toSorted(t),...r.toSorted(t),...i.toSorted(t)]}export{D as a,C as c,h as d,_ as i,w as l,T as n,m as o,y as r,b as s,p as t,E as u};