@powerhousedao/connect 6.0.0-dev.46 → 6.0.0-dev.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddDriveModal-Q54uyCBz.js → AddDriveModal-BYfZzMIC.js} +1 -1
- package/dist/assets/{ClearStorageModal-DbETjfeJ.js → ClearStorageModal-DFZ-m6f-.js} +1 -1
- package/dist/assets/{CookiesPolicyModal-C8uEPVS4.js → CookiesPolicyModal-Cj5Xl9jN.js} +1 -1
- package/dist/assets/{DebugSettingsModal-B6jhZFMW.js → DebugSettingsModal-CkP1JPUx.js} +1 -1
- package/dist/assets/{DeleteDriveModal-DpLhxvJU.js → DeleteDriveModal-CyvW_Fxo.js} +1 -1
- package/dist/assets/{DeleteItemModal--MaJM3aA.js → DeleteItemModal-IjQJN5Ta.js} +1 -1
- package/dist/assets/{DisclaimerModal-QPOBOirM.js → DisclaimerModal-DOQ36Dok.js} +1 -1
- package/dist/assets/{ExportDocumentWithErrorsModal-C6nRzNv-.js → ExportDocumentWithErrorsModal-CouuHIrQ.js} +1 -1
- package/dist/assets/{SettingsModal-CYMY7zsG.js → SettingsModal-DpeJc9tM.js} +1 -1
- package/dist/assets/{UpgradeDriveModal-ChhEaSso.js → UpgradeDriveModal-DQ9hGANt.js} +1 -1
- package/dist/assets/{index-BvbrhGUL.js → index-BsJNDFx7.js} +3 -3
- package/dist/index.html +1 -1
- package/lib/package.copy.json +2 -2
- package/lib/src/pglite.db.d.ts +1 -1
- package/lib/src/pglite.db.d.ts.map +1 -1
- package/lib/src/pglite.db.js +1 -1
- package/lib/src/pglite.db.js.map +1 -1
- package/lib/src/pglite.worker.js +1 -1
- package/lib/src/pglite.worker.js.map +1 -1
- package/lib/src/store/processor-host-module.d.ts +1 -1
- package/lib/src/store/processor-host-module.d.ts.map +1 -1
- package/lib/src/store/processor-host-module.js +1 -1
- package/lib/src/store/processor-host-module.js.map +1 -1
- package/lib/src/store/reactor.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.copy.json +2 -2
- package/package.json +12 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sentry_react-CVx4Qq7f.js","assets/react-D_vzfE_e.js","assets/sentry_browser-TIBDlywD.js","assets/AddDriveModal-
|
|
2
|
-
import{o as Fe,f as oo,s as ie,g as io,n as zi,h as Gi,j as R,i as Yi}from"./document_model_editor-BAQgvoKN.js";import{r as qi}from"./react-dom/client-SoBEzBdt.js";import{r as g,R as Ji,a as Xi}from"./sentry_react-CVx4Qq7f.js";import{$ as so,l as Ze,S as _n,R as Zi,Y as Qi,X as es,a0 as er,j as lo,h as co}from"./document_model-ly1Z8uco.js";import{_ as ge,G as uo}from"./drive_explorer-nRFwqJAw.js";import{t as ts,c as fo,H as ho,A as rs,W as ns,d as as,e as os,f as is,g as ss,h as ls,i as cs,j as us,k as ds,S as fs,l as hs}from"./design_system_connect-f0RXCh0R.js";import{A as po,B as yn,W as ps,R as gs,C as ms,D as Es,E as vs,K as go,P as mo,F as ur,y as Ge,H as _s,l as ys,J as Cs,L as Ss,g as on,M as Ns,N as Eo,O as vo,T as Rs,U as ws,V as bs,X as Ls,Y as Os,i as xs,Z as Ds,_ as Ps,$ as As,a0 as Ts,a1 as Is,a2 as ks,a3 as Ms,a4 as Hs,a5 as js,a6 as dr,a7 as Vn,a8 as Wn,a9 as _o,aa as Fs,ab as ce,ac as ye,ad as $,ae as pe,af as $s,ag as Bs,ah as Us,ai as Vs,aj as Ws,ak as Ks,al as zs,am as Gs,an as Ys,ao as qs,ap as Js,aq as Xs,ar as Zs,as as Qs,at as el,au as tl,av as rl,aw as nl,ax as al,ay as ol,az as il,aA as sl,s as fr,aB as ll,aC as Kn,aD as cl,aE as yo,d as Co,aF as ul,aG as dl,aH as fl,aI as So,aJ as hl,aK as pl,aL as gl,aM as ml}from"./reactor_browser-Cq7Q4foD.js";import{I as zn,l as El}from"./design_system-ChgkHQcK.js";import{g as vl,r as _l}from"./graphql_request-BHyPFzlZ.js";import{g as yl,r as Cl}from"./react-D_vzfE_e.js";import{o as tr}from"./document_drive-DiwReQ7A.js";import{an as Sl}from"./sentry_browser-TIBDlywD.js";import"./graphql-BXSeDpaV.js";import"./react/jsx-runtime-DldvXD6N.js";import"./zod-Cc38s6JG.js";import"./tailwind_merge-CXl88Wxt.js";import"./react-dom-Cz_KAjfm.js";import"./design_system_ui-Lpzxckn7.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(a){if(a.ep)return;a.ep=!0;const o=r(a);fetch(a.href,o)}})();var Nl=qi();const ee=oo([Gi(),io(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),hr=oo([zi(),ie()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),Rl=Fe({PH_CONFIG_PATH:ie().optional(),PH_PACKAGES:ie().optional(),PH_LOCAL_PACKAGE:ie().optional(),PH_DISABLE_LOCAL_PACKAGE:ee.default(!1),PH_WATCH_TIMEOUT:hr.default(300),PH_SENTRY_AUTH_TOKEN:ie().optional(),PH_SENTRY_ORG:ie().optional(),PH_SENTRY_PROJECT:ie().optional()}),wl=Fe({PH_CONNECT_VERSION:ie().default("unknown"),PH_CONNECT_LOG_LEVEL:io(["debug","info","warn","error"]).default("info"),PH_CONNECT_REQUIRES_HARD_REFRESH:ee.default(!0),PH_CONNECT_WARN_OUTDATED_APP:ee.default(!1),PH_CONNECT_STUDIO_MODE:ee.default(!1),PH_CONNECT_BASE_PATH:ie().optional(),PH_CONNECT_DEFAULT_DRIVES_URL:ie().optional(),PH_CONNECT_DRIVES_PRESERVE_STRATEGY:ie().optional(),PH_CONNECT_VERSION_CHECK_INTERVAL:hr.default(3600*1e3),PH_CONNECT_CLI_VERSION:ie().optional(),PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:hr.default(50)}),bl=Fe({PH_CONNECT_DISABLE_ADD_DRIVE:ee.default(!1),PH_CONNECT_SEARCH_BAR_ENABLED:ee.default(!1),PH_CONNECT_INSPECTOR_ENABLED:ee.default(!1),PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:ee.default(!0),PH_CONNECT_ENABLED_EDITORS:ie().optional(),PH_CONNECT_DISABLED_EDITORS:ie().default("powerhouse/document-drive"),PH_CONNECT_GA_TRACKING_ID:ie().optional(),PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:ee.default(!1)}),Ll=Fe({PH_CONNECT_PUBLIC_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_CLOUD_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_LOCAL_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:ee.default(!1)}),Ol=Fe({PH_CONNECT_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_ANALYTICS_DATABASE_NAME:ie().optional(),PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:ee.default(!0),PH_CONNECT_DIFF_ANALYTICS_ENABLED:ee.default(!1),PH_CONNECT_DRIVE_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:ee.default(!0)}),xl=Fe({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0)}),Dl=Fe({PH_CONNECT_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ee.default(!0)}),Pl=Dl.merge(Ol).merge(xl),Al=Fe({PH_CONNECT_SENTRY_RELEASE:ie().optional(),PH_CONNECT_SENTRY_DSN:ie().optional(),PH_CONNECT_SENTRY_ENV:ie().default("dev"),PH_CONNECT_SENTRY_TRACING_ENABLED:ee.default(!1)}),Tl=Fe({PH_CONNECT_RENOWN_URL:ie().default("https://www.renown.id"),PH_CONNECT_RENOWN_NETWORK_ID:ie().default("eip155"),PH_CONNECT_RENOWN_CHAIN_ID:hr.default(1)}),ir=wl.merge(bl).merge(Ll).merge(Pl).merge(Al).merge(Tl);Rl.merge(ir);function Il(t,e,r){const{processEnv:n={},optionsEnv:a={},fileEnv:o={}}=t,i={};for(const s of e){const l=[{name:"process.env",value:n[s]},{name:"options",value:a[s]},{name:"fileEnv",value:o[s]}];for(const c of l){const u=c.value;if(!(u===void 0||u===""))try{const d=r.shape[s];if(d){d.parse(u),i[s]=u;break}console.warn(`Unknown environment variable: '${s}'`),i[s]=u;break}catch{const d=u===null?"null":typeof u=="object"?JSON.stringify(u):u;console.warn(`Invalid value for ${s} from ${c.name}: ${d}. Trying next source.`)}}}return i}function kl(t={}){const e=new Set(Object.keys(ir.shape)),r=Il(t,e,ir);return ir.parse(r)}function Ml(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const Hl={BASE_URL:"/",DEV:!1,MODE:"production",PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:"true",PH_CONNECT_ANALYTICS_ENABLED:"true",PH_CONNECT_CLOUD_DRIVES_ENABLED:"true",PH_CONNECT_DIFF_ANALYTICS_ENABLED:"false",PH_CONNECT_DISABLED_EDITORS:"powerhouse/document-drive",PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_ADD_DRIVE:"false",PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:"false",PH_CONNECT_DRIVE_ANALYTICS_ENABLED:"true",PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:"false",PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:"50",PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:"true",PH_CONNECT_INSPECTOR_ENABLED:"false",PH_CONNECT_LOCAL_DRIVES_ENABLED:"true",PH_CONNECT_LOG_LEVEL:"info",PH_CONNECT_PROCESSORS_ENABLED:"true",PH_CONNECT_PUBLIC_DRIVES_ENABLED:"true",PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_RENOWN_CHAIN_ID:"1",PH_CONNECT_RENOWN_NETWORK_ID:"eip155",PH_CONNECT_RENOWN_URL:"https://www.renown.id",PH_CONNECT_REQUIRES_HARD_REFRESH:"true",PH_CONNECT_SEARCH_BAR_ENABLED:"false",PH_CONNECT_SENTRY_ENV:"prod",PH_CONNECT_SENTRY_TRACING_ENABLED:"false",PH_CONNECT_STUDIO_MODE:"false",PH_CONNECT_VERSION:"6.0.0-dev.45",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},A=kl({processEnv:Hl});function jl(t){return t.endsWith("/")?t:t+"/"}function Fl(){const t=A.PH_CONNECT_BASE_PATH||"/",e=jl(t);return{basePath:t,routerBasename:e,allowList:void 0,allowedDocumentTypes:[],isDragAndDropEnabled:!0,isEditorDebugModeEnabled:!1,isEditorReadModeEnabled:!1,isExternalControlsEnabled:!1,version:A.PH_CONNECT_VERSION,logLevel:A.PH_CONNECT_LOG_LEVEL,requiresHardRefresh:A.PH_CONNECT_REQUIRES_HARD_REFRESH,warnOutdatedApp:A.PH_CONNECT_WARN_OUTDATED_APP,studioMode:A.PH_CONNECT_STUDIO_MODE,versionCheckInterval:A.PH_CONNECT_VERSION_CHECK_INTERVAL,cliVersion:A.PH_CONNECT_CLI_VERSION,fileUploadOperationsChunkSize:A.PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE,gaTrackingId:A.PH_CONNECT_GA_TRACKING_ID,defaultDrivesUrl:A.PH_CONNECT_DEFAULT_DRIVES_URL,drivesPreserveStrategy:A.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,enabledEditors:A.PH_CONNECT_ENABLED_EDITORS?.split(","),disabledEditors:A.PH_CONNECT_DISABLED_EDITORS.split(","),isExternalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED,isAnalyticsEnabled:A.PH_CONNECT_ANALYTICS_ENABLED,isAnalyticsExternalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&A.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,analyticsDatabaseName:A.PH_CONNECT_ANALYTICS_DATABASE_NAME,isRelationalProcessorsEnabled:A.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,isExternalRelationalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&A.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED,renownUrl:A.PH_CONNECT_RENOWN_URL,renownNetworkId:A.PH_CONNECT_RENOWN_NETWORK_ID,renownChainId:A.PH_CONNECT_RENOWN_CHAIN_ID,sentryRelease:A.PH_CONNECT_SENTRY_RELEASE,sentryDsn:A.PH_CONNECT_SENTRY_DSN,sentryEnv:A.PH_CONNECT_SENTRY_ENV,isDiffAnalyticsEnabled:A.PH_CONNECT_DIFF_ANALYTICS_ENABLED,isDriveAnalyticsEnabled:A.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,isPublicDrivesEnabled:A.PH_CONNECT_PUBLIC_DRIVES_ENABLED,isCloudDrivesEnabled:A.PH_CONNECT_CLOUD_DRIVES_ENABLED,isLocalDrivesEnabled:A.PH_CONNECT_LOCAL_DRIVES_ENABLED,isSentryTracingEnabled:A.PH_CONNECT_SENTRY_TRACING_ENABLED,isDocumentModelSelectionSettingsEnabled:!A.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,isAddDriveEnabled:!A.PH_CONNECT_DISABLE_ADD_DRIVE,isAddPublicDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,isDeletePublicDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES,isAddCloudDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,isDeleteCloudDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES,isAddLocalDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,isDeleteLocalDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES,isAnalyticsDatabaseWorkerEnabled:!A.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,isExternalPackagesEnabled:!A.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED}}const Rt=Fl(),$l={isExternalControlsEnabled:Rt.isExternalControlsEnabled},Bl={allowedDocumentTypes:Rt.allowedDocumentTypes,isDragAndDropEnabled:Rt.isDragAndDropEnabled};so(A.PH_CONNECT_LOG_LEVEL);Ze.debug("Setting log level to @level.",A.PH_CONNECT_LOG_LEVEL);const No=Ml(A.PH_CONNECT_BASE_PATH||"/"),Ul=A.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${No.replace(/\//g,"")}:analytics`,fe={appVersion:A.PH_CONNECT_VERSION,studioMode:A.PH_CONNECT_STUDIO_MODE,warnOutdatedApp:A.PH_CONNECT_WARN_OUTDATED_APP,appVersionCheckInterval:A.PH_CONNECT_VERSION_CHECK_INTERVAL,routerBasename:No,externalPackagesEnabled:!A.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED,processors:{enabled:A.PH_CONNECT_PROCESSORS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},analytics:{enabled:A.PH_CONNECT_ANALYTICS_ENABLED,databaseName:Ul,useWorker:!A.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,driveAnalyticsEnabled:A.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,diffProcessorEnabled:A.PH_CONNECT_DIFF_ANALYTICS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},relational:{enabled:A.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED},renown:{url:A.PH_CONNECT_RENOWN_URL,networkId:A.PH_CONNECT_RENOWN_NETWORK_ID,chainId:A.PH_CONNECT_RENOWN_CHAIN_ID},sentry:{release:A.PH_CONNECT_SENTRY_RELEASE,dsn:A.PH_CONNECT_SENTRY_DSN,env:A.PH_CONNECT_SENTRY_ENV,tracing:A.PH_CONNECT_SENTRY_TRACING_ENABLED},content:{showSearchBar:A.PH_CONNECT_SEARCH_BAR_ENABLED,showDocumentModelSelectionSetting:!A.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,inspectorEnabled:A.PH_CONNECT_INSPECTOR_ENABLED},drives:{addDriveEnabled:!A.PH_CONNECT_DISABLE_ADD_DRIVE,preserveStrategy:A.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,sections:{LOCAL:{enabled:A.PH_CONNECT_LOCAL_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES},CLOUD:{enabled:A.PH_CONNECT_CLOUD_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES},PUBLIC:{enabled:A.PH_CONNECT_PUBLIC_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES}}},gaTrackingId:A.PH_CONNECT_GA_TRACKING_ID,phCliVersion:A.PH_CONNECT_CLI_VERSION},Vl=fe.routerBasename,Ro=`${Vl}:acceptedCookies`,sn=new Set;let sr=Wl();function Wl(){try{const t=localStorage.getItem(Ro);return t?JSON.parse(t):{analytics:!1,marketing:!1,functional:!1}}catch{return{analytics:!1,marketing:!1,functional:!1}}}function Gn(){return sr}function Kl(t){sr=t(sr),localStorage.setItem(Ro,JSON.stringify(sr)),sn.forEach(e=>e())}function zl(t){return sn.add(t),()=>sn.delete(t)}const Cn=()=>[g.useSyncExternalStore(zl,Gn,Gn),Kl];async function Sn(){try{return(await ge(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Zp(t){const e=await Sn();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-added",n))}e.on("studio:external-package-added",n),e.send("studio:add-external-package",{name:t})})}async function Qp(t){const e=await Sn();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-removed",n))}e.on("studio:external-package-removed",n),e.send("studio:remove-external-package",{name:t})})}function Gl(){const t=g.useRef(void 0);g.useEffect(()=>{const e=async n=>{const a=window.ph?.vetraPackages||[],l=(await ge(()=>import(`${n.url}?t=${n.timestamp}`),[])).default.map(po),u=[...a.filter(d=>d.id==="powerhouse/common"),...l];yn(u)};async function r(){const n=await Sn();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(n=>Ze.error("@error",n)),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Yl="connect";function wt(t,e){const{type:r="default",containerId:n=Yl,...a}=e||{};return ts(t,{type:r,containerId:n,...a})}const V=t=>typeof t=="string",Pt=()=>{let t,e;const r=new Promise((n,a)=>{t=n,e=a});return r.resolve=t,r.reject=e,r},Yn=t=>t==null?"":""+t,ql=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Jl=/###/g,qn=t=>t&&t.indexOf("###")>-1?t.replace(Jl,"."):t,Jn=t=>!t||V(t),Ft=(t,e,r)=>{const n=V(e)?e.split("."):e;let a=0;for(;a<n.length-1;){if(Jn(t))return{};const o=qn(n[a]);!t[o]&&r&&(t[o]=new r),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++a}return Jn(t)?{}:{obj:t,k:qn(n[a])}},Xn=(t,e,r)=>{const{obj:n,k:a}=Ft(t,e,Object);if(n!==void 0||e.length===1){n[a]=r;return}let o=e[e.length-1],i=e.slice(0,e.length-1),s=Ft(t,i,Object);for(;s.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),s=Ft(t,i,Object),s?.obj&&typeof s.obj[`${s.k}.${o}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},Xl=(t,e,r,n)=>{const{obj:a,k:o}=Ft(t,e,Object);a[o]=a[o]||[],a[o].push(r)},pr=(t,e)=>{const{obj:r,k:n}=Ft(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Zl=(t,e,r)=>{const n=pr(t,r);return n!==void 0?n:pr(e,r)},wo=(t,e,r)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?V(t[n])||t[n]instanceof String||V(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):wo(t[n],e[n],r):t[n]=e[n]);return t},pt=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ql={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ec=t=>V(t)?t.replace(/[&<>"'\/]/g,e=>Ql[e]):t;class tc{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const rc=[" ",",","?","!",";"],nc=new tc(20),ac=(t,e,r)=>{e=e||"",r=r||"";const n=rc.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const a=nc.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!a.test(t);if(!o){const i=t.indexOf(r);i>0&&!a.test(t.substring(0,i))&&(o=!0)}return o},ln=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(r);let a=t;for(let o=0;o<n.length;){if(!a||typeof a!="object")return;let i,s="";for(let l=o;l<n.length;++l)if(l!==o&&(s+=r),s+=n[l],i=a[s],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<n.length-1)continue;o+=l-o+1;break}a=i}return a},$t=t=>t?.replace("_","-"),oc={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class gr{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||oc,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,a){return a&&!this.debug?null:(V(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new gr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new gr(this.logger,e)}}var Ae=new gr;class Dr{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const a=this.observers[n].get(r)||0;this.observers[n].set(r,a+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,o])=>{for(let i=0;i<o;i++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,o])=>{for(let i=0;i<o;i++)a.apply(a,[e,...r])})}}class Zn extends Dr{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,a={}){const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,r],n&&(Array.isArray(n)?s.push(...n):V(n)&&o?s.push(...n.split(o)):s.push(n)));const l=pr(this.data,s);return!l&&!r&&!n&&e.indexOf(".")>-1&&(e=s[0],r=s[1],n=s.slice(2).join(".")),l||!i||!V(n)?l:ln(this.data?.[e]?.[r],n,o)}addResource(e,r,n,a,o={silent:!1}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[e,r];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),a=r,r=s[1]),this.addNamespaces(r),Xn(this.data,s,a),o.silent||this.emit("added",e,r,n,a)}addResources(e,r,n,a={silent:!1}){for(const o in n)(V(n[o])||Array.isArray(n[o]))&&this.addResource(e,r,o,n[o],{silent:!0});a.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,a,o,i={silent:!1,skipCopy:!1}){let s=[e,r];e.indexOf(".")>-1&&(s=e.split("."),a=n,n=r,r=s[1]),this.addNamespaces(r);let l=pr(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),a?wo(l,n,o):l={...l,...n},Xn(this.data,s,l),i.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(a=>r[a]&&Object.keys(r[a]).length>0)}toJSON(){return this.data}}var bo={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,a){return t.forEach(o=>{e=this.processors[o]?.process(e,r,n,a)??e}),e}};const Lo=Symbol("i18next/PATH_KEY");function ic(){const t=[],e=Object.create(null);let r;return e.get=(n,a)=>(r?.revoke?.(),a===Lo?t:(t.push(a),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function mr(t,e){const{[Lo]:r}=t(ic());return r.join(e?.keySeparator??".")}const Qn={},Ur=t=>!V(t)&&typeof t!="boolean"&&typeof t!="number";class Er extends Dr{constructor(e,r={}){super(),ql(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ae.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){const n={...r};if(e==null)return!1;const a=this.resolve(e,n);if(a?.res===void 0)return!1;const o=Ur(a.res);return!(n.returnObjects===!1&&o)}extractFromKey(e,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=r.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!ac(e,n,a);if(i&&!s){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:V(o)?[o]:o};const c=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(a)}return{key:e,namespaces:V(o)?[o]:o}}translate(e,r,n){let a=typeof r=="object"?{...r}:r;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=mr(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]);const o=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:s,namespaces:l}=this.extractFromKey(e[e.length-1],a),c=l[l.length-1];let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const d=a.lng||this.language,h=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return h?o?{res:`${c}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:`${c}${u}${s}`:o?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:s;const f=this.resolve(e,a);let E=f?.res;const _=f?.usedKey||s,S=f?.exactUsedKey||s,y=["[object Number]","[object Function]","[object RegExp]"],w=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,N=a.count!==void 0&&!V(a.count),L=Er.hasDefaultValue(a),P=N?this.pluralResolver.getSuffix(d,a.count,a):"",m=a.ordinal&&N?this.pluralResolver.getSuffix(d,a.count,{ordinal:!1}):"",b=N&&!a.ordinal&&a.count===0,x=b&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${P}`]||a[`defaultValue${m}`]||a.defaultValue;let I=E;O&&!E&&L&&(I=x);const W=Ur(I),B=Object.prototype.toString.apply(I);if(O&&I&&W&&y.indexOf(B)<0&&!(V(w)&&Array.isArray(I))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,I,{...a,ns:l}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(f.res=G,f.usedParams=this.getUsedParamsDetails(a),f):G}if(i){const G=Array.isArray(I),q=G?[]:{},_e=G?S:_;for(const he in I)if(Object.prototype.hasOwnProperty.call(I,he)){const X=`${_e}${i}${he}`;L&&!E?q[he]=this.translate(X,{...a,defaultValue:Ur(x)?x[he]:void 0,joinArrays:!1,ns:l}):q[he]=this.translate(X,{...a,joinArrays:!1,ns:l}),q[he]===X&&(q[he]=I[he])}E=q}}else if(O&&V(w)&&Array.isArray(E))E=E.join(w),E&&(E=this.extendTranslation(E,e,a,n));else{let G=!1,q=!1;!this.isValidLookup(E)&&L&&(G=!0,E=x),this.isValidLookup(E)||(q=!0,E=s);const he=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&q?void 0:E,X=L&&x!==E&&this.options.updateMissing;if(q||G||X){if(this.logger.log(X?"updateKey":"missingKey",d,c,s,X?x:E),i){const se=this.resolve(s,{...a,keySeparator:!1});se&&se.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let te=[];const Te=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Te&&Te[0])for(let se=0;se<Te.length;se++)te.push(Te[se]);else this.options.saveMissingTo==="all"?te=this.languageUtils.toResolveHierarchy(a.lng||this.language):te.push(a.lng||this.language);const $e=(se,me,we)=>{const Be=L&&we!==E?we:he;this.options.missingKeyHandler?this.options.missingKeyHandler(se,c,me,Be,X,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(se,c,me,Be,X,a),this.emit("missingKey",se,c,me,E)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?te.forEach(se=>{const me=this.pluralResolver.getSuffixes(se,a);b&&a[`defaultValue${this.options.pluralSeparator}zero`]&&me.indexOf(`${this.options.pluralSeparator}zero`)<0&&me.push(`${this.options.pluralSeparator}zero`),me.forEach(we=>{$e([se],s+we,a[`defaultValue${we}`]||x)})}):$e(te,s,x))}E=this.extendTranslation(E,e,a,f,n),q&&E===s&&this.options.appendNamespaceToMissingKey&&(E=`${c}${u}${s}`),(q||G)&&this.options.parseMissingKeyHandler&&(E=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${s}`:s,G?E:void 0,a))}return o?(f.res=E,f.usedParams=this.getUsedParamsDetails(a),f):E}extendTranslation(e,r,n,a,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=V(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const d=e.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!V(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,n.lng||this.language||a.usedLng,n),l){const d=e.match(this.interpolator.nestingRegexp),h=d&&d.length;c<h&&(n.nest=!1)}!n.lng&&a&&a.res&&(n.lng=this.language||a.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>o?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,s=V(i)?[i]:i;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=bo.handle(s,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,a,o,i,s;return V(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(l,r),u=c.key;a=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=r.count!==void 0&&!V(r.count),f=h&&!r.ordinal&&r.count===0,E=r.context!==void 0&&(V(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(S=>{this.isValidLookup(n)||(s=S,!Qn[`${_[0]}-${S}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(Qn[`${_[0]}-${S}`]=!0,this.logger.warn(`key "${a}" for languages "${_.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(y=>{if(this.isValidLookup(n))return;i=y;const w=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(w,u,y,S,r);else{let N;h&&(N=this.pluralResolver.getSuffix(y,r.count,r));const L=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(r.ordinal&&N.indexOf(P)===0&&w.push(u+N.replace(P,this.options.pluralSeparator)),w.push(u+N),f&&w.push(u+L)),E){const m=`${u}${this.options.contextSeparator||"_"}${r.context}`;w.push(m),h&&(r.ordinal&&N.indexOf(P)===0&&w.push(m+N.replace(P,this.options.pluralSeparator)),w.push(m+N),f&&w.push(m+L))}}let O;for(;O=w.pop();)this.isValidLookup(n)||(o=O,n=this.getResource(y,S,O,r))}))})}),{res:n,usedKey:a,exactUsedKey:o,usedLng:i,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,a):this.resourceStore.getResource(e,r,n,a)}getUsedParamsDetails(e={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!V(e.replace);let a=n?e.replace:e;if(n&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!n){a={...a};for(const o of r)delete a[o]}return a}static hasDefaultValue(e){const r="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}}class ea{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ae.create("languageUtils")}getScriptPartFromCode(e){if(e=$t(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=$t(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(V(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;const a=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(a))&&(r=a)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;const a=this.getScriptPartFromCode(n);if(this.isSupportedCode(a))return r=a;const o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return r=o;r=this.options.supportedLngs.find(i=>{if(i===o)return i;if(!(i.indexOf("-")<0&&o.indexOf("-")<0)&&(i.indexOf("-")>0&&o.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===o||i.indexOf(o)===0&&o.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),a=[],o=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return V(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):V(e)&&o(this.formatLanguageCode(e)),n.forEach(i=>{a.indexOf(i)<0&&o(this.formatLanguageCode(i))}),a}}const ta={zero:0,one:1,two:2,few:3,many:4,other:5},ra={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class sc{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Ae.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){const n=$t(e==="dev"?"en":e),a=r.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ra;if(!e.match(/-|_/))return ra;const l=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(l,r)}return this.pluralRulesCache[o]=i,i}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(a=>`${r}${a}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((a,o)=>ta[a]-ta[o]).map(a=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,r,n={}){const a=this.getRule(e,n);return a?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}}const na=(t,e,r,n=".",a=!0)=>{let o=Zl(t,e,r);return!o&&a&&V(r)&&(o=ln(t,r,n),o===void 0&&(o=ln(e,r,n))),o},Vr=t=>t.replace(/\$/g,"$$$$");class lc{constructor(e={}){this.logger=Ae.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:a,prefix:o,prefixEscaped:i,suffix:s,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:E,nestingSuffixEscaped:_,nestingOptionsSeparator:S,maxReplaces:y,alwaysFormat:w}=e.interpolation;this.escape=r!==void 0?r:ec,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=o?pt(o):i||"{{",this.suffix=s?pt(s):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?pt(h):f||pt("$t("),this.nestingSuffix=E?pt(E):_||pt(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=y||1e3,this.alwaysFormat=w!==void 0?w:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,a){let o,i,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(f.indexOf(this.formatSeparator)<0){const y=na(r,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,n,{...a,...r,interpolationkey:f}):y}const E=f.split(this.formatSeparator),_=E.shift().trim(),S=E.join(this.formatSeparator).trim();return this.format(na(r,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),S,n,{...a,...r,interpolationkey:_})};this.resetRegExp();const u=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>Vr(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?Vr(this.escape(f)):Vr(f)}].forEach(f=>{for(s=0;o=f.regex.exec(e);){const E=o[1].trim();if(i=c(E),i===void 0)if(typeof u=="function"){const S=u(e,o,a);i=V(S)?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,E))i="";else if(d){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${E} for interpolating ${e}`),i="";else!V(i)&&!this.useRawValueToEscape&&(i=Yn(i));const _=f.safeValue(i);if(e=e.replace(o[0],_),d?(f.regex.lastIndex+=i.length,f.regex.lastIndex-=o[0].length):f.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,r,n={}){let a,o,i;const s=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;l=d[0],h=this.interpolate(h,i);const f=h.match(/'/g),E=h.match(/"/g);((f?.length??0)%2===0&&!E||E.length%2!==0)&&(h=h.replace(/'/g,'"'));try{i=JSON.parse(h),c&&(i={...c,...i})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${u}${h}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;a=this.nestingRegexp.exec(e);){let l=[];i={...n},i=i.replace&&!V(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(c!==-1&&(l=a[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),a[1]=a[1].slice(0,c)),o=r(s.call(this,a[1].trim(),i),i),o&&a[0]===e&&!V(o))return o;V(o)||(o=Yn(o)),o||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),o=""),l.length&&(o=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:a[1].trim()}),o.trim())),e=e.replace(a[0],o),this.regexp.lastIndex=0}return e}}const cc=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const a=n[1].substring(0,n[1].length-1);e==="currency"&&a.indexOf(":")<0?r.currency||(r.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?r.range||(r.range=a.trim()):a.split(";").forEach(i=>{if(i){const[s,...l]=i.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=s.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:r}},aa=t=>{const e={};return(r,n,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});const i=n+JSON.stringify(o);let s=e[i];return s||(s=t($t(n),a),e[i]=s),s(r)}},uc=t=>(e,r,n)=>t($t(r),n)(e);class dc{constructor(e={}){this.logger=Ae.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?aa:uc;this.formats={number:n((a,o)=>{const i=new Intl.NumberFormat(a,{...o});return s=>i.format(s)}),currency:n((a,o)=>{const i=new Intl.NumberFormat(a,{...o,style:"currency"});return s=>i.format(s)}),datetime:n((a,o)=>{const i=new Intl.DateTimeFormat(a,{...o});return s=>i.format(s)}),relativetime:n((a,o)=>{const i=new Intl.RelativeTimeFormat(a,{...o});return s=>i.format(s,o.range||"day")}),list:n((a,o)=>{const i=new Intl.ListFormat(a,{...o});return s=>i.format(s)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=aa(r)}format(e,r,n,a={}){const o=r.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(s=>s.indexOf(")")>-1)){const s=o.findIndex(l=>l.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,s)].join(this.formatSeparator)}return o.reduce((s,l)=>{const{formatName:c,formatOptions:u}=cc(l);if(this.formats[c]){let d=s;try{const h=a?.formatParams?.[a.interpolationkey]||{},f=h.locale||h.lng||a.locale||a.lng||n;d=this.formats[c](s,f,{...u,...a,...h})}catch(h){this.logger.warn(h)}return d}else this.logger.warn(`there was no format function for ${c}`);return s},e)}}const fc=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class hc extends Dr{constructor(e,r,n,a={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=Ae.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,a.backend,a)}queueLoad(e,r,n,a){const o={},i={},s={},l={};return e.forEach(c=>{let u=!0;r.forEach(d=>{const h=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?i[h]===void 0&&(i[h]=!0):(this.state[h]=1,u=!1,i[h]===void 0&&(i[h]=!0),o[h]===void 0&&(o[h]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(s[c]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){const a=e.split("|"),o=a[0],i=a[1];r&&this.emit("failedLoading",o,i,r),!r&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);const s={};this.queue.forEach(l=>{Xl(l.loaded,[o],i),fc(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{s[c]||(s[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{s[c][d]===void 0&&(s[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,a=0,o=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:a,wait:o,callback:i});return}this.readingCalls++;const s=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,a+1,o*2,i)},o);return}i(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const c=l(e,r);c&&typeof c.then=="function"?c.then(u=>s(null,u)).catch(s):s(null,c)}catch(c){s(c)}return}return l(e,r,s)}prepareLoading(e,r,n={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(r)&&(r=[r]);const o=this.queueLoad(e,r,n,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){const n=e.split("|"),a=n[0],o=n[1];this.read(a,o,"read",void 0,void 0,(i,s)=>{i&&this.logger.warn(`${r}loading namespace ${o} for language ${a} failed`,i),!i&&s&&this.logger.log(`${r}loaded namespace ${o} for language ${a}`,s),this.loaded(e,i,s)})}saveMissing(e,r,n,a,o,i={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...i,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,r,n,a,l):u=c(e,r,n,a),u&&typeof u.then=="function"?u.then(d=>s(null,d)).catch(s):s(null,u)}catch(u){s(u)}else c(e,r,n,a,s,l)}!e||!e[0]||this.store.addResource(e[0],r,n,a)}}}const oa=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),V(t[1])&&(e.defaultValue=t[1]),V(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ia=t=>(V(t.ns)&&(t.ns=[t.ns]),V(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),V(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),rr=()=>{},pc=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class Bt extends Dr{constructor(e={},r){if(super(),this.options=ia(e),this.services={},this.logger=Ae,this.modules={external:[]},pc(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=oa();this.options={...n,...this.options,...ia(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const a=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Ae.init(a(this.modules.logger),this.options):Ae.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=dc;const u=new ea(this.options);this.store=new Zn(this.options.resources,this.options);const d=this.services;d.logger=Ae,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new sc(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=a(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new lc(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new hc(a(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...E)=>{this.emit(f,...E)}),this.modules.languageDetector&&(d.languageDetector=a(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=a(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Er(this.services,this.options),this.translator.on("*",(f,...E)=>{this.emit(f,...E)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=rr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});const s=Pt(),l=()=>{const c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(d),r(u,d)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),s}loadResources(e,r=rr){let n=r;const a=V(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const o=[],i=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(c=>{c!=="cimode"&&o.indexOf(c)<0&&o.push(c)})};a?i(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload?.forEach?.(s=>i(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(e,r,n){const a=Pt();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=rr),this.services.backendConnector.reload(e,r,o=>{a.resolve(),n(o)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&bo.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;const n=Pt();this.emit("languageChanging",e);const a=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},o=(s,l)=>{l?this.isLanguageChangingTo===e&&(a(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(s,(...c)=>this.t(...c))},i=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const l=V(s)?s:s&&s[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(V(s)?[s]:s);c&&(this.language||a(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),n}getFixedT(e,r,n){const a=(o,i,...s)=>{let l;typeof i!="object"?l=this.options.overloadTranslationOptionHandler([o,i].concat(s)):l={...i},l.lng=l.lng||a.lng,l.lngs=l.lngs||a.lngs,l.ns=l.ns||a.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||a.keyPrefix);const c=this.options.keySeparator||".";let u;return l.keyPrefix&&Array.isArray(o)?u=o.map(d=>(typeof d=="function"&&(d=mr(d,{...this.options,...i})),`${l.keyPrefix}${c}${d}`)):(typeof o=="function"&&(o=mr(o,{...this.options,...i})),u=l.keyPrefix?`${l.keyPrefix}${c}${o}`:o),this.t(u,l)};return V(e)?a.lng=e:a.lngs=e,a.ns=r,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(s,l)=>{const c=this.services.backendConnector.state[`${s}|${l}`];return c===-1||c===0||c===2};if(r.precheck){const s=r.precheck(this,i);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!a||i(o,e)))}loadNamespaces(e,r){const n=Pt();return this.options.ns?(V(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{n.resolve(),r&&r(a)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){const n=Pt();V(e)&&(e=[e]);const a=this.options.preload||[],o=e.filter(i=>a.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=a.concat(o),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const o=a.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new ea(oa());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new Bt(e,r)}cloneInstance(e={},r=rr){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},o=new Bt(a);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){const s=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});o.store=new Zn(s,a),o.services.resourceStore=o.store}return o.translator=new Er(o.services,a),o.translator.on("*",(s,...l)=>{o.emit(s,...l)}),o.init(a,r),o.translator.options=a,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ve=Bt.createInstance();ve.createInstance=Bt.createInstance;ve.createInstance;ve.dir;ve.init;ve.loadResources;ve.reloadResources;ve.use;ve.changeLanguage;ve.getFixedT;const eg=ve.t;ve.exists;ve.setDefaultNamespace;ve.hasLoadedNamespace;ve.loadNamespaces;ve.loadLanguages;var Wr,sa;function gc(){return sa||(sa=1,Wr={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}),Wr}var mc=gc();const Ec=yl(mc);var vc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function la(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(Ec[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 a=new RegExp(vc),o=null;(o=a.exec(t))!==null;)if(o[0].trim())if(o[1]){var i=o[1].trim(),s=[i,""];i.indexOf("=")>-1&&(s=i.split("=")),e.attrs[s[0]]=s[1],a.lastIndex--}else o[2]&&(e.attrs[o[2]]=o[3].trim().substring(1,o[3].length-1));return e}var _c=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,yc=/^\s*$/,Cc=Object.create(null);function Oo(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 a in r)n.push(a+'="'+r[a]+'"');return n.length?" "+n.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(Oo,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Sc={parse:function(t,e){e||(e={}),e.components||(e.components=Cc);var r,n=[],a=[],o=-1,i=!1;if(t.indexOf("<")!==0){var s=t.indexOf("<");n.push({type:"text",content:s===-1?t:t.substring(0,s)})}return t.replace(_c,function(l,c){if(i){if(l!=="</"+r.name+">")return;i=!1}var u,d=l.charAt(1)!=="/",h=l.startsWith("<!--"),f=c+l.length,E=t.charAt(f);if(h){var _=la(l);return o<0?(n.push(_),n):((u=a[o]).children.push(_),n)}if(d&&(o++,(r=la(l)).type==="tag"&&e.components[r.name]&&(r.type="component",i=!0),r.voidElement||i||!E||E==="<"||r.children.push({type:"text",content:t.slice(f,t.indexOf("<",f))}),o===0&&n.push(r),(u=a[o-1])&&u.children.push(r),a[o]=r),(!d||r.voidElement)&&(o>-1&&(r.voidElement||r.name===l.slice(2,-1))&&(o--,r=o===-1?n:a[o]),!i&&E!=="<"&&E)){u=o===-1?n:a[o].children;var S=t.indexOf("<",f),y=t.slice(f,S===-1?void 0:S);yc.test(y)&&(y=" "),(S>-1&&o+u.length>=0||y!==" ")&&u.push({type:"text",content:y})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+Oo("",r)},"")}};const lr=(t,e,r,n)=>{const a=[r,{code:e,...n||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);Le(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...a):console?.warn&&console.warn(...a)},ca={},Pr=(t,e,r,n)=>{Le(r)&&ca[r]||(Le(r)&&(ca[r]=new Date),lr(t,e,r,n))},xo=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},cn=(t,e,r)=>{t.loadNamespaces(e,xo(t,r))},ua=(t,e,r,n)=>{if(Le(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return cn(t,r,n);r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,xo(t,n))},Nc=(t,e,r={})=>!e.languages||!e.languages.length?(Pr(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,t))return!1}}),Le=t=>typeof t=="string",Ye=t=>typeof t=="object"&&t!==null,Rc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,wc={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},bc=t=>wc[t],Lc=t=>t.replace(Rc,bc);let un={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Lc};const Oc=(t={})=>{un={...un,...t}},Do=()=>un;let Po;const xc=t=>{Po=t},Nn=()=>Po,Kr=(t,e)=>{if(!t)return!1;const r=t.props?.children??t.children;return e?r.length>0:!!r},zr=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?_t(e):e},Dc=t=>Array.isArray(t)&&t.every(g.isValidElement),_t=t=>Array.isArray(t)?t:[t],Pc=(t,e)=>{const r={...e};return r.props=Object.assign(t.props,e.props),r},Ao=(t,e,r,n)=>{if(!t)return"";let a="";const o=_t(t),i=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((s,l)=>{if(Le(s)){a+=`${s}`;return}if(g.isValidElement(s)){const{props:c,type:u}=s,d=Object.keys(c).length,h=i.indexOf(u)>-1,f=c.children;if(!f&&h&&!d){a+=`<${u}/>`;return}if(!f&&(!h||d)||c.i18nIsDynamicList){a+=`<${l}></${l}>`;return}if(h&&d===1&&Le(f)){a+=`<${u}>${f}</${u}>`;return}const E=Ao(f,e,r,n);a+=`<${l}>${E}</${l}>`;return}if(s===null){lr(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(Ye(s)){const{format:c,...u}=s,d=Object.keys(u);if(d.length===1){const h=c?`${d[0]}, ${c}`:d[0];a+=`{{${h}}}`;return}lr(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:s});return}lr(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:s})}),a},Ac=(t,e=[],r={})=>{if(!t)return t;const n=Object.keys(r),a=[...e,...n];let o="",i=0;for(;i<t.length;)if(t[i]==="<"){let s=!1;const l=t.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9-]*)>/);if(l){const c=l[1];(/^\d+$/.test(c)||a.includes(c))&&(s=!0,o+=l[0],i+=l[0].length)}if(!s){const c=t.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const u=c[1];(/^\d+$/.test(u)||a.includes(u))&&(s=!0,o+=c[0],i+=c[0].length)}}s||(o+="<",i+=1)}else o+=t[i],i+=1;return o},Tc=(t,e,r,n,a,o,i)=>{if(r==="")return[];const s=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(s.map(w=>`<${w}`).join("|")).test(r);if(!t&&!e&&!l&&!i)return[r];const c=e??{},u=w=>{_t(w).forEach(N=>{Le(N)||(Kr(N)?u(zr(N)):Ye(N)&&!g.isValidElement(N)&&Object.assign(c,N))})};u(t);const d=Ac(r,s,c),h=Sc.parse(`<0>${d}</0>`),f={...c,...o},E=(w,O,N)=>{const L=zr(w),P=S(L,O.children,N);return Dc(L)&&P.length===0||w.props?.i18nIsDynamicList?L:P},_=(w,O,N,L,P)=>{w.dummy?(w.children=O,N.push(g.cloneElement(w,{key:L},P?void 0:O))):N.push(...g.Children.map([w],m=>{const b={...m.props};return delete b.i18nIsDynamicList,g.createElement(m.type,{...b,key:L,ref:m.props.ref??m.ref},P?null:O)}))},S=(w,O,N)=>{const L=_t(w);return _t(O).reduce((m,b,x)=>{const I=b.children?.[0]?.content&&n.services.interpolator.interpolate(b.children[0].content,f,n.language);if(b.type==="tag"){let W=L[parseInt(b.name,10)];!W&&e&&(W=e[b.name]),N.length===1&&!W&&(W=N[0][b.name]),W||(W={});const B=Object.keys(b.attrs).length!==0?Pc({props:b.attrs},W):W,G=g.isValidElement(B),q=G&&Kr(b,!0)&&!b.voidElement,_e=l&&Ye(B)&&B.dummy&&!G,he=Ye(e)&&Object.hasOwnProperty.call(e,b.name);if(Le(B)){const X=n.services.interpolator.interpolate(B,f,n.language);m.push(X)}else if(Kr(B)||q){const X=E(B,b,N);_(B,X,m,x)}else if(_e){const X=S(L,b.children,N);_(B,X,m,x)}else if(Number.isNaN(parseFloat(b.name)))if(he){const X=E(B,b,N);_(B,X,m,x,b.voidElement)}else if(a.transSupportBasicHtmlNodes&&s.indexOf(b.name)>-1)if(b.voidElement)m.push(g.createElement(b.name,{key:`${b.name}-${x}`}));else{const X=S(L,b.children,N);m.push(g.createElement(b.name,{key:`${b.name}-${x}`},X))}else if(b.voidElement)m.push(`<${b.name} />`);else{const X=S(L,b.children,N);m.push(`<${b.name}>${X}</${b.name}>`)}else if(Ye(B)&&!G){const X=b.children[0]?I:null;X&&m.push(X)}else _(B,I,m,x,b.children.length!==1||!I)}else if(b.type==="text"){const W=a.transWrapTextNodes,B=i?a.unescape(n.services.interpolator.interpolate(b.content,f,n.language)):n.services.interpolator.interpolate(b.content,f,n.language);W?m.push(g.createElement(W,{key:`${b.name}-${x}`},B)):m.push(B)}return m},[])},y=S([{dummy:!0,children:t||[]}],h,_t(t||[]));return zr(y[0])},To=(t,e,r)=>{const n=t.key||e,a=g.cloneElement(t,{key:n});if(!a.props||!a.props.children||r.indexOf(`${e}/>`)<0&&r.indexOf(`${e} />`)<0)return a;function o(){return g.createElement(g.Fragment,null,a)}return g.createElement(o,{key:n})},Ic=(t,e)=>t.map((r,n)=>To(r,n,e)),kc=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:To(t[n],n,e)})}),r},Mc=(t,e,r,n)=>t?Array.isArray(t)?Ic(t,e):Ye(t)?kc(t,e):(Pr(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,Hc=t=>!Ye(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function jc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const E=u||Nn();if(!E)return Pr(E,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const _=d||E.t.bind(E)||(q=>q),S={...Do(),...E.options?.react};let y=c||_.ns||E.options?.defaultNS;y=Le(y)?[y]:y||["translation"];const w=Ao(t,S,E,n),O=s||o?.defaultValue||w||S.transEmptyNodeValue||(typeof n=="function"?mr(n):n),{hashTransKey:N}=S,L=n||(N?N(w||O):w||O);E.options?.interpolation?.defaultVariables&&(i=i&&Object.keys(i).length>0?{...i,...E.options.interpolation.defaultVariables}:{...E.options.interpolation.defaultVariables});const P=i||e!==void 0&&!E.options?.interpolation?.alwaysFormat||!t?o.interpolation:{interpolation:{...o.interpolation,prefix:"#$?",suffix:"?$#"}},m={...o,context:a||o.context,count:e,...i,...P,defaultValue:s||o?.defaultValue,ns:y};let b=L?_(L,m):O;b===L&&O&&(b=O);const x=Mc(l,b,E,n);let I=x||t,W=null;Hc(x)&&(W=x,I=t);const B=Tc(I,W,b,E,S,m,h),G=r??S.defaultTransParent;return G?g.createElement(G,f,B):B}const Fc={type:"3rdParty",init(t){Oc(t.options.react),xc(t)}},Io=g.createContext();class $c{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function Bc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const{i18n:E,defaultNS:_}=g.useContext(Io)||{},S=u||E||Nn(),y=d||S?.t.bind(S);return jc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o,values:i,defaults:s,components:l,ns:c||y?.ns||_||S?.options?.defaultNS,i18n:S,t:d,shouldUnescape:h,...f})}var Gr={exports:{}},Yr={};var da;function Uc(){if(da)return Yr;da=1;var t=Cl();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,o=t.useLayoutEffect,i=t.useDebugValue;function s(d,h){var f=h(),E=n({inst:{value:f,getSnapshot:h}}),_=E[0].inst,S=E[1];return o(function(){_.value=f,_.getSnapshot=h,l(_)&&S({inst:_})},[d,f,h]),a(function(){return l(_)&&S({inst:_}),d(function(){l(_)&&S({inst:_})})},[d]),i(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!r(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:s;return Yr.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Yr}var fa;function Vc(){return fa||(fa=1,Gr.exports=Uc()),Gr.exports}var Wc=Vc();const Kc=(t,e)=>Le(e)?e:Ye(e)&&Le(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,zc={t:Kc,ready:!1},Gc=()=>()=>{},ko=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:a}=g.useContext(Io)||{},o=r||n||Nn();o&&!o.reportNamespaces&&(o.reportNamespaces=new $c),o||Pr(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=g.useMemo(()=>({...Do(),...o?.options?.react,...e}),[o,e]),{useSuspense:s,keyPrefix:l}=i,c=g.useMemo(()=>{const N=a||o?.options?.defaultNS;return Le(N)?[N]:N||["translation"]},[t,a,o]);o?.reportNamespaces?.addUsedNamespaces?.(c);const u=g.useRef(0),d=g.useCallback(N=>{if(!o)return Gc;const{bindI18n:L,bindI18nStore:P}=i,m=()=>{u.current+=1,N()};return L&&o.on(L,m),P&&o.store.on(P,m),()=>{L&&L.split(" ").forEach(b=>o.off(b,m)),P&&P.split(" ").forEach(b=>o.store.off(b,m))}},[o,i]),h=g.useRef(),f=g.useCallback(()=>{if(!o)return zc;const N=!!(o.isInitialized||o.initializedStoreOnce)&&c.every(I=>Nc(I,o,i)),L=e.lng||o.language,P=u.current,m=h.current;if(m&&m.ready===N&&m.lng===L&&m.keyPrefix===l&&m.revision===P)return m;const x={t:o.getFixedT(L,i.nsMode==="fallback"?c:c[0],l),ready:N,lng:L,keyPrefix:l,revision:P};return h.current=x,x},[o,c,l,i,e.lng]),[E,_]=g.useState(0),{t:S,ready:y}=Wc.useSyncExternalStore(d,f,f);g.useEffect(()=>{if(o&&!y&&!s){const N=()=>_(L=>L+1);e.lng?ua(o,e.lng,c,N):cn(o,c,N)}},[o,e.lng,c,y,s,E]);const w=o||{},O=g.useMemo(()=>{const N=[S,w,y];return N.t=S,N.i18n=w,N.ready=y,N},[S,w,y]);if(o&&s&&!y)throw new Promise(N=>{const L=()=>N();e.lng?ua(o,e.lng,c,L):cn(o,c,L)});return O},Yc=()=>{const{t}=ko();return R.jsxs("div",{children:[R.jsx("p",{className:"font-medium",children:t("notifications.reloadApp")}),R.jsxs("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},qc=()=>{async function t(){const e=await ef();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;fe.studioMode||!fe.warnOutdatedApp?Ze.warn(`Connect is outdated:
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sentry_react-CVx4Qq7f.js","assets/react-D_vzfE_e.js","assets/sentry_browser-TIBDlywD.js","assets/AddDriveModal-BYfZzMIC.js","assets/document_model_editor-BAQgvoKN.js","assets/graphql-BXSeDpaV.js","assets/drive_explorer-nRFwqJAw.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-ly1Z8uco.js","assets/zod-Cc38s6JG.js","assets/design_system-ChgkHQcK.js","assets/tailwind_merge-CXl88Wxt.js","assets/react-dom-Cz_KAjfm.js","assets/reactor_browser-Cq7Q4foD.js","assets/document_drive-DiwReQ7A.js","assets/design_system_connect-f0RXCh0R.js","assets/design_system_ui-Lpzxckn7.js","assets/react-dom/client-SoBEzBdt.js","assets/graphql_request-BHyPFzlZ.js","assets/ClearStorageModal-DFZ-m6f-.js","assets/CookiesPolicyModal-Cj5Xl9jN.js","assets/CreateDocumentModal-ohHswNs9.js","assets/DebugSettingsModal-CkP1JPUx.js","assets/DeleteDriveModal-CyvW_Fxo.js","assets/DeleteItemModal-IjQJN5Ta.js","assets/DisclaimerModal-DOQ36Dok.js","assets/DriveSettingsModal-Diohqk0G.js","assets/ExportDocumentWithErrorsModal-CouuHIrQ.js","assets/SettingsModal-DpeJc9tM.js","assets/config-0mYxXHFp.js","assets/UpgradeDriveModal-DQ9hGANt.js","assets/index-B2VqKMxE.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Fe,f as oo,s as ie,g as io,n as zi,h as Gi,j as R,i as Yi}from"./document_model_editor-BAQgvoKN.js";import{r as qi}from"./react-dom/client-SoBEzBdt.js";import{r as g,R as Ji,a as Xi}from"./sentry_react-CVx4Qq7f.js";import{$ as so,l as Ze,S as _n,R as Zi,Y as Qi,X as es,a0 as er,j as lo,h as co}from"./document_model-ly1Z8uco.js";import{_ as ge,G as uo}from"./drive_explorer-nRFwqJAw.js";import{t as ts,c as fo,H as ho,A as rs,W as ns,d as as,e as os,f as is,g as ss,h as ls,i as cs,j as us,k as ds,S as fs,l as hs}from"./design_system_connect-f0RXCh0R.js";import{A as po,B as yn,W as ps,R as gs,C as ms,D as Es,E as vs,K as go,P as mo,F as ur,y as Ge,H as _s,l as ys,J as Cs,L as Ss,g as on,M as Ns,N as Eo,O as vo,T as Rs,U as ws,V as bs,X as Ls,Y as Os,i as xs,Z as Ds,_ as Ps,$ as As,a0 as Ts,a1 as Is,a2 as ks,a3 as Ms,a4 as Hs,a5 as js,a6 as dr,a7 as Vn,a8 as Wn,a9 as _o,aa as Fs,ab as ce,ac as ye,ad as $,ae as pe,af as $s,ag as Bs,ah as Us,ai as Vs,aj as Ws,ak as Ks,al as zs,am as Gs,an as Ys,ao as qs,ap as Js,aq as Xs,ar as Zs,as as Qs,at as el,au as tl,av as rl,aw as nl,ax as al,ay as ol,az as il,aA as sl,s as fr,aB as ll,aC as Kn,aD as cl,aE as yo,d as Co,aF as ul,aG as dl,aH as fl,aI as So,aJ as hl,aK as pl,aL as gl,aM as ml}from"./reactor_browser-Cq7Q4foD.js";import{I as zn,l as El}from"./design_system-ChgkHQcK.js";import{g as vl,r as _l}from"./graphql_request-BHyPFzlZ.js";import{g as yl,r as Cl}from"./react-D_vzfE_e.js";import{o as tr}from"./document_drive-DiwReQ7A.js";import{an as Sl}from"./sentry_browser-TIBDlywD.js";import"./graphql-BXSeDpaV.js";import"./react/jsx-runtime-DldvXD6N.js";import"./zod-Cc38s6JG.js";import"./tailwind_merge-CXl88Wxt.js";import"./react-dom-Cz_KAjfm.js";import"./design_system_ui-Lpzxckn7.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(a){if(a.ep)return;a.ep=!0;const o=r(a);fetch(a.href,o)}})();var Nl=qi();const ee=oo([Gi(),io(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),hr=oo([zi(),ie()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),Rl=Fe({PH_CONFIG_PATH:ie().optional(),PH_PACKAGES:ie().optional(),PH_LOCAL_PACKAGE:ie().optional(),PH_DISABLE_LOCAL_PACKAGE:ee.default(!1),PH_WATCH_TIMEOUT:hr.default(300),PH_SENTRY_AUTH_TOKEN:ie().optional(),PH_SENTRY_ORG:ie().optional(),PH_SENTRY_PROJECT:ie().optional()}),wl=Fe({PH_CONNECT_VERSION:ie().default("unknown"),PH_CONNECT_LOG_LEVEL:io(["debug","info","warn","error"]).default("info"),PH_CONNECT_REQUIRES_HARD_REFRESH:ee.default(!0),PH_CONNECT_WARN_OUTDATED_APP:ee.default(!1),PH_CONNECT_STUDIO_MODE:ee.default(!1),PH_CONNECT_BASE_PATH:ie().optional(),PH_CONNECT_DEFAULT_DRIVES_URL:ie().optional(),PH_CONNECT_DRIVES_PRESERVE_STRATEGY:ie().optional(),PH_CONNECT_VERSION_CHECK_INTERVAL:hr.default(3600*1e3),PH_CONNECT_CLI_VERSION:ie().optional(),PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:hr.default(50)}),bl=Fe({PH_CONNECT_DISABLE_ADD_DRIVE:ee.default(!1),PH_CONNECT_SEARCH_BAR_ENABLED:ee.default(!1),PH_CONNECT_INSPECTOR_ENABLED:ee.default(!1),PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:ee.default(!0),PH_CONNECT_ENABLED_EDITORS:ie().optional(),PH_CONNECT_DISABLED_EDITORS:ie().default("powerhouse/document-drive"),PH_CONNECT_GA_TRACKING_ID:ie().optional(),PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:ee.default(!1)}),Ll=Fe({PH_CONNECT_PUBLIC_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_CLOUD_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_LOCAL_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:ee.default(!1)}),Ol=Fe({PH_CONNECT_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_ANALYTICS_DATABASE_NAME:ie().optional(),PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:ee.default(!0),PH_CONNECT_DIFF_ANALYTICS_ENABLED:ee.default(!1),PH_CONNECT_DRIVE_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:ee.default(!0)}),xl=Fe({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0)}),Dl=Fe({PH_CONNECT_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ee.default(!0)}),Pl=Dl.merge(Ol).merge(xl),Al=Fe({PH_CONNECT_SENTRY_RELEASE:ie().optional(),PH_CONNECT_SENTRY_DSN:ie().optional(),PH_CONNECT_SENTRY_ENV:ie().default("dev"),PH_CONNECT_SENTRY_TRACING_ENABLED:ee.default(!1)}),Tl=Fe({PH_CONNECT_RENOWN_URL:ie().default("https://www.renown.id"),PH_CONNECT_RENOWN_NETWORK_ID:ie().default("eip155"),PH_CONNECT_RENOWN_CHAIN_ID:hr.default(1)}),ir=wl.merge(bl).merge(Ll).merge(Pl).merge(Al).merge(Tl);Rl.merge(ir);function Il(t,e,r){const{processEnv:n={},optionsEnv:a={},fileEnv:o={}}=t,i={};for(const s of e){const l=[{name:"process.env",value:n[s]},{name:"options",value:a[s]},{name:"fileEnv",value:o[s]}];for(const c of l){const u=c.value;if(!(u===void 0||u===""))try{const d=r.shape[s];if(d){d.parse(u),i[s]=u;break}console.warn(`Unknown environment variable: '${s}'`),i[s]=u;break}catch{const d=u===null?"null":typeof u=="object"?JSON.stringify(u):u;console.warn(`Invalid value for ${s} from ${c.name}: ${d}. Trying next source.`)}}}return i}function kl(t={}){const e=new Set(Object.keys(ir.shape)),r=Il(t,e,ir);return ir.parse(r)}function Ml(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const Hl={BASE_URL:"/",DEV:!1,MODE:"production",PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:"true",PH_CONNECT_ANALYTICS_ENABLED:"true",PH_CONNECT_CLOUD_DRIVES_ENABLED:"true",PH_CONNECT_DIFF_ANALYTICS_ENABLED:"false",PH_CONNECT_DISABLED_EDITORS:"powerhouse/document-drive",PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_ADD_DRIVE:"false",PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:"false",PH_CONNECT_DRIVE_ANALYTICS_ENABLED:"true",PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:"false",PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:"50",PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:"true",PH_CONNECT_INSPECTOR_ENABLED:"false",PH_CONNECT_LOCAL_DRIVES_ENABLED:"true",PH_CONNECT_LOG_LEVEL:"info",PH_CONNECT_PROCESSORS_ENABLED:"true",PH_CONNECT_PUBLIC_DRIVES_ENABLED:"true",PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_RENOWN_CHAIN_ID:"1",PH_CONNECT_RENOWN_NETWORK_ID:"eip155",PH_CONNECT_RENOWN_URL:"https://www.renown.id",PH_CONNECT_REQUIRES_HARD_REFRESH:"true",PH_CONNECT_SEARCH_BAR_ENABLED:"false",PH_CONNECT_SENTRY_ENV:"prod",PH_CONNECT_SENTRY_TRACING_ENABLED:"false",PH_CONNECT_STUDIO_MODE:"false",PH_CONNECT_VERSION:"6.0.0-dev.47",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},A=kl({processEnv:Hl});function jl(t){return t.endsWith("/")?t:t+"/"}function Fl(){const t=A.PH_CONNECT_BASE_PATH||"/",e=jl(t);return{basePath:t,routerBasename:e,allowList:void 0,allowedDocumentTypes:[],isDragAndDropEnabled:!0,isEditorDebugModeEnabled:!1,isEditorReadModeEnabled:!1,isExternalControlsEnabled:!1,version:A.PH_CONNECT_VERSION,logLevel:A.PH_CONNECT_LOG_LEVEL,requiresHardRefresh:A.PH_CONNECT_REQUIRES_HARD_REFRESH,warnOutdatedApp:A.PH_CONNECT_WARN_OUTDATED_APP,studioMode:A.PH_CONNECT_STUDIO_MODE,versionCheckInterval:A.PH_CONNECT_VERSION_CHECK_INTERVAL,cliVersion:A.PH_CONNECT_CLI_VERSION,fileUploadOperationsChunkSize:A.PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE,gaTrackingId:A.PH_CONNECT_GA_TRACKING_ID,defaultDrivesUrl:A.PH_CONNECT_DEFAULT_DRIVES_URL,drivesPreserveStrategy:A.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,enabledEditors:A.PH_CONNECT_ENABLED_EDITORS?.split(","),disabledEditors:A.PH_CONNECT_DISABLED_EDITORS.split(","),isExternalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED,isAnalyticsEnabled:A.PH_CONNECT_ANALYTICS_ENABLED,isAnalyticsExternalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&A.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,analyticsDatabaseName:A.PH_CONNECT_ANALYTICS_DATABASE_NAME,isRelationalProcessorsEnabled:A.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,isExternalRelationalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&A.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED,renownUrl:A.PH_CONNECT_RENOWN_URL,renownNetworkId:A.PH_CONNECT_RENOWN_NETWORK_ID,renownChainId:A.PH_CONNECT_RENOWN_CHAIN_ID,sentryRelease:A.PH_CONNECT_SENTRY_RELEASE,sentryDsn:A.PH_CONNECT_SENTRY_DSN,sentryEnv:A.PH_CONNECT_SENTRY_ENV,isDiffAnalyticsEnabled:A.PH_CONNECT_DIFF_ANALYTICS_ENABLED,isDriveAnalyticsEnabled:A.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,isPublicDrivesEnabled:A.PH_CONNECT_PUBLIC_DRIVES_ENABLED,isCloudDrivesEnabled:A.PH_CONNECT_CLOUD_DRIVES_ENABLED,isLocalDrivesEnabled:A.PH_CONNECT_LOCAL_DRIVES_ENABLED,isSentryTracingEnabled:A.PH_CONNECT_SENTRY_TRACING_ENABLED,isDocumentModelSelectionSettingsEnabled:!A.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,isAddDriveEnabled:!A.PH_CONNECT_DISABLE_ADD_DRIVE,isAddPublicDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,isDeletePublicDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES,isAddCloudDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,isDeleteCloudDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES,isAddLocalDrivesEnabled:!A.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,isDeleteLocalDrivesEnabled:!A.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES,isAnalyticsDatabaseWorkerEnabled:!A.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,isExternalPackagesEnabled:!A.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED}}const Rt=Fl(),$l={isExternalControlsEnabled:Rt.isExternalControlsEnabled},Bl={allowedDocumentTypes:Rt.allowedDocumentTypes,isDragAndDropEnabled:Rt.isDragAndDropEnabled};so(A.PH_CONNECT_LOG_LEVEL);Ze.debug("Setting log level to @level.",A.PH_CONNECT_LOG_LEVEL);const No=Ml(A.PH_CONNECT_BASE_PATH||"/"),Ul=A.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${No.replace(/\//g,"")}:analytics`,fe={appVersion:A.PH_CONNECT_VERSION,studioMode:A.PH_CONNECT_STUDIO_MODE,warnOutdatedApp:A.PH_CONNECT_WARN_OUTDATED_APP,appVersionCheckInterval:A.PH_CONNECT_VERSION_CHECK_INTERVAL,routerBasename:No,externalPackagesEnabled:!A.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED,processors:{enabled:A.PH_CONNECT_PROCESSORS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},analytics:{enabled:A.PH_CONNECT_ANALYTICS_ENABLED,databaseName:Ul,useWorker:!A.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,driveAnalyticsEnabled:A.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,diffProcessorEnabled:A.PH_CONNECT_DIFF_ANALYTICS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},relational:{enabled:A.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,externalProcessorsEnabled:A.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED},renown:{url:A.PH_CONNECT_RENOWN_URL,networkId:A.PH_CONNECT_RENOWN_NETWORK_ID,chainId:A.PH_CONNECT_RENOWN_CHAIN_ID},sentry:{release:A.PH_CONNECT_SENTRY_RELEASE,dsn:A.PH_CONNECT_SENTRY_DSN,env:A.PH_CONNECT_SENTRY_ENV,tracing:A.PH_CONNECT_SENTRY_TRACING_ENABLED},content:{showSearchBar:A.PH_CONNECT_SEARCH_BAR_ENABLED,showDocumentModelSelectionSetting:!A.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,inspectorEnabled:A.PH_CONNECT_INSPECTOR_ENABLED},drives:{addDriveEnabled:!A.PH_CONNECT_DISABLE_ADD_DRIVE,preserveStrategy:A.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,sections:{LOCAL:{enabled:A.PH_CONNECT_LOCAL_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES},CLOUD:{enabled:A.PH_CONNECT_CLOUD_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES},PUBLIC:{enabled:A.PH_CONNECT_PUBLIC_DRIVES_ENABLED,allowAdd:!A.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,allowDelete:!A.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES}}},gaTrackingId:A.PH_CONNECT_GA_TRACKING_ID,phCliVersion:A.PH_CONNECT_CLI_VERSION},Vl=fe.routerBasename,Ro=`${Vl}:acceptedCookies`,sn=new Set;let sr=Wl();function Wl(){try{const t=localStorage.getItem(Ro);return t?JSON.parse(t):{analytics:!1,marketing:!1,functional:!1}}catch{return{analytics:!1,marketing:!1,functional:!1}}}function Gn(){return sr}function Kl(t){sr=t(sr),localStorage.setItem(Ro,JSON.stringify(sr)),sn.forEach(e=>e())}function zl(t){return sn.add(t),()=>sn.delete(t)}const Cn=()=>[g.useSyncExternalStore(zl,Gn,Gn),Kl];async function Sn(){try{return(await ge(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Zp(t){const e=await Sn();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-added",n))}e.on("studio:external-package-added",n),e.send("studio:add-external-package",{name:t})})}async function Qp(t){const e=await Sn();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(a){t===a.name&&(r(),e?.off("studio:external-package-removed",n))}e.on("studio:external-package-removed",n),e.send("studio:remove-external-package",{name:t})})}function Gl(){const t=g.useRef(void 0);g.useEffect(()=>{const e=async n=>{const a=window.ph?.vetraPackages||[],l=(await ge(()=>import(`${n.url}?t=${n.timestamp}`),[])).default.map(po),u=[...a.filter(d=>d.id==="powerhouse/common"),...l];yn(u)};async function r(){const n=await Sn();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(n=>Ze.error("@error",n)),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Yl="connect";function wt(t,e){const{type:r="default",containerId:n=Yl,...a}=e||{};return ts(t,{type:r,containerId:n,...a})}const V=t=>typeof t=="string",Pt=()=>{let t,e;const r=new Promise((n,a)=>{t=n,e=a});return r.resolve=t,r.reject=e,r},Yn=t=>t==null?"":""+t,ql=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},Jl=/###/g,qn=t=>t&&t.indexOf("###")>-1?t.replace(Jl,"."):t,Jn=t=>!t||V(t),Ft=(t,e,r)=>{const n=V(e)?e.split("."):e;let a=0;for(;a<n.length-1;){if(Jn(t))return{};const o=qn(n[a]);!t[o]&&r&&(t[o]=new r),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={},++a}return Jn(t)?{}:{obj:t,k:qn(n[a])}},Xn=(t,e,r)=>{const{obj:n,k:a}=Ft(t,e,Object);if(n!==void 0||e.length===1){n[a]=r;return}let o=e[e.length-1],i=e.slice(0,e.length-1),s=Ft(t,i,Object);for(;s.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),s=Ft(t,i,Object),s?.obj&&typeof s.obj[`${s.k}.${o}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},Xl=(t,e,r,n)=>{const{obj:a,k:o}=Ft(t,e,Object);a[o]=a[o]||[],a[o].push(r)},pr=(t,e)=>{const{obj:r,k:n}=Ft(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Zl=(t,e,r)=>{const n=pr(t,r);return n!==void 0?n:pr(e,r)},wo=(t,e,r)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?V(t[n])||t[n]instanceof String||V(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):wo(t[n],e[n],r):t[n]=e[n]);return t},pt=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Ql={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const ec=t=>V(t)?t.replace(/[&<>"'\/]/g,e=>Ql[e]):t;class tc{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const rc=[" ",",","?","!",";"],nc=new tc(20),ac=(t,e,r)=>{e=e||"",r=r||"";const n=rc.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const a=nc.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!a.test(t);if(!o){const i=t.indexOf(r);i>0&&!a.test(t.substring(0,i))&&(o=!0)}return o},ln=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(r);let a=t;for(let o=0;o<n.length;){if(!a||typeof a!="object")return;let i,s="";for(let l=o;l<n.length;++l)if(l!==o&&(s+=r),s+=n[l],i=a[s],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<n.length-1)continue;o+=l-o+1;break}a=i}return a},$t=t=>t?.replace("_","-"),oc={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class gr{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||oc,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,a){return a&&!this.debug?null:(V(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new gr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new gr(this.logger,e)}}var Ae=new gr;class Dr{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const a=this.observers[n].get(r)||0;this.observers[n].set(r,a+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,o])=>{for(let i=0;i<o;i++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,o])=>{for(let i=0;i<o;i++)a.apply(a,[e,...r])})}}class Zn extends Dr{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,a={}){const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,r],n&&(Array.isArray(n)?s.push(...n):V(n)&&o?s.push(...n.split(o)):s.push(n)));const l=pr(this.data,s);return!l&&!r&&!n&&e.indexOf(".")>-1&&(e=s[0],r=s[1],n=s.slice(2).join(".")),l||!i||!V(n)?l:ln(this.data?.[e]?.[r],n,o)}addResource(e,r,n,a,o={silent:!1}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[e,r];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),a=r,r=s[1]),this.addNamespaces(r),Xn(this.data,s,a),o.silent||this.emit("added",e,r,n,a)}addResources(e,r,n,a={silent:!1}){for(const o in n)(V(n[o])||Array.isArray(n[o]))&&this.addResource(e,r,o,n[o],{silent:!0});a.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,a,o,i={silent:!1,skipCopy:!1}){let s=[e,r];e.indexOf(".")>-1&&(s=e.split("."),a=n,n=r,r=s[1]),this.addNamespaces(r);let l=pr(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),a?wo(l,n,o):l={...l,...n},Xn(this.data,s,l),i.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(a=>r[a]&&Object.keys(r[a]).length>0)}toJSON(){return this.data}}var bo={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,a){return t.forEach(o=>{e=this.processors[o]?.process(e,r,n,a)??e}),e}};const Lo=Symbol("i18next/PATH_KEY");function ic(){const t=[],e=Object.create(null);let r;return e.get=(n,a)=>(r?.revoke?.(),a===Lo?t:(t.push(a),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function mr(t,e){const{[Lo]:r}=t(ic());return r.join(e?.keySeparator??".")}const Qn={},Ur=t=>!V(t)&&typeof t!="boolean"&&typeof t!="number";class Er extends Dr{constructor(e,r={}){super(),ql(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ae.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){const n={...r};if(e==null)return!1;const a=this.resolve(e,n);if(a?.res===void 0)return!1;const o=Ur(a.res);return!(n.returnObjects===!1&&o)}extractFromKey(e,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=r.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!ac(e,n,a);if(i&&!s){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:V(o)?[o]:o};const c=e.split(n);(n!==a||n===a&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(a)}return{key:e,namespaces:V(o)?[o]:o}}translate(e,r,n){let a=typeof r=="object"?{...r}:r;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=mr(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]);const o=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:s,namespaces:l}=this.extractFromKey(e[e.length-1],a),c=l[l.length-1];let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const d=a.lng||this.language,h=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return h?o?{res:`${c}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:`${c}${u}${s}`:o?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(a)}:s;const f=this.resolve(e,a);let E=f?.res;const _=f?.usedKey||s,S=f?.exactUsedKey||s,y=["[object Number]","[object Function]","[object RegExp]"],w=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject,N=a.count!==void 0&&!V(a.count),L=Er.hasDefaultValue(a),P=N?this.pluralResolver.getSuffix(d,a.count,a):"",m=a.ordinal&&N?this.pluralResolver.getSuffix(d,a.count,{ordinal:!1}):"",b=N&&!a.ordinal&&a.count===0,x=b&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${P}`]||a[`defaultValue${m}`]||a.defaultValue;let I=E;O&&!E&&L&&(I=x);const W=Ur(I),B=Object.prototype.toString.apply(I);if(O&&I&&W&&y.indexOf(B)<0&&!(V(w)&&Array.isArray(I))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,I,{...a,ns:l}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(f.res=G,f.usedParams=this.getUsedParamsDetails(a),f):G}if(i){const G=Array.isArray(I),q=G?[]:{},_e=G?S:_;for(const he in I)if(Object.prototype.hasOwnProperty.call(I,he)){const X=`${_e}${i}${he}`;L&&!E?q[he]=this.translate(X,{...a,defaultValue:Ur(x)?x[he]:void 0,joinArrays:!1,ns:l}):q[he]=this.translate(X,{...a,joinArrays:!1,ns:l}),q[he]===X&&(q[he]=I[he])}E=q}}else if(O&&V(w)&&Array.isArray(E))E=E.join(w),E&&(E=this.extendTranslation(E,e,a,n));else{let G=!1,q=!1;!this.isValidLookup(E)&&L&&(G=!0,E=x),this.isValidLookup(E)||(q=!0,E=s);const he=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&q?void 0:E,X=L&&x!==E&&this.options.updateMissing;if(q||G||X){if(this.logger.log(X?"updateKey":"missingKey",d,c,s,X?x:E),i){const se=this.resolve(s,{...a,keySeparator:!1});se&&se.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let te=[];const Te=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Te&&Te[0])for(let se=0;se<Te.length;se++)te.push(Te[se]);else this.options.saveMissingTo==="all"?te=this.languageUtils.toResolveHierarchy(a.lng||this.language):te.push(a.lng||this.language);const $e=(se,me,we)=>{const Be=L&&we!==E?we:he;this.options.missingKeyHandler?this.options.missingKeyHandler(se,c,me,Be,X,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(se,c,me,Be,X,a),this.emit("missingKey",se,c,me,E)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?te.forEach(se=>{const me=this.pluralResolver.getSuffixes(se,a);b&&a[`defaultValue${this.options.pluralSeparator}zero`]&&me.indexOf(`${this.options.pluralSeparator}zero`)<0&&me.push(`${this.options.pluralSeparator}zero`),me.forEach(we=>{$e([se],s+we,a[`defaultValue${we}`]||x)})}):$e(te,s,x))}E=this.extendTranslation(E,e,a,f,n),q&&E===s&&this.options.appendNamespaceToMissingKey&&(E=`${c}${u}${s}`),(q||G)&&this.options.parseMissingKeyHandler&&(E=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${s}`:s,G?E:void 0,a))}return o?(f.res=E,f.usedParams=this.getUsedParamsDetails(a),f):E}extendTranslation(e,r,n,a,o){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=V(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const d=e.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!V(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,n.lng||this.language||a.usedLng,n),l){const d=e.match(this.interpolator.nestingRegexp),h=d&&d.length;c<h&&(n.nest=!1)}!n.lng&&a&&a.res&&(n.lng=this.language||a.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>o?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,s=V(i)?[i]:i;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=bo.handle(s,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,a,o,i,s;return V(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(l,r),u=c.key;a=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=r.count!==void 0&&!V(r.count),f=h&&!r.ordinal&&r.count===0,E=r.context!==void 0&&(V(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(S=>{this.isValidLookup(n)||(s=S,!Qn[`${_[0]}-${S}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(Qn[`${_[0]}-${S}`]=!0,this.logger.warn(`key "${a}" for languages "${_.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(y=>{if(this.isValidLookup(n))return;i=y;const w=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(w,u,y,S,r);else{let N;h&&(N=this.pluralResolver.getSuffix(y,r.count,r));const L=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(r.ordinal&&N.indexOf(P)===0&&w.push(u+N.replace(P,this.options.pluralSeparator)),w.push(u+N),f&&w.push(u+L)),E){const m=`${u}${this.options.contextSeparator||"_"}${r.context}`;w.push(m),h&&(r.ordinal&&N.indexOf(P)===0&&w.push(m+N.replace(P,this.options.pluralSeparator)),w.push(m+N),f&&w.push(m+L))}}let O;for(;O=w.pop();)this.isValidLookup(n)||(o=O,n=this.getResource(y,S,O,r))}))})}),{res:n,usedKey:a,exactUsedKey:o,usedLng:i,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,a):this.resourceStore.getResource(e,r,n,a)}getUsedParamsDetails(e={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!V(e.replace);let a=n?e.replace:e;if(n&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!n){a={...a};for(const o of r)delete a[o]}return a}static hasDefaultValue(e){const r="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}}class ea{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ae.create("languageUtils")}getScriptPartFromCode(e){if(e=$t(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=$t(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(V(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;const a=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(a))&&(r=a)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;const a=this.getScriptPartFromCode(n);if(this.isSupportedCode(a))return r=a;const o=this.getLanguagePartFromCode(n);if(this.isSupportedCode(o))return r=o;r=this.options.supportedLngs.find(i=>{if(i===o)return i;if(!(i.indexOf("-")<0&&o.indexOf("-")<0)&&(i.indexOf("-")>0&&o.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===o||i.indexOf(o)===0&&o.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),a=[],o=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return V(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):V(e)&&o(this.formatLanguageCode(e)),n.forEach(i=>{a.indexOf(i)<0&&o(this.formatLanguageCode(i))}),a}}const ta={zero:0,one:1,two:2,few:3,many:4,other:5},ra={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class sc{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=Ae.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){const n=$t(e==="dev"?"en":e),a=r.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:n,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(n,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ra;if(!e.match(/-|_/))return ra;const l=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(l,r)}return this.pluralRulesCache[o]=i,i}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(a=>`${r}${a}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((a,o)=>ta[a]-ta[o]).map(a=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,r,n={}){const a=this.getRule(e,n);return a?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}}const na=(t,e,r,n=".",a=!0)=>{let o=Zl(t,e,r);return!o&&a&&V(r)&&(o=ln(t,r,n),o===void 0&&(o=ln(e,r,n))),o},Vr=t=>t.replace(/\$/g,"$$$$");class lc{constructor(e={}){this.logger=Ae.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:a,prefix:o,prefixEscaped:i,suffix:s,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:E,nestingSuffixEscaped:_,nestingOptionsSeparator:S,maxReplaces:y,alwaysFormat:w}=e.interpolation;this.escape=r!==void 0?r:ec,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=o?pt(o):i||"{{",this.suffix=s?pt(s):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?pt(h):f||pt("$t("),this.nestingSuffix=E?pt(E):_||pt(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=y||1e3,this.alwaysFormat=w!==void 0?w:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,a){let o,i,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(f.indexOf(this.formatSeparator)<0){const y=na(r,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,n,{...a,...r,interpolationkey:f}):y}const E=f.split(this.formatSeparator),_=E.shift().trim(),S=E.join(this.formatSeparator).trim();return this.format(na(r,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),S,n,{...a,...r,interpolationkey:_})};this.resetRegExp();const u=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>Vr(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?Vr(this.escape(f)):Vr(f)}].forEach(f=>{for(s=0;o=f.regex.exec(e);){const E=o[1].trim();if(i=c(E),i===void 0)if(typeof u=="function"){const S=u(e,o,a);i=V(S)?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,E))i="";else if(d){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${E} for interpolating ${e}`),i="";else!V(i)&&!this.useRawValueToEscape&&(i=Yn(i));const _=f.safeValue(i);if(e=e.replace(o[0],_),d?(f.regex.lastIndex+=i.length,f.regex.lastIndex-=o[0].length):f.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,r,n={}){let a,o,i;const s=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;l=d[0],h=this.interpolate(h,i);const f=h.match(/'/g),E=h.match(/"/g);((f?.length??0)%2===0&&!E||E.length%2!==0)&&(h=h.replace(/'/g,'"'));try{i=JSON.parse(h),c&&(i={...c,...i})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${u}${h}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;a=this.nestingRegexp.exec(e);){let l=[];i={...n},i=i.replace&&!V(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(c!==-1&&(l=a[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),a[1]=a[1].slice(0,c)),o=r(s.call(this,a[1].trim(),i),i),o&&a[0]===e&&!V(o))return o;V(o)||(o=Yn(o)),o||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),o=""),l.length&&(o=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:a[1].trim()}),o.trim())),e=e.replace(a[0],o),this.regexp.lastIndex=0}return e}}const cc=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const a=n[1].substring(0,n[1].length-1);e==="currency"&&a.indexOf(":")<0?r.currency||(r.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?r.range||(r.range=a.trim()):a.split(";").forEach(i=>{if(i){const[s,...l]=i.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=s.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:r}},aa=t=>{const e={};return(r,n,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});const i=n+JSON.stringify(o);let s=e[i];return s||(s=t($t(n),a),e[i]=s),s(r)}},uc=t=>(e,r,n)=>t($t(r),n)(e);class dc{constructor(e={}){this.logger=Ae.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?aa:uc;this.formats={number:n((a,o)=>{const i=new Intl.NumberFormat(a,{...o});return s=>i.format(s)}),currency:n((a,o)=>{const i=new Intl.NumberFormat(a,{...o,style:"currency"});return s=>i.format(s)}),datetime:n((a,o)=>{const i=new Intl.DateTimeFormat(a,{...o});return s=>i.format(s)}),relativetime:n((a,o)=>{const i=new Intl.RelativeTimeFormat(a,{...o});return s=>i.format(s,o.range||"day")}),list:n((a,o)=>{const i=new Intl.ListFormat(a,{...o});return s=>i.format(s)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=aa(r)}format(e,r,n,a={}){const o=r.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(s=>s.indexOf(")")>-1)){const s=o.findIndex(l=>l.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,s)].join(this.formatSeparator)}return o.reduce((s,l)=>{const{formatName:c,formatOptions:u}=cc(l);if(this.formats[c]){let d=s;try{const h=a?.formatParams?.[a.interpolationkey]||{},f=h.locale||h.lng||a.locale||a.lng||n;d=this.formats[c](s,f,{...u,...a,...h})}catch(h){this.logger.warn(h)}return d}else this.logger.warn(`there was no format function for ${c}`);return s},e)}}const fc=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class hc extends Dr{constructor(e,r,n,a={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=a,this.logger=Ae.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,a.backend,a)}queueLoad(e,r,n,a){const o={},i={},s={},l={};return e.forEach(c=>{let u=!0;r.forEach(d=>{const h=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?i[h]===void 0&&(i[h]=!0):(this.state[h]=1,u=!1,i[h]===void 0&&(i[h]=!0),o[h]===void 0&&(o[h]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(s[c]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){const a=e.split("|"),o=a[0],i=a[1];r&&this.emit("failedLoading",o,i,r),!r&&n&&this.store.addResourceBundle(o,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);const s={};this.queue.forEach(l=>{Xl(l.loaded,[o],i),fc(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{s[c]||(s[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{s[c][d]===void 0&&(s[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,a=0,o=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:a,wait:o,callback:i});return}this.readingCalls++;const s=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,a+1,o*2,i)},o);return}i(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const c=l(e,r);c&&typeof c.then=="function"?c.then(u=>s(null,u)).catch(s):s(null,c)}catch(c){s(c)}return}return l(e,r,s)}prepareLoading(e,r,n={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(r)&&(r=[r]);const o=this.queueLoad(e,r,n,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){const n=e.split("|"),a=n[0],o=n[1];this.read(a,o,"read",void 0,void 0,(i,s)=>{i&&this.logger.warn(`${r}loading namespace ${o} for language ${a} failed`,i),!i&&s&&this.logger.log(`${r}loaded namespace ${o} for language ${a}`,s),this.loaded(e,i,s)})}saveMissing(e,r,n,a,o,i={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...i,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,r,n,a,l):u=c(e,r,n,a),u&&typeof u.then=="function"?u.then(d=>s(null,d)).catch(s):s(null,u)}catch(u){s(u)}else c(e,r,n,a,s,l)}!e||!e[0]||this.store.addResource(e[0],r,n,a)}}}const oa=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),V(t[1])&&(e.defaultValue=t[1]),V(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),ia=t=>(V(t.ns)&&(t.ns=[t.ns]),V(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),V(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),rr=()=>{},pc=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class Bt extends Dr{constructor(e={},r){if(super(),this.options=ia(e),this.services={},this.logger=Ae,this.modules={external:[]},pc(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=oa();this.options={...n,...this.options,...ia(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const a=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Ae.init(a(this.modules.logger),this.options):Ae.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=dc;const u=new ea(this.options);this.store=new Zn(this.options.resources,this.options);const d=this.services;d.logger=Ae,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new sc(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=a(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new lc(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new hc(a(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...E)=>{this.emit(f,...E)}),this.modules.languageDetector&&(d.languageDetector=a(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=a(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Er(this.services,this.options),this.translator.on("*",(f,...E)=>{this.emit(f,...E)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=rr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});const s=Pt(),l=()=>{const c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(d),r(u,d)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),s}loadResources(e,r=rr){let n=r;const a=V(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const o=[],i=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(c=>{c!=="cimode"&&o.indexOf(c)<0&&o.push(c)})};a?i(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload?.forEach?.(s=>i(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(e,r,n){const a=Pt();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=rr),this.services.backendConnector.reload(e,r,o=>{a.resolve(),n(o)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&bo.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;const n=Pt();this.emit("languageChanging",e);const a=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},o=(s,l)=>{l?this.isLanguageChangingTo===e&&(a(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(s,(...c)=>this.t(...c))},i=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const l=V(s)?s:s&&s[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(V(s)?[s]:s);c&&(this.language||a(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),n}getFixedT(e,r,n){const a=(o,i,...s)=>{let l;typeof i!="object"?l=this.options.overloadTranslationOptionHandler([o,i].concat(s)):l={...i},l.lng=l.lng||a.lng,l.lngs=l.lngs||a.lngs,l.ns=l.ns||a.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||a.keyPrefix);const c=this.options.keySeparator||".";let u;return l.keyPrefix&&Array.isArray(o)?u=o.map(d=>(typeof d=="function"&&(d=mr(d,{...this.options,...i})),`${l.keyPrefix}${c}${d}`)):(typeof o=="function"&&(o=mr(o,{...this.options,...i})),u=l.keyPrefix?`${l.keyPrefix}${c}${o}`:o),this.t(u,l)};return V(e)?a.lng=e:a.lngs=e,a.ns=r,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(s,l)=>{const c=this.services.backendConnector.state[`${s}|${l}`];return c===-1||c===0||c===2};if(r.precheck){const s=r.precheck(this,i);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!a||i(o,e)))}loadNamespaces(e,r){const n=Pt();return this.options.ns?(V(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{n.resolve(),r&&r(a)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){const n=Pt();V(e)&&(e=[e]);const a=this.options.preload||[],o=e.filter(i=>a.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=a.concat(o),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const o=a.getTextInfo();if(o&&o.direction)return o.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new ea(oa());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new Bt(e,r)}cloneInstance(e={},r=rr){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},o=new Bt(a);if((e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},n){const s=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});o.store=new Zn(s,a),o.services.resourceStore=o.store}return o.translator=new Er(o.services,a),o.translator.on("*",(s,...l)=>{o.emit(s,...l)}),o.init(a,r),o.translator.options=a,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ve=Bt.createInstance();ve.createInstance=Bt.createInstance;ve.createInstance;ve.dir;ve.init;ve.loadResources;ve.reloadResources;ve.use;ve.changeLanguage;ve.getFixedT;const eg=ve.t;ve.exists;ve.setDefaultNamespace;ve.hasLoadedNamespace;ve.loadNamespaces;ve.loadLanguages;var Wr,sa;function gc(){return sa||(sa=1,Wr={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}),Wr}var mc=gc();const Ec=yl(mc);var vc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function la(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(Ec[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 a=new RegExp(vc),o=null;(o=a.exec(t))!==null;)if(o[0].trim())if(o[1]){var i=o[1].trim(),s=[i,""];i.indexOf("=")>-1&&(s=i.split("=")),e.attrs[s[0]]=s[1],a.lastIndex--}else o[2]&&(e.attrs[o[2]]=o[3].trim().substring(1,o[3].length-1));return e}var _c=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,yc=/^\s*$/,Cc=Object.create(null);function Oo(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 a in r)n.push(a+'="'+r[a]+'"');return n.length?" "+n.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(Oo,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var Sc={parse:function(t,e){e||(e={}),e.components||(e.components=Cc);var r,n=[],a=[],o=-1,i=!1;if(t.indexOf("<")!==0){var s=t.indexOf("<");n.push({type:"text",content:s===-1?t:t.substring(0,s)})}return t.replace(_c,function(l,c){if(i){if(l!=="</"+r.name+">")return;i=!1}var u,d=l.charAt(1)!=="/",h=l.startsWith("<!--"),f=c+l.length,E=t.charAt(f);if(h){var _=la(l);return o<0?(n.push(_),n):((u=a[o]).children.push(_),n)}if(d&&(o++,(r=la(l)).type==="tag"&&e.components[r.name]&&(r.type="component",i=!0),r.voidElement||i||!E||E==="<"||r.children.push({type:"text",content:t.slice(f,t.indexOf("<",f))}),o===0&&n.push(r),(u=a[o-1])&&u.children.push(r),a[o]=r),(!d||r.voidElement)&&(o>-1&&(r.voidElement||r.name===l.slice(2,-1))&&(o--,r=o===-1?n:a[o]),!i&&E!=="<"&&E)){u=o===-1?n:a[o].children;var S=t.indexOf("<",f),y=t.slice(f,S===-1?void 0:S);yc.test(y)&&(y=" "),(S>-1&&o+u.length>=0||y!==" ")&&u.push({type:"text",content:y})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+Oo("",r)},"")}};const lr=(t,e,r,n)=>{const a=[r,{code:e,...n||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);Le(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...a):console?.warn&&console.warn(...a)},ca={},Pr=(t,e,r,n)=>{Le(r)&&ca[r]||(Le(r)&&(ca[r]=new Date),lr(t,e,r,n))},xo=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},cn=(t,e,r)=>{t.loadNamespaces(e,xo(t,r))},ua=(t,e,r,n)=>{if(Le(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return cn(t,r,n);r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,xo(t,n))},Nc=(t,e,r={})=>!e.languages||!e.languages.length?(Pr(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,a)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,t))return!1}}),Le=t=>typeof t=="string",Ye=t=>typeof t=="object"&&t!==null,Rc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,wc={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},bc=t=>wc[t],Lc=t=>t.replace(Rc,bc);let un={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Lc};const Oc=(t={})=>{un={...un,...t}},Do=()=>un;let Po;const xc=t=>{Po=t},Nn=()=>Po,Kr=(t,e)=>{if(!t)return!1;const r=t.props?.children??t.children;return e?r.length>0:!!r},zr=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?_t(e):e},Dc=t=>Array.isArray(t)&&t.every(g.isValidElement),_t=t=>Array.isArray(t)?t:[t],Pc=(t,e)=>{const r={...e};return r.props=Object.assign(t.props,e.props),r},Ao=(t,e,r,n)=>{if(!t)return"";let a="";const o=_t(t),i=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return o.forEach((s,l)=>{if(Le(s)){a+=`${s}`;return}if(g.isValidElement(s)){const{props:c,type:u}=s,d=Object.keys(c).length,h=i.indexOf(u)>-1,f=c.children;if(!f&&h&&!d){a+=`<${u}/>`;return}if(!f&&(!h||d)||c.i18nIsDynamicList){a+=`<${l}></${l}>`;return}if(h&&d===1&&Le(f)){a+=`<${u}>${f}</${u}>`;return}const E=Ao(f,e,r,n);a+=`<${l}>${E}</${l}>`;return}if(s===null){lr(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(Ye(s)){const{format:c,...u}=s,d=Object.keys(u);if(d.length===1){const h=c?`${d[0]}, ${c}`:d[0];a+=`{{${h}}}`;return}lr(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:s});return}lr(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:s})}),a},Ac=(t,e=[],r={})=>{if(!t)return t;const n=Object.keys(r),a=[...e,...n];let o="",i=0;for(;i<t.length;)if(t[i]==="<"){let s=!1;const l=t.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9-]*)>/);if(l){const c=l[1];(/^\d+$/.test(c)||a.includes(c))&&(s=!0,o+=l[0],i+=l[0].length)}if(!s){const c=t.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const u=c[1];(/^\d+$/.test(u)||a.includes(u))&&(s=!0,o+=c[0],i+=c[0].length)}}s||(o+="<",i+=1)}else o+=t[i],i+=1;return o},Tc=(t,e,r,n,a,o,i)=>{if(r==="")return[];const s=a.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(s.map(w=>`<${w}`).join("|")).test(r);if(!t&&!e&&!l&&!i)return[r];const c=e??{},u=w=>{_t(w).forEach(N=>{Le(N)||(Kr(N)?u(zr(N)):Ye(N)&&!g.isValidElement(N)&&Object.assign(c,N))})};u(t);const d=Ac(r,s,c),h=Sc.parse(`<0>${d}</0>`),f={...c,...o},E=(w,O,N)=>{const L=zr(w),P=S(L,O.children,N);return Dc(L)&&P.length===0||w.props?.i18nIsDynamicList?L:P},_=(w,O,N,L,P)=>{w.dummy?(w.children=O,N.push(g.cloneElement(w,{key:L},P?void 0:O))):N.push(...g.Children.map([w],m=>{const b={...m.props};return delete b.i18nIsDynamicList,g.createElement(m.type,{...b,key:L,ref:m.props.ref??m.ref},P?null:O)}))},S=(w,O,N)=>{const L=_t(w);return _t(O).reduce((m,b,x)=>{const I=b.children?.[0]?.content&&n.services.interpolator.interpolate(b.children[0].content,f,n.language);if(b.type==="tag"){let W=L[parseInt(b.name,10)];!W&&e&&(W=e[b.name]),N.length===1&&!W&&(W=N[0][b.name]),W||(W={});const B=Object.keys(b.attrs).length!==0?Pc({props:b.attrs},W):W,G=g.isValidElement(B),q=G&&Kr(b,!0)&&!b.voidElement,_e=l&&Ye(B)&&B.dummy&&!G,he=Ye(e)&&Object.hasOwnProperty.call(e,b.name);if(Le(B)){const X=n.services.interpolator.interpolate(B,f,n.language);m.push(X)}else if(Kr(B)||q){const X=E(B,b,N);_(B,X,m,x)}else if(_e){const X=S(L,b.children,N);_(B,X,m,x)}else if(Number.isNaN(parseFloat(b.name)))if(he){const X=E(B,b,N);_(B,X,m,x,b.voidElement)}else if(a.transSupportBasicHtmlNodes&&s.indexOf(b.name)>-1)if(b.voidElement)m.push(g.createElement(b.name,{key:`${b.name}-${x}`}));else{const X=S(L,b.children,N);m.push(g.createElement(b.name,{key:`${b.name}-${x}`},X))}else if(b.voidElement)m.push(`<${b.name} />`);else{const X=S(L,b.children,N);m.push(`<${b.name}>${X}</${b.name}>`)}else if(Ye(B)&&!G){const X=b.children[0]?I:null;X&&m.push(X)}else _(B,I,m,x,b.children.length!==1||!I)}else if(b.type==="text"){const W=a.transWrapTextNodes,B=i?a.unescape(n.services.interpolator.interpolate(b.content,f,n.language)):n.services.interpolator.interpolate(b.content,f,n.language);W?m.push(g.createElement(W,{key:`${b.name}-${x}`},B)):m.push(B)}return m},[])},y=S([{dummy:!0,children:t||[]}],h,_t(t||[]));return zr(y[0])},To=(t,e,r)=>{const n=t.key||e,a=g.cloneElement(t,{key:n});if(!a.props||!a.props.children||r.indexOf(`${e}/>`)<0&&r.indexOf(`${e} />`)<0)return a;function o(){return g.createElement(g.Fragment,null,a)}return g.createElement(o,{key:n})},Ic=(t,e)=>t.map((r,n)=>To(r,n,e)),kc=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:To(t[n],n,e)})}),r},Mc=(t,e,r,n)=>t?Array.isArray(t)?Ic(t,e):Ye(t)?kc(t,e):(Pr(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,Hc=t=>!Ye(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function jc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const E=u||Nn();if(!E)return Pr(E,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const _=d||E.t.bind(E)||(q=>q),S={...Do(),...E.options?.react};let y=c||_.ns||E.options?.defaultNS;y=Le(y)?[y]:y||["translation"];const w=Ao(t,S,E,n),O=s||o?.defaultValue||w||S.transEmptyNodeValue||(typeof n=="function"?mr(n):n),{hashTransKey:N}=S,L=n||(N?N(w||O):w||O);E.options?.interpolation?.defaultVariables&&(i=i&&Object.keys(i).length>0?{...i,...E.options.interpolation.defaultVariables}:{...E.options.interpolation.defaultVariables});const P=i||e!==void 0&&!E.options?.interpolation?.alwaysFormat||!t?o.interpolation:{interpolation:{...o.interpolation,prefix:"#$?",suffix:"?$#"}},m={...o,context:a||o.context,count:e,...i,...P,defaultValue:s||o?.defaultValue,ns:y};let b=L?_(L,m):O;b===L&&O&&(b=O);const x=Mc(l,b,E,n);let I=x||t,W=null;Hc(x)&&(W=x,I=t);const B=Tc(I,W,b,E,S,m,h),G=r??S.defaultTransParent;return G?g.createElement(G,f,B):B}const Fc={type:"3rdParty",init(t){Oc(t.options.react),xc(t)}},Io=g.createContext();class $c{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function Bc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const{i18n:E,defaultNS:_}=g.useContext(Io)||{},S=u||E||Nn(),y=d||S?.t.bind(S);return jc({children:t,count:e,parent:r,i18nKey:n,context:a,tOptions:o,values:i,defaults:s,components:l,ns:c||y?.ns||_||S?.options?.defaultNS,i18n:S,t:d,shouldUnescape:h,...f})}var Gr={exports:{}},Yr={};var da;function Uc(){if(da)return Yr;da=1;var t=Cl();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,o=t.useLayoutEffect,i=t.useDebugValue;function s(d,h){var f=h(),E=n({inst:{value:f,getSnapshot:h}}),_=E[0].inst,S=E[1];return o(function(){_.value=f,_.getSnapshot=h,l(_)&&S({inst:_})},[d,f,h]),a(function(){return l(_)&&S({inst:_}),d(function(){l(_)&&S({inst:_})})},[d]),i(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!r(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:s;return Yr.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Yr}var fa;function Vc(){return fa||(fa=1,Gr.exports=Uc()),Gr.exports}var Wc=Vc();const Kc=(t,e)=>Le(e)?e:Ye(e)&&Le(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,zc={t:Kc,ready:!1},Gc=()=>()=>{},ko=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:a}=g.useContext(Io)||{},o=r||n||Nn();o&&!o.reportNamespaces&&(o.reportNamespaces=new $c),o||Pr(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=g.useMemo(()=>({...Do(),...o?.options?.react,...e}),[o,e]),{useSuspense:s,keyPrefix:l}=i,c=g.useMemo(()=>{const N=a||o?.options?.defaultNS;return Le(N)?[N]:N||["translation"]},[t,a,o]);o?.reportNamespaces?.addUsedNamespaces?.(c);const u=g.useRef(0),d=g.useCallback(N=>{if(!o)return Gc;const{bindI18n:L,bindI18nStore:P}=i,m=()=>{u.current+=1,N()};return L&&o.on(L,m),P&&o.store.on(P,m),()=>{L&&L.split(" ").forEach(b=>o.off(b,m)),P&&P.split(" ").forEach(b=>o.store.off(b,m))}},[o,i]),h=g.useRef(),f=g.useCallback(()=>{if(!o)return zc;const N=!!(o.isInitialized||o.initializedStoreOnce)&&c.every(I=>Nc(I,o,i)),L=e.lng||o.language,P=u.current,m=h.current;if(m&&m.ready===N&&m.lng===L&&m.keyPrefix===l&&m.revision===P)return m;const x={t:o.getFixedT(L,i.nsMode==="fallback"?c:c[0],l),ready:N,lng:L,keyPrefix:l,revision:P};return h.current=x,x},[o,c,l,i,e.lng]),[E,_]=g.useState(0),{t:S,ready:y}=Wc.useSyncExternalStore(d,f,f);g.useEffect(()=>{if(o&&!y&&!s){const N=()=>_(L=>L+1);e.lng?ua(o,e.lng,c,N):cn(o,c,N)}},[o,e.lng,c,y,s,E]);const w=o||{},O=g.useMemo(()=>{const N=[S,w,y];return N.t=S,N.i18n=w,N.ready=y,N},[S,w,y]);if(o&&s&&!y)throw new Promise(N=>{const L=()=>N();e.lng?ua(o,e.lng,c,L):cn(o,c,L)});return O},Yc=()=>{const{t}=ko();return R.jsxs("div",{children:[R.jsx("p",{className:"font-medium",children:t("notifications.reloadApp")}),R.jsxs("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},qc=()=>{async function t(){const e=await ef();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;fe.studioMode||!fe.warnOutdatedApp?Ze.warn(`Connect is outdated:
|
|
3
3
|
Current: @currentVersion
|
|
4
4
|
Latest: @latestVersion`,e.currentVersion,e.latestVersion):wt(g.createElement(Yc),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}g.useEffect(()=>{t().catch(console.error)},[])},Jc=fe.routerBasename,Mo=`${Jc}:display-cookie-banner`,ha=new Set;let Ho=Xc();function Xc(){try{return localStorage.getItem(Mo)!=="false"}catch(t){return console.error(t),!0}}function pa(){return Ho}function Zc(t){Ho=t,localStorage.setItem(Mo,JSON.stringify(t))}function Qc(t){return ha.add(t),()=>ha.delete(t)}const eu=()=>[g.useSyncExternalStore(Qc,pa,pa),Zc];function ne(){return ne=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},ne.apply(this,arguments)}var de;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(de||(de={}));const ga="popstate";function tu(t){t===void 0&&(t={});function e(n,a){let{pathname:o,search:i,hash:s}=n.location;return Ut("",{pathname:o,search:i,hash:s},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:Kt(a)}return nu(e,r,null,t)}function z(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function bt(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ru(){return Math.random().toString(36).substr(2,8)}function ma(t,e){return{usr:t.state,key:t.key,idx:e}}function Ut(t,e,r,n){return r===void 0&&(r=null),ne({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?et(e):e,{state:r,key:e&&e.key||n||ru()})}function Kt(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function et(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function nu(t,e,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:o=!1}=n,i=a.history,s=de.Pop,l=null,c=u();c==null&&(c=0,i.replaceState(ne({},i.state,{idx:c}),""));function u(){return(i.state||{idx:null}).idx}function d(){s=de.Pop;let S=u(),y=S==null?null:S-c;c=S,l&&l({action:s,location:_.location,delta:y})}function h(S,y){s=de.Push;let w=Ut(_.location,S,y);c=u()+1;let O=ma(w,c),N=_.createHref(w);try{i.pushState(O,"",N)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;a.location.assign(N)}o&&l&&l({action:s,location:_.location,delta:1})}function f(S,y){s=de.Replace;let w=Ut(_.location,S,y);c=u();let O=ma(w,c),N=_.createHref(w);i.replaceState(O,"",N),o&&l&&l({action:s,location:_.location,delta:0})}function E(S){let y=a.location.origin!=="null"?a.location.origin:a.location.href,w=typeof S=="string"?S:Kt(S);return w=w.replace(/ $/,"%20"),z(y,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,y)}let _={get action(){return s},get location(){return t(a,i)},listen(S){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(ga,d),l=S,()=>{a.removeEventListener(ga,d),l=null}},createHref(S){return e(a,S)},createURL:E,encodeLocation(S){let y=E(S);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:h,replace:f,go(S){return i.go(S)}};return _}var Q;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Q||(Q={}));const au=new Set(["lazy","caseSensitive","path","id","index","children"]);function ou(t){return t.index===!0}function vr(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((a,o)=>{let i=[...r,String(o)],s=typeof a.id=="string"?a.id:i.join("-");if(z(a.index!==!0||!a.children,"Cannot specify children on an index route"),z(!n[s],'Found a route id collision on id "'+s+`". Route id's must be globally unique within Data Router usages`),ou(a)){let l=ne({},a,e(a),{id:s});return n[s]=l,l}else{let l=ne({},a,e(a),{id:s,children:void 0});return n[s]=l,a.children&&(l.children=vr(a.children,e,i,n)),l}})}function ze(t,e,r){return r===void 0&&(r="/"),cr(t,e,r,!1)}function cr(t,e,r,n){let a=typeof e=="string"?et(e):e,o=zt(a.pathname||"/",r);if(o==null)return null;let i=jo(t);su(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let c=vu(o);s=mu(i[l],c,n)}return s}function iu(t,e){let{route:r,pathname:n,params:a}=t;return{id:r.id,pathname:n,params:a,data:e[r.id],handle:r.handle}}function jo(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(o,i,s)=>{let l={relativePath:s===void 0?o.path||"":s,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};l.relativePath.startsWith("/")&&(z(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=Qe([n,l.relativePath]),u=r.concat(l);o.children&&o.children.length>0&&(z(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),jo(o.children,e,u,c)),!(o.path==null&&!o.index)&&e.push({path:c,score:pu(c,o.index),routesMeta:u})};return t.forEach((o,i)=>{var s;if(o.path===""||!((s=o.path)!=null&&s.includes("?")))a(o,i);else for(let l of Fo(o.path))a(o,i,l)}),e}function Fo(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let i=Fo(n.join("/")),s=[];return s.push(...i.map(l=>l===""?o:[o,l].join("/"))),a&&s.push(...i),s.map(l=>t.startsWith("/")&&l===""?"/":l)}function su(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:gu(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const lu=/^:[\w-]+$/,cu=3,uu=2,du=1,fu=10,hu=-2,Ea=t=>t==="*";function pu(t,e){let r=t.split("/"),n=r.length;return r.some(Ea)&&(n+=hu),e&&(n+=uu),r.filter(a=>!Ea(a)).reduce((a,o)=>a+(lu.test(o)?cu:o===""?du:fu),n)}function gu(t,e){return t.length===e.length&&t.slice(0,-1).every((n,a)=>n===e[a])?t[t.length-1]-e[e.length-1]:0}function mu(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,a={},o="/",i=[];for(let s=0;s<n.length;++s){let l=n[s],c=s===n.length-1,u=o==="/"?e:e.slice(o.length)||"/",d=va({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),h=l.route;if(!d&&c&&r&&!n[n.length-1].route.index&&(d=va({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(a,d.params),i.push({params:a,pathname:Qe([o,d.pathname]),pathnameBase:Cu(Qe([o,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(o=Qe([o,d.pathnameBase]))}return i}function va(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=Eu(t.path,t.caseSensitive,t.end),a=e.match(r);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),s=a.slice(1);return{params:n.reduce((c,u,d)=>{let{paramName:h,isOptional:f}=u;if(h==="*"){let _=s[d]||"";i=o.slice(0,o.length-_.length).replace(/(.)\/+$/,"$1")}const E=s[d];return f&&!E?c[h]=void 0:c[h]=(E||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:i,pattern:t}}function Eu(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),bt(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(n.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),n]}function vu(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return bt(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function zt(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function _u(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?et(t):t;return{pathname:r?r.startsWith("/")?r:yu(r,e):e,search:Su(n),hash:Nu(a)}}function yu(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function qr(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function $o(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Bo(t,e){let r=$o(t);return e?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Uo(t,e,r,n){n===void 0&&(n=!1);let a;typeof t=="string"?a=et(t):(a=ne({},t),z(!a.pathname||!a.pathname.includes("?"),qr("?","pathname","search",a)),z(!a.pathname||!a.pathname.includes("#"),qr("#","pathname","hash",a)),z(!a.search||!a.search.includes("#"),qr("#","search","hash",a)));let o=t===""||a.pathname==="",i=o?"/":a.pathname,s;if(i==null)s=r;else{let d=e.length-1;if(!n&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),d-=1;a.pathname=h.join("/")}s=d>=0?e[d]:"/"}let l=_u(a,s),c=i&&i!=="/"&&i.endsWith("/"),u=(o||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const Qe=t=>t.join("/").replace(/\/\/+/g,"/"),Cu=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Su=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Nu=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class _r{constructor(e,r,n,a){a===void 0&&(a=!1),this.status=e,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function Vt(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Vo=["post","put","patch","delete"],Ru=new Set(Vo),wu=["get",...Vo],bu=new Set(wu),Lu=new Set([301,302,303,307,308]),Ou=new Set([307,308]),Jr={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},xu={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},At={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Rn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Du=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),Wo="remix-router-transitions";function Pu(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;z(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(t.mapRouteProperties)a=t.mapRouteProperties;else if(t.detectErrorBoundary){let p=t.detectErrorBoundary;a=v=>({hasErrorBoundary:p(v)})}else a=Du;let o={},i=vr(t.routes,a,void 0,o),s,l=t.basename||"/",c=t.dataStrategy||ku,u=t.patchRoutesOnNavigation,d=ne({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),h=null,f=new Set,E=null,_=null,S=null,y=t.hydrationData!=null,w=ze(i,t.history.location,l),O=!1,N=null;if(w==null&&!u){let p=Ne(404,{pathname:t.history.location.pathname}),{matches:v,route:C}=xa(i);w=v,N={[C.id]:p}}w&&!t.hydrationData&&Jt(w,i,t.history.location.pathname).active&&(w=null);let L;if(w)if(w.some(p=>p.route.lazy))L=!1;else if(!w.some(p=>p.route.loader))L=!0;else if(d.v7_partialHydration){let p=t.hydrationData?t.hydrationData.loaderData:null,v=t.hydrationData?t.hydrationData.errors:null;if(v){let C=w.findIndex(D=>v[D.route.id]!==void 0);L=w.slice(0,C+1).every(D=>!fn(D.route,p,v))}else L=w.every(C=>!fn(C.route,p,v))}else L=t.hydrationData!=null;else if(L=!1,w=[],d.v7_partialHydration){let p=Jt(null,i,t.history.location.pathname);p.active&&p.matches&&(O=!0,w=p.matches)}let P,m={historyAction:t.history.action,location:t.history.location,matches:w,initialized:L,navigation:Jr,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||N,fetchers:new Map,blockers:new Map},b=de.Pop,x=!1,I,W=!1,B=new Map,G=null,q=!1,_e=!1,he=[],X=new Set,te=new Map,Te=0,$e=-1,se=new Map,me=new Set,we=new Map,Be=new Map,Oe=new Set,nt=new Map,at=new Map,Gt;function xi(){if(h=t.history.listen(p=>{let{action:v,location:C,delta:D}=p;if(Gt){Gt(),Gt=void 0;return}bt(at.size===0||D!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let T=Fn({currentLocation:m.location,nextLocation:C,historyAction:v});if(T&&D!=null){let F=new Promise(U=>{Gt=U});t.history.go(D*-1),qt(T,{state:"blocked",location:C,proceed(){qt(T,{state:"proceeding",proceed:void 0,reset:void 0,location:C}),F.then(()=>t.history.go(D))},reset(){let U=new Map(m.blockers);U.set(T,At),Ce({blockers:U})}});return}return ot(v,C)}),r){qu(e,B);let p=()=>Ju(e,B);e.addEventListener("pagehide",p),G=()=>e.removeEventListener("pagehide",p)}return m.initialized||ot(de.Pop,m.location,{initialHydration:!0}),P}function Di(){h&&h(),G&&G(),f.clear(),I&&I.abort(),m.fetchers.forEach((p,v)=>Yt(v)),m.blockers.forEach((p,v)=>jn(v))}function Pi(p){return f.add(p),()=>f.delete(p)}function Ce(p,v){v===void 0&&(v={}),m=ne({},m,p);let C=[],D=[];d.v7_fetcherPersist&&m.fetchers.forEach((T,F)=>{T.state==="idle"&&(Oe.has(F)?D.push(F):C.push(F))}),Oe.forEach(T=>{!m.fetchers.has(T)&&!te.has(T)&&D.push(T)}),[...f].forEach(T=>T(m,{deletedFetchers:D,viewTransitionOpts:v.viewTransitionOpts,flushSync:v.flushSync===!0})),d.v7_fetcherPersist?(C.forEach(T=>m.fetchers.delete(T)),D.forEach(T=>Yt(T))):D.forEach(T=>Oe.delete(T))}function ut(p,v,C){var D,T;let{flushSync:F}=C===void 0?{}:C,U=m.actionData!=null&&m.navigation.formMethod!=null&&xe(m.navigation.formMethod)&&m.navigation.state==="loading"&&((D=p.state)==null?void 0:D._isRedirect)!==!0,M;v.actionData?Object.keys(v.actionData).length>0?M=v.actionData:M=null:U?M=m.actionData:M=null;let H=v.loaderData?La(m.loaderData,v.loaderData,v.matches||[],v.errors):m.loaderData,k=m.blockers;k.size>0&&(k=new Map(k),k.forEach((Y,Ee)=>k.set(Ee,At)));let j=x===!0||m.navigation.formMethod!=null&&xe(m.navigation.formMethod)&&((T=p.state)==null?void 0:T._isRedirect)!==!0;s&&(i=s,s=void 0),q||b===de.Pop||(b===de.Push?t.history.push(p,p.state):b===de.Replace&&t.history.replace(p,p.state));let K;if(b===de.Pop){let Y=B.get(m.location.pathname);Y&&Y.has(p.pathname)?K={currentLocation:m.location,nextLocation:p}:B.has(p.pathname)&&(K={currentLocation:p,nextLocation:m.location})}else if(W){let Y=B.get(m.location.pathname);Y?Y.add(p.pathname):(Y=new Set([p.pathname]),B.set(m.location.pathname,Y)),K={currentLocation:m.location,nextLocation:p}}Ce(ne({},v,{actionData:M,loaderData:H,historyAction:b,location:p,initialized:!0,navigation:Jr,revalidation:"idle",restoreScrollPosition:Bn(p,v.matches||m.matches),preventScrollReset:j,blockers:k}),{viewTransitionOpts:K,flushSync:F===!0}),b=de.Pop,x=!1,W=!1,q=!1,_e=!1,he=[]}async function Pn(p,v){if(typeof p=="number"){t.history.go(p);return}let C=dn(m.location,m.matches,l,d.v7_prependBasename,p,d.v7_relativeSplatPath,v?.fromRouteId,v?.relative),{path:D,submission:T,error:F}=_a(d.v7_normalizeFormMethod,!1,C,v),U=m.location,M=Ut(m.location,D,v&&v.state);M=ne({},M,t.history.encodeLocation(M));let H=v&&v.replace!=null?v.replace:void 0,k=de.Push;H===!0?k=de.Replace:H===!1||T!=null&&xe(T.formMethod)&&T.formAction===m.location.pathname+m.location.search&&(k=de.Replace);let j=v&&"preventScrollReset"in v?v.preventScrollReset===!0:void 0,K=(v&&v.flushSync)===!0,Y=Fn({currentLocation:U,nextLocation:M,historyAction:k});if(Y){qt(Y,{state:"blocked",location:M,proceed(){qt(Y,{state:"proceeding",proceed:void 0,reset:void 0,location:M}),Pn(p,v)},reset(){let Ee=new Map(m.blockers);Ee.set(Y,At),Ce({blockers:Ee})}});return}return await ot(k,M,{submission:T,pendingError:F,preventScrollReset:j,replace:v&&v.replace,enableViewTransition:v&&v.viewTransition,flushSync:K})}function Ai(){if(jr(),Ce({revalidation:"loading"}),m.navigation.state!=="submitting"){if(m.navigation.state==="idle"){ot(m.historyAction,m.location,{startUninterruptedRevalidation:!0});return}ot(b||m.historyAction,m.navigation.location,{overrideNavigation:m.navigation,enableViewTransition:W===!0})}}async function ot(p,v,C){I&&I.abort(),I=null,b=p,q=(C&&C.startUninterruptedRevalidation)===!0,Ui(m.location,m.matches),x=(C&&C.preventScrollReset)===!0,W=(C&&C.enableViewTransition)===!0;let D=s||i,T=C&&C.overrideNavigation,F=C!=null&&C.initialHydration&&m.matches&&m.matches.length>0&&!O?m.matches:ze(D,v,l),U=(C&&C.flushSync)===!0;if(F&&m.initialized&&!_e&&Bu(m.location,v)&&!(C&&C.submission&&xe(C.submission.formMethod))){ut(v,{matches:F},{flushSync:U});return}let M=Jt(F,D,v.pathname);if(M.active&&M.matches&&(F=M.matches),!F){let{error:re,notFoundMatches:Z,route:ae}=Fr(v.pathname);ut(v,{matches:Z,loaderData:{},errors:{[ae.id]:re}},{flushSync:U});return}I=new AbortController;let H=gt(t.history,v,I.signal,C&&C.submission),k;if(C&&C.pendingError)k=[lt(F).route.id,{type:Q.error,error:C.pendingError}];else if(C&&C.submission&&xe(C.submission.formMethod)){let re=await Ti(H,v,C.submission,F,M.active,{replace:C.replace,flushSync:U});if(re.shortCircuited)return;if(re.pendingActionResult){let[Z,ae]=re.pendingActionResult;if(Re(ae)&&Vt(ae.error)&&ae.error.status===404){I=null,ut(v,{matches:re.matches,loaderData:{},errors:{[Z]:ae.error}});return}}F=re.matches||F,k=re.pendingActionResult,T=Xr(v,C.submission),U=!1,M.active=!1,H=gt(t.history,H.url,H.signal)}let{shortCircuited:j,matches:K,loaderData:Y,errors:Ee}=await Ii(H,v,F,M.active,T,C&&C.submission,C&&C.fetcherSubmission,C&&C.replace,C&&C.initialHydration===!0,U,k);j||(I=null,ut(v,ne({matches:K||F},Oa(k),{loaderData:Y,errors:Ee})))}async function Ti(p,v,C,D,T,F){F===void 0&&(F={}),jr();let U=Gu(v,C);if(Ce({navigation:U},{flushSync:F.flushSync===!0}),T){let k=await Xt(D,v.pathname,p.signal);if(k.type==="aborted")return{shortCircuited:!0};if(k.type==="error"){let j=lt(k.partialMatches).route.id;return{matches:k.partialMatches,pendingActionResult:[j,{type:Q.error,error:k.error}]}}else if(k.matches)D=k.matches;else{let{notFoundMatches:j,error:K,route:Y}=Fr(v.pathname);return{matches:j,pendingActionResult:[Y.id,{type:Q.error,error:K}]}}}let M,H=kt(D,v);if(!H.route.action&&!H.route.lazy)M={type:Q.error,error:Ne(405,{method:p.method,pathname:v.pathname,routeId:H.route.id})};else if(M=(await Lt("action",m,p,[H],D,null))[H.route.id],p.signal.aborted)return{shortCircuited:!0};if(ct(M)){let k;return F&&F.replace!=null?k=F.replace:k=Ra(M.response.headers.get("Location"),new URL(p.url),l)===m.location.pathname+m.location.search,await it(p,M,!0,{submission:C,replace:k}),{shortCircuited:!0}}if(qe(M))throw Ne(400,{type:"defer-action"});if(Re(M)){let k=lt(D,H.route.id);return(F&&F.replace)!==!0&&(b=de.Push),{matches:D,pendingActionResult:[k.route.id,M]}}return{matches:D,pendingActionResult:[H.route.id,M]}}async function Ii(p,v,C,D,T,F,U,M,H,k,j){let K=T||Xr(v,F),Y=F||U||Pa(K),Ee=!q&&(!d.v7_partialHydration||!H);if(D){if(Ee){let oe=An(j);Ce(ne({navigation:K},oe!==void 0?{actionData:oe}:{}),{flushSync:k})}let J=await Xt(C,v.pathname,p.signal);if(J.type==="aborted")return{shortCircuited:!0};if(J.type==="error"){let oe=lt(J.partialMatches).route.id;return{matches:J.partialMatches,loaderData:{},errors:{[oe]:J.error}}}else if(J.matches)C=J.matches;else{let{error:oe,notFoundMatches:ft,route:Dt}=Fr(v.pathname);return{matches:ft,loaderData:{},errors:{[Dt.id]:oe}}}}let re=s||i,[Z,ae]=Ca(t.history,m,C,Y,v,d.v7_partialHydration&&H===!0,d.v7_skipActionErrorRevalidation,_e,he,X,Oe,we,me,re,l,j);if($r(J=>!(C&&C.some(oe=>oe.route.id===J))||Z&&Z.some(oe=>oe.route.id===J)),$e=++Te,Z.length===0&&ae.length===0){let J=Mn();return ut(v,ne({matches:C,loaderData:{},errors:j&&Re(j[1])?{[j[0]]:j[1].error}:null},Oa(j),J?{fetchers:new Map(m.fetchers)}:{}),{flushSync:k}),{shortCircuited:!0}}if(Ee){let J={};if(!D){J.navigation=K;let oe=An(j);oe!==void 0&&(J.actionData=oe)}ae.length>0&&(J.fetchers=ki(ae)),Ce(J,{flushSync:k})}ae.forEach(J=>{Ve(J.key),J.controller&&te.set(J.key,J.controller)});let dt=()=>ae.forEach(J=>Ve(J.key));I&&I.signal.addEventListener("abort",dt);let{loaderResults:Ot,fetcherResults:ke}=await Tn(m,C,Z,ae,p);if(p.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener("abort",dt),ae.forEach(J=>te.delete(J.key));let Pe=nr(Ot);if(Pe)return await it(p,Pe.result,!0,{replace:M}),{shortCircuited:!0};if(Pe=nr(ke),Pe)return me.add(Pe.key),await it(p,Pe.result,!0,{replace:M}),{shortCircuited:!0};let{loaderData:Br,errors:xt}=ba(m,C,Ot,j,ae,ke,nt);nt.forEach((J,oe)=>{J.subscribe(ft=>{(ft||J.done)&&nt.delete(oe)})}),d.v7_partialHydration&&H&&m.errors&&(xt=ne({},m.errors,xt));let st=Mn(),Zt=Hn($e),Qt=st||Zt||ae.length>0;return ne({matches:C,loaderData:Br,errors:xt},Qt?{fetchers:new Map(m.fetchers)}:{})}function An(p){if(p&&!Re(p[1]))return{[p[0]]:p[1].data};if(m.actionData)return Object.keys(m.actionData).length===0?null:m.actionData}function ki(p){return p.forEach(v=>{let C=m.fetchers.get(v.key),D=Tt(void 0,C?C.data:void 0);m.fetchers.set(v.key,D)}),new Map(m.fetchers)}function Mi(p,v,C,D){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ve(p);let T=(D&&D.flushSync)===!0,F=s||i,U=dn(m.location,m.matches,l,d.v7_prependBasename,C,d.v7_relativeSplatPath,v,D?.relative),M=ze(F,U,l),H=Jt(M,F,U);if(H.active&&H.matches&&(M=H.matches),!M){Ie(p,v,Ne(404,{pathname:U}),{flushSync:T});return}let{path:k,submission:j,error:K}=_a(d.v7_normalizeFormMethod,!0,U,D);if(K){Ie(p,v,K,{flushSync:T});return}let Y=kt(M,k),Ee=(D&&D.preventScrollReset)===!0;if(j&&xe(j.formMethod)){Hi(p,v,k,Y,M,H.active,T,Ee,j);return}we.set(p,{routeId:v,path:k}),ji(p,v,k,Y,M,H.active,T,Ee,j)}async function Hi(p,v,C,D,T,F,U,M,H){jr(),we.delete(p);function k(le){if(!le.route.action&&!le.route.lazy){let ht=Ne(405,{method:H.formMethod,pathname:C,routeId:v});return Ie(p,v,ht,{flushSync:U}),!0}return!1}if(!F&&k(D))return;let j=m.fetchers.get(p);Ue(p,Yu(H,j),{flushSync:U});let K=new AbortController,Y=gt(t.history,C,K.signal,H);if(F){let le=await Xt(T,new URL(Y.url).pathname,Y.signal,p);if(le.type==="aborted")return;if(le.type==="error"){Ie(p,v,le.error,{flushSync:U});return}else if(le.matches){if(T=le.matches,D=kt(T,C),k(D))return}else{Ie(p,v,Ne(404,{pathname:C}),{flushSync:U});return}}te.set(p,K);let Ee=Te,Z=(await Lt("action",m,Y,[D],T,p))[D.route.id];if(Y.signal.aborted){te.get(p)===K&&te.delete(p);return}if(d.v7_fetcherPersist&&Oe.has(p)){if(ct(Z)||Re(Z)){Ue(p,We(void 0));return}}else{if(ct(Z))if(te.delete(p),$e>Ee){Ue(p,We(void 0));return}else return me.add(p),Ue(p,Tt(H)),it(Y,Z,!1,{fetcherSubmission:H,preventScrollReset:M});if(Re(Z)){Ie(p,v,Z.error);return}}if(qe(Z))throw Ne(400,{type:"defer-action"});let ae=m.navigation.location||m.location,dt=gt(t.history,ae,K.signal),Ot=s||i,ke=m.navigation.state!=="idle"?ze(Ot,m.navigation.location,l):m.matches;z(ke,"Didn't find any matches after fetcher action");let Pe=++Te;se.set(p,Pe);let Br=Tt(H,Z.data);m.fetchers.set(p,Br);let[xt,st]=Ca(t.history,m,ke,H,ae,!1,d.v7_skipActionErrorRevalidation,_e,he,X,Oe,we,me,Ot,l,[D.route.id,Z]);st.filter(le=>le.key!==p).forEach(le=>{let ht=le.key,Un=m.fetchers.get(ht),Ki=Tt(void 0,Un?Un.data:void 0);m.fetchers.set(ht,Ki),Ve(ht),le.controller&&te.set(ht,le.controller)}),Ce({fetchers:new Map(m.fetchers)});let Zt=()=>st.forEach(le=>Ve(le.key));K.signal.addEventListener("abort",Zt);let{loaderResults:Qt,fetcherResults:J}=await Tn(m,ke,xt,st,dt);if(K.signal.aborted)return;K.signal.removeEventListener("abort",Zt),se.delete(p),te.delete(p),st.forEach(le=>te.delete(le.key));let oe=nr(Qt);if(oe)return it(dt,oe.result,!1,{preventScrollReset:M});if(oe=nr(J),oe)return me.add(oe.key),it(dt,oe.result,!1,{preventScrollReset:M});let{loaderData:ft,errors:Dt}=ba(m,ke,Qt,void 0,st,J,nt);if(m.fetchers.has(p)){let le=We(Z.data);m.fetchers.set(p,le)}Hn(Pe),m.navigation.state==="loading"&&Pe>$e?(z(b,"Expected pending action"),I&&I.abort(),ut(m.navigation.location,{matches:ke,loaderData:ft,errors:Dt,fetchers:new Map(m.fetchers)})):(Ce({errors:Dt,loaderData:La(m.loaderData,ft,ke,Dt),fetchers:new Map(m.fetchers)}),_e=!1)}async function ji(p,v,C,D,T,F,U,M,H){let k=m.fetchers.get(p);Ue(p,Tt(H,k?k.data:void 0),{flushSync:U});let j=new AbortController,K=gt(t.history,C,j.signal);if(F){let Z=await Xt(T,new URL(K.url).pathname,K.signal,p);if(Z.type==="aborted")return;if(Z.type==="error"){Ie(p,v,Z.error,{flushSync:U});return}else if(Z.matches)T=Z.matches,D=kt(T,C);else{Ie(p,v,Ne(404,{pathname:C}),{flushSync:U});return}}te.set(p,j);let Y=Te,re=(await Lt("loader",m,K,[D],T,p))[D.route.id];if(qe(re)&&(re=await wn(re,K.signal,!0)||re),te.get(p)===j&&te.delete(p),!K.signal.aborted){if(Oe.has(p)){Ue(p,We(void 0));return}if(ct(re))if($e>Y){Ue(p,We(void 0));return}else{me.add(p),await it(K,re,!1,{preventScrollReset:M});return}if(Re(re)){Ie(p,v,re.error);return}z(!qe(re),"Unhandled fetcher deferred data"),Ue(p,We(re.data))}}async function it(p,v,C,D){let{submission:T,fetcherSubmission:F,preventScrollReset:U,replace:M}=D===void 0?{}:D;v.response.headers.has("X-Remix-Revalidate")&&(_e=!0);let H=v.response.headers.get("Location");z(H,"Expected a Location header on the redirect Response"),H=Ra(H,new URL(p.url),l);let k=Ut(m.location,H,{_isRedirect:!0});if(r){let Z=!1;if(v.response.headers.has("X-Remix-Reload-Document"))Z=!0;else if(Rn.test(H)){const ae=t.history.createURL(H);Z=ae.origin!==e.location.origin||zt(ae.pathname,l)==null}if(Z){M?e.location.replace(H):e.location.assign(H);return}}I=null;let j=M===!0||v.response.headers.has("X-Remix-Replace")?de.Replace:de.Push,{formMethod:K,formAction:Y,formEncType:Ee}=m.navigation;!T&&!F&&K&&Y&&Ee&&(T=Pa(m.navigation));let re=T||F;if(Ou.has(v.response.status)&&re&&xe(re.formMethod))await ot(j,k,{submission:ne({},re,{formAction:H}),preventScrollReset:U||x,enableViewTransition:C?W:void 0});else{let Z=Xr(k,T);await ot(j,k,{overrideNavigation:Z,fetcherSubmission:F,preventScrollReset:U||x,enableViewTransition:C?W:void 0})}}async function Lt(p,v,C,D,T,F){let U,M={};try{U=await Mu(c,p,v,C,D,T,F,o,a)}catch(H){return D.forEach(k=>{M[k.route.id]={type:Q.error,error:H}}),M}for(let[H,k]of Object.entries(U))if(Uu(k)){let j=k.result;M[H]={type:Q.redirect,response:Fu(j,C,H,T,l,d.v7_relativeSplatPath)}}else M[H]=await ju(k);return M}async function Tn(p,v,C,D,T){let F=p.matches,U=Lt("loader",p,T,C,v,null),M=Promise.all(D.map(async j=>{if(j.matches&&j.match&&j.controller){let Y=(await Lt("loader",p,gt(t.history,j.path,j.controller.signal),[j.match],j.matches,j.key))[j.match.route.id];return{[j.key]:Y}}else return Promise.resolve({[j.key]:{type:Q.error,error:Ne(404,{pathname:j.path})}})})),H=await U,k=(await M).reduce((j,K)=>Object.assign(j,K),{});return await Promise.all([Ku(v,H,T.signal,F,p.loaderData),zu(v,k,D)]),{loaderResults:H,fetcherResults:k}}function jr(){_e=!0,he.push(...$r()),we.forEach((p,v)=>{te.has(v)&&X.add(v),Ve(v)})}function Ue(p,v,C){C===void 0&&(C={}),m.fetchers.set(p,v),Ce({fetchers:new Map(m.fetchers)},{flushSync:(C&&C.flushSync)===!0})}function Ie(p,v,C,D){D===void 0&&(D={});let T=lt(m.matches,v);Yt(p),Ce({errors:{[T.route.id]:C},fetchers:new Map(m.fetchers)},{flushSync:(D&&D.flushSync)===!0})}function In(p){return Be.set(p,(Be.get(p)||0)+1),Oe.has(p)&&Oe.delete(p),m.fetchers.get(p)||xu}function Yt(p){let v=m.fetchers.get(p);te.has(p)&&!(v&&v.state==="loading"&&se.has(p))&&Ve(p),we.delete(p),se.delete(p),me.delete(p),d.v7_fetcherPersist&&Oe.delete(p),X.delete(p),m.fetchers.delete(p)}function Fi(p){let v=(Be.get(p)||0)-1;v<=0?(Be.delete(p),Oe.add(p),d.v7_fetcherPersist||Yt(p)):Be.set(p,v),Ce({fetchers:new Map(m.fetchers)})}function Ve(p){let v=te.get(p);v&&(v.abort(),te.delete(p))}function kn(p){for(let v of p){let C=In(v),D=We(C.data);m.fetchers.set(v,D)}}function Mn(){let p=[],v=!1;for(let C of me){let D=m.fetchers.get(C);z(D,"Expected fetcher: "+C),D.state==="loading"&&(me.delete(C),p.push(C),v=!0)}return kn(p),v}function Hn(p){let v=[];for(let[C,D]of se)if(D<p){let T=m.fetchers.get(C);z(T,"Expected fetcher: "+C),T.state==="loading"&&(Ve(C),se.delete(C),v.push(C))}return kn(v),v.length>0}function $i(p,v){let C=m.blockers.get(p)||At;return at.get(p)!==v&&at.set(p,v),C}function jn(p){m.blockers.delete(p),at.delete(p)}function qt(p,v){let C=m.blockers.get(p)||At;z(C.state==="unblocked"&&v.state==="blocked"||C.state==="blocked"&&v.state==="blocked"||C.state==="blocked"&&v.state==="proceeding"||C.state==="blocked"&&v.state==="unblocked"||C.state==="proceeding"&&v.state==="unblocked","Invalid blocker state transition: "+C.state+" -> "+v.state);let D=new Map(m.blockers);D.set(p,v),Ce({blockers:D})}function Fn(p){let{currentLocation:v,nextLocation:C,historyAction:D}=p;if(at.size===0)return;at.size>1&&bt(!1,"A router only supports one blocker at a time");let T=Array.from(at.entries()),[F,U]=T[T.length-1],M=m.blockers.get(F);if(!(M&&M.state==="proceeding")&&U({currentLocation:v,nextLocation:C,historyAction:D}))return F}function Fr(p){let v=Ne(404,{pathname:p}),C=s||i,{matches:D,route:T}=xa(C);return $r(),{notFoundMatches:D,route:T,error:v}}function $r(p){let v=[];return nt.forEach((C,D)=>{(!p||p(D))&&(C.cancel(),v.push(D),nt.delete(D))}),v}function Bi(p,v,C){if(E=p,S=v,_=C||null,!y&&m.navigation===Jr){y=!0;let D=Bn(m.location,m.matches);D!=null&&Ce({restoreScrollPosition:D})}return()=>{E=null,S=null,_=null}}function $n(p,v){return _&&_(p,v.map(D=>iu(D,m.loaderData)))||p.key}function Ui(p,v){if(E&&S){let C=$n(p,v);E[C]=S()}}function Bn(p,v){if(E){let C=$n(p,v),D=E[C];if(typeof D=="number")return D}return null}function Jt(p,v,C){if(u)if(p){if(Object.keys(p[0].params).length>0)return{active:!0,matches:cr(v,C,l,!0)}}else return{active:!0,matches:cr(v,C,l,!0)||[]};return{active:!1,matches:null}}async function Xt(p,v,C,D){if(!u)return{type:"success",matches:p};let T=p;for(;;){let F=s==null,U=s||i,M=o;try{await u({signal:C,path:v,matches:T,fetcherKey:D,patch:(j,K)=>{C.aborted||Na(j,K,U,M,a)}})}catch(j){return{type:"error",error:j,partialMatches:T}}finally{F&&!C.aborted&&(i=[...i])}if(C.aborted)return{type:"aborted"};let H=ze(U,v,l);if(H)return{type:"success",matches:H};let k=cr(U,v,l,!0);if(!k||T.length===k.length&&T.every((j,K)=>j.route.id===k[K].route.id))return{type:"success",matches:null};T=k}}function Vi(p){o={},s=vr(p,a,void 0,o)}function Wi(p,v){let C=s==null;Na(p,v,s||i,o,a),C&&(i=[...i],Ce({}))}return P={get basename(){return l},get future(){return d},get state(){return m},get routes(){return i},get window(){return e},initialize:xi,subscribe:Pi,enableScrollRestoration:Bi,navigate:Pn,fetch:Mi,revalidate:Ai,createHref:p=>t.history.createHref(p),encodeLocation:p=>t.history.encodeLocation(p),getFetcher:In,deleteFetcher:Fi,dispose:Di,getBlocker:$i,deleteBlocker:jn,patchRoutes:Wi,_internalFetchControllers:te,_internalActiveDeferreds:nt,_internalSetRoutes:Vi},P}function Au(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function dn(t,e,r,n,a,o,i,s){let l,c;if(i){l=[];for(let d of e)if(l.push(d),d.route.id===i){c=d;break}}else l=e,c=e[e.length-1];let u=Uo(a||".",Bo(l,o),zt(t.pathname,r)||t.pathname,s==="path");if(a==null&&(u.search=t.search,u.hash=t.hash),(a==null||a===""||a===".")&&c){let d=bn(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),f=h.getAll("index");h.delete("index"),f.filter(_=>_).forEach(_=>h.append("index",_));let E=h.toString();u.search=E?"?"+E:""}}return n&&r!=="/"&&(u.pathname=u.pathname==="/"?r:Qe([r,u.pathname])),Kt(u)}function _a(t,e,r,n){if(!n||!Au(n))return{path:r};if(n.formMethod&&!Wu(n.formMethod))return{path:r,error:Ne(405,{method:n.formMethod})};let a=()=>({path:r,error:Ne(400,{type:"invalid-body"})}),o=n.formMethod||"get",i=t?o.toUpperCase():o.toLowerCase(),s=Go(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!xe(i))return a();let h=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,E)=>{let[_,S]=E;return""+f+_+"="+S+`
|
|
5
5
|
`},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:void 0,text:h}}}else if(n.formEncType==="application/json"){if(!xe(i))return a();try{let h=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:h,text:void 0}}}catch{return a()}}}z(typeof FormData=="function","FormData is not available in this environment");let l,c;if(n.formData)l=hn(n.formData),c=n.formData;else if(n.body instanceof FormData)l=hn(n.body),c=n.body;else if(n.body instanceof URLSearchParams)l=n.body,c=wa(l);else if(n.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(n.body),c=wa(l)}catch{return a()}let u={formMethod:i,formAction:s,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(xe(u.formMethod))return{path:r,submission:u};let d=et(r);return e&&d.search&&bn(d.search)&&l.append("index",""),d.search="?"+l,{path:Kt(d),submission:u}}function ya(t,e,r){r===void 0&&(r=!1);let n=t.findIndex(a=>a.route.id===e);return n>=0?t.slice(0,r?n+1:n):t}function Ca(t,e,r,n,a,o,i,s,l,c,u,d,h,f,E,_){let S=_?Re(_[1])?_[1].error:_[1].data:void 0,y=t.createURL(e.location),w=t.createURL(a),O=r;o&&e.errors?O=ya(r,Object.keys(e.errors)[0],!0):_&&Re(_[1])&&(O=ya(r,_[0]));let N=_?_[1].statusCode:void 0,L=i&&N&&N>=400,P=O.filter((b,x)=>{let{route:I}=b;if(I.lazy)return!0;if(I.loader==null)return!1;if(o)return fn(I,e.loaderData,e.errors);if(Tu(e.loaderData,e.matches[x],b)||l.some(G=>G===b.route.id))return!0;let W=e.matches[x],B=b;return Sa(b,ne({currentUrl:y,currentParams:W.params,nextUrl:w,nextParams:B.params},n,{actionResult:S,actionStatus:N,defaultShouldRevalidate:L?!1:s||y.pathname+y.search===w.pathname+w.search||y.search!==w.search||Ko(W,B)}))}),m=[];return d.forEach((b,x)=>{if(o||!r.some(q=>q.route.id===b.routeId)||u.has(x))return;let I=ze(f,b.path,E);if(!I){m.push({key:x,routeId:b.routeId,path:b.path,matches:null,match:null,controller:null});return}let W=e.fetchers.get(x),B=kt(I,b.path),G=!1;h.has(x)?G=!1:c.has(x)?(c.delete(x),G=!0):W&&W.state!=="idle"&&W.data===void 0?G=s:G=Sa(B,ne({currentUrl:y,currentParams:e.matches[e.matches.length-1].params,nextUrl:w,nextParams:r[r.length-1].params},n,{actionResult:S,actionStatus:N,defaultShouldRevalidate:L?!1:s})),G&&m.push({key:x,routeId:b.routeId,path:b.path,matches:I,match:B,controller:new AbortController})}),[P,m]}function fn(t,e,r){if(t.lazy)return!0;if(!t.loader)return!1;let n=e!=null&&e[t.id]!==void 0,a=r!=null&&r[t.id]!==void 0;return!n&&a?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!n&&!a}function Tu(t,e,r){let n=!e||r.route.id!==e.route.id,a=t[r.route.id]===void 0;return n||a}function Ko(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function Sa(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function Na(t,e,r,n,a){var o;let i;if(t){let c=n[t];z(c,"No route found to patch children into: routeId = "+t),c.children||(c.children=[]),i=c.children}else i=r;let s=e.filter(c=>!i.some(u=>zo(c,u))),l=vr(s,a,[t||"_","patch",String(((o=i)==null?void 0:o.length)||"0")],n);i.push(...l)}function zo(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((r,n)=>{var a;return(a=e.children)==null?void 0:a.some(o=>zo(r,o))}):!1}async function Iu(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let a=r[t.id];z(a,"No route found in manifest");let o={};for(let i in n){let l=a[i]!==void 0&&i!=="hasErrorBoundary";bt(!l,'Route "'+a.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!l&&!au.has(i)&&(o[i]=n[i])}Object.assign(a,o),Object.assign(a,ne({},e(a),{lazy:void 0}))}async function ku(t){let{matches:e}=t,r=e.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,o,i)=>Object.assign(a,{[r[i].route.id]:o}),{})}async function Mu(t,e,r,n,a,o,i,s,l,c){let u=o.map(f=>f.route.lazy?Iu(f.route,l,s):void 0),d=o.map((f,E)=>{let _=u[E],S=a.some(w=>w.route.id===f.route.id);return ne({},f,{shouldLoad:S,resolve:async w=>(w&&n.method==="GET"&&(f.route.lazy||f.route.loader)&&(S=!0),S?Hu(e,n,f,_,w,c):Promise.resolve({type:Q.data,result:void 0}))})}),h=await t({matches:d,request:n,params:o[0].params,fetcherKey:i,context:c});try{await Promise.all(u)}catch{}return h}async function Hu(t,e,r,n,a,o){let i,s,l=c=>{let u,d=new Promise((E,_)=>u=_);s=()=>u(),e.signal.addEventListener("abort",s);let h=E=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):c({request:e,params:r.params,context:o},...E!==void 0?[E]:[]),f=(async()=>{try{return{type:"data",result:await(a?a(_=>h(_)):h())}}catch(E){return{type:"error",result:E}}})();return Promise.race([f,d])};try{let c=r.route[t];if(n)if(c){let u,[d]=await Promise.all([l(c).catch(h=>{u=h}),n]);if(u!==void 0)throw u;i=d}else if(await n,c=r.route[t],c)i=await l(c);else if(t==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw Ne(405,{method:e.method,pathname:d,routeId:r.route.id})}else return{type:Q.data,result:void 0};else if(c)i=await l(c);else{let u=new URL(e.url),d=u.pathname+u.search;throw Ne(404,{pathname:d})}z(i.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:Q.error,result:c}}finally{s&&e.signal.removeEventListener("abort",s)}return i}async function ju(t){let{result:e,type:r}=t;if(Yo(e)){let d;try{let h=e.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?e.body==null?d=null:d=await e.json():d=await e.text()}catch(h){return{type:Q.error,error:h}}return r===Q.error?{type:Q.error,error:new _r(e.status,e.statusText,d),statusCode:e.status,headers:e.headers}:{type:Q.data,data:d,statusCode:e.status,headers:e.headers}}if(r===Q.error){if(Da(e)){var n,a;if(e.data instanceof Error){var o,i;return{type:Q.error,error:e.data,statusCode:(o=e.init)==null?void 0:o.status,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}}return{type:Q.error,error:new _r(((n=e.init)==null?void 0:n.status)||500,void 0,e.data),statusCode:Vt(e)?e.status:void 0,headers:(a=e.init)!=null&&a.headers?new Headers(e.init.headers):void 0}}return{type:Q.error,error:e,statusCode:Vt(e)?e.status:void 0}}if(Vu(e)){var s,l;return{type:Q.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((l=e.init)==null?void 0:l.headers)&&new Headers(e.init.headers)}}if(Da(e)){var c,u;return{type:Q.data,data:e.data,statusCode:(c=e.init)==null?void 0:c.status,headers:(u=e.init)!=null&&u.headers?new Headers(e.init.headers):void 0}}return{type:Q.data,data:e}}function Fu(t,e,r,n,a,o){let i=t.headers.get("Location");if(z(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Rn.test(i)){let s=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=dn(new URL(e.url),s,a,!0,i,o),t.headers.set("Location",i)}return t}function Ra(t,e,r){if(Rn.test(t)){let n=t,a=n.startsWith("//")?new URL(e.protocol+n):new URL(n),o=zt(a.pathname,r)!=null;if(a.origin===e.origin&&o)return a.pathname+a.search+a.hash}return t}function gt(t,e,r,n){let a=t.createURL(Go(e)).toString(),o={signal:r};if(n&&xe(n.formMethod)){let{formMethod:i,formEncType:s}=n;o.method=i.toUpperCase(),s==="application/json"?(o.headers=new Headers({"Content-Type":s}),o.body=JSON.stringify(n.json)):s==="text/plain"?o.body=n.text:s==="application/x-www-form-urlencoded"&&n.formData?o.body=hn(n.formData):o.body=n.formData}return new Request(a,o)}function hn(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function wa(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function $u(t,e,r,n,a){let o={},i=null,s,l=!1,c={},u=r&&Re(r[1])?r[1].error:void 0;return t.forEach(d=>{if(!(d.route.id in e))return;let h=d.route.id,f=e[h];if(z(!ct(f),"Cannot handle redirect results in processLoaderData"),Re(f)){let E=f.error;u!==void 0&&(E=u,u=void 0),i=i||{};{let _=lt(t,h);i[_.route.id]==null&&(i[_.route.id]=E)}o[h]=void 0,l||(l=!0,s=Vt(f.error)?f.error.status:500),f.headers&&(c[h]=f.headers)}else qe(f)?(n.set(h,f.deferredData),o[h]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!l&&(s=f.statusCode),f.headers&&(c[h]=f.headers)):(o[h]=f.data,f.statusCode&&f.statusCode!==200&&!l&&(s=f.statusCode),f.headers&&(c[h]=f.headers))}),u!==void 0&&r&&(i={[r[0]]:u},o[r[0]]=void 0),{loaderData:o,errors:i,statusCode:s||200,loaderHeaders:c}}function ba(t,e,r,n,a,o,i){let{loaderData:s,errors:l}=$u(e,r,n,i);return a.forEach(c=>{let{key:u,match:d,controller:h}=c,f=o[u];if(z(f,"Did not find corresponding fetcher result"),!(h&&h.signal.aborted))if(Re(f)){let E=lt(t.matches,d?.route.id);l&&l[E.route.id]||(l=ne({},l,{[E.route.id]:f.error})),t.fetchers.delete(u)}else if(ct(f))z(!1,"Unhandled fetcher revalidation redirect");else if(qe(f))z(!1,"Unhandled fetcher deferred data");else{let E=We(f.data);t.fetchers.set(u,E)}}),{loaderData:s,errors:l}}function La(t,e,r,n){let a=ne({},e);for(let o of r){let i=o.route.id;if(e.hasOwnProperty(i)?e[i]!==void 0&&(a[i]=e[i]):t[i]!==void 0&&o.route.loader&&(a[i]=t[i]),n&&n.hasOwnProperty(i))break}return a}function Oa(t){return t?Re(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function lt(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function xa(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Ne(t,e){let{pathname:r,routeId:n,method:a,type:o,message:i}=e===void 0?{}:e,s="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(s="Bad Request",a&&r&&n?l="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":o==="defer-action"?l="defer() is not supported in actions":o==="invalid-body"&&(l="Unable to encode submission body")):t===403?(s="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):t===404?(s="Not Found",l='No route matches URL "'+r+'"'):t===405&&(s="Method Not Allowed",a&&r&&n?l="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new _r(t||500,s,new Error(l),!0)}function nr(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,a]=e[r];if(ct(a))return{key:n,result:a}}}function Go(t){let e=typeof t=="string"?et(t):t;return Kt(ne({},e,{hash:""}))}function Bu(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Uu(t){return Yo(t.result)&&Lu.has(t.result.status)}function qe(t){return t.type===Q.deferred}function Re(t){return t.type===Q.error}function ct(t){return(t&&t.type)===Q.redirect}function Da(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Vu(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function Yo(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Wu(t){return bu.has(t.toLowerCase())}function xe(t){return Ru.has(t.toLowerCase())}async function Ku(t,e,r,n,a){let o=Object.entries(e);for(let i=0;i<o.length;i++){let[s,l]=o[i],c=t.find(h=>h?.route.id===s);if(!c)continue;let u=n.find(h=>h.route.id===c.route.id),d=u!=null&&!Ko(u,c)&&(a&&a[c.route.id])!==void 0;qe(l)&&d&&await wn(l,r,!1).then(h=>{h&&(e[s]=h)})}}async function zu(t,e,r){for(let n=0;n<r.length;n++){let{key:a,routeId:o,controller:i}=r[n],s=e[a];t.find(c=>c?.route.id===o)&&qe(s)&&(z(i,"Expected an AbortController for revalidating fetcher deferred result"),await wn(s,i.signal,!0).then(c=>{c&&(e[a]=c)}))}}async function wn(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:Q.data,data:t.deferredData.unwrappedData}}catch(a){return{type:Q.error,error:a}}return{type:Q.data,data:t.deferredData.data}}}function bn(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function kt(t,e){let r=typeof e=="string"?et(e).search:e.search;if(t[t.length-1].route.index&&bn(r||""))return t[t.length-1];let n=$o(t);return n[n.length-1]}function Pa(t){let{formMethod:e,formAction:r,formEncType:n,text:a,formData:o,json:i}=t;if(!(!e||!r||!n)){if(a!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(o!=null)return{formMethod:e,formAction:r,formEncType:n,formData:o,json:void 0,text:void 0};if(i!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function Xr(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Gu(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Tt(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Yu(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function We(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function qu(t,e){try{let r=t.sessionStorage.getItem(Wo);if(r){let n=JSON.parse(r);for(let[a,o]of Object.entries(n||{}))o&&Array.isArray(o)&&e.set(a,new Set(o||[]))}}catch{}}function Ju(t,e){if(e.size>0){let r={};for(let[n,a]of e)r[n]=[...a];try{t.sessionStorage.setItem(Wo,JSON.stringify(r))}catch(n){bt(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}function yr(){return yr=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},yr.apply(this,arguments)}const Ar=g.createContext(null),qo=g.createContext(null),Tr=g.createContext(null),Ir=g.createContext(null),tt=g.createContext({outlet:null,matches:[],isDataRoute:!1}),Jo=g.createContext(null);function kr(){return g.useContext(Ir)!=null}function Mr(){return kr()||z(!1),g.useContext(Ir).location}function Xu(){return g.useContext(Ir).navigationType}function Xo(t){g.useContext(Tr).static||g.useLayoutEffect(t)}function Zu(){let{isDataRoute:t}=g.useContext(tt);return t?hd():Qu()}function Qu(){kr()||z(!1);let t=g.useContext(Ar),{basename:e,future:r,navigator:n}=g.useContext(Tr),{matches:a}=g.useContext(tt),{pathname:o}=Mr(),i=JSON.stringify(Bo(a,r.v7_relativeSplatPath)),s=g.useRef(!1);return Xo(()=>{s.current=!0}),g.useCallback(function(c,u){if(u===void 0&&(u={}),!s.current)return;if(typeof c=="number"){n.go(c);return}let d=Uo(c,JSON.parse(i),o,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Qe([e,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[e,n,i,o,t])}const ed=g.createContext(null);function td(t){let e=g.useContext(tt).outlet;return e&&g.createElement(ed.Provider,{value:t},e)}function rd(){let{matches:t}=g.useContext(tt),e=t[t.length-1];return e?e.params:{}}function nd(t,e,r,n){kr()||z(!1);let{navigator:a}=g.useContext(Tr),{matches:o}=g.useContext(tt),i=o[o.length-1],s=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let c=Mr(),u;u=c;let d=u.pathname||"/",h=d;if(l!=="/"){let _=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(_.length).join("/")}let f=ze(t,{pathname:h});return ld(f&&f.map(_=>Object.assign({},_,{params:Object.assign({},s,_.params),pathname:Qe([l,a.encodeLocation?a.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?l:Qe([l,a.encodeLocation?a.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),o,r,n)}function ad(){let t=fd(),e=Vt(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),r?g.createElement("pre",{style:a},r):null,null)}const od=g.createElement(ad,null);class id extends g.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?g.createElement(tt.Provider,{value:this.props.routeContext},g.createElement(Jo.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sd(t){let{routeContext:e,match:r,children:n}=t,a=g.useContext(Ar);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),g.createElement(tt.Provider,{value:e},n)}function ld(t,e,r,n){var a;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if(!r)return null;if(r.errors)t=r.matches;else if((o=n)!=null&&o.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,s=(a=r)==null?void 0:a.errors;if(s!=null){let u=i.findIndex(d=>d.route.id&&s?.[d.route.id]!==void 0);u>=0||z(!1),i=i.slice(0,Math.min(i.length,u+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<i.length;u++){let d=i[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:h,errors:f}=r,E=d.route.loader&&h[d.route.id]===void 0&&(!f||f[d.route.id]===void 0);if(d.route.lazy||E){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((u,d,h)=>{let f,E=!1,_=null,S=null;r&&(f=s&&d.route.id?s[d.route.id]:void 0,_=d.route.errorElement||od,l&&(c<0&&h===0?(pd("route-fallback"),E=!0,S=null):c===h&&(E=!0,S=d.route.hydrateFallbackElement||null)));let y=e.concat(i.slice(0,h+1)),w=()=>{let O;return f?O=_:E?O=S:d.route.Component?O=g.createElement(d.route.Component,null):d.route.element?O=d.route.element:O=u,g.createElement(sd,{match:d,routeContext:{outlet:u,matches:y,isDataRoute:r!=null},children:O})};return r&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?g.createElement(id,{location:r.location,revalidation:r.revalidation,component:_,error:f,children:w(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):w()},null)}var Zo=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Zo||{}),Qo=(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})(Qo||{});function cd(t){let e=g.useContext(Ar);return e||z(!1),e}function ud(t){let e=g.useContext(qo);return e||z(!1),e}function dd(t){let e=g.useContext(tt);return e||z(!1),e}function ei(t){let e=dd(),r=e.matches[e.matches.length-1];return r.route.id||z(!1),r.route.id}function fd(){var t;let e=g.useContext(Jo),r=ud(Qo.UseRouteError),n=ei();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function hd(){let{router:t}=cd(Zo.UseNavigateStable),e=ei(),r=g.useRef(!1);return Xo(()=>{r.current=!0}),g.useCallback(function(a,o){o===void 0&&(o={}),r.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,yr({fromRouteId:e},o)))},[t,e])}const Aa={};function pd(t,e,r){Aa[t]||(Aa[t]=!0)}function gd(t,e){t?.v7_startTransition,t?.v7_relativeSplatPath===void 0&&(!e||e.v7_relativeSplatPath),e&&(e.v7_fetcherPersist,e.v7_normalizeFormMethod,e.v7_partialHydration,e.v7_skipActionErrorRevalidation)}function md(t){return td(t.context)}function Ed(t){z(!1)}function vd(t){let{basename:e="/",children:r=null,location:n,navigationType:a=de.Pop,navigator:o,static:i=!1,future:s}=t;kr()&&z(!1);let l=e.replace(/^\/*/,"/"),c=g.useMemo(()=>({basename:l,navigator:o,static:i,future:yr({v7_relativeSplatPath:!1},s)}),[l,s,o,i]);typeof n=="string"&&(n=et(n));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:E="default"}=n,_=g.useMemo(()=>{let S=zt(u,l);return S==null?null:{location:{pathname:S,search:d,hash:h,state:f,key:E},navigationType:a}},[l,u,d,h,f,E,a]);return _==null?null:g.createElement(Tr.Provider,{value:c},g.createElement(Ir.Provider,{children:r,value:_}))}new Promise(()=>{});function pn(t,e){e===void 0&&(e=[]);let r=[];return g.Children.forEach(t,(n,a)=>{if(!g.isValidElement(n))return;let o=[...e,a];if(n.type===g.Fragment){r.push.apply(r,pn(n.props.children,o));return}n.type!==Ed&&z(!1),!n.props.index||!n.props.children||z(!1);let i={id:n.props.id||o.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&&(i.children=pn(n.props.children,o)),r.push(i)}),r}function _d(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:g.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:g.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:g.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function Cr(){return Cr=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},Cr.apply(this,arguments)}const yd="6";try{window.__reactRouterVersion=yd}catch{}function Cd(t,e){return Pu({basename:e?.basename,future:Cr({},e?.future,{v7_prependBasename:!0}),history:tu({window:e?.window}),hydrationData:e?.hydrationData||Sd(),routes:t,mapRouteProperties:_d,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window}).initialize()}function Sd(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=Cr({},e,{errors:Nd(e.errors)})),e}function Nd(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,a]of e)if(a&&a.__type==="RouteErrorResponse")r[n]=new _r(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let o=window[a.__subType];if(typeof o=="function")try{let i=new o(a.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let o=new Error(a.message);o.stack="",r[n]=o}}else r[n]=a;return r}const Rd=g.createContext({isTransitioning:!1}),wd=g.createContext(new Map),bd="startTransition",Ta=Ji[bd],Ld="flushSync",Ia=Yi[Ld];function Od(t){Ta?Ta(t):t()}function It(t){Ia?Ia(t):t()}class xd{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function Dd(t){let{fallbackElement:e,router:r,future:n}=t,[a,o]=g.useState(r.state),[i,s]=g.useState(),[l,c]=g.useState({isTransitioning:!1}),[u,d]=g.useState(),[h,f]=g.useState(),[E,_]=g.useState(),S=g.useRef(new Map),{v7_startTransition:y}=n||{},w=g.useCallback(b=>{y?Od(b):b()},[y]),O=g.useCallback((b,x)=>{let{deletedFetchers:I,flushSync:W,viewTransitionOpts:B}=x;b.fetchers.forEach((q,_e)=>{q.data!==void 0&&S.current.set(_e,q.data)}),I.forEach(q=>S.current.delete(q));let G=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!B||G){W?It(()=>o(b)):w(()=>o(b));return}if(W){It(()=>{h&&(u&&u.resolve(),h.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:B.currentLocation,nextLocation:B.nextLocation})});let q=r.window.document.startViewTransition(()=>{It(()=>o(b))});q.finished.finally(()=>{It(()=>{d(void 0),f(void 0),s(void 0),c({isTransitioning:!1})})}),It(()=>f(q));return}h?(u&&u.resolve(),h.skipTransition(),_({state:b,currentLocation:B.currentLocation,nextLocation:B.nextLocation})):(s(b),c({isTransitioning:!0,flushSync:!1,currentLocation:B.currentLocation,nextLocation:B.nextLocation}))},[r.window,h,u,S,w]);g.useLayoutEffect(()=>r.subscribe(O),[r,O]),g.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new xd)},[l]),g.useEffect(()=>{if(u&&i&&r.window){let b=i,x=u.promise,I=r.window.document.startViewTransition(async()=>{w(()=>o(b)),await x});I.finished.finally(()=>{d(void 0),f(void 0),s(void 0),c({isTransitioning:!1})}),f(I)}},[w,i,u,r.window]),g.useEffect(()=>{u&&i&&a.location.key===i.location.key&&u.resolve()},[u,h,a.location,i]),g.useEffect(()=>{!l.isTransitioning&&E&&(s(E.state),c({isTransitioning:!0,flushSync:!1,currentLocation:E.currentLocation,nextLocation:E.nextLocation}),_(void 0))},[l.isTransitioning,E]),g.useEffect(()=>{},[]);let N=g.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:b=>r.navigate(b),push:(b,x,I)=>r.navigate(b,{state:x,preventScrollReset:I?.preventScrollReset}),replace:(b,x,I)=>r.navigate(b,{replace:!0,state:x,preventScrollReset:I?.preventScrollReset})}),[r]),L=r.basename||"/",P=g.useMemo(()=>({router:r,navigator:N,static:!1,basename:L}),[r,N,L]),m=g.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return g.useEffect(()=>gd(n,r.future),[n,r.future]),g.createElement(g.Fragment,null,g.createElement(Ar.Provider,{value:P},g.createElement(qo.Provider,{value:a},g.createElement(wd.Provider,{value:S.current},g.createElement(Rd.Provider,{value:l},g.createElement(vd,{basename:L,location:a.location,navigationType:a.historyAction,navigator:N,future:m},a.initialized||r.future.v7_partialHydration?g.createElement(Pd,{routes:r.routes,future:r.future,state:a}):e))))),null)}const Pd=g.memo(Ad);function Ad(t){let{routes:e,future:r,state:n}=t;return nd(e,void 0,n,r)}var ka;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(ka||(ka={}));var Ma;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Ma||(Ma={}));const Ha=_n(["sentry"]);let Ln=!1;async function ti(){return await ge(()=>import("./sentry_react-CVx4Qq7f.js").then(t=>t.i),__vite__mapDeps([0,1,2]))}async function Td(){const t=await ti(),e=[t.httpClientIntegration(),t.extraErrorDataIntegration({depth:5}),t.replayIntegration(),t.captureConsoleIntegration({levels:["error"]})];fe.sentry.tracing&&e.push(t.reactRouterV6BrowserTracingIntegration({useEffect:Xi.useEffect,useLocation:Mr,useNavigationType:Xu,createRoutesFromChildren:pn,matchRoutes:ze})),t.init({release:fe.sentry.release,dsn:fe.sentry.dsn,environment:fe.sentry.env,integrations:e,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(r,n){const a=n.originalException;return a instanceof TypeError&&a.message.includes("Failed to fetch")&&!navigator.onLine?null:r}}),Ln=!0}async function Id(){return Ln?(await ti()).getClient()?.close():void 0}function kd(){const[t]=Cn(),{analytics:e}=t;g.useEffect(()=>{if(!e){Id().catch(r=>Ha.error("@error",r));return}Ln||!fe.sentry.dsn||fe.sentry.dsn===""||Td().catch(r=>Ha.error("@error",r))},[e])}function gn(){return gn=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},gn.apply(null,arguments)}var ri=["shift","alt","meta","mod","ctrl"],Md={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Je(t){return(t&&Md[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function Hd(t){return ri.includes(t)}function Zr(t,e){return e===void 0&&(e=","),t.split(e)}function Qr(t,e,r){e===void 0&&(e="+");var n=t.toLocaleLowerCase().split(e).map(function(i){return Je(i)}),a={alt:n.includes("alt"),ctrl:n.includes("ctrl")||n.includes("control"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},o=n.filter(function(i){return!ri.includes(i)});return gn({},a,{keys:o,description:r,hotkey:t})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(t){t.key!==void 0&&ni([Je(t.key),Je(t.code)])}),document.addEventListener("keyup",function(t){t.key!==void 0&&ai([Je(t.key),Je(t.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){Xe.clear()})})();var Xe=new Set;function On(t){return Array.isArray(t)}function jd(t,e){e===void 0&&(e=",");var r=On(t)?t:t.split(e);return r.every(function(n){return Xe.has(n.trim().toLowerCase())})}function ni(t){var e=Array.isArray(t)?t:[t];Xe.has("meta")&&Xe.forEach(function(r){return!Hd(r)&&Xe.delete(r.toLowerCase())}),e.forEach(function(r){return Xe.add(r.toLowerCase())})}function ai(t){var e=Array.isArray(t)?t:[t];t==="meta"?Xe.clear():e.forEach(function(r){return Xe.delete(r.toLowerCase())})}function Fd(t,e,r){(typeof r=="function"&&r(t,e)||r===!0)&&t.preventDefault()}function $d(t,e,r){return typeof r=="function"?r(t,e):r===!0||r===void 0}function Bd(t){return oi(t,["input","textarea","select"])}function oi(t,e){e===void 0&&(e=!1);var r=t.target,n=t.composed,a=null;return Ud(r)&&n?a=t.composedPath()[0]&&t.composedPath()[0].tagName:a=r&&r.tagName,On(e)?!!(a&&e&&e.some(function(o){var i;return o.toLowerCase()===((i=a)==null?void 0:i.toLowerCase())})):!!(a&&e&&e)}function Ud(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function Vd(t,e){return t.length===0&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):e?t.some(function(r){return e.includes(r)})||t.includes("*"):!0}var Wd=function(e,r,n){n===void 0&&(n=!1);var a=r.alt,o=r.meta,i=r.mod,s=r.shift,l=r.ctrl,c=r.keys,u=e.key,d=e.code,h=e.ctrlKey,f=e.metaKey,E=e.shiftKey,_=e.altKey,S=Je(d),y=u.toLowerCase();if(!(c!=null&&c.includes(S))&&!(c!=null&&c.includes(y))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(S))return!1;if(!n){if(a===!_&&y!=="alt"||s===!E&&y!=="shift")return!1;if(i){if(!f&&!h)return!1}else if(o===!f&&y!=="meta"&&y!=="os"||l===!h&&y!=="ctrl"&&y!=="control")return!1}return c&&c.length===1&&(c.includes(y)||c.includes(S))?!0:c?jd(c):!c},Kd=g.createContext(void 0),zd=function(){return g.useContext(Kd)};function ii(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce(function(r,n){return r&&ii(t[n],e[n])},!0):t===e}var Gd=g.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Yd=function(){return g.useContext(Gd)};function qd(t){var e=g.useRef(void 0);return ii(e.current,t)||(e.current=t),e.current}var ja=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Jd=typeof window<"u"?g.useLayoutEffect:g.useEffect;function Fa(t,e,r,n){var a=g.useState(null),o=a[0],i=a[1],s=g.useRef(!1),l=r instanceof Array?n instanceof Array?void 0:n:r,c=On(t)?t.join(l?.splitKey):t,u=r instanceof Array?r:n instanceof Array?n:void 0,d=g.useCallback(e,u??[]),h=g.useRef(d);u?h.current=d:h.current=e;var f=qd(l),E=Yd(),_=E.enabledScopes,S=zd();return Jd(function(){if(!(f?.enabled===!1||!Vd(_,f?.scopes))){var y=function(P,m){var b;if(m===void 0&&(m=!1),!(Bd(P)&&!oi(P,f?.enableOnFormTags))){if(o!==null){var x=o.getRootNode();if((x instanceof Document||x instanceof ShadowRoot)&&x.activeElement!==o&&!o.contains(x.activeElement)){ja(P);return}}(b=P.target)!=null&&b.isContentEditable&&!(f!=null&&f.enableOnContentEditable)||Zr(c,f?.splitKey).forEach(function(I){var W,B=Qr(I,f?.combinationKey);if(Wd(P,B,f?.ignoreModifiers)||(W=B.keys)!=null&&W.includes("*")){if(f!=null&&f.ignoreEventWhen!=null&&f.ignoreEventWhen(P)||m&&s.current)return;if(Fd(P,B,f?.preventDefault),!$d(P,B,f?.enabled)){ja(P);return}h.current(P,B),m||(s.current=!0)}})}},w=function(P){P.key!==void 0&&(ni(Je(P.code)),(f?.keydown===void 0&&f?.keyup!==!0||f!=null&&f.keydown)&&y(P))},O=function(P){P.key!==void 0&&(ai(Je(P.code)),s.current=!1,f!=null&&f.keyup&&y(P,!0))},N=o||l?.document||document;return N.addEventListener("keyup",O,l?.eventListenerOptions),N.addEventListener("keydown",w,l?.eventListenerOptions),S&&Zr(c,f?.splitKey).forEach(function(L){return S.addHotkey(Qr(L,f?.combinationKey,f?.description))}),function(){N.removeEventListener("keyup",O,l?.eventListenerOptions),N.removeEventListener("keydown",w,l?.eventListenerOptions),S&&Zr(c,f?.splitKey).forEach(function(L){return S.removeHotkey(Qr(L,f?.combinationKey,f?.description))})}}},[o,c,f,_]),i}const Xd=t=>{const{undo:e,redo:r,canRedo:n,canUndo:a}=t,o=window.navigator.userAgent.includes("Mac");let i="ctrl+z",s="ctrl+y";o&&(i="mod+z",s="mod+shift+z"),Fa(i,l=>{l.preventDefault(),a&&e()},{},[a,e]),Fa(s,l=>{l.preventDefault(),n&&r()},{},[n,r])};window.navigator.appVersion.includes("Mac");const $a={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},Zd=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,r=Object.keys($a).find(a=>e.includes(a)),n=r?$a[r]:void 0;if(n)return`${t}/${n}/package.json`},Qd=async()=>{const t=Zd();if(!t)return;const r=await(await fetch(t)).json(),{version:n}=r;return n},ef=async()=>{const t=fe.appVersion,e=await Qd();return e?{isLatest:e===t,currentVersion:t,latestVersion:e}:null};function Ba(...t){window.dataLayer?.push(...t)}const tf=()=>{const t=fe.gaTrackingId,[{analytics:e}]=Cn(),r=t&&e;return g.useEffect(()=>{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||[],Ba("js",new Date),Ba("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null};function rf(){return typeof document>"u"?"/":document.querySelector("base")?.getAttribute("href")||"/"}async function nf(t,e,r){const n={signer:r.signer,verifier:ms()},a=async c=>{if(r.user)return r.getBearerToken({expiresIn:10,aud:c})},o=new ps("idb://reactor",{relaxedDurability:!0}),i=new Zi(["reactor-client"]);return{...await new gs().withLogger(i).withSigner(n).withReactorBuilder(new Es().withDocumentModels(t).withUpgradeManifests(e).withChannelScheme(vs.CONNECT).withJwtHandler(a).withKysely(new go({dialect:new mo(o)}))).buildModule(),pg:o}}function af(){return[]}async function of(t){for(const e of t)try{await ur(e,{})}catch(r){console.error(`Failed to add default drive ${e}:`,r)}}const sf=fe.routerBasename,lf=[sf,"service-worker.js"].join("/").replace(/\/{2,}/gm,"/");class cf{ready=!1;debug=!1;registration=null;constructor(e=!1){this.debug=e}setDebug(e){this.debug=e}#t(e){this.debug&&console.log("ServiceWorker message: ",e);const r="type"in e.data?e:null;switch(r?.data.type){case"NEW_VERSION_AVAILABLE":{if(r.data.version===fe.appVersion)return;r.data.requiresHardRefresh&&(this.debug&&console.log("New version available"),window.location.reload());break}default:{console.warn("Unhandled message:",r);break}}}#e(e){this.debug&&console.log("ServiceWorker registered: ",e),navigator.serviceWorker.addEventListener("message",this.#t.bind(this)),this.registration=e,this.ready=!0}async#r(){try{const e=await navigator.serviceWorker.getRegistration();if(e)await e.update(),this.#e(e);else{const n=await navigator.serviceWorker.register(lf);this.#e(n),n.addEventListener("updatefound",()=>{this.#e(n)})}const r=setInterval(async()=>{const n=await navigator.serviceWorker.getRegistration();n?await n.update():(clearInterval(r),this.registerServiceWorker())},fe.appVersionCheckInterval)}catch(e){console.error("ServiceWorker registration failed: ",e)}}registerServiceWorker(e=!1){if(this.debug=e,!("serviceWorker"in navigator)){console.warn("Service Worker not available");return}window.addEventListener("load",()=>{this.#r().catch(console.error)})}}const uf=new cf,df=250,ff=({delay:t=df})=>{const e=typeof window>"u",r=typeof document<"u"&&document.body.getAttribute("data-show-loader")==="true",[n,a]=g.useState(!t||r);return g.useEffect(()=>{const o=setTimeout(()=>{a(!0)},t);return()=>clearTimeout(o)},[]),R.jsxs("div",{className:`skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${n?"":"hidden"}`,children:[R.jsx("div",{className:"animate-pulse overflow-hidden rounded-full shadow-lg",children:R.jsx(rs,{})}),e?R.jsx("script",{dangerouslySetInnerHTML:{__html:`setTimeout(() => {
|
|
@@ -11,7 +11,7 @@ Latest: @latestVersion`,e.currentVersion,e.latestVersion):wt(g.createElement(Yc)
|
|
|
11
11
|
const basePath = href || '/';
|
|
12
12
|
if (window.location.pathname === basePath) {
|
|
13
13
|
document.querySelector('.home-screen')?.classList.remove('hidden')
|
|
14
|
-
}`}}):null,R.jsx(ff,{})]})};function pf({children:t}){return R.jsx(R.Fragment,{children:t})}const gf=({children:t})=>(kd(),t),mf=()=>(g.useEffect(()=>{const t=()=>{console.log("Outdated chunks detected, reloading page..."),window.location.reload()};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),g.useEffect(()=>{uf.registerServiceWorker(!1)},[]),R.jsx(gf,{children:R.jsx(ns,{children:R.jsxs(pf,{children:[R.jsx(as,{position:"bottom-right",containerId:"connect"}),R.jsx(Dp,{}),R.jsx(tf,{})]})})})),Ef={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},vf={placeholder:"Search Powerhouse",filterLabel:"File type"},_f={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},yf={options:{switchboardLink:"Switchboard Link"}},Cf={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},Sf={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Nf={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},Rf={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},wf={common:Ef,searchbar:vf,folderView:_f,files:yf,modals:Cf,notifications:Sf,footer:Nf,cookieBanner:Rf},bf={en:{code:"en",name:"English",translation:wf}};ve.use(Fc).init({resources:bf,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const Lf=(t,e)=>t.some(r=>r.id===e&&r.value),Of=()=>{const{t}=ko(void 0,{useSuspense:!0,i18n:ve}),[e,r]=eu(),[,n]=Cn(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],o=s=>{r(!1),Lf(s,"analytics-cookie")&&n(l=>({...l,analytics:!0}))},i=()=>{r(!1),n(()=>({analytics:!1,functional:!1,marketing:!1}))};return e?R.jsxs("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[R.jsx("div",{className:"absolute inset-0 bg-black opacity-15"}),R.jsx("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:R.jsx(os,{className:"max-w-[1024px]",cookies:a,onSubmit:o,onReject:i,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:R.jsx("p",{className:"font-semibold text-gray-500",children:R.jsx(Bc,{i18nKey:"cookieBanner.message",components:{a:R.jsx("a",{onClick:()=>Ge({type:"cookiesPolicy"}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};function xf(){const[t]=_s(),e=ys(t.header.id),r=g.useCallback(()=>{Cs(t).length?Ge({type:"exportDocumentWithErrors",documentId:t.header.id}):Ss(t).catch(i=>{console.error(i);const s=i instanceof Error?i.message:JSON.stringify(i,null,1);wt(`Failed to export document: ${s}`)})},[t]),n=g.useMemo(()=>async()=>{},[]),a=g.useCallback(()=>{on(e)},[e,on]);return R.jsx("div",{id:"document-editor-container",className:"flex-1","data-document-type":t.header.documentType,children:R.jsx($f,{document:t,onClose:a,onExport:r,onOpenSwitchboardLink:n})})}function Mt(t){const[e,r]=g.useState(!1);if(g.useEffect(()=>{setTimeout(()=>{r(!0)},t.loadingTimeout??200)},[t]),!e)return null;const{customEditorLoader:n,...a}=t;return n?R.jsx(R.Fragment,{children:n}):R.jsx(is,{...a})}const Df=g.createContext(null),en={didCatch:!1,error:null};let Pf=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=en}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var r,n,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:o,reason:"imperative-api"}),this.setState(en)}}componentDidCatch(e,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,e,r)}componentDidUpdate(e,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&Af(e.resetKeys,a)){var o,i;(o=(i=this.props).onReset)===null||o===void 0||o.call(i,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(en)}}render(){const{children:e,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:o,error:i}=this.state;let s=e;if(o){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")s=r(l);else if(n)s=g.createElement(n,l);else if(a!==void 0)s=a;else throw i}return g.createElement(Df.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function Af(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((r,n)=>!Object.is(r,e[n]))}const Tf=_n(["Connect"]);function If(t){return"fallbackRender"in t}function kf(){return null}function Mf({message:t="Something went wrong"}){return R.jsx("div",{className:"text-center",children:t})}function Hf({error:t}){const e=t instanceof Error?t.message:String(t);return R.jsxs("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[R.jsx("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),R.jsx("i",{children:e}),R.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function si({error:t}){const e=t instanceof Error?t.message:String(t);return R.jsx("div",{className:"flex size-full items-center justify-center",children:R.jsx("h3",{className:"text-lg font-semibold",children:e})})}function jf(t,e){switch(t){case"silent":return kf;case"text":return()=>R.jsx(Mf,{message:e});case"detailed":return Hf;default:return si}}function Hr(t){const{children:e,onError:r,resetKeys:n,loggerContext:a}=t,o=(s,l)=>{if(s.message.includes("Failed to fetch dynamically imported module")&&s.message.includes("node_modules/.vite")){console.error(s),console.log("Outdated chunk detected, reloading page..."),window.location.reload();return}(a?_n(a):Tf).error("@error @info",s,l),r?.(s,l)},i=If(t)?t.fallbackRender:jf(t.variant,t.fallbackMessage);return R.jsx(Pf,{fallbackRender:i,onError:o,resetKeys:n,children:e})}function Ff(){const[t]=Ns(),e=Eo(),r=vo(t.header.meta?.preferredEditor),n=Rs(),a=r?.Component??n?.Component??uo.Component;if(!a)throw new Error("No drive editor component found");return R.jsx(Hr,{variant:"detailed",resetKeys:[t.header.id],loggerContext:["Connect","DriveEditor"],children:R.jsx(g.Suspense,{fallback:R.jsx(Mt,{}),children:R.jsx(ss,{className:"flex h-full flex-col overflow-auto",children:R.jsx(a,{children:e?R.jsx(xf,{}):null})})})})}function li({drive:t}){const e=ws(),r=g.useMemo(()=>t?e.some(a=>a.collectionId===bs("main",t.header.id)):!1,[e,t]),n=t?.state.global.icon;return n?R.jsx("img",{src:n,alt:t.header.name,height:32,width:32}):r?R.jsx(zn,{name:"Server",size:32}):R.jsx(zn,{name:"Hdd",size:32})}function Ua({message:t}){return R.jsx("div",{className:"flex size-full items-center justify-center",children:R.jsx("h3",{className:"text-lg font-semibold",children:t})})}const $f=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:a}=t,o=Ls(),i=Os(),[s,l]=xs(e.header.id),c=s?.header.id??void 0,u=s?.header.name??void 0,d=s?.header.documentType??void 0,h=s?.header.meta?.preferredEditor??void 0,{globalOperations:f,localOperations:E,isLoading:_,refetch:S}=Ds(c);g.useEffect(()=>{i&&S()},[i,S]);const y=s?.header.revision.global??0,w=s?.header.revision.local??0,O=Ps(d),N=As(h),L=Ts(d),P=N??L,m=!s,b=P&&d&&!P.documentTypes.includes(d)&&!P.documentTypes.includes("*"),x=y>0||w>0,I=!!s?.clipboard.length;Xd({undo:()=>l(Qi()),redo:()=>l(es()),canUndo:x,canRedo:I}),g.useEffect(()=>()=>{window.documentEditorDebugTools?.clear()},[]);const[G,q]=g.useState(void 0);g.useEffect(()=>{G&&G.documentId!==c&&q(void 0)},[G,c]);const _e=(X,te)=>{q({error:X,documentId:c,info:te})};if(b)return R.jsx(Mt,{message:"Loading editor"});if(m)return R.jsx(Mt,{message:"Loading document"});if(!O)return R.jsx(Ua,{message:R.jsxs("div",{className:"text-center leading-10",children:[R.jsxs("p",{children:['Unable to open the document because the document model "',d,'" is not supported.']}),R.jsxs("p",{children:["Go to the"," ",R.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ge({type:"settings"})},children:"package manager"})," ","to install this document model"]})]})});if(!P)return R.jsx(Ua,{message:R.jsxs("div",{className:"text-center leading-10",children:[R.jsx("p",{children:"Unable to open the document because no editor has been found"}),R.jsxs("p",{children:["Go to the"," ",R.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ge({type:"settings"})},children:"package manager"})," ",'an editor for the "$',d,'" document type']})]})});const he=P.Component;return R.jsx("div",{className:"relative h-full",id:"document-editor-context","data-editor":P.id,"data-document-type":d,children:i?_?R.jsx(Mt,{message:"Loading operations"}):R.jsx(ls,{documentTitle:u??"",documentId:c??"",globalOperations:f,localOperations:E,onClose:()=>Is(!1),documentState:s.state,onCopyState:()=>{wt("Copied document state to clipboard",{type:"success"})},onCopyDocId:()=>{wt("Copied document ID to clipboard",{type:"success"})}},c):R.jsx(g.Suspense,{fallback:R.jsx(Mt,{message:"Loading editor"}),name:"EditorLoader",children:R.jsx(Hr,{fallbackRender:si,resetKeys:[c],onError:_e,loggerContext:["Connect","DocumentEditor"],children:!G?.error&&R.jsx(he,{context:{readMode:!!o,selectedTimelineRevision:ks(o?.startDate,o?.endDate,f)},documentId:s.header.id},c)})})})},Bf=g.lazy(()=>ge(()=>import("./AddDriveModal-Q54uyCBz.js"),__vite__mapDeps([3,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.AddDriveModal}))),Uf=g.lazy(()=>ge(()=>import("./ClearStorageModal-DbETjfeJ.js"),__vite__mapDeps([19,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.ClearStorageModal}))),Vf=g.lazy(()=>ge(()=>import("./CookiesPolicyModal-C8uEPVS4.js"),__vite__mapDeps([20,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.CookiesPolicyModal}))),Wf=g.lazy(()=>ge(()=>import("./CreateDocumentModal-ohHswNs9.js"),__vite__mapDeps([21,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.CreateDocumentModal}))),Kf=g.lazy(()=>ge(()=>import("./DebugSettingsModal-B6jhZFMW.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DebugSettingsModal}))),zf=g.lazy(()=>ge(()=>import("./DeleteDriveModal-DpLhxvJU.js"),__vite__mapDeps([23,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DeleteDriveModal}))),Gf=g.lazy(()=>ge(()=>import("./DeleteItemModal--MaJM3aA.js"),__vite__mapDeps([24,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DeleteItemModal}))),Yf=g.lazy(()=>ge(()=>import("./DisclaimerModal-QPOBOirM.js"),__vite__mapDeps([25,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DisclaimerModal}))),qf=g.lazy(()=>ge(()=>import("./DriveSettingsModal-Diohqk0G.js"),__vite__mapDeps([26,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.DriveSettingsModal}))),Jf=g.lazy(()=>ge(()=>import("./ExportDocumentWithErrorsModal-C6nRzNv-.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.ExportDocumentWithErrorsModal}))),Xf=g.lazy(()=>ge(()=>import("./SettingsModal-CYMY7zsG.js"),__vite__mapDeps([28,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,29,17,18])).then(t=>({default:t.SettingsModal}))),Zf=g.lazy(()=>ge(()=>import("./UpgradeDriveModal-ChhEaSso.js"),__vite__mapDeps([30,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.UpgradeDriveModal}))),Qf=g.lazy(()=>ge(()=>import("./index-B2VqKMxE.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.InspectorModal}))),eh={addDrive:Bf,clearStorage:Uf,cookiesPolicy:Vf,createDocument:Wf,debugSettings:Kf,deleteDrive:zf,deleteItem:Gf,disclaimer:Yf,driveSettings:qf,exportDocumentWithErrors:Jf,inspector:Qf,settings:Xf,upgradeDrive:Zf};function th(){const t=Ms();if(!t?.type)return null;const e=eh[t.type];return e?R.jsx(Hr,{variant:"silent",loggerContext:["Connect","Modals"],children:R.jsx(g.Suspense,{fallback:null,children:R.jsx(e,{})})}):null}const rh={Component:g.lazy(()=>ge(()=>import("./document_model_editor-BAQgvoKN.js").then(t=>t.B),__vite__mapDeps([4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])))};function nh(){const t="Generic Drive Explorer",e=["powerhouse/document-drive"],r=uo.Component;return{id:Hs,name:t,documentTypes:e,Component:r}}function ah(){const t="Document Model Editor",e="document-model-editor-v2",r=["powerhouse/document-model"],n=rh.Component;return{id:e,name:t,documentTypes:r,Component:n}}async function oh(){const t=er.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,o=t.specifications,i=er.reducer,s=er.actions,l=er.utils;return{id:n,name:e,documentType:r,extension:a,specifications:o,reducer:i,actions:s,utils:l,documentModel:lo(co(),t)}}async function ih(){const t=tr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,o=t.specifications,i=tr.reducer,s=tr.actions,l=tr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:o,reducer:i,actions:s,utils:l,documentModel:lo(co(),t)}}async function sh(){const t=await oh(),e=await ih(),r=ah(),n=nh();return{id:js,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]},upgradeManifests:[]}}const{externalPackagesEnabled:lh}=fe;function ch(t){return t.loadExternalPackages().then(e=>e.map(po))}async function uh(){try{if(!lh)return[];const t=await ge(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return ch(t)}catch(t){return console.error(t),[]}}var dh=Object.defineProperty,fh=Object.defineProperties,hh=Object.getOwnPropertyDescriptors,Va=Object.getOwnPropertySymbols,ph=Object.prototype.hasOwnProperty,gh=Object.prototype.propertyIsEnumerable,Wa=(t,e,r)=>e in t?dh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))ph.call(e,r)&&Wa(t,r,e[r]);if(Va)for(var r of Va(e))gh.call(e,r)&&Wa(t,r,e[r]);return t},rn=(t,e)=>fh(t,hh(e)),Et=(t,e,r)=>new Promise((n,a)=>{var o=l=>{try{s(r.next(l))}catch(c){a(c)}},i=l=>{try{s(r.throw(l))}catch(c){a(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,i);s((r=r.apply(t,e)).next())}),mh=class{constructor(){this.data=new Map}set(t,e){this.data.set(t,e)}get(t){return this.data.get(t)}has(t){return this.data.has(t)}delete(t){return this.data.delete(t)}clear(){this.data.clear()}},Eh={ERROR:"ERROR"},ci=(t=>(t.PROVIDER_NOT_READY="PROVIDER_NOT_READY",t.PROVIDER_FATAL="PROVIDER_FATAL",t.FLAG_NOT_FOUND="FLAG_NOT_FOUND",t.PARSE_ERROR="PARSE_ERROR",t.TYPE_MISMATCH="TYPE_MISMATCH",t.TARGETING_KEY_MISSING="TARGETING_KEY_MISSING",t.INVALID_CONTEXT="INVALID_CONTEXT",t.GENERAL="GENERAL",t))(ci||{}),rt=class ui extends Error{constructor(e,r){super(e),Object.setPrototypeOf(this,ui.prototype),this.name="OpenFeatureError",this.cause=r?.cause}},vh=class di extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,di.prototype),this.name="FlagNotFoundError",this.code="FLAG_NOT_FOUND"}},fi=class hi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,hi.prototype),this.name="GeneralError",this.code="GENERAL"}},_h=class pi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,pi.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},yh=class gi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,gi.prototype),this.name="ParseError",this.code="PARSE_ERROR"}},mi=class Ei extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ei.prototype),this.name="ProviderFatalError",this.code="PROVIDER_FATAL"}},vi=class _i extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,_i.prototype),this.name="ProviderNotReadyError",this.code="PROVIDER_NOT_READY"}},Ch=class yi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,yi.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},Sh=class Ci extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ci.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},Nh=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new vh(e);case"PARSE_ERROR":return new yh(e);case"TYPE_MISMATCH":return new Sh(e);case"TARGETING_KEY_MISSING":return new Ch(e);case"INVALID_CONTEXT":return new _h(e);case"PROVIDER_NOT_READY":return new vi(e);case"PROVIDER_FATAL":return new mi(e);default:return new fi(e)}},Wt=(t=>(t.NOT_READY="NOT_READY",t.READY="READY",t.ERROR="ERROR",t.STALE="STALE",t.FATAL="FATAL",t.RECONCILING="RECONCILING",t))(Wt||{}),He=(t=>(t.Ready="PROVIDER_READY",t.Error="PROVIDER_ERROR",t.ConfigurationChanged="PROVIDER_CONFIGURATION_CHANGED",t.ContextChanged="PROVIDER_CONTEXT_CHANGED",t.Reconciling="PROVIDER_RECONCILING",t.Stale="PROVIDER_STALE",t))(He||{}),Rh={READY:"PROVIDER_READY",ERROR:"PROVIDER_ERROR",FATAL:"PROVIDER_ERROR",STALE:"PROVIDER_STALE",RECONCILING:"PROVIDER_RECONCILING",NOT_READY:void 0},Si=(t,e)=>!e&&t==="PROVIDER_READY"||Rh[e]===t,Ni=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},wh=["error","warn","info","debug"],xn=class{constructor(t){this.fallbackLogger=new Ni;try{for(const e of wh)if(!t[e]||typeof t[e]!="function")throw new Error(`The provided logger is missing the ${e} method.`);this.logger=t}catch(e){console.error(e),console.error("Falling back to the default logger."),this.logger=this.fallbackLogger}}error(...t){this.log("error",...t)}warn(...t){this.log("warn",...t)}info(...t){this.log("info",...t)}debug(...t){this.log("debug",...t)}log(t,...e){try{this.logger[t](...e)}catch{this.fallbackLogger[t](...e)}}},bh=class{constructor(t){this.globalLogger=t,this._handlers={PROVIDER_CONFIGURATION_CHANGED:new WeakMap,PROVIDER_CONTEXT_CHANGED:new WeakMap,PROVIDER_READY:new WeakMap,PROVIDER_ERROR:new WeakMap,PROVIDER_STALE:new WeakMap,PROVIDER_RECONCILING:new WeakMap}}emit(t,e){this.eventEmitter.emit(t,e)}addHandler(t,e){const r=a=>Et(this,null,function*(){var o;try{yield e(a)}catch(i){(o=this._logger)==null||o.error("Error running event handler:",i)}}),n=this._handlers[t].get(e);this._handlers[t].set(e,[...n||[],r]),this.eventEmitter.on(t,r)}removeHandler(t,e){const r=this._handlers[t].get(e);if(r){const n=r.pop();n&&this.eventEmitter.removeListener(t,n)}}removeAllHandlers(t){t?this.eventEmitter.removeAllListeners(t):this.eventEmitter.removeAllListeners()}getHandlers(t){return this.eventEmitter.listeners(t)}setLogger(t){return this._eventLogger=new xn(t),this}get _logger(){var t,e;return(e=this._eventLogger)!=null?e:(t=this.globalLogger)==null?void 0:t.call(this)}};function Lh(t){return typeof t=="string"}function vt(t){return Lh(t)?t:void 0}function Oh(t){return typeof t=="object"}function be(t){return Oh(t)?t:void 0}function Ka(t){return typeof t<"u"&&t!==null}var mn=class{constructor(t,e,r){this._provider=t,this._status=e,this._pendingContextChanges=0;var n,a,o;(n=t.events)==null||n.addHandler("PROVIDER_READY",()=>{this._status=r.READY}),(a=t.events)==null||a.addHandler("PROVIDER_STALE",()=>{this._status=r.STALE}),(o=t.events)==null||o.addHandler("PROVIDER_ERROR",i=>{i?.errorCode==="PROVIDER_FATAL"?this._status=r.FATAL:this._status=r.ERROR})}get provider(){return this._provider}set provider(t){this._provider=t}get status(){return this._status}set status(t){this._status=t}get allContextChangesSettled(){return this._pendingContextChanges===0}incrementPendingContextChanges(){this._pendingContextChanges++}decrementPendingContextChanges(){this._pendingContextChanges--}},xh=class{constructor(t){this._hooks=[],this._context={},this._logger=new Ni,this._clientEventHandlers=new Map,this._domainScopedContext=new Map,this._clientEvents=new Map,this._runsOn=t}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}setLogger(t){return this._logger=new xn(t),this}get providerMetadata(){return this.getProviderMetadata()}getProviderMetadata(t){return this.getProviderForClient(t).metadata}addHandler(t,e,r){[...new Map([[void 0,this._defaultProvider]]),...this._domainScopedProviders].forEach(n=>{var a;const o=n[0],i=n[1].provider,s=n[1].status;if(Si(t,s))try{e({domain:o,providerName:i.metadata.name})}catch(c){(a=this._logger)==null||a.error("Error running event handler:",c)}}),this._apiEmitter.addHandler(t,e),r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this._apiEmitter.removeHandler(t,e)}clearHandlers(){this._apiEmitter.removeAllHandlers()}getHandlers(t){return this._apiEmitter.getHandlers(t)}setAwaitableProvider(t,e){var r,n,a,o,i,s,l,c;const u=vt(t),d=(r=be(t))!=null?r:be(e);if(!d){this._logger.debug("No provider defined, ignoring setProvider call");return}const h=this.getProviderForClient(u),f=d.metadata.name;if(h===d){this._logger.debug("Provider is already set, ignoring setProvider call");return}if(!d.runsOn)this._logger.debug(`Provider '${d.metadata.name}' has not defined its intended use.`);else if(d.runsOn!==this._runsOn)throw new fi(`Provider '${d.metadata.name}' is intended for use on the ${d.runsOn}.`);const E=this.getAssociatedEventEmitters(u);let _;const S=new mn(d,this._statusEnumType.NOT_READY,this._statusEnumType);return typeof d.initialize=="function"&&!this.allProviders.includes(d)?_=(i=(o=(a=d.initialize)==null?void 0:a.call(d,u?(n=this._domainScopedContext.get(u))!=null?n:this._context:this._context))==null?void 0:o.then(()=>{var y;S.status=this._statusEnumType.READY,this.getAssociatedEventEmitters(u).forEach(w=>{w?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(y=this._apiEmitter)==null||y.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}))==null?void 0:i.catch(y=>{var w;throw y?.code==="PROVIDER_FATAL"?S.status=this._statusEnumType.FATAL:S.status=this._statusEnumType.ERROR,this.getAssociatedEventEmitters(u).forEach(O=>{O?.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:y?.message})}),(w=this._apiEmitter)==null||w.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:y?.message}),y}):(S.status=this._statusEnumType.READY,E.forEach(y=>{y?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(s=this._apiEmitter)==null||s.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})),u?this._domainScopedProviders.set(u,S):this._defaultProvider=S,this.transferListeners(h,d,u,E),this.allProviders.includes(h)||(c=(l=h?.onClose)==null?void 0:l.call(h))==null||c.catch(y=>{this._logger.error(`error closing provider: ${y?.message}, ${y?.stack}`)}),_}getProviderForClient(t){var e,r;return t?(r=(e=this._domainScopedProviders.get(t))==null?void 0:e.provider)!=null?r:this._defaultProvider.provider:this._defaultProvider.provider}buildAndCacheEventEmitterForClient(t){const e=this._clientEvents.get(t);if(e)return e;const r=this._createEventEmitter();this._clientEvents.set(t,r);const n=this.getProviderForClient(t);return Object.values(He).forEach(a=>{var o;return(o=n.events)==null?void 0:o.addHandler(a,i=>Et(this,null,function*(){r.emit(a,rn(tn({},i),{clientName:t,domain:t,providerName:n.metadata.name}))}))}),r}getUnboundEmitters(){const t=[...this._domainScopedProviders.keys()];return[...[...this._clientEvents.keys()].filter(Ka).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(Ka)}getAssociatedEventEmitters(t){return t?[this.buildAndCacheEventEmitterForClient(t)]:this.getUnboundEmitters()}transferListeners(t,e,r,n){var a;(a=this._clientEventHandlers.get(r))==null||a.forEach(i=>{var s;return(s=t.events)==null?void 0:s.removeHandler(...i)});const o=Object.values(He).map(i=>[i,l=>Et(this,null,function*(){n.forEach(c=>{c?.emit(i,rn(tn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))}),this._apiEmitter.emit(i,rn(tn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))})]);this._clientEventHandlers.set(r,o),o.forEach(i=>{var s;return(s=e.events)==null?void 0:s.addHandler(...i)})}close(){return Et(this,null,function*(){var t,e;try{yield(e=(t=this==null?void 0:this._defaultProvider.provider)==null?void 0:t.onClose)==null?void 0:e.call(t)}catch(n){this.handleShutdownError(this._defaultProvider.provider,n)}const r=Array.from(this._domainScopedProviders);yield Promise.all(r.map(n=>Et(this,[n],function*([,a]){var o,i;try{yield(i=a==null?void 0:(o=a.provider).onClose)==null?void 0:i.call(o)}catch(s){this.handleShutdownError(a?.provider,s)}})))})}clearProvidersAndSetDefault(t){return Et(this,null,function*(){try{yield this.close()}catch{this._logger.error("Unable to cleanly close providers. Resetting to the default configuration.")}finally{this._domainScopedProviders.clear(),this._defaultProvider=new mn(t,this._statusEnumType.NOT_READY,this._statusEnumType)}})}get allProviders(){return[...[...this._domainScopedProviders.values()].map(t=>t.provider),this._defaultProvider.provider]}handleShutdownError(t,e){this._logger.error(`Error during shutdown of provider ${t.metadata.name}: ${e}`),this._logger.error(e?.stack)}},Dh=Object.create,Dn=Object.defineProperty,Ph=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertyNames,za=Object.getOwnPropertySymbols,wi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,kh=Reflect.get,Ga=(t,e,r)=>e in t?Dn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nn=(t,e)=>{for(var r in e||(e={}))bi.call(e,r)&&Ga(t,r,e[r]);if(za)for(var r of za(e))Ih.call(e,r)&&Ga(t,r,e[r]);return t},Mh=(t,e)=>Ph(t,Th(e)),Hh=(t,e)=>function(){return e||(0,t[Ri(t)[0]])((e={exports:{}}).exports,e),e.exports},jh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ri(e))!bi.call(t,a)&&a!==r&&Dn(t,a,{get:()=>e[a],enumerable:!(n=Ah(e,a))||n.enumerable});return t},Fh=(t,e,r)=>(r=t!=null?Dh(wi(t)):{},jh(Dn(r,"default",{value:t,enumerable:!0}),t)),$h=(t,e,r)=>kh(wi(t),r,e),mt=(t,e,r)=>new Promise((n,a)=>{var o=l=>{try{s(r.next(l))}catch(c){a(c)}},i=l=>{try{s(r.throw(l))}catch(c){a(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,i);s((r=r.apply(t,e)).next())}),Bh=Hh({"../../node_modules/eventemitter3/index.js"(t,e){var r=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function o(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var E=new o(d,h||c,f),_=n?n+u:u;return c._events[_]?c._events[_].fn?c._events[_]=[c._events[_],E]:c._events[_].push(E):(c._events[_]=E,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new a:delete c._events[u]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)r.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,E=h.length,_=new Array(E);f<E;f++)_[f]=h[f].fn;return _},l.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,E,_){var S=n?n+u:u;if(!this._events[S])return!1;var y=this._events[S],w=arguments.length,O,N;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),w){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,h),!0;case 4:return y.fn.call(y.context,d,h,f),!0;case 5:return y.fn.call(y.context,d,h,f,E),!0;case 6:return y.fn.call(y.context,d,h,f,E,_),!0}for(N=1,O=new Array(w-1);N<w;N++)O[N-1]=arguments[N];y.fn.apply(y.context,O)}else{var L=y.length,P;for(N=0;N<L;N++)switch(y[N].once&&this.removeListener(u,y[N].fn,void 0,!0),w){case 1:y[N].fn.call(y[N].context);break;case 2:y[N].fn.call(y[N].context,d);break;case 3:y[N].fn.call(y[N].context,d,h);break;case 4:y[N].fn.call(y[N].context,d,h,f);break;default:if(!O)for(P=1,O=new Array(w-1);P<w;P++)O[P-1]=arguments[P];y[N].fn.apply(y[N].context,O)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var E=n?n+u:u;if(!this._events[E])return this;if(!d)return s(this,E),this;var _=this._events[E];if(_.fn)_.fn===d&&(!f||_.once)&&(!h||_.context===h)&&s(this,E);else{for(var S=0,y=[],w=_.length;S<w;S++)(_[S].fn!==d||f&&!_[S].once||h&&_[S].context!==h)&&y.push(_[S]);y.length?this._events[E]=y.length===1?y[0]:y:s(this,E)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&s(this,d)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}}),Uh="No-op",Vh=class{constructor(){this.metadata={name:"No-op Provider"}}resolveBooleanEvaluation(t,e){return this.noOp(e)}resolveStringEvaluation(t,e){return this.noOp(e)}resolveNumberEvaluation(t,e){return this.noOp(e)}resolveObjectEvaluation(t,e){return this.noOp(e)}noOp(t){return{value:t,reason:Uh}}},Ya=new Vh,Wh=Fh(Bh()),qa=class extends bh{constructor(){super(),this.eventEmitter=new Wh.default}},Kh=class{constructor(t,e,r,n,a,o,i){this.providerAccessor=t,this.providerStatusAccessor=e,this.emitterAccessor=r,this.apiContextAccessor=n,this.apiHooksAccessor=a,this.globalLogger=o,this.options=i,this._hooks=[]}get metadata(){var t,e;return{name:(t=this.options.domain)!=null?t:this.options.name,domain:(e=this.options.domain)!=null?e:this.options.name,version:this.options.version,providerMetadata:this.providerAccessor().metadata}}get providerStatus(){return this.providerStatusAccessor()}addHandler(t,e,r){var n;if(this.emitterAccessor().addHandler(t,e),Si(t,this.providerStatus))try{e({clientName:this.metadata.name,domain:this.metadata.domain,providerName:this._provider.metadata.name})}catch(o){(n=this._logger)==null||n.error("Error running event handler:",o)}r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this.emitterAccessor().removeHandler(t,e)}getHandlers(t){return this.emitterAccessor().getHandlers(t)}setLogger(t){return this._clientLogger=new xn(t),this}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}getBooleanValue(t,e,r){return this.getBooleanDetails(t,e,r).value}getBooleanDetails(t,e,r){return this.evaluate(t,this._provider.resolveBooleanEvaluation,e,"boolean",r)}getStringValue(t,e,r){return this.getStringDetails(t,e,r).value}getStringDetails(t,e,r){return this.evaluate(t,this._provider.resolveStringEvaluation,e,"string",r)}getNumberValue(t,e,r){return this.getNumberDetails(t,e,r).value}getNumberDetails(t,e,r){return this.evaluate(t,this._provider.resolveNumberEvaluation,e,"number",r)}getObjectValue(t,e,r){return this.getObjectDetails(t,e,r).value}getObjectDetails(t,e,r){return this.evaluate(t,this._provider.resolveObjectEvaluation,e,"object",r)}track(t,e={}){var r,n,a;try{if(this.shortCircuitIfNotReady(),typeof this._provider.track=="function"){const o=Object.freeze(nn({},this.apiContextAccessor((r=this==null?void 0:this.options)==null?void 0:r.domain)));return(a=(n=this._provider).track)==null?void 0:a.call(n,t,o,e)}else this._logger.debug("Provider does not support the track function; will no-op.")}catch(o){this._logger.debug("Error recording tracking event.",o)}}evaluate(t,e,r,n,a={}){var o,i;const s=[...this.apiHooksAccessor(),...this.getHooks(),...a.hooks||[],...this._provider.hooks||[]],l=[...s].reverse(),c=nn({},this.apiContextAccessor((o=this==null?void 0:this.options)==null?void 0:o.domain)),u=l.map(()=>Object.freeze({flagKey:t,defaultValue:r,flagValueType:n,clientMetadata:this.metadata,providerMetadata:this._provider.metadata,context:c,logger:this._logger,hookData:new mh}));let d;try{this.beforeHooks(s,u,a),this.shortCircuitIfNotReady();const h=e.call(this._provider,t,r,c,this._logger),f=Mh(nn({},h),{flagMetadata:Object.freeze((i=h.flagMetadata)!=null?i:{}),flagKey:t});if(f.errorCode){const E=Nh(f.errorCode,f.errorMessage);this.errorHooks(l,u,E,a),d=this.getErrorEvaluationDetails(t,r,E,f.flagMetadata)}else this.afterHooks(l,u,f,a),d=f}catch(h){this.errorHooks(l,u,h,a),d=this.getErrorEvaluationDetails(t,r,h)}return this.finallyHooks(l,u,d,a),d}beforeHooks(t,e,r){var n;for(const[a,o]of t.entries()){const i=t.length-1-a,s=e[i];Object.freeze(s),Object.freeze(s.context),(n=o?.before)==null||n.call(o,s,Object.freeze(r.hookHints))}}afterHooks(t,e,r,n){var a;for(const[o,i]of t.entries()){const s=e[o];(a=i?.after)==null||a.call(i,s,r,n.hookHints)}}errorHooks(t,e,r,n){var a;for(const[o,i]of t.entries())try{const s=e[o];(a=i?.error)==null||a.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'error' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}finallyHooks(t,e,r,n){var a;for(const[o,i]of t.entries())try{const s=e[o];(a=i?.finally)==null||a.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'finally' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}get _provider(){return this.providerAccessor()}get _logger(){return this._clientLogger||this.globalLogger()}shortCircuitIfNotReady(){if(this.providerStatus===Wt.NOT_READY)throw new vi("provider has not yet initialized");if(this.providerStatus===Wt.FATAL)throw new mi("provider is in an irrecoverable error state")}getErrorEvaluationDetails(t,e,r,n={}){const a=r?.message;return{errorCode:r?.code||ci.GENERAL,errorMessage:a,value:e,reason:Eh.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},Ja=Symbol.for("@openfeature/web-sdk/api"),Xa=globalThis,zh=class En extends xh{constructor(){super("client"),this._statusEnumType=Wt,this._apiEmitter=new qa,this._defaultProvider=new mn(Ya,Wt.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new qa}static getInstance(){const e=Xa[Ja];if(e)return e;const r=new En;return Xa[Ja]=r,r}getProviderStatus(e){var r,n;return e?(n=(r=this._domainScopedProviders.get(e))==null?void 0:r.status)!=null?n:this._defaultProvider.status:this._defaultProvider.status}setProviderAndWait(e,r,n){return mt(this,null,function*(){const a=vt(e),o=be(a?r:e),i=be(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i),yield this.setAwaitableProvider(a,o)})}setProvider(e,r,n){const a=vt(e),o=be(a?r:e),i=be(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i);const s=this.setAwaitableProvider(a,o);return Promise.resolve(s).catch(l=>{this._logger.error("Error during provider initialization:",l)}),this}getProvider(e){return this.getProviderForClient(e)}setContext(e,r){return mt(this,null,function*(){var n,a;const o=vt(e),i=(a=(n=be(e))!=null?n:be(r))!=null?a:{};if(o){const s=this._domainScopedProviders.get(o);if(s){const l=this.getContext(o);this._domainScopedContext.set(o,i),yield this.runProviderContextChangeHandler(o,s,l,i)}else this._domainScopedContext.set(o,i)}else{const s=this._context;this._context=i;const l=Array.from(this._domainScopedProviders.entries()).filter(([u])=>!this._domainScopedContext.has(u)).reduce((u,[d,h])=>(u.push({domain:d,wrapper:h}),u),[]),c=[{domain:void 0,wrapper:this._defaultProvider},...l];yield Promise.all(c.map(u=>this.runProviderContextChangeHandler(u.domain,u.wrapper,s,i)))}})}getContext(e){const r=vt(e);if(r){const n=this._domainScopedContext.get(r);if(n)return n;this._logger.debug(`Unable to find context for '${r}'.`)}return this._context}clearContext(e){return mt(this,null,function*(){const r=vt(e);if(r){const n=this._domainScopedProviders.get(r);if(n){const a=this.getContext(r);this._domainScopedContext.delete(r);const o=this.getContext();yield this.runProviderContextChangeHandler(r,n,a,o)}else this._domainScopedContext.delete(r)}else return this.setContext({})})}clearContexts(){return mt(this,null,function*(){yield this.clearContext(),yield Promise.allSettled(Array.from(this._domainScopedProviders.keys()).map(e=>this.clearContext(e)))})}getClient(e,r){return new Kh(()=>this.getProviderForClient(e),()=>this.getProviderStatus(e),()=>this.buildAndCacheEventEmitterForClient(e),n=>this.getContext(n),()=>this.getHooks(),()=>this._logger,{domain:e,version:r})}clearProviders(){return mt(this,null,function*(){yield $h(En.prototype,this,"clearProvidersAndSetDefault").call(this,Ya),this._domainScopedContext.clear()})}runProviderContextChangeHandler(e,r,n,a){return mt(this,null,function*(){var o,i,s,l,c,u;const d=((i=(o=r.provider)==null?void 0:o.metadata)==null?void 0:i.name)||"unnamed-provider";try{if(typeof r.provider.onContextChange=="function"){const h=r.provider.onContextChange(n,a);h&&typeof h?.then=="function"&&(r.incrementPendingContextChanges(),r.status=this._statusEnumType.RECONCILING,this.getAssociatedEventEmitters(e).forEach(f=>{f?.emit(He.Reconciling,{domain:e,providerName:d})}),(s=this._apiEmitter)==null||s.emit(He.Reconciling,{domain:e,providerName:d}),yield h,r.decrementPendingContextChanges())}r.status=this._statusEnumType.READY,r.allContextChangesSettled&&(this.getAssociatedEventEmitters(e).forEach(h=>{h?.emit(He.ContextChanged,{clientName:e,domain:e,providerName:d})}),(l=this._apiEmitter)==null||l.emit(He.ContextChanged,{clientName:e,domain:e,providerName:d}))}catch(h){if(r.decrementPendingContextChanges(),r.status=this._statusEnumType.ERROR,r.allContextChangesSettled){const f=h,E=`Error running ${d}'s context change handler: ${f?.message}`;(c=this._logger)==null||c.error(`${E}`,h),this.getAssociatedEventEmitters(e).forEach(_=>{_?.emit(He.Error,{clientName:e,domain:e,providerName:d,message:E})}),(u=this._apiEmitter)==null||u.emit(He.Error,{clientName:e,domain:e,providerName:d,message:E})}}})}},Za=zh.getInstance();class Gh{runsOn="client";metadata={name:"QueryParamProvider"};flags;constructor(e){this.flags=new Map;for(const[r,n]of e.entries())this.flags.set(r,n)}resolveBooleanEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n.toLowerCase()==="true"||n==="1",reason:"STATIC",variant:n}}resolveStringEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n,reason:"STATIC",variant:n}}resolveNumberEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};const a=Number(n);return isNaN(a)?{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse "${n}" as a number`}:{value:a,reason:"STATIC",variant:n}}resolveObjectEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};try{return{value:JSON.parse(n),reason:"STATIC",variant:n}}catch(a){return{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse JSON: ${a instanceof Error?a.message:String(a)}`}}}}async function Yh(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new Gh(e);await Za.setProviderAndWait(r);const n=new Map,a=Za.getClient();n.set(Qa,a.getBooleanValue(Qa,qh)),n.set(eo,a.getBooleanValue(eo,Jh)),n.set(to,a.getBooleanValue(to,Xh));const i=e.has(an)?a.getBooleanValue(an,Zh):fe.content.inspectorEnabled;n.set(an,i);const s=e.get("LOG_LEVEL");if(s){const l=["verbose","debug","info","warn","error"];l.includes(s.toLowerCase())?(so(s.toLowerCase()),Ze.info("Log level set to @level via query param",s.toLowerCase())):Ze.warn("Invalid LOG_LEVEL query param: @param. Valid values: @validLevels",s,l.join(", "))}return n}const Qa="FEATURE_LEGACY_READ_ENABLED",qh=!1,eo="FEATURE_LEGACY_WRITE_ENABLED",Jh=!1,to="FEATURE_CHANNEL_SYNC_ENABLED",Xh=!0,an="FEATURE_INSPECTOR_ENABLED",Zh=!1;_o();var Qh=5,ep=async(t,e)=>{let r=new Set,n={async query(a,o,i){let s,l,c;if(typeof a!="string"&&(s=a.signal,o=a.params,i=a.callback,l=a.offset,c=a.limit,a=a.query),l===void 0!=(c===void 0))throw new Error("offset and limit must be provided together");let u=l!==void 0&&c!==void 0,d;if(u&&(typeof l!="number"||isNaN(l)||typeof c!="number"||isNaN(c)))throw new Error("offset and limit must be numbers");let h=i?[i]:[],f=dr().replace(/-/g,""),E=!1,_,S,y=async()=>{await t.transaction(async L=>{let P=o&&o.length>0?await Wn(t,a,o,L):a;await L.exec(`CREATE OR REPLACE TEMP VIEW live_query_${f}_view AS ${P}`);let m=await ro(L,`live_query_${f}_view`);await no(L,m,r),u?(await L.exec(`
|
|
14
|
+
}`}}):null,R.jsx(ff,{})]})};function pf({children:t}){return R.jsx(R.Fragment,{children:t})}const gf=({children:t})=>(kd(),t),mf=()=>(g.useEffect(()=>{const t=()=>{console.log("Outdated chunks detected, reloading page..."),window.location.reload()};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),g.useEffect(()=>{uf.registerServiceWorker(!1)},[]),R.jsx(gf,{children:R.jsx(ns,{children:R.jsxs(pf,{children:[R.jsx(as,{position:"bottom-right",containerId:"connect"}),R.jsx(Dp,{}),R.jsx(tf,{})]})})})),Ef={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},vf={placeholder:"Search Powerhouse",filterLabel:"File type"},_f={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},yf={options:{switchboardLink:"Switchboard Link"}},Cf={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},Sf={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Nf={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},Rf={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},wf={common:Ef,searchbar:vf,folderView:_f,files:yf,modals:Cf,notifications:Sf,footer:Nf,cookieBanner:Rf},bf={en:{code:"en",name:"English",translation:wf}};ve.use(Fc).init({resources:bf,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const Lf=(t,e)=>t.some(r=>r.id===e&&r.value),Of=()=>{const{t}=ko(void 0,{useSuspense:!0,i18n:ve}),[e,r]=eu(),[,n]=Cn(),a=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],o=s=>{r(!1),Lf(s,"analytics-cookie")&&n(l=>({...l,analytics:!0}))},i=()=>{r(!1),n(()=>({analytics:!1,functional:!1,marketing:!1}))};return e?R.jsxs("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[R.jsx("div",{className:"absolute inset-0 bg-black opacity-15"}),R.jsx("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:R.jsx(os,{className:"max-w-[1024px]",cookies:a,onSubmit:o,onReject:i,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:R.jsx("p",{className:"font-semibold text-gray-500",children:R.jsx(Bc,{i18nKey:"cookieBanner.message",components:{a:R.jsx("a",{onClick:()=>Ge({type:"cookiesPolicy"}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};function xf(){const[t]=_s(),e=ys(t.header.id),r=g.useCallback(()=>{Cs(t).length?Ge({type:"exportDocumentWithErrors",documentId:t.header.id}):Ss(t).catch(i=>{console.error(i);const s=i instanceof Error?i.message:JSON.stringify(i,null,1);wt(`Failed to export document: ${s}`)})},[t]),n=g.useMemo(()=>async()=>{},[]),a=g.useCallback(()=>{on(e)},[e,on]);return R.jsx("div",{id:"document-editor-container",className:"flex-1","data-document-type":t.header.documentType,children:R.jsx($f,{document:t,onClose:a,onExport:r,onOpenSwitchboardLink:n})})}function Mt(t){const[e,r]=g.useState(!1);if(g.useEffect(()=>{setTimeout(()=>{r(!0)},t.loadingTimeout??200)},[t]),!e)return null;const{customEditorLoader:n,...a}=t;return n?R.jsx(R.Fragment,{children:n}):R.jsx(is,{...a})}const Df=g.createContext(null),en={didCatch:!1,error:null};let Pf=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=en}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var r,n,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:o,reason:"imperative-api"}),this.setState(en)}}componentDidCatch(e,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,e,r)}componentDidUpdate(e,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&Af(e.resetKeys,a)){var o,i;(o=(i=this.props).onReset)===null||o===void 0||o.call(i,{next:a,prev:e.resetKeys,reason:"keys"}),this.setState(en)}}render(){const{children:e,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:o,error:i}=this.state;let s=e;if(o){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")s=r(l);else if(n)s=g.createElement(n,l);else if(a!==void 0)s=a;else throw i}return g.createElement(Df.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function Af(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((r,n)=>!Object.is(r,e[n]))}const Tf=_n(["Connect"]);function If(t){return"fallbackRender"in t}function kf(){return null}function Mf({message:t="Something went wrong"}){return R.jsx("div",{className:"text-center",children:t})}function Hf({error:t}){const e=t instanceof Error?t.message:String(t);return R.jsxs("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[R.jsx("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),R.jsx("i",{children:e}),R.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function si({error:t}){const e=t instanceof Error?t.message:String(t);return R.jsx("div",{className:"flex size-full items-center justify-center",children:R.jsx("h3",{className:"text-lg font-semibold",children:e})})}function jf(t,e){switch(t){case"silent":return kf;case"text":return()=>R.jsx(Mf,{message:e});case"detailed":return Hf;default:return si}}function Hr(t){const{children:e,onError:r,resetKeys:n,loggerContext:a}=t,o=(s,l)=>{if(s.message.includes("Failed to fetch dynamically imported module")&&s.message.includes("node_modules/.vite")){console.error(s),console.log("Outdated chunk detected, reloading page..."),window.location.reload();return}(a?_n(a):Tf).error("@error @info",s,l),r?.(s,l)},i=If(t)?t.fallbackRender:jf(t.variant,t.fallbackMessage);return R.jsx(Pf,{fallbackRender:i,onError:o,resetKeys:n,children:e})}function Ff(){const[t]=Ns(),e=Eo(),r=vo(t.header.meta?.preferredEditor),n=Rs(),a=r?.Component??n?.Component??uo.Component;if(!a)throw new Error("No drive editor component found");return R.jsx(Hr,{variant:"detailed",resetKeys:[t.header.id],loggerContext:["Connect","DriveEditor"],children:R.jsx(g.Suspense,{fallback:R.jsx(Mt,{}),children:R.jsx(ss,{className:"flex h-full flex-col overflow-auto",children:R.jsx(a,{children:e?R.jsx(xf,{}):null})})})})}function li({drive:t}){const e=ws(),r=g.useMemo(()=>t?e.some(a=>a.collectionId===bs("main",t.header.id)):!1,[e,t]),n=t?.state.global.icon;return n?R.jsx("img",{src:n,alt:t.header.name,height:32,width:32}):r?R.jsx(zn,{name:"Server",size:32}):R.jsx(zn,{name:"Hdd",size:32})}function Ua({message:t}){return R.jsx("div",{className:"flex size-full items-center justify-center",children:R.jsx("h3",{className:"text-lg font-semibold",children:t})})}const $f=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:a}=t,o=Ls(),i=Os(),[s,l]=xs(e.header.id),c=s?.header.id??void 0,u=s?.header.name??void 0,d=s?.header.documentType??void 0,h=s?.header.meta?.preferredEditor??void 0,{globalOperations:f,localOperations:E,isLoading:_,refetch:S}=Ds(c);g.useEffect(()=>{i&&S()},[i,S]);const y=s?.header.revision.global??0,w=s?.header.revision.local??0,O=Ps(d),N=As(h),L=Ts(d),P=N??L,m=!s,b=P&&d&&!P.documentTypes.includes(d)&&!P.documentTypes.includes("*"),x=y>0||w>0,I=!!s?.clipboard.length;Xd({undo:()=>l(Qi()),redo:()=>l(es()),canUndo:x,canRedo:I}),g.useEffect(()=>()=>{window.documentEditorDebugTools?.clear()},[]);const[G,q]=g.useState(void 0);g.useEffect(()=>{G&&G.documentId!==c&&q(void 0)},[G,c]);const _e=(X,te)=>{q({error:X,documentId:c,info:te})};if(b)return R.jsx(Mt,{message:"Loading editor"});if(m)return R.jsx(Mt,{message:"Loading document"});if(!O)return R.jsx(Ua,{message:R.jsxs("div",{className:"text-center leading-10",children:[R.jsxs("p",{children:['Unable to open the document because the document model "',d,'" is not supported.']}),R.jsxs("p",{children:["Go to the"," ",R.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ge({type:"settings"})},children:"package manager"})," ","to install this document model"]})]})});if(!P)return R.jsx(Ua,{message:R.jsxs("div",{className:"text-center leading-10",children:[R.jsx("p",{children:"Unable to open the document because no editor has been found"}),R.jsxs("p",{children:["Go to the"," ",R.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ge({type:"settings"})},children:"package manager"})," ",'an editor for the "$',d,'" document type']})]})});const he=P.Component;return R.jsx("div",{className:"relative h-full",id:"document-editor-context","data-editor":P.id,"data-document-type":d,children:i?_?R.jsx(Mt,{message:"Loading operations"}):R.jsx(ls,{documentTitle:u??"",documentId:c??"",globalOperations:f,localOperations:E,onClose:()=>Is(!1),documentState:s.state,onCopyState:()=>{wt("Copied document state to clipboard",{type:"success"})},onCopyDocId:()=>{wt("Copied document ID to clipboard",{type:"success"})}},c):R.jsx(g.Suspense,{fallback:R.jsx(Mt,{message:"Loading editor"}),name:"EditorLoader",children:R.jsx(Hr,{fallbackRender:si,resetKeys:[c],onError:_e,loggerContext:["Connect","DocumentEditor"],children:!G?.error&&R.jsx(he,{context:{readMode:!!o,selectedTimelineRevision:ks(o?.startDate,o?.endDate,f)},documentId:s.header.id},c)})})})},Bf=g.lazy(()=>ge(()=>import("./AddDriveModal-BYfZzMIC.js"),__vite__mapDeps([3,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.AddDriveModal}))),Uf=g.lazy(()=>ge(()=>import("./ClearStorageModal-DFZ-m6f-.js"),__vite__mapDeps([19,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.ClearStorageModal}))),Vf=g.lazy(()=>ge(()=>import("./CookiesPolicyModal-Cj5Xl9jN.js"),__vite__mapDeps([20,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.CookiesPolicyModal}))),Wf=g.lazy(()=>ge(()=>import("./CreateDocumentModal-ohHswNs9.js"),__vite__mapDeps([21,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.CreateDocumentModal}))),Kf=g.lazy(()=>ge(()=>import("./DebugSettingsModal-CkP1JPUx.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DebugSettingsModal}))),zf=g.lazy(()=>ge(()=>import("./DeleteDriveModal-CyvW_Fxo.js"),__vite__mapDeps([23,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DeleteDriveModal}))),Gf=g.lazy(()=>ge(()=>import("./DeleteItemModal-IjQJN5Ta.js"),__vite__mapDeps([24,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DeleteItemModal}))),Yf=g.lazy(()=>ge(()=>import("./DisclaimerModal-DOQ36Dok.js"),__vite__mapDeps([25,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DisclaimerModal}))),qf=g.lazy(()=>ge(()=>import("./DriveSettingsModal-Diohqk0G.js"),__vite__mapDeps([26,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.DriveSettingsModal}))),Jf=g.lazy(()=>ge(()=>import("./ExportDocumentWithErrorsModal-CouuHIrQ.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.ExportDocumentWithErrorsModal}))),Xf=g.lazy(()=>ge(()=>import("./SettingsModal-DpeJc9tM.js"),__vite__mapDeps([28,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,29,17,18])).then(t=>({default:t.SettingsModal}))),Zf=g.lazy(()=>ge(()=>import("./UpgradeDriveModal-DQ9hGANt.js"),__vite__mapDeps([30,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.UpgradeDriveModal}))),Qf=g.lazy(()=>ge(()=>import("./index-B2VqKMxE.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])).then(t=>({default:t.InspectorModal}))),eh={addDrive:Bf,clearStorage:Uf,cookiesPolicy:Vf,createDocument:Wf,debugSettings:Kf,deleteDrive:zf,deleteItem:Gf,disclaimer:Yf,driveSettings:qf,exportDocumentWithErrors:Jf,inspector:Qf,settings:Xf,upgradeDrive:Zf};function th(){const t=Ms();if(!t?.type)return null;const e=eh[t.type];return e?R.jsx(Hr,{variant:"silent",loggerContext:["Connect","Modals"],children:R.jsx(g.Suspense,{fallback:null,children:R.jsx(e,{})})}):null}const rh={Component:g.lazy(()=>ge(()=>import("./document_model_editor-BAQgvoKN.js").then(t=>t.B),__vite__mapDeps([4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16])))};function nh(){const t="Generic Drive Explorer",e=["powerhouse/document-drive"],r=uo.Component;return{id:Hs,name:t,documentTypes:e,Component:r}}function ah(){const t="Document Model Editor",e="document-model-editor-v2",r=["powerhouse/document-model"],n=rh.Component;return{id:e,name:t,documentTypes:r,Component:n}}async function oh(){const t=er.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,o=t.specifications,i=er.reducer,s=er.actions,l=er.utils;return{id:n,name:e,documentType:r,extension:a,specifications:o,reducer:i,actions:s,utils:l,documentModel:lo(co(),t)}}async function ih(){const t=tr.documentModel.global,e=t.name,r=t.id,n=r,a=t.extension,o=t.specifications,i=tr.reducer,s=tr.actions,l=tr.utils;return{id:n,name:e,documentType:r,extension:a,specifications:o,reducer:i,actions:s,utils:l,documentModel:lo(co(),t)}}async function sh(){const t=await oh(),e=await ih(),r=ah(),n=nh();return{id:js,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]},upgradeManifests:[]}}const{externalPackagesEnabled:lh}=fe;function ch(t){return t.loadExternalPackages().then(e=>e.map(po))}async function uh(){try{if(!lh)return[];const t=await ge(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return ch(t)}catch(t){return console.error(t),[]}}var dh=Object.defineProperty,fh=Object.defineProperties,hh=Object.getOwnPropertyDescriptors,Va=Object.getOwnPropertySymbols,ph=Object.prototype.hasOwnProperty,gh=Object.prototype.propertyIsEnumerable,Wa=(t,e,r)=>e in t?dh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e)=>{for(var r in e||(e={}))ph.call(e,r)&&Wa(t,r,e[r]);if(Va)for(var r of Va(e))gh.call(e,r)&&Wa(t,r,e[r]);return t},rn=(t,e)=>fh(t,hh(e)),Et=(t,e,r)=>new Promise((n,a)=>{var o=l=>{try{s(r.next(l))}catch(c){a(c)}},i=l=>{try{s(r.throw(l))}catch(c){a(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,i);s((r=r.apply(t,e)).next())}),mh=class{constructor(){this.data=new Map}set(t,e){this.data.set(t,e)}get(t){return this.data.get(t)}has(t){return this.data.has(t)}delete(t){return this.data.delete(t)}clear(){this.data.clear()}},Eh={ERROR:"ERROR"},ci=(t=>(t.PROVIDER_NOT_READY="PROVIDER_NOT_READY",t.PROVIDER_FATAL="PROVIDER_FATAL",t.FLAG_NOT_FOUND="FLAG_NOT_FOUND",t.PARSE_ERROR="PARSE_ERROR",t.TYPE_MISMATCH="TYPE_MISMATCH",t.TARGETING_KEY_MISSING="TARGETING_KEY_MISSING",t.INVALID_CONTEXT="INVALID_CONTEXT",t.GENERAL="GENERAL",t))(ci||{}),rt=class ui extends Error{constructor(e,r){super(e),Object.setPrototypeOf(this,ui.prototype),this.name="OpenFeatureError",this.cause=r?.cause}},vh=class di extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,di.prototype),this.name="FlagNotFoundError",this.code="FLAG_NOT_FOUND"}},fi=class hi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,hi.prototype),this.name="GeneralError",this.code="GENERAL"}},_h=class pi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,pi.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},yh=class gi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,gi.prototype),this.name="ParseError",this.code="PARSE_ERROR"}},mi=class Ei extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ei.prototype),this.name="ProviderFatalError",this.code="PROVIDER_FATAL"}},vi=class _i extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,_i.prototype),this.name="ProviderNotReadyError",this.code="PROVIDER_NOT_READY"}},Ch=class yi extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,yi.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},Sh=class Ci extends rt{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ci.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},Nh=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new vh(e);case"PARSE_ERROR":return new yh(e);case"TYPE_MISMATCH":return new Sh(e);case"TARGETING_KEY_MISSING":return new Ch(e);case"INVALID_CONTEXT":return new _h(e);case"PROVIDER_NOT_READY":return new vi(e);case"PROVIDER_FATAL":return new mi(e);default:return new fi(e)}},Wt=(t=>(t.NOT_READY="NOT_READY",t.READY="READY",t.ERROR="ERROR",t.STALE="STALE",t.FATAL="FATAL",t.RECONCILING="RECONCILING",t))(Wt||{}),He=(t=>(t.Ready="PROVIDER_READY",t.Error="PROVIDER_ERROR",t.ConfigurationChanged="PROVIDER_CONFIGURATION_CHANGED",t.ContextChanged="PROVIDER_CONTEXT_CHANGED",t.Reconciling="PROVIDER_RECONCILING",t.Stale="PROVIDER_STALE",t))(He||{}),Rh={READY:"PROVIDER_READY",ERROR:"PROVIDER_ERROR",FATAL:"PROVIDER_ERROR",STALE:"PROVIDER_STALE",RECONCILING:"PROVIDER_RECONCILING",NOT_READY:void 0},Si=(t,e)=>!e&&t==="PROVIDER_READY"||Rh[e]===t,Ni=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},wh=["error","warn","info","debug"],xn=class{constructor(t){this.fallbackLogger=new Ni;try{for(const e of wh)if(!t[e]||typeof t[e]!="function")throw new Error(`The provided logger is missing the ${e} method.`);this.logger=t}catch(e){console.error(e),console.error("Falling back to the default logger."),this.logger=this.fallbackLogger}}error(...t){this.log("error",...t)}warn(...t){this.log("warn",...t)}info(...t){this.log("info",...t)}debug(...t){this.log("debug",...t)}log(t,...e){try{this.logger[t](...e)}catch{this.fallbackLogger[t](...e)}}},bh=class{constructor(t){this.globalLogger=t,this._handlers={PROVIDER_CONFIGURATION_CHANGED:new WeakMap,PROVIDER_CONTEXT_CHANGED:new WeakMap,PROVIDER_READY:new WeakMap,PROVIDER_ERROR:new WeakMap,PROVIDER_STALE:new WeakMap,PROVIDER_RECONCILING:new WeakMap}}emit(t,e){this.eventEmitter.emit(t,e)}addHandler(t,e){const r=a=>Et(this,null,function*(){var o;try{yield e(a)}catch(i){(o=this._logger)==null||o.error("Error running event handler:",i)}}),n=this._handlers[t].get(e);this._handlers[t].set(e,[...n||[],r]),this.eventEmitter.on(t,r)}removeHandler(t,e){const r=this._handlers[t].get(e);if(r){const n=r.pop();n&&this.eventEmitter.removeListener(t,n)}}removeAllHandlers(t){t?this.eventEmitter.removeAllListeners(t):this.eventEmitter.removeAllListeners()}getHandlers(t){return this.eventEmitter.listeners(t)}setLogger(t){return this._eventLogger=new xn(t),this}get _logger(){var t,e;return(e=this._eventLogger)!=null?e:(t=this.globalLogger)==null?void 0:t.call(this)}};function Lh(t){return typeof t=="string"}function vt(t){return Lh(t)?t:void 0}function Oh(t){return typeof t=="object"}function be(t){return Oh(t)?t:void 0}function Ka(t){return typeof t<"u"&&t!==null}var mn=class{constructor(t,e,r){this._provider=t,this._status=e,this._pendingContextChanges=0;var n,a,o;(n=t.events)==null||n.addHandler("PROVIDER_READY",()=>{this._status=r.READY}),(a=t.events)==null||a.addHandler("PROVIDER_STALE",()=>{this._status=r.STALE}),(o=t.events)==null||o.addHandler("PROVIDER_ERROR",i=>{i?.errorCode==="PROVIDER_FATAL"?this._status=r.FATAL:this._status=r.ERROR})}get provider(){return this._provider}set provider(t){this._provider=t}get status(){return this._status}set status(t){this._status=t}get allContextChangesSettled(){return this._pendingContextChanges===0}incrementPendingContextChanges(){this._pendingContextChanges++}decrementPendingContextChanges(){this._pendingContextChanges--}},xh=class{constructor(t){this._hooks=[],this._context={},this._logger=new Ni,this._clientEventHandlers=new Map,this._domainScopedContext=new Map,this._clientEvents=new Map,this._runsOn=t}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}setLogger(t){return this._logger=new xn(t),this}get providerMetadata(){return this.getProviderMetadata()}getProviderMetadata(t){return this.getProviderForClient(t).metadata}addHandler(t,e,r){[...new Map([[void 0,this._defaultProvider]]),...this._domainScopedProviders].forEach(n=>{var a;const o=n[0],i=n[1].provider,s=n[1].status;if(Si(t,s))try{e({domain:o,providerName:i.metadata.name})}catch(c){(a=this._logger)==null||a.error("Error running event handler:",c)}}),this._apiEmitter.addHandler(t,e),r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this._apiEmitter.removeHandler(t,e)}clearHandlers(){this._apiEmitter.removeAllHandlers()}getHandlers(t){return this._apiEmitter.getHandlers(t)}setAwaitableProvider(t,e){var r,n,a,o,i,s,l,c;const u=vt(t),d=(r=be(t))!=null?r:be(e);if(!d){this._logger.debug("No provider defined, ignoring setProvider call");return}const h=this.getProviderForClient(u),f=d.metadata.name;if(h===d){this._logger.debug("Provider is already set, ignoring setProvider call");return}if(!d.runsOn)this._logger.debug(`Provider '${d.metadata.name}' has not defined its intended use.`);else if(d.runsOn!==this._runsOn)throw new fi(`Provider '${d.metadata.name}' is intended for use on the ${d.runsOn}.`);const E=this.getAssociatedEventEmitters(u);let _;const S=new mn(d,this._statusEnumType.NOT_READY,this._statusEnumType);return typeof d.initialize=="function"&&!this.allProviders.includes(d)?_=(i=(o=(a=d.initialize)==null?void 0:a.call(d,u?(n=this._domainScopedContext.get(u))!=null?n:this._context:this._context))==null?void 0:o.then(()=>{var y;S.status=this._statusEnumType.READY,this.getAssociatedEventEmitters(u).forEach(w=>{w?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(y=this._apiEmitter)==null||y.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}))==null?void 0:i.catch(y=>{var w;throw y?.code==="PROVIDER_FATAL"?S.status=this._statusEnumType.FATAL:S.status=this._statusEnumType.ERROR,this.getAssociatedEventEmitters(u).forEach(O=>{O?.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:y?.message})}),(w=this._apiEmitter)==null||w.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:y?.message}),y}):(S.status=this._statusEnumType.READY,E.forEach(y=>{y?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(s=this._apiEmitter)==null||s.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})),u?this._domainScopedProviders.set(u,S):this._defaultProvider=S,this.transferListeners(h,d,u,E),this.allProviders.includes(h)||(c=(l=h?.onClose)==null?void 0:l.call(h))==null||c.catch(y=>{this._logger.error(`error closing provider: ${y?.message}, ${y?.stack}`)}),_}getProviderForClient(t){var e,r;return t?(r=(e=this._domainScopedProviders.get(t))==null?void 0:e.provider)!=null?r:this._defaultProvider.provider:this._defaultProvider.provider}buildAndCacheEventEmitterForClient(t){const e=this._clientEvents.get(t);if(e)return e;const r=this._createEventEmitter();this._clientEvents.set(t,r);const n=this.getProviderForClient(t);return Object.values(He).forEach(a=>{var o;return(o=n.events)==null?void 0:o.addHandler(a,i=>Et(this,null,function*(){r.emit(a,rn(tn({},i),{clientName:t,domain:t,providerName:n.metadata.name}))}))}),r}getUnboundEmitters(){const t=[...this._domainScopedProviders.keys()];return[...[...this._clientEvents.keys()].filter(Ka).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(Ka)}getAssociatedEventEmitters(t){return t?[this.buildAndCacheEventEmitterForClient(t)]:this.getUnboundEmitters()}transferListeners(t,e,r,n){var a;(a=this._clientEventHandlers.get(r))==null||a.forEach(i=>{var s;return(s=t.events)==null?void 0:s.removeHandler(...i)});const o=Object.values(He).map(i=>[i,l=>Et(this,null,function*(){n.forEach(c=>{c?.emit(i,rn(tn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))}),this._apiEmitter.emit(i,rn(tn({},l),{clientName:r,domain:r,providerName:e.metadata.name}))})]);this._clientEventHandlers.set(r,o),o.forEach(i=>{var s;return(s=e.events)==null?void 0:s.addHandler(...i)})}close(){return Et(this,null,function*(){var t,e;try{yield(e=(t=this==null?void 0:this._defaultProvider.provider)==null?void 0:t.onClose)==null?void 0:e.call(t)}catch(n){this.handleShutdownError(this._defaultProvider.provider,n)}const r=Array.from(this._domainScopedProviders);yield Promise.all(r.map(n=>Et(this,[n],function*([,a]){var o,i;try{yield(i=a==null?void 0:(o=a.provider).onClose)==null?void 0:i.call(o)}catch(s){this.handleShutdownError(a?.provider,s)}})))})}clearProvidersAndSetDefault(t){return Et(this,null,function*(){try{yield this.close()}catch{this._logger.error("Unable to cleanly close providers. Resetting to the default configuration.")}finally{this._domainScopedProviders.clear(),this._defaultProvider=new mn(t,this._statusEnumType.NOT_READY,this._statusEnumType)}})}get allProviders(){return[...[...this._domainScopedProviders.values()].map(t=>t.provider),this._defaultProvider.provider]}handleShutdownError(t,e){this._logger.error(`Error during shutdown of provider ${t.metadata.name}: ${e}`),this._logger.error(e?.stack)}},Dh=Object.create,Dn=Object.defineProperty,Ph=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Th=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertyNames,za=Object.getOwnPropertySymbols,wi=Object.getPrototypeOf,bi=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,kh=Reflect.get,Ga=(t,e,r)=>e in t?Dn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nn=(t,e)=>{for(var r in e||(e={}))bi.call(e,r)&&Ga(t,r,e[r]);if(za)for(var r of za(e))Ih.call(e,r)&&Ga(t,r,e[r]);return t},Mh=(t,e)=>Ph(t,Th(e)),Hh=(t,e)=>function(){return e||(0,t[Ri(t)[0]])((e={exports:{}}).exports,e),e.exports},jh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ri(e))!bi.call(t,a)&&a!==r&&Dn(t,a,{get:()=>e[a],enumerable:!(n=Ah(e,a))||n.enumerable});return t},Fh=(t,e,r)=>(r=t!=null?Dh(wi(t)):{},jh(Dn(r,"default",{value:t,enumerable:!0}),t)),$h=(t,e,r)=>kh(wi(t),r,e),mt=(t,e,r)=>new Promise((n,a)=>{var o=l=>{try{s(r.next(l))}catch(c){a(c)}},i=l=>{try{s(r.throw(l))}catch(c){a(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,i);s((r=r.apply(t,e)).next())}),Bh=Hh({"../../node_modules/eventemitter3/index.js"(t,e){var r=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function o(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var E=new o(d,h||c,f),_=n?n+u:u;return c._events[_]?c._events[_].fn?c._events[_]=[c._events[_],E]:c._events[_].push(E):(c._events[_]=E,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new a:delete c._events[u]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)r.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,E=h.length,_=new Array(E);f<E;f++)_[f]=h[f].fn;return _},l.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,E,_){var S=n?n+u:u;if(!this._events[S])return!1;var y=this._events[S],w=arguments.length,O,N;if(y.fn){switch(y.once&&this.removeListener(u,y.fn,void 0,!0),w){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,d),!0;case 3:return y.fn.call(y.context,d,h),!0;case 4:return y.fn.call(y.context,d,h,f),!0;case 5:return y.fn.call(y.context,d,h,f,E),!0;case 6:return y.fn.call(y.context,d,h,f,E,_),!0}for(N=1,O=new Array(w-1);N<w;N++)O[N-1]=arguments[N];y.fn.apply(y.context,O)}else{var L=y.length,P;for(N=0;N<L;N++)switch(y[N].once&&this.removeListener(u,y[N].fn,void 0,!0),w){case 1:y[N].fn.call(y[N].context);break;case 2:y[N].fn.call(y[N].context,d);break;case 3:y[N].fn.call(y[N].context,d,h);break;case 4:y[N].fn.call(y[N].context,d,h,f);break;default:if(!O)for(P=1,O=new Array(w-1);P<w;P++)O[P-1]=arguments[P];y[N].fn.apply(y[N].context,O)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var E=n?n+u:u;if(!this._events[E])return this;if(!d)return s(this,E),this;var _=this._events[E];if(_.fn)_.fn===d&&(!f||_.once)&&(!h||_.context===h)&&s(this,E);else{for(var S=0,y=[],w=_.length;S<w;S++)(_[S].fn!==d||f&&!_[S].once||h&&_[S].context!==h)&&y.push(_[S]);y.length?this._events[E]=y.length===1?y[0]:y:s(this,E)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&s(this,d)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}}),Uh="No-op",Vh=class{constructor(){this.metadata={name:"No-op Provider"}}resolveBooleanEvaluation(t,e){return this.noOp(e)}resolveStringEvaluation(t,e){return this.noOp(e)}resolveNumberEvaluation(t,e){return this.noOp(e)}resolveObjectEvaluation(t,e){return this.noOp(e)}noOp(t){return{value:t,reason:Uh}}},Ya=new Vh,Wh=Fh(Bh()),qa=class extends bh{constructor(){super(),this.eventEmitter=new Wh.default}},Kh=class{constructor(t,e,r,n,a,o,i){this.providerAccessor=t,this.providerStatusAccessor=e,this.emitterAccessor=r,this.apiContextAccessor=n,this.apiHooksAccessor=a,this.globalLogger=o,this.options=i,this._hooks=[]}get metadata(){var t,e;return{name:(t=this.options.domain)!=null?t:this.options.name,domain:(e=this.options.domain)!=null?e:this.options.name,version:this.options.version,providerMetadata:this.providerAccessor().metadata}}get providerStatus(){return this.providerStatusAccessor()}addHandler(t,e,r){var n;if(this.emitterAccessor().addHandler(t,e),Si(t,this.providerStatus))try{e({clientName:this.metadata.name,domain:this.metadata.domain,providerName:this._provider.metadata.name})}catch(o){(n=this._logger)==null||n.error("Error running event handler:",o)}r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this.emitterAccessor().removeHandler(t,e)}getHandlers(t){return this.emitterAccessor().getHandlers(t)}setLogger(t){return this._clientLogger=new xn(t),this}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}getBooleanValue(t,e,r){return this.getBooleanDetails(t,e,r).value}getBooleanDetails(t,e,r){return this.evaluate(t,this._provider.resolveBooleanEvaluation,e,"boolean",r)}getStringValue(t,e,r){return this.getStringDetails(t,e,r).value}getStringDetails(t,e,r){return this.evaluate(t,this._provider.resolveStringEvaluation,e,"string",r)}getNumberValue(t,e,r){return this.getNumberDetails(t,e,r).value}getNumberDetails(t,e,r){return this.evaluate(t,this._provider.resolveNumberEvaluation,e,"number",r)}getObjectValue(t,e,r){return this.getObjectDetails(t,e,r).value}getObjectDetails(t,e,r){return this.evaluate(t,this._provider.resolveObjectEvaluation,e,"object",r)}track(t,e={}){var r,n,a;try{if(this.shortCircuitIfNotReady(),typeof this._provider.track=="function"){const o=Object.freeze(nn({},this.apiContextAccessor((r=this==null?void 0:this.options)==null?void 0:r.domain)));return(a=(n=this._provider).track)==null?void 0:a.call(n,t,o,e)}else this._logger.debug("Provider does not support the track function; will no-op.")}catch(o){this._logger.debug("Error recording tracking event.",o)}}evaluate(t,e,r,n,a={}){var o,i;const s=[...this.apiHooksAccessor(),...this.getHooks(),...a.hooks||[],...this._provider.hooks||[]],l=[...s].reverse(),c=nn({},this.apiContextAccessor((o=this==null?void 0:this.options)==null?void 0:o.domain)),u=l.map(()=>Object.freeze({flagKey:t,defaultValue:r,flagValueType:n,clientMetadata:this.metadata,providerMetadata:this._provider.metadata,context:c,logger:this._logger,hookData:new mh}));let d;try{this.beforeHooks(s,u,a),this.shortCircuitIfNotReady();const h=e.call(this._provider,t,r,c,this._logger),f=Mh(nn({},h),{flagMetadata:Object.freeze((i=h.flagMetadata)!=null?i:{}),flagKey:t});if(f.errorCode){const E=Nh(f.errorCode,f.errorMessage);this.errorHooks(l,u,E,a),d=this.getErrorEvaluationDetails(t,r,E,f.flagMetadata)}else this.afterHooks(l,u,f,a),d=f}catch(h){this.errorHooks(l,u,h,a),d=this.getErrorEvaluationDetails(t,r,h)}return this.finallyHooks(l,u,d,a),d}beforeHooks(t,e,r){var n;for(const[a,o]of t.entries()){const i=t.length-1-a,s=e[i];Object.freeze(s),Object.freeze(s.context),(n=o?.before)==null||n.call(o,s,Object.freeze(r.hookHints))}}afterHooks(t,e,r,n){var a;for(const[o,i]of t.entries()){const s=e[o];(a=i?.after)==null||a.call(i,s,r,n.hookHints)}}errorHooks(t,e,r,n){var a;for(const[o,i]of t.entries())try{const s=e[o];(a=i?.error)==null||a.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'error' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}finallyHooks(t,e,r,n){var a;for(const[o,i]of t.entries())try{const s=e[o];(a=i?.finally)==null||a.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'finally' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}get _provider(){return this.providerAccessor()}get _logger(){return this._clientLogger||this.globalLogger()}shortCircuitIfNotReady(){if(this.providerStatus===Wt.NOT_READY)throw new vi("provider has not yet initialized");if(this.providerStatus===Wt.FATAL)throw new mi("provider is in an irrecoverable error state")}getErrorEvaluationDetails(t,e,r,n={}){const a=r?.message;return{errorCode:r?.code||ci.GENERAL,errorMessage:a,value:e,reason:Eh.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},Ja=Symbol.for("@openfeature/web-sdk/api"),Xa=globalThis,zh=class En extends xh{constructor(){super("client"),this._statusEnumType=Wt,this._apiEmitter=new qa,this._defaultProvider=new mn(Ya,Wt.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new qa}static getInstance(){const e=Xa[Ja];if(e)return e;const r=new En;return Xa[Ja]=r,r}getProviderStatus(e){var r,n;return e?(n=(r=this._domainScopedProviders.get(e))==null?void 0:r.status)!=null?n:this._defaultProvider.status:this._defaultProvider.status}setProviderAndWait(e,r,n){return mt(this,null,function*(){const a=vt(e),o=be(a?r:e),i=be(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i),yield this.setAwaitableProvider(a,o)})}setProvider(e,r,n){const a=vt(e),o=be(a?r:e),i=be(a?n:r);i&&(a?this._domainScopedContext.set(a,i):this._context=i);const s=this.setAwaitableProvider(a,o);return Promise.resolve(s).catch(l=>{this._logger.error("Error during provider initialization:",l)}),this}getProvider(e){return this.getProviderForClient(e)}setContext(e,r){return mt(this,null,function*(){var n,a;const o=vt(e),i=(a=(n=be(e))!=null?n:be(r))!=null?a:{};if(o){const s=this._domainScopedProviders.get(o);if(s){const l=this.getContext(o);this._domainScopedContext.set(o,i),yield this.runProviderContextChangeHandler(o,s,l,i)}else this._domainScopedContext.set(o,i)}else{const s=this._context;this._context=i;const l=Array.from(this._domainScopedProviders.entries()).filter(([u])=>!this._domainScopedContext.has(u)).reduce((u,[d,h])=>(u.push({domain:d,wrapper:h}),u),[]),c=[{domain:void 0,wrapper:this._defaultProvider},...l];yield Promise.all(c.map(u=>this.runProviderContextChangeHandler(u.domain,u.wrapper,s,i)))}})}getContext(e){const r=vt(e);if(r){const n=this._domainScopedContext.get(r);if(n)return n;this._logger.debug(`Unable to find context for '${r}'.`)}return this._context}clearContext(e){return mt(this,null,function*(){const r=vt(e);if(r){const n=this._domainScopedProviders.get(r);if(n){const a=this.getContext(r);this._domainScopedContext.delete(r);const o=this.getContext();yield this.runProviderContextChangeHandler(r,n,a,o)}else this._domainScopedContext.delete(r)}else return this.setContext({})})}clearContexts(){return mt(this,null,function*(){yield this.clearContext(),yield Promise.allSettled(Array.from(this._domainScopedProviders.keys()).map(e=>this.clearContext(e)))})}getClient(e,r){return new Kh(()=>this.getProviderForClient(e),()=>this.getProviderStatus(e),()=>this.buildAndCacheEventEmitterForClient(e),n=>this.getContext(n),()=>this.getHooks(),()=>this._logger,{domain:e,version:r})}clearProviders(){return mt(this,null,function*(){yield $h(En.prototype,this,"clearProvidersAndSetDefault").call(this,Ya),this._domainScopedContext.clear()})}runProviderContextChangeHandler(e,r,n,a){return mt(this,null,function*(){var o,i,s,l,c,u;const d=((i=(o=r.provider)==null?void 0:o.metadata)==null?void 0:i.name)||"unnamed-provider";try{if(typeof r.provider.onContextChange=="function"){const h=r.provider.onContextChange(n,a);h&&typeof h?.then=="function"&&(r.incrementPendingContextChanges(),r.status=this._statusEnumType.RECONCILING,this.getAssociatedEventEmitters(e).forEach(f=>{f?.emit(He.Reconciling,{domain:e,providerName:d})}),(s=this._apiEmitter)==null||s.emit(He.Reconciling,{domain:e,providerName:d}),yield h,r.decrementPendingContextChanges())}r.status=this._statusEnumType.READY,r.allContextChangesSettled&&(this.getAssociatedEventEmitters(e).forEach(h=>{h?.emit(He.ContextChanged,{clientName:e,domain:e,providerName:d})}),(l=this._apiEmitter)==null||l.emit(He.ContextChanged,{clientName:e,domain:e,providerName:d}))}catch(h){if(r.decrementPendingContextChanges(),r.status=this._statusEnumType.ERROR,r.allContextChangesSettled){const f=h,E=`Error running ${d}'s context change handler: ${f?.message}`;(c=this._logger)==null||c.error(`${E}`,h),this.getAssociatedEventEmitters(e).forEach(_=>{_?.emit(He.Error,{clientName:e,domain:e,providerName:d,message:E})}),(u=this._apiEmitter)==null||u.emit(He.Error,{clientName:e,domain:e,providerName:d,message:E})}}})}},Za=zh.getInstance();class Gh{runsOn="client";metadata={name:"QueryParamProvider"};flags;constructor(e){this.flags=new Map;for(const[r,n]of e.entries())this.flags.set(r,n)}resolveBooleanEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n.toLowerCase()==="true"||n==="1",reason:"STATIC",variant:n}}resolveStringEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n,reason:"STATIC",variant:n}}resolveNumberEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};const a=Number(n);return isNaN(a)?{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse "${n}" as a number`}:{value:a,reason:"STATIC",variant:n}}resolveObjectEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};try{return{value:JSON.parse(n),reason:"STATIC",variant:n}}catch(a){return{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse JSON: ${a instanceof Error?a.message:String(a)}`}}}}async function Yh(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new Gh(e);await Za.setProviderAndWait(r);const n=new Map,a=Za.getClient();n.set(Qa,a.getBooleanValue(Qa,qh)),n.set(eo,a.getBooleanValue(eo,Jh)),n.set(to,a.getBooleanValue(to,Xh));const i=e.has(an)?a.getBooleanValue(an,Zh):fe.content.inspectorEnabled;n.set(an,i);const s=e.get("LOG_LEVEL");if(s){const l=["verbose","debug","info","warn","error"];l.includes(s.toLowerCase())?(so(s.toLowerCase()),Ze.info("Log level set to @level via query param",s.toLowerCase())):Ze.warn("Invalid LOG_LEVEL query param: @param. Valid values: @validLevels",s,l.join(", "))}return n}const Qa="FEATURE_LEGACY_READ_ENABLED",qh=!1,eo="FEATURE_LEGACY_WRITE_ENABLED",Jh=!1,to="FEATURE_CHANNEL_SYNC_ENABLED",Xh=!0,an="FEATURE_INSPECTOR_ENABLED",Zh=!1;_o();var Qh=5,ep=async(t,e)=>{let r=new Set,n={async query(a,o,i){let s,l,c;if(typeof a!="string"&&(s=a.signal,o=a.params,i=a.callback,l=a.offset,c=a.limit,a=a.query),l===void 0!=(c===void 0))throw new Error("offset and limit must be provided together");let u=l!==void 0&&c!==void 0,d;if(u&&(typeof l!="number"||isNaN(l)||typeof c!="number"||isNaN(c)))throw new Error("offset and limit must be numbers");let h=i?[i]:[],f=dr().replace(/-/g,""),E=!1,_,S,y=async()=>{await t.transaction(async L=>{let P=o&&o.length>0?await Wn(t,a,o,L):a;await L.exec(`CREATE OR REPLACE TEMP VIEW live_query_${f}_view AS ${P}`);let m=await ro(L,`live_query_${f}_view`);await no(L,m,r),u?(await L.exec(`
|
|
15
15
|
PREPARE live_query_${f}_get(int, int) AS
|
|
16
16
|
SELECT * FROM live_query_${f}_view
|
|
17
17
|
LIMIT $1 OFFSET $2;
|