@oneworks/client 0.1.0-beta.0 → 0.1.0-beta.1
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/{ActionSearchToolbar-8q-bk3mu.js → ActionSearchToolbar-BqRwfUQY.js} +1 -1
- package/dist/assets/{AgentRoomRoute-DfSI_dFH.js → AgentRoomRoute-BYgM7vgg.js} +1 -1
- package/dist/assets/{AgentRoomSessionRoute-DH9PdjZm.js → AgentRoomSessionRoute-DdoZY7qL.js} +1 -1
- package/dist/assets/{ArchiveRoute-E9-htB4H.js → ArchiveRoute-ydgLUN7p.js} +1 -1
- package/dist/assets/{AuthenticatedApp-CgBrvMuc.js → AuthenticatedApp-CK9TT7Nk.js} +192 -192
- package/dist/assets/{AutomationRoute-Bw2xw5bx.js → AutomationRoute-CpcRbNa8.js} +1 -1
- package/dist/assets/{BenchmarkRoute-3VS17jHr.js → BenchmarkRoute-CZRZVolT.js} +1 -1
- package/dist/assets/{ChatRoute-CBQ3j4Je.js → ChatRoute-DdRVEkAb.js} +1 -1
- package/dist/assets/{Collapse-B-oCiEx4.js → Collapse-CxTS9FJh.js} +1 -1
- package/dist/assets/{ComposerLanding-SZn_zRGX.js → ComposerLanding-BChGuCjF.js} +1 -1
- package/dist/assets/{ConfigRoute-Dv-7BRGG.js → ConfigRoute-D_EkHryB.js} +1 -1
- package/dist/assets/{InteractionStructureRoute-FDl9jRvT.js → InteractionStructureRoute-Dpjr6hIq.js} +1 -1
- package/dist/assets/{KnowledgeRoute-C5em_VSL.js → KnowledgeRoute-Bp4Da65A.js} +1 -1
- package/dist/assets/{LauncherApp-olYmK_zO.js → LauncherApp-ByUpDwod.js} +2 -2
- package/dist/assets/{LauncherRoute-Qt8dQkIk.js → LauncherRoute-B94P9m3I.js} +1 -1
- package/dist/assets/{MobileAwareSelect-BmK6WApn.js → MobileAwareSelect-CCAQrsxL.js} +1 -1
- package/dist/assets/{ModuleManagementRoute-B1I_8JKc.js → ModuleManagementRoute-DcrMX6P7.js} +1 -1
- package/dist/assets/{NotFoundRoute-Bj6_YY3I.js → NotFoundRoute-C1IfsiZY.js} +1 -1
- package/dist/assets/{PluginStoreRoute-B847PAZ5.js → PluginStoreRoute-7UBLkrWc.js} +1 -1
- package/dist/assets/{RouteContainerPanelTabs-BnIptVwq.js → RouteContainerPanelTabs-D8pC61tF.js} +1 -1
- package/dist/assets/{SchemaObjectEditor-B9fPfDyT.js → SchemaObjectEditor-DvwrURac.js} +1 -1
- package/dist/assets/{StandaloneMobileDebugRoute-BR4w_LeM.js → StandaloneMobileDebugRoute--yiQ5EdW.js} +1 -1
- package/dist/assets/{WorkspaceApp-BNmtIdn4.js → WorkspaceApp-l-h_IsMp.js} +3 -3
- package/dist/assets/{agent-room-session-paths-Dca8S6NN.js → agent-room-session-paths-DNpYqOr3.js} +3 -3
- package/dist/assets/{arc-JBUpUV6M.js → arc-Xh4h56Fv.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-DKhNwgEQ.js → blockDiagram-c4efeb88-CG3HxYeL.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-CWODEGms.js → c4Diagram-c83219d4-DiEPAqCg.js} +1 -1
- package/dist/assets/channel-DH-F5Uqk.js +1 -0
- package/dist/assets/{classDiagram-beda092f-DlghsOqF.js → classDiagram-beda092f-Dwx44PuJ.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-CrSR8gWz.js → classDiagram-v2-2358418a-COXM437u.js} +1 -1
- package/dist/assets/client-build-info-6B4KoYHs.js +1 -0
- package/dist/assets/clone-DGri7oGq.js +1 -0
- package/dist/assets/{createText-1719965b-CLlPr73k.js → createText-1719965b-DPLMqVqY.js} +1 -1
- package/dist/assets/{cssMode-Bt_74RVV.js → cssMode-DfDq4hLs.js} +1 -1
- package/dist/assets/{dockPanelConstants-BWuu_DJp.js → dockPanelConstants-OzU6hJl5.js} +1 -1
- package/dist/assets/{edges-96097737-L_gy1fky.js → edges-96097737-ry9ejc8v.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-X1QMD6me.js → erDiagram-0228fc6a-AcCPz3wc.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-DNdWK0Po.js → flowDb-c6c81e3f-BGnBxhJf.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-C2khStgw.js → flowDiagram-50d868cf-BnS6RFWo.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-C3klqpJG.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-C89sxd2D.js → flowchart-elk-definition-6af322e1-8-ynORZL.js} +1 -1
- package/dist/assets/{freemarker2-DZ1XIuHj.js → freemarker2-uFZBYLEW.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-Ba3rPNKd.js → ganttDiagram-a2739b55-3MEPfmMB.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-DTEFHHtN.js → gitGraphDiagram-82fe8481-BKYGV9pb.js} +1 -1
- package/dist/assets/{graph-BPujwFoF.js → graph-BEwlNa_j.js} +1 -1
- package/dist/assets/{handlebars-lOgsnnQw.js → handlebars-dg6IZCa7.js} +1 -1
- package/dist/assets/{html-DLHadu9L.js → html-KunL9NkW.js} +1 -1
- package/dist/assets/{htmlMode-VeiQ-IsQ.js → htmlMode-CrFpTEpC.js} +1 -1
- package/dist/assets/{index-5325376f-Cx2RM6pk.js → index-5325376f-CCcP_Ahl.js} +1 -1
- package/dist/assets/{index-D4eelxQF.js → index-BIs5hzci.js} +1 -1
- package/dist/assets/{index-CJEVYkL9.js → index-BggFUwYR.js} +1 -1
- package/dist/assets/{index-Cp4GfHnF.js → index-DdUqPqXW.js} +3 -3
- package/dist/assets/{index-CBFCjoHv.js → index-DhpAFZQZ.js} +1 -1
- package/dist/assets/{index-sFqkb8xv.js → index-YzfSzOLk.js} +1 -1
- package/dist/assets/{index-CWmEuVWV.js → index-ZOsqqPVv.js} +1 -1
- package/dist/assets/{index-DBUG8CzV.js → index-nXq6jwfM.js} +1 -1
- package/dist/assets/{infoDiagram-8eee0895-Bj9hWnDg.js → infoDiagram-8eee0895-BzZ34kgw.js} +1 -1
- package/dist/assets/{interaction-panel-mobile-debug-pages-1Gdivksn.js → interaction-panel-mobile-debug-pages-DXC3HSZU.js} +1 -1
- package/dist/assets/{javascript-CXJw-bvU.js → javascript-DA3fh3oR.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-BXAycrrn.js → journeyDiagram-c64418c1-B_kSGErn.js} +1 -1
- package/dist/assets/{jsonMode-DmUNJfpX.js → jsonMode-BDucSIBv.js} +1 -1
- package/dist/assets/{layout-Bp8GVMnq.js → layout-CRLM1T9z.js} +1 -1
- package/dist/assets/{line-olpPNgnh.js → line-Cdyr_7ve.js} +1 -1
- package/dist/assets/{linear-flh_7ux_.js → linear-y86GycLK.js} +1 -1
- package/dist/assets/{liquid-BiVpRgBP.js → liquid-mJp997il.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-olWF83eX.js → lspLanguageFeatures-DiGGmudW.js} +1 -1
- package/dist/assets/{mdx-B5dr7YB-.js → mdx-Co6h2mZ2.js} +1 -1
- package/dist/assets/{mermaid.core-NVIiXnRA.js → mermaid.core-VYJIZL_J.js} +4 -4
- package/dist/assets/{mindmap-definition-8da855dc-BOCh8K8K.js → mindmap-definition-8da855dc-DKNG2gyr.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-CCitKBQK.js → pieDiagram-a8764435-Cu3up9mc.js} +1 -1
- package/dist/assets/{project-file-tree-icons-DqqhgvoI.js → project-file-tree-icons-CfonMx-1.js} +1 -1
- package/dist/assets/{python-BkEOPIle.js → python-BUUKzwmG.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-C_FvcHzZ.js → quadrantDiagram-1e28029f-DHW8R4el.js} +1 -1
- package/dist/assets/{razor-BCMQgdis.js → razor-ZPlQfY47.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-B001ugYd.js → requirementDiagram-08caed73-CXWNC-_B.js} +1 -1
- package/dist/assets/{route-plugin-chrome-B-Goj3vG.js → route-plugin-chrome-bV1HEaju.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-BnkC9YW5.js → sankeyDiagram-a04cb91d-DhKL8pMH.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-BGiFCs5z.js → sequenceDiagram-c5b8d532-D3fAcQeI.js} +1 -1
- package/dist/assets/{shortcutUtils-20iqPDwh.js → shortcutUtils-B8h6g_7o.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-Uk4XxTkP.js → stateDiagram-1ecb1508-wKQS4LMF.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-Db6Ouywh.js → stateDiagram-v2-c2b004d7-D5qOKtOa.js} +1 -1
- package/dist/assets/{styles-b4e223ce-CfG45yIm.js → styles-b4e223ce-CpBwPex_.js} +1 -1
- package/dist/assets/{styles-ca3715f6-BGGbMvKc.js → styles-ca3715f6-4bqpN1KH.js} +1 -1
- package/dist/assets/{styles-d45a18b0-mHteeqS2.js → styles-d45a18b0-B0RCBD5D.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-BAMR2PsF.js → svgDrawCommon-b86b1483-C9KXk4gS.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-DLBoPuJD.js → timeline-definition-faaaa080-B1Bfjd0m.js} +1 -1
- package/dist/assets/{tsMode-BTzZ8Zos.js → tsMode-Bd8BwKXc.js} +1 -1
- package/dist/assets/{typescript-_rLmAd51.js → typescript-CLd6MPK0.js} +1 -1
- package/dist/assets/{use-app-preferences-gyulV-hA.js → use-app-preferences-DGCafwsP.js} +1 -1
- package/dist/assets/{use-chat-session-actions-DDZ5KCua.js → use-chat-session-actions-wF_HiVzj.js} +1 -1
- package/dist/assets/{vendor-state-BYwEPTaO.js → vendor-state-zjcHRN98.js} +1 -1
- package/dist/assets/{workspace-file-openers-BwZ5cSeq.js → workspace-file-openers-Dj_Cfk1S.js} +1 -1
- package/dist/assets/{xml-BAU8TJ-c.js → xml-BeC1cWk3.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-CNfcxTsi.js → xychartDiagram-f5964ef8-DbJVUSHy.js} +1 -1
- package/dist/assets/{yaml-_cphTIn0.js → yaml-gQrw9AcN.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +17 -17
- package/dist/assets/channel-BsuHYNQO.js +0 -1
- package/dist/assets/client-build-info-bcijLdfD.js +0 -1
- package/dist/assets/clone-BKV6leIk.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-DW5hyUju.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cj as e}from"./AuthenticatedApp-
|
|
1
|
+
import{cj as e}from"./AuthenticatedApp-CK9TT7Nk.js";import"./vendor-react-CnooHTJc.js";import"./vendor-state-zjcHRN98.js";import"./index-DdUqPqXW.js";import"./MobileAwareSelect-CCAQrsxL.js";import"./use-app-preferences-DGCafwsP.js";import"./route-plugin-chrome-bV1HEaju.js";import"./shortcutUtils-B8h6g_7o.js";import"./project-file-tree-icons-CfonMx-1.js";import"./WorkspaceApp-l-h_IsMp.js";import"./index-ZOsqqPVv.js";import"./client-build-info-6B4KoYHs.js";const m={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],onEnterRules:[{beforeText:/^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,afterText:/^\s*\*\/$/,action:{indentAction:e.IndentAction.IndentOutdent,appendText:" * "}},{beforeText:/^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,action:{indentAction:e.IndentAction.None,appendText:" * "}},{beforeText:/^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,action:{indentAction:e.IndentAction.None,appendText:"* "}},{beforeText:/^(\t|(\ \ ))*\ \*\/\s*$/,action:{indentAction:e.IndentAction.None,removeText:1}}],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]},{open:"`",close:"`",notIn:["string","comment"]},{open:"/**",close:" */",notIn:["string"]}],folding:{markers:{start:new RegExp("^\\s*//\\s*#?region\\b"),end:new RegExp("^\\s*//\\s*#?endregion\\b")}}},x={defaultToken:"invalid",tokenPostfix:".ts",keywords:["abstract","any","as","asserts","bigint","boolean","break","case","catch","class","continue","const","constructor","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","infer","instanceof","interface","is","keyof","let","module","namespace","never","new","null","number","object","out","package","private","protected","public","override","readonly","require","global","return","satisfies","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","undefined","unique","unknown","var","void","while","with","yield","async","await","of"],operators:["<=",">=","==","!=","===","!==","=>","+","-","**","*","/","%","++","--","<<","</",">>",">>>","&","|","^","!","~","&&","||","??","?",":","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=","@"],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/[{}]/,"delimiter.bracket"],{include:"common"}],common:[[/#?[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w\$]*/,"type.identifier"],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,{token:"regexp",bracket:"@open",next:"@regexp"}],[/[()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/!(?=([^=]|$))/,"delimiter"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/(@digits)[eE]([\-+]?(@digits))?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/,"number.float"],[/0[xX](@hexdigits)n?/,"number.hex"],[/0[oO]?(@octaldigits)n?/,"number.octal"],[/0[bB](@binarydigits)n?/,"number.binary"],[/(@digits)n?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string_double"],[/'/,"string","@string_single"],[/`/,"string","@string_backtick"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@jsdoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],jsdoc:[[/[^\/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["regexp.escape.control","regexp.escape.control","regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,["regexp.escape.control",{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["regexp.escape.control","regexp.escape.control"]],[/[()]/,"regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],[/(\/)([dgimsuy]*)/,[{token:"regexp",bracket:"@close",next:"@pop"},"keyword.other"]]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,{token:"regexp.escape.control",next:"@pop",bracket:"@close"}]],string_double:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],string_single:[[/[^\\']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,"string","@pop"]],string_backtick:[[/\$\{/,{token:"delimiter.bracket",next:"@bracketCounting"}],[/[^\\`$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/`/,"string","@pop"]],bracketCounting:[[/\{/,"delimiter.bracket","@bracketCounting"],[/\}/,"delimiter.bracket","@pop"],{include:"common"}]}};export{m as conf,x as language};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d}from"./vendor-react-CnooHTJc.js";import{u as O,d as k,e as x}from"./vendor-state-
|
|
1
|
+
import{r as d}from"./vendor-react-CnooHTJc.js";import{u as O,d as k,e as x}from"./vendor-state-zjcHRN98.js";import{bt as P,c3 as b,c4 as _,c5 as A,c6 as w,c7 as L,aw as M,ax as j,ay as F,n as g,c8 as B,t as H,u as $,D,a as I,c9 as G}from"./index-DdUqPqXW.js";const l=(e,o)=>new P(e).setA(o).toRgbString(),m=(e,o)=>new P(e).lighten(o).toHexString(),J=e=>{const o=b(e,{theme:"dark"});return{1:o[0],2:o[1],3:o[2],4:o[3],5:o[6],6:o[5],7:o[4],8:o[6],9:o[5],10:o[4]}},Y=(e,o)=>{const t=e||"#000",r=o||"#fff";return{colorBgBase:t,colorTextBase:r,colorText:l(r,.85),colorTextSecondary:l(r,.65),colorTextTertiary:l(r,.45),colorTextQuaternary:l(r,.25),colorFill:l(r,.18),colorFillSecondary:l(r,.12),colorFillTertiary:l(r,.08),colorFillQuaternary:l(r,.04),colorBgSolid:l(r,.95),colorBgSolidHover:l(r,1),colorBgSolidActive:l(r,.9),colorBgElevated:m(t,12),colorBgContainer:m(t,8),colorBgLayout:m(t,0),colorBgSpotlight:m(t,26),colorBgBlur:l(r,.04),colorBorder:m(t,26),colorBorderSecondary:m(t,19)}},z=(e,o)=>{const t=Object.keys(_).map(s=>{const a=b(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((c,u,i)=>(c[`${s}-${i+1}`]=a[i],c[`${s}${i+1}`]=a[i],c),{})}).reduce((s,a)=>(s=Object.assign(Object.assign({},s),a),s),{}),r=o??A(e),n=w(e,{generateColorPalettes:J,generateNeutralColorPalettes:Y});return Object.assign(Object.assign(Object.assign(Object.assign({},r),t),n),{colorPrimaryBg:n.colorPrimaryBorder,colorPrimaryBgHover:n.colorPrimaryBorderHover})},C={defaultSeed:L.token,defaultAlgorithm:A,darkAlgorithm:z};async function N(){return M("/api/config")}async function R(){return M("/api/config/schema")}async function ee(e,o,t,r={}){return j("/api/config",{method:"PATCH",headers:F,body:JSON.stringify({source:e,section:o,value:t,unsetPaths:r.unsetPaths})},"[api] update config failed:")}const y="oneworks_theme_primary_color",v=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Q=e=>{var o,t,r,n,s,a;return g(((r=(t=(o=e==null?void 0:e.resolvedSources)==null?void 0:o.global)==null?void 0:t.appearance)==null?void 0:r.primaryColor)??((a=(s=(n=e==null?void 0:e.sources)==null?void 0:n.global)==null?void 0:s.appearance)==null?void 0:a.primaryColor))},V=e=>{var t,r,n,s,a,c;const o=((n=(r=(t=e==null?void 0:e.resolvedSources)==null?void 0:t.global)==null?void 0:r.appearance)==null?void 0:n.themeMode)??((c=(a=(s=e==null?void 0:e.sources)==null?void 0:s.global)==null?void 0:a.appearance)==null?void 0:c.themeMode);return o==null?void 0:B(o)},oe=e=>{if(!(!v(e)||typeof e.primaryColor!="string"))return g(e.primaryColor)},re=e=>{if(v(e))return e.themeMode==null?void 0:B(e.themeMode)},U=()=>{try{return g(localStorage.getItem(y))}catch{return}},W=e=>{try{localStorage.setItem(y,e)}catch{}},q=e=>{const o=document.documentElement.style;o.setProperty("--primary-color",e),o.setProperty("--primary-soft-bg",`color-mix(in srgb, ${e} 12%, var(--bg-color))`),o.setProperty("--primary-text-color",`color-mix(in srgb, ${e} 82%, var(--text-color))`)};function te(){var h,p,f;const{i18n:e}=O(),o=k(H),{isDarkMode:t,themeMode:r}=$(),[n,s]=d.useState(()=>U()),{data:a}=x("/api/config",N),c=(f=(p=(h=a==null?void 0:a.sources)==null?void 0:h.merged)==null?void 0:p.general)==null?void 0:f.interfaceLanguage,u=V(a),i=Q(a)??n??D;I(r),d.useEffect(()=>{const S=T=>{T.key===y&&s(g(T.newValue))};return window.addEventListener("storage",S),()=>window.removeEventListener("storage",S)},[]),d.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]),d.useEffect(()=>{u!=null&&o(u)},[u,o]),d.useEffect(()=>{q(i),W(i)},[i]),d.useEffect(()=>{c&&e.language!==c&&G(c)},[e,c]);const E=d.useMemo(()=>({algorithm:t?C.darkAlgorithm:C.defaultAlgorithm,token:{colorPrimary:i}}),[t,i]);return{isDarkMode:t,themeConfig:E}}export{y as T,N as a,oe as b,Q as c,re as d,V as e,q as f,U as g,te as h,R as i,W as p,C as t,ee as u};
|
package/dist/assets/{use-chat-session-actions-DDZ5KCua.js → use-chat-session-actions-wF_HiVzj.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var Pt=(e,t,r)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>Pt(e,typeof t!="symbol"?t+"":t,r);import{r as a,h as Lt,u as Wt}from"./vendor-react-CnooHTJc.js";import{aI as Ht,aD as J}from"./index-
|
|
1
|
+
var wt=Object.defineProperty;var Pt=(e,t,r)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>Pt(e,typeof t!="symbol"?t+"":t,r);import{r as a,h as Lt,u as Wt}from"./vendor-react-CnooHTJc.js";import{aI as Ht,aD as J}from"./index-DdUqPqXW.js";import{bS as Ft,aH as ft,bT as mt,bU as Ze,bV as gt,bW as qt,U as xe,az as Nt,bX as ve,bY as et,i as Ut,X as He,bZ as It,b_ as zt,b$ as $t,c0 as Bt,c1 as Dt,c2 as tt,aU as rt,c3 as Vt,c4 as jt,c5 as Gt,c6 as Kt,c7 as Qt,c8 as Yt,c9 as Xt,ca as Jt}from"./AuthenticatedApp-CK9TT7Nk.js";import{u as pt,f as St,b as Zt,d as xt}from"./vendor-state-zjcHRN98.js";const ht="local-user-message:",vt=6e4,Ue=new Map,qe=new Map,Gr=()=>{var t;const e=(t=globalThis.crypto)!=null&&t.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return`${ht}${e}`},er=(e,t)=>{const r=Ue.get(e)??[];Ue.set(e,[...r,t]);const o=qe.get(e);if(o!=null)for(const i of o)i(t)},tr=e=>{const t=Ue.get(e)??[];return Ue.delete(e),t},rr=(e,t)=>{const r=qe.get(e)??new Set;return r.add(t),qe.set(e,r),()=>{r.delete(t),r.size===0&&qe.delete(e)}},je=e=>e.role==="user"&&(e.id.startsWith(ht)||e.id.endsWith(Ft)),nt=e=>e.trim().replace(/\s+/g," "),Ge=e=>nt(typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
2
2
|
`)),nr=(e,t)=>e.role==="user"&&t.role==="user"&&Ge(e.content)!==""&&Ge(e.content)===Ge(t.content),or=(e,t)=>nr(e,t)&&t.createdAt>=e.createdAt-vt,Ke=(e,t)=>{const r=e.filter(f=>!je(f)),o=f=>r.some(b=>or(f,b)),i=e.filter(f=>!je(f)||!o(f)),d=new Set(i.map(f=>f.id)),C=t.filter(f=>je(f)&&!d.has(f.id)&&!o(f));return C.length===0?i:[...i,...C].sort((f,b)=>f.createdAt-b.createdAt)},yt=e=>typeof e=="object"&&e!=null&&!Array.isArray(e),ot=e=>typeof e=="string"&&e.trim()!==""?e.trim():void 0,ct=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,st=e=>{if(!yt(e)||e.type!=="context_compaction"&&e.type!=="contextCompaction")return null;const t=ot(e.id)??`context-compaction-${Date.now()}`,r=ct(e.createdAt)??Date.now(),o=ct(e.tokenCount),i=ot(e.trigger);return{id:t,createdAt:r,status:"compressing",...o==null?{}:{tokenCount:o},...i==null?{}:{trigger:i}}},Ct=e=>{if(e.type!=="adapter_event")return null;const t=st(e.data);return t??(yt(e.data)?st(e.data.runtimeEvent):null)},cr=e=>e.type!=="message"?!1:"message"in e&&e.message!=null?e.message.role==="assistant":e.role==="assistant",Ie=e=>e!=null&&e!=="running"&&e!=="waiting_input",Te=e=>e.some(t=>t.status!=="compressed")?e.map(t=>({...t,status:"compressed"})):e,at=e=>e.reduce((t,r)=>t==null||r.createdAt>=t.createdAt?r:t,null),bt=(e,t)=>{const r=e.filter(o=>o.id!==t.id);return r.push(t),r.sort((o,i)=>o.createdAt-i.createdAt)},Kr=(e,t)=>e.status==="compressed"||Ie(t)?"compressed":"compressing",sr=(e,t)=>{let r=[];for(const o of e){const i=Ct(o);if(i!=null){r=bt(r,i);continue}cr(o)&&(r=Te(r))}return Ie(t)&&(r=Te(r)),r},it="branchSessionId",ar=e=>(e==null?void 0:e.messageBranchGroupId)!=null&&e.messageBranchGroupId!=="",ir=(e,t)=>{const r=new Map;for(const o of e)r.set(o.id,o);for(const o of t)o!=null&&o.id!==""&&r.set(o.id,o);return r},ur=(e,t=[])=>{if(e==null||e.id==="")return;const r=ir(t,[e]);let o=e;const i=new Set;for(;(o==null?void 0:o.messageBranchSourceSessionId)!=null&&o.messageBranchSourceSessionId!==""&&!i.has(o.id);){i.add(o.id);const d=r.get(o.messageBranchSourceSessionId);if(d==null)return o.messageBranchSourceSessionId;o=d}return(o==null?void 0:o.id)??e.id},Qr=(e,t,r=[])=>e!=null&&t!=null&&ar(e)&&ur(e,r)===t,lr=({currentSearch:e,rootSessionId:t,targetSessionId:r})=>{const o=new URLSearchParams(e);r===t?o.delete(it):o.set(it,r);const i=o.toString();return i===""?"":`?${i}`};class dr{constructor(){V(this,"sockets",new Map);V(this,"subscribers",new Map);V(this,"disconnectTimers",new Map);V(this,"reconnectTimers",new Map);V(this,"reconnectAttempts",new Map);V(this,"connectionParams",new Map);V(this,"connectionParamValues",new Map);V(this,"DISCONNECT_DELAY",6e4);V(this,"RECONNECT_BASE_DELAY",1e3);V(this,"RECONNECT_MAX_DELAY",15e3)}connect(t,r,o){var b;this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.reconnectTimers.has(t)&&(clearTimeout(this.reconnectTimers.get(t)),this.reconnectTimers.delete(t)),this.subscribers.has(t)||this.subscribers.set(t,new Set),this.subscribers.get(t).add(r);const i=this.normalizeParams({sessionId:t,...o??{}}),d=this.buildParamsKey(i),C=this.connectionParams.get(t);let f=this.sockets.get(t);return C!=null&&C!==d&&f&&(this.sockets.delete(t),this.closeSocket(f),f=void 0),!f||f.readyState===WebSocket.CLOSED||f.readyState===WebSocket.CLOSING?this.createConnection(t,i):f.readyState===WebSocket.OPEN&&((b=r.onOpen)==null||b.call(r)),this.connectionParams.set(t,d),this.connectionParamValues.set(t,i),()=>this.disconnect(t,r)}createConnection(t,r){const o=ft({onOpen:()=>{this.reconnectAttempts.delete(t),this.broadcast(t,"onOpen")},onMessage:i=>{this.broadcast(t,"onMessage",i)},onError:i=>{this.broadcast(t,"onError",i),this.sockets.get(t)===o&&this.closeSocket(o)},onClose:i=>{this.broadcast(t,"onClose",i),this.sockets.get(t)===o&&(this.sockets.delete(t),this.shouldReconnect(t,i)?this.scheduleReconnect(t):this.reconnectAttempts.delete(t))}},r);this.sockets.set(t,o)}scheduleReconnect(t){if(this.reconnectTimers.has(t))return;const r=this.subscribers.get(t),o=this.connectionParamValues.get(t);if(r==null||r.size===0||o==null){this.reconnectAttempts.delete(t);return}const i=this.reconnectAttempts.get(t)??0,d=Math.min(this.RECONNECT_BASE_DELAY*2**i,this.RECONNECT_MAX_DELAY);this.reconnectAttempts.set(t,i+1),this.reconnectTimers.set(t,setTimeout(()=>{this.reconnectTimers.delete(t);const C=this.subscribers.get(t);if(C==null||C.size===0){this.reconnectAttempts.delete(t);return}this.sockets.has(t)||this.createConnection(t,o)},d))}disconnect(t,r){const o=this.subscribers.get(t);o&&(o.delete(r),o.size===0&&this.disconnectTimers.set(t,setTimeout(()=>{const i=this.sockets.get(t);i&&(this.sockets.delete(t),this.closeSocket(i)),this.disconnectTimers.delete(t),this.reconnectAttempts.delete(t),this.subscribers.delete(t),this.connectionParams.delete(t),this.connectionParamValues.delete(t)},this.DISCONNECT_DELAY)))}broadcast(t,r,o){const i=this.subscribers.get(t);i&&Array.from(i).forEach(C=>{if(C[r])try{C[r](o)}catch(f){console.error(`Error in ${r} handler for session ${t}:`,f)}})}shouldReconnect(t,r){const o=this.subscribers.get(t);return o==null?!1:Array.from(o).every(i=>{var d;return((d=i.shouldReconnect)==null?void 0:d.call(i,r))!==!1})}close(t){const r=this.sockets.get(t);r&&(this.sockets.delete(t),this.closeSocket(r)),this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.reconnectTimers.has(t)&&(clearTimeout(this.reconnectTimers.get(t)),this.reconnectTimers.delete(t)),this.reconnectAttempts.delete(t),this.subscribers.delete(t),this.connectionParams.delete(t),this.connectionParamValues.delete(t)}send(t,r){const o=this.sockets.get(t);return o&&o.readyState===WebSocket.OPEN?(o.send(typeof r=="string"?r:JSON.stringify(r)),!0):(console.warn(`Cannot send message: Session ${t} not connected or ready`),!1)}normalizeParams(t){return Object.entries(t).reduce((r,[o,i])=>{if(i==null)return r;const d=String(i).trim();return d===""||(r[o]=d),r},{})}buildParamsKey(t){return Object.entries(t).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>`${r}=${o}`).join("&")}closeSocket(t){t.readyState===WebSocket.CLOSED||t.readyState===WebSocket.CLOSING||t.close()}}const ke=new dr,fr=27,mr=e=>{let t="",r=0;for(;r<e.length;){if(e.charCodeAt(r)===fr&&e[r+1]==="["){for(r+=2;r<e.length;){const o=e.charCodeAt(r);if(o>=64&&o<=126){r+=1;break}r+=1}continue}t+=e[r],r+=1}return t},ut=e=>mr(e).trim(),Rt=e=>{if((e==null?void 0:e.type)!=="error"||e.data!=null&&typeof e.data=="object"&&"fatal"in e.data&&e.data.fatal===!1)return null;const t=e.data!=null&&typeof e.data=="object"&&"code"in e.data&&typeof e.data.code=="string"&&e.data.code.trim()!==""?e.data.code:void 0;if(e.data!=null&&typeof e.data=="object"&&"message"in e.data){const r=e.data.message;if(typeof r=="string"){const o=ut(r);if(o!=="")return{message:o,code:t}}}if(typeof e.message=="string"){const r=ut(e.message);if(r!=="")return{message:r,code:t}}return null},Et=(e,t)=>{if(t.type==="interaction_request")return{id:t.id,payload:t.payload};if(t.type==="interaction_response")return(e==null?void 0:e.id)===t.id||e==null?null:e;if(t.type==="session_updated"){const r=t.session;if("isDeleted"in r||r.status!=="waiting_input")return null}return t.type==="error"&&t.data!=null&&typeof t.data=="object"&&"fatal"in t.data&&t.data.fatal!==!1?null:e},gr=(e,t,r)=>{let o=null;for(const i of e)o=Et(o,i);return o!=null?r==null||r==="waiting_input"?o:null:r==="waiting_input"?t:null},pr=e=>{for(let t=e.length-1;t>=0;t-=1){const r=Rt(e[t]);if(r!=null)return r}return null},Sr=20,ze=e=>({creationProgress:(e==null?void 0:e.creationProgress)??[],messages:(e==null?void 0:e.messages)??[],sessionInfo:(e==null?void 0:e.sessionInfo)??null,sessionOperationInfo:(e==null?void 0:e.sessionOperationInfo)??null,sessionCompactionInfo:(e==null?void 0:e.sessionCompactionInfo)??null,sessionCompactionEvents:(e==null?void 0:e.sessionCompactionEvents)??[],sessionWorkspaceChanges:(e==null?void 0:e.sessionWorkspaceChanges)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??{steer:[],next:[]},errorState:(e==null?void 0:e.errorState)??null,interactionRequest:(e==null?void 0:e.interactionRequest)??null,isHydrated:(e==null?void 0:e.isHydrated)??!1}),hr=(e,t)=>ze({...ze(e),...t}),yr=e=>{const t=ze(e),r=t.isHydrated===!0?t:ze();return{creationProgress:r.creationProgress,messages:r.messages,sessionInfo:r.sessionInfo,sessionOperationInfo:r.sessionOperationInfo,sessionCompactionInfo:r.sessionCompactionInfo,sessionCompactionEvents:r.sessionCompactionEvents,sessionWorkspaceChanges:r.sessionWorkspaceChanges,queuedMessages:r.queuedMessages,errorState:r.errorState,interactionRequest:r.interactionRequest,isReady:r.isHydrated}},Cr=(e,t,r)=>{const o=hr(e.get(t),r);for(e.has(t)&&e.delete(t),e.set(t,o);e.size>Sr;){const i=e.keys().next().value;if(i==null)break;e.delete(i)}return o},br=(e,t)=>{e.delete(t)},Fe={steer:[],next:[]},Rr=2,Ne=new Map,Ae=(e,t)=>{const r=Ne.get(e);if(r!=null)for(const o of r)o(t)},Er=(e,t)=>{const r=Ne.get(e)??new Set;return r.add(t),Ne.set(e,r),()=>{r.delete(t),r.size===0&&Ne.delete(e)}},Mr=e=>e==="user"||e==="assistant"||e==="system",kr=e=>e.type==="message"&&!("message"in e),lt=e=>{const t=typeof e.createdAt=="number"?e.createdAt:e.ts;return typeof t=="number"?t:Date.now()},Xe=e=>typeof e=="object"&&e!=null&&!Array.isArray(e),P=(e,t)=>typeof e[t]=="string"&&e[t]!==""?e[t]:void 0,Ar=(e,t)=>e==null?t:e==="ui"||e==="user"?t??"user":e,Je=e=>{if(!Xe(e))return;const t=P(e,"commandId"),r=P(e,"causedByCommandId"),o=Ar(P(e,"source"),t!=null||r!=null?"leader":void 0),i=P(e,"sourceLabel"),d=P(e,"roomId"),C=P(e,"hostSessionId"),f=P(e,"memberKey"),b=P(e,"runKey")??P(e,"runId"),I={...o!=null?{source:o}:{},...i!=null?{sourceLabel:i}:{},...d!=null?{roomId:d}:{},...C!=null?{hostSessionId:C}:{},...f!=null?{memberKey:f}:{},...b!=null?{runKey:b}:{},...t!=null?{commandId:t}:{},...r!=null?{causedByCommandId:r}:{}};return Object.keys(I).length===0?void 0:I},Tr=(e,t)=>Je(e.agentRoom)??Je(e)??(t==null?void 0:t.agentRoom),Mt=e=>{if(!(e.type!=="adapter_event"||!Xe(e.data)))return Xe(e.data.runtimeEvent)?e.data.runtimeEvent:void 0},_r=e=>typeof e.ts=="number"?e.ts:Date.now(),Or=e=>{const t=Mt(e);if(t==null)return null;const r=t.type;if(r!=="operation_started"&&r!=="operation_completed"&&r!=="operation_failed")return null;const o=P(t,"operationId")??P(t,"id");return o==null?null:r!=="operation_started"?{operationId:o,operationInfo:null}:{operationId:o,operationInfo:{operationId:o,adapter:P(t,"adapter"),message:P(t,"message"),startedAt:_r(t),summary:P(t,"summary"),title:P(t,"title")}}},kt=(e,t)=>{const r=Or(t);return r==null?e:r.operationInfo!=null?r.operationInfo:(e==null?void 0:e.operationId)===r.operationId?null:e},wr=e=>e.reduce(kt,null),Pr=e=>{const t=Mt(e);if(!(t==null||t.type!=="command_ack"))return Je(t)},At=(e,t)=>{if(e.type!=="message")return null;if("message"in e&&e.message!=null)return(t==null?void 0:t.agentRoom)==null||e.message.role!=="user"||e.message.agentRoom!=null?e.message:{...e.message,agentRoom:t.agentRoom};if(!kr(e)||!Mr(e.role)||typeof e.content!="string"&&!Array.isArray(e.content))return null;const r=Tr(e,t);return{id:typeof e.id=="string"&&e.id!==""?e.id:`runtime-message-${lt(e)}`,role:e.role,content:e.content,...r!=null?{agentRoom:r}:{},model:typeof e.model=="string"?e.model:void 0,createdAt:lt(e)}},Lr=e=>{let t=[],r;for(const o of e)r=Pr(o)??r,t=Tt(t,o,r!=null?{agentRoom:r}:void 0),t=_t(t,o),o.type==="message"&&(r=void 0);return t},Wr=(e,t)=>!t||(e==null?void 0:e.id)==null||e.id===""||e.parentSessionId!=null&&e.parentSessionId!==""?!1:e.status==="waiting_input",Qe=({activeSessionId:e,appliedRequestSeq:t,requestSeq:r,sessionId:o})=>e===o&&r>=t,Hr=(e,t)=>gt(t)||t.id!==e.id?!1:t.status!==e.status||t.lastMessage!==e.lastMessage||t.messageCount!==e.messageCount,Fr=e=>800*2**e,Tt=(e,t,r)=>{const o=At(t,r);return o==null?e:e.find(d=>d.id===o.id)!=null?e.map(d=>d.id===o.id?o:d):[...e,o]},qr=e=>{var t;return((t=e.toolCall)==null?void 0:t.id)??e.id},_t=(e,t)=>{if(t.type!=="tool_result")return e;const r=t.isError===!0?"error":"success";return e.map(o=>o.toolCall!=null&&qr(o)===t.toolCallId?{...o,toolCall:{...o.toolCall,status:r,output:t.output}}:o)},dt=(e,t)=>t.type!=="session_creation_progress"?e:[...e,t.progress],Ot=(e,t)=>(e.some(o=>o.id===t.id)?e.map(o=>o.id===t.id?t:o):[...e,t]).sort((o,i)=>{const d=o.createdAt-i.createdAt;return d!==0?d:o.id.localeCompare(i.id)}),Nr=e=>e.reduce((t,r)=>r.type!=="workspace_changes"?t:Ot(t,r.changes),[]);function Yr({session:e,modelForQuery:t,effort:r,permissionMode:o,adapter:i,account:d,optimisticCreation:C,setInteractionRequest:f}){const{t:b}=pt(),{mutate:I}=St(),[_e,j]=a.useState([]),[Oe,R]=a.useState([]),[ue,Z]=a.useState(null),[$e,te]=a.useState(null),[h,m]=a.useState(null),[pe,G]=a.useState([]),[le,re]=a.useState([]),[Be,z]=a.useState({steer:[],next:[]}),[Se,K]=a.useState(!1),[he,_]=a.useState(null),[De,we]=a.useState(0),T=a.useRef(!0),p=a.useRef(void 0),ye=a.useRef(void 0),Ee=a.useRef(void 0),x=a.useRef(void 0),H=a.useRef(void 0),$=a.useRef(e==null?void 0:e.status),O=a.useRef(!1),F=a.useRef(!1),B=a.useRef(null),D=a.useRef(null),w=a.useRef(e==null?void 0:e.id),ne=a.useRef(0),v=a.useRef(0),Q=a.useRef([]),Y=a.useRef([]),oe=a.useRef(new Map),ce=a.useRef([]);w.current=e==null?void 0:e.id;const g=a.useCallback((n,c)=>Cr(oe.current,n,c),[]),Pe=a.useCallback(n=>{br(oe.current,n)},[]),Le=a.useCallback((n,c=w.current)=>{ce.current=n,G(n);const l=at(n);m(l),c!=null&&c!==""&&g(c,{sessionCompactionEvents:n,sessionCompactionInfo:l})},[g]),q=a.useCallback(n=>{const c=ce.current,l=n(c);l!==c&&Le(l)},[Le]),We=a.useCallback(n=>{j(c=>{const l=typeof n=="function"?n(c):n,y=w.current;if(y!=null&&y!==""){const E=oe.current.get(y);g(y,{messages:l,isHydrated:(E==null?void 0:E.isHydrated)===!0})}return l})},[g]),de=a.useCallback(n=>{j(c=>{const l=typeof n=="function"?n(c):n,y=Ke(l,c),E=w.current;if(E!=null&&E!==""){const k=oe.current.get(E);g(E,{messages:y,isHydrated:(k==null?void 0:k.isHydrated)===!0})}return y})},[g]),se=a.useCallback((n,c=w.current)=>{z(n),c!=null&&c!==""&&g(c,{queuedMessages:n})},[g]),Ce=a.useCallback((n,c=w.current)=>{D.current=n,te(n),c!=null&&c!==""&&g(c,{sessionOperationInfo:n})},[g]),ee=a.useCallback(()=>{for(const n of Q.current)clearTimeout(n);Q.current=[]},[]),ae=a.useCallback(()=>{for(const n of Y.current)clearTimeout(n);Y.current=[]},[]),U=a.useCallback(async(n={})=>{var y,E,k,ie;const c=w.current;if(c==null||c==="")return;const l=++ne.current;try{const L=await mt(c);if(!Qe({activeSessionId:w.current,appliedRequestSeq:v.current,requestSeq:l,sessionId:c}))return;v.current=l,ae();const W=L.messages;L.session&&Ze(I,L.session);const fe=Lr(W),X=sr(W,(y=L.session)==null?void 0:y.status),be=at(X),Ve=Nr(W),me=wr(W);let Re=[],N=null;const u=gr(W,L.interaction??null,(E=L.session)==null?void 0:E.status),A=pr(W),ge=u==null&&((k=L.session)==null?void 0:k.status)==="failed"&&A!=null?{kind:"session",message:A.message,code:A.code}:null,S=L.queuedMessages??Fe;B.current=u,D.current=me,f(u),se(S,c),Ce(me,c),_(ge);for(const M of W)Re=dt(Re,M),M.type==="session_info"&&M.info!=null&&M.info.type!=="summary"&&(N=M.info);g(c,{messages:fe,creationProgress:Re,sessionInfo:N,sessionOperationInfo:me,sessionCompactionInfo:be,sessionCompactionEvents:X,sessionWorkspaceChanges:Ve,queuedMessages:S,errorState:ge,interactionRequest:u,isHydrated:!0}),de(fe),R(Re),Z(N),te(me),m(be),ce.current=X,G(X),re(Ve),n.updateReadiness!==!1&&setTimeout(()=>{Qe({activeSessionId:w.current,appliedRequestSeq:v.current,requestSeq:l,sessionId:c})&&(K(!0),T.current=!1)},100)}catch(L){if(!Qe({activeSessionId:w.current,appliedRequestSeq:v.current,requestSeq:l,sessionId:c})||((ie=oe.current.get(c))==null?void 0:ie.isHydrated)===!0)return;console.error("Failed to fetch history messages:",L);const W=n.retryAttempt??0;if(W<Rr){const X=globalThis.setTimeout(()=>{Y.current=Y.current.filter(be=>be!==X),U({...n,retryAttempt:W+1})},Fr(W));Y.current.push(X);return}const fe={kind:"connection",message:b("chat.historyLoadFailed"),recoverable:!0,reason:"error"};_(fe),g(c,{errorState:fe}),n.updateReadiness!==!1&&(K(!0),T.current=!1)}},[se,Ce,ae,I,f,de,b,g]),Me=a.useCallback(()=>{ee();for(const n of[0,800,2400,5e3,9e3,15e3]){const c=globalThis.setTimeout(()=>{U({updateReadiness:!1})},n);Q.current.push(c)}},[ee,U]),s=a.useCallback(()=>{(e==null?void 0:e.id)==null||e.id===""||(O.current=!0,F.current=!1,_(null),g(e.id,{errorState:null}),ke.close(e.id),we(n=>n+1))},[e==null?void 0:e.id,g]);return a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){ne.current+=1,v.current=ne.current,ae(),j([]),R([]),Z(null),te(null),m(null),ce.current=[],G([]),re([]),z(Fe),K(!0),_(null),f(null),B.current=null,D.current=null,T.current=!0,p.current=void 0,ye.current=void 0,Ee.current=void 0,x.current=void 0,H.current=void 0,F.current=!1,ee();return}if(C!=null){ee(),ne.current+=1,v.current=ne.current,ae();const E=[C.message],k=C.status==="failed"?{action:"retry-session-creation",code:"session_create_failed",kind:"session",message:C.errorMessage??b("chat.sessionCreateFailedMessage")}:null;B.current=null,f(null),j(E),Z(null),te(null),m(null),D.current=null,ce.current=[],G([]),re([]),z(Fe),_(k),K(!0),T.current=!1,g(e.id,{messages:E,sessionInfo:null,sessionOperationInfo:null,sessionCompactionInfo:null,sessionCompactionEvents:[],sessionWorkspaceChanges:[],queuedMessages:Fe,errorState:k,interactionRequest:null,isHydrated:!0});return}const n=yr(oe.current.get(e.id)),c=tr(e.id),l=c.length>0,y=Ke(n.messages,c);return j(y),R(n.creationProgress),Z(n.sessionInfo),te(n.sessionOperationInfo),m(n.sessionCompactionInfo),ce.current=n.sessionCompactionEvents,G(n.sessionCompactionEvents),re(n.sessionWorkspaceChanges),z(n.queuedMessages),_(n.errorState),f(n.interactionRequest),B.current=n.interactionRequest,D.current=n.sessionOperationInfo,K(n.isReady||l),T.current=!(n.isReady||l),l&&g(e.id,{messages:y,isHydrated:n.isReady||l}),U(),()=>{ee(),ae()}},[ae,ee,C,U,e==null?void 0:e.id,f,b,g]),a.useEffect(()=>{if(!((e==null?void 0:e.id)==null||e.id===""))return Er(e.id,n=>{se(n,e.id)})},[se,e==null?void 0:e.id]),a.useEffect(()=>{if(!((e==null?void 0:e.id)==null||e.id===""))return rr(e.id,n=>{de(c=>Ke(c,[n]))})},[e==null?void 0:e.id,de]),a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){$.current=void 0;return}if(C!=null){$.current=e.status;return}const n=$.current;$.current=e.status,!(n==null||n===e.status)&&(Ie(e.status)&&q(Te),U({updateReadiness:!1}))},[C,U,e==null?void 0:e.id,e==null?void 0:e.status,q]),a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id==="")return;if(C!=null){O.current=!0,F.current=!1,ke.close(e.id);return}let n=!1,c;const l=[],y=t??"",E=t!=null&&p.current!=null&&y!==p.current&&(e==null?void 0:e.status)!=="running",k=r==="default"?"":r,ie=ye.current!=null&&k!==ye.current&&(e==null?void 0:e.status)!=="running",L=o??"",W=i??"",fe=i!=null&&x.current!=null&&W!==x.current&&(e==null?void 0:e.status)!=="running",X=d??"",be=d!=null&&H.current!=null&&X!==H.current&&(e==null?void 0:e.status)!=="running",me=Wr(e,E||ie||fe||be);me&&(O.current=!0,F.current=!1,_(null),ke.send(e.id,{type:"terminate_session"}),ke.close(e.id)),p.current=y,ye.current=k,Ee.current=L,x.current=W,H.current=X;const Re=setTimeout(()=>{if(n)return;const N={};t&&(N.model=t),r!=="default"&&(N.effort=r),o&&(N.permissionMode=o),i&&(N.adapter=i),d&&(N.account=d),c=ke.connect(e.id,{onOpen(){if(O.current=!1,F.current=!1,_(u=>{const A=(u==null?void 0:u.kind)==="session"?u:null;return g(e.id,{errorState:A}),A}),e.status==="running")for(const u of[500,1500,3e3]){const A=setTimeout(()=>{n||U({updateReadiness:!1})},u);l.push(A)}},onMessage(u){if(n)return;const A=Et(B.current,u);if(A!==B.current&&(B.current=A,f(A),g(e.id,{interactionRequest:A}),A!=null&&(_(null),g(e.id,{errorState:null}))),u.type==="interaction_response"){Me();return}if(u.type==="error"){const S=Rt(u);if(S!=null){F.current=!0;const M={kind:"session",message:S.message,code:S.code};_(M),g(e.id,{errorState:M})}return}if(u.type==="session_updated"){const S=u.session;gt(S)?Pe(S.id):Ie(S.status)&&q(Te),Hr(e,S)&&U({updateReadiness:!1}),Ze(I,S);return}if(u.type==="session_queue_updated"){se(u.queue,e.id);return}if(u.type==="adapter_event"){const S=kt(D.current,u);S!==D.current&&Ce(S,e.id)}if(u.type==="message"){const S=At(u);(S==null?void 0:S.role)==="assistant"&&q(Te),de(M=>Tt(M,u));return}if(u.type==="session_creation_progress"){R(S=>{const M=dt(S,u);return g(e.id,{creationProgress:M}),M});return}if(u.type==="workspace_changes"){re(S=>{const M=Ot(S,u.changes);return g(e.id,{sessionWorkspaceChanges:M}),M});return}if(u.type==="session_info"){u.info!=null&&u.info.type==="summary"?I("/api/sessions"):(Z(u.info??null),g(e.id,{sessionInfo:u.info??null}),T.current&&setTimeout(()=>{n||T.current&&(K(!0),T.current=!1)},100));return}const ge=Ct(u);if(ge!=null){q(S=>bt(S,ge));return}if(u.type==="tool_result"){We(S=>_t(S,u));return}u.type==="interaction_request"&&(B.current=u,f(u),g(e.id,{interactionRequest:u}))},onError(){if(n)return;const u={kind:"connection",message:b("chat.connectionError"),reason:"error"};_(u),g(e.id,{errorState:u})},onClose(u){if(n)return;if(O.current){O.current=!1;return}const A=u.code===1008&&u.reason==="Login required",ge=!F.current&&u.code!==1e3&&u.code!==1008;_(S=>{const M=S??{...A?{code:"auth_required"}:{},kind:"connection",message:A?b("chat.connectionAuthRequired"):u.reason||b("chat.connectionClosed"),recoverable:ge,reason:"closed"};return g(e.id,{errorState:M}),M})},shouldReconnect(u){return O.current||F.current?!1:u.code!==1e3&&u.code!==1008}},Object.keys(N).length>0?N:void 0)},me?200:100);return()=>{n=!0,clearTimeout(Re);for(const N of l)clearTimeout(N);c==null||c()}},[i,d,se,Ce,ee,r,t,I,C,o,Me,De,U,e==null?void 0:e.id,e==null?void 0:e.status,f,b,Pe,q,g]),{messages:_e,creationProgress:Oe,setMessages:We,sessionInfo:ue,sessionOperationInfo:$e,sessionCompactionInfo:h,sessionCompactionEvents:pe,sessionWorkspaceChanges:le,queuedMessages:Be,isReady:Se,errorState:he,retryConnection:s,reconcileAfterInteraction:Me}}const Ur=e=>{if(!(e==null||e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING)){if(e.readyState===WebSocket.CONNECTING){e.addEventListener("open",()=>e.close(),{once:!0});return}e.close()}},Ye=new Set,Ir=3e4,zr=(e,t)=>{if(e!=null&&t)return e.createWorktree?{createWorktree:!0,worktreeEnvironment:e.worktreeEnvironment,branch:e.branch}:{createWorktree:!1}};function Xr({canonicalSessionId:e,session:t,modelForQuery:r,hasAvailableModels:o,effort:i,permissionMode:d,adapter:C,account:f,workspaceSourceSessionId:b,navigateOnCreate:I=!0,collapseSenderHeaderOnCreate:_e=!0,onSessionCreated:j,sessionTargetDraft:Oe,sessionCreationContext:R,workspaceDraft:ue,workspaceDraftDirty:Z,workspaceConfigReady:$e,onClearMessages:te}){const{message:h}=Ht.useApp(),{t:m}=pt(),pe=Lt(),G=Wt(),{mutate:le}=St(),{setHeaderCollapsed:re}=qt(),Be=Zt(xe),z=xt(xe),[Se,K]=a.useState(!1),[he,_]=a.useState(),[De,we]=a.useState([]),T=Se||(t==null?void 0:t.status)==="running",p=Nt(t,Be),ye=he!=null&&he===(t==null?void 0:t.id),Ee=(ue==null?void 0:ue.createWorktree)===!0||Z!==!0&&$e!==!0,x=a.useCallback((s,n,c={})=>{const l=new URLSearchParams(G.search);if(n!=null)for(const[y,E]of Object.entries(n))E===""?l.delete(y):l.set(y,E);pe({pathname:s,search:l.toString()===""?"":`?${l.toString()}`},{replace:c.replace})},[G.search,pe]);a.useCallback((s,n={})=>{x(s,void 0,n)},[x]);const H=a.useCallback(async s=>{await le("/api/sessions",n=>{if(!(n!=null&&n.sessions))return{sessions:[s]};const c=n.sessions.filter(l=>l.id!==s.id);return{...n,sessions:[s,...c]}},!1)},[le]),$=a.useCallback(async s=>{await le("/api/sessions",n=>(n==null?void 0:n.sessions)==null?n:{...n,sessions:ve(n.sessions,s)},!1),await le("/api/sessions/archived",n=>(n==null?void 0:n.sessions)==null?n:{...n,sessions:ve(n.sessions,s)},!1)},[le]),O=a.useCallback(s=>{z(n=>{if(n[s]==null)return n;const c={...n};return delete c[s],c})},[z]),F=a.useCallback((s,n)=>{z(c=>{const l=c[s];return l==null?c:{...c,[s]:n(l)}})},[z]),B=a.useCallback(async s=>{try{return(await mt(s)).session}catch(n){console.warn("Failed to verify optimistic session creation state:",n);return}},[]),D=a.useCallback(async s=>{if(et(s.id)){O(s.id),await $(s.id);try{await Ut(s.id,{force:!0})}catch(n){console.warn("Failed to delete discarded optimistic session:",n)}finally{He(s.id)}return!1}return await H(s),O(s.id),He(s.id),_e&&re(!0),!0},[_e,H,O,$,re]),w=a.useCallback(s=>{const n=It(Oe),c=zr(ue,Z===!0);return{id:s,...n,effort:i==="default"?void 0:i,permissionMode:d,parentSessionId:b,adapter:C,account:f,tags:R==null?void 0:R.tags,workspace:b==null?c:{...c,sourceSessionId:b,createWorktree:!1}}},[f,C,i,d,R==null?void 0:R.tags,Oe,b,ue,Z]),ne=a.useCallback(s=>{let n,c=!1,l;const y=k=>{c||(c=!0,l!=null&&clearTimeout(l),k())};return{ready:new Promise(k=>{l=setTimeout(()=>y(k),750),n=ft({onOpen:()=>y(k),onError:()=>y(k),onMessage:ie=>{ie.type!=="session_creation_progress"||ie.sessionId!==s||we(L=>[...L,ie.progress])}},{subscribe:"sessions"})}),close:()=>Ur(n)}},[]),v=a.useCallback(async s=>{const n=new AbortController,c=setTimeout(()=>{n.abort()},Ir);try{return await zt(s.title,s.initialMessage,s.initialContent,s.model,s.options,{signal:n.signal})}finally{clearTimeout(c)}},[]),Q=a.useCallback(async s=>{if(Ye.has(s.id))return!1;Ye.add(s.id);let n;we([]);try{n=Ee?ne(s.id):void 0,await(n==null?void 0:n.ready);const{session:c}=await v(s);return await D(c)}catch(c){console.error(c);const l=await B(s.id);if(l!=null)return await D(l);if(et(s.id))return O(s.id),await $(s.id),He(s.id),!1;const y=J(c,m("chat.sessionCreateFailedMessage"));return F(s.id,E=>$t(E,y)),!1}finally{Ye.delete(s.id),n==null||n.close()}},[v,D,ne,O,$,B,Ee,m,F]),Y=a.useCallback(s=>{const n=Bt(s);He(n.session.id),K(!0),z(c=>({...c,[n.session.id]:n})),er(n.session.id,n.message),H(n.session),j==null||j(n.session),Q(s),I&&x(`/session/${n.session.id}`,{senderHeader:"collapsed"})},[H,I,x,j,Q,z]);a.useEffect(()=>{(p==null?void 0:p.status)==="creating"&&Q(p.request)},[p==null?void 0:p.request,p==null?void 0:p.status,Q]);const oe=a.useCallback(async()=>p==null?!1:(F(p.session.id,Dt),H({...p.session,status:"running"}),await Q(p.request)),[H,p,Q,F]);a.useEffect(()=>{!Se||(t==null?void 0:t.id)==null||t.id===""||K(!1)},[Se,t==null?void 0:t.id]);const ce=a.useCallback(async(s,n)=>{if(s.trim()===""||T)return!1;if(!o)return h.warning(m("chat.modelConfigRequired")),!1;if(p!=null)return h.warning(m("chat.retrySessionCreationRequired")),!1;if(!(t!=null&&t.id)){const c=tt();return Y({id:c,title:R==null?void 0:R.title,initialMessage:s.trim(),model:r,options:w(c)}),!0}try{return await rt(t.id,s.trim(),{permissionMode:d}),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[w,o,T,h,r,p,d,R==null?void 0:R.title,t==null?void 0:t.id,Y,m]),g=a.useCallback(async(s,n)=>{if(s.length===0||T)return!1;if(!o)return h.warning(m("chat.modelConfigRequired")),!1;if(p!=null)return h.warning(m("chat.retrySessionCreationRequired")),!1;if(!(t!=null&&t.id)){const c=tt();return Y({id:c,title:R==null?void 0:R.title,initialContent:s,model:r,options:w(c)}),!0}try{return await rt(t.id,s,{permissionMode:d}),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[w,o,T,h,r,p,d,R==null?void 0:R.title,t==null?void 0:t.id,Y,m]),Pe=a.useCallback(async()=>{if(!(t!=null&&t.id)||T===!1||he===t.id)return;const s=t.id,n=`chat-session-stop-${s}`,c=(p==null?void 0:p.status)==="creating";_(s),h.open({type:"loading",content:m("chat.sessionStoppingMessage"),duration:0,key:n});try{await Vt(s),h.success({content:m("chat.sessionStopRequestedMessage"),duration:1.6,key:n}),c&&(jt(s),O(s),await $(s),K(!1))}catch(l){console.error(l),h.error({content:J(l,m("chat.sessionStopFailedMessage")),duration:3,key:n})}finally{_(l=>l===s?void 0:l)}},[T,h,p==null?void 0:p.status,O,$,t==null?void 0:t.id,m,he]),Le=a.useCallback(()=>{te(),h.success("Messages cleared")},[h,te]),q=a.useCallback(async(s,n,c)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{session:l}=await Gt(t.id,s,n,c);await H(l);const y=e??t.id;return pe({pathname:`/session/${y}`,search:lr({currentSearch:G.search,rootSessionId:y,targetSessionId:l.id})},{replace:n==="edit"}),!0}catch(l){return console.error(l),h.error(J(l,m("common.operationFailed"))),!1}},[e,H,G.search,h,pe,t==null?void 0:t.id,m]),We=a.useCallback(s=>q(s,"fork"),[q]),de=a.useCallback(s=>q(s,"recall"),[q]),se=a.useCallback((s,n)=>q(s,"edit",{content:n}),[q]),Ce=a.useCallback(async(s,n)=>{if((t==null?void 0:t.id)==null||t.id===""||n.length===0)return!1;try{const{queuedMessages:c}=await Kt(t.id,s,n);return Ae(t.id,c),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,m]),ee=a.useCallback(async(s,n)=>{if((t==null?void 0:t.id)==null||t.id===""||n.length===0)return!1;try{const{queuedMessages:c}=await Qt(t.id,s,n);return Ae(t.id,c),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,m]),ae=a.useCallback(async s=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:n}=await Yt(t.id,s);return Ae(t.id,n),!0}catch(n){return console.error(n),h.error(J(n,m("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,m]),U=a.useCallback(async(s,n)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:c}=await Xt(t.id,s,n);return Ae(t.id,c),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,m]),Me=a.useCallback(async(s,n)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:c}=await Jt(t.id,s,n);return Ae(t.id,c),!0}catch(c){return console.error(c),h.error(J(c,m("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,m]);return{creationProgress:De,isCreating:Se,isStopping:ye,isThinking:T,send:ce,sendContent:g,retrySessionCreation:oe,enqueueContent:Ce,updateQueuedContent:ee,removeQueuedContent:ae,moveQueuedContent:U,reorderQueuedContent:Me,editMessage:se,forkMessage:We,interrupt:Pe,clearMessages:Le,recallMessage:de}}export{it as M,Qr as a,Kr as b,ke as c,lr as d,Gr as e,Yr as f,ar as i,ur as r,Xr as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,s as Ie,R as Le}from"./vendor-react-CnooHTJc.js";const w=t=>typeof t=="string",ye=()=>{let t,e;const n=new Promise((s,i)=>{t=s,e=i});return n.resolve=t,n.reject=e,n},Ct=t=>t==null?"":""+t,Ln=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},Cn=/###/g,Et=t=>t&&t.indexOf("###")>-1?t.replace(Cn,"."):t,_t=t=>!t||w(t),Oe=(t,e,n)=>{const s=w(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(_t(t))return{};const r=Et(s[i]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++i}return _t(t)?{}:{obj:t,k:Et(s[i])}},Nt=(t,e,n)=>{const{obj:s,k:i}=Oe(t,e,Object);if(s!==void 0||e.length===1){s[i]=n;return}let r=e[e.length-1],o=e.slice(0,e.length-1),a=Oe(t,o,Object);for(;a.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),a=Oe(t,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${r}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=n},En=(t,e,n,s)=>{const{obj:i,k:r}=Oe(t,e,Object);i[r]=i[r]||[],i[r].push(n)},Ae=(t,e)=>{const{obj:n,k:s}=Oe(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},_n=(t,e,n)=>{const s=Ae(t,n);return s!==void 0?s:Ae(e,n)},Yt=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?w(t[s])||t[s]instanceof String||w(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):Yt(t[s],e[s],n):t[s]=e[s]);return t},pe=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Pn=t=>w(t)?t.replace(/[&<>"'\/]/g,e=>Nn[e]):t;class In{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const An=[" ",",","?","!",";"],Dn=new In(20),Tn=(t,e,n)=>{e=e||"",n=n||"";const s=An.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(s.length===0)return!0;const i=Dn.getRegExp(`(${s.map(o=>o==="?"?"\\?":o).join("|")})`);let r=!i.test(t);if(!r){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(r=!0)}return r},et=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let i=t;for(let r=0;r<s.length;){if(!i||typeof i!="object")return;let o,a="";for(let l=r;l<s.length;++l)if(l!==r&&(a+=n),a+=s[l],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<s.length-1)continue;r+=l-r+1;break}i=o}return i},we=t=>t==null?void 0:t.replace("_","-"),kn={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,s;(s=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||s.call(n,console,e)}};class De{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||kn,this.options=n,this.debug=n.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,n,s,i){return i&&!this.debug?null:(w(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new De(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new De(this.logger,e)}}var ne=new De;class Ve{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(n)||0;this.observers[s].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i.apply(i,[e,...n])})}}class Pt extends Ve{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,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 n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,i={}){var c,f;const r=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,n],s&&(Array.isArray(s)?a.push(...s):w(s)&&r?a.push(...s.split(r)):a.push(s)));const l=Ae(this.data,a);return!l&&!n&&!s&&e.indexOf(".")>-1&&(e=a[0],n=a[1],s=a.slice(2).join(".")),l||!o||!w(s)?l:et((f=(c=this.data)==null?void 0:c[e])==null?void 0:f[n],s,r)}addResource(e,n,s,i,r={silent:!1}){const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let a=[e,n];s&&(a=a.concat(o?s.split(o):s)),e.indexOf(".")>-1&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),Nt(this.data,a,i),r.silent||this.emit("added",e,n,s,i)}addResources(e,n,s,i={silent:!1}){for(const r in s)(w(s[r])||Array.isArray(s[r]))&&this.addResource(e,n,r,s[r],{silent:!0});i.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,i,r,o={silent:!1,skipCopy:!1}){let a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),i=s,s=n,n=a[1]),this.addNamespaces(n);let l=Ae(this.data,a)||{};o.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?Yt(l,s,r):l={...l,...s},Nt(this.data,a,l),o.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Qt={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,i){return t.forEach(r=>{var o;e=((o=this.processors[r])==null?void 0:o.process(e,n,s,i))??e}),e}};const Xt=Symbol("i18next/PATH_KEY");function $n(){const t=[],e=Object.create(null);let n;return e.get=(s,i)=>{var r;return(r=n==null?void 0:n.revoke)==null||r.call(n),i===Xt?t:(t.push(i),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function tt(t,e){const{[Xt]:n}=t($n());return n.join((e==null?void 0:e.keySeparator)??".")}const It={},Ke=t=>!w(t)&&typeof t!="boolean"&&typeof t!="number";class Te extends Ve{constructor(e,n={}){super(),Ln(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ne.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const i=this.resolve(e,s);if((i==null?void 0:i.res)===void 0)return!1;const r=Ke(i.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const o=s&&e.indexOf(s)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Tn(e,s,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:w(r)?[r]:r};const c=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(c[0])>-1)&&(r=c.shift()),e=c.join(i)}return{key:e,namespaces:w(r)?[r]:r}}translate(e,n,s){let i=typeof n=="object"?{...n}:n;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),e==null)return"";typeof e=="function"&&(e=tt(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]);const r=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],i),c=l[l.length-1];let f=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const u=i.lng||this.language,g=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode")return g?r?{res:`${c}${f}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${f}${a}`:r?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;const d=this.resolve(e,i);let h=d==null?void 0:d.res;const S=(d==null?void 0:d.usedKey)||a,L=(d==null?void 0:d.exactUsedKey)||a,O=["[object Number]","[object Function]","[object RegExp]"],p=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,_=!this.i18nFormat||this.i18nFormat.handleAsObject,N=i.count!==void 0&&!w(i.count),b=Te.hasDefaultValue(i),D=N?this.pluralResolver.getSuffix(u,i.count,i):"",k=i.ordinal&&N?this.pluralResolver.getSuffix(u,i.count,{ordinal:!1}):"",P=N&&!i.ordinal&&i.count===0,m=P&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${D}`]||i[`defaultValue${k}`]||i.defaultValue;let x=h;_&&!h&&b&&(x=m);const A=Ke(x),C=Object.prototype.toString.apply(x);if(_&&x&&A&&O.indexOf(C)<0&&!(w(p)&&Array.isArray(x))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(S,x,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=R,d.usedParams=this.getUsedParamsDetails(i),d):R}if(o){const R=Array.isArray(x),y=R?[]:{},I=R?L:S;for(const $ in x)if(Object.prototype.hasOwnProperty.call(x,$)){const T=`${I}${o}${$}`;b&&!h?y[$]=this.translate(T,{...i,defaultValue:Ke(m)?m[$]:void 0,joinArrays:!1,ns:l}):y[$]=this.translate(T,{...i,joinArrays:!1,ns:l}),y[$]===T&&(y[$]=x[$])}h=y}}else if(_&&w(p)&&Array.isArray(h))h=h.join(p),h&&(h=this.extendTranslation(h,e,i,s));else{let R=!1,y=!1;!this.isValidLookup(h)&&b&&(R=!0,h=m),this.isValidLookup(h)||(y=!0,h=a);const $=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&y?void 0:h,T=b&&m!==h&&this.options.updateMissing;if(y||R||T){if(this.logger.log(T?"updateKey":"missingKey",u,c,a,T?m:h),o){const K=this.resolve(a,{...i,keySeparator:!1});K&&K.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 W=[];const J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(let K=0;K<J.length;K++)W.push(J[K]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(i.lng||this.language):W.push(i.lng||this.language);const ce=(K,j,G)=>{var ue;const ee=b&&G!==h?G:$;this.options.missingKeyHandler?this.options.missingKeyHandler(K,c,j,ee,T,i):(ue=this.backendConnector)!=null&&ue.saveMissing&&this.backendConnector.saveMissing(K,c,j,ee,T,i),this.emit("missingKey",K,c,j,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?W.forEach(K=>{const j=this.pluralResolver.getSuffixes(K,i);P&&i[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(G=>{ce([K],a+G,i[`defaultValue${G}`]||m)})}):ce(W,a,m))}h=this.extendTranslation(h,e,i,d,s),y&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${c}${f}${a}`),(y||R)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${f}${a}`:a,R?h:void 0,i))}return r?(d.res=h,d.usedParams=this.getUsedParamsDetails(i),d):h}extendTranslation(e,n,s,i,r){var l,c;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const f=w(e)&&(((c=s==null?void 0:s.interpolation)==null?void 0:c.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(f){const d=e.match(this.interpolator.nestingRegexp);u=d&&d.length}let g=s.replace&&!w(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),e=this.interpolator.interpolate(e,g,s.lng||this.language||i.usedLng,s),f){const d=e.match(this.interpolator.nestingRegexp),h=d&&d.length;u<h&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>(r==null?void 0:r[0])===d[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${n[0]}`),null):this.translate(...d,n),s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,a=w(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&s.applyPostProcessor!==!1&&(e=Qt.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,i,r,o,a;return w(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const c=this.extractFromKey(l,n),f=c.key;i=f;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const g=n.count!==void 0&&!w(n.count),d=g&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(w(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(L=>{var O,p;this.isValidLookup(s)||(a=L,!It[`${S[0]}-${L}`]&&((O=this.utils)!=null&&O.hasLoadedNamespace)&&!((p=this.utils)!=null&&p.hasLoadedNamespace(a))&&(It[`${S[0]}-${L}`]=!0,this.logger.warn(`key "${i}" for languages "${S.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),S.forEach(_=>{var D;if(this.isValidLookup(s))return;o=_;const N=[f];if((D=this.i18nFormat)!=null&&D.addLookupKeys)this.i18nFormat.addLookupKeys(N,f,_,L,n);else{let k;g&&(k=this.pluralResolver.getSuffix(_,n.count,n));const P=`${this.options.pluralSeparator}zero`,m=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(n.ordinal&&k.indexOf(m)===0&&N.push(f+k.replace(m,this.options.pluralSeparator)),N.push(f+k),d&&N.push(f+P)),h){const x=`${f}${this.options.contextSeparator||"_"}${n.context}`;N.push(x),g&&(n.ordinal&&k.indexOf(m)===0&&N.push(x+k.replace(m,this.options.pluralSeparator)),N.push(x+k),d&&N.push(x+P))}}let b;for(;b=N.pop();)this.isValidLookup(s)||(r=b,s=this.getResource(_,L,b,n))}))})}),{res:s,usedKey:i,exactUsedKey:r,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,i={}){var r;return(r=this.i18nFormat)!=null&&r.getResource?this.i18nFormat.getResource(e,n,s,i):this.resourceStore.getResource(e,n,s,i)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!w(e.replace);let i=s?e.replace:e;if(s&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const r of n)delete i[r]}return i}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n===s.substring(0,n.length)&&e[s]!==void 0)return!0;return!1}}class At{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ne.create("languageUtils")}getScriptPartFromCode(e){if(e=we(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=we(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(w(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(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 n;return e.forEach(s=>{if(n)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return n=i;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(o=>{if(o===r)return o;if(!(o.indexOf("-")<0&&r.indexOf("-")<0)&&(o.indexOf("-")>0&&r.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===r||o.indexOf(r)===0&&r.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),w(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],r=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return w(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):w(e)&&r(this.formatLanguageCode(e)),s.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}const Dt={zero:0,one:1,two:2,few:3,many:4,other:5},Tt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Fn{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=ne.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=we(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let o;try{o=new Intl.PluralRules(s,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Tt;if(!e.match(/-|_/))return Tt;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,n)}return this.pluralRulesCache[r]=o,o}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(i=>`${n}${i}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((i,r)=>Dt[i]-Dt[r]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n,s={}){const i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const kt=(t,e,n,s=".",i=!0)=>{let r=_n(t,e,n);return!r&&i&&w(n)&&(r=et(t,n,s),r===void 0&&(r=et(e,n,s))),r},He=t=>t.replace(/\$/g,"$$$$");class $t{constructor(e={}){var n;this.logger=ne.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:i,prefix:r,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:g,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:S,nestingOptionsSeparator:L,maxReplaces:O,alwaysFormat:p}=e.interpolation;this.escape=n!==void 0?n:Pn,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?pe(r):o||"{{",this.suffix=a?pe(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=g?pe(g):d||pe("$t("),this.nestingSuffix=h?pe(h):S||pe(")"),this.nestingOptionsSeparator=L||",",this.maxReplaces=O||1e3,this.alwaysFormat=p!==void 0?p:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"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,n,s,i){var d;let r,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const p=kt(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(p,void 0,s,{...i,...n,interpolationkey:h}):p}const S=h.split(this.formatSeparator),L=S.shift().trim(),O=S.join(this.formatSeparator).trim();return this.format(kt(n,l,L,this.options.keySeparator,this.options.ignoreJSONStructure),O,s,{...i,...n,interpolationkey:L})};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,u=((d=i==null?void 0:i.interpolation)==null?void 0:d.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>He(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?He(this.escape(h)):He(h)}].forEach(h=>{for(a=0;r=h.regex.exec(e);){const S=r[1].trim();if(o=c(S),o===void 0)if(typeof f=="function"){const O=f(e,r,i);o=w(O)?O:""}else if(i&&Object.prototype.hasOwnProperty.call(i,S))o="";else if(u){o=r[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),o="";else!w(o)&&!this.useRawValueToEscape&&(o=Ct(o));const L=h.safeValue(o);if(e=e.replace(r[0],L),u?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=r[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n,s={}){let i,r,o;const a=(l,c)=>{const f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;const u=l.split(new RegExp(`${f}[ ]*{`));let g=`{${u[1]}`;l=u[0],g=this.interpolate(g,o);const d=g.match(/'/g),h=g.match(/"/g);(((d==null?void 0:d.length)??0)%2===0&&!h||h.length%2!==0)&&(g=g.replace(/'/g,'"'));try{o=JSON.parse(g),c&&(o={...c,...o})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${f}${g}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];o={...s},o=o.replace&&!w(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(l=i[1].slice(c).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),r=n(a.call(this,i[1].trim(),o),o),r&&i[0]===e&&!w(r))return r;w(r)||(r=Ct(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),r=""),l.length&&(r=l.reduce((f,u)=>this.format(f,u,s.lng,{...s,interpolationkey:i[1].trim()}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}const jn=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),f=a.trim();n[f]||(n[f]=c),c==="false"&&(n[f]=!1),c==="true"&&(n[f]=!0),isNaN(c)||(n[f]=parseInt(c,10))}})}return{formatName:e,formatOptions:n}},Ft=t=>{const e={};return(n,s,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const o=s+JSON.stringify(r);let a=e[o];return a||(a=t(we(s),i),e[o]=a),a(n)}},Vn=t=>(e,n,s)=>t(we(n),s)(e);class Mn{constructor(e={}){this.logger=ne.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?Ft:Vn;this.formats={number:s((i,r)=>{const o=new Intl.NumberFormat(i,{...r});return a=>o.format(a)}),currency:s((i,r)=>{const o=new Intl.NumberFormat(i,{...r,style:"currency"});return a=>o.format(a)}),datetime:s((i,r)=>{const o=new Intl.DateTimeFormat(i,{...r});return a=>o.format(a)}),relativetime:s((i,r)=>{const o=new Intl.RelativeTimeFormat(i,{...r});return a=>o.format(a,r.range||"day")}),list:s((i,r)=>{const o=new Intl.ListFormat(i,{...r});return a=>o.format(a)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Ft(n)}format(e,n,s,i={}){const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(a=>a.indexOf(")")>-1)){const a=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,a)].join(this.formatSeparator)}return r.reduce((a,l)=>{var u;const{formatName:c,formatOptions:f}=jn(l);if(this.formats[c]){let g=a;try{const d=((u=i==null?void 0:i.formatParams)==null?void 0:u[i.interpolationkey])||{},h=d.locale||d.lng||i.locale||i.lng||s;g=this.formats[c](a,h,{...f,...i,...d})}catch(d){this.logger.warn(d)}return g}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}const Bn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Un extends Ve{constructor(e,n,s,i={}){var r,o;super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=ne.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(o=(r=this.backend)==null?void 0:r.init)==null||o.call(r,s,i.backend,i)}queueLoad(e,n,s,i){const r={},o={},a={},l={};return e.forEach(c=>{let f=!0;n.forEach(u=>{const g=`${c}|${u}`;!s.reload&&this.store.hasResourceBundle(c,u)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?o[g]===void 0&&(o[g]=!0):(this.state[g]=1,f=!1,o[g]===void 0&&(o[g]=!0),r[g]===void 0&&(r[g]=!0),l[u]===void 0&&(l[u]=!0)))}),f||(a[c]=!0)}),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,s){const i=e.split("|"),r=i[0],o=i[1];n&&this.emit("failedLoading",r,o,n),!n&&s&&this.store.addResourceBundle(r,o,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const a={};this.queue.forEach(l=>{En(l.loaded,[r],o),Bn(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const f=l.loaded[c];f.length&&f.forEach(u=>{a[c][u]===void 0&&(a[c][u]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,s,i=0,r=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:i,wait:r,callback:o});return}this.readingCalls++;const a=(c,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(c&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,s,i+1,r*2,o)},r);return}o(c,f)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const c=l(e,n);c&&typeof c.then=="function"?c.then(f=>a(null,f)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,n,a)}prepareLoading(e,n,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();w(e)&&(e=this.languageUtils.toResolveHierarchy(e)),w(n)&&(n=[n]);const r=this.queueLoad(e,n,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${r} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${r} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,n,s,i,r,o={},a=()=>{}){var l,c,f,u,g;if((c=(l=this.services)==null?void 0:l.utils)!=null&&c.hasLoadedNamespace&&!((u=(f=this.services)==null?void 0:f.utils)!=null&&u.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${s}" as the namespace "${n}" 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(!(s==null||s==="")){if((g=this.backend)!=null&&g.create){const d={...o,isUpdate:r},h=this.backend.create.bind(this.backend);if(h.length<6)try{let S;h.length===5?S=h(e,n,s,i,d):S=h(e,n,s,i),S&&typeof S.then=="function"?S.then(L=>a(null,L)).catch(a):a(null,S)}catch(S){a(S)}else h(e,n,s,i,a,d)}!e||!e[0]||this.store.addResource(e[0],n,s,i)}}}const We=()=>({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]),w(t[1])&&(e.defaultValue=t[1]),w(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),jt=t=>{var e,n;return w(t.ns)&&(t.ns=[t.ns]),w(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),w(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Ee=()=>{},Kn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class ve extends Ve{constructor(e={},n){if(super(),this.options=jt(e),this.services={},this.logger=ne,this.modules={external:[]},Kn(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(w(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=We();this.options={...s,...this.options,...jt(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?ne.init(i(this.modules.logger),this.options):ne.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Mn;const f=new At(this.options);this.store=new Pt(this.options.resources,this.options);const u=this.services;u.logger=ne,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new Fn(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.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===s.interpolation.format)&&(u.formatter=i(c),u.formatter.init&&u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new $t(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Un(i(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.languageDetector&&(u.languageDetector=i(this.modules.languageDetector),u.languageDetector.init&&u.languageDetector.init(u,this.options.detection,this.options)),this.modules.i18nFormat&&(u.i18nFormat=i(this.modules.i18nFormat),u.i18nFormat.init&&u.i18nFormat.init(this)),this.translator=new Te(this.services,this.options),this.translator.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Ee),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]=(...f)=>this.store[c](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...f)=>(this.store[c](...f),this)});const a=ye(),l=()=>{const c=(f,u)=>{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),a.resolve(u),n(f,u)};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),a}loadResources(e,n=Ee){var r,o;let s=n;const i=w(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const a=[],l=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?l(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>l(f)),(o=(r=this.options.preload)==null?void 0:r.forEach)==null||o.call(r,c=>l(c)),this.services.backendConnector.load(a,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(c)})}else s(null)}reloadResources(e,n,s){const i=ye();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Ee),this.services.backendConnector.reload(e,n,r=>{i.resolve(),s(r)}),i}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"&&Qt.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 n=0;n<this.languages.length;n++){const s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=ye();this.emit("languageChanging",e);const i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},r=(a,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...c)=>this.t(...c)),n&&n(a,(...c)=>this.t(...c))},o=a=>{var f,u;!e&&!a&&this.services.languageDetector&&(a=[]);const l=w(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(w(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),(u=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||u.call(f,c)),this.loadResources(c,g=>{r(g,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),s}getFixedT(e,n,s){const i=(r,o,...a)=>{let l;typeof o!="object"?l=this.options.overloadTranslationOptionHandler([r,o].concat(a)):l={...o},l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||i.keyPrefix);const c=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(r)?f=r.map(u=>(typeof u=="function"&&(u=tt(u,{...this.options,...o})),`${l.keyPrefix}${c}${u}`)):(typeof r=="function"&&(r=tt(r,{...this.options,...o})),f=l.keyPrefix?`${l.keyPrefix}${c}${r}`:r),this.t(f,l)};return w(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=s,i}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){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 s=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(s,e)&&(!i||o(r,e)))}loadNamespaces(e,n){const s=ye();return this.options.ns?(w(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=ye();w(e)&&(e=[e]);const i=this.options.preload||[],r=e.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return r.length?(this.options.preload=i.concat(r),this.loadResources(o=>{s.resolve(),n&&n(o)}),s):(n&&n(),Promise.resolve())}dir(e){var i,r;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["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"],s=((r=this.services)==null?void 0:r.languageUtils)||new At(We());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new ve(e,n);return s.createInstance=ve.createInstance,s}cloneInstance(e={},n=Ee){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},r=new ve(i);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(a=>{r[a]=this[a]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s){const a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((f,u)=>(f[u]={...l[c][u]},f),l[c]),l),{});r.store=new Pt(a,i),r.services.resourceStore=r.store}if(e.interpolation){const l={...We().interpolation,...this.options.interpolation,...e.interpolation},c={...i,interpolation:l};r.services.interpolator=new $t(c)}return r.translator=new Te(r.services,i),r.translator.on("*",(a,...l)=>{r.emit(a,...l)}),r.init(i,n),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Y=ve.createInstance();Y.createInstance;Y.dir;Y.init;Y.loadResources;Y.reloadResources;Y.use;Y.changeLanguage;Y.getFixedT;Y.t;Y.exists;Y.setDefaultNamespace;Y.hasLoadedNamespace;Y.loadNamespaces;Y.loadLanguages;const Hn=(t,e,n,s)=>{var r,o,a,l;const i=[n,{code:e,...s||{}}];if((o=(r=t==null?void 0:t.services)==null?void 0:r.logger)!=null&&o.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);de(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(l=(a=t==null?void 0:t.services)==null?void 0:a.logger)!=null&&l.warn?t.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},Vt={},Zt=(t,e,n,s)=>{de(n)&&Vt[n]||(de(n)&&(Vt[n]=new Date),Hn(t,e,n,s))},en=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},nt=(t,e,n)=>{t.loadNamespaces(e,en(t,n))},Mt=(t,e,n,s)=>{if(de(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return nt(t,n,s);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,en(t,s))},Wn=(t,e,n={})=>!e.languages||!e.languages.length?(Zt(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,t))return!1}}),de=t=>typeof t=="string",zn=t=>typeof t=="object"&&t!==null,Jn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Gn={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},qn=t=>Gn[t],Yn=t=>t.replace(Jn,qn);let st={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Yn,transDefaultProps:void 0};const Qn=(t={})=>{st={...st,...t}},Xn=()=>st;let tn;const Zn=t=>{tn=t},es=()=>tn,Si={type:"3rdParty",init(t){Qn(t.options.react),Zn(t)}},ts=v.createContext();class ns{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ss=(t,e)=>de(e)?e:zn(e)&&de(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,is={t:ss,ready:!1},rs=()=>()=>{},yi=(t,e={})=>{var m,x,A;const{i18n:n}=e,{i18n:s,defaultNS:i}=v.useContext(ts)||{},r=n||s||es();r&&!r.reportNamespaces&&(r.reportNamespaces=new ns),r||Zt(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=v.useMemo(()=>{var C;return{...Xn(),...(C=r==null?void 0:r.options)==null?void 0:C.react,...e}},[r,e]),{useSuspense:a,keyPrefix:l}=o,c=i||((m=r==null?void 0:r.options)==null?void 0:m.defaultNS),f=de(c)?[c]:c||["translation"],u=v.useMemo(()=>f,f);(A=(x=r==null?void 0:r.reportNamespaces)==null?void 0:x.addUsedNamespaces)==null||A.call(x,u);const g=v.useRef(0),d=v.useCallback(C=>{if(!r)return rs;const{bindI18n:R,bindI18nStore:y}=o,I=()=>{g.current+=1,C()};return R&&r.on(R,I),y&&r.store.on(y,I),()=>{R&&R.split(" ").forEach($=>r.off($,I)),y&&y.split(" ").forEach($=>r.store.off($,I))}},[r,o]),h=v.useRef(),S=v.useCallback(()=>{if(!r)return is;const C=!!(r.isInitialized||r.initializedStoreOnce)&&u.every(W=>Wn(W,r,o)),R=e.lng||r.language,y=g.current,I=h.current;if(I&&I.ready===C&&I.lng===R&&I.keyPrefix===l&&I.revision===y)return I;const T={t:r.getFixedT(R,o.nsMode==="fallback"?u:u[0],l),ready:C,lng:R,keyPrefix:l,revision:y};return h.current=T,T},[r,u,l,o,e.lng]),[L,O]=v.useState(0),{t:p,ready:_}=Ie.useSyncExternalStore(d,S,S);v.useEffect(()=>{if(r&&!_&&!a){const C=()=>O(R=>R+1);e.lng?Mt(r,e.lng,u,C):nt(r,u,C)}},[r,e.lng,u,_,a,L]);const N=r||{},b=v.useRef(null),D=v.useRef(),k=C=>{const R=Object.getOwnPropertyDescriptors(C);R.__original&&delete R.__original;const y=Object.create(Object.getPrototypeOf(C),R);if(!Object.prototype.hasOwnProperty.call(y,"__original"))try{Object.defineProperty(y,"__original",{value:C,writable:!1,enumerable:!1,configurable:!1})}catch{}return y},P=v.useMemo(()=>{const C=N,R=C==null?void 0:C.language;let y=C;C&&(b.current&&b.current.__original===C?D.current!==R?(y=k(C),b.current=y,D.current=R):y=b.current:(y=k(C),b.current=y,D.current=R));const I=[p,y,_];return I.t=p,I.i18n=y,I.ready=_,I},[p,N,_,N.resolvedLanguage,N.language,N.languages]);if(r&&a&&!_)throw new Promise(C=>{const R=()=>C();e.lng?Mt(r,e.lng,u,R):nt(r,u,R)});return P},nn=0,sn=1,rn=2,Bt=3;var Ut=Object.prototype.hasOwnProperty;function it(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&it(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(Ut.call(t,n)&&++s&&!Ut.call(e,n)||!(n in e)||!it(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const te=new WeakMap,re=()=>{},U=re(),ke=Object,E=t=>t===U,X=t=>typeof t=="function",ae=(t,e)=>({...t,...e}),on=t=>X(t.then),ze={},_e={},bt="undefined",Ce=typeof window!=bt,rt=typeof document!=bt,os=Ce&&"Deno"in window,as=()=>Ce&&typeof window.requestAnimationFrame!=bt,le=(t,e)=>{const n=te.get(t);return[()=>!E(e)&&t.get(e)||ze,s=>{if(!E(e)){const i=t.get(e);e in _e||(_e[e]=i),n[5](e,ae(i,s),i||ze)}},n[6],()=>!E(e)&&e in _e?_e[e]:!E(e)&&t.get(e)||ze]};let ot=!0;const ls=()=>ot,[at,lt]=Ce&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[re,re],cs=()=>{const t=rt&&document.visibilityState;return E(t)||t!=="hidden"},us=t=>(rt&&document.addEventListener("visibilitychange",t),at("focus",t),()=>{rt&&document.removeEventListener("visibilitychange",t),lt("focus",t)}),fs=t=>{const e=()=>{ot=!0,t()},n=()=>{ot=!1};return at("online",e),at("offline",n),()=>{lt("online",e),lt("offline",n)}},ds={isOnline:ls,isVisible:cs},hs={initFocus:us,initReconnect:fs},Kt=!Le.useId,me=!Ce||os,gs=t=>as()?window.requestAnimationFrame(t):setTimeout(t,1),xe=me?v.useEffect:v.useLayoutEffect,Je=typeof navigator<"u"&&navigator.connection,Ht=!me&&Je&&(["slow-2g","2g"].includes(Je.effectiveType)||Je.saveData),Ne=new WeakMap,ps=t=>ke.prototype.toString.call(t),Ge=(t,e)=>t===`[object ${e}]`;let ms=0;const ct=t=>{const e=typeof t,n=ps(t),s=Ge(n,"Date"),i=Ge(n,"RegExp"),r=Ge(n,"Object");let o,a;if(ke(t)===t&&!s&&!i){if(o=Ne.get(t),o)return o;if(o=++ms+"~",Ne.set(t,o),Array.isArray(t)){for(o="@",a=0;a<t.length;a++)o+=ct(t[a])+",";Ne.set(t,o)}if(r){o="#";const l=ke.keys(t).sort();for(;!E(a=l.pop());)E(t[a])||(o+=a+":"+ct(t[a])+",");Ne.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Re=t=>{if(X(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?ct(t):"",[t,e]};let Ss=0;const ut=()=>++Ss;async function an(...t){const[e,n,s,i]=t,r=ae({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let o=r.populateCache;const a=r.rollbackOnError;let l=r.optimisticData;const c=g=>typeof a=="function"?a(g):a!==!1,f=r.throwOnError;if(X(n)){const g=n,d=[],h=e.keys();for(const S of h)!/^\$(inf|sub)\$/.test(S)&&g(e.get(S)._k)&&d.push(S);return Promise.all(d.map(u))}return u(n);async function u(g){const[d]=Re(g);if(!d)return;const[h,S]=le(e,d),[L,O,p,_]=te.get(e),N=()=>{const y=L[d];return(X(r.revalidate)?r.revalidate(h().data,g):r.revalidate!==!1)&&(delete p[d],delete _[d],y&&y[0])?y[0](rn).then(()=>h().data):h().data};if(t.length<3)return N();let b=s,D,k=!1;const P=ut();O[d]=[P,0];const m=!E(l),x=h(),A=x.data,C=x._c,R=E(C)?A:C;if(m&&(l=X(l)?l(R,A):l,S({data:l,_c:R})),X(b))try{b=b(R)}catch(y){D=y,k=!0}if(b&&on(b))if(b=await b.catch(y=>{D=y,k=!0}),P!==O[d][0]){if(k)throw D;return b}else k&&m&&c(D)&&(o=!0,S({data:R,_c:U}));if(o&&!k)if(X(o)){const y=o(b,R);S({data:y,error:U,_c:U})}else S({data:b,error:U,_c:U});if(O[d][1]=ut(),Promise.resolve(N()).then(()=>{S({_c:U})}),k){if(f)throw D;return}return b}}const Wt=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},ln=(t,e)=>{if(!te.has(t)){const n=ae(hs,e),s=Object.create(null),i=an.bind(U,t);let r=re;const o=Object.create(null),a=(f,u)=>{const g=o[f]||[];return o[f]=g,g.push(u),()=>g.splice(g.indexOf(u),1)},l=(f,u,g)=>{t.set(f,u);const d=o[f];if(d)for(const h of d)h(u,g)},c=()=>{if(!te.has(t)&&(te.set(t,[s,Object.create(null),Object.create(null),Object.create(null),i,l,a]),!me)){const f=n.initFocus(setTimeout.bind(U,Wt.bind(U,s,nn))),u=n.initReconnect(setTimeout.bind(U,Wt.bind(U,s,sn)));r=()=>{f&&f(),u&&u(),te.delete(t)}}};return c(),[t,i,c,r]}return[t,te.get(t)[4]]},ys=(t,e,n,s,i)=>{const r=n.errorRetryCount,o=i.retryCount,a=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!E(r)&&o>r||setTimeout(s,a,i)},bs=it,[Me,Os]=ln(new Map),cn=ae({onLoadingSlow:re,onSuccess:re,onError:re,onErrorRetry:ys,onDiscarded:re,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ht?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ht?5e3:3e3,compare:bs,isPaused:()=>!1,cache:Me,mutate:Os,fallback:{}},ds),un=(t,e)=>{const n=ae(t,e);if(e){const{use:s,fallback:i}=t,{use:r,fallback:o}=e;s&&r&&(n.use=s.concat(r)),i&&o&&(n.fallback=ae(i,o))}return n},ft=v.createContext({}),vs=t=>{const{value:e}=t,n=v.useContext(ft),s=X(e),i=v.useMemo(()=>s?e(n):e,[s,n,e]),r=v.useMemo(()=>s?i:un(n,i),[s,n,i]),o=i&&i.provider,a=v.useRef(U);o&&!a.current&&(a.current=ln(o(r.cache||Me),i));const l=a.current;return l&&(r.cache=l[0],r.mutate=l[1]),xe(()=>{if(l)return l[2]&&l[2](),l[3]},[]),v.createElement(ft.Provider,ae(t,{value:r}))},fn="$inf$",dn=Ce&&window.__SWR_DEVTOOLS_USE__,xs=dn?window.__SWR_DEVTOOLS_USE__:[],ws=()=>{dn&&(window.__SWR_DEVTOOLS_REACT__=Le)},hn=t=>X(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Rs=()=>{const t=v.useContext(ft);return v.useMemo(()=>ae(cn,t),[t])},Ls=t=>(e,n,s)=>t(e,n&&((...r)=>{const[o]=Re(e),[,,,a]=te.get(Me);if(o.startsWith(fn))return n(...r);const l=a[o];return E(l)?n(...r):(delete a[o],l)}),s),Cs=xs.concat(Ls),Es=t=>function(...n){const s=Rs(),[i,r,o]=hn(n),a=un(s,o);let l=t;const{use:c}=a,f=(c||[]).concat(Cs);for(let u=f.length;u--;)l=f[u](l);return l(i,r||a.fetcher||null,a)},_s=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const i=s.indexOf(n);i>=0&&(s[i]=s[s.length-1],s.pop())}},Ns=(t,e)=>(...n)=>{const[s,i,r]=hn(n),o=(r.use||[]).concat(e);return t(s,i,{...r,use:o})};ws();const qe=Le.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Ye={dedupe:!0},zt=Promise.resolve(U),Ps=(t,e,n)=>{const{cache:s,compare:i,suspense:r,fallbackData:o,revalidateOnMount:a,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:f,refreshWhenOffline:u,keepPreviousData:g,strictServerPrefetchWarning:d}=n,[h,S,L,O]=te.get(s),[p,_]=Re(t),N=v.useRef(!1),b=v.useRef(!1),D=v.useRef(p),k=v.useRef(e),P=v.useRef(n),m=()=>P.current,x=()=>m().isVisible()&&m().isOnline(),[A,C,R,y]=le(s,p),I=v.useRef({}).current,$=E(o)?E(n.fallback)?U:n.fallback[p]:o,T=(F,V)=>{for(const B in I){const M=B;if(M==="data"){if(!i(F[M],V[M])&&(!E(F[M])||!i(he,V[M])))return!1}else if(V[M]!==F[M])return!1}return!0},W=v.useMemo(()=>{const F=!p||!e?!1:E(a)?m().isPaused()||r?!1:l!==!1:a,V=q=>{const se=ae(q);return delete se._k,F?{isValidating:!0,isLoading:!0,...se}:se},B=A(),M=y(),Z=V(B),ge=B===M?Z:V(M);let H=Z;return[()=>{const q=V(A());return T(q,H)?(H.data=q.data,H.isLoading=q.isLoading,H.isValidating=q.isValidating,H.error=q.error,H):(H=q,q)},()=>ge]},[s,p]),J=Ie.useSyncExternalStore(v.useCallback(F=>R(p,(V,B)=>{T(B,V)||F()}),[s,p]),W[0],W[1]),ce=!N.current,K=h[p]&&h[p].length>0,j=J.data,G=E(j)?$&&on($)?qe($):$:j,ee=J.error,ue=v.useRef(G),he=g?E(j)?E(ue.current)?G:ue.current:j:G,fe=p&&E(G),vn=!me&&Ie.useSyncExternalStore(()=>re,()=>!1,()=>!0);d&&vn&&!r&&fe&&console.warn(`Missing pre-initiated data for serialized key "${p}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Ot=K&&!E(ee)?!1:ce&&!E(a)?a:m().isPaused()?!1:r?E(G)?!1:l:E(G)||l,vt=!!(p&&e&&ce&&Ot),xn=E(J.isValidating)?vt:J.isValidating,wn=E(J.isLoading)?vt:J.isLoading,Se=v.useCallback(async F=>{const V=k.current;if(!p||!V||b.current||m().isPaused())return!1;let B,M,Z=!0;const ge=F||{},H=!L[p]||!ge.dedupe,q=()=>Kt?!b.current&&p===D.current&&N.current:p===D.current,se={isValidating:!1,isLoading:!1},wt=()=>{C(se)},Rt=()=>{const Q=L[p];Q&&Q[1]===M&&delete L[p]},Lt={isValidating:!0};E(A().data)&&(Lt.isLoading=!0);try{if(H&&(C(Lt),n.loadingTimeout&&E(A().data)&&setTimeout(()=>{Z&&q()&&m().onLoadingSlow(p,n)},n.loadingTimeout),L[p]=[V(_),ut()]),[B,M]=L[p],B=await B,H&&setTimeout(Rt,n.dedupingInterval),!L[p]||L[p][1]!==M)return H&&q()&&m().onDiscarded(p),!1;se.error=U;const Q=S[p];if(!E(Q)&&(M<=Q[0]||M<=Q[1]||Q[1]===0))return wt(),H&&q()&&m().onDiscarded(p),!1;const ie=A().data;se.data=i(ie,B)?ie:B,H&&q()&&m().onSuccess(B,p,n)}catch(Q){Rt();const ie=m(),{shouldRetryOnError:Be}=ie;ie.isPaused()||(se.error=Q,H&&q()&&(ie.onError(Q,p,ie),(Be===!0||X(Be)&&Be(Q))&&(!m().revalidateOnFocus||!m().revalidateOnReconnect||x())&&ie.onErrorRetry(Q,p,ie,Rn=>{const Ue=h[p];Ue&&Ue[0]&&Ue[0](Bt,Rn)},{retryCount:(ge.retryCount||0)+1,dedupe:!0})))}return Z=!1,wt(),!0},[p,s]),xt=v.useCallback((...F)=>an(s,D.current,...F),[]);if(xe(()=>{k.current=e,P.current=n,E(j)||(ue.current=j)}),xe(()=>{if(!p)return;const F=Se.bind(U,Ye);let V=0;m().revalidateOnFocus&&(V=Date.now()+m().focusThrottleInterval);const M=_s(p,h,(Z,ge={})=>{if(Z==nn){const H=Date.now();m().revalidateOnFocus&&H>V&&x()&&(V=H+m().focusThrottleInterval,F())}else if(Z==sn)m().revalidateOnReconnect&&x()&&F();else{if(Z==rn)return Se();if(Z==Bt)return Se(ge)}});return b.current=!1,D.current=p,N.current=!0,C({_k:_}),Ot&&(L[p]||(E(G)||me?F():gs(F))),()=>{b.current=!0,M()}},[p]),xe(()=>{let F;function V(){const M=X(c)?c(A().data):c;M&&F!==-1&&(F=setTimeout(B,M))}function B(){!A().error&&(f||m().isVisible())&&(u||m().isOnline())?Se(Ye).then(V):V()}return V(),()=>{F&&(clearTimeout(F),F=-1)}},[c,f,u,p]),v.useDebugValue(he),r){if(!Kt&&me&&fe)throw new Error("Fallback data is required when using Suspense in SSR.");fe&&(k.current=e,P.current=n,b.current=!1);const F=O[p],V=!E(F)&&fe?xt(F):zt;if(qe(V),!E(ee)&&fe)throw ee;const B=fe?Se(Ye):zt;!E(he)&&fe&&(B.status="fulfilled",B.value=!0),qe(B)}return{mutate:xt,get data(){return I.data=!0,he},get error(){return I.error=!0,ee},get isValidating(){return I.isValidating=!0,xn},get isLoading(){return I.isLoading=!0,wn}}},bi=ke.defineProperty(vs,"defaultValue",{value:cn}),Is=Es(Ps),oe={BASE_URL:"/__ONEWORKS_PROJECT_CLIENT_BASE__/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,__ONEWORKS_PROJECT_CLIENT_COMMIT_HASH__:"58ff704dc300bb08c207e357a9ff2d5740d9730a",__ONEWORKS_PROJECT_CLIENT_VERSION__:"0.1.0-beta.0",__ONEWORKS_PROJECT_DEV_GIT_REF__:""};function gn(t){return"init"in t}function dt(t){return!!t.write}function Jt(t){return"v"in t||"e"in t}function $e(t){if("e"in t)throw t.e;if((oe?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}const Fe=new WeakMap;function pn(t){var e;return je(t)&&!!((e=Fe.get(t))!=null&&e[0])}function As(t){const e=Fe.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))}function ht(t,e){let n=Fe.get(t);if(!n){n=[!0,new Set],Fe.set(t,n);const s=()=>{n[0]=!1};t.then(s,s)}n[1].add(e)}function je(t){return typeof(t==null?void 0:t.then)=="function"}function mn(t,e,n){if(!n.p.has(t)){n.p.add(t);const s=()=>n.p.delete(t);e.then(s,s)}}function Sn(t,e,n){var s;const i=new Set;for(const r of((s=n.get(t))==null?void 0:s.t)||[])i.add(r);for(const r of e.p)i.add(r);return i}const Ds=(t,e,...n)=>e.read(...n),Ts=(t,e,...n)=>e.write(...n),ks=(t,e)=>{if(e.INTERNAL_onInit)return e.INTERNAL_onInit(t);if(e.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),e.unstable_onInit(t)},$s=(t,e,n)=>{var s;return(s=e.onMount)==null?void 0:s.call(e,n)},Fs=(t,e)=>{var n;const s=z(t),i=s[0],r=s[6],o=s[9];if((oe?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let a=i.get(e);return a||(a={d:new Map,p:new Set,n:0},i.set(e,a),(n=r.i)==null||n.call(r,e),o==null||o(t,e)),a},js=t=>{const e=z(t),n=e[1],s=e[3],i=e[4],r=e[5],o=e[6],a=e[13],l=[],c=f=>{try{f()}catch(u){l.push(u)}};do{o.f&&c(o.f);const f=new Set,u=f.add.bind(f);s.forEach(g=>{var d;return(d=n.get(g))==null?void 0:d.l.forEach(u)}),s.clear(),r.forEach(u),r.clear(),i.forEach(u),i.clear(),f.forEach(c),s.size&&a(t)}while(s.size||r.size||i.size);if(l.length)throw new AggregateError(l)},Vs=t=>{const e=z(t),n=e[1],s=e[2],i=e[3],r=e[11],o=e[14],a=e[17],l=[],c=new WeakSet,f=new WeakSet,u=Array.from(i);for(;u.length;){const g=u[u.length-1],d=r(t,g);if(f.has(g)){u.pop();continue}if(c.has(g)){if(s.get(g)===d.n)l.push([g,d]);else if((oe?"production":void 0)!=="production"&&s.has(g))throw new Error("[Bug] invalidated atom exists");f.add(g),u.pop();continue}c.add(g);for(const h of Sn(g,d,n))c.has(h)||u.push(h)}for(let g=l.length-1;g>=0;--g){const[d,h]=l[g];let S=!1;for(const L of h.d.keys())if(L!==d&&i.has(L)){S=!0;break}S&&(o(t,d),a(t,d)),s.delete(d)}},gt=new WeakSet,Ms=(t,e)=>{var n,s;const i=z(t),r=i[1],o=i[2],a=i[3],l=i[6],c=i[7],f=i[11],u=i[12],g=i[13],d=i[14],h=i[16],S=i[17],L=i[20],O=f(t,e);if(Jt(O)){if(r.has(e)&&o.get(e)!==O.n)return O;let m=!1;for(const[x,A]of O.d)if(d(t,x).n!==A){m=!0;break}if(!m)return O}O.d.clear();let p=!0;function _(){r.has(e)&&(S(t,e),g(t),u(t))}function N(m){var x;if(m===e){const C=f(t,m);if(!Jt(C))if(gn(m))L(t,m,m.init);else throw new Error("no atom init");return $e(C)}const A=d(t,m);try{return $e(A)}finally{O.d.set(m,A.n),pn(O.v)&&mn(e,O.v,A),r.has(e)&&((x=r.get(m))==null||x.t.add(e)),p||_()}}let b,D;const k={get signal(){return b||(b=new AbortController),b.signal},get setSelf(){return(oe?"production":void 0)!=="production"&&!dt(e)&&console.warn("setSelf function cannot be used with read-only atom"),!D&&dt(e)&&(D=(...m)=>{if((oe?"production":void 0)!=="production"&&p&&console.warn("setSelf function cannot be called in sync"),!p)try{return h(t,e,...m)}finally{g(t),u(t)}}),D}},P=O.n;try{(oe?"production":void 0)!=="production"&>.delete(t);const m=c(t,e,N,k);return(oe?"production":void 0)!=="production"&>.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),L(t,e,m),je(m)&&(ht(m,()=>b==null?void 0:b.abort()),m.then(_,_)),(n=l.r)==null||n.call(l,e),O}catch(m){return delete O.v,O.e=m,++O.n,O}finally{p=!1,P!==O.n&&o.get(e)===P&&(o.set(e,O.n),a.add(e),(s=l.c)==null||s.call(l,e))}},Bs=(t,e)=>{const n=z(t),s=n[1],i=n[2],r=n[11],o=[e];for(;o.length;){const a=o.pop(),l=r(t,a);for(const c of Sn(a,l,s)){const f=r(t,c);i.set(c,f.n),o.push(c)}}},Us=(t,e,...n)=>{const s=z(t),i=s[3],r=s[6],o=s[8],a=s[11],l=s[12],c=s[13],f=s[14],u=s[15],g=s[16],d=s[17],h=s[20];let S=!0;const L=p=>$e(f(t,p)),O=(p,..._)=>{var N;const b=a(t,p);try{if(p===e){if(!gn(p))throw new Error("atom not writable");(oe?"production":void 0)!=="production"&>.add(t);const D=b.n,k=_[0];h(t,p,k),d(t,p),D!==b.n&&(i.add(p),u(t,p),(N=r.c)==null||N.call(r,p));return}else return g(t,p,..._)}finally{S||(c(t),l(t))}};try{return o(t,e,L,O,...n)}finally{S=!1}},Ks=(t,e)=>{var n;const s=z(t),i=s[1],r=s[3],o=s[6],a=s[11],l=s[15],c=s[18],f=s[19],u=a(t,e),g=i.get(e);if(g&&!pn(u.v)){for(const[d,h]of u.d)if(!g.d.has(d)){const S=a(t,d);c(t,d).t.add(e),g.d.add(d),h!==S.n&&(r.add(d),l(t,d),(n=o.c)==null||n.call(o,d))}for(const d of g.d)if(!u.d.has(d)){g.d.delete(d);const h=f(t,d);h==null||h.t.delete(e)}}},Hs=(t,e)=>{var n;const s=z(t),i=s[1],r=s[4],o=s[6],a=s[10],l=s[11],c=s[12],f=s[13],u=s[14],g=s[16],d=s[18],h=l(t,e);let S=i.get(e);if(!S){u(t,e);for(const L of h.d.keys())d(t,L).t.add(e);if(S={l:new Set,d:new Set(h.d.keys()),t:new Set},i.set(e,S),dt(e)){const L=()=>{let O=!0;const p=(..._)=>{try{return g(t,e,..._)}finally{O||(f(t),c(t))}};try{const _=a(t,e,p);_&&(S.u=()=>{O=!0;try{_()}finally{O=!1}})}finally{O=!1}};r.add(L)}(n=o.m)==null||n.call(o,e)}return S},Ws=(t,e)=>{var n,s;const i=z(t),r=i[1],o=i[5],a=i[6],l=i[11],c=i[19],f=l(t,e);let u=r.get(e);if(!u||u.l.size)return u;let g=!1;for(const d of u.t)if((n=r.get(d))!=null&&n.d.has(e)){g=!0;break}if(!g){u.u&&o.add(u.u),u=void 0,r.delete(e);for(const d of f.d.keys()){const h=c(t,d);h==null||h.t.delete(e)}(s=a.u)==null||s.call(a,e);return}return u},zs=(t,e,n)=>{const s=z(t)[11],i=s(t,e),r="v"in i,o=i.v;if(je(n))for(const a of i.d.keys())mn(e,n,s(t,a));i.v=n,delete i.e,(!r||!Object.is(o,i.v))&&(++i.n,je(o)&&As(o))},Js=(t,e)=>{const n=z(t)[14];return $e(n(t,e))},Gs=(t,e,...n)=>{const s=z(t),i=s[12],r=s[13],o=s[16];try{return o(t,e,...n)}finally{r(t),i(t)}},qs=(t,e,n)=>{const s=z(t),i=s[12],r=s[18],o=s[19],l=r(t,e).l;return l.add(n),i(t),()=>{l.delete(n),o(t,e),i(t)}},yn=new WeakMap,z=t=>{const e=yn.get(t);if((oe?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Ys(...t){const e={get(s){const i=z(e)[21];return i(e,s)},set(s,...i){const r=z(e)[22];return r(e,s,...i)},sub(s,i){const r=z(e)[23];return r(e,s,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Ds,Ts,ks,$s,Fs,js,Vs,Ms,Bs,Us,Ks,Hs,Ws,zs,Js,Gs,qs,void 0].map((s,i)=>t[i]||s);return yn.set(e,Object.freeze(n)),e}const bn={};let Qs=0;function Oi(t,e){const n=`atom${++Qs}`,s={toString(){return(bn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?s.read=t:(s.init=t,s.read=Xs,s.write=Zs),e&&(s.write=e),s}function Xs(t){return t(this)}function Zs(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function ei(){return Ys()}let be;function ti(){return be||(be=ei(),(bn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=be),globalThis.__JOTAI_DEFAULT_STORE__!==be&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),be}const ni={},si=v.createContext(void 0);function On(t){return v.useContext(si)||ti()}const pt=t=>typeof(t==null?void 0:t.then)=="function",mt=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},ii=Le.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(mt(t),t)}),Qe=new WeakMap,Gt=(t,e)=>{let n=Qe.get(t);return n||(n=new Promise((s,i)=>{let r=t;const o=c=>f=>{r===c&&s(f)},a=c=>f=>{r===c&&i(f)},l=()=>{try{const c=e();pt(c)?(Qe.set(c,n),r=c,c.then(o(c),a(c)),ht(c,l)):s(c)}catch(c){i(c)}};t.then(o(t),a(t)),ht(t,l)}),Qe.set(t,n)),n};function ri(t,e){const{delay:n,unstable_promiseStatus:s=!Le.use}={},i=On(),[[r,o,a],l]=v.useReducer(f=>{const u=i.get(t);return Object.is(f[0],u)&&f[1]===i&&f[2]===t?f:[u,i,t]},void 0,()=>[i.get(t),i,t]);let c=r;if((o!==i||a!==t)&&(l(),c=i.get(t)),v.useEffect(()=>{const f=i.sub(t,()=>{if(s)try{const u=i.get(t);pt(u)&&mt(Gt(u,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),f},[i,t,n,s]),v.useDebugValue(c),pt(c)){const f=Gt(c,()=>i.get(t));return s&&mt(f),ii(f)}return c}function oi(t,e){const n=On();return v.useCallback((...i)=>{if((ni?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function vi(t,e){return[ri(t),oi(t)]}const ai=()=>{},li=ai(),St=Object,qt=t=>t===li,ci=t=>typeof t=="function",Pe=new WeakMap,ui=t=>St.prototype.toString.call(t),Xe=(t,e)=>t===`[object ${e}]`;let fi=0;const yt=t=>{const e=typeof t,n=ui(t),s=Xe(n,"Date"),i=Xe(n,"RegExp"),r=Xe(n,"Object");let o,a;if(St(t)===t&&!s&&!i){if(o=Pe.get(t),o)return o;if(o=++fi+"~",Pe.set(t,o),Array.isArray(t)){for(o="@",a=0;a<t.length;a++)o+=yt(t[a])+",";Pe.set(t,o)}if(r){o="#";const l=St.keys(t).sort();for(;!qt(a=l.pop());)qt(t[a])||(o+=a+":"+yt(t[a])+",");Pe.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},di=t=>{if(ci(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?yt(t):"",[t,e]},hi=t=>di(t?t(0,null):null)[0],Ze=Promise.resolve(),gi=t=>(e,n,s)=>{const i=v.useRef(!1),{cache:r,initialSize:o=1,revalidateAll:a=!1,persistSize:l=!1,revalidateFirstPage:c=!0,revalidateOnMount:f=!1,parallel:u=!1}=s,[,,,g]=te.get(Me);let d;try{d=hi(e),d&&(d=fn+d)}catch{}const[h,S,L]=le(r,d),O=v.useCallback(()=>E(h()._l)?o:h()._l,[r,d,o]);Ie.useSyncExternalStore(v.useCallback(P=>d?L(d,()=>{P()}):()=>{},[r,d]),O,O);const p=v.useCallback(()=>{const P=h()._l;return E(P)?o:P},[d,o]),_=v.useRef(p());xe(()=>{if(!i.current){i.current=!0;return}d&&S({_l:l?_.current:p()})},[d,r]);const N=f&&!i.current,b=t(d,async P=>{const m=h()._i,x=h()._r;S({_r:U});const A=[],C=p(),[R]=le(r,P),y=R().data,I=[];let $=null;for(let T=0;T<C;++T){const[W,J]=Re(e(T,u?null:$));if(!W)break;const[ce,K]=le(r,W);let j=ce().data;const G=a||m||E(j)||c&&!T&&!E(y)||N||y&&!E(y[T])&&!s.compare(y[T],j);if(n&&(typeof x=="function"?x(j,J):G)){const ee=async()=>{if(!(W in g))j=await n(J);else{const he=g[W];delete g[W],j=await he}K({data:j,_k:J}),A[T]=j};u?I.push(ee):await ee()}else A[T]=j;u||($=j)}return u&&await Promise.all(I.map(T=>T())),S({_i:U}),A},s),D=v.useCallback(function(P,m){const x=typeof m=="boolean"?{revalidate:m}:m||{},A=x.revalidate!==!1;return d?(A&&(E(P)?S({_i:!0,_r:x.revalidate}):S({_i:!1,_r:x.revalidate})),arguments.length?b.mutate(P,{...x,revalidate:A}):b.mutate()):Ze},[d,r]),k=v.useCallback(P=>{if(!d)return Ze;const[,m]=le(r,d);let x;if(X(P)?x=P(p()):typeof P=="number"&&(x=P),typeof x!="number")return Ze;m({_l:x}),_.current=x;const A=[],[C]=le(r,d);let R=null;for(let y=0;y<x;++y){const[I]=Re(e(y,R)),[$]=le(r,I),T=I?$().data:U;if(E(T))return D(C().data);A.push(T),R=T}return D(A)},[d,r,D,p]);return{size:p(),setSize:k,mutate:D,get data(){return b.data},get error(){return b.error},get isValidating(){return b.isValidating},get isLoading(){return b.isLoading}}},xi=Ns(Is,gi);export{bi as S,Oi as a,ri as b,Si as c,oi as d,Is as e,Rs as f,vi as g,xi as h,Y as i,yi as u};
|
|
1
|
+
import{r as v,s as Ie,R as Le}from"./vendor-react-CnooHTJc.js";const w=t=>typeof t=="string",ye=()=>{let t,e;const n=new Promise((s,i)=>{t=s,e=i});return n.resolve=t,n.reject=e,n},Ct=t=>t==null?"":""+t,Ln=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},Cn=/###/g,Et=t=>t&&t.indexOf("###")>-1?t.replace(Cn,"."):t,_t=t=>!t||w(t),Oe=(t,e,n)=>{const s=w(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(_t(t))return{};const r=Et(s[i]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++i}return _t(t)?{}:{obj:t,k:Et(s[i])}},Nt=(t,e,n)=>{const{obj:s,k:i}=Oe(t,e,Object);if(s!==void 0||e.length===1){s[i]=n;return}let r=e[e.length-1],o=e.slice(0,e.length-1),a=Oe(t,o,Object);for(;a.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),a=Oe(t,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${r}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=n},En=(t,e,n,s)=>{const{obj:i,k:r}=Oe(t,e,Object);i[r]=i[r]||[],i[r].push(n)},Ae=(t,e)=>{const{obj:n,k:s}=Oe(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},_n=(t,e,n)=>{const s=Ae(t,n);return s!==void 0?s:Ae(e,n)},Yt=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?w(t[s])||t[s]instanceof String||w(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):Yt(t[s],e[s],n):t[s]=e[s]);return t},pe=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Pn=t=>w(t)?t.replace(/[&<>"'\/]/g,e=>Nn[e]):t;class In{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const An=[" ",",","?","!",";"],Dn=new In(20),Tn=(t,e,n)=>{e=e||"",n=n||"";const s=An.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(s.length===0)return!0;const i=Dn.getRegExp(`(${s.map(o=>o==="?"?"\\?":o).join("|")})`);let r=!i.test(t);if(!r){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(r=!0)}return r},et=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let i=t;for(let r=0;r<s.length;){if(!i||typeof i!="object")return;let o,a="";for(let l=r;l<s.length;++l)if(l!==r&&(a+=n),a+=s[l],o=i[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<s.length-1)continue;r+=l-r+1;break}i=o}return i},we=t=>t==null?void 0:t.replace("_","-"),kn={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,s;(s=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||s.call(n,console,e)}};class De{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||kn,this.options=n,this.debug=n.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,n,s,i){return i&&!this.debug?null:(w(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new De(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new De(this.logger,e)}}var ne=new De;class Ve{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(n)||0;this.observers[s].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i.apply(i,[e,...n])})}}class Pt extends Ve{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,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 n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,i={}){var c,f;const r=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,n],s&&(Array.isArray(s)?a.push(...s):w(s)&&r?a.push(...s.split(r)):a.push(s)));const l=Ae(this.data,a);return!l&&!n&&!s&&e.indexOf(".")>-1&&(e=a[0],n=a[1],s=a.slice(2).join(".")),l||!o||!w(s)?l:et((f=(c=this.data)==null?void 0:c[e])==null?void 0:f[n],s,r)}addResource(e,n,s,i,r={silent:!1}){const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let a=[e,n];s&&(a=a.concat(o?s.split(o):s)),e.indexOf(".")>-1&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),Nt(this.data,a,i),r.silent||this.emit("added",e,n,s,i)}addResources(e,n,s,i={silent:!1}){for(const r in s)(w(s[r])||Array.isArray(s[r]))&&this.addResource(e,n,r,s[r],{silent:!0});i.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,i,r,o={silent:!1,skipCopy:!1}){let a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),i=s,s=n,n=a[1]),this.addNamespaces(n);let l=Ae(this.data,a)||{};o.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?Yt(l,s,r):l={...l,...s},Nt(this.data,a,l),o.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Qt={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,i){return t.forEach(r=>{var o;e=((o=this.processors[r])==null?void 0:o.process(e,n,s,i))??e}),e}};const Xt=Symbol("i18next/PATH_KEY");function $n(){const t=[],e=Object.create(null);let n;return e.get=(s,i)=>{var r;return(r=n==null?void 0:n.revoke)==null||r.call(n),i===Xt?t:(t.push(i),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function tt(t,e){const{[Xt]:n}=t($n());return n.join((e==null?void 0:e.keySeparator)??".")}const It={},Ke=t=>!w(t)&&typeof t!="boolean"&&typeof t!="number";class Te extends Ve{constructor(e,n={}){super(),Ln(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ne.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const i=this.resolve(e,s);if((i==null?void 0:i.res)===void 0)return!1;const r=Ke(i.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const o=s&&e.indexOf(s)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Tn(e,s,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:w(r)?[r]:r};const c=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(c[0])>-1)&&(r=c.shift()),e=c.join(i)}return{key:e,namespaces:w(r)?[r]:r}}translate(e,n,s){let i=typeof n=="object"?{...n}:n;if(typeof i!="object"&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i=="object"&&(i={...i}),i||(i={}),e==null)return"";typeof e=="function"&&(e=tt(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]);const r=i.returnDetails!==void 0?i.returnDetails:this.options.returnDetails,o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],i),c=l[l.length-1];let f=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;f===void 0&&(f=":");const u=i.lng||this.language,g=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((u==null?void 0:u.toLowerCase())==="cimode")return g?r?{res:`${c}${f}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:`${c}${f}${a}`:r?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(i)}:a;const d=this.resolve(e,i);let h=d==null?void 0:d.res;const S=(d==null?void 0:d.usedKey)||a,L=(d==null?void 0:d.exactUsedKey)||a,O=["[object Number]","[object Function]","[object RegExp]"],p=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,_=!this.i18nFormat||this.i18nFormat.handleAsObject,N=i.count!==void 0&&!w(i.count),b=Te.hasDefaultValue(i),D=N?this.pluralResolver.getSuffix(u,i.count,i):"",k=i.ordinal&&N?this.pluralResolver.getSuffix(u,i.count,{ordinal:!1}):"",P=N&&!i.ordinal&&i.count===0,m=P&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${D}`]||i[`defaultValue${k}`]||i.defaultValue;let x=h;_&&!h&&b&&(x=m);const A=Ke(x),C=Object.prototype.toString.apply(x);if(_&&x&&A&&O.indexOf(C)<0&&!(w(p)&&Array.isArray(x))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(S,x,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=R,d.usedParams=this.getUsedParamsDetails(i),d):R}if(o){const R=Array.isArray(x),y=R?[]:{},I=R?L:S;for(const $ in x)if(Object.prototype.hasOwnProperty.call(x,$)){const T=`${I}${o}${$}`;b&&!h?y[$]=this.translate(T,{...i,defaultValue:Ke(m)?m[$]:void 0,joinArrays:!1,ns:l}):y[$]=this.translate(T,{...i,joinArrays:!1,ns:l}),y[$]===T&&(y[$]=x[$])}h=y}}else if(_&&w(p)&&Array.isArray(h))h=h.join(p),h&&(h=this.extendTranslation(h,e,i,s));else{let R=!1,y=!1;!this.isValidLookup(h)&&b&&(R=!0,h=m),this.isValidLookup(h)||(y=!0,h=a);const $=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&y?void 0:h,T=b&&m!==h&&this.options.updateMissing;if(y||R||T){if(this.logger.log(T?"updateKey":"missingKey",u,c,a,T?m:h),o){const K=this.resolve(a,{...i,keySeparator:!1});K&&K.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 W=[];const J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(let K=0;K<J.length;K++)W.push(J[K]);else this.options.saveMissingTo==="all"?W=this.languageUtils.toResolveHierarchy(i.lng||this.language):W.push(i.lng||this.language);const ce=(K,j,G)=>{var ue;const ee=b&&G!==h?G:$;this.options.missingKeyHandler?this.options.missingKeyHandler(K,c,j,ee,T,i):(ue=this.backendConnector)!=null&&ue.saveMissing&&this.backendConnector.saveMissing(K,c,j,ee,T,i),this.emit("missingKey",K,c,j,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&N?W.forEach(K=>{const j=this.pluralResolver.getSuffixes(K,i);P&&i[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(G=>{ce([K],a+G,i[`defaultValue${G}`]||m)})}):ce(W,a,m))}h=this.extendTranslation(h,e,i,d,s),y&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${c}${f}${a}`),(y||R)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${f}${a}`:a,R?h:void 0,i))}return r?(d.res=h,d.usedParams=this.getUsedParamsDetails(i),d):h}extendTranslation(e,n,s,i,r){var l,c;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const f=w(e)&&(((c=s==null?void 0:s.interpolation)==null?void 0:c.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(f){const d=e.match(this.interpolator.nestingRegexp);u=d&&d.length}let g=s.replace&&!w(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),e=this.interpolator.interpolate(e,g,s.lng||this.language||i.usedLng,s),f){const d=e.match(this.interpolator.nestingRegexp),h=d&&d.length;u<h&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>(r==null?void 0:r[0])===d[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${n[0]}`),null):this.translate(...d,n),s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,a=w(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&s.applyPostProcessor!==!1&&(e=Qt.handle(a,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,i,r,o,a;return w(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const c=this.extractFromKey(l,n),f=c.key;i=f;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const g=n.count!==void 0&&!w(n.count),d=g&&!n.ordinal&&n.count===0,h=n.context!==void 0&&(w(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(L=>{var O,p;this.isValidLookup(s)||(a=L,!It[`${S[0]}-${L}`]&&((O=this.utils)!=null&&O.hasLoadedNamespace)&&!((p=this.utils)!=null&&p.hasLoadedNamespace(a))&&(It[`${S[0]}-${L}`]=!0,this.logger.warn(`key "${i}" for languages "${S.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),S.forEach(_=>{var D;if(this.isValidLookup(s))return;o=_;const N=[f];if((D=this.i18nFormat)!=null&&D.addLookupKeys)this.i18nFormat.addLookupKeys(N,f,_,L,n);else{let k;g&&(k=this.pluralResolver.getSuffix(_,n.count,n));const P=`${this.options.pluralSeparator}zero`,m=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(n.ordinal&&k.indexOf(m)===0&&N.push(f+k.replace(m,this.options.pluralSeparator)),N.push(f+k),d&&N.push(f+P)),h){const x=`${f}${this.options.contextSeparator||"_"}${n.context}`;N.push(x),g&&(n.ordinal&&k.indexOf(m)===0&&N.push(x+k.replace(m,this.options.pluralSeparator)),N.push(x+k),d&&N.push(x+P))}}let b;for(;b=N.pop();)this.isValidLookup(s)||(r=b,s=this.getResource(_,L,b,n))}))})}),{res:s,usedKey:i,exactUsedKey:r,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,i={}){var r;return(r=this.i18nFormat)!=null&&r.getResource?this.i18nFormat.getResource(e,n,s,i):this.resourceStore.getResource(e,n,s,i)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!w(e.replace);let i=s?e.replace:e;if(s&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const r of n)delete i[r]}return i}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&n===s.substring(0,n.length)&&e[s]!==void 0)return!0;return!1}}class At{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ne.create("languageUtils")}getScriptPartFromCode(e){if(e=we(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=we(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(w(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(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 n;return e.forEach(s=>{if(n)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return n=i;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(o=>{if(o===r)return o;if(!(o.indexOf("-")<0&&r.indexOf("-")<0)&&(o.indexOf("-")>0&&r.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===r||o.indexOf(r)===0&&r.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),w(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),i=[],r=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return w(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):w(e)&&r(this.formatLanguageCode(e)),s.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}const Dt={zero:0,one:1,two:2,few:3,many:4,other:5},Tt={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Fn{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=ne.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=we(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let o;try{o=new Intl.PluralRules(s,{type:i})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Tt;if(!e.match(/-|_/))return Tt;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,n)}return this.pluralRulesCache[r]=o,o}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(i=>`${n}${i}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((i,r)=>Dt[i]-Dt[r]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,n,s={}){const i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const kt=(t,e,n,s=".",i=!0)=>{let r=_n(t,e,n);return!r&&i&&w(n)&&(r=et(t,n,s),r===void 0&&(r=et(e,n,s))),r},He=t=>t.replace(/\$/g,"$$$$");class $t{constructor(e={}){var n;this.logger=ne.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:i,prefix:r,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:g,nestingPrefixEscaped:d,nestingSuffix:h,nestingSuffixEscaped:S,nestingOptionsSeparator:L,maxReplaces:O,alwaysFormat:p}=e.interpolation;this.escape=n!==void 0?n:Pn,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?pe(r):o||"{{",this.suffix=a?pe(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=g?pe(g):d||pe("$t("),this.nestingSuffix=h?pe(h):S||pe(")"),this.nestingOptionsSeparator=L||",",this.maxReplaces=O||1e3,this.alwaysFormat=p!==void 0?p:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"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,n,s,i){var d;let r,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=h=>{if(h.indexOf(this.formatSeparator)<0){const p=kt(n,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(p,void 0,s,{...i,...n,interpolationkey:h}):p}const S=h.split(this.formatSeparator),L=S.shift().trim(),O=S.join(this.formatSeparator).trim();return this.format(kt(n,l,L,this.options.keySeparator,this.options.ignoreJSONStructure),O,s,{...i,...n,interpolationkey:L})};this.resetRegExp();const f=(i==null?void 0:i.missingInterpolationHandler)||this.options.missingInterpolationHandler,u=((d=i==null?void 0:i.interpolation)==null?void 0:d.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>He(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?He(this.escape(h)):He(h)}].forEach(h=>{for(a=0;r=h.regex.exec(e);){const S=r[1].trim();if(o=c(S),o===void 0)if(typeof f=="function"){const O=f(e,r,i);o=w(O)?O:""}else if(i&&Object.prototype.hasOwnProperty.call(i,S))o="";else if(u){o=r[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),o="";else!w(o)&&!this.useRawValueToEscape&&(o=Ct(o));const L=h.safeValue(o);if(e=e.replace(r[0],L),u?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=r[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n,s={}){let i,r,o;const a=(l,c)=>{const f=this.nestingOptionsSeparator;if(l.indexOf(f)<0)return l;const u=l.split(new RegExp(`${f}[ ]*{`));let g=`{${u[1]}`;l=u[0],g=this.interpolate(g,o);const d=g.match(/'/g),h=g.match(/"/g);(((d==null?void 0:d.length)??0)%2===0&&!h||h.length%2!==0)&&(g=g.replace(/'/g,'"'));try{o=JSON.parse(g),c&&(o={...c,...o})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,S),`${l}${f}${g}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];o={...s},o=o.replace&&!w(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const c=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(c!==-1&&(l=i[1].slice(c).split(this.formatSeparator).map(f=>f.trim()).filter(Boolean),i[1]=i[1].slice(0,c)),r=n(a.call(this,i[1].trim(),o),o),r&&i[0]===e&&!w(r))return r;w(r)||(r=Ct(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),r=""),l.length&&(r=l.reduce((f,u)=>this.format(f,u,s.lng,{...s,interpolationkey:i[1].trim()}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}const jn=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),f=a.trim();n[f]||(n[f]=c),c==="false"&&(n[f]=!1),c==="true"&&(n[f]=!0),isNaN(c)||(n[f]=parseInt(c,10))}})}return{formatName:e,formatOptions:n}},Ft=t=>{const e={};return(n,s,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const o=s+JSON.stringify(r);let a=e[o];return a||(a=t(we(s),i),e[o]=a),a(n)}},Vn=t=>(e,n,s)=>t(we(n),s)(e);class Mn{constructor(e={}){this.logger=ne.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?Ft:Vn;this.formats={number:s((i,r)=>{const o=new Intl.NumberFormat(i,{...r});return a=>o.format(a)}),currency:s((i,r)=>{const o=new Intl.NumberFormat(i,{...r,style:"currency"});return a=>o.format(a)}),datetime:s((i,r)=>{const o=new Intl.DateTimeFormat(i,{...r});return a=>o.format(a)}),relativetime:s((i,r)=>{const o=new Intl.RelativeTimeFormat(i,{...r});return a=>o.format(a,r.range||"day")}),list:s((i,r)=>{const o=new Intl.ListFormat(i,{...r});return a=>o.format(a)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Ft(n)}format(e,n,s,i={}){const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(a=>a.indexOf(")")>-1)){const a=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,a)].join(this.formatSeparator)}return r.reduce((a,l)=>{var u;const{formatName:c,formatOptions:f}=jn(l);if(this.formats[c]){let g=a;try{const d=((u=i==null?void 0:i.formatParams)==null?void 0:u[i.interpolationkey])||{},h=d.locale||d.lng||i.locale||i.lng||s;g=this.formats[c](a,h,{...f,...i,...d})}catch(d){this.logger.warn(d)}return g}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}const Bn=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Un extends Ve{constructor(e,n,s,i={}){var r,o;super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=ne.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],(o=(r=this.backend)==null?void 0:r.init)==null||o.call(r,s,i.backend,i)}queueLoad(e,n,s,i){const r={},o={},a={},l={};return e.forEach(c=>{let f=!0;n.forEach(u=>{const g=`${c}|${u}`;!s.reload&&this.store.hasResourceBundle(c,u)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?o[g]===void 0&&(o[g]=!0):(this.state[g]=1,f=!1,o[g]===void 0&&(o[g]=!0),r[g]===void 0&&(r[g]=!0),l[u]===void 0&&(l[u]=!0)))}),f||(a[c]=!0)}),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,s){const i=e.split("|"),r=i[0],o=i[1];n&&this.emit("failedLoading",r,o,n),!n&&s&&this.store.addResourceBundle(r,o,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const a={};this.queue.forEach(l=>{En(l.loaded,[r],o),Bn(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const f=l.loaded[c];f.length&&f.forEach(u=>{a[c][u]===void 0&&(a[c][u]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,s,i=0,r=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:i,wait:r,callback:o});return}this.readingCalls++;const a=(c,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(c&&f&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,s,i+1,r*2,o)},r);return}o(c,f)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const c=l(e,n);c&&typeof c.then=="function"?c.then(f=>a(null,f)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,n,a)}prepareLoading(e,n,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();w(e)&&(e=this.languageUtils.toResolveHierarchy(e)),w(n)&&(n=[n]);const r=this.queueLoad(e,n,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${r} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${r} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,n,s,i,r,o={},a=()=>{}){var l,c,f,u,g;if((c=(l=this.services)==null?void 0:l.utils)!=null&&c.hasLoadedNamespace&&!((u=(f=this.services)==null?void 0:f.utils)!=null&&u.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${s}" as the namespace "${n}" 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(!(s==null||s==="")){if((g=this.backend)!=null&&g.create){const d={...o,isUpdate:r},h=this.backend.create.bind(this.backend);if(h.length<6)try{let S;h.length===5?S=h(e,n,s,i,d):S=h(e,n,s,i),S&&typeof S.then=="function"?S.then(L=>a(null,L)).catch(a):a(null,S)}catch(S){a(S)}else h(e,n,s,i,a,d)}!e||!e[0]||this.store.addResource(e[0],n,s,i)}}}const We=()=>({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]),w(t[1])&&(e.defaultValue=t[1]),w(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),jt=t=>{var e,n;return w(t.ns)&&(t.ns=[t.ns]),w(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),w(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((n=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:n.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},Ee=()=>{},Kn=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class ve extends Ve{constructor(e={},n){if(super(),this.options=jt(e),this.services={},this.logger=ne,this.modules={external:[]},Kn(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(w(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=We();this.options={...s,...this.options,...jt(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?ne.init(i(this.modules.logger),this.options):ne.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=Mn;const f=new At(this.options);this.store=new Pt(this.options.resources,this.options);const u=this.services;u.logger=ne,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new Fn(f,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.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===s.interpolation.format)&&(u.formatter=i(c),u.formatter.init&&u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new $t(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Un(i(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.languageDetector&&(u.languageDetector=i(this.modules.languageDetector),u.languageDetector.init&&u.languageDetector.init(u,this.options.detection,this.options)),this.modules.i18nFormat&&(u.i18nFormat=i(this.modules.i18nFormat),u.i18nFormat.init&&u.i18nFormat.init(this)),this.translator=new Te(this.services,this.options),this.translator.on("*",(d,...h)=>{this.emit(d,...h)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Ee),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]=(...f)=>this.store[c](...f)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...f)=>(this.store[c](...f),this)});const a=ye(),l=()=>{const c=(f,u)=>{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),a.resolve(u),n(f,u)};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),a}loadResources(e,n=Ee){var r,o;let s=n;const i=w(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((i==null?void 0:i.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const a=[],l=c=>{if(!c||c==="cimode")return;this.services.languageUtils.toResolveHierarchy(c).forEach(u=>{u!=="cimode"&&a.indexOf(u)<0&&a.push(u)})};i?l(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>l(f)),(o=(r=this.options.preload)==null?void 0:r.forEach)==null||o.call(r,c=>l(c)),this.services.backendConnector.load(a,this.options.ns,c=>{!c&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(c)})}else s(null)}reloadResources(e,n,s){const i=ye();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Ee),this.services.backendConnector.reload(e,n,r=>{i.resolve(),s(r)}),i}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"&&Qt.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 n=0;n<this.languages.length;n++){const s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=ye();this.emit("languageChanging",e);const i=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},r=(a,l)=>{l?this.isLanguageChangingTo===e&&(i(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,s.resolve((...c)=>this.t(...c)),n&&n(a,(...c)=>this.t(...c))},o=a=>{var f,u;!e&&!a&&this.services.languageDetector&&(a=[]);const l=w(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(w(a)?[a]:a);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),(u=(f=this.services.languageDetector)==null?void 0:f.cacheUserLanguage)==null||u.call(f,c)),this.loadResources(c,g=>{r(g,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),s}getFixedT(e,n,s){const i=(r,o,...a)=>{let l;typeof o!="object"?l=this.options.overloadTranslationOptionHandler([r,o].concat(a)):l={...o},l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||i.keyPrefix);const c=this.options.keySeparator||".";let f;return l.keyPrefix&&Array.isArray(r)?f=r.map(u=>(typeof u=="function"&&(u=tt(u,{...this.options,...o})),`${l.keyPrefix}${c}${u}`)):(typeof r=="function"&&(r=tt(r,{...this.options,...o})),f=l.keyPrefix?`${l.keyPrefix}${c}${r}`:r),this.t(f,l)};return w(e)?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=s,i}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){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 s=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(s,e)&&(!i||o(r,e)))}loadNamespaces(e,n){const s=ye();return this.options.ns?(w(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=ye();w(e)&&(e=[e]);const i=this.options.preload||[],r=e.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return r.length?(this.options.preload=i.concat(r),this.loadResources(o=>{s.resolve(),n&&n(o)}),s):(n&&n(),Promise.resolve())}dir(e){var i,r;if(e||(e=this.resolvedLanguage||(((i=this.languages)==null?void 0:i.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["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"],s=((r=this.services)==null?void 0:r.languageUtils)||new At(We());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new ve(e,n);return s.createInstance=ve.createInstance,s}cloneInstance(e={},n=Ee){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},r=new ve(i);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(a=>{r[a]=this[a]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s){const a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((f,u)=>(f[u]={...l[c][u]},f),l[c]),l),{});r.store=new Pt(a,i),r.services.resourceStore=r.store}if(e.interpolation){const l={...We().interpolation,...this.options.interpolation,...e.interpolation},c={...i,interpolation:l};r.services.interpolator=new $t(c)}return r.translator=new Te(r.services,i),r.translator.on("*",(a,...l)=>{r.emit(a,...l)}),r.init(i,n),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Y=ve.createInstance();Y.createInstance;Y.dir;Y.init;Y.loadResources;Y.reloadResources;Y.use;Y.changeLanguage;Y.getFixedT;Y.t;Y.exists;Y.setDefaultNamespace;Y.hasLoadedNamespace;Y.loadNamespaces;Y.loadLanguages;const Hn=(t,e,n,s)=>{var r,o,a,l;const i=[n,{code:e,...s||{}}];if((o=(r=t==null?void 0:t.services)==null?void 0:r.logger)!=null&&o.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);de(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(l=(a=t==null?void 0:t.services)==null?void 0:a.logger)!=null&&l.warn?t.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},Vt={},Zt=(t,e,n,s)=>{de(n)&&Vt[n]||(de(n)&&(Vt[n]=new Date),Hn(t,e,n,s))},en=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},nt=(t,e,n)=>{t.loadNamespaces(e,en(t,n))},Mt=(t,e,n,s)=>{if(de(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return nt(t,n,s);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,en(t,s))},Wn=(t,e,n={})=>!e.languages||!e.languages.length?(Zt(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,t))return!1}}),de=t=>typeof t=="string",zn=t=>typeof t=="object"&&t!==null,Jn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Gn={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},qn=t=>Gn[t],Yn=t=>t.replace(Jn,qn);let st={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Yn,transDefaultProps:void 0};const Qn=(t={})=>{st={...st,...t}},Xn=()=>st;let tn;const Zn=t=>{tn=t},es=()=>tn,Si={type:"3rdParty",init(t){Qn(t.options.react),Zn(t)}},ts=v.createContext();class ns{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const ss=(t,e)=>de(e)?e:zn(e)&&de(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,is={t:ss,ready:!1},rs=()=>()=>{},yi=(t,e={})=>{var m,x,A;const{i18n:n}=e,{i18n:s,defaultNS:i}=v.useContext(ts)||{},r=n||s||es();r&&!r.reportNamespaces&&(r.reportNamespaces=new ns),r||Zt(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=v.useMemo(()=>{var C;return{...Xn(),...(C=r==null?void 0:r.options)==null?void 0:C.react,...e}},[r,e]),{useSuspense:a,keyPrefix:l}=o,c=i||((m=r==null?void 0:r.options)==null?void 0:m.defaultNS),f=de(c)?[c]:c||["translation"],u=v.useMemo(()=>f,f);(A=(x=r==null?void 0:r.reportNamespaces)==null?void 0:x.addUsedNamespaces)==null||A.call(x,u);const g=v.useRef(0),d=v.useCallback(C=>{if(!r)return rs;const{bindI18n:R,bindI18nStore:y}=o,I=()=>{g.current+=1,C()};return R&&r.on(R,I),y&&r.store.on(y,I),()=>{R&&R.split(" ").forEach($=>r.off($,I)),y&&y.split(" ").forEach($=>r.store.off($,I))}},[r,o]),h=v.useRef(),S=v.useCallback(()=>{if(!r)return is;const C=!!(r.isInitialized||r.initializedStoreOnce)&&u.every(W=>Wn(W,r,o)),R=e.lng||r.language,y=g.current,I=h.current;if(I&&I.ready===C&&I.lng===R&&I.keyPrefix===l&&I.revision===y)return I;const T={t:r.getFixedT(R,o.nsMode==="fallback"?u:u[0],l),ready:C,lng:R,keyPrefix:l,revision:y};return h.current=T,T},[r,u,l,o,e.lng]),[L,O]=v.useState(0),{t:p,ready:_}=Ie.useSyncExternalStore(d,S,S);v.useEffect(()=>{if(r&&!_&&!a){const C=()=>O(R=>R+1);e.lng?Mt(r,e.lng,u,C):nt(r,u,C)}},[r,e.lng,u,_,a,L]);const N=r||{},b=v.useRef(null),D=v.useRef(),k=C=>{const R=Object.getOwnPropertyDescriptors(C);R.__original&&delete R.__original;const y=Object.create(Object.getPrototypeOf(C),R);if(!Object.prototype.hasOwnProperty.call(y,"__original"))try{Object.defineProperty(y,"__original",{value:C,writable:!1,enumerable:!1,configurable:!1})}catch{}return y},P=v.useMemo(()=>{const C=N,R=C==null?void 0:C.language;let y=C;C&&(b.current&&b.current.__original===C?D.current!==R?(y=k(C),b.current=y,D.current=R):y=b.current:(y=k(C),b.current=y,D.current=R));const I=[p,y,_];return I.t=p,I.i18n=y,I.ready=_,I},[p,N,_,N.resolvedLanguage,N.language,N.languages]);if(r&&a&&!_)throw new Promise(C=>{const R=()=>C();e.lng?Mt(r,e.lng,u,R):nt(r,u,R)});return P},nn=0,sn=1,rn=2,Bt=3;var Ut=Object.prototype.hasOwnProperty;function it(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&it(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(Ut.call(t,n)&&++s&&!Ut.call(e,n)||!(n in e)||!it(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const te=new WeakMap,re=()=>{},U=re(),ke=Object,E=t=>t===U,X=t=>typeof t=="function",ae=(t,e)=>({...t,...e}),on=t=>X(t.then),ze={},_e={},bt="undefined",Ce=typeof window!=bt,rt=typeof document!=bt,os=Ce&&"Deno"in window,as=()=>Ce&&typeof window.requestAnimationFrame!=bt,le=(t,e)=>{const n=te.get(t);return[()=>!E(e)&&t.get(e)||ze,s=>{if(!E(e)){const i=t.get(e);e in _e||(_e[e]=i),n[5](e,ae(i,s),i||ze)}},n[6],()=>!E(e)&&e in _e?_e[e]:!E(e)&&t.get(e)||ze]};let ot=!0;const ls=()=>ot,[at,lt]=Ce&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[re,re],cs=()=>{const t=rt&&document.visibilityState;return E(t)||t!=="hidden"},us=t=>(rt&&document.addEventListener("visibilitychange",t),at("focus",t),()=>{rt&&document.removeEventListener("visibilitychange",t),lt("focus",t)}),fs=t=>{const e=()=>{ot=!0,t()},n=()=>{ot=!1};return at("online",e),at("offline",n),()=>{lt("online",e),lt("offline",n)}},ds={isOnline:ls,isVisible:cs},hs={initFocus:us,initReconnect:fs},Kt=!Le.useId,me=!Ce||os,gs=t=>as()?window.requestAnimationFrame(t):setTimeout(t,1),xe=me?v.useEffect:v.useLayoutEffect,Je=typeof navigator<"u"&&navigator.connection,Ht=!me&&Je&&(["slow-2g","2g"].includes(Je.effectiveType)||Je.saveData),Ne=new WeakMap,ps=t=>ke.prototype.toString.call(t),Ge=(t,e)=>t===`[object ${e}]`;let ms=0;const ct=t=>{const e=typeof t,n=ps(t),s=Ge(n,"Date"),i=Ge(n,"RegExp"),r=Ge(n,"Object");let o,a;if(ke(t)===t&&!s&&!i){if(o=Ne.get(t),o)return o;if(o=++ms+"~",Ne.set(t,o),Array.isArray(t)){for(o="@",a=0;a<t.length;a++)o+=ct(t[a])+",";Ne.set(t,o)}if(r){o="#";const l=ke.keys(t).sort();for(;!E(a=l.pop());)E(t[a])||(o+=a+":"+ct(t[a])+",");Ne.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Re=t=>{if(X(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?ct(t):"",[t,e]};let Ss=0;const ut=()=>++Ss;async function an(...t){const[e,n,s,i]=t,r=ae({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let o=r.populateCache;const a=r.rollbackOnError;let l=r.optimisticData;const c=g=>typeof a=="function"?a(g):a!==!1,f=r.throwOnError;if(X(n)){const g=n,d=[],h=e.keys();for(const S of h)!/^\$(inf|sub)\$/.test(S)&&g(e.get(S)._k)&&d.push(S);return Promise.all(d.map(u))}return u(n);async function u(g){const[d]=Re(g);if(!d)return;const[h,S]=le(e,d),[L,O,p,_]=te.get(e),N=()=>{const y=L[d];return(X(r.revalidate)?r.revalidate(h().data,g):r.revalidate!==!1)&&(delete p[d],delete _[d],y&&y[0])?y[0](rn).then(()=>h().data):h().data};if(t.length<3)return N();let b=s,D,k=!1;const P=ut();O[d]=[P,0];const m=!E(l),x=h(),A=x.data,C=x._c,R=E(C)?A:C;if(m&&(l=X(l)?l(R,A):l,S({data:l,_c:R})),X(b))try{b=b(R)}catch(y){D=y,k=!0}if(b&&on(b))if(b=await b.catch(y=>{D=y,k=!0}),P!==O[d][0]){if(k)throw D;return b}else k&&m&&c(D)&&(o=!0,S({data:R,_c:U}));if(o&&!k)if(X(o)){const y=o(b,R);S({data:y,error:U,_c:U})}else S({data:b,error:U,_c:U});if(O[d][1]=ut(),Promise.resolve(N()).then(()=>{S({_c:U})}),k){if(f)throw D;return}return b}}const Wt=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},ln=(t,e)=>{if(!te.has(t)){const n=ae(hs,e),s=Object.create(null),i=an.bind(U,t);let r=re;const o=Object.create(null),a=(f,u)=>{const g=o[f]||[];return o[f]=g,g.push(u),()=>g.splice(g.indexOf(u),1)},l=(f,u,g)=>{t.set(f,u);const d=o[f];if(d)for(const h of d)h(u,g)},c=()=>{if(!te.has(t)&&(te.set(t,[s,Object.create(null),Object.create(null),Object.create(null),i,l,a]),!me)){const f=n.initFocus(setTimeout.bind(U,Wt.bind(U,s,nn))),u=n.initReconnect(setTimeout.bind(U,Wt.bind(U,s,sn)));r=()=>{f&&f(),u&&u(),te.delete(t)}}};return c(),[t,i,c,r]}return[t,te.get(t)[4]]},ys=(t,e,n,s,i)=>{const r=n.errorRetryCount,o=i.retryCount,a=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!E(r)&&o>r||setTimeout(s,a,i)},bs=it,[Me,Os]=ln(new Map),cn=ae({onLoadingSlow:re,onSuccess:re,onError:re,onErrorRetry:ys,onDiscarded:re,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ht?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ht?5e3:3e3,compare:bs,isPaused:()=>!1,cache:Me,mutate:Os,fallback:{}},ds),un=(t,e)=>{const n=ae(t,e);if(e){const{use:s,fallback:i}=t,{use:r,fallback:o}=e;s&&r&&(n.use=s.concat(r)),i&&o&&(n.fallback=ae(i,o))}return n},ft=v.createContext({}),vs=t=>{const{value:e}=t,n=v.useContext(ft),s=X(e),i=v.useMemo(()=>s?e(n):e,[s,n,e]),r=v.useMemo(()=>s?i:un(n,i),[s,n,i]),o=i&&i.provider,a=v.useRef(U);o&&!a.current&&(a.current=ln(o(r.cache||Me),i));const l=a.current;return l&&(r.cache=l[0],r.mutate=l[1]),xe(()=>{if(l)return l[2]&&l[2](),l[3]},[]),v.createElement(ft.Provider,ae(t,{value:r}))},fn="$inf$",dn=Ce&&window.__SWR_DEVTOOLS_USE__,xs=dn?window.__SWR_DEVTOOLS_USE__:[],ws=()=>{dn&&(window.__SWR_DEVTOOLS_REACT__=Le)},hn=t=>X(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Rs=()=>{const t=v.useContext(ft);return v.useMemo(()=>ae(cn,t),[t])},Ls=t=>(e,n,s)=>t(e,n&&((...r)=>{const[o]=Re(e),[,,,a]=te.get(Me);if(o.startsWith(fn))return n(...r);const l=a[o];return E(l)?n(...r):(delete a[o],l)}),s),Cs=xs.concat(Ls),Es=t=>function(...n){const s=Rs(),[i,r,o]=hn(n),a=un(s,o);let l=t;const{use:c}=a,f=(c||[]).concat(Cs);for(let u=f.length;u--;)l=f[u](l);return l(i,r||a.fetcher||null,a)},_s=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const i=s.indexOf(n);i>=0&&(s[i]=s[s.length-1],s.pop())}},Ns=(t,e)=>(...n)=>{const[s,i,r]=hn(n),o=(r.use||[]).concat(e);return t(s,i,{...r,use:o})};ws();const qe=Le.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Ye={dedupe:!0},zt=Promise.resolve(U),Ps=(t,e,n)=>{const{cache:s,compare:i,suspense:r,fallbackData:o,revalidateOnMount:a,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:f,refreshWhenOffline:u,keepPreviousData:g,strictServerPrefetchWarning:d}=n,[h,S,L,O]=te.get(s),[p,_]=Re(t),N=v.useRef(!1),b=v.useRef(!1),D=v.useRef(p),k=v.useRef(e),P=v.useRef(n),m=()=>P.current,x=()=>m().isVisible()&&m().isOnline(),[A,C,R,y]=le(s,p),I=v.useRef({}).current,$=E(o)?E(n.fallback)?U:n.fallback[p]:o,T=(F,V)=>{for(const B in I){const M=B;if(M==="data"){if(!i(F[M],V[M])&&(!E(F[M])||!i(he,V[M])))return!1}else if(V[M]!==F[M])return!1}return!0},W=v.useMemo(()=>{const F=!p||!e?!1:E(a)?m().isPaused()||r?!1:l!==!1:a,V=q=>{const se=ae(q);return delete se._k,F?{isValidating:!0,isLoading:!0,...se}:se},B=A(),M=y(),Z=V(B),ge=B===M?Z:V(M);let H=Z;return[()=>{const q=V(A());return T(q,H)?(H.data=q.data,H.isLoading=q.isLoading,H.isValidating=q.isValidating,H.error=q.error,H):(H=q,q)},()=>ge]},[s,p]),J=Ie.useSyncExternalStore(v.useCallback(F=>R(p,(V,B)=>{T(B,V)||F()}),[s,p]),W[0],W[1]),ce=!N.current,K=h[p]&&h[p].length>0,j=J.data,G=E(j)?$&&on($)?qe($):$:j,ee=J.error,ue=v.useRef(G),he=g?E(j)?E(ue.current)?G:ue.current:j:G,fe=p&&E(G),vn=!me&&Ie.useSyncExternalStore(()=>re,()=>!1,()=>!0);d&&vn&&!r&&fe&&console.warn(`Missing pre-initiated data for serialized key "${p}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Ot=K&&!E(ee)?!1:ce&&!E(a)?a:m().isPaused()?!1:r?E(G)?!1:l:E(G)||l,vt=!!(p&&e&&ce&&Ot),xn=E(J.isValidating)?vt:J.isValidating,wn=E(J.isLoading)?vt:J.isLoading,Se=v.useCallback(async F=>{const V=k.current;if(!p||!V||b.current||m().isPaused())return!1;let B,M,Z=!0;const ge=F||{},H=!L[p]||!ge.dedupe,q=()=>Kt?!b.current&&p===D.current&&N.current:p===D.current,se={isValidating:!1,isLoading:!1},wt=()=>{C(se)},Rt=()=>{const Q=L[p];Q&&Q[1]===M&&delete L[p]},Lt={isValidating:!0};E(A().data)&&(Lt.isLoading=!0);try{if(H&&(C(Lt),n.loadingTimeout&&E(A().data)&&setTimeout(()=>{Z&&q()&&m().onLoadingSlow(p,n)},n.loadingTimeout),L[p]=[V(_),ut()]),[B,M]=L[p],B=await B,H&&setTimeout(Rt,n.dedupingInterval),!L[p]||L[p][1]!==M)return H&&q()&&m().onDiscarded(p),!1;se.error=U;const Q=S[p];if(!E(Q)&&(M<=Q[0]||M<=Q[1]||Q[1]===0))return wt(),H&&q()&&m().onDiscarded(p),!1;const ie=A().data;se.data=i(ie,B)?ie:B,H&&q()&&m().onSuccess(B,p,n)}catch(Q){Rt();const ie=m(),{shouldRetryOnError:Be}=ie;ie.isPaused()||(se.error=Q,H&&q()&&(ie.onError(Q,p,ie),(Be===!0||X(Be)&&Be(Q))&&(!m().revalidateOnFocus||!m().revalidateOnReconnect||x())&&ie.onErrorRetry(Q,p,ie,Rn=>{const Ue=h[p];Ue&&Ue[0]&&Ue[0](Bt,Rn)},{retryCount:(ge.retryCount||0)+1,dedupe:!0})))}return Z=!1,wt(),!0},[p,s]),xt=v.useCallback((...F)=>an(s,D.current,...F),[]);if(xe(()=>{k.current=e,P.current=n,E(j)||(ue.current=j)}),xe(()=>{if(!p)return;const F=Se.bind(U,Ye);let V=0;m().revalidateOnFocus&&(V=Date.now()+m().focusThrottleInterval);const M=_s(p,h,(Z,ge={})=>{if(Z==nn){const H=Date.now();m().revalidateOnFocus&&H>V&&x()&&(V=H+m().focusThrottleInterval,F())}else if(Z==sn)m().revalidateOnReconnect&&x()&&F();else{if(Z==rn)return Se();if(Z==Bt)return Se(ge)}});return b.current=!1,D.current=p,N.current=!0,C({_k:_}),Ot&&(L[p]||(E(G)||me?F():gs(F))),()=>{b.current=!0,M()}},[p]),xe(()=>{let F;function V(){const M=X(c)?c(A().data):c;M&&F!==-1&&(F=setTimeout(B,M))}function B(){!A().error&&(f||m().isVisible())&&(u||m().isOnline())?Se(Ye).then(V):V()}return V(),()=>{F&&(clearTimeout(F),F=-1)}},[c,f,u,p]),v.useDebugValue(he),r){if(!Kt&&me&&fe)throw new Error("Fallback data is required when using Suspense in SSR.");fe&&(k.current=e,P.current=n,b.current=!1);const F=O[p],V=!E(F)&&fe?xt(F):zt;if(qe(V),!E(ee)&&fe)throw ee;const B=fe?Se(Ye):zt;!E(he)&&fe&&(B.status="fulfilled",B.value=!0),qe(B)}return{mutate:xt,get data(){return I.data=!0,he},get error(){return I.error=!0,ee},get isValidating(){return I.isValidating=!0,xn},get isLoading(){return I.isLoading=!0,wn}}},bi=ke.defineProperty(vs,"defaultValue",{value:cn}),Is=Es(Ps),oe={BASE_URL:"/__ONEWORKS_PROJECT_CLIENT_BASE__/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,__ONEWORKS_PROJECT_CLIENT_COMMIT_HASH__:"6788a07c7f265c252930c4d6df671af73ff93dad",__ONEWORKS_PROJECT_CLIENT_VERSION__:"0.1.0-beta.1",__ONEWORKS_PROJECT_DEV_GIT_REF__:""};function gn(t){return"init"in t}function dt(t){return!!t.write}function Jt(t){return"v"in t||"e"in t}function $e(t){if("e"in t)throw t.e;if((oe?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}const Fe=new WeakMap;function pn(t){var e;return je(t)&&!!((e=Fe.get(t))!=null&&e[0])}function As(t){const e=Fe.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))}function ht(t,e){let n=Fe.get(t);if(!n){n=[!0,new Set],Fe.set(t,n);const s=()=>{n[0]=!1};t.then(s,s)}n[1].add(e)}function je(t){return typeof(t==null?void 0:t.then)=="function"}function mn(t,e,n){if(!n.p.has(t)){n.p.add(t);const s=()=>n.p.delete(t);e.then(s,s)}}function Sn(t,e,n){var s;const i=new Set;for(const r of((s=n.get(t))==null?void 0:s.t)||[])i.add(r);for(const r of e.p)i.add(r);return i}const Ds=(t,e,...n)=>e.read(...n),Ts=(t,e,...n)=>e.write(...n),ks=(t,e)=>{if(e.INTERNAL_onInit)return e.INTERNAL_onInit(t);if(e.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),e.unstable_onInit(t)},$s=(t,e,n)=>{var s;return(s=e.onMount)==null?void 0:s.call(e,n)},Fs=(t,e)=>{var n;const s=z(t),i=s[0],r=s[6],o=s[9];if((oe?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let a=i.get(e);return a||(a={d:new Map,p:new Set,n:0},i.set(e,a),(n=r.i)==null||n.call(r,e),o==null||o(t,e)),a},js=t=>{const e=z(t),n=e[1],s=e[3],i=e[4],r=e[5],o=e[6],a=e[13],l=[],c=f=>{try{f()}catch(u){l.push(u)}};do{o.f&&c(o.f);const f=new Set,u=f.add.bind(f);s.forEach(g=>{var d;return(d=n.get(g))==null?void 0:d.l.forEach(u)}),s.clear(),r.forEach(u),r.clear(),i.forEach(u),i.clear(),f.forEach(c),s.size&&a(t)}while(s.size||r.size||i.size);if(l.length)throw new AggregateError(l)},Vs=t=>{const e=z(t),n=e[1],s=e[2],i=e[3],r=e[11],o=e[14],a=e[17],l=[],c=new WeakSet,f=new WeakSet,u=Array.from(i);for(;u.length;){const g=u[u.length-1],d=r(t,g);if(f.has(g)){u.pop();continue}if(c.has(g)){if(s.get(g)===d.n)l.push([g,d]);else if((oe?"production":void 0)!=="production"&&s.has(g))throw new Error("[Bug] invalidated atom exists");f.add(g),u.pop();continue}c.add(g);for(const h of Sn(g,d,n))c.has(h)||u.push(h)}for(let g=l.length-1;g>=0;--g){const[d,h]=l[g];let S=!1;for(const L of h.d.keys())if(L!==d&&i.has(L)){S=!0;break}S&&(o(t,d),a(t,d)),s.delete(d)}},gt=new WeakSet,Ms=(t,e)=>{var n,s;const i=z(t),r=i[1],o=i[2],a=i[3],l=i[6],c=i[7],f=i[11],u=i[12],g=i[13],d=i[14],h=i[16],S=i[17],L=i[20],O=f(t,e);if(Jt(O)){if(r.has(e)&&o.get(e)!==O.n)return O;let m=!1;for(const[x,A]of O.d)if(d(t,x).n!==A){m=!0;break}if(!m)return O}O.d.clear();let p=!0;function _(){r.has(e)&&(S(t,e),g(t),u(t))}function N(m){var x;if(m===e){const C=f(t,m);if(!Jt(C))if(gn(m))L(t,m,m.init);else throw new Error("no atom init");return $e(C)}const A=d(t,m);try{return $e(A)}finally{O.d.set(m,A.n),pn(O.v)&&mn(e,O.v,A),r.has(e)&&((x=r.get(m))==null||x.t.add(e)),p||_()}}let b,D;const k={get signal(){return b||(b=new AbortController),b.signal},get setSelf(){return(oe?"production":void 0)!=="production"&&!dt(e)&&console.warn("setSelf function cannot be used with read-only atom"),!D&&dt(e)&&(D=(...m)=>{if((oe?"production":void 0)!=="production"&&p&&console.warn("setSelf function cannot be called in sync"),!p)try{return h(t,e,...m)}finally{g(t),u(t)}}),D}},P=O.n;try{(oe?"production":void 0)!=="production"&>.delete(t);const m=c(t,e,N,k);return(oe?"production":void 0)!=="production"&>.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),L(t,e,m),je(m)&&(ht(m,()=>b==null?void 0:b.abort()),m.then(_,_)),(n=l.r)==null||n.call(l,e),O}catch(m){return delete O.v,O.e=m,++O.n,O}finally{p=!1,P!==O.n&&o.get(e)===P&&(o.set(e,O.n),a.add(e),(s=l.c)==null||s.call(l,e))}},Bs=(t,e)=>{const n=z(t),s=n[1],i=n[2],r=n[11],o=[e];for(;o.length;){const a=o.pop(),l=r(t,a);for(const c of Sn(a,l,s)){const f=r(t,c);i.set(c,f.n),o.push(c)}}},Us=(t,e,...n)=>{const s=z(t),i=s[3],r=s[6],o=s[8],a=s[11],l=s[12],c=s[13],f=s[14],u=s[15],g=s[16],d=s[17],h=s[20];let S=!0;const L=p=>$e(f(t,p)),O=(p,..._)=>{var N;const b=a(t,p);try{if(p===e){if(!gn(p))throw new Error("atom not writable");(oe?"production":void 0)!=="production"&>.add(t);const D=b.n,k=_[0];h(t,p,k),d(t,p),D!==b.n&&(i.add(p),u(t,p),(N=r.c)==null||N.call(r,p));return}else return g(t,p,..._)}finally{S||(c(t),l(t))}};try{return o(t,e,L,O,...n)}finally{S=!1}},Ks=(t,e)=>{var n;const s=z(t),i=s[1],r=s[3],o=s[6],a=s[11],l=s[15],c=s[18],f=s[19],u=a(t,e),g=i.get(e);if(g&&!pn(u.v)){for(const[d,h]of u.d)if(!g.d.has(d)){const S=a(t,d);c(t,d).t.add(e),g.d.add(d),h!==S.n&&(r.add(d),l(t,d),(n=o.c)==null||n.call(o,d))}for(const d of g.d)if(!u.d.has(d)){g.d.delete(d);const h=f(t,d);h==null||h.t.delete(e)}}},Hs=(t,e)=>{var n;const s=z(t),i=s[1],r=s[4],o=s[6],a=s[10],l=s[11],c=s[12],f=s[13],u=s[14],g=s[16],d=s[18],h=l(t,e);let S=i.get(e);if(!S){u(t,e);for(const L of h.d.keys())d(t,L).t.add(e);if(S={l:new Set,d:new Set(h.d.keys()),t:new Set},i.set(e,S),dt(e)){const L=()=>{let O=!0;const p=(..._)=>{try{return g(t,e,..._)}finally{O||(f(t),c(t))}};try{const _=a(t,e,p);_&&(S.u=()=>{O=!0;try{_()}finally{O=!1}})}finally{O=!1}};r.add(L)}(n=o.m)==null||n.call(o,e)}return S},Ws=(t,e)=>{var n,s;const i=z(t),r=i[1],o=i[5],a=i[6],l=i[11],c=i[19],f=l(t,e);let u=r.get(e);if(!u||u.l.size)return u;let g=!1;for(const d of u.t)if((n=r.get(d))!=null&&n.d.has(e)){g=!0;break}if(!g){u.u&&o.add(u.u),u=void 0,r.delete(e);for(const d of f.d.keys()){const h=c(t,d);h==null||h.t.delete(e)}(s=a.u)==null||s.call(a,e);return}return u},zs=(t,e,n)=>{const s=z(t)[11],i=s(t,e),r="v"in i,o=i.v;if(je(n))for(const a of i.d.keys())mn(e,n,s(t,a));i.v=n,delete i.e,(!r||!Object.is(o,i.v))&&(++i.n,je(o)&&As(o))},Js=(t,e)=>{const n=z(t)[14];return $e(n(t,e))},Gs=(t,e,...n)=>{const s=z(t),i=s[12],r=s[13],o=s[16];try{return o(t,e,...n)}finally{r(t),i(t)}},qs=(t,e,n)=>{const s=z(t),i=s[12],r=s[18],o=s[19],l=r(t,e).l;return l.add(n),i(t),()=>{l.delete(n),o(t,e),i(t)}},yn=new WeakMap,z=t=>{const e=yn.get(t);if((oe?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Ys(...t){const e={get(s){const i=z(e)[21];return i(e,s)},set(s,...i){const r=z(e)[22];return r(e,s,...i)},sub(s,i){const r=z(e)[23];return r(e,s,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Ds,Ts,ks,$s,Fs,js,Vs,Ms,Bs,Us,Ks,Hs,Ws,zs,Js,Gs,qs,void 0].map((s,i)=>t[i]||s);return yn.set(e,Object.freeze(n)),e}const bn={};let Qs=0;function Oi(t,e){const n=`atom${++Qs}`,s={toString(){return(bn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?s.read=t:(s.init=t,s.read=Xs,s.write=Zs),e&&(s.write=e),s}function Xs(t){return t(this)}function Zs(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function ei(){return Ys()}let be;function ti(){return be||(be=ei(),(bn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=be),globalThis.__JOTAI_DEFAULT_STORE__!==be&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),be}const ni={},si=v.createContext(void 0);function On(t){return v.useContext(si)||ti()}const pt=t=>typeof(t==null?void 0:t.then)=="function",mt=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},ii=Le.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(mt(t),t)}),Qe=new WeakMap,Gt=(t,e)=>{let n=Qe.get(t);return n||(n=new Promise((s,i)=>{let r=t;const o=c=>f=>{r===c&&s(f)},a=c=>f=>{r===c&&i(f)},l=()=>{try{const c=e();pt(c)?(Qe.set(c,n),r=c,c.then(o(c),a(c)),ht(c,l)):s(c)}catch(c){i(c)}};t.then(o(t),a(t)),ht(t,l)}),Qe.set(t,n)),n};function ri(t,e){const{delay:n,unstable_promiseStatus:s=!Le.use}={},i=On(),[[r,o,a],l]=v.useReducer(f=>{const u=i.get(t);return Object.is(f[0],u)&&f[1]===i&&f[2]===t?f:[u,i,t]},void 0,()=>[i.get(t),i,t]);let c=r;if((o!==i||a!==t)&&(l(),c=i.get(t)),v.useEffect(()=>{const f=i.sub(t,()=>{if(s)try{const u=i.get(t);pt(u)&&mt(Gt(u,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),f},[i,t,n,s]),v.useDebugValue(c),pt(c)){const f=Gt(c,()=>i.get(t));return s&&mt(f),ii(f)}return c}function oi(t,e){const n=On();return v.useCallback((...i)=>{if((ni?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function vi(t,e){return[ri(t),oi(t)]}const ai=()=>{},li=ai(),St=Object,qt=t=>t===li,ci=t=>typeof t=="function",Pe=new WeakMap,ui=t=>St.prototype.toString.call(t),Xe=(t,e)=>t===`[object ${e}]`;let fi=0;const yt=t=>{const e=typeof t,n=ui(t),s=Xe(n,"Date"),i=Xe(n,"RegExp"),r=Xe(n,"Object");let o,a;if(St(t)===t&&!s&&!i){if(o=Pe.get(t),o)return o;if(o=++fi+"~",Pe.set(t,o),Array.isArray(t)){for(o="@",a=0;a<t.length;a++)o+=yt(t[a])+",";Pe.set(t,o)}if(r){o="#";const l=St.keys(t).sort();for(;!qt(a=l.pop());)qt(t[a])||(o+=a+":"+yt(t[a])+",");Pe.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},di=t=>{if(ci(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?yt(t):"",[t,e]},hi=t=>di(t?t(0,null):null)[0],Ze=Promise.resolve(),gi=t=>(e,n,s)=>{const i=v.useRef(!1),{cache:r,initialSize:o=1,revalidateAll:a=!1,persistSize:l=!1,revalidateFirstPage:c=!0,revalidateOnMount:f=!1,parallel:u=!1}=s,[,,,g]=te.get(Me);let d;try{d=hi(e),d&&(d=fn+d)}catch{}const[h,S,L]=le(r,d),O=v.useCallback(()=>E(h()._l)?o:h()._l,[r,d,o]);Ie.useSyncExternalStore(v.useCallback(P=>d?L(d,()=>{P()}):()=>{},[r,d]),O,O);const p=v.useCallback(()=>{const P=h()._l;return E(P)?o:P},[d,o]),_=v.useRef(p());xe(()=>{if(!i.current){i.current=!0;return}d&&S({_l:l?_.current:p()})},[d,r]);const N=f&&!i.current,b=t(d,async P=>{const m=h()._i,x=h()._r;S({_r:U});const A=[],C=p(),[R]=le(r,P),y=R().data,I=[];let $=null;for(let T=0;T<C;++T){const[W,J]=Re(e(T,u?null:$));if(!W)break;const[ce,K]=le(r,W);let j=ce().data;const G=a||m||E(j)||c&&!T&&!E(y)||N||y&&!E(y[T])&&!s.compare(y[T],j);if(n&&(typeof x=="function"?x(j,J):G)){const ee=async()=>{if(!(W in g))j=await n(J);else{const he=g[W];delete g[W],j=await he}K({data:j,_k:J}),A[T]=j};u?I.push(ee):await ee()}else A[T]=j;u||($=j)}return u&&await Promise.all(I.map(T=>T())),S({_i:U}),A},s),D=v.useCallback(function(P,m){const x=typeof m=="boolean"?{revalidate:m}:m||{},A=x.revalidate!==!1;return d?(A&&(E(P)?S({_i:!0,_r:x.revalidate}):S({_i:!1,_r:x.revalidate})),arguments.length?b.mutate(P,{...x,revalidate:A}):b.mutate()):Ze},[d,r]),k=v.useCallback(P=>{if(!d)return Ze;const[,m]=le(r,d);let x;if(X(P)?x=P(p()):typeof P=="number"&&(x=P),typeof x!="number")return Ze;m({_l:x}),_.current=x;const A=[],[C]=le(r,d);let R=null;for(let y=0;y<x;++y){const[I]=Re(e(y,R)),[$]=le(r,I),T=I?$().data:U;if(E(T))return D(C().data);A.push(T),R=T}return D(A)},[d,r,D,p]);return{size:p(),setSize:k,mutate:D,get data(){return b.data},get error(){return b.error},get isValidating(){return b.isValidating},get isLoading(){return b.isLoading}}},xi=Ns(Is,gi);export{bi as S,Oi as a,ri as b,Si as c,oi as d,Is as e,Rs as f,vi as g,xi as h,Y as i,yi as u};
|