@inkeep/open-knowledge 0.85.0-beta.3 → 0.85.0-beta.4
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/cli.mjs +6 -6
- package/dist/constants-D5w683OR.mjs +1 -0
- package/dist/{dist-CqZISrZN.mjs → dist-BCYVWHsR.mjs} +318 -318
- package/dist/{dist-DjEZX3vG.mjs → dist-NhLRGMzw.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init-CzUtIxs8.mjs +1 -0
- package/dist/{init-4Osufus_.mjs → init-iH-arA2G.mjs} +2 -2
- package/dist/{launch-json-removal-Bty3GkiI.mjs → launch-json-removal-7EPfW1gR.mjs} +1 -1
- package/dist/{loader-CS3-Fsyn.mjs → loader-BPBqgr-2.mjs} +1 -1
- package/dist/loader-C15d7cmm.mjs +1 -0
- package/dist/{open-browser-CbRl45f4.mjs → open-browser-BA4x7USG.mjs} +1 -1
- package/dist/{preview-KORy1a0W.mjs → preview-C8nGyFNQ.mjs} +1 -1
- package/dist/preview-CVz9i5jg.mjs +1 -0
- package/dist/public/assets/{AccountSection-adN2rwhj.js → AccountSection-uEZl_mju.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-Bdl6OmHI.js → ActivityModeContent-D6bm4kJT.js} +1 -1
- package/dist/public/assets/AddPropertiesButton-BbxqMedS.js +2 -0
- package/dist/public/assets/{AgentDiffPane-Cecw3Mrv.js → AgentDiffPane-DxqfS7to.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-NIZW2veu.js → AttachmentsSection-D4gD9K5F.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Doo-cuhn.js → CodeMirrorPropInput-Buv5WUqJ.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-Bxk1NLVc.js → ContentRulesSection-Br-l422Z.js} +1 -1
- package/dist/public/assets/{DocumentContext-raAZ6wU_.js → DocumentContext-CorZvYgo.js} +14 -14
- package/dist/public/assets/{EditorModeToggle-Codw9OqM.js → EditorModeToggle-CRzHwk_c.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-U8ndHRsw.js → ExcalidrawDocEditor-EQVCkgpX.js} +1 -1
- package/dist/public/assets/FeedbackForm-B3LCnaN-.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-3MZYBShq.js → ImportSkillDialog-DuG9JEye.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-BoSX9Y5f.js → LinkPreviewsSection--PnKeBLD.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-CS35dOCn.js → LintConfigEditor-jcGxgQwc.js} +1 -1
- package/dist/public/assets/{LintingSection-Bw-7lE63.js → LintingSection-Dvgj5Ttf.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DuJcCo7W.js → ManagedArtifactProperties-Bsvat-ju.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DQGljSd5.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-CdTiKD4M.js → MermaidDocEditor-VR7GsjSm.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-BtuXAqBC.js → NetworkAccessSection-D43WDwx9.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-iK21Zw0T.js → PropertyDisplayRow-CWrQAKBl.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-DGTwvn4-.js → PublishToGitHubDialog-C3wLeehy.js} +1 -1
- package/dist/public/assets/ReportBugMenuTrigger-B7ha_vzT.js +1 -0
- package/dist/public/assets/{SchemaConfigEditor-GopsnCZi.js → SchemaConfigEditor-CGaJB0xn.js} +1 -1
- package/dist/public/assets/{SearchSection-k_3iYUVu.js → SearchSection-a8lszdwH.js} +1 -1
- package/dist/public/assets/SessionsHost-BjkYqOzo.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-B4Xc27xN.js → SettingsDialogBody-Cg5j6OJH.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-EQZ57mKG.js → ShareReceiveMissDialog-DRGvyccq.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-Cm-CL6Lw.js → SkillToolbarControls-uJO_ykPP.js} +1 -1
- package/dist/public/assets/{SourceEditor-DGT7q2vJ.js → SourceEditor-D0RSGDUt.js} +1 -1
- package/dist/public/assets/{SyncSection-Ba_tWnaD.js → SyncSection-CRG2LkSG.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-DsP-NJ9v.js → SyncStatusBadge-DoYJzvIT.js} +1 -1
- package/dist/public/assets/{TerminalSection-DqzX_FyW.js → TerminalSection-6ExXD5z5.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-D6dgChoj.js → TerminalWindowApp-B2mnEA0Z.js} +1 -1
- package/dist/public/assets/{TextDocEditor-hRlsB7CJ.js → TextDocEditor-CzwNYI5Q.js} +1 -1
- package/dist/public/assets/{ThreadView-nZLg8IBy.js → ThreadView-CAfBkY-n.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-B6pKH3m8.js → TimelineDiffPane-Oj5zOvzN.js} +1 -1
- package/dist/public/assets/client-version-DDIvS8RB.js +1 -0
- package/dist/public/assets/{comment-chips-Od0yEqg-.js → comment-chips-DNwQbxLO.js} +1 -1
- package/dist/public/assets/{config-provider-D7tAjHlA.js → config-provider-2W1hFFiT.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-CpjaremK.js → doc-undo-manager-1o5q5gwi.js} +1 -1
- package/dist/public/assets/index-ClMapCCf.js +2205 -0
- package/dist/public/assets/{lint-plugins-Cxhn9QhZ.js → lint-plugins-BTxsaGaY.js} +1 -1
- package/dist/public/assets/{constants-embedded-host-Cc7UiZn-.js → local-menu-action-bus-Dyh2UJJF.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DdinvxKF.js → pending-receive-nav-store-CsnZS_Ro.js} +1 -1
- package/dist/public/assets/preferred-session-events-DhdzT8Vr.js +1 -0
- package/dist/public/assets/{progress-Bt6heYrW.js → progress-CLlmYVN5.js} +1 -1
- package/dist/public/assets/{selection-context--RG_zbL1.js → selection-context-BiUjqAKb.js} +1 -1
- package/dist/public/assets/{src-DFrY4htS.js → src-DGY0VXnv.js} +1 -1
- package/dist/public/assets/telemetry-impl-C_SzfD38.js +2 -0
- package/dist/public/assets/{telemetry-startup-D2JgukUW.js → telemetry-startup-CrBJFhWz.js} +1 -1
- package/dist/public/assets/terminal-launch-events-BCKO9apj.js +1 -0
- package/dist/public/assets/{typing-burst-detector-NbMMCwJS.js → typing-burst-detector-BvJppmhO.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BKll2Lbb.js → use-activity-panel-vwUB_0Q4.js} +1 -1
- package/dist/public/assets/{use-open-skill-DhCIdizW.js → use-open-skill-D0ybF2gq.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BpmUhMxt.js → use-terminal-enabled-BAfmRgEk.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-Crd78V2q.js → use-timeline-entry-diff-CFyLJSDJ.js} +1 -1
- package/dist/public/index.html +21 -21
- package/dist/{registry-probes-nLYr85hO.mjs → registry-probes-CM3GVnGY.mjs} +1 -1
- package/dist/{removal-file-path-Du3wSYg2.mjs → removal-file-path-oz6iBHDK.mjs} +1 -1
- package/dist/{repair-launch-json-7swt92TB.mjs → repair-launch-json-DNSuSUsH.mjs} +1 -1
- package/dist/{repair-mcp-configs-BVVEzHSL.mjs → repair-mcp-configs-Bahn7_bp.mjs} +1 -1
- package/dist/{src-CjGU_F3L.mjs → src-BqzHUD_W.mjs} +1 -1
- package/dist/src-DKF_fAWB.mjs +1 -0
- package/dist/start-BueKHDx7.mjs +1 -0
- package/dist/{start-BsjkUr3B.mjs → start-CEEWMHcQ.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-8euN_q24.mjs +0 -1
- package/dist/init-D-qTABj_.mjs +0 -1
- package/dist/loader-wfRoAciM.mjs +0 -1
- package/dist/preview-jQZ_AkTH.mjs +0 -1
- package/dist/public/assets/AddPropertiesButton-DK0-byQh.js +0 -2
- package/dist/public/assets/FeedbackForm-CUfwmv_p.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-yEbsB8JQ.js +0 -1
- package/dist/public/assets/ReportBugMenuTrigger-D6HmlS6i.js +0 -1
- package/dist/public/assets/SessionsHost-yRLL-gt6.js +0 -2
- package/dist/public/assets/client-version-BJKWodjV.js +0 -1
- package/dist/public/assets/index-CfvFSmB5.js +0 -2205
- package/dist/public/assets/preferred-session-events-6GbGlu8P.js +0 -1
- package/dist/public/assets/telemetry-impl-BXY-sj8p.js +0 -2
- package/dist/public/assets/terminal-launch-events-C-sad7ou.js +0 -1
- package/dist/src-D7Kik7MH.mjs +0 -1
- package/dist/start-DEN3IHqV.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./lint-plugin-meta-CtDE2R0v.js";import{FrontmatterPluginSection as t,MarkdownlintPluginSection as n,OkfPluginSection as r}from"./LintingSection-
|
|
1
|
+
import{t as e}from"./lint-plugin-meta-CtDE2R0v.js";import{FrontmatterPluginSection as t,MarkdownlintPluginSection as n,OkfPluginSection as r}from"./LintingSection-Dvgj5Ttf.js";var i={markdownlint:n,frontmatter:t,okf:r},a=e.map(e=>({...e,Section:i[e.id]}));export{a as LINT_PLUGIN_UI};
|
package/dist/public/assets/{constants-embedded-host-Cc7UiZn-.js → local-menu-action-bus-Dyh2UJJF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./note-window-mode-CI3Yju9B.js";import{t}from"./createLucideIcon-DdBzwsHe.js";function n(t,n){if(typeof window>`u`||n!==window||!e())return!1;let r=window.okDesktop?.noteWindow?.dispatchToMain;return typeof r==`function`?(r(t).then(e=>{e.ok||console.warn(`[note-window] main-window action dispatch declined`,{reason:e.reason,kind:t.kind})}).catch(e=>{console.warn(`[note-window] main-window action dispatch failed`,e)}),!0):!1}var r=t(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),i=t(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),a=Object.freeze({launcherBorne:!1}),o=new Set,s=null;function c(){if(s!==null)return;let e=typeof window<`u`?window.okDesktop:void 0;e==null||typeof e.onMenuAction!=`function`||(s=e.onMenuAction((e,t)=>{d(e,t)}))}function l(){o.size===0&&s!==null&&(s(),s=null)}function u(e){return o.add(e),c(),()=>{o.delete(e),l()}}function d(e,t=a){for(let n of o)try{n(e,t)}catch(e){console.error(`[local-menu-action-bus] subscriber threw during dispatch:`,e)}}
|
|
1
|
+
import{t as e}from"./note-window-mode-CI3Yju9B.js";import{t}from"./createLucideIcon-DdBzwsHe.js";function n(t,n){if(typeof window>`u`||n!==window||!e())return!1;let r=window.okDesktop?.noteWindow?.dispatchToMain;return typeof r==`function`?(r(t).then(e=>{e.ok||console.warn(`[note-window] main-window action dispatch declined`,{reason:e.reason,kind:t.kind})}).catch(e=>{console.warn(`[note-window] main-window action dispatch failed`,e)}),!0):!1}var r=t(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),i=t(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),a=Object.freeze({launcherBorne:!1}),o=new Set,s=null;function c(){if(s!==null)return;let e=typeof window<`u`?window.okDesktop:void 0;e==null||typeof e.onMenuAction!=`function`||(s=e.onMenuAction((e,t)=>{d(e,t)}))}function l(){o.size===0&&s!==null&&(s(),s=null)}function u(e){return o.add(e),c(),()=>{o.delete(e),l()}}function d(e,t=a){for(let n of o)try{n(e,t)}catch(e){console.error(`[local-menu-action-bus] subscriber threw during dispatch:`,e)}}export{n as a,r as i,u as n,i as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{t as l}from"./createLucideIcon-DdBzwsHe.js";import{D as u,S as d,T as f,b as p,d as m,h,i as g,n as _,t as v,w as y,y as b}from"./SyncStatusBadge-DsP-NJ9v.js";import{t as x}from"./arrow-up-right-nJaICi16.js";import{t as S}from"./check-B2OLRY33.js";import{t as C}from"./folder-open-COGOeTzI.js";import{t as w}from"./info-CyR0W2SK.js";import{t as T}from"./spinner-Bx8xD6f8.js";import{n as E}from"./miss-dialog-store-CsiJb9Ou.js";import{t as D}from"./refresh-cw-CC7UZEnZ.js";import{t as O}from"./triangle-alert-BXrUEeRU.js";import{i as k,p as A}from"./doc-hash-BJkweiX9.js";import{r as j}from"./doc-paths-cEiFVCxr.js";import{t as M}from"./external-link-CldCnbtR.js";import{t as N}from"./use-git-sync-status-DPG8QuKs.js";var P=l(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),F=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),I=l(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),L=a(),R=e(n(),1),z=t(),B=`https://git-scm.com/docs/git-push`;function V(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function ee(e){if(!e)return!1;let t=g(e);return t!==`dormant`&&t!==`disabled`&&t!==`auth-error`&&t!==`conflict`}function te(e){let t=(0,L.c)(11),{status:n,className:r}=e,i=n?.pausedReason;if(!m(i))return null;let a;t[0]===r?a=t[1]:(a=o(`flex min-w-0 flex-col gap-1.5`,r),t[0]=r,t[1]=a);let s;t[2]===i?s=t[3]:(s=(0,z.jsx)(`span`,{children:(0,z.jsx)(v,{reason:i})}),t[2]=i,t[3]=s);let c;t[4]!==i||t[5]!==n?.refusedSymlinkPaths?(c=i===`unsafe-incoming-symlinks`?(0,z.jsx)(_,{paths:n?.refusedSymlinkPaths}):null,t[4]=i,t[5]=n?.refusedSymlinkPaths,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,z.jsxs)(`div`,{className:a,"data-testid":`sync-now-paused-notice`,children:[s,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function H(e){let t=(0,L.c)(52),{freshness:n,status:a,kind:o}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:f,onConfirm:m}=p(d()),[g,_]=(0,R.useState)(`idle`),v=(0,R.useRef)(null),y,C;if(t[0]!==a||t[1]!==g?(y=()=>{if(!(g!==`pending`||!a)){if(a.pushError||a.pushErrorCode){_(`idle`);return}(a.lastSyncUtc??null)!==v.current&&_(`synced`)}},C=[g,a],t[0]=a,t[1]=g,t[2]=y,t[3]=C):(y=t[2],C=t[3]),(0,R.useEffect)(y,C),!V(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(O,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,z.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(g===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,z.jsx)(S,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:(0,z.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let E=a?.syncEnabled===!0,k=a?.pushPermission?.checkStatus===`denied`,A=!!(a?.pushError||a?.pushErrorCode),j=k||A,M=n===`absent`&&!E,N;if(n===`absent`&&!E){let e;t[10]!==c||t[11]!==o?(e=c(o===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=o,t[12]=e):e=t[12],N=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==o?(e=c(o===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=o,t[15]=e):e=t[15],N=e}else{let e;t[16]!==c||t[17]!==o?(e=c(o===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=o,t[18]=e):e=t[18],N=e}let P;t[19]!==c||t[20]!==A||t[21]!==k?(P=k?c({id:`9OIqw4`}):A?c({id:`K6MQQk`}):null,t[19]=c,t[20]=A,t[21]=k,t[22]=P):P=t[22];let F=P,I;t[23]===a?.lastSyncUtc?I=t[24]:(I=()=>{v.current=a?.lastSyncUtc??null,_(`pending`),b(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),_(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=I);let H=I,W=M?O:w,G;t[25]===W?G=t[26]:(G=(0,z.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=W,t[26]=G);let K;t[27]===N?K=t[28]:(K=(0,z.jsx)(`span`,{children:N}),t[27]=N,t[28]=K);let q;t[29]===F?q=t[30]:(q=F?(0,z.jsx)(`span`,{children:F}):null,t[29]=F,t[30]=q);let J;t[31]!==j||t[32]!==H||t[33]!==f||t[34]!==a||t[35]!==E||t[36]!==g?(J=j?null:E?ee(a)?(0,z.jsx)(`div`,{children:g===`pending`?(0,z.jsxs)(s,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,z.jsx)(T,{icon:D,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`EHu0x2`})]}):(0,z.jsx)(s,{variant:`outline`,size:`xs`,onClick:H,children:(0,z.jsx)(r,{id:`lb_UU4`})})}):(0,z.jsx)(te,{status:a}):(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,z.jsx)(s,{variant:`outline`,size:`xs`,onClick:()=>f(!0),children:(0,z.jsx)(r,{id:`pPiV8s`})}),(0,z.jsxs)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,onClick:ne,onAuxClick:U,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,z.jsx)(r,{id:`GLxIKR`}),(0,z.jsx)(x,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=j,t[32]=H,t[33]=f,t[34]=a,t[35]=E,t[36]=g,t[37]=J):J=t[37];let Y;t[38]!==K||t[39]!==q||t[40]!==J?(Y=(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[K,q,J]}),t[38]=K,t[39]=q,t[40]=J,t[41]=Y):Y=t[41];let X;t[42]!==G||t[43]!==Y?(X=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[G,Y]}),t[42]=G,t[43]=Y,t[44]=X):X=t[44];let Z;t[45]!==l||t[46]!==m||t[47]!==u?(Z=(0,z.jsx)(h,{open:l,onOpenChange:u,onConfirm:m}),t[45]=l,t[46]=m,t[47]=u,t[48]=Z):Z=t[48];let Q;return t[49]!==X||t[50]!==Z?(Q=(0,z.jsxs)(z.Fragment,{children:[X,Z]}),t[49]=X,t[50]=Z,t[51]=Q):Q=t[51],Q}function U(e){return M(e,B)}function ne(e){return M(e,B)}function W(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function G(e){let t=(0,L.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,R.useState)(n),[a,o]=(0,R.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.contentRootDepth||t[3]!==e.kind||t[4]!==e.path||t[5]!==e.repositoryPath?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.repositoryPath??e.path,kind:e.kind,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.contentRootDepth,t[3]=e.kind,t[4]=e.path,t[5]=e.repositoryPath,t[6]=c):c=t[6];let l;t[7]!==s||t[8]!==a||t[9]!==e.contentRootDepth||t[10]!==e.kind||t[11]!==e.path||t[12]!==e.repositoryPath?(l=[s,e.kind,e.path,e.repositoryPath,e.contentRootDepth,a],t[7]=s,t[8]=a,t[9]=e.contentRootDepth,t[10]=e.kind,t[11]=e.path,t[12]=e.repositoryPath,t[13]=l):l=t[13],(0,R.useEffect)(c,l);let u;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(K)},t[14]=u):u=t[14];let d;return t[15]===r?d=t[16]:(d={state:r,refetch:u},t[15]=r,t[16]=d),d}function K(e){return e+1}function q(e){let t=(0,L.c)(15),{onEnabled:n}=e,i=d(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:o,setConfirmOpen:c,onToggleRequest:l,onConfirm:u}=p(i,a),f;t[2]===l?f=t[3]:(f=()=>l(!0),t[2]=l,t[3]=f);let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),g=(0,z.jsx)(r,{id:`pPiV8s`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _;t[6]===f?_=t[7]:(_=(0,z.jsxs)(s,{onClick:f,"data-testid":`share-receive-miss-enable-sync`,children:[m,g]}),t[6]=f,t[7]=_);let v;t[8]!==o||t[9]!==u||t[10]!==c?(v=(0,z.jsx)(h,{open:o,onOpenChange:c,onConfirm:u}),t[8]=o,t[9]=u,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,z.jsxs)(z.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function J(e){let t=(0,L.c)(23),{status:n,onSyncCompleted:a}=e,{_:o}=i(),[l,u]=(0,R.useState)(!1),d=(0,R.useRef)(null),f;t[0]!==a||t[1]!==l||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(f=()=>{if(l){if(n.pushError||n.pushErrorCode){u(!1);return}(n.lastSyncUtc??null)!==d.current&&(u(!1),a?.())}},t[0]=a,t[1]=l,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=f):f=t[5];let p;t[6]!==a||t[7]!==l||t[8]!==n?(p=[l,n,a],t[6]=a,t[7]=l,t[8]=n,t[9]=p):p=t[9],(0,R.useEffect)(f,p);let m;t[10]!==o||t[11]!==n.lastSyncUtc?(m=()=>{d.current=n.lastSyncUtc??null,u(!0),b(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),u(!1),c.error(o({id:`1u-mAI`}))})},t[10]=o,t[11]=n.lastSyncUtc,t[12]=m):m=t[12];let h=m,g;t[13]!==h||t[14]!==l?(g=l?(0,z.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,z.jsx)(T,{icon:D,className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`EHu0x2`})]}):(0,z.jsxs)(s,{onClick:h,"data-testid":`share-receive-miss-sync-now`,children:[(0,z.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`lb_UU4`})]}),t[13]=h,t[14]=l,t[15]=g):g=t[15];let _;t[16]===l?_=t[17]:(_=l?(0,z.jsx)(r,{id:`dXOolp`}):null,t[16]=l,t[17]=_);let v;t[18]===_?v=t[19]:(v=(0,z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:_}),t[18]=_,t[19]=v);let y;return t[20]!==g||t[21]!==v?(y=(0,z.jsxs)(z.Fragment,{children:[g,v]}),t[20]=g,t[21]=v,t[22]=y):y=t[22],y}var Y=!1;function X(e){return!Y&&e!==null&&e.syncEnabled!==!0}function Z(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function Q(e,t){let n=(0,L.c)(15),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),l=(0,R.useRef)(null),u,d;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(X(e)){Y=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},d=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=d):(u=n[3],d=n[4]),(0,R.useEffect)(u,d);let f;n[5]===t?f=n[6]:(f=()=>{c(!1),t?.()},n[5]=t,n[6]=f);let p;n[7]===e?.lastPullUtc?p=n[8]:(p=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),b(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=p);let m;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==f||n[13]!==p?(m={pending:r,failure:a,offering:s,resolveOffer:f,start:p},n[9]=a,n[10]=s,n[11]=r,n[12]=f,n[13]=p,n[14]=m):m=n[14],m}function re(e){let t=(0,L.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,z.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,z.jsx)(T,{icon:D,className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`4uNLmk`})]}):(0,z.jsxs)(s,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,z.jsx)(u,{className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n?(0,z.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=o);let c;t[5]===o?c=t[6]:(c=(0,z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,z.jsxs)(z.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function ie(e){let t=(0,L.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=f(),a=(0,R.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c={onApplied:s},t[2]=s,t[3]=c);let{confirmOpen:l,setConfirmOpen:u,onModeSelect:d,onConfirm:p}=y(i,`off`,c),m=(0,R.useRef)(!1),g,_;t[4]===d?(g=t[5],_=t[6]):(g=()=>{m.current||(m.current=!0,d(`follow`))},_=[d],t[4]=d,t[5]=g,t[6]=_),(0,R.useEffect)(g,_);let v;t[7]!==s||t[8]!==u?(v=e=>{u(e),e||s()},t[7]=s,t[8]=u,t[9]=v):v=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==l||t[14]!==r||t[15]!==v||t[16]!==b?(x=(0,z.jsx)(h,{open:l,onOpenChange:v,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=l,t[14]=r,t[15]=v,t[16]=b,t[17]=x):x=t[17],x}function ae(e){let t=(0,L.c)(108),{nav:n,state:a,onBrowseFolder:o,onOpenRenamed:c,onEnableAutoSync:l,onSyncCompleted:d,onPullApplied:f}=e,{_:p}=i(),h=N(),g=Q(h,f),y=n.branch,b;t[0]!==p||t[1]!==n.kind?(b=n.kind===`folder`?p({id:`ugoTXs`}):p({id:`XH30C4`}),t[0]=p,t[1]=n.kind,t[2]=b):b=t[2];let x=b;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{className:`size-5`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:S}=a,w,D;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,z.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),D=(0,z.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=D):(w=t[4],D=t[5]);let O;t[6]===o?O=t[7]:(O=(0,z.jsxs)(s,{variant:`outline`,onClick:o,"data-testid":`share-receive-miss-browse`,children:[w,D]}),t[6]=o,t[7]=O);let k=O,A,j,M,R=null;if(S.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(E,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],A=e;let n;t[9]!==S.renamedTo||t[10]!==x?(n={0:S.renamedTo,targetNoun:x},t[9]=S.renamedTo,t[10]=x,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,z.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),j=a;let o;t[15]!==c||t[16]!==S.renamedTo?(o=()=>c(S.renamedTo),t[15]=c,t[16]=S.renamedTo,t[17]=o):o=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(E,{className:`size-4`,"aria-hidden":`true`}),u=(0,z.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===o?d=t[21]:(d=(0,z.jsxs)(s,{onClick:o,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=o,t[21]=d);let f;t[22]!==k||t[23]!==d?(f=(0,z.jsxs)(z.Fragment,{children:[d,k]}),t[22]=k,t[23]=d,t[24]=f):f=t[24],M=f}else if(S.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(I,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],A=e;let n;t[26]!==y||t[27]!==x?(n={targetNoun:x,branch:y},t[26]=y,t[27]=x,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,z.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),j=a,M=k}else if(S.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(F,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],A=e;let n;t[33]!==y||t[34]!==x?(n={targetNoun:x,branch:y},t[33]=y,t[34]=x,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,z.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),j=a,M=k}else if(S.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(P,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],A=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==y||t[41]!==x?(e=y===null?(0,z.jsx)(r,{id:`RyIKxy`,values:{targetNoun:x}}):(0,z.jsx)(r,{id:`l6kpzR`,values:{targetNoun:x,branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=y,t[41]=x,t[42]=e):e=t[42],j=e}else{let e;t[43]!==y||t[44]!==x?(e=y===null?(0,z.jsx)(r,{id:`UuYo7g`,values:{targetNoun:x}}):(0,z.jsx)(r,{id:`HoWElC`,values:{targetNoun:x,branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=y,t[44]=x,t[45]=e):e=t[45],j=e}let a=null;if(h?.syncEnabled){let e;t[46]===h?e=t[47]:(e=ee(h),t[46]=h,t[47]=e);let n=e,r;t[48]!==n||t[49]!==h?(r=!n&&m(h.pausedReason),t[48]=n,t[49]=h,t[50]=r):r=t[50];let o=r,s=o?`w-full max-w-md text-balance text-1sm text-muted-foreground`:`sr-only`,c;t[51]!==o||t[52]!==h?(c=o?(0,z.jsx)(te,{status:h}):null,t[51]=o,t[52]=h,t[53]=c):c=t[53];let l;if(t[54]!==s||t[55]!==c?(l=(0,z.jsx)(`div`,{role:`status`,className:s,"data-testid":`share-receive-miss-sync-paused`,children:c}),t[54]=s,t[55]=c,t[56]=l):l=t[56],R=l,n&&!i){let e;t[57]!==d||t[58]!==h?(e=(0,z.jsx)(J,{status:h,onSyncCompleted:d}),t[57]=d,t[58]=h,t[59]=e):e=t[59],a=e}}else if(h!==null){let e;t[60]===l?e=t[61]:(e=(0,z.jsx)(q,{onEnabled:l}),t[60]=l,t[61]=e),a=e}let o;t[62]!==k||t[63]!==a?(o=(0,z.jsxs)(z.Fragment,{children:[a,k]}),t[62]=k,t[63]=a,t[64]=o):o=t[64],M=o}else{let e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(u,{className:`size-9`,"aria-hidden":`true`}),t[65]=e):e=t[65],A=e;let n;t[66]===h?n=t[67]:(n=Z(h),t[66]=h,t[67]=n);let i=n;if(i){let e;t[68]===y?e=t[69]:(e=y===null?(0,z.jsx)(r,{id:`gwEcOD`}):(0,z.jsx)(r,{id:`wvK7Ay`,values:{branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[68]=y,t[69]=e),j=e}else{let e;t[70]===y?e=t[71]:(e=y===null?(0,z.jsx)(r,{id:`Xewl6B`}):(0,z.jsx)(r,{id:`d1JjXo`,values:{branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[70]=y,t[71]=e),j=e}let a=g.failure===`refused`&&h?.pausedReason===`unsafe-incoming-symlinks`,o=a?`flex w-full max-w-md flex-col gap-2`:`contents`,s=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,c;t[72]!==g.failure||t[73]!==a?(c=a?(0,z.jsx)(v,{reason:`unsafe-incoming-symlinks`}):g.failure===`refused`?(0,z.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,z.jsx)(r,{id:`JG_8KT`}):null,t[72]=g.failure,t[73]=a,t[74]=c):c=t[74];let l;t[75]!==s||t[76]!==c?(l=(0,z.jsx)(`p`,{role:`alert`,className:s,"data-testid":`share-receive-miss-pull-error`,children:c}),t[75]=s,t[76]=c,t[77]=l):l=t[77];let d;t[78]!==a||t[79]!==h?.refusedSymlinkPaths?(d=a?(0,z.jsx)(_,{paths:h?.refusedSymlinkPaths}):null,t[78]=a,t[79]=h?.refusedSymlinkPaths,t[80]=d):d=t[80];let f;t[81]!==l||t[82]!==d||t[83]!==o?(f=(0,z.jsxs)(`div`,{className:o,children:[l,d]}),t[81]=l,t[82]=d,t[83]=o,t[84]=f):f=t[84],R=f;let p;t[85]!==i||t[86]!==g.pending||t[87]!==g.start?(p=i?(0,z.jsx)(re,{pending:g.pending,onPull:g.start}):null,t[85]=i,t[86]=g.pending,t[87]=g.start,t[88]=p):p=t[88];let m;t[89]!==g.offering||t[90]!==g.resolveOffer||t[91]!==h?.ahead?(m=g.offering?(0,z.jsx)(ie,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[89]=g.offering,t[90]=g.resolveOffer,t[91]=h?.ahead,t[92]=m):m=t[92];let b;t[93]!==k||t[94]!==p||t[95]!==m?(b=(0,z.jsxs)(z.Fragment,{children:[p,k,m]}),t[93]=k,t[94]=p,t[95]=m,t[96]=b):b=t[96],M=b}let B;t[97]===A?B=t[98]:(B=(0,z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:A}),t[97]=A,t[98]=B);let V;t[99]===j?V=t[100]:(V=(0,z.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:j}),t[99]=j,t[100]=V);let H;t[101]===M?H=t[102]:(H=(0,z.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:M}),t[101]=M,t[102]=H);let U;return t[103]!==R||t[104]!==B||t[105]!==V||t[106]!==H?(U=(0,z.jsxs)(z.Fragment,{children:[B,V,R,H]}),t[103]=R,t[104]=B,t[105]=V,t[106]=H,t[107]=U):U=t[107],U}function $(e){return e.replace(/^\/+|\/+$/g,``)}function oe(e,t){if(t.kind===`folder`){if(A(e))return $(t.path)===``;let n=k(e);return n!==null&&$(n)===$(t.path)}let n=k(e);return n===null?!1:j(n)===j(t.path)}function se(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&(oe(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ce=se();function le(e,t){if(e.contentRootDepth===void 0)return{...e,path:t,repositoryPath:t};let n=(e.repositoryPath??e.path).split(`/`).slice(0,e.contentRootDepth);return{...e,path:t,repositoryPath:[...n,...t===``?[]:t.split(`/`)].join(`/`)}}function ue(e,t){return e===null||e.kind!==`missing`||t===null||j(t.path)!==e.target?null:t}export{W as a,V as c,ae as i,le as n,G as o,ce as r,H as s,ue as t};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{t as l}from"./createLucideIcon-DdBzwsHe.js";import{D as u,S as d,T as f,b as p,d as m,h,i as g,n as _,t as v,w as y,y as b}from"./SyncStatusBadge-DoYJzvIT.js";import{t as x}from"./arrow-up-right-nJaICi16.js";import{t as S}from"./check-B2OLRY33.js";import{t as C}from"./folder-open-COGOeTzI.js";import{t as w}from"./info-CyR0W2SK.js";import{t as T}from"./spinner-Bx8xD6f8.js";import{n as E}from"./miss-dialog-store-CsiJb9Ou.js";import{t as D}from"./refresh-cw-CC7UZEnZ.js";import{t as O}from"./triangle-alert-BXrUEeRU.js";import{i as k,p as A}from"./doc-hash-BJkweiX9.js";import{r as j}from"./doc-paths-cEiFVCxr.js";import{t as M}from"./external-link-CldCnbtR.js";import{t as N}from"./use-git-sync-status-DPG8QuKs.js";var P=l(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),F=l(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),I=l(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),L=a(),R=e(n(),1),z=t(),B=`https://git-scm.com/docs/git-push`;function V(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function ee(e){if(!e)return!1;let t=g(e);return t!==`dormant`&&t!==`disabled`&&t!==`auth-error`&&t!==`conflict`}function te(e){let t=(0,L.c)(11),{status:n,className:r}=e,i=n?.pausedReason;if(!m(i))return null;let a;t[0]===r?a=t[1]:(a=o(`flex min-w-0 flex-col gap-1.5`,r),t[0]=r,t[1]=a);let s;t[2]===i?s=t[3]:(s=(0,z.jsx)(`span`,{children:(0,z.jsx)(v,{reason:i})}),t[2]=i,t[3]=s);let c;t[4]!==i||t[5]!==n?.refusedSymlinkPaths?(c=i===`unsafe-incoming-symlinks`?(0,z.jsx)(_,{paths:n?.refusedSymlinkPaths}):null,t[4]=i,t[5]=n?.refusedSymlinkPaths,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,z.jsxs)(`div`,{className:a,"data-testid":`sync-now-paused-notice`,children:[s,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function H(e){let t=(0,L.c)(52),{freshness:n,status:a,kind:o}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:f,onConfirm:m}=p(d()),[g,_]=(0,R.useState)(`idle`),v=(0,R.useRef)(null),y,C;if(t[0]!==a||t[1]!==g?(y=()=>{if(!(g!==`pending`||!a)){if(a.pushError||a.pushErrorCode){_(`idle`);return}(a.lastSyncUtc??null)!==v.current&&_(`synced`)}},C=[g,a],t[0]=a,t[1]=g,t[2]=y,t[3]=C):(y=t[2],C=t[3]),(0,R.useEffect)(y,C),!V(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(O,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,z.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(g===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,z.jsx)(S,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,z.jsx)(`span`,{children:(0,z.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let E=a?.syncEnabled===!0,k=a?.pushPermission?.checkStatus===`denied`,A=!!(a?.pushError||a?.pushErrorCode),j=k||A,M=n===`absent`&&!E,N;if(n===`absent`&&!E){let e;t[10]!==c||t[11]!==o?(e=c(o===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=o,t[12]=e):e=t[12],N=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==o?(e=c(o===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=o,t[15]=e):e=t[15],N=e}else{let e;t[16]!==c||t[17]!==o?(e=c(o===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=o,t[18]=e):e=t[18],N=e}let P;t[19]!==c||t[20]!==A||t[21]!==k?(P=k?c({id:`9OIqw4`}):A?c({id:`K6MQQk`}):null,t[19]=c,t[20]=A,t[21]=k,t[22]=P):P=t[22];let F=P,I;t[23]===a?.lastSyncUtc?I=t[24]:(I=()=>{v.current=a?.lastSyncUtc??null,_(`pending`),b(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),_(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=I);let H=I,W=M?O:w,G;t[25]===W?G=t[26]:(G=(0,z.jsx)(W,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=W,t[26]=G);let K;t[27]===N?K=t[28]:(K=(0,z.jsx)(`span`,{children:N}),t[27]=N,t[28]=K);let q;t[29]===F?q=t[30]:(q=F?(0,z.jsx)(`span`,{children:F}):null,t[29]=F,t[30]=q);let J;t[31]!==j||t[32]!==H||t[33]!==f||t[34]!==a||t[35]!==E||t[36]!==g?(J=j?null:E?ee(a)?(0,z.jsx)(`div`,{children:g===`pending`?(0,z.jsxs)(s,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,z.jsx)(T,{icon:D,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`EHu0x2`})]}):(0,z.jsx)(s,{variant:`outline`,size:`xs`,onClick:H,children:(0,z.jsx)(r,{id:`lb_UU4`})})}):(0,z.jsx)(te,{status:a}):(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,z.jsx)(s,{variant:`outline`,size:`xs`,onClick:()=>f(!0),children:(0,z.jsx)(r,{id:`pPiV8s`})}),(0,z.jsxs)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,onClick:ne,onAuxClick:U,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,z.jsx)(r,{id:`GLxIKR`}),(0,z.jsx)(x,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=j,t[32]=H,t[33]=f,t[34]=a,t[35]=E,t[36]=g,t[37]=J):J=t[37];let Y;t[38]!==K||t[39]!==q||t[40]!==J?(Y=(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[K,q,J]}),t[38]=K,t[39]=q,t[40]=J,t[41]=Y):Y=t[41];let X;t[42]!==G||t[43]!==Y?(X=(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[G,Y]}),t[42]=G,t[43]=Y,t[44]=X):X=t[44];let Z;t[45]!==l||t[46]!==m||t[47]!==u?(Z=(0,z.jsx)(h,{open:l,onOpenChange:u,onConfirm:m}),t[45]=l,t[46]=m,t[47]=u,t[48]=Z):Z=t[48];let Q;return t[49]!==X||t[50]!==Z?(Q=(0,z.jsxs)(z.Fragment,{children:[X,Z]}),t[49]=X,t[50]=Z,t[51]=Q):Q=t[51],Q}function U(e){return M(e,B)}function ne(e){return M(e,B)}function W(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function G(e){let t=(0,L.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,R.useState)(n),[a,o]=(0,R.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.contentRootDepth||t[3]!==e.kind||t[4]!==e.path||t[5]!==e.repositoryPath?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.repositoryPath??e.path,kind:e.kind,...e.contentRootDepth===void 0?{}:{contentRootDepth:e.contentRootDepth}}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.contentRootDepth,t[3]=e.kind,t[4]=e.path,t[5]=e.repositoryPath,t[6]=c):c=t[6];let l;t[7]!==s||t[8]!==a||t[9]!==e.contentRootDepth||t[10]!==e.kind||t[11]!==e.path||t[12]!==e.repositoryPath?(l=[s,e.kind,e.path,e.repositoryPath,e.contentRootDepth,a],t[7]=s,t[8]=a,t[9]=e.contentRootDepth,t[10]=e.kind,t[11]=e.path,t[12]=e.repositoryPath,t[13]=l):l=t[13],(0,R.useEffect)(c,l);let u;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(K)},t[14]=u):u=t[14];let d;return t[15]===r?d=t[16]:(d={state:r,refetch:u},t[15]=r,t[16]=d),d}function K(e){return e+1}function q(e){let t=(0,L.c)(15),{onEnabled:n}=e,i=d(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:o,setConfirmOpen:c,onToggleRequest:l,onConfirm:u}=p(i,a),f;t[2]===l?f=t[3]:(f=()=>l(!0),t[2]=l,t[3]=f);let m,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),g=(0,z.jsx)(r,{id:`pPiV8s`}),t[4]=m,t[5]=g):(m=t[4],g=t[5]);let _;t[6]===f?_=t[7]:(_=(0,z.jsxs)(s,{onClick:f,"data-testid":`share-receive-miss-enable-sync`,children:[m,g]}),t[6]=f,t[7]=_);let v;t[8]!==o||t[9]!==u||t[10]!==c?(v=(0,z.jsx)(h,{open:o,onOpenChange:c,onConfirm:u}),t[8]=o,t[9]=u,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,z.jsxs)(z.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function J(e){let t=(0,L.c)(23),{status:n,onSyncCompleted:a}=e,{_:o}=i(),[l,u]=(0,R.useState)(!1),d=(0,R.useRef)(null),f;t[0]!==a||t[1]!==l||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(f=()=>{if(l){if(n.pushError||n.pushErrorCode){u(!1);return}(n.lastSyncUtc??null)!==d.current&&(u(!1),a?.())}},t[0]=a,t[1]=l,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=f):f=t[5];let p;t[6]!==a||t[7]!==l||t[8]!==n?(p=[l,n,a],t[6]=a,t[7]=l,t[8]=n,t[9]=p):p=t[9],(0,R.useEffect)(f,p);let m;t[10]!==o||t[11]!==n.lastSyncUtc?(m=()=>{d.current=n.lastSyncUtc??null,u(!0),b(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),u(!1),c.error(o({id:`1u-mAI`}))})},t[10]=o,t[11]=n.lastSyncUtc,t[12]=m):m=t[12];let h=m,g;t[13]!==h||t[14]!==l?(g=l?(0,z.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,z.jsx)(T,{icon:D,className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`EHu0x2`})]}):(0,z.jsxs)(s,{onClick:h,"data-testid":`share-receive-miss-sync-now`,children:[(0,z.jsx)(D,{className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`lb_UU4`})]}),t[13]=h,t[14]=l,t[15]=g):g=t[15];let _;t[16]===l?_=t[17]:(_=l?(0,z.jsx)(r,{id:`dXOolp`}):null,t[16]=l,t[17]=_);let v;t[18]===_?v=t[19]:(v=(0,z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:_}),t[18]=_,t[19]=v);let y;return t[20]!==g||t[21]!==v?(y=(0,z.jsxs)(z.Fragment,{children:[g,v]}),t[20]=g,t[21]=v,t[22]=y):y=t[22],y}var Y=!1;function X(e){return!Y&&e!==null&&e.syncEnabled!==!0}function Z(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function Q(e,t){let n=(0,L.c)(15),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),l=(0,R.useRef)(null),u,d;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(X(e)){Y=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},d=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=d):(u=n[3],d=n[4]),(0,R.useEffect)(u,d);let f;n[5]===t?f=n[6]:(f=()=>{c(!1),t?.()},n[5]=t,n[6]=f);let p;n[7]===e?.lastPullUtc?p=n[8]:(p=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),b(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=p);let m;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==f||n[13]!==p?(m={pending:r,failure:a,offering:s,resolveOffer:f,start:p},n[9]=a,n[10]=s,n[11]=r,n[12]=f,n[13]=p,n[14]=m):m=n[14],m}function re(e){let t=(0,L.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,z.jsxs)(s,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,z.jsx)(T,{icon:D,className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`4uNLmk`})]}):(0,z.jsxs)(s,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,z.jsx)(u,{className:`size-4`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n?(0,z.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=o);let c;t[5]===o?c=t[6]:(c=(0,z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,z.jsxs)(z.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function ie(e){let t=(0,L.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=f(),a=(0,R.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c={onApplied:s},t[2]=s,t[3]=c);let{confirmOpen:l,setConfirmOpen:u,onModeSelect:d,onConfirm:p}=y(i,`off`,c),m=(0,R.useRef)(!1),g,_;t[4]===d?(g=t[5],_=t[6]):(g=()=>{m.current||(m.current=!0,d(`follow`))},_=[d],t[4]=d,t[5]=g,t[6]=_),(0,R.useEffect)(g,_);let v;t[7]!==s||t[8]!==u?(v=e=>{u(e),e||s()},t[7]=s,t[8]=u,t[9]=v):v=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==l||t[14]!==r||t[15]!==v||t[16]!==b?(x=(0,z.jsx)(h,{open:l,onOpenChange:v,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=l,t[14]=r,t[15]=v,t[16]=b,t[17]=x):x=t[17],x}function ae(e){let t=(0,L.c)(108),{nav:n,state:a,onBrowseFolder:o,onOpenRenamed:c,onEnableAutoSync:l,onSyncCompleted:d,onPullApplied:f}=e,{_:p}=i(),h=N(),g=Q(h,f),y=n.branch,b;t[0]!==p||t[1]!==n.kind?(b=n.kind===`folder`?p({id:`ugoTXs`}):p({id:`XH30C4`}),t[0]=p,t[1]=n.kind,t[2]=b):b=t[2];let x=b;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{className:`size-5`,"aria-hidden":`true`}),(0,z.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:S}=a,w,D;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,z.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),D=(0,z.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=D):(w=t[4],D=t[5]);let O;t[6]===o?O=t[7]:(O=(0,z.jsxs)(s,{variant:`outline`,onClick:o,"data-testid":`share-receive-miss-browse`,children:[w,D]}),t[6]=o,t[7]=O);let k=O,A,j,M,R=null;if(S.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(E,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],A=e;let n;t[9]!==S.renamedTo||t[10]!==x?(n={0:S.renamedTo,targetNoun:x},t[9]=S.renamedTo,t[10]=x,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,z.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),j=a;let o;t[15]!==c||t[16]!==S.renamedTo?(o=()=>c(S.renamedTo),t[15]=c,t[16]=S.renamedTo,t[17]=o):o=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,z.jsx)(E,{className:`size-4`,"aria-hidden":`true`}),u=(0,z.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===o?d=t[21]:(d=(0,z.jsxs)(s,{onClick:o,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=o,t[21]=d);let f;t[22]!==k||t[23]!==d?(f=(0,z.jsxs)(z.Fragment,{children:[d,k]}),t[22]=k,t[23]=d,t[24]=f):f=t[24],M=f}else if(S.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(I,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],A=e;let n;t[26]!==y||t[27]!==x?(n={targetNoun:x,branch:y},t[26]=y,t[27]=x,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,z.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),j=a,M=k}else if(S.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(F,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],A=e;let n;t[33]!==y||t[34]!==x?(n={targetNoun:x,branch:y},t[33]=y,t[34]=x,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,z.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),j=a,M=k}else if(S.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(P,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],A=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==y||t[41]!==x?(e=y===null?(0,z.jsx)(r,{id:`RyIKxy`,values:{targetNoun:x}}):(0,z.jsx)(r,{id:`l6kpzR`,values:{targetNoun:x,branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=y,t[41]=x,t[42]=e):e=t[42],j=e}else{let e;t[43]!==y||t[44]!==x?(e=y===null?(0,z.jsx)(r,{id:`UuYo7g`,values:{targetNoun:x}}):(0,z.jsx)(r,{id:`HoWElC`,values:{targetNoun:x,branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=y,t[44]=x,t[45]=e):e=t[45],j=e}let a=null;if(h?.syncEnabled){let e;t[46]===h?e=t[47]:(e=ee(h),t[46]=h,t[47]=e);let n=e,r;t[48]!==n||t[49]!==h?(r=!n&&m(h.pausedReason),t[48]=n,t[49]=h,t[50]=r):r=t[50];let o=r,s=o?`w-full max-w-md text-balance text-1sm text-muted-foreground`:`sr-only`,c;t[51]!==o||t[52]!==h?(c=o?(0,z.jsx)(te,{status:h}):null,t[51]=o,t[52]=h,t[53]=c):c=t[53];let l;if(t[54]!==s||t[55]!==c?(l=(0,z.jsx)(`div`,{role:`status`,className:s,"data-testid":`share-receive-miss-sync-paused`,children:c}),t[54]=s,t[55]=c,t[56]=l):l=t[56],R=l,n&&!i){let e;t[57]!==d||t[58]!==h?(e=(0,z.jsx)(J,{status:h,onSyncCompleted:d}),t[57]=d,t[58]=h,t[59]=e):e=t[59],a=e}}else if(h!==null){let e;t[60]===l?e=t[61]:(e=(0,z.jsx)(q,{onEnabled:l}),t[60]=l,t[61]=e),a=e}let o;t[62]!==k||t[63]!==a?(o=(0,z.jsxs)(z.Fragment,{children:[a,k]}),t[62]=k,t[63]=a,t[64]=o):o=t[64],M=o}else{let e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(u,{className:`size-9`,"aria-hidden":`true`}),t[65]=e):e=t[65],A=e;let n;t[66]===h?n=t[67]:(n=Z(h),t[66]=h,t[67]=n);let i=n;if(i){let e;t[68]===y?e=t[69]:(e=y===null?(0,z.jsx)(r,{id:`gwEcOD`}):(0,z.jsx)(r,{id:`wvK7Ay`,values:{branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[68]=y,t[69]=e),j=e}else{let e;t[70]===y?e=t[71]:(e=y===null?(0,z.jsx)(r,{id:`Xewl6B`}):(0,z.jsx)(r,{id:`d1JjXo`,values:{branch:y},components:{0:(0,z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[70]=y,t[71]=e),j=e}let a=g.failure===`refused`&&h?.pausedReason===`unsafe-incoming-symlinks`,o=a?`flex w-full max-w-md flex-col gap-2`:`contents`,s=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,c;t[72]!==g.failure||t[73]!==a?(c=a?(0,z.jsx)(v,{reason:`unsafe-incoming-symlinks`}):g.failure===`refused`?(0,z.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,z.jsx)(r,{id:`JG_8KT`}):null,t[72]=g.failure,t[73]=a,t[74]=c):c=t[74];let l;t[75]!==s||t[76]!==c?(l=(0,z.jsx)(`p`,{role:`alert`,className:s,"data-testid":`share-receive-miss-pull-error`,children:c}),t[75]=s,t[76]=c,t[77]=l):l=t[77];let d;t[78]!==a||t[79]!==h?.refusedSymlinkPaths?(d=a?(0,z.jsx)(_,{paths:h?.refusedSymlinkPaths}):null,t[78]=a,t[79]=h?.refusedSymlinkPaths,t[80]=d):d=t[80];let f;t[81]!==l||t[82]!==d||t[83]!==o?(f=(0,z.jsxs)(`div`,{className:o,children:[l,d]}),t[81]=l,t[82]=d,t[83]=o,t[84]=f):f=t[84],R=f;let p;t[85]!==i||t[86]!==g.pending||t[87]!==g.start?(p=i?(0,z.jsx)(re,{pending:g.pending,onPull:g.start}):null,t[85]=i,t[86]=g.pending,t[87]=g.start,t[88]=p):p=t[88];let m;t[89]!==g.offering||t[90]!==g.resolveOffer||t[91]!==h?.ahead?(m=g.offering?(0,z.jsx)(ie,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[89]=g.offering,t[90]=g.resolveOffer,t[91]=h?.ahead,t[92]=m):m=t[92];let b;t[93]!==k||t[94]!==p||t[95]!==m?(b=(0,z.jsxs)(z.Fragment,{children:[p,k,m]}),t[93]=k,t[94]=p,t[95]=m,t[96]=b):b=t[96],M=b}let B;t[97]===A?B=t[98]:(B=(0,z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:A}),t[97]=A,t[98]=B);let V;t[99]===j?V=t[100]:(V=(0,z.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:j}),t[99]=j,t[100]=V);let H;t[101]===M?H=t[102]:(H=(0,z.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:M}),t[101]=M,t[102]=H);let U;return t[103]!==R||t[104]!==B||t[105]!==V||t[106]!==H?(U=(0,z.jsxs)(z.Fragment,{children:[B,V,R,H]}),t[103]=R,t[104]=B,t[105]=V,t[106]=H,t[107]=U):U=t[107],U}function $(e){return e.replace(/^\/+|\/+$/g,``)}function oe(e,t){if(t.kind===`folder`){if(A(e))return $(t.path)===``;let n=k(e);return n!==null&&$(n)===$(t.path)}let n=k(e);return n===null?!1:j(n)===j(t.path)}function se(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&(oe(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ce=se();function le(e,t){if(e.contentRootDepth===void 0)return{...e,path:t,repositoryPath:t};let n=(e.repositoryPath??e.path).split(`/`).slice(0,e.contentRootDepth);return{...e,path:t,repositoryPath:[...n,...t===``?[]:t.split(`/`)].join(`/`)}}function ue(e,t){return e===null||e.kind!==`missing`||t===null||j(t.path)!==e.target?null:t}export{W as a,V as c,ae as i,le as n,G as o,ce as r,H as s,ue as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./overlay-layers-CKMAjef3.js";import{t as c}from"./dist-BsJYDohW.js";import{t as l}from"./dist-CSCUSbQc.js";import{i as u,n as d,t as f}from"./tooltip-DBqLYfio.js";import"./separator-D7s_9ZwH.js";import{t as p}from"./button-DzgjsZzC.js";import{t as m}from"./RegisteredAgentIcon-DjlAkIlP.js";import{s as h,u as g}from"./keyboard-shortcuts-FtScAm_I.js";import{a as _,i as v,r as y}from"./local-menu-action-bus-Dyh2UJJF.js";import{g as b}from"./terminal-launch-events-BCKO9apj.js";import{t as x}from"./OpenInAgentMenuItem-Bd9Zl2ks.js";import{t as S}from"./createLucideIcon-DdBzwsHe.js";import{t as C}from"./arrow-up-right-nJaICi16.js";import{t as w}from"./check-B2OLRY33.js";import{t as T}from"./chevron-down-CEv6N8LG.js";import{a as E,h as D,i as O,o as k,r as ee,t as A,u as j}from"./dropdown-menu-DtLu9NwU.js";import{a as M}from"./client-version-DDIvS8RB.js";import"./input-C-Qm8YDT.js";import{n as te}from"./agent-launcher-labels-BtrP7a_g.js";import{n as ne}from"./terminal-cli-display-BbrhD8t2.js";import"./skeleton-BPb29aFG.js";import{_ as N,f as P,l as F}from"./sortable.esm-BdFZmZc5.js";var I=e(n(),1),L=new Map,R=null,z=new Set;function B(){return L.get(`agents`)??L.get(`terminal`)??null}function V(e,t){return e===null||t===null?e===t:e.id!==t.id||e.kind!==t.kind||e.label!==t.label?!1:e.kind===`thread`&&t.kind===`thread`?e.agentId===t.agentId&&e.iconUrl===t.iconUrl:e.kind===`terminal`&&t.kind===`terminal`?e.cli===t.cli:!1}function H(e,t){if(L.has(e)&&V(L.get(e)??null,t))return;L.set(e,t);let n=B();if(!V(R,n)){R=n;for(let e of z)e()}}function U(){return R}function W(e){return z.add(e),()=>{z.delete(e)}}function G(){return(0,I.useSyncExternalStore)(W,U,K)}function K(){return null}var q=S(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),J=S(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),re=S(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ie={},Y=new Set;function X(){return ie}function ae(e){ie={...ie,...e};for(let e of Y)e()}function oe(e){return Y.add(e),()=>{Y.delete(e)}}function se(){return(0,I.useSyncExternalStore)(oe,X,X)}var Z={terminal:`ok-dock-session-order-v1`,agents:`ok-agent-session-order-v1`};function ce(e){let t=Array.isArray(e.order)?e.order.filter(e=>typeof e==`string`):[],n=typeof e.activeKey==`string`?e.activeKey:null,r=typeof e.agentPanelVisible==`boolean`?e.agentPanelVisible:void 0;return r===void 0?{order:t,activeKey:n}:{order:t,activeKey:n,agentPanelVisible:r}}function le(e){if(typeof window>`u`)return{status:`absent`};let t;try{t=window.localStorage.getItem(Z[e])}catch(t){return console.warn(`[dock-session-persistence] reading ${Z[e]} failed: ${String(t)}`),{status:`blocked`}}if(t===null)return{status:`absent`};try{return{status:`parsed`,record:ce(JSON.parse(t))}}catch(t){return console.warn(`[dock-session-persistence] stored ${Z[e]} record was not valid JSON; ignoring it: ${String(t)}`),{status:`corrupt`}}}function ue(e){let t=le(`agents`);if(t.status===`blocked`)return console.warn(`[dock-session-persistence] ${Z.agents} could not be read; withholding this write rather than overwriting the unread record`),null;let n=t.status===`parsed`?t.record:null,r=[...e.order??n?.order??[]],i=e.activeKey===void 0?n?.activeKey??null:e.activeKey,a=e.agentPanelVisible??n?.agentPanelVisible;return a===void 0?{order:r,activeKey:i}:{order:r,activeKey:i,agentPanelVisible:a}}function de(e){let t=le(e);return t.status===`parsed`?t.record:null}function fe(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(Z[e],JSON.stringify(t))}catch(t){console.warn(`[dock-session-persistence] writing ${Z[e]} failed: ${String(t)}`)}}function pe(e,t){if(e?.terminal!=null)return;let n=ue({agentPanelVisible:t});n!==null&&fe(`agents`,n)}async function me(e,t){if(typeof e?.terminal?.getDockState==`function`)try{let n=await e.terminal.getDockState(),r=n[t];if(r==null)return{sessionOrder:null,terminalSnapshot:n.terminalSnapshot,failed:!1};let{order:i,activeKey:a}=ce(r);return{sessionOrder:i.length===0&&a===null?null:{order:i,activeKey:a},terminalSnapshot:n.terminalSnapshot,failed:!1}}catch(e){return console.warn(`[dock-session-persistence] getDockState failed; cold-starting: ${String(e)}`),{sessionOrder:null,terminalSnapshot:void 0,failed:!0}}return{sessionOrder:e?.terminal==null?de(t):null,terminalSnapshot:void 0,failed:!1}}function he(e,t,n,r={tabs:[],activeOrdinal:null}){if(typeof e?.terminal?.setDockState==`function`){let i={order:[...n.order],activeKey:n.activeKey},a=t===`terminal`?e.terminal.setDockState({surface:`terminal`,...i,terminalSnapshot:r}):e.terminal.setDockState({surface:`agents`,...i});Promise.resolve(a).then(e=>{e?.ok===!1&&(e.reason===`ipc-unavailable`?console.warn(`[dock-session-persistence] setDockState skipped during window teardown`):console.error(`[dock-session-persistence] setDockState failed: ${e.reason}`))}).catch(e=>{console.error(`[dock-session-persistence] setDockState rejected: ${e instanceof Error?e.stack??e.message:String(e)}`)});return}if(e?.terminal==null){if(t===`agents`){let e=ue({order:n.order,activeKey:n.activeKey});if(e===null)return;fe(`agents`,e);return}fe(t,n)}}var ge=5e3,Q=a(),$=t();function _e(e){let t=(0,Q.c)(65),{primary:n,onPrimary:a,primaryDisabled:s,enabledTargets:c,selectedTargetId:l,onSelectTarget:u,threadAgents:d,onOpenSettings:f,terminal:h,terminals:g,menuEmptyState:_,menuLeading:v,onMenuOpenChange:S,menuAlign:M,menuAttributes:N,className:P,primaryClassName:F,primaryAriaLabel:I,threadAgentsFooter:L,triggerAriaLabel:R,testIds:z}=e,B=s===void 0?!1:s,V=M===void 0?`end`:M,{_:H}=i(),U=c.length>0,W=g&&g.length>0?g:null,G=W!=null||h!=null,K=U||G,q=d!==void 0&&d.length>0,J;t[0]===z?J=t[1]:(J=e=>typeof z.terminal==`function`?z.terminal(e):z.terminal,t[0]=z,t[1]=J);let re=J,ie=z.group,Y;t[2]===F?Y=t[3]:(Y=o(`gap-1.5`,F),t[2]=F,t[3]=Y);let X;t[4]!==a||t[5]!==n||t[6]!==I||t[7]!==B||t[8]!==Y||t[9]!==z.primary?(X=(0,$.jsx)(p,{type:`button`,variant:`outline`,className:Y,disabled:B,"aria-label":I,onClick:a,"data-testid":z.primary,children:n}),t[4]=a,t[5]=n,t[6]=I,t[7]=B,t[8]=Y,t[9]=z.primary,t[10]=X):X=t[10];let ae;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(T,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[11]=ae):ae=t[11];let oe;t[12]!==z.trigger||t[13]!==R?(oe=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`outline`,size:`icon`,"aria-label":R,"data-testid":z.trigger,children:ae})}),t[12]=z.trigger,t[13]=R,t[14]=oe):oe=t[14];let se;t[15]!==K||t[16]!==v||t[17]!==q?(se=v?(0,$.jsxs)($.Fragment,{children:[v,q||K?(0,$.jsx)(j,{}):null]}):null,t[15]=K,t[16]=v,t[17]=q,t[18]=se):se=t[18];let Z;t[19]!==H||t[20]!==K||t[21]!==q||t[22]!==z||t[23]!==d||t[24]!==L?(Z=q?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(O,{"aria-label":H({id:`RXEbZy`}),children:[(0,$.jsx)(k,{children:(0,$.jsx)(r,{id:`RXEbZy`})}),d?.map(e=>(0,$.jsxs)(E,{onSelect:e.onSelect,disabled:e.disabled,"data-testid":z.threadAgent?.(e.key),"aria-current":e.selected?`true`:void 0,children:[(0,$.jsx)(m,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,$.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key)),L]}),K?(0,$.jsx)(j,{}):null]}):null,t[19]=H,t[20]=K,t[21]=q,t[22]=z,t[23]=d,t[24]=L,t[25]=Z):Z=t[25];let ce;t[26]!==H||t[27]!==W||t[28]!==c||t[29]!==K||t[30]!==u||t[31]!==l||t[32]!==U||t[33]!==G||t[34]!==h||t[35]!==re||t[36]!==z?(ce=K?(0,$.jsxs)($.Fragment,{children:[G?(0,$.jsxs)(O,{"aria-label":H({id:`ALhMYW`}),children:[(0,$.jsx)(k,{children:(0,$.jsx)(r,{id:`ALhMYW`})}),W?.map(e=>(0,$.jsxs)(E,{onSelect:e.onSelect,"data-testid":re(e.cli),"aria-label":e.ariaLabel,children:[(0,$.jsx)(x,{id:ne(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)),h?(0,$.jsxs)(E,{onSelect:h.onSelect,"data-testid":h.testId??re(`claude`),"aria-label":h.ariaLabel??H({id:`AcK_r0`}),children:[h.icon??(0,$.jsx)(x,{id:ne(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:h.label??(0,$.jsx)(r,{id:`fcgvCA`})}),h.selected?(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,U?(0,$.jsxs)($.Fragment,{children:[G?(0,$.jsx)(j,{}):null,(0,$.jsxs)(O,{"aria-label":H({id:`BwKH4d`}),children:[(0,$.jsxs)(k,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(r,{id:`BwKH4d`}),(0,$.jsx)(C,{"aria-hidden":`true`,className:`size-3`})]}),c.map(e=>(0,$.jsxs)(E,{onSelect:()=>u(e),"data-testid":z.option(e.id),children:[(0,$.jsx)(x,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(te,{displayName:e.displayName})}),l===e.id?(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[26]=H,t[27]=W,t[28]=c,t[29]=K,t[30]=u,t[31]=l,t[32]=U,t[33]=G,t[34]=h,t[35]=re,t[36]=z,t[37]=ce):ce=t[37];let le=!q&&!K?_:null,ue;t[38]!==K||t[39]!==q?(ue=q||K?(0,$.jsx)(j,{}):null,t[38]=K,t[39]=q,t[40]=ue):ue=t[40];let de;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(y,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[41]=de):de=t[41];let fe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(`span`,{className:`flex-1`,children:(0,$.jsx)(r,{id:`jRAGrQ`})}),t[42]=fe):fe=t[42];let pe;t[43]!==f||t[44]!==z.settings?(pe=(0,$.jsxs)(E,{onSelect:f,"data-testid":z.settings,children:[de,fe]}),t[43]=f,t[44]=z.settings,t[45]=pe):pe=t[45];let me;t[46]!==V||t[47]!==N||t[48]!==Z||t[49]!==ce||t[50]!==le||t[51]!==ue||t[52]!==pe||t[53]!==se||t[54]!==z.menu?(me=(0,$.jsxs)(ee,{align:V,className:`max-h-80 min-w-[200px]`,"data-testid":z.menu,...N,children:[se,Z,ce,le,ue,pe]}),t[46]=V,t[47]=N,t[48]=Z,t[49]=ce,t[50]=le,t[51]=ue,t[52]=pe,t[53]=se,t[54]=z.menu,t[55]=me):me=t[55];let he;t[56]!==S||t[57]!==me||t[58]!==oe?(he=(0,$.jsxs)(A,{modal:!1,onOpenChange:S,children:[oe,me]}),t[56]=S,t[57]=me,t[58]=oe,t[59]=he):he=t[59];let ge;return t[60]!==P||t[61]!==he||t[62]!==X||t[63]!==z.group?(ge=(0,$.jsxs)(b,{className:P,"data-testid":ie,children:[X,he]}),t[60]=P,t[61]=he,t[62]=X,t[63]=z.group,t[64]=ge):ge=t[64],ge}var ve=`open-knowledge:active-terminal-input`;function ye(e,t,n=typeof window>`u`?new EventTarget:window){let r={text:e,newTab:t?.newTab===!0,submit:t?.submit===!0,...t?.target===`agents`?{target:`agents`}:{}};_({kind:`active-input`,...r},n)||n.dispatchEvent(new CustomEvent(ve,{detail:r}))}function be(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n!==void 0&&typeof n.text==`string`&&e({text:n.text,newTab:n.newTab===!0,submit:n.submit===!0,...n.target===`agents`?{target:`agents`}:{}})};return t.addEventListener(ve,n),()=>t.removeEventListener(ve,n)}function xe(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Se(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ce=c(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function we(e){let t=(0,Q.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,s;t[4]!==n||t[5]!==a?(s=o(Ce({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==s||t[9]!==a?(c=(0,$.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:s,...r}),t[7]=r,t[8]=s,t[9]=a,t[10]=c):c=t[10],c}function Te(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?l:`div`,s;t[4]===n?s=t[5]:(s=o(`font-heading text-sm font-medium tracking-tight`,n),t[4]=n,t[5]=s);let c;return t[6]!==a||t[7]!==r||t[8]!==s?(c=(0,$.jsx)(a,{"data-slot":`empty-title`,className:s,...r}),t[6]=a,t[7]=r,t[8]=s,t[9]=c):c=t[9],c}function Ee(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function De(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Oe=1024,ke=1280,Ae={left:Oe,right:ke};function je(e,t,n){return e==null?t>=Ae[n]?`above`:`below`:`embedded`}function Me(e){return e===`above`?`open`:`collapsed`}var Ne=`ok-sidebar-pins-v2`;function Pe(e){return e===`open`||e===`collapsed`}function Fe(e){return e===`above`||e===`below`||e===`embedded`}function Ie(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!Fe(e)||!Pe(t[e]))return!1;return!0}function Le(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Ie(n.left)&&(r.left=n.left),Ie(n.right)&&(r.right=n.right),r}function Re(e){try{let t=(e??localStorage).getItem(Ne);return t==null?{}:Le(t)}catch{return{}}}function ze(e,t){try{t.setItem(Ne,JSON.stringify(e))}catch{}}function Be(e,t,n){return n[e]?.[t]??Me(t)}function Ve(e,t,n,r){let i=r??localStorage,a=Re(i);return a[e]={...a[e],[t]:n},ze(a,i),a}function He(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Ue(e){let{value:t,unit:n}=He(e);return n===`rem`?t*16:t}function We(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var Ge=3600*24*7;function Ke(e){let t=(0,Q.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?qe:m,O=g===void 0?Ge:g,k=_===void 0?!1:_,ee=(0,I.useRef)(null),A=(0,I.useRef)(0),j=(0,I.useRef)(0),M=(0,I.useRef)(!1),te=(0,I.useRef)(!1),ne=(0,I.useRef)(null),N=(0,I.useRef)(0),P=(0,I.useRef)(!1),F=(0,I.useRef)(0),L=(0,I.useRef)(0),R=(0,I.useRef)(null),z=(0,I.useRef)(r),B=(0,I.useRef)(y),V,H;t[0]===r?(V=t[1],H=t[2]):(V=()=>{z.current=r},H=[r],t[0]=r,t[1]=V,t[2]=H),(0,I.useEffect)(V,H);let U,W;t[3]===y?(U=t[4],W=t[5]):(U=()=>{B.current=y},W=[y],t[3]=y,t[4]=U,t[5]=W),(0,I.useEffect)(U,W);let G=Ue(b),K;t[6]===x?K=t[7]:(K=Ue(x),t[6]=x,t[7]=K);let q=K,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(te.current=!0,A.current=B.current?0:Ue(z.current),j.current=e.clientX,N.current=e.clientX,ne.current=null,P.current=!1,F.current=0,L.current=0,R.current=k&&ee.current?ee.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=J):J=t[10];let re=J,ie,Y;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==G||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!te.current)return;let o=Math.abs(r.clientX-j.current);if(!M.current&&o>5&&(M.current=!0,D(!0)),M.current){let{unit:o}=He(z.current),s=R.current;k&&ee.current&&(s=ee.current.getBoundingClientRect());let c=t(r.clientX,N.current)?`expand`:`collapse`;ne.current!==c&&(ne.current=c),L.current=Math.abs(r.clientX-N.current);let l=Date.now();if(P.current&&l-F.current>200&&(P.current=!1),!P.current){if(C&&a&&!B.current){let e=n(r,j.current,A.current,s),t=!1;if(w<=1)t=e<=G*w;else if(e<=G){let n=G*(w-1);t=G-e>=n}if(c===`collapse`&&t){a(),N.current=r.clientX,P.current=!0,F.current=l;return}}if(a&&B.current&&c===`expand`&&L.current>G*T){a();let t=n(r,j.current,A.current,s),c=Math.max(G,Math.min(q,t)),u=We(o===`rem`?c/16:c,o);i(u),e(u),N.current=r.clientX,P.current=!0,F.current=l;return}}if(B.current)return;let u=n(r,j.current,A.current,s),d=Math.max(G,Math.min(q,u)),f=We(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){te.current&&(!M.current&&a&&S&&a(),M.current=!1,te.current=!1,ne.current=null,N.current=0,P.current=!1,F.current=0,L.current=0,R.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},Y=[i,a,D,G,q,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=q,t[18]=G,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=Y):(ie=t[24],Y=t[25]),(0,I.useEffect)(ie,Y);let X;return t[26]===re?X=t[27]:(X={dragRef:ee,isDragging:M,handleMouseDown:re},t[26]=re,t[27]=X),X}function qe(){}var Je=3600*24*7,Ye=`18rem`,Xe=`3rem`,Ze=`app-file-sidebar`,Qe=`14.625rem`,$e=`32rem`,et=`sidebar_width`,tt=/^\d+(?:\.\d+)?(?:rem|px)$/,nt=I.createContext(null);function rt(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${et}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return tt.test(n)?n:e}function it(){let e=I.use(nt);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function at(e){let t=(0,Q.c)(57),n,r,i,a,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5],l=t[6],u=t[7]):({open:i,onOpenChange:c,className:r,style:l,children:n,defaultWidth:u,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c,t[6]=l,t[7]=u);let d=u===void 0?Ye:u,[f]=I.useState(st),p;t[8]===f?p=t[9]:(p=()=>je(f,window.innerWidth,`left`),t[8]=f,t[9]=p);let[m,h]=I.useState(p),_;t[10]===d?_=t[11]:(_=()=>rt(d),t[10]=d,t[11]=_);let[v,y]=I.useState(_),[b,x]=I.useState(!1),[S,C]=I.useState(!1),w;t[12]===f?w=t[13]:(w=()=>{let e=Re();return Be(`left`,je(f,window.innerWidth,`left`),e)===`open`},t[12]=f,t[13]=w);let[T,E]=I.useState(w),D=i??T,O;t[14]!==m||t[15]!==c?(O=e=>{let t=typeof e==`function`?e(j.current):e;c?c(t):E(t),Ve(`left`,m,t?`open`:`collapsed`)},t[14]=m,t[15]=c,t[16]=O):O=t[16];let k=O,ee;t[17]===k?ee=t[18]:(ee=function(){k(ot)},t[17]=k,t[18]=ee);let A=ee,j=I.useRef(D),M;t[19]===D?M=t[20]:(M=()=>{j.current=D},t[19]=D,t[20]=M),I.useLayoutEffect(M);let te;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(te=function(){window.innerWidth>=1024||j.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||C(!0))},t[21]=te):te=t[21];let ne=te,N,P;t[22]===f?(N=t[23],P=t[24]):(P=()=>{let e=window.matchMedia(`(min-width: ${Oe}px)`),t=()=>{let e=je(f,window.innerWidth,`left`);h(e),E(Be(`left`,e,Re())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[f],t[22]=f,t[23]=N,t[24]=P),I.useEffect(P,N);let F,L;t[25]===D?(F=t[26],L=t[27]):(F=()=>{D||document.getElementById(Ze)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},L=[D],t[25]=D,t[26]=F,t[27]=L),I.useLayoutEffect(F,L);let R,z;t[28]!==D||t[29]!==m||t[30]!==k?(R=()=>{if(m===`above`||!D)return;let e=e=>{if(e.key!==`Escape`||s())return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)||k(!1)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},z=[m,D,k],t[28]=D,t[29]=m,t[30]=k,t[31]=R,t[32]=z):(R=t[31],z=t[32]),I.useEffect(R,z);let B,V;t[33]===A?(B=t[34],V=t[35]):(B=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{g(e,`toggle-files-sidebar`)&&(s()||(e.preventDefault(),A()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},V=[A],t[33]=A,t[34]=B,t[35]=V),I.useEffect(B,V);let H=D?`expanded`:`collapsed`,U;t[36]!==b||t[37]!==D||t[38]!==k||t[39]!==S||t[40]!==H||t[41]!==A||t[42]!==v?(U={state:H,open:D,setOpen:k,toggleSidebar:A,width:v,setWidth:y,isDraggingRail:b,setIsDraggingRail:x,showPushPulse:S,setShowPushPulse:C,notifySidebarFileSelected:ne},t[36]=b,t[37]=D,t[38]=k,t[39]=S,t[40]=H,t[41]=A,t[42]=v,t[43]=U):U=t[43];let W;t[44]!==l||t[45]!==v?(W={"--sidebar-width":v,"--sidebar-width-icon":Xe,...l},t[44]=l,t[45]=v,t[46]=W):W=t[46];let G=W,K;t[47]===r?K=t[48]:(K=o(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[47]=r,t[48]=K);let q;t[49]!==n||t[50]!==a||t[51]!==G||t[52]!==K?(q=(0,$.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:G,className:K,...a,children:n}),t[49]=n,t[50]=a,t[51]=G,t[52]=K,t[53]=q):q=t[53];let J;return t[54]!==U||t[55]!==q?(J=(0,$.jsx)(nt.Provider,{value:U,children:q}),t[54]=U,t[55]=q,t[56]=J):J=t[56],J}function ot(e){return!e}function st(){return M()}function ct(e){let t=(0,Q.c)(39),n,r,a,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4],c=t[5],l=t[6]):({side:s,variant:c,collapsible:l,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l);let u=s===void 0?`left`:s,d=c===void 0?`sidebar`:c,f=l===void 0?`offcanvas`:l,{_:p}=i(),{state:m,isDraggingRail:h}=it();if(f===`none`){let e;t[7]===r?e=t[8]:(e=o(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==d?(i=(0,$.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":d,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=d,t[13]=i):i=t[13],i}let g=m===`collapsed`?f:``,_=d===`floating`||d===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,v;t[14]===_?v=t[15]:(v=o(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,_,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=_,t[15]=v);let y;t[16]===v?y=t[17]:(y=(0,$.jsx)(`div`,{"data-slot":`sidebar-gap`,className:v}),t[16]=v,t[17]=y);let b;t[18]===p?b=t[19]:(b=p({id:`07q4Qk`}),t[18]=p,t[19]=b);let x=d===`floating`||d===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,S;t[20]!==r||t[21]!==x?(S=o(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,x,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=x,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=(0,$.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=C);let w;t[25]!==a||t[26]!==u||t[27]!==S||t[28]!==C||t[29]!==b?(w=(0,$.jsx)(`nav`,{id:Ze,"aria-label":b,"data-slot":`sidebar-container`,"data-side":u,className:S,...a,children:C}),t[25]=a,t[26]=u,t[27]=S,t[28]=C,t[29]=b,t[30]=w):w=t[30];let T;return t[31]!==h||t[32]!==u||t[33]!==m||t[34]!==w||t[35]!==g||t[36]!==y||t[37]!==d?(T=(0,$.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":m,"data-collapsible":g,"data-variant":d,"data-side":u,"data-slot":`sidebar`,"data-dragging":h,children:[y,w]}),t[31]=h,t[32]=u,t[33]=m,t[34]=w,t[35]=g,t[36]=y,t[37]=d,t[38]=T):T=t[38],T}function lt(e){let t=(0,Q.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:s}=i(),{toggleSidebar:c,state:l}=it(),u,d,f,m,g,_,y,b;if(t[4]!==s||t[5]!==l){let e=h(`toggle-files-sidebar`);u=p,d=`trigger`,f=`sidebar-trigger`,m=`ghost`,g=`icon-sm`,_=l===`expanded`,y=Ze,b=s(l===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=s,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=m,t[10]=g,t[11]=_,t[12]=y,t[13]=b}else u=t[6],d=t[7],f=t[8],m=t[9],g=t[10],_=t[11],y=t[12],b=t[13];let x;t[14]===n?x=t[15]:(x=o(n),t[14]=n,t[15]=x);let S;t[16]!==r||t[17]!==c?(S=e=>{r?.(e),c()},t[16]=r,t[17]=c,t[18]=S):S=t[18];let C;t[19]===l?C=t[20]:(C=l===`expanded`?(0,$.jsx)(v,{}):(0,$.jsx)(q,{}),t[19]=l,t[20]=C);let w;return t[21]!==u||t[22]!==a||t[23]!==d||t[24]!==C||t[25]!==f||t[26]!==m||t[27]!==g||t[28]!==_||t[29]!==y||t[30]!==b||t[31]!==x||t[32]!==S?(w=(0,$.jsx)(u,{"data-sidebar":d,"data-slot":f,variant:m,size:g,"aria-expanded":_,"aria-controls":y,"aria-label":b,className:x,onClick:S,...a,children:C}),t[21]=u,t[22]=a,t[23]=d,t[24]=C,t[25]=f,t[26]=m,t[27]=g,t[28]=_,t[29]=y,t[30]=b,t[31]=x,t[32]=S,t[33]=w):w=t[33],w}function ut(e){let t=(0,Q.c)(32),n,r,a,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4],c=t[5]):({className:n,enableDrag:s,enableToggle:c,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s,t[5]=c);let l=s===void 0?!0:s,u=c===void 0?!0:c,{_:d}=i(),{toggleSidebar:f,setWidth:p,state:m,width:h,setIsDraggingRail:g}=it(),_=m===`collapsed`,v;t[6]!==l||t[7]!==u||t[8]!==g||t[9]!==p||t[10]!==_||t[11]!==f||t[12]!==h?(v={direction:`right`,enableDrag:l,enableToggle:u,onResize:p,onToggle:f,currentWidth:h,isCollapsed:_,minResizeWidth:Qe,maxResizeWidth:$e,setIsDraggingRail:g,widthCookieName:et,widthCookieMaxAge:Je},t[6]=l,t[7]=u,t[8]=g,t[9]=p,t[10]=_,t[11]=f,t[12]=h,t[13]=v):v=t[13];let{dragRef:y,handleMouseDown:b}=Ke(v),x;t[14]!==d||t[15]!==m?(x=d(m===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=d,t[15]=m,t[16]=x):x=t[16];let S;t[17]!==b||t[18]!==r?(S=e=>{r?.(e),e.defaultPrevented||b(e)},t[17]=b,t[18]=r,t[19]=S):S=t[19];let C;t[20]!==d||t[21]!==m?(C=d(m===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=d,t[21]=m,t[22]=C):C=t[22];let w;t[23]===n?w=t[24]:(w=o(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=w);let T;return t[25]!==y||t[26]!==a||t[27]!==x||t[28]!==S||t[29]!==C||t[30]!==w?(T=(0,$.jsx)(`button`,{ref:y,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":x,tabIndex:-1,onMouseDown:S,title:C,className:w,...a}),t[25]=y,t[26]=a,t[27]=x,t[28]=S,t[29]=C,t[30]=w,t[31]=T):T=t[31],T}function dt(e){let t=(0,Q.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:s}=it(),c;t[4]!==r||t[5]!==s?(c=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&s(!1)},t[4]=r,t[5]=s,t[6]=c):c=t[6];let l=c,u=a?``:void 0,d;t[7]===n?d=t[8]:(d=o(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=d);let f;return t[9]!==l||t[10]!==i||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":u,onAnimationEnd:l,className:d,...i}),t[9]=l,t[10]=i,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function ft(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ht(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gt(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?l:`div`,s;t[4]===n?s=t[5]:(s=o(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=s);let c;return t[6]!==a||t[7]!==r||t[8]!==s?(c=(0,$.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:s,...r}),t[6]=a,t[7]=r,t[8]=s,t[9]=c):c=t[9],c}function _t(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yt(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var bt=c(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function xt(e){let t=(0,Q.c)(28),n,r,i,a,s,c,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],p=t[7]):({asChild:i,isActive:a,variant:s,size:c,tooltip:p,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=p);let m=i===void 0?!1:i,h=a===void 0?!1:a,g=s===void 0?`default`:s,_=c===void 0?`default`:c,v=m?l:`button`,y=I.use(nt),b;t[8]!==n||t[9]!==_||t[10]!==g?(b=o(bt({variant:g,size:_}),n),t[8]=n,t[9]=_,t[10]=g,t[11]=b):b=t[11];let x;t[12]!==v||t[13]!==h||t[14]!==r||t[15]!==_||t[16]!==b?(x=(0,$.jsx)(v,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":_,"data-active":h,className:b,...r}),t[12]=v,t[13]=h,t[14]=r,t[15]=_,t[16]=b,t[17]=x):x=t[17];let S=x;if(!p)return S;if(!y)throw Error(`SidebarMenuButton tooltip requires a SidebarProvider.`);if(typeof p==`string`){let e;t[18]===p?e=t[19]:(e={children:p},t[18]=p,t[19]=e),p=e}let C;t[20]===S?C=t[21]:(C=(0,$.jsx)(u,{asChild:!0,children:S}),t[20]=S,t[21]=C);let w=y.state!==`collapsed`,T;t[22]!==w||t[23]!==p?(T=(0,$.jsx)(d,{side:`right`,align:`center`,hidden:w,...p}),t[22]=w,t[23]=p,t[24]=T):T=t[24];let E;return t[25]!==C||t[26]!==T?(E=(0,$.jsxs)(f,{children:[C,T]}),t[25]=C,t[26]=T,t[27]=E):E=t[27],E}function St(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=i===void 0?!1:i,c=a===void 0?!1:a,u=s?l:`button`,d=c&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,f;t[5]!==n||t[6]!==d?(f=o(`absolute top-1.5 end-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,d,n),t[5]=n,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==u||t[9]!==r||t[10]!==f?(p=(0,$.jsx)(u,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:f,...r}),t[8]=u,t[9]=r,t[10]=f,t[11]=p):p=t[11],p}var Ct=`flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none hover:bg-muted-foreground/20 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,wt=`bg-sidebar-selected text-sidebar-selected-foreground`,Tt=`bg-sidebar-selected! text-sidebar-selected-foreground!`,Et=`bg-sidebar-hover! text-sidebar-hover-foreground!`,Dt=`${wt} hover:bg-sidebar-selected focus-visible:bg-sidebar-selected`,Ot={start:[F.Space],cancel:[F.Esc],end:[F.Space,F.Enter]};function kt(e){return o(Ct,e?`mr-1 opacity-100`:`pointer-events-none absolute right-1 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}var At=`overflow-hidden whitespace-nowrap mask-r-from-[calc(100%-1.5rem)] mask-r-to-[100%]`;function jt(e){return e?At:`truncate group-hover:text-clip group-hover:mask-r-from-[calc(100%-3rem)] group-hover:mask-r-to-[calc(100%-1.5rem)]`}function Mt(e){return e?void 0:-1}function Nt({className:e,isDragging:t}){return o(e,t&&Dt)}function Pt(e){return e.code===F.Enter&&e.target===e.currentTarget}function Ft(e){return e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`}function It(e,t,n){for(let r of e.querySelectorAll(`[data-editor-tab-id]`))if(r.dataset.editorPaneId===t&&r.dataset.editorTabId===n)return r;return null}function Lt({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&Pt(e)?`activate-tab`:`delegate-sortable`}function Rt({activeWidth:e,disableMovement:t=!1,isDragging:n,outerStyle:r,transform:i,transition:a}){let o=n&&e?e:void 0;return{...r,transform:t?void 0:N.Transform.toString(i?{...i,scaleX:1,scaleY:1}:null),transition:t?void 0:a,flexBasis:o??r?.flexBasis,maxWidth:o??r?.maxWidth,minWidth:o??r?.minWidth,opacity:r?.opacity,width:o??r?.width,zIndex:n?20:r?.zIndex}}function zt(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function Bt(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}function Vt(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`editor-tab`&&typeof t.paneId==`string`&&typeof t.tabId==`string`&&typeof t.splittable==`boolean`&&typeof t.label==`string`}function Ht(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`pane-edge`?typeof t.paneId==`string`&&(t.side===`left`||t.side===`right`):t.kind===`pane-strip`&&typeof t.paneId==`string`&&typeof t.index==`number`&&Number.isInteger(t.index)}function Ut(e,t){return e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom}function Wt(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}var Gt=e=>{let t=e.droppableContainers.filter(e=>e.data.current?.kind===`pane-edge`),n=e.droppableContainers.filter(e=>e.data.current?.kind!==`pane-edge`),r=e.active.data.current,i=e.pointerCoordinates;if(i&&Vt(r)&&r.splittable){let n=t.find(t=>{let n=e.droppableRects.get(t.id);return n?Ut(i,n):!1});if(n)return[{id:n.id,data:{droppableContainer:n,value:0}}]}if(i){let t=n.filter(t=>{let n=e.droppableRects.get(t.id);return n?Ut(i,n):!1});if(t.length>0){let n=t.filter(e=>Vt(e.data.current));return P({...e,droppableContainers:n.length>0?n:t})}let r=n.filter(t=>{let n=t.data.current,r=e.droppableRects.get(t.id);return n?.kind!==`pane-strip`||!r?!1:Wt(e.collisionRect,r)});if(r.length===0)return[];let a=new Set(r.map(e=>e.data.current?.paneId)),o=n.filter(t=>{let n=t.data.current,r=e.droppableRects.get(t.id);return!Vt(n)||!a.has(n.paneId)||!r?!1:Wt(e.collisionRect,r)});return P({...e,droppableContainers:o.length>0?o:r})}return P({...e,droppableContainers:n})},Kt=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return P(e)};function qt(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}var Jt=`open-knowledge:new-preferred-session`;function Yt(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Jt))}function Xt(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Jt,n),()=>t.removeEventListener(Jt,n)}export{_e as $,ft as A,Ve as B,Kt as C,ht as D,pt as E,yt as F,xe as G,Be as H,at as I,Se as J,De as K,ut as L,vt as M,St as N,_t as O,xt as P,be as Q,lt as R,Ft as S,mt as T,ke as U,Re as V,je as W,Te as X,we as Y,ye as Z,Mt as _,Et as a,ae as at,Ht as b,Tt as c,J as ct,Gt as d,ge as et,It as f,kt as g,Rt as h,Ct as i,he as it,dt as j,gt as k,At as l,H as lt,Lt as m,Xt as n,de as nt,Ot as o,se as ot,Nt as p,Ee as q,qt as r,pe as rt,wt as s,re as st,Yt as t,me as tt,Bt as u,G as ut,jt as v,ct as w,zt as x,Vt as y,it as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,P as r,R as i}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,P as r,R as i}from"./DocumentContext-CorZvYgo.js";import{t as a}from"./react-f2sANaYj.js";import{r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./utils-CPqDy6Hr.js";import{c as l,l as u}from"./dist-DTFuvKje.js";import{i as d,n as f,r as p,t as m}from"./tooltip-DBqLYfio.js";import{t as h}from"./button-DzgjsZzC.js";import{J as g,X as _,Y as v,at as y,it as b,n as x,o as S,z as C}from"./dist-Dc8tD1th.js";import{t as w}from"./dist-C_FzPxEX2.js";import{t as T}from"./workspace-paths-BjilyZF6.js";import{t as E}from"./createLucideIcon-DdBzwsHe.js";import{a as D,d as O,h as ee,r as te,t as ne}from"./dropdown-menu-DtLu9NwU.js";import{$ as k,A,K as re,St as ie,Z as ae,bt as oe,cr as se,f as j,g as ce,h as le,k as ue,l as M,m as N,p as P,u as F,xt as I,yt as L}from"./CodeMirrorPropInput-Buv5WUqJ.js";import{t as de}from"./spinner-Bx8xD6f8.js";import{b as fe}from"./comment-chips-DNwQbxLO.js";import{t as R}from"./paperclip-BHdV1F_7.js";import{t as pe}from"./plus-zPnYzcqL.js";import{t as z}from"./x-DM2drskU.js";import{t as me}from"./badge-DmdA1C7r.js";import{r as he}from"./doc-paths-cEiFVCxr.js";import{h as ge}from"./file-tree-adapter-BeSKxnyg.js";import{r as _e}from"./image-attachment-IPVf2vc9.js";import{C as B,T as ve,w as ye}from"./thread-client-DuyrjvRs.js";var V=e(a(),1),H=t(),U=`Progress`,W=100,[be,xe]=l(U),[G,K]=be(U),q=V.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=Y,...o}=e;(i||i===0)&&!Ce(i)&&console.error(Te(`${i}`,`Progress`));let s=Ce(i)?i:W;r!==null&&!we(r,s)&&console.error(Ee(`${r}`,`Progress`));let c=we(r,s)?r:null,l=Z(c)?a(c,s):void 0;return(0,H.jsx)(G,{scope:n,value:c,max:s,children:(0,H.jsx)(u.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Z(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":X(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});q.displayName=U;var Se=`ProgressIndicator`,J=V.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=K(Se,n);return(0,H.jsx)(u.div,{"data-state":X(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});J.displayName=Se;function Y(e,t){return`${Math.round(e/t*100)}%`}function X(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function Z(e){return typeof e==`number`}function Ce(e){return Z(e)&&!isNaN(e)&&e>0}function we(e,t){return Z(e)&&!isNaN(e)&&e<=t&&e>=0}function Te(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${W}\`.`}function Ee(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
2
|
- a positive number
|
|
3
3
|
- less than the value passed to \`max\` (or ${W} if no \`max\` prop is set)
|
|
4
4
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{it as e}from"./DocumentContext-
|
|
1
|
+
import{it as e}from"./DocumentContext-CorZvYgo.js";import{tt as t}from"./CodeMirrorPropInput-Buv5WUqJ.js";function n(n){let r=e(n.state.selection.content(),n.state.schema);return t().serialize(r).trim()}function r(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function i(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function a(e){let t=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var o=new Map,s=new Set,c=(e,t)=>`${t}:${e}`;function l(){for(let e of s)e()}function u(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function d(e,t,n){let r=c(e,t);if(n===null){o.delete(r)&&l();return}let i=o.get(r);i&&u(i,n)||(o.set(r,n),l())}function f(e,t){return e===null?null:o.get(c(e,t))??null}function p(e){return s.add(e),()=>{s.delete(e)}}function m(e,t){if(e.state.selection.empty)return null;let r=n(e);return r.trim()?{surface:`wysiwyg`,docName:t,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function h(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function g(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
|
|
4
4
|
`);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}export{h as a,r as c,i,p as l,a as n,g as o,d as r,m as s,f as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{or as e}from"./CodeMirrorPropInput-
|
|
1
|
+
import{or as e}from"./CodeMirrorPropInput-Buv5WUqJ.js";import{F as t,H as n,T as r,U as i,V as a,b as o,m as s,nt as c,tt as l,w as u,x as d}from"./config-provider-2W1hFFiT.js";import{Et as f,J as p,K as m,X as h,Z as g,kt as _,wt as v,yt as y}from"./dist-D2SphF3p.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:t(this.yanchor),yhead:t(this.yhead)}}static fromJSON(t){return new e(u(t.yanchor),u(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new s(e)}toYPos(e,t=0){return r(this.ytext,e,t)}fromYPos(e){let t=d(u(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?v.cursor(n.pos,n.assoc):v.range(t.pos,n.pos)}},S=f.define({combine(e){return e[e.length-1]}}),C=y.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
2
2
|
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},T=h.fromClass(w),E=p.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),D=y.define(),O=class extends g{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return a(`span`,[i(`class`,`cm-ySelectionCaret`),i(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[n(``),a(`div`,[i(`class`,`cm-ySelectionCaretDot`)]),n(``),a(`div`,[i(`class`,`cm-ySelectionInfo`)],[n(this.name)]),n(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},k=class{constructor(e){this.conf=e.state.facet(S),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[D.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=_.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,i=this.conf.awareness,a=[],s=this.conf.awareness.getLocalState();if(s!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),a=n?e.state.selection.main:null,c=s.cursor==null?null:u(s.cursor.anchor),l=s.cursor==null?null:u(s.cursor.head);if(a!=null){let e=r(t,a.anchor),n=r(t,a.head);(s.cursor==null||!o(c,e)||!o(l,n))&&i.setLocalStateField(`cursor`,{anchor:e,head:n})}else s.cursor!=null&&n&&i.setLocalStateField(`cursor`,null)}i.getStates().forEach((r,o)=>{if(o===i.doc.clientID)return;let s=r.cursor;if(s==null||s.anchor==null||s.head==null)return;let u=d(s.anchor,n),f=d(s.head,n);if(u==null||f==null||u.type!==t||f.type!==t)return;let{color:p=`#30bced`,name:h=`Anonymous`}=r.user||{},g=r.user&&r.user.colorLight||p+`33`,_=c(u.index,f.index),v=l(u.index,f.index),y=e.view.state.doc.lineAt(_),b=e.view.state.doc.lineAt(v);if(y.number===b.number)a.push({from:_,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});else{a.push({from:_,to:y.from+y.length,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})}),a.push({from:b.from,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});for(let t=y.number+1;t<b.number;t++){let n=e.view.state.doc.line(t).from;a.push({from:n,to:n,value:m.line({attributes:{style:`background-color: ${g}`,class:`cm-yLineSelection`}})})}}a.push({from:f.index,to:f.index,value:m.widget({side:f.index-u.index>0?-1:1,block:!1,widget:new O(p,h)})})}),this.decorations=m.set(a,!0)}},A=h.fromClass(k,{decorations:e=>e.decorations}),j=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},M=f.define({combine(e){return e[e.length-1]}});y.define();var N=class{constructor(t){this.view=t,this.conf=t.state.facet(M),this._undoManager=this.conf.undoManager,this.syncConf=t.state.facet(S),this._beforeChangeSelection=null,this._mux=e(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:e})=>{let n=e.meta.get(this);if(n){let e=this.syncConf.fromYRange(n);t.dispatch(t.state.update({selection:e,effects:[p.scrollIntoView(e)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(C)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},P=h.fromClass(N),F=({state:e,dispatch:t})=>e.facet(M).undo()||!0,I=({state:e,dispatch:t})=>e.facet(M).redo()||!0,L=[{key:`Mod-z`,run:F,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:I,preventDefault:!0},{key:`Mod-Shift-z`,run:I,preventDefault:!0}],R=(e,t,{undoManager:n=new s(e)}={})=>{let r=new x(e,t),i=[S.of(r),T];return t&&i.push(E,A),n!==!1&&i.push(M.of(new j(n)),P,p.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?F(t):e.inputType===`historyRedo`?I(t):!1}})),i};export{L as n,R as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-pK7FQf_r.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{a as n,c as r,d as i,f as a,i as o,l as s,n as c,r as l,s as u,t as d,u as f}from"./trace-api-BjgnT4Mc.js";import{n as ee,t as p}from"./propagation-api-BP58TooP.js";import{t as m}from"./status-SIkheD7g.js";import{t as h}from"./context-api-D2PVlCLE.js";import{n as te,o as ne}from"./client-version-DDIvS8RB.js";var re=class{constructor(){}createGauge(e,t){return me}createHistogram(e,t){return he}createCounter(e,t){return pe}createUpDownCounter(e,t){return ge}createObservableGauge(e,t){return ve}createObservableCounter(e,t){return _e}createObservableUpDownCounter(e,t){return ye}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},g=class{},ie=class extends g{add(e,t){}},ae=class extends g{add(e,t){}},oe=class extends g{record(e,t){}},se=class extends g{record(e,t){}},ce=class{addCallback(e){}removeCallback(e){}},le=class extends ce{},ue=class extends ce{},de=class extends ce{},fe=new re,pe=new ie,me=new oe,he=new se,ge=new ae,_e=new le,ve=new ue,ye=new de;function be(){return fe}var xe;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(xe||={});var Se;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Se||={});var _=s.instance(),Ce=new class{getMeter(e,t,n){return fe}},we=`metrics`,Te=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalMeterProvider(e){return i(we,e,s.instance())}getMeterProvider(){return f(we)||Ce}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){a(we,s.instance())}}.getInstance(),Ee=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}},De=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function Oe(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function ke(e){if(e!=null)return()=>e}function Ae(e,t,n){return{timeoutMillis:Oe(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function je(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Me=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function Ne(e){return new Me(e.concurrencyLimit)}var Pe=r(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Fe(e){return e.setValue(Pe,!0)}function Ie(e){return e.getValue(Pe)===!0}var Le=`baggage`,Re=4096;function ze(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function Be(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function Ve(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=ee(e.substring(t+1))),{key:o,value:s,metadata:c}}function He(e,t,n,r){let i=0;for(;i<e.length&&n<180;){let a=e.indexOf(`,`,i),o=a===-1?e.length:a,s=o-i;if(s<=4096){let a=Ve(e.substring(i,o));if(a){let e=(n===0?0:1)+s;if(r+e>8192)break;t[a.key]=a.metadata?{value:a.value,metadata:a.metadata}:{value:a.value},n++,r+=e}}if(a===-1)break;i=a+1}return[n,r]}var Ue=class{inject(e,t,n){let r=p.getBaggage(e);if(!r||Ie(e))return;let i=ze(Be(r).filter(e=>e.length<=Re).slice(0,180));i.length>0&&n.set(t,Le,i)}extract(e,t,n){let r=n.get(t,Le);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=He(r[e],i,a,o);else [a]=He(r,i,a,o);return a===0?e:p.setBaggage(e,p.createBaggage(i))}fields(){return[Le]}};function v(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!We(n)){_.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Ge(r)){_.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function We(e){return typeof e==`string`&&e!==``}function Ge(e){return e==null?!0:Array.isArray(e)?Ke(e):qe(typeof e)}function Ke(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(qe(e)){t=e;continue}return!1}return!1}}return!0}function qe(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function Je(){return e=>{_.error(Ye(e))}}function Ye(e){return typeof e==`string`?e:JSON.stringify(Xe(e))}function Xe(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Ze=Je();function y(e){try{Ze(e)}catch{}}var Qe=globalThis,$e=`2.8.0`,et=`http.url`,tt=`http.user_agent`,nt=et,rt=tt,it=`deployment.environment.name`,at=`error.type`,ot=`exception.message`,st=`exception.stacktrace`,ct=`exception.type`,lt=`http.request.method`,ut=`http.request.method_original`,dt=`http.response.status_code`,ft=`server.address`,pt=`server.port`,mt=`service.name`,ht=`service.version`,gt=`telemetry.sdk.language`,_t=`webjs`,vt=`telemetry.sdk.name`,yt=`telemetry.sdk.version`,bt=`url.full`,xt=`process.runtime.name`,St={[vt]:`opentelemetry`,[xt]:`browser`,[gt]:_t,[yt]:$e},b=performance,Ct=9,wt=10**6,x=10**Ct;function S(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*wt)]}function C(e){return Ot(S(b.timeOrigin),S(typeof e==`number`?e:b.now()))}function w(e){if(Et(e))return e;if(typeof e==`number`)return e<b.timeOrigin?C(e):S(e);if(e instanceof Date)return S(e.getTime());throw TypeError(`Invalid input type`)}function Tt(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=x),[n,r]}function T(e){return e[0]*x+e[1]}function Et(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Dt(e){return Et(e)||typeof e==`number`||e instanceof Date}function Ot(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=x&&(n[1]-=x,n[0]+=1),n}var E;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(E||={});var kt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){_.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){_.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},At=`[_0-9a-z-*/]`,jt=`[a-z]${At}{0,255}`,Mt=`[a-z0-9]${At}{0,240}@[a-z]${At}{0,13}`,Nt=RegExp(`^(?:${jt}|${Mt})$`),Pt=/^[ -~]{0,255}[!-~]$/,Ft=/,|=/;function It(e){return Nt.test(e)}function Lt(e){return Pt.test(e)&&!Ft.test(e)}var Rt=32,zt=512,Bt=`,`,Vt=`=`,Ht=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!It(e)||!Lt(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>zt)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Bt+e),e=`${n[0]}${Vt}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Bt),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Vt);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!It(a)||!Lt(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>zt)&&(t.set(a,o),n=s,t.size>=Rt))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},D=`traceparent`,Ut=`tracestate`,Wt=`00`,Gt=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Kt(e){let t=Gt.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var qt=class{inject(e,t,r){let i=d.getSpanContext(e);if(!i||Ie(e)||!c(i))return;let a=`${Wt}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||n.NONE).toString(16)}`;r.set(t,D,a),i.traceState&&r.set(t,Ut,i.traceState.serialize())}extract(e,t,n){let r=n.get(t,D);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Kt(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,Ut);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Ht(typeof e==`string`?e:void 0)}return d.setSpanContext(e,a)}fields(){return[D,Ut]}},Jt=`[object Object]`,Yt=`[object Null]`,Xt=`[object Undefined]`,Zt=Function.prototype.toString,Qt=Zt.call(Object),$t=Object.getPrototypeOf,en=Object.prototype,tn=en.hasOwnProperty,O=Symbol?Symbol.toStringTag:void 0,nn=en.toString;function rn(e){if(!an(e)||on(e)!==Jt)return!1;let t=$t(e);if(t===null)return!0;let n=tn.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Zt.call(n)===Qt}function an(e){return typeof e==`object`&&!!e}function on(e){return e==null?e===void 0?Xt:Yt:O&&O in Object(e)?sn(e):cn(e)}function sn(e){let t=tn.call(e,O),n=e[O],r=!1;try{e[O]=void 0,r=!0}catch{}let i=nn.call(e);return r&&(t?e[O]=n:delete e[O]),i}function cn(e){return nn.call(e)}var ln=20;function un(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=fn(t,e.shift(),0,n);return t}function dn(e){return k(e)?e.slice():e}function fn(e,t,n=0,r){let i;if(!(n>ln)){if(n++,j(e)||j(t)||mn(t))i=dn(t);else if(k(e)){if(i=e.slice(),k(t))for(let e=0,n=t.length;e<n;e++)i.push(dn(t[e]));else if(A(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=dn(t[r]))}}}else if(A(e))if(A(t)){if(!hn(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(j(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(pn(e,s,r)||pn(t,s,r))delete i[s];else{if(A(a)&&A(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=fn(i[s],c,n,r)}}}}else i=t;return i}}function pn(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function k(e){return Array.isArray(e)}function mn(e){return typeof e==`function`}function A(e){return!j(e)&&!k(e)&&!mn(e)&&typeof e==`object`}function j(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function hn(e,t){return!(!rn(e)||!rn(t))}function gn(e,t){return typeof t==`string`?e===t:!!e.match(t)}function _n(e,t){if(!t)return!1;for(let n of t)if(gn(e,n))return!0;return!1}var vn=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},yn=class{_isCalled=!1;_deferred=new vn;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function bn(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function xn(){return{handleResponse(e){e==null||!bn(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||_.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Sn=class{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=_.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:E.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:E.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:E.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:E.FAILED,error:e.error});return}else e.status===`retryable`?t({code:E.FAILED,error:new De(`Export failed with retryable status`)}):t({code:E.FAILED,error:new De(`Export failed with unknown error`)})},e=>t({code:E.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function Cn(e,t){return new Sn(e.transport,e.serializer,xn(),e.promiseHandler,t.timeout)}function wn(e,t,n){return Cn({transport:n,serializer:t,promiseHandler:Ne(e)},{timeout:e.timeoutMillis})}function Tn(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function En(e){let t=new Uint8Array(e.length/2),n=0;for(let r=0;r<e.length;r+=2){let i=Tn(e.charCodeAt(r)),a=Tn(e.charCodeAt(r+1));t[n++]=i<<4|a}return t}function Dn(e){let t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function On(e){return{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}function kn(e){return On(Dn(e))}function An(e){return Dn(e).toString()}var jn=typeof BigInt<`u`?An:T;function Mn(e){return e}function Nn(e){if(e!==void 0)return En(e)}var Pn={encodeHrTime:kn,encodeSpanContext:En,encodeOptionalSpanContext:Nn};function Fn(e){if(e===void 0)return Pn;let t=e.useLongBits??!0,n=e.useHex??!1;return{encodeHrTime:t?kn:jn,encodeSpanContext:n?Mn:En,encodeOptionalSpanContext:n?Mn:Nn}}function In(e){let t={attributes:M(e.attributes),droppedAttributesCount:0},n=e.schemaUrl;return n&&n!==``&&(t.schemaUrl=n),t}function Ln(e){return{name:e.name,version:e.version}}function M(e){return Object.keys(e).map(t=>Rn(t,e[t]))}function Rn(e,t){return{key:e,value:zn(t)}}function zn(e){let t=typeof e;return t===`string`?{stringValue:e}:t===`number`?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t===`boolean`?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(zn)}}:t===`object`&&e!=null?{kvlistValue:{values:Object.entries(e).map(([e,t])=>Rn(e,t))}}:{}}function Bn(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:M(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Hn(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Vn(e,t)),droppedLinksCount:e.droppedLinksCount}}function Vn(e,t){return{attributes:e.attributes?M(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function Hn(e,t){return{attributes:e.attributes?M(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Un(e,t){return{resourceSpans:Gn(e,Fn(t))}}function Wn(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Gn(e,t){let n=Wn(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Bn(e,t));o.push({scope:Ln(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=In(e),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var Kn={serializeRequest:e=>{let t=Un(e,{useHex:!0,useLongBits:!1});return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;return JSON.parse(t.decode(e))}},qn=5,Jn=1e3,Yn=5e3,Xn=1.5,Zn=.2;function Qn(){return 2*Zn*Math.random()-Zn}var $n=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Date.now()+t,r=await this._transport.send(e,t),i=qn,a=Jn;for(;r.status===`retryable`&&i>0;){i--;let t=Math.max(Math.min(a,Yn)+Qn(),0);a*=Xn;let o=r.retryInMillis??t,s=n-Date.now();if(o>s)return r;r=await this.retry(e,s,o)}return r}shutdown(){return this._transport.shutdown()}};function er(e){return new $n(e.transport)}function tr(e){return[429,502,503,504].includes(e)}function nr(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var rr=class{_parameters;constructor(e){this._parameters=e}send(e,t){return new Promise(n=>{let r=new XMLHttpRequest;r.timeout=t,r.open(`POST`,this._parameters.url);let i=this._parameters.headers();Object.entries(i).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{n({status:`failure`,error:Error(`XHR request timed out`)})},r.onreadystatechange=()=>{r.status>=200&&r.status<=299?(_.debug(`XHR success`),n({status:`success`})):r.status&&tr(r.status)?n({status:`retryable`,retryInMillis:nr(r.getResponseHeader(`Retry-After`))}):r.status!==0&&n({status:`failure`,error:Error(`XHR request failed with non-retryable status`)})},r.onabort=()=>{n({status:`failure`,error:Error(`XHR request aborted`)})},r.onerror=()=>{n({status:`failure`,error:Error(`XHR request errored`)})},r.send(e)})}shutdown(){}};function ir(e){return new rr(e)}var ar=class{_params;constructor(e){this._params=e}send(e){return new Promise(t=>{navigator.sendBeacon(this._params.url,new Blob([e],{type:this._params.blobType}))?(_.debug(`SendBeacon success`),t({status:`success`})):t({status:`failure`,error:Error(`SendBeacon failed`)})})}shutdown(){}};function or(e){return new ar(e)}var sr=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t);try{let t=!!globalThis.location,r=new URL(this._parameters.url),i=await fetch(r.href,{method:`POST`,headers:this._parameters.headers(),body:e,signal:n.signal,keepalive:t,mode:t?globalThis.location?.origin===r.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(_.debug(`response success`),{status:`success`}):tr(i.status)?{status:`retryable`,retryInMillis:nr(i.headers.get(`Retry-After`))}:{status:`failure`,error:Error(`Fetch request failed with non-retryable status`)}}catch(e){return e?.name===`AbortError`?{status:`failure`,error:Error(`Fetch request timed out`,{cause:e})}:{status:`failure`,error:Error(`Fetch request errored`,{cause:e})}}finally{clearTimeout(r)}}shutdown(){}};function cr(e){return new sr(e)}function lr(e,t){return wn(e,t,er({transport:ir(e)}))}function ur(e,t){return wn(e,t,er({transport:cr(e)}))}function dr(e,t){return wn(e,t,er({transport:or({url:e.url,blobType:e.headers()[`Content-Type`]})}))}function fr(e){return()=>{let t={};return Object.entries(e?.()??{}).forEach(([e,n])=>{n===void 0?_.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}}function pr(e,t,n){let r={...n()},i={};return()=>(t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,r))}function mr(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function hr(n){return async r=>{let{Agent:i}=await t(()=>import(`./__vite-browser-external-pK7FQf_r.js`).then(t=>e(t.default)),__vite__mapDeps([0,1]),import.meta.url);return new i(n)}}function gr(e,t,n){return{...Ae(e,t,n),headers:pr(fr(e.headers),t.headers,n.headers),url:mr(e.url)??t.url??n.url,agentFactory:e.agentFactory??t.agentFactory??n.agentFactory}}function _r(e,t){return{...je(),headers:()=>e,url:`http://localhost:4318/`+t,agentFactory:hr({keepAlive:!0})}}function vr(e,t,n){return gr({url:e.url,timeoutMillis:e.timeoutMillis,headers:ke(e.headers),concurrencyLimit:e.concurrencyLimit},{},_r(n,t))}function yr(e,t,n,r){return br(e.headers)(vr(e,n,r),t)}function br(e){return!e&&typeof navigator.sendBeacon==`function`?dr:globalThis.fetch===void 0?lr:ur}var xr=class extends Ee{constructor(e={}){super(yr(e,Kn,`v1/traces`,{"Content-Type":`application/json`}))}},Sr=class{emit(e){}},Cr=new Sr,wr=new class{getLogger(e,t,n){return new Sr}},Tr=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Cr}},Er=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Tr(this,e,t,n)}_getDelegate(){return this._delegate??wr}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},Dr=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{},N=Symbol.for(`io.opentelemetry.js.api.logs`),P=Dr;function Or(e,t,n){return r=>r===e?t:n}var kr=class e{constructor(){this._proxyLoggerProvider=new Er}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return P[N]?this.getLoggerProvider():(P[N]=Or(1,e,wr),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return P[N]?.call(P,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete P[N],this._proxyLoggerProvider=new Er}}.getInstance();function Ar(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function jr(e){e.forEach(e=>e.disable())}function Mr(e){let t=e.tracerProvider||d.getTracerProvider(),n=e.meterProvider||Te.getMeterProvider(),r=e.loggerProvider||kr.getLoggerProvider(),i=e.instrumentations?.flat()??[];return Ar(i,t,n,r),()=>{jr(i)}}var F=console.error.bind(console);function I(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}var Nr=(e,t,n)=>{if(!e||!e[t]){F(`no original function `+String(t)+` to wrap`);return}if(!n){F(`no wrapper function`),F(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){F(`original object and wrapper must be functions`);return}let i=n(r,t);return I(i,`__original`,r),I(i,`__unwrap`,()=>{e[t]===i&&I(e,t,r)}),I(i,`__wrapped`,!0),I(e,t,i),i},Pr=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{F(`must provide one or more modules to patch`),F(Error().stack);return}if(!(t&&Array.isArray(t))){F(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Nr(e,t,n)})})},Fr=(e,t)=>{if(!e||!e[t]){F(`no function to unwrap.`),F(Error().stack);return}let n=e[t];if(!n.__unwrap)F(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Ir=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{F(`must provide one or more modules to patch`),F(Error().stack);return}if(!(t&&Array.isArray(t))){F(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Fr(e,t)})})};function L(e){e&&e.logger&&(typeof e.logger==`function`?F=e.logger:F(`new logger isn't a function, not replacing`))}L.wrap=Nr,L.massWrap=Pr,L.unwrap=Fr,L.massUnwrap=Ir;var Lr=class{instrumentationName;instrumentationVersion;_config={};_tracer;_meter;_logger;_diag;constructor(e,t,n){this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=_.createComponentLogger({namespace:e}),this._tracer=d.getTracer(e,t),this._meter=Te.getMeter(e,t),this._logger=kr.getLogger(e,t),this._updateMetricInstruments()}_wrap=Nr;_unwrap=Fr;_massWrap=Pr;_massUnwrap=Ir;get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){let e=this.init()??[];return Array.isArray(e)?e:[e]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config={enabled:!0,...e}}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}},Rr=class extends Lr{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}};function R(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}function z(e){return typeof e==`function`&&typeof e.__original==`function`&&typeof e.__unwrap==`function`&&e.__wrapped===!0}var B;(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(B||={});function zr(e,t){let n=B.OLD,r=t?.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r??[])if(t.toLowerCase()===e+`/dup`){n=B.DUPLICATE;break}else t.toLowerCase()===e&&(n=B.STABLE);return n}var V;function Br(){if(V===void 0)try{let e=globalThis.process.argv0;V=e?`unknown_service:${e}`:`unknown_service`}catch{V=`unknown_service`}return V}var H=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Vr=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Wr(t),r._asyncAttributesPending=t.filter(([e,t])=>H(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(H(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Wr(this._rawAttributes),this._schemaUrl=Gr(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,H(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&_.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(H(n)){_.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Kr(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Hr(e,t){return Vr.FromAttributeList(Object.entries(e),t)}function Ur(){return Hr({[mt]:Br(),[gt]:St[gt],[vt]:St[vt],[yt]:St[yt]})}function Wr(e){return e.map(([e,t])=>H(t)?[e,t.catch(t=>{_.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Gr(e){if(typeof e==`string`||e===void 0)return e;_.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Kr(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;_.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var qr=`exception`,Jr=Symbol.for(`nodejs.util.inspect.custom`);function Yr(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function Xr(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}var Zr=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:m.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=b.now(),this._performanceOffset=t-(this._performanceStartTime+b.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return _.warn(`Invalid attribute key: ${e}`),this;if(!Ge(t))return _.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return _.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&_.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Dt(t)&&(Dt(n)||(n=t),t=void 0);let i=v(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&_.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=v(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===m.UNSET||this.status.code===m.OK)return this;let t={code:e.code};return e.code===m.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&_.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){_.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Tt(this.startTime,this.endTime),this._duration[0]<0&&(_.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&_.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&_.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=b.now())return C(e+this._performanceOffset);if(typeof e==`number`)return S(e);if(e instanceof Date)return S(e.getTime());if(Et(e))return e;if(this._startTimeProvided)return S(Date.now());let t=b.now()-this._performanceStartTime;return Ot(this.startTime,S(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ot]=e:e&&(e.code?n[ct]=e.code.toString():e.name&&(n[ct]=e.name),e.message&&(n[ot]=e.message),e.stack&&(n[st]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(qr,n,t):_.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);_.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(_.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Jr](e,t,n){return Xr(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Yr(this.resource)}},e,t,n)}},U;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(U||={});var Qr=`otel.component.name`,$r=`otel.component.type`,ei=`otel.span.parent.origin`,ti=`otel.span.sampling_result`,ni=`otel.sdk.processor.span.processed`,ri=`otel.sdk.processor.span.queue.capacity`,ii=`otel.sdk.processor.span.queue.size`,ai=`otel.sdk.span.live`,oi=`otel.sdk.span.started`,si=`batching_span_processor`,ci=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(oi,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ai,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=ui(t);if(this.startedSpans.add(1,{[ei]:li(e),[ti]:n}),t===U.NOT_RECORD)return()=>{};let r={[ti]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function li(e){return e?e.isRemote?`remote`:`local`:`none`}function ui(e){switch(e){case U.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case U.RECORD:return`RECORD_ONLY`;case U.NOT_RECORD:return`DROP`}}var di=`2.9.0`,fi=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t){this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor,this._tracerMetrics=new ci(t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,di))}startSpan(e,t={},r=h.active()){t.root&&(r=d.deleteSpan(r));let i=d.getSpan(r);if(Ie(r))return _.debug(`Instrumentation suppressed, returning Noop Span`),d.wrapSpanContext(o);let a=i?.spanContext(),s=this._idGenerator.generateSpanId(),c,l,u;!a||!d.isSpanContextValid(a)?l=this._idGenerator.generateTraceId():(l=a.traceId,u=a.traceState,c=a);let f=t.kind??Se.INTERNAL,ee=(t.links??[]).map(e=>({context:e.context,attributes:v(e.attributes)})),p=v(t.attributes),m=this._sampler.shouldSample(r,l,e,f,p,ee),te=this._tracerMetrics.startSpan(a,m.decision);u=m.traceState??u;let ne=m.decision===xe.RECORD_AND_SAMPLED?n.SAMPLED:n.NONE,re={traceId:l,spanId:s,traceFlags:ne,traceState:u};if(m.decision===xe.NOT_RECORD)return _.debug(`Recording is off, propagating context in a non-recording span`),d.wrapSpanContext(re);let g=v(Object.assign(p,m.attributes));return new Zr({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:re,name:e,kind:f,links:ee,parentSpanContext:c,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??h.active(),c=this.startSpan(e,i,s),l=d.setSpan(s,c);return h.with(l,o,void 0,c)}[Jr](e,t,n){return Xr(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Yr(this._resource)},spanLimits:this._spanLimits},e,t,n)}},pi=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{y(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},mi=class{shouldSample(){return{decision:U.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},W=class{shouldSample(){return{decision:U.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},G=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(y(Error(`ParentBasedSampler must have a root sampler configured`)),new W),this._remoteParentSampled=e.remoteParentSampled??new W,this._remoteParentNotSampled=e.remoteParentNotSampled??new mi,this._localParentSampled=e.localParentSampled??new W,this._localParentNotSampled=e.localParentNotSampled??new mi}shouldSample(e,t,r,i,a,o){let s=d.getSpanContext(e);return!s||!c(s)?this._root.shouldSample(e,t,r,i,a,o):s.isRemote?s.traceFlags&n.SAMPLED?this._remoteParentSampled.shouldSample(e,t,r,i,a,o):this._remoteParentNotSampled.shouldSample(e,t,r,i,a,o):s.traceFlags&n.SAMPLED?this._localParentSampled.shouldSample(e,t,r,i,a,o):this._localParentNotSampled.shouldSample(e,t,r,i,a,o)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},hi=new Map,gi=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,t,n){let r=hi.get(e)??0;if(hi.set(e,r+1),this.standardAttrs={[$r]:e,[Qr]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[at]:`queue_full`},this.processedSpans=t.createCounter(ni,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(ri,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(ii,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[at]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}},_i=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new yn(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(_.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize),this._metrics=new gi(si,e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):be(),{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&n.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&_.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(_.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);h.with(Fe(h.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===E.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{y(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,y(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},vi=class extends _i{_visibilityChangeListener;_pageHideListener;constructor(e){super(e),this.onInit(e)}onInit(e){e.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{y(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{y(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}},yi=16,bi=8,xi=new Uint8Array(yi),Si=new Uint8Array(bi),Ci=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function wi(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Ti(e){let t=``;for(let n=0;n<e.length;n++)t+=Ci[e[n]];return t}var Ei=class{generateTraceId(){return wi(xi),Ti(xi)}generateSpanId(){return wi(Si),Ti(Si)}},K;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(K||={});var Di=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Ur(),this._activeSpanProcessor=new pi(e.spanProcessors??[]),this._tracerOptions={resource:this._resource,sampler:e.sampler??new G({root:new W}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Ei,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return be()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new fi({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=K.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==K.timeout&&(r=K.resolved,n(r))}).catch(e=>{clearTimeout(i),r=K.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==K.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Jr](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Xr(`TracerProvider`,{resource:{attributes:Yr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Oi=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:l(t)&&this._accumulate(t)<this._upperBound?U.RECORD_AND_SAMPLED:U.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(q||={});var ki=1;function Ai(){return{sampler:ji(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function ji(){let e=q.ParentBasedAlwaysOn;switch(e){case q.AlwaysOn:return new W;case q.AlwaysOff:return new mi;case q.ParentBasedAlwaysOn:return new G({root:new W});case q.ParentBasedAlwaysOff:return new G({root:new mi});case q.TraceIdRatio:return new Oi(Mi());case q.ParentBasedTraceIdRatio:return new G({root:new Oi(Mi())});default:return _.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${q.ParentBasedAlwaysOn}".`),new G({root:new W})}}function Mi(){return _.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ki}.`),ki}function Ni(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??1/0,Object.assign({},e,{spanLimits:t})}var Pi=class extends Di{constructor(e={}){let t=un({},Ai(),Ni(e));delete t.generalLimits,super(t)}},Fi=class extends vi{constructor(e,t){t||={};for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])t[e];super({exporter:e,...t})}},Ii=class{_enabled=!1;_currentContext=u;_bindFunction(e=u,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=u,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=u,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||u;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Li(e){if(e!==null){if(e===void 0){let e=new Ii;e.enable(),h.setGlobalContextManager(e);return}e.enable(),h.setGlobalContextManager(e)}}function Ri(e){if(e!==null){if(e===void 0){p.setGlobalPropagator(new kt({propagators:[new qt,new Ue]}));return}p.setGlobalPropagator(e)}}var zi=class extends Pi{constructor(e={}){super(e)}register(e={}){d.setGlobalTracerProvider(this),Ri(e.propagator),Li(e.contextManager)}},J;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||={});var Bi=`http.response_content_length`,Vi=`http.response_content_length_uncompressed`;function Y(e,t){return t in e}function X(e,t,n,r=!0){if(Y(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function Hi(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(X(e,J.FETCH_START,t,r),X(e,J.DOMAIN_LOOKUP_START,t,r),X(e,J.DOMAIN_LOOKUP_END,t,r),X(e,J.CONNECT_START,t,r),X(e,J.SECURE_CONNECTION_START,t,r),X(e,J.CONNECT_END,t,r),X(e,J.REQUEST_START,t,r),X(e,J.RESPONSE_START,t,r),X(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(Bi,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Vi,r)}}function Ui(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=Gi(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Ui(e.parentNode,t)),r+=n,r}function Wi(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function Gi(e,t){let n=e.nodeType,r=Wi(e),i;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}var Ki;(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(Ki||={});var qi=`0.49.0`,Ji=`@opentelemetry/instrumentation-document-load`,Yi;(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(Yi||={});var Xi=()=>{let e={},t=b.getEntriesByType?.(`navigation`)[0];if(t)Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}});else{let t=b.timing;t&&Object.values(J).forEach(n=>{if(Y(t,n)){let r=t[n];typeof r==`number`&&(e[n]=r)}})}return e},Zi={"first-paint":Yi.FIRST_PAINT,"first-contentful-paint":Yi.FIRST_CONTENTFUL_PAINT},Qi=e=>{let t=b.getEntriesByType?.(`paint`);t&&t.forEach(({name:t,startTime:n})=>{Y(Zi,t)&&e.addEvent(Zi[t],n)})},$i=class extends Rr{component=`document-load`;version=`1`;moduleName=this.component;constructor(e={}){super(Ji,qi,e)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){let t=b.getEntriesByType?.(`resource`);t&&t.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===D),t=Xi(),n=e&&e.content||``;h.with(p.extract(u,{traceparent:n}),()=>{let e=this._startSpan(Ki.DOCUMENT_LOAD,J.FETCH_START,t);e&&(h.with(d.setSpan(h.active(),e),()=>{let e=this._startSpan(Ki.DOCUMENT_FETCH,J.FETCH_START,t);e&&(e.setAttribute(nt,location.href),h.with(d.setSpan(h.active(),e),()=>{Hi(e,t,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),e.setAttribute(nt,location.href),e.setAttribute(rt,navigator.userAgent),this._addResourcesSpans(e),this.getConfig().ignoreNetworkEvents||(X(e,J.FETCH_START,t),X(e,J.UNLOAD_EVENT_START,t),X(e,J.UNLOAD_EVENT_END,t),X(e,J.DOM_INTERACTIVE,t),X(e,J.DOM_CONTENT_LOADED_EVENT_START,t),X(e,J.DOM_CONTENT_LOADED_EVENT_END,t),X(e,J.DOM_COMPLETE,t),X(e,J.LOAD_EVENT_START,t),X(e,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Qi(e),this._addCustomAttributesOnSpan(e,this.getConfig().applyCustomAttributesOnSpan?.documentLoad),this._endSpan(e,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Y(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(Ki.RESOURCE_FETCH,J.FETCH_START,e,t);n&&(n.setAttribute(nt,e.name),Hi(n,e,this.getConfig().ignoreNetworkEvents),this._addCustomAttributesOnResourceSpan(n,e,this.getConfig().applyCustomAttributesOnSpan?.resourceFetch),this._endSpan(n,J.RESPONSE_END,e))}_startSpan(e,t,n,r){if(Y(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?d.setSpan(h.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&R(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&R(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}},Z;(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(Z||={});var ea=`http.response_content_length`,ta=`http.response_content_length_uncompressed`,na;function ra(){return na||=document.createElement(`a`),na}function ia(e,t){return t in e}function Q(e,t,n,r=!0){if(ia(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function aa(e,t,n=!1,r,i){if(r===void 0&&(r=t[Z.START_TIME]!==0),n||(Q(e,Z.FETCH_START,t,r),Q(e,Z.DOMAIN_LOOKUP_START,t,r),Q(e,Z.DOMAIN_LOOKUP_END,t,r),Q(e,Z.CONNECT_START,t,r),Q(e,Z.SECURE_CONNECTION_START,t,r),Q(e,Z.CONNECT_END,t,r),Q(e,Z.REQUEST_START,t,r),Q(e,Z.RESPONSE_START,t,r),Q(e,Z.RESPONSE_END,t,r)),!i){let n=t[Z.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(ea,n);let r=t[Z.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(ta,r)}}function oa(e){return e.slice().sort((e,t)=>{let n=e[Z.FETCH_START],r=t[Z.FETCH_START];return n>r?1:n<r?-1:0})}function sa(){return typeof location<`u`?location.origin:void 0}function ca(e,t,n,r,i=new WeakSet,a){let o=da(e);e=o.toString();let s=ua(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=oa(s);if(o.origin!==sa()&&c.length>1){let e=c[0],t=la(c,e[Z.RESPONSE_END],n),r=e[Z.RESPONSE_END];return t[Z.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function la(e,t,n){let r=T(n),i=T(w(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=T(w(n[Z.FETCH_START])),c=r-T(w(n[Z.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function ua(e,t,n,r,i,a){let o=T(t),s=T(n),c=r.filter(t=>{let n=T(w(t[Z.FETCH_START])),r=T(w(t[Z.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function da(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=ra();return t.href=e,t}function fa(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),da(e).origin===sa()?!0:n.some(t=>gn(e,t))}var pa;(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(pa||={});var ma=`http.host`,ha=`http.method`,ga=`http.request.body.size`,_a=`http.request_content_length_uncompressed`,va=`http.scheme`,ya=`http.status_code`,ba=`http.url`,xa=`http.user_agent`,Sa=_.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`});function Ca(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=wa(t.body);return t.body=e,n}else return Promise.resolve(Ea(t.body))}else{let t=e[0];return t?.body?t.clone().text().then(e=>Oa(e)):Promise.resolve()}}function wa(e){if(!e.pipeThrough)return Sa.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},async transform(e,n){let r=await e;t+=r.byteLength,n.enqueue(e)},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function Ta(e){return typeof Document<`u`&&e instanceof Document}function Ea(e){if(Ta(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Oa(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return ka(e);if(e instanceof URLSearchParams)return Oa(e.toString());if(e.byteLength!==void 0)return e.byteLength;Sa.warn(`unknown body type`)}var Da=new TextEncoder;function Oa(e){return Da.encode(e).byteLength}function ka(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Aa(e){let t=Na(),n=e.toUpperCase();return n in t?n:`_OTHER`}var ja={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0},Ma;function Na(){return Ma===void 0&&(Ma=ja),Ma}var Pa={"https:":`443`,"http:":`80`};function Fa(e){let t=Number(e.port||Pa[e.protocol]);if(t&&!isNaN(t))return t}var Ia=`0.204.0`,La=300,Ra=typeof process==`object`&&process.release?.name===`node`,za=class extends Rr{component=`fetch`;version=Ia;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,Ia,e),this._semconvStability=zr(`http`,e?.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[Z.FETCH_START]},d.setSpan(h.active(),e)),r=!(this._semconvStability&B.OLD);aa(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[Z.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=da(t.url);if(this._semconvStability&B.OLD&&(e.setAttribute(ya,t.status),t.statusText!=null&&e.setAttribute(pa.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(ma,n.host),e.setAttribute(va,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(xa,navigator.userAgent)),this._semconvStability&B.STABLE){e.setAttribute(dt,t.status),e.setAttribute(ft,n.hostname);let r=Fa(n);r&&e.setAttribute(pt,r)}}_addHeaders(e,t){if(!fa(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};p.inject(h.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)p.inject(h.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Headers)p.inject(h.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else if(e.headers instanceof Map)p.inject(h.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t={};p.inject(h.active(),t),e.headers=Object.assign({},t,e.headers||{})}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(_n(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&B.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[pa.COMPONENT]=this.moduleName,r[ha]=i,r[ba]=e}if(this._semconvStability&B.STABLE){let i=t.method,a=Aa(t.method||`GET`);n||=a,r[lt]=a,a!==i&&(r[ut]=i),r[bt]=e}return this.tracer.startSpan(n,{kind:Se.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=ca(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&B.OLD);aa(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=S(Date.now()),i=C();this._addFinalSpanAttributes(e,n),this._semconvStability&B.STABLE&&n.status>=400&&(e.setStatus({code:m.ERROR}),e.setAttribute(at,String(n.status))),setTimeout(()=>{t.observer?.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},La)}_patchConstructor(){return e=>{let t=this;return function(...n){let r=this,i=da(n[0]instanceof Request?n[0].url:String(n[0])).href,a=n[0]instanceof Request?n[0]:n[1]||{},o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&Ca(...n).then(e=>{e&&(t._semconvStability&B.OLD&&o.setAttribute(_a,e),t._semconvStability&B.STABLE&&o.setAttribute(ga,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,t,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}finally{t(n)}}function f(e,t,n){try{c(e,n)}finally{t(n)}}return new Promise((n,s)=>h.with(d.setSpan(h.active(),o),()=>(t._addHeaders(a,i),t._callRequestHook(o,a),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o,n),f.bind(r,o,s)))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&R(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&R(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=C(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(Ra){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()`);return}z(fetch)&&(this._unwrap(Qe,`fetch`),this._diag.debug(`removing previous patch for constructor`)),this._wrap(Qe,`fetch`,this._patchConstructor())}disable(){Ra||(this._unwrap(Qe,`fetch`),this._usedResources=new WeakSet)}},$;(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})($||={});var Ba=`0.49.0`,Va=`@opentelemetry/instrumentation-user-interaction`,Ha=`OT_ZONE_CONTEXT`,Ua=`Navigation:`,Wa=[`click`];function Ga(){return!1}var Ka=class extends Rr{version=Ba;moduleName=`user-interaction`;_spansData=new WeakMap;_wrappedListeners=new WeakMap;_eventsSpanMap=new WeakMap;_eventNames;_shouldPreventSpanCreation;constructor(e={}){super(Va,Ba,e),this._eventNames=new Set(e?.eventNames??Wa),this._shouldPreventSpanCreation=typeof e?.shouldPreventSpanCreation==`function`?e.shouldPreventSpanCreation:Ga}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=C():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Ui(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[$.EVENT_TYPE]:t,[$.TARGET_ELEMENT]:e.tagName,[$.TARGET_XPATH]:r,[$.HTTP_URL]:window.location.href}},n?d.setSpan(h.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(Ha);return t&&d.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o?.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),h.with(d.setSpan(h.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._unpatchHistoryApi(),this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod())}_patchHistoryMethod(){let e=this;return t=>function(...n){let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_unpatchHistoryApi(){z(history.replaceState)&&this._unwrap(history,`replaceState`),z(history.pushState)&&this._unwrap(history,`pushState`),z(history.back)&&this._unwrap(history,`back`),z(history.forward)&&this._unwrap(history,`forward`),z(history.go)&&this._unwrap(history,`go`)}_updateInteractionName(e){let t=d.getSpan(h.active());t&&typeof t.updateName==`function`&&t.updateName(`${Ua} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=(Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0)?.target,o,s=this;if(a){if(o=e._createSpan(a,n.eventName),o)return e._incrementTask(o),s.run(()=>{try{return h.with(d.setSpan(h.active(),o),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(o)}})}else o=e._getCurrentSpan(s);try{return t.call(s,n,r,i)}finally{o&&e._shouldCountTask(n,s)&&e._decrementTask(o)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(z(e.prototype.runTask)&&(this._unwrap(e.prototype,`runTask`),this._diag.debug(`removing previous patch from method runTask`)),z(e.prototype.scheduleTask)&&(this._unwrap(e.prototype,`scheduleTask`),this._diag.debug(`removing previous patch from method scheduleTask`)),z(e.prototype.cancelTask)&&(this._unwrap(e.prototype,`cancelTask`),this._diag.debug(`removing previous patch from method cancelTask`)),this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{z(e.addEventListener)&&(this._unwrap(e,`addEventListener`),this._diag.debug(`removing previous patch from method addEventListener`)),z(e.removeEventListener)&&(this._unwrap(e,`removeEventListener`),this._diag.debug(`removing previous patch from method removeEventListener`)),this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){let e=this._getZoneWithPrototype();this._diag.debug(`removing patch from`,this.moduleName,this.version,`zone:`,!!e),e&&this._zonePatched?(z(e.prototype.runTask)&&this._unwrap(e.prototype,`runTask`),z(e.prototype.scheduleTask)&&this._unwrap(e.prototype,`scheduleTask`),z(e.prototype.cancelTask)&&this._unwrap(e.prototype,`cancelTask`)):this._getPatchableEventTargets().forEach(e=>{z(e.addEventListener)&&this._unwrap(e,`addEventListener`),z(e.removeEventListener)&&this._unwrap(e,`removeEventListener`)}),this._unpatchHistoryApi()}_getZoneWithPrototype(){return window.Zone}},qa=`open-knowledge-app`,Ja=!1;function Ya(){return{BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.84.0`}?.VITE_OTEL_COLLECTOR_URL??`http://localhost:14318`}function Xa(){if(Ja)return;Ja=!0;let e=null,t=!1;try{let n=Ya(),r={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.84.0`};e=new zi({resource:Hr({[mt]:`open-knowledge-app`,[ht]:r?.VITE_APP_VERSION??`dev`,[it]:r?.MODE??`dev`,[ne]:te}),spanProcessors:[new Fi(new xr({url:`${n}/v1/traces`}),{maxExportBatchSize:50,scheduledDelayMillis:2e3})]}),e.register(),t=!0,Mr({instrumentations:[new $i,new Ka({eventNames:[`click`,`submit`]}),new za({propagateTraceHeaderCorsUrls:[/^https?:\/\/localhost(:\d+)?\/api\//,/^https?:\/\/127\.0\.0\.1(:\d+)?\/api\//,/^\/api\//],clearTimingResources:!0})]}),console.info(`[otel] frontend telemetry initialized — OTLP/HTTP → ${n}/v1/traces`)}catch(n){console.warn(`[otel] frontend telemetry init failed — continuing without`,n),t&&e&&e.shutdown().catch(()=>{}),Ja=!1}}function Za(){return d.getTracer(qa)}export{Za as getAppTracer,Xa as install};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./propagation-api-BP58TooP.js";import{t}from"./context-api-D2PVlCLE.js";import{n}from"./startup-marks-aftNzVFI.js";import{getAppTracer as r}from"./telemetry-impl-
|
|
1
|
+
import{t as e}from"./propagation-api-BP58TooP.js";import{t}from"./context-api-D2PVlCLE.js";import{n}from"./startup-marks-aftNzVFI.js";import{getAppTracer as r}from"./telemetry-impl-C_SzfD38.js";var i;function a(){if(!i)try{let a=typeof window<`u`?window.okDesktop?.config.startupTraceparent:void 0;if(!a)return;let o=e.extract(t.active(),{traceparent:a}),s=r().startSpan(`ok.app-startup`,void 0,o);i=s,n(e=>{try{s.end(e)}catch{}i=void 0})}catch{}}export{a as initStartupTrace};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{t as i}from"./utils-CPqDy6Hr.js";import{t as a}from"./dist-BsJYDohW.js";import"./separator-D7s_9ZwH.js";import{i as o,n as s,o as c,r as l}from"./RegisteredAgentIcon-DjlAkIlP.js";import{a as u}from"./local-menu-action-bus-Dyh2UJJF.js";import{b as d}from"./handoff-ClTYrgLm.js";import{u as f}from"./agent-registry-B4dxoiaL.js";import{t as p}from"./createLucideIcon-DdBzwsHe.js";var m=`open-knowledge:comments-send-to-open-chat`,h=`open-knowledge:comments-send-in-thread`,g=typeof window>`u`?new EventTarget:window;function _(e){g.dispatchEvent(new CustomEvent(m,{detail:{threadIds:e}}))}function v(e){let t=t=>{e(t instanceof CustomEvent?t.detail??{}:{})};return g.addEventListener(m,t),()=>g.removeEventListener(m,t)}function y(e,t){g.dispatchEvent(new CustomEvent(h,{detail:{threadId:e,threadIds:t}}))}function b(e){let t=t=>{let n=t instanceof CustomEvent?t.detail:null;n==null||typeof n.threadId!=`string`||n.threadId===``||e(n.threadId,n.threadIds)};return g.addEventListener(h,t),()=>g.removeEventListener(h,t)}var x=p(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),S=r(),C=t(),w=a(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function T(e){let t=(0,S.c)(11),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,orientation:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let o;t[4]!==n||t[5]!==r?(o=i(w({orientation:r}),n),t[4]=n,t[5]=r,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,C.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:o,...a}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}var E=e(n(),1),D=`ok-ask-ai-agent-v2`,O=`ok-ask-ai-default-agent-v1`,k=`ok-preferred-agent-v1`,A=`terminal-cli`;function j(e){return`${A}:${e}`}var M=`in-app-thread`;function N(e){return`${M}:${e.source}:${e.id}`}function P(e){if(e===null)return null;if(e===`in-app-thread`)return{kind:`default`};let t=`${M}:`;if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`:`);if(r<=0)return null;let i=n.slice(0,r),a=n.slice(r+1);return i!==`registry`&&i!==`custom`||a===``?null:{kind:`concrete`,source:i,id:a}}function F(e){return e===null?null:e===`terminal-cli`?`claude`:d.find(t=>e===j(t))??null}function I(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function L(e){let t=I(e);if(!t)return null;try{let e=t.getItem(D);return e===null?t.getItem(O)??t.getItem(k):e}catch{return null}}function R(e,t){let n=I(t);if(n)try{n.setItem(D,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}for(let e of z)e()}var z=new Set;function B(){return L()}function V(){for(let e of z)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-ask-ai-agent-v2`||e.key===null)&&V()});function H(e){return z.add(e),()=>z.delete(e)}function U(){return(0,E.useSyncExternalStore)(H,B,B)}function W(e,t){return e.filter(e=>l(t,e.source,e.id,!0,e.supported))}function G(e,t){return d.filter(n=>o(e,n,t))}function K(e,t){return f.filter(n=>s(e,n.id,t[n.id]?.installed)).map(e=>e.id)}function q(e,t){return f.filter(n=>e[c(n.id)]===void 0&&t[n.id]?.installed==null).map(e=>e.id)}function J(e){let{sticky:t,effectiveThreadAgent:n,enabledClis:r,enabledDesktopTargets:i,unresolvedDesktopTargets:a=[],installedClis:o,terminalAvailable:s,threadsAvailable:c,desktopSelectable:l,preferBareTerminal:u,bareTerminalFallback:d}=e;if(u&&s)return{kind:`terminal`};if(c&&P(t)!==null&&n!==null)return{kind:`thread`,agent:n};if(s){let e=F(t);if(e!==null&&r.includes(e))return{kind:`cli`,cli:e}}return l&&t!==null&&(i.includes(t)||a.includes(t))?{kind:`desktop`,target:t}:c&&n!==null?{kind:`thread`,agent:n}:s&&r.length>0?{kind:`cli`,cli:r.find(e=>o[e]===!0)??r[0]}:l&&i.length>0?{kind:`desktop`,target:i[0]}:d&&s?{kind:`terminal`}:{kind:`none`}}var Y=`open-knowledge:terminal-launch`;function X(){return typeof window>`u`?new EventTarget:window}function Z(e,t){e.dispatchEvent(new CustomEvent(Y,{detail:t}))}function Q(e,t,n,r=X()){let i=n?.stage===!0;u({kind:`terminal-launch`,prompt:e,cli:t,stage:i},r)||Z(r,{kind:`cli`,prompt:e,cli:t,stage:i,...n?.signInThreadId===void 0?{}:{signInThreadId:n.signInThreadId}})}function $(e,t=X()){Z(t,{kind:`command`,...e})}function ee(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent&&typeof t.detail==`object`&&t.detail!==null?t.detail:void 0;if(n===void 0)return;let r=typeof n.signInThreadId==`string`?{signInThreadId:n.signInThreadId}:{};if(n.kind===`command`){let t=n.command;typeof t==`object`&&t&&typeof t.executable==`string`&&Array.isArray(t.args)&&typeof n.label==`string`&&e({kind:`command`,command:t,label:n.label,...r});return}n.kind!==void 0&&n.kind!==`cli`||typeof n.prompt!=`string`||typeof n.cli!=`string`||e({kind:`cli`,prompt:n.prompt,cli:n.cli,stage:n.stage===!0,...r})};return t.addEventListener(Y,n),()=>t.removeEventListener(Y,n)}export{x as _,G as a,b,q as c,F as d,R as f,T as g,U as h,K as i,M as l,N as m,Q as n,W as o,j as p,ee as r,J as s,$ as t,L as u,_ as v,v as x,y};
|
package/dist/public/assets/{typing-burst-detector-NbMMCwJS.js → typing-burst-detector-BvJppmhO.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Bn as n,Bt as r,Fn as i,Qn as a,Vt as o,br as s,fi as c,hn as l,i as u,jn as d,li as f,mr as p,z as m}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Bn as n,Bt as r,Fn as i,Qn as a,Vt as o,br as s,fi as c,hn as l,i as u,jn as d,li as f,mr as p,z as m}from"./DocumentContext-CorZvYgo.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{i as S,n as C,t as w}from"./tooltip-DBqLYfio.js";import{n as T,r as E,t as D}from"./collapsible-BKbszYZV.js";import{n as O,t as k}from"./toggle-group-B7p69Qfd.js";import{t as A}from"./button-DzgjsZzC.js";import{y as j}from"./constants-upload-CVKO8P4d.js";import{n as M}from"./dist-BGzUo_18.js";import{t as N}from"./dist-C_FzPxEX2.js";import{d as P}from"./constants-cc1-Bt4QPTUe.js";import{f as F,v as I}from"./documents-events-ckNvVQCr.js";import{C as L,ht as ee,vt as R}from"./schemas-api-BbYGQuTW.js";import{n as z}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as B}from"./note-window-mode-CI3Yju9B.js";import{t as V}from"./createLucideIcon-DdBzwsHe.js";import{t as H}from"./chevron-right-Bofu4lib.js";import{n as U,t as te}from"./lint-plugin-meta-CtDE2R0v.js";import{t as W}from"./circle-alert-eBm4JPxY.js";import{Kn as G,S as K,Wn as q,cr as J,ft as Y,lt as ne,pr as X,rn as re,tt as ie,ur as ae}from"./CodeMirrorPropInput-Buv5WUqJ.js";import{t as oe}from"./info-CyR0W2SK.js";import{t as se}from"./refresh-cw-CC7UZEnZ.js";import{t as ce}from"./sparkles-BS2TX_Um.js";import{t as le}from"./triangle-alert-BXrUEeRU.js";import{t as ue}from"./wrench-DqFwoSdV.js";import{t as de}from"./badge-DmdA1C7r.js";import{l as fe}from"./use-settings-route-CikTq5Vq.js";import{l as pe,s as me}from"./doc-hash-BJkweiX9.js";import{t as he}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as ge,t as _e}from"./perf-DZJpLc5j.js";import{A as ve}from"./navigation-targets-DTSxcGor.js";import{T as ye,x as be}from"./config-provider-2W1hFFiT.js";import{J as xe,K as Se,Mt as Ce,Nt as we,X as Te,wt as Ee}from"./dist-D2SphF3p.js";import{n as De,r as Oe}from"./PageListContext-DgTeRFU-.js";import{a as ke,c as Ae,i as je,n as Me,r as Ne,s as Pe,t as Fe}from"./panel-My61A8fk.js";import{d as Ie,h as Le,u as Re,y as ze}from"./markdown-lint-BmjyI9ZU.js";import{t as Be}from"./skeleton-BPb29aFG.js";import{a as Ve,c as He,d as Ue}from"./lint-config-client-DhP_RDHH.js";var We=V(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Ge=56,Ke=2,qe=150,Je=2e3;function Ye(e,t,n){return e.top+e.height/2-(n+t)/2}function Xe(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Ze(e){let{docName:t,container:r,measureTarget:a,placement:o,intent:s,grade:c,landedMode:l,transition:u,onOutcome:f,onDiscardQueuedTarget:p,toolbarOffset:m=Ge,driftThresholdPx:h=Ke,quietMs:g=qe,abandonAfterMs:_=Je}=e,v=e.contentColumn??r.firstElementChild,y=d(t,`landing`),b=i(t,{yieldsToNavigation:s===`toggle`,supersede:()=>P(`superseded`)}),x=r.style.overflowAnchor;r.style.overflowAnchor=`none`,u&&ge(`ok/mode-switch/transition`,{from:u.from,to:u.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=a();return e===null?null:Xe(o===`center`?Ye(e,r.clientHeight,m):e.top-m,r)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(r.scrollTop-e)>h;return t&&(r.scrollTop=e),{measurable:!0,moved:t}},A=()=>r.scrollTop-(O()??C??r.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),r.removeEventListener(`wheel`,I),r.removeEventListener(`touchstart`,I),r.removeEventListener(`contentvisibilityautostatechange`,L,!0),r.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&n({docName:t,container:r,targetScrollTop:r.scrollTop,mode:l})}finally{j()}ge(`ok/landing/land`,{grade:c,delta:e}),f?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??r.scrollTop,t;try{t=A()}finally{j()}ge(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),f?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&p?.(),f?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),r.addEventListener(`contentvisibilityautostatechange`,L,!0),r.addEventListener(`wheel`,I,{passive:!0}),r.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Qe(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function $e(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map($e).join(``):``}function et(e,t){let{frontmatter:n,body:r}=R(e),i=n===``?0:n.split(`
|
|
2
2
|
`).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Qe(e.type),text:$e(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function tt(e,t){let{blocks:n,fmLineCount:r}=et(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function nt(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function rt(e){let t=0;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size!==0)break;t++}return t===e.childCount?0:e.childCount}function it(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function at(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
3
3
|
`&&t.push(n+1);return t}function ot(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function st(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function ct(e,t,n){return Math.max(t,Math.min(e,n))}function lt(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function ut(e,t){return t.inRange?t.tripwireOk?lt(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function dt(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:et(r,e).blocks,lineStarts:at(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=ct(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Qe(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=ct(t,0,e.length),s=nt(i,st(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=ot(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=rt(n)===i.length,c=i[ct(e.blockIndex,0,i.length-1)],l=ot(a,c.start,t.length),u=Math.min(ot(a,c.end+1,t.length),t.length),d=ut(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=ct(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=rt(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=ct(e.blockIndex,0,i-1),l=it(n,c,c+1);if(l===null)return null;let u=n.child(c),d=ut(e,{inRange:o,tripwireOk:s,kind:Qe(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var ft=Ce.define(),pt=Ce.define(),mt=Se.mark({class:r}),ht=we.define({create(){return Se.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(ft)?n=Se.set([mt.range(e.value.from,e.value.to)]):e.is(pt)&&(n=Se.none);return n},provide:e=>xe.decorations.from(e)}),gt=new WeakMap,_t=Te.define(e=>({destroy(){let t=gt.get(e);t!==void 0&&(clearTimeout(t),gt.delete(e))}}));function vt(e,t,n,r){let i=o(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:ft.of(i)});let a=gt.get(e);a!==void 0&&clearTimeout(a);let s=setTimeout(()=>{gt.delete(e),e.dispatch({effects:pt.of(null)})},ne);gt.set(e,s)}function yt(){return[ht,_t]}var bt=3e4;function xt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>bt?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var St=xt(),Ct=xt(),wt=St.remember,Tt=St.peek,Et=St.consume,Dt=St.clear;St.clearForTest;var Ot=Ct.remember,kt=Ct.peek,At=Ct.consume,jt=Ct.clear;Ct.clearForTest;function Mt(e,t,n){return{start:ye(e,t),end:ye(e,n)}}function Nt(e,t){let n=be(e.start,t),r=be(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var Pt=`open-knowledge:view-in-source`,Ft=null;function It(){return Ft??=dt(ie()),Ft}function Lt(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Rt(e){let{editor:t,docName:n,ytext:r}=e,i=J(t);if(!i)return;let a=i.state.selection.from,o=Lt(i.state.doc,a,r,It(),`jump`);o&&wt(n,o),window.dispatchEvent(new CustomEvent(Pt,{detail:{docName:n}}))}function zt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Bt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function Vt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function Ht(e,t){try{return e.coordsAtPos(t)}catch{return null}}function Ut(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=Ht(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Wt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Gt(e,t,n){if(e.isDestroyed)return null;let r=Wt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Kt(){return typeof document>`u`?null:l()}function qt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=K();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function Jt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=K();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Yt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Xt(r,i):t===`source`&&n===`wysiwyg`&&Zt(r,i)}function Xt(e,t){let n=Tt(e);if(n&&n.kind!==`selection-offset`)return;let r=a(e);if(!r)return;let i=J(r);if(!i)return;let o=Kt();if(!o)return;let s=qt(i,o);if(s===null)return;let c=Lt(i.state.doc,s,t,It());c&&wt(e,c)}function Zt(e,t){let n=q(e);if(!n)return;let r=Kt();if(!r)return;let i=Jt(n,r);if(i===null)return;let o=a(e),s=o?J(o)?.state.doc:void 0,c=zt(t.toString(),i,t,It(),s);c&&Ot(e,c)}function Qt(e){let{view:t,docName:n,navigation:r,ydoc:o,transition:s}=e,c=a(n),l=c?J(c)?.state.doc:void 0;if(!l)return null;let u=Vt(r,{source:t.state.doc.toString(),pmDoc:l,ydoc:o,resolver:It()});if(!u)return null;let d=Kt();if(!d)return null;let f=u,p=r.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:xe.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=i(n,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(Ht(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:Ee.cursor(m)}),t.focus())}finally{_.release()}g=Ze({docName:n,container:d,contentColumn:t.contentDOM,measureTarget:()=>Ut(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:s,toolbarOffset:K(),onOutcome:p?e=>{e.status===`landed`&&vt(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>Dt(n)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function $t(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=J(t);if(!o)return null;let s=Bt(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:It()});if(!s)return null;let c=Kt();if(!c)return null;let l=s;return Ze({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Gt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:K(),onDiscardQueuedTarget:()=>jt(n)})}var en={words:0,chars:0,tokens:0},tn=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,nn=/[\p{L}\p{N}]/u,rn=new Set([`text`,`inlineCode`,`code`,`tag`]),an=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),on=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function sn(e,t){if(!e)return;let n=e.type;if(!an.has(n)){if(rn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
4
4
|
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)sn(n,t);if(on.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
package/dist/public/assets/{use-activity-panel-BKll2Lbb.js → use-activity-panel-vwUB_0Q4.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-CorZvYgo.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{v as i}from"./documents-events-ckNvVQCr.js";import{n as a,t as o}from"./schemas-api-BbYGQuTW.js";import{n as s}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{ft as c}from"./CodeMirrorPropInput-Buv5WUqJ.js";import{n as l}from"./agent-presence-DJNS_1Pz.js";import{t as u}from"./lru-string-cache-BXtJBFf3.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new c(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=s.safeParse(r);throw e.success?Error(e.data.title):new c(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=o.safeParse(r);if(!i.success)throw new c(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,i=await fetch(r),o;try{o=await i.json()}catch(e){throw new c(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=s.safeParse(o);throw e.success?Error(e.data.title):new c(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let l=a.safeParse(o);if(!l.success)throw new c(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:i.status});let{diff:u,before:d,after:f,properties:p}=l.data;return{diff:u,before:d,after:f,properties:p}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;c(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);o({...n,writingDocs:i}),c(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),c(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,o(null),c(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=i(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);o(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==a||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==s?(N={data:a,status:s,error:l,reload:M,fetchBurstDiff:A},n[17]=a,n[18]=l,n[19]=A,n[20]=M,n[21]=s,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
|