From 447e4bded997fa1833e035fe6b1b91107fa9b88f Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 17 Jul 2025 22:12:06 +0900 Subject: [PATCH] update --- .github/workflows/cloudflare-pages.yml | 11 + Cargo.toml | 2 +- my-blog/static/pds/assets/index-BH2xHPKq.css | 1 + my-blog/static/pds/assets/index-nqqvPufZ.js | 57 ++ my-blog/static/pds/index.html | 13 + my-blog/templates/at-browser-assets.html | 61 ++ my-blog/templates/base.html | 1 + my-blog/templates/pds.html | 774 +++++++++++++++++++ oauth/package.json | 2 +- pds/index.html | 12 + pds/package.json | 27 + pds/src/App.css | 128 +++ pds/src/App.jsx | 62 ++ pds/src/components/AtUriBrowser.jsx | 75 ++ pds/src/components/AtUriJson.jsx | 130 ++++ pds/src/components/AtUriModal.jsx | 80 ++ pds/src/components/AtUriViewer.jsx | 111 +++ pds/src/config.js | 33 + pds/src/index.js | 9 + pds/src/lib/atproto.js | 165 ++++ pds/src/main.jsx | 9 + pds/vite.config.js | 10 + scpt/run.zsh | 22 + src/commands/serve.rs | 41 +- src/generator.rs | 28 + 25 files changed, 1858 insertions(+), 6 deletions(-) create mode 100644 my-blog/static/pds/assets/index-BH2xHPKq.css create mode 100644 my-blog/static/pds/assets/index-nqqvPufZ.js create mode 100644 my-blog/static/pds/index.html create mode 100644 my-blog/templates/at-browser-assets.html create mode 100644 my-blog/templates/pds.html create mode 100644 pds/index.html create mode 100644 pds/package.json create mode 100644 pds/src/App.css create mode 100644 pds/src/App.jsx create mode 100644 pds/src/components/AtUriBrowser.jsx create mode 100644 pds/src/components/AtUriJson.jsx create mode 100644 pds/src/components/AtUriModal.jsx create mode 100644 pds/src/components/AtUriViewer.jsx create mode 100644 pds/src/config.js create mode 100644 pds/src/index.js create mode 100644 pds/src/lib/atproto.js create mode 100644 pds/src/main.jsx create mode 100644 pds/vite.config.js diff --git a/.github/workflows/cloudflare-pages.yml b/.github/workflows/cloudflare-pages.yml index fe82337..2865f45 100644 --- a/.github/workflows/cloudflare-pages.yml +++ b/.github/workflows/cloudflare-pages.yml @@ -40,6 +40,17 @@ jobs: rm -rf my-blog/static/assets cp -rf ${{ env.OAUTH_DIR }}/dist/* my-blog/static/ cp ${{ env.OAUTH_DIR }}/dist/index.html my-blog/templates/oauth-assets.html + + - name: Build PDS app + run: | + cd pds + npm install + npm run build + + - name: Copy PDS build to static + run: | + rm -rf my-blog/static/pds + cp -rf pds/dist my-blog/static/pds - name: Cache ailog binary uses: actions/cache@v4 diff --git a/Cargo.toml b/Cargo.toml index d294a3f..fe1dbc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ailog" -version = "0.2.9" +version = "0.3.0" edition = "2021" authors = ["syui"] description = "A static blog generator with AI features" diff --git a/my-blog/static/pds/assets/index-BH2xHPKq.css b/my-blog/static/pds/assets/index-BH2xHPKq.css new file mode 100644 index 0000000..415162c --- /dev/null +++ b/my-blog/static/pds/assets/index-BH2xHPKq.css @@ -0,0 +1 @@ +body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;margin:0;padding:20px;background-color:#f5f5f5;line-height:1.6}.container{max-width:1200px;margin:0 auto;background:#fff;padding:30px;border-radius:10px;box-shadow:0 2px 10px #0000001a}h1{color:#333;margin-bottom:30px;border-bottom:3px solid #007acc;padding-bottom:10px}.test-section{margin-bottom:30px;padding:20px;background:#f8f9fa;border-radius:8px;border-left:4px solid #007acc}.test-uris{background:#fff;padding:15px;border-radius:5px;border:1px solid #ddd;margin:15px 0}.at-uri{font-family:Monaco,Consolas,monospace;background:#f4f4f4;padding:8px 12px;border-radius:4px;margin:10px 0;display:block;word-break:break-all;cursor:pointer;transition:background-color .2s}.at-uri:hover{background:#e8e8e8}.instructions{background:#e8f4f8;padding:15px;border-radius:5px;margin:15px 0}.instructions ol{margin:10px 0;padding-left:20px}.back-link{display:inline-block;margin-top:20px;color:#007acc;text-decoration:none;font-weight:700}.back-link:hover{text-decoration:underline}.at-uri-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.at-uri-modal-content{background-color:#fff;border-radius:8px;max-width:800px;max-height:600px;width:90%;height:80%;overflow:auto;position:relative;box-shadow:0 4px 6px #0000001a}.at-uri-modal-close{position:absolute;top:10px;right:10px;background:none;border:none;font-size:20px;cursor:pointer;z-index:1001;padding:5px 10px}[data-at-uri]{color:#1976d2;cursor:pointer;text-decoration:underline}[data-at-uri]:hover{color:#1565c0} diff --git a/my-blog/static/pds/assets/index-nqqvPufZ.js b/my-blog/static/pds/assets/index-nqqvPufZ.js new file mode 100644 index 0000000..515c299 --- /dev/null +++ b/my-blog/static/pds/assets/index-nqqvPufZ.js @@ -0,0 +1,57 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Fb(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var qb={exports:{}},_u={},Gb={exports:{}},Y={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fa=Symbol.for("react.element"),Vw=Symbol.for("react.portal"),Ow=Symbol.for("react.fragment"),Nw=Symbol.for("react.strict_mode"),Mw=Symbol.for("react.profiler"),$w=Symbol.for("react.provider"),zw=Symbol.for("react.context"),Fw=Symbol.for("react.forward_ref"),qw=Symbol.for("react.suspense"),Gw=Symbol.for("react.memo"),Xw=Symbol.for("react.lazy"),vh=Symbol.iterator;function Hw(t){return t===null||typeof t!="object"?null:(t=vh&&t[vh]||t["@@iterator"],typeof t=="function"?t:null)}var Xb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Hb=Object.assign,Zb={};function po(t,e,r){this.props=t,this.context=e,this.refs=Zb,this.updater=r||Xb}po.prototype.isReactComponent={};po.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};po.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Wb(){}Wb.prototype=po.prototype;function vp(t,e,r){this.props=t,this.context=e,this.refs=Zb,this.updater=r||Xb}var Rp=vp.prototype=new Wb;Rp.constructor=vp;Hb(Rp,po.prototype);Rp.isPureReactComponent=!0;var Rh=Array.isArray,Qb=Object.prototype.hasOwnProperty,Ap={current:null},Jb={key:!0,ref:!0,__self:!0,__source:!0};function Yb(t,e,r){var n,i={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)Qb.call(e,n)&&!Jb.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,Se=M[xe];if(0>>1;xei(Pc,Q))Jni(Ga,Pc)?(M[xe]=Ga,M[Jn]=Q,xe=Jn):(M[xe]=Pc,M[Qn]=Q,xe=Qn);else if(Jni(Ga,Q))M[xe]=Ga,M[Jn]=Q,xe=Jn;else break e}}return Z}function i(M,Z){var Q=M.sortIndex-Z.sortIndex;return Q!==0?Q:M.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var u=[],c=[],p=1,f=null,b=3,E=!1,x=!1,w=!1,T=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var Z=r(c);Z!==null;){if(Z.callback===null)n(c);else if(Z.startTime<=M)n(c),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=r(c)}}function A(M){if(w=!1,g(M),!x)if(r(u)!==null)x=!0,Lc(C);else{var Z=r(c);Z!==null&&Dc(A,Z.startTime-M)}}function C(M,Z){x=!1,w&&(w=!1,m(K),K=-1),E=!0;var Q=b;try{for(g(Z),f=r(u);f!==null&&(!(f.expirationTime>Z)||M&&!jt());){var xe=f.callback;if(typeof xe=="function"){f.callback=null,b=f.priorityLevel;var Se=xe(f.expirationTime<=Z);Z=t.unstable_now(),typeof Se=="function"?f.callback=Se:f===r(u)&&n(u),g(Z)}else n(u);f=r(u)}if(f!==null)var qa=!0;else{var Qn=r(c);Qn!==null&&Dc(A,Qn.startTime-Z),qa=!1}return qa}finally{f=null,b=Q,E=!1}}var L=!1,D=null,K=-1,ie=5,re=-1;function jt(){return!(t.unstable_now()-reM||125xe?(M.sortIndex=Q,e(c,M),r(u)===null&&M===r(c)&&(w?(m(K),K=-1):w=!0,Dc(A,Q-xe))):(M.sortIndex=Se,e(u,M),x||E||(x=!0,Lc(C))),M},t.unstable_shouldYield=jt,t.unstable_wrapCallback=function(M){var Z=b;return function(){var Q=b;b=Z;try{return M.apply(this,arguments)}finally{b=Q}}}})(ig);ng.exports=ig;var s_=ng.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var a_=or,ht=s_;function k(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bd=Object.prototype.hasOwnProperty,l_=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wh={},_h={};function u_(t){return bd.call(_h,t)?!0:bd.call(wh,t)?!1:l_.test(t)?_h[t]=!0:(wh[t]=!0,!1)}function c_(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function d_(t,e,r,n){if(e===null||typeof e>"u"||c_(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ye(t,e,r,n,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var Ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ie[t]=new Ye(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ie[e]=new Ye(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ie[t]=new Ye(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ie[t]=new Ye(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ie[t]=new Ye(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ie[t]=new Ye(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ie[t]=new Ye(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ie[t]=new Ye(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ie[t]=new Ye(t,5,!1,t.toLowerCase(),null,!1,!1)});var _p=/[\-:]([a-z])/g;function Sp(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(_p,Sp);Ie[e]=new Ye(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(_p,Sp);Ie[e]=new Ye(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(_p,Sp);Ie[e]=new Ye(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ie[t]=new Ye(t,1,!1,t.toLowerCase(),null,!1,!1)});Ie.xlinkHref=new Ye("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ie[t]=new Ye(t,1,!1,t.toLowerCase(),null,!0,!0)});function Tp(t,e,r,n){var i=Ie.hasOwnProperty(e)?Ie[e]:null;(i!==null?i.type!==0:n||!(2l||i[a]!==s[l]){var u=` +`+i[a].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=a&&0<=l);break}}}finally{Ic=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Es(t):""}function p_(t){switch(t.tag){case 5:return Es(t.type);case 16:return Es("Lazy");case 13:return Es("Suspense");case 19:return Es("SuspenseList");case 0:case 2:case 15:return t=jc(t.type,!1),t;case 11:return t=jc(t.type.render,!1),t;case 1:return t=jc(t.type,!0),t;default:return""}}function vd(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Bi:return"Fragment";case Pi:return"Portal";case gd:return"Profiler";case Cp:return"StrictMode";case Ed:return"Suspense";case xd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ag:return(t.displayName||"Context")+".Consumer";case sg:return(t._context.displayName||"Context")+".Provider";case kp:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Lp:return e=t.displayName||null,e!==null?e:vd(t.type)||"Memo";case en:e=t._payload,t=t._init;try{return vd(t(e))}catch{}}return null}function f_(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vd(e);case 8:return e===Cp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function En(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ug(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function y_(t){var e=ug(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Za(t){t._valueTracker||(t._valueTracker=y_(t))}function cg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=ug(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Ul(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Rd(t,e){var r=e.checked;return be({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Th(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=En(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dg(t,e){e=e.checked,e!=null&&Tp(t,"checked",e,!1)}function Ad(t,e){dg(t,e);var r=En(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?wd(t,e.type,r):e.hasOwnProperty("defaultValue")&&wd(t,e.type,En(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ch(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function wd(t,e,r){(e!=="number"||Ul(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var xs=Array.isArray;function Fi(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Wa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function js(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var As={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},m_=["Webkit","ms","Moz","O"];Object.keys(As).forEach(function(t){m_.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),As[e]=As[t]})});function mg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||As.hasOwnProperty(t)&&As[t]?(""+e).trim():e+"px"}function hg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=mg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var h_=be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Td(t,e){if(e){if(h_[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(k(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(k(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(k(61))}if(e.style!=null&&typeof e.style!="object")throw Error(k(62))}}function Cd(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kd=null;function Dp(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ld=null,qi=null,Gi=null;function Dh(t){if(t=ha(t)){if(typeof Ld!="function")throw Error(k(280));var e=t.stateNode;e&&(e=Lu(e),Ld(t.stateNode,t.type,e))}}function bg(t){qi?Gi?Gi.push(t):Gi=[t]:qi=t}function gg(){if(qi){var t=qi,e=Gi;if(Gi=qi=null,Dh(t),e)for(t=0;t>>=0,t===0?32:31-(T_(t)/C_|0)|0}var Qa=64,Ja=4194304;function vs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Vl(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,a=r&268435455;if(a!==0){var l=a&~i;l!==0?n=vs(l):(s&=a,s!==0&&(n=vs(s)))}else a=r&~i,a!==0?n=vs(a):s!==0&&(n=vs(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function ya(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Gt(e),t[e]=r}function P_(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=_s),Nh=" ",Mh=!1;function Vg(t,e){switch(t){case"keyup":return sS.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Og(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ui=!1;function lS(t,e){switch(t){case"compositionend":return Og(e);case"keypress":return e.which!==32?null:(Mh=!0,Nh);case"textInput":return t=e.data,t===Nh&&Mh?null:t;default:return null}}function uS(t,e){if(Ui)return t==="compositionend"||!Op&&Vg(t,e)?(t=jg(),Al=jp=sn=null,Ui=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=qh(r)}}function zg(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?zg(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Fg(){for(var t=window,e=Ul();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Ul(t.document)}return e}function Np(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function gS(t){var e=Fg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&zg(r.ownerDocument.documentElement,r)){if(n!==null&&Np(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=Gh(r,s);var a=Gh(r,n);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ii=null,jd=null,Ts=null,Kd=!1;function Xh(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Kd||Ii==null||Ii!==Ul(n)||(n=Ii,"selectionStart"in n&&Np(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ts&&$s(Ts,n)||(Ts=n,n=Ml(jd,"onSelect"),0Vi||(t.current=zd[Vi],zd[Vi]=null,Vi--)}function ae(t,e){Vi++,zd[Vi]=t.current,t.current=e}var xn={},Fe=Vn(xn),at=Vn(!1),di=xn;function Ji(t,e){var r=t.type.contextTypes;if(!r)return xn;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function lt(t){return t=t.childContextTypes,t!=null}function zl(){ce(at),ce(Fe)}function e0(t,e,r){if(Fe.current!==xn)throw Error(k(168));ae(Fe,e),ae(at,r)}function Yg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(k(108,f_(t)||"Unknown",i));return be({},r,n)}function Fl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xn,di=Fe.current,ae(Fe,t),ae(at,at.current),!0}function t0(t,e,r){var n=t.stateNode;if(!n)throw Error(k(169));r?(t=Yg(t,e,di),n.__reactInternalMemoizedMergedChildContext=t,ce(at),ce(Fe),ae(Fe,t)):ce(at),ae(at,r)}var Pr=null,Du=!1,Wc=!1;function eE(t){Pr===null?Pr=[t]:Pr.push(t)}function LS(t){Du=!0,eE(t)}function On(){if(!Wc&&Pr!==null){Wc=!0;var t=0,e=oe;try{var r=Pr;for(oe=1;t>=a,i-=a,jr=1<<32-Gt(e)+i|r<K?(ie=D,D=null):ie=D.sibling;var re=b(m,D,g[K],A);if(re===null){D===null&&(D=ie);break}t&&D&&re.alternate===null&&e(m,D),y=s(re,y,K),L===null?C=re:L.sibling=re,L=re,D=ie}if(K===g.length)return r(m,D),pe&&ti(m,K),C;if(D===null){for(;KK?(ie=D,D=null):ie=D.sibling;var jt=b(m,D,re.value,A);if(jt===null){D===null&&(D=ie);break}t&&D&&jt.alternate===null&&e(m,D),y=s(jt,y,K),L===null?C=jt:L.sibling=jt,L=jt,D=ie}if(re.done)return r(m,D),pe&&ti(m,K),C;if(D===null){for(;!re.done;K++,re=g.next())re=f(m,re.value,A),re!==null&&(y=s(re,y,K),L===null?C=re:L.sibling=re,L=re);return pe&&ti(m,K),C}for(D=n(m,D);!re.done;K++,re=g.next())re=E(D,m,K,re.value,A),re!==null&&(t&&re.alternate!==null&&D.delete(re.key===null?K:re.key),y=s(re,y,K),L===null?C=re:L.sibling=re,L=re);return t&&D.forEach(function(ss){return e(m,ss)}),pe&&ti(m,K),C}function T(m,y,g,A){if(typeof g=="object"&&g!==null&&g.type===Bi&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Ha:e:{for(var C=g.key,L=y;L!==null;){if(L.key===C){if(C=g.type,C===Bi){if(L.tag===7){r(m,L.sibling),y=i(L,g.props.children),y.return=m,m=y;break e}}else if(L.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===en&&i0(C)===L.type){r(m,L.sibling),y=i(L,g.props),y.ref=fs(m,L,g),y.return=m,m=y;break e}r(m,L);break}else e(m,L);L=L.sibling}g.type===Bi?(y=ui(g.props.children,m.mode,A,g.key),y.return=m,m=y):(A=Dl(g.type,g.key,g.props,null,m.mode,A),A.ref=fs(m,y,g),A.return=m,m=A)}return a(m);case Pi:e:{for(L=g.key;y!==null;){if(y.key===L)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){r(m,y.sibling),y=i(y,g.children||[]),y.return=m,m=y;break e}else{r(m,y);break}else e(m,y);y=y.sibling}y=id(g,m.mode,A),y.return=m,m=y}return a(m);case en:return L=g._init,T(m,y,L(g._payload),A)}if(xs(g))return x(m,y,g,A);if(ls(g))return w(m,y,g,A);ol(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(r(m,y.sibling),y=i(y,g),y.return=m,m=y):(r(m,y),y=nd(g,m.mode,A),y.return=m,m=y),a(m)):r(m,y)}return T}var eo=iE(!0),oE=iE(!1),Xl=Vn(null),Hl=null,Mi=null,Fp=null;function qp(){Fp=Mi=Hl=null}function Gp(t){var e=Xl.current;ce(Xl),t._currentValue=e}function Gd(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Hi(t,e){Hl=t,Fp=Mi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(st=!0),t.firstContext=null)}function Ct(t){var e=t._currentValue;if(Fp!==t)if(t={context:t,memoizedValue:e,next:null},Mi===null){if(Hl===null)throw Error(k(308));Mi=t,Hl.dependencies={lanes:0,firstContext:t}}else Mi=Mi.next=t;return e}var si=null;function Xp(t){si===null?si=[t]:si.push(t)}function sE(t,e,r,n){var i=e.interleaved;return i===null?(r.next=r,Xp(e)):(r.next=i.next,i.next=r),e.interleaved=r,Gr(t,n)}function Gr(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var tn=!1;function Hp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function aE(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Vr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function fn(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,ne&2){var i=n.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),n.pending=e,Gr(t,r)}return i=n.interleaved,i===null?(e.next=e,Xp(n)):(e.next=i.next,i.next=e),n.interleaved=e,Gr(t,r)}function _l(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Bp(t,r)}}function o0(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=a:s=s.next=a,r=r.next}while(r!==null);s===null?i=s=e:s=s.next=e}else i=s=e;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function Zl(t,e,r,n){var i=t.updateQueue;tn=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var u=l,c=u.next;u.next=null,a===null?s=c:a.next=c,a=u;var p=t.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==a&&(l===null?p.firstBaseUpdate=c:l.next=c,p.lastBaseUpdate=u))}if(s!==null){var f=i.baseState;a=0,p=c=u=null,l=s;do{var b=l.lane,E=l.eventTime;if((n&b)===b){p!==null&&(p=p.next={eventTime:E,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=t,w=l;switch(b=e,E=r,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(E,f,b);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,b=typeof x=="function"?x.call(E,f,b):x,b==null)break e;f=be({},f,b);break e;case 2:tn=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,b=i.effects,b===null?i.effects=[l]:b.push(l))}else E={eventTime:E,lane:b,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(c=p=E,u=f):p=p.next=E,a|=b;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;b=l,l=b.next,b.next=null,i.lastBaseUpdate=b,i.shared.pending=null}}while(!0);if(p===null&&(u=f),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=p,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);yi|=a,t.lanes=a,t.memoizedState=f}}function s0(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;er?r:4,t(!0);var n=Jc.transition;Jc.transition={};try{t(!1),e()}finally{oe=r,Jc.transition=n}}function wE(){return kt().memoizedState}function US(t,e,r){var n=mn(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},_E(t))SE(e,r);else if(r=sE(t,e,r,n),r!==null){var i=Qe();Xt(r,t,n,i),TE(r,e,n)}}function IS(t,e,r){var n=mn(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(_E(t))SE(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,l=s(a,r);if(i.hasEagerState=!0,i.eagerState=l,Zt(l,a)){var u=e.interleaved;u===null?(i.next=i,Xp(e)):(i.next=u.next,u.next=i),e.interleaved=i;return}}catch{}finally{}r=sE(t,e,i,n),r!==null&&(i=Qe(),Xt(r,t,n,i),TE(r,e,n))}}function _E(t){var e=t.alternate;return t===he||e!==null&&e===he}function SE(t,e){Cs=Ql=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function TE(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Bp(t,r)}}var Jl={readContext:Ct,useCallback:Ke,useContext:Ke,useEffect:Ke,useImperativeHandle:Ke,useInsertionEffect:Ke,useLayoutEffect:Ke,useMemo:Ke,useReducer:Ke,useRef:Ke,useState:Ke,useDebugValue:Ke,useDeferredValue:Ke,useTransition:Ke,useMutableSource:Ke,useSyncExternalStore:Ke,useId:Ke,unstable_isNewReconciler:!1},jS={readContext:Ct,useCallback:function(t,e){return nr().memoizedState=[t,e===void 0?null:e],t},useContext:Ct,useEffect:l0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Tl(4194308,4,EE.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Tl(4194308,4,t,e)},useInsertionEffect:function(t,e){return Tl(4,2,t,e)},useMemo:function(t,e){var r=nr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=nr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=US.bind(null,he,t),[n.memoizedState,t]},useRef:function(t){var e=nr();return t={current:t},e.memoizedState=t},useState:a0,useDebugValue:rf,useDeferredValue:function(t){return nr().memoizedState=t},useTransition:function(){var t=a0(!1),e=t[0];return t=BS.bind(null,t[1]),nr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=he,i=nr();if(pe){if(r===void 0)throw Error(k(407));r=r()}else{if(r=e(),ke===null)throw Error(k(349));fi&30||dE(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,l0(fE.bind(null,n,s,t),[t]),n.flags|=2048,Ws(9,pE.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=nr(),e=ke.identifierPrefix;if(pe){var r=Kr,n=jr;r=(n&~(1<<32-Gt(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Hs++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[ir]=e,t[qs]=n,KE(t,e,!1,!1),e.stateNode=t;e:{switch(a=Cd(r,n),r){case"dialog":le("cancel",t),le("close",t),i=n;break;case"iframe":case"object":case"embed":le("load",t),i=n;break;case"video":case"audio":for(i=0;ino&&(e.flags|=128,n=!0,ys(s,!1),e.lanes=4194304)}else{if(!n)if(t=Wl(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),ys(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!pe)return Ve(e),null}else 2*ve()-s.renderingStartTime>no&&r!==1073741824&&(e.flags|=128,n=!0,ys(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(r=s.last,r!==null?r.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ve(),e.sibling=null,r=me.current,ae(me,n?r&1|2:r&1),e):(Ve(e),null);case 22:case 23:return uf(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?pt&1073741824&&(Ve(e),e.subtreeFlags&6&&(e.flags|=8192)):Ve(e),null;case 24:return null;case 25:return null}throw Error(k(156,e.tag))}function FS(t,e){switch($p(e),e.tag){case 1:return lt(e.type)&&zl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return to(),ce(at),ce(Fe),Qp(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Wp(e),null;case 13:if(ce(me),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(k(340));Yi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ce(me),null;case 4:return to(),null;case 10:return Gp(e.type._context),null;case 22:case 23:return uf(),null;case 24:return null;default:return null}}var al=!1,ze=!1,qS=typeof WeakSet=="function"?WeakSet:Set,V=null;function $i(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ge(t,e,n)}else r.current=null}function tp(t,e,r){try{r()}catch(n){ge(t,e,n)}}var E0=!1;function GS(t,e){if(Vd=Ol,t=Fg(),Np(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var a=0,l=-1,u=-1,c=0,p=0,f=t,b=null;t:for(;;){for(var E;f!==r||i!==0&&f.nodeType!==3||(l=a+i),f!==s||n!==0&&f.nodeType!==3||(u=a+n),f.nodeType===3&&(a+=f.nodeValue.length),(E=f.firstChild)!==null;)b=f,f=E;for(;;){if(f===t)break t;if(b===r&&++c===i&&(l=a),b===s&&++p===n&&(u=a),(E=f.nextSibling)!==null)break;f=b,b=f.parentNode}f=E}r=l===-1||u===-1?null:{start:l,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(Od={focusedElem:t,selectionRange:r},Ol=!1,V=e;V!==null;)if(e=V,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,V=t;else for(;V!==null;){e=V;try{var x=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,T=x.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?w:Nt(e.type,w),T);m.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=e.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(k(163))}}catch(A){ge(e,e.return,A)}if(t=e.sibling,t!==null){t.return=e.return,V=t;break}V=e.return}return x=E0,E0=!1,x}function ks(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&tp(e,r,s)}i=i.next}while(i!==n)}}function Uu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function rp(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function NE(t){var e=t.alternate;e!==null&&(t.alternate=null,NE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ir],delete e[qs],delete e[$d],delete e[CS],delete e[kS])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function ME(t){return t.tag===5||t.tag===3||t.tag===4}function x0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ME(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function np(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=$l));else if(n!==4&&(t=t.child,t!==null))for(np(t,e,r),t=t.sibling;t!==null;)np(t,e,r),t=t.sibling}function ip(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(ip(t,e,r),t=t.sibling;t!==null;)ip(t,e,r),t=t.sibling}var Be=null,Mt=!1;function Qr(t,e,r){for(r=r.child;r!==null;)$E(t,e,r),r=r.sibling}function $E(t,e,r){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(Su,r)}catch{}switch(r.tag){case 5:ze||$i(r,e);case 6:var n=Be,i=Mt;Be=null,Qr(t,e,r),Be=n,Mt=i,Be!==null&&(Mt?(t=Be,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Be.removeChild(r.stateNode));break;case 18:Be!==null&&(Mt?(t=Be,r=r.stateNode,t.nodeType===8?Zc(t.parentNode,r):t.nodeType===1&&Zc(t,r),Ns(t)):Zc(Be,r.stateNode));break;case 4:n=Be,i=Mt,Be=r.stateNode.containerInfo,Mt=!0,Qr(t,e,r),Be=n,Mt=i;break;case 0:case 11:case 14:case 15:if(!ze&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&tp(r,e,a),i=i.next}while(i!==n)}Qr(t,e,r);break;case 1:if(!ze&&($i(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ge(r,e,l)}Qr(t,e,r);break;case 21:Qr(t,e,r);break;case 22:r.mode&1?(ze=(n=ze)||r.memoizedState!==null,Qr(t,e,r),ze=n):Qr(t,e,r);break;default:Qr(t,e,r)}}function v0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new qS),e.forEach(function(n){var i=tT.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Kt(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=a),n&=~s}if(n=i,n=ve()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*HS(n/1960))-n,10t?16:t,an===null)var n=!1;else{if(t=an,an=null,tu=0,ne&6)throw Error(k(331));var i=ne;for(ne|=4,V=t.current;V!==null;){var s=V,a=s.child;if(V.flags&16){var l=s.deletions;if(l!==null){for(var u=0;uve()-af?li(t,0):sf|=r),ut(t,e)}function WE(t,e){e===0&&(t.mode&1?(e=Ja,Ja<<=1,!(Ja&130023424)&&(Ja=4194304)):e=1);var r=Qe();t=Gr(t,e),t!==null&&(ya(t,e,r),ut(t,r))}function eT(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),WE(t,r)}function tT(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(k(314))}n!==null&&n.delete(e),WE(t,r)}var QE;QE=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||at.current)st=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return st=!1,$S(t,e,r);st=!!(t.flags&131072)}else st=!1,pe&&e.flags&1048576&&tE(e,Gl,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Cl(t,e),t=e.pendingProps;var i=Ji(e,Fe.current);Hi(e,r),i=Yp(null,e,n,t,i,r);var s=ef();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,lt(n)?(s=!0,Fl(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Hp(e),i.updater=Bu,e.stateNode=i,i._reactInternals=e,Hd(e,n,t,r),e=Qd(null,e,n,!0,s,r)):(e.tag=0,pe&&s&&Mp(e),Ze(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Cl(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=nT(n),t=Nt(n,t),i){case 0:e=Wd(null,e,n,t,r);break e;case 1:e=h0(null,e,n,t,r);break e;case 11:e=y0(null,e,n,t,r);break e;case 14:e=m0(null,e,n,Nt(n.type,t),r);break e}throw Error(k(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Nt(n,i),Wd(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Nt(n,i),h0(t,e,n,i,r);case 3:e:{if(UE(e),t===null)throw Error(k(387));n=e.pendingProps,s=e.memoizedState,i=s.element,aE(t,e),Zl(e,n,null,r);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ro(Error(k(423)),e),e=b0(t,e,n,r,i);break e}else if(n!==i){i=ro(Error(k(424)),e),e=b0(t,e,n,r,i);break e}else for(yt=pn(e.stateNode.containerInfo.firstChild),mt=e,pe=!0,$t=null,r=oE(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Yi(),n===i){e=Xr(t,e,r);break e}Ze(t,e,n,r)}e=e.child}return e;case 5:return lE(e),t===null&&qd(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,Nd(n,i)?a=null:s!==null&&Nd(n,s)&&(e.flags|=32),BE(t,e),Ze(t,e,a,r),e.child;case 6:return t===null&&qd(e),null;case 13:return IE(t,e,r);case 4:return Zp(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=eo(e,null,n,r):Ze(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Nt(n,i),y0(t,e,n,i,r);case 7:return Ze(t,e,e.pendingProps,r),e.child;case 8:return Ze(t,e,e.pendingProps.children,r),e.child;case 12:return Ze(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,ae(Xl,n._currentValue),n._currentValue=a,s!==null)if(Zt(s.value,a)){if(s.children===i.children&&!at.current){e=Xr(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var u=l.firstContext;u!==null;){if(u.context===n){if(s.tag===1){u=Vr(-1,r&-r),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?u.next=u:(u.next=p.next,p.next=u),c.pending=u}}s.lanes|=r,u=s.alternate,u!==null&&(u.lanes|=r),Gd(s.return,r,e),l.lanes|=r;break}u=u.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(k(341));a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),Gd(a,r,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Ze(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Hi(e,r),i=Ct(i),n=n(i),e.flags|=1,Ze(t,e,n,r),e.child;case 14:return n=e.type,i=Nt(n,e.pendingProps),i=Nt(n.type,i),m0(t,e,n,i,r);case 15:return DE(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Nt(n,i),Cl(t,e),e.tag=1,lt(n)?(t=!0,Fl(e)):t=!1,Hi(e,r),CE(e,n,i),Hd(e,n,i,r),Qd(null,e,n,!0,t,r);case 19:return jE(t,e,r);case 22:return PE(t,e,r)}throw Error(k(156,e.tag))};function JE(t,e){return _g(t,e)}function rT(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rt(t,e,r,n){return new rT(t,e,r,n)}function df(t){return t=t.prototype,!(!t||!t.isReactComponent)}function nT(t){if(typeof t=="function")return df(t)?1:0;if(t!=null){if(t=t.$$typeof,t===kp)return 11;if(t===Lp)return 14}return 2}function hn(t,e){var r=t.alternate;return r===null?(r=Rt(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Dl(t,e,r,n,i,s){var a=2;if(n=t,typeof t=="function")df(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Bi:return ui(r.children,i,s,e);case Cp:a=8,i|=8;break;case gd:return t=Rt(12,r,e,i|2),t.elementType=gd,t.lanes=s,t;case Ed:return t=Rt(13,r,e,i),t.elementType=Ed,t.lanes=s,t;case xd:return t=Rt(19,r,e,i),t.elementType=xd,t.lanes=s,t;case lg:return ju(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case sg:a=10;break e;case ag:a=9;break e;case kp:a=11;break e;case Lp:a=14;break e;case en:a=16,n=null;break e}throw Error(k(130,t==null?t:typeof t,""))}return e=Rt(a,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function ui(t,e,r,n){return t=Rt(7,t,n,e),t.lanes=r,t}function ju(t,e,r,n){return t=Rt(22,t,n,e),t.elementType=lg,t.lanes=r,t.stateNode={isHidden:!1},t}function nd(t,e,r){return t=Rt(6,t,null,e),t.lanes=r,t}function id(t,e,r){return e=Rt(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function iT(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vc(0),this.expirationTimes=Vc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function pf(t,e,r,n,i,s,a,l,u){return t=new iT(t,e,r,l,u),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Rt(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hp(s),t}function oT(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rx)}catch(t){console.error(t)}}rx(),rg.exports=bt;var cT=rg.exports,k0=cT;hd.createRoot=k0.createRoot,hd.hydrateRoot=k0.hydrateRoot;var nx={},hi={},Nn={},Jt={},up={},Mn={},Mu={},ur={},ga={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var e;(function(i){i.assertEqual=u=>{};function s(u){}i.assertIs=s;function a(u){throw new Error}i.assertNever=a,i.arrayToEnum=u=>{const c={};for(const p of u)c[p]=p;return c},i.getValidEnumValues=u=>{const c=i.objectKeys(u).filter(f=>typeof u[u[f]]!="number"),p={};for(const f of c)p[f]=u[f];return i.objectValues(p)},i.objectValues=u=>i.objectKeys(u).map(function(c){return u[c]}),i.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const c=[];for(const p in u)Object.prototype.hasOwnProperty.call(u,p)&&c.push(p);return c},i.find=(u,c)=>{for(const p of u)if(c(p))return p},i.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&Number.isFinite(u)&&Math.floor(u)===u;function l(u,c=" | "){return u.map(p=>typeof p=="string"?`'${p}'`:p).join(c)}i.joinValues=l,i.jsonStringifyReplacer=(u,c)=>typeof c=="bigint"?c.toString():c})(e||(t.util=e={}));var r;(function(i){i.mergeShapes=(s,a)=>({...s,...a})})(r||(t.objectUtil=r={})),t.ZodParsedType=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const n=i=>{switch(typeof i){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return Number.isNaN(i)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(i)?t.ZodParsedType.array:i===null?t.ZodParsedType.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?t.ZodParsedType.promise:typeof Map<"u"&&i instanceof Map?t.ZodParsedType.map:typeof Set<"u"&&i instanceof Set?t.ZodParsedType.set:typeof Date<"u"&&i instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=n})(ga);Object.defineProperty(ur,"__esModule",{value:!0});ur.ZodError=ur.quotelessJson=ur.ZodIssueCode=void 0;const ix=ga;ur.ZodIssueCode=ix.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);const dT=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ur.quotelessJson=dT;class Js extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let l=n,u=0;for(;ur.message){const r={},n=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];r[s]=r[s]||[],r[s].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}ur.ZodError=Js;Js.create=t=>new Js(t);Object.defineProperty(Mu,"__esModule",{value:!0});const Oe=ur,Yn=ga,pT=(t,e)=>{let r;switch(t.code){case Oe.ZodIssueCode.invalid_type:t.received===Yn.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Oe.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Yn.util.jsonStringifyReplacer)}`;break;case Oe.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Yn.util.joinValues(t.keys,", ")}`;break;case Oe.ZodIssueCode.invalid_union:r="Invalid input";break;case Oe.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Yn.util.joinValues(t.options)}`;break;case Oe.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Yn.util.joinValues(t.options)}, received '${t.received}'`;break;case Oe.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Oe.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Oe.ZodIssueCode.invalid_date:r="Invalid date";break;case Oe.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Yn.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Oe.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Oe.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Oe.ZodIssueCode.custom:r="Invalid input";break;case Oe.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Oe.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Oe.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Yn.util.assertNever(t)}return{message:r}};Mu.default=pT;var fT=S&&S.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.defaultErrorMap=void 0;Mn.setErrorMap=yT;Mn.getErrorMap=mT;const ox=fT(Mu);Mn.defaultErrorMap=ox.default;let sx=ox.default;function yT(t){sx=t}function mT(){return sx}var hf={};(function(t){var e=S&&S.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.EMPTY_PATH=t.makeIssue=void 0,t.addIssueToContext=s;const r=Mn,n=e(Mu),i=E=>{const{data:x,path:w,errorMaps:T,issueData:m}=E,y=[...w,...m.path||[]],g={...m,path:y};if(m.message!==void 0)return{...m,path:y,message:m.message};let A="";const C=T.filter(L=>!!L).slice().reverse();for(const L of C)A=L(g,{data:x,defaultError:A}).message;return{...m,path:y,message:A}};t.makeIssue=i,t.EMPTY_PATH=[];function s(E,x){const w=(0,r.getErrorMap)(),T=(0,t.makeIssue)({issueData:x,data:E.data,path:E.path,errorMaps:[E.common.contextualErrorMap,E.schemaErrorMap,w,w===n.default?void 0:n.default].filter(m=>!!m)});E.common.issues.push(T)}class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(x,w){const T=[];for(const m of w){if(m.status==="aborted")return t.INVALID;m.status==="dirty"&&x.dirty(),T.push(m.value)}return{status:x.value,value:T}}static async mergeObjectAsync(x,w){const T=[];for(const m of w){const y=await m.key,g=await m.value;T.push({key:y,value:g})}return a.mergeObjectSync(x,T)}static mergeObjectSync(x,w){const T={};for(const m of w){const{key:y,value:g}=m;if(y.status==="aborted"||g.status==="aborted")return t.INVALID;y.status==="dirty"&&x.dirty(),g.status==="dirty"&&x.dirty(),y.value!=="__proto__"&&(typeof g.value<"u"||m.alwaysSet)&&(T[y.value]=g.value)}return{status:x.value,value:T}}}t.ParseStatus=a,t.INVALID=Object.freeze({status:"aborted"});const l=E=>({status:"dirty",value:E});t.DIRTY=l;const u=E=>({status:"valid",value:E});t.OK=u;const c=E=>E.status==="aborted";t.isAborted=c;const p=E=>E.status==="dirty";t.isDirty=p;const f=E=>E.status==="valid";t.isValid=f;const b=E=>typeof Promise<"u"&&E instanceof Promise;t.isAsync=b})(hf);var ax={};Object.defineProperty(ax,"__esModule",{value:!0});var v={},$u={};Object.defineProperty($u,"__esModule",{value:!0});$u.errorUtil=void 0;var L0;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(L0||($u.errorUtil=L0={}));Object.defineProperty(v,"__esModule",{value:!0});v.discriminatedUnion=v.date=v.boolean=v.bigint=v.array=v.any=v.coerce=v.ZodFirstPartyTypeKind=v.late=v.ZodSchema=v.Schema=v.ZodReadonly=v.ZodPipeline=v.ZodBranded=v.BRAND=v.ZodNaN=v.ZodCatch=v.ZodDefault=v.ZodNullable=v.ZodOptional=v.ZodTransformer=v.ZodEffects=v.ZodPromise=v.ZodNativeEnum=v.ZodEnum=v.ZodLiteral=v.ZodLazy=v.ZodFunction=v.ZodSet=v.ZodMap=v.ZodRecord=v.ZodTuple=v.ZodIntersection=v.ZodDiscriminatedUnion=v.ZodUnion=v.ZodObject=v.ZodArray=v.ZodVoid=v.ZodNever=v.ZodUnknown=v.ZodAny=v.ZodNull=v.ZodUndefined=v.ZodSymbol=v.ZodDate=v.ZodBoolean=v.ZodBigInt=v.ZodNumber=v.ZodString=v.ZodType=void 0;v.NEVER=v.void=v.unknown=v.union=v.undefined=v.tuple=v.transformer=v.symbol=v.string=v.strictObject=v.set=v.record=v.promise=v.preprocess=v.pipeline=v.ostring=v.optional=v.onumber=v.oboolean=v.object=v.number=v.nullable=v.null=v.never=v.nativeEnum=v.nan=v.map=v.literal=v.lazy=v.intersection=v.instanceof=v.function=v.enum=v.effect=void 0;v.datetimeRegex=cx;v.custom=px;const P=ur,cl=Mn,z=$u,R=hf,I=ga;class fr{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const D0=(t,e)=>{if((0,R.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new P.ZodError(t.common.issues);return this._error=r,this._error}}};function H(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,l)=>{const{message:u}=t;return a.code==="invalid_enum_value"?{message:u??l.defaultError}:typeof l.data>"u"?{message:u??n??l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:u??r??l.defaultError}},description:i}}class W{get description(){return this._def.description}_getType(e){return(0,I.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,I.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,I.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if((0,R.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,I.getParsedType)(e)},i=this._parseSync({data:e,path:n.path,parent:n});return D0(n,i)}"~validate"(e){var n,i;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,I.getParsedType)(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:r});return(0,R.isValid)(s)?{value:s.value}:{issues:r.common.issues}}catch(s){(i=(n=s==null?void 0:s.message)==null?void 0:n.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>(0,R.isValid)(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,I.getParsedType)(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await((0,R.isAsync)(i)?i:Promise.resolve(i));return D0(n,s)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{const a=e(i),l=()=>s.addIssue({code:P.ZodIssueCode.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Wt({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return cr.create(this,this._def)}nullable(){return wn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return oo.create(this,this._def)}or(e){return ra.create([this,e],this._def)}and(e){return na.create(this,e,this._def)}transform(e){return new Wt({...H(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new la({...H(this._def),innerType:this,defaultValue:r,typeName:X.ZodDefault})}brand(){return new bf({typeName:X.ZodBranded,type:this,...H(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ua({...H(this._def),innerType:this,catchValue:r,typeName:X.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ea.create(this,e)}readonly(){return ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}v.ZodType=W;v.Schema=W;v.ZodSchema=W;const hT=/^c[^\s-]{8,}$/i,bT=/^[0-9a-z]+$/,gT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ET=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,xT=/^[a-z0-9_-]{21}$/i,vT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,AT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let od;const _T=/^(?:(?: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])$/,ST=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lx="((\\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])))",DT=new RegExp(`^${lx}$`);function ux(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function PT(t){return new RegExp(`^${ux(t)}$`)}function cx(t){let e=`${lx}T${ux(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function BT(t,e){return!!((e==="v4"||!e)&&_T.test(t)||(e==="v6"||!e)&&TT.test(t))}function UT(t,e){if(!vT.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function IT(t,e){return!!((e==="v4"||!e)&&ST.test(t)||(e==="v6"||!e)&&CT.test(t))}class Ft extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.ZodParsedType.string){const s=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.string,received:s.parsedType}),R.INVALID}const n=new R.ParseStatus;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),(0,R.addIssueToContext)(i,{code:P.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,l=e.data.lengthe.test(i),{validation:r,code:P.ZodIssueCode.invalid_string,...z.errorUtil.errToObj(n)})}_addCheck(e){return new Ft({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...z.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...z.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...z.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...z.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...z.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...z.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...z.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...z.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...z.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...z.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,z.errorUtil.errToObj(e))}trim(){return new Ft({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ft({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ft({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ft({checks:[],typeName:X.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...H(t)});function jT(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}class vn extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==I.ZodParsedType.number){const s=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.number,received:s.parsedType}),R.INVALID}let n;const i=new R.ParseStatus;for(const s of this._def.checks)s.kind==="int"?I.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?jT(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.not_finite,message:s.message}),i.dirty()):I.util.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,z.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,z.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,z.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,z.errorUtil.toString(r))}setLimit(e,r,n,i){return new vn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:z.errorUtil.toString(i)}]})}_addCheck(e){return new vn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:z.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:z.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.errorUtil.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&I.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.valuenew vn({checks:[],typeName:X.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...H(t)});class Rn extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==I.ZodParsedType.bigint)return this._getInvalidInput(e);let n;const i=new R.ParseStatus;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):I.util.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.bigint,received:r.parsedType}),R.INVALID}gte(e,r){return this.setLimit("min",e,!0,z.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,z.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,z.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,z.errorUtil.toString(r))}setLimit(e,r,n,i){return new Rn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:z.errorUtil.toString(i)}]})}_addCheck(e){return new Rn({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:z.errorUtil.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Rn({checks:[],typeName:X.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...H(t)});class Ys extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.ZodParsedType.boolean){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.boolean,received:n.parsedType}),R.INVALID}return(0,R.OK)(e.data)}}v.ZodBoolean=Ys;Ys.create=t=>new Ys({typeName:X.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...H(t)});class bi extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.ZodParsedType.date){const s=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.date,received:s.parsedType}),R.INVALID}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(s,{code:P.ZodIssueCode.invalid_date}),R.INVALID}const n=new R.ParseStatus;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),(0,R.addIssueToContext)(i,{code:P.ZodIssueCode.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):I.util.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bi({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:z.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:z.errorUtil.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew bi({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:X.ZodDate,...H(t)});class iu extends W{_parse(e){if(this._getType(e)!==I.ZodParsedType.symbol){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.symbol,received:n.parsedType}),R.INVALID}return(0,R.OK)(e.data)}}v.ZodSymbol=iu;iu.create=t=>new iu({typeName:X.ZodSymbol,...H(t)});class ea extends W{_parse(e){if(this._getType(e)!==I.ZodParsedType.undefined){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.undefined,received:n.parsedType}),R.INVALID}return(0,R.OK)(e.data)}}v.ZodUndefined=ea;ea.create=t=>new ea({typeName:X.ZodUndefined,...H(t)});class ta extends W{_parse(e){if(this._getType(e)!==I.ZodParsedType.null){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.null,received:n.parsedType}),R.INVALID}return(0,R.OK)(e.data)}}v.ZodNull=ta;ta.create=t=>new ta({typeName:X.ZodNull,...H(t)});class io extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,R.OK)(e.data)}}v.ZodAny=io;io.create=t=>new io({typeName:X.ZodAny,...H(t)});class ci extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,R.OK)(e.data)}}v.ZodUnknown=ci;ci.create=t=>new ci({typeName:X.ZodUnknown,...H(t)});class Hr extends W{_parse(e){const r=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.never,received:r.parsedType}),R.INVALID}}v.ZodNever=Hr;Hr.create=t=>new Hr({typeName:X.ZodNever,...H(t)});class ou extends W{_parse(e){if(this._getType(e)!==I.ZodParsedType.undefined){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.void,received:n.parsedType}),R.INVALID}return(0,R.OK)(e.data)}}v.ZodVoid=ou;ou.create=t=>new ou({typeName:X.ZodVoid,...H(t)});class Ht extends W{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==I.ZodParsedType.array)return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.array,received:r.parsedType}),R.INVALID;if(i.exactLength!==null){const a=r.data.length>i.exactLength.value,l=r.data.lengthi.maxLength.value&&((0,R.addIssueToContext)(r,{code:P.ZodIssueCode.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,l)=>i.type._parseAsync(new fr(r,a,r.path,l)))).then(a=>R.ParseStatus.mergeArray(n,a));const s=[...r.data].map((a,l)=>i.type._parseSync(new fr(r,a,r.path,l)));return R.ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new Ht({...this._def,minLength:{value:e,message:z.errorUtil.toString(r)}})}max(e,r){return new Ht({...this._def,maxLength:{value:e,message:z.errorUtil.toString(r)}})}length(e,r){return new Ht({...this._def,exactLength:{value:e,message:z.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}}v.ZodArray=Ht;Ht.create=(t,e)=>new Ht({type:t,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...H(e)});function Li(t){if(t instanceof ye){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=cr.create(Li(n))}return new ye({...t._def,shape:()=>e})}else return t instanceof Ht?new Ht({...t._def,type:Li(t.element)}):t instanceof cr?cr.create(Li(t.unwrap())):t instanceof wn?wn.create(Li(t.unwrap())):t instanceof yr?yr.create(t.items.map(e=>Li(e))):t}class ye extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=I.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==I.ZodParsedType.object){const c=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(c,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.object,received:c.parsedType}),R.INVALID}const{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hr&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||l.push(c);const u=[];for(const c of a){const p=s[c],f=i.data[c];u.push({key:{status:"valid",value:c},value:p._parse(new fr(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Hr){const c=this._def.unknownKeys;if(c==="passthrough")for(const p of l)u.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(c==="strict")l.length>0&&((0,R.addIssueToContext)(i,{code:P.ZodIssueCode.unrecognized_keys,keys:l}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const p of l){const f=i.data[p];u.push({key:{status:"valid",value:p},value:c._parse(new fr(i,f,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const p of u){const f=await p.key,b=await p.value;c.push({key:f,value:b,alwaysSet:p.alwaysSet})}return c}).then(c=>R.ParseStatus.mergeObjectSync(n,c)):R.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return z.errorUtil.errToObj,new ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var s,a;const i=((a=(s=this._def).errorMap)==null?void 0:a.call(s,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:z.errorUtil.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){const r={};for(const n of I.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}omit(e){const r={};for(const n of I.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}deepPartial(){return Li(this)}partial(e){const r={};for(const n of I.util.objectKeys(this.shape)){const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new ye({...this._def,shape:()=>r})}required(e){const r={};for(const n of I.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof cr;)s=s._def.innerType;r[n]=s}return new ye({...this._def,shape:()=>r})}keyof(){return dx(I.util.objectKeys(this.shape))}}v.ZodObject=ye;ye.create=(t,e)=>new ye({shape:()=>t,unknownKeys:"strip",catchall:Hr.create(),typeName:X.ZodObject,...H(e)});ye.strictCreate=(t,e)=>new ye({shape:()=>t,unknownKeys:"strict",catchall:Hr.create(),typeName:X.ZodObject,...H(e)});ye.lazycreate=(t,e)=>new ye({shape:t,unknownKeys:"strip",catchall:Hr.create(),typeName:X.ZodObject,...H(e)});class ra extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const a=s.map(l=>new P.ZodError(l.ctx.common.issues));return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union,unionErrors:a}),R.INVALID}if(r.common.async)return Promise.all(n.map(async s=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const u of n){const c={...r,common:{...r.common,issues:[]},parent:null},p=u._parseSync({data:r.data,path:r.path,parent:c});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;const l=a.map(u=>new P.ZodError(u));return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union,unionErrors:l}),R.INVALID}}get options(){return this._def.options}}v.ZodUnion=ra;ra.create=(t,e)=>new ra({options:t,typeName:X.ZodUnion,...H(e)});const Cr=t=>t instanceof oa?Cr(t.schema):t instanceof Wt?Cr(t.innerType()):t instanceof sa?[t.value]:t instanceof An?t.options:t instanceof aa?I.util.objectValues(t.enum):t instanceof la?Cr(t._def.innerType):t instanceof ea?[void 0]:t instanceof ta?[null]:t instanceof cr?[void 0,...Cr(t.unwrap())]:t instanceof wn?[null,...Cr(t.unwrap())]:t instanceof bf||t instanceof ca?Cr(t.unwrap()):t instanceof ua?Cr(t._def.innerType):[];class zu extends W{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==I.ZodParsedType.object)return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.object,received:r.parsedType}),R.INVALID;const n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):((0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const i=new Map;for(const s of r){const a=Cr(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const l of a){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,s)}}return new zu({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...H(n)})}}v.ZodDiscriminatedUnion=zu;function cp(t,e){const r=(0,I.getParsedType)(t),n=(0,I.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===I.ZodParsedType.object&&n===I.ZodParsedType.object){const i=I.util.objectKeys(e),s=I.util.objectKeys(t).filter(l=>i.indexOf(l)!==-1),a={...t,...e};for(const l of s){const u=cp(t[l],e[l]);if(!u.valid)return{valid:!1};a[l]=u.data}return{valid:!0,data:a}}else if(r===I.ZodParsedType.array&&n===I.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if((0,R.isAborted)(s)||(0,R.isAborted)(a))return R.INVALID;const l=cp(s.value,a.value);return l.valid?(((0,R.isDirty)(s)||(0,R.isDirty)(a))&&r.dirty(),{status:r.value,value:l.data}):((0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_intersection_types}),R.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}v.ZodIntersection=na;na.create=(t,e,r)=>new na({left:t,right:e,typeName:X.ZodIntersection,...H(r)});class yr extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.ZodParsedType.array)return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.array,received:n.parsedType}),R.INVALID;if(n.data.lengththis._def.items.length&&((0,R.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...n.data].map((a,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new fr(n,a,n.path,l)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>R.ParseStatus.mergeArray(r,a)):R.ParseStatus.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new yr({...this._def,rest:e})}}v.ZodTuple=yr;yr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yr({items:t,typeName:X.ZodTuple,rest:null,...H(e)})};class ia extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.ZodParsedType.object)return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.object,received:n.parsedType}),R.INVALID;const i=[],s=this._def.keyType,a=this._def.valueType;for(const l in n.data)i.push({key:s._parse(new fr(n,l,n.path,l)),value:a._parse(new fr(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?R.ParseStatus.mergeObjectAsync(r,i):R.ParseStatus.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof W?new ia({keyType:e,valueType:r,typeName:X.ZodRecord,...H(n)}):new ia({keyType:Ft.create(),valueType:e,typeName:X.ZodRecord,...H(r)})}}v.ZodRecord=ia;class su extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.ZodParsedType.map)return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.map,received:n.parsedType}),R.INVALID;const i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([l,u],c)=>({key:i._parse(new fr(n,l,n.path,[c,"key"])),value:s._parse(new fr(n,u,n.path,[c,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of a){const c=await u.key,p=await u.value;if(c.status==="aborted"||p.status==="aborted")return R.INVALID;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),l.set(c.value,p.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const u of a){const c=u.key,p=u.value;if(c.status==="aborted"||p.status==="aborted")return R.INVALID;(c.status==="dirty"||p.status==="dirty")&&r.dirty(),l.set(c.value,p.value)}return{status:r.value,value:l}}}}v.ZodMap=su;su.create=(t,e,r)=>new su({valueType:e,keyType:t,typeName:X.ZodMap,...H(r)});class gi extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==I.ZodParsedType.set)return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.set,received:n.parsedType}),R.INVALID;const i=this._def;i.minSize!==null&&n.data.sizei.maxSize.value&&((0,R.addIssueToContext)(n,{code:P.ZodIssueCode.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const s=this._def.valueType;function a(u){const c=new Set;for(const p of u){if(p.status==="aborted")return R.INVALID;p.status==="dirty"&&r.dirty(),c.add(p.value)}return{status:r.value,value:c}}const l=[...n.data.values()].map((u,c)=>s._parse(new fr(n,u,n.path,c)));return n.common.async?Promise.all(l).then(u=>a(u)):a(l)}min(e,r){return new gi({...this._def,minSize:{value:e,message:z.errorUtil.toString(r)}})}max(e,r){return new gi({...this._def,maxSize:{value:e,message:z.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}v.ZodSet=gi;gi.create=(t,e)=>new gi({valueType:t,minSize:null,maxSize:null,typeName:X.ZodSet,...H(e)});class Wi extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==I.ZodParsedType.function)return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.function,received:r.parsedType}),R.INVALID;function n(l,u){return(0,R.makeIssue)({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,cl.getErrorMap)(),cl.defaultErrorMap].filter(c=>!!c),issueData:{code:P.ZodIssueCode.invalid_arguments,argumentsError:u}})}function i(l,u){return(0,R.makeIssue)({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,cl.getErrorMap)(),cl.defaultErrorMap].filter(c=>!!c),issueData:{code:P.ZodIssueCode.invalid_return_type,returnTypeError:u}})}const s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof oo){const l=this;return(0,R.OK)(async function(...u){const c=new P.ZodError([]),p=await l._def.args.parseAsync(u,s).catch(E=>{throw c.addIssue(n(u,E)),c}),f=await Reflect.apply(a,this,p);return await l._def.returns._def.type.parseAsync(f,s).catch(E=>{throw c.addIssue(i(f,E)),c})})}else{const l=this;return(0,R.OK)(function(...u){const c=l._def.args.safeParse(u,s);if(!c.success)throw new P.ZodError([n(u,c.error)]);const p=Reflect.apply(a,this,c.data),f=l._def.returns.safeParse(p,s);if(!f.success)throw new P.ZodError([i(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Wi({...this._def,args:yr.create(e).rest(ci.create())})}returns(e){return new Wi({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new Wi({args:e||yr.create([]).rest(ci.create()),returns:r||ci.create(),typeName:X.ZodFunction,...H(n)})}}v.ZodFunction=Wi;class oa extends W{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}v.ZodLazy=oa;oa.create=(t,e)=>new oa({getter:t,typeName:X.ZodLazy,...H(e)});class sa extends W{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(r,{received:r.data,code:P.ZodIssueCode.invalid_literal,expected:this._def.value}),R.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}v.ZodLiteral=sa;sa.create=(t,e)=>new sa({value:t,typeName:X.ZodLiteral,...H(e)});function dx(t,e){return new An({values:t,typeName:X.ZodEnum,...H(e)})}class An extends W{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return(0,R.addIssueToContext)(r,{expected:I.util.joinValues(n),received:r.parsedType,code:P.ZodIssueCode.invalid_type}),R.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return(0,R.addIssueToContext)(r,{received:r.data,code:P.ZodIssueCode.invalid_enum_value,options:n}),R.INVALID}return(0,R.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return An.create(e,{...this._def,...r})}exclude(e,r=this._def){return An.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}v.ZodEnum=An;An.create=dx;class aa extends W{_parse(e){const r=I.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==I.ZodParsedType.string&&n.parsedType!==I.ZodParsedType.number){const i=I.util.objectValues(r);return(0,R.addIssueToContext)(n,{expected:I.util.joinValues(i),received:n.parsedType,code:P.ZodIssueCode.invalid_type}),R.INVALID}if(this._cache||(this._cache=new Set(I.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=I.util.objectValues(r);return(0,R.addIssueToContext)(n,{received:n.data,code:P.ZodIssueCode.invalid_enum_value,options:i}),R.INVALID}return(0,R.OK)(e.data)}get enum(){return this._def.values}}v.ZodNativeEnum=aa;aa.create=(t,e)=>new aa({values:t,typeName:X.ZodNativeEnum,...H(e)});class oo extends W{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==I.ZodParsedType.promise&&r.common.async===!1)return(0,R.addIssueToContext)(r,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.promise,received:r.parsedType}),R.INVALID;const n=r.parsedType===I.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,R.OK)(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}}v.ZodPromise=oo;oo.create=(t,e)=>new oo({type:t,typeName:X.ZodPromise,...H(e)});class Wt extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{(0,R.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async l=>{if(r.value==="aborted")return R.INVALID;const u=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return u.status==="aborted"?R.INVALID:u.status==="dirty"||r.value==="dirty"?(0,R.DIRTY)(u.value):u});{if(r.value==="aborted")return R.INVALID;const l=this._def.schema._parseSync({data:a,path:n.path,parent:n});return l.status==="aborted"?R.INVALID:l.status==="dirty"||r.value==="dirty"?(0,R.DIRTY)(l.value):l}}if(i.type==="refinement"){const a=l=>{const u=i.refinement(l,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?R.INVALID:(l.status==="dirty"&&r.dirty(),a(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?R.INVALID:(l.status==="dirty"&&r.dirty(),a(l.value).then(()=>({status:r.value,value:l.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,R.isValid)(a))return R.INVALID;const l=i.transform(a.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,R.isValid)(a)?Promise.resolve(i.transform(a.value,s)).then(l=>({status:r.value,value:l})):R.INVALID);I.util.assertNever(i)}}v.ZodEffects=Wt;v.ZodTransformer=Wt;Wt.create=(t,e,r)=>new Wt({schema:t,typeName:X.ZodEffects,effect:e,...H(r)});Wt.createWithPreprocess=(t,e,r)=>new Wt({schema:e,effect:{type:"preprocess",transform:t},typeName:X.ZodEffects,...H(r)});class cr extends W{_parse(e){return this._getType(e)===I.ZodParsedType.undefined?(0,R.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}v.ZodOptional=cr;cr.create=(t,e)=>new cr({innerType:t,typeName:X.ZodOptional,...H(e)});class wn extends W{_parse(e){return this._getType(e)===I.ZodParsedType.null?(0,R.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}v.ZodNullable=wn;wn.create=(t,e)=>new wn({innerType:t,typeName:X.ZodNullable,...H(e)});class la extends W{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===I.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}v.ZodDefault=la;la.create=(t,e)=>new la({innerType:t,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...H(e)});class ua extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,R.isAsync)(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new P.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new P.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}v.ZodCatch=ua;ua.create=(t,e)=>new ua({innerType:t,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...H(e)});class au extends W{_parse(e){if(this._getType(e)!==I.ZodParsedType.nan){const n=this._getOrReturnCtx(e);return(0,R.addIssueToContext)(n,{code:P.ZodIssueCode.invalid_type,expected:I.ZodParsedType.nan,received:n.parsedType}),R.INVALID}return{status:"valid",value:e.data}}}v.ZodNaN=au;au.create=t=>new au({typeName:X.ZodNaN,...H(t)});v.BRAND=Symbol("zod_brand");class bf extends W{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}v.ZodBranded=bf;class Ea extends W{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?R.INVALID:s.status==="dirty"?(r.dirty(),(0,R.DIRTY)(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R.INVALID:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new Ea({in:e,out:r,typeName:X.ZodPipeline})}}v.ZodPipeline=Ea;class ca extends W{_parse(e){const r=this._def.innerType._parse(e),n=i=>((0,R.isValid)(i)&&(i.value=Object.freeze(i.value)),i);return(0,R.isAsync)(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}}v.ZodReadonly=ca;ca.create=(t,e)=>new ca({innerType:t,typeName:X.ZodReadonly,...H(e)});function P0(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function px(t,e={},r){return t?io.create().superRefine((n,i)=>{const s=t(n);if(s instanceof Promise)return s.then(a=>{if(!a){const l=P0(e,n),u=l.fatal??r??!0;i.addIssue({code:"custom",...l,fatal:u})}});if(!s){const a=P0(e,n),l=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:l})}}):io.create()}v.late={object:ye.lazycreate};var X;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(X||(v.ZodFirstPartyTypeKind=X={}));const KT=(t,e={message:`Input not instance of ${t.name}`})=>px(r=>r instanceof t,e);v.instanceof=KT;const fx=Ft.create;v.string=fx;const yx=vn.create;v.number=yx;const VT=au.create;v.nan=VT;const OT=Rn.create;v.bigint=OT;const mx=Ys.create;v.boolean=mx;const NT=bi.create;v.date=NT;const MT=iu.create;v.symbol=MT;const $T=ea.create;v.undefined=$T;const zT=ta.create;v.null=zT;const FT=io.create;v.any=FT;const qT=ci.create;v.unknown=qT;const GT=Hr.create;v.never=GT;const XT=ou.create;v.void=XT;const HT=Ht.create;v.array=HT;const ZT=ye.create;v.object=ZT;const WT=ye.strictCreate;v.strictObject=WT;const QT=ra.create;v.union=QT;const JT=zu.create;v.discriminatedUnion=JT;const YT=na.create;v.intersection=YT;const e1=yr.create;v.tuple=e1;const t1=ia.create;v.record=t1;const r1=su.create;v.map=r1;const n1=gi.create;v.set=n1;const i1=Wi.create;v.function=i1;const o1=oa.create;v.lazy=o1;const s1=sa.create;v.literal=s1;const a1=An.create;v.enum=a1;const l1=aa.create;v.nativeEnum=l1;const u1=oo.create;v.promise=u1;const hx=Wt.create;v.effect=hx;v.transformer=hx;const c1=cr.create;v.optional=c1;const d1=wn.create;v.nullable=d1;const p1=Wt.createWithPreprocess;v.preprocess=p1;const f1=Ea.create;v.pipeline=f1;const y1=()=>fx().optional();v.ostring=y1;const m1=()=>yx().optional();v.onumber=m1;const h1=()=>mx().optional();v.oboolean=h1;v.coerce={string:t=>Ft.create({...t,coerce:!0}),number:t=>vn.create({...t,coerce:!0}),boolean:t=>Ys.create({...t,coerce:!0}),bigint:t=>Rn.create({...t,coerce:!0}),date:t=>bi.create({...t,coerce:!0})};v.NEVER=R.INVALID;(function(t){var e=S&&S.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=S&&S.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Mn,t),r(hf,t),r(ax,t),r(ga,t),r(v,t),r(ur,t)})(up);(function(t){var e=S&&S.__createBinding||(Object.create?function(a,l,u,c){c===void 0&&(c=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(a,c,p)}:function(a,l,u,c){c===void 0&&(c=u),a[c]=l[u]}),r=S&&S.__setModuleDefault||(Object.create?function(a,l){Object.defineProperty(a,"default",{enumerable:!0,value:l})}:function(a,l){a.default=l}),n=S&&S.__importStar||function(a){if(a&&a.__esModule)return a;var l={};if(a!=null)for(var u in a)u!=="default"&&Object.prototype.hasOwnProperty.call(a,u)&&e(l,a,u);return r(l,a),l},i=S&&S.__exportStar||function(a,l){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,a,u)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const s=n(up);t.z=s,i(up,t),t.default=s})(Jt);var gf={},Ef={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DisallowedDomainError=t.UnsupportedDomainError=t.ReservedHandleError=t.InvalidHandleError=t.isValidTld=t.isValidHandle=t.normalizeAndEnsureValidHandle=t.normalizeHandle=t.ensureValidHandleRegex=t.ensureValidHandle=t.DISALLOWED_TLDS=t.INVALID_HANDLE=void 0,t.INVALID_HANDLE="handle.invalid",t.DISALLOWED_TLDS=[".local",".arpa",".invalid",".localhost",".internal",".example",".alt",".onion"];const e=f=>{if(!/^[a-zA-Z0-9.-]*$/.test(f))throw new l("Disallowed characters in handle (ASCII letters, digits, dashes, periods only)");if(f.length>253)throw new l("Handle is too long (253 chars max)");const b=f.split(".");if(b.length<2)throw new l("Handle domain needs at least two parts");for(let E=0;E63)throw new l("Handle part too long (max 63 chars)");if(x.endsWith("-")||x.startsWith("-"))throw new l("Handle parts can not start or end with hyphens");if(E+1===b.length&&!/^[a-zA-Z]/.test(x))throw new l("Handle final component (TLD) must start with ASCII letter")}};t.ensureValidHandle=e;const r=f=>{if(!/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/.test(f))throw new l("Handle didn't validate via regex");if(f.length>253)throw new l("Handle is too long (253 chars max)")};t.ensureValidHandleRegex=r;const n=f=>f.toLowerCase();t.normalizeHandle=n;const i=f=>{const b=(0,t.normalizeHandle)(f);return(0,t.ensureValidHandle)(b),b};t.normalizeAndEnsureValidHandle=i;const s=f=>{try{(0,t.ensureValidHandle)(f)}catch(b){if(b instanceof l)return!1;throw b}return!0};t.isValidHandle=s;const a=f=>!t.DISALLOWED_TLDS.some(b=>f.endsWith(b));t.isValidTld=a;class l extends Error{}t.InvalidHandleError=l;class u extends Error{}t.ReservedHandleError=u;class c extends Error{}t.UnsupportedDomainError=c;class p extends Error{}t.DisallowedDomainError=p})(Ef);var Or={};Object.defineProperty(Or,"__esModule",{value:!0});Or.InvalidDidError=Or.ensureValidDidRegex=Or.ensureValidDid=void 0;const b1=t=>{if(!t.startsWith("did:"))throw new Br('DID requires "did:" prefix');if(!/^[a-zA-Z0-9._:%-]*$/.test(t))throw new Br("Disallowed characters in DID (ASCII letters, digits, and a couple other characters only)");const{length:e,1:r}=t.split(":");if(e<3)throw new Br("DID requires prefix, method, and method-specific content");if(!/^[a-z]+$/.test(r))throw new Br("DID method must be lower-case letters");if(t.endsWith(":")||t.endsWith("%"))throw new Br('DID can not end with ":" or "%"');if(t.length>2*1024)throw new Br("DID is too long (2048 chars max)")};Or.ensureValidDid=b1;const g1=t=>{if(!/^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$/.test(t))throw new Br("DID didn't validate via regex");if(t.length>2*1024)throw new Br("DID is too long (2048 chars max)")};Or.ensureValidDidRegex=g1;let Br=class extends Error{};Or.InvalidDidError=Br;var xf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidNsidError=t.ensureValidNsidRegex=t.ensureValidNsid=t.NSID=void 0;class e{static parse(a){return new e(a)}static create(a,l){const u=[...a.split(".").reverse(),l].join(".");return new e(u)}static isValid(a){try{return e.parse(a),!0}catch{return!1}}constructor(a){Object.defineProperty(this,"segments",{enumerable:!0,configurable:!0,writable:!0,value:[]}),(0,t.ensureValidNsid)(a),this.segments=a.split(".")}get authority(){return this.segments.slice(0,this.segments.length-1).reverse().join(".")}get name(){return this.segments.at(this.segments.length-1)}toString(){return this.segments.join(".")}}t.NSID=e;const r=s=>{const a=s;if(!/^[a-zA-Z0-9.-]*$/.test(a))throw new i("Disallowed characters in NSID (ASCII letters, digits, dashes, periods only)");if(a.length>317)throw new i("NSID is too long (317 chars max)");const l=a.split(".");if(l.length<3)throw new i("NSID needs at least three parts");for(let u=0;u63)throw new i("NSID part too long (max 63 chars)");if(c.endsWith("-")||c.startsWith("-"))throw new i("NSID parts can not start or end with hyphen");if(/^[0-9]/.test(c)&&u===0)throw new i("NSID first part may not start with a digit");if(!/^[a-zA-Z][a-zA-Z0-9]*$/.test(c)&&u+1===l.length)throw new i("NSID name part must be only letters and digits (and no leading digit)")}};t.ensureValidNsid=r;const n=s=>{if(!/^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\.[a-zA-Z]([a-zA-Z0-9]{0,62})?)$/.test(s))throw new i("NSID didn't validate via regex");if(s.length>317)throw new i("NSID is too long (317 chars max)")};t.ensureValidNsidRegex=n;class i extends Error{}t.InvalidNsidError=i})(xf);var bx={},so={};Object.defineProperty(so,"__esModule",{value:!0});so.ensureValidAtUriRegex=so.ensureValidAtUri=void 0;const gx=Or,Ex=Ef,xx=xf,E1=t=>{const e=t.split("#");if(e.length>2)throw new Error('ATURI can have at most one "#", separating fragment out');const r=e[1]||null;if(t=e[0],!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(t))throw new Error("Disallowed characters in ATURI (ASCII)");const n=t.split("/");if(n.length>=3&&(n[0]!=="at:"||n[1].length!==0))throw new Error('ATURI must start with "at://"');if(n.length<3)throw new Error("ATURI requires at least method and authority sections");try{n[2].startsWith("did:")?(0,gx.ensureValidDid)(n[2]):(0,Ex.ensureValidHandle)(n[2])}catch{throw new Error("ATURI authority must be a valid handle or DID")}if(n.length>=4){if(n[3].length===0)throw new Error("ATURI can not have a slash after authority without a path segment");try{(0,xx.ensureValidNsid)(n[3])}catch{throw new Error("ATURI requires first path segment (if supplied) to be valid NSID")}}if(n.length>=5&&n[4].length===0)throw new Error("ATURI can not have a slash after collection, unless record key is provided");if(n.length>=6)throw new Error("ATURI path can have at most two parts, and no trailing slash");if(e.length>=2&&r==null)throw new Error("ATURI fragment must be non-empty and start with slash");if(r!=null){if(r.length===0||r[0]!=="/")throw new Error("ATURI fragment must be non-empty and start with slash");if(!/^\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\]/-]*$/.test(r))throw new Error("Disallowed characters in ATURI fragment (ASCII)")}if(t.length>8*1024)throw new Error("ATURI is far too long")};so.ensureValidAtUri=E1;const x1=t=>{const e=/^at:\/\/(?[a-zA-Z0-9._:%-]+)(\/(?[a-zA-Z0-9-.]+)(\/(?[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/,r=t.match(e);if(!r||!r.groups)throw new Error("ATURI didn't validate via regex");const n=r.groups;try{(0,Ex.ensureValidHandleRegex)(n.authority)}catch{try{(0,gx.ensureValidDidRegex)(n.authority)}catch{throw new Error("ATURI authority must be a valid handle or DID")}}if(n.collection)try{(0,xx.ensureValidNsidRegex)(n.collection)}catch{throw new Error("ATURI collection path segment must be a valid NSID")}if(t.length>8*1024)throw new Error("ATURI is far too long")};so.ensureValidAtUriRegex=x1;(function(t){var e=S&&S.__createBinding||(Object.create?function(l,u,c,p){p===void 0&&(p=c);var f=Object.getOwnPropertyDescriptor(u,c);(!f||("get"in f?!u.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return u[c]}}),Object.defineProperty(l,p,f)}:function(l,u,c,p){p===void 0&&(p=c),l[p]=u[c]}),r=S&&S.__exportStar||function(l,u){for(var c in l)c!=="default"&&!Object.prototype.hasOwnProperty.call(u,c)&&e(u,l,c)};Object.defineProperty(t,"__esModule",{value:!0}),t.AtUri=t.ATP_URI_REGEX=void 0,r(so,t),t.ATP_URI_REGEX=/^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;const n=/^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;class i{constructor(u,c){Object.defineProperty(this,"hash",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"searchParams",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let p;if(c){if(p=s(c),!p)throw new Error(`Invalid at uri: ${c}`);const f=a(u);if(!f)throw new Error(`Invalid path: ${u}`);Object.assign(p,f)}else if(p=s(u),!p)throw new Error(`Invalid at uri: ${u}`);this.hash=p.hash,this.host=p.host,this.pathname=p.pathname,this.searchParams=p.searchParams}static make(u,c,p){let f=u;return c&&(f+="/"+c),p&&(f+="/"+p),new i(f)}get protocol(){return"at:"}get origin(){return`at://${this.host}`}get hostname(){return this.host}set hostname(u){this.host=u}get search(){return this.searchParams.toString()}set search(u){this.searchParams=new URLSearchParams(u)}get collection(){return this.pathname.split("/").filter(Boolean)[0]||""}set collection(u){const c=this.pathname.split("/").filter(Boolean);c[0]=u,this.pathname=c.join("/")}get rkey(){return this.pathname.split("/").filter(Boolean)[1]||""}set rkey(u){const c=this.pathname.split("/").filter(Boolean);c[0]||(c[0]="undefined"),c[1]=u,this.pathname=c.join("/")}get href(){return this.toString()}toString(){let u=this.pathname||"/";u.startsWith("/")||(u=`/${u}`);let c=this.searchParams.toString();c&&!c.startsWith("?")&&(c=`?${c}`);let p=this.hash;return p&&!p.startsWith("#")&&(p=`#${p}`),`at://${this.host}${u}${c}${p}`}}t.AtUri=i;function s(l){const u=t.ATP_URI_REGEX.exec(l);if(u)return{hash:u[5]||"",host:u[2]||"",pathname:u[3]||"",searchParams:new URLSearchParams(u[4]||"")}}function a(l){const u=n.exec(l);if(u)return{hash:u[3]||"",pathname:u[1]||"",searchParams:new URLSearchParams(u[2]||"")}}})(bx);var bn={};Object.defineProperty(bn,"__esModule",{value:!0});bn.InvalidTidError=bn.isValidTid=bn.ensureValidTid=void 0;const dp=13,vx=/^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/,v1=t=>{if(t.length!==dp)throw new pp(`TID must be ${dp} characters`);if(!vx.test(t))throw new pp("TID syntax not valid (regex)")};bn.ensureValidTid=v1;const R1=t=>t.length===dp&&vx.test(t);bn.isValidTid=R1;let pp=class extends Error{};bn.InvalidTidError=pp;var Rx={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidRecordKeyError=t.isValidRecordKey=t.ensureValidRecordKey=void 0;const e=i=>{if(i.length>512||i.length<1)throw new n("record key must be 1 to 512 characters");if(!/^[a-zA-Z0-9_~.:-]{1,512}$/.test(i))throw new n("record key syntax not valid (regex)");if(i==="."||i==="..")throw new n('record key can not be "." or ".."')};t.ensureValidRecordKey=e;const r=i=>{try{(0,t.ensureValidRecordKey)(i)}catch(s){if(s instanceof n)return!1;throw s}return!0};t.isValidRecordKey=r;class n extends Error{}t.InvalidRecordKeyError=n})(Rx);var Ax={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidDatetimeError=t.normalizeDatetimeAlways=t.normalizeDatetime=t.isValidDatetime=t.ensureValidDatetime=void 0;const e=a=>{const l=new Date(a);if(isNaN(l.getTime()))throw new s("datetime did not parse as ISO 8601");if(l.toISOString().startsWith("-"))throw new s("datetime normalized to a negative time");if(!/^[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](.[0-9]{1,20})?(Z|([+-][0-2][0-9]:[0-5][0-9]))$/.test(a))throw new s("datetime didn't validate via regex");if(a.length>64)throw new s("datetime is too long (64 chars max)");if(a.endsWith("-00:00"))throw new s('datetime can not use "-00:00" for UTC timezone');if(a.startsWith("000"))throw new s("datetime so close to year zero not allowed")};t.ensureValidDatetime=e;const r=a=>{try{(0,t.ensureValidDatetime)(a)}catch(l){if(l instanceof s)return!1;throw l}return!0};t.isValidDatetime=r;const n=a=>{if((0,t.isValidDatetime)(a)){const c=new Date(a).toISOString();if((0,t.isValidDatetime)(c))return c}if(!/.*(([+-]\d\d:?\d\d)|[a-zA-Z])$/.test(a)){const c=new Date(a+"Z");if(!isNaN(c.getTime())){const p=c.toISOString();if((0,t.isValidDatetime)(p))return p}}const l=new Date(a);if(isNaN(l.getTime()))throw new s("datetime did not parse as any timestamp format");const u=l.toISOString();if((0,t.isValidDatetime)(u))return u;throw new s("datetime normalized to invalid timestamp string")};t.normalizeDatetime=n;const i=a=>{try{return(0,t.normalizeDatetime)(a)}catch(l){if(l instanceof s)return new Date(0).toISOString();throw l}};t.normalizeDatetimeAlways=i;class s extends Error{}t.InvalidDatetimeError=s})(Ax);(function(t){var e=S&&S.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=S&&S.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ef,t),r(Or,t),r(xf,t),r(bx,t),r(bn,t),r(Rx,t),r(Ax,t)})(gf);var mo={};Object.defineProperty(mo,"__esModule",{value:!0});mo.toLexUri=A1;mo.requiredPropertiesRefinement=w1;const sd=Jt;function A1(t,e){if(t.split("#").length>2)throw new Error("Uri can only have one hash segment");if(t.startsWith("lex:"))return t;if(t.startsWith("#")){if(!e)throw new Error(`Unable to resolve uri without anchor: ${t}`);return`${e}${t}`}return`lex:${t}`}function w1(t,e){if(t.required!==void 0){if(!Array.isArray(t.required)){e.addIssue({code:sd.z.ZodIssueCode.invalid_type,received:typeof t.required,expected:"array"});return}if(t.properties===void 0){t.required.length>0&&e.addIssue({code:sd.z.ZodIssueCode.custom,message:"Required fields defined but no properties defined"});return}for(const r of t.required)t.properties[r]===void 0&&e.addIssue({code:sd.z.ZodIssueCode.custom,message:`Required field "${r}" not defined`})}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.LexiconDefNotFoundError=t.InvalidLexiconError=t.ValidationError=t.lexiconDoc=t.lexUserType=t.lexRecord=t.lexXrpcSubscription=t.lexXrpcProcedure=t.lexXrpcQuery=t.lexXrpcError=t.lexXrpcSubscriptionMessage=t.lexXrpcBody=t.lexXrpcParameters=t.lexObject=t.lexToken=t.lexPrimitiveArray=t.lexArray=t.lexBlob=t.lexRefVariant=t.lexRefUnion=t.lexRef=t.lexIpldType=t.lexCidLink=t.lexBytes=t.lexPrimitive=t.lexUnknown=t.lexString=t.lexStringFormat=t.lexInteger=t.lexBoolean=void 0,t.isValidLexiconDoc=i,t.isObj=s,t.isDiscriminatedObject=a,t.parseLexiconDoc=l;const e=Jt,r=gf,n=mo;t.lexBoolean=e.z.object({type:e.z.literal("boolean"),description:e.z.string().optional(),default:e.z.boolean().optional(),const:e.z.boolean().optional()}).strict(),t.lexInteger=e.z.object({type:e.z.literal("integer"),description:e.z.string().optional(),default:e.z.number().int().optional(),minimum:e.z.number().int().optional(),maximum:e.z.number().int().optional(),enum:e.z.number().int().array().optional(),const:e.z.number().int().optional()}).strict(),t.lexStringFormat=e.z.enum(["datetime","uri","at-uri","did","handle","at-identifier","nsid","cid","language","tid","record-key"]),t.lexString=e.z.object({type:e.z.literal("string"),format:t.lexStringFormat.optional(),description:e.z.string().optional(),default:e.z.string().optional(),minLength:e.z.number().int().optional(),maxLength:e.z.number().int().optional(),minGraphemes:e.z.number().int().optional(),maxGraphemes:e.z.number().int().optional(),enum:e.z.string().array().optional(),const:e.z.string().optional(),knownValues:e.z.string().array().optional()}).strict(),t.lexUnknown=e.z.object({type:e.z.literal("unknown"),description:e.z.string().optional()}).strict(),t.lexPrimitive=e.z.discriminatedUnion("type",[t.lexBoolean,t.lexInteger,t.lexString,t.lexUnknown]),t.lexBytes=e.z.object({type:e.z.literal("bytes"),description:e.z.string().optional(),maxLength:e.z.number().optional(),minLength:e.z.number().optional()}).strict(),t.lexCidLink=e.z.object({type:e.z.literal("cid-link"),description:e.z.string().optional()}).strict(),t.lexIpldType=e.z.discriminatedUnion("type",[t.lexBytes,t.lexCidLink]),t.lexRef=e.z.object({type:e.z.literal("ref"),description:e.z.string().optional(),ref:e.z.string()}).strict(),t.lexRefUnion=e.z.object({type:e.z.literal("union"),description:e.z.string().optional(),refs:e.z.string().array(),closed:e.z.boolean().optional()}).strict(),t.lexRefVariant=e.z.discriminatedUnion("type",[t.lexRef,t.lexRefUnion]),t.lexBlob=e.z.object({type:e.z.literal("blob"),description:e.z.string().optional(),accept:e.z.string().array().optional(),maxSize:e.z.number().optional()}).strict(),t.lexArray=e.z.object({type:e.z.literal("array"),description:e.z.string().optional(),items:e.z.discriminatedUnion("type",[t.lexBoolean,t.lexInteger,t.lexString,t.lexUnknown,t.lexBytes,t.lexCidLink,t.lexRef,t.lexRefUnion,t.lexBlob]),minLength:e.z.number().int().optional(),maxLength:e.z.number().int().optional()}).strict(),t.lexPrimitiveArray=t.lexArray.merge(e.z.object({items:t.lexPrimitive}).strict()),t.lexToken=e.z.object({type:e.z.literal("token"),description:e.z.string().optional()}).strict(),t.lexObject=e.z.object({type:e.z.literal("object"),description:e.z.string().optional(),required:e.z.string().array().optional(),nullable:e.z.string().array().optional(),properties:e.z.record(e.z.discriminatedUnion("type",[t.lexArray,t.lexBoolean,t.lexInteger,t.lexString,t.lexUnknown,t.lexBytes,t.lexCidLink,t.lexRef,t.lexRefUnion,t.lexBlob]))}).strict().superRefine(n.requiredPropertiesRefinement),t.lexXrpcParameters=e.z.object({type:e.z.literal("params"),description:e.z.string().optional(),required:e.z.string().array().optional(),properties:e.z.record(e.z.discriminatedUnion("type",[t.lexPrimitiveArray,t.lexBoolean,t.lexInteger,t.lexString,t.lexUnknown]))}).strict().superRefine(n.requiredPropertiesRefinement),t.lexXrpcBody=e.z.object({description:e.z.string().optional(),encoding:e.z.string(),schema:e.z.union([t.lexRefVariant,t.lexObject]).optional()}).strict(),t.lexXrpcSubscriptionMessage=e.z.object({description:e.z.string().optional(),schema:e.z.union([t.lexRefVariant,t.lexObject]).optional()}).strict(),t.lexXrpcError=e.z.object({name:e.z.string(),description:e.z.string().optional()}).strict(),t.lexXrpcQuery=e.z.object({type:e.z.literal("query"),description:e.z.string().optional(),parameters:t.lexXrpcParameters.optional(),output:t.lexXrpcBody.optional(),errors:t.lexXrpcError.array().optional()}).strict(),t.lexXrpcProcedure=e.z.object({type:e.z.literal("procedure"),description:e.z.string().optional(),parameters:t.lexXrpcParameters.optional(),input:t.lexXrpcBody.optional(),output:t.lexXrpcBody.optional(),errors:t.lexXrpcError.array().optional()}).strict(),t.lexXrpcSubscription=e.z.object({type:e.z.literal("subscription"),description:e.z.string().optional(),parameters:t.lexXrpcParameters.optional(),message:t.lexXrpcSubscriptionMessage.optional(),errors:t.lexXrpcError.array().optional()}).strict(),t.lexRecord=e.z.object({type:e.z.literal("record"),description:e.z.string().optional(),key:e.z.string().optional(),record:t.lexObject}).strict(),t.lexUserType=e.z.custom(f=>{if(!(!f||typeof f!="object")&&f.type!==void 0)switch(f.type){case"record":return t.lexRecord.parse(f);case"query":return t.lexXrpcQuery.parse(f);case"procedure":return t.lexXrpcProcedure.parse(f);case"subscription":return t.lexXrpcSubscription.parse(f);case"blob":return t.lexBlob.parse(f);case"array":return t.lexArray.parse(f);case"token":return t.lexToken.parse(f);case"object":return t.lexObject.parse(f);case"boolean":return t.lexBoolean.parse(f);case"integer":return t.lexInteger.parse(f);case"string":return t.lexString.parse(f);case"bytes":return t.lexBytes.parse(f);case"cid-link":return t.lexCidLink.parse(f);case"unknown":return t.lexUnknown.parse(f)}},f=>!f||typeof f!="object"?{message:"Must be an object",fatal:!0}:f.type===void 0?{message:"Must have a type",fatal:!0}:typeof f.type!="string"?{message:"Type property must be a string",fatal:!0}:{message:`Invalid type: ${f.type} must be one of: record, query, procedure, subscription, blob, array, token, object, boolean, integer, string, bytes, cid-link, unknown`,fatal:!0}),t.lexiconDoc=e.z.object({lexicon:e.z.literal(1),id:e.z.string().refine(f=>r.NSID.isValid(f),{message:"Must be a valid NSID"}),revision:e.z.number().optional(),description:e.z.string().optional(),defs:e.z.record(t.lexUserType)}).strict().superRefine((f,b)=>{for(const E in f.defs){const x=f.defs[E];E!=="main"&&(x.type==="record"||x.type==="procedure"||x.type==="query"||x.type==="subscription")&&b.addIssue({code:e.z.ZodIssueCode.custom,message:"Records, procedures, queries, and subscriptions must be the main definition."})}});function i(f){return t.lexiconDoc.safeParse(f).success}function s(f){return f!=null&&typeof f=="object"}function a(f){return s(f)&&"$type"in f&&typeof f.$type=="string"}function l(f){return t.lexiconDoc.parse(f),f}class u extends Error{}t.ValidationError=u;class c extends Error{}t.InvalidLexiconError=c;class p extends Error{}t.LexiconDefNotFoundError=p})(Nn);var Fu={},Ri={},$n={},vf={},qu={},_1=wx,B0=128,S1=-128,T1=Math.pow(2,31);function wx(t,e,r){e=e||[],r=r||0;for(var n=r;t>=T1;)e[r++]=t&255|B0,t/=128;for(;t&S1;)e[r++]=t&255|B0,t>>>=7;return e[r]=t|0,wx.bytes=r-n+1,e}var C1=fp,k1=128,U0=127;function fp(t,n){var r=0,n=n||0,i=0,s=n,a,l=t.length;do{if(s>=l)throw fp.bytes=0,new RangeError("Could not decode varint");a=t[s++],r+=i<28?(a&U0)<=k1);return fp.bytes=s-n,r}var L1=Math.pow(2,7),D1=Math.pow(2,14),P1=Math.pow(2,21),B1=Math.pow(2,28),U1=Math.pow(2,35),I1=Math.pow(2,42),j1=Math.pow(2,49),K1=Math.pow(2,56),V1=Math.pow(2,63),O1=function(t){return t[lu.decode(t,e),lu.decode.bytes],uu=(t,e,r=0)=>(lu.encode(t,e,r),e),cu=t=>lu.encodingLength(t),M1=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},$1=t=>new TextEncoder().encode(t),z1=t=>new TextDecoder().decode(t),F1=(t,e)=>{const r=e.byteLength,n=cu(t),i=n+cu(r),s=new Uint8Array(i+r);return uu(t,s,0),uu(r,s,n),s.set(e,i),new Af(t,r,e,s)},q1=t=>{const e=Rf(t),[r,n]=yp(e),[i,s]=yp(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new Af(r,i,a,e)},G1=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&M1(t.bytes,e.bytes);class Af{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}function X1(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(g);m!==y;){for(var C=x[m],L=0,D=g-1;(C!==0||L>>0,A[D]=C%l>>>0,C=C/l>>>0;if(C!==0)throw new Error("Non-zero carry");T=L,m++}for(var K=g-T;K!==g&&A[K]===0;)K++;for(var ie=u.repeat(w);K>>0,g=new Uint8Array(y);x[w];){var A=r[x.charCodeAt(w)];if(A===255)return;for(var C=0,L=y-1;(A!==0||C>>0,g[L]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");m=C,w++}if(x[w]!==" "){for(var D=y-m;D!==y&&g[D]===0;)D++;for(var K=new Uint8Array(T+(y-D)),ie=T;D!==y;)K[ie++]=g[D++];return K}}}function E(x){var w=b(x);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:b,decode:E}}var H1=X1,Z1=H1;class W1{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Q1{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return _x(this,e)}}class J1{constructor(e){this.decoders=e}or(e){return _x(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const _x=(t,e)=>new J1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Y1{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new W1(e,r,n),this.decoder=new Q1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Gu=({name:t,prefix:e,encode:r,decode:n})=>new Y1(t,e,r,n),xa=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Z1(r,e);return Gu({prefix:t,name:e,encode:n,decode:s=>Rf(i(s))})},eC=(t,e,r,n)=>{const i={};for(let p=0;p=8&&(l-=8,a[c++]=255&u>>l)}if(l>=r||255&u<<8-l)throw new SyntaxError("Unexpected end of data");return a},tC=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)a-=r,s+=e[i&l>>a];if(a&&(s+=e[i&l<Gu({prefix:e,name:t,encode(i){return tC(i,n,r)},decode(i){return eC(i,n,r,t)}}),Ur=xa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),rC=xa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),nC=Object.freeze(Object.defineProperty({__proto__:null,base58btc:Ur,base58flickr:rC},Symbol.toStringTag,{value:"Module"})),Ps=je({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iC=je({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oC=je({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sC=je({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),aC=je({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lC=je({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uC=je({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cC=je({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dC=je({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),pC=Object.freeze(Object.defineProperty({__proto__:null,base32:Ps,base32hex:aC,base32hexpad:uC,base32hexpadupper:cC,base32hexupper:lC,base32pad:oC,base32padupper:sC,base32upper:iC,base32z:dC},Symbol.toStringTag,{value:"Module"}));class Ne{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:pl,byteLength:pl,code:dl,version:dl,multihash:dl,bytes:dl,_baseCache:pl,asCID:pl})}toV0(){switch(this.version){case 0:return this;default:{const{code:e,multihash:r}=this;if(e!==hs)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==hC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ne.createV0(r)}}}toV1(){switch(this.version){case 0:{const{code:e,digest:r}=this.multihash,n=F1(e,r);return Ne.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&G1(this.multihash,e.multihash)}toString(e){const{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return yC(r,i,e||Ur.encoder);default:return mC(r,i,e||Ps.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return gC(/^0\.0/,EC),!!(e&&(e[j0]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof Ne)return e;if(e!=null&&e.asCID===e){const{version:r,code:n,multihash:i,bytes:s}=e;return new Ne(r,n,i,s||I0(r,n,i.bytes))}else if(e!=null&&e[j0]===!0){const{version:r,multihash:n,code:i}=e,s=q1(n);return Ne.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==hs)throw new Error(`Version 0 CID must use dag-pb (code: ${hs}) block encoding`);return new Ne(e,r,n,n.bytes)}case 1:{const i=I0(e,r,n.bytes);return new Ne(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ne.create(0,hs,e)}static createV1(e,r){return Ne.create(1,e,r)}static decode(e){const[r,n]=Ne.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){const r=Ne.inspectBytes(e),n=r.size-r.multihashSize,i=Rf(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");const s=i.subarray(r.multihashSize-r.digestSize),a=new Af(r.multihashCode,r.digestSize,s,i);return[r.version===0?Ne.createV0(a):Ne.createV1(r.codec,a),e.subarray(r.size)]}static inspectBytes(e){let r=0;const n=()=>{const[f,b]=yp(e.subarray(r));return r+=b,f};let i=n(),s=hs;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);const a=r,l=n(),u=n(),c=r+u,p=c-a;return{version:i,codec:s,multihashCode:l,digestSize:u,multihashSize:p,size:c}}static parse(e,r){const[n,i]=fC(e,r),s=Ne.decode(i);return s._baseCache.set(n,e),s}}const fC=(t,e)=>{switch(t[0]){case"Q":{const r=e||Ur;return[Ur.prefix,r.decode(`${Ur.prefix}${t}`)]}case Ur.prefix:{const r=e||Ur;return[Ur.prefix,r.decode(t)]}case Ps.prefix:{const r=e||Ps;return[Ps.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},yC=(t,e,r)=>{const{prefix:n}=r;if(n!==Ur.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const i=e.get(n);if(i==null){const s=r.encode(t).slice(1);return e.set(n,s),s}else return i},mC=(t,e,r)=>{const{prefix:n}=r,i=e.get(n);if(i==null){const s=r.encode(t);return e.set(n,s),s}else return i},hs=112,hC=18,I0=(t,e,r)=>{const n=cu(t),i=n+cu(e),s=new Uint8Array(i+r.byteLength);return uu(t,s,0),uu(e,s,n),s.set(r,i),s},j0=Symbol.for("@ipld/js-cid/CID"),dl={writable:!1,configurable:!1,enumerable:!0},pl={writable:!1,enumerable:!1,configurable:!1},bC="0.0.0-dev",gC=(t,e)=>{if(t.test(bC))console.warn(e);else throw new Error(e)},EC=`CID.isCID(v) is deprecated and will be removed in the next major release. +Following code pattern: + +if (CID.isCID(value)) { + doSomethingWithCID(value) +} + +Is replaced with: + +const cid = CID.asCID(value) +if (cid) { + // Make sure to use cid instead of value + doSomethingWithCID(cid) +} +`,xC=Object.freeze(Object.defineProperty({__proto__:null,CID:Ne},Symbol.toStringTag,{value:"Module"})),ho=Fb(xC);var xr={},sr={};Object.defineProperty(sr,"__esModule",{value:!0});sr.isObject=sr.assure=sr.create=sr.is=void 0;const vC=(t,e)=>e.safeParse(t).success;sr.is=vC;const RC=t=>e=>t.safeParse(e).success;sr.create=RC;const AC=(t,e)=>t.parse(e);sr.assure=AC;const wC=t=>typeof t=="object"&&t!==null;sr.isObject=wC;var ao={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseIntWithFallback=t.dedupeStrs=t.range=t.chunkArray=t.errHasMsg=t.isErrnoException=t.asyncFilter=t.s32decode=t.s32encode=t.streamToBuffer=t.flattenUint8Arrays=t.bailableWait=t.wait=t.jitter=t.noUndefinedVals=void 0,t.omit=r;const e=y=>(Object.keys(y).forEach(g=>{y[g]===void 0&&delete y[g]}),y);t.noUndefinedVals=e;function r(y,g){if(!y)return y;const A={},C=Object.keys(y);for(let L=0;LMath.round((Math.random()-.5)*y*2);t.jitter=n;const i=y=>new Promise(g=>setTimeout(g,y));t.wait=i;const s=y=>{let g;const A=new Promise(C=>{const L=setTimeout(C,y);g=()=>{clearTimeout(L),C()}});return{bail:g,wait:()=>A}};t.bailableWait=s;const a=y=>{const g=y.reduce((L,D)=>L+D.length,0),A=new Uint8Array(g);let C=0;return y.forEach(L=>{A.set(L,C),C+=L.length}),A};t.flattenUint8Arrays=a;const l=async y=>{const g=[];for await(const A of y)g.push(A);return(0,t.flattenUint8Arrays)(g)};t.streamToBuffer=l;const u="234567abcdefghijklmnopqrstuvwxyz",c=y=>{let g="";for(;y;){const A=y%32;y=Math.floor(y/32),g=u.charAt(A)+g}return g};t.s32encode=c;const p=y=>{let g=0;for(const A of y)g=g*32+u.indexOf(A);return g};t.s32decode=p;const f=async(y,g)=>{const A=await Promise.all(y.map(C=>g(C)));return y.filter((C,L)=>A[L])};t.asyncFilter=f;const b=y=>!!y&&y.code;t.isErrnoException=b;const E=(y,g)=>!!y&&typeof y=="object"&&y.message===g;t.errHasMsg=E;const x=(y,g)=>y.reduce((A,C,L)=>{const D=Math.floor(L/g);return A[D]||(A[D]=[]),A[D].push(C),A},[]);t.chunkArray=x;const w=y=>{const g=[];for(let A=0;A[...new Set(y)];t.dedupeStrs=T;const m=(y,g)=>{const A=parseInt(y||"",10);return isNaN(A)?g:A};t.parseIntWithFallback=m})(ao);var va={};Object.defineProperty(va,"__esModule",{value:!0});va.mapDefined=void 0;va.keyBy=_C;function _C(t,e){return t.reduce((r,n)=>(r.set(n[e],n),r),new Map)}const SC=(t,e)=>{const r=[];for(const n of t){const i=e(n);i!==void 0&&r.push(i)}return r};va.mapDefined=SC;var Sx={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncBufferFullError=t.AsyncBuffer=t.allComplete=t.createDeferrables=t.createDeferrable=t.readFromGenerator=void 0,t.allFulfilled=u,t.handleAllSettledErrors=c,t.isRejectedResult=p,t.isFulfilledResult=b;const e=ao,r=async(w,T,m=Promise.resolve(),y=Number.MAX_SAFE_INTEGER)=>{const g=[];let A,C=!1;const L=async()=>{if(await T(g.at(-1)))return!0;const K=(0,e.bailableWait)(20);return await K.wait(),A=K.bail,C?!1:await L()},D=new Promise(K=>{m.then(()=>{L().then(()=>K())})});try{for(;g.length{let w;const T=new Promise(m=>{w=()=>m()});return{resolve:w,complete:T}};t.createDeferrable=n;const i=w=>{const T=[];for(let m=0;m{await Promise.all(w.map(T=>T.complete))};t.allComplete=s;class a{constructor(T){Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:T}),Object.defineProperty(this,"buffer",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"toThrow",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=Promise.resolve(),this.resolve=()=>null,this.resetPromise()}get curr(){return this.buffer}get size(){return this.buffer.length}get isClosed(){return this.closed}resetPromise(){this.promise=new Promise(T=>this.resolve=T)}push(T){this.buffer.push(T),this.resolve()}pushMany(T){T.forEach(m=>this.buffer.push(m)),this.resolve()}async*events(){for(;;){if(this.closed&&this.buffer.length===0){if(this.toThrow)throw this.toThrow;return}if(await this.promise,this.toThrow)throw this.toThrow;if(this.maxSize&&this.size>this.maxSize)throw new l(this.maxSize);const[T,...m]=this.buffer;T?(this.buffer=m,yield T):this.resetPromise()}}throw(T){this.toThrow=T,this.closed=!0,this.resolve()}close(){this.closed=!0,this.resolve()}}t.AsyncBuffer=a;class l extends Error{constructor(T){super(`ReachedMaxBufferSize: ${T}`)}}t.AsyncBufferFullError=l;function u(w){return Promise.allSettled(w).then(c)}function c(w){const T=w.filter(p).map(f);if(T.length===0)return w.map(E);throw T.length===1?T[0]:new AggregateError(T,`Multiple errors: ${T.map(x).join(` +`)}`)}function p(w){return w.status==="rejected"}function f(w){return w.reason}function b(w){return w.status==="fulfilled"}function E(w){return w.value}function x(w){return w instanceof Error?w.message:String(w)}})(Sx);var Xu={};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.TID=void 0;const fl=ao,K0=13;let ad=0,V0=0,yl=null;function O0(t){return t.replaceAll("-","")}class rn{constructor(e){Object.defineProperty(this,"str",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const r=O0(e);if(r.length!==K0)throw new Error(`Poorly formatted TID: ${r.length} length`);this.str=r}static next(e){const r=Math.max(Date.now(),ad);r===ad&&V0++,ad=r;const n=r*1e3+V0;yl===null&&(yl=Math.floor(Math.random()*32));const i=rn.fromTime(n,yl);return!e||i.newerThan(e)?i:rn.fromTime(e.timestamp()+1,yl)}static nextStr(e){return rn.next(e?new rn(e):void 0).toString()}static fromTime(e,r){const n=`${(0,fl.s32encode)(e)}${(0,fl.s32encode)(r).padStart(2,"2")}`;return new rn(n)}static fromStr(e){return new rn(e)}static oldestFirst(e,r){return e.compareTo(r)}static newestFirst(e,r){return r.compareTo(e)}static is(e){return O0(e).length===K0}timestamp(){return(0,fl.s32decode)(this.str.slice(0,11))}clockid(){return(0,fl.s32decode)(this.str.slice(11,13))}formatted(){const e=this.toString();return`${e.slice(0,4)}-${e.slice(4,7)}-${e.slice(7,11)}-${e.slice(11,13)}`}toString(){return this.str}compareTo(e){return this.str>e.str?1:this.str0}olderThan(e){return this.compareTo(e)<0}}Xu.TID=rn;var Tx={};function TC(t,e){for(let r=0;re[r])return 1}return t.byteLength>e.byteLength?1:t.byteLengthi+s.length,0));const r=new Uint8Array(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function kC(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;rz1(t),decode:t=>$1(t)}),DC=Object.freeze(Object.defineProperty({__proto__:null,identity:LC},Symbol.toStringTag,{value:"Module"})),PC=je({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),BC=Object.freeze(Object.defineProperty({__proto__:null,base2:PC},Symbol.toStringTag,{value:"Module"})),UC=je({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),IC=Object.freeze(Object.defineProperty({__proto__:null,base8:UC},Symbol.toStringTag,{value:"Module"})),jC=xa({prefix:"9",name:"base10",alphabet:"0123456789"}),KC=Object.freeze(Object.defineProperty({__proto__:null,base10:jC},Symbol.toStringTag,{value:"Module"})),VC=je({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OC=je({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),NC=Object.freeze(Object.defineProperty({__proto__:null,base16:VC,base16upper:OC},Symbol.toStringTag,{value:"Module"})),MC=xa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$C=xa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),zC=Object.freeze(Object.defineProperty({__proto__:null,base36:MC,base36upper:$C},Symbol.toStringTag,{value:"Module"})),FC=je({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qC=je({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),GC=je({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),XC=je({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),HC=Object.freeze(Object.defineProperty({__proto__:null,base64:FC,base64pad:qC,base64url:GC,base64urlpad:XC},Symbol.toStringTag,{value:"Module"})),Cx=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),ZC=Cx.reduce((t,e,r)=>(t[r]=e,t),[]),WC=Cx.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function QC(t){return t.reduce((e,r)=>(e+=ZC[r],e),"")}function JC(t){const e=[];for(const r of t){const n=WC[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const YC=Gu({prefix:"🚀",name:"base256emoji",encode:QC,decode:JC}),ek=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:YC},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const N0={...DC,...BC,...IC,...KC,...NC,...pC,...zC,...nC,...HC,...ek};function kx(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const M0=kx("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ld=kx("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=new Uint8Array(t.length);for(let r=0;r{if(Array.isArray(c))return c.map(p=>(0,t.jsonToIpld)(p));if(c&&typeof c=="object"){if(typeof c.$link=="string"&&Object.keys(c).length===1)return i.CID.parse(c.$link);if(typeof c.$bytes=="string"&&Object.keys(c).length===1)return s.fromString(c.$bytes,"base64");const p={};for(const f of Object.keys(c))p[f]=(0,t.jsonToIpld)(c[f]);return p}return c};t.jsonToIpld=a;const l=c=>{if(Array.isArray(c))return c.map(p=>(0,t.ipldToJson)(p));if(c&&typeof c=="object"){if(c instanceof Uint8Array)return{$bytes:s.toString(c,"base64")};if(i.CID.asCID(c))return{$link:c.toString()};const p={};for(const f of Object.keys(c))p[f]=(0,t.ipldToJson)(c[f]);return p}return c};t.ipldToJson=l;const u=(c,p)=>{var f;if(Array.isArray(c)&&Array.isArray(p)){if(c.length!==p.length)return!1;for(let b=0;b!0,getWaitMs:i=Bx}=e;let s=0,a;for(;!a;)try{return await t()}catch(l){const u=i(s);sPx(e,{...r,retryable:t})}function Bx(t,e=100,r=1e3){const n=Math.pow(2,t)*e,i=Math.min(n,r);return ak(i)}function ak(t){const e=t*.15;return t+lk(-e,e)}function lk(t,e){return Math.random()*(e-t)+t}var Ux={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.def=t.schema=void 0;const e=ho,r=Jt,n=r.z.unknown().transform((s,a)=>{const l=e.CID.asCID(s);return l??(a.addIssue({code:r.z.ZodIssueCode.custom,message:"Not a valid CID"}),r.z.NEVER)}),i=r.z.object({version:r.z.literal(1),roots:r.z.array(n)});t.schema={cid:n,carHeader:i,bytes:r.z.instanceof(Uint8Array),string:r.z.string(),array:r.z.array(r.z.unknown()),map:r.z.record(r.z.string(),r.z.unknown()),unknown:r.z.unknown()},t.def={cid:{name:"cid",schema:t.schema.cid},carHeader:{name:"CAR header",schema:t.schema.carHeader},bytes:{name:"bytes",schema:t.schema.bytes},string:{name:"string",schema:t.schema.string},map:{name:"map",schema:t.schema.map},unknown:{name:"unknown",schema:t.schema.unknown}}})(Ux);var Ix={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.addHoursToDate=t.lessThanAgoMs=t.DAY=t.HOUR=t.MINUTE=t.SECOND=void 0,t.SECOND=1e3,t.MINUTE=t.SECOND*60,t.HOUR=t.MINUTE*60,t.DAY=t.HOUR*24;const e=(n,i)=>Date.now(){const s=i?new Date(i):new Date;return s.setHours(s.getHours()+n),s};t.addHoursToDate=r})(Ix);var rt={},wf={},_f={},Sf={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EXTENDED_PICTOGRAPHIC=t.CLUSTER_BREAK=void 0,function(e){e[e.CR=0]="CR",e[e.LF=1]="LF",e[e.CONTROL=2]="CONTROL",e[e.EXTEND=3]="EXTEND",e[e.REGIONAL_INDICATOR=4]="REGIONAL_INDICATOR",e[e.SPACINGMARK=5]="SPACINGMARK",e[e.L=6]="L",e[e.V=7]="V",e[e.T=8]="T",e[e.LV=9]="LV",e[e.LVT=10]="LVT",e[e.OTHER=11]="OTHER",e[e.PREPEND=12]="PREPEND",e[e.E_BASE=13]="E_BASE",e[e.E_MODIFIER=14]="E_MODIFIER",e[e.ZWJ=15]="ZWJ",e[e.GLUE_AFTER_ZWJ=16]="GLUE_AFTER_ZWJ",e[e.E_BASE_GAZ=17]="E_BASE_GAZ"}(t.CLUSTER_BREAK||(t.CLUSTER_BREAK={})),t.EXTENDED_PICTOGRAPHIC=101})(Sf);var Tf={};Object.defineProperty(Tf,"__esModule",{value:!0});const J=Sf,Tr=0,ud=1,uk=2,ck=3,dk=4;class pk{static isSurrogate(e,r){return 55296<=e.charCodeAt(r)&&e.charCodeAt(r)<=56319&&56320<=e.charCodeAt(r+1)&&e.charCodeAt(r+1)<=57343}static codePointAt(e,r){r===void 0&&(r=0);const n=e.charCodeAt(r);if(55296<=n&&n<=56319&&r=1){const i=e.charCodeAt(r-1),s=n;return 55296<=i&&i<=56319?(i-55296)*1024+(s-56320)+65536:s}return n}static shouldBreak(e,r,n,i,s,a){const l=[e].concat(r).concat([n]),u=[i].concat(s).concat([a]),c=l[l.length-2],p=n,f=a,b=l.lastIndexOf(J.CLUSTER_BREAK.REGIONAL_INDICATOR);if(b>0&&l.slice(1,b).every(function(x){return x===J.CLUSTER_BREAK.REGIONAL_INDICATOR})&&[J.CLUSTER_BREAK.PREPEND,J.CLUSTER_BREAK.REGIONAL_INDICATOR].indexOf(c)===-1)return l.filter(function(x){return x===J.CLUSTER_BREAK.REGIONAL_INDICATOR}).length%2===1?ck:dk;if(c===J.CLUSTER_BREAK.CR&&p===J.CLUSTER_BREAK.LF)return Tr;if(c===J.CLUSTER_BREAK.CONTROL||c===J.CLUSTER_BREAK.CR||c===J.CLUSTER_BREAK.LF)return ud;if(p===J.CLUSTER_BREAK.CONTROL||p===J.CLUSTER_BREAK.CR||p===J.CLUSTER_BREAK.LF)return ud;if(c===J.CLUSTER_BREAK.L&&(p===J.CLUSTER_BREAK.L||p===J.CLUSTER_BREAK.V||p===J.CLUSTER_BREAK.LV||p===J.CLUSTER_BREAK.LVT))return Tr;if((c===J.CLUSTER_BREAK.LV||c===J.CLUSTER_BREAK.V)&&(p===J.CLUSTER_BREAK.V||p===J.CLUSTER_BREAK.T))return Tr;if((c===J.CLUSTER_BREAK.LVT||c===J.CLUSTER_BREAK.T)&&p===J.CLUSTER_BREAK.T)return Tr;if(p===J.CLUSTER_BREAK.EXTEND||p===J.CLUSTER_BREAK.ZWJ)return Tr;if(p===J.CLUSTER_BREAK.SPACINGMARK)return Tr;if(c===J.CLUSTER_BREAK.PREPEND)return Tr;const E=u.slice(0,-1).lastIndexOf(J.EXTENDED_PICTOGRAPHIC);return E!==-1&&u[E]===J.EXTENDED_PICTOGRAPHIC&&l.slice(E+1,-2).every(function(x){return x===J.CLUSTER_BREAK.EXTEND})&&c===J.CLUSTER_BREAK.ZWJ&&f===J.EXTENDED_PICTOGRAPHIC?Tr:r.indexOf(J.CLUSTER_BREAK.REGIONAL_INDICATOR)!==-1?uk:c===J.CLUSTER_BREAK.REGIONAL_INDICATOR&&p===J.CLUSTER_BREAK.REGIONAL_INDICATOR?Tr:ud}}Tf.default=pk;var Cf={};Object.defineProperty(Cf,"__esModule",{value:!0});class fk{constructor(e,r){this._index=0,this._str=e,this._nextBreak=r}[Symbol.iterator](){return this}next(){let e;if((e=this._nextBreak(this._str,this._index))=e.length-1)return e.length;const n=ml.default.codePointAt(e,r),i=Dr.getGraphemeBreakProperty(n),s=Dr.getEmojiProperty(n),a=[],l=[];for(let u=r+1;unew TextEncoder().encode(t).byteLength;rt.utf8Len=Rk;const Ak=t=>new vk.default().countGraphemes(t);rt.graphemeLen=Ak;const wk=t=>du.toString(du.fromString(t,"utf8"),"base64url");rt.utf8ToB64Url=wk;const _k=t=>du.toString(du.fromString(t,"base64url"),"utf8");rt.b64UrlToUtf8=_k;const Sk=t=>{const e=t.match(Kx);if(!(e!=null&&e.groups))return null;const r=e.groups;return{grandfathered:r.grandfathered,language:r.language,extlang:r.extlang,script:r.script,region:r.region,variant:r.variant,extension:r.extension,privateUse:r.privateUseA||r.privateUseB}};rt.parseLanguage=Sk;const Tk=t=>Kx.test(t);rt.validateLanguage=Tk;const Kx=/^((?(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?([A-Za-z]{2,3}(-(?[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(? + + + +
+ + \ No newline at end of file diff --git a/my-blog/templates/at-browser-assets.html b/my-blog/templates/at-browser-assets.html new file mode 100644 index 0000000..3dbd52f --- /dev/null +++ b/my-blog/templates/at-browser-assets.html @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/my-blog/templates/base.html b/my-blog/templates/base.html index d85a45e..bbc497a 100644 --- a/my-blog/templates/base.html +++ b/my-blog/templates/base.html @@ -131,5 +131,6 @@ {% include "oauth-assets.html" %} + {% include "at-browser-assets.html" %} diff --git a/my-blog/templates/pds.html b/my-blog/templates/pds.html new file mode 100644 index 0000000..571f247 --- /dev/null +++ b/my-blog/templates/pds.html @@ -0,0 +1,774 @@ +{% extends "base.html" %} + +{% block title %}AT URI Browser - {{ config.title }}{% endblock %} + +{% block content %} +
+
+
+ + +
+
+
+ + +
+
+
+ + + + + + + + + + + +
+ + + + + + + +{% endblock %} \ No newline at end of file diff --git a/oauth/package.json b/oauth/package.json index b52aac6..5211ff1 100644 --- a/oauth/package.json +++ b/oauth/package.json @@ -1,6 +1,6 @@ { "name": "ailog-oauth", - "version": "0.2.9", + "version": "0.3.0", "type": "module", "scripts": { "dev": "vite", diff --git a/pds/index.html b/pds/index.html new file mode 100644 index 0000000..f46e33f --- /dev/null +++ b/pds/index.html @@ -0,0 +1,12 @@ + + + + + + AT URI Browser - syui.ai + + +
+ + + \ No newline at end of file diff --git a/pds/package.json b/pds/package.json new file mode 100644 index 0000000..abdfdec --- /dev/null +++ b/pds/package.json @@ -0,0 +1,27 @@ +{ + "name": "pds-browser", + "version": "0.3.0", + "description": "AT Protocol browser for ai.log", + "main": "index.js", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "license": "MIT", + "dependencies": { + "@atproto/api": "^0.13.0", + "@atproto/did": "^0.1.0", + "@atproto/lexicon": "^0.4.0", + "@atproto/syntax": "^0.3.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.37", + "@types/react-dom": "^18.0.11", + "@vitejs/plugin-react": "^4.0.0", + "vite": "^5.0.0" + } +} diff --git a/pds/src/App.css b/pds/src/App.css new file mode 100644 index 0000000..984a5d5 --- /dev/null +++ b/pds/src/App.css @@ -0,0 +1,128 @@ +body { + font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + margin: 0; + padding: 20px; + background-color: #f5f5f5; + line-height: 1.6; +} + +.container { + max-width: 1200px; + margin: 0 auto; + background: white; + padding: 30px; + border-radius: 10px; + box-shadow: 0 2px 10px rgba(0,0,0,0.1); +} + +h1 { + color: #333; + margin-bottom: 30px; + border-bottom: 3px solid #007acc; + padding-bottom: 10px; +} + +.test-section { + margin-bottom: 30px; + padding: 20px; + background: #f8f9fa; + border-radius: 8px; + border-left: 4px solid #007acc; +} + +.test-uris { + background: #fff; + padding: 15px; + border-radius: 5px; + border: 1px solid #ddd; + margin: 15px 0; +} + +.at-uri { + font-family: 'Monaco', 'Consolas', monospace; + background: #f4f4f4; + padding: 8px 12px; + border-radius: 4px; + margin: 10px 0; + display: block; + word-break: break-all; + cursor: pointer; + transition: background-color 0.2s; +} + +.at-uri:hover { + background: #e8e8e8; +} + +.instructions { + background: #e8f4f8; + padding: 15px; + border-radius: 5px; + margin: 15px 0; +} + +.instructions ol { + margin: 10px 0; + padding-left: 20px; +} + +.back-link { + display: inline-block; + margin-top: 20px; + color: #007acc; + text-decoration: none; + font-weight: bold; +} + +.back-link:hover { + text-decoration: underline; +} + +/* AT Browser Modal Styles */ +.at-uri-modal-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + z-index: 1000; +} + +.at-uri-modal-content { + background-color: white; + border-radius: 8px; + max-width: 800px; + max-height: 600px; + width: 90%; + height: 80%; + overflow: auto; + position: relative; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +.at-uri-modal-close { + position: absolute; + top: 10px; + right: 10px; + background: none; + border: none; + font-size: 20px; + cursor: pointer; + z-index: 1001; + padding: 5px 10px; +} + +/* AT URI Link Styles */ +[data-at-uri] { + color: #1976d2; + cursor: pointer; + text-decoration: underline; +} + +[data-at-uri]:hover { + color: #1565c0; +} \ No newline at end of file diff --git a/pds/src/App.jsx b/pds/src/App.jsx new file mode 100644 index 0000000..3cb2356 --- /dev/null +++ b/pds/src/App.jsx @@ -0,0 +1,62 @@ +import React from 'react' +import { AtUriBrowser } from './components/AtUriBrowser.jsx' +import './App.css' + +function App() { + return ( + +
+

AT URI Browser

+ +
+

テスト用 AT URI

+

以下のAT URIをクリックすると、モーダルでコンテンツが表示されます。

+ +
+
+ at://did:plc:vzsvtbtbnwn22xjqhcu3vd6y/app.bsky.feed.post/3lu5givmkc222 +
+
+ at://did:plc:vzsvtbtbnwn22xjqhcu3vd6y/app.bsky.actor.profile/self +
+
+ at://syui.ai/app.bsky.actor.profile/self +
+
+ at://bsky.app/app.bsky.actor.profile/self +
+
+ +
+

使用方法:

+
    +
  1. 上記のAT URIをクリックしてください
  2. +
  3. モーダルがポップアップし、AT Protocolレコードの内容が表示されます
  4. +
  5. モーダルは×ボタンまたはEscキーで閉じることができます
  6. +
  7. モーダルはレスポンシブ対応で、異なる画面サイズに対応します
  8. +
+
+
+ +
+

AT URI について

+

AT URIは、AT Protocolで使用される統一リソース識別子です。この形式により、分散ソーシャルネットワーク上のコンテンツを一意に識別できます。

+

このブラウザを使用することで、ブログ投稿やその他のコンテンツに埋め込まれたAT URIを直接探索することが可能です。

+ +

対応PDS環境

+
    +
  • bsky.social - メインのBlueskyネットワーク
  • +
  • syu.is - 独立したPDS環境
  • +
  • plc.directory + plc.syu.is - DID解決
  • +
+ +

注意: 独立したPDS環境では、レコードの同期状況により、一部のコンテンツが利用できない場合があります。

+
+ + ← ブログに戻る +
+
+ ) +} + +export default App \ No newline at end of file diff --git a/pds/src/components/AtUriBrowser.jsx b/pds/src/components/AtUriBrowser.jsx new file mode 100644 index 0000000..2836050 --- /dev/null +++ b/pds/src/components/AtUriBrowser.jsx @@ -0,0 +1,75 @@ +/* + * AT URI Browser Component + * Copyright (c) 2025 ai.log + * MIT License + */ + +import React, { useState, useEffect } from 'react' +import { AtUriModal } from './AtUriModal.jsx' +import { isAtUri } from '../lib/atproto.js' + +export function AtUriBrowser({ children }) { + const [modalUri, setModalUri] = useState(null) + + useEffect(() => { + const handleAtUriClick = (e) => { + const target = e.target + + // Check if clicked element has at-uri data attribute + if (target.dataset.atUri) { + e.preventDefault() + setModalUri(target.dataset.atUri) + return + } + + // Check if clicked element contains at-uri text + const text = target.textContent + if (text && isAtUri(text)) { + e.preventDefault() + setModalUri(text) + return + } + + // Check if parent element has at-uri + const parent = target.parentElement + if (parent && parent.dataset.atUri) { + e.preventDefault() + setModalUri(parent.dataset.atUri) + return + } + } + + document.addEventListener('click', handleAtUriClick) + + return () => { + document.removeEventListener('click', handleAtUriClick) + } + }, []) + + const handleAtUriClick = (uri) => { + setModalUri(uri) + } + + const handleCloseModal = () => { + setModalUri(null) + } + + return ( + <> + {children} + + + ) +} + +// Utility function to wrap at-uri text with clickable spans +export const wrapAtUris = (text) => { + const atUriRegex = /at:\/\/[^\s]+/g + return text.replace(atUriRegex, (match) => { + return `${match}` + }) +} \ No newline at end of file diff --git a/pds/src/components/AtUriJson.jsx b/pds/src/components/AtUriJson.jsx new file mode 100644 index 0000000..280b829 --- /dev/null +++ b/pds/src/components/AtUriJson.jsx @@ -0,0 +1,130 @@ +/* + * Based on frontpage/atproto-browser + * Copyright (c) 2025 The Frontpage Authors + * MIT License + */ + +import React from 'react' +import { isDid } from '@atproto/did' +import { parseAtUri, isAtUri } from '../lib/atproto.js' + +const JSONString = ({ data, onAtUriClick }) => { + const handleClick = (uri) => { + if (onAtUriClick) { + onAtUriClick(uri) + } + } + + return ( +
+      {isAtUri(data) ? (
+        <>
+          "
+           handleClick(data)}
+            style={{ 
+              color: 'blue', 
+              cursor: 'pointer',
+              textDecoration: 'underline'
+            }}
+          >
+            {data}
+          
+          "
+        
+      ) : isDid(data) ? (
+        <>
+          "
+           handleClick(`at://${data}`)}
+            style={{ 
+              color: 'blue', 
+              cursor: 'pointer',
+              textDecoration: 'underline'
+            }}
+          >
+            {data}
+          
+          "
+        
+      ) : URL.canParse(data) ? (
+        <>
+          "
+          
+            {data}
+          
+          "
+        
+      ) : (
+        `"${data}"`
+      )}
+    
+ ) +} + +const JSONValue = ({ data, onAtUriClick }) => { + if (data === null) { + return
null
+ } + + if (typeof data === 'string') { + return + } + + if (typeof data === 'number') { + return
{data}
+ } + + if (typeof data === 'boolean') { + return
{data.toString()}
+ } + + if (Array.isArray(data)) { + return ( +
+ [ + {data.map((item, index) => ( +
+ + {index < data.length - 1 && ','} +
+ ))} + ] +
+ ) + } + + if (typeof data === 'object') { + return ( +
+ {'{'} + {Object.entries(data).map(([key, value], index, entries) => ( +
+ "{key}": + {index < entries.length - 1 && ','} +
+ ))} + {'}'} +
+ ) + } + + return
{String(data)}
+} + +export default function AtUriJson({ data, onAtUriClick }) { + return ( +
+ +
+ ) +} \ No newline at end of file diff --git a/pds/src/components/AtUriModal.jsx b/pds/src/components/AtUriModal.jsx new file mode 100644 index 0000000..21e12af --- /dev/null +++ b/pds/src/components/AtUriModal.jsx @@ -0,0 +1,80 @@ +/* + * AT URI Modal Component + * Copyright (c) 2025 ai.log + * MIT License + */ + +import React, { useEffect } from 'react' +import AtUriViewer from './AtUriViewer.jsx' + +export function AtUriModal({ uri, onClose, onAtUriClick }) { + useEffect(() => { + const handleEscape = (e) => { + if (e.key === 'Escape') { + onClose() + } + } + + const handleClickOutside = (e) => { + if (e.target.classList.contains('at-uri-modal-overlay')) { + onClose() + } + } + + document.addEventListener('keydown', handleEscape) + document.addEventListener('click', handleClickOutside) + + return () => { + document.removeEventListener('keydown', handleEscape) + document.removeEventListener('click', handleClickOutside) + } + }, [onClose]) + + if (!uri) return null + + return ( +
+
+ + + +
+
+ ) +} \ No newline at end of file diff --git a/pds/src/components/AtUriViewer.jsx b/pds/src/components/AtUriViewer.jsx new file mode 100644 index 0000000..0d77107 --- /dev/null +++ b/pds/src/components/AtUriViewer.jsx @@ -0,0 +1,111 @@ +/* + * Based on frontpage/atproto-browser + * Copyright (c) 2025 The Frontpage Authors + * MIT License + */ + +import React, { useState, useEffect } from 'react' +import { parseAtUri, getRecord } from '../lib/atproto.js' +import AtUriJson from './AtUriJson.jsx' + +export default function AtUriViewer({ uri, onAtUriClick }) { + const [record, setRecord] = useState(null) + const [loading, setLoading] = useState(true) + const [error, setError] = useState(null) + + useEffect(() => { + const loadRecord = async () => { + if (!uri) return + + setLoading(true) + setError(null) + + try { + console.log('Loading AT URI:', uri) + const atUri = parseAtUri(uri) + if (!atUri) { + throw new Error('Invalid AT URI') + } + + console.log('Parsed AT URI:', { + hostname: atUri.hostname, + collection: atUri.collection, + rkey: atUri.rkey + }) + + const result = await getRecord(atUri.hostname, atUri.collection, atUri.rkey) + + console.log('getRecord result:', result) + + if (!result.success) { + throw new Error(result.error) + } + + setRecord(result.data) + } catch (err) { + console.error('AtUriViewer error:', err) + setError(err.message) + } finally { + setLoading(false) + } + } + + loadRecord() + }, [uri]) + + if (loading) { + return ( +
+
Loading...
+
+ ) + } + + if (error) { + return ( +
+
Error: {error}
+
+ URI: {uri} +
+
+ デバッグ情報: このAT URIは有効ではないか、レコードが存在しません。 +
+
+ ) + } + + if (!record) { + return ( +
+
No record found
+
+ ) + } + + const atUri = parseAtUri(uri) + + return ( +
+
+

AT URI Record

+
+ {uri} +
+
+ DID: {atUri.hostname} | Collection: {atUri.collection} | RKey: {atUri.rkey} +
+
+ +
+

Record Data

+ +
+
+ ) +} \ No newline at end of file diff --git a/pds/src/config.js b/pds/src/config.js new file mode 100644 index 0000000..244aeb9 --- /dev/null +++ b/pds/src/config.js @@ -0,0 +1,33 @@ +/* + * AT Protocol Configuration for syu.is environment + */ + +export const AT_PROTOCOL_CONFIG = { + // Primary PDS environment (syu.is) + primary: { + pds: 'https://syu.is', + plc: 'https://plc.syu.is', + bsky: 'https://bsky.syu.is', + web: 'https://web.syu.is' + }, + + // Fallback PDS environment (bsky.social) + fallback: { + pds: 'https://bsky.social', + plc: 'https://plc.directory', + bsky: 'https://public.api.bsky.app', + web: 'https://bsky.app' + } +} + +export const getPDSConfig = (pds) => { + // Map PDS URL to appropriate config + if (pds.includes('syu.is')) { + return AT_PROTOCOL_CONFIG.primary + } else if (pds.includes('bsky.social')) { + return AT_PROTOCOL_CONFIG.fallback + } + + // Default to primary for unknown PDS + return AT_PROTOCOL_CONFIG.primary +} \ No newline at end of file diff --git a/pds/src/index.js b/pds/src/index.js new file mode 100644 index 0000000..2e82f25 --- /dev/null +++ b/pds/src/index.js @@ -0,0 +1,9 @@ +/* + * Based on frontpage/atproto-browser + * Copyright (c) 2025 The Frontpage Authors + * MIT License + */ + +export { AtUriBrowser } from './components/AtUriBrowser.jsx' +export { AtUriModal } from './components/AtUriModal.jsx' +export { default as AtUriViewer } from './components/AtUriViewer.jsx' \ No newline at end of file diff --git a/pds/src/lib/atproto.js b/pds/src/lib/atproto.js new file mode 100644 index 0000000..5a92b2b --- /dev/null +++ b/pds/src/lib/atproto.js @@ -0,0 +1,165 @@ +/* + * Based on frontpage/atproto-browser + * Copyright (c) 2025 The Frontpage Authors + * MIT License + */ + +import { AtpBaseClient } from '@atproto/api' +import { AtUri } from '@atproto/syntax' +import { isDid } from '@atproto/did' +import { AT_PROTOCOL_CONFIG } from '../config.js' + +// Identity resolution cache +const identityCache = new Map() + +// Create AT Protocol client +export const createAtpClient = (pds) => { + return new AtpBaseClient({ + service: pds.startsWith('http') ? pds : `https://${pds}` + }) +} + +// Resolve identity (DID/Handle) +export const resolveIdentity = async (identifier) => { + if (identityCache.has(identifier)) { + return identityCache.get(identifier) + } + + try { + let did = identifier + + // If it's a handle, resolve to DID + if (!isDid(identifier)) { + // Try syu.is first, then fallback to bsky.social + let resolved = false + + try { + const client = createAtpClient(AT_PROTOCOL_CONFIG.primary.pds) + const response = await client.com.atproto.repo.describeRepo({ repo: identifier }) + did = response.data.did + resolved = true + } catch (error) { + console.log('Failed to resolve from syu.is:', error) + } + + if (!resolved) { + try { + const client = createAtpClient(AT_PROTOCOL_CONFIG.fallback.pds) + const response = await client.com.atproto.repo.describeRepo({ repo: identifier }) + did = response.data.did + } catch (error) { + throw new Error(`Failed to resolve handle: ${identifier}`) + } + } + } + + // Get DID document to find PDS + // Try plc.syu.is first, then fallback to plc.directory + let didDoc = null + let plcResponse = null + + try { + plcResponse = await fetch(`${AT_PROTOCOL_CONFIG.primary.plc}/${did}`) + if (plcResponse.ok) { + didDoc = await plcResponse.json() + } + } catch (error) { + console.log('Failed to resolve from plc.syu.is:', error) + } + + // If plc.syu.is fails, try plc.directory + if (!didDoc) { + try { + plcResponse = await fetch(`${AT_PROTOCOL_CONFIG.fallback.plc}/${did}`) + if (plcResponse.ok) { + didDoc = await plcResponse.json() + } + } catch (error) { + console.log('Failed to resolve from plc.directory:', error) + } + } + + if (!didDoc) { + throw new Error(`Failed to resolve DID document from any PLC server`) + } + + // Find PDS service endpoint + const pdsService = didDoc.service?.find(service => + service.type === 'AtprotoPersonalDataServer' || + service.id === '#atproto_pds' + ) + + if (!pdsService) { + throw new Error('No PDS service found in DID document') + } + + const result = { + success: true, + didDocument: didDoc, + pdsUrl: pdsService.serviceEndpoint + } + + identityCache.set(identifier, result) + return result + } catch (error) { + const result = { + success: false, + error: error.message + } + identityCache.set(identifier, result) + return result + } +} + +// Get record from AT Protocol +export const getRecord = async (did, collection, rkey) => { + try { + console.log('getRecord called with:', { did, collection, rkey }) + + const identityResult = await resolveIdentity(did) + console.log('resolveIdentity result:', identityResult) + + if (!identityResult.success) { + return { success: false, error: identityResult.error } + } + + const pdsUrl = identityResult.pdsUrl + console.log('Using PDS URL:', pdsUrl) + + const client = createAtpClient(pdsUrl) + + const response = await client.com.atproto.repo.getRecord({ + repo: did, + collection, + rkey + }) + + console.log('getRecord response:', response) + + return { + success: true, + data: response.data, + pdsUrl + } + } catch (error) { + console.error('getRecord error:', error) + return { + success: false, + error: error.message + } + } +} + +// Parse AT URI +export const parseAtUri = (uri) => { + try { + return new AtUri(uri) + } catch (error) { + return null + } +} + +// Check if string is AT URI +export const isAtUri = (str) => { + return str.startsWith('at://') && str.split(' ').length === 1 +} \ No newline at end of file diff --git a/pds/src/main.jsx b/pds/src/main.jsx new file mode 100644 index 0000000..6161d18 --- /dev/null +++ b/pds/src/main.jsx @@ -0,0 +1,9 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.jsx' + +ReactDOM.createRoot(document.getElementById('root')).render( + + + , +) \ No newline at end of file diff --git a/pds/vite.config.js b/pds/vite.config.js new file mode 100644 index 0000000..e21c23d --- /dev/null +++ b/pds/vite.config.js @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +export default defineConfig({ + plugins: [react()], + base: '/pds/', + define: { + 'process.env.NODE_ENV': JSON.stringify('production') + } +}) \ No newline at end of file diff --git a/scpt/run.zsh b/scpt/run.zsh index 704f4b9..78f3193 100755 --- a/scpt/run.zsh +++ b/scpt/run.zsh @@ -5,6 +5,7 @@ function _env() { ailog=$d/target/release/ailog oauth=$d/oauth myblog=$d/my-blog + pds=$d/pds port=4173 #source $oauth/.env.production case $OSTYPE in @@ -43,6 +44,21 @@ function _oauth_build() { #npm run preview } +function _pds_build() { + cd $pds + nvm use 21 + npm i + npm run build + rm -rf $myblog/static/pds + cp -rf dist $myblog/static/pds +} + +function _pds_server() { + cd $pds + nvm use 21 + npm run preview +} + function _server_comment() { cargo build --release @@ -65,6 +81,12 @@ case "${1:-serve}" in oauth|o) _oauth_build ;; + pds|p) + _pds_build + ;; + pds-server|ps) + _pds_server + ;; n) oauth=$d/oauth_old _oauth_build diff --git a/src/commands/serve.rs b/src/commands/serve.rs index 77e45a2..219e394 100644 --- a/src/commands/serve.rs +++ b/src/commands/serve.rs @@ -328,7 +328,7 @@ async fn serve_file(path: &str) -> Result<(&'static str, Vec, &'static str)> // Remove query parameters from path let clean_path = path.split('?').next().unwrap_or(path); - let file_path = if clean_path == "/" { + let mut file_path = if clean_path == "/" { PathBuf::from("public/index.html") } else { PathBuf::from("public").join(clean_path.trim_start_matches('/')) @@ -337,9 +337,42 @@ async fn serve_file(path: &str) -> Result<(&'static str, Vec, &'static str)> println!("Serving file: {}", file_path.display()); // Check if file exists and get metadata - let metadata = tokio::fs::metadata(&file_path).await?; - if !metadata.is_file() { - return Err(anyhow::anyhow!("Not a file: {}", file_path.display())); + let metadata = tokio::fs::metadata(&file_path).await; + + match metadata { + Ok(meta) if meta.is_file() => { + // File exists, proceed normally + } + Ok(meta) if meta.is_dir() => { + // Directory exists, try to serve index.html + file_path = file_path.join("index.html"); + println!("Directory found, trying index.html: {}", file_path.display()); + let index_metadata = tokio::fs::metadata(&file_path).await?; + if !index_metadata.is_file() { + return Err(anyhow::anyhow!("No index.html in directory: {}", file_path.display())); + } + } + Ok(_) => { + return Err(anyhow::anyhow!("Not a file: {}", file_path.display())); + } + Err(e) => { + // Try adding index.html to the original path + let index_path = PathBuf::from("public") + .join(clean_path.trim_start_matches('/')) + .join("index.html"); + + println!("File not found, trying index.html: {}", index_path.display()); + let index_metadata = tokio::fs::metadata(&index_path).await; + if let Ok(meta) = index_metadata { + if meta.is_file() { + file_path = index_path; + } else { + return Err(anyhow::anyhow!("Original error: {}", e)); + } + } else { + return Err(anyhow::anyhow!("File not found: {}", file_path.display())); + } + } } let (content_type, cache_control) = match file_path.extension().and_then(|ext| ext.to_str()) { diff --git a/src/generator.rs b/src/generator.rs index 47c6906..f5cd32e 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -86,6 +86,9 @@ impl Generator { } } + // Generate PDS page + self.generate_pds_page().await?; + println!("{} {} posts", "Generated".cyan(), posts.len()); Ok(()) @@ -491,6 +494,30 @@ impl Generator { Ok(()) } + async fn generate_pds_page(&self) -> Result<()> { + let public_dir = self.base_path.join("public"); + let pds_dir = public_dir.join("pds"); + fs::create_dir_all(&pds_dir)?; + + // Generate PDS page using the pds.html template + let config_with_timestamp = self.create_config_with_timestamp()?; + let mut context = tera::Context::new(); + context.insert("config", &config_with_timestamp); + context.insert("site", &self.config.site); + context.insert("page", &serde_json::json!({ + "title": "AT URI Browser", + "description": "AT Protocol レコードをブラウズし、分散SNSのコンテンツを探索できます" + })); + + let rendered_content = self.template_engine.render("pds.html", &context)?; + let output_path = pds_dir.join("index.html"); + fs::write(output_path, rendered_content)?; + + println!("{} PDS page", "Generated".cyan()); + + Ok(()) + } + fn extract_plain_text(&self, html_content: &str) -> String { // Remove HTML tags and extract plain text let mut text = String::new(); @@ -536,6 +563,7 @@ pub struct Post { pub extra: Option, } + #[derive(Debug, Clone, serde::Serialize)] pub struct Translation { pub lang: String,