@powerhousedao/connect 1.0.0-sky.184 → 1.0.0-sky.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/assets/{app-xkQmjDch.js → app-CEjUVP0-.js} +6 -6
  2. package/dist/assets/{app-xkQmjDch.js.map → app-CEjUVP0-.js.map} +1 -1
  3. package/dist/assets/{app-loader-BBe4M2Ml.js → app-loader-BNyCiyDz.js} +3 -3
  4. package/dist/assets/{app-loader-BBe4M2Ml.js.map → app-loader-BNyCiyDz.js.map} +1 -1
  5. package/dist/assets/{browser-CEARsm5L.js → browser-CPcl7U5g.js} +4 -4
  6. package/dist/assets/{browser-CEARsm5L.js.map → browser-CPcl7U5g.js.map} +1 -1
  7. package/dist/assets/{ccip-DA9iGsQE.js → ccip-C6tafvYY.js} +2 -2
  8. package/dist/assets/{ccip-DA9iGsQE.js.map → ccip-C6tafvYY.js.map} +1 -1
  9. package/dist/assets/content-C7DGe_qU.js +92 -0
  10. package/dist/assets/content-C7DGe_qU.js.map +1 -0
  11. package/dist/assets/{editor-Bi10PLX-.js → editor-60KSeLXl.js} +2 -2
  12. package/dist/assets/{editor-Bi10PLX-.js.map → editor-60KSeLXl.js.map} +1 -1
  13. package/dist/assets/{editor-Bs04MLzK.js → editor-B5mvOgOD.js} +2 -2
  14. package/dist/assets/{editor-Bs04MLzK.js.map → editor-B5mvOgOD.js.map} +1 -1
  15. package/dist/assets/{editor-CaH9gYrb.js → editor-C0aQEn9c.js} +2 -2
  16. package/dist/assets/{editor-CaH9gYrb.js.map → editor-C0aQEn9c.js.map} +1 -1
  17. package/dist/assets/{editor-BD8Wk4kt.js → editor-Dbz8kQvZ.js} +2 -2
  18. package/dist/assets/{editor-BD8Wk4kt.js.map → editor-Dbz8kQvZ.js.map} +1 -1
  19. package/dist/assets/{editors-BH6MLE1z.js → editors-CUAsvgKz.js} +5 -5
  20. package/dist/assets/{editors-BH6MLE1z.js.map → editors-CUAsvgKz.js.map} +1 -1
  21. package/dist/assets/{index-CMLoiw55.js → index-g4Q6-PRA.js} +2 -2
  22. package/dist/assets/{index-CMLoiw55.js.map → index-g4Q6-PRA.js.map} +1 -1
  23. package/dist/assets/{index-D_kQ8OEz.js → index-h9lOUGxV.js} +3 -3
  24. package/dist/assets/{index-D_kQ8OEz.js.map → index-h9lOUGxV.js.map} +1 -1
  25. package/dist/assets/{main.yZTQnvvE.js → main.AX2O67pt.js} +2 -2
  26. package/dist/assets/{main.yZTQnvvE.js.map → main.AX2O67pt.js.map} +1 -1
  27. package/dist/assets/{root-DIxTzlKD.js → root-C784bEPE.js} +2 -2
  28. package/dist/assets/{root-DIxTzlKD.js.map → root-C784bEPE.js.map} +1 -1
  29. package/dist/assets/{router-rzs8I7Wj.js → router-0g625aul.js} +4 -4
  30. package/dist/assets/{router-rzs8I7Wj.js.map → router-0g625aul.js.map} +1 -1
  31. package/dist/assets/{useUiNodes-DH62DyAC.js → useUiNodes-DYMt05zv.js} +2 -2
  32. package/dist/assets/{useUiNodes-DH62DyAC.js.map → useUiNodes-DYMt05zv.js.map} +1 -1
  33. package/dist/index.html +6 -6
  34. package/dist/service-worker.js +1 -1
  35. package/dist/swEnv.js +5 -5
  36. package/dist/vite-envs.sh +5 -5
  37. package/package.json +2 -2
  38. package/dist/assets/content-DAePlLHb.js +0 -92
  39. package/dist/assets/content-DAePlLHb.js.map +0 -1
  40. package/dist/icons.svg +0 -302
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CMLoiw55.js","assets/main.yZTQnvvE.js","assets/app-loader-BBe4M2Ml.js","assets/app-loader-DoI5W0wZ.css","assets/browser-CEARsm5L.js","assets/router-rzs8I7Wj.js"])))=>i.map(i=>d[i]);
2
- var VU=Object.defineProperty;var VE=t=>{throw TypeError(t)};var ZU=(t,e,r)=>e in t?VU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ZE=(t,e,r)=>ZU(t,typeof e!="symbol"?e+"":e,r),Gy=(t,e,r)=>e.has(t)||VE("Cannot "+r);var Ir=(t,e,r)=>(Gy(t,e,"read from private field"),r?r.call(t):e.get(t)),Ja=(t,e,r)=>e.has(t)?VE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),yd=(t,e,r,n)=>(Gy(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ma=(t,e,r)=>(Gy(t,e,"access private method"),r);import{_ as xf}from"./main.yZTQnvvE.js";import{jsx as et,jsxs as Yr,Fragment as xI}from"react/jsx-runtime";import{AddLocalDriveModal as HU,AddRemoteDriveModal as WU,ConnectConfirmationModal as YU,ReadRequiredModal as EI,FILE as Pb,LOCAL as JU,ERROR as KU,CreateDocumentModal as GU,Modal as XU,Icon as xh,Combobox as Rd,Button as Vc,FormInput as HE,ConnectDeleteDriveModal as QU,ConnectDeleteItemModal as ez,DriveSettingsModal as tz,SettingsModal as rz,DocumentSelectSettingsRow as nz,ClearStorageSettingsRow as iz,DependencyVersions as az,ConnectUpgradeDriveModal as sz,CookieBanner as oz,WagmiContext as uz,UiNodesContextProvider as cz,ToastContainer as lz}from"@powerhousedao/design-system";import*as mt from"react";import Us,{createElement as rf,isValidElement as Km,cloneElement as dz,Children as fz,createContext as L_,useContext as jp,useState as ii,useRef as Gm,useEffect as vi,useReducer as pz,useDebugValue as hz,useCallback as Cr,useMemo as Fo,Suspense as mz}from"react";import{g as SI,a as j_,c as ks,s as Eh,p as gz}from"./app-loader-BBe4M2Ml.js";function yz(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Bb(){return Bb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bb.apply(null,arguments)}var Fs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function SIe(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 vz={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const bz=$p(vz);var wz=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function WE(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(bz[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(wz),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var _z=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,xz=/^\s*$/,Ez=Object.create(null);function TI(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(TI,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Sz={parse:function(t,e){e||(e={}),e.components||(e.components=Ez);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(_z,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),p=c+u.length,h=t.charAt(p);if(f){var m=WE(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=WE(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!h||h==="<"||r.children.push({type:"text",content:t.slice(p,t.indexOf("<",p))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&h!=="<"&&h)){l=a===-1?n:i[a].children;var y=t.indexOf("<",p),g=t.slice(p,y===-1?void 0:y);xz.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+TI("",r)},"")}};function Nm(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const YE={};function Xm(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&YE[e[0]]||(typeof e[0]=="string"&&(YE[e[0]]=new Date),Nm(...e))}const DI=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function JE(t,e,r){t.loadNamespaces(e,DI(t,r))}function KE(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,DI(t,n))}function Tz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function Dz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Xm("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):Tz(t,e,r)}function Xy(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Qy(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?Zc(e):e}function Az(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Km(e))}function Zc(t){return Array.isArray(t)?t:[t]}function Nz(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function AI(t,e){if(!t)return"";let r="";const n=Zc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Km(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=AI(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Nm("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Nm("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Nm("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function Iz(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){Zc(y).forEach(b=>{typeof b!="string"&&(Xy(b)?c(Qy(b)):typeof b=="object"&&!Km(b)&&Object.assign(u,b))})}c(t);const l=Sz.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,b){const _=Qy(y),E=h(_,g.children,b);return Az(_)&&E.length===0||y.props&&y.props.i18nIsDynamicList?_:E}function p(y,g,b,_,E){y.dummy?(y.children=g,b.push(dz(y,{key:_},E?void 0:g))):b.push(...fz.map([y],x=>{const D={...x.props};return delete D.i18nIsDynamicList,Us.createElement(x.type,Bb({},D,{key:_,ref:x.ref},E?{}:{children:g}))}))}function h(y,g,b){const _=Zc(y);return Zc(g).reduce((x,D,M)=>{const F=D.children&&D.children[0]&&D.children[0].content&&r.services.interpolator.interpolate(D.children[0].content,d,r.language);if(D.type==="tag"){let k=_[parseInt(D.name,10)];b.length===1&&!k&&(k=b[0][D.name]),k||(k={});const $=Object.keys(D.attrs).length!==0?Nz({props:D.attrs},k):k,T=Km($),A=T&&Xy(D,!0)&&!D.voidElement,v=o&&typeof $=="object"&&$.dummy&&!T,w=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,D.name);if(typeof $=="string"){const N=r.services.interpolator.interpolate($,d,r.language);x.push(N)}else if(Xy($)||A){const N=f($,D,b);p($,N,x,M)}else if(v){const N=h(_,D.children,b);p($,N,x,M)}else if(Number.isNaN(parseFloat(D.name)))if(w){const N=f($,D,b);p($,N,x,M,D.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(D.name)>-1)if(D.voidElement)x.push(rf(D.name,{key:`${D.name}-${M}`}));else{const N=h(_,D.children,b);x.push(rf(D.name,{key:`${D.name}-${M}`},N))}else if(D.voidElement)x.push(`<${D.name} />`);else{const N=h(_,D.children,b);x.push(`<${D.name}>${N}</${D.name}>`)}else if(typeof $=="object"&&!T){const N=D.children[0]?F:null;N&&x.push(N)}else p($,F,x,M,D.children.length!==1||!F)}else if(D.type==="text"){const k=n.transWrapTextNodes,$=a?n.unescape(r.services.interpolator.interpolate(D.content,d,r.language)):r.services.interpolator.interpolate(D.content,d,r.language);k?x.push(rf(k,{key:`${D.name}-${M}`},$)):x.push($)}return x},[])}const m=h([{dummy:!0,children:t||[]}],l,Zc(t||[]));return Qy(m[0])}function Cz(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const m=d||j_();if(!m)return Xm("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(A=>A);a&&(s.context=a);const g={...SI(),...m.options&&m.options.react};let b=l||y.ns||m.options&&m.options.defaultNS;b=typeof b=="string"?[b]:b||["translation"];const _=AI(e,g),E=u||_||g.transEmptyNodeValue||i,{hashTransKey:x}=g,D=i||(x?x(_||E):_||E);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const M=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...M,defaultValue:E,ns:b},k=D?y(D,F):E;c&&Object.keys(c).forEach(A=>{const v=c[A];if(typeof v.type=="function"||!v.props||!v.props.children||k.indexOf(`${A}/>`)<0&&k.indexOf(`${A} />`)<0)return;function w(){return Us.createElement(Us.Fragment,null,v)}c[A]=Us.createElement(w,null)});const $=Iz(c||e,k,m,g,F,p),T=n!==void 0?n:g.defaultTransParent;return T?rf(T,h,$):$}const NI=L_();class Oz{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function II(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const{i18n:m,defaultNS:y}=jp(NI)||{},g=d||m||j_(),b=f||g&&g.t.bind(g);return Cz({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||b&&b.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:p,...h})}const Mz=(t,e)=>{const r=Gm();return vi(()=>{r.current=t},[t,e]),r.current};function nc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=jp(NI)||{},a=r||n||j_();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Oz),!a){Xm("You will need to pass in an i18next instance by using initReactI18next");const _=(x,D)=>typeof D=="string"?D:D&&typeof D=="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(x)?x[x.length-1]:x,E=[_,{},!1];return E.t=_,E.i18n={},E.ready=!1,E}a.options.react&&a.options.react.wait!==void 0&&Xm("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...SI(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(_=>Dz(_,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,p]=ii(d);let h=c.join();e.lng&&(h=`${e.lng}${h}`);const m=Mz(h),y=Gm(!0);vi(()=>{const{bindI18n:_,bindI18nStore:E}=s;y.current=!0,!l&&!o&&(e.lng?KE(a,e.lng,c,()=>{y.current&&p(d)}):JE(a,c,()=>{y.current&&p(d)})),l&&m&&m!==h&&y.current&&p(d);function x(){y.current&&p(d)}return _&&a&&a.on(_,x),E&&a&&a.store.on(E,x),()=>{y.current=!1,_&&a&&_.split(" ").forEach(D=>a.off(D,x)),E&&a&&E.split(" ").forEach(D=>a.store.off(D,x))}},[a,h]);const g=Gm(!0);vi(()=>{y.current&&!g.current&&p(d),g.current=!1},[a,u]);const b=[f,a,l];if(b.t=f,b.i18n=a,b.ready=l,l||!l&&!o)return b;throw new Promise(_=>{e.lng?KE(a,e.lng,c,()=>_()):JE(a,c,()=>_())})}const na={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""};let kz=0;function $n(t,e){const r=`atom${++kz}`,n={toString(){return(na?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Rz,n.write=Fz),e&&(n.write=e),n}function Rz(t){return t(this)}function Fz(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const GE=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,ev=t=>"init"in t,tv=t=>!!t.write,Qm=new WeakMap,Lb=t=>{var e;return jb(t)&&!((e=Qm.get(t))!=null&&e[1])},Pz=(t,e)=>{const r=Qm.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((na?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Bz=t=>{if(Qm.has(t))return;const e=[new Set,!1];Qm.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},jb=t=>typeof(t==null?void 0:t.then)=="function",XE=t=>"v"in t||"e"in t,Sh=t=>{if("e"in t)throw t.e;if((na?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},CI=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},QE=(t,e,r,n,i)=>{var a;if((na?"production":void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,i.n),Lb(r.v)&&CI(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&Lz(t,n,e)},yc=()=>[new Map,new Map,new Set],rv=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},Lz=(t,e,r)=>{const n=t[0].get(e);n&&n.add(r)},jz=(t,e)=>t[0].get(e),eS=(t,e)=>{t[2].add(e)},oo=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();const i=new Set(t[1].values());t[1].clear();const a=new Set(t[2]);t[2].clear(),i.forEach(s=>{var o;return(o=s.m)==null?void 0:o.l.forEach(n)}),a.forEach(n)}if(r)throw e},OI=(...[t,e,r,n])=>{let i;(na?"production":void 0)!=="production"&&(i=new Set);const a=(_,E,x)=>{const D="v"in E,M=E.v,F=Lb(E.v)?E.v:null;if(jb(x)){Bz(x);for(const k of E.d.keys())CI(_,x,t(k));E.v=x,delete E.e}else E.v=x,delete E.e;(!D||!Object.is(M,E.v))&&(++E.n,F&&Pz(F,x))},s=(_,E,x)=>{var D;const M=t(E);if(XE(M)&&(M.m&&!(x!=null&&x.has(E))||Array.from(M.d).every(([v,w])=>s(_,v,x).n===w)))return M;M.d.clear();let F=!0;const k=v=>{if(GE(E,v)){const N=t(v);if(!XE(N))if(ev(v))a(v,N,v.init);else throw new Error("no atom init");return Sh(N)}const w=s(_,v,x);try{return Sh(w)}finally{if(F)QE(_,E,M,v,w);else{const N=yc();QE(N,E,M,v,w),p(N,E,M),oo(N)}}};let $,T;const A={get signal(){return $||($=new AbortController),$.signal},get setSelf(){return(na?"production":void 0)!=="production"&&!tv(E)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&tv(E)&&(T=(...v)=>{if((na?"production":void 0)!=="production"&&F&&console.warn("setSelf function cannot be called in sync"),!F)return f(E,...v)}),T}};try{const v=e(E,k,A);if(a(E,M,v),jb(v)){(D=v.onCancel)==null||D.call(v,()=>$==null?void 0:$.abort());const w=()=>{if(M.m){const N=yc();p(N,E,M),oo(N)}};v.then(w,w)}return M}catch(v){return delete M.v,M.e=v,++M.n,M}finally{F=!1}},o=_=>Sh(s(void 0,_)),u=(_,E,x)=>{var D,M;const F=new Map;for(const k of((D=x.m)==null?void 0:D.t)||[])F.set(k,t(k));for(const k of x.p)F.set(k,t(k));return(M=jz(_,E))==null||M.forEach(k=>{F.set(k,t(k))}),F};function c(_,E,x){const D=[],M=new Set,F=new Set,k=[[E,x]];for(;k.length>0;){const[$,T]=k[k.length-1];if(F.has($)){k.pop();continue}if(M.has($)){D.push([$,T,T.n]),F.add($),k.pop();continue}M.add($);for(const[A,v]of u(_,$,T))$!==A&&!M.has(A)&&k.push([A,v])}return[D,F]}const l=(_,E,x)=>{const[D,M]=c(_,E,x),F=new Set([E]);for(let k=D.length-1;k>=0;--k){const[$,T,A]=D[k];let v=!1;for(const w of T.d.keys())if(w!==$&&F.has(w)){v=!0;break}v&&(s(_,$,M),p(_,$,T),A!==T.n&&(rv(_,$,T),F.add($))),M.delete($)}},d=(_,E,...x)=>{let D=!0;const M=k=>Sh(s(_,k)),F=(k,...$)=>{const T=t(k);try{if(GE(E,k)){if(!ev(k))throw new Error("atom not writable");const A=T.n,v=$[0];a(k,T,v),p(_,k,T),A!==T.n&&(rv(_,k,T),l(_,k,T));return}else return d(_,k,...$)}finally{D||oo(_)}};try{return r(E,M,F,...x)}finally{D=!1}},f=(_,...E)=>{const x=yc();try{return d(x,_,...E)}finally{oo(x)}},p=(_,E,x)=>{if(x.m&&!Lb(x.v)){for(const D of x.d.keys())x.m.d.has(D)||(h(_,D,t(D)).t.add(E),x.m.d.add(D));for(const D of x.m.d||[])if(!x.d.has(D)){x.m.d.delete(D);const M=m(_,D,t(D));M==null||M.t.delete(E)}}},h=(_,E,x)=>{if(!x.m){s(_,E);for(const D of x.d.keys())h(_,D,t(D)).t.add(E);if(x.m={l:new Set,d:new Set(x.d.keys()),t:new Set},(na?"production":void 0)!=="production"&&i.add(E),tv(E)){const D=x.m;let M;const F=(k,$)=>{let T=!0;M=(...A)=>{try{return d(k,E,...A)}finally{T||oo(k)}};try{return $()}finally{T=!1}};eS(_,()=>{const k=F(_,()=>n(E,(...$)=>M(...$)));k&&(D.u=$=>F($,k))})}}return x.m},m=(_,E,x)=>{if(x.m&&!x.m.l.size&&!Array.from(x.m.t).some(D=>{var M;return(M=t(D).m)==null?void 0:M.d.has(E)})){const D=x.m.u;D&&eS(_,()=>D(_)),delete x.m,(na?"production":void 0)!=="production"&&i.delete(E);for(const M of x.d.keys()){const F=m(_,M,t(M));F==null||F.t.delete(E)}return}return x.m},b={get:o,set:f,sub:(_,E)=>{const x=yc(),D=t(_),F=h(x,_,D).l;return F.add(E),oo(x),()=>{F.delete(E);const k=yc();m(k,_,D),oo(k)}},unstable_derive:_=>OI(..._(t,e,r,n))};return(na?"production":void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:E=>{const x=t(E);if(x.n!==0)return x}}),dev4_get_mounted_atoms:()=>i,dev4_restore_atoms:E=>{const x=yc();for(const[D,M]of E)if(ev(D)){const F=t(D),k=F.n;a(D,F,M),p(x,D,F),k!==F.n&&(rv(x,D,F),l(x,D,F))}oo(x)}}),b},$_=()=>{const t=new WeakMap;return OI(r=>{if((na?"production":void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var i;return(i=r.onMount)==null?void 0:i.call(r,...n)})};let vd;const $z=()=>(vd||(vd=$_(),(na?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=vd),globalThis.__JOTAI_DEFAULT_STORE__!==vd&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),vd),MI={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},kI=L_(void 0),RI=t=>jp(kI)||$z(),Uz=({children:t,store:e})=>{const r=Gm();return!e&&!r.current&&(r.current=$_()),rf(kI.Provider,{value:e||r.current},t)},FI=t=>typeof(t==null?void 0:t.then)=="function",zz=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},qz=Us.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(zz(t),t)}),nv=new WeakMap,Vz=t=>{let e=nv.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{if((MI?"production":void 0)!=="production"&&c===u)throw new Error("[Bug] p is not updated even after cancelation");FI(c)?(nv.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),nv.set(t,e)),e};function Up(t,e){const r=RI(),[[n,i,a],s]=pz(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),vi(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),hz(o),FI(o)){const c=Vz(o);return qz(c)}return o}function Zz(t,e){const r=RI();return Cr((...i)=>{if((MI?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...i)},[r,t])}function La(t,e){return[Up(t),Zz(t)]}const Ef={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},Hz=Symbol((Ef?"production":void 0)!=="production"?"RESET":"");function Wz(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const Yz=t=>typeof(t==null?void 0:t.then)=="function";function Jz(t=()=>{try{return window.localStorage}catch(r){(Ef?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(r);return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=h=>{if(h=h||"",n!==h){try{i=JSON.parse(h,e==null?void 0:e.reviver)}catch{return c}n=h}return i},p=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return Yz(p)?p.then(f):f(p)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let p;try{p=JSON.parse(f||"")}catch{p=d}l(p)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const Kz=Jz();function PI(t,e,r=Kz,n){const i=$n(e);return(Ef?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},$n(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===Hz?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const tS=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),Gz=new WeakMap,Xz=(t,e,r)=>{const n=tS(()=>new WeakMap,Gz,e);return tS(t,n,r)},Qz=t=>t instanceof Promise,eq=()=>{};function BI(t,e=eq){return Xz(()=>{const r=new WeakMap,n=new WeakMap,i=$n(0);(Ef?"production":void 0)!=="production"&&(i.debugPrivate=!0);const a=$n((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!Qz(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,(Ef?"production":void 0)!=="production"&&(a.debugPrivate=!0),$n(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}function TIe(t){const e=$n(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const Fd=ks.routerBasename,zp=(t,e,r,n)=>PI(`${Fd}:${t}`,e,void 0),tq=(t,e,r)=>PI(t,e,{getItem(n,i){const a=localStorage.getItem(`${Fd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${Fd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${Fd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${Fd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),rq="acceptedCookies",nq=zp(rq,{analytics:!1,marketing:!1,functional:!1}),U_=()=>La(nq),iq="display-cookie-banner",aq=zp(iq,!0),sq=()=>La(aq);function oq(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return et(HU,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const uq=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),cq=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),lq=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),dq=/[^\p{L}\d]+/giu,rS="$1\0$2",nS="";function LI(t){let e=t.trim();e=e.replace(uq,rS).replace(cq,rS),e=e.replace(dq,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function fq(t){const e=LI(t);for(let r=0;r<e.length;r++){const n=e[r],i=lq.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function jI(t,e){const[r,n,i]=gq(t,e),a=pq(e==null?void 0:e.locale),s=hq(e==null?void 0:e.locale),o=mq(a,s);return r+n.map(o).join("")+i}function pq(t){return e=>e.toLocaleLowerCase(t)}function hq(t){return e=>e.toLocaleUpperCase(t)}function mq(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function gq(t,e={}){const r=e.split??(e.separateNumbers?fq:LI),n=e.prefixCharacters??nS,i=e.suffixCharacters??nS;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Fr(t,e){if(!!!t)throw new Error(e)}function Bu(t){return typeof t=="object"&&t!==null}function Ca(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const yq=/\r\n|[\n\r]/g;function $b(t,e){let r=0,n=1;for(const i of t.body.matchAll(yq)){if(typeof i.index=="number"||Ca(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function vq(t){return $I(t.source,$b(t.source,t.start))}function $I(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-g4Q6-PRA.js","assets/main.AX2O67pt.js","assets/app-loader-BNyCiyDz.js","assets/app-loader-DoI5W0wZ.css","assets/browser-CPcl7U5g.js","assets/router-0g625aul.js"])))=>i.map(i=>d[i]);
2
+ var VU=Object.defineProperty;var VE=t=>{throw TypeError(t)};var ZU=(t,e,r)=>e in t?VU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ZE=(t,e,r)=>ZU(t,typeof e!="symbol"?e+"":e,r),Gy=(t,e,r)=>e.has(t)||VE("Cannot "+r);var Ir=(t,e,r)=>(Gy(t,e,"read from private field"),r?r.call(t):e.get(t)),Ja=(t,e,r)=>e.has(t)?VE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),yd=(t,e,r,n)=>(Gy(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),ma=(t,e,r)=>(Gy(t,e,"access private method"),r);import{_ as xf}from"./main.AX2O67pt.js";import{jsx as et,jsxs as Yr,Fragment as xI}from"react/jsx-runtime";import{AddLocalDriveModal as HU,AddRemoteDriveModal as WU,ConnectConfirmationModal as YU,ReadRequiredModal as EI,FILE as Pb,LOCAL as JU,ERROR as KU,CreateDocumentModal as GU,Modal as XU,Icon as xh,Combobox as Rd,Button as Vc,FormInput as HE,ConnectDeleteDriveModal as QU,ConnectDeleteItemModal as ez,DriveSettingsModal as tz,SettingsModal as rz,DocumentSelectSettingsRow as nz,ClearStorageSettingsRow as iz,DependencyVersions as az,ConnectUpgradeDriveModal as sz,CookieBanner as oz,WagmiContext as uz,UiNodesContextProvider as cz,ToastContainer as lz}from"@powerhousedao/design-system";import*as mt from"react";import Us,{createElement as rf,isValidElement as Km,cloneElement as dz,Children as fz,createContext as L_,useContext as jp,useState as ii,useRef as Gm,useEffect as vi,useReducer as pz,useDebugValue as hz,useCallback as Cr,useMemo as Fo,Suspense as mz}from"react";import{g as SI,a as j_,c as ks,s as Eh,p as gz}from"./app-loader-BNyCiyDz.js";function yz(t,e){for(var r=0;r<e.length;r++){const n=e[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(n,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Bb(){return Bb=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bb.apply(null,arguments)}var Fs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function SIe(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 vz={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};const bz=$p(vz);var wz=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function WE(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(bz[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var i=new RegExp(wz),a=null;(a=i.exec(t))!==null;)if(a[0].trim())if(a[1]){var s=a[1].trim(),o=[s,""];s.indexOf("=")>-1&&(o=s.split("=")),e.attrs[o[0]]=o[1],i.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var _z=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,xz=/^\s*$/,Ez=Object.create(null);function TI(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?function(r){var n=[];for(var i in r)n.push(i+'="'+r[i]+'"');return n.length?" "+n.join(" "):""}(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(TI,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Sz={parse:function(t,e){e||(e={}),e.components||(e.components=Ez);var r,n=[],i=[],a=-1,s=!1;if(t.indexOf("<")!==0){var o=t.indexOf("<");n.push({type:"text",content:o===-1?t:t.substring(0,o)})}return t.replace(_z,function(u,c){if(s){if(u!=="</"+r.name+">")return;s=!1}var l,d=u.charAt(1)!=="/",f=u.startsWith("<!--"),p=c+u.length,h=t.charAt(p);if(f){var m=WE(u);return a<0?(n.push(m),n):((l=i[a]).children.push(m),n)}if(d&&(a++,(r=WE(u)).type==="tag"&&e.components[r.name]&&(r.type="component",s=!0),r.voidElement||s||!h||h==="<"||r.children.push({type:"text",content:t.slice(p,t.indexOf("<",p))}),a===0&&n.push(r),(l=i[a-1])&&l.children.push(r),i[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===u.slice(2,-1))&&(a--,r=a===-1?n:i[a]),!s&&h!=="<"&&h)){l=a===-1?n:i[a].children;var y=t.indexOf("<",p),g=t.slice(p,y===-1?void 0:y);xz.test(g)&&(g=" "),(y>-1&&a+l.length>=0||g!==" ")&&l.push({type:"text",content:g})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+TI("",r)},"")}};function Nm(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const YE={};function Xm(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];typeof e[0]=="string"&&YE[e[0]]||(typeof e[0]=="string"&&(YE[e[0]]=new Date),Nm(...e))}const DI=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}};function JE(t,e,r){t.loadNamespaces(e,DI(t,r))}function KE(t,e,r,n){typeof r=="string"&&(r=[r]),r.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,DI(t,n))}function Tz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const s=(o,u)=>{const c=e.services.backendConnector.state[`${o}|${u}`];return c===-1||c===2};return r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(n,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(n,t)&&(!i||s(a,t)))}function Dz(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Xm("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:r.lng,precheck:(i,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!a(i.isLanguageChangingTo,t))return!1}}):Tz(t,e,r)}function Xy(t,e){if(!t)return!1;const r=t.props?t.props.children:t.children;return e?r.length>0:!!r}function Qy(t){if(!t)return[];const e=t.props?t.props.children:t.children;return t.props&&t.props.i18nIsDynamicList?Zc(e):e}function Az(t){return Object.prototype.toString.call(t)!=="[object Array]"?!1:t.every(e=>Km(e))}function Zc(t){return Array.isArray(t)?t:[t]}function Nz(t,e){const r={...e};return r.props=Object.assign(t.props,e.props),r}function AI(t,e){if(!t)return"";let r="";const n=Zc(t),i=e.transSupportBasicHtmlNodes&&e.transKeepBasicHtmlNodesFor?e.transKeepBasicHtmlNodesFor:[];return n.forEach((a,s)=>{if(typeof a=="string")r+=`${a}`;else if(Km(a)){const o=Object.keys(a.props).length,u=i.indexOf(a.type)>-1,c=a.props.children;if(!c&&u&&o===0)r+=`<${a.type}/>`;else if(!c&&(!u||o!==0))r+=`<${s}></${s}>`;else if(a.props.i18nIsDynamicList)r+=`<${s}></${s}>`;else if(u&&o===1&&typeof c=="string")r+=`<${a.type}>${c}</${a.type}>`;else{const l=AI(c,e);r+=`<${s}>${l}</${s}>`}}else if(a===null)Nm("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:o,...u}=a,c=Object.keys(u);if(c.length===1){const l=o?`${c[0]}, ${o}`:c[0];r+=`{{${l}}}`}else Nm("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Nm("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function Iz(t,e,r,n,i,a){if(e==="")return[];const s=n.transKeepBasicHtmlNodesFor||[],o=e&&new RegExp(s.map(y=>`<${y}`).join("|")).test(e);if(!t&&!o&&!a)return[e];const u={};function c(y){Zc(y).forEach(b=>{typeof b!="string"&&(Xy(b)?c(Qy(b)):typeof b=="object"&&!Km(b)&&Object.assign(u,b))})}c(t);const l=Sz.parse(`<0>${e}</0>`),d={...u,...i};function f(y,g,b){const _=Qy(y),E=h(_,g.children,b);return Az(_)&&E.length===0||y.props&&y.props.i18nIsDynamicList?_:E}function p(y,g,b,_,E){y.dummy?(y.children=g,b.push(dz(y,{key:_},E?void 0:g))):b.push(...fz.map([y],x=>{const D={...x.props};return delete D.i18nIsDynamicList,Us.createElement(x.type,Bb({},D,{key:_,ref:x.ref},E?{}:{children:g}))}))}function h(y,g,b){const _=Zc(y);return Zc(g).reduce((x,D,M)=>{const F=D.children&&D.children[0]&&D.children[0].content&&r.services.interpolator.interpolate(D.children[0].content,d,r.language);if(D.type==="tag"){let k=_[parseInt(D.name,10)];b.length===1&&!k&&(k=b[0][D.name]),k||(k={});const $=Object.keys(D.attrs).length!==0?Nz({props:D.attrs},k):k,T=Km($),A=T&&Xy(D,!0)&&!D.voidElement,v=o&&typeof $=="object"&&$.dummy&&!T,w=typeof t=="object"&&t!==null&&Object.hasOwnProperty.call(t,D.name);if(typeof $=="string"){const N=r.services.interpolator.interpolate($,d,r.language);x.push(N)}else if(Xy($)||A){const N=f($,D,b);p($,N,x,M)}else if(v){const N=h(_,D.children,b);p($,N,x,M)}else if(Number.isNaN(parseFloat(D.name)))if(w){const N=f($,D,b);p($,N,x,M,D.voidElement)}else if(n.transSupportBasicHtmlNodes&&s.indexOf(D.name)>-1)if(D.voidElement)x.push(rf(D.name,{key:`${D.name}-${M}`}));else{const N=h(_,D.children,b);x.push(rf(D.name,{key:`${D.name}-${M}`},N))}else if(D.voidElement)x.push(`<${D.name} />`);else{const N=h(_,D.children,b);x.push(`<${D.name}>${N}</${D.name}>`)}else if(typeof $=="object"&&!T){const N=D.children[0]?F:null;N&&x.push(N)}else p($,F,x,M,D.children.length!==1||!F)}else if(D.type==="text"){const k=n.transWrapTextNodes,$=a?n.unescape(r.services.interpolator.interpolate(D.content,d,r.language)):r.services.interpolator.interpolate(D.content,d,r.language);k?x.push(rf(k,{key:`${D.name}-${M}`},$)):x.push($)}return x},[])}const m=h([{dummy:!0,children:t||[]}],l,Zc(t||[]));return Qy(m[0])}function Cz(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const m=d||j_();if(!m)return Xm("You will need to pass in an i18next instance by using i18nextReactModule"),e;const y=f||m.t.bind(m)||(A=>A);a&&(s.context=a);const g={...SI(),...m.options&&m.options.react};let b=l||y.ns||m.options&&m.options.defaultNS;b=typeof b=="string"?[b]:b||["translation"];const _=AI(e,g),E=u||_||g.transEmptyNodeValue||i,{hashTransKey:x}=g,D=i||(x?x(_||E):_||E);m.options&&m.options.interpolation&&m.options.interpolation.defaultVariables&&(o=o&&Object.keys(o).length>0?{...o,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const M=o?s.interpolation:{interpolation:{...s.interpolation,prefix:"#$?",suffix:"?$#"}},F={...s,count:r,...o,...M,defaultValue:E,ns:b},k=D?y(D,F):E;c&&Object.keys(c).forEach(A=>{const v=c[A];if(typeof v.type=="function"||!v.props||!v.props.children||k.indexOf(`${A}/>`)<0&&k.indexOf(`${A} />`)<0)return;function w(){return Us.createElement(Us.Fragment,null,v)}c[A]=Us.createElement(w,null)});const $=Iz(c||e,k,m,g,F,p),T=n!==void 0?n:g.defaultTransParent;return T?rf(T,h,$):$}const NI=L_();class Oz{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function II(t){let{children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s={},values:o,defaults:u,components:c,ns:l,i18n:d,t:f,shouldUnescape:p,...h}=t;const{i18n:m,defaultNS:y}=jp(NI)||{},g=d||m||j_(),b=f||g&&g.t.bind(g);return Cz({children:e,count:r,parent:n,i18nKey:i,context:a,tOptions:s,values:o,defaults:u,components:c,ns:l||b&&b.ns||y||g&&g.options&&g.options.defaultNS,i18n:g,t:f,shouldUnescape:p,...h})}const Mz=(t,e)=>{const r=Gm();return vi(()=>{r.current=t},[t,e]),r.current};function nc(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:r}=e,{i18n:n,defaultNS:i}=jp(NI)||{},a=r||n||j_();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Oz),!a){Xm("You will need to pass in an i18next instance by using initReactI18next");const _=(x,D)=>typeof D=="string"?D:D&&typeof D=="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(x)?x[x.length-1]:x,E=[_,{},!1];return E.t=_,E.i18n={},E.ready=!1,E}a.options.react&&a.options.react.wait!==void 0&&Xm("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...SI(),...a.options.react,...e},{useSuspense:o,keyPrefix:u}=s;let c=i||a.options&&a.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(c);const l=(a.isInitialized||a.initializedStoreOnce)&&c.every(_=>Dz(_,a,s));function d(){return a.getFixedT(e.lng||null,s.nsMode==="fallback"?c:c[0],u)}const[f,p]=ii(d);let h=c.join();e.lng&&(h=`${e.lng}${h}`);const m=Mz(h),y=Gm(!0);vi(()=>{const{bindI18n:_,bindI18nStore:E}=s;y.current=!0,!l&&!o&&(e.lng?KE(a,e.lng,c,()=>{y.current&&p(d)}):JE(a,c,()=>{y.current&&p(d)})),l&&m&&m!==h&&y.current&&p(d);function x(){y.current&&p(d)}return _&&a&&a.on(_,x),E&&a&&a.store.on(E,x),()=>{y.current=!1,_&&a&&_.split(" ").forEach(D=>a.off(D,x)),E&&a&&E.split(" ").forEach(D=>a.store.off(D,x))}},[a,h]);const g=Gm(!0);vi(()=>{y.current&&!g.current&&p(d),g.current=!1},[a,u]);const b=[f,a,l];if(b.t=f,b.i18n=a,b.ready=l,l||!l&&!o)return b;throw new Promise(_=>{e.lng?KE(a,e.lng,c,()=>_()):JE(a,c,()=>_())})}const na={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""};let kz=0;function $n(t,e){const r=`atom${++kz}`,n={toString(){return(na?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Rz,n.write=Fz),e&&(n.write=e),n}function Rz(t){return t(this)}function Fz(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}const GE=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,ev=t=>"init"in t,tv=t=>!!t.write,Qm=new WeakMap,Lb=t=>{var e;return jb(t)&&!((e=Qm.get(t))!=null&&e[1])},Pz=(t,e)=>{const r=Qm.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((na?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Bz=t=>{if(Qm.has(t))return;const e=[new Set,!1];Qm.set(t,e);const r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},jb=t=>typeof(t==null?void 0:t.then)=="function",XE=t=>"v"in t||"e"in t,Sh=t=>{if("e"in t)throw t.e;if((na?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},CI=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},QE=(t,e,r,n,i)=>{var a;if((na?"production":void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,i.n),Lb(r.v)&&CI(e,r.v,i),(a=i.m)==null||a.t.add(e),t&&Lz(t,n,e)},yc=()=>[new Map,new Map,new Set],rv=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},Lz=(t,e,r)=>{const n=t[0].get(e);n&&n.add(r)},jz=(t,e)=>t[0].get(e),eS=(t,e)=>{t[2].add(e)},oo=t=>{let e,r=!1;const n=i=>{try{i()}catch(a){r||(e=a,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();const i=new Set(t[1].values());t[1].clear();const a=new Set(t[2]);t[2].clear(),i.forEach(s=>{var o;return(o=s.m)==null?void 0:o.l.forEach(n)}),a.forEach(n)}if(r)throw e},OI=(...[t,e,r,n])=>{let i;(na?"production":void 0)!=="production"&&(i=new Set);const a=(_,E,x)=>{const D="v"in E,M=E.v,F=Lb(E.v)?E.v:null;if(jb(x)){Bz(x);for(const k of E.d.keys())CI(_,x,t(k));E.v=x,delete E.e}else E.v=x,delete E.e;(!D||!Object.is(M,E.v))&&(++E.n,F&&Pz(F,x))},s=(_,E,x)=>{var D;const M=t(E);if(XE(M)&&(M.m&&!(x!=null&&x.has(E))||Array.from(M.d).every(([v,w])=>s(_,v,x).n===w)))return M;M.d.clear();let F=!0;const k=v=>{if(GE(E,v)){const N=t(v);if(!XE(N))if(ev(v))a(v,N,v.init);else throw new Error("no atom init");return Sh(N)}const w=s(_,v,x);try{return Sh(w)}finally{if(F)QE(_,E,M,v,w);else{const N=yc();QE(N,E,M,v,w),p(N,E,M),oo(N)}}};let $,T;const A={get signal(){return $||($=new AbortController),$.signal},get setSelf(){return(na?"production":void 0)!=="production"&&!tv(E)&&console.warn("setSelf function cannot be used with read-only atom"),!T&&tv(E)&&(T=(...v)=>{if((na?"production":void 0)!=="production"&&F&&console.warn("setSelf function cannot be called in sync"),!F)return f(E,...v)}),T}};try{const v=e(E,k,A);if(a(E,M,v),jb(v)){(D=v.onCancel)==null||D.call(v,()=>$==null?void 0:$.abort());const w=()=>{if(M.m){const N=yc();p(N,E,M),oo(N)}};v.then(w,w)}return M}catch(v){return delete M.v,M.e=v,++M.n,M}finally{F=!1}},o=_=>Sh(s(void 0,_)),u=(_,E,x)=>{var D,M;const F=new Map;for(const k of((D=x.m)==null?void 0:D.t)||[])F.set(k,t(k));for(const k of x.p)F.set(k,t(k));return(M=jz(_,E))==null||M.forEach(k=>{F.set(k,t(k))}),F};function c(_,E,x){const D=[],M=new Set,F=new Set,k=[[E,x]];for(;k.length>0;){const[$,T]=k[k.length-1];if(F.has($)){k.pop();continue}if(M.has($)){D.push([$,T,T.n]),F.add($),k.pop();continue}M.add($);for(const[A,v]of u(_,$,T))$!==A&&!M.has(A)&&k.push([A,v])}return[D,F]}const l=(_,E,x)=>{const[D,M]=c(_,E,x),F=new Set([E]);for(let k=D.length-1;k>=0;--k){const[$,T,A]=D[k];let v=!1;for(const w of T.d.keys())if(w!==$&&F.has(w)){v=!0;break}v&&(s(_,$,M),p(_,$,T),A!==T.n&&(rv(_,$,T),F.add($))),M.delete($)}},d=(_,E,...x)=>{let D=!0;const M=k=>Sh(s(_,k)),F=(k,...$)=>{const T=t(k);try{if(GE(E,k)){if(!ev(k))throw new Error("atom not writable");const A=T.n,v=$[0];a(k,T,v),p(_,k,T),A!==T.n&&(rv(_,k,T),l(_,k,T));return}else return d(_,k,...$)}finally{D||oo(_)}};try{return r(E,M,F,...x)}finally{D=!1}},f=(_,...E)=>{const x=yc();try{return d(x,_,...E)}finally{oo(x)}},p=(_,E,x)=>{if(x.m&&!Lb(x.v)){for(const D of x.d.keys())x.m.d.has(D)||(h(_,D,t(D)).t.add(E),x.m.d.add(D));for(const D of x.m.d||[])if(!x.d.has(D)){x.m.d.delete(D);const M=m(_,D,t(D));M==null||M.t.delete(E)}}},h=(_,E,x)=>{if(!x.m){s(_,E);for(const D of x.d.keys())h(_,D,t(D)).t.add(E);if(x.m={l:new Set,d:new Set(x.d.keys()),t:new Set},(na?"production":void 0)!=="production"&&i.add(E),tv(E)){const D=x.m;let M;const F=(k,$)=>{let T=!0;M=(...A)=>{try{return d(k,E,...A)}finally{T||oo(k)}};try{return $()}finally{T=!1}};eS(_,()=>{const k=F(_,()=>n(E,(...$)=>M(...$)));k&&(D.u=$=>F($,k))})}}return x.m},m=(_,E,x)=>{if(x.m&&!x.m.l.size&&!Array.from(x.m.t).some(D=>{var M;return(M=t(D).m)==null?void 0:M.d.has(E)})){const D=x.m.u;D&&eS(_,()=>D(_)),delete x.m,(na?"production":void 0)!=="production"&&i.delete(E);for(const M of x.d.keys()){const F=m(_,M,t(M));F==null||F.t.delete(E)}return}return x.m},b={get:o,set:f,sub:(_,E)=>{const x=yc(),D=t(_),F=h(x,_,D).l;return F.add(E),oo(x),()=>{F.delete(E);const k=yc();m(k,_,D),oo(k)}},unstable_derive:_=>OI(..._(t,e,r,n))};return(na?"production":void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:E=>{const x=t(E);if(x.n!==0)return x}}),dev4_get_mounted_atoms:()=>i,dev4_restore_atoms:E=>{const x=yc();for(const[D,M]of E)if(ev(D)){const F=t(D),k=F.n;a(D,F,M),p(x,D,F),k!==F.n&&(rv(x,D,F),l(x,D,F))}oo(x)}}),b},$_=()=>{const t=new WeakMap;return OI(r=>{if((na?"production":void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var i;return(i=r.onMount)==null?void 0:i.call(r,...n)})};let vd;const $z=()=>(vd||(vd=$_(),(na?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=vd),globalThis.__JOTAI_DEFAULT_STORE__!==vd&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),vd),MI={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},kI=L_(void 0),RI=t=>jp(kI)||$z(),Uz=({children:t,store:e})=>{const r=Gm();return!e&&!r.current&&(r.current=$_()),rf(kI.Provider,{value:e||r.current},t)},FI=t=>typeof(t==null?void 0:t.then)=="function",zz=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},qz=Us.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(zz(t),t)}),nv=new WeakMap,Vz=t=>{let e=nv.get(t);return e||(e=new Promise((r,n)=>{let i=t;const a=u=>c=>{i===u&&r(c)},s=u=>c=>{i===u&&n(c)},o=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(c=>{if((MI?"production":void 0)!=="production"&&c===u)throw new Error("[Bug] p is not updated even after cancelation");FI(c)?(nv.set(c,e),i=c,c.then(a(c),s(c)),o(c)):r(c)})};t.then(a(t),s(t)),o(t)}),nv.set(t,e)),e};function Up(t,e){const r=RI(),[[n,i,a],s]=pz(c=>{const l=r.get(t);return Object.is(c[0],l)&&c[1]===r&&c[2]===t?c:[l,r,t]},void 0,()=>[r.get(t),r,t]);let o=n;if((i!==r||a!==t)&&(s(),o=r.get(t)),vi(()=>{const c=r.sub(t,()=>{s()});return s(),c},[r,t,void 0]),hz(o),FI(o)){const c=Vz(o);return qz(c)}return o}function Zz(t,e){const r=RI();return Cr((...i)=>{if((MI?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...i)},[r,t])}function La(t,e){return[Up(t),Zz(t)]}const Ef={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_IMPORT_REACT_SCRIPT:""},Hz=Symbol((Ef?"production":void 0)!=="production"?"RESET":"");function Wz(t,e){let r=null;const n=new Map,i=new Set,a=o=>{let u;if(u=n.get(o),u!==void 0)if(r!=null&&r(u[1],o))a.remove(o);else return u[0];const c=t(o);return n.set(o,[c,Date.now()]),s("CREATE",o,c),c};function s(o,u,c){for(const l of i)l({type:o,param:u,atom:c})}return a.unstable_listen=o=>(i.add(o),()=>{i.delete(o)}),a.getParams=()=>n.keys(),a.remove=o=>{{if(!n.has(o))return;const[u]=n.get(o);n.delete(o),s("REMOVE",o,u)}},a.setShouldRemove=o=>{if(r=o,!!r)for(const[u,[c,l]]of n)r(l,u)&&(n.delete(u),s("REMOVE",u,c))},a}const Yz=t=>typeof(t==null?void 0:t.then)=="function";function Jz(t=()=>{try{return window.localStorage}catch(r){(Ef?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(r);return}},e){var r;let n,i;const a={getItem:(u,c)=>{var l,d;const f=h=>{if(h=h||"",n!==h){try{i=JSON.parse(h,e==null?void 0:e.reviver)}catch{return c}n=h}return i},p=(d=(l=t())==null?void 0:l.getItem(u))!=null?d:null;return Yz(p)?p.then(f):f(p)},setItem:(u,c)=>{var l;return(l=t())==null?void 0:l.setItem(u,JSON.stringify(c,void 0))},removeItem:u=>{var c;return(c=t())==null?void 0:c.removeItem(u)}},s=u=>(c,l,d)=>u(c,f=>{let p;try{p=JSON.parse(f||"")}catch{p=d}l(p)});let o;try{o=(r=t())==null?void 0:r.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(u,c)=>{if(!(t()instanceof window.Storage))return()=>{};const l=d=>{d.storageArea===t()&&d.key===u&&c(d.newValue)};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}}),o&&(a.subscribe=s(o)),a}const Kz=Jz();function PI(t,e,r=Kz,n){const i=$n(e);return(Ef?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=s=>{s(r.getItem(t,e));let o;return r.subscribe&&(o=r.subscribe(t,s,e)),o},$n(s=>s(i),(s,o,u)=>{const c=typeof u=="function"?u(s(i)):u;return c===Hz?(o(i,e),r.removeItem(t)):c instanceof Promise?c.then(l=>(o(i,l),r.setItem(t,l))):(o(i,c),r.setItem(t,c))})}const tS=(t,e,r)=>(e.has(r)?e:e.set(r,t())).get(r),Gz=new WeakMap,Xz=(t,e,r)=>{const n=tS(()=>new WeakMap,Gz,e);return tS(t,n,r)},Qz=t=>t instanceof Promise,eq=()=>{};function BI(t,e=eq){return Xz(()=>{const r=new WeakMap,n=new WeakMap,i=$n(0);(Ef?"production":void 0)!=="production"&&(i.debugPrivate=!0);const a=$n((s,{setSelf:o})=>{s(i);const u=s(a),c=s(t);if(!Qz(c))return{v:c};if(c!==(u==null?void 0:u.p)&&c.then(l=>{n.set(c,l),o()},l=>{r.set(c,l),o()}),r.has(c))throw r.get(c);return n.has(c)?{p:c,v:n.get(c)}:u&&"v"in u?{p:c,f:e(u.v),v:u.v}:{p:c,f:e()}},(s,o)=>{o(i,u=>u+1)});return a.init=void 0,(Ef?"production":void 0)!=="production"&&(a.debugPrivate=!0),$n(s=>{const o=s(a);return"f"in o?o.f:o.v},(s,o,...u)=>o(t,...u))},t,e)}function TIe(t){const e=$n(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const Fd=ks.routerBasename,zp=(t,e,r,n)=>PI(`${Fd}:${t}`,e,void 0),tq=(t,e,r)=>PI(t,e,{getItem(n,i){const a=localStorage.getItem(`${Fd}:${n}`);return a?JSON.parse(a):i},setItem(n,i){localStorage.setItem(`${Fd}:${n}`,JSON.stringify(i)),r(i)},removeItem(n){localStorage.removeItem(`${Fd}:${n}`)},subscribe(n,i){if(typeof window.addEventListener>"u")return()=>null;function a(s){s.storageArea===localStorage&&s.key===`${Fd}:${n}`&&i(s.newValue??"")}return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)}}),rq="acceptedCookies",nq=zp(rq,{analytics:!1,marketing:!1,functional:!1}),U_=()=>La(nq),iq="display-cookie-banner",aq=zp(iq,!0),sq=()=>La(aq);function oq(t){const{open:e,onAddLocalDrive:r,onClose:n}=t;async function i(a){await r(a),n()}return et(HU,{open:e,onSubmit:i,onOpenChange:a=>{if(!a)return n()}})}const uq=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),cq=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),lq=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),dq=/[^\p{L}\d]+/giu,rS="$1\0$2",nS="";function LI(t){let e=t.trim();e=e.replace(uq,rS).replace(cq,rS),e=e.replace(dq,"\0");let r=0,n=e.length;for(;e.charAt(r)==="\0";)r++;if(r===n)return[];for(;e.charAt(n-1)==="\0";)n--;return e.slice(r,n).split(/\0/g)}function fq(t){const e=LI(t);for(let r=0;r<e.length;r++){const n=e[r],i=lq.exec(n);if(i){const a=i.index+(i[1]??i[2]).length;e.splice(r,1,n.slice(0,a),n.slice(a))}}return e}function jI(t,e){const[r,n,i]=gq(t,e),a=pq(e==null?void 0:e.locale),s=hq(e==null?void 0:e.locale),o=mq(a,s);return r+n.map(o).join("")+i}function pq(t){return e=>e.toLocaleLowerCase(t)}function hq(t){return e=>e.toLocaleUpperCase(t)}function mq(t,e){return(r,n)=>{const i=r[0];return(n>0&&i>="0"&&i<="9"?"_"+i:e(i))+t(r.slice(1))}}function gq(t,e={}){const r=e.split??(e.separateNumbers?fq:LI),n=e.prefixCharacters??nS,i=e.suffixCharacters??nS;let a=0,s=t.length;for(;a<t.length;){const o=t.charAt(a);if(!n.includes(o))break;a++}for(;s>a;){const o=s-1,u=t.charAt(o);if(!i.includes(u))break;s=o}return[t.slice(0,a),r(t.slice(a,s)),t.slice(s)]}function Fr(t,e){if(!!!t)throw new Error(e)}function Bu(t){return typeof t=="object"&&t!==null}function Ca(t,e){if(!!!t)throw new Error(e??"Unexpected invariant triggered.")}const yq=/\r\n|[\n\r]/g;function $b(t,e){let r=0,n=1;for(const i of t.body.matchAll(yq)){if(typeof i.index=="number"||Ca(!1),i.index>=e)break;r=i.index+i[0].length,n+=1}return{line:n,column:e+1-r}}function vq(t){return $I(t.source,$b(t.source,t.start))}function $I(t,e){const r=t.locationOffset.column-1,n="".padStart(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,s=e.line+a,o=e.line===1?r:0,u=e.column+o,c=`${t.name}:${s}:${u}
3
3
  `,l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){const f=Math.floor(u/80),p=u%80,h=[];for(let m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return c+iS([[`${s} |`,h[0]],...h.slice(1,f+1).map(m=>["|",m]),["|","^".padStart(p)],["|",h[f+1]]])}return c+iS([[`${s-1} |`,l[i-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,l[i+1]]])}function iS(t){const e=t.filter(([n,i])=>i!==void 0),r=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(r)+(i?" "+i:"")).join(`
4
4
  `)}function bq(t){const e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}class Ze extends Error{constructor(e,...r){var n,i,a;const{nodes:s,source:o,positions:u,path:c,originalError:l,extensions:d}=bq(r);super(e),this.name="GraphQLError",this.path=c??void 0,this.originalError=l??void 0,this.nodes=aS(Array.isArray(s)?s:s?[s]:void 0);const f=aS((n=this.nodes)===null||n===void 0?void 0:n.map(h=>h.loc).filter(h=>h!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=u??(f==null?void 0:f.map(h=>h.start)),this.locations=u&&o?u.map(h=>$b(o,h)):f==null?void 0:f.map(h=>$b(h.source,h.start));const p=Bu(l==null?void 0:l.extensions)?l==null?void 0:l.extensions:void 0;this.extensions=(a=d??p)!==null&&a!==void 0?a:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Ze):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(e+=`
5
5
 
@@ -508,7 +508,7 @@ type Comment {
508
508
  notionId: String
509
509
  content: String
510
510
  editedAt: DateTime!
511
- }`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]};var Nr;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Nr||(Nr={}));var Hw;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Hw||(Hw={}));const dt=Nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ms=t=>{switch(typeof t){case"undefined":return dt.undefined;case"string":return dt.string;case"number":return isNaN(t)?dt.nan:dt.number;case"boolean":return dt.boolean;case"function":return dt.function;case"bigint":return dt.bigint;case"symbol":return dt.symbol;case"object":return Array.isArray(t)?dt.array:t===null?dt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?dt.promise:typeof Map<"u"&&t instanceof Map?dt.map:typeof Set<"u"&&t instanceof Set?dt.set:typeof Date<"u"&&t instanceof Date?dt.date:dt.object;default:return dt.unknown}},qe=Nr.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"]),cse=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");let Fa=class Rk 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(a){return a.message},n={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(s))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return i(this),n}static assert(e){if(!(e instanceof Rk))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fa.create=t=>new Fa(t);const Ml=(t,e)=>{let r;switch(t.code){case qe.invalid_type:t.received===dt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Nr.jsonStringifyReplacer)}`;break;case qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nr.joinValues(t.keys,", ")}`;break;case qe.invalid_union:r="Invalid input";break;case qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nr.joinValues(t.options)}`;break;case qe.invalid_enum_value:r=`Invalid enum value. Expected ${Nr.joinValues(t.options)}, received '${t.received}'`;break;case qe.invalid_arguments:r="Invalid function arguments";break;case qe.invalid_return_type:r="Invalid function return type";break;case qe.invalid_date:r="Invalid date";break;case qe.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}"`:Nr.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case qe.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==="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 qe.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 qe.custom:r="Invalid input";break;case qe.invalid_intersection_types:r="Intersection results could not be merged";break;case qe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case qe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Nr.assertNever(t)}return{message:r}};let Fk=Ml;function lse(t){Fk=t}function q0(){return Fk}const V0=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],s={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let o="";const u=n.filter(c=>!!c).slice().reverse();for(const c of u)o=c(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},dse=[];function st(t,e){const r=q0(),n=V0({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ml?void 0:Ml].filter(i=>!!i)});t.common.issues.push(n)}let Oi=class Pk{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return qt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r){const a=await i.key,s=await i.value;n.push({key:a,value:s})}return Pk.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:a,value:s}=i;if(a.status==="aborted"||s.status==="aborted")return qt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[a.value]=s.value)}return{status:e.value,value:n}}};const qt=Object.freeze({status:"aborted"}),Z0=t=>({status:"dirty",value:t}),_i=t=>({status:"valid",value:t}),Ww=t=>t.status==="aborted",Yw=t=>t.status==="dirty",Xu=t=>t.status==="valid",pp=t=>typeof Promise<"u"&&t instanceof Promise;function H0(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Bk(t,e,r,n,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var _t;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_t||(_t={}));var Jd,Kd;let ms=class{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||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const K3=(t,e)=>{if(Xu(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 Fa(t.common.issues);return this._error=r,this._error}}};function rr(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,s)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(o=c??n)!==null&&o!==void 0?o:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??r)!==null&&u!==void 0?u:s.defaultError}},description:i}}let or=class{get description(){return this._def.description}_getType(e){return Ms(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ms(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oi,ctx:{common:e.parent.common,data:e.data,parsedType:Ms(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(pp(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){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ms(e)},a=this._parseSync({data:e,path:i.path,parent:i});return K3(i,a)}"~validate"(e){var r,n;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ms(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:i});return Xu(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a==null?void 0:a.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>Xu(a)?{value:a.value}:{issues:i.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:Ms(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(pp(i)?i:Promise.resolve(i));return K3(n,a)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{const s=e(i),o=()=>a.addIssue({code:qe.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(o(),!1)):s?!0:(o(),!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 za({schema:this,typeName:Lt.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 ls.create(this,this._def)}nullable(){return Yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qu.create(this)}promise(){return Fl.create(this,this._def)}or(e){return wp.create([this,e],this._def)}and(e){return _p.create(this,e,this._def)}transform(e){return new za({...rr(this._def),schema:this,typeName:Lt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Tp({...rr(this._def),innerType:this,defaultValue:r,typeName:Lt.ZodDefault})}brand(){return new Rx({typeName:Lt.ZodBranded,type:this,...rr(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Dp({...rr(this._def),innerType:this,catchValue:r,typeName:Lt.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ch.create(this,e)}readonly(){return Ap.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const fse=/^c[^\s-]{8,}$/i,pse=/^[0-9a-z]+$/,hse=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mse=/^[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,gse=/^[a-z0-9_-]{21}$/i,yse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vse=/^[-+]?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)?)??$/,bse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wse="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Iv;const _se=/^(?:(?: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])$/,xse=/^(?:(?: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])$/,Ese=/^(([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]))$/,Sse=/^(([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])$/,Tse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lk="((\\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])))",Ase=new RegExp(`^${Lk}$`);function jk(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Nse(t){return new RegExp(`^${jk(t)}$`)}function $k(t){let e=`${Lk}T${jk(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 Ise(t,e){return!!((e==="v4"||!e)&&_se.test(t)||(e==="v6"||!e)&&Ese.test(t))}function Cse(t,e){if(!yse.test(t))return!1;try{const[r]=t.split("."),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||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ose(t,e){return!!((e==="v4"||!e)&&xse.test(t)||(e==="v6"||!e)&&Sse.test(t))}let kl=class Gd extends or{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dt.string){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.string,received:i.parsedType}),qt}const r=new Oi;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(n=this._getOrReturnCtx(e,n),a?st(n,{code:qe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&st(n,{code:qe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")bse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"email",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Iv||(Iv=new RegExp(wse,"u")),Iv.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"emoji",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")mse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"uuid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")gse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"nanoid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")fse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cuid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")pse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cuid2",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")hse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"ulid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),st(n,{validation:"url",code:qe.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"regex",code:qe.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$k(i).test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Ase.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Nse(i).test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?vse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"duration",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Ise(e.data,i.version)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"ip",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Cse(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"jwt",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ose(e.data,i.version)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cidr",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Tse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"base64",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Dse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"base64url",code:qe.invalid_string,message:i.message}),r.dirty()):Nr.assertNever(i);return{status:r.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:qe.invalid_string,..._t.errToObj(n)})}_addCheck(e){return new Gd({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._t.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._t.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._t.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._t.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._t.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._t.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._t.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._t.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._t.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._t.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._t.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._t.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._t.errToObj(e)})}datetime(e){var r,n;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:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,..._t.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,..._t.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._t.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._t.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._t.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._t.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._t.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._t.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._t.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._t.errToObj(r)})}nonempty(e){return this.min(1,_t.errToObj(e))}trim(){return new Gd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Gd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Gd({...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.value<e)&&(e=r.value);return e}};kl.create=t=>{var e;return new kl({checks:[],typeName:Lt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rr(t)})};function Mse(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return a%s/Math.pow(10,i)}let hp=class Jw extends or{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)!==dt.number){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.number,received:i.parsedType}),qt}let r;const n=new Oi;for(const i of this._def.checks)i.kind==="int"?Nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),st(r,{code:qe.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Mse(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_finite,message:i.message}),n.dirty()):Nr.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_t.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_t.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_t.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_t.toString(r))}setLimit(e,r,n,i){return new Jw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_t.toString(i)}]})}_addCheck(e){return new Jw({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_t.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_t.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_t.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_t.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_t.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_t.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_t.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_t.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_t.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.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Nr.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.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};hp.create=t=>new hp({checks:[],typeName:Lt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...rr(t)});let mp=class Kw extends or{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)!==dt.bigint)return this._getInvalidInput(e);let r;const n=new Oi;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Nr.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.bigint,received:r.parsedType}),qt}gte(e,r){return this.setLimit("min",e,!0,_t.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_t.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_t.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_t.toString(r))}setLimit(e,r,n,i){return new Kw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_t.toString(i)}]})}_addCheck(e){return new Kw({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_t.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_t.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_t.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_t.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_t.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.value<e)&&(e=r.value);return e}};mp.create=t=>{var e;return new mp({checks:[],typeName:Lt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rr(t)})};let gp=class extends or{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dt.boolean){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.boolean,received:r.parsedType}),qt}return _i(e.data)}};gp.create=t=>new gp({typeName:Lt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...rr(t)});let yp=class Uk extends or{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dt.date){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.date,received:i.parsedType}),qt}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_date}),qt}const r=new Oi;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Nr.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Uk({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_t.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_t.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.value<e)&&(e=r.value);return e!=null?new Date(e):null}};yp.create=t=>new yp({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Lt.ZodDate,...rr(t)});class W0 extends or{_parse(e){if(this._getType(e)!==dt.symbol){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.symbol,received:r.parsedType}),qt}return _i(e.data)}}W0.create=t=>new W0({typeName:Lt.ZodSymbol,...rr(t)});let vp=class extends or{_parse(e){if(this._getType(e)!==dt.undefined){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.undefined,received:r.parsedType}),qt}return _i(e.data)}};vp.create=t=>new vp({typeName:Lt.ZodUndefined,...rr(t)});let bp=class extends or{_parse(e){if(this._getType(e)!==dt.null){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.null,received:r.parsedType}),qt}return _i(e.data)}};bp.create=t=>new bp({typeName:Lt.ZodNull,...rr(t)});let Rl=class extends or{constructor(){super(...arguments),this._any=!0}_parse(e){return _i(e.data)}};Rl.create=t=>new Rl({typeName:Lt.ZodAny,...rr(t)});let ku=class extends or{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _i(e.data)}};ku.create=t=>new ku({typeName:Lt.ZodUnknown,...rr(t)});let Xs=class extends or{_parse(e){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.never,received:r.parsedType}),qt}};Xs.create=t=>new Xs({typeName:Lt.ZodNever,...rr(t)});let Y0=class extends or{_parse(e){if(this._getType(e)!==dt.undefined){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.void,received:r.parsedType}),qt}return _i(e.data)}};Y0.create=t=>new Y0({typeName:Lt.ZodVoid,...rr(t)});let Qu=class Um extends or{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==dt.array)return st(r,{code:qe.invalid_type,expected:dt.array,received:r.parsedType}),qt;if(i.exactLength!==null){const s=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(s||o)&&(st(r,{code:s?qe.too_big:qe.too_small,minimum:o?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(st(r,{code:qe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(st(r,{code:qe.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((s,o)=>i.type._parseAsync(new ms(r,s,r.path,o)))).then(s=>Oi.mergeArray(n,s));const a=[...r.data].map((s,o)=>i.type._parseSync(new ms(r,s,r.path,o)));return Oi.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new Um({...this._def,minLength:{value:e,message:_t.toString(r)}})}max(e,r){return new Um({...this._def,maxLength:{value:e,message:_t.toString(r)}})}length(e,r){return new Um({...this._def,exactLength:{value:e,message:_t.toString(r)}})}nonempty(e){return this.min(1,e)}};Qu.create=(t,e)=>new Qu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Lt.ZodArray,...rr(e)});function Uc(t){if(t instanceof ca){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ls.create(Uc(n))}return new ca({...t._def,shape:()=>e})}else return t instanceof Qu?new Qu({...t._def,type:Uc(t.element)}):t instanceof ls?ls.create(Uc(t.unwrap())):t instanceof Yo?Yo.create(Uc(t.unwrap())):t instanceof Wo?Wo.create(t.items.map(e=>Uc(e))):t}let ca=class ba extends or{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=Nr.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==dt.object){const u=this._getOrReturnCtx(e);return st(u,{code:qe.invalid_type,expected:dt.object,received:u.parsedType}),qt}const{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Xs&&this._def.unknownKeys==="strip"))for(const u in n.data)a.includes(u)||s.push(u);const o=[];for(const u of a){const c=i[u],l=n.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new ms(n,l,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Xs){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(u==="strict")s.length>0&&(st(n,{code:qe.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const l=n.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new ms(n,l,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of o){const l=await c.key,d=await c.value;u.push({key:l,value:d,alwaysSet:c.alwaysSet})}return u}).then(u=>Oi.mergeObjectSync(r,u)):Oi.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(e){return _t.errToObj,new ba({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,a,s,o;const u=(s=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&s!==void 0?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=_t.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new ba({...this._def,unknownKeys:"strip"})}passthrough(){return new ba({...this._def,unknownKeys:"passthrough"})}extend(e){return new ba({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ba({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Lt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ba({...this._def,catchall:e})}pick(e){const r={};return Nr.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new ba({...this._def,shape:()=>r})}omit(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new ba({...this._def,shape:()=>r})}deepPartial(){return Uc(this)}partial(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new ba({...this._def,shape:()=>r})}required(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ls;)i=i._def.innerType;r[n]=i}}),new ba({...this._def,shape:()=>r})}keyof(){return Wk(Nr.objectKeys(this.shape))}};ca.create=(t,e)=>new ca({shape:()=>t,unknownKeys:"strip",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});ca.strictCreate=(t,e)=>new ca({shape:()=>t,unknownKeys:"strict",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});ca.lazycreate=(t,e)=>new ca({shape:t,unknownKeys:"strip",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});let wp=class extends or{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Fa(o.ctx.common.issues));return st(r,{code:qe.invalid_union,unionErrors:s}),qt}if(r.common.async)return Promise.all(n.map(async a=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let a;const s=[];for(const u of n){const c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(u=>new Fa(u));return st(r,{code:qe.invalid_union,unionErrors:o}),qt}}get options(){return this._def.options}};wp.create=(t,e)=>new wp({options:t,typeName:Lt.ZodUnion,...rr(e)});const po=t=>t instanceof xp?po(t.schema):t instanceof za?po(t.innerType()):t instanceof Ep?[t.value]:t instanceof uh?t.options:t instanceof Sp?Nr.objectValues(t.enum):t instanceof Tp?po(t._def.innerType):t instanceof vp?[void 0]:t instanceof bp?[null]:t instanceof ls?[void 0,...po(t.unwrap())]:t instanceof Yo?[null,...po(t.unwrap())]:t instanceof Rx||t instanceof Ap?po(t.unwrap()):t instanceof Dp?po(t._def.innerType):[];let zk=class qk extends or{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.object)return st(r,{code:qe.invalid_type,expected:dt.object,received:r.parsedType}),qt;const n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(st(r,{code:qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),qt)}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 a of r){const s=po(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,a)}}return new qk({typeName:Lt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...rr(n)})}};function Gw(t,e){const r=Ms(t),n=Ms(e);if(t===e)return{valid:!0,data:t};if(r===dt.object&&n===dt.object){const i=Nr.objectKeys(e),a=Nr.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(const o of a){const u=Gw(t[o],e[o]);if(!u.valid)return{valid:!1};s[o]=u.data}return{valid:!0,data:s}}else if(r===dt.array&&n===dt.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],u=Gw(s,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===dt.date&&n===dt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let _p=class extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=(a,s)=>{if(Ww(a)||Ww(s))return qt;const o=Gw(a.value,s.value);return o.valid?((Yw(a)||Yw(s))&&r.dirty(),{status:r.value,value:o.data}):(st(n,{code:qe.invalid_intersection_types}),qt)};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(([a,s])=>i(a,s)):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}))}};_p.create=(t,e,r)=>new _p({left:t,right:e,typeName:Lt.ZodIntersection,...rr(r)});let Wo=class Vk extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.array)return st(n,{code:qe.invalid_type,expected:dt.array,received:n.parsedType}),qt;if(n.data.length<this._def.items.length)return st(n,{code:qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),qt;!this._def.rest&&n.data.length>this._def.items.length&&(st(n,{code:qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((a,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new ms(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Oi.mergeArray(r,a)):Oi.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Vk({...this._def,rest:e})}};Wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wo({items:t,typeName:Lt.ZodTuple,rest:null,...rr(e)})};let Zk=class Xw extends or{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!==dt.object)return st(n,{code:qe.invalid_type,expected:dt.object,received:n.parsedType}),qt;const i=[],a=this._def.keyType,s=this._def.valueType;for(const o in n.data)i.push({key:a._parse(new ms(n,o,n.path,o)),value:s._parse(new ms(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Oi.mergeObjectAsync(r,i):Oi.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof or?new Xw({keyType:e,valueType:r,typeName:Lt.ZodRecord,...rr(n)}):new Xw({keyType:kl.create(),valueType:e,typeName:Lt.ZodRecord,...rr(r)})}};class J0 extends or{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!==dt.map)return st(n,{code:qe.invalid_type,expected:dt.map,received:n.parsedType}),qt;const i=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([o,u],c)=>({key:i._parse(new ms(n,o,n.path,[c,"key"])),value:a._parse(new ms(n,u,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of s){const c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return qt;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const u of s){const c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return qt;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}}J0.create=(t,e,r)=>new J0({valueType:e,keyType:t,typeName:Lt.ZodMap,...rr(r)});let K0=class Qw extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.set)return st(n,{code:qe.invalid_type,expected:dt.set,received:n.parsedType}),qt;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(st(n,{code:qe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(st(n,{code:qe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const a=this._def.valueType;function s(u){const c=new Set;for(const l of u){if(l.status==="aborted")return qt;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((u,c)=>a._parse(new ms(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>s(u)):s(o)}min(e,r){return new Qw({...this._def,minSize:{value:e,message:_t.toString(r)}})}max(e,r){return new Qw({...this._def,maxSize:{value:e,message:_t.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};K0.create=(t,e)=>new K0({valueType:t,minSize:null,maxSize:null,typeName:Lt.ZodSet,...rr(e)});let Hk=class zm extends or{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.function)return st(r,{code:qe.invalid_type,expected:dt.function,received:r.parsedType}),qt;function n(o,u){return V0({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,q0(),Ml].filter(c=>!!c),issueData:{code:qe.invalid_arguments,argumentsError:u}})}function i(o,u){return V0({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,q0(),Ml].filter(c=>!!c),issueData:{code:qe.invalid_return_type,returnTypeError:u}})}const a={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Fl){const o=this;return _i(async function(...u){const c=new Fa([]),l=await o._def.args.parseAsync(u,a).catch(f=>{throw c.addIssue(n(u,f)),c}),d=await Reflect.apply(s,this,l);return await o._def.returns._def.type.parseAsync(d,a).catch(f=>{throw c.addIssue(i(d,f)),c})})}else{const o=this;return _i(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new Fa([n(u,c.error)]);const l=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(l,a);if(!d.success)throw new Fa([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new zm({...this._def,args:Wo.create(e).rest(ku.create())})}returns(e){return new zm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new zm({args:e||Wo.create([]).rest(ku.create()),returns:r||ku.create(),typeName:Lt.ZodFunction,...rr(n)})}};class xp extends or{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})}}xp.create=(t,e)=>new xp({getter:t,typeName:Lt.ZodLazy,...rr(e)});let Ep=class extends or{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return st(r,{received:r.data,code:qe.invalid_literal,expected:this._def.value}),qt}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ep.create=(t,e)=>new Ep({value:t,typeName:Lt.ZodLiteral,...rr(e)});function Wk(t,e){return new uh({values:t,typeName:Lt.ZodEnum,...rr(e)})}let uh=class e_ extends or{constructor(){super(...arguments),Jd.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{expected:Nr.joinValues(n),received:r.parsedType,code:qe.invalid_type}),qt}if(H0(this,Jd)||Bk(this,Jd,new Set(this._def.values)),!H0(this,Jd).has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{received:r.data,code:qe.invalid_enum_value,options:n}),qt}return _i(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 e_.create(e,{...this._def,...r})}exclude(e,r=this._def){return e_.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Jd=new WeakMap;uh.create=Wk;let Sp=class extends or{constructor(){super(...arguments),Kd.set(this,void 0)}_parse(e){const r=Nr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==dt.string&&n.parsedType!==dt.number){const i=Nr.objectValues(r);return st(n,{expected:Nr.joinValues(i),received:n.parsedType,code:qe.invalid_type}),qt}if(H0(this,Kd)||Bk(this,Kd,new Set(Nr.getValidEnumValues(this._def.values))),!H0(this,Kd).has(e.data)){const i=Nr.objectValues(r);return st(n,{received:n.data,code:qe.invalid_enum_value,options:i}),qt}return _i(e.data)}get enum(){return this._def.values}};Kd=new WeakMap;Sp.create=(t,e)=>new Sp({values:t,typeName:Lt.ZodNativeEnum,...rr(e)});let Fl=class extends or{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.promise&&r.common.async===!1)return st(r,{code:qe.invalid_type,expected:dt.promise,received:r.parsedType}),qt;const n=r.parsedType===dt.promise?r.data:Promise.resolve(r.data);return _i(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fl.create=(t,e)=>new Fl({type:t,typeName:Lt.ZodPromise,...rr(e)});let za=class extends or{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:s=>{st(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const s=i.transform(n.data,a);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return qt;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?qt:u.status==="dirty"||r.value==="dirty"?Z0(u.value):u});{if(r.value==="aborted")return qt;const o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?qt:o.status==="dirty"||r.value==="dirty"?Z0(o.value):o}}if(i.type==="refinement"){const s=o=>{const u=i.refinement(o,a);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 o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?qt:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?qt:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xu(s))return s;const o=i.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Xu(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:r.value,value:o})):s);Nr.assertNever(i)}};za.create=(t,e,r)=>new za({schema:t,typeName:Lt.ZodEffects,effect:e,...rr(r)});za.createWithPreprocess=(t,e,r)=>new za({schema:e,effect:{type:"preprocess",transform:t},typeName:Lt.ZodEffects,...rr(r)});let ls=class extends or{_parse(e){return this._getType(e)===dt.undefined?_i(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ls.create=(t,e)=>new ls({innerType:t,typeName:Lt.ZodOptional,...rr(e)});let Yo=class extends or{_parse(e){return this._getType(e)===dt.null?_i(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Yo.create=(t,e)=>new Yo({innerType:t,typeName:Lt.ZodNullable,...rr(e)});class Tp extends or{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===dt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Tp.create=(t,e)=>new Tp({innerType:t,typeName:Lt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rr(e)});let Dp=class extends or{_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 pp(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Fa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Dp.create=(t,e)=>new Dp({innerType:t,typeName:Lt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rr(e)});let G0=class extends or{_parse(e){if(this._getType(e)!==dt.nan){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.nan,received:r.parsedType}),qt}return{status:"valid",value:e.data}}};G0.create=t=>new G0({typeName:Lt.ZodNaN,...rr(t)});const kse=Symbol("zod_brand");let Rx=class extends or{_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}};class ch extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?qt:i.status==="dirty"?(r.dirty(),Z0(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?qt: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 ch({in:e,out:r,typeName:Lt.ZodPipeline})}}let Ap=class extends or{_parse(e){const r=this._def.innerType._parse(e),n=i=>(Xu(i)&&(i.value=Object.freeze(i.value)),i);return pp(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Ap.create=(t,e)=>new Ap({innerType:t,typeName:Lt.ZodReadonly,...rr(e)});function Yk(t,e={},r){return t?Rl.create().superRefine((n,i)=>{var a,s;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(s=(a=o.fatal)!==null&&a!==void 0?a:r)!==null&&s!==void 0?s:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:u})}}):Rl.create()}const Rse={object:ca.lazycreate};var Lt;(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"})(Lt||(Lt={}));const Fse=(t,e={message:`Input not instance of ${t.name}`})=>Yk(r=>r instanceof t,e),Jk=kl.create,Kk=hp.create,Pse=G0.create,Bse=mp.create,Gk=gp.create,Lse=yp.create,jse=W0.create,$se=vp.create,Use=bp.create,zse=Rl.create,qse=ku.create,Vse=Xs.create,Zse=Y0.create,Hse=Qu.create,Wse=ca.create,Yse=ca.strictCreate,Jse=wp.create,Kse=zk.create,Gse=_p.create,Xse=Wo.create,Qse=Zk.create,eoe=J0.create,toe=K0.create,roe=Hk.create,noe=xp.create,ioe=Ep.create,aoe=uh.create,soe=Sp.create,ooe=Fl.create,G3=za.create,uoe=ls.create,coe=Yo.create,loe=za.createWithPreprocess,doe=ch.create,foe=()=>Jk().optional(),poe=()=>Kk().optional(),hoe=()=>Gk().optional(),moe={string:t=>kl.create({...t,coerce:!0}),number:t=>hp.create({...t,coerce:!0}),boolean:t=>gp.create({...t,coerce:!0}),bigint:t=>mp.create({...t,coerce:!0}),date:t=>yp.create({...t,coerce:!0})},goe=qt;var St=Object.freeze({__proto__:null,defaultErrorMap:Ml,setErrorMap:lse,getErrorMap:q0,makeIssue:V0,EMPTY_PATH:dse,addIssueToContext:st,ParseStatus:Oi,INVALID:qt,DIRTY:Z0,OK:_i,isAborted:Ww,isDirty:Yw,isValid:Xu,isAsync:pp,get util(){return Nr},get objectUtil(){return Hw},ZodParsedType:dt,getParsedType:Ms,ZodType:or,datetimeRegex:$k,ZodString:kl,ZodNumber:hp,ZodBigInt:mp,ZodBoolean:gp,ZodDate:yp,ZodSymbol:W0,ZodUndefined:vp,ZodNull:bp,ZodAny:Rl,ZodUnknown:ku,ZodNever:Xs,ZodVoid:Y0,ZodArray:Qu,ZodObject:ca,ZodUnion:wp,ZodDiscriminatedUnion:zk,ZodIntersection:_p,ZodTuple:Wo,ZodRecord:Zk,ZodMap:J0,ZodSet:K0,ZodFunction:Hk,ZodLazy:xp,ZodLiteral:Ep,ZodEnum:uh,ZodNativeEnum:Sp,ZodPromise:Fl,ZodEffects:za,ZodTransformer:za,ZodOptional:ls,ZodNullable:Yo,ZodDefault:Tp,ZodCatch:Dp,ZodNaN:G0,BRAND:kse,ZodBranded:Rx,ZodPipeline:ch,ZodReadonly:Ap,custom:Yk,Schema:or,ZodSchema:or,late:Rse,get ZodFirstPartyTypeKind(){return Lt},coerce:moe,any:zse,array:Hse,bigint:Bse,boolean:Gk,date:Lse,discriminatedUnion:Kse,effect:G3,enum:aoe,function:roe,instanceof:Fse,intersection:Gse,lazy:noe,literal:ioe,map:eoe,nan:Pse,nativeEnum:soe,never:Vse,null:Use,nullable:coe,number:Kk,object:Wse,oboolean:hoe,onumber:poe,optional:uoe,ostring:foe,pipeline:doe,preprocess:loe,promise:ooe,record:Qse,set:toe,strictObject:Yse,string:Jk,symbol:jse,transformer:G3,tuple:Xse,undefined:$se,union:Jse,unknown:qse,void:Zse,NEVER:goe,ZodIssueCode:qe,quotelessJson:cse,ZodError:Fa});const yoe=t=>t!=null;St.any().refine(t=>yoe(t));function Xk(){return St.object({notionId:St.string(),phid:St.string()})}function Qk(){return St.object({__typename:St.literal("Comment").optional(),content:St.string(),createdAt:St.string().datetime(),creatorAddress:St.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Invalid Ethereum address format"}),lastEditedAt:St.string().datetime(),notionId:St.string(),phid:St.string()})}function eR(){return St.object({content:St.string(),createdAt:St.string().datetime(),issuePhid:St.string(),notionId:St.string(),phid:St.string()})}function tR(){return St.object({createdAt:St.string().datetime(),notionIds:St.array(St.string().nullish()),phid:St.string()})}function Fx(){return St.object({issuePhid:St.string(),phid:St.string()})}function rR(){return St.object({phid:St.string()})}function Px(){return St.object({content:St.string().nullish(),editedAt:St.string().datetime(),issuePhid:St.string(),notionId:St.string().nullish(),phid:St.string()})}function voe(){return St.object({__typename:St.literal("Issue").optional(),comments:St.array(Qk()),createdAt:St.string().datetime(),creatorAddress:St.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Invalid Ethereum address format"}),notionIds:St.array(St.string()),phid:St.string()})}function nR(){return St.object({notionId:St.string(),phid:St.string()})}const boe=St.coerce.date(),woe=St.number();function gy(t,e){return St.string().refine(r=>!t.includes(r),{message:e??"Item already exists"})}function Pl(t,e){return St.string().refine(r=>t.includes(r),{message:e??"Item does not exist exist"})}function _oe(t,e){return St.string().refine(r=>r===t,{message:e??"String does not match"})}function iR(t){return St.object({phid:gy(t.issues.map(e=>e.phid),"Issue with this phid already exists")})}function aR(t){return St.object({phid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist")})}function sR(t){return St.object({content:St.string().min(1,"Comment cannot be empty"),notionId:St.string().min(1,"Notion ID cannot be empty"),issuePhid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist"),phid:gy(t.issues.flatMap(e=>e.comments.map(r=>r.phid)),"Comment with this phid already exists")})}function t_(t){return St.object({content:St.string().min(1,"Comment cannot be empty"),issuePhid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist"),phid:Pl(t.issues.flatMap(e=>e.comments.map(r=>r.phid)),"Comment with this phid does not exist")})}const xoe=Object.freeze(Object.defineProperty({__proto__:null,dateValidator:boe,makeDeleteIssueValidator:aR,makeExistingCommentValidator:t_,makeIssueValidator:iR,makeNewCommentValidator:sR,makeStringEqualsValidator:_oe,makeStringExistsValidator:Pl,makeUniqueStringValidator:gy,numberValidator:woe},Symbol.toStringTag,{value:"Module"})),Du=["0xd8da6bf26964af9d7eed9e03e53415d37aa96045","0xd61415f6c5d93027778ceab5f099f64c29f58fd7","0x9aDdcBbaA28F7eB5f75E023F7C1Fcb13C9DFD8F7","0xf0a8ebe58a810a185e6ae23b066c14aa36574571","0x4714C7EfE5D0213615FC6CBB8717B524eC433e9a","0x985ab1Da57161724ea8497b0E6F8DBe02e85342B","0xeDA03FbC91bf77339b9387a8Aebe55524bB96Add","0xcA06585Ee8b94351288277f0Ea7ee9234a00Afb8","0x7Ea463eEcF971f57799afC4e1069c6521E47c4c1","0x1F9137De785BDE7964d1f761877fDd43063A7D10","0x231FfDB6EF1197Ed073691Ebb232a5123DfD579c","0x4bCA3550e7d7928B8AdCbE2043028Ed955447C94","0x3E0De0A940A0635A2dA865B69a2dc324F7E85076"],qh={createIssueOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to submit issues");const s=voe().merge(iR(t)),o={...e.input,creatorAddress:a,comments:[]},u=s.safeParse(o);if(!u.success)throw new Error(u.error.message);t.issues.push(u.data)},deleteIssueOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to delete issues");const s=aR(t).safeParse(e.input);if(!s.success)throw console.log(s.error),new Error(s.error.message);const o=t.issues.find(u=>u.phid===e.input.phid);if(!o)throw new Error("Issue with this phid does not exist");if(o.creatorAddress!==a)throw new Error("User is not the creator of this issue");t.issues=t.issues.filter(u=>u.phid!==o.phid)},addNotionIdOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to add notion IDs");const s=t.issues.find(u=>u.phid===e.input.phid);if(!s)throw new Error("Issue with this phid does not exist");const o=gy(s.notionIds,"This Notion ID is already linked to this issue").safeParse(e.input.notionId);if(!o.success)throw new Error(o.error.message);s.notionIds=[...s.notionIds,e.input.notionId],t.issues=t.issues.map(u=>u.phid===s.phid?s:u)},removeNotionIdOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to remove notion IDs");const s=t.issues.find(u=>u.phid===e.input.phid);if(!s)throw new Error("Issue with this phid does not exist");const o=Pl(s.notionIds,"This Notion ID does not exist on this issue").safeParse(e.input.notionId);if(!o.success)throw new Error(o.error.message);s.notionIds=s.notionIds.filter(u=>u!==e.input.notionId),t.issues=t.issues.map(u=>u.phid===s.phid?s:u)}},Cv={createCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to submit comments");const s=Qk().merge(sR(t)),o={...e.input,lastEditedAt:e.input.createdAt,creatorAddress:a},u=s.safeParse(o);if(!u.success)throw new Error(u.error.message);const c=t.issues.find(l=>l.phid===e.input.issuePhid);if(!c)throw new Error("Issue with this phid does not exist");c.comments.push(u.data),t.issues=t.issues.map(l=>(l.phid,e.input.issuePhid,l))},deleteCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to delete comments");const s=Fx().merge(t_(t).omit({content:!0})).safeParse(e.input);if(!s.success)throw new Error(s.error.message);const o=t.issues.find(c=>c.phid===e.input.issuePhid);if(!o)throw new Error("Issue not found");const u=o.comments.find(c=>c.phid===e.input.phid);if(!u)throw new Error("Comment not found");if(u.creatorAddress!==a)throw new Error("User is not allowed to delete this comment");o.comments=o.comments.filter(c=>c.phid!==u.phid),t.issues=t.issues.map(c=>c.phid===o.phid?o:c)},editCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to edit comments");const s=Px().merge(t_(t)).safeParse(e.input);if(!s.success)throw new Error(s.error.message);const o=t.issues.find(c=>c.phid===e.input.issuePhid);if(!o)throw new Error("Comment with this phid does not exist");const u=o.comments.find(c=>c.phid===e.input.phid);if(!u)throw new Error("Comment not found");if(u.creatorAddress!==a)throw new Error("User is not allowed to edit this comment");u.content=s.data.content??u.content,u.notionId=s.data.notionId??u.notionId,u.lastEditedAt=e.input.editedAt,o.comments=o.comments.map(c=>c.phid===e.input.phid?u:c),t.issues=t.issues.map(c=>(c.phid,e.input.issuePhid,c))}},Eoe=(t,e,r)=>{if(Xe.isBaseAction(e))return t;switch(e.type){case"CREATE_ISSUE":tR().parse(e.input),qh.createIssueOperation(t[e.scope],e,r);break;case"DELETE_ISSUE":rR().parse(e.input),qh.deleteIssueOperation(t[e.scope],e,r);break;case"ADD_NOTION_ID":Xk().parse(e.input),qh.addNotionIdOperation(t[e.scope],e,r);break;case"REMOVE_NOTION_ID":nR().parse(e.input),qh.removeNotionIdOperation(t[e.scope],e,r);break;case"CREATE_COMMENT":eR().parse(e.input),Cv.createCommentOperation(t[e.scope],e,r);break;case"DELETE_COMMENT":Fx().parse(e.input),Cv.deleteCommentOperation(t[e.scope],e,r);break;case"EDIT_COMMENT":Px().parse(e.input),Cv.editCommentOperation(t[e.scope],e,r);break;default:return t}},X0=Xe.createReducer(Eoe),Soe={issues:[]},Toe={},hf={fileExtension:".phdm",createState(t){return{global:{...Soe,...t==null?void 0:t.global},local:{...Toe,...t==null?void 0:t.local}}},createExtendedState(t){return Xe.createExtendedState({...t,documentType:"makerdao/feedback-issues"},hf.createState)},createDocument(t){return Xe.createDocument(hf.createExtendedState(t),hf.createState)},saveToFile(t,e,r){return Xe.saveToFile(t,e,".phdm",r)},saveToFileHandle(t,e){return Xe.saveToFileHandle(t,e)},loadFromFile(t){return Xe.loadFromFile(t,X0)},loadFromInput(t){return Xe.loadFromInput(t,X0)}},{createAction:yy}=Xe,oR=t=>yy("CREATE_ISSUE",{...t},void 0,tR,"global"),uR=t=>yy("DELETE_ISSUE",{...t},void 0,rR,"global"),cR=t=>yy("ADD_NOTION_ID",{...t},void 0,Xk,"global"),lR=t=>yy("REMOVE_NOTION_ID",{...t},void 0,nR,"global");let Doe=class extends Pr{createIssue(e){return this.dispatch(oR(e))}deleteIssue(e){return this.dispatch(uR(e))}addNotionId(e){return this.dispatch(cR(e))}removeNotionId(e){return this.dispatch(lR(e))}};const{createAction:Bx}=Xe,dR=t=>Bx("CREATE_COMMENT",{...t},void 0,eR,"global"),fR=t=>Bx("DELETE_COMMENT",{...t},void 0,Fx,"global"),pR=t=>Bx("EDIT_COMMENT",{...t},void 0,Px,"global");let Aoe=class extends Pr{createComment(e){return this.dispatch(dR(e))}deleteComment(e){return this.dispatch(fR(e))}editComment(e){return this.dispatch(pR(e))}};const hR=class mR extends Pr{constructor(e,r){super(X0,hf.createDocument(e),r)}saveToFile(e,r){return super.saveToFile(e,mR.fileExtension,r)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const r=new this;return await r.loadFromFile(e),r}};ose(hR,"fileExtension",".phdm");let gR=hR;Qo(gR,[Doe,Aoe]);const Noe=Object.freeze(Object.defineProperty({__proto__:null,addNotionId:cR,createComment:dR,createIssue:oR,deleteComment:fR,deleteIssue:uR,editComment:pR,removeNotionId:lR},Symbol.toStringTag,{value:"Module"})),Ioe=gR,Coe={...hf,...xoe},Ooe={...Xo,...Noe},Moe={Document:Ioe,reducer:X0,actions:Ooe,utils:Coe,documentModel:use};var koe=Object.defineProperty,Roe=(t,e,r)=>e in t?koe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Foe=(t,e,r)=>Roe(t,e+"",r);const Poe={id:"powerhouse/budget-statement",name:"BudgetStatement",extension:"phbs",description:"The BudgetStatement module manages the state and actions related to budget statements, which are documents that track the financial transactions of an organization over a month.",author:{name:"Powerhouse",website:"https://powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"account",operations:[{name:"AddAccount",id:"",description:"",schema:`input AddAccountInput {
511
+ }`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]}]}]};var Nr;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Nr||(Nr={}));var Hw;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Hw||(Hw={}));const dt=Nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ms=t=>{switch(typeof t){case"undefined":return dt.undefined;case"string":return dt.string;case"number":return isNaN(t)?dt.nan:dt.number;case"boolean":return dt.boolean;case"function":return dt.function;case"bigint":return dt.bigint;case"symbol":return dt.symbol;case"object":return Array.isArray(t)?dt.array:t===null?dt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?dt.promise:typeof Map<"u"&&t instanceof Map?dt.map:typeof Set<"u"&&t instanceof Set?dt.set:typeof Date<"u"&&t instanceof Date?dt.date:dt.object;default:return dt.unknown}},qe=Nr.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"]),cse=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");let Fa=class Rk 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(a){return a.message},n={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(s))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return i(this),n}static assert(e){if(!(e instanceof Rk))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fa.create=t=>new Fa(t);const Ml=(t,e)=>{let r;switch(t.code){case qe.invalid_type:t.received===dt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Nr.jsonStringifyReplacer)}`;break;case qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nr.joinValues(t.keys,", ")}`;break;case qe.invalid_union:r="Invalid input";break;case qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nr.joinValues(t.options)}`;break;case qe.invalid_enum_value:r=`Invalid enum value. Expected ${Nr.joinValues(t.options)}, received '${t.received}'`;break;case qe.invalid_arguments:r="Invalid function arguments";break;case qe.invalid_return_type:r="Invalid function return type";break;case qe.invalid_date:r="Invalid date";break;case qe.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}"`:Nr.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case qe.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==="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 qe.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 qe.custom:r="Invalid input";break;case qe.invalid_intersection_types:r="Intersection results could not be merged";break;case qe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case qe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Nr.assertNever(t)}return{message:r}};let Fk=Ml;function lse(t){Fk=t}function q0(){return Fk}const V0=t=>{const{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],s={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let o="";const u=n.filter(c=>!!c).slice().reverse();for(const c of u)o=c(s,{data:e,defaultError:o}).message;return{...i,path:a,message:o}},dse=[];function st(t,e){const r=q0(),n=V0({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ml?void 0:Ml].filter(i=>!!i)});t.common.issues.push(n)}let Oi=class Pk{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const i of r){if(i.status==="aborted")return qt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const i of r){const a=await i.key,s=await i.value;n.push({key:a,value:s})}return Pk.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const i of r){const{key:a,value:s}=i;if(a.status==="aborted"||s.status==="aborted")return qt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[a.value]=s.value)}return{status:e.value,value:n}}};const qt=Object.freeze({status:"aborted"}),Z0=t=>({status:"dirty",value:t}),_i=t=>({status:"valid",value:t}),Ww=t=>t.status==="aborted",Yw=t=>t.status==="dirty",Xu=t=>t.status==="valid",pp=t=>typeof Promise<"u"&&t instanceof Promise;function H0(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Bk(t,e,r,n,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var _t;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_t||(_t={}));var Jd,Kd;let ms=class{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||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const K3=(t,e)=>{if(Xu(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 Fa(t.common.issues);return this._error=r,this._error}}};function rr(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,s)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(o=c??n)!==null&&o!==void 0?o:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(u=c??r)!==null&&u!==void 0?u:s.defaultError}},description:i}}let or=class{get description(){return this._def.description}_getType(e){return Ms(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ms(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oi,ctx:{common:e.parent.common,data:e.data,parsedType:Ms(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(pp(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){var n;const i={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ms(e)},a=this._parseSync({data:e,path:i.path,parent:i});return K3(i,a)}"~validate"(e){var r,n;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ms(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:i});return Xu(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(r=a==null?void 0:a.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>Xu(a)?{value:a.value}:{issues:i.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:Ms(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(pp(i)?i:Promise.resolve(i));return K3(n,a)}refine(e,r){const n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{const s=e(i),o=()=>a.addIssue({code:qe.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(o(),!1)):s?!0:(o(),!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 za({schema:this,typeName:Lt.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 ls.create(this,this._def)}nullable(){return Yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qu.create(this)}promise(){return Fl.create(this,this._def)}or(e){return wp.create([this,e],this._def)}and(e){return _p.create(this,e,this._def)}transform(e){return new za({...rr(this._def),schema:this,typeName:Lt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Tp({...rr(this._def),innerType:this,defaultValue:r,typeName:Lt.ZodDefault})}brand(){return new Rx({typeName:Lt.ZodBranded,type:this,...rr(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Dp({...rr(this._def),innerType:this,catchValue:r,typeName:Lt.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ch.create(this,e)}readonly(){return Ap.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const fse=/^c[^\s-]{8,}$/i,pse=/^[0-9a-z]+$/,hse=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mse=/^[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,gse=/^[a-z0-9_-]{21}$/i,yse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vse=/^[-+]?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)?)??$/,bse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wse="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Iv;const _se=/^(?:(?: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])$/,xse=/^(?:(?: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])$/,Ese=/^(([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]))$/,Sse=/^(([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])$/,Tse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lk="((\\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])))",Ase=new RegExp(`^${Lk}$`);function jk(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Nse(t){return new RegExp(`^${jk(t)}$`)}function $k(t){let e=`${Lk}T${jk(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 Ise(t,e){return!!((e==="v4"||!e)&&_se.test(t)||(e==="v6"||!e)&&Ese.test(t))}function Cse(t,e){if(!yse.test(t))return!1;try{const[r]=t.split("."),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||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function Ose(t,e){return!!((e==="v4"||!e)&&xse.test(t)||(e==="v6"||!e)&&Sse.test(t))}let kl=class Gd extends or{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==dt.string){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.string,received:i.parsedType}),qt}const r=new Oi;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(n=this._getOrReturnCtx(e,n),a?st(n,{code:qe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&st(n,{code:qe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")bse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"email",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Iv||(Iv=new RegExp(wse,"u")),Iv.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"emoji",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")mse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"uuid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")gse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"nanoid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")fse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cuid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")pse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cuid2",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")hse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"ulid",code:qe.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),st(n,{validation:"url",code:qe.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"regex",code:qe.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$k(i).test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Ase.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Nse(i).test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{code:qe.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?vse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"duration",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Ise(e.data,i.version)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"ip",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Cse(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"jwt",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Ose(e.data,i.version)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"cidr",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Tse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"base64",code:qe.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Dse.test(e.data)||(n=this._getOrReturnCtx(e,n),st(n,{validation:"base64url",code:qe.invalid_string,message:i.message}),r.dirty()):Nr.assertNever(i);return{status:r.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:qe.invalid_string,..._t.errToObj(n)})}_addCheck(e){return new Gd({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._t.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._t.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._t.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._t.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._t.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._t.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._t.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._t.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._t.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._t.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._t.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._t.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._t.errToObj(e)})}datetime(e){var r,n;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:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,..._t.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,..._t.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._t.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._t.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._t.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._t.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._t.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._t.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._t.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._t.errToObj(r)})}nonempty(e){return this.min(1,_t.errToObj(e))}trim(){return new Gd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Gd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Gd({...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.value<e)&&(e=r.value);return e}};kl.create=t=>{var e;return new kl({checks:[],typeName:Lt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rr(t)})};function Mse(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return a%s/Math.pow(10,i)}let hp=class Jw extends or{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)!==dt.number){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.number,received:i.parsedType}),qt}let r;const n=new Oi;for(const i of this._def.checks)i.kind==="int"?Nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),st(r,{code:qe.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Mse(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_finite,message:i.message}),n.dirty()):Nr.assertNever(i);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_t.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_t.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_t.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_t.toString(r))}setLimit(e,r,n,i){return new Jw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_t.toString(i)}]})}_addCheck(e){return new Jw({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_t.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_t.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_t.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_t.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_t.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_t.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_t.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_t.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_t.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.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Nr.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.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};hp.create=t=>new hp({checks:[],typeName:Lt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...rr(t)});let mp=class Kw extends or{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)!==dt.bigint)return this._getInvalidInput(e);let r;const n=new Oi;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),st(r,{code:qe.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Nr.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.bigint,received:r.parsedType}),qt}gte(e,r){return this.setLimit("min",e,!0,_t.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_t.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_t.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_t.toString(r))}setLimit(e,r,n,i){return new Kw({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_t.toString(i)}]})}_addCheck(e){return new Kw({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_t.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_t.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_t.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_t.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_t.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.value<e)&&(e=r.value);return e}};mp.create=t=>{var e;return new mp({checks:[],typeName:Lt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...rr(t)})};let gp=class extends or{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==dt.boolean){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.boolean,received:r.parsedType}),qt}return _i(e.data)}};gp.create=t=>new gp({typeName:Lt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...rr(t)});let yp=class Uk extends or{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==dt.date){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_type,expected:dt.date,received:i.parsedType}),qt}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return st(i,{code:qe.invalid_date}),qt}const r=new Oi;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),st(n,{code:qe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Nr.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Uk({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_t.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_t.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.value<e)&&(e=r.value);return e!=null?new Date(e):null}};yp.create=t=>new yp({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Lt.ZodDate,...rr(t)});class W0 extends or{_parse(e){if(this._getType(e)!==dt.symbol){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.symbol,received:r.parsedType}),qt}return _i(e.data)}}W0.create=t=>new W0({typeName:Lt.ZodSymbol,...rr(t)});let vp=class extends or{_parse(e){if(this._getType(e)!==dt.undefined){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.undefined,received:r.parsedType}),qt}return _i(e.data)}};vp.create=t=>new vp({typeName:Lt.ZodUndefined,...rr(t)});let bp=class extends or{_parse(e){if(this._getType(e)!==dt.null){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.null,received:r.parsedType}),qt}return _i(e.data)}};bp.create=t=>new bp({typeName:Lt.ZodNull,...rr(t)});let Rl=class extends or{constructor(){super(...arguments),this._any=!0}_parse(e){return _i(e.data)}};Rl.create=t=>new Rl({typeName:Lt.ZodAny,...rr(t)});let ku=class extends or{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _i(e.data)}};ku.create=t=>new ku({typeName:Lt.ZodUnknown,...rr(t)});let Xs=class extends or{_parse(e){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.never,received:r.parsedType}),qt}};Xs.create=t=>new Xs({typeName:Lt.ZodNever,...rr(t)});let Y0=class extends or{_parse(e){if(this._getType(e)!==dt.undefined){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.void,received:r.parsedType}),qt}return _i(e.data)}};Y0.create=t=>new Y0({typeName:Lt.ZodVoid,...rr(t)});let Qu=class Um extends or{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==dt.array)return st(r,{code:qe.invalid_type,expected:dt.array,received:r.parsedType}),qt;if(i.exactLength!==null){const s=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(s||o)&&(st(r,{code:s?qe.too_big:qe.too_small,minimum:o?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(st(r,{code:qe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(st(r,{code:qe.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((s,o)=>i.type._parseAsync(new ms(r,s,r.path,o)))).then(s=>Oi.mergeArray(n,s));const a=[...r.data].map((s,o)=>i.type._parseSync(new ms(r,s,r.path,o)));return Oi.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new Um({...this._def,minLength:{value:e,message:_t.toString(r)}})}max(e,r){return new Um({...this._def,maxLength:{value:e,message:_t.toString(r)}})}length(e,r){return new Um({...this._def,exactLength:{value:e,message:_t.toString(r)}})}nonempty(e){return this.min(1,e)}};Qu.create=(t,e)=>new Qu({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Lt.ZodArray,...rr(e)});function Uc(t){if(t instanceof ca){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=ls.create(Uc(n))}return new ca({...t._def,shape:()=>e})}else return t instanceof Qu?new Qu({...t._def,type:Uc(t.element)}):t instanceof ls?ls.create(Uc(t.unwrap())):t instanceof Yo?Yo.create(Uc(t.unwrap())):t instanceof Wo?Wo.create(t.items.map(e=>Uc(e))):t}let ca=class ba extends or{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=Nr.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==dt.object){const u=this._getOrReturnCtx(e);return st(u,{code:qe.invalid_type,expected:dt.object,received:u.parsedType}),qt}const{status:r,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Xs&&this._def.unknownKeys==="strip"))for(const u in n.data)a.includes(u)||s.push(u);const o=[];for(const u of a){const c=i[u],l=n.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new ms(n,l,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Xs){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(u==="strict")s.length>0&&(st(n,{code:qe.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const l=n.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new ms(n,l,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of o){const l=await c.key,d=await c.value;u.push({key:l,value:d,alwaysSet:c.alwaysSet})}return u}).then(u=>Oi.mergeObjectSync(r,u)):Oi.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(e){return _t.errToObj,new ba({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,a,s,o;const u=(s=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,r,n).message)!==null&&s!==void 0?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=_t.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new ba({...this._def,unknownKeys:"strip"})}passthrough(){return new ba({...this._def,unknownKeys:"passthrough"})}extend(e){return new ba({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ba({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Lt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ba({...this._def,catchall:e})}pick(e){const r={};return Nr.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new ba({...this._def,shape:()=>r})}omit(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new ba({...this._def,shape:()=>r})}deepPartial(){return Uc(this)}partial(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new ba({...this._def,shape:()=>r})}required(e){const r={};return Nr.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ls;)i=i._def.innerType;r[n]=i}}),new ba({...this._def,shape:()=>r})}keyof(){return Wk(Nr.objectKeys(this.shape))}};ca.create=(t,e)=>new ca({shape:()=>t,unknownKeys:"strip",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});ca.strictCreate=(t,e)=>new ca({shape:()=>t,unknownKeys:"strict",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});ca.lazycreate=(t,e)=>new ca({shape:t,unknownKeys:"strip",catchall:Xs.create(),typeName:Lt.ZodObject,...rr(e)});let wp=class extends or{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Fa(o.ctx.common.issues));return st(r,{code:qe.invalid_union,unionErrors:s}),qt}if(r.common.async)return Promise.all(n.map(async a=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let a;const s=[];for(const u of n){const c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(u=>new Fa(u));return st(r,{code:qe.invalid_union,unionErrors:o}),qt}}get options(){return this._def.options}};wp.create=(t,e)=>new wp({options:t,typeName:Lt.ZodUnion,...rr(e)});const po=t=>t instanceof xp?po(t.schema):t instanceof za?po(t.innerType()):t instanceof Ep?[t.value]:t instanceof uh?t.options:t instanceof Sp?Nr.objectValues(t.enum):t instanceof Tp?po(t._def.innerType):t instanceof vp?[void 0]:t instanceof bp?[null]:t instanceof ls?[void 0,...po(t.unwrap())]:t instanceof Yo?[null,...po(t.unwrap())]:t instanceof Rx||t instanceof Ap?po(t.unwrap()):t instanceof Dp?po(t._def.innerType):[];let zk=class qk extends or{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.object)return st(r,{code:qe.invalid_type,expected:dt.object,received:r.parsedType}),qt;const n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(st(r,{code:qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),qt)}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 a of r){const s=po(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,a)}}return new qk({typeName:Lt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...rr(n)})}};function Gw(t,e){const r=Ms(t),n=Ms(e);if(t===e)return{valid:!0,data:t};if(r===dt.object&&n===dt.object){const i=Nr.objectKeys(e),a=Nr.objectKeys(t).filter(o=>i.indexOf(o)!==-1),s={...t,...e};for(const o of a){const u=Gw(t[o],e[o]);if(!u.valid)return{valid:!1};s[o]=u.data}return{valid:!0,data:s}}else if(r===dt.array&&n===dt.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],u=Gw(s,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===dt.date&&n===dt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}let _p=class extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=(a,s)=>{if(Ww(a)||Ww(s))return qt;const o=Gw(a.value,s.value);return o.valid?((Yw(a)||Yw(s))&&r.dirty(),{status:r.value,value:o.data}):(st(n,{code:qe.invalid_intersection_types}),qt)};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(([a,s])=>i(a,s)):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}))}};_p.create=(t,e,r)=>new _p({left:t,right:e,typeName:Lt.ZodIntersection,...rr(r)});let Wo=class Vk extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.array)return st(n,{code:qe.invalid_type,expected:dt.array,received:n.parsedType}),qt;if(n.data.length<this._def.items.length)return st(n,{code:qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),qt;!this._def.rest&&n.data.length>this._def.items.length&&(st(n,{code:qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((a,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new ms(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Oi.mergeArray(r,a)):Oi.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Vk({...this._def,rest:e})}};Wo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wo({items:t,typeName:Lt.ZodTuple,rest:null,...rr(e)})};let Zk=class Xw extends or{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!==dt.object)return st(n,{code:qe.invalid_type,expected:dt.object,received:n.parsedType}),qt;const i=[],a=this._def.keyType,s=this._def.valueType;for(const o in n.data)i.push({key:a._parse(new ms(n,o,n.path,o)),value:s._parse(new ms(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?Oi.mergeObjectAsync(r,i):Oi.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof or?new Xw({keyType:e,valueType:r,typeName:Lt.ZodRecord,...rr(n)}):new Xw({keyType:kl.create(),valueType:e,typeName:Lt.ZodRecord,...rr(r)})}};class J0 extends or{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!==dt.map)return st(n,{code:qe.invalid_type,expected:dt.map,received:n.parsedType}),qt;const i=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([o,u],c)=>({key:i._parse(new ms(n,o,n.path,[c,"key"])),value:a._parse(new ms(n,u,n.path,[c,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of s){const c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return qt;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const u of s){const c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return qt;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}}J0.create=(t,e,r)=>new J0({valueType:e,keyType:t,typeName:Lt.ZodMap,...rr(r)});let K0=class Qw extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==dt.set)return st(n,{code:qe.invalid_type,expected:dt.set,received:n.parsedType}),qt;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(st(n,{code:qe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(st(n,{code:qe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());const a=this._def.valueType;function s(u){const c=new Set;for(const l of u){if(l.status==="aborted")return qt;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((u,c)=>a._parse(new ms(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>s(u)):s(o)}min(e,r){return new Qw({...this._def,minSize:{value:e,message:_t.toString(r)}})}max(e,r){return new Qw({...this._def,maxSize:{value:e,message:_t.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};K0.create=(t,e)=>new K0({valueType:t,minSize:null,maxSize:null,typeName:Lt.ZodSet,...rr(e)});let Hk=class zm extends or{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.function)return st(r,{code:qe.invalid_type,expected:dt.function,received:r.parsedType}),qt;function n(o,u){return V0({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,q0(),Ml].filter(c=>!!c),issueData:{code:qe.invalid_arguments,argumentsError:u}})}function i(o,u){return V0({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,q0(),Ml].filter(c=>!!c),issueData:{code:qe.invalid_return_type,returnTypeError:u}})}const a={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Fl){const o=this;return _i(async function(...u){const c=new Fa([]),l=await o._def.args.parseAsync(u,a).catch(f=>{throw c.addIssue(n(u,f)),c}),d=await Reflect.apply(s,this,l);return await o._def.returns._def.type.parseAsync(d,a).catch(f=>{throw c.addIssue(i(d,f)),c})})}else{const o=this;return _i(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new Fa([n(u,c.error)]);const l=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(l,a);if(!d.success)throw new Fa([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new zm({...this._def,args:Wo.create(e).rest(ku.create())})}returns(e){return new zm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new zm({args:e||Wo.create([]).rest(ku.create()),returns:r||ku.create(),typeName:Lt.ZodFunction,...rr(n)})}};class xp extends or{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})}}xp.create=(t,e)=>new xp({getter:t,typeName:Lt.ZodLazy,...rr(e)});let Ep=class extends or{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return st(r,{received:r.data,code:qe.invalid_literal,expected:this._def.value}),qt}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ep.create=(t,e)=>new Ep({value:t,typeName:Lt.ZodLiteral,...rr(e)});function Wk(t,e){return new uh({values:t,typeName:Lt.ZodEnum,...rr(e)})}let uh=class e_ extends or{constructor(){super(...arguments),Jd.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{expected:Nr.joinValues(n),received:r.parsedType,code:qe.invalid_type}),qt}if(H0(this,Jd)||Bk(this,Jd,new Set(this._def.values)),!H0(this,Jd).has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return st(r,{received:r.data,code:qe.invalid_enum_value,options:n}),qt}return _i(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 e_.create(e,{...this._def,...r})}exclude(e,r=this._def){return e_.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Jd=new WeakMap;uh.create=Wk;let Sp=class extends or{constructor(){super(...arguments),Kd.set(this,void 0)}_parse(e){const r=Nr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==dt.string&&n.parsedType!==dt.number){const i=Nr.objectValues(r);return st(n,{expected:Nr.joinValues(i),received:n.parsedType,code:qe.invalid_type}),qt}if(H0(this,Kd)||Bk(this,Kd,new Set(Nr.getValidEnumValues(this._def.values))),!H0(this,Kd).has(e.data)){const i=Nr.objectValues(r);return st(n,{received:n.data,code:qe.invalid_enum_value,options:i}),qt}return _i(e.data)}get enum(){return this._def.values}};Kd=new WeakMap;Sp.create=(t,e)=>new Sp({values:t,typeName:Lt.ZodNativeEnum,...rr(e)});let Fl=class extends or{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==dt.promise&&r.common.async===!1)return st(r,{code:qe.invalid_type,expected:dt.promise,received:r.parsedType}),qt;const n=r.parsedType===dt.promise?r.data:Promise.resolve(r.data);return _i(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Fl.create=(t,e)=>new Fl({type:t,typeName:Lt.ZodPromise,...rr(e)});let za=class extends or{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:s=>{st(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const s=i.transform(n.data,a);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return qt;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?qt:u.status==="dirty"||r.value==="dirty"?Z0(u.value):u});{if(r.value==="aborted")return qt;const o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?qt:o.status==="dirty"||r.value==="dirty"?Z0(o.value):o}}if(i.type==="refinement"){const s=o=>{const u=i.refinement(o,a);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 o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?qt:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?qt:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xu(s))return s;const o=i.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Xu(s)?Promise.resolve(i.transform(s.value,a)).then(o=>({status:r.value,value:o})):s);Nr.assertNever(i)}};za.create=(t,e,r)=>new za({schema:t,typeName:Lt.ZodEffects,effect:e,...rr(r)});za.createWithPreprocess=(t,e,r)=>new za({schema:e,effect:{type:"preprocess",transform:t},typeName:Lt.ZodEffects,...rr(r)});let ls=class extends or{_parse(e){return this._getType(e)===dt.undefined?_i(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ls.create=(t,e)=>new ls({innerType:t,typeName:Lt.ZodOptional,...rr(e)});let Yo=class extends or{_parse(e){return this._getType(e)===dt.null?_i(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Yo.create=(t,e)=>new Yo({innerType:t,typeName:Lt.ZodNullable,...rr(e)});class Tp extends or{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===dt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Tp.create=(t,e)=>new Tp({innerType:t,typeName:Lt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...rr(e)});let Dp=class extends or{_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 pp(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Fa(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Dp.create=(t,e)=>new Dp({innerType:t,typeName:Lt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...rr(e)});let G0=class extends or{_parse(e){if(this._getType(e)!==dt.nan){const r=this._getOrReturnCtx(e);return st(r,{code:qe.invalid_type,expected:dt.nan,received:r.parsedType}),qt}return{status:"valid",value:e.data}}};G0.create=t=>new G0({typeName:Lt.ZodNaN,...rr(t)});const kse=Symbol("zod_brand");let Rx=class extends or{_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}};class ch extends or{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?qt:i.status==="dirty"?(r.dirty(),Z0(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?qt: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 ch({in:e,out:r,typeName:Lt.ZodPipeline})}}let Ap=class extends or{_parse(e){const r=this._def.innerType._parse(e),n=i=>(Xu(i)&&(i.value=Object.freeze(i.value)),i);return pp(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Ap.create=(t,e)=>new Ap({innerType:t,typeName:Lt.ZodReadonly,...rr(e)});function Yk(t,e={},r){return t?Rl.create().superRefine((n,i)=>{var a,s;if(!t(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(s=(a=o.fatal)!==null&&a!==void 0?a:r)!==null&&s!==void 0?s:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:u})}}):Rl.create()}const Rse={object:ca.lazycreate};var Lt;(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"})(Lt||(Lt={}));const Fse=(t,e={message:`Input not instance of ${t.name}`})=>Yk(r=>r instanceof t,e),Jk=kl.create,Kk=hp.create,Pse=G0.create,Bse=mp.create,Gk=gp.create,Lse=yp.create,jse=W0.create,$se=vp.create,Use=bp.create,zse=Rl.create,qse=ku.create,Vse=Xs.create,Zse=Y0.create,Hse=Qu.create,Wse=ca.create,Yse=ca.strictCreate,Jse=wp.create,Kse=zk.create,Gse=_p.create,Xse=Wo.create,Qse=Zk.create,eoe=J0.create,toe=K0.create,roe=Hk.create,noe=xp.create,ioe=Ep.create,aoe=uh.create,soe=Sp.create,ooe=Fl.create,G3=za.create,uoe=ls.create,coe=Yo.create,loe=za.createWithPreprocess,doe=ch.create,foe=()=>Jk().optional(),poe=()=>Kk().optional(),hoe=()=>Gk().optional(),moe={string:t=>kl.create({...t,coerce:!0}),number:t=>hp.create({...t,coerce:!0}),boolean:t=>gp.create({...t,coerce:!0}),bigint:t=>mp.create({...t,coerce:!0}),date:t=>yp.create({...t,coerce:!0})},goe=qt;var St=Object.freeze({__proto__:null,defaultErrorMap:Ml,setErrorMap:lse,getErrorMap:q0,makeIssue:V0,EMPTY_PATH:dse,addIssueToContext:st,ParseStatus:Oi,INVALID:qt,DIRTY:Z0,OK:_i,isAborted:Ww,isDirty:Yw,isValid:Xu,isAsync:pp,get util(){return Nr},get objectUtil(){return Hw},ZodParsedType:dt,getParsedType:Ms,ZodType:or,datetimeRegex:$k,ZodString:kl,ZodNumber:hp,ZodBigInt:mp,ZodBoolean:gp,ZodDate:yp,ZodSymbol:W0,ZodUndefined:vp,ZodNull:bp,ZodAny:Rl,ZodUnknown:ku,ZodNever:Xs,ZodVoid:Y0,ZodArray:Qu,ZodObject:ca,ZodUnion:wp,ZodDiscriminatedUnion:zk,ZodIntersection:_p,ZodTuple:Wo,ZodRecord:Zk,ZodMap:J0,ZodSet:K0,ZodFunction:Hk,ZodLazy:xp,ZodLiteral:Ep,ZodEnum:uh,ZodNativeEnum:Sp,ZodPromise:Fl,ZodEffects:za,ZodTransformer:za,ZodOptional:ls,ZodNullable:Yo,ZodDefault:Tp,ZodCatch:Dp,ZodNaN:G0,BRAND:kse,ZodBranded:Rx,ZodPipeline:ch,ZodReadonly:Ap,custom:Yk,Schema:or,ZodSchema:or,late:Rse,get ZodFirstPartyTypeKind(){return Lt},coerce:moe,any:zse,array:Hse,bigint:Bse,boolean:Gk,date:Lse,discriminatedUnion:Kse,effect:G3,enum:aoe,function:roe,instanceof:Fse,intersection:Gse,lazy:noe,literal:ioe,map:eoe,nan:Pse,nativeEnum:soe,never:Vse,null:Use,nullable:coe,number:Kk,object:Wse,oboolean:hoe,onumber:poe,optional:uoe,ostring:foe,pipeline:doe,preprocess:loe,promise:ooe,record:Qse,set:toe,strictObject:Yse,string:Jk,symbol:jse,transformer:G3,tuple:Xse,undefined:$se,union:Jse,unknown:qse,void:Zse,NEVER:goe,ZodIssueCode:qe,quotelessJson:cse,ZodError:Fa});const yoe=t=>t!=null;St.any().refine(t=>yoe(t));function Xk(){return St.object({notionId:St.string(),phid:St.string()})}function Qk(){return St.object({__typename:St.literal("Comment").optional(),content:St.string(),createdAt:St.string().datetime(),creatorAddress:St.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Invalid Ethereum address format"}),lastEditedAt:St.string().datetime(),notionId:St.string(),phid:St.string()})}function eR(){return St.object({content:St.string(),createdAt:St.string().datetime(),issuePhid:St.string(),notionId:St.string(),phid:St.string()})}function tR(){return St.object({createdAt:St.string().datetime(),notionIds:St.array(St.string().nullish()),phid:St.string()})}function Fx(){return St.object({issuePhid:St.string(),phid:St.string()})}function rR(){return St.object({phid:St.string()})}function Px(){return St.object({content:St.string().nullish(),editedAt:St.string().datetime(),issuePhid:St.string(),notionId:St.string().nullish(),phid:St.string()})}function voe(){return St.object({__typename:St.literal("Issue").optional(),comments:St.array(Qk()),createdAt:St.string().datetime(),creatorAddress:St.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Invalid Ethereum address format"}),notionIds:St.array(St.string()),phid:St.string()})}function nR(){return St.object({notionId:St.string(),phid:St.string()})}const boe=St.coerce.date(),woe=St.number();function gy(t,e){return St.string().refine(r=>!t.includes(r),{message:e??"Item already exists"})}function Pl(t,e){return St.string().refine(r=>t.includes(r),{message:e??"Item does not exist exist"})}function _oe(t,e){return St.string().refine(r=>r===t,{message:e??"String does not match"})}function iR(t){return St.object({phid:gy(t.issues.map(e=>e.phid),"Issue with this phid already exists")})}function aR(t){return St.object({phid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist")})}function sR(t){return St.object({content:St.string().min(1,"Comment cannot be empty"),notionId:St.string().min(1,"Notion ID cannot be empty"),issuePhid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist"),phid:gy(t.issues.flatMap(e=>e.comments.map(r=>r.phid)),"Comment with this phid already exists")})}function t_(t){return St.object({content:St.string().min(1,"Comment cannot be empty"),issuePhid:Pl(t.issues.map(e=>e.phid),"Issue with this phid does not exist"),phid:Pl(t.issues.flatMap(e=>e.comments.map(r=>r.phid)),"Comment with this phid does not exist")})}const xoe=Object.freeze(Object.defineProperty({__proto__:null,dateValidator:boe,makeDeleteIssueValidator:aR,makeExistingCommentValidator:t_,makeIssueValidator:iR,makeNewCommentValidator:sR,makeStringEqualsValidator:_oe,makeStringExistsValidator:Pl,makeUniqueStringValidator:gy,numberValidator:woe},Symbol.toStringTag,{value:"Module"})),Du=["0xd8da6bf26964af9d7eed9e03e53415d37aa96045","0xd61415f6c5d93027778ceab5f099f64c29f58fd7","0x9aDdcBbaA28F7eB5f75E023F7C1Fcb13C9DFD8F7","0xf0a8ebe58a810a185e6ae23b066c14aa36574571","0x4714C7EfE5D0213615FC6CBB8717B524eC433e9a","0x985ab1Da57161724ea8497b0E6F8DBe02e85342B","0xeDA03FbC91bf77339b9387a8Aebe55524bB96Add","0xcA06585Ee8b94351288277f0Ea7ee9234a00Afb8","0x7Ea463eEcF971f57799afC4e1069c6521E47c4c1","0x1F9137De785BDE7964d1f761877fDd43063A7D10","0x231FfDB6EF1197Ed073691Ebb232a5123DfD579c","0x4bCA3550e7d7928B8AdCbE2043028Ed955447C94","0x3E0De0A940A0635A2dA865B69a2dc324F7E85076","0x274cBec821170d47d2047E1AA177a8E0Af19c54e"],qh={createIssueOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to submit issues");const s=voe().merge(iR(t)),o={...e.input,creatorAddress:a,comments:[]},u=s.safeParse(o);if(!u.success)throw new Error(u.error.message);t.issues.push(u.data)},deleteIssueOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to delete issues");const s=aR(t).safeParse(e.input);if(!s.success)throw console.log(s.error),new Error(s.error.message);const o=t.issues.find(u=>u.phid===e.input.phid);if(!o)throw new Error("Issue with this phid does not exist");if(o.creatorAddress!==a)throw new Error("User is not the creator of this issue");t.issues=t.issues.filter(u=>u.phid!==o.phid)},addNotionIdOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to add notion IDs");const s=t.issues.find(u=>u.phid===e.input.phid);if(!s)throw new Error("Issue with this phid does not exist");const o=gy(s.notionIds,"This Notion ID is already linked to this issue").safeParse(e.input.notionId);if(!o.success)throw new Error(o.error.message);s.notionIds=[...s.notionIds,e.input.notionId],t.issues=t.issues.map(u=>u.phid===s.phid?s:u)},removeNotionIdOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to remove notion IDs");const s=t.issues.find(u=>u.phid===e.input.phid);if(!s)throw new Error("Issue with this phid does not exist");const o=Pl(s.notionIds,"This Notion ID does not exist on this issue").safeParse(e.input.notionId);if(!o.success)throw new Error(o.error.message);s.notionIds=s.notionIds.filter(u=>u!==e.input.notionId),t.issues=t.issues.map(u=>u.phid===s.phid?s:u)}},Cv={createCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to submit comments");const s=Qk().merge(sR(t)),o={...e.input,lastEditedAt:e.input.createdAt,creatorAddress:a},u=s.safeParse(o);if(!u.success)throw new Error(u.error.message);const c=t.issues.find(l=>l.phid===e.input.issuePhid);if(!c)throw new Error("Issue with this phid does not exist");c.comments.push(u.data),t.issues=t.issues.map(l=>(l.phid,e.input.issuePhid,l))},deleteCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to delete comments");const s=Fx().merge(t_(t).omit({content:!0})).safeParse(e.input);if(!s.success)throw new Error(s.error.message);const o=t.issues.find(c=>c.phid===e.input.issuePhid);if(!o)throw new Error("Issue not found");const u=o.comments.find(c=>c.phid===e.input.phid);if(!u)throw new Error("Comment not found");if(u.creatorAddress!==a)throw new Error("User is not allowed to delete this comment");o.comments=o.comments.filter(c=>c.phid!==u.phid),t.issues=t.issues.map(c=>c.phid===o.phid?o:c)},editCommentOperation(t,e,r){var n,i;const a=(i=(n=e.context)==null?void 0:n.signer)==null?void 0:i.user.address;if(!a)throw new Error("User is not signed in");if(!Du.includes(a))throw new Error("User is not allowed to edit comments");const s=Px().merge(t_(t)).safeParse(e.input);if(!s.success)throw new Error(s.error.message);const o=t.issues.find(c=>c.phid===e.input.issuePhid);if(!o)throw new Error("Comment with this phid does not exist");const u=o.comments.find(c=>c.phid===e.input.phid);if(!u)throw new Error("Comment not found");if(u.creatorAddress!==a)throw new Error("User is not allowed to edit this comment");u.content=s.data.content??u.content,u.notionId=s.data.notionId??u.notionId,u.lastEditedAt=e.input.editedAt,o.comments=o.comments.map(c=>c.phid===e.input.phid?u:c),t.issues=t.issues.map(c=>(c.phid,e.input.issuePhid,c))}},Eoe=(t,e,r)=>{if(Xe.isBaseAction(e))return t;switch(e.type){case"CREATE_ISSUE":tR().parse(e.input),qh.createIssueOperation(t[e.scope],e,r);break;case"DELETE_ISSUE":rR().parse(e.input),qh.deleteIssueOperation(t[e.scope],e,r);break;case"ADD_NOTION_ID":Xk().parse(e.input),qh.addNotionIdOperation(t[e.scope],e,r);break;case"REMOVE_NOTION_ID":nR().parse(e.input),qh.removeNotionIdOperation(t[e.scope],e,r);break;case"CREATE_COMMENT":eR().parse(e.input),Cv.createCommentOperation(t[e.scope],e,r);break;case"DELETE_COMMENT":Fx().parse(e.input),Cv.deleteCommentOperation(t[e.scope],e,r);break;case"EDIT_COMMENT":Px().parse(e.input),Cv.editCommentOperation(t[e.scope],e,r);break;default:return t}},X0=Xe.createReducer(Eoe),Soe={issues:[]},Toe={},hf={fileExtension:".phdm",createState(t){return{global:{...Soe,...t==null?void 0:t.global},local:{...Toe,...t==null?void 0:t.local}}},createExtendedState(t){return Xe.createExtendedState({...t,documentType:"makerdao/feedback-issues"},hf.createState)},createDocument(t){return Xe.createDocument(hf.createExtendedState(t),hf.createState)},saveToFile(t,e,r){return Xe.saveToFile(t,e,".phdm",r)},saveToFileHandle(t,e){return Xe.saveToFileHandle(t,e)},loadFromFile(t){return Xe.loadFromFile(t,X0)},loadFromInput(t){return Xe.loadFromInput(t,X0)}},{createAction:yy}=Xe,oR=t=>yy("CREATE_ISSUE",{...t},void 0,tR,"global"),uR=t=>yy("DELETE_ISSUE",{...t},void 0,rR,"global"),cR=t=>yy("ADD_NOTION_ID",{...t},void 0,Xk,"global"),lR=t=>yy("REMOVE_NOTION_ID",{...t},void 0,nR,"global");let Doe=class extends Pr{createIssue(e){return this.dispatch(oR(e))}deleteIssue(e){return this.dispatch(uR(e))}addNotionId(e){return this.dispatch(cR(e))}removeNotionId(e){return this.dispatch(lR(e))}};const{createAction:Bx}=Xe,dR=t=>Bx("CREATE_COMMENT",{...t},void 0,eR,"global"),fR=t=>Bx("DELETE_COMMENT",{...t},void 0,Fx,"global"),pR=t=>Bx("EDIT_COMMENT",{...t},void 0,Px,"global");let Aoe=class extends Pr{createComment(e){return this.dispatch(dR(e))}deleteComment(e){return this.dispatch(fR(e))}editComment(e){return this.dispatch(pR(e))}};const hR=class mR extends Pr{constructor(e,r){super(X0,hf.createDocument(e),r)}saveToFile(e,r){return super.saveToFile(e,mR.fileExtension,r)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const r=new this;return await r.loadFromFile(e),r}};ose(hR,"fileExtension",".phdm");let gR=hR;Qo(gR,[Doe,Aoe]);const Noe=Object.freeze(Object.defineProperty({__proto__:null,addNotionId:cR,createComment:dR,createIssue:oR,deleteComment:fR,deleteIssue:uR,editComment:pR,removeNotionId:lR},Symbol.toStringTag,{value:"Module"})),Ioe=gR,Coe={...hf,...xoe},Ooe={...Xo,...Noe},Moe={Document:Ioe,reducer:X0,actions:Ooe,utils:Coe,documentModel:use};var koe=Object.defineProperty,Roe=(t,e,r)=>e in t?koe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Foe=(t,e,r)=>Roe(t,e+"",r);const Poe={id:"powerhouse/budget-statement",name:"BudgetStatement",extension:"phbs",description:"The BudgetStatement module manages the state and actions related to budget statements, which are documents that track the financial transactions of an organization over a month.",author:{name:"Powerhouse",website:"https://powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"account",operations:[{name:"AddAccount",id:"",description:"",schema:`input AddAccountInput {
512
512
  address: String!
513
513
  name: String
514
514
  lineItems: [LineItemInput!]
@@ -1184,7 +1184,7 @@ enum ReactionType {
1184
1184
  "modules": []
1185
1185
  }
1186
1186
  ]
1187
- }`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},_5e=t=>t!=null;Te.any().refine(t=>_5e(t));function x5e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function E5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function S5e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function T5e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function D5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:E$().nullish()})}function A5e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function N5e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function I5e(){return Te.object({id:Te.string()})}function C5e(){return Te.object({id:Te.string()})}function O5e(){return Te.object({id:Te.string()})}function M5e(){return Te.object({id:Te.string()})}function k5e(){return Te.object({scope:Te.string(),id:Te.string()})}function E$(){return Te.literal("global").or(Te.literal("local"))}function R5e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function F5e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function P5e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function B5e(){return Te.object({order:Te.array(Te.string())})}function L5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function j5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function $5e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function U5e(){return Te.object({authorName:Te.string()})}function z5e(){return Te.object({authorWebsite:Te.string()})}function q5e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function V5e(){return Te.object({description:Te.string()})}function Z5e(){return Te.object({extension:Te.string()})}function H5e(){return Te.object({id:Te.string()})}function W5e(){return Te.object({name:Te.string()})}function Y5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function J5e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function K5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function G5e(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function X5e(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function Q5e(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function eDe(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function tDe(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function rDe(){return Te.object({id:Te.string(),scope:E$()})}function nDe(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function iDe(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function aDe(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function sDe(){return Te.object({scope:Te.string(),schema:Te.string()})}function oDe(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function uDe(){return Te.object({example:Te.string(),id:Te.string()})}function cDe(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const Oc={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Cd={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},lDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Od={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(lDe(e.input.order))}},dDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},hu={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(dDe(e.input.order))}},fDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Sm={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(fDe(e.input.order))}},pDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Xa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(pDe(e.input.order))}},hDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Mc={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(hDe(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},mDe=(t,e)=>{if(vl(e))return t;switch(e.type){case"SET_MODEL_NAME":W5e().parse(e.input),Oc.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":H5e().parse(e.input),Oc.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":Z5e().parse(e.input),Oc.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":V5e().parse(e.input),Oc.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":U5e().parse(e.input),Oc.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":z5e().parse(e.input),Oc.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":x5e().parse(e.input),Cd.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":oDe().parse(e.input),Cd.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":N5e().parse(e.input),Cd.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":F5e().parse(e.input),Cd.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Cd.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":E5e().parse(e.input),Od.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J5e().parse(e.input),Od.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":Y5e().parse(e.input),Od.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":I5e().parse(e.input),Od.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":B5e().parse(e.input),Od.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":S5e().parse(e.input),hu.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":G5e().parse(e.input),hu.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Q5e().parse(e.input),hu.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":X5e().parse(e.input),hu.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":eDe().parse(e.input),hu.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":C5e().parse(e.input),hu.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":L5e().parse(e.input),hu.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":T5e().parse(e.input),Sm.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":uDe().parse(e.input),Sm.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":O5e().parse(e.input),Sm.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":j5e().parse(e.input),Sm.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":D5e().parse(e.input),Xa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":tDe().parse(e.input),Xa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":rDe().parse(e.input),Xa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":iDe().parse(e.input),Xa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K5e().parse(e.input),Xa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":aDe().parse(e.input),Xa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":nDe().parse(e.input),Xa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":R5e().parse(e.input),Xa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":M5e().parse(e.input),Xa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":P5e().parse(e.input),Xa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":sDe().parse(e.input),Mc.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":q5e().parse(e.input),Mc.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":A5e().parse(e.input),Mc.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":cDe().parse(e.input),Mc.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":k5e().parse(e.input),Mc.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":$5e().parse(e.input),Mc.reorderStateExamplesOperation(t.global,e);break;default:return t}},Tg=b2(mDe),gDe={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},yDe={},_f={fileExtension:"phdm",createState(t){return{global:{...gDe,...t==null?void 0:t.global},local:{...yDe,...t==null?void 0:t.local}}},createExtendedState(t){return w2({...t,documentType:"powerhouse/document-model"},_f.createState)},createDocument(t){return _2(_f.createExtendedState(t),_f.createState)},saveToFile(t,e,r){return y2(t,e,"phdm",r)},saveToFileHandle(t,e){return bC(t,e)},loadFromFile(t){return p0(t,Tg)},loadFromInput(t){return v2(t,Tg)}},S$=t=>Rt("SET_MODEL_NAME",{...t}),T$=t=>Rt("SET_MODEL_ID",{...t}),D$=t=>Rt("SET_MODEL_EXTENSION",{...t}),A$=t=>Rt("SET_MODEL_DESCRIPTION",{...t}),N$=t=>Rt("SET_AUTHOR_NAME",{...t}),I$=t=>Rt("SET_AUTHOR_WEBSITE",{...t});class vDe extends Pr{setModelName(e,r){return this.dispatch(S$(e),r)}setModelId(e,r){return this.dispatch(T$(e),r)}setModelExtension(e,r){return this.dispatch(D$(e),r)}setModelDescription(e,r){return this.dispatch(A$(e),r)}setAuthorName(e,r){return this.dispatch(N$(e),r)}setAuthorWebsite(e,r){return this.dispatch(I$(e),r)}}const C$=t=>Rt("ADD_CHANGE_LOG_ITEM",{...t}),O$=t=>Rt("UPDATE_CHANGE_LOG_ITEM",{...t}),M$=t=>Rt("DELETE_CHANGE_LOG_ITEM",{...t}),k$=t=>Rt("REORDER_CHANGE_LOG_ITEMS",{...t}),R$=()=>Rt("RELEASE_NEW_VERSION");class bDe extends Pr{addChangeLogItem(e,r){return this.dispatch(C$(e),r)}updateChangeLogItem(e,r){return this.dispatch(O$(e),r)}deleteChangeLogItem(e,r){return this.dispatch(M$(e),r)}reorderChangeLogItems(e,r){return this.dispatch(k$(e),r)}releaseNewVersion(e){return this.dispatch(R$(),e)}}const F$=t=>Rt("ADD_MODULE",{...t}),P$=t=>Rt("SET_MODULE_NAME",{...t}),B$=t=>Rt("SET_MODULE_DESCRIPTION",{...t}),L$=t=>Rt("DELETE_MODULE",{...t}),j$=t=>Rt("REORDER_MODULES",{...t});class wDe extends Pr{addModule(e,r){return this.dispatch(F$(e),r)}setModuleName(e,r){return this.dispatch(P$(e),r)}setModuleDescription(e,r){return this.dispatch(B$(e),r)}deleteModule(e,r){return this.dispatch(L$(e),r)}reorderModules(e,r){return this.dispatch(j$(e),r)}}const $$=t=>Rt("ADD_OPERATION_ERROR",{...t}),U$=t=>Rt("SET_OPERATION_ERROR_CODE",{...t}),z$=t=>Rt("SET_OPERATION_ERROR_NAME",{...t}),q$=t=>Rt("SET_OPERATION_ERROR_DESCRIPTION",{...t}),V$=t=>Rt("SET_OPERATION_ERROR_TEMPLATE",{...t}),Z$=t=>Rt("DELETE_OPERATION_ERROR",{...t}),H$=t=>Rt("REORDER_OPERATION_ERRORS",{...t});class _De extends Pr{addOperationError(e,r){return this.dispatch($$(e),r)}setOperationErrorCode(e,r){return this.dispatch(U$(e),r)}setOperationErrorName(e,r){return this.dispatch(z$(e),r)}setOperationErrorDescription(e,r){return this.dispatch(q$(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(V$(e),r)}deleteOperationError(e,r){return this.dispatch(Z$(e),r)}reorderOperationErrors(e,r){return this.dispatch(H$(e),r)}}const W$=t=>Rt("ADD_OPERATION_EXAMPLE",{...t}),Y$=t=>Rt("UPDATE_OPERATION_EXAMPLE",{...t}),J$=t=>Rt("DELETE_OPERATION_EXAMPLE",{...t}),K$=t=>Rt("REORDER_OPERATION_EXAMPLES",{...t});class xDe extends Pr{addOperationExample(e,r){return this.dispatch(W$(e),r)}updateOperationExample(e,r){return this.dispatch(Y$(e),r)}deleteOperationExample(e,r){return this.dispatch(J$(e),r)}reorderOperationExamples(e,r){return this.dispatch(K$(e),r)}}const G$=t=>Rt("ADD_OPERATION",{...t}),X$=t=>Rt("SET_OPERATION_NAME",{...t}),Q$=t=>Rt("SET_OPERATION_SCOPE",{...t}),eU=t=>Rt("SET_OPERATION_SCHEMA",{...t}),tU=t=>Rt("SET_OPERATION_DESCRIPTION",{...t}),rU=t=>Rt("SET_OPERATION_TEMPLATE",{...t}),nU=t=>Rt("SET_OPERATION_REDUCER",{...t}),iU=t=>Rt("MOVE_OPERATION",{...t}),aU=t=>Rt("DELETE_OPERATION",{...t}),sU=t=>Rt("REORDER_MODULE_OPERATIONS",{...t});class EDe extends Pr{addOperation(e,r){return this.dispatch(G$(e),r)}setOperationName(e,r){return this.dispatch(X$(e),r)}setOperationScope(e,r){return this.dispatch(Q$(e),r)}setOperationSchema(e,r){return this.dispatch(eU(e),r)}setOperationDescription(e,r){return this.dispatch(tU(e),r)}setOperationTemplate(e,r){return this.dispatch(rU(e),r)}setOperationReducer(e,r){return this.dispatch(nU(e),r)}moveOperation(e,r){return this.dispatch(iU(e),r)}deleteOperation(e,r){return this.dispatch(aU(e),r)}reorderModuleOperations(e,r){return this.dispatch(sU(e),r)}}const oU=t=>Rt("SET_STATE_SCHEMA",{...t}),uU=t=>Rt("SET_INITIAL_STATE",{...t}),cU=t=>Rt("ADD_STATE_EXAMPLE",{...t}),lU=t=>Rt("UPDATE_STATE_EXAMPLE",{...t}),dU=t=>Rt("DELETE_STATE_EXAMPLE",{...t}),fU=t=>Rt("REORDER_STATE_EXAMPLES",{...t});class SDe extends Pr{setStateSchema(e,r){return this.dispatch(oU(e),r)}setInitialState(e,r){return this.dispatch(uU(e),r)}addStateExample(e,r){return this.dispatch(cU(e),r)}updateStateExample(e,r){return this.dispatch(lU(e),r)}deleteStateExample(e,r){return this.dispatch(dU(e),r)}reorderStateExamples(e,r){return this.dispatch(fU(e),r)}}let pU=(Em=class extends Pr{constructor(t,e){super(Tg,_f.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,Em.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},s5e(Em,"fileExtension","phdm"),Em);Qo(pU,[vDe,bDe,wDe,_De,xDe,EDe,SDe]);const TDe=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:C$,addModule:F$,addOperation:G$,addOperationError:$$,addOperationExample:W$,addStateExample:cU,deleteChangeLogItem:M$,deleteModule:L$,deleteOperation:aU,deleteOperationError:Z$,deleteOperationExample:J$,deleteStateExample:dU,moveOperation:iU,releaseNewVersion:R$,reorderChangeLogItems:k$,reorderModuleOperations:sU,reorderModules:j$,reorderOperationErrors:H$,reorderOperationExamples:K$,reorderStateExamples:fU,setAuthorName:N$,setAuthorWebsite:I$,setInitialState:uU,setModelDescription:A$,setModelExtension:D$,setModelId:T$,setModelName:S$,setModuleDescription:B$,setModuleName:P$,setOperationDescription:tU,setOperationErrorCode:U$,setOperationErrorDescription:q$,setOperationErrorName:z$,setOperationErrorTemplate:V$,setOperationName:X$,setOperationReducer:nU,setOperationSchema:eU,setOperationScope:Q$,setOperationTemplate:rU,setStateSchema:oU,updateChangeLogItem:O$,updateOperationExample:Y$,updateStateExample:lU},Symbol.toStringTag,{value:"Module"})),DDe=pU,ADe={..._f,...b5e},NDe={...Xo,...TDe},IDe={Document:DDe,reducer:Tg,actions:NDe,utils:ADe,documentModel:w5e},CDe="feature-flags-config",Hm=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,ODe=Hm==null?void 0:Hm.split(","),Wm=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,MDe=Wm==null?void 0:Wm.split(","),hU={editors:{enabledEditors:Hm==="*"?"*":ODe,disabledEditors:Wm==="*"?"*":MDe}},kDe=zp(CDe,hU),mU=()=>{const[t,e]=La(kDe);return{config:{...hU,...t},setConfig:e}},RDe=tq("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Fp=$_(),FDe=zp("sidebar-collapsed",!1);$n(!1);const PDe={sidebarCollapsedAtom:FDe,themeAtom:RDe},BDe=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS;async function LDe(){if(!BDe)return[];try{const t=await xf(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const jDe={DocumentModel:IDe,AtlasFeedbackIssues:Moe,...n5e},gU=Object.values(jDe),yU=LDe(),$De=$n(yU),Pp=$n(async t=>{const e=await t($De),r=e.map(n=>n.documentModel.id);return[...gU.filter(n=>!r.includes(n.documentModel.id)),...e]}),UDe=()=>Up(Pp),zDe=BI(Pp),vU=()=>Up(zDe),qDe=()=>yU,VDe=function(t){return Fp.sub(Pp,()=>{Fp.get(Pp).then(t).catch(e=>{throw e})})};function ZDe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const HDe=()=>{const t=vU();return e=>ZDe(e,t)},WDe=()=>{const t=vU(),{config:e}=mU(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function YDe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=JDe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function JDe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Yn=class Yn{constructor(e){this.db=J3.ready().then(()=>J3.createInstance({name:e?`${e}:${Yn.DBName}`:Yn.DBName}))}buildKey(...e){return e.join(Yn.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Yn.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=S0(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Yn.DRIVES_KEY)).map(n=>n.slice(Yn.DRIVES_KEY.length+Yn.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Yn.DRIVES_KEY,e));if(!n)throw new uf(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Yn.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=S0(i.operations,r);await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Yn.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=YDe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Yn.DBName="DOCUMENT_DRIVES",Yn.SEP=":",Yn.DRIVES_KEY="DRIVES";let M_=Yn;const XN=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,Mb=XN?XN.split(","):[],KDe=()=>({defaultDrives:{remoteDrives:Mb.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[],pullInterval:3e3}})),removeOldRemoteDrives:Mb.length>0?{strategy:"preserve-by-url-and-detach",urls:Mb}:{strategy:"preserve-all"}}});function GDe(t,e){return new tG(t,new M_(e),new WO,new JO(1,10),{...KDe()})}async function XDe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&ks.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:Xe.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(Cn.error)}const kE=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??GDe(gU,ks.routerBasename);return await XDe(t),t})(),bU=$n(kE),QDe=BI(bU),wU=()=>Up(QDe),eAe=()=>kE;VDe(async t=>{(await Fp.get(bU)).setDocumentModels(t)});async function tAe(){await qDe();const t=await Fp.get(Pp);(await kE).setDocumentModels(t)}tAe().catch(console.error);const Ym=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await xf(async()=>{const{ConnectCrypto:n}=await import("./index-CMLoiw55.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await xf(async()=>{const{BrowserKeyStorage:n}=await import("./browser-Dmr6AWWk.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function RE(){return Fo(()=>({async regenerateDid(){return(await Ym).regenerateDid()},async did(){return(await Ym).did()},sign:async t=>await(await Ym).sign(t)}),[])}const rAe=$n(void 0);function nAe(){const[t,e]=La(rAe);return vi(()=>{t||Ym.then(r=>r.did()).then(r=>e(r)).catch(Cn.error)}),t}const iAe=$n(window.renown?Promise.resolve(window.renown):void 0);function _U(){const[t,e]=La(iAe),{did:r}=RE();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await xf(async()=>{const{initRenownBrowser:c}=await import("./browser-CEARsm5L.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let Tm=!1;const aAe=$n(void 0),Vy=()=>{const[t,e]=La(aAe),r=_U();return vi(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}CX(n)},[t]),vi(()=>{if(Tm)return;Tm=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),Tm=!1}},[r,Tm]),t},sAe=parseInt("50");function B9e(t,e,r=Cn.error){const[n,i]=ii(e),[a,s]=ii(),o=c=>{s(c),r(c)};return vi(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const p=t(f,c),h=c.scope??"global",m=p.operations[h],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...p}}),p}catch(p){return o(p),d==null||d(p),f}})},a]}async function oAe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var p;if(!(l.documentId===e&&l.scope==r))return;const f=(p=l.operations.at(-1))==null?void 0:p.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function uAe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||sAe;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await oAe(1e4,e,d,l.index,n)}}const cAe=async t=>{(await Xe.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(Cn.error)};async function L9e(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await cAe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function lAe(t,e){const r=await Xe.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function dAe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return Cn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await Xe.buildSignedOperation(t,i,n,s,e)}function fAe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const QN=$n(new Map);function pAe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function Dg(t){return t.map(pAe).join("&")}const hAe=t=>()=>$n(e=>t?e(QN).get(t)??[]:[],(e,r,n)=>{r(QN,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||Dg(a)!==Dg(n)?new Map(i).set(t,n):i})}),mAe=Wz(()=>$n("INITIAL"));function gAe(){const t=wU(),[e,r]=La(Fo(hAe(t),[t])),n=Cr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){Cn.error(l)}}catch(u){Cn.error(u)}finally{r(o)}},[t]),[i,a]=La(mAe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=Cr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,p,h)=>{h&&Cn.error(h),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return Fo(()=>[e,n,s,i],[e,i])}const yAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",vAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",bAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",wAe=$n("initial"),FE=()=>{const[t,e]=La(wAe),r=Vy(),n=_U(),{did:i}=RE(),a=Cr(async()=>{var l;const u=await i(),c=new URL(yAe);if(c.searchParams.set("connect",u),c.searchParams.set("network",vAe),c.searchParams.set("chain",bAe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=Cr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),Cn.error(c)}},[n]);vi(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=Cr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return Fo(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function _Ae(){const{user:t,status:e}=FE(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function xU(){const t=_Ae();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function PE(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=xU()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Vy()||void 0,n=nAe(),{sign:i}=RE(),a=wU(),s=HDe(),[o,u,,c]=gAe(),l=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,B);if(!R)throw new Error(`There was an error opening file with id ${B} on drive ${S}`);return R},[a]),d=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=Wu(R,fAe(B,n,r));const q=B.scope??"global",X=R.operations[q].findLast(z=>z.type===B.type);if(!X)throw new Error("There was an error applying the operation");const ie=await dAe(X,i,S,L,Wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&Cn.error(z.error),z.operations.length&&await u(),z.document&&!gu(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return Cn.error(z),R}},[o,u,a,i,r,n]),f=Cr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const K=Xe.hashKey();let X=o.find(V=>V.state.global.id===S);if(!X)throw new Error(`Drive with id ${S} not found`);const ie=Y2(X.state.global,{id:K,name:B,parentFolder:L??null,documentType:R,document:q},["global"]);X=await d(S,ie);const z=X==null?void 0:X.state.global.nodes.find(V=>V.id===K);if(!z||!Ni(z))throw new Error("There was an error adding document");return z},[d,o,t]),p=Cr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(K=>K.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,B,R)).document},[o,e,a]),h=Cr(async(S,B,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await lAe(S,s),K={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},X=await f(B,R||(typeof S=="string"?q.name:S.name),q.documentType,L,K),ie=o.find(V=>V.state.global.id===B),z=ie&&ie.state.local.listeners.length>0;uAe(B,X.id,q,a,p,{waitForSync:z}).catch(V=>{throw V})},[f,p,s,t,a]),m=Cr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const K=await d(S,Jn.updateFile({id:B,name:L||void 0,parentFolder:q,documentType:R})),X=K==null?void 0:K.state.global.nodes.find(ie=>ie.id===B);if(!X||!Ni(X))throw new Error("There was an error updating document");return X},[d,t]),y=Cr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=Xe.hashKey(),q=await d(S,Jn.addFolder({id:L,name:B,parentFolder:R})),K=q==null?void 0:q.state.global.nodes.find(X=>X.id===L);if(!K||!jg(K))throw new Error("There was an error adding folder");return K},[d,t]),g=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,Jn.deleteNode({id:B}))},[d,t]),b=Cr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,Jn.updateNode({id:B,name:R})),q=L==null?void 0:L.state.global.nodes.find(K=>K.id===B);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),_=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to move documents");B.kind===Pb||S.parentFolder===B.id||await d(B.driveId,Jn.moveNode({srcFolder:S.id,targetParentFolder:B.id}))},[d,t]),E=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(B.kind===Pb)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>Xe.hashKey(),K=sp.generateNodesCopy({srcId:S.id,targetParentFolder:B.id,targetName:S.name},L,R.state.global.nodes).map(ie=>Jn.copyNode(ie)),X=await a.addDriveActions(S.driveId,K);X.operations.length?await u():X.status!=="SUCCESS"&&Cn.error(`Error copying files: ${X.status}`,X.error)},[o,t,u,a]),x=Cr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(K=>K.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,B,R)).document},[o,e,a]),D=Cr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const B=S.global.id||Xe.hashKey();S=sp.createState(S);const R=await a.addDrive({global:{...S.global,id:B},local:S.local});return await u(),R},[t,u,a]),M=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,B);return await u(),R},[u,a]),F=Cr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,Jn.setDriveName({name:B}))},[d,t]),$=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setAvailableOffline({availableOffline:B}))},[d,t]),T=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setSharingType({type:B}))},[d,t]),A=Cr(async(S,B)=>{if(B!==JU){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof YO?"INITIAL_SYNC":R}catch(R){return console.error(R),KU}}},[a]),v=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),w=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),N=Cr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=Cr(async(S,B)=>{const R=await d(S,Jn.removeTrigger({triggerId:B}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===B))throw new Error(`There was an error removing trigger ${B}`)},[d]),I=Cr(async(S,B,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,B,R)},[a]),O=Cr(async(S,B)=>{const R=await d(S,Jn.addTrigger({trigger:B}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${B.id}`)},[d]);return Fo(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:h,updateFile:m,addFolder:y,deleteNode:g,renameNode:b,moveNode:_,copyNode:E,addOperation:x,addOperations:p,addDrive:D,addRemoteDrive:M,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:$,setDriveSharingType:T,getSyncStatus:A,onStrandUpdate:v,onSyncStatus:w,clearStorage:N,removeTrigger:C,addTrigger:O,registerNewPullResponderTrigger:I}),[f,D,h,y,x,p,M,O,N,E,F,g,o,c,A,_,v,w,l,I,C,k,b,$,T,m])}function xAe(t){return t.replaceAll(/\s/g,"-")}const EAe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=PE();return et(GU,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:xAe(c.name),kind:Pb,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},SAe=$n(ks);function BE(){return La(SAe)}let Dm;const TAe=new Uint8Array(16);function DAe(){if(!Dm&&(Dm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dm(TAe)}const Wn=[];for(let t=0;t<256;++t)Wn.push((t+256).toString(16).slice(1));function AAe(t,e=0){return Wn[t[e+0]]+Wn[t[e+1]]+Wn[t[e+2]]+Wn[t[e+3]]+"-"+Wn[t[e+4]]+Wn[t[e+5]]+"-"+Wn[t[e+6]]+Wn[t[e+7]]+"-"+Wn[t[e+8]]+Wn[t[e+9]]+"-"+Wn[t[e+10]]+Wn[t[e+11]]+Wn[t[e+12]]+Wn[t[e+13]]+Wn[t[e+14]]+Wn[t[e+15]]}const NAe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eI={randomUUID:NAe};function tI(t,e,r){if(eI.randomUUID&&!e&&!t)return eI.randomUUID();t=t||{};const n=t.random||(t.rng||DAe)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,AAe(n)}const IAe=t=>{var T;const[e]=BE(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=ii(e.appVersion),[o,u]=ii({label:Eh.debug?"Enabled":"Disabled",value:Eh.debug}),[c,l]=ii(),[d,f]=ii(null),[p,h]=ii(""),[m,y]=ii({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:b,addTrigger:_,registerNewPullResponderTrigger:E}=PE();vi(()=>{Eh.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const x=((T=g.find(A=>A.state.global.id===c))==null?void 0:T.state.local.triggers)||[],M=!c||p==="",F=async()=>{!d||!c||(await b(c,d.value),f(null))},k=async(A=!1)=>{if(!(!p||p===""||!c)){if(!A){const v=await E(c,p,{pullInterval:3e3});await _(c,v),h("");return}await _(c,{id:`invalid-trigger-${tI()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${tI()}`,url:p}}),h("")}},$=A=>{y(A),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",A.value)};return et(XU,{open:r,onOpenChange:A=>{if(!A)return n()},contentProps:{className:"rounded-2xl"},children:Yr("div",{className:"w-[700px] rounded-2xl p-6",children:[Yr("div",{className:"mb-6 flex justify-between",children:[et("div",{className:"text-xl font-bold",children:"Debug Tools"}),et("button",{id:"close-modal",onClick:()=>n(),children:et(xh,{name:"Xmark",size:28})})]}),Yr("div",{className:"flex text-sm font-bold",children:[et(xh,{name:"Ring",size:22}),Yr("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(xh,{name:"Hdd",size:22}),et("span",{className:"ml-2",children:"Drive Tools:"})]}),Yr("div",{children:[et("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),et(Rd,{id:"selectedDrive",onChange:A=>{if(!A||typeof A!="object"||!("value"in A)){l(void 0),f(null);return}l(A.value),f(null)},options:g.map(A=>({label:A.state.global.name,value:A.state.global.id}))})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),et(Rd,{id:"autoRegisterPullResponder",onChange:A=>{$(A)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),et(Rd,{id:"driveTrigger",onChange:A=>{f(A)},value:d,options:x.map(A=>({label:`${A.id} - ${A.type}`,value:A.id}))})]}),et("div",{children:et(Vc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),et(HE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:et("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:p,onChange:A=>h(A.target.value)})]}),Yr("div",{className:"mb-1 flex items-center justify-center",children:[et(Vc,{className:"mr-2",color:M?"light":"blue",size:"small",disabled:M,onClick:()=>k(),children:"Add Trigger"}),et(Vc,{color:M?"light":"red",size:"small",disabled:M,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(xh,{name:"Gear",size:22}),et("span",{className:"ml-2",children:"Service Worker Tools:"})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),et(Rd,{id:"serviceWorkerDebugMode",onChange:A=>{u(A)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),et(HE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:et("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:A=>s(A.target.value)})]}),et("div",{className:"mb-1 flex items-center justify-center",children:et(Vc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{Eh.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},CAe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=nc();return et(QU,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},OAe=t=>{const{t:e}=nc(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return et(ez,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},MAe=t=>{const{open:e,onClose:r}=t,{t:n}=nc();return et(EI,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function kAe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return et(tz,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const RAe="defaultDocumentModelEditor",FAe=zp(RAe,{label:"V2",value:"document-model-editor-v2"}),PAe=()=>La(FAe),BAe=t=>mt.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},mt.createElement("g",{id:"Group 1000003373"},mt.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),mt.createElement("g",{id:"Renown"},mt.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),mt.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),mt.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),mt.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),mt.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),mt.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),LAe=()=>{const[t,e]=ii(0);return vi(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),et("span",{children:new Array(t).fill(".").join("")})},jAe=()=>{const t=Vy(),{openRenown:e,status:r}=FE();return et("div",{children:r==="checking"?Yr("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[et("span",{children:"Checking Authorization"}),et("span",{className:"inline-block w-5 text-left",children:et(LAe,{})})]}):r!=="authorized"?Yr("div",{className:"flex flex-col items-center",children:[et("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),et(BAe,{className:"mb-3"}),et("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),et(Vc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:et("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Yr("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},rI=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),$Ae=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=PE(),{t:a}=nc(),s=WDe(),o=UDe(),{setConfig:u}=mU(),{showModal:c}=SU(),[l]=BE(),[d,f]=PAe(),[p,h]=ii(rI(s)),{logout:m,status:y}=FE(),g=Vy(),b=()=>{u(E=>({...E,editors:{enabledEditors:p.map(x=>x.value)}})),r()},_=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(Cn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Yr(rz,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:b,onOpenChange:E=>{if(!E)return r()},children:[et("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Yr(xI,{children:[Yr("p",{children:["Logged in with address:"," ",et("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),et(Vc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):et(jAe,{})}),l.content.showDocumentModelSelectionSetting&&et(nz,{selected:p,onChange:E=>h(E),options:rI(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),et(iz,{onClearStorage:_,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Yr("div",{children:[et("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),et(Rd,{id:"default-document-model-editor",value:d,onChange:E=>f(E),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),et(az,{packageJson:gz})]})},UAe=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=nc();return et(sz,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},zAe={deleteItem:OAe,upgradeDrive:UAe,createDocument:EAe,addLocalDrive:oq,addRemoteDrive:qZ,driveSettings:kAe,settingsModal:$Ae,confirmationModal:VZ,deleteDriveModal:CAe,debugSettingsModal:IAe,disclaimerModal:MAe,cookiesPolicy:ZZ},EU=Us.createContext({showModal:()=>{},closeModal:()=>{}}),SU=()=>jp(EU),qAe=t=>{const{children:e}=t,[r,n]=ii(),[i,a]=ii(),[s,o]=ii(!1),u=Cr((f,p)=>{o(!0),n(p),a(f)},[]),c=Cr(()=>{o(!1)},[]),l=i?zAe[i]:null,d=Fo(()=>({showModal:u,closeModal:c}),[c,u]);return Yr(EU.Provider,{value:d,children:[e,l&&et(l,{...r,open:s,onClose:c})]})},VAe=(t,e)=>t.some(r=>r.id===e&&r.value),ZAe=()=>{const{t}=nc(),{showModal:e}=SU(),[r,n]=sq(),[,i]=U_(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),VAe(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Yr("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[et("div",{className:"absolute inset-0 bg-black opacity-15"}),et("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:et(oz,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:et("p",{className:"font-semibold text-gray-500",children:et(II,{i18nKey:"cookieBanner.message",components:{a:et("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var HAe=Object.defineProperty,WAe=Object.getOwnPropertyDescriptor,_s=(t,e,r,n)=>{for(var i=WAe(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&HAe(e,r,i),i};function xs(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function YAe(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Ya{constructor(e){ZE(this,"server");YAe(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}_s([xs],Ya.prototype,"migrateReadDrive");_s([xs],Ya.prototype,"addReadDrive");_s([xs],Ya.prototype,"getReadDrives");_s([xs],Ya.prototype,"getReadDriveBySlug");_s([xs],Ya.prototype,"getReadDrive");_s([xs],Ya.prototype,"getReadDriveContext");_s([xs],Ya.prototype,"fetchDrive");_s([xs],Ya.prototype,"fetchDocument");_s([xs],Ya.prototype,"deleteReadDrive");_s([xs],Ya.prototype,"onReadDrivesUpdate");const qc=new Ya,TU=L_({...qc,readDrives:[]});async function JAe(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof yu))}const KAe=t=>{const e=eAe(),[r,n]=ii([]),i=xU(),[a,s]=ii(!1);vi(()=>{e.then(c=>{qc.setDocumentDrive(c),s(!0)}).catch(Cn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);Fo(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=qc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(Cn.error)},[o,a]),vi(()=>{if(!a)return;JAe(qc).then(l=>n(l)).catch(Cn.error);const c=qc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||Dg(d)!==Dg(l)?l:d)}).catch(Cn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(Cn.error)}},[a]);const u=Fo(()=>({...qc,readDrives:r}),[r]);return et(TU.Provider,{...t,value:u})},j9e=()=>jp(TU);/**
1187
+ }`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},_5e=t=>t!=null;Te.any().refine(t=>_5e(t));function x5e(){return Te.object({__typename:Te.literal("AddChangeLogItemInput").optional(),content:Te.string(),id:Te.string(),insertBefore:Te.string().nullable()})}function E5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),name:Te.string()})}function S5e(){return Te.object({errorCode:Te.string().nullish(),errorDescription:Te.string().nullish(),errorName:Te.string().nullish(),errorTemplate:Te.string().nullish(),id:Te.string(),operationId:Te.string()})}function T5e(){return Te.object({example:Te.string(),id:Te.string(),operationId:Te.string()})}function D5e(){return Te.object({description:Te.string().nullish(),id:Te.string(),moduleId:Te.string(),name:Te.string(),reducer:Te.string().nullish(),schema:Te.string().nullish(),template:Te.string().nullish(),scope:E$().nullish()})}function A5e(){return Te.object({scope:Te.string(),example:Te.string(),id:Te.string(),insertBefore:Te.string().nullish()})}function N5e(){return Te.object({__typename:Te.literal("DeleteChangeLogItemInput").optional(),id:Te.string()})}function I5e(){return Te.object({id:Te.string()})}function C5e(){return Te.object({id:Te.string()})}function O5e(){return Te.object({id:Te.string()})}function M5e(){return Te.object({id:Te.string()})}function k5e(){return Te.object({scope:Te.string(),id:Te.string()})}function E$(){return Te.literal("global").or(Te.literal("local"))}function R5e(){return Te.object({newModuleId:Te.string(),operationId:Te.string()})}function F5e(){return Te.object({__typename:Te.literal("ReorderChangeLogItemsInput").optional(),order:Te.array(Te.string())})}function P5e(){return Te.object({moduleId:Te.string(),order:Te.array(Te.string())})}function B5e(){return Te.object({order:Te.array(Te.string())})}function L5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function j5e(){return Te.object({operationId:Te.string(),order:Te.array(Te.string())})}function $5e(){return Te.object({scope:Te.string(),order:Te.array(Te.string())})}function U5e(){return Te.object({authorName:Te.string()})}function z5e(){return Te.object({authorWebsite:Te.string()})}function q5e(){return Te.object({scope:Te.string(),initialValue:Te.string()})}function V5e(){return Te.object({description:Te.string()})}function Z5e(){return Te.object({extension:Te.string()})}function H5e(){return Te.object({id:Te.string()})}function W5e(){return Te.object({name:Te.string()})}function Y5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function J5e(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function K5e(){return Te.object({description:Te.string().nullish(),id:Te.string()})}function G5e(){return Te.object({errorCode:Te.string().nullish(),id:Te.string()})}function X5e(){return Te.object({errorDescription:Te.string().nullish(),id:Te.string()})}function Q5e(){return Te.object({errorName:Te.string().nullish(),id:Te.string()})}function eDe(){return Te.object({errorTemplate:Te.string().nullish(),id:Te.string()})}function tDe(){return Te.object({id:Te.string(),name:Te.string().nullish()})}function rDe(){return Te.object({id:Te.string(),scope:E$()})}function nDe(){return Te.object({id:Te.string(),reducer:Te.string().nullish()})}function iDe(){return Te.object({id:Te.string(),schema:Te.string().nullish()})}function aDe(){return Te.object({id:Te.string(),template:Te.string().nullish()})}function sDe(){return Te.object({scope:Te.string(),schema:Te.string()})}function oDe(){return Te.object({__typename:Te.literal("UpdateChangeLogItemInput").optional(),id:Te.string(),newContent:Te.string()})}function uDe(){return Te.object({example:Te.string(),id:Te.string()})}function cDe(){return Te.object({scope:Te.string(),id:Te.string(),newExample:Te.string()})}const Oc={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},Cd={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},lDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Od={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id===e.input.id&&(r.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const r=t.specifications[t.specifications.length-1];r.modules=r.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(lDe(e.input.order))}},dDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},hu={addOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].errors.length;a++)r.modules[n].operations[i].errors[a].id==e.input.id&&(r.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].errors=r.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].errors.sort(dDe(e.input.order))}},fDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Sm={addOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)for(let a=0;a<r.modules[n].operations[i].examples.length;a++)r.modules[n].operations[i].examples[a].id==e.input.id&&(r.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].examples=r.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.operationId&&r.modules[n].operations[i].examples.sort(fDe(e.input.order))}},pDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Xa={addOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)for(let i=0;i<r.modules[n].operations.length;i++)r.modules[n].operations[i].id==e.input.id&&(r.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const r=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(r.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...r)},deleteOperationOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].operations=r.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const r=t.specifications[t.specifications.length-1];for(let n=0;n<r.modules.length;n++)r.modules[n].id==e.input.moduleId&&r.modules[n].operations.sort(pDe(e.input.order))}},hDe=t=>{const e={};return t.forEach((r,n)=>e[r]=n),(r,n)=>(e[n.id]||999999)-(e[r.id]||999999)},Mc={setStateSchemaOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(!Object.keys(r.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=r.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples=r.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const r=t.specifications[t.specifications.length-1];if(Object.keys(r.state).includes(e.input.scope))r.state[e.input.scope].examples.sort(hDe(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},mDe=(t,e)=>{if(vl(e))return t;switch(e.type){case"SET_MODEL_NAME":W5e().parse(e.input),Oc.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":H5e().parse(e.input),Oc.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":Z5e().parse(e.input),Oc.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":V5e().parse(e.input),Oc.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":U5e().parse(e.input),Oc.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":z5e().parse(e.input),Oc.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":x5e().parse(e.input),Cd.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":oDe().parse(e.input),Cd.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":N5e().parse(e.input),Cd.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":F5e().parse(e.input),Cd.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");Cd.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":E5e().parse(e.input),Od.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J5e().parse(e.input),Od.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":Y5e().parse(e.input),Od.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":I5e().parse(e.input),Od.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":B5e().parse(e.input),Od.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":S5e().parse(e.input),hu.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":G5e().parse(e.input),hu.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Q5e().parse(e.input),hu.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":X5e().parse(e.input),hu.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":eDe().parse(e.input),hu.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":C5e().parse(e.input),hu.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":L5e().parse(e.input),hu.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":T5e().parse(e.input),Sm.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":uDe().parse(e.input),Sm.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":O5e().parse(e.input),Sm.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":j5e().parse(e.input),Sm.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":D5e().parse(e.input),Xa.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":tDe().parse(e.input),Xa.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":rDe().parse(e.input),Xa.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":iDe().parse(e.input),Xa.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K5e().parse(e.input),Xa.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":aDe().parse(e.input),Xa.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":nDe().parse(e.input),Xa.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":R5e().parse(e.input),Xa.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":M5e().parse(e.input),Xa.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":P5e().parse(e.input),Xa.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":sDe().parse(e.input),Mc.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":q5e().parse(e.input),Mc.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":A5e().parse(e.input),Mc.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":cDe().parse(e.input),Mc.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":k5e().parse(e.input),Mc.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":$5e().parse(e.input),Mc.reorderStateExamplesOperation(t.global,e);break;default:return t}},Tg=b2(mDe),gDe={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},yDe={},_f={fileExtension:"phdm",createState(t){return{global:{...gDe,...t==null?void 0:t.global},local:{...yDe,...t==null?void 0:t.local}}},createExtendedState(t){return w2({...t,documentType:"powerhouse/document-model"},_f.createState)},createDocument(t){return _2(_f.createExtendedState(t),_f.createState)},saveToFile(t,e,r){return y2(t,e,"phdm",r)},saveToFileHandle(t,e){return bC(t,e)},loadFromFile(t){return p0(t,Tg)},loadFromInput(t){return v2(t,Tg)}},S$=t=>Rt("SET_MODEL_NAME",{...t}),T$=t=>Rt("SET_MODEL_ID",{...t}),D$=t=>Rt("SET_MODEL_EXTENSION",{...t}),A$=t=>Rt("SET_MODEL_DESCRIPTION",{...t}),N$=t=>Rt("SET_AUTHOR_NAME",{...t}),I$=t=>Rt("SET_AUTHOR_WEBSITE",{...t});class vDe extends Pr{setModelName(e,r){return this.dispatch(S$(e),r)}setModelId(e,r){return this.dispatch(T$(e),r)}setModelExtension(e,r){return this.dispatch(D$(e),r)}setModelDescription(e,r){return this.dispatch(A$(e),r)}setAuthorName(e,r){return this.dispatch(N$(e),r)}setAuthorWebsite(e,r){return this.dispatch(I$(e),r)}}const C$=t=>Rt("ADD_CHANGE_LOG_ITEM",{...t}),O$=t=>Rt("UPDATE_CHANGE_LOG_ITEM",{...t}),M$=t=>Rt("DELETE_CHANGE_LOG_ITEM",{...t}),k$=t=>Rt("REORDER_CHANGE_LOG_ITEMS",{...t}),R$=()=>Rt("RELEASE_NEW_VERSION");class bDe extends Pr{addChangeLogItem(e,r){return this.dispatch(C$(e),r)}updateChangeLogItem(e,r){return this.dispatch(O$(e),r)}deleteChangeLogItem(e,r){return this.dispatch(M$(e),r)}reorderChangeLogItems(e,r){return this.dispatch(k$(e),r)}releaseNewVersion(e){return this.dispatch(R$(),e)}}const F$=t=>Rt("ADD_MODULE",{...t}),P$=t=>Rt("SET_MODULE_NAME",{...t}),B$=t=>Rt("SET_MODULE_DESCRIPTION",{...t}),L$=t=>Rt("DELETE_MODULE",{...t}),j$=t=>Rt("REORDER_MODULES",{...t});class wDe extends Pr{addModule(e,r){return this.dispatch(F$(e),r)}setModuleName(e,r){return this.dispatch(P$(e),r)}setModuleDescription(e,r){return this.dispatch(B$(e),r)}deleteModule(e,r){return this.dispatch(L$(e),r)}reorderModules(e,r){return this.dispatch(j$(e),r)}}const $$=t=>Rt("ADD_OPERATION_ERROR",{...t}),U$=t=>Rt("SET_OPERATION_ERROR_CODE",{...t}),z$=t=>Rt("SET_OPERATION_ERROR_NAME",{...t}),q$=t=>Rt("SET_OPERATION_ERROR_DESCRIPTION",{...t}),V$=t=>Rt("SET_OPERATION_ERROR_TEMPLATE",{...t}),Z$=t=>Rt("DELETE_OPERATION_ERROR",{...t}),H$=t=>Rt("REORDER_OPERATION_ERRORS",{...t});class _De extends Pr{addOperationError(e,r){return this.dispatch($$(e),r)}setOperationErrorCode(e,r){return this.dispatch(U$(e),r)}setOperationErrorName(e,r){return this.dispatch(z$(e),r)}setOperationErrorDescription(e,r){return this.dispatch(q$(e),r)}setOperationErrorTemplate(e,r){return this.dispatch(V$(e),r)}deleteOperationError(e,r){return this.dispatch(Z$(e),r)}reorderOperationErrors(e,r){return this.dispatch(H$(e),r)}}const W$=t=>Rt("ADD_OPERATION_EXAMPLE",{...t}),Y$=t=>Rt("UPDATE_OPERATION_EXAMPLE",{...t}),J$=t=>Rt("DELETE_OPERATION_EXAMPLE",{...t}),K$=t=>Rt("REORDER_OPERATION_EXAMPLES",{...t});class xDe extends Pr{addOperationExample(e,r){return this.dispatch(W$(e),r)}updateOperationExample(e,r){return this.dispatch(Y$(e),r)}deleteOperationExample(e,r){return this.dispatch(J$(e),r)}reorderOperationExamples(e,r){return this.dispatch(K$(e),r)}}const G$=t=>Rt("ADD_OPERATION",{...t}),X$=t=>Rt("SET_OPERATION_NAME",{...t}),Q$=t=>Rt("SET_OPERATION_SCOPE",{...t}),eU=t=>Rt("SET_OPERATION_SCHEMA",{...t}),tU=t=>Rt("SET_OPERATION_DESCRIPTION",{...t}),rU=t=>Rt("SET_OPERATION_TEMPLATE",{...t}),nU=t=>Rt("SET_OPERATION_REDUCER",{...t}),iU=t=>Rt("MOVE_OPERATION",{...t}),aU=t=>Rt("DELETE_OPERATION",{...t}),sU=t=>Rt("REORDER_MODULE_OPERATIONS",{...t});class EDe extends Pr{addOperation(e,r){return this.dispatch(G$(e),r)}setOperationName(e,r){return this.dispatch(X$(e),r)}setOperationScope(e,r){return this.dispatch(Q$(e),r)}setOperationSchema(e,r){return this.dispatch(eU(e),r)}setOperationDescription(e,r){return this.dispatch(tU(e),r)}setOperationTemplate(e,r){return this.dispatch(rU(e),r)}setOperationReducer(e,r){return this.dispatch(nU(e),r)}moveOperation(e,r){return this.dispatch(iU(e),r)}deleteOperation(e,r){return this.dispatch(aU(e),r)}reorderModuleOperations(e,r){return this.dispatch(sU(e),r)}}const oU=t=>Rt("SET_STATE_SCHEMA",{...t}),uU=t=>Rt("SET_INITIAL_STATE",{...t}),cU=t=>Rt("ADD_STATE_EXAMPLE",{...t}),lU=t=>Rt("UPDATE_STATE_EXAMPLE",{...t}),dU=t=>Rt("DELETE_STATE_EXAMPLE",{...t}),fU=t=>Rt("REORDER_STATE_EXAMPLES",{...t});class SDe extends Pr{setStateSchema(e,r){return this.dispatch(oU(e),r)}setInitialState(e,r){return this.dispatch(uU(e),r)}addStateExample(e,r){return this.dispatch(cU(e),r)}updateStateExample(e,r){return this.dispatch(lU(e),r)}deleteStateExample(e,r){return this.dispatch(dU(e),r)}reorderStateExamples(e,r){return this.dispatch(fU(e),r)}}let pU=(Em=class extends Pr{constructor(t,e){super(Tg,_f.createDocument(t),e)}saveToFile(t,e){return super.saveToFile(t,Em.fileExtension,e)}loadFromFile(t){return super.loadFromFile(t)}static async fromFile(t){const e=new this;return await e.loadFromFile(t),e}},s5e(Em,"fileExtension","phdm"),Em);Qo(pU,[vDe,bDe,wDe,_De,xDe,EDe,SDe]);const TDe=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:C$,addModule:F$,addOperation:G$,addOperationError:$$,addOperationExample:W$,addStateExample:cU,deleteChangeLogItem:M$,deleteModule:L$,deleteOperation:aU,deleteOperationError:Z$,deleteOperationExample:J$,deleteStateExample:dU,moveOperation:iU,releaseNewVersion:R$,reorderChangeLogItems:k$,reorderModuleOperations:sU,reorderModules:j$,reorderOperationErrors:H$,reorderOperationExamples:K$,reorderStateExamples:fU,setAuthorName:N$,setAuthorWebsite:I$,setInitialState:uU,setModelDescription:A$,setModelExtension:D$,setModelId:T$,setModelName:S$,setModuleDescription:B$,setModuleName:P$,setOperationDescription:tU,setOperationErrorCode:U$,setOperationErrorDescription:q$,setOperationErrorName:z$,setOperationErrorTemplate:V$,setOperationName:X$,setOperationReducer:nU,setOperationSchema:eU,setOperationScope:Q$,setOperationTemplate:rU,setStateSchema:oU,updateChangeLogItem:O$,updateOperationExample:Y$,updateStateExample:lU},Symbol.toStringTag,{value:"Module"})),DDe=pU,ADe={..._f,...b5e},NDe={...Xo,...TDe},IDe={Document:DDe,reducer:Tg,actions:NDe,utils:ADe,documentModel:w5e},CDe="feature-flags-config",Hm=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,ODe=Hm==null?void 0:Hm.split(","),Wm=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||void 0,MDe=Wm==null?void 0:Wm.split(","),hU={editors:{enabledEditors:Hm==="*"?"*":ODe,disabledEditors:Wm==="*"?"*":MDe}},kDe=zp(CDe,hU),mU=()=>{const[t,e]=La(kDe);return{config:{...hU,...t},setConfig:e}},RDe=tq("theme","light",t=>{var e;typeof window<"u"&&((e=window.electronAPI)==null||e.setTheme(t))}),Fp=$_(),FDe=zp("sidebar-collapsed",!1);$n(!1);const PDe={sidebarCollapsedAtom:FDe,themeAtom:RDe},BDe=window.__VITE_ENVS.LOCAL_DOCUMENT_MODELS;async function LDe(){if(!BDe)return[];try{const t=await xf(()=>import("LOCAL_DOCUMENT_MODELS"),[]);return console.log("Loaded local document models:",t),Object.values(t)}catch(t){return console.error("Error loading local document models",t),[]}}const jDe={DocumentModel:IDe,AtlasFeedbackIssues:Moe,...n5e},gU=Object.values(jDe),yU=LDe(),$De=$n(yU),Pp=$n(async t=>{const e=await t($De),r=e.map(n=>n.documentModel.id);return[...gU.filter(n=>!r.includes(n.documentModel.id)),...e]}),UDe=()=>Up(Pp),zDe=BI(Pp),vU=()=>Up(zDe),qDe=()=>yU,VDe=function(t){return Fp.sub(Pp,()=>{Fp.get(Pp).then(t).catch(e=>{throw e})})};function ZDe(t,e){return e==null?void 0:e.find(r=>r.documentModel.id===t)}const HDe=()=>{const t=vU();return e=>ZDe(e,t)},WDe=()=>{const t=vU(),{config:e}=mU(),{enabledEditors:r,disabledEditors:n}=e.editors;if(!t)return;const i=t.filter(a=>a.documentModel.id!=="powerhouse/document-drive");return r==="*"?t:n==="*"?[]:n?i.filter(a=>!n.includes(a.documentModel.id)):r?i.filter(a=>r.includes(a.documentModel.id)):i};function YDe(t){let e=!1;const r=Object.entries(t.operations).reduce((n,[i,a])=>{const s=i;for(const o of a){const u=JDe(o);n[s].push(u),u!==o&&(e=!0)}return n},{global:[],local:[]});return e?{...t,operations:r}:t}function JDe(t){var r;if(!((r=t.context)!=null&&r.signer)||t.context.signer.signatures)return t;const{signer:e}=t.context;if("signature"in e){const n=e.signature;return{...t,context:{...t.context,signer:{user:e.user,app:e.app,signatures:n!=null&&n.length?[n]:[]}}}}else return t}const Yn=class Yn{constructor(e){this.db=J3.ready().then(()=>J3.createInstance({name:e?`${e}:${Yn.DBName}`:Yn.DBName}))}buildKey(...e){return e.join(Yn.SEP)}async checkDocumentExists(e,r){return!!await(await this.db).getItem(this.buildKey(e,r))}async getDocuments(e){const n=await(await this.db).keys(),i=`${e}${Yn.SEP}`;return n.filter(a=>a.startsWith(i)).map(a=>a.slice(i.length))}async getDocument(e,r){const n=await(await this.db).getItem(this.buildKey(e,r));if(!n)throw new Error(`Document with id ${r} not found`);return n}async createDocument(e,r,n){await(await this.db).setItem(this.buildKey(e,r),n)}async deleteDocument(e,r){await(await this.db).removeItem(this.buildKey(e,r))}async clearStorage(){return(await this.db).clear()}async addDocumentOperations(e,r,n,i){const a=await this.getDocument(e,r);if(!a)throw new Error(`Document with id ${r} not found`);const s=S0(a.operations,n);await(await this.db).setItem(this.buildKey(e,r),{...a,...i,operations:s})}async getDrives(){return(await(await this.db).keys()).filter(n=>n.startsWith(Yn.DRIVES_KEY)).map(n=>n.slice(Yn.DRIVES_KEY.length+Yn.SEP.length))}async getDrive(e){const n=await(await this.db).getItem(this.buildKey(Yn.DRIVES_KEY,e));if(!n)throw new uf(e);return n}async getDriveBySlug(e){const r=(await this.getDrives()).reverse();for(const n of r)if((await this.getDrive(n)).initialState.state.global.slug===e)return this.getDrive(n);throw new Error(`Drive with slug ${e} not found`)}async createDrive(e,r){await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),r)}async deleteDrive(e){const r=await this.getDocuments(e);return await Promise.all(r.map(n=>this.deleteDocument(e,n))),(await this.db).removeItem(this.buildKey(Yn.DRIVES_KEY,e))}async addDriveOperations(e,r,n){const i=await this.getDrive(e),a=S0(i.operations,r);await(await this.db).setItem(this.buildKey(Yn.DRIVES_KEY,e),{...i,...n,operations:a})}async getSynchronizationUnitsRevision(e){return(await Promise.allSettled(e.map(async n=>{try{const i=await(n.documentId?this.getDocument(n.driveId,n.documentId):this.getDrive(n.driveId));if(!i)return;const a=i.operations[n.scope].at(-1);if(a)return{driveId:n.driveId,documentId:n.documentId,scope:n.scope,branch:n.branch,lastUpdated:a.timestamp,revision:a.index}}catch{return}}))).reduce((n,i)=>(i.status==="fulfilled"&&i.value!==void 0&&n.push(i.value),n),[])}async migrateOperationSignatures(){const e=await this.getDrives();for(const r of e){await this.migrateDocument(Yn.DRIVES_KEY,r);const n=await this.getDocuments(r);await Promise.all(n.map(async i=>this.migrateDocument(r,i)))}}async migrateDocument(e,r){const n=await this.getDocument(e,r),i=YDe(n);if(i!==n)return(await this.db).setItem(this.buildKey(e,r),i)}};Yn.DBName="DOCUMENT_DRIVES",Yn.SEP=":",Yn.DRIVES_KEY="DRIVES";let M_=Yn;const XN=window.__VITE_ENVS.PH_CONNECT_DEFAULT_DRIVES_URL||void 0,Mb=XN?XN.split(","):[],KDe=()=>({defaultDrives:{remoteDrives:Mb.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[],pullInterval:3e3}})),removeOldRemoteDrives:Mb.length>0?{strategy:"preserve-by-url-and-detach",urls:Mb}:{strategy:"preserve-all"}}});function GDe(t,e){return new tG(t,new M_(e),new WO,new JO(1,10),{...KDe()})}async function XDe(t){const e=await t.initialize(),r=e==null?void 0:e.at(0);if(r)throw r;!(await t.getDrives()).length&&ks.drives.sections.LOCAL.enabled&&t.addDrive({global:{id:Xe.hashKey(),name:"My Local Drive",icon:null,slug:"my-local-drive"},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(Cn.error)}const kE=(async()=>{var e;const t=((e=window.electronAPI)==null?void 0:e.documentDrive)??GDe(gU,ks.routerBasename);return await XDe(t),t})(),bU=$n(kE),QDe=BI(bU),wU=()=>Up(QDe),eAe=()=>kE;VDe(async t=>{(await Fp.get(bU)).setDocumentModels(t)});async function tAe(){await qDe();const t=await Fp.get(Pp);(await kE).setDocumentModels(t)}tAe().catch(console.error);const Ym=(async()=>{if(window.connectCrypto)return window.connectCrypto;const{ConnectCrypto:t}=await xf(async()=>{const{ConnectCrypto:n}=await import("./index-g4Q6-PRA.js");return{ConnectCrypto:n}},__vite__mapDeps([0,1,2,3])),{BrowserKeyStorage:e}=await xf(async()=>{const{BrowserKeyStorage:n}=await import("./browser-Dmr6AWWk.js");return{BrowserKeyStorage:n}},[]),r=new t(new e);return await r.did(),r})();function RE(){return Fo(()=>({async regenerateDid(){return(await Ym).regenerateDid()},async did(){return(await Ym).did()},sign:async t=>await(await Ym).sign(t)}),[])}const rAe=$n(void 0);function nAe(){const[t,e]=La(rAe);return vi(()=>{t||Ym.then(r=>r.did()).then(r=>e(r)).catch(Cn.error)}),t}const iAe=$n(window.renown?Promise.resolve(window.renown):void 0);function _U(){const[t,e]=La(iAe),{did:r}=RE();async function n(i){const a=await i();if(!a)return;const{initRenownBrowser:s}=await xf(async()=>{const{initRenownBrowser:c}=await import("./browser-CPcl7U5g.js").then(l=>l.f);return{initRenownBrowser:c}},__vite__mapDeps([4,1,2,3])),o=s(a);return{user:function(){return Promise.resolve(o.user)},login:function(c){return o.login(c)},logout(){return Promise.resolve(o.logout())},on:{user(c){return o.on("user",c)}}}}return t||e(n(r)),t}let Tm=!1;const aAe=$n(void 0),Vy=()=>{const[t,e]=La(aAe),r=_U();return vi(()=>{var i;let n=null;if(t){const{credential:a,...s}=t;n={id:s.did,username:(i=s.ens)==null?void 0:i.name,...s}}CX(n)},[t]),vi(()=>{if(Tm)return;Tm=!0,r==null||r.user().then(i=>{e(i||null)}).catch(()=>{e(null)});const n=r==null?void 0:r.on.user(i=>{e(i||null)});return()=>{n==null||n(),Tm=!1}},[r,Tm]),t},sAe=parseInt("50");function B9e(t,e,r=Cn.error){const[n,i]=ii(e),[a,s]=ii(),o=c=>{s(c),r(c)};return vi(()=>{i(e)},[e]),[n,(c,l,d)=>{s(void 0),i(f=>{if(!t||!f)return f;try{const p=t(f,c),h=c.scope??"global",m=p.operations[h],y=m[m.length-1];if(y.error){const g=new Error(y.error);o(g),d==null||d(g)}return l==null||l(y,{prevState:{...f},newState:{...p}}),p}catch(p){return o(p),d==null||d(p),f}})},a]}async function oAe(t,e,r,n,i){let a;const s=new Promise(c=>{a=i.on("strandUpdate",l=>{var p;if(!(l.documentId===e&&l.scope==r))return;const f=(p=l.operations.at(-1))==null?void 0:p.index;f&&f>=n&&c()})}),o=new Promise((c,l)=>setTimeout(()=>l(new Error(`Timed out waiting for operation ${n} for document ${e}`)),t)),u=Promise.race([s,o]);return u.finally(()=>{a==null||a()}),u}async function uAe(t,e,r,n,i,a){const s=(a==null?void 0:a.operationsLimit)||sAe;for(const o of Object.values(r.operations))for(let u=0;u<o.length;u+=s){const c=o.slice(u,u+s),l=c.at(-1);if(!l)break;const{scope:d}=l;await i(t,e,c),a!=null&&a.waitForSync&&await oAe(1e4,e,d,l.index,n)}}const cAe=async t=>{(await Xe.createZip(t)).generateAsync({type:"blob"}).then(r=>{const n=window.document.createElement("a");n.style.display="none",n.href=URL.createObjectURL(r),n.download=`${t.name||"Untitled"}.zip`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}).catch(Cn.error)};async function L9e(t,e){var i,a,s;const r=e(t.documentType);if(!r)throw new Error(`Document model not supported: ${t.documentType}`);const n=r.utils.fileExtension;if(!window.showSaveFilePicker){await cAe(t);return}try{const o=await window.showSaveFilePicker({suggestedName:`${t.name||((a=(i=t.state)==null?void 0:i.global)==null?void 0:a.name)||"Untitled"}.${n?`${n}.`:""}zip`});await r.utils.saveToFileHandle(t,o);const u=(await o.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,u)),u}catch(o){if(!(o instanceof DOMException&&o.name==="AbortError"))throw o}}async function lAe(t,e){const r=await Xe.loadFromInput(t,i=>i,{checkHashes:!0}),n=e(r.documentType);if(!n)throw new Error(`Document "${r.documentType}" is not supported`);return n.utils.loadFromInput(t)}async function dAe(t,e,r,n,i,a){if(!a||!t.context||!t.context.signer)return t;if(!i)return Cn.error(`Document model '${n.documentType}' does not have a reducer`),t;const s={documentId:r,signer:t.context.signer};return await Xe.buildSignedOperation(t,i,n,s,e)}function fAe(t,e,r){return r?{context:{signer:{app:{name:"Connect",key:e||""},user:{address:r.address,networkId:r.networkId,chainId:r.chainId},signatures:[]}},...t}:t}const QN=$n(new Map);function pAe(t){return Object.keys(t.operations).map(e=>{var r;return`${e}:${t.operations[e].length}:${(r=t.operations[e].at(-1))==null?void 0:r.hash}`}).join(":")}function Dg(t){return t.map(pAe).join("&")}const hAe=t=>()=>$n(e=>t?e(QN).get(t)??[]:[],(e,r,n)=>{r(QN,i=>{if(!t)return new Map;const a=i.get(t)??[];return a.length!==n.length||Dg(a)!==Dg(n)?new Map(i).set(t,n):i})}),mAe=Wz(()=>$n("INITIAL"));function gAe(){const t=wU(),[e,r]=La(Fo(hAe(t),[t])),n=Cr(async()=>{if(!t)return;const o=[];try{const u=await t.getDrives();for(const c of u)try{const l=await t.getDrive(c);o.push(l)}catch(l){Cn.error(l)}}catch(u){Cn.error(u)}finally{r(o)}},[t]),[i,a]=La(mAe(t));i==="INITIAL"&&(a("LOADING"),n().then(()=>a("LOADED")).catch(()=>a("ERROR")));const s=Cr(o=>{if(!t)return;const u=t.on("syncStatus",async(f,p,h)=>{h&&Cn.error(h),await n()}),c=t.on("strandUpdate",()=>n()),l=t.on("clientStrandsError",o.strandsErrorHandler),d=t.on("defaultRemoteDrive",()=>n());return()=>{u(),c(),l(),d()}},[t,n]);return Fo(()=>[e,n,s,i],[e,i])}const yAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",vAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",bAe=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",wAe=$n("initial"),FE=()=>{const[t,e]=La(wAe),r=Vy(),n=_U(),{did:i}=RE(),a=Cr(async()=>{var l;const u=await i(),c=new URL(yAe);if(c.searchParams.set("connect",u),c.searchParams.set("network",vAe),c.searchParams.set("chain",bAe),window.electronAPI){const d=await window.electronAPI.protocol();c.searchParams.set("deeplink",d),await window.electronAPI.openURL(c.toString())}else{const d=new URL(window.location.pathname,window.location.origin);c.searchParams.set("returnUrl",d.toJSON()),(l=window.open(c,"_self"))==null||l.focus()}},[i]),s=Cr(async u=>{if(n)try{e("checking");const c=await n.user();if((c==null?void 0:c.did)===u)return e("authorized"),c;const l=await n.login(u);if(l)return e("authorized"),l;e("not-authorized")}catch(c){e("not-authorized"),Cn.error(c)}},[n]);vi(()=>{r&&t!=="authorized"&&e("authorized")},[r,t]);const o=Cr(async()=>{e("initial"),await(n==null?void 0:n.logout())},[n]);return Fo(()=>({openRenown:a,user:r,status:r?"authorized":t,login:n?s:void 0,logout:o}),[n,a,r,t,s,o])};function _Ae(){const{user:t,status:e}=FE(),r=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,n=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,i=!!r&&r!=="",a=!!n&&n!=="";if(i&&a)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!i&&!a)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(i){const s=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:s.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(a){const s=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:s.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function xU(){const t=_Ae();if(!t)return;const{allowListType:e,isAllowed:r}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:r,isAllowedToEditDocuments:r}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function PE(){const{isAllowedToCreateDocuments:t,isAllowedToEditDocuments:e}=xU()||{isAllowedToCreateDocuments:!1,isAllowedToEditDocuments:!1},r=Vy()||void 0,n=nAe(),{sign:i}=RE(),a=wU(),s=HDe(),[o,u,,c]=gAe(),l=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.getDocument(S,B);if(!R)throw new Error(`There was an error opening file with id ${B} on drive ${S}`);return R},[a]),d=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");let R=o.find(z=>z.state.global.id===S);if(!R)throw new Error(`Drive with id ${S} not found`);const L={...R};R=Wu(R,fAe(B,n,r));const q=B.scope??"global",X=R.operations[q].findLast(z=>z.type===B.type);if(!X)throw new Error("There was an error applying the operation");const ie=await dAe(X,i,S,L,Wu,r);try{const z=await a.queueDriveOperation(S,ie);if(z.status!=="SUCCESS"&&Cn.error(z.error),z.operations.length&&await u(),z.document&&!gu(z.document))throw new Error("Received document is not a Document Drive");return z.document}catch(z){return Cn.error(z),R}},[o,u,a,i,r,n]),f=Cr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to create documents");const K=Xe.hashKey();let X=o.find(V=>V.state.global.id===S);if(!X)throw new Error(`Drive with id ${S} not found`);const ie=Y2(X.state.global,{id:K,name:B,parentFolder:L??null,documentType:R,document:q},["global"]);X=await d(S,ie);const z=X==null?void 0:X.state.global.nodes.find(V=>V.id===K);if(!z||!Ni(z))throw new Error("There was an error adding document");return z},[d,o,t]),p=Cr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(K=>K.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.queueOperations(S,B,R)).document},[o,e,a]),h=Cr(async(S,B,R,L)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create files");const q=await lAe(S,s),K={...q.initialState,initialState:q.initialState,operations:{global:[],local:[]},clipboard:[]},X=await f(B,R||(typeof S=="string"?q.name:S.name),q.documentType,L,K),ie=o.find(V=>V.state.global.id===B),z=ie&&ie.state.local.listeners.length>0;uAe(B,X.id,q,a,p,{waitForSync:z}).catch(V=>{throw V})},[f,p,s,t,a]),m=Cr(async(S,B,R,L,q)=>{if(!t)throw new Error("User is not allowed to update files");const K=await d(S,Jn.updateFile({id:B,name:L||void 0,parentFolder:q,documentType:R})),X=K==null?void 0:K.state.global.nodes.find(ie=>ie.id===B);if(!X||!Ni(X))throw new Error("There was an error updating document");return X},[d,t]),y=Cr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to create folders");const L=Xe.hashKey(),q=await d(S,Jn.addFolder({id:L,name:B,parentFolder:R})),K=q==null?void 0:q.state.global.nodes.find(X=>X.id===L);if(!K||!jg(K))throw new Error("There was an error adding folder");return K},[d,t]),g=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to delete documents");await d(S,Jn.deleteNode({id:B}))},[d,t]),b=Cr(async(S,B,R)=>{if(!t)throw new Error("User is not allowed to rename documents");const L=await d(S,Jn.updateNode({id:B,name:R})),q=L==null?void 0:L.state.global.nodes.find(K=>K.id===B);if(!q)throw new Error("There was an error renaming node");return q},[d,t]),_=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to move documents");B.kind===Pb||S.parentFolder===B.id||await d(B.driveId,Jn.moveNode({srcFolder:S.id,targetParentFolder:B.id}))},[d,t]),E=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to copy documents");if(B.kind===Pb)return;const R=o.find(ie=>ie.state.global.id===S.driveId);if(!R)return;const L=()=>Xe.hashKey(),K=sp.generateNodesCopy({srcId:S.id,targetParentFolder:B.id,targetName:S.name},L,R.state.global.nodes).map(ie=>Jn.copyNode(ie)),X=await a.addDriveActions(S.driveId,K);X.operations.length?await u():X.status!=="SUCCESS"&&Cn.error(`Error copying files: ${X.status}`,X.error)},[o,t,u,a]),x=Cr(async(S,B,R)=>{if(!e)throw new Error("User is not allowed to edit documents");if(!a)throw new Error("Reactor is not loaded");if(!o.find(K=>K.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return(await a.addOperation(S,B,R)).document},[o,e,a]),D=Cr(async S=>{if(!a)throw new Error("Reactor is not loaded");if(!t)throw new Error("User is not allowed to create drives");const B=S.global.id||Xe.hashKey();S=sp.createState(S);const R=await a.addDrive({global:{...S.global,id:B},local:S.local});return await u(),R},[t,u,a]),M=Cr(async(S,B)=>{if(!a)throw new Error("Reactor is not loaded");const R=await a.addRemoteDrive(S,B);return await u(),R},[u,a]),F=Cr(async S=>{if(!t)throw new Error("User is not allowed to delete drives");if(!a)throw new Error("Reactor is not loaded");if(!o.find(R=>R.state.global.id===S))throw new Error(`Drive with id ${S} not found`);return await a.deleteDrive(S),u()},[o,t,u,a]),k=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to rename drives");return d(S,Jn.setDriveName({name:B}))},[d,t]),$=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setAvailableOffline({availableOffline:B}))},[d,t]),T=Cr(async(S,B)=>{if(!t)throw new Error("User is not allowed to change drive availability");return d(S,Jn.setSharingType({type:B}))},[d,t]),A=Cr(async(S,B)=>{if(B!==JU){if(!a)throw new Error("Reactor is not loaded");try{const R=a.getSyncStatus(S);return R instanceof YO?"INITIAL_SYNC":R}catch(R){return console.error(R),KU}}},[a]),v=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("strandUpdate",S)},[a]),w=Cr(S=>{if(!a)throw new Error("Reactor is not loaded");return a.on("syncStatus",S)},[a]),N=Cr(async()=>{a&&(await a.clearStorage(),await u())},[u,a]),C=Cr(async(S,B)=>{const R=await d(S,Jn.removeTrigger({triggerId:B}));if(R==null?void 0:R.state.local.triggers.find(q=>q.id===B))throw new Error(`There was an error removing trigger ${B}`)},[d]),I=Cr(async(S,B,R)=>{if(!a)throw new Error("Reactor is not loaded");return await a.registerPullResponderTrigger(S,B,R)},[a]),O=Cr(async(S,B)=>{const R=await d(S,Jn.addTrigger({trigger:B}));if(!(R==null?void 0:R.state.local.triggers.find(q=>q.id===q.id)))throw new Error(`There was an error adding the trigger ${B.id}`)},[d]);return Fo(()=>({documentDrives:o,documentDrivesStatus:c,addDocument:f,openFile:l,addFile:h,updateFile:m,addFolder:y,deleteNode:g,renameNode:b,moveNode:_,copyNode:E,addOperation:x,addOperations:p,addDrive:D,addRemoteDrive:M,deleteDrive:F,renameDrive:k,setDriveAvailableOffline:$,setDriveSharingType:T,getSyncStatus:A,onStrandUpdate:v,onSyncStatus:w,clearStorage:N,removeTrigger:C,addTrigger:O,registerNewPullResponderTrigger:I}),[f,D,h,y,x,p,M,O,N,E,F,g,o,c,A,_,v,w,l,I,C,k,b,$,T,m])}function xAe(t){return t.replaceAll(/\s/g,"-")}const EAe=t=>{const{open:e,onClose:r,selectedParentNode:n,setSelectedNode:i,documentModel:a}=t,{addDocument:s}=PE();return et(GU,{open:e,onContinue:async u=>{if(r(),!n)throw new Error("No drive or folder selected");const c=await s(n.driveId,u||`New ${a.documentModel.name}`,a.documentModel.id,n.id);c&&i({...c,slug:xAe(c.name),kind:Pb,documentType:c.documentType,parentFolder:n.id,driveId:n.driveId,syncStatus:n.syncStatus,synchronizationUnits:[],sharingType:n.sharingType})},onOpenChange:u=>{if(!u)return r()}})},SAe=$n(ks);function BE(){return La(SAe)}let Dm;const TAe=new Uint8Array(16);function DAe(){if(!Dm&&(Dm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dm(TAe)}const Wn=[];for(let t=0;t<256;++t)Wn.push((t+256).toString(16).slice(1));function AAe(t,e=0){return Wn[t[e+0]]+Wn[t[e+1]]+Wn[t[e+2]]+Wn[t[e+3]]+"-"+Wn[t[e+4]]+Wn[t[e+5]]+"-"+Wn[t[e+6]]+Wn[t[e+7]]+"-"+Wn[t[e+8]]+Wn[t[e+9]]+"-"+Wn[t[e+10]]+Wn[t[e+11]]+Wn[t[e+12]]+Wn[t[e+13]]+Wn[t[e+14]]+Wn[t[e+15]]}const NAe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eI={randomUUID:NAe};function tI(t,e,r){if(eI.randomUUID&&!e&&!t)return eI.randomUUID();t=t||{};const n=t.random||(t.rng||DAe)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,AAe(n)}const IAe=t=>{var T;const[e]=BE(),{open:r,onClose:n}=t,i=localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false";console.log("autoRegisterPullResponder",i);const[a,s]=ii(e.appVersion),[o,u]=ii({label:Eh.debug?"Enabled":"Disabled",value:Eh.debug}),[c,l]=ii(),[d,f]=ii(null),[p,h]=ii(""),[m,y]=ii({label:i?"Enabled":"Disabled",value:i?"true":"false"}),{documentDrives:g,removeTrigger:b,addTrigger:_,registerNewPullResponderTrigger:E}=PE();vi(()=>{Eh.setDebug(o.value)},[o]),console.log("documentDrives",g),console.log("selectedDrive",c);const x=((T=g.find(A=>A.state.global.id===c))==null?void 0:T.state.local.triggers)||[],M=!c||p==="",F=async()=>{!d||!c||(await b(c,d.value),f(null))},k=async(A=!1)=>{if(!(!p||p===""||!c)){if(!A){const v=await E(c,p,{pullInterval:3e3});await _(c,v),h("");return}await _(c,{id:`invalid-trigger-${tI()}`,type:"PullResponder",data:{interval:"3000",listenerId:`ivalid-listener-${tI()}`,url:p}}),h("")}},$=A=>{y(A),localStorage.setItem("AUTO_REGISTER_PULL_RESPONDER",A.value)};return et(XU,{open:r,onOpenChange:A=>{if(!A)return n()},contentProps:{className:"rounded-2xl"},children:Yr("div",{className:"w-[700px] rounded-2xl p-6",children:[Yr("div",{className:"mb-6 flex justify-between",children:[et("div",{className:"text-xl font-bold",children:"Debug Tools"}),et("button",{id:"close-modal",onClick:()=>n(),children:et(xh,{name:"Xmark",size:28})})]}),Yr("div",{className:"flex text-sm font-bold",children:[et(xh,{name:"Ring",size:22}),Yr("span",{className:"ml-2",children:["App Version: ",e.appVersion]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(xh,{name:"Hdd",size:22}),et("span",{className:"ml-2",children:"Drive Tools:"})]}),Yr("div",{children:[et("label",{htmlFor:"selectedDrive",className:"text-xs",children:"Selected Drive:"}),et(Rd,{id:"selectedDrive",onChange:A=>{if(!A||typeof A!="object"||!("value"in A)){l(void 0),f(null);return}l(A.value),f(null)},options:g.map(A=>({label:A.state.global.name,value:A.state.global.id}))})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"autoRegisterPullResponder",className:"text-xs",children:"Auto register pull responder:"}),et(Rd,{id:"autoRegisterPullResponder",onChange:A=>{$(A)},value:m,options:[{label:"Enabled",value:"true"},{label:"Disabled",value:"false"}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveTrigger",className:"text-xs",children:"Drive trigger:"}),et(Rd,{id:"driveTrigger",onChange:A=>{f(A)},value:d,options:x.map(A=>({label:`${A.id} - ${A.type}`,value:A.id}))})]}),et("div",{children:et(Vc,{onClick:F,color:d?"red":"light",disabled:!d,size:"small",children:"Remove Trigger"})})]}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"driveUrl",className:"text-xs",children:"Add drive trigger:"}),et(HE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"driveUrl",icon:et("div",{className:"flex h-full items-center text-xs",children:"URL:"}),value:p,onChange:A=>h(A.target.value)})]}),Yr("div",{className:"mb-1 flex items-center justify-center",children:[et(Vc,{className:"mr-2",color:M?"light":"blue",size:"small",disabled:M,onClick:()=>k(),children:"Add Trigger"}),et(Vc,{color:M?"light":"red",size:"small",disabled:M,onClick:()=>k(!0),children:"Add Invalid Trigger"})]})]}),Yr("div",{className:"mt-4 flex text-sm font-bold",children:[et(xh,{name:"Gear",size:22}),et("span",{className:"ml-2",children:"Service Worker Tools:"})]}),et("div",{className:"mt-2 flex items-end justify-between pl-4",children:Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"serviceWorkerDebugMode",className:"text-xs",children:"Service Worker Debug Mode:"}),et(Rd,{id:"serviceWorkerDebugMode",onChange:A=>{u(A)},value:o,options:[{label:"Enabled",value:!0},{label:"Disabled",value:!1}]})]})}),Yr("div",{className:"mt-2 flex items-end justify-between pl-4",children:[Yr("div",{className:"w-[400px]",children:[et("label",{htmlFor:"appVersion",className:"text-xs",children:"Set invalid app version:"}),et(HE,{containerClassName:"p-1 bg-white border border-gray-200 rounded-md text-sm",inputClassName:"text-xs font-normal",id:"appVersion",icon:et("div",{className:"flex h-full items-center text-xs",children:"Version:"}),value:a,onChange:A=>s(A.target.value)})]}),et("div",{className:"mb-1 flex items-center justify-center",children:et(Vc,{color:a===""?"light":"red",size:"small",disabled:a==="",onClick:()=>{Eh.sendMessage({type:"SET_APP_VERSION",version:a}),s("")},children:"Add Invalid App Version"})})]})]})})},CAe=t=>{const{open:e,onClose:r,uiDriveNode:n,onDelete:i}=t,{t:a}=nc();return et(QU,{open:e,driveName:n.name,onCancel:r,header:a("modals.deleteDrive.title",{label:n.name}),body:a("modals.deleteDrive.body"),inputPlaceholder:a("modals.deleteDrive.inputPlaceholder"),cancelLabel:a("common.cancel"),continueLabel:a("common.delete"),onContinue:()=>i(r),onOpenChange:s=>{if(!s)return r()}})},OAe=t=>{const{t:e}=nc(),{uiNode:r,open:n,onClose:i,onDelete:a}=t,{kind:s,name:o}=r;return et(ez,{open:n,onDelete:()=>a(i),onCancel:()=>i(),header:e(`modals.deleteItem.${s.toLowerCase()}.header`,{item:o}),body:e(`modals.deleteItem.${s.toLowerCase()}.body`),cancelLabel:e("common.cancel"),deleteLabel:e("common.delete")})},MAe=t=>{const{open:e,onClose:r}=t,{t:n}=nc();return et(EI,{open:e,header:n("modals.disclaimer.title"),body:n("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>r()})};function kAe(t){const{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onClose:o}=t;return et(tz,{uiDriveNode:e,open:r,onRenameDrive:n,onDeleteDrive:i,onChangeAvailableOffline:a,onChangeSharingType:s,onOpenChange:u=>{if(!u)return o()}})}const RAe="defaultDocumentModelEditor",FAe=zp(RAe,{label:"V2",value:"document-model-editor-v2"}),PAe=()=>La(FAe),BAe=t=>mt.createElement("svg",{width:126,height:24,viewBox:"0 0 126 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t},mt.createElement("g",{id:"Group 1000003373"},mt.createElement("path",{id:"Vector",d:"M11.8372 0.488748C10.2978 5.70206 6.19289 9.81182 0.98589 11.3469C0.332828 11.5409 0.332828 12.4591 0.98589 12.6531C6.18997 14.1882 10.2978 18.2979 11.8372 23.5113C12.0296 24.1629 12.9597 24.1629 13.155 23.5113C14.6943 18.2979 18.7993 14.1882 24.0063 12.6531C24.6594 12.4591 24.6594 11.5409 24.0063 11.3469C18.8022 9.81182 14.6943 5.70206 13.155 0.488748C12.9626 -0.162916 12.0325 -0.162916 11.8372 0.488748Z",fill:"inherit"}),mt.createElement("g",{id:"Renown"},mt.createElement("path",{d:"M42.6238 2.65186C44.3678 2.65186 45.6958 3.05186 46.6078 3.85186C47.5198 4.63586 47.9758 5.65985 47.9758 6.92385C47.9758 7.29185 47.9438 7.63586 47.8798 7.95586C47.6878 9.07586 47.1998 10.0759 46.4158 10.9559C45.6318 11.8359 44.5838 12.4599 43.2718 12.8279L45.9838 19.4999H41.3518L38.9758 13.1399H37.9918L36.8638 19.4999H32.7598L35.7358 2.65186H42.6238ZM43.6798 8.12385C43.7118 7.86786 43.7278 7.69986 43.7278 7.61985C43.7278 7.10786 43.5598 6.71586 43.2238 6.44386C42.9038 6.15586 42.4238 6.01186 41.7838 6.01186H39.2398L38.4958 10.2359H41.0398C41.7918 10.2359 42.3838 10.0519 42.8158 9.68386C43.2638 9.31586 43.5518 8.79586 43.6798 8.12385Z",fill:"inherit"}),mt.createElement("path",{d:"M55.808 5.91585C57.536 5.91585 58.904 6.38785 59.912 7.33185C60.936 8.25985 61.448 9.53186 61.448 11.1479C61.448 11.6759 61.408 12.1479 61.328 12.5639C61.264 12.9319 61.168 13.3239 61.04 13.7399H51.752C51.736 13.8359 51.728 13.9879 51.728 14.1959C51.728 14.8999 51.92 15.4359 52.304 15.8039C52.688 16.1719 53.2 16.3559 53.84 16.3559C54.864 16.3559 55.648 15.9239 56.192 15.0599H60.56C59.984 16.4199 59.048 17.5319 57.752 18.3959C56.456 19.2599 55 19.6919 53.384 19.6919C51.656 19.6919 50.272 19.2119 49.232 18.2519C48.208 17.2919 47.696 15.9879 47.696 14.3399C47.696 13.8439 47.744 13.3319 47.84 12.8039C48.08 11.4119 48.576 10.1959 49.328 9.15586C50.08 8.11586 51.016 7.31586 52.136 6.75586C53.256 6.19586 54.48 5.91585 55.808 5.91585ZM57.296 11.6519C57.328 11.4279 57.344 11.2759 57.344 11.1959C57.344 10.5559 57.144 10.0679 56.744 9.73186C56.344 9.37986 55.816 9.20386 55.16 9.20386C54.456 9.20386 53.832 9.41986 53.288 9.85186C52.76 10.2679 52.376 10.8679 52.136 11.6519H57.296Z",fill:"inherit"}),mt.createElement("path",{d:"M71.8211 5.96386C73.1651 5.96386 74.2211 6.33986 74.9891 7.09186C75.7571 7.84385 76.1411 8.89186 76.1411 10.2359C76.1411 10.6839 76.0931 11.1639 75.9971 11.6759L74.6051 19.4999H70.5251L71.8211 12.2279C71.8691 11.9559 71.8931 11.7159 71.8931 11.5079C71.8931 10.8359 71.7011 10.3159 71.3171 9.94785C70.9491 9.57985 70.4291 9.39585 69.7571 9.39585C68.9571 9.39585 68.2851 9.64386 67.7411 10.1399C67.1971 10.6359 66.8451 11.3319 66.6851 12.2279V12.1079L65.3891 19.4999H61.2851L63.6371 6.10786H67.7411L67.4291 7.90786C67.9571 7.31586 68.5971 6.84385 69.3491 6.49185C70.1171 6.13986 70.9411 5.96386 71.8211 5.96386Z",fill:"inherit"}),mt.createElement("path",{d:"M82.617 19.6919C81.465 19.6919 80.441 19.4599 79.545 18.9959C78.649 18.5319 77.9529 17.8759 77.457 17.0279C76.977 16.1799 76.737 15.1959 76.737 14.0759C76.737 12.5559 77.097 11.1719 77.817 9.92386C78.537 8.67586 79.529 7.69986 80.793 6.99586C82.057 6.27586 83.465 5.91585 85.017 5.91585C86.169 5.91585 87.193 6.15586 88.089 6.63586C89.0009 7.09986 89.7049 7.75586 90.201 8.60386C90.697 9.45186 90.945 10.4359 90.945 11.5559C90.945 13.0919 90.577 14.4839 89.841 15.7319C89.121 16.9639 88.121 17.9319 86.841 18.6359C85.577 19.3399 84.169 19.6919 82.617 19.6919ZM83.193 16.1639C83.865 16.1639 84.465 15.9639 84.993 15.5639C85.5369 15.1479 85.9529 14.6199 86.241 13.9799C86.545 13.3239 86.697 12.6439 86.697 11.9399C86.697 11.1399 86.481 10.5239 86.049 10.0919C85.617 9.65985 85.073 9.44386 84.417 9.44386C83.729 9.44386 83.121 9.65186 82.593 10.0679C82.081 10.4679 81.681 10.9959 81.393 11.6519C81.105 12.3079 80.961 12.9959 80.961 13.7159C80.961 14.4999 81.169 15.1079 81.585 15.5399C82.001 15.9559 82.5369 16.1639 83.193 16.1639Z",fill:"inherit"}),mt.createElement("path",{d:"M112.418 6.10786L106.418 19.4999H101.882L101.306 10.8119L97.5862 19.4999H93.0742L91.8022 6.10786H95.9062L96.0982 15.6839L100.058 6.10786H104.402L105.002 15.6839L108.554 6.10786H112.418Z",fill:"inherit"}),mt.createElement("path",{d:"M121.183 5.96386C122.527 5.96386 123.583 6.33986 124.351 7.09186C125.119 7.84385 125.503 8.89186 125.503 10.2359C125.503 10.6839 125.455 11.1639 125.359 11.6759L123.967 19.4999H119.887L121.183 12.2279C121.231 11.9559 121.255 11.7159 121.255 11.5079C121.255 10.8359 121.063 10.3159 120.679 9.94785C120.311 9.57985 119.791 9.39585 119.119 9.39585C118.319 9.39585 117.647 9.64386 117.103 10.1399C116.559 10.6359 116.207 11.3319 116.047 12.2279V12.1079L114.751 19.4999H110.647L112.999 6.10786H117.103L116.791 7.90786C117.319 7.31586 117.959 6.84385 118.711 6.49185C119.479 6.13986 120.303 5.96386 121.183 5.96386Z",fill:"inherit"})))),LAe=()=>{const[t,e]=ii(0);return vi(()=>{const r=setInterval(()=>{e(n=>n===3?0:n+1)},200);return()=>{clearInterval(r)}},[]),et("span",{children:new Array(t).fill(".").join("")})},jAe=()=>{const t=Vy(),{openRenown:e,status:r}=FE();return et("div",{children:r==="checking"?Yr("h2",{className:"px-4 py-5 text-center text-xl font-medium",children:[et("span",{children:"Checking Authorization"}),et("span",{className:"inline-block w-5 text-left",children:et(LAe,{})})]}):r!=="authorized"?Yr("div",{className:"flex flex-col items-center",children:[et("h2",{className:"mb-1 text-2xl font-semibold",children:"Log in with"}),et(BAe,{className:"mb-3"}),et("p",{className:"mb-5 text-center text-lg leading-6",children:"Click on the button below to start signing messages in Connect on behalf of your Ethereum identity"}),et(Vc,{onClick:()=>e(),className:"mb-3 w-full p-0 text-white shadow-none transition-colors",children:et("p",{className:"block h-10 px-7 leading-10 text-slate-50",children:"Authorize Connect"})})]}):Yr("p",{className:"p-4 pb-5",children:["Logged in with address: ",t==null?void 0:t.address]})})},rI=t=>t.map(e=>({label:e.documentModel.name,value:e.documentModel.id})),$Ae=t=>{const{open:e,onClose:r,onRefresh:n}=t,{clearStorage:i}=PE(),{t:a}=nc(),s=WDe(),o=UDe(),{setConfig:u}=mU(),{showModal:c}=SU(),[l]=BE(),[d,f]=PAe(),[p,h]=ii(rI(s)),{logout:m,status:y}=FE(),g=Vy(),b=()=>{u(E=>({...E,editors:{enabledEditors:p.map(x=>x.value)}})),r()},_=()=>{c("confirmationModal",{title:a("modals.connectSettings.clearStorage.confirmation.title"),body:a("modals.connectSettings.clearStorage.confirmation.body"),cancelLabel:a("common.cancel"),continueLabel:a("modals.connectSettings.clearStorage.confirmation.clearButton"),onContinue:()=>{i().then(()=>{n()}).catch(Cn.error)},onCancel:()=>c("settingsModal",{onRefresh:n})})};return Yr(rz,{open:e,title:a("modals.connectSettings.title"),body:a("modals.connectSettings.body"),cancelLabel:a("common.cancel"),saveLabel:a("common.save"),onSave:b,onOpenChange:E=>{if(!E)return r()},children:[et("div",{className:"rounded border border-gray-400 p-4",children:y==="authorized"?Yr(xI,{children:[Yr("p",{children:["Logged in with address:"," ",et("span",{className:"text-sm font-semibold",children:g==null?void 0:g.address})]}),et(Vc,{className:"mt-2 w-full",onClick:m,children:"Logout"})]}):et(jAe,{})}),l.content.showDocumentModelSelectionSetting&&et(nz,{selected:p,onChange:E=>h(E),options:rI(o),title:a("modals.connectSettings.enabledDocumentTypes.title"),description:a("modals.connectSettings.enabledDocumentTypes.description"),selectProps:{overrideStrings:{allItemsAreSelected:a("modals.connectSettings.enabledDocumentTypes.allSelected")}}}),et(iz,{onClearStorage:_,buttonLabel:a("modals.connectSettings.clearStorage.button"),description:a("modals.connectSettings.clearStorage.description")}),Yr("div",{children:[et("label",{htmlFor:"default-document-model-editor",className:"text-sm",children:"Default Document Model Editor:"}),et(Rd,{id:"default-document-model-editor",value:d,onChange:E=>f(E),options:[{label:"V1",value:"document-model-editor"},{label:"V2",value:"document-model-editor-v2"}]})]}),et(az,{packageJson:gz})]})},UAe=t=>{const{open:e,onClose:r,driveId:n}=t,{t:i}=nc();return et(sz,{open:e,onContinue:()=>{console.log("Upgrade drive: ",n),r()},header:i("modals.upgradeDrive.header"),body:i("modals.upgradeDrive.body"),cancelLabel:i("common.cancel"),continueLabel:i("common.continue"),onOpenChange:s=>{if(!s)return r()}})},zAe={deleteItem:OAe,upgradeDrive:UAe,createDocument:EAe,addLocalDrive:oq,addRemoteDrive:qZ,driveSettings:kAe,settingsModal:$Ae,confirmationModal:VZ,deleteDriveModal:CAe,debugSettingsModal:IAe,disclaimerModal:MAe,cookiesPolicy:ZZ},EU=Us.createContext({showModal:()=>{},closeModal:()=>{}}),SU=()=>jp(EU),qAe=t=>{const{children:e}=t,[r,n]=ii(),[i,a]=ii(),[s,o]=ii(!1),u=Cr((f,p)=>{o(!0),n(p),a(f)},[]),c=Cr(()=>{o(!1)},[]),l=i?zAe[i]:null,d=Fo(()=>({showModal:u,closeModal:c}),[c,u]);return Yr(EU.Provider,{value:d,children:[e,l&&et(l,{...r,open:s,onClose:c})]})},VAe=(t,e)=>t.some(r=>r.id===e&&r.value),ZAe=()=>{const{t}=nc(),{showModal:e}=SU(),[r,n]=sq(),[,i]=U_(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],s=u=>{n(!1),VAe(u,"analytics-cookie")&&i(c=>({...c,analytics:!0}))},o=()=>{n(!1),i({analytics:!1,functional:!1,marketing:!1})};return r?Yr("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[et("div",{className:"absolute inset-0 bg-black opacity-15"}),et("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:et(oz,{className:"max-w-[1024px] ",cookies:a,onSubmit:s,onReject:o,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:et("p",{className:"font-semibold text-gray-500",children:et(II,{i18nKey:"cookieBanner.message",components:{a:et("a",{onClick:()=>e("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"})}})})})})]}):null};var HAe=Object.defineProperty,WAe=Object.getOwnPropertyDescriptor,_s=(t,e,r,n)=>{for(var i=WAe(e,r),a=t.length-1,s;a>=0;a--)(s=t[a])&&(i=s(e,r,i)||i);return i&&HAe(e,r,i),i};function xs(t,e,r){const n=r.value;r.value=function(...i){if(!this.server)throw new Error("Read mode document drive not initialized.");return n.apply(this,i)}}function YAe(t){const e=Object.getPrototypeOf(t);Object.getOwnPropertyNames(e).forEach(n=>{const i=Object.getOwnPropertyDescriptor(e,n);i&&typeof i.value=="function"&&n!=="constructor"&&(t[n]=t[n].bind(t))})}class Ya{constructor(e){ZE(this,"server");YAe(this),this.server=e}getServer(){return this.server}setDocumentDrive(e){this.server=e}migrateReadDrive(e,r){return this.server.migrateReadDrive(e,r)}addReadDrive(e,r){return this.server.addReadDrive(e,r)}getReadDrives(){return this.server.getReadDrives()}getReadDriveBySlug(e){return this.server.getReadDriveBySlug(e)}getReadDrive(e){return this.server.getReadDrive(e)}getReadDriveContext(e){return this.server.getReadDriveContext(e)}fetchDrive(e){return this.server.fetchDrive(e)}fetchDocument(e,r,n){return this.server.fetchDocument(e,r,n)}deleteReadDrive(e){return this.server.deleteReadDrive(e)}onReadDrivesUpdate(e){return this.server.onReadDrivesUpdate(e)}}_s([xs],Ya.prototype,"migrateReadDrive");_s([xs],Ya.prototype,"addReadDrive");_s([xs],Ya.prototype,"getReadDrives");_s([xs],Ya.prototype,"getReadDriveBySlug");_s([xs],Ya.prototype,"getReadDrive");_s([xs],Ya.prototype,"getReadDriveContext");_s([xs],Ya.prototype,"fetchDrive");_s([xs],Ya.prototype,"fetchDocument");_s([xs],Ya.prototype,"deleteReadDrive");_s([xs],Ya.prototype,"onReadDrivesUpdate");const qc=new Ya,TU=L_({...qc,readDrives:[]});async function JAe(t){const e=await t.getReadDrives();return(await Promise.all(e.map(n=>t.getReadDrive(n)))).filter(n=>!(n instanceof yu))}const KAe=t=>{const e=eAe(),[r,n]=ii([]),i=xU(),[a,s]=ii(!1);vi(()=>{e.then(c=>{qc.setDocumentDrive(c),s(!0)}).catch(Cn.error)},[e]);const o=i===void 0?void 0:!(i.isAllowedToCreateDocuments||i.isAllowedToEditDocuments);Fo(()=>{if(!a||o===void 0)return;const c=o?"READ":"WRITE",l=qc.getServer();l&&typeof l.setAllDefaultDrivesAccessLevel=="function"&&l.setAllDefaultDrivesAccessLevel(c).catch(Cn.error)},[o,a]),vi(()=>{if(!a)return;JAe(qc).then(l=>n(l)).catch(Cn.error);const c=qc.onReadDrivesUpdate(l=>{n(d=>d.length!==l.length||Dg(d)!==Dg(l)?l:d)}).catch(Cn.error);return()=>{c.then(l=>l==null?void 0:l()).catch(Cn.error)}},[a]);const u=Fo(()=>({...qc,readDrives:r}),[r]);return et(TU.Provider,{...t,value:u})},j9e=()=>jp(TU);/**
1188
1188
  * @remix-run/router v1.21.0
1189
1189
  *
1190
1190
  * Copyright (c) Remix Software Inc.
@@ -1203,5 +1203,5 @@ enum ReactionType {
1203
1203
  * LICENSE.md file in the root directory of this source tree.
1204
1204
  *
1205
1205
  * @license MIT
1206
- */function Bp(){return Bp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bp.apply(this,arguments)}const UE=mt.createContext(null),WNe=mt.createContext(null),Hy=mt.createContext(null),Wy=mt.createContext(null),cu=mt.createContext({outlet:null,matches:[],isDataRoute:!1}),BU=mt.createContext(null);function Yy(){return mt.useContext(Wy)!=null}function zE(){return Yy()||mr(!1),mt.useContext(Wy).location}function YNe(){return mt.useContext(Wy).navigationType}function LU(t){mt.useContext(Hy).static||mt.useLayoutEffect(t)}function U9e(){let{isDataRoute:t}=mt.useContext(cu);return t?oIe():JNe()}function JNe(){Yy()||mr(!1);let t=mt.useContext(UE),{basename:e,future:r,navigator:n}=mt.useContext(Hy),{matches:i}=mt.useContext(cu),{pathname:a}=zE(),s=JSON.stringify(IU(i,r.v7_relativeSplatPath)),o=mt.useRef(!1);return LU(()=>{o.current=!0}),mt.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=CU(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ro([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const KNe=mt.createContext(null);function GNe(t){let e=mt.useContext(cu).outlet;return e&&mt.createElement(KNe.Provider,{value:t},e)}function z9e(){let{matches:t}=mt.useContext(cu),e=t[t.length-1];return e?e.params:{}}function q9e(t,e,r,n){Yy()||mr(!1);let{navigator:i}=mt.useContext(Hy),{matches:a}=mt.useContext(cu),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=zE(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=To(t,{pathname:f});return rIe(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:Ro([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Ro([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function XNe(){let t=sIe(),e=Zy(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return mt.createElement(mt.Fragment,null,mt.createElement("h2",null,"Unexpected Application Error!"),mt.createElement("h3",{style:{fontStyle:"italic"}},e),r?mt.createElement("pre",{style:i},r):null,null)}const QNe=mt.createElement(XNe,null);class eIe extends mt.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?mt.createElement(cu.Provider,{value:this.props.routeContext},mt.createElement(BU.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tIe(t){let{routeContext:e,match:r,children:n}=t,i=mt.useContext(UE);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),mt.createElement(cu.Provider,{value:e},n)}function rIe(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||mr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:p}=r,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let p,h=!1,m=null,y=null;r&&(p=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||QNe,u&&(c<0&&f===0?(h=!0,y=null):c===f&&(h=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),b=()=>{let _;return p?_=m:h?_=y:d.route.Component?_=mt.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=l,mt.createElement(tIe,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?mt.createElement(eIe,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:b(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):b()},null)}var jU=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(jU||{}),Ng=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ng||{});function nIe(t){let e=mt.useContext(UE);return e||mr(!1),e}function iIe(t){let e=mt.useContext(WNe);return e||mr(!1),e}function aIe(t){let e=mt.useContext(cu);return e||mr(!1),e}function $U(t){let e=aIe(),r=e.matches[e.matches.length-1];return r.route.id||mr(!1),r.route.id}function sIe(){var t;let e=mt.useContext(BU),r=iIe(Ng.UseRouteError),n=$U(Ng.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function oIe(){let{router:t}=nIe(jU.UseNavigateStable),e=$U(Ng.UseNavigateStable),r=mt.useRef(!1);return LU(()=>{r.current=!0}),mt.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Bp({fromRouteId:e},a)))},[t,e])}const wI={};function uIe(t,e){wI[e]||(wI[e]=!0,console.warn(e))}const Rc=(t,e,r)=>uIe(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function V9e(t,e){t!=null&&t.v7_startTransition||Rc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(t!=null&&t.v7_relativeSplatPath)&&(!e||!e.v7_relativeSplatPath)&&Rc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist||Rc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod||Rc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration||Rc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation||Rc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function Z9e(t){return GNe(t.context)}function cIe(t){mr(!1)}function H9e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=cn.Pop,navigator:a,static:s=!1,future:o}=t;Yy()&&mr(!1);let u=e.replace(/^\/*/,"/"),c=mt.useMemo(()=>({basename:u,navigator:a,static:s,future:Bp({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=so(n));let{pathname:l="/",search:d="",hash:f="",state:p=null,key:h="default"}=n,m=mt.useMemo(()=>{let y=_h(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h},navigationType:i}},[u,l,d,f,p,h,i]);return m==null?null:mt.createElement(Hy.Provider,{value:c},mt.createElement(Wy.Provider,{children:r,value:m}))}new Promise(()=>{});function B_(t,e){e===void 0&&(e=[]);let r=[];return mt.Children.forEach(t,(n,i)=>{if(!mt.isValidElement(n))return;let a=[...e,i];if(n.type===mt.Fragment){r.push.apply(r,B_(n.props.children,a));return}n.type!==cIe&&mr(!1),!n.props.index||!n.props.children||mr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=B_(n.props.children,a)),r.push(s)}),r}function lIe(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:mt.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:mt.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:mt.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function W9e(t,e){return ANe({basename:e==null?void 0:e.basename,future:Bp({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:GAe({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:lIe,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function dIe(){const[t]=U_(),{analytics:e}=t;vi(()=>{const r=Er();if(!e){r&&r.close();return}if(r||!ks.sentry.dsn||ks.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[Tk(),xk({depth:5}),Nae(),wk({levels:["error"]})];ks.sentry.tracing&&i.push(rse({useEffect:Us.useEffect,useLocation:zE,useNavigationType:YNe,createRoutesFromChildren:B_,matchRoutes:To})),Wae({release:n,dsn:ks.sentry.dsn,environment:ks.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const fIe=({children:t})=>(dIe(),t);function _I(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const pIe=()=>{const[{gaTrackingId:t}]=BE(),[{analytics:e}]=U_(),r=t&&e;return vi(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],_I("js",new Date),_I("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},hIe=Us.lazy(async()=>({default:await(await xf(()=>import("./router-rzs8I7Wj.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),mIe=()=>{for(const t of Object.values(PDe))Up(t);return null},gIe=()=>et(Us.StrictMode,{children:et(mz,{fallback:et(xI,{}),children:Yr(Uz,{store:Fp,children:[et(mIe,{}),et(uz,{children:et(fIe,{children:et(KAe,{children:Yr(cz,{children:[et(lz,{position:"bottom-right"}),Yr(qAe,{children:[et(hIe,{}),et(ZAe,{}),et(pIe,{})]})]})})})})]})})}),Y9e=Object.freeze(Object.defineProperty({__proto__:null,default:gIe},Symbol.toStringTag,{value:"Module"}));export{WDe as $,TIe as A,$n as B,Up as C,UE as D,k_ as E,BI as F,PAe as G,Vy as H,nAe as I,RE as J,HDe as K,B9e as L,xU as M,RDe as N,Z9e as O,fAe as P,Xo as Q,H9e as R,dAe as S,sq as T,Du as U,t_ as V,II as W,z9e as X,ADe as Y,L9e as Z,pAe as _,U9e as a,xAe as a0,sj as a1,h8e as a2,kn as a3,Vr as a4,t5e as a5,ai as a6,ume as a7,kp as a8,G as a9,NDe as aa,My as ab,nue as ac,Tue as ad,j8e as ae,Kj as af,qy as ag,Rp as ah,x8e as ai,Gj as aj,e$ as ak,Zl as al,Xj as am,Qj as an,Y9e as ao,WNe as b,q9e as c,ANe as d,$9e as e,W9e as f,SIe as g,$p as h,yAe as i,Cn as j,nc as k,V9e as l,lIe as m,PE as n,gAe as o,j9e as p,wU as q,BE as r,La as s,SU as t,zE as u,FE as v,FDe as w,Xe as x,Ooe as y,sR as z};
1207
- //# sourceMappingURL=app-xkQmjDch.js.map
1206
+ */function Bp(){return Bp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bp.apply(this,arguments)}const UE=mt.createContext(null),WNe=mt.createContext(null),Hy=mt.createContext(null),Wy=mt.createContext(null),cu=mt.createContext({outlet:null,matches:[],isDataRoute:!1}),BU=mt.createContext(null);function Yy(){return mt.useContext(Wy)!=null}function zE(){return Yy()||mr(!1),mt.useContext(Wy).location}function YNe(){return mt.useContext(Wy).navigationType}function LU(t){mt.useContext(Hy).static||mt.useLayoutEffect(t)}function U9e(){let{isDataRoute:t}=mt.useContext(cu);return t?oIe():JNe()}function JNe(){Yy()||mr(!1);let t=mt.useContext(UE),{basename:e,future:r,navigator:n}=mt.useContext(Hy),{matches:i}=mt.useContext(cu),{pathname:a}=zE(),s=JSON.stringify(IU(i,r.v7_relativeSplatPath)),o=mt.useRef(!1);return LU(()=>{o.current=!0}),mt.useCallback(function(c,l){if(l===void 0&&(l={}),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=CU(c,JSON.parse(s),a,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ro([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,s,a,t])}const KNe=mt.createContext(null);function GNe(t){let e=mt.useContext(cu).outlet;return e&&mt.createElement(KNe.Provider,{value:t},e)}function z9e(){let{matches:t}=mt.useContext(cu),e=t[t.length-1];return e?e.params:{}}function q9e(t,e,r,n){Yy()||mr(!1);let{navigator:i}=mt.useContext(Hy),{matches:a}=mt.useContext(cu),s=a[a.length-1],o=s?s.params:{};s&&s.pathname;let u=s?s.pathnameBase:"/";s&&s.route;let c=zE(),l;l=c;let d=l.pathname||"/",f=d;if(u!=="/"){let m=u.replace(/^\//,"").split("/");f="/"+d.replace(/^\//,"").split("/").slice(m.length).join("/")}let p=To(t,{pathname:f});return rIe(p&&p.map(m=>Object.assign({},m,{params:Object.assign({},o,m.params),pathname:Ro([u,i.encodeLocation?i.encodeLocation(m.pathname).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Ro([u,i.encodeLocation?i.encodeLocation(m.pathnameBase).pathname:m.pathnameBase])})),a,r,n)}function XNe(){let t=sIe(),e=Zy(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return mt.createElement(mt.Fragment,null,mt.createElement("h2",null,"Unexpected Application Error!"),mt.createElement("h3",{style:{fontStyle:"italic"}},e),r?mt.createElement("pre",{style:i},r):null,null)}const QNe=mt.createElement(XNe,null);class eIe extends mt.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?mt.createElement(cu.Provider,{value:this.props.routeContext},mt.createElement(BU.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tIe(t){let{routeContext:e,match:r,children:n}=t,i=mt.useContext(UE);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),mt.createElement(cu.Provider,{value:e},n)}function rIe(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,o=(i=r)==null?void 0:i.errors;if(o!=null){let l=s.findIndex(d=>d.route.id&&(o==null?void 0:o[d.route.id])!==void 0);l>=0||mr(!1),s=s.slice(0,Math.min(s.length,l+1))}let u=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let l=0;l<s.length;l++){let d=s[l];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=l),d.route.id){let{loaderData:f,errors:p}=r,h=d.route.loader&&f[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||h){u=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((l,d,f)=>{let p,h=!1,m=null,y=null;r&&(p=o&&d.route.id?o[d.route.id]:void 0,m=d.route.errorElement||QNe,u&&(c<0&&f===0?(h=!0,y=null):c===f&&(h=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(s.slice(0,f+1)),b=()=>{let _;return p?_=m:h?_=y:d.route.Component?_=mt.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=l,mt.createElement(tIe,{match:d,routeContext:{outlet:l,matches:g,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?mt.createElement(eIe,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:b(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):b()},null)}var jU=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(jU||{}),Ng=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ng||{});function nIe(t){let e=mt.useContext(UE);return e||mr(!1),e}function iIe(t){let e=mt.useContext(WNe);return e||mr(!1),e}function aIe(t){let e=mt.useContext(cu);return e||mr(!1),e}function $U(t){let e=aIe(),r=e.matches[e.matches.length-1];return r.route.id||mr(!1),r.route.id}function sIe(){var t;let e=mt.useContext(BU),r=iIe(Ng.UseRouteError),n=$U(Ng.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function oIe(){let{router:t}=nIe(jU.UseNavigateStable),e=$U(Ng.UseNavigateStable),r=mt.useRef(!1);return LU(()=>{r.current=!0}),mt.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Bp({fromRouteId:e},a)))},[t,e])}const wI={};function uIe(t,e){wI[e]||(wI[e]=!0,console.warn(e))}const Rc=(t,e,r)=>uIe(t,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+t+"` future flag to opt-in early. ")+("For more information, see "+r+"."));function V9e(t,e){t!=null&&t.v7_startTransition||Rc("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),!(t!=null&&t.v7_relativeSplatPath)&&(!e||!e.v7_relativeSplatPath)&&Rc("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist||Rc("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod||Rc("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration||Rc("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation||Rc("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function Z9e(t){return GNe(t.context)}function cIe(t){mr(!1)}function H9e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=cn.Pop,navigator:a,static:s=!1,future:o}=t;Yy()&&mr(!1);let u=e.replace(/^\/*/,"/"),c=mt.useMemo(()=>({basename:u,navigator:a,static:s,future:Bp({v7_relativeSplatPath:!1},o)}),[u,o,a,s]);typeof n=="string"&&(n=so(n));let{pathname:l="/",search:d="",hash:f="",state:p=null,key:h="default"}=n,m=mt.useMemo(()=>{let y=_h(l,u);return y==null?null:{location:{pathname:y,search:d,hash:f,state:p,key:h},navigationType:i}},[u,l,d,f,p,h,i]);return m==null?null:mt.createElement(Hy.Provider,{value:c},mt.createElement(Wy.Provider,{children:r,value:m}))}new Promise(()=>{});function B_(t,e){e===void 0&&(e=[]);let r=[];return mt.Children.forEach(t,(n,i)=>{if(!mt.isValidElement(n))return;let a=[...e,i];if(n.type===mt.Fragment){r.push.apply(r,B_(n.props.children,a));return}n.type!==cIe&&mr(!1),!n.props.index||!n.props.children||mr(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=B_(n.props.children,a)),r.push(s)}),r}function lIe(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:mt.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:mt.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:mt.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function W9e(t,e){return ANe({basename:e==null?void 0:e.basename,future:Bp({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:GAe({initialEntries:e==null?void 0:e.initialEntries,initialIndex:e==null?void 0:e.initialIndex}),hydrationData:e==null?void 0:e.hydrationData,routes:t,mapRouteProperties:lIe,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation}).initialize()}function dIe(){const[t]=U_(),{analytics:e}=t;vi(()=>{const r=Er();if(!e){r&&r.close();return}if(r||!ks.sentry.dsn||ks.sentry.dsn==="")return;const n=window.__VITE_ENVS.SENTRY_RELEASE,i=[Tk(),xk({depth:5}),Nae(),wk({levels:["error"]})];ks.sentry.tracing&&i.push(rse({useEffect:Us.useEffect,useLocation:zE,useNavigationType:YNe,createRoutesFromChildren:B_,matchRoutes:To})),Wae({release:n,dsn:ks.sentry.dsn,environment:ks.sentry.env,integrations:i,ignoreErrors:["User is not allowed to create files","User is not allowed to move documents","The user aborted a request."],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(a,s){const o=s.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:a}})},[e])}const fIe=({children:t})=>(dIe(),t);function _I(...t){var e;(e=window.dataLayer)==null||e.push(...t)}const pIe=()=>{const[{gaTrackingId:t}]=BE(),[{analytics:e}]=U_(),r=t&&e;return vi(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],_I("js",new Date),_I("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null},hIe=Us.lazy(async()=>({default:await(await xf(()=>import("./router-0g625aul.js").then(r=>r.r),__vite__mapDeps([5,1,2,3]))).default()})),mIe=()=>{for(const t of Object.values(PDe))Up(t);return null},gIe=()=>et(Us.StrictMode,{children:et(mz,{fallback:et(xI,{}),children:Yr(Uz,{store:Fp,children:[et(mIe,{}),et(uz,{children:et(fIe,{children:et(KAe,{children:Yr(cz,{children:[et(lz,{position:"bottom-right"}),Yr(qAe,{children:[et(hIe,{}),et(ZAe,{}),et(pIe,{})]})]})})})})]})})}),Y9e=Object.freeze(Object.defineProperty({__proto__:null,default:gIe},Symbol.toStringTag,{value:"Module"}));export{WDe as $,TIe as A,$n as B,Up as C,UE as D,k_ as E,BI as F,PAe as G,Vy as H,nAe as I,RE as J,HDe as K,B9e as L,xU as M,RDe as N,Z9e as O,fAe as P,Xo as Q,H9e as R,dAe as S,sq as T,Du as U,t_ as V,II as W,z9e as X,ADe as Y,L9e as Z,pAe as _,U9e as a,xAe as a0,sj as a1,h8e as a2,kn as a3,Vr as a4,t5e as a5,ai as a6,ume as a7,kp as a8,G as a9,NDe as aa,My as ab,nue as ac,Tue as ad,j8e as ae,Kj as af,qy as ag,Rp as ah,x8e as ai,Gj as aj,e$ as ak,Zl as al,Xj as am,Qj as an,Y9e as ao,WNe as b,q9e as c,ANe as d,$9e as e,W9e as f,SIe as g,$p as h,yAe as i,Cn as j,nc as k,V9e as l,lIe as m,PE as n,gAe as o,j9e as p,wU as q,BE as r,La as s,SU as t,zE as u,FE as v,FDe as w,Xe as x,Ooe as y,sR as z};
1207
+ //# sourceMappingURL=app-CEjUVP0-.js.map