@oneworks/client 0.1.0-alpha.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-BqRwfUQY.js +1 -0
- package/dist/assets/ActionSearchToolbar-CMBns0Zm.css +1 -0
- package/dist/assets/AgentRoomRoute-BYgM7vgg.js +1 -0
- package/dist/assets/AgentRoomSessionRoute-DdoZY7qL.js +3 -0
- package/dist/assets/ArchiveRoute-ydgLUN7p.js +1 -0
- package/dist/assets/{AuthenticatedApp-BTs4l2pB.js → AuthenticatedApp-CK9TT7Nk.js} +236 -224
- package/dist/assets/AuthenticatedApp-scWyvbOf.css +1 -0
- package/dist/assets/AutomationRoute-CpcRbNa8.js +1 -0
- package/dist/assets/BenchmarkRoute-CZRZVolT.js +21 -0
- package/dist/assets/ChatRoute-DdRVEkAb.js +2 -0
- package/dist/assets/Collapse-CxTS9FJh.js +10 -0
- package/dist/assets/{ComposerLanding-Cl6zfbOm.js → ComposerLanding-BChGuCjF.js} +4 -4
- package/dist/assets/ConfigEditors-BuDavOAj.css +1 -0
- package/dist/assets/ConfigRoute-D_EkHryB.js +28 -0
- package/dist/assets/ConfigRoute-TW2qRRNP.css +1 -0
- package/dist/assets/InteractionStructureRoute-Dpjr6hIq.js +1 -0
- package/dist/assets/KnowledgeRoute-Bp4Da65A.js +1 -0
- package/dist/assets/LauncherApp-ByUpDwod.js +2 -0
- package/dist/assets/LauncherRoute-B94P9m3I.js +2 -0
- package/dist/assets/LauncherRoute-NsK8KCzb.css +1 -0
- package/dist/assets/MobileAwareSelect-BySpAJpa.css +1 -0
- package/dist/assets/MobileAwareSelect-CCAQrsxL.js +37 -0
- package/dist/assets/{ModuleManagementRoute-DQACRan1.js → ModuleManagementRoute-DcrMX6P7.js} +3 -3
- package/dist/assets/NotFoundRoute-C1IfsiZY.js +1 -0
- package/dist/assets/PluginStoreRoute-7UBLkrWc.js +1 -0
- package/dist/assets/PluginStoreRoute-Cfalv335.css +1 -0
- package/dist/assets/RouteContainerPanelTabs-D8pC61tF.js +11 -0
- package/dist/assets/RouteContainerPanelTabs-DAjUmk7i.css +1 -0
- package/dist/assets/SchemaObjectEditor-DvwrURac.js +1 -0
- package/dist/assets/StandaloneMobileDebugRoute--yiQ5EdW.js +1 -0
- package/dist/assets/StandaloneMobileDebugRoute-DuOLjUb9.css +1 -0
- package/dist/assets/WorkspaceApp-l-h_IsMp.js +9 -0
- package/dist/assets/agent-room-session-paths-CYMSFD9m.css +32 -0
- package/dist/assets/agent-room-session-paths-DNpYqOr3.js +537 -0
- package/dist/assets/{arc-BXsvCKst.js → arc-Xh4h56Fv.js} +1 -1
- package/dist/assets/azure-C6wcxVWu.ico +0 -0
- package/dist/assets/{blockDiagram-c4efeb88-hc-xNCrG.js → blockDiagram-c4efeb88-CG3HxYeL.js} +2 -2
- package/dist/assets/{c4Diagram-c83219d4-DVHTOuVr.js → c4Diagram-c83219d4-DiEPAqCg.js} +2 -2
- package/dist/assets/channel-DH-F5Uqk.js +1 -0
- package/dist/assets/classDiagram-beda092f-Dwx44PuJ.js +2 -0
- package/dist/assets/classDiagram-v2-2358418a-COXM437u.js +2 -0
- package/dist/assets/client-build-info-6B4KoYHs.js +1 -0
- package/dist/assets/clone-DGri7oGq.js +1 -0
- package/dist/assets/{createText-1719965b-x3Mhf0Jh.js → createText-1719965b-DPLMqVqY.js} +1 -1
- package/dist/assets/cssMode-DfDq4hLs.js +1 -0
- package/dist/assets/customParseFormat-DwjB960X.js +1 -0
- package/dist/assets/dockPanelConstants-4XXOUD0A.css +1 -0
- package/dist/assets/dockPanelConstants-OzU6hJl5.js +8 -0
- package/dist/assets/{edges-96097737-COVuSxRY.js → edges-96097737-ry9ejc8v.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-WcgqCWce.js → erDiagram-0228fc6a-AcCPz3wc.js} +2 -2
- package/dist/assets/{flowDb-c6c81e3f-nYly38YN.js → flowDb-c6c81e3f-BGnBxhJf.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-DLYALlBY.js → flowDiagram-50d868cf-BnS6RFWo.js} +2 -2
- package/dist/assets/flowDiagram-v2-4f6560a1-C3klqpJG.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-Da8rP8k4.js → flowchart-elk-definition-6af322e1-8-ynORZL.js} +2 -2
- package/dist/assets/{freemarker2-OWISI6Bb.js → freemarker2-uFZBYLEW.js} +2 -2
- package/dist/assets/ganttDiagram-a2739b55-3MEPfmMB.js +257 -0
- package/dist/assets/gemini-B9inYaVW.png +0 -0
- package/dist/assets/{gitGraphDiagram-82fe8481-DCk8Jny9.js → gitGraphDiagram-82fe8481-BKYGV9pb.js} +2 -2
- package/dist/assets/{graph-DvFQr_wY.js → graph-BEwlNa_j.js} +1 -1
- package/dist/assets/handlebars-dg6IZCa7.js +1 -0
- package/dist/assets/html-KunL9NkW.js +1 -0
- package/dist/assets/htmlMode-CrFpTEpC.js +1 -0
- package/dist/assets/{index-5325376f-CRF6GGjL.js → index-5325376f-CCcP_Ahl.js} +1 -1
- package/dist/assets/index-BIs5hzci.js +13 -0
- package/dist/assets/index-BggFUwYR.js +1 -0
- package/dist/assets/index-DdUqPqXW.js +727 -0
- package/dist/assets/{index-BnZLa3J3.js → index-DhpAFZQZ.js} +2 -2
- package/dist/assets/index-YzfSzOLk.js +13 -0
- package/dist/assets/index-ZOsqqPVv.js +36 -0
- package/dist/assets/index-jfuA2A4w.css +1 -0
- package/dist/assets/index-nXq6jwfM.js +3 -0
- package/dist/assets/{infoDiagram-8eee0895-dVa2Kh9_.js → infoDiagram-8eee0895-BzZ34kgw.js} +2 -2
- package/dist/assets/interaction-panel-mobile-debug-pages-8AAd4Csf.css +1 -0
- package/dist/assets/interaction-panel-mobile-debug-pages-DXC3HSZU.js +113 -0
- package/dist/assets/javascript-DA3fh3oR.js +1 -0
- package/dist/assets/{journeyDiagram-c64418c1-BJCT1TJ7.js → journeyDiagram-c64418c1-B_kSGErn.js} +2 -2
- package/dist/assets/{jsonMode-RsjNGxUQ.js → jsonMode-BDucSIBv.js} +4 -4
- package/dist/assets/{layout-BMZRkCUf.js → layout-CRLM1T9z.js} +1 -1
- package/dist/assets/{line-C99msl9T.js → line-Cdyr_7ve.js} +1 -1
- package/dist/assets/{linear-CJHB38BG.js → linear-y86GycLK.js} +1 -1
- package/dist/assets/liquid-mJp997il.js +1 -0
- package/dist/assets/{lspLanguageFeatures-D8zjArb3.js → lspLanguageFeatures-DiGGmudW.js} +1 -1
- package/dist/assets/mdx-Co6h2mZ2.js +1 -0
- package/dist/assets/{mermaid.core-DWzpZH_g.js → mermaid.core-VYJIZL_J.js} +4 -4
- package/dist/assets/micu-dUcmmgZZ.png +0 -0
- package/dist/assets/{mindmap-definition-8da855dc-DulNL_Ks.js → mindmap-definition-8da855dc-DKNG2gyr.js} +2 -2
- package/dist/assets/minimax-B5WRVrUt.png +0 -0
- package/dist/assets/openai-ABb0YGGa.svg +71 -0
- package/dist/assets/openrouter-CsJ_bD5Q.ico +0 -0
- package/dist/assets/{pieDiagram-a8764435-CHfubQBm.js → pieDiagram-a8764435-Cu3up9mc.js} +3 -3
- package/dist/assets/project-file-tree-icons-CfonMx-1.js +2 -0
- package/dist/assets/project-file-tree-icons-DXkdVC0r.css +1 -0
- package/dist/assets/python-BUUKzwmG.js +1 -0
- package/dist/assets/{quadrantDiagram-1e28029f-CFHca9nu.js → quadrantDiagram-1e28029f-DHW8R4el.js} +2 -2
- package/dist/assets/qwen-Cla2cGrM.svg +107 -0
- package/dist/assets/razor-ZPlQfY47.js +1 -0
- package/dist/assets/requesty-DAzbbw8F.ico +0 -0
- package/dist/assets/{requirementDiagram-08caed73-ClrFG92W.js → requirementDiagram-08caed73-CXWNC-_B.js} +2 -2
- package/dist/assets/route-plugin-chrome-bV1HEaju.js +1 -0
- package/dist/assets/sankeyDiagram-a04cb91d-DhKL8pMH.js +8 -0
- package/dist/assets/{sequenceDiagram-c5b8d532-ZoeuLa-n.js → sequenceDiagram-c5b8d532-D3fAcQeI.js} +2 -2
- package/dist/assets/shortcutUtils-B8h6g_7o.js +27 -0
- package/dist/assets/stateDiagram-1ecb1508-wKQS4LMF.js +1 -0
- package/dist/assets/stateDiagram-v2-c2b004d7-D5qOKtOa.js +1 -0
- package/dist/assets/{styles-b4e223ce-0VFG2Z9W.js → styles-b4e223ce-CpBwPex_.js} +1 -1
- package/dist/assets/{styles-ca3715f6-DaJIsB-N.js → styles-ca3715f6-4bqpN1KH.js} +1 -1
- package/dist/assets/{styles-d45a18b0-DT8DH24o.js → styles-d45a18b0-B0RCBD5D.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-DxTZXiLW.js → svgDrawCommon-b86b1483-C9KXk4gS.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-lu3ppiNq.js → timeline-definition-faaaa080-B1Bfjd0m.js} +2 -2
- package/dist/assets/{tsMode-B6pOKC1l.js → tsMode-Bd8BwKXc.js} +2 -2
- package/dist/assets/typescript-CLd6MPK0.js +1 -0
- package/dist/assets/use-app-preferences-DGCafwsP.js +1 -0
- package/dist/assets/use-chat-session-actions-wF_HiVzj.js +2 -0
- package/dist/assets/{vendor-react-BNJ5yonH.js → vendor-react-CnooHTJc.js} +1 -1
- package/dist/assets/vendor-state-zjcHRN98.js +1 -0
- package/dist/assets/worker-BZxxbL_z.js +1 -0
- package/dist/assets/workspace-file-openers-Dj_Cfk1S.js +1 -0
- package/dist/assets/workspace-file-openers-fM4AQXug.css +1 -0
- package/dist/assets/xml-BeC1cWk3.js +1 -0
- package/dist/assets/{xychartDiagram-f5964ef8-DvmrNK0s.js → xychartDiagram-f5964ef8-DbJVUSHy.js} +2 -2
- package/dist/assets/yaml-gQrw9AcN.js +1 -0
- package/dist/assets/yunwu-C0h7koCA.png +0 -0
- package/dist/assets/zhipu-CWmkm5qz.png +0 -0
- package/dist/index.html +4 -4
- package/dist/sw.js +5 -3
- package/package.json +20 -15
- package/dist/assets/AgentRoomRoute-rNmmPMvh.js +0 -1
- package/dist/assets/AgentRoomSessionRoute-Dg8yQRY_.js +0 -1
- package/dist/assets/ArchiveRoute-BWE_JVjl.js +0 -1
- package/dist/assets/AuthenticatedApp-Bop-GglJ.css +0 -1
- package/dist/assets/AutomationRoute-CoJ8YGK2.js +0 -1
- package/dist/assets/BenchmarkRoute-BcRZ1AFC.js +0 -21
- package/dist/assets/ChatRoute-DBN4uo7j.js +0 -1
- package/dist/assets/Collapse-DDrFhfKr.js +0 -8
- package/dist/assets/ConfigEditors-jcXiTWRg.css +0 -1
- package/dist/assets/ConfigRoute-D5zxs-kv.css +0 -1
- package/dist/assets/ConfigRoute-z5Dj1ihn.js +0 -2
- package/dist/assets/ConfigSectionPanel-DHIwutHm.js +0 -13
- package/dist/assets/DockPanel-DuxVeJzf.js +0 -11
- package/dist/assets/DockPanel-HEMeJ1MR.css +0 -1
- package/dist/assets/InteractionStructureRoute-B8yJdycA.js +0 -1
- package/dist/assets/KnowledgeRoute-BPYnBocT.js +0 -1
- package/dist/assets/LauncherApp-BqKOigOK.js +0 -2
- package/dist/assets/LauncherRoute-C1g-gjbs.js +0 -2
- package/dist/assets/LauncherRoute-DtjtKtXc.css +0 -1
- package/dist/assets/PluginStoreRoute-Bny2x-oC.css +0 -1
- package/dist/assets/PluginStoreRoute-CGIBez_4.js +0 -3
- package/dist/assets/SchemaObjectEditor-BdzgIkYh.js +0 -1
- package/dist/assets/WorkspaceApp-DGL3CHCp.js +0 -46
- package/dist/assets/agent-room-session-paths-Bl0JdX79.js +0 -153
- package/dist/assets/agent-room-session-paths-CCE5rS0K.css +0 -32
- package/dist/assets/channel-X7k9544o.js +0 -1
- package/dist/assets/classDiagram-beda092f-C--_J0De.js +0 -2
- package/dist/assets/classDiagram-v2-2358418a-VLoB_o-4.js +0 -2
- package/dist/assets/client-build-info-CUyezPn4.js +0 -37
- package/dist/assets/client-build-info-CgBKDSmG.css +0 -1
- package/dist/assets/clone-BsR4Dtrm.js +0 -1
- package/dist/assets/copy-OJ_6Pvs2.js +0 -28
- package/dist/assets/cssMode-Dg95dCSS.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-DZXqc8d3.js +0 -1
- package/dist/assets/ganttDiagram-a2739b55-SFoaaNUl.js +0 -257
- package/dist/assets/handlebars-DvhbIeVz.js +0 -1
- package/dist/assets/html-B6ANaoGC.js +0 -1
- package/dist/assets/htmlMode-CA_KA1J8.js +0 -1
- package/dist/assets/index-BfLbHhFR.js +0 -13
- package/dist/assets/index-C9FQLbWu.js +0 -1
- package/dist/assets/index-DA1kZA8X.css +0 -1
- package/dist/assets/index-Dn-Bbs_z.js +0 -705
- package/dist/assets/javascript-qaeO24NX.js +0 -1
- package/dist/assets/liquid-yYJuHMAu.js +0 -1
- package/dist/assets/mdx-CrAkCLhE.js +0 -1
- package/dist/assets/python-h0Aqhxqi.js +0 -1
- package/dist/assets/razor-DalkOWO-.js +0 -1
- package/dist/assets/sankeyDiagram-a04cb91d-C9DgEVjM.js +0 -8
- package/dist/assets/stateDiagram-1ecb1508-DDRxhJDf.js +0 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-CIob4OCF.js +0 -1
- package/dist/assets/typescript-Bn-lx_lA.js +0 -1
- package/dist/assets/use-app-preferences-B4K999VJ.js +0 -1
- package/dist/assets/use-chat-session-actions-5N-NQ9my.js +0 -2
- package/dist/assets/use-project-theme-preview-sources-5CPt1X2N.js +0 -1
- package/dist/assets/vendor-state-CBVXPiKY.js +0 -1
- package/dist/assets/workspace-file-openers-DAuX65xw.js +0 -1
- package/dist/assets/workspace-file-openers-erSFu-UO.css +0 -1
- package/dist/assets/xml-C1SO5DSd.js +0 -1
- package/dist/assets/yaml-DihjE03_.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{conf as t,language as e}from"./typescript-Bn-lx_lA.js";import"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const d=t,g={defaultToken:"invalid",tokenPostfix:".js",keywords:["break","case","catch","class","continue","const","constructor","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","get","if","import","in","instanceof","let","new","null","return","set","static","super","switch","symbol","this","throw","true","try","typeof","undefined","var","void","while","with","yield","async","await","of"],typeKeywords:[],operators:e.operators,symbols:e.symbols,escapes:e.escapes,digits:e.digits,octaldigits:e.octaldigits,binarydigits:e.binarydigits,hexdigits:e.hexdigits,regexpctl:e.regexpctl,regexpesc:e.regexpesc,tokenizer:e.tokenizer};export{d as conf,g as language};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cg as e}from"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],m={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,brackets:[["<!--","-->"],["<",">"],["{{","}}"],["{%","%}"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"%",close:"%"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:new RegExp(`<(?!(?:${t.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),afterText:/^<\/(\w[\w\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:new RegExp(`<(?!(?:${t.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),action:{indentAction:e.IndentAction.Indent}}]},u={defaultToken:"",tokenPostfix:"",builtinTags:["if","else","elseif","endif","render","assign","capture","endcapture","case","endcase","comment","endcomment","cycle","decrement","for","endfor","include","increment","layout","raw","endraw","render","tablerow","endtablerow","unless","endunless"],builtinFilters:["abs","append","at_least","at_most","capitalize","ceil","compact","date","default","divided_by","downcase","escape","escape_once","first","floor","join","json","last","lstrip","map","minus","modulo","newline_to_br","plus","prepend","remove","remove_first","replace","replace_first","reverse","round","rstrip","size","slice","sort","sort_natural","split","strip","strip_html","strip_newlines","times","truncate","truncatewords","uniq","upcase","url_decode","url_encode","where"],constants:["true","false"],operators:["==","!=",">","<",">=","<="],symbol:/[=><!]+/,identifier:/[a-zA-Z_][\w]*/,tokenizer:{root:[[/\{\%\s*comment\s*\%\}/,"comment.start.liquid","@comment"],[/\{\{/,{token:"@rematch",switchTo:"@liquidState.root"}],[/\{\%/,{token:"@rematch",switchTo:"@liquidState.root"}],[/(<)([\w\-]+)(\/>)/,["delimiter.html","tag.html","delimiter.html"]],[/(<)([:\w]+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/(<\/)([\w\-]+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/</,"delimiter.html"],[/\{/,"delimiter.html"],[/[^<{]+/]],comment:[[/\{\%\s*endcomment\s*\%\}/,"comment.end.liquid","@pop"],[/./,"comment.content.liquid"]],otherTag:[[/\{\{/,{token:"@rematch",switchTo:"@liquidState.otherTag"}],[/\{\%/,{token:"@rematch",switchTo:"@liquidState.otherTag"}],[/\/?>/,"delimiter.html","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],liquidState:[[/\{\{/,"delimiter.output.liquid"],[/\}\}/,{token:"delimiter.output.liquid",switchTo:"@$S2.$S3"}],[/\{\%/,"delimiter.tag.liquid"],[/raw\s*\%\}/,"delimiter.tag.liquid","@liquidRaw"],[/\%\}/,{token:"delimiter.tag.liquid",switchTo:"@$S2.$S3"}],{include:"liquidRoot"}],liquidRaw:[[/^(?!\{\%\s*endraw\s*\%\}).+/],[/\{\%/,"delimiter.tag.liquid"],[/@identifier/],[/\%\}/,{token:"delimiter.tag.liquid",next:"@root"}]],liquidRoot:[[/\d+(\.\d+)?/,"number.liquid"],[/"[^"]*"/,"string.liquid"],[/'[^']*'/,"string.liquid"],[/\s+/],[/@symbol/,{cases:{"@operators":"operator.liquid","@default":""}}],[/\./],[/@identifier/,{cases:{"@constants":"keyword.liquid","@builtinFilters":"predefined.liquid","@builtinTags":"predefined.liquid","@default":"variable.liquid"}}],[/[^}|%]/,"variable.liquid"]]}};export{m as conf,u as language};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cg as e}from"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const a={comments:{blockComment:["{/*","*/}"]},brackets:[["{","}"]],autoClosingPairs:[{open:'"',close:'"'},{open:"'",close:"'"},{open:"“",close:"”"},{open:"‘",close:"’"},{open:"`",close:"`"},{open:"{",close:"}"},{open:"(",close:")"},{open:"_",close:"_"},{open:"**",close:"**"},{open:"<",close:">"}],onEnterRules:[{beforeText:/^\s*- .+/,action:{indentAction:e.IndentAction.None,appendText:"- "}},{beforeText:/^\s*\+ .+/,action:{indentAction:e.IndentAction.None,appendText:"+ "}},{beforeText:/^\s*\* .+/,action:{indentAction:e.IndentAction.None,appendText:"* "}},{beforeText:/^> /,action:{indentAction:e.IndentAction.None,appendText:"> "}},{beforeText:/<\w+/,action:{indentAction:e.IndentAction.Indent}},{beforeText:/\s+>\s*$/,action:{indentAction:e.IndentAction.Indent}},{beforeText:/<\/\w+>/,action:{indentAction:e.IndentAction.Outdent}},...Array.from({length:100},(n,t)=>({beforeText:new RegExp(`^${t}\\. .+`),action:{indentAction:e.IndentAction.None,appendText:`${t+1}. `}}))]},m={defaultToken:"",tokenPostfix:".mdx",control:/[!#()*+.[\\\]_`{}\-]/,escapes:/\\@control/,tokenizer:{root:[[/^---$/,{token:"meta.content",next:"@frontmatter",nextEmbedded:"yaml"}],[/^\s*import/,{token:"keyword",next:"@import",nextEmbedded:"js"}],[/^\s*export/,{token:"keyword",next:"@export",nextEmbedded:"js"}],[/<\w+/,{token:"type.identifier",next:"@jsx"}],[/<\/?\w+>/,"type.identifier"],[/^(\s*)(>*\s*)(#{1,6}\s)/,[{token:"white"},{token:"comment"},{token:"keyword",next:"@header"}]],[/^(\s*)(>*\s*)([*+-])(\s+)/,["white","comment","keyword","white"]],[/^(\s*)(>*\s*)(\d{1,9}\.)(\s+)/,["white","comment","number","white"]],[/^(\s*)(>*\s*)(\d{1,9}\.)(\s+)/,["white","comment","number","white"]],[/^(\s*)(>*\s*)(-{3,}|\*{3,}|_{3,})$/,["white","comment","keyword"]],[/`{3,}(\s.*)?$/,{token:"string",next:"@codeblock_backtick"}],[/~{3,}(\s.*)?$/,{token:"string",next:"@codeblock_tilde"}],[/`{3,}(\S+).*$/,{token:"string",next:"@codeblock_highlight_backtick",nextEmbedded:"$1"}],[/~{3,}(\S+).*$/,{token:"string",next:"@codeblock_highlight_tilde",nextEmbedded:"$1"}],[/^(\s*)(-{4,})$/,["white","comment"]],[/^(\s*)(>+)/,["white","comment"]],{include:"content"}],content:[[/(\[)(.+)(]\()(.+)(\s+".*")(\))/,["","string.link","","type.identifier","string.link",""]],[/(\[)(.+)(]\()(.+)(\))/,["","type.identifier","","string.link",""]],[/(\[)(.+)(]\[)(.+)(])/,["","type.identifier","","type.identifier",""]],[/(\[)(.+)(]:\s+)(\S*)/,["","type.identifier","","string.link"]],[/(\[)(.+)(])/,["","type.identifier",""]],[/`.*`/,"variable.source"],[/_/,{token:"emphasis",next:"@emphasis_underscore"}],[/\*(?!\*)/,{token:"emphasis",next:"@emphasis_asterisk"}],[/\*\*/,{token:"strong",next:"@strong"}],[/{/,{token:"delimiter.bracket",next:"@expression",nextEmbedded:"js"}]],import:[[/'\s*(;|$)/,{token:"string",next:"@pop",nextEmbedded:"@pop"}]],expression:[[/{/,{token:"delimiter.bracket",next:"@expression"}],[/}/,{token:"delimiter.bracket",next:"@pop",nextEmbedded:"@pop"}]],export:[[/^\s*$/,{token:"delimiter.bracket",next:"@pop",nextEmbedded:"@pop"}]],jsx:[[/\s+/,""],[/(\w+)(=)("(?:[^"\\]|\\.)*")/,["attribute.name","operator","string"]],[/(\w+)(=)('(?:[^'\\]|\\.)*')/,["attribute.name","operator","string"]],[/(\w+(?=\s|>|={|$))/,["attribute.name"]],[/={/,{token:"delimiter.bracket",next:"@expression",nextEmbedded:"js"}],[/>/,{token:"type.identifier",next:"@pop"}]],header:[[/.$/,{token:"keyword",next:"@pop"}],{include:"content"},[/./,{token:"keyword"}]],strong:[[/\*\*/,{token:"strong",next:"@pop"}],{include:"content"},[/./,{token:"strong"}]],emphasis_underscore:[[/_/,{token:"emphasis",next:"@pop"}],{include:"content"},[/./,{token:"emphasis"}]],emphasis_asterisk:[[/\*(?!\*)/,{token:"emphasis",next:"@pop"}],{include:"content"},[/./,{token:"emphasis"}]],frontmatter:[[/^---$/,{token:"meta.content",nextEmbedded:"@pop",next:"@pop"}]],codeblock_highlight_backtick:[[/\s*`{3,}\s*$/,{token:"string",next:"@pop",nextEmbedded:"@pop"}],[/.*$/,"variable.source"]],codeblock_highlight_tilde:[[/\s*~{3,}\s*$/,{token:"string",next:"@pop",nextEmbedded:"@pop"}],[/.*$/,"variable.source"]],codeblock_backtick:[[/\s*`{3,}\s*$/,{token:"string",next:"@pop"}],[/.*$/,"variable.source"]],codeblock_tilde:[[/\s*~{3,}\s*$/,{token:"string",next:"@pop"}],[/.*$/,"variable.source"]]}};export{a as conf,m as language};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cg as e}from"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const p={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$"),action:{indentAction:e.IndentAction.Indent}}],folding:{offSide:!0,markers:{start:new RegExp("^\\s*#region\\b"),end:new RegExp("^\\s*#endregion\\b")}}},c={defaultToken:"",tokenPostfix:".python",keywords:["False","None","True","_","and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","match","nonlocal","not","or","pass","print","raise","return","try","type","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","self","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],tokenizer:{root:[{include:"@whitespace"},{include:"@numbers"},{include:"@strings"},[/[,:;]/,"delimiter"],[/[{}\[\]()]/,"@brackets"],[/@[a-zA-Z_]\w*/,"tag"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":"keyword","@default":"identifier"}}]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]],numbers:[[/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/,"number.hex"],[/-?(\d*\.)?\d+([eE][+\-]?\d+)?[jJ]?[lL]?/,"number"]],strings:[[/'$/,"string.escape","@popall"],[/f'{1,3}/,"string.escape","@fStringBody"],[/'/,"string.escape","@stringBody"],[/"$/,"string.escape","@popall"],[/f"{1,3}/,"string.escape","@fDblStringBody"],[/"/,"string.escape","@dblStringBody"]],fStringBody:[[/[^\\'\{\}]+$/,"string","@popall"],[/[^\\'\{\}]+/,"string"],[/\{[^\}':!=]+/,"identifier","@fStringDetail"],[/\\./,"string"],[/'/,"string.escape","@popall"],[/\\$/,"string"]],stringBody:[[/[^\\']+$/,"string","@popall"],[/[^\\']+/,"string"],[/\\./,"string"],[/'/,"string.escape","@popall"],[/\\$/,"string"]],fDblStringBody:[[/[^\\"\{\}]+$/,"string","@popall"],[/[^\\"\{\}]+/,"string"],[/\{[^\}':!=]+/,"identifier","@fStringDetail"],[/\\./,"string"],[/"/,"string.escape","@popall"],[/\\$/,"string"]],dblStringBody:[[/[^\\"]+$/,"string","@popall"],[/[^\\"]+/,"string"],[/\\./,"string"],[/"/,"string.escape","@popall"],[/\\$/,"string"]],fStringDetail:[[/[:][^}]+/,"string"],[/[!][ars]/,"string"],[/=/,"string"],[/\}/,"identifier","@pop"]]}};export{p as conf,c as language};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cg as t}from"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const e=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],l={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<!--","-->"],["<",">"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],onEnterRules:[{beforeText:new RegExp(`<(?!(?:${e.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),afterText:/^<\/(\w[\w\d]*)\s*>$/i,action:{indentAction:t.IndentAction.IndentOutdent}},{beforeText:new RegExp(`<(?!(?:${e.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),action:{indentAction:t.IndentAction.Indent}}]},d={defaultToken:"",tokenPostfix:"",tokenizer:{root:[[/@@@@/],[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.root"}],[/<!DOCTYPE/,"metatag.html","@doctype"],[/<!--/,"comment.html","@comment"],[/(<)([\w\-]+)(\/>)/,["delimiter.html","tag.html","delimiter.html"]],[/(<)(script)/,["delimiter.html",{token:"tag.html",next:"@script"}]],[/(<)(style)/,["delimiter.html",{token:"tag.html",next:"@style"}]],[/(<)([:\w\-]+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/(<\/)([\w\-]+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/</,"delimiter.html"],[/[ \t\r\n]+/],[/[^<@]+/]],doctype:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.comment"}],[/[^>]+/,"metatag.content.html"],[/>/,"metatag.html","@pop"]],comment:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.comment"}],[/-->/,"comment.html","@pop"],[/[^-]+/,"comment.content.html"],[/./,"comment.content.html"]],otherTag:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.otherTag"}],[/\/?>/,"delimiter.html","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],script:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.script"}],[/type/,"attribute.name","@scriptAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,["delimiter.html","tag.html",{token:"delimiter.html",next:"@pop"}]]],scriptAfterType:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.scriptAfterType"}],[/=/,"delimiter","@scriptAfterTypeEquals"],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptAfterTypeEquals:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.scriptAfterTypeEquals"}],[/"([^"]*)"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptWithCustomType:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.scriptWithCustomType.$S2"}],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptEmbedded:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInEmbeddedState.scriptEmbedded.$S2",nextEmbedded:"@pop"}],[/<\/script/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}]],style:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.style"}],[/type/,"attribute.name","@styleAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,["delimiter.html","tag.html",{token:"delimiter.html",next:"@pop"}]]],styleAfterType:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.styleAfterType"}],[/=/,"delimiter","@styleAfterTypeEquals"],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleAfterTypeEquals:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.styleAfterTypeEquals"}],[/"([^"]*)"/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleWithCustomType:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInSimpleState.styleWithCustomType.$S2"}],[/>/,{token:"delimiter.html",next:"@styleEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleEmbedded:[[/@[^@]/,{token:"@rematch",switchTo:"@razorInEmbeddedState.styleEmbedded.$S2",nextEmbedded:"@pop"}],[/<\/style/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}]],razorInSimpleState:[[/@\*/,"comment.cs","@razorBlockCommentTopLevel"],[/@[{(]/,"metatag.cs","@razorRootTopLevel"],[/(@)(\s*[\w]+)/,["metatag.cs",{token:"identifier.cs",switchTo:"@$S2.$S3"}]],[/[})]/,{token:"metatag.cs",switchTo:"@$S2.$S3"}],[/\*@/,{token:"comment.cs",switchTo:"@$S2.$S3"}]],razorInEmbeddedState:[[/@\*/,"comment.cs","@razorBlockCommentTopLevel"],[/@[{(]/,"metatag.cs","@razorRootTopLevel"],[/(@)(\s*[\w]+)/,["metatag.cs",{token:"identifier.cs",switchTo:"@$S2.$S3",nextEmbedded:"$S3"}]],[/[})]/,{token:"metatag.cs",switchTo:"@$S2.$S3",nextEmbedded:"$S3"}],[/\*@/,{token:"comment.cs",switchTo:"@$S2.$S3",nextEmbedded:"$S3"}]],razorBlockCommentTopLevel:[[/\*@/,"@rematch","@pop"],[/[^*]+/,"comment.cs"],[/./,"comment.cs"]],razorBlockComment:[[/\*@/,"comment.cs","@pop"],[/[^*]+/,"comment.cs"],[/./,"comment.cs"]],razorRootTopLevel:[[/\{/,"delimiter.bracket.cs","@razorRoot"],[/\(/,"delimiter.parenthesis.cs","@razorRoot"],[/[})]/,"@rematch","@pop"],{include:"razorCommon"}],razorRoot:[[/\{/,"delimiter.bracket.cs","@razorRoot"],[/\(/,"delimiter.parenthesis.cs","@razorRoot"],[/\}/,"delimiter.bracket.cs","@pop"],[/\)/,"delimiter.parenthesis.cs","@pop"],{include:"razorCommon"}],razorCommon:[[/[a-zA-Z_]\w*/,{cases:{"@razorKeywords":{token:"keyword.cs"},"@default":"identifier.cs"}}],[/[\[\]]/,"delimiter.array.cs"],[/[ \t\r\n]+/],[/\/\/.*$/,"comment.cs"],[/@\*/,"comment.cs","@razorBlockComment"],[/"([^"]*)"/,"string.cs"],[/'([^']*)'/,"string.cs"],[/(<)([\w\-]+)(\/>)/,["delimiter.html","tag.html","delimiter.html"]],[/(<)([\w\-]+)(>)/,["delimiter.html","tag.html","delimiter.html"]],[/(<\/)([\w\-]+)(>)/,["delimiter.html","tag.html","delimiter.html"]],[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/,"delimiter.cs"],[/\d*\d+[eE]([\-+]?\d+)?/,"number.float.cs"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float.cs"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F]/,"number.hex.cs"],[/0[0-7']*[0-7]/,"number.octal.cs"],[/0[bB][0-1']*[0-1]/,"number.binary.cs"],[/\d[\d']*/,"number.cs"],[/\d/,"number.cs"]]},razorKeywords:["abstract","as","async","await","base","bool","break","by","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","descending","explicit","event","extern","else","enum","false","finally","fixed","float","for","foreach","from","goto","group","if","implicit","in","int","interface","internal","into","is","lock","long","nameof","new","null","namespace","object","operator","out","override","orderby","params","private","protected","public","readonly","ref","return","switch","struct","sbyte","sealed","short","sizeof","stackalloc","static","string","select","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","var","virtual","volatile","void","when","while","where","yield","model","inject"],escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/};export{l as conf,d as language};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{x as mt,v as kt,s as _t,a as xt,c as vt,b as bt,g as rt,y as wt,d as G,p as St,z as Lt,k as Et}from"./mermaid.core-DWzpZH_g.js";import"./AuthenticatedApp-BTs4l2pB.js";import{o as At}from"./ordinal-Cboi1Yqb.js";import{s as Tt}from"./Tableau10-B-NsZVaP.js";import"./index-Dn-Bbs_z.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";import"./init-Gi6I4Gst.js";function ot(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s<a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s<u||s===void 0&&u>=u)&&(s=u)}return s}function yt(t,n){let s;if(n===void 0)for(const a of t)a!=null&&(s>a||s===void 0&&a>=a)&&(s=a);else{let a=-1;for(let u of t)(u=n(u,++a,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function Z(t,n){let s=0;if(n===void 0)for(let a of t)(a=+a)&&(s+=a);else{let a=-1;for(let u of t)(u=+n(u,++a,t))&&(s+=u)}return s}function Mt(t){return t.target.depth}function Nt(t){return t.depth}function Pt(t,n){return n-1-t.height}function dt(t,n){return t.sourceLinks.length?t.depth:n-1}function Ct(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?yt(t.sourceLinks,Mt)-1:0}function Y(t){return function(){return t}}function lt(t,n){return H(t.source,n.source)||t.index-n.index}function at(t,n){return H(t.target,n.target)||t.index-n.index}function H(t,n){return t.y0-n.y0}function J(t){return t.value}function It(t){return t.index}function $t(t){return t.nodes}function Ot(t){return t.links}function ct(t,n){const s=t.get(n);if(!s)throw new Error("missing: "+n);return s}function ut({nodes:t}){for(const n of t){let s=n.y0,a=s;for(const u of n.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of n.targetLinks)u.y1=a+u.width/2,a+=u.width}}function zt(){let t=0,n=0,s=1,a=1,u=24,_=8,p,g=It,i=dt,o,c,m=$t,b=Ot,y=6;function x(){const e={nodes:m.apply(null,arguments),links:b.apply(null,arguments)};return E(e),L(e),A(e),N(e),S(e),ut(e),e}x.update=function(e){return ut(e),e},x.nodeId=function(e){return arguments.length?(g=typeof e=="function"?e:Y(e),x):g},x.nodeAlign=function(e){return arguments.length?(i=typeof e=="function"?e:Y(e),x):i},x.nodeSort=function(e){return arguments.length?(o=e,x):o},x.nodeWidth=function(e){return arguments.length?(u=+e,x):u},x.nodePadding=function(e){return arguments.length?(_=p=+e,x):_},x.nodes=function(e){return arguments.length?(m=typeof e=="function"?e:Y(e),x):m},x.links=function(e){return arguments.length?(b=typeof e=="function"?e:Y(e),x):b},x.linkSort=function(e){return arguments.length?(c=e,x):c},x.size=function(e){return arguments.length?(t=n=0,s=+e[0],a=+e[1],x):[s-t,a-n]},x.extent=function(e){return arguments.length?(t=+e[0][0],s=+e[1][0],n=+e[0][1],a=+e[1][1],x):[[t,n],[s,a]]},x.iterations=function(e){return arguments.length?(y=+e,x):y};function E({nodes:e,links:f}){for(const[h,r]of e.entries())r.index=h,r.sourceLinks=[],r.targetLinks=[];const l=new Map(e.map((h,r)=>[g(h,r,e),h]));for(const[h,r]of f.entries()){r.index=h;let{source:k,target:v}=r;typeof k!="object"&&(k=r.source=ct(l,k)),typeof v!="object"&&(v=r.target=ct(l,v)),k.sourceLinks.push(r),v.targetLinks.push(r)}if(c!=null)for(const{sourceLinks:h,targetLinks:r}of e)h.sort(c),r.sort(c)}function L({nodes:e}){for(const f of e)f.value=f.fixedValue===void 0?Math.max(Z(f.sourceLinks,J),Z(f.targetLinks,J)):f.fixedValue}function A({nodes:e}){const f=e.length;let l=new Set(e),h=new Set,r=0;for(;l.size;){for(const k of l){k.depth=r;for(const{target:v}of k.sourceLinks)h.add(v)}if(++r>f)throw new Error("circular link");l=h,h=new Set}}function N({nodes:e}){const f=e.length;let l=new Set(e),h=new Set,r=0;for(;l.size;){for(const k of l){k.height=r;for(const{source:v}of k.targetLinks)h.add(v)}if(++r>f)throw new Error("circular link");l=h,h=new Set}}function I({nodes:e}){const f=ot(e,r=>r.depth)+1,l=(s-t-u)/(f-1),h=new Array(f);for(const r of e){const k=Math.max(0,Math.min(f-1,Math.floor(i.call(null,r,f))));r.layer=k,r.x0=t+k*l,r.x1=r.x0+u,h[k]?h[k].push(r):h[k]=[r]}if(o)for(const r of h)r.sort(o);return h}function z(e){const f=yt(e,l=>(a-n-(l.length-1)*p)/Z(l,J));for(const l of e){let h=n;for(const r of l){r.y0=h,r.y1=h+r.value*f,h=r.y1+p;for(const k of r.sourceLinks)k.width=k.value*f}h=(a-h+p)/(l.length+1);for(let r=0;r<l.length;++r){const k=l[r];k.y0+=h*(r+1),k.y1+=h*(r+1)}$(l)}}function S(e){const f=I(e);p=Math.min(_,(a-n)/(ot(f,l=>l.length)-1)),z(f);for(let l=0;l<y;++l){const h=Math.pow(.99,l),r=Math.max(1-h,(l+1)/y);O(f,h,r),M(f,h,r)}}function M(e,f,l){for(let h=1,r=e.length;h<r;++h){const k=e[h];for(const v of k){let R=0,j=0;for(const{source:W,value:K}of v.targetLinks){let F=K*(v.layer-W.layer);R+=T(W,v)*F,j+=F}if(!(j>0))continue;let U=(R/j-v.y0)*f;v.y0+=U,v.y1+=U,w(v)}o===void 0&&k.sort(H),P(k,l)}}function O(e,f,l){for(let h=e.length,r=h-2;r>=0;--r){const k=e[r];for(const v of k){let R=0,j=0;for(const{target:W,value:K}of v.sourceLinks){let F=K*(W.layer-v.layer);R+=V(v,W)*F,j+=F}if(!(j>0))continue;let U=(R/j-v.y0)*f;v.y0+=U,v.y1+=U,w(v)}o===void 0&&k.sort(H),P(k,l)}}function P(e,f){const l=e.length>>1,h=e[l];d(e,h.y0-p,l-1,f),C(e,h.y1+p,l+1,f),d(e,a,e.length-1,f),C(e,n,0,f)}function C(e,f,l,h){for(;l<e.length;++l){const r=e[l],k=(f-r.y0)*h;k>1e-6&&(r.y0+=k,r.y1+=k),f=r.y1+p}}function d(e,f,l,h){for(;l>=0;--l){const r=e[l],k=(r.y1-f)*h;k>1e-6&&(r.y0-=k,r.y1-=k),f=r.y0-p}}function w({sourceLinks:e,targetLinks:f}){if(c===void 0){for(const{source:{sourceLinks:l}}of f)l.sort(at);for(const{target:{targetLinks:l}}of e)l.sort(lt)}}function $(e){if(c===void 0)for(const{sourceLinks:f,targetLinks:l}of e)f.sort(at),l.sort(lt)}function T(e,f){let l=e.y0-(e.sourceLinks.length-1)*p/2;for(const{target:h,width:r}of e.sourceLinks){if(h===f)break;l+=r+p}for(const{source:h,width:r}of f.targetLinks){if(h===e)break;l-=r}return l}function V(e,f){let l=f.y0-(f.targetLinks.length-1)*p/2;for(const{source:h,width:r}of f.targetLinks){if(h===e)break;l+=r+p}for(const{target:h,width:r}of e.sourceLinks){if(h===f)break;l-=r}return l}return x}var tt=Math.PI,et=2*tt,D=1e-6,jt=et-D;function nt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function pt(){return new nt}nt.prototype=pt.prototype={constructor:nt,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,s,a){this._+="Q"+ +t+","+ +n+","+(this._x1=+s)+","+(this._y1=+a)},bezierCurveTo:function(t,n,s,a,u,_){this._+="C"+ +t+","+ +n+","+ +s+","+ +a+","+(this._x1=+u)+","+(this._y1=+_)},arcTo:function(t,n,s,a,u){t=+t,n=+n,s=+s,a=+a,u=+u;var _=this._x1,p=this._y1,g=s-t,i=a-n,o=_-t,c=p-n,m=o*o+c*c;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(m>D)if(!(Math.abs(c*g-i*o)>D)||!u)this._+="L"+(this._x1=t)+","+(this._y1=n);else{var b=s-_,y=a-p,x=g*g+i*i,E=b*b+y*y,L=Math.sqrt(x),A=Math.sqrt(m),N=u*Math.tan((tt-Math.acos((x+m-E)/(2*L*A)))/2),I=N/A,z=N/L;Math.abs(I-1)>D&&(this._+="L"+(t+I*o)+","+(n+I*c)),this._+="A"+u+","+u+",0,0,"+ +(c*b>o*y)+","+(this._x1=t+z*g)+","+(this._y1=n+z*i)}},arc:function(t,n,s,a,u,_){t=+t,n=+n,s=+s,_=!!_;var p=s*Math.cos(a),g=s*Math.sin(a),i=t+p,o=n+g,c=1^_,m=_?a-u:u-a;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+i+","+o:(Math.abs(this._x1-i)>D||Math.abs(this._y1-o)>D)&&(this._+="L"+i+","+o),s&&(m<0&&(m=m%et+et),m>jt?this._+="A"+s+","+s+",0,1,"+c+","+(t-p)+","+(n-g)+"A"+s+","+s+",0,1,"+c+","+(this._x1=i)+","+(this._y1=o):m>D&&(this._+="A"+s+","+s+",0,"+ +(m>=tt)+","+c+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=n+s*Math.sin(u))))},rect:function(t,n,s,a){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +s+"v"+ +a+"h"+-s+"Z"},toString:function(){return this._}};function ht(t){return function(){return t}}function Dt(t){return t[0]}function Bt(t){return t[1]}var Vt=Array.prototype.slice;function Rt(t){return t.source}function Ut(t){return t.target}function Wt(t){var n=Rt,s=Ut,a=Dt,u=Bt,_=null;function p(){var g,i=Vt.call(arguments),o=n.apply(this,i),c=s.apply(this,i);if(_||(_=g=pt()),t(_,+a.apply(this,(i[0]=o,i)),+u.apply(this,i),+a.apply(this,(i[0]=c,i)),+u.apply(this,i)),g)return _=null,g+""||null}return p.source=function(g){return arguments.length?(n=g,p):n},p.target=function(g){return arguments.length?(s=g,p):s},p.x=function(g){return arguments.length?(a=typeof g=="function"?g:ht(+g),p):a},p.y=function(g){return arguments.length?(u=typeof g=="function"?g:ht(+g),p):u},p.context=function(g){return arguments.length?(_=g??null,p):_},p}function Ft(t,n,s,a,u){t.moveTo(n,s),t.bezierCurveTo(n=(n+a)/2,s,n,u,a,u)}function Gt(){return Wt(Ft)}function Yt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Gt().source(Yt).target(Ht)}var it=function(){var t=function(g,i,o,c){for(o=o||{},c=g.length;c--;o[g[c]]=i);return o},n=[1,9],s=[1,10],a=[1,5,10,12],u={trace:function(){},yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:function(i,o,c,m,b,y,x){var E=y.length-1;switch(b){case 7:const L=m.findOrCreateNode(y[E-4].trim().replaceAll('""','"')),A=m.findOrCreateNode(y[E-2].trim().replaceAll('""','"')),N=parseFloat(y[E].trim());m.addLink(L,A,N);break;case 8:case 9:case 11:this.$=y[E];break;case 10:this.$=y[E-1];break}},table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:n,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(a,[2,8]),t(a,[2,9]),{19:[1,16]},t(a,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:n,20:s},{15:18,16:7,17:8,18:n,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(a,[2,10]),{15:21,16:7,17:8,18:n,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:function(i,o){if(o.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=o,c}},parse:function(i){var o=this,c=[0],m=[],b=[null],y=[],x=this.table,E="",L=0,A=0,N=2,I=1,z=y.slice.call(arguments,1),S=Object.create(this.lexer),M={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(M.yy[O]=this.yy[O]);S.setInput(i,M.yy),M.yy.lexer=S,M.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var P=S.yylloc;y.push(P);var C=S.options&&S.options.ranges;typeof M.yy.parseError=="function"?this.parseError=M.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function d(){var v;return v=m.pop()||S.lex()||I,typeof v!="number"&&(v instanceof Array&&(m=v,v=m.pop()),v=o.symbols_[v]||v),v}for(var w,$,T,V,e={},f,l,h,r;;){if($=c[c.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((w===null||typeof w>"u")&&(w=d()),T=x[$]&&x[$][w]),typeof T>"u"||!T.length||!T[0]){var k="";r=[];for(f in x[$])this.terminals_[f]&&f>N&&r.push("'"+this.terminals_[f]+"'");S.showPosition?k="Parse error on line "+(L+1)+`:
|
|
2
|
-
`+S.showPosition()+`
|
|
3
|
-
Expecting `+r.join(", ")+", got '"+(this.terminals_[w]||w)+"'":k="Parse error on line "+(L+1)+": Unexpected "+(w==I?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(k,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:P,expected:r})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+w);switch(T[0]){case 1:c.push(w),b.push(S.yytext),y.push(S.yylloc),c.push(T[1]),w=null,A=S.yyleng,E=S.yytext,L=S.yylineno,P=S.yylloc;break;case 2:if(l=this.productions_[T[1]][1],e.$=b[b.length-l],e._$={first_line:y[y.length-(l||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(l||1)].first_column,last_column:y[y.length-1].last_column},C&&(e._$.range=[y[y.length-(l||1)].range[0],y[y.length-1].range[1]]),V=this.performAction.apply(e,[E,A,L,M.yy,T[1],b,y].concat(z)),typeof V<"u")return V;l&&(c=c.slice(0,-1*l*2),b=b.slice(0,-1*l),y=y.slice(0,-1*l)),c.push(this.productions_[T[1]][0]),b.push(e.$),y.push(e._$),h=x[c[c.length-2]][c[c.length-1]],c.push(h);break;case 3:return!0}}return!0}},_=function(){var g={EOF:1,parseError:function(o,c){if(this.yy.parser)this.yy.parser.parseError(o,c);else throw new Error(o)},setInput:function(i,o){return this.yy=o||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var o=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var b=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===m.length?this.yylloc.first_column:0)+m[m.length-c.length].length-c[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[b[0],b[0]+this.yyleng-o]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),o=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
-
`+o+"^"},test_match:function(i,o){var c,m,b;if(this.options.backtrack_lexer&&(b={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(b.yylloc.range=this.yylloc.range.slice(0))),m=i[0].match(/(?:\r\n?|\n).*/g),m&&(this.yylineno+=m.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:m?m[m.length-1].length-m[m.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],c=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var y in b)this[y]=b[y];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,o,c,m;this._more||(this.yytext="",this.match="");for(var b=this._currentRules(),y=0;y<b.length;y++)if(c=this._input.match(this.rules[b[y]]),c&&(!o||c[0].length>o[0].length)){if(o=c,m=y,this.options.backtrack_lexer){if(i=this.test_match(c,b[y]),i!==!1)return i;if(this._backtrack){o=!1;continue}else return!1}else if(!this.options.flex)break}return o?(i=this.test_match(o,b[m]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var o=this.next();return o||this.lex()},begin:function(o){this.conditionStack.push(o)},popState:function(){var o=this.conditionStack.length-1;return o>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(o){return o=this.conditionStack.length-1-Math.abs(o||0),o>=0?this.conditionStack[o]:"INITIAL"},pushState:function(o){this.begin(o)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(o,c,m,b){switch(m){case 0:return this.pushState("csv"),4;case 1:return 10;case 2:return 5;case 3:return 12;case 4:return this.pushState("escaped_text"),18;case 5:return 20;case 6:return this.popState("escaped_text"),18;case 7:return 19}},rules:[/^(?:sankey-beta\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[1,2,3,4,5,6,7],inclusive:!1},escaped_text:{rules:[6,7],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return g}();u.lexer=_;function p(){this.yy={}}return p.prototype=u,u.Parser=p,new p}();it.parser=it;const X=it;let q=[],Q=[],B={};const qt=()=>{q=[],Q=[],B={},Lt()};class Qt{constructor(n,s,a=0){this.source=n,this.target=s,this.value=a}}const Kt=(t,n,s)=>{q.push(new Qt(t,n,s))};class Zt{constructor(n){this.ID=n}}const Jt=t=>(t=Et.sanitizeText(t,rt()),B[t]||(B[t]=new Zt(t),Q.push(B[t])),B[t]),te=()=>Q,ee=()=>q,ne=()=>({nodes:Q.map(t=>({id:t.ID})),links:q.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),ie={nodesMap:B,getConfig:()=>rt().sankey,getNodes:te,getLinks:ee,getGraph:ne,addLink:Kt,findOrCreateNode:Jt,getAccTitle:bt,setAccTitle:vt,getAccDescription:xt,setAccDescription:_t,getDiagramTitle:kt,setDiagramTitle:mt,clear:qt},gt=class st{static next(n){return new st(n+ ++st.count)}constructor(n){this.id=n,this.href=`#${n}`}toString(){return"url("+this.href+")"}};gt.count=0;let ft=gt;const se={left:Nt,right:Pt,center:Ct,justify:dt},re=function(t,n,s,a){const{securityLevel:u,sankey:_}=rt(),p=wt.sankey;let g;u==="sandbox"&&(g=G("#i"+n));const i=u==="sandbox"?G(g.nodes()[0].contentDocument.body):G("body"),o=u==="sandbox"?i.select(`[id="${n}"]`):G(`[id="${n}"]`),c=(_==null?void 0:_.width)??p.width,m=(_==null?void 0:_.height)??p.width,b=(_==null?void 0:_.useMaxWidth)??p.useMaxWidth,y=(_==null?void 0:_.nodeAlignment)??p.nodeAlignment,x=(_==null?void 0:_.prefix)??p.prefix,E=(_==null?void 0:_.suffix)??p.suffix,L=(_==null?void 0:_.showValues)??p.showValues,A=a.db.getGraph(),N=se[y];zt().nodeId(d=>d.id).nodeWidth(10).nodePadding(10+(L?15:0)).nodeAlign(N).extent([[0,0],[c,m]])(A);const S=At(Tt);o.append("g").attr("class","nodes").selectAll(".node").data(A.nodes).join("g").attr("class","node").attr("id",d=>(d.uid=ft.next("node-")).id).attr("transform",function(d){return"translate("+d.x0+","+d.y0+")"}).attr("x",d=>d.x0).attr("y",d=>d.y0).append("rect").attr("height",d=>d.y1-d.y0).attr("width",d=>d.x1-d.x0).attr("fill",d=>S(d.id));const M=({id:d,value:w})=>L?`${d}
|
|
7
|
-
${x}${Math.round(w*100)/100}${E}`:d;o.append("g").attr("class","node-labels").attr("font-family","sans-serif").attr("font-size",14).selectAll("text").data(A.nodes).join("text").attr("x",d=>d.x0<c/2?d.x1+6:d.x0-6).attr("y",d=>(d.y1+d.y0)/2).attr("dy",`${L?"0":"0.35"}em`).attr("text-anchor",d=>d.x0<c/2?"start":"end").text(M);const O=o.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(A.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),P=(_==null?void 0:_.linkColor)||"gradient";if(P==="gradient"){const d=O.append("linearGradient").attr("id",w=>(w.uid=ft.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",w=>w.source.x1).attr("x2",w=>w.target.x0);d.append("stop").attr("offset","0%").attr("stop-color",w=>S(w.source.id)),d.append("stop").attr("offset","100%").attr("stop-color",w=>S(w.target.id))}let C;switch(P){case"gradient":C=d=>d.uid;break;case"source":C=d=>S(d.source.id);break;case"target":C=d=>S(d.target.id);break;default:C=P}O.append("path").attr("d",Xt()).attr("stroke",C).attr("stroke-width",d=>Math.max(1,d.width)),St(void 0,o,0,b)},oe={draw:re},le=t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
|
|
8
|
-
`).trim(),ae=X.parse.bind(X);X.parse=t=>ae(le(t));const ve={parser:X,db:ie,renderer:oe};export{ve as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as P,d as N,p as W}from"./styles-ca3715f6-DaJIsB-N.js";import{g as t,d as H,l as b,e as R,k as T,an as v,A as U}from"./mermaid.core-DWzpZH_g.js";import{G as C}from"./graph-DvFQr_wY.js";import{l as F}from"./layout-BMZRkCUf.js";import"./AuthenticatedApp-BTs4l2pB.js";import{l as $}from"./line-C99msl9T.js";import"./index-Dn-Bbs_z.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";import"./array-BKyUJesY.js";import"./path-CbwjOpE9.js";const O=e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),X=e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),J=(e,a)=>{const o=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.id),c=o.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),o},Y=(e,a)=>{const o=function(l,m,w){const E=l.append("tspan").attr("x",2*t().state.padding).text(m);w||E.attr("dy",t().state.textHeight)},s=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.descriptions[0]).node().getBBox(),g=s.height,h=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let i=!0,r=!0;a.descriptions.forEach(function(l){i||(o(h,l,r),r=!1),i=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),x=h.node().getBBox(),d=Math.max(x.width,s.width);return y.attr("x2",d+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",d+2*t().state.padding).attr("height",x.height+g+2*t().state.padding).attr("rx",t().state.radius),e},I=(e,a,o)=>{const c=t().state.padding,s=2*t().state.padding,g=e.node().getBBox(),h=g.width,i=g.x,r=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(a.id),x=r.node().getBBox().width+s;let d=Math.max(x,h);d===h&&(d=d+s);let l;const m=e.node().getBBox();a.doc,l=i-c,x>h&&(l=(h-d)/2+c),Math.abs(i-m.x)<c&&x>h&&(l=i-(x-h)/2);const w=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",w).attr("class",o?"alt-composit":"composit").attr("width",d).attr("height",m.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),r.attr("x",l+c),x<=h&&r.attr("x",i+(d-s)/2-x/2+c),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",d).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",d).attr("height",m.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},_=e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),q=(e,a)=>{let o=t().state.forkWidth,c=t().state.forkHeight;if(a.parentId){let s=o;o=c,c=s}return e.append("rect").style("stroke","black").style("fill","black").attr("width",o).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},Z=(e,a,o,c)=>{let s=0;const g=c.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let h=e.replace(/\r\n/g,"<br/>");h=h.replace(/\n/g,"<br/>");const i=h.split(T.lineBreakRegex);let r=1.25*t().state.noteMargin;for(const y of i){const x=y.trim();if(x.length>0){const d=g.append("tspan");if(d.text(x),r===0){const l=d.node().getBBox();r+=l.height}s+=r,d.attr("x",a+t().state.noteMargin),d.attr("y",o+s+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:s}},K=(e,a)=>{a.attr("class","state-note");const o=a.append("rect").attr("x",0).attr("y",t().state.padding),c=a.append("g"),{textWidth:s,textHeight:g}=Z(e,0,0,c);return o.attr("height",g+2*t().state.noteMargin),o.attr("width",s+t().state.noteMargin*2),o},L=function(e,a){const o=a.id,c={id:o,label:a.id,width:0,height:0},s=e.append("g").attr("id",o).attr("class","stateGroup");a.type==="start"&&O(s),a.type==="end"&&_(s),(a.type==="fork"||a.type==="join")&&q(s,a),a.type==="note"&&K(a.note.text,s),a.type==="divider"&&X(s),a.type==="default"&&a.descriptions.length===0&&J(s,a),a.type==="default"&&a.descriptions.length>0&&Y(s,a);const g=s.node().getBBox();return c.width=g.width+2*t().state.padding,c.height=g.height+2*t().state.padding,c};let A=0;const Q=function(e,a,o){const c=function(r){switch(r){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}};a.points=a.points.filter(r=>!Number.isNaN(r.y));const s=a.points,g=$().x(function(r){return r.x}).y(function(r){return r.y}).curve(v),h=e.append("path").attr("d",g(s)).attr("id","edge"+A).attr("class","transition");let i="";if(t().state.arrowMarkerAbsolute&&(i=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,i=i.replace(/\(/g,"\\("),i=i.replace(/\)/g,"\\)")),h.attr("marker-end","url("+i+"#"+c(N.relationType.DEPENDENCY)+"End)"),o.title!==void 0){const r=e.append("g").attr("class","stateLabel"),{x:y,y:x}=U.calcLabelPosition(a.points),d=T.getRows(o.title);let l=0;const m=[];let w=0,E=0;for(let u=0;u<=d.length;u++){const p=r.append("text").attr("text-anchor","middle").text(d[u]).attr("x",y).attr("y",x+l),f=p.node().getBBox();w=Math.max(w,f.width),E=Math.min(E,f.x),b.info(f.x,y,x+l),l===0&&(l=p.node().getBBox().height,b.info("Title height",l,x)),m.push(p)}let k=l*d.length;if(d.length>1){const u=(d.length-1)*l*.5;m.forEach((p,f)=>p.attr("y",x+f*l-u)),k=l*d.length}const n=r.node().getBBox();r.insert("rect",":first-child").attr("class","box").attr("x",y-w/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",w+t().state.padding).attr("height",k+t().state.padding),b.info(n)}A++};let B;const z={},V=function(){},j=function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},D=function(e,a,o,c){B=t().state;const s=t().securityLevel;let g;s==="sandbox"&&(g=H("#i"+a));const h=s==="sandbox"?H(g.nodes()[0].contentDocument.body):H("body"),i=s==="sandbox"?g.nodes()[0].contentDocument:document;b.debug("Rendering diagram "+e);const r=h.select(`[id='${a}']`);j(r);const y=c.db.getRootDoc();G(y,r,void 0,!1,h,i,c);const x=B.padding,d=r.node().getBBox(),l=d.width+x*2,m=d.height+x*2,w=l*1.75;R(r,m,w,B.useMaxWidth),r.attr("viewBox",`${d.x-B.padding} ${d.y-B.padding} `+l+" "+m)},tt=e=>e?e.length*B.fontSizeFactor:1,G=(e,a,o,c,s,g,h)=>{const i=new C({compound:!0,multigraph:!0});let r,y=!0;for(r=0;r<e.length;r++)if(e[r].stmt==="relation"){y=!1;break}o?i.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:B.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):i.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:B.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),i.setDefaultEdgeLabel(function(){return{}}),h.db.extract(e);const x=h.db.getStates(),d=h.db.getRelations(),l=Object.keys(x);for(const n of l){const u=x[n];o&&(u.parentId=o);let p;if(u.doc){let f=a.append("g").attr("id",u.id).attr("class","stateGroup");p=G(u.doc,f,u.id,!c,s,g,h);{f=I(f,u,c);let S=f.node().getBBox();p.width=S.width,p.height=S.height+B.padding/2,z[u.id]={y:B.compositTitleSize}}}else p=L(a,u);if(u.note){const f={descriptions:[],id:u.id+"-note",note:u.note,type:"note"},S=L(a,f);u.note.position==="left of"?(i.setNode(p.id+"-note",S),i.setNode(p.id,p)):(i.setNode(p.id,p),i.setNode(p.id+"-note",S)),i.setParent(p.id,p.id+"-group"),i.setParent(p.id+"-note",p.id+"-group")}else i.setNode(p.id,p)}b.debug("Count=",i.nodeCount(),i);let m=0;d.forEach(function(n){m++,b.debug("Setting edge",n),i.setEdge(n.id1,n.id2,{relation:n,width:tt(n.title),height:B.labelHeight*T.getRows(n.title).length,labelpos:"c"},"id"+m)}),F(i),b.debug("Graph after layout",i.nodes());const w=a.node();i.nodes().forEach(function(n){n!==void 0&&i.node(n)!==void 0?(b.warn("Node "+n+": "+JSON.stringify(i.node(n))),s.select("#"+w.id+" #"+n).attr("transform","translate("+(i.node(n).x-i.node(n).width/2)+","+(i.node(n).y+(z[n]?z[n].y:0)-i.node(n).height/2)+" )"),s.select("#"+w.id+" #"+n).attr("data-x-shift",i.node(n).x-i.node(n).width/2),g.querySelectorAll("#"+w.id+" #"+n+" .divider").forEach(p=>{const f=p.parentElement;let S=0,M=0;f&&(f.parentElement&&(S=f.parentElement.getBBox().width),M=parseInt(f.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),p.setAttribute("x1",0-M+8),p.setAttribute("x2",S-M-8)})):b.debug("No Node "+n+": "+JSON.stringify(i.node(n)))});let E=w.getBBox();i.edges().forEach(function(n){n!==void 0&&i.edge(n)!==void 0&&(b.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(i.edge(n))),Q(a,i.edge(n),i.edge(n).relation))}),E=w.getBBox();const k={id:o||"root",label:o||"root",width:0,height:0};return k.width=E.width+2*B.padding,k.height=E.height+2*B.padding,b.debug("Doc rendered",k,i),k},et={setConf:V,draw:D},yt={parser:W,db:N,renderer:et,styles:P,init:e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute,N.clear()}};export{yt as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as J,d as B,p as Q,D as X,a as m,b as Z,S as F,c as I}from"./styles-ca3715f6-DaJIsB-N.js";import{G as tt}from"./graph-DvFQr_wY.js";import{l as E,g,d as x,A as et,e as ot,k as w}from"./mermaid.core-DWzpZH_g.js";import{r as st}from"./index-5325376f-CRF6GGjL.js";import"./AuthenticatedApp-BTs4l2pB.js";import"./layout-BMZRkCUf.js";import"./index-Dn-Bbs_z.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./clone-BsR4Dtrm.js";import"./edges-96097737-COVuSxRY.js";import"./createText-1719965b-x3Mhf0Jh.js";import"./line-C99msl9T.js";import"./array-BKyUJesY.js";import"./path-CbwjOpE9.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const h="rect",C="rectWithTitle",nt="start",it="end",ct="divider",rt="roundedWithTitle",lt="note",at="noteGroup",_="statediagram",dt="state",Et=`${_}-${dt}`,H="transition",St="note",pt="note-edge",Tt=`${H} ${pt}`,_t=`${_}-${St}`,ut="cluster",Dt=`${_}-${ut}`,bt="cluster-alt",ft=`${_}-${bt}`,U="parent",V="note",At="state",N="----",ht=`${N}${V}`,M=`${N}${U}`,Y="fill:none",W="fill: #333",z="c",q="text",K="normal";let y={},d=0;const yt=function(t){const n=Object.keys(t);for(const e of n)t[e]},gt=function(t,n){return n.db.extract(n.db.getRootDocV2()),n.db.getClasses()};function $t(t){return t==null?"":t.classes?t.classes.join(" "):""}function R(t="",n=0,e="",i=N){const c=e!==null&&e.length>0?`${i}${e}`:"";return`${At}-${t}${c}-${n}`}const A=(t,n,e,i,c,r)=>{const o=e.id,u=$t(i[o]);if(o!=="root"){let p=h;e.start===!0&&(p=nt),e.start===!1&&(p=it),e.type!==m&&(p=e.type),y[o]||(y[o]={id:o,shape:p,description:w.sanitizeText(o,g()),classes:`${u} ${Et}`});const s=y[o];e.description&&(Array.isArray(s.description)?(s.shape=C,s.description.push(e.description)):s.description.length>0?(s.shape=C,s.description===o?s.description=[e.description]:s.description=[s.description,e.description]):(s.shape=h,s.description=e.description),s.description=w.sanitizeTextOrArray(s.description,g())),s.description.length===1&&s.shape===C&&(s.shape=h),!s.type&&e.doc&&(E.info("Setting cluster for ",o,G(e)),s.type="group",s.dir=G(e),s.shape=e.type===Z?ct:rt,s.classes=s.classes+" "+Dt+" "+(r?ft:""));const T={labelStyle:"",shape:s.shape,labelText:s.description,classes:s.classes,style:"",id:o,dir:s.dir,domId:R(o,d),type:s.type,padding:15};if(T.centerLabel=!0,e.note){const l={labelStyle:"",shape:lt,labelText:e.note.text,classes:_t,style:"",id:o+ht+"-"+d,domId:R(o,d,V),type:s.type,padding:15},a={labelStyle:"",shape:at,labelText:e.note.text,classes:s.classes,style:"",id:o+M,domId:R(o,d,U),type:"group",padding:0};d++;const D=o+M;t.setNode(D,a),t.setNode(l.id,l),t.setNode(o,T),t.setParent(o,D),t.setParent(l.id,D);let S=o,b=l.id;e.note.position==="left of"&&(S=l.id,b=o),t.setEdge(S,b,{arrowhead:"none",arrowType:"",style:Y,labelStyle:"",classes:Tt,arrowheadStyle:W,labelpos:z,labelType:q,thickness:K})}else t.setNode(o,T)}n&&n.id!=="root"&&(E.trace("Setting node ",o," to be child of its parent ",n.id),t.setParent(o,n.id)),e.doc&&(E.trace("Adding nodes children "),xt(t,e,e.doc,i,c,!r))},xt=(t,n,e,i,c,r)=>{E.trace("items",e),e.forEach(o=>{switch(o.stmt){case I:A(t,n,o,i,c,r);break;case m:A(t,n,o,i,c,r);break;case F:{A(t,n,o.state1,i,c,r),A(t,n,o.state2,i,c,r);const u={id:"edge"+d,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:Y,labelStyle:"",label:w.sanitizeText(o.description,g()),arrowheadStyle:W,labelpos:z,labelType:q,thickness:K,classes:H};t.setEdge(o.state1.id,o.state2.id,u,d),d++}break}})},G=(t,n=X)=>{let e=n;if(t.doc)for(let i=0;i<t.doc.length;i++){const c=t.doc[i];c.stmt==="dir"&&(e=c.value)}return e},Ct=async function(t,n,e,i){E.info("Drawing state diagram (v2)",n),y={},i.db.getDirection();const{securityLevel:c,state:r}=g(),o=r.nodeSpacing||50,u=r.rankSpacing||50;E.info(i.db.getRootDocV2()),i.db.extract(i.db.getRootDocV2()),E.info(i.db.getRootDocV2());const p=i.db.getStates(),s=new tt({multigraph:!0,compound:!0}).setGraph({rankdir:G(i.db.getRootDocV2()),nodesep:o,ranksep:u,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});A(s,void 0,i.db.getRootDocV2(),p,i.db,!0);let T;c==="sandbox"&&(T=x("#i"+n));const l=c==="sandbox"?x(T.nodes()[0].contentDocument.body):x("body"),a=l.select(`[id="${n}"]`),D=l.select("#"+n+" g");await st(D,s,["barb"],_,n);const S=8;et.insertTitle(a,"statediagramTitleText",r.titleTopMargin,i.db.getDiagramTitle());const b=a.node().getBBox(),L=b.width+S*2,P=b.height+S*2;a.attr("class",_);const O=a.node().getBBox();ot(a,P,L,r.useMaxWidth);const k=`${O.x-S} ${O.y-S} ${L} ${P}`;E.debug(`viewBox ${k}`),a.attr("viewBox",k);const j=document.querySelectorAll('[id="'+n+'"] .edgeLabel .label');for(const $ of j){const v=$.getBBox(),f=document.createElementNS("http://www.w3.org/2000/svg",h);f.setAttribute("rx",0),f.setAttribute("ry",0),f.setAttribute("width",v.width),f.setAttribute("height",v.height),$.insertBefore(f,$.firstChild)}},Rt={setConf:yt,getClasses:gt,draw:Ct},jt={parser:Q,db:B,renderer:Rt,styles:J,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,B.clear()}};export{jt as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cg as e}from"./AuthenticatedApp-BTs4l2pB.js";import"./vendor-react-BNJ5yonH.js";import"./vendor-state-CBVXPiKY.js";import"./index-Dn-Bbs_z.js";import"./client-build-info-CUyezPn4.js";import"./use-app-preferences-B4K999VJ.js";import"./copy-OJ_6Pvs2.js";import"./WorkspaceApp-DGL3CHCp.js";const p={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")}}},g={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{p as conf,g as language};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d}from"./vendor-react-BNJ5yonH.js";import{f as l,g as H,u as x,b as j,c as F}from"./vendor-state-CBVXPiKY.js";import{bs as P,bS as C,bT as Y,bU as I,bV as G,bW as R,aM as M,aN as W,aO as $,n as S,D as U,bX as V}from"./index-Dn-Bbs_z.js";const i=(e,t)=>new P(e).setA(t).toRgbString(),u=(e,t)=>new P(e).lighten(t).toHexString(),z=e=>{const t=C(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},J=(e,t)=>{const o=e||"#000",r=t||"#fff";return{colorBgBase:o,colorTextBase:r,colorText:i(r,.85),colorTextSecondary:i(r,.65),colorTextTertiary:i(r,.45),colorTextQuaternary:i(r,.25),colorFill:i(r,.18),colorFillSecondary:i(r,.12),colorFillTertiary:i(r,.08),colorFillQuaternary:i(r,.04),colorBgSolid:i(r,.95),colorBgSolidHover:i(r,1),colorBgSolidActive:i(r,.9),colorBgElevated:u(o,12),colorBgContainer:u(o,8),colorBgLayout:u(o,0),colorBgSpotlight:u(o,26),colorBgBlur:i(r,.04),colorBorder:u(o,26),colorBorderSecondary:u(o,19)}},K=(e,t)=>{const o=Object.keys(Y).map(s=>{const a=C(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((c,g,m)=>(c[`${s}-${m+1}`]=a[m],c[`${s}${m+1}`]=a[m],c),{})}).reduce((s,a)=>(s=Object.assign(Object.assign({},s),a),s),{}),r=t??I(e),n=G(e,{generateColorPalettes:z,generateNeutralColorPalettes:J});return Object.assign(Object.assign(Object.assign(Object.assign({},r),o),n),{colorPrimaryBg:n.colorPrimaryBorder,colorPrimaryBgHover:n.colorPrimaryBorderHover})},A={defaultSeed:R.token,defaultAlgorithm:I,darkAlgorithm:K};async function Q(){return M("/api/config")}async function _e(){return M("/api/config/schema")}async function pe(e,t,o,r={}){return W("/api/config",{method:"PATCH",headers:$,body:JSON.stringify({source:e,section:t,value:o,unsetPaths:r.unsetPaths})},"[api] update config failed:")}const Te=l(Number(localStorage.getItem("sidebarWidth"))||300),Ee=l(!1),Ae=l(!1),be=l(!1);l(void 0);const q=e=>e==="light"||e==="dark"||e==="system",h=e=>q(e)?e:"system",b=l("system"),N=l(e=>e(b),(e,t,o)=>{t(b,h(o))}),X=(e,t)=>{try{const o=localStorage.getItem(e);if(o==="true")return!0;if(o==="false")return!1}catch{}return t},O=(e,t)=>{const o=l(X(e,t));return l(r=>r(o),(r,n,s)=>{const a=s===!0;n(o,a);try{localStorage.setItem(e,String(a))}catch{}})},Z=(e,t)=>{try{const o=localStorage.getItem(e);if(o==null||o.trim()==="")return t;const r=Number(o);if(Number.isInteger(r)&&r>=0)return r}catch{}return t},k=(e,t)=>{const o=l(Z(e,t));return l(r=>r(o),(r,n,s)=>{const a=Number.isInteger(s)&&s>=0?s:t;n(o,a);try{localStorage.setItem(e,String(a))}catch{}})},D="oneworks_sender_header_default_display",L=e=>e==="expanded"||e==="collapsed",ee=()=>{try{const e=localStorage.getItem(D);if(e!=null&&L(e))return e}catch{}return"collapsed"},w=l(ee()),we=l(e=>e(w),(e,t,o)=>{const r=L(o)?o:"collapsed";t(w,r);try{localStorage.setItem(D,r)}catch{}}),te="oneworks_show_announcements",oe="oneworks_show_new_session_starter_list",re="oneworks_session_list_search_threshold",se="oneworks_interaction_panel_pinned_tab_limit",ae=5,ne=4,Pe=O(te,!0),Ce=O(oe,!0),Ie=k(re,ae),Me=k(se,ne),ce=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches;function le(){const e=H(N),[t,o]=d.useState(ce);d.useEffect(()=>{if(e!=="system"||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o(n.matches);return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[e]);const r=e==="dark"||e==="system"&&t?"dark":"light";return d.useMemo(()=>({isDarkMode:r==="dark",resolvedThemeMode:r,themeMode:e}),[r,e])}function ie(e){d.useEffect(()=>{const t=window.oneworksDesktop,o=t==null?void 0:t.setThemeSource;if(o==null)return;o(e).catch(()=>{});const r=t==null?void 0:t.updateDesktopSettings;if(r==null)return;let n=!1;return(async()=>{var a;try{const c=await((a=t==null?void 0:t.getDesktopSettings)==null?void 0:a.call(t));if(n||(c==null?void 0:c.iconAppearance)===e)return;await r({iconAppearance:e})}catch{}})(),()=>{n=!0}},[e])}const y="oneworks_theme_primary_color",B=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),de=e=>{var t,o,r,n,s,a;return S(((r=(o=(t=e==null?void 0:e.resolvedSources)==null?void 0:t.global)==null?void 0:o.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))},me=e=>{var o,r,n,s,a,c;const t=((n=(r=(o=e==null?void 0:e.resolvedSources)==null?void 0:o.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 t==null?void 0:h(t)},Ne=e=>{if(!(!B(e)||typeof e.primaryColor!="string"))return S(e.primaryColor)},Oe=e=>{if(B(e))return e.themeMode==null?void 0:h(e.themeMode)},ue=()=>{try{return S(localStorage.getItem(y))}catch{return}},ge=e=>{try{localStorage.setItem(y,e)}catch{}},Se=e=>{const t=document.documentElement.style;t.setProperty("--primary-color",e),t.setProperty("--primary-soft-bg",`color-mix(in srgb, ${e} 12%, var(--bg-color))`),t.setProperty("--primary-text-color",`color-mix(in srgb, ${e} 82%, var(--text-color))`)};function ke(){var f,_,p;const{i18n:e}=x(),t=j(N),{isDarkMode:o,themeMode:r}=le(),[n,s]=d.useState(()=>ue()),{data:a}=F("/api/config",Q),c=(p=(_=(f=a==null?void 0:a.sources)==null?void 0:f.merged)==null?void 0:_.general)==null?void 0:p.interfaceLanguage,g=me(a),m=de(a)??n??U;ie(r),d.useEffect(()=>{const T=E=>{E.key===y&&s(S(E.newValue))};return window.addEventListener("storage",T),()=>window.removeEventListener("storage",T)},[]),d.useEffect(()=>{document.documentElement.classList.toggle("dark",o)},[o]),d.useEffect(()=>{g!=null&&t(g)},[g,t]),d.useEffect(()=>{Se(m),ge(m)},[m]),d.useEffect(()=>{c&&e.language!==c&&V(c)},[e,c]);const v=d.useMemo(()=>({algorithm:o?A.darkAlgorithm:A.defaultAlgorithm,token:{colorPrimary:m}}),[o,m]);return{isDarkMode:o,themeConfig:v}}export{y as T,Q as a,Ne as b,de as c,Oe as d,me as e,ie as f,ue as g,Se as h,N as i,Ee as j,pe as k,Ie as l,Ae as m,h as n,be as o,ge as p,we as q,ke as r,Te as s,A as t,le as u,Pe as v,Ce as w,Me as x,_e as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Et=Object.defineProperty;var Rt=(e,t,r)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var V=(e,t,r)=>Rt(e,typeof t!="symbol"?t+"":t,r);import{r as a,i as Mt,u as kt}from"./vendor-react-BNJ5yonH.js";import{aW as At,aT as Y}from"./index-Dn-Bbs_z.js";import{bO as Tt,aF as st,bP as it,bQ as Ke,bR as _t,bS as wt,X as Ye,aC as Pt,bT as Xe,bU as Ie,k as Ot,_ as Pe,bV as Lt,bW as Wt,bX as qt,bY as Ft,bZ as Nt,b_ as Je,b$ as Ze,c0 as Ht,c1 as Ut,c2 as zt,c3 as $t,c4 as Bt,c5 as Vt,c6 as jt,c7 as Dt}from"./AuthenticatedApp-BTs4l2pB.js";import{u as ut,e as lt,g as Qt,b as Gt}from"./vendor-state-CBVXPiKY.js";const dt="local-user-message:",Kt=6e4,qe=new Map,Le=new Map,Nr=()=>{var t;const e=(t=globalThis.crypto)!=null&&t.randomUUID?globalThis.crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return`${dt}${e}`},Yt=(e,t)=>{const r=qe.get(e)??[];qe.set(e,[...r,t]);const n=Le.get(e);if(n!=null)for(const i of n)i(t)},Xt=e=>{const t=qe.get(e)??[];return qe.delete(e),t},It=(e,t)=>{const r=Le.get(e)??new Set;return r.add(t),Le.set(e,r),()=>{r.delete(t),r.size===0&&Le.delete(e)}},$e=e=>e.role==="user"&&(e.id.startsWith(dt)||e.id.endsWith(Tt)),xe=e=>e.trim().replace(/\s+/g," "),Be=e=>xe(typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
2
|
-
`)),Jt=(e,t)=>e.role==="user"&&t.role==="user"&&Be(e.content)!==""&&Be(e.content)===Be(t.content),Zt=(e,t)=>Jt(e,t)&&t.createdAt>=e.createdAt-Kt,Ve=(e,t)=>{const r=e.filter(m=>!$e(m)),n=m=>r.some(M=>Zt(m,M)),i=e.filter(m=>!$e(m)||!n(m)),f=new Set(i.map(m=>m.id)),C=t.filter(m=>$e(m)&&!f.has(m.id)&&!n(m));return C.length===0?i:[...i,...C].sort((m,M)=>m.createdAt-M.createdAt)},ft=e=>typeof e=="object"&&e!=null&&!Array.isArray(e),ve=e=>typeof e=="string"&&e.trim()!==""?e.trim():void 0,et=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0,tt=e=>{if(!ft(e)||e.type!=="context_compaction"&&e.type!=="contextCompaction")return null;const t=ve(e.id)??`context-compaction-${Date.now()}`,r=et(e.createdAt)??Date.now(),n=et(e.tokenCount),i=ve(e.trigger);return{id:t,createdAt:r,status:"compressing",...n==null?{}:{tokenCount:n},...i==null?{}:{trigger:i}}},mt=e=>{if(e.type!=="adapter_event")return null;const t=tt(e.data);return t??(ft(e.data)?tt(e.data.runtimeEvent):null)},xt=e=>e.type!=="message"?!1:"message"in e&&e.message!=null?e.message.role==="assistant":e.role==="assistant",Fe=e=>e!=null&&e!=="running"&&e!=="waiting_input",Re=e=>e.some(t=>t.status!=="compressed")?e.map(t=>({...t,status:"compressed"})):e,rt=e=>e.reduce((t,r)=>t==null||r.createdAt>=t.createdAt?r:t,null),gt=(e,t)=>{const r=e.filter(n=>n.id!==t.id);return r.push(t),r.sort((n,i)=>n.createdAt-i.createdAt)},Hr=(e,t)=>e.status==="compressed"||Fe(t)?"compressed":"compressing",vt=(e,t)=>{let r=[];for(const n of e){const i=mt(n);if(i!=null){r=gt(r,i);continue}xt(n)&&(r=Re(r))}return Fe(t)&&(r=Re(r)),r},nt="branchSessionId",er=e=>(e==null?void 0:e.messageBranchGroupId)!=null&&e.messageBranchGroupId!=="",tr=(e,t)=>{const r=new Map;for(const n of e)r.set(n.id,n);for(const n of t)n!=null&&n.id!==""&&r.set(n.id,n);return r},rr=(e,t=[])=>{if(e==null||e.id==="")return;const r=tr(t,[e]);let n=e;const i=new Set;for(;(n==null?void 0:n.messageBranchSourceSessionId)!=null&&n.messageBranchSourceSessionId!==""&&!i.has(n.id);){i.add(n.id);const f=r.get(n.messageBranchSourceSessionId);if(f==null)return n.messageBranchSourceSessionId;n=f}return(n==null?void 0:n.id)??e.id},Ur=(e,t,r=[])=>e!=null&&t!=null&&er(e)&&rr(e,r)===t,nr=({currentSearch:e,rootSessionId:t,targetSessionId:r})=>{const n=new URLSearchParams(e);r===t?n.delete(nt):n.set(nt,r);const i=n.toString();return i===""?"":`?${i}`};class cr{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,n){var M;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,...n??{}}),f=this.buildParamsKey(i),C=this.connectionParams.get(t);let m=this.sockets.get(t);return C!=null&&C!==f&&m&&(this.sockets.delete(t),this.closeSocket(m),m=void 0),!m||m.readyState===WebSocket.CLOSED||m.readyState===WebSocket.CLOSING?this.createConnection(t,i):m.readyState===WebSocket.OPEN&&((M=r.onOpen)==null||M.call(r)),this.connectionParams.set(t,f),this.connectionParamValues.set(t,i),()=>this.disconnect(t,r)}createConnection(t,r){const n=st({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)===n&&this.closeSocket(n)},onClose:i=>{this.broadcast(t,"onClose",i),this.sockets.get(t)===n&&(this.sockets.delete(t),this.shouldReconnect(t,i)?this.scheduleReconnect(t):this.reconnectAttempts.delete(t))}},r);this.sockets.set(t,n)}scheduleReconnect(t){if(this.reconnectTimers.has(t))return;const r=this.subscribers.get(t),n=this.connectionParamValues.get(t);if(r==null||r.size===0||n==null){this.reconnectAttempts.delete(t);return}const i=this.reconnectAttempts.get(t)??0,f=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,n)},f))}disconnect(t,r){const n=this.subscribers.get(t);n&&(n.delete(r),n.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,n){const i=this.subscribers.get(t);i&&Array.from(i).forEach(C=>{if(C[r])try{C[r](n)}catch(m){console.error(`Error in ${r} handler for session ${t}:`,m)}})}shouldReconnect(t,r){const n=this.subscribers.get(t);return n==null?!1:Array.from(n).every(i=>{var f;return((f=i.shouldReconnect)==null?void 0:f.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 n=this.sockets.get(t);return n&&n.readyState===WebSocket.OPEN?(n.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,[n,i])=>{if(i==null)return r;const f=String(i).trim();return f===""||(r[n]=f),r},{})}buildParamsKey(t){return Object.entries(t).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${r}=${n}`).join("&")}closeSocket(t){t.readyState===WebSocket.CLOSED||t.readyState===WebSocket.CLOSING||t.close()}}const be=new cr,or=27,ar=e=>{let t="",r=0;for(;r<e.length;){if(e.charCodeAt(r)===or&&e[r+1]==="["){for(r+=2;r<e.length;){const n=e.charCodeAt(r);if(n>=64&&n<=126){r+=1;break}r+=1}continue}t+=e[r],r+=1}return t},ct=e=>ar(e).trim(),pt=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 n=ct(r);if(n!=="")return{message:n,code:t}}}if(typeof e.message=="string"){const r=ct(e.message);if(r!=="")return{message:r,code:t}}return null},St=(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},sr=(e,t,r)=>{let n=null;for(const i of e)n=St(n,i);return n!=null?r==null||r==="waiting_input"?n:null:r==="waiting_input"?t:null},ir=e=>{for(let t=e.length-1;t>=0;t-=1){const r=pt(e[t]);if(r!=null)return r}return null},ur=20,Ne=e=>({creationProgress:(e==null?void 0:e.creationProgress)??[],messages:(e==null?void 0:e.messages)??[],sessionInfo:(e==null?void 0:e.sessionInfo)??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}),lr=(e,t)=>Ne({...Ne(e),...t}),dr=e=>{const t=Ne(e),r=t.isHydrated===!0?t:Ne();return{creationProgress:r.creationProgress,messages:r.messages,sessionInfo:r.sessionInfo,sessionCompactionInfo:r.sessionCompactionInfo,sessionCompactionEvents:r.sessionCompactionEvents,sessionWorkspaceChanges:r.sessionWorkspaceChanges,queuedMessages:r.queuedMessages,errorState:r.errorState,interactionRequest:r.interactionRequest,isReady:r.isHydrated}},fr=(e,t,r)=>{const n=lr(e.get(t),r);for(e.has(t)&&e.delete(t),e.set(t,n);e.size>ur;){const i=e.keys().next().value;if(i==null)break;e.delete(i)}return n},mr=(e,t)=>{e.delete(t)},Oe={steer:[],next:[]},gr=2,We=new Map,Ee=(e,t)=>{const r=We.get(e);if(r!=null)for(const n of r)n(t)},pr=(e,t)=>{const r=We.get(e)??new Set;return r.add(t),We.set(e,r),()=>{r.delete(t),r.size===0&&We.delete(e)}},Sr=e=>e==="user"||e==="assistant"||e==="system",hr=e=>e.type==="message"&&!("message"in e),ot=e=>{const t=typeof e.createdAt=="number"?e.createdAt:e.ts;return typeof t=="number"?t:Date.now()},Qe=e=>typeof e=="object"&&e!=null&&!Array.isArray(e),x=(e,t)=>typeof e[t]=="string"&&e[t]!==""?e[t]:void 0,yr=(e,t)=>e==null?t:e==="ui"||e==="user"?t??"user":e,Ge=e=>{if(!Qe(e))return;const t=x(e,"commandId"),r=x(e,"causedByCommandId"),n=yr(x(e,"source"),t!=null||r!=null?"leader":void 0),i=x(e,"sourceLabel"),f=x(e,"roomId"),C=x(e,"hostSessionId"),m=x(e,"memberKey"),M=x(e,"runKey")??x(e,"runId"),$={...n!=null?{source:n}:{},...i!=null?{sourceLabel:i}:{},...f!=null?{roomId:f}:{},...C!=null?{hostSessionId:C}:{},...m!=null?{memberKey:m}:{},...M!=null?{runKey:M}:{},...t!=null?{commandId:t}:{},...r!=null?{causedByCommandId:r}:{}};return Object.keys($).length===0?void 0:$},Cr=(e,t)=>Ge(e.agentRoom)??Ge(e)??(t==null?void 0:t.agentRoom),br=e=>{if(!(e.type!=="adapter_event"||!Qe(e.data)))return Qe(e.data.runtimeEvent)?e.data.runtimeEvent:void 0},Er=e=>{const t=br(e);if(!(t==null||t.type!=="command_ack"))return Ge(t)},ht=(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(!hr(e)||!Sr(e.role)||typeof e.content!="string"&&!Array.isArray(e.content))return null;const r=Cr(e,t);return{id:typeof e.id=="string"&&e.id!==""?e.id:`runtime-message-${ot(e)}`,role:e.role,content:e.content,...r!=null?{agentRoom:r}:{},model:typeof e.model=="string"?e.model:void 0,createdAt:ot(e)}},Rr=e=>{let t=[],r;for(const n of e)r=Er(n)??r,t=yt(t,n,r!=null?{agentRoom:r}:void 0),t=Ct(t,n),n.type==="message"&&(r=void 0);return t},Mr=(e,t)=>!t||(e==null?void 0:e.id)==null||e.id===""||e.parentSessionId!=null&&e.parentSessionId!==""?!1:e.status==="waiting_input",je=({activeSessionId:e,appliedRequestSeq:t,requestSeq:r,sessionId:n})=>e===n&&r>=t,kr=e=>800*2**e,yt=(e,t,r)=>{const n=ht(t,r);return n==null?e:e.find(f=>f.id===n.id)!=null?e.map(f=>f.id===n.id?n:f):[...e,n]},Ar=e=>{var t;return((t=e.toolCall)==null?void 0:t.id)??e.id},Ct=(e,t)=>{if(t.type!=="tool_result")return e;const r=t.isError===!0?"error":"success";return e.map(n=>n.toolCall!=null&&Ar(n)===t.toolCallId?{...n,toolCall:{...n.toolCall,status:r,output:t.output}}:n)},at=(e,t)=>t.type!=="session_creation_progress"?e:[...e,t.progress],bt=(e,t)=>(e.some(n=>n.id===t.id)?e.map(n=>n.id===t.id?t:n):[...e,t]).sort((n,i)=>{const f=n.createdAt-i.createdAt;return f!==0?f:n.id.localeCompare(i.id)}),Tr=e=>e.reduce((t,r)=>r.type!=="workspace_changes"?t:bt(t,r.changes),[]);function zr({session:e,modelForQuery:t,effort:r,permissionMode:n,adapter:i,account:f,optimisticCreation:C,setInteractionRequest:m}){const{t:M}=ut(),{mutate:$}=lt(),[Me,j]=a.useState([]),[ke,k]=a.useState([]),[oe,X]=a.useState(null),[He,v]=a.useState(null),[h,p]=a.useState([]),[me,D]=a.useState([]),[ae,se]=a.useState({steer:[],next:[]}),[Ue,F]=a.useState(!1),[ge,_]=a.useState(null),[pe,Ae]=a.useState(0),Q=a.useRef(!0),ie=a.useRef(void 0),z=a.useRef(void 0),y=a.useRef(void 0),Se=a.useRef(void 0),ue=a.useRef(void 0),I=a.useRef(e==null?void 0:e.status),w=a.useRef(!1),O=a.useRef(!1),P=a.useRef(null),W=a.useRef(e==null?void 0:e.id),ee=a.useRef(0),G=a.useRef(0),te=a.useRef([]),re=a.useRef([]),J=a.useRef(new Map),N=a.useRef([]);W.current=e==null?void 0:e.id;const S=a.useCallback((u,d)=>fr(J.current,u,d),[]),Te=a.useCallback(u=>{mr(J.current,u)},[]),_e=a.useCallback((u,d=W.current)=>{N.current=u,p(u);const b=rt(u);v(b),d!=null&&d!==""&&S(d,{sessionCompactionEvents:u,sessionCompactionInfo:b})},[S]),ne=a.useCallback(u=>{const d=N.current,b=u(d);b!==d&&_e(b)},[_e]),we=a.useCallback(u=>{j(d=>{const b=typeof u=="function"?u(d):u,o=W.current;if(o!=null&&o!==""){const c=J.current.get(o);S(o,{messages:b,isHydrated:(c==null?void 0:c.isHydrated)===!0})}return b})},[S]),le=a.useCallback(u=>{j(d=>{const b=typeof u=="function"?u(d):u,o=Ve(b,d),c=W.current;if(c!=null&&c!==""){const s=J.current.get(c);S(c,{messages:o,isHydrated:(s==null?void 0:s.isHydrated)===!0})}return o})},[S]),H=a.useCallback((u,d=W.current)=>{se(u),d!=null&&d!==""&&S(d,{queuedMessages:u})},[S]),Z=a.useCallback(()=>{for(const u of te.current)clearTimeout(u);te.current=[]},[]),ce=a.useCallback(()=>{for(const u of re.current)clearTimeout(u);re.current=[]},[]),K=a.useCallback(async(u={})=>{var o,c,s,g;const d=W.current;if(d==null||d==="")return;const b=++ee.current;try{const E=await it(d);if(!je({activeSessionId:W.current,appliedRequestSeq:G.current,requestSeq:b,sessionId:d}))return;G.current=b,ce();const T=E.messages;E.session&&Ke($,E.session);const q=Rr(T),U=vt(T,(o=E.session)==null?void 0:o.status),de=rt(U),Ce=Tr(T);let he=[],B=null;const l=sr(T,E.interaction??null,(c=E.session)==null?void 0:c.status),L=ir(T),fe=l==null&&((s=E.session)==null?void 0:s.status)==="failed"&&L!=null?{kind:"session",message:L.message,code:L.code}:null,R=E.queuedMessages??Oe;P.current=l,m(l),H(R,d),_(fe);for(const A of T)he=at(he,A),A.type==="session_info"&&A.info!=null&&A.info.type!=="summary"&&(B=A.info);S(d,{messages:q,creationProgress:he,sessionInfo:B,sessionCompactionInfo:de,sessionCompactionEvents:U,sessionWorkspaceChanges:Ce,queuedMessages:R,errorState:fe,interactionRequest:l,isHydrated:!0}),le(q),k(he),X(B),v(de),N.current=U,p(U),D(Ce),u.updateReadiness!==!1&&setTimeout(()=>{je({activeSessionId:W.current,appliedRequestSeq:G.current,requestSeq:b,sessionId:d})&&(F(!0),Q.current=!1)},100)}catch(E){if(!je({activeSessionId:W.current,appliedRequestSeq:G.current,requestSeq:b,sessionId:d})||((g=J.current.get(d))==null?void 0:g.isHydrated)===!0)return;console.error("Failed to fetch history messages:",E);const T=u.retryAttempt??0;if(T<gr){const U=globalThis.setTimeout(()=>{re.current=re.current.filter(de=>de!==U),K({...u,retryAttempt:T+1})},kr(T));re.current.push(U);return}const q={kind:"connection",message:M("chat.historyLoadFailed"),recoverable:!0,reason:"error"};_(q),S(d,{errorState:q}),u.updateReadiness!==!1&&(F(!0),Q.current=!1)}},[H,ce,$,m,le,M,S]),ye=a.useCallback(()=>{Z();for(const u of[0,800,2400,5e3,9e3,15e3]){const d=globalThis.setTimeout(()=>{K({updateReadiness:!1})},u);te.current.push(d)}},[Z,K]),ze=a.useCallback(()=>{(e==null?void 0:e.id)==null||e.id===""||(w.current=!0,O.current=!1,_(null),S(e.id,{errorState:null}),be.close(e.id),Ae(u=>u+1))},[e==null?void 0:e.id,S]);return a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){ee.current+=1,G.current=ee.current,ce(),j([]),k([]),X(null),v(null),N.current=[],p([]),D([]),se(Oe),F(!0),_(null),m(null),P.current=null,Q.current=!0,ie.current=void 0,z.current=void 0,y.current=void 0,Se.current=void 0,ue.current=void 0,O.current=!1,Z();return}if(C!=null){Z(),ee.current+=1,G.current=ee.current,ce();const c=[C.message],s=C.status==="failed"?{action:"retry-session-creation",code:"session_create_failed",kind:"session",message:C.errorMessage??M("chat.sessionCreateFailedMessage")}:null;P.current=null,m(null),j(c),X(null),v(null),N.current=[],p([]),D([]),se(Oe),_(s),F(!0),Q.current=!1,S(e.id,{messages:c,sessionInfo:null,sessionCompactionInfo:null,sessionCompactionEvents:[],sessionWorkspaceChanges:[],queuedMessages:Oe,errorState:s,interactionRequest:null,isHydrated:!0});return}const u=dr(J.current.get(e.id)),d=Xt(e.id),b=d.length>0,o=Ve(u.messages,d);return j(o),k(u.creationProgress),X(u.sessionInfo),v(u.sessionCompactionInfo),N.current=u.sessionCompactionEvents,p(u.sessionCompactionEvents),D(u.sessionWorkspaceChanges),se(u.queuedMessages),_(u.errorState),m(u.interactionRequest),P.current=u.interactionRequest,F(u.isReady||b),Q.current=!(u.isReady||b),b&&S(e.id,{messages:o,isHydrated:u.isReady||b}),K(),()=>{Z(),ce()}},[ce,Z,C,K,e==null?void 0:e.id,m,M,S]),a.useEffect(()=>{if(!((e==null?void 0:e.id)==null||e.id===""))return pr(e.id,u=>{H(u,e.id)})},[H,e==null?void 0:e.id]),a.useEffect(()=>{if(!((e==null?void 0:e.id)==null||e.id===""))return It(e.id,u=>{le(d=>Ve(d,[u]))})},[e==null?void 0:e.id,le]),a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){I.current=void 0;return}if(C!=null){I.current=e.status;return}const u=I.current;I.current=e.status,!(u==null||u===e.status)&&(Fe(e.status)&&ne(Re),K({updateReadiness:!1}))},[C,K,e==null?void 0:e.id,e==null?void 0:e.status,ne]),a.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id==="")return;if(C!=null){w.current=!0,O.current=!1,be.close(e.id);return}let u=!1,d;const b=t??"",o=t!=null&&ie.current!=null&&b!==ie.current&&(e==null?void 0:e.status)!=="running",c=r==="default"?"":r,s=z.current!=null&&c!==z.current&&(e==null?void 0:e.status)!=="running",g=n??"",E=i??"",T=i!=null&&Se.current!=null&&E!==Se.current&&(e==null?void 0:e.status)!=="running",q=f??"",U=f!=null&&ue.current!=null&&q!==ue.current&&(e==null?void 0:e.status)!=="running",Ce=Mr(e,o||s||T||U);Ce&&(w.current=!0,O.current=!1,_(null),be.send(e.id,{type:"terminate_session"}),be.close(e.id)),ie.current=b,z.current=c,y.current=g,Se.current=E,ue.current=q;const he=setTimeout(()=>{if(u)return;const B={};t&&(B.model=t),r!=="default"&&(B.effort=r),n&&(B.permissionMode=n),i&&(B.adapter=i),f&&(B.account=f),d=be.connect(e.id,{onOpen(){w.current=!1,O.current=!1,_(l=>{const L=(l==null?void 0:l.kind)==="session"?l:null;return S(e.id,{errorState:L}),L})},onMessage(l){if(u)return;const L=St(P.current,l);if(L!==P.current&&(P.current=L,m(L),S(e.id,{interactionRequest:L}),L!=null&&(_(null),S(e.id,{errorState:null}))),l.type==="interaction_response"){ye();return}if(l.type==="error"){const R=pt(l);if(R!=null){O.current=!0;const A={kind:"session",message:R.message,code:R.code};_(A),S(e.id,{errorState:A})}return}if(l.type==="session_updated"){const R=l.session;_t(R)?Te(R.id):Fe(R.status)&&ne(Re),Ke($,R);return}if(l.type==="session_queue_updated"){H(l.queue,e.id);return}if(l.type==="message"){const R=ht(l);(R==null?void 0:R.role)==="assistant"&&ne(Re),le(A=>yt(A,l));return}if(l.type==="session_creation_progress"){k(R=>{const A=at(R,l);return S(e.id,{creationProgress:A}),A});return}if(l.type==="workspace_changes"){D(R=>{const A=bt(R,l.changes);return S(e.id,{sessionWorkspaceChanges:A}),A});return}if(l.type==="session_info"){l.info!=null&&l.info.type==="summary"?$("/api/sessions"):(X(l.info??null),S(e.id,{sessionInfo:l.info??null}),Q.current&&setTimeout(()=>{u||Q.current&&(F(!0),Q.current=!1)},100));return}const fe=mt(l);if(fe!=null){ne(R=>gt(R,fe));return}if(l.type==="tool_result"){we(R=>Ct(R,l));return}l.type==="interaction_request"&&(P.current=l,m(l),S(e.id,{interactionRequest:l}))},onError(){if(u)return;const l={kind:"connection",message:M("chat.connectionError"),reason:"error"};_(l),S(e.id,{errorState:l})},onClose(l){if(u)return;if(w.current){w.current=!1;return}const L=l.code===1008&&l.reason==="Login required",fe=!O.current&&l.code!==1e3&&l.code!==1008;_(R=>{const A=R??{...L?{code:"auth_required"}:{},kind:"connection",message:L?M("chat.connectionAuthRequired"):l.reason||M("chat.connectionClosed"),recoverable:fe,reason:"closed"};return S(e.id,{errorState:A}),A})},shouldReconnect(l){return w.current||O.current?!1:l.code!==1e3&&l.code!==1008}},Object.keys(B).length>0?B:void 0)},Ce?200:100);return()=>{u=!0,clearTimeout(he),d==null||d()}},[i,f,H,Z,r,t,$,C,n,ye,pe,K,e==null?void 0:e.id,e==null?void 0:e.status,m,M,Te,ne,S]),{messages:Me,creationProgress:ke,setMessages:we,sessionInfo:oe,sessionCompactionInfo:He,sessionCompactionEvents:h,sessionWorkspaceChanges:me,queuedMessages:ae,isReady:Ue,errorState:ge,retryConnection:ze,reconcileAfterInteraction:ye}}const _r=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()}},De=new Set,wr=3e4,Pr=(e,t)=>{if(e!=null&&t)return e.createWorktree?{createWorktree:!0,worktreeEnvironment:e.worktreeEnvironment,branch:e.branch}:{createWorktree:!1}};function $r({canonicalSessionId:e,session:t,modelForQuery:r,hasAvailableModels:n,effort:i,permissionMode:f,adapter:C,account:m,workspaceSourceSessionId:M,navigateOnCreate:$=!0,collapseSenderHeaderOnCreate:Me=!0,onSessionCreated:j,sessionTargetDraft:ke,sessionCreationContext:k,workspaceDraft:oe,workspaceDraftDirty:X,workspaceConfigReady:He,onClearMessages:v}){const{message:h}=At.useApp(),{t:p}=ut(),me=Mt(),D=kt(),{mutate:ae}=lt(),{setHeaderCollapsed:se}=wt(),Ue=Qt(Ye),F=Gt(Ye),[ge,_]=a.useState(!1),[pe,Ae]=a.useState(),[Q,ie]=a.useState([]),z=ge||(t==null?void 0:t.status)==="running",y=Pt(t,Ue),Se=pe!=null&&pe===(t==null?void 0:t.id),ue=(oe==null?void 0:oe.createWorktree)===!0||X!==!0&&He!==!0,I=a.useCallback((o,c,s={})=>{const g=new URLSearchParams(D.search);if(c!=null)for(const[E,T]of Object.entries(c))T===""?g.delete(E):g.set(E,T);me({pathname:o,search:g.toString()===""?"":`?${g.toString()}`},{replace:s.replace})},[D.search,me]);a.useCallback((o,c={})=>{I(o,void 0,c)},[I]);const w=a.useCallback(async o=>{await ae("/api/sessions",c=>{if(!(c!=null&&c.sessions))return{sessions:[o]};const s=c.sessions.filter(g=>g.id!==o.id);return{...c,sessions:[o,...s]}},!1)},[ae]),O=a.useCallback(async o=>{await ae("/api/sessions",c=>(c==null?void 0:c.sessions)==null?c:{...c,sessions:Xe(c.sessions,o)},!1),await ae("/api/sessions/archived",c=>(c==null?void 0:c.sessions)==null?c:{...c,sessions:Xe(c.sessions,o)},!1)},[ae]),P=a.useCallback(o=>{F(c=>{if(c[o]==null)return c;const s={...c};return delete s[o],s})},[F]),W=a.useCallback((o,c)=>{F(s=>{const g=s[o];return g==null?s:{...s,[o]:c(g)}})},[F]),ee=a.useCallback(async o=>{try{return(await it(o)).session}catch(c){console.warn("Failed to verify optimistic session creation state:",c);return}},[]),G=a.useCallback(async o=>{if(Ie(o.id)){P(o.id),await O(o.id);try{await Ot(o.id,{force:!0})}catch(c){console.warn("Failed to delete discarded optimistic session:",c)}finally{Pe(o.id)}return!1}return await w(o),P(o.id),Pe(o.id),Me&&se(!0),!0},[Me,w,P,O,se]),te=a.useCallback(o=>{const c=Lt(ke),s=Pr(oe,X===!0);return{id:o,...c,effort:i==="default"?void 0:i,permissionMode:f,parentSessionId:M,adapter:C,account:m,tags:k==null?void 0:k.tags,workspace:M==null?s:{...s,sourceSessionId:M,createWorktree:!1}}},[m,C,i,f,k==null?void 0:k.tags,ke,M,oe,X]),re=a.useCallback(o=>{let c,s=!1,g;const E=q=>{s||(s=!0,g!=null&&clearTimeout(g),q())};return{ready:new Promise(q=>{g=setTimeout(()=>E(q),750),c=st({onOpen:()=>E(q),onError:()=>E(q),onMessage:U=>{U.type!=="session_creation_progress"||U.sessionId!==o||ie(de=>[...de,U.progress])}},{subscribe:"sessions"})}),close:()=>_r(c)}},[]),J=a.useCallback(async o=>{const c=new AbortController,s=setTimeout(()=>{c.abort()},wr);try{return await Wt(o.title,o.initialMessage,o.initialContent,o.model,o.options,{signal:c.signal})}finally{clearTimeout(s)}},[]),N=a.useCallback(async o=>{if(De.has(o.id))return!1;De.add(o.id);let c;ie([]);try{c=ue?re(o.id):void 0,await(c==null?void 0:c.ready);const{session:s}=await J(o);return await G(s)}catch(s){console.error(s);const g=await ee(o.id);if(g!=null)return await G(g);if(Ie(o.id))return P(o.id),await O(o.id),Pe(o.id),!1;const E=Y(s,p("chat.sessionCreateFailedMessage"));return W(o.id,T=>qt(T,E)),!1}finally{De.delete(o.id),c==null||c.close()}},[J,G,re,P,O,ee,ue,p,W]),S=a.useCallback(o=>{const c=Ft(o);Pe(c.session.id),_(!0),F(s=>({...s,[c.session.id]:c})),Yt(c.session.id,c.message),w(c.session),j==null||j(c.session),N(o),$&&I(`/session/${c.session.id}`,{senderHeader:"collapsed"})},[w,$,I,j,N,F]);a.useEffect(()=>{(y==null?void 0:y.status)==="creating"&&N(y.request)},[y==null?void 0:y.request,y==null?void 0:y.status,N]);const Te=a.useCallback(async()=>y==null?!1:(W(y.session.id,Nt),w({...y.session,status:"running"}),await N(y.request)),[w,y,N,W]);a.useEffect(()=>{!ge||(t==null?void 0:t.id)==null||t.id===""||_(!1)},[ge,t==null?void 0:t.id]);const _e=a.useCallback(async(o,c)=>{if(o.trim()===""||z)return!1;if(!n)return h.warning(p("chat.modelConfigRequired")),!1;if(y!=null)return h.warning(p("chat.retrySessionCreationRequired")),!1;if(!(t!=null&&t.id)){const s=Je();return S({id:s,title:k==null?void 0:k.title,initialMessage:o.trim(),model:r,options:te(s)}),!0}try{return await Ze(t.id,o.trim(),{permissionMode:f}),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[te,n,z,h,r,y,f,k==null?void 0:k.title,t==null?void 0:t.id,S,p]),ne=a.useCallback(async(o,c)=>{if(o.length===0||z)return!1;if(!n)return h.warning(p("chat.modelConfigRequired")),!1;if(y!=null)return h.warning(p("chat.retrySessionCreationRequired")),!1;if(!(t!=null&&t.id)){const s=Je();return S({id:s,title:k==null?void 0:k.title,initialContent:o,model:r,options:te(s)}),!0}try{return await Ze(t.id,o,{permissionMode:f}),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[te,n,z,h,r,y,f,k==null?void 0:k.title,t==null?void 0:t.id,S,p]),we=a.useCallback(async()=>{if(!(t!=null&&t.id)||z===!1||pe===t.id)return;const o=t.id,c=`chat-session-stop-${o}`,s=(y==null?void 0:y.status)==="creating";Ae(o),h.open({type:"loading",content:p("chat.sessionStoppingMessage"),duration:0,key:c});try{await Ht(o),h.success({content:p("chat.sessionStopRequestedMessage"),duration:1.6,key:c}),s&&(Ut(o),P(o),await O(o),_(!1))}catch(g){console.error(g),h.error({content:Y(g,p("chat.sessionStopFailedMessage")),duration:3,key:c})}finally{Ae(g=>g===o?void 0:g)}},[z,h,y==null?void 0:y.status,P,O,t==null?void 0:t.id,p,pe]),le=a.useCallback(()=>{v(),h.success("Messages cleared")},[h,v]),H=a.useCallback(async(o,c,s)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{session:g}=await zt(t.id,o,c,s);await w(g);const E=e??t.id;return me({pathname:`/session/${E}`,search:nr({currentSearch:D.search,rootSessionId:E,targetSessionId:g.id})},{replace:c==="edit"}),!0}catch(g){return console.error(g),h.error(Y(g,p("common.operationFailed"))),!1}},[e,w,D.search,h,me,t==null?void 0:t.id,p]),Z=a.useCallback(o=>H(o,"fork"),[H]),ce=a.useCallback(o=>H(o,"recall"),[H]),K=a.useCallback((o,c)=>H(o,"edit",{content:c}),[H]),ye=a.useCallback(async(o,c)=>{if((t==null?void 0:t.id)==null||t.id===""||c.length===0)return!1;try{const{queuedMessages:s}=await $t(t.id,o,c);return Ee(t.id,s),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,p]),ze=a.useCallback(async(o,c)=>{if((t==null?void 0:t.id)==null||t.id===""||c.length===0)return!1;try{const{queuedMessages:s}=await Bt(t.id,o,c);return Ee(t.id,s),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,p]),u=a.useCallback(async o=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:c}=await Vt(t.id,o);return Ee(t.id,c),!0}catch(c){return console.error(c),h.error(Y(c,p("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,p]),d=a.useCallback(async(o,c)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:s}=await jt(t.id,o,c);return Ee(t.id,s),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,p]),b=a.useCallback(async(o,c)=>{if((t==null?void 0:t.id)==null||t.id==="")return!1;try{const{queuedMessages:s}=await Dt(t.id,o,c);return Ee(t.id,s),!0}catch(s){return console.error(s),h.error(Y(s,p("common.operationFailed"))),!1}},[h,t==null?void 0:t.id,p]);return{creationProgress:Q,isCreating:ge,isStopping:Se,isThinking:z,send:_e,sendContent:ne,retrySessionCreation:Te,enqueueContent:ye,updateQueuedContent:ze,removeQueuedContent:u,moveQueuedContent:d,reorderQueuedContent:b,editMessage:K,forkMessage:Z,interrupt:we,clearMessages:le,recallMessage:ce}}export{nt as M,Ur as a,Hr as b,be as c,nr as d,Nr as e,zr as f,er as i,rr as r,$r as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as b,j as o}from"./vendor-react-BNJ5yonH.js";import"./workspace-file-openers-DAuX65xw.js";import{e as R,B as A,T as D}from"./client-build-info-CUyezPn4.js";import{u as M}from"./vendor-state-CBVXPiKY.js";import{bM as g,n as O,D as H}from"./index-Dn-Bbs_z.js";import{S as $,b as L}from"./copy-OJ_6Pvs2.js";const N=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),w=e=>typeof e=="string"&&e.trim()!==""?e.trim():void 0,T=e=>{if(!N(e))return;const t=w(e.branch),s=w(e.buildTime),a=w(e.gitHash);if(!(t==null||s==null||a==null))return{branch:t,buildTime:s,gitHash:a}},z=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},ae=({value:e})=>{const{t}=M(),s=window.oneworksDesktop,[a,c]=b.useState(!1),[r,l]=b.useState(),i=e!=null&&typeof e=="object"?e:void 0,n=i==null?void 0:i.urls,u=i==null?void 0:i.version,d=R(),m=A(),_=i==null?void 0:i.lastReleaseAt,f=r==null?void 0:z(r.buildTime);return b.useEffect(()=>{var h,y;let j=!1;const S=(h=s==null?void 0:s.getDesktopSettings)==null?void 0:h.call(s);if(S==null){l(void 0);return}S.then(p=>{j||l(T(N(p)?p.buildSource:void 0))}).catch(p=>{console.error("[config-about] failed to load desktop build source",p),j||l(void 0)});const x=(y=s==null?void 0:s.onDesktopSettingsChange)==null?void 0:y.call(s,p=>{l(T(N(p)?p.buildSource:void 0))});return()=>{j=!0,x==null||x()}},[s]),o.jsxs("div",{className:"config-about",children:[o.jsxs("div",{className:"config-about__card",children:[o.jsxs("div",{className:"config-about__app",children:[o.jsx("div",{className:"config-about__app-icon",children:o.jsx("span",{className:"material-symbols-rounded",children:"auto_awesome"})}),o.jsxs("div",{className:"config-about__app-info",children:[o.jsx("div",{className:"config-about__app-title",children:t("config.about.software")}),o.jsxs("div",{className:"config-about__app-meta",children:[o.jsxs("span",{className:"config-about__app-version",title:t("config.about.commitHash"),onDoubleClick:()=>c(!0),children:[t("config.about.clientVersion"),": ",d]}),a&&o.jsxs("span",{className:"config-about__app-commit",children:[t("config.about.commitHash"),": ",m??t("config.about.unknown")]}),o.jsxs("span",{className:"config-about__app-server-version",children:[t("config.about.serverVersion"),": ",u??t("config.about.unknown")]}),o.jsx("span",{className:"config-about__app-date",children:_??t("config.about.unknown")})]})]})]}),o.jsx("a",{className:"config-about__primary",href:(n==null?void 0:n.releases)??(n==null?void 0:n.repo),target:"_blank",rel:"noreferrer",children:t("config.about.checkUpdate")})]}),o.jsxs("div",{className:"config-about__list",children:[o.jsxs("a",{className:"config-about__item-row",href:(n==null?void 0:n.docs)??(n==null?void 0:n.repo),target:"_blank",rel:"noreferrer",children:[o.jsxs("span",{className:"config-about__item-left",children:[o.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"menu_book"}),o.jsx("span",{children:t("config.about.docs")})]}),o.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),o.jsxs("a",{className:"config-about__item-row",href:(n==null?void 0:n.contact)??(n==null?void 0:n.repo),target:"_blank",rel:"noreferrer",children:[o.jsxs("span",{className:"config-about__item-left",children:[o.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"mail"}),o.jsx("span",{children:t("config.about.contact")})]}),o.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),o.jsxs("a",{className:"config-about__item-row",href:(n==null?void 0:n.issues)??(n==null?void 0:n.repo),target:"_blank",rel:"noreferrer",children:[o.jsxs("span",{className:"config-about__item-left",children:[o.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"bug_report"}),o.jsx("span",{children:t("config.about.feedback")})]}),o.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]})]}),r!=null&&o.jsxs("div",{className:"config-about__build-source",children:[o.jsxs("div",{className:"config-about__build-source-title",children:[o.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"commit"}),o.jsx("span",{children:t("config.about.buildSource.title")})]}),o.jsxs("div",{className:"config-about__build-source-list",children:[o.jsxs("div",{className:"config-about__build-source-row",children:[o.jsx("span",{children:t("config.about.buildSource.gitHash")}),o.jsx("code",{title:r.gitHash,children:r.gitHash})]}),o.jsxs("div",{className:"config-about__build-source-row",children:[o.jsx("span",{children:t("config.about.buildSource.branch")}),o.jsx("code",{title:r.branch,children:r.branch})]}),o.jsxs("div",{className:"config-about__build-source-row",children:[o.jsx("span",{children:t("config.about.buildSource.buildTime")}),o.jsx("code",{title:r.buildTime,children:f??r.buildTime})]})]})]})]})},U=["industrial","metal","matrix"],W=["system","light","dark"],k=["transparent","solid","textured"],v="metal",I="system",C="solid",P=!0,V=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),F=e=>typeof e=="string"&&U.includes(e),G=e=>typeof e=="string"&&W.includes(e),K=e=>typeof e=="boolean",B=e=>e===!1?"transparent":e===!0?C:typeof e=="string"&&k.includes(e)?e:C,E=e=>V(e)?{iconAppearance:G(e.iconAppearance)?e.iconAppearance:I,iconBackground:B(e.iconBackground),syncAppIcon:K(e.syncAppIcon)?e.syncAppIcon:P,iconTheme:F(e.iconTheme)?e.iconTheme:v}:{iconAppearance:I,iconBackground:C,syncAppIcon:P,iconTheme:v},Y={transparent:"opacity",solid:"circle",textured:"texture"};function le({canUpdateDesktopIcon:e,backgroundAriaLabel:t,backgroundOptionTranslationPrefix:s="config.appSettings.projectThemeColor.backgroundStyle.options",iconBackground:a,previewSources:c,saving:r,selectedTheme:l,showBackgroundControls:i=!0,syncAppIcon:n,syncAppIconDescription:u,syncAppIconLabel:d,t:m,themeAriaLabel:_,onIconBackgroundChange:f,onSyncAppIconChange:j,onThemeChange:S}){const x=Math.max(0,g.findIndex(h=>h.theme===l));return o.jsx("div",{className:"config-view__project-theme-settings",children:o.jsxs("div",{className:"config-view__project-theme-controls",children:[o.jsxs("div",{className:"config-view__project-theme-picker",children:[o.jsx("div",{className:"config-view__project-theme-radio-group",role:"radiogroup","aria-label":_,style:{"--config-project-theme-active-index":x},children:g.map(h=>{const y=h.theme===l,p=m(`config.desktopSettings.appIcon.themeOptions.${h.theme}`);return o.jsx(D,{title:p,children:o.jsx("button",{type:"button",className:`config-view__project-theme-radio${y?" is-active":""}`,"aria-checked":y,"aria-label":p,role:"radio",disabled:r,onClick:()=>S(h.theme),children:o.jsx("span",{className:"config-view__project-theme-radio-icon","aria-hidden":"true",children:o.jsx("img",{className:"config-view__project-theme-radio-image",src:c[h.theme],alt:""})})})},h.theme)})}),i&&o.jsx(q,{ariaLabel:t??m("config.appSettings.projectThemeColor.backgroundStyle.label"),optionTranslationPrefix:s,disabled:r,t:m,value:a,onChange:f})]}),e&&o.jsx("div",{className:"config-view__project-theme-options",children:o.jsx(J,{checked:n,disabled:r,label:d,description:u,onChange:j})})]})})}function q({ariaLabel:e,optionTranslationPrefix:t,disabled:s,t:a,value:c,onChange:r}){const l=Math.max(0,k.indexOf(c));return o.jsx("div",{className:"config-view__project-theme-background-radio-group",role:"radiogroup","aria-label":e,style:{"--config-project-theme-active-index":l},children:k.map(i=>{const n=i===c,u=a(`${t}.${i}.label`),d=a(`${t}.${i}.desc`);return o.jsx(D,{title:`${u}: ${d}`,children:o.jsx("button",{type:"button",className:`config-view__project-theme-background-radio${n?" is-active":""}`,"aria-checked":n,"aria-label":u,role:"radio",disabled:s,onClick:()=>r(i),children:o.jsx("span",{className:"material-symbols-rounded","aria-hidden":"true",children:Y[i]})})},i)})})}function J({checked:e,description:t,disabled:s,label:a,onChange:c}){return o.jsxs("div",{className:"config-view__project-theme-switch",children:[o.jsxs("span",{className:"config-view__project-theme-switch-text",children:[o.jsx("span",{className:"config-view__project-theme-switch-title",children:a}),o.jsx("span",{className:"config-view__project-theme-switch-desc",children:t})]}),o.jsx($,{"aria-label":a,size:"small",checked:e,disabled:s,onChange:c})]})}function de({value:e,t,onChange:s}){const a=[{icon:"contrast",label:t("common.themeSystem"),value:"system"},{icon:"light_mode",label:t("common.themeLight"),value:"light"},{icon:"dark_mode",label:t("common.themeDark"),value:"dark"}];return o.jsx("div",{className:"config-view__theme-mode-radio-group",role:"radiogroup","aria-label":t("config.appSettings.themeMode.label"),children:a.map(c=>{const r=c.value===e;return o.jsx("button",{type:"button",className:`config-view__theme-mode-radio${r?" is-active":""}`,"aria-label":c.label,role:"radio","aria-checked":r,title:c.label,onClick:()=>s(c.value),children:o.jsx("span",{className:"material-symbols-rounded","aria-hidden":"true",children:c.icon})},c.value)})})}const Q=new Set(["#E23F12","#3F7E8F","#00B454","#8B9493"]),X=new Set(["stable","rc","beta","alpha"]),me="option+space",Z={...E(void 0),launcherShortcut:"",launcherShortcutRegistered:!1,autoUpdate:!0,openLastWorkspaceOnStartup:!1,updateChannel:"stable"},ee=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),he=e=>ee(e)?{...E(e),primaryColor:typeof e.primaryColor=="string"&&Q.has(e.primaryColor)?e.primaryColor:void 0,themeMode:e.themeMode==="light"||e.themeMode==="dark"||e.themeMode==="system"?e.themeMode:void 0,launcherShortcut:typeof e.launcherShortcut=="string"?e.launcherShortcut:"",launcherShortcutError:typeof e.launcherShortcutError=="string"&&e.launcherShortcutError!==""?e.launcherShortcutError:void 0,launcherShortcutRegistered:typeof e.launcherShortcutRegistered=="boolean"?e.launcherShortcutRegistered:!1,autoUpdate:typeof e.autoUpdate=="boolean"?e.autoUpdate:!0,openLastWorkspaceOnStartup:typeof e.openLastWorkspaceOnStartup=="boolean"?e.openLastWorkspaceOnStartup:!1,updateChannel:typeof e.updateChannel=="string"&&X.has(e.updateChannel)?e.updateChannel:"stable"}:Z,pe=e=>g.find(t=>t.primaryColor===e)??g[0],ue=e=>g.find(t=>t.theme===e)??g[0],ge=e=>O(typeof e.primaryColor=="string"?e.primaryColor:void 0)??H,fe=e=>"iconBackground"in e?B(e.iconBackground):void 0,oe=({iconBackground:e,iconMode:t,t:s})=>g.reduce((a,c)=>(a[c.theme]=L({mode:t,backgroundStyle:e,size:96,theme:c.theme,title:s(`config.desktopSettings.appIcon.themeOptions.${c.theme}`)}),a),{}),be=(e,t)=>e==="darwin"?{description:t("config.appSettings.projectThemeColor.syncDockIcon.desc"),label:t("config.appSettings.projectThemeColor.syncDockIcon.label")}:e==="win32"?{description:t("config.appSettings.projectThemeColor.syncTaskbarIcon.desc"),label:t("config.appSettings.projectThemeColor.syncTaskbarIcon.label")}:{description:t("config.appSettings.projectThemeColor.syncAppIcon.desc"),label:t("config.appSettings.projectThemeColor.syncAppIcon.label")};function _e({desktopApi:e,iconAppearance:t,iconBackground:s,iconMode:a,t:c}){const[r,l]=b.useState({}),i=b.useMemo(()=>oe({iconBackground:s,iconMode:a,t:c}),[s,a,c]);return b.useEffect(()=>{const n=e==null?void 0:e.getDesktopIconPreview;if(n==null){l({});return}let u=!1;return l({}),Promise.all(g.map(async d=>{const m=await n({iconAppearance:t,iconBackground:s,iconTheme:d.theme}).catch(()=>{});return[d.theme,m]})).then(d=>{u||l(d.reduce((m,[_,f])=>(f!=null&&f!==""&&(m[_]=f),m),{}))}),()=>{u=!0}},[e,t,s]),b.useMemo(()=>({...i,...r}),[r,i])}export{ae as A,le as P,de as T,he as a,ge as b,pe as c,fe as d,Z as e,me as f,ue as g,be as h,E as n,_e as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as w,s as Ge,R as xe}from"./vendor-react-BNJ5yonH.js";const S=n=>typeof n=="string",me=()=>{let n,e;const t=new Promise((s,i)=>{n=s,e=i});return t.resolve=n,t.reject=e,t},Ot=n=>n==null?"":""+n,yn=(n,e,t)=>{n.forEach(s=>{e[s]&&(t[s]=e[s])})},Sn=/###/g,xt=n=>n&&n.indexOf("###")>-1?n.replace(Sn,"."):n,vt=n=>!n||S(n),Se=(n,e,t)=>{const s=S(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(vt(n))return{};const r=xt(s[i]);!n[r]&&t&&(n[r]=new t),Object.prototype.hasOwnProperty.call(n,r)?n=n[r]:n={},++i}return vt(n)?{}:{obj:n,k:xt(s[i])}},wt=(n,e,t)=>{const{obj:s,k:i}=Se(n,e,Object);if(s!==void 0||e.length===1){s[i]=t;return}let r=e[e.length-1],o=e.slice(0,e.length-1),a=Se(n,o,Object);for(;a.obj===void 0&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),a=Se(n,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${r}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=t},bn=(n,e,t,s)=>{const{obj:i,k:r}=Se(n,e,Object);i[r]=i[r]||[],i[r].push(t)},_e=(n,e)=>{const{obj:t,k:s}=Se(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s]},On=(n,e,t)=>{const s=_e(n,t);return s!==void 0?s:_e(e,t)},Kt=(n,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in n?S(n[s])||n[s]instanceof String||S(e[s])||e[s]instanceof String?t&&(n[s]=e[s]):Kt(n[s],e[s],t):n[s]=e[s]);return n},de=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var xn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const vn=n=>S(n)?n.replace(/[&<>"'\/]/g,e=>xn[e]):n;class wn{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;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 Ln=[" ",",","?","!",";"],Rn=new wn(20),Cn=(n,e,t)=>{e=e||"",t=t||"";const s=Ln.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(s.length===0)return!0;const i=Rn.getRegExp(`(${s.map(o=>o==="?"?"\\?":o).join("|")})`);let r=!i.test(n);if(!r){const o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(r=!0)}return r},Je=(n,e,t=".")=>{if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const s=e.split(t);let i=n;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+=t),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},Oe=n=>n==null?void 0:n.replace("_","-"),En={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){var t,s;(s=(t=console==null?void 0:console[n])==null?void 0:t.apply)==null||s.call(t,console,e)}};class Ne{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||En,this.options=t,this.debug=t.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,t,s,i){return i&&!this.debug?null:(S(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Ne(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Ne(this.logger,e)}}var ee=new Ne;class De{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(t)||0;this.observers[s].set(t,i+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([i,r])=>{for(let o=0;o<r;o++)i.apply(i,[e,...t])})}}class Lt extends De{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,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 t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,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,t],s&&(Array.isArray(s)?a.push(...s):S(s)&&r?a.push(...s.split(r)):a.push(s)));const l=_e(this.data,a);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=a[0],t=a[1],s=a.slice(2).join(".")),l||!o||!S(s)?l:Je((f=(c=this.data)==null?void 0:c[e])==null?void 0:f[t],s,r)}addResource(e,t,s,i,r={silent:!1}){const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let a=[e,t];s&&(a=a.concat(o?s.split(o):s)),e.indexOf(".")>-1&&(a=e.split("."),i=t,t=a[1]),this.addNamespaces(t),wt(this.data,a,i),r.silent||this.emit("added",e,t,s,i)}addResources(e,t,s,i={silent:!1}){for(const r in s)(S(s[r])||Array.isArray(s[r]))&&this.addResource(e,t,r,s[r],{silent:!0});i.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,i,r,o={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),i=s,s=t,t=a[1]),this.addNamespaces(t);let l=_e(this.data,a)||{};o.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?Kt(l,s,r):l={...l,...s},wt(this.data,a,l),o.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var Ht={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,s,i){return n.forEach(r=>{var o;e=((o=this.processors[r])==null?void 0:o.process(e,t,s,i))??e}),e}};const Wt=Symbol("i18next/PATH_KEY");function _n(){const n=[],e=Object.create(null);let t;return e.get=(s,i)=>{var r;return(r=t==null?void 0:t.revoke)==null||r.call(t),i===Wt?n:(n.push(i),t=Proxy.revocable(s,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function qe(n,e){const{[Wt]:t}=n(_n());return t.join((e==null?void 0:e.keySeparator)??".")}const Rt={},je=n=>!S(n)&&typeof n!="boolean"&&typeof n!="number";class Ie extends De{constructor(e,t={}){super(),yn(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ee.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const s={...t};if(e==null)return!1;const i=this.resolve(e,s);if((i==null?void 0:i.res)===void 0)return!1;const r=je(i.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const o=s&&e.indexOf(s)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Cn(e,s,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:S(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:S(r)?[r]:r}}translate(e,t,s){let i=typeof t=="object"?{...t}:t;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=qe(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 y=(d==null?void 0:d.usedKey)||a,x=(d==null?void 0:d.exactUsedKey)||a,b=["[object Number]","[object Function]","[object RegExp]"],p=i.joinArrays!==void 0?i.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,_=i.count!==void 0&&!S(i.count),v=Ie.hasDefaultValue(i),A=_?this.pluralResolver.getSuffix(u,i.count,i):"",I=i.ordinal&&_?this.pluralResolver.getSuffix(u,i.count,{ordinal:!1}):"",V=_&&!i.ordinal&&i.count===0,m=V&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${A}`]||i[`defaultValue${I}`]||i.defaultValue;let N=h;E&&!h&&v&&(N=m);const D=je(N),R=Object.prototype.toString.apply(N);if(E&&N&&D&&b.indexOf(R)<0&&!(S(p)&&Array.isArray(N))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,N,{...i,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=L,d.usedParams=this.getUsedParamsDetails(i),d):L}if(o){const L=Array.isArray(N),O=L?[]:{},P=L?x:y;for(const F in N)if(Object.prototype.hasOwnProperty.call(N,F)){const K=`${P}${o}${F}`;v&&!h?O[F]=this.translate(K,{...i,defaultValue:je(m)?m[F]:void 0,joinArrays:!1,ns:l}):O[F]=this.translate(K,{...i,joinArrays:!1,ns:l}),O[F]===K&&(O[F]=N[F])}h=O}}else if(E&&S(p)&&Array.isArray(h))h=h.join(p),h&&(h=this.extendTranslation(h,e,i,s));else{let L=!1,O=!1;!this.isValidLookup(h)&&v&&(L=!0,h=m),this.isValidLookup(h)||(O=!0,h=a);const F=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&O?void 0:h,K=v&&m!==h&&this.options.updateMissing;if(O||L||K){if(this.logger.log(K?"updateKey":"missingKey",u,c,a,K?m:h),o){const H=this.resolve(a,{...i,keySeparator:!1});H&&H.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 Z=[];const Y=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Y&&Y[0])for(let H=0;H<Y.length;H++)Z.push(Y[H]);else this.options.saveMissingTo==="all"?Z=this.languageUtils.toResolveHierarchy(i.lng||this.language):Z.push(i.lng||this.language);const ge=(H,z,J)=>{var ue;const ae=v&&J!==h?J:F;this.options.missingKeyHandler?this.options.missingKeyHandler(H,c,z,ae,K,i):(ue=this.backendConnector)!=null&&ue.saveMissing&&this.backendConnector.saveMissing(H,c,z,ae,K,i),this.emit("missingKey",H,c,z,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?Z.forEach(H=>{const z=this.pluralResolver.getSuffixes(H,i);V&&i[`defaultValue${this.options.pluralSeparator}zero`]&&z.indexOf(`${this.options.pluralSeparator}zero`)<0&&z.push(`${this.options.pluralSeparator}zero`),z.forEach(J=>{ge([H],a+J,i[`defaultValue${J}`]||m)})}):ge(Z,a,m))}h=this.extendTranslation(h,e,i,d,s),O&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${c}${f}${a}`),(O||L)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${f}${a}`:a,L?h:void 0,i))}return r?(d.res=h,d.usedParams=this.getUsedParamsDetails(i),d):h}extendTranslation(e,t,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=S(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&&!S(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: ${t[0]}`),null):this.translate(...d,t),s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,a=S(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&s.applyPostProcessor!==!1&&(e=Ht.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,t={}){let s,i,r,o,a;return S(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const c=this.extractFromKey(l,t),f=c.key;i=f;let u=c.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const g=t.count!==void 0&&!S(t.count),d=g&&!t.ordinal&&t.count===0,h=t.context!==void 0&&(S(t.context)||typeof t.context=="number")&&t.context!=="",y=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);u.forEach(x=>{var b,p;this.isValidLookup(s)||(a=x,!Rt[`${y[0]}-${x}`]&&((b=this.utils)!=null&&b.hasLoadedNamespace)&&!((p=this.utils)!=null&&p.hasLoadedNamespace(a))&&(Rt[`${y[0]}-${x}`]=!0,this.logger.warn(`key "${i}" for languages "${y.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!!!")),y.forEach(E=>{var A;if(this.isValidLookup(s))return;o=E;const _=[f];if((A=this.i18nFormat)!=null&&A.addLookupKeys)this.i18nFormat.addLookupKeys(_,f,E,x,t);else{let I;g&&(I=this.pluralResolver.getSuffix(E,t.count,t));const V=`${this.options.pluralSeparator}zero`,m=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(t.ordinal&&I.indexOf(m)===0&&_.push(f+I.replace(m,this.options.pluralSeparator)),_.push(f+I),d&&_.push(f+V)),h){const N=`${f}${this.options.contextSeparator||"_"}${t.context}`;_.push(N),g&&(t.ordinal&&I.indexOf(m)===0&&_.push(N+I.replace(m,this.options.pluralSeparator)),_.push(N+I),d&&_.push(N+V))}}let v;for(;v=_.pop();)this.isValidLookup(s)||(r=v,s=this.getResource(E,x,v,t))}))})}),{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,t,s,i={}){var r;return(r=this.i18nFormat)!=null&&r.getResource?this.i18nFormat.getResource(e,t,s,i):this.resourceStore.getResource(e,t,s,i)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!S(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 t)delete i[r]}return i}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}class Ct{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ee.create("languageUtils")}getScriptPartFromCode(e){if(e=Oe(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=Oe(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(S(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(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 t;return e.forEach(s=>{if(t)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const i=this.getScriptPartFromCode(s);if(this.isSupportedCode(i))return t=i;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return t=r;t=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})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),S(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes((t===!1?[]:t)||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 S(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))):S(e)&&r(this.formatLanguageCode(e)),s.forEach(o=>{i.indexOf(o)<0&&r(this.formatLanguageCode(o))}),i}}const Et={zero:0,one:1,two:2,few:3,many:4,other:5},_t={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Nn{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ee.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const s=Oe(e==="dev"?"en":e),i=t.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!"),_t;if(!e.match(/-|_/))return _t;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[r]=o,o}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(i=>`${t}${i}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort((i,r)=>Et[i]-Et[r]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):[]}getSuffix(e,t,s={}){const i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const Nt=(n,e,t,s=".",i=!0)=>{let r=On(n,e,t);return!r&&i&&S(t)&&(r=Je(n,t,s),r===void 0&&(r=Je(e,t,s))),r},Ve=n=>n.replace(/\$/g,"$$$$");class It{constructor(e={}){var t;this.logger=ee.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,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:y,nestingOptionsSeparator:x,maxReplaces:b,alwaysFormat:p}=e.interpolation;this.escape=t!==void 0?t:vn,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?de(r):o||"{{",this.suffix=a?de(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=g?de(g):d||de("$t("),this.nestingSuffix=h?de(h):y||de(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=b||1e3,this.alwaysFormat=p!==void 0?p:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>(t==null?void 0:t.source)===s?(t.lastIndex=0,t):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,t,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=Nt(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(p,void 0,s,{...i,...t,interpolationkey:h}):p}const y=h.split(this.formatSeparator),x=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(Nt(t,l,x,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...i,...t,interpolationkey:x})};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=>Ve(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Ve(this.escape(h)):Ve(h)}].forEach(h=>{for(a=0;r=h.regex.exec(e);){const y=r[1].trim();if(o=c(y),o===void 0)if(typeof f=="function"){const b=f(e,r,i);o=S(b)?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,y))o="";else if(u){o=r[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),o="";else!S(o)&&!this.useRawValueToEscape&&(o=Ot(o));const x=h.safeValue(o);if(e=e.replace(r[0],x),u?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=r[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,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(y){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,y),`${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&&!S(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=t(a.call(this,i[1].trim(),o),o),r&&i[0]===e&&!S(r))return r;S(r)||(r=Ot(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 In=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const s=n.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),f=a.trim();t[f]||(t[f]=c),c==="false"&&(t[f]=!1),c==="true"&&(t[f]=!0),isNaN(c)||(t[f]=parseInt(c,10))}})}return{formatName:e,formatOptions:t}},Pt=n=>{const e={};return(t,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=n(Oe(s),i),e[o]=a),a(t)}},Pn=n=>(e,t,s)=>n(Oe(t),s)(e);class An{constructor(e={}){this.logger=ee.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const s=t.cacheInBuiltFormats?Pt:Pn;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,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Pt(t)}format(e,t,s,i={}){const r=t.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}=In(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 Tn=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class kn extends De{constructor(e,t,s,i={}){var r,o;super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=ee.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,t,s,i){const r={},o={},a={},l={};return e.forEach(c=>{let f=!0;t.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,t,s){const i=e.split("|"),r=i[0],o=i[1];t&&this.emit("failedLoading",r,o,t),!t&&s&&this.store.addResourceBundle(r,o,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const a={};this.queue.forEach(l=>{bn(l.loaded,[r],o),Tn(l,e),t&&l.errors.push(t),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,t,s,i=0,r=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,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,t,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,t);c&&typeof c.then=="function"?c.then(f=>a(null,f)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();S(e)&&(e=this.languageUtils.toResolveHierarchy(e)),S(t)&&(t=[t]);const r=this.queueLoad(e,t,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){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(`${t}loading namespace ${r} for language ${i} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${r} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,t,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(t))){this.logger.warn(`did not save key "${s}" as the namespace "${t}" 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 y;h.length===5?y=h(e,t,s,i,d):y=h(e,t,s,i),y&&typeof y.then=="function"?y.then(x=>a(null,x)).catch(a):a(null,y)}catch(y){a(y)}else h(e,t,s,i,a,d)}!e||!e[0]||this.store.addResource(e[0],t,s,i)}}}const Me=()=>({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:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),S(n[1])&&(e.defaultValue=n[1]),S(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),At=n=>{var e,t;return S(n.ns)&&(n.ns=[n.ns]),S(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),S(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((t=(e=n.supportedLngs)==null?void 0:e.indexOf)==null?void 0:t.call(e,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},Le=()=>{},Dn=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class be extends De{constructor(e={},t){if(super(),this.options=At(e),this.services={},this.logger=ee,this.modules={external:[]},Dn(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(S(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const s=Me();this.options={...s,...this.options,...At(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?ee.init(i(this.modules.logger),this.options):ee.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=An;const f=new Ct(this.options);this.store=new Lt(this.options.resources,this.options);const u=this.services;u.logger=ee,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new Nn(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 It(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new kn(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 Ie(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,t||(t=Le),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=me(),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),t(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,t=Le){var r,o;let s=t;const i=S(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,t,s){const i=me();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=Le),this.services.backendConnector.reload(e,t,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"&&Ht.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 t=0;t<this.languages.length;t++){const s=this.languages[t];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,t){this.isLanguageChangingTo=e;const s=me();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)),t&&t(a,(...c)=>this.t(...c))},o=a=>{var f,u;!e&&!a&&this.services.languageDetector&&(a=[]);const l=S(a)?a:a&&a[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(S(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,t,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=qe(u,{...this.options,...o})),`${l.keyPrefix}${c}${u}`)):(typeof r=="function"&&(r=qe(r,{...this.options,...o})),f=l.keyPrefix?`${l.keyPrefix}${c}${r}`:r),this.t(f,l)};return S(e)?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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=t.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(t.precheck){const a=t.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,t){const s=me();return this.options.ns?(S(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),t&&t(i)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=me();S(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(),t&&t(o)}),s):(t&&t(),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 t=["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 Ct(Me());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const s=new be(e,t);return s.createInstance=be.createInstance,s}cloneInstance(e={},t=Le){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},r=new be(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 Lt(a,i),r.services.resourceStore=r.store}if(e.interpolation){const l={...Me().interpolation,...this.options.interpolation,...e.interpolation},c={...i,interpolation:l};r.services.interpolator=new It(c)}return r.translator=new Ie(r.services,i),r.translator.on("*",(a,...l)=>{r.emit(a,...l)}),r.init(i,t),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 G=be.createInstance();G.createInstance;G.dir;G.init;G.loadResources;G.reloadResources;G.use;G.changeLanguage;G.getFixedT;G.t;G.exists;G.setDefaultNamespace;G.hasLoadedNamespace;G.loadNamespaces;G.loadLanguages;const $n=(n,e,t,s)=>{var r,o,a,l;const i=[t,{code:e,...s||{}}];if((o=(r=n==null?void 0:n.services)==null?void 0:r.logger)!=null&&o.forward)return n.services.logger.forward(i,"warn","react-i18next::",!0);ce(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),(l=(a=n==null?void 0:n.services)==null?void 0:a.logger)!=null&&l.warn?n.services.logger.warn(...i):console!=null&&console.warn&&console.warn(...i)},Tt={},zt=(n,e,t,s)=>{ce(t)&&Tt[t]||(ce(t)&&(Tt[t]=new Date),$n(n,e,t,s))},Gt=(n,e)=>()=>{if(n.isInitialized)e();else{const t=()=>{setTimeout(()=>{n.off("initialized",t)},0),e()};n.on("initialized",t)}},Ye=(n,e,t)=>{n.loadNamespaces(e,Gt(n,t))},kt=(n,e,t,s)=>{if(ce(t)&&(t=[t]),n.options.preload&&n.options.preload.indexOf(e)>-1)return Ye(n,t,s);t.forEach(i=>{n.options.ns.indexOf(i)<0&&n.options.ns.push(i)}),n.loadLanguages(e,Gt(n,s))},Fn=(n,e,t={})=>!e.languages||!e.languages.length?(zt(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(n,{lng:t.lng,precheck:(s,i)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,n))return!1}}),ce=n=>typeof n=="string",jn=n=>typeof n=="object"&&n!==null,Vn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Mn={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Bn=n=>Mn[n],Un=n=>n.replace(Vn,Bn);let Qe={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Un,transDefaultProps:void 0};const Kn=(n={})=>{Qe={...Qe,...n}},Hn=()=>Qe;let Jt;const Wn=n=>{Jt=n},zn=()=>Jt,ti={type:"3rdParty",init(n){Kn(n.options.react),Wn(n)}},Gn=w.createContext();class Jn{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const qn=(n,e)=>ce(e)?e:jn(e)&&ce(e.defaultValue)?e.defaultValue:Array.isArray(n)?n[n.length-1]:n,Yn={t:qn,ready:!1},Qn=()=>()=>{},ni=(n,e={})=>{var m,N,D;const{i18n:t}=e,{i18n:s,defaultNS:i}=w.useContext(Gn)||{},r=t||s||zn();r&&!r.reportNamespaces&&(r.reportNamespaces=new Jn),r||zt(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=w.useMemo(()=>{var R;return{...Hn(),...(R=r==null?void 0:r.options)==null?void 0:R.react,...e}},[r,e]),{useSuspense:a,keyPrefix:l}=o,c=i||((m=r==null?void 0:r.options)==null?void 0:m.defaultNS),f=ce(c)?[c]:c||["translation"],u=w.useMemo(()=>f,f);(D=(N=r==null?void 0:r.reportNamespaces)==null?void 0:N.addUsedNamespaces)==null||D.call(N,u);const g=w.useRef(0),d=w.useCallback(R=>{if(!r)return Qn;const{bindI18n:L,bindI18nStore:O}=o,P=()=>{g.current+=1,R()};return L&&r.on(L,P),O&&r.store.on(O,P),()=>{L&&L.split(" ").forEach(F=>r.off(F,P)),O&&O.split(" ").forEach(F=>r.store.off(F,P))}},[r,o]),h=w.useRef(),y=w.useCallback(()=>{if(!r)return Yn;const R=!!(r.isInitialized||r.initializedStoreOnce)&&u.every(Z=>Fn(Z,r,o)),L=e.lng||r.language,O=g.current,P=h.current;if(P&&P.ready===R&&P.lng===L&&P.keyPrefix===l&&P.revision===O)return P;const K={t:r.getFixedT(L,o.nsMode==="fallback"?u:u[0],l),ready:R,lng:L,keyPrefix:l,revision:O};return h.current=K,K},[r,u,l,o,e.lng]),[x,b]=w.useState(0),{t:p,ready:E}=Ge.useSyncExternalStore(d,y,y);w.useEffect(()=>{if(r&&!E&&!a){const R=()=>b(L=>L+1);e.lng?kt(r,e.lng,u,R):Ye(r,u,R)}},[r,e.lng,u,E,a,x]);const _=r||{},v=w.useRef(null),A=w.useRef(),I=R=>{const L=Object.getOwnPropertyDescriptors(R);L.__original&&delete L.__original;const O=Object.create(Object.getPrototypeOf(R),L);if(!Object.prototype.hasOwnProperty.call(O,"__original"))try{Object.defineProperty(O,"__original",{value:R,writable:!1,enumerable:!1,configurable:!1})}catch{}return O},V=w.useMemo(()=>{const R=_,L=R==null?void 0:R.language;let O=R;R&&(v.current&&v.current.__original===R?A.current!==L?(O=I(R),v.current=O,A.current=L):O=v.current:(O=I(R),v.current=O,A.current=L));const P=[p,O,E];return P.t=p,P.i18n=O,P.ready=E,P},[p,_,E,_.resolvedLanguage,_.language,_.languages]);if(r&&a&&!E)throw new Promise(R=>{const L=()=>R();e.lng?kt(r,e.lng,u,L):Ye(r,u,L)});return V},qt=0,Yt=1,Qt=2,Dt=3;var $t=Object.prototype.hasOwnProperty;function Xe(n,e){var t,s;if(n===e)return!0;if(n&&e&&(t=n.constructor)===e.constructor){if(t===Date)return n.getTime()===e.getTime();if(t===RegExp)return n.toString()===e.toString();if(t===Array){if((s=n.length)===e.length)for(;s--&&Xe(n[s],e[s]););return s===-1}if(!t||typeof n=="object"){s=0;for(t in n)if($t.call(n,t)&&++s&&!$t.call(e,t)||!(t in e)||!Xe(n[t],e[t]))return!1;return Object.keys(e).length===s}}return n!==n&&e!==e}const se=new WeakMap,ie=()=>{},B=ie(),Pe=Object,C=n=>n===B,X=n=>typeof n=="function",oe=(n,e)=>({...n,...e}),Xt=n=>X(n.then),Be={},Re={},ft="undefined",ve=typeof window!=ft,Ze=typeof document!=ft,Xn=ve&&"Deno"in window,Zn=()=>ve&&typeof window.requestAnimationFrame!=ft,Zt=(n,e)=>{const t=se.get(n);return[()=>!C(e)&&n.get(e)||Be,s=>{if(!C(e)){const i=n.get(e);e in Re||(Re[e]=i),t[5](e,oe(i,s),i||Be)}},t[6],()=>!C(e)&&e in Re?Re[e]:!C(e)&&n.get(e)||Be]};let et=!0;const es=()=>et,[tt,nt]=ve&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ie,ie],ts=()=>{const n=Ze&&document.visibilityState;return C(n)||n!=="hidden"},ns=n=>(Ze&&document.addEventListener("visibilitychange",n),tt("focus",n),()=>{Ze&&document.removeEventListener("visibilitychange",n),nt("focus",n)}),ss=n=>{const e=()=>{et=!0,n()},t=()=>{et=!1};return tt("online",e),tt("offline",t),()=>{nt("online",e),nt("offline",t)}},is={isOnline:es,isVisible:ts},rs={initFocus:ns,initReconnect:ss},Ft=!xe.useId,he=!ve||Xn,os=n=>Zn()?window.requestAnimationFrame(n):setTimeout(n,1),Ee=he?w.useEffect:w.useLayoutEffect,Ue=typeof navigator<"u"&&navigator.connection,jt=!he&&Ue&&(["slow-2g","2g"].includes(Ue.effectiveType)||Ue.saveData),Ce=new WeakMap,as=n=>Pe.prototype.toString.call(n),Ke=(n,e)=>n===`[object ${e}]`;let ls=0;const st=n=>{const e=typeof n,t=as(n),s=Ke(t,"Date"),i=Ke(t,"RegExp"),r=Ke(t,"Object");let o,a;if(Pe(n)===n&&!s&&!i){if(o=Ce.get(n),o)return o;if(o=++ls+"~",Ce.set(n,o),Array.isArray(n)){for(o="@",a=0;a<n.length;a++)o+=st(n[a])+",";Ce.set(n,o)}if(r){o="#";const l=Pe.keys(n).sort();for(;!C(a=l.pop());)C(n[a])||(o+=a+":"+st(n[a])+",");Ce.set(n,o)}}else o=s?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return o},dt=n=>{if(X(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?st(n):"",[n,e]};let cs=0;const it=()=>++cs;async function en(...n){const[e,t,s,i]=n,r=oe({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(t)){const g=t,d=[],h=e.keys();for(const y of h)!/^\$(inf|sub)\$/.test(y)&&g(e.get(y)._k)&&d.push(y);return Promise.all(d.map(u))}return u(t);async function u(g){const[d]=dt(g);if(!d)return;const[h,y]=Zt(e,d),[x,b,p,E]=se.get(e),_=()=>{const O=x[d];return(X(r.revalidate)?r.revalidate(h().data,g):r.revalidate!==!1)&&(delete p[d],delete E[d],O&&O[0])?O[0](Qt).then(()=>h().data):h().data};if(n.length<3)return _();let v=s,A,I=!1;const V=it();b[d]=[V,0];const m=!C(l),N=h(),D=N.data,R=N._c,L=C(R)?D:R;if(m&&(l=X(l)?l(L,D):l,y({data:l,_c:L})),X(v))try{v=v(L)}catch(O){A=O,I=!0}if(v&&Xt(v))if(v=await v.catch(O=>{A=O,I=!0}),V!==b[d][0]){if(I)throw A;return v}else I&&m&&c(A)&&(o=!0,y({data:L,_c:B}));if(o&&!I)if(X(o)){const O=o(v,L);y({data:O,error:B,_c:B})}else y({data:v,error:B,_c:B});if(b[d][1]=it(),Promise.resolve(_()).then(()=>{y({_c:B})}),I){if(f)throw A;return}return v}}const Vt=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},tn=(n,e)=>{if(!se.has(n)){const t=oe(rs,e),s=Object.create(null),i=en.bind(B,n);let r=ie;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)=>{n.set(f,u);const d=o[f];if(d)for(const h of d)h(u,g)},c=()=>{if(!se.has(n)&&(se.set(n,[s,Object.create(null),Object.create(null),Object.create(null),i,l,a]),!he)){const f=t.initFocus(setTimeout.bind(B,Vt.bind(B,s,qt))),u=t.initReconnect(setTimeout.bind(B,Vt.bind(B,s,Yt)));r=()=>{f&&f(),u&&u(),se.delete(n)}}};return c(),[n,i,c,r]}return[n,se.get(n)[4]]},us=(n,e,t,s,i)=>{const r=t.errorRetryCount,o=i.retryCount,a=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!C(r)&&o>r||setTimeout(s,a,i)},fs=Xe,[ht,ds]=tn(new Map),nn=oe({onLoadingSlow:ie,onSuccess:ie,onError:ie,onErrorRetry:us,onDiscarded:ie,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:jt?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:jt?5e3:3e3,compare:fs,isPaused:()=>!1,cache:ht,mutate:ds,fallback:{}},is),sn=(n,e)=>{const t=oe(n,e);if(e){const{use:s,fallback:i}=n,{use:r,fallback:o}=e;s&&r&&(t.use=s.concat(r)),i&&o&&(t.fallback=oe(i,o))}return t},rt=w.createContext({}),hs=n=>{const{value:e}=n,t=w.useContext(rt),s=X(e),i=w.useMemo(()=>s?e(t):e,[s,t,e]),r=w.useMemo(()=>s?i:sn(t,i),[s,t,i]),o=i&&i.provider,a=w.useRef(B);o&&!a.current&&(a.current=tn(o(r.cache||ht),i));const l=a.current;return l&&(r.cache=l[0],r.mutate=l[1]),Ee(()=>{if(l)return l[2]&&l[2](),l[3]},[]),w.createElement(rt.Provider,oe(n,{value:r}))},gs="$inf$",rn=ve&&window.__SWR_DEVTOOLS_USE__,ps=rn?window.__SWR_DEVTOOLS_USE__:[],ms=()=>{rn&&(window.__SWR_DEVTOOLS_REACT__=xe)},ys=n=>X(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],Ss=()=>{const n=w.useContext(rt);return w.useMemo(()=>oe(nn,n),[n])},bs=n=>(e,t,s)=>n(e,t&&((...r)=>{const[o]=dt(e),[,,,a]=se.get(ht);if(o.startsWith(gs))return t(...r);const l=a[o];return C(l)?t(...r):(delete a[o],l)}),s),Os=ps.concat(bs),xs=n=>function(...t){const s=Ss(),[i,r,o]=ys(t),a=sn(s,o);let l=n;const{use:c}=a,f=(c||[]).concat(Os);for(let u=f.length;u--;)l=f[u](l);return l(i,r||a.fetcher||null,a)},vs=(n,e,t)=>{const s=e[n]||(e[n]=[]);return s.push(t),()=>{const i=s.indexOf(t);i>=0&&(s[i]=s[s.length-1],s.pop())}};ms();const He=xe.use||(n=>{switch(n.status){case"pending":throw n;case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n}}),We={dedupe:!0},Mt=Promise.resolve(B),ws=(n,e,t)=>{const{cache:s,compare:i,suspense:r,fallbackData:o,revalidateOnMount:a,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:f,refreshWhenOffline:u,keepPreviousData:g,strictServerPrefetchWarning:d}=t,[h,y,x,b]=se.get(s),[p,E]=dt(n),_=w.useRef(!1),v=w.useRef(!1),A=w.useRef(p),I=w.useRef(e),V=w.useRef(t),m=()=>V.current,N=()=>m().isVisible()&&m().isOnline(),[D,R,L,O]=Zt(s,p),P=w.useRef({}).current,F=C(o)?C(t.fallback)?B:t.fallback[p]:o,K=(T,k)=>{for(const j in P){const $=j;if($==="data"){if(!i(T[$],k[$])&&(!C(T[$])||!i(we,k[$])))return!1}else if(k[$]!==T[$])return!1}return!0},Z=w.useMemo(()=>{const T=!p||!e?!1:C(a)?m().isPaused()||r?!1:l!==!1:a,k=W=>{const te=oe(W);return delete te._k,T?{isValidating:!0,isLoading:!0,...te}:te},j=D(),$=O(),Q=k(j),fe=j===$?Q:k($);let M=Q;return[()=>{const W=k(D());return K(W,M)?(M.data=W.data,M.isLoading=W.isLoading,M.isValidating=W.isValidating,M.error=W.error,M):(M=W,W)},()=>fe]},[s,p]),Y=Ge.useSyncExternalStore(w.useCallback(T=>L(p,(k,j)=>{K(j,k)||T()}),[s,p]),Z[0],Z[1]),ge=!_.current,H=h[p]&&h[p].length>0,z=Y.data,J=C(z)?F&&Xt(F)?He(F):F:z,ae=Y.error,ue=w.useRef(J),we=g?C(z)?C(ue.current)?J:ue.current:z:J,le=p&&C(J),hn=!he&&Ge.useSyncExternalStore(()=>ie,()=>!1,()=>!0);d&&hn&&!r&&le&&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 gt=H&&!C(ae)?!1:ge&&!C(a)?a:m().isPaused()?!1:r?C(J)?!1:l:C(J)||l,pt=!!(p&&e&&ge&>),gn=C(Y.isValidating)?pt:Y.isValidating,pn=C(Y.isLoading)?pt:Y.isLoading,pe=w.useCallback(async T=>{const k=I.current;if(!p||!k||v.current||m().isPaused())return!1;let j,$,Q=!0;const fe=T||{},M=!x[p]||!fe.dedupe,W=()=>Ft?!v.current&&p===A.current&&_.current:p===A.current,te={isValidating:!1,isLoading:!1},yt=()=>{R(te)},St=()=>{const q=x[p];q&&q[1]===$&&delete x[p]},bt={isValidating:!0};C(D().data)&&(bt.isLoading=!0);try{if(M&&(R(bt),t.loadingTimeout&&C(D().data)&&setTimeout(()=>{Q&&W()&&m().onLoadingSlow(p,t)},t.loadingTimeout),x[p]=[k(E),it()]),[j,$]=x[p],j=await j,M&&setTimeout(St,t.dedupingInterval),!x[p]||x[p][1]!==$)return M&&W()&&m().onDiscarded(p),!1;te.error=B;const q=y[p];if(!C(q)&&($<=q[0]||$<=q[1]||q[1]===0))return yt(),M&&W()&&m().onDiscarded(p),!1;const ne=D().data;te.data=i(ne,j)?ne:j,M&&W()&&m().onSuccess(j,p,t)}catch(q){St();const ne=m(),{shouldRetryOnError:$e}=ne;ne.isPaused()||(te.error=q,M&&W()&&(ne.onError(q,p,ne),($e===!0||X($e)&&$e(q))&&(!m().revalidateOnFocus||!m().revalidateOnReconnect||N())&&ne.onErrorRetry(q,p,ne,mn=>{const Fe=h[p];Fe&&Fe[0]&&Fe[0](Dt,mn)},{retryCount:(fe.retryCount||0)+1,dedupe:!0})))}return Q=!1,yt(),!0},[p,s]),mt=w.useCallback((...T)=>en(s,A.current,...T),[]);if(Ee(()=>{I.current=e,V.current=t,C(z)||(ue.current=z)}),Ee(()=>{if(!p)return;const T=pe.bind(B,We);let k=0;m().revalidateOnFocus&&(k=Date.now()+m().focusThrottleInterval);const $=vs(p,h,(Q,fe={})=>{if(Q==qt){const M=Date.now();m().revalidateOnFocus&&M>k&&N()&&(k=M+m().focusThrottleInterval,T())}else if(Q==Yt)m().revalidateOnReconnect&&N()&&T();else{if(Q==Qt)return pe();if(Q==Dt)return pe(fe)}});return v.current=!1,A.current=p,_.current=!0,R({_k:E}),gt&&(x[p]||(C(J)||he?T():os(T))),()=>{v.current=!0,$()}},[p]),Ee(()=>{let T;function k(){const $=X(c)?c(D().data):c;$&&T!==-1&&(T=setTimeout(j,$))}function j(){!D().error&&(f||m().isVisible())&&(u||m().isOnline())?pe(We).then(k):k()}return k(),()=>{T&&(clearTimeout(T),T=-1)}},[c,f,u,p]),w.useDebugValue(we),r){if(!Ft&&he&&le)throw new Error("Fallback data is required when using Suspense in SSR.");le&&(I.current=e,V.current=t,v.current=!1);const T=b[p],k=!C(T)&&le?mt(T):Mt;if(He(k),!C(ae)&&le)throw ae;const j=le?pe(We):Mt;!C(we)&&le&&(j.status="fulfilled",j.value=!0),He(j)}return{mutate:mt,get data(){return P.data=!0,we},get error(){return P.error=!0,ae},get isValidating(){return P.isValidating=!0,gn},get isLoading(){return P.isLoading=!0,pn}}},si=Pe.defineProperty(hs,"defaultValue",{value:nn}),ii=xs(ws),re={BASE_URL:"/__ONEWORKS_PROJECT_CLIENT_BASE__/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,__ONEWORKS_PROJECT_CLIENT_COMMIT_HASH__:"8d153dfe945bf327bf447ae24c816afb79adb6cc",__ONEWORKS_PROJECT_CLIENT_VERSION__:"0.1.0-alpha.0",__ONEWORKS_PROJECT_DEV_GIT_REF__:""};function on(n){return"init"in n}function ot(n){return!!n.write}function Bt(n){return"v"in n||"e"in n}function Ae(n){if("e"in n)throw n.e;if((re?"production":void 0)!=="production"&&!("v"in n))throw new Error("[Bug] atom state is not initialized");return n.v}const Te=new WeakMap;function an(n){var e;return ke(n)&&!!((e=Te.get(n))!=null&&e[0])}function Ls(n){const e=Te.get(n);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(t=>t()))}function at(n,e){let t=Te.get(n);if(!t){t=[!0,new Set],Te.set(n,t);const s=()=>{t[0]=!1};n.then(s,s)}t[1].add(e)}function ke(n){return typeof(n==null?void 0:n.then)=="function"}function ln(n,e,t){if(!t.p.has(n)){t.p.add(n);const s=()=>t.p.delete(n);e.then(s,s)}}function cn(n,e,t){var s;const i=new Set;for(const r of((s=t.get(n))==null?void 0:s.t)||[])i.add(r);for(const r of e.p)i.add(r);return i}const Rs=(n,e,...t)=>e.read(...t),Cs=(n,e,...t)=>e.write(...t),Es=(n,e)=>{if(e.INTERNAL_onInit)return e.INTERNAL_onInit(n);if(e.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),e.unstable_onInit(n)},_s=(n,e,t)=>{var s;return(s=e.onMount)==null?void 0:s.call(e,t)},Ns=(n,e)=>{var t;const s=U(n),i=s[0],r=s[6],o=s[9];if((re?"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),(t=r.i)==null||t.call(r,e),o==null||o(n,e)),a},Is=n=>{const e=U(n),t=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=t.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(n)}while(s.size||r.size||i.size);if(l.length)throw new AggregateError(l)},Ps=n=>{const e=U(n),t=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(n,g);if(f.has(g)){u.pop();continue}if(c.has(g)){if(s.get(g)===d.n)l.push([g,d]);else if((re?"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 cn(g,d,t))c.has(h)||u.push(h)}for(let g=l.length-1;g>=0;--g){const[d,h]=l[g];let y=!1;for(const x of h.d.keys())if(x!==d&&i.has(x)){y=!0;break}y&&(o(n,d),a(n,d)),s.delete(d)}},lt=new WeakSet,As=(n,e)=>{var t,s;const i=U(n),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],y=i[17],x=i[20],b=f(n,e);if(Bt(b)){if(r.has(e)&&o.get(e)!==b.n)return b;let m=!1;for(const[N,D]of b.d)if(d(n,N).n!==D){m=!0;break}if(!m)return b}b.d.clear();let p=!0;function E(){r.has(e)&&(y(n,e),g(n),u(n))}function _(m){var N;if(m===e){const R=f(n,m);if(!Bt(R))if(on(m))x(n,m,m.init);else throw new Error("no atom init");return Ae(R)}const D=d(n,m);try{return Ae(D)}finally{b.d.set(m,D.n),an(b.v)&&ln(e,b.v,D),r.has(e)&&((N=r.get(m))==null||N.t.add(e)),p||E()}}let v,A;const I={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return(re?"production":void 0)!=="production"&&!ot(e)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&ot(e)&&(A=(...m)=>{if((re?"production":void 0)!=="production"&&p&&console.warn("setSelf function cannot be called in sync"),!p)try{return h(n,e,...m)}finally{g(n),u(n)}}),A}},V=b.n;try{(re?"production":void 0)!=="production"&<.delete(n);const m=c(n,e,_,I);return(re?"production":void 0)!=="production"&<.has(n)&&console.warn("Detected store mutation during atom read. This is not supported."),x(n,e,m),ke(m)&&(at(m,()=>v==null?void 0:v.abort()),m.then(E,E)),(t=l.r)==null||t.call(l,e),b}catch(m){return delete b.v,b.e=m,++b.n,b}finally{p=!1,V!==b.n&&o.get(e)===V&&(o.set(e,b.n),a.add(e),(s=l.c)==null||s.call(l,e))}},Ts=(n,e)=>{const t=U(n),s=t[1],i=t[2],r=t[11],o=[e];for(;o.length;){const a=o.pop(),l=r(n,a);for(const c of cn(a,l,s)){const f=r(n,c);i.set(c,f.n),o.push(c)}}},ks=(n,e,...t)=>{const s=U(n),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 y=!0;const x=p=>Ae(f(n,p)),b=(p,...E)=>{var _;const v=a(n,p);try{if(p===e){if(!on(p))throw new Error("atom not writable");(re?"production":void 0)!=="production"&<.add(n);const A=v.n,I=E[0];h(n,p,I),d(n,p),A!==v.n&&(i.add(p),u(n,p),(_=r.c)==null||_.call(r,p));return}else return g(n,p,...E)}finally{y||(c(n),l(n))}};try{return o(n,e,x,b,...t)}finally{y=!1}},Ds=(n,e)=>{var t;const s=U(n),i=s[1],r=s[3],o=s[6],a=s[11],l=s[15],c=s[18],f=s[19],u=a(n,e),g=i.get(e);if(g&&!an(u.v)){for(const[d,h]of u.d)if(!g.d.has(d)){const y=a(n,d);c(n,d).t.add(e),g.d.add(d),h!==y.n&&(r.add(d),l(n,d),(t=o.c)==null||t.call(o,d))}for(const d of g.d)if(!u.d.has(d)){g.d.delete(d);const h=f(n,d);h==null||h.t.delete(e)}}},$s=(n,e)=>{var t;const s=U(n),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(n,e);let y=i.get(e);if(!y){u(n,e);for(const x of h.d.keys())d(n,x).t.add(e);if(y={l:new Set,d:new Set(h.d.keys()),t:new Set},i.set(e,y),ot(e)){const x=()=>{let b=!0;const p=(...E)=>{try{return g(n,e,...E)}finally{b||(f(n),c(n))}};try{const E=a(n,e,p);E&&(y.u=()=>{b=!0;try{E()}finally{b=!1}})}finally{b=!1}};r.add(x)}(t=o.m)==null||t.call(o,e)}return y},Fs=(n,e)=>{var t,s;const i=U(n),r=i[1],o=i[5],a=i[6],l=i[11],c=i[19],f=l(n,e);let u=r.get(e);if(!u||u.l.size)return u;let g=!1;for(const d of u.t)if((t=r.get(d))!=null&&t.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(n,d);h==null||h.t.delete(e)}(s=a.u)==null||s.call(a,e);return}return u},js=(n,e,t)=>{const s=U(n)[11],i=s(n,e),r="v"in i,o=i.v;if(ke(t))for(const a of i.d.keys())ln(e,t,s(n,a));i.v=t,delete i.e,(!r||!Object.is(o,i.v))&&(++i.n,ke(o)&&Ls(o))},Vs=(n,e)=>{const t=U(n)[14];return Ae(t(n,e))},Ms=(n,e,...t)=>{const s=U(n),i=s[12],r=s[13],o=s[16];try{return o(n,e,...t)}finally{r(n),i(n)}},Bs=(n,e,t)=>{const s=U(n),i=s[12],r=s[18],o=s[19],l=r(n,e).l;return l.add(t),i(n),()=>{l.delete(t),o(n,e),i(n)}},un=new WeakMap,U=n=>{const e=un.get(n);if((re?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Us(...n){const e={get(s){const i=U(e)[21];return i(e,s)},set(s,...i){const r=U(e)[22];return r(e,s,...i)},sub(s,i){const r=U(e)[23];return r(e,s,i)}},t=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Rs,Cs,Es,_s,Ns,Is,Ps,As,Ts,ks,Ds,$s,Fs,js,Vs,Ms,Bs,void 0].map((s,i)=>n[i]||s);return un.set(e,Object.freeze(t)),e}const fn={};let Ks=0;function ri(n,e){const t=`atom${++Ks}`,s={toString(){return(fn?"production":void 0)!=="production"&&this.debugLabel?t+":"+this.debugLabel:t}};return typeof n=="function"?s.read=n:(s.init=n,s.read=Hs,s.write=Ws),e&&(s.write=e),s}function Hs(n){return n(this)}function Ws(n,e,t){return e(this,typeof t=="function"?t(n(this)):t)}function zs(){return Us()}let ye;function Gs(){return ye||(ye=zs(),(fn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ye),globalThis.__JOTAI_DEFAULT_STORE__!==ye&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ye}const Js={},qs=w.createContext(void 0);function dn(n){return w.useContext(qs)||Gs()}const ct=n=>typeof(n==null?void 0:n.then)=="function",ut=n=>{n.status||(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}))},Ys=xe.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(ut(n),n)}),ze=new WeakMap,Ut=(n,e)=>{let t=ze.get(n);return t||(t=new Promise((s,i)=>{let r=n;const o=c=>f=>{r===c&&s(f)},a=c=>f=>{r===c&&i(f)},l=()=>{try{const c=e();ct(c)?(ze.set(c,t),r=c,c.then(o(c),a(c)),at(c,l)):s(c)}catch(c){i(c)}};n.then(o(n),a(n)),at(n,l)}),ze.set(n,t)),t};function Qs(n,e){const{delay:t,unstable_promiseStatus:s=!xe.use}={},i=dn(),[[r,o,a],l]=w.useReducer(f=>{const u=i.get(n);return Object.is(f[0],u)&&f[1]===i&&f[2]===n?f:[u,i,n]},void 0,()=>[i.get(n),i,n]);let c=r;if((o!==i||a!==n)&&(l(),c=i.get(n)),w.useEffect(()=>{const f=i.sub(n,()=>{if(s)try{const u=i.get(n);ct(u)&&ut(Ut(u,()=>i.get(n)))}catch{}if(typeof t=="number"){setTimeout(l,t);return}l()});return l(),f},[i,n,t,s]),w.useDebugValue(c),ct(c)){const f=Ut(c,()=>i.get(n));return s&&ut(f),Ys(f)}return c}function Xs(n,e){const t=dn();return w.useCallback((...i)=>{if((Js?"production":void 0)!=="production"&&!("write"in n))throw new Error("not writable atom");return t.set(n,...i)},[t,n])}function oi(n,e){return[Qs(n),Xs(n)]}export{si as S,ti as a,Xs as b,ii as c,oi as d,Ss as e,ri as f,Qs as g,G as i,ni as u};
|