@inkeep/open-knowledge 0.86.15 → 0.86.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/project/references/media-and-assets.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/config-schema.json +1 -1
- package/dist/config.project.schema.json +1 -1
- package/dist/constants-CqNABsZB.mjs +1 -0
- package/dist/{dist-fzYMjYEW.mjs → dist-BNPpubXf.mjs} +1 -1
- package/dist/{dist-CerHybyM.mjs → dist-CvZCvtXe.mjs} +4 -4
- package/dist/index.mjs +2 -2
- package/dist/init-C99xOULP.mjs +1 -0
- package/dist/{init-D_Mnfn9S.mjs → init-RmBoT2PK.mjs} +2 -2
- package/dist/{launch-json-removal-DF78Zb2V.mjs → launch-json-removal-CctovJFV.mjs} +1 -1
- package/dist/loader-BVSrV694.mjs +1 -0
- package/dist/{loader-EPi5ZErh.mjs → loader-CPblhk01.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-B6Vk34FK.mjs → md-manager-BGnqyqi1-DRBNLmLZ.mjs} +1 -1
- package/dist/{open-browser-BL65djdM.mjs → open-browser-DU_gU7KC.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-DkSS1KD_.mjs +1 -0
- package/dist/{preview-D9iu9mhV.mjs → preview-rK0HPHCM.mjs} +1 -1
- package/dist/public/assets/{AccountSection-BG0_TO2e.js → AccountSection-CQ3MoAiu.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-DX7qnelJ.js → ActivityModeContent-7yA_LDxD.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-ISpK9Zho.js → AddPropertiesButton-bukgzoDX.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BUMpUwLF.js → AgentDiffPane-stzSbdBy.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-CN5du-Ku.js → AttachmentsSection-8I8Nxe0M.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Bbv8fSFU.js → CodeMirrorPropInput-CezfVY4H.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-C9IeMwCS.js → ContentRulesSection-Ci2czTjF.js} +1 -1
- package/dist/public/assets/{DocumentContext-Di4xaMwl.js → DocumentContext-BB0nKfep.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-AVuI8ebZ.js → EditorModeToggle-DYuuX6dO.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-Ce86s-v8.js → ExcalidrawDocEditor-4yYSBe14.js} +1 -1
- package/dist/public/assets/FeedbackForm-Cfrx5H9R.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-YCivM6Y8.js → ImportSkillDialog-CbVOxKm9.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-DgK68AAA.js → LinkPreviewsSection-eJeiL-G6.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-CEnWskLc.js → LintConfigEditor-B08bIlPA.js} +1 -1
- package/dist/public/assets/{LintingSection-DfdRWFJl.js → LintingSection-CgdZ2qC8.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-GW5LIoca.js → ManagedArtifactProperties-CHNAj6L4.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-sRiQX_v3.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-pBnfScXw.js → MermaidDocEditor-BfwKbHcc.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-COAzJ4e0.js → NetworkAccessSection-B_pi2Qal.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DoYx80d4.js → PropertyDisplayRow-Ch2yOLBv.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-J-VGefwl.js → PublishToGitHubDialog-Buo-KPJx.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-BXEY5Lpc.js → SchemaConfigEditor-iDGqAzG4.js} +1 -1
- package/dist/public/assets/{SearchSection-DfIFmawW.js → SearchSection-C1RHTjy5.js} +1 -1
- package/dist/public/assets/{SessionsHost-DaPpTHog.js → SessionsHost-BQ-iaohc.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CYvW19u7.js → SettingsDialogBody-DoYZUwsg.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-Cw9ITE2h.js → ShareReceiveMissDialog-DzZbDaXI.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-CuTnMhoM.js → SkillToolbarControls-ChlOZJXQ.js} +1 -1
- package/dist/public/assets/{SourceEditor-DzijW0O3.js → SourceEditor-CofwPhEl.js} +1 -1
- package/dist/public/assets/{SpellingSettings-DH0T6Q-0.js → SpellingSettings-D6u6jJWL.js} +1 -1
- package/dist/public/assets/{SyncSection-D-yuvsEP.js → SyncSection-DLhKIpvC.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-DDXV7fc_.js → SyncStatusBadge-wVSPKrjz.js} +1 -1
- package/dist/public/assets/{TerminalSection-B35_ovK-.js → TerminalSection-xlIDaFSJ.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DVlYGRoh.js → TerminalWindowApp-CHxli66i.js} +1 -1
- package/dist/public/assets/{TextDocEditor-D9oE75zl.js → TextDocEditor-DBbmicjx.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-1CRBX5E8.js → ThemePluginSection-08z6uhJY.js} +1 -1
- package/dist/public/assets/{ThreadView-BQnQfd0I.js → ThreadView-DdYuP5Fq.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-Dri7SUVQ.js → TimelineDiffPane-BIGIL6Fc.js} +1 -1
- package/dist/public/assets/{client-version-BYVa8AIr.js → client-version-nR7-m4d2.js} +1 -1
- package/dist/public/assets/{comment-chips-EHSRiXz3.js → comment-chips-CwpaKWgF.js} +1 -1
- package/dist/public/assets/{config-provider-kLYQhPYp.js → config-provider-maC-s8nJ.js} +1 -1
- package/dist/public/assets/config-schema-BranunPO.js +1 -0
- package/dist/public/assets/{doc-undo-manager-HTjJCKce.js → doc-undo-manager-CMNnHa17.js} +1 -1
- package/dist/public/assets/{field-controls-e2mA3LBp.js → field-controls-7M8rxNa1.js} +1 -1
- package/dist/public/assets/field-controls-B4v3SIzn.js +1 -0
- package/dist/public/assets/{index-9UmK6oDx.js → index-1J1mB1rq.js} +8 -8
- package/dist/public/assets/{lint-config-client-Wa2rYzej.js → lint-config-client-BXxJgiMj.js} +1 -1
- package/dist/public/assets/{lint-plugins-B9OFl9DC.js → lint-plugins-IzY40E-g.js} +1 -1
- package/dist/public/assets/{markdown-lint-BgDulTY0.js → markdown-lint-CnxqlpxD.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-a9COyrB0.js → markdownlint-rule-browser-Ca0LiFxs.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DRuzqurs.js → pending-receive-nav-store-CtyTO1zl.js} +1 -1
- package/dist/public/assets/{preferred-session-events-Cwvz3DYB.js → preferred-session-events-BEFdeskN.js} +1 -1
- package/dist/public/assets/{progress-DJDyKmOT.js → progress-CjLBpKVA.js} +1 -1
- package/dist/public/assets/saved-themes-client-L2ZZOn0Z.js +1 -0
- package/dist/public/assets/{schema-section-D0TwA1wk.js → schema-section-BCQI08Fz.js} +1 -1
- package/dist/public/assets/{selection-context-BiltXMSS.js → selection-context-QohlVBby.js} +1 -1
- package/dist/public/assets/{src-CpVL1MXA.js → src-eD2YcFLO.js} +1 -1
- package/dist/public/assets/{telemetry-impl-tfAX1CTp.js → telemetry-impl-DbEbLICB.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Kz3A4OMo.js → telemetry-startup-Bklp1VJg.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DCLWi61a.js → typing-burst-detector-l0s7Bvng.js} +1 -1
- package/dist/public/assets/{use-activity-panel-Betx0VB5.js → use-activity-panel-MWNz0jP2.js} +1 -1
- package/dist/public/assets/{use-open-skill-Qib9eMlk.js → use-open-skill-w9Yc1dgu.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CVVMal6F.js → use-terminal-enabled-D4Z_JsJ9.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-C2kQsAEV.js → use-timeline-entry-diff-CgmegStH.js} +1 -1
- package/dist/public/index.html +21 -21
- package/dist/{registry-probes-xhAfEfyJ.mjs → registry-probes-CQJWD_N1.mjs} +1 -1
- package/dist/{removal-file-path-Cck6aRSq.mjs → removal-file-path-FZgRZJMq.mjs} +1 -1
- package/dist/{repair-launch-json-CwNpvI1_.mjs → repair-launch-json-YXWJ7404.mjs} +1 -1
- package/dist/{repair-mcp-configs-BJuIMxPX.mjs → repair-mcp-configs-qFDKov51.mjs} +1 -1
- package/dist/schemas/v0/config.project.schema.json +1 -1
- package/dist/{src-P3X9-4mK.mjs → src-B4Ppfouc.mjs} +1 -1
- package/dist/src-BgQTBEn_.mjs +1 -0
- package/dist/start-BBEHhUC8.mjs +1 -0
- package/dist/{start-W6HfLGEn.mjs → start-BOXkkd5Z.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-Big4uVC4.mjs +0 -1
- package/dist/init-DpWQMxOd.mjs +0 -1
- package/dist/loader-D5rR-ONY.mjs +0 -1
- package/dist/preview-ClW6A8dv.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BZSwiBHE.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CPP8NsrT.js +0 -1
- package/dist/public/assets/config-schema-B4_7xb9l.js +0 -1
- package/dist/public/assets/field-controls-B1UqOPPr.js +0 -1
- package/dist/public/assets/saved-themes-client-CdTWCmn6.js +0 -1
- package/dist/src-DkA3OkNb.mjs +0 -1
- package/dist/start-Bqg3TrSD.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./compiler-runtime-BfE3aGVn.js";import"./constants-upload-CVKO8P4d.js";import{S as r,a as i,d as a,f as o,g as s,i as c,p as l,t as u,u as d,v as f,x as p,y as m}from"./schemas-B93JY9Ef.js";import{c as h,l as g,u as _}from"./share-D-LUU2aX-B7Yg0G_m.js";import{n as v}from"./_envelope-q8XHEv4O-C-Qnl5Tu.js";import{A as y,F as b,M as x,N as S,Ot as C,P as w,bt as T,j as E,k as D,xt as O,yt as k}from"./schemas-api-CzN0ZSyO.js";import{t as ee}from"./constants-github-B7yhDvQc.js";import{g as te,h as A,m as j,v as ne}from"./use-apply-config-color-theme-Ddh-kKyn.js";import{u as re}from"./use-apply-config-language-DJ85uRhm.js";var ie=n(),M=e(t(),1),N=null,P=new Set;function ae(){return N}function oe(e){let t=e!==null&&e.length>0?e:null;if(t!==N){N=t;for(let e of P)try{e()}catch(e){console.warn(`[server-instance-store] subscriber threw:`,e)}}}function se(e){return P.add(e),()=>{P.delete(e)}}function ce(){return(0,M.useSyncExternalStore)(se,ae,ae)}var F=Symbol.for(`@inkeep/open-knowledge/field-registry`),I=globalThis;I[F]===void 0&&(I[F]=r());var L=I[F];function R(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=le(t)?L.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function le(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var ue=[`markdownlint`,`frontmatter`,`okf`],de=[`missing`,`invalid`];function fe(e){return e.frontmatterScope!==void 0}[...ue];var pe=[`off`,`warning`,`error`],z=`warning`,me=[`error`,`warning`];function B(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(C(e.getIn(r,!0))||e.deleteIn(r))}}function he(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){B(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}B(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function V(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var H={provider:u(ee).register(L,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Declares that this git host is a GitHub Enterprise Server instance, so OpenKnowledge treats its remotes the way it treats github.com (OpenKnowledge credential handling, the push-permission check, share links, and the default host for `ok auth`). 'github' is the only accepted value today. A host that is not declared here and is not github.com is treated as a generic git remote, so OpenKnowledge leaves the machine's own git credentials alone and does not check push permission. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. The declaration takes effect when OpenKnowledge next starts."})},ge=Object.fromEntries(Object.entries(H).map(([e,t])=>[e,t.optional().catch(void 0)])),_e=Object.fromEntries(Object.entries(H).map(([e,t])=>[e,t.nullish()])),ve=a(ge).catch({});s(f(),a(H).partial());var ye=a({git:a({hosts:s(f(),a(_e).nullish()).nullish()}).nullish()});function be(e){let t=ye.safeParse(e);return t.success?null:{code:`SCHEMA_INVALID`,issues:t.error.issues.map(V)}}var U=l({prefix:f().regex(/^[A-Za-z][A-Za-z0-9_-]*$/,{message:`prefix must start with a letter and use only letters, digits, _ and -`}),url:f().regex(/^https?:\/\/[^\s<>]*<num>[^\s<>]*$/,{message:`url must be an http or https URL containing <num>`})});c(U);var xe=U.nullable().catch(null);function Se(){return Object.fromEntries(k.map(e=>[e,f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${T[e]}, as a #rrggbb hex string.`}).optional()]))}function W(){return te.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var G=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),K=52428800,q=26214400,Ce=12582912,J=`https://api.openai.com/v1`,Y=`text-embedding-3-small`,X=96e3,Z=3e4,we=2048,Te=16384e3,Ee=6e5,De=Object.freeze([`127.0.0.1`]),Oe=/^[1-9]\d*(s|m|h)$/,ke=/^https?:\/\//,Ae=24550;function je(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Me(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&je(e)?null:`insecure-scheme`}function Ne(e){let t=e.trim();return t===``?`./`:t}function Pe(e){let t=Ne(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var Fe=a({content:a({dir:f().register(L,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:f().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets, and MCP write assets given a bare file name, are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Pe,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:a({theme:u([`light`,`dark`,`system`]).register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:u([`system`,...re]).register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${W()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(j,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${W()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(j,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(j,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:a({name:f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:f().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:u([`dark`,`light`]).register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Se()}).optional(),preview:a({autoOpen:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:a({showHiddenFiles:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:c(f()).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:c(f()).register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:a({wordWrap:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:a({autoApproveOkTools:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools for agents launched from the built-in terminal (plus `ok open` on Claude) and for in-app Agents-panel chats with any ACP agent. Destructive tools (delete/move/share/install/import) still prompt. Per-machine personal preference (user scope)."}).default(!0),browserTools:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Give in-app Claude Code and Codex chats a browser they can drive (Playwright MCP, started through npx from OpenKnowledge's own folder with a fresh in-memory profile), so an agent can open pages, click, and take screenshots. Every browser action asks for approval, with no option to always allow it, unless the agent's own mode or permission settings skip approvals. Needs Google Chrome and Node.js. Off by default; takes effect for chats started after the change. Per-machine personal preference (user scope).`}).default(!1)}).default({autoApproveOkTools:!0,browserTools:!1}),autoSync:a({mode:u(_).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:u(g).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:o().int().min(30).max(h).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:o().int().min(30).max(h).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:m([i(),u(_)]).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),git:a({hosts:s(f(),ve).register(L,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Per-git-host declarations, keyed by hostname (for example ghes.example.com). Each entry says how OpenKnowledge should treat remotes on that host; today the only key an entry carries is `provider`. Hosts absent from this map are treated as generic git remotes. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. Declarations take effect when OpenKnowledge next starts."}).default({}).catch({})}).default({hosts:{}}),terminal:a({enabled:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:f().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:a({enabled:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:a({localSink:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:a({maxBytes:o().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(K)}).default({maxBytes:K}),logs:a({maxBytes:o().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(q)}).default({maxBytes:q}),attributeDenylist:c(f()).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...G])}).default({enabled:!0,spans:{maxBytes:K},logs:{maxBytes:q},attributeDenylist:[...G]}),skillInstallReports:a({enabled:i().register(L,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default off; when it is on, the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables still turn it off.`}).default(!1)}).default({enabled:!1})}).default({localSink:{enabled:!0,spans:{maxBytes:K},logs:{maxBytes:q},attributeDenylist:[...G]},skillInstallReports:{enabled:!1}}),lossCapture:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:o().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ce)}).default({enabled:!0,maxBytes:Ce}),bridge:a({backgroundThrottle:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:a({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:a({semantic:a({enabled:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:f().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (stored in secrets.yml in the OpenKnowledge home folder); it is sent to whichever endpoint this names."}).default(J),model:f().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Y),dimensions:o().int().positive().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:o().min(0).max(1).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional(),maxBatchSize:o().int().min(1).max(we).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Maximum number of text chunks sent in one indexing request (1–2048, default 96). The ceiling follows OpenAI's input-array limit; other providers may impose different limits. Larger requests may still be split by the character budget. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(96).catch(96),maxBatchChars:o().int().min(1).max(Te).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Approximate cumulative character budget per indexing request (1–16384000, default 96000). A single chunk can exceed this budget. OpenAI separately caps total input at 300000 tokens per request; this character budget does not enforce that limit, and high values can produce rejected requests. Other providers have their own limits. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(X).catch(X),docTimeoutMs:o().int().min(1).max(Ee).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Timeout in milliseconds for each indexing request attempt (1–600000, default 30000). A request can retry four times, and a failed grouped request can trigger individual-document requests. There is no total indexing-pass deadline: large timeouts can delay newly queued work for hours. The query timeout remains 8 seconds per attempt. Changing it preserves cached vectors and applies to the next indexing pass; an in-progress pass keeps its current timeout. Invalid values use the default and are reported by ok config validate and server logs.`}).default(Z).catch(Z)}).default({enabled:!1,baseUrl:J,model:Y,maxBatchSize:96,maxBatchChars:X,docTimeoutMs:Z})}).default({semantic:{enabled:!1,baseUrl:J,model:Y,maxBatchSize:96,maxBatchChars:X,docTimeoutMs:Z}}),contentRules:a({markdownlint:l({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:l({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:c(l({appliesTo:m([f(),c(f())]).optional(),file:f(),enabled:i().optional()})).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:l({enabled:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:s(f(),i()).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:l({index:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:a({links:u(pe).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(z),fileTreeIndicators:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0),suppressLogLinkAdvisories:i().register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether unresolved links in the reserved change-history documents (lowercase-stemmed log.md / log.mdx at any depth, where the extension's case does not matter and the stem's does) are omitted from broken-link advisories: the Problems panel, file-tree indicators, source diagnostics, audits, and agent write/edit results. Default true. Raw link views still show them, and LOG.md, Log.md, and every other stem spelling are ordinary documents.`}).default(!0)}).default({links:z,fileTreeIndicators:!0,suppressLogLinkAdvisories:!0}),autolinks:c(xe).register(L,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Turn ticket references into links; today they apply to Agents-panel chat messages. Each entry pairs a `prefix` (for example `PRD-`) with a `url` template containing `<num>` (for example `https://linear.app/inkeep/issue/PRD-<num>`); the prefix followed by digits links to that URL with the digits in place of `<num>`. Matching is case-sensitive. An invalid entry is skipped with a warning and the others still apply. Shared with collaborators (project scope, `.ok/config.yml`)."}).default([]).catch([]),linkPreviews:a({enabled:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor, and a status card when you hover a GitHub pull request or issue link in an agent chat. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata, and hovering a GitHub reference asks the GitHub host's API for it, signed in as you when a GitHub sign-in is available — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:a({port:o().int().min(1).max(65535).register(L,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:c(f().min(1)).min(1).register(L,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...De]),externalUrl:p({protocol:/^https?$/}).regex(ke).register(L,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. A non-loopback server.bind without allowExternal: true is refused at boot with a one-line fix; a server.externalUrl without it boots (a committed externalUrl never arms exposure on clones — but it is project-scoped, so its host still joins the Host/Origin allowlists there), but requests carrying forwarding headers (X-Forwarded-For etc.) are refused until consent is given — proxy tolerance requires both keys. Default off. The server has no authentication of its own, so only consent behind an authenticating edge. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:i().register(L,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:m([d(`off`),f().regex(Oe)]).register(L,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...De],allowExternal:!1})});function Ie(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Le(e,t){let n=e;for(let e of t){n=Ie(n);let t=n?._zod?.def?.shape;if(!t){let e=n?._zod?.def;if(e?.type!==`record`)return;n=e.valueType;continue}if(n=t[String(e)],n===void 0)return}return n}function Re(e,t){let n=Le(e,t);if(n!==void 0)return R(n)}function Q(e){return{authoritative:e,themes:A,warnings:[],truncated:!1}}function ze(e){let{scheme:t}=e;return{id:e.id,label:t.name,kind:t.variant,scheme:t,toTokens:()=>O(t)}}function Be(e,t){return{id:e,label:t.name,kind:t.variant,scheme:t,toTokens:()=>O(t)}}function $(e,t,n={}){console.warn(JSON.stringify({event:`ok-saved-theme-request-failed`,action:e,result:t,...n.status===void 0?{}:{status:n.status},...n.error===void 0?{}:{errorName:n.error instanceof Error?n.error.name:`UnknownError`}}))}async function Ve(e={}){let t=e.request??globalThis.fetch;try{let n=await t(`/api/saved-themes`,{signal:e.signal});if(!n.ok)return $(`list`,`http-error`,{status:n.status}),Q(!1);let r=b.safeParse(await n.json());if(!r.success)return console.warn(`[themes] saved-themes response failed schema validation`,r.error.issues),Q(!1);let i=[],a=[];for(let e of r.data.themes)e.ok?i.push(ze(e)):a.push({filename:e.filename,id:e.id,code:e.code,...e.conflictingFilenames?{conflictingFilenames:e.conflictingFilenames}:{}});return{authoritative:!0,themes:i.length===0?A:[...A,...i],warnings:a,truncated:r.data.truncated}}catch(t){return e.signal?.aborted||$(`list`,`request-error`,{error:t}),Q(!1)}}function He(e){switch(e.detail){case`empty`:case`too-long`:case`invalid-chars`:return e.detail;default:return}}async function Ue(e,t={}){let n=y.safeParse(e);if(!n.success)return{ok:!1,reason:`unexpected`};let r=t.request??globalThis.fetch;try{let e=await r(`/api/saved-theme`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n.data)}),t=await e.json().catch(()=>null);if(e.ok){let e=E.safeParse(t);return e.success?{ok:!0,...e.data}:{ok:!1,reason:`unexpected`}}let i=v.safeParse(t);if(!i.success)return{ok:!1,reason:`unexpected`};if(i.data.type===`urn:ok:error:theme-name-taken`)return{ok:!1,reason:`name-taken`};if(i.data.type===`urn:ok:error:theme-name-invalid`){let e=He(i.data);return e?{ok:!1,reason:`name-invalid`,detail:e}:{ok:!1,reason:`name-invalid`}}return{ok:!1,reason:`unexpected`}}catch(e){return $(`save`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}async function We(e,t={}){let n=S.safeParse(e);if(!n.success)return{ok:!1,reason:`unexpected`};let r=t.request??globalThis.fetch;try{let e=await r(`/api/saved-theme`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n.data)}),t=await e.json().catch(()=>null);if(e.ok){let e=w.safeParse(t);return e.success?{ok:!0,...e.data}:{ok:!1,reason:`unexpected`}}let i=v.safeParse(t);return i.success&&i.data.type===`urn:ok:error:not-found`?{ok:!1,reason:`not-found`}:{ok:!1,reason:`unexpected`}}catch(e){return $(`update`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}async function Ge(e,t={}){if(!ne(e).ok)return{ok:!1,reason:`unexpected`};let n=t.request??globalThis.fetch;try{let t=await n(`/api/saved-theme?${new URLSearchParams({id:e})}`,{method:`DELETE`}),r=await t.json().catch(()=>null);if(!t.ok)return{ok:!1,reason:`unexpected`};let i=D.safeParse(r);if(!i.success)return{ok:!1,reason:`unexpected`};if(!i.data.existed)return{ok:!0,existed:!1};let a=x.safeParse(i.data.scheme);return a.success?{ok:!0,existed:!0,filename:i.data.filename,scheme:a.data}:{ok:!1,reason:`unexpected`}}catch(e){return $(`delete`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}var Ke=(0,M.createContext)(null);function qe(e){let t=(0,ie.c)(20),{children:n}=e,r=ce(),[i,a]=(0,M.useState)(Xe),[o,s]=(0,M.useState)(!1),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(`custom`),[f,p]=(0,M.useState)(!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={},t[0]=m):m=t[0];let h=(0,M.useRef)(m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={},t[1]=g):g=t[1];let[_,v]=(0,M.useState)(g),y=(0,M.useRef)(0),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=0,t=null,n=!1,r=null,i,o=[250,1e3,4e3],c=()=>{i!==void 0&&clearTimeout(i),i=void 0},u=()=>{if(t)return n=!0,t;let i=e,o=(async()=>{let t;do{n=!1;let o=y.current,u=new AbortController;r=u;let{authoritative:d,...f}=await Ve({signal:u.signal});if(i!==e)return!1;t=d,d?(c(),o===y.current&&a(f),s(!0),l(!1)):l(!0)}while(n);return t})().finally(()=>{t===o&&(t=null)});return t=o,o};return{refresh:u,startAutomaticRetry:()=>{e+=1;let a=e;r?.abort(),r=null,t=null,n=!1,c();let s=async t=>{let n=await u();a!==e||n||t>=o.length||(i=setTimeout(()=>void s(t+1),o[t]))};return s(0),()=>{a===e&&(e+=1,r?.abort(),r=null,t=null,n=!1,c())}}}},t[2]=b):b=t[2];let[x]=(0,M.useState)(b),S=x.refresh,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=new Map,t=(t,n)=>{let r=(e.get(t)??Promise.resolve()).then(n,n),i=r.then(Ye,Je);return e.set(t,i),i.finally(()=>{e.get(t)===i&&e.delete(t)}),r},n=(e,t,n)=>{y.current+=1;let r=Be(e,t);a(t=>({...t,themes:t.themes.some(t=>t.id===e)?t.themes.map(t=>t.id===e?r:t):[...t.themes,r],warnings:t.warnings.filter(t=>t.id!==e&&(n===void 0||t.filename!==n))}))};return{updateTheme:e=>t(e.id,async()=>{let t=await We(e);return t.ok&&n(e.id,e.scheme,t.filename),t}),deleteTheme:e=>t(e,async()=>{let t=await Ge(e);if(t.ok){let t={...h.current,[e]:(h.current[e]??0)+1};h.current=t,v(t),y.current+=1,a(t=>({...t,themes:t.themes.filter(t=>t.id!==e),warnings:t.warnings.filter(t=>t.id!==e)}))}return t}),restoreTheme:e=>t(e.id,async()=>{let t=await Ue({name:e.name,stem:e.stem,scheme:e.scheme,extension:e.extension});return t.ok&&n(t.id,e.scheme,t.filename),t})}},t[3]=C):C=t[3];let[w]=(0,M.useState)(C),T;t[4]===x?T=t[5]:(T=()=>x.startAutomaticRetry(),t[4]=x,t[5]=T);let E;t[6]!==x||t[7]!==r?(E=[x,r],t[6]=x,t[7]=r,t[8]=E):E=t[8],(0,M.useEffect)(T,E);let D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){if(e===null){p(!1);return}d(e),p(!0)},t[9]=D):D=t[9];let O=D,k;return t[10]!==n||t[11]!==i||t[12]!==u||t[13]!==c||t[14]!==o||t[15]!==w||t[16]!==S||t[17]!==f||t[18]!==_?(k=(0,M.createElement)(Ke,{value:{...i,loaded:o,loadError:c,refresh:S,...w,editingThemeId:u,themeIncarnations:_,themeEditorOpen:f,selectThemeToEdit:O}},n),t[10]=n,t[11]=i,t[12]=u,t[13]=c,t[14]=o,t[15]=w,t[16]=S,t[17]=f,t[18]=_,t[19]=k):k=t[19],k}function Je(){}function Ye(){}function Xe(){return Q(!1)}function Ze(){let e=(0,M.use)(Ke);if(!e)throw Error(`useSavedThemes must be used within <SavedThemesProvider />`);return e}export{R as C,fe as S,ce as T,V as _,Fe as a,de as b,X as c,Ee as d,Te as f,Ne as g,Me as h,Le as i,Y as l,he as m,Ze as n,J as o,we as p,Re as r,Z as s,qe as t,Ae as u,be as v,oe as w,me as x,z as y};
|
|
@@ -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{t as r}from"./compiler-runtime-BfE3aGVn.js";import{n as i}from"./dist-BGzUo_18.js";import{n as a}from"./config-errors-tVoeK4OC.js";import{a as o,r as s}from"./constants-cc1-Bt4QPTUe.js";import{t as c}from"./form-CPts7HJO.js";import{n as l}from"./config-validation-events-D2c9Wj4b.js";import{t as u}from"./SettingsSectionHeader-DBUjTOcT.js";import{a as d,i as f,o as p,r as m}from"./field-controls-
|
|
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{n as i}from"./dist-BGzUo_18.js";import{n as a}from"./config-errors-tVoeK4OC.js";import{a as o,r as s}from"./constants-cc1-Bt4QPTUe.js";import{t as c}from"./form-CPts7HJO.js";import{n as l}from"./config-validation-events-D2c9Wj4b.js";import{t as u}from"./SettingsSectionHeader-DBUjTOcT.js";import{a as d,i as f,o as p,r as m}from"./field-controls-7M8rxNa1.js";var h=r(),g=e(n(),1),_=t();function v(e){let t=(0,h.c)(16),{title:n,description:r,scope:u,binding:m,fields:v,scopeBadge:b,slotsAfter:x}=e,{form:S,commitField:C}=p(m),[w,T]=(0,g.useState)(null),E=(0,g.useRef)(null),D,O;t[0]!==S||t[1]!==u?(D=()=>{let e=u===`project`?s:o,t=l(t=>{if(t.docName!==e)return;i.error(a(t.error),{duration:8e3});let n=f(t.error);n&&(S.setError(n,{type:`config-validation-rejected`,message:d(t.error,n)}),S.setFocus(n),T(n),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{T(null),S.clearErrors(n)},600))});return()=>{t(),E.current&&clearTimeout(E.current)}},O=[u,S],t[0]=S,t[1]=u,t[2]=D,t[3]=O):(D=t[2],O=t[3]),(0,g.useEffect)(D,O);let k;t[4]!==C||t[5]!==r||t[6]!==v||t[7]!==w||t[8]!==u||t[9]!==b||t[10]!==x||t[11]!==n?(k=(0,_.jsx)(y,{title:n,description:r,scope:u,scopeBadge:b,fields:v,commitField:C,flashedPath:w,slotsAfter:x}),t[4]=C,t[5]=r,t[6]=v,t[7]=w,t[8]=u,t[9]=b,t[10]=x,t[11]=n,t[12]=k):k=t[12];let A;return t[13]!==S||t[14]!==k?(A=(0,_.jsx)(c,{...S,children:k}),t[13]=S,t[14]=k,t[15]=A):A=t[15],A}function y(e){let t=(0,h.c)(22),{title:n,description:r,scope:i,scopeBadge:a,fields:o,commitField:s,flashedPath:c,slotsAfter:l}=e,d=`settings-section-${i}-title`,f;t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==d?(f=(0,_.jsx)(u,{titleId:d,title:n,scope:a,children:r}),t[0]=r,t[1]=a,t[2]=n,t[3]=d,t[4]=f):f=t[4];let p;if(t[5]!==s||t[6]!==o||t[7]!==c||t[8]!==i||t[9]!==l){let e;t[11]!==s||t[12]!==c||t[13]!==i||t[14]!==l?(e=e=>{let t=e.path.join(`.`);return(0,_.jsxs)(g.Fragment,{children:[(0,_.jsx)(m,{field:e,scope:i,commitField:s,isFlashed:c===t}),l?.[t]??null]},t)},t[11]=s,t[12]=c,t[13]=i,t[14]=l,t[15]=e):e=t[15],p=o.map(e),t[5]=s,t[6]=o,t[7]=c,t[8]=i,t[9]=l,t[10]=p}else p=t[10];let v;t[16]===p?v=t[17]:(v=(0,_.jsx)(`div`,{className:`space-y-10`,children:p}),t[16]=p,t[17]=v);let y;return t[18]!==f||t[19]!==v||t[20]!==d?(y=(0,_.jsxs)(`section`,{"aria-labelledby":d,className:`space-y-3`,children:[f,v]}),t[18]=f,t[19]=v,t[20]=d,t[21]=y):y=t[21],y}export{v as BoundSchemaSection};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{gt as e}from"./DocumentContext-
|
|
1
|
+
import{gt as e}from"./DocumentContext-BB0nKfep.js";import{tt as t}from"./CodeMirrorPropInput-CezfVY4H.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-CezfVY4H.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-maC-s8nJ.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-QDYvYmIe.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-BYVa8AIr.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-QDYvYmIe.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.86.15`}?.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.86.15`};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};
|
|
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-nR7-m4d2.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-QDYvYmIe.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.86.16`}?.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.86.16`};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-YB3zPCjL.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-YB3zPCjL.js";import{getAppTracer as r}from"./telemetry-impl-DbEbLICB.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};
|
package/dist/public/assets/{typing-burst-detector-DCLWi61a.js → typing-burst-detector-l0s7Bvng.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Di as n,Fr as r,Kn as i,Xn as a,Z as o,en as s,i as c,kn as l,kr as u,pr as d,tn as f,tr as p,wi as m}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Di as n,Fr as r,Kn as i,Xn as a,Z as o,en as s,i as c,kn as l,kr as u,pr as d,tn as f,tr as p,wi as m}from"./DocumentContext-BB0nKfep.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 ee,v as F}from"./documents-events-ckNvVQCr.js";import{n as I}from"./_envelope-q8XHEv4O-C-Qnl5Tu.js";import{C as L,gt as R,pt as z}from"./schemas-api-CzN0ZSyO.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 te,t as ne}from"./lint-plugin-meta-CtDE2R0v.js";import{t as U}from"./circle-alert-eBm4JPxY.js";import{Kn as W,S as G,Wn as K,cr as q,ft as J,lt as Y,pr as X,rn as re,tt as ie,ur as ae}from"./CodeMirrorPropInput-CezfVY4H.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{c as fe}from"./use-settings-route-Bj-m9X61.js";import{l as pe,s as me}from"./doc-hash-BJkweiX9.js";import{t as he}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as ge,t as _e}from"./perf-CPPbaRwr.js";import{A as ve}from"./navigation-targets-CcY2FHJZ.js";import{T as ye,x as be}from"./config-provider-maC-s8nJ.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-B4oUr1KZ.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-BL97Zqcg.js";import{d as Ie,h as Le,u as Re,y as ze}from"./markdown-lint-CnxqlpxD.js";import{t as Be}from"./skeleton-Dk1iOPND.js";import{a as Ve,c as He,d as Ue}from"./lint-config-client-BXxJgiMj.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:n,measureTarget:r,placement:o,intent:s,grade:c,landedMode:l,transition:u,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:m=Ge,driftThresholdPx:h=Ke,quietMs:g=qe,abandonAfterMs:_=Je}=e,v=e.contentColumn??n.firstElementChild,y=i(t,`landing`),b=a(t,{yieldsToNavigation:s===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.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=r();return e===null?null:Xe(o===`center`?Ye(e,n.clientHeight,m):e.top-m,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,F),n.removeEventListener(`touchstart`,F),n.removeEventListener(`contentvisibilityautostatechange`,I,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&p({docName:t,container:n,targetScrollTop:n.scrollTop,mode:l})}finally{j()}ge(`ok/landing/land`,{grade:c,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}ge(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},ee=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function F(){P(`user-scroll`)}function I(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&ee()}try{k().measurable&&ee(),n.addEventListener(`contentvisibilityautostatechange`,I,!0),n.addEventListener(`wheel`,F,{passive:!0}),n.addEventListener(`touchstart`,F,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(I),D.observe(v)),E=requestAnimationFrame(I),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:s}),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=f(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 o=setTimeout(()=>{gt.delete(e),e.dispatch({effects:pt.of(null)})},Y);gt.set(e,o)}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=q(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=G();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=G();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=d(e);if(!r)return;let i=q(r);if(!i)return;let a=Kt();if(!a)return;let o=qt(i,a);if(o===null)return;let s=Lt(i.state.doc,o,t,It());s&&wt(e,s)}function Zt(e,t){let n=K(e);if(!n)return;let r=Kt();if(!r)return;let i=Jt(n,r);if(i===null)return;let a=d(e),o=a?q(a)?.state.doc:void 0,s=zt(t.toString(),i,t,It(),o);s&&Ot(e,s)}function Qt(e){let{view:t,docName:n,navigation:r,ydoc:i,transition:o}=e,s=d(n),c=s?q(s)?.state.doc:void 0;if(!c)return null;let l=Vt(r,{source:t.state.doc.toString(),pmDoc:c,ydoc:i,resolver:It()});if(!l)return null;let u=Kt();if(!u)return null;let f=l,p=r.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:xe.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=a(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:u,contentColumn:t.contentDOM,measureTarget:()=>Ut(t,u,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:G(),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=q(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:G(),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(`
|