@semiont/cli 0.5.4 → 0.5.5

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.
Files changed (75) hide show
  1. package/dist/cli.mjs +27 -12
  2. package/dist/frontend/dist/assets/{CookiePreferences-CMgprW9V.js → CookiePreferences-Vt05bBY7.js} +2 -2
  3. package/dist/frontend/dist/assets/{CookiePreferences-CMgprW9V.js.map → CookiePreferences-Vt05bBY7.js.map} +1 -1
  4. package/dist/frontend/dist/assets/{KeyboardShortcutsContext-BRLeqQUj.js → KeyboardShortcutsContext-CK7NFEft.js} +2 -2
  5. package/dist/frontend/dist/assets/{KeyboardShortcutsContext-BRLeqQUj.js.map → KeyboardShortcutsContext-CK7NFEft.js.map} +1 -1
  6. package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-CN3C3S55-DsCya3j0.js → PdfAnnotationCanvas.client-CN3C3S55-DZ2osbg-.js} +2 -2
  7. package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-CN3C3S55-DsCya3j0.js.map → PdfAnnotationCanvas.client-CN3C3S55-DZ2osbg-.js.map} +1 -1
  8. package/dist/frontend/dist/assets/{ToolbarPanels-CRGQDX-L.js → ToolbarPanels-wzZqAqCQ.js} +2 -2
  9. package/dist/frontend/dist/assets/{ToolbarPanels-CRGQDX-L.js.map → ToolbarPanels-wzZqAqCQ.js.map} +1 -1
  10. package/dist/frontend/dist/assets/{client-DvALJ3DL.js → client-C54EWgTc.js} +2 -2
  11. package/dist/frontend/dist/assets/{client-DvALJ3DL.js.map → client-C54EWgTc.js.map} +1 -1
  12. package/dist/frontend/dist/assets/{client-uEoQ8iJO.js → client-D5yyxFbt.js} +2 -2
  13. package/dist/frontend/dist/assets/{client-uEoQ8iJO.js.map → client-D5yyxFbt.js.map} +1 -1
  14. package/dist/frontend/dist/assets/{client-DkMJxPA7.js → client-DgzjF497.js} +2 -2
  15. package/dist/frontend/dist/assets/{client-DkMJxPA7.js.map → client-DgzjF497.js.map} +1 -1
  16. package/dist/frontend/dist/assets/{client-DxlEW_QJ.js → client-myF3ozNf.js} +2 -2
  17. package/dist/frontend/dist/assets/{client-DxlEW_QJ.js.map → client-myF3ozNf.js.map} +1 -1
  18. package/dist/frontend/dist/assets/{index-DjtRDlfn.js → index-DojEUBpq.js} +6 -6
  19. package/dist/frontend/dist/assets/index-DojEUBpq.js.map +1 -0
  20. package/dist/frontend/dist/assets/{layout-xDEqzpvE.js → layout-CpxxVgZl.js} +2 -2
  21. package/dist/frontend/dist/assets/{layout-xDEqzpvE.js.map → layout-CpxxVgZl.js.map} +1 -1
  22. package/dist/frontend/dist/assets/{layout-BhnmJA6O.js → layout-DGddEk2F.js} +2 -2
  23. package/dist/frontend/dist/assets/{layout-BhnmJA6O.js.map → layout-DGddEk2F.js.map} +1 -1
  24. package/dist/frontend/dist/assets/{layout-e6QyrD0Y.js → layout-WUjhuEFR.js} +2 -2
  25. package/dist/frontend/dist/assets/{layout-e6QyrD0Y.js.map → layout-WUjhuEFR.js.map} +1 -1
  26. package/dist/frontend/dist/assets/{layout-DolG9tOf.js → layout-osn4jTJF.js} +2 -2
  27. package/dist/frontend/dist/assets/{layout-DolG9tOf.js.map → layout-osn4jTJF.js.map} +1 -1
  28. package/dist/frontend/dist/assets/{not-found-4iuCkpA7.js → not-found-CXjr3aHk.js} +2 -2
  29. package/dist/frontend/dist/assets/{not-found-4iuCkpA7.js.map → not-found-CXjr3aHk.js.map} +1 -1
  30. package/dist/frontend/dist/assets/{page-DVCVvH_S.js → page-3_orURnj.js} +2 -2
  31. package/dist/frontend/dist/assets/{page-DVCVvH_S.js.map → page-3_orURnj.js.map} +1 -1
  32. package/dist/frontend/dist/assets/{page-CXhfUrZM.js → page-A0bP7R9_.js} +2 -2
  33. package/dist/frontend/dist/assets/{page-CXhfUrZM.js.map → page-A0bP7R9_.js.map} +1 -1
  34. package/dist/frontend/dist/assets/{page-BrSlkHj9.js → page-BXDwcCLI.js} +2 -2
  35. package/dist/frontend/dist/assets/{page-BrSlkHj9.js.map → page-BXDwcCLI.js.map} +1 -1
  36. package/dist/frontend/dist/assets/{page-D0bYoQZI.js → page-CR97hIaP.js} +2 -2
  37. package/dist/frontend/dist/assets/{page-D0bYoQZI.js.map → page-CR97hIaP.js.map} +1 -1
  38. package/dist/frontend/dist/assets/{page-C5gTlI4M.js → page-ClOO6d4L.js} +2 -2
  39. package/dist/frontend/dist/assets/{page-C5gTlI4M.js.map → page-ClOO6d4L.js.map} +1 -1
  40. package/dist/frontend/dist/assets/{page-8sXDEos5.js → page-CoU19X7P.js} +2 -2
  41. package/dist/frontend/dist/assets/{page-8sXDEos5.js.map → page-CoU19X7P.js.map} +1 -1
  42. package/dist/frontend/dist/assets/{page-CXVPWK3i.js → page-Crea7MLa.js} +2 -2
  43. package/dist/frontend/dist/assets/{page-CXVPWK3i.js.map → page-Crea7MLa.js.map} +1 -1
  44. package/dist/frontend/dist/assets/{page-7cCGgkUd.js → page-D3vt40lt.js} +2 -2
  45. package/dist/frontend/dist/assets/{page-7cCGgkUd.js.map → page-D3vt40lt.js.map} +1 -1
  46. package/dist/frontend/dist/assets/{page-6YupxiP8.js → page-D74-p81B.js} +2 -2
  47. package/dist/frontend/dist/assets/{page-6YupxiP8.js.map → page-D74-p81B.js.map} +1 -1
  48. package/dist/frontend/dist/assets/{page-CkHE2rPM.js → page-D9VjQ4Ci.js} +2 -2
  49. package/dist/frontend/dist/assets/{page-CkHE2rPM.js.map → page-D9VjQ4Ci.js.map} +1 -1
  50. package/dist/frontend/dist/assets/{page-BioSV21A.js → page-DAaiG0_S.js} +2 -2
  51. package/dist/frontend/dist/assets/{page-BioSV21A.js.map → page-DAaiG0_S.js.map} +1 -1
  52. package/dist/frontend/dist/assets/{page-BOhOKDMk.js → page-DGGXDS8h.js} +2 -2
  53. package/dist/frontend/dist/assets/{page-BOhOKDMk.js.map → page-DGGXDS8h.js.map} +1 -1
  54. package/dist/frontend/dist/assets/{page-A6_MoyUb2.js → page-DWTT4pP82.js} +2 -2
  55. package/dist/frontend/dist/assets/{page-A6_MoyUb2.js.map → page-DWTT4pP82.js.map} +1 -1
  56. package/dist/frontend/dist/assets/{page-D1veR3Kp.js → page-Db8QDovL.js} +2 -2
  57. package/dist/frontend/dist/assets/{page-D1veR3Kp.js.map → page-Db8QDovL.js.map} +1 -1
  58. package/dist/frontend/dist/assets/{page-DbwiMF1N.js → page-V3GB89Xa.js} +2 -2
  59. package/dist/frontend/dist/assets/{page-DbwiMF1N.js.map → page-V3GB89Xa.js.map} +1 -1
  60. package/dist/frontend/dist/assets/{page-Bl8sZu8k.js → page-pid5J2JR.js} +2 -2
  61. package/dist/frontend/dist/assets/{page-Bl8sZu8k.js.map → page-pid5J2JR.js.map} +1 -1
  62. package/dist/frontend/dist/assets/{page-D6oe9LkY.js → page-vxSCIznX.js} +2 -2
  63. package/dist/frontend/dist/assets/{page-D6oe9LkY.js.map → page-vxSCIznX.js.map} +1 -1
  64. package/dist/frontend/dist/assets/{page-B9EYfbrY.js → page-yaV9evoV.js} +2 -2
  65. package/dist/frontend/dist/assets/{page-B9EYfbrY.js.map → page-yaV9evoV.js.map} +1 -1
  66. package/dist/frontend/dist/assets/{routing-DW1ehi64.js → routing-CcetIVef.js} +2 -2
  67. package/dist/frontend/dist/assets/{routing-DW1ehi64.js.map → routing-CcetIVef.js.map} +1 -1
  68. package/dist/frontend/dist/assets/{routing-Bcj1FhkC.js → routing-Dqgz2rV4.js} +2 -2
  69. package/dist/frontend/dist/assets/{routing-Bcj1FhkC.js.map → routing-Dqgz2rV4.js.map} +1 -1
  70. package/dist/frontend/dist/assets/{web-Dr6mdA1A.js → web-DAgGdiC_.js} +2 -2
  71. package/dist/frontend/dist/assets/{web-Dr6mdA1A.js.map → web-DAgGdiC_.js.map} +1 -1
  72. package/dist/frontend/dist/index.html +1 -1
  73. package/dist/frontend/package.json +1 -1
  74. package/package.json +8 -8
  75. package/dist/frontend/dist/assets/index-DjtRDlfn.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{N as i,U as a,Z as o,h as s,ot as c,st as l,tt as u}from"./index-DjtRDlfn.js";import{i as d,t as f}from"./routing-Bcj1FhkC.js";var p=e(t()),m=r();function h(){let{t:e}=n(),t=(t,n)=>e(`AuthWelcome.${t}`,n),r=c(),h=o(r.activeKbId$),g=o(r.activeSession$),_=o(g?.user$)??null,v=g?.kb??null,y=!!_,b=h!=null&&g==null,x=e=>{r.signOut(e)},S=d(),[C,w]=(0,p.useState)(!1),T=l(),E=g?.client,D=u(()=>a(E)),O=o(D.userData$),k=o(D.isProcessing$)??!1;(0,p.useEffect)(()=>{if(!b){if(!y){S.push(`/auth/connect`);return}if(O?.termsAcceptedAt){S.push(`/`);return}}},[b,y,S,O]);let A=async e=>{if(!e){v&&x(v.id),S.push(`/`);return}try{await D.acceptTerms(),w(!0),setTimeout(()=>{S.push(`/`)},1e3)}catch(e){console.error(`Terms acceptance error:`,e),T.showError(t(`errorAcceptingTerms`))}},j=b?`loading`:C?`accepted`:`form`,M=_?.name?.split(` `)[0]??``;return(0,m.jsx)(i,{userName:M,termsAcceptedAt:O?.termsAcceptedAt??null,isNewUser:!O?.termsAcceptedAt,status:j,isProcessing:k,onAccept:()=>A(!0),onDecline:()=>A(!1),translations:{loading:t(`loading`),welcomeTitle:t(`welcomeTitle`),thanksForAccepting:t(`thanksForAccepting`),welcomeUser:t(`welcomeUser`,{firstName:M}),reviewTermsPrompt:t(`reviewTermsPrompt`),termsSummaryTitle:t(`termsSummaryTitle`),termsSummaryIntro:t(`termsSummaryIntro`),acceptableUseTitle:t(`acceptableUseTitle`),acceptableUseResponsible:t(`acceptableUseResponsible`),acceptableUseRespect:t(`acceptableUseRespect`),acceptableUseConduct:t(`acceptableUseConduct`),prohibitedContentTitle:t(`prohibitedContentTitle`),prohibitedContentIntro:t(`prohibitedContentIntro`),prohibitedIllegal:t(`prohibitedIllegal`),prohibitedAdult:t(`prohibitedAdult`),prohibitedHate:t(`prohibitedHate`),prohibitedViolence:t(`prohibitedViolence`),prohibitedMisinformation:t(`prohibitedMisinformation`),prohibitedPrivacy:t(`prohibitedPrivacy`),prohibitedCopyright:t(`prohibitedCopyright`),prohibitedMalware:t(`prohibitedMalware`),prohibitedSpam:t(`prohibitedSpam`),conductTitle:t(`conductTitle`),conductDescription:t(`conductDescription`),conductLink:t(`conductLink`),conductPromotion:t(`conductPromotion`),responsibilitiesTitle:t(`responsibilitiesTitle`),responsibilitiesSecure:t(`responsibilitiesSecure`),responsibilitiesReport:t(`responsibilitiesReport`),responsibilitiesAccurate:t(`responsibilitiesAccurate`),responsibilitiesComply:t(`responsibilitiesComply`),violationsWarning:t(`violationsWarning`),readFullTerms:t(`readFullTerms`),termsOfService:t(`termsOfService`),and:t(`and`),privacyPolicy:t(`privacyPolicy`),declineAndSignOut:t(`declineAndSignOut`),acceptAndContinue:t(`acceptAndContinue`),processing:t(`processing`),legallyBound:t(`legallyBound`)},PageLayout:s,Link:f})}export{h as default};
2
- //# sourceMappingURL=page-Bl8sZu8k.js.map
1
+ import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{N as i,U as a,Z as o,h as s,ot as c,st as l,tt as u}from"./index-DojEUBpq.js";import{i as d,t as f}from"./routing-Dqgz2rV4.js";var p=e(t()),m=r();function h(){let{t:e}=n(),t=(t,n)=>e(`AuthWelcome.${t}`,n),r=c(),h=o(r.activeKbId$),g=o(r.activeSession$),_=o(g?.user$)??null,v=g?.kb??null,y=!!_,b=h!=null&&g==null,x=e=>{r.signOut(e)},S=d(),[C,w]=(0,p.useState)(!1),T=l(),E=g?.client,D=u(()=>a(E)),O=o(D.userData$),k=o(D.isProcessing$)??!1;(0,p.useEffect)(()=>{if(!b){if(!y){S.push(`/auth/connect`);return}if(O?.termsAcceptedAt){S.push(`/`);return}}},[b,y,S,O]);let A=async e=>{if(!e){v&&x(v.id),S.push(`/`);return}try{await D.acceptTerms(),w(!0),setTimeout(()=>{S.push(`/`)},1e3)}catch(e){console.error(`Terms acceptance error:`,e),T.showError(t(`errorAcceptingTerms`))}},j=b?`loading`:C?`accepted`:`form`,M=_?.name?.split(` `)[0]??``;return(0,m.jsx)(i,{userName:M,termsAcceptedAt:O?.termsAcceptedAt??null,isNewUser:!O?.termsAcceptedAt,status:j,isProcessing:k,onAccept:()=>A(!0),onDecline:()=>A(!1),translations:{loading:t(`loading`),welcomeTitle:t(`welcomeTitle`),thanksForAccepting:t(`thanksForAccepting`),welcomeUser:t(`welcomeUser`,{firstName:M}),reviewTermsPrompt:t(`reviewTermsPrompt`),termsSummaryTitle:t(`termsSummaryTitle`),termsSummaryIntro:t(`termsSummaryIntro`),acceptableUseTitle:t(`acceptableUseTitle`),acceptableUseResponsible:t(`acceptableUseResponsible`),acceptableUseRespect:t(`acceptableUseRespect`),acceptableUseConduct:t(`acceptableUseConduct`),prohibitedContentTitle:t(`prohibitedContentTitle`),prohibitedContentIntro:t(`prohibitedContentIntro`),prohibitedIllegal:t(`prohibitedIllegal`),prohibitedAdult:t(`prohibitedAdult`),prohibitedHate:t(`prohibitedHate`),prohibitedViolence:t(`prohibitedViolence`),prohibitedMisinformation:t(`prohibitedMisinformation`),prohibitedPrivacy:t(`prohibitedPrivacy`),prohibitedCopyright:t(`prohibitedCopyright`),prohibitedMalware:t(`prohibitedMalware`),prohibitedSpam:t(`prohibitedSpam`),conductTitle:t(`conductTitle`),conductDescription:t(`conductDescription`),conductLink:t(`conductLink`),conductPromotion:t(`conductPromotion`),responsibilitiesTitle:t(`responsibilitiesTitle`),responsibilitiesSecure:t(`responsibilitiesSecure`),responsibilitiesReport:t(`responsibilitiesReport`),responsibilitiesAccurate:t(`responsibilitiesAccurate`),responsibilitiesComply:t(`responsibilitiesComply`),violationsWarning:t(`violationsWarning`),readFullTerms:t(`readFullTerms`),termsOfService:t(`termsOfService`),and:t(`and`),privacyPolicy:t(`privacyPolicy`),declineAndSignOut:t(`declineAndSignOut`),acceptAndContinue:t(`acceptAndContinue`),processing:t(`processing`),legallyBound:t(`legallyBound`)},PageLayout:s,Link:f})}export{h as default};
2
+ //# sourceMappingURL=page-pid5J2JR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-Bl8sZu8k.js","names":[],"sources":["../../src/app/[locale]/auth/welcome/page.tsx"],"sourcesContent":["/**\n * Welcome Page - Thin Next.js wrapper\n *\n * This page handles Next.js-specific concerns (routing, auth, API calls)\n * and delegates rendering to the pure React WelcomePage component.\n */\n\nimport React, { useState, useEffect } from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { useTranslation } from 'react-i18next';\nimport { Link } from '@/i18n/routing';\nimport { PageLayout, useToast, useSemiont, useObservable } from '@semiont/react-ui';\nimport { WelcomePage } from '@semiont/react-ui';\nimport { createWelcomeStateUnit } from '@semiont/react-ui';\nimport { useStateUnit } from '@semiont/react-ui';\n\nexport default function Welcome() {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`AuthWelcome.${k}`, p as any) as string;\n const semiont = useSemiont();\n const activeKbId = useObservable(semiont.activeKbId$);\n const session = useObservable(semiont.activeSession$);\n const user = useObservable(session?.user$) ?? null;\n const activeKnowledgeBase = session?.kb ?? null;\n const isAuthenticated = !!user;\n // \"Loading\" = KB is selected but session not yet constructed.\n const isLoading = activeKbId != null && session == null;\n const signOut = (id: string) => { void semiont.signOut(id); };\n const router = useRouter();\n const [termsAccepted, setTermsAccepted] = useState(false);\n const toast = useToast();\n\n const client = session?.client;\n const stateUnit = useStateUnit(() => createWelcomeStateUnit(client!));\n\n const userData = useObservable(stateUnit.userData$);\n const isProcessing = useObservable(stateUnit.isProcessing$) ?? false;\n\n // Redirect if not authenticated or if terms already accepted\n useEffect(() => {\n if (isLoading) return;\n if (!isAuthenticated) {\n router.push('/auth/connect');\n return;\n }\n\n if (userData?.termsAcceptedAt) {\n router.push('/');\n return;\n }\n }, [isLoading, isAuthenticated, router, userData]);\n\n const handleTermsAcceptance = async (accepted: boolean) => {\n if (!accepted) {\n if (activeKnowledgeBase) {\n signOut(activeKnowledgeBase.id);\n }\n router.push('/');\n return;\n }\n\n try {\n await stateUnit.acceptTerms();\n setTermsAccepted(true);\n\n setTimeout(() => {\n router.push('/');\n }, 1000);\n } catch (error) {\n console.error('Terms acceptance error:', error);\n toast.showError(t('errorAcceptingTerms'));\n }\n };\n\n const pageStatus = isLoading ? 'loading' : termsAccepted ? 'accepted' : 'form';\n const firstName = user?.name?.split(' ')[0] ?? '';\n\n return (\n <WelcomePage\n userName={firstName}\n termsAcceptedAt={userData?.termsAcceptedAt ?? null}\n isNewUser={!userData?.termsAcceptedAt}\n status={pageStatus}\n isProcessing={isProcessing}\n onAccept={() => handleTermsAcceptance(true)}\n onDecline={() => handleTermsAcceptance(false)}\n translations={{\n loading: t('loading'),\n welcomeTitle: t('welcomeTitle'),\n thanksForAccepting: t('thanksForAccepting'),\n welcomeUser: t('welcomeUser', { firstName }),\n reviewTermsPrompt: t('reviewTermsPrompt'),\n termsSummaryTitle: t('termsSummaryTitle'),\n termsSummaryIntro: t('termsSummaryIntro'),\n acceptableUseTitle: t('acceptableUseTitle'),\n acceptableUseResponsible: t('acceptableUseResponsible'),\n acceptableUseRespect: t('acceptableUseRespect'),\n acceptableUseConduct: t('acceptableUseConduct'),\n prohibitedContentTitle: t('prohibitedContentTitle'),\n prohibitedContentIntro: t('prohibitedContentIntro'),\n prohibitedIllegal: t('prohibitedIllegal'),\n prohibitedAdult: t('prohibitedAdult'),\n prohibitedHate: t('prohibitedHate'),\n prohibitedViolence: t('prohibitedViolence'),\n prohibitedMisinformation: t('prohibitedMisinformation'),\n prohibitedPrivacy: t('prohibitedPrivacy'),\n prohibitedCopyright: t('prohibitedCopyright'),\n prohibitedMalware: t('prohibitedMalware'),\n prohibitedSpam: t('prohibitedSpam'),\n conductTitle: t('conductTitle'),\n conductDescription: t('conductDescription'),\n conductLink: t('conductLink'),\n conductPromotion: t('conductPromotion'),\n responsibilitiesTitle: t('responsibilitiesTitle'),\n responsibilitiesSecure: t('responsibilitiesSecure'),\n responsibilitiesReport: t('responsibilitiesReport'),\n responsibilitiesAccurate: t('responsibilitiesAccurate'),\n responsibilitiesComply: t('responsibilitiesComply'),\n violationsWarning: t('violationsWarning'),\n readFullTerms: t('readFullTerms'),\n termsOfService: t('termsOfService'),\n and: t('and'),\n privacyPolicy: t('privacyPolicy'),\n declineAndSignOut: t('declineAndSignOut'),\n acceptAndContinue: t('acceptAndContinue'),\n processing: t('processing'),\n legallyBound: t('legallyBound'),\n }}\n PageLayout={PageLayout}\n Link={Link}\n />\n );\n}\n"],"mappings":"8RAgBA,SAAwB,GAAU,CAChC,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,GAAK,EAAW,IAAgC,EAAG,eAAe,IAAK,EAAS,CAChF,EAAU,GAAY,CACtB,EAAa,EAAc,EAAQ,YAAY,CAC/C,EAAU,EAAc,EAAQ,eAAe,CAC/C,EAAO,EAAc,GAAS,MAAM,EAAI,KACxC,EAAsB,GAAS,IAAM,KACrC,EAAkB,CAAC,CAAC,EAEpB,EAAY,GAAc,MAAQ,GAAW,KAC7C,EAAW,GAAe,CAAO,EAAQ,QAAQ,EAAG,EACpD,EAAS,GAAW,CACpB,CAAC,EAAe,IAAA,EAAA,EAAA,UAA6B,GAAM,CACnD,EAAQ,GAAU,CAElB,EAAS,GAAS,OAClB,EAAY,MAAmB,EAAuB,EAAQ,CAAC,CAE/D,EAAW,EAAc,EAAU,UAAU,CAC7C,EAAe,EAAc,EAAU,cAAc,EAAI,IAG/D,EAAA,EAAA,eAAgB,CACV,MACJ,IAAI,CAAC,EAAiB,CACpB,EAAO,KAAK,gBAAgB,CAC5B,OAGF,GAAI,GAAU,gBAAiB,CAC7B,EAAO,KAAK,IAAI,CAChB,UAED,CAAC,EAAW,EAAiB,EAAQ,EAAS,CAAC,CAElD,IAAM,EAAwB,KAAO,IAAsB,CACzD,GAAI,CAAC,EAAU,CACT,GACF,EAAQ,EAAoB,GAAG,CAEjC,EAAO,KAAK,IAAI,CAChB,OAGF,GAAI,CACF,MAAM,EAAU,aAAa,CAC7B,EAAiB,GAAK,CAEtB,eAAiB,CACf,EAAO,KAAK,IAAI,EACf,IAAK,OACD,EAAO,CACd,QAAQ,MAAM,0BAA2B,EAAM,CAC/C,EAAM,UAAU,EAAE,sBAAsB,CAAC,GAIvC,EAAa,EAAY,UAAY,EAAgB,WAAa,OAClE,EAAY,GAAM,MAAM,MAAM,IAAI,CAAC,IAAM,GAE/C,OACE,EAAA,EAAA,KAAC,EAAD,CACE,SAAU,EACV,gBAAiB,GAAU,iBAAmB,KAC9C,UAAW,CAAC,GAAU,gBACtB,OAAQ,EACM,eACd,aAAgB,EAAsB,GAAK,CAC3C,cAAiB,EAAsB,GAAM,CAC7C,aAAc,CACZ,QAAS,EAAE,UAAU,CACrB,aAAc,EAAE,eAAe,CAC/B,mBAAoB,EAAE,qBAAqB,CAC3C,YAAa,EAAE,cAAe,CAAE,YAAW,CAAC,CAC5C,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,mBAAoB,EAAE,qBAAqB,CAC3C,yBAA0B,EAAE,2BAA2B,CACvD,qBAAsB,EAAE,uBAAuB,CAC/C,qBAAsB,EAAE,uBAAuB,CAC/C,uBAAwB,EAAE,yBAAyB,CACnD,uBAAwB,EAAE,yBAAyB,CACnD,kBAAmB,EAAE,oBAAoB,CACzC,gBAAiB,EAAE,kBAAkB,CACrC,eAAgB,EAAE,iBAAiB,CACnC,mBAAoB,EAAE,qBAAqB,CAC3C,yBAA0B,EAAE,2BAA2B,CACvD,kBAAmB,EAAE,oBAAoB,CACzC,oBAAqB,EAAE,sBAAsB,CAC7C,kBAAmB,EAAE,oBAAoB,CACzC,eAAgB,EAAE,iBAAiB,CACnC,aAAc,EAAE,eAAe,CAC/B,mBAAoB,EAAE,qBAAqB,CAC3C,YAAa,EAAE,cAAc,CAC7B,iBAAkB,EAAE,mBAAmB,CACvC,sBAAuB,EAAE,wBAAwB,CACjD,uBAAwB,EAAE,yBAAyB,CACnD,uBAAwB,EAAE,yBAAyB,CACnD,yBAA0B,EAAE,2BAA2B,CACvD,uBAAwB,EAAE,yBAAyB,CACnD,kBAAmB,EAAE,oBAAoB,CACzC,cAAe,EAAE,gBAAgB,CACjC,eAAgB,EAAE,iBAAiB,CACnC,IAAK,EAAE,MAAM,CACb,cAAe,EAAE,gBAAgB,CACjC,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,WAAY,EAAE,aAAa,CAC3B,aAAc,EAAE,eAAe,CAChC,CACW,aACN,OACN,CAAA"}
1
+ {"version":3,"file":"page-pid5J2JR.js","names":[],"sources":["../../src/app/[locale]/auth/welcome/page.tsx"],"sourcesContent":["/**\n * Welcome Page - Thin Next.js wrapper\n *\n * This page handles Next.js-specific concerns (routing, auth, API calls)\n * and delegates rendering to the pure React WelcomePage component.\n */\n\nimport React, { useState, useEffect } from 'react';\nimport { useRouter } from '@/i18n/routing';\nimport { useTranslation } from 'react-i18next';\nimport { Link } from '@/i18n/routing';\nimport { PageLayout, useToast, useSemiont, useObservable } from '@semiont/react-ui';\nimport { WelcomePage } from '@semiont/react-ui';\nimport { createWelcomeStateUnit } from '@semiont/react-ui';\nimport { useStateUnit } from '@semiont/react-ui';\n\nexport default function Welcome() {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`AuthWelcome.${k}`, p as any) as string;\n const semiont = useSemiont();\n const activeKbId = useObservable(semiont.activeKbId$);\n const session = useObservable(semiont.activeSession$);\n const user = useObservable(session?.user$) ?? null;\n const activeKnowledgeBase = session?.kb ?? null;\n const isAuthenticated = !!user;\n // \"Loading\" = KB is selected but session not yet constructed.\n const isLoading = activeKbId != null && session == null;\n const signOut = (id: string) => { void semiont.signOut(id); };\n const router = useRouter();\n const [termsAccepted, setTermsAccepted] = useState(false);\n const toast = useToast();\n\n const client = session?.client;\n const stateUnit = useStateUnit(() => createWelcomeStateUnit(client!));\n\n const userData = useObservable(stateUnit.userData$);\n const isProcessing = useObservable(stateUnit.isProcessing$) ?? false;\n\n // Redirect if not authenticated or if terms already accepted\n useEffect(() => {\n if (isLoading) return;\n if (!isAuthenticated) {\n router.push('/auth/connect');\n return;\n }\n\n if (userData?.termsAcceptedAt) {\n router.push('/');\n return;\n }\n }, [isLoading, isAuthenticated, router, userData]);\n\n const handleTermsAcceptance = async (accepted: boolean) => {\n if (!accepted) {\n if (activeKnowledgeBase) {\n signOut(activeKnowledgeBase.id);\n }\n router.push('/');\n return;\n }\n\n try {\n await stateUnit.acceptTerms();\n setTermsAccepted(true);\n\n setTimeout(() => {\n router.push('/');\n }, 1000);\n } catch (error) {\n console.error('Terms acceptance error:', error);\n toast.showError(t('errorAcceptingTerms'));\n }\n };\n\n const pageStatus = isLoading ? 'loading' : termsAccepted ? 'accepted' : 'form';\n const firstName = user?.name?.split(' ')[0] ?? '';\n\n return (\n <WelcomePage\n userName={firstName}\n termsAcceptedAt={userData?.termsAcceptedAt ?? null}\n isNewUser={!userData?.termsAcceptedAt}\n status={pageStatus}\n isProcessing={isProcessing}\n onAccept={() => handleTermsAcceptance(true)}\n onDecline={() => handleTermsAcceptance(false)}\n translations={{\n loading: t('loading'),\n welcomeTitle: t('welcomeTitle'),\n thanksForAccepting: t('thanksForAccepting'),\n welcomeUser: t('welcomeUser', { firstName }),\n reviewTermsPrompt: t('reviewTermsPrompt'),\n termsSummaryTitle: t('termsSummaryTitle'),\n termsSummaryIntro: t('termsSummaryIntro'),\n acceptableUseTitle: t('acceptableUseTitle'),\n acceptableUseResponsible: t('acceptableUseResponsible'),\n acceptableUseRespect: t('acceptableUseRespect'),\n acceptableUseConduct: t('acceptableUseConduct'),\n prohibitedContentTitle: t('prohibitedContentTitle'),\n prohibitedContentIntro: t('prohibitedContentIntro'),\n prohibitedIllegal: t('prohibitedIllegal'),\n prohibitedAdult: t('prohibitedAdult'),\n prohibitedHate: t('prohibitedHate'),\n prohibitedViolence: t('prohibitedViolence'),\n prohibitedMisinformation: t('prohibitedMisinformation'),\n prohibitedPrivacy: t('prohibitedPrivacy'),\n prohibitedCopyright: t('prohibitedCopyright'),\n prohibitedMalware: t('prohibitedMalware'),\n prohibitedSpam: t('prohibitedSpam'),\n conductTitle: t('conductTitle'),\n conductDescription: t('conductDescription'),\n conductLink: t('conductLink'),\n conductPromotion: t('conductPromotion'),\n responsibilitiesTitle: t('responsibilitiesTitle'),\n responsibilitiesSecure: t('responsibilitiesSecure'),\n responsibilitiesReport: t('responsibilitiesReport'),\n responsibilitiesAccurate: t('responsibilitiesAccurate'),\n responsibilitiesComply: t('responsibilitiesComply'),\n violationsWarning: t('violationsWarning'),\n readFullTerms: t('readFullTerms'),\n termsOfService: t('termsOfService'),\n and: t('and'),\n privacyPolicy: t('privacyPolicy'),\n declineAndSignOut: t('declineAndSignOut'),\n acceptAndContinue: t('acceptAndContinue'),\n processing: t('processing'),\n legallyBound: t('legallyBound'),\n }}\n PageLayout={PageLayout}\n Link={Link}\n />\n );\n}\n"],"mappings":"8RAgBA,SAAwB,GAAU,CAChC,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,GAAK,EAAW,IAAgC,EAAG,eAAe,IAAK,EAAS,CAChF,EAAU,GAAY,CACtB,EAAa,EAAc,EAAQ,YAAY,CAC/C,EAAU,EAAc,EAAQ,eAAe,CAC/C,EAAO,EAAc,GAAS,MAAM,EAAI,KACxC,EAAsB,GAAS,IAAM,KACrC,EAAkB,CAAC,CAAC,EAEpB,EAAY,GAAc,MAAQ,GAAW,KAC7C,EAAW,GAAe,CAAO,EAAQ,QAAQ,EAAG,EACpD,EAAS,GAAW,CACpB,CAAC,EAAe,IAAA,EAAA,EAAA,UAA6B,GAAM,CACnD,EAAQ,GAAU,CAElB,EAAS,GAAS,OAClB,EAAY,MAAmB,EAAuB,EAAQ,CAAC,CAE/D,EAAW,EAAc,EAAU,UAAU,CAC7C,EAAe,EAAc,EAAU,cAAc,EAAI,IAG/D,EAAA,EAAA,eAAgB,CACV,MACJ,IAAI,CAAC,EAAiB,CACpB,EAAO,KAAK,gBAAgB,CAC5B,OAGF,GAAI,GAAU,gBAAiB,CAC7B,EAAO,KAAK,IAAI,CAChB,UAED,CAAC,EAAW,EAAiB,EAAQ,EAAS,CAAC,CAElD,IAAM,EAAwB,KAAO,IAAsB,CACzD,GAAI,CAAC,EAAU,CACT,GACF,EAAQ,EAAoB,GAAG,CAEjC,EAAO,KAAK,IAAI,CAChB,OAGF,GAAI,CACF,MAAM,EAAU,aAAa,CAC7B,EAAiB,GAAK,CAEtB,eAAiB,CACf,EAAO,KAAK,IAAI,EACf,IAAK,OACD,EAAO,CACd,QAAQ,MAAM,0BAA2B,EAAM,CAC/C,EAAM,UAAU,EAAE,sBAAsB,CAAC,GAIvC,EAAa,EAAY,UAAY,EAAgB,WAAa,OAClE,EAAY,GAAM,MAAM,MAAM,IAAI,CAAC,IAAM,GAE/C,OACE,EAAA,EAAA,KAAC,EAAD,CACE,SAAU,EACV,gBAAiB,GAAU,iBAAmB,KAC9C,UAAW,CAAC,GAAU,gBACtB,OAAQ,EACM,eACd,aAAgB,EAAsB,GAAK,CAC3C,cAAiB,EAAsB,GAAM,CAC7C,aAAc,CACZ,QAAS,EAAE,UAAU,CACrB,aAAc,EAAE,eAAe,CAC/B,mBAAoB,EAAE,qBAAqB,CAC3C,YAAa,EAAE,cAAe,CAAE,YAAW,CAAC,CAC5C,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,mBAAoB,EAAE,qBAAqB,CAC3C,yBAA0B,EAAE,2BAA2B,CACvD,qBAAsB,EAAE,uBAAuB,CAC/C,qBAAsB,EAAE,uBAAuB,CAC/C,uBAAwB,EAAE,yBAAyB,CACnD,uBAAwB,EAAE,yBAAyB,CACnD,kBAAmB,EAAE,oBAAoB,CACzC,gBAAiB,EAAE,kBAAkB,CACrC,eAAgB,EAAE,iBAAiB,CACnC,mBAAoB,EAAE,qBAAqB,CAC3C,yBAA0B,EAAE,2BAA2B,CACvD,kBAAmB,EAAE,oBAAoB,CACzC,oBAAqB,EAAE,sBAAsB,CAC7C,kBAAmB,EAAE,oBAAoB,CACzC,eAAgB,EAAE,iBAAiB,CACnC,aAAc,EAAE,eAAe,CAC/B,mBAAoB,EAAE,qBAAqB,CAC3C,YAAa,EAAE,cAAc,CAC7B,iBAAkB,EAAE,mBAAmB,CACvC,sBAAuB,EAAE,wBAAwB,CACjD,uBAAwB,EAAE,yBAAyB,CACnD,uBAAwB,EAAE,yBAAyB,CACnD,yBAA0B,EAAE,2BAA2B,CACvD,uBAAwB,EAAE,yBAAyB,CACnD,kBAAmB,EAAE,oBAAoB,CACzC,cAAe,EAAE,gBAAgB,CACjC,eAAgB,EAAE,iBAAiB,CACnC,IAAK,EAAE,MAAM,CACb,cAAe,EAAE,gBAAgB,CACjC,kBAAmB,EAAE,oBAAoB,CACzC,kBAAmB,EAAE,oBAAoB,CACzC,WAAY,EAAE,aAAa,CAC3B,aAAc,EAAE,eAAe,CAChC,CACW,aACN,OACN,CAAA"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{P as i,w as a}from"./index-DjtRDlfn.js";import{i as o}from"./routing-Bcj1FhkC.js";var s=e(t()),c=r(),l=5e3;function u(){let{t:e}=n(),t=t=>e(`Home.${t}`),r=o(),u=(0,s.useRef)(null),d=()=>{u.current&&clearTimeout(u.current),r.push(`/know/discover`)};return(0,s.useEffect)(()=>(u.current=setTimeout(d,l),()=>{u.current&&clearTimeout(u.current)}),[]),(0,c.jsxs)(`main`,{role:`main`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`100vh`,gap:`2rem`},children:[(0,c.jsx)(a,{t,size:`xl`,animated:!0}),(0,c.jsx)(`button`,{onClick:d,className:i.primary.base,children:t(`begin`)})]})}export{u as default};
2
- //# sourceMappingURL=page-D6oe9LkY.js.map
1
+ import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{P as i,w as a}from"./index-DojEUBpq.js";import{i as o}from"./routing-Dqgz2rV4.js";var s=e(t()),c=r(),l=5e3;function u(){let{t:e}=n(),t=t=>e(`Home.${t}`),r=o(),u=(0,s.useRef)(null),d=()=>{u.current&&clearTimeout(u.current),r.push(`/know/discover`)};return(0,s.useEffect)(()=>(u.current=setTimeout(d,l),()=>{u.current&&clearTimeout(u.current)}),[]),(0,c.jsxs)(`main`,{role:`main`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`100vh`,gap:`2rem`},children:[(0,c.jsx)(a,{t,size:`xl`,animated:!0}),(0,c.jsx)(`button`,{onClick:d,className:i.primary.base,children:t(`begin`)})]})}export{u as default};
2
+ //# sourceMappingURL=page-vxSCIznX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-D6oe9LkY.js","names":[],"sources":["../../src/app/[locale]/page.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SemiontBranding, buttonStyles } from '@semiont/react-ui';\nimport { useRouter } from '@/i18n/routing';\n\nconst AUTO_TRANSITION_MS = 5000;\n\nexport default function Home() {\n const { t: _t } = useTranslation();\n const t = (k: string) => _t(`Home.${k}`) as string;\n const router = useRouter();\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const goToWorkspace = () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n router.push('/know/discover');\n };\n\n useEffect(() => {\n timerRef.current = setTimeout(goToWorkspace, AUTO_TRANSITION_MS);\n return () => { if (timerRef.current) clearTimeout(timerRef.current); };\n }, []);\n\n return (\n <main\n role=\"main\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '100vh',\n gap: '2rem',\n }}\n >\n <SemiontBranding t={t} size=\"xl\" animated={true} />\n <button onClick={goToWorkspace} className={buttonStyles.primary.base}>\n {t('begin')}\n </button>\n </main>\n );\n}\n"],"mappings":"iPAKM,EAAqB,IAE3B,SAAwB,GAAO,CAC7B,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,EAAK,GAAc,EAAG,QAAQ,IAAI,CAClC,EAAS,GAAW,CACpB,GAAA,EAAA,EAAA,QAAwD,KAAK,CAE7D,MAAsB,CACtB,EAAS,SAAS,aAAa,EAAS,QAAQ,CACpD,EAAO,KAAK,iBAAiB,EAQ/B,OALA,EAAA,EAAA,gBACE,EAAS,QAAU,WAAW,EAAe,EAAmB,KACnD,CAAM,EAAS,SAAS,aAAa,EAAS,QAAQ,GAClE,EAAE,CAAC,EAGJ,EAAA,EAAA,MAAC,OAAD,CACE,KAAK,OACL,MAAO,CACL,QAAS,OACT,cAAe,SACf,WAAY,SACZ,eAAgB,SAChB,UAAW,QACX,IAAK,OACN,UATH,EAWE,EAAA,EAAA,KAAC,EAAD,CAAoB,EAAG,KAAK,KAAK,SAAU,GAAQ,CAAA,EACnD,EAAA,EAAA,KAAC,SAAD,CAAQ,QAAS,EAAe,UAAW,EAAa,QAAQ,cAC7D,EAAE,QAAQ,CACJ,CAAA,CACJ"}
1
+ {"version":3,"file":"page-vxSCIznX.js","names":[],"sources":["../../src/app/[locale]/page.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { SemiontBranding, buttonStyles } from '@semiont/react-ui';\nimport { useRouter } from '@/i18n/routing';\n\nconst AUTO_TRANSITION_MS = 5000;\n\nexport default function Home() {\n const { t: _t } = useTranslation();\n const t = (k: string) => _t(`Home.${k}`) as string;\n const router = useRouter();\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const goToWorkspace = () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n router.push('/know/discover');\n };\n\n useEffect(() => {\n timerRef.current = setTimeout(goToWorkspace, AUTO_TRANSITION_MS);\n return () => { if (timerRef.current) clearTimeout(timerRef.current); };\n }, []);\n\n return (\n <main\n role=\"main\"\n style={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '100vh',\n gap: '2rem',\n }}\n >\n <SemiontBranding t={t} size=\"xl\" animated={true} />\n <button onClick={goToWorkspace} className={buttonStyles.primary.base}>\n {t('begin')}\n </button>\n </main>\n );\n}\n"],"mappings":"iPAKM,EAAqB,IAE3B,SAAwB,GAAO,CAC7B,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,EAAK,GAAc,EAAG,QAAQ,IAAI,CAClC,EAAS,GAAW,CACpB,GAAA,EAAA,EAAA,QAAwD,KAAK,CAE7D,MAAsB,CACtB,EAAS,SAAS,aAAa,EAAS,QAAQ,CACpD,EAAO,KAAK,iBAAiB,EAQ/B,OALA,EAAA,EAAA,gBACE,EAAS,QAAU,WAAW,EAAe,EAAmB,KACnD,CAAM,EAAS,SAAS,aAAa,EAAS,QAAQ,GAClE,EAAE,CAAC,EAGJ,EAAA,EAAA,MAAC,OAAD,CACE,KAAK,OACL,MAAO,CACL,QAAS,OACT,cAAe,SACf,WAAY,SACZ,eAAgB,SAChB,UAAW,QACX,IAAK,OACN,UATH,EAWE,EAAA,EAAA,KAAC,EAAD,CAAoB,EAAG,KAAK,KAAK,SAAU,GAAQ,CAAA,EACnD,EAAA,EAAA,KAAC,SAAD,CAAQ,QAAS,EAAe,UAAW,EAAa,QAAQ,cAC7D,EAAE,QAAQ,CACJ,CAAA,CACJ"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{R as i,X as a,Z as o,b as s,et as c,nt as l,ot as u,q as d,tt as f}from"./index-DjtRDlfn.js";import{t as p}from"./ToolbarPanels-CRGQDX-L.js";import{i as m}from"./routing-Bcj1FhkC.js";var h=e(t()),g=r();function _(){let{t:e}=n(),t=(t,n)=>e(`Discover.${t}`,n),r=m(),_=o(u().activeSession$)?.client,v=c(),y=f(()=>i(_,v)),b=o(y.browse.activePanel$)??null,x=o(y.recentResources$)??[],S=o(y.entityTypes$)??[],C=o(y.isLoadingRecent$)??!0,w=o(y.search.query$)??``,T=o(y.search.state$),E=T?.results??[],D=T?.isSearching??!1,{theme:O,setTheme:k,resolvedTheme:A}=l(),{showLineNumbers:j,toggleLineNumbers:M}=a();return d({"settings:theme-changed":(0,h.useCallback)(({theme:e})=>k(e),[k]),"settings:line-numbers-toggled":(0,h.useCallback)(()=>M(),[M])}),(0,g.jsx)(s,{recentDocuments:x,searchDocuments:E,entityTypes:S,isLoadingRecent:C,isSearching:D,searchQuery:w,onSearchQueryChange:y.search.setQuery,theme:A,showLineNumbers:j,activePanel:b,onNavigateToResource:e=>r.push(`/know/resource/${encodeURIComponent(e)}`),onNavigateToCompose:()=>r.push(`/know/compose`),translations:{title:t(`title`),subtitle:t(`subtitle`),searchPlaceholder:t(`searchPlaceholder`),searchButton:t(`searchButton`),searching:t(`searching`),filterByEntityType:t(`filterByEntityType`),all:t(`all`),recentResources:t(`recentResources`),searchResults:e=>t(`searchResults`,{count:e}),documentsTaggedWith:e=>t(`documentsTaggedWith`,{entityType:e}),noResultsFound:e=>t(`noResultsFound`,{query:e}),noResourcesAvailable:t(`noResourcesAvailable`),composeFirstResource:t(`composeFirstResource`),archived:t(`archived`),created:t(`created`),loadingKnowledgeBase:t(`loadingKnowledgeBase`)},ToolbarPanels:p})}export{_ as default};
2
- //# sourceMappingURL=page-B9EYfbrY.js.map
1
+ import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{R as i,X as a,Z as o,b as s,et as c,nt as l,ot as u,q as d,tt as f}from"./index-DojEUBpq.js";import{t as p}from"./ToolbarPanels-wzZqAqCQ.js";import{i as m}from"./routing-Dqgz2rV4.js";var h=e(t()),g=r();function _(){let{t:e}=n(),t=(t,n)=>e(`Discover.${t}`,n),r=m(),_=o(u().activeSession$)?.client,v=c(),y=f(()=>i(_,v)),b=o(y.browse.activePanel$)??null,x=o(y.recentResources$)??[],S=o(y.entityTypes$)??[],C=o(y.isLoadingRecent$)??!0,w=o(y.search.query$)??``,T=o(y.search.state$),E=T?.results??[],D=T?.isSearching??!1,{theme:O,setTheme:k,resolvedTheme:A}=l(),{showLineNumbers:j,toggleLineNumbers:M}=a();return d({"settings:theme-changed":(0,h.useCallback)(({theme:e})=>k(e),[k]),"settings:line-numbers-toggled":(0,h.useCallback)(()=>M(),[M])}),(0,g.jsx)(s,{recentDocuments:x,searchDocuments:E,entityTypes:S,isLoadingRecent:C,isSearching:D,searchQuery:w,onSearchQueryChange:y.search.setQuery,theme:A,showLineNumbers:j,activePanel:b,onNavigateToResource:e=>r.push(`/know/resource/${encodeURIComponent(e)}`),onNavigateToCompose:()=>r.push(`/know/compose`),translations:{title:t(`title`),subtitle:t(`subtitle`),searchPlaceholder:t(`searchPlaceholder`),searchButton:t(`searchButton`),searching:t(`searching`),filterByEntityType:t(`filterByEntityType`),all:t(`all`),recentResources:t(`recentResources`),searchResults:e=>t(`searchResults`,{count:e}),documentsTaggedWith:e=>t(`documentsTaggedWith`,{entityType:e}),noResultsFound:e=>t(`noResultsFound`,{query:e}),noResourcesAvailable:t(`noResourcesAvailable`),composeFirstResource:t(`composeFirstResource`),archived:t(`archived`),created:t(`created`),loadingKnowledgeBase:t(`loadingKnowledgeBase`)},ToolbarPanels:p})}export{_ as default};
2
+ //# sourceMappingURL=page-yaV9evoV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-B9EYfbrY.js","names":[],"sources":["../../src/app/[locale]/know/discover/page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useRouter } from '@/i18n/routing';\nimport {\n useTheme,\n useLineNumbers,\n useEventSubscriptions,\n useObservable,\n useSemiont,\n useStateUnit,\n ResourceDiscoveryPage,\n} from '@semiont/react-ui';\nimport { ToolbarPanels } from '@/components/toolbar/ToolbarPanels';\nimport { useShellStateUnit } from '@semiont/react-ui';\nimport { createDiscoverStateUnit } from '@semiont/react-ui';\nexport default function DiscoverPage() {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`Discover.${k}`, p as any) as string;\n const router = useRouter();\n const semiont = useObservable(useSemiont().activeSession$)?.client;\n\n const browseStateUnit = useShellStateUnit();\n const stateUnit = useStateUnit(() => createDiscoverStateUnit(semiont!, browseStateUnit));\n\n const activePanel = useObservable(stateUnit.browse.activePanel$) ?? null;\n const recentDocuments = useObservable(stateUnit.recentResources$) ?? [];\n const entityTypes = useObservable(stateUnit.entityTypes$) ?? [];\n const isLoadingRecent = useObservable(stateUnit.isLoadingRecent$) ?? true;\n const searchQuery = useObservable(stateUnit.search.query$) ?? '';\n const searchState = useObservable(stateUnit.search.state$);\n const searchDocuments = searchState?.results ?? [];\n const isSearching = searchState?.isSearching ?? false;\n\n const { theme, setTheme, resolvedTheme } = useTheme();\n const { showLineNumbers, toggleLineNumbers } = useLineNumbers();\n\n useEventSubscriptions({\n 'settings:theme-changed': useCallback(({ theme }: { theme: 'light' | 'dark' | 'system' }) => setTheme(theme), [setTheme]),\n 'settings:line-numbers-toggled': useCallback(() => toggleLineNumbers(), [toggleLineNumbers]),\n });\n\n return (\n <ResourceDiscoveryPage\n recentDocuments={recentDocuments}\n searchDocuments={searchDocuments}\n entityTypes={entityTypes}\n isLoadingRecent={isLoadingRecent}\n isSearching={isSearching}\n searchQuery={searchQuery}\n onSearchQueryChange={stateUnit.search.setQuery}\n theme={resolvedTheme}\n showLineNumbers={showLineNumbers}\n activePanel={activePanel}\n onNavigateToResource={(resourceId) => router.push(`/know/resource/${encodeURIComponent(resourceId)}`)}\n onNavigateToCompose={() => router.push('/know/compose')}\n translations={{\n title: t('title'),\n subtitle: t('subtitle'),\n searchPlaceholder: t('searchPlaceholder'),\n searchButton: t('searchButton'),\n searching: t('searching'),\n filterByEntityType: t('filterByEntityType'),\n all: t('all'),\n recentResources: t('recentResources'),\n searchResults: (count: number) => t('searchResults', { count }),\n documentsTaggedWith: (entityType: string) => t('documentsTaggedWith', { entityType }),\n noResultsFound: (query: string) => t('noResultsFound', { query }),\n noResourcesAvailable: t('noResourcesAvailable'),\n composeFirstResource: t('composeFirstResource'),\n archived: t('archived'),\n created: t('created'),\n loadingKnowledgeBase: t('loadingKnowledgeBase'),\n }}\n ToolbarPanels={ToolbarPanels}\n />\n );\n}\n"],"mappings":"sVAiBA,SAAwB,GAAe,CACrC,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,GAAK,EAAW,IAAgC,EAAG,YAAY,IAAK,EAAS,CAC7E,EAAS,GAAW,CACpB,EAAU,EAAc,GAAY,CAAC,eAAe,EAAE,OAEtD,EAAkB,GAAmB,CACrC,EAAY,MAAmB,EAAwB,EAAU,EAAgB,CAAC,CAElF,EAAc,EAAc,EAAU,OAAO,aAAa,EAAI,KAC9D,EAAkB,EAAc,EAAU,iBAAiB,EAAI,EAAE,CACjE,EAAc,EAAc,EAAU,aAAa,EAAI,EAAE,CACzD,EAAkB,EAAc,EAAU,iBAAiB,EAAI,GAC/D,EAAc,EAAc,EAAU,OAAO,OAAO,EAAI,GACxD,EAAc,EAAc,EAAU,OAAO,OAAO,CACpD,EAAkB,GAAa,SAAW,EAAE,CAC5C,EAAc,GAAa,aAAe,GAE1C,CAAE,QAAO,WAAU,iBAAkB,GAAU,CAC/C,CAAE,kBAAiB,qBAAsB,GAAgB,CAO/D,OALA,EAAsB,CACpB,0BAAA,EAAA,EAAA,cAAuC,CAAE,WAAoD,EAAS,EAAM,CAAE,CAAC,EAAS,CAAC,CACzH,iCAAA,EAAA,EAAA,iBAAmD,GAAmB,CAAE,CAAC,EAAkB,CAAC,CAC7F,CAAC,EAGA,EAAA,EAAA,KAAC,EAAD,CACmB,kBACA,kBACJ,cACI,kBACJ,cACA,cACb,oBAAqB,EAAU,OAAO,SACtC,MAAO,EACU,kBACJ,cACb,qBAAuB,GAAe,EAAO,KAAK,kBAAkB,mBAAmB,EAAW,GAAG,CACrG,wBAA2B,EAAO,KAAK,gBAAgB,CACvD,aAAc,CACZ,MAAO,EAAE,QAAQ,CACjB,SAAU,EAAE,WAAW,CACvB,kBAAmB,EAAE,oBAAoB,CACzC,aAAc,EAAE,eAAe,CAC/B,UAAW,EAAE,YAAY,CACzB,mBAAoB,EAAE,qBAAqB,CAC3C,IAAK,EAAE,MAAM,CACb,gBAAiB,EAAE,kBAAkB,CACrC,cAAgB,GAAkB,EAAE,gBAAiB,CAAE,QAAO,CAAC,CAC/D,oBAAsB,GAAuB,EAAE,sBAAuB,CAAE,aAAY,CAAC,CACrF,eAAiB,GAAkB,EAAE,iBAAkB,CAAE,QAAO,CAAC,CACjE,qBAAsB,EAAE,uBAAuB,CAC/C,qBAAsB,EAAE,uBAAuB,CAC/C,SAAU,EAAE,WAAW,CACvB,QAAS,EAAE,UAAU,CACrB,qBAAsB,EAAE,uBAAuB,CAChD,CACc,gBACf,CAAA"}
1
+ {"version":3,"file":"page-yaV9evoV.js","names":[],"sources":["../../src/app/[locale]/know/discover/page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useRouter } from '@/i18n/routing';\nimport {\n useTheme,\n useLineNumbers,\n useEventSubscriptions,\n useObservable,\n useSemiont,\n useStateUnit,\n ResourceDiscoveryPage,\n} from '@semiont/react-ui';\nimport { ToolbarPanels } from '@/components/toolbar/ToolbarPanels';\nimport { useShellStateUnit } from '@semiont/react-ui';\nimport { createDiscoverStateUnit } from '@semiont/react-ui';\nexport default function DiscoverPage() {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`Discover.${k}`, p as any) as string;\n const router = useRouter();\n const semiont = useObservable(useSemiont().activeSession$)?.client;\n\n const browseStateUnit = useShellStateUnit();\n const stateUnit = useStateUnit(() => createDiscoverStateUnit(semiont!, browseStateUnit));\n\n const activePanel = useObservable(stateUnit.browse.activePanel$) ?? null;\n const recentDocuments = useObservable(stateUnit.recentResources$) ?? [];\n const entityTypes = useObservable(stateUnit.entityTypes$) ?? [];\n const isLoadingRecent = useObservable(stateUnit.isLoadingRecent$) ?? true;\n const searchQuery = useObservable(stateUnit.search.query$) ?? '';\n const searchState = useObservable(stateUnit.search.state$);\n const searchDocuments = searchState?.results ?? [];\n const isSearching = searchState?.isSearching ?? false;\n\n const { theme, setTheme, resolvedTheme } = useTheme();\n const { showLineNumbers, toggleLineNumbers } = useLineNumbers();\n\n useEventSubscriptions({\n 'settings:theme-changed': useCallback(({ theme }: { theme: 'light' | 'dark' | 'system' }) => setTheme(theme), [setTheme]),\n 'settings:line-numbers-toggled': useCallback(() => toggleLineNumbers(), [toggleLineNumbers]),\n });\n\n return (\n <ResourceDiscoveryPage\n recentDocuments={recentDocuments}\n searchDocuments={searchDocuments}\n entityTypes={entityTypes}\n isLoadingRecent={isLoadingRecent}\n isSearching={isSearching}\n searchQuery={searchQuery}\n onSearchQueryChange={stateUnit.search.setQuery}\n theme={resolvedTheme}\n showLineNumbers={showLineNumbers}\n activePanel={activePanel}\n onNavigateToResource={(resourceId) => router.push(`/know/resource/${encodeURIComponent(resourceId)}`)}\n onNavigateToCompose={() => router.push('/know/compose')}\n translations={{\n title: t('title'),\n subtitle: t('subtitle'),\n searchPlaceholder: t('searchPlaceholder'),\n searchButton: t('searchButton'),\n searching: t('searching'),\n filterByEntityType: t('filterByEntityType'),\n all: t('all'),\n recentResources: t('recentResources'),\n searchResults: (count: number) => t('searchResults', { count }),\n documentsTaggedWith: (entityType: string) => t('documentsTaggedWith', { entityType }),\n noResultsFound: (query: string) => t('noResultsFound', { query }),\n noResourcesAvailable: t('noResourcesAvailable'),\n composeFirstResource: t('composeFirstResource'),\n archived: t('archived'),\n created: t('created'),\n loadingKnowledgeBase: t('loadingKnowledgeBase'),\n }}\n ToolbarPanels={ToolbarPanels}\n />\n );\n}\n"],"mappings":"sVAiBA,SAAwB,GAAe,CACrC,GAAM,CAAE,EAAG,GAAO,GAAgB,CAC5B,GAAK,EAAW,IAAgC,EAAG,YAAY,IAAK,EAAS,CAC7E,EAAS,GAAW,CACpB,EAAU,EAAc,GAAY,CAAC,eAAe,EAAE,OAEtD,EAAkB,GAAmB,CACrC,EAAY,MAAmB,EAAwB,EAAU,EAAgB,CAAC,CAElF,EAAc,EAAc,EAAU,OAAO,aAAa,EAAI,KAC9D,EAAkB,EAAc,EAAU,iBAAiB,EAAI,EAAE,CACjE,EAAc,EAAc,EAAU,aAAa,EAAI,EAAE,CACzD,EAAkB,EAAc,EAAU,iBAAiB,EAAI,GAC/D,EAAc,EAAc,EAAU,OAAO,OAAO,EAAI,GACxD,EAAc,EAAc,EAAU,OAAO,OAAO,CACpD,EAAkB,GAAa,SAAW,EAAE,CAC5C,EAAc,GAAa,aAAe,GAE1C,CAAE,QAAO,WAAU,iBAAkB,GAAU,CAC/C,CAAE,kBAAiB,qBAAsB,GAAgB,CAO/D,OALA,EAAsB,CACpB,0BAAA,EAAA,EAAA,cAAuC,CAAE,WAAoD,EAAS,EAAM,CAAE,CAAC,EAAS,CAAC,CACzH,iCAAA,EAAA,EAAA,iBAAmD,GAAmB,CAAE,CAAC,EAAkB,CAAC,CAC7F,CAAC,EAGA,EAAA,EAAA,KAAC,EAAD,CACmB,kBACA,kBACJ,cACI,kBACJ,cACA,cACb,oBAAqB,EAAU,OAAO,SACtC,MAAO,EACU,kBACJ,cACb,qBAAuB,GAAe,EAAO,KAAK,kBAAkB,mBAAmB,EAAW,GAAG,CACrG,wBAA2B,EAAO,KAAK,gBAAgB,CACvD,aAAc,CACZ,MAAO,EAAE,QAAQ,CACjB,SAAU,EAAE,WAAW,CACvB,kBAAmB,EAAE,oBAAoB,CACzC,aAAc,EAAE,eAAe,CAC/B,UAAW,EAAE,YAAY,CACzB,mBAAoB,EAAE,qBAAqB,CAC3C,IAAK,EAAE,MAAM,CACb,gBAAiB,EAAE,kBAAkB,CACrC,cAAgB,GAAkB,EAAE,gBAAiB,CAAE,QAAO,CAAC,CAC/D,oBAAsB,GAAuB,EAAE,sBAAuB,CAAE,aAAY,CAAC,CACrF,eAAiB,GAAkB,EAAE,iBAAkB,CAAE,QAAO,CAAC,CACjE,qBAAsB,EAAE,uBAAuB,CAC/C,qBAAsB,EAAE,uBAAuB,CAC/C,SAAU,EAAE,WAAW,CACvB,QAAS,EAAE,UAAU,CACrB,qBAAsB,EAAE,uBAAuB,CAChD,CACc,gBACf,CAAA"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t}from"./i18n-B53Yefbh.js";import{t as n}from"./vendor-0HjOURbh.js";import{t as r}from"./routing-Bcj1FhkC.js";var i=e(t()),a=n(),o=i.forwardRef(function({href:e,...t},n){return(0,a.jsx)(r,{ref:n,to:e,...t})}),s={resourceDetail:e=>`/know/resource/${e}`,userProfile:e=>`/users/${e}`,search:e=>`/search?q=${encodeURIComponent(e)}`,home:()=>`/`,about:()=>`/about`,privacy:()=>`/privacy`,terms:()=>`/terms`,knowledge:()=>`/know`,moderate:()=>`/moderate`,admin:()=>`/admin`};export{s as n,o as t};
2
- //# sourceMappingURL=routing-DW1ehi64.js.map
1
+ import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t}from"./i18n-B53Yefbh.js";import{t as n}from"./vendor-0HjOURbh.js";import{t as r}from"./routing-Dqgz2rV4.js";var i=e(t()),a=n(),o=i.forwardRef(function({href:e,...t},n){return(0,a.jsx)(r,{ref:n,to:e,...t})}),s={resourceDetail:e=>`/know/resource/${e}`,userProfile:e=>`/users/${e}`,search:e=>`/search?q=${encodeURIComponent(e)}`,home:()=>`/`,about:()=>`/about`,privacy:()=>`/privacy`,terms:()=>`/terms`,knowledge:()=>`/know`,moderate:()=>`/moderate`,admin:()=>`/admin`};export{s as n,o as t};
2
+ //# sourceMappingURL=routing-CcetIVef.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing-DW1ehi64.js","names":[],"sources":["../../src/lib/routing.tsx"],"sourcesContent":["/**\n * Routing configuration for Semiont frontend\n *\n * This module provides the concrete implementation of the RoutingContext\n * interface for the React Router-based frontend application.\n */\n\nimport React from 'react';\nimport { Link as NextLink } from '@/i18n/routing';\nimport type { RouteBuilder, LinkComponentProps } from '@semiont/react-ui';\nimport type { ComponentType } from 'react';\n\n/**\n * Adapter: react-ui components pass `href`, but React Router Link expects `to`.\n */\nconst LinkAdapter = React.forwardRef<HTMLAnchorElement, LinkComponentProps>(\n function LinkAdapter({ href, ...props }, ref) {\n return <NextLink ref={ref} to={href} {...props} />;\n }\n);\nexport const Link: ComponentType<LinkComponentProps> = LinkAdapter as any;\n\n/**\n * Route builder for Semiont frontend\n */\nexport const routes: RouteBuilder = {\n resourceDetail: (id: string) => `/know/resource/${id}`,\n userProfile: (id: string) => `/users/${id}`,\n search: (query: string) => `/search?q=${encodeURIComponent(query)}`,\n home: () => '/',\n about: () => '/about',\n privacy: () => '/privacy',\n terms: () => '/terms',\n knowledge: () => '/know',\n moderate: () => '/moderate',\n admin: () => '/admin',\n};\n"],"mappings":"gMAoBa,EALP,EAAoB,WACxB,SAAqB,CAAE,OAAM,GAAG,GAAS,EAAK,CAC5C,OAAO,EAAA,EAAA,KAAC,EAAD,CAAe,MAAK,GAAI,EAAM,GAAI,EAAS,CAAA,EAGC,CAK1C,EAAuB,CAClC,eAAiB,GAAe,kBAAkB,IAClD,YAAc,GAAe,UAAU,IACvC,OAAS,GAAkB,aAAa,mBAAmB,EAAM,GACjE,SAAY,IACZ,UAAa,SACb,YAAe,WACf,UAAa,SACb,cAAiB,QACjB,aAAgB,YAChB,UAAa,SACd"}
1
+ {"version":3,"file":"routing-CcetIVef.js","names":[],"sources":["../../src/lib/routing.tsx"],"sourcesContent":["/**\n * Routing configuration for Semiont frontend\n *\n * This module provides the concrete implementation of the RoutingContext\n * interface for the React Router-based frontend application.\n */\n\nimport React from 'react';\nimport { Link as NextLink } from '@/i18n/routing';\nimport type { RouteBuilder, LinkComponentProps } from '@semiont/react-ui';\nimport type { ComponentType } from 'react';\n\n/**\n * Adapter: react-ui components pass `href`, but React Router Link expects `to`.\n */\nconst LinkAdapter = React.forwardRef<HTMLAnchorElement, LinkComponentProps>(\n function LinkAdapter({ href, ...props }, ref) {\n return <NextLink ref={ref} to={href} {...props} />;\n }\n);\nexport const Link: ComponentType<LinkComponentProps> = LinkAdapter as any;\n\n/**\n * Route builder for Semiont frontend\n */\nexport const routes: RouteBuilder = {\n resourceDetail: (id: string) => `/know/resource/${id}`,\n userProfile: (id: string) => `/users/${id}`,\n search: (query: string) => `/search?q=${encodeURIComponent(query)}`,\n home: () => '/',\n about: () => '/about',\n privacy: () => '/privacy',\n terms: () => '/terms',\n knowledge: () => '/know',\n moderate: () => '/moderate',\n admin: () => '/admin',\n};\n"],"mappings":"gMAoBa,EALP,EAAoB,WACxB,SAAqB,CAAE,OAAM,GAAG,GAAS,EAAK,CAC5C,OAAO,EAAA,EAAA,KAAC,EAAD,CAAe,MAAK,GAAI,EAAM,GAAI,EAAS,CAAA,EAGC,CAK1C,EAAuB,CAClC,eAAiB,GAAe,kBAAkB,IAClD,YAAc,GAAe,UAAU,IACvC,OAAS,GAAkB,aAAa,mBAAmB,EAAM,GACjE,SAAY,IACZ,UAAa,SACb,YAAe,WACf,UAAa,SACb,cAAiB,QACjB,aAAgB,YAChB,UAAa,SACd"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{Ft as i,It as a,Lt as o,Mt as s,jt as c}from"./index-DjtRDlfn.js";var l=e(t()),u=r(),d=l.forwardRef(function({to:e,...t},r){let{i18n:i}=n(),a=o(),c=i.language||a.locale||`en`;return(0,u.jsx)(s,{ref:r,to:typeof e==`string`?`/${c}${e.startsWith(`/`)?e:`/${e}`}`:e,...t})});function f(){let e=a(),{i18n:t}=n(),r=o();function i(e,n){return`/${n||t.language||r.locale||`en`}${e.startsWith(`/`)?e:`/${e}`}`}return{push(t,n){e(i(t,n?.locale))},replace(t,n){e(i(t,n?.locale),{replace:!0})},back(){e(-1)},forward(){e(1)},refresh(){window.location.reload()},prefetch(e){}}}function p(){let{pathname:e}=i(),t=e.match(/^\/[a-z]{2}(\/.*)?$/);return t?t[1]??`/`:e}function m(){let e=o(),{i18n:t}=n(),r=e.locale;return r&&c(r)?r:t.language||`en`}export{f as i,m as n,p as r,d as t};
2
- //# sourceMappingURL=routing-Bcj1FhkC.js.map
1
+ import{n as e}from"./rolldown-runtime-jpDsebLB.js";import{i as t,n}from"./i18n-B53Yefbh.js";import{t as r}from"./vendor-0HjOURbh.js";import{Ft as i,It as a,Lt as o,Mt as s,jt as c}from"./index-DojEUBpq.js";var l=e(t()),u=r(),d=l.forwardRef(function({to:e,...t},r){let{i18n:i}=n(),a=o(),c=i.language||a.locale||`en`;return(0,u.jsx)(s,{ref:r,to:typeof e==`string`?`/${c}${e.startsWith(`/`)?e:`/${e}`}`:e,...t})});function f(){let e=a(),{i18n:t}=n(),r=o();function i(e,n){return`/${n||t.language||r.locale||`en`}${e.startsWith(`/`)?e:`/${e}`}`}return{push(t,n){e(i(t,n?.locale))},replace(t,n){e(i(t,n?.locale),{replace:!0})},back(){e(-1)},forward(){e(1)},refresh(){window.location.reload()},prefetch(e){}}}function p(){let{pathname:e}=i(),t=e.match(/^\/[a-z]{2}(\/.*)?$/);return t?t[1]??`/`:e}function m(){let e=o(),{i18n:t}=n(),r=e.locale;return r&&c(r)?r:t.language||`en`}export{f as i,m as n,p as r,d as t};
2
+ //# sourceMappingURL=routing-Dqgz2rV4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing-Bcj1FhkC.js","names":[],"sources":["../../src/i18n/routing.tsx"],"sourcesContent":["/**\n * Routing abstraction layer — React Router implementation\n *\n * All call sites import from @/i18n/routing and do not need to change\n * when the underlying router changes.\n *\n * Key behaviours:\n * - Link: locale-prefixed anchor rendered via react-router-dom\n * - useRouter: locale-aware push/replace/back\n * - usePathname: returns path WITHOUT locale prefix\n * - redirect: programmatic navigation without locale prefix\n */\n\nimport React from 'react';\nimport {\n Link as RouterLink,\n useNavigate,\n useLocation,\n useParams,\n Navigate,\n} from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\nimport { SUPPORTED_LOCALES, DEFAULT_LOCALE, isSupportedLocale } from './config';\n\nexport { SUPPORTED_LOCALES, DEFAULT_LOCALE };\n\n// ── Link ─────────────────────────────────────────────────────────────────────\n\ntype LinkProps = React.ComponentProps<typeof RouterLink>;\n\n/**\n * Locale-aware Link. Prepends the current locale to the href.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function Link({ to, ...props }, ref) {\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n const locale = i18n.language || params.locale || DEFAULT_LOCALE;\n const target = typeof to === 'string' ? `/${locale}${to.startsWith('/') ? to : `/${to}`}` : to;\n return <RouterLink ref={ref} to={target} {...props} />;\n },\n);\n\n// ── useRouter ─────────────────────────────────────────────────────────────────\n\ntype RouterOptions = { locale?: string };\n\nexport function useRouter() {\n const navigate = useNavigate();\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n\n function prefixLocale(path: string, locale?: string): string {\n const lang = locale || i18n.language || params.locale || DEFAULT_LOCALE;\n return `/${lang}${path.startsWith('/') ? path : `/${path}`}`;\n }\n\n return {\n push(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale));\n },\n replace(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale), { replace: true });\n },\n back() {\n navigate(-1);\n },\n forward() {\n navigate(1);\n },\n refresh() {\n window.location.reload();\n },\n prefetch(_path: string) {\n // No-op: Vite/React Router handles prefetching differently\n },\n };\n}\n\n// ── usePathname ───────────────────────────────────────────────────────────────\n\n/**\n * Returns the path WITHOUT the locale prefix.\n * e.g. /en/know/discover → /know/discover\n */\nexport function usePathname(): string {\n const { pathname } = useLocation();\n // Strip leading /{locale}\n const match = pathname.match(/^\\/[a-z]{2}(\\/.*)?$/);\n if (match) {\n return match[1] ?? '/';\n }\n return pathname;\n}\n\n// ── redirect ─────────────────────────────────────────────────────────────────\n\n/**\n * Render a redirect component. Pass { href, locale } to redirect with locale,\n * or just a string href to redirect to an absolute path.\n */\nexport function redirect(target: string | { href: string; locale?: string }): React.ReactElement {\n const { i18n } = useTranslation();\n const locale = typeof target === 'string' ? (i18n.language || DEFAULT_LOCALE) : (target.locale || i18n.language || DEFAULT_LOCALE);\n const href = typeof target === 'string' ? target : target.href;\n const to = `/${locale}${href.startsWith('/') ? href : `/${href}`}`;\n return <Navigate to={to} replace />;\n}\n\n// ── useParams with locale ────────────────────────────────────────────────────\n\nexport function useLocale(): string {\n const params = useParams<{ locale?: string }>();\n const { i18n } = useTranslation();\n const localeFromParams = params.locale;\n if (localeFromParams && isSupportedLocale(localeFromParams)) {\n return localeFromParams;\n }\n return i18n.language || DEFAULT_LOCALE;\n}\n"],"mappings":"iOAiCa,EAAA,EAAa,WACxB,SAAc,CAAE,KAAI,GAAG,GAAS,EAAK,CACnC,GAAM,CAAE,QAAS,GAAgB,CAC3B,EAAS,GAAgC,CACzC,EAAS,EAAK,UAAY,EAAO,QAAA,KAEvC,OAAO,EAAA,EAAA,KAAC,EAAD,CAAiB,MAAK,GADd,OAAO,GAAO,SAAW,IAAI,IAAS,EAAG,WAAW,IAAI,CAAG,EAAK,IAAI,MAAS,EACnD,GAAI,EAAS,CAAA,EAEzD,CAMD,SAAgB,GAAY,CAC1B,IAAM,EAAW,GAAa,CACxB,CAAE,QAAS,GAAgB,CAC3B,EAAS,GAAgC,CAE/C,SAAS,EAAa,EAAc,EAAyB,CAE3D,MAAO,IADM,GAAU,EAAK,UAAY,EAAO,QAAA,OAC7B,EAAK,WAAW,IAAI,CAAG,EAAO,IAAI,MAGtD,MAAO,CACL,KAAK,EAAc,EAAyB,CAC1C,EAAS,EAAa,EAAM,GAAS,OAAO,CAAC,EAE/C,QAAQ,EAAc,EAAyB,CAC7C,EAAS,EAAa,EAAM,GAAS,OAAO,CAAE,CAAE,QAAS,GAAM,CAAC,EAElE,MAAO,CACL,EAAS,GAAG,EAEd,SAAU,CACR,EAAS,EAAE,EAEb,SAAU,CACR,OAAO,SAAS,QAAQ,EAE1B,SAAS,EAAe,GAGzB,CASH,SAAgB,GAAsB,CACpC,GAAM,CAAE,YAAa,GAAa,CAE5B,EAAQ,EAAS,MAAM,sBAAsB,CAInD,OAHI,EACK,EAAM,IAAM,IAEd,EAmBT,SAAgB,GAAoB,CAClC,IAAM,EAAS,GAAgC,CACzC,CAAE,QAAS,GAAgB,CAC3B,EAAmB,EAAO,OAIhC,OAHI,GAAoB,EAAkB,EAAiB,CAClD,EAEF,EAAK,UAAA"}
1
+ {"version":3,"file":"routing-Dqgz2rV4.js","names":[],"sources":["../../src/i18n/routing.tsx"],"sourcesContent":["/**\n * Routing abstraction layer — React Router implementation\n *\n * All call sites import from @/i18n/routing and do not need to change\n * when the underlying router changes.\n *\n * Key behaviours:\n * - Link: locale-prefixed anchor rendered via react-router-dom\n * - useRouter: locale-aware push/replace/back\n * - usePathname: returns path WITHOUT locale prefix\n * - redirect: programmatic navigation without locale prefix\n */\n\nimport React from 'react';\nimport {\n Link as RouterLink,\n useNavigate,\n useLocation,\n useParams,\n Navigate,\n} from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\nimport { SUPPORTED_LOCALES, DEFAULT_LOCALE, isSupportedLocale } from './config';\n\nexport { SUPPORTED_LOCALES, DEFAULT_LOCALE };\n\n// ── Link ─────────────────────────────────────────────────────────────────────\n\ntype LinkProps = React.ComponentProps<typeof RouterLink>;\n\n/**\n * Locale-aware Link. Prepends the current locale to the href.\n */\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n function Link({ to, ...props }, ref) {\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n const locale = i18n.language || params.locale || DEFAULT_LOCALE;\n const target = typeof to === 'string' ? `/${locale}${to.startsWith('/') ? to : `/${to}`}` : to;\n return <RouterLink ref={ref} to={target} {...props} />;\n },\n);\n\n// ── useRouter ─────────────────────────────────────────────────────────────────\n\ntype RouterOptions = { locale?: string };\n\nexport function useRouter() {\n const navigate = useNavigate();\n const { i18n } = useTranslation();\n const params = useParams<{ locale?: string }>();\n\n function prefixLocale(path: string, locale?: string): string {\n const lang = locale || i18n.language || params.locale || DEFAULT_LOCALE;\n return `/${lang}${path.startsWith('/') ? path : `/${path}`}`;\n }\n\n return {\n push(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale));\n },\n replace(path: string, options?: RouterOptions) {\n navigate(prefixLocale(path, options?.locale), { replace: true });\n },\n back() {\n navigate(-1);\n },\n forward() {\n navigate(1);\n },\n refresh() {\n window.location.reload();\n },\n prefetch(_path: string) {\n // No-op: Vite/React Router handles prefetching differently\n },\n };\n}\n\n// ── usePathname ───────────────────────────────────────────────────────────────\n\n/**\n * Returns the path WITHOUT the locale prefix.\n * e.g. /en/know/discover → /know/discover\n */\nexport function usePathname(): string {\n const { pathname } = useLocation();\n // Strip leading /{locale}\n const match = pathname.match(/^\\/[a-z]{2}(\\/.*)?$/);\n if (match) {\n return match[1] ?? '/';\n }\n return pathname;\n}\n\n// ── redirect ─────────────────────────────────────────────────────────────────\n\n/**\n * Render a redirect component. Pass { href, locale } to redirect with locale,\n * or just a string href to redirect to an absolute path.\n */\nexport function redirect(target: string | { href: string; locale?: string }): React.ReactElement {\n const { i18n } = useTranslation();\n const locale = typeof target === 'string' ? (i18n.language || DEFAULT_LOCALE) : (target.locale || i18n.language || DEFAULT_LOCALE);\n const href = typeof target === 'string' ? target : target.href;\n const to = `/${locale}${href.startsWith('/') ? href : `/${href}`}`;\n return <Navigate to={to} replace />;\n}\n\n// ── useParams with locale ────────────────────────────────────────────────────\n\nexport function useLocale(): string {\n const params = useParams<{ locale?: string }>();\n const { i18n } = useTranslation();\n const localeFromParams = params.locale;\n if (localeFromParams && isSupportedLocale(localeFromParams)) {\n return localeFromParams;\n }\n return i18n.language || DEFAULT_LOCALE;\n}\n"],"mappings":"iOAiCa,EAAA,EAAa,WACxB,SAAc,CAAE,KAAI,GAAG,GAAS,EAAK,CACnC,GAAM,CAAE,QAAS,GAAgB,CAC3B,EAAS,GAAgC,CACzC,EAAS,EAAK,UAAY,EAAO,QAAA,KAEvC,OAAO,EAAA,EAAA,KAAC,EAAD,CAAiB,MAAK,GADd,OAAO,GAAO,SAAW,IAAI,IAAS,EAAG,WAAW,IAAI,CAAG,EAAK,IAAI,MAAS,EACnD,GAAI,EAAS,CAAA,EAEzD,CAMD,SAAgB,GAAY,CAC1B,IAAM,EAAW,GAAa,CACxB,CAAE,QAAS,GAAgB,CAC3B,EAAS,GAAgC,CAE/C,SAAS,EAAa,EAAc,EAAyB,CAE3D,MAAO,IADM,GAAU,EAAK,UAAY,EAAO,QAAA,OAC7B,EAAK,WAAW,IAAI,CAAG,EAAO,IAAI,MAGtD,MAAO,CACL,KAAK,EAAc,EAAyB,CAC1C,EAAS,EAAa,EAAM,GAAS,OAAO,CAAC,EAE/C,QAAQ,EAAc,EAAyB,CAC7C,EAAS,EAAa,EAAM,GAAS,OAAO,CAAE,CAAE,QAAS,GAAM,CAAC,EAElE,MAAO,CACL,EAAS,GAAG,EAEd,SAAU,CACR,EAAS,EAAE,EAEb,SAAU,CACR,OAAO,SAAS,QAAQ,EAE1B,SAAS,EAAe,GAGzB,CASH,SAAgB,GAAsB,CACpC,GAAM,CAAE,YAAa,GAAa,CAE5B,EAAQ,EAAS,MAAM,sBAAsB,CAInD,OAHI,EACK,EAAM,IAAM,IAEd,EAmBT,SAAgB,GAAoB,CAClC,IAAM,EAAS,GAAgC,CACzC,CAAE,QAAS,GAAgB,CAC3B,EAAmB,EAAO,OAIhC,OAHI,GAAoB,EAAkB,EAAiB,CAClD,EAEF,EAAK,UAAA"}
@@ -1,2 +1,2 @@
1
- import{Ct as e,Dt as t,Et as n,St as r,Tt as i,_t as a,bt as o,gt as s,ht as c,mt as l,vt as u,wt as d,xt as ee,yt as f}from"./index-DjtRDlfn.js";var p;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(p||={});var m=t.instance(),h=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()}},g=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function _(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function v(e){if(e!=null)return async()=>e}function te(e,t,n){return{timeoutMillis:_(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function ne(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var y=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 re(e){return new y(e.concurrencyLimit)}var ie=i(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function ae(e){return e.setValue(ie,!0)}function b(e){return e.getValue(ie)===!0}var x=`baggage`,oe=4096;function se(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function ce(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 le(e){if(!e)return;let t=e.indexOf(`;`),r=t===-1?e:e.substring(0,t),i=r.indexOf(`=`);if(i<=0)return;let a=r.substring(0,i).trim(),o=r.substring(i+1).trim();if(!a||!o)return;let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch{return}let l;return t!==-1&&t<e.length-1&&(l=n(e.substring(t+1))),{key:s,value:c,metadata:l}}var ue=class{inject(e,t,n){let r=c.getBaggage(e);if(!r||b(e))return;let i=se(ce(r).filter(e=>e.length<=oe).slice(0,180));i.length>0&&n.set(t,x,i)}extract(e,t,n){let r=n.get(t,x),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=le(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:c.setBaggage(e,c.createBaggage(a))}fields(){return[x]}};function S(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!de(n)){m.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!fe(r)){m.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function de(e){return typeof e==`string`&&e!==``}function fe(e){return e==null?!0:Array.isArray(e)?pe(e):me(typeof e)}function pe(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(me(e)){t=e;continue}return!1}return!1}}return!0}function me(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function he(){return e=>{m.error(ge(e))}}function ge(e){return typeof e==`string`?e:JSON.stringify(_e(e))}function _e(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 ve=he();function C(e){try{ve(e)}catch{}}var ye=`2.7.0`,be=`exception.message`,xe=`exception.stacktrace`,Se=`exception.type`,Ce=`service.name`,we=`service.version`,w=`telemetry.sdk.language`,Te=`webjs`,T=`telemetry.sdk.name`,E=`telemetry.sdk.version`,Ee=`process.runtime.name`,D={[T]:`opentelemetry`,[Ee]:`browser`,[w]:Te,[E]:ye},O=performance,De=9,Oe=10**6,k=10**De;function A(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Oe)]}function ke(e){return Fe(A(O.timeOrigin),A(typeof e==`number`?e:O.now()))}function Ae(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=k),[n,r]}function je(e){return e[0]*k+e[1]}function Me(e){return e[0]*1e6+e[1]/1e3}function Ne(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Pe(e){return Ne(e)||typeof e==`number`||e instanceof Date}function Fe(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=k&&(n[1]-=k,n[0]+=1),n}var j;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(j||={});var Ie=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){m.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){m.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},M=`[_0-9a-z-*/]`,Le=`[a-z]${M}{0,255}`,Re=`[a-z0-9]${M}{0,240}@[a-z]${M}{0,13}`,ze=RegExp(`^(?:${Le}|${Re})$`),Be=/^[ -~]{0,255}[!-~]$/,Ve=/,|=/;function He(e){return ze.test(e)}function Ue(e){return Be.test(e)&&!Ve.test(e)}var We=32,Ge=512,Ke=`,`,qe=`=`,Je=class e{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+qe+this.get(t)),e),[]).join(Ke)}_parse(e){e.length>Ge||(this._internalState=e.split(Ke).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(qe);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);He(i)&&Ue(a)&&e.set(i,a)}return e},new Map),this._internalState.size>We&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,We))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}},N=`traceparent`,P=`tracestate`,Ye=`00`,Xe=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Ze(e){let t=Xe.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Qe=class{inject(e,t,n){let i=l.getSpanContext(e);if(!i||b(e)||!f(i))return;let a=`${Ye}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||r.NONE).toString(16)}`;n.set(t,N,a),i.traceState&&n.set(t,P,i.traceState.serialize())}extract(e,t,n){let r=n.get(t,N);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ze(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,P);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Je(typeof e==`string`?e:void 0)}return l.setSpanContext(e,a)}fields(){return[N,P]}},$e=`[object Object]`,et=`[object Null]`,tt=`[object Undefined]`,nt=Function.prototype.toString,rt=nt.call(Object),it=Object.getPrototypeOf,at=Object.prototype,ot=at.hasOwnProperty,F=Symbol?Symbol.toStringTag:void 0,st=at.toString;function ct(e){if(!lt(e)||ut(e)!==$e)return!1;let t=it(e);if(t===null)return!0;let n=ot.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&nt.call(n)===rt}function lt(e){return typeof e==`object`&&!!e}function ut(e){return e==null?e===void 0?tt:et:F&&F in Object(e)?dt(e):ft(e)}function dt(e){let t=ot.call(e,F),n=e[F],r=!1;try{e[F]=void 0,r=!0}catch{}let i=st.call(e);return r&&(t?e[F]=n:delete e[F]),i}function ft(e){return st.call(e)}var pt=20;function mt(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ht(t,e.shift(),0,n);return t}function I(e){return L(e)?e.slice():e}function ht(e,t,n=0,r){let i;if(!(n>pt)){if(n++,z(e)||z(t)||_t(t))i=I(t);else if(L(e)){if(i=e.slice(),L(t))for(let e=0,n=t.length;e<n;e++)i.push(I(t[e]));else if(R(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]=I(t[r]))}}}else if(R(e))if(R(t)){if(!vt(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(z(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(gt(e,s,r)||gt(t,s,r))delete i[s];else{if(R(a)&&R(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]=ht(i[s],c,n,r)}}}}else i=t;return i}}function gt(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 L(e){return Array.isArray(e)}function _t(e){return typeof e==`function`}function R(e){return!z(e)&&!L(e)&&!_t(e)&&typeof e==`object`}function z(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function vt(e,t){return!(!ct(e)||!ct(t))}var yt=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)}},bt=class{_isCalled=!1;_deferred=new yt;_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 xt(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function St(){return{handleResponse(e){e==null||!xt(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||m.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Ct=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=m.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:j.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:j.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:j.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:j.FAILED,error:e.error});return}else e.status===`retryable`?t({code:j.FAILED,error:e.error??new g(`Export failed with retryable status`)}):t({code:j.FAILED,error:new g(`Export failed with unknown error`)})},e=>t({code:j.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function wt(e,t){return new Ct(e.transport,e.serializer,St(),e.promiseHandler,t.timeout)}function Tt(e,t,n){return wt({transport:n,serializer:t,promiseHandler:re(e)},{timeout:e.timeoutMillis})}var B;function Et(){if(B===void 0)try{let e=globalThis.process.argv0;B=e?`unknown_service:${e}`:`unknown_service`}catch{B=`unknown_service`}return B}var V=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Dt=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=At(t),r._asyncAttributesPending=t.filter(([e,t])=>V(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(V(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=At(this._rawAttributes),this._schemaUrl=jt(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,V(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&m.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(V(n)){m.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=Mt(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ot(e,t){return Dt.FromAttributeList(Object.entries(e),t)}function kt(){return Ot({[Ce]:Et(),[w]:D[w],[T]:D[T],[E]:D[E]})}function At(e){return e.map(([e,t])=>V(t)?[e,t.catch(t=>{m.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function jt(e){if(typeof e==`string`||e===void 0)return e;m.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Mt(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;m.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Nt(e,t){let n={attributes:H(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Pt(e){return{name:e.name,version:e.version}}function H(e,t){return Object.keys(e).map(n=>Ft(n,e[n],t))}function Ft(e,t,n){return{key:e,value:U(t,n)}}function U(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=U(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:U(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function It(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Lt(e){return It(e).toString()}var Rt=typeof BigInt<`u`?Lt:je;function zt(e){return e}var Bt={encodeHrTime:Rt,encodeSpanContext:zt,encodeOptionalSpanContext:zt,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}},Vt=256,Ht=512;function Ut(e,t){let n=e&255|Vt;return t&&(n|=Ht),n}function Wt(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:H(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Kt(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Gt(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ut(n.traceFlags,e.parentSpanContext?.isRemote)}}function Gt(e,t){return{attributes:e.attributes?H(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ut(e.context.traceFlags,e.context.isRemote)}}function Kt(e,t){return{attributes:e.attributes?H(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function qt(e,t){return{resourceSpans:Yt(e,t)}}function Jt(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 Yt(e,t){let n=Jt(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=>Wt(e,t));o.push({scope:Pt(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Nt(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var Xt={serializeRequest:e=>{let t=qt(e,Bt);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return m.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},W=5,Zt=1e3,Qt=5e3,$t=1.5,en=.2;function tn(){return 2*en*Math.random()-en}var nn=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=W,r=Zt,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+tn()),Qt),0);r*=$t;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return m.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;m.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?m.verbose(`Export succeeded after ${W-n} retry attempts.`):a.status===`retryable`?m.info(`Export failed after maximum retry attempts (${W}).`):m.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function rn(e){return new nn(e.transport)}function an(e){return e===429||e===502||e===503||e===504}function on(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 sn=60*1024,cn=9,G=0,K=0,ln=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=G+a>sn,s=!o&&!(K>=cn);if(s)G+=a,K++;else{let e=o?`size limit`:`count limit`;m.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${K} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(m.debug(`export response success (status: ${r.status})`),{status:`success`}):an(r.status)?(m.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:on(r.headers.get(`Retry-After`))}):(m.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return dn(e)?(m.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(m.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(G-=a,K--)}}shutdown(){}};function un(e){return new ln(e)}function dn(e){return e instanceof TypeError&&!e.cause}function fn(e,t){return Tt(e,t,rn({transport:un(e)}))}function pn(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?m.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function mn(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,pn(await e())),Object.assign(i,r)}}function hn(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 gn(e,t,n){return{...te(e,t,n),headers:mn(e.headers,t.headers,n.headers),url:hn(e.url)??t.url??n.url}}function _n(e,t){return{...ne(),headers:async()=>e,url:`http://localhost:4318/`+t}}function vn(e){return typeof e.headers==`function`?e.headers:v(e.headers)}function yn(e,t,n){return gn({url:e.url,timeoutMillis:e.timeoutMillis,headers:vn(e),concurrencyLimit:e.concurrencyLimit},{},_n(n,t))}function bn(e,t,n,r){return fn(yn(e,n,r),t)}var xn=class extends h{constructor(e={}){super(bn(e,Xt,`v1/traces`,{"Content-Type":`application/json`}))}},Sn=`exception`,Cn=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:a.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=O.now(),this._performanceOffset=t-(this._performanceStartTime+O.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 m.warn(`Invalid attribute key: ${e}`),this;if(!fe(t))return m.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 m.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&m.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Pe(t)&&(Pe(n)||(n=t),t=void 0);let i=S(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&&m.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=S(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===a.UNSET||this.status.code===a.OK)return this;let t={code:e.code};return e.code===a.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&m.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()){m.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=Ae(this.startTime,this.endTime),this._duration[0]<0&&(m.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&&m.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&m.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<=O.now())return ke(e+this._performanceOffset);if(typeof e==`number`)return A(e);if(e instanceof Date)return A(e.getTime());if(Ne(e))return e;if(this._startTimeProvided)return A(Date.now());let t=O.now()-this._performanceStartTime;return Fe(this.startTime,A(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[be]=e:e&&(e.code?n[Se]=e.code.toString():e.name&&(n[Se]=e.name),e.message&&(n[be]=e.message),e.stack&&(n[xe]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Sn,n,t):m.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}}`);m.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?(m.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}},q;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(q||={});var J=class{shouldSample(){return{decision:q.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Y=class{shouldSample(){return{decision:q.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},X=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(C(Error(`ParentBasedSampler must have a root sampler configured`)),new Y),this._remoteParentSampled=e.remoteParentSampled??new Y,this._remoteParentNotSampled=e.remoteParentNotSampled??new J,this._localParentSampled=e.localParentSampled??new Y,this._localParentNotSampled=e.localParentNotSampled??new J}shouldSample(e,t,n,i,a,o){let s=l.getSpanContext(e);return!s||!f(s)?this._root.shouldSample(e,t,n,i,a,o):s.isRemote?s.traceFlags&r.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,i,a,o):this._remoteParentNotSampled.shouldSample(e,t,n,i,a,o):s.traceFlags&r.SAMPLED?this._localParentSampled.shouldSample(e,t,n,i,a,o):this._localParentNotSampled.shouldSample(e,t,n,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()}}`}},wn=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:o(t)&&this._accumulate(t)<this._upperBound?q.RECORD_AND_SAMPLED:q.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<e.length/8;n++){let r=n*8,i=parseInt(e.slice(r,r+8),16);t=(t^i)>>>0}return t}},Z;(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`})(Z||={});var Tn=1;function En(){return{sampler:Dn(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Dn(){let e=Z.ParentBasedAlwaysOn;switch(e){case Z.AlwaysOn:return new Y;case Z.AlwaysOff:return new J;case Z.ParentBasedAlwaysOn:return new X({root:new Y});case Z.ParentBasedAlwaysOff:return new X({root:new J});case Z.TraceIdRatio:return new wn(On());case Z.ParentBasedTraceIdRatio:return new X({root:new wn(On())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Z.ParentBasedAlwaysOn}".`),new X({root:new Y})}}function On(){return m.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Tn}.`),Tn}function kn(e){let t={sampler:Dn()},n=En(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function An(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 jn=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new bt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(m.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&r.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&m.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(m.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);s.with(ae(s.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,r=>{clearTimeout(n),r.code===j.SUCCESS?e():t(r.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=>{C(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,C(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)}},Mn=class extends jn{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{C(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{C(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))}},Nn=16,Pn=8,Fn=new Uint8Array(Nn),In=new Uint8Array(Pn),Ln=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Rn(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 zn(e){let t=``;for(let n=0;n<e.length;n++)t+=Ln[e[n]];return t}var Bn=class{generateTraceId(){return Rn(Fn),zn(Fn)}generateSpanId(){return Rn(In),zn(In)}},Vn=`otel.span.parent.origin`,Hn=`otel.span.sampling_result`,Un=`otel.sdk.span.live`,Wn=`otel.sdk.span.started`,Gn=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Wn,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Un,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=qn(t);if(this.startedSpans.add(1,{[Vn]:Kn(e),[Hn]:n}),t===q.NOT_RECORD)return()=>{};let r={[Hn]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Kn(e){return e?e.isRemote?`remote`:`local`:`none`}function qn(e){switch(e){case q.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case q.RECORD:return`RECORD_ONLY`;case q.NOT_RECORD:return`DROP`}}var Jn=`2.7.0`,Yn=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,n,r,i){let a=kn(n);this._sampler=a.sampler,this._generalLimits=a.generalLimits,this._spanLimits=a.spanLimits,this._idGenerator=n.idGenerator||new Bn,this._resource=r,this._spanProcessor=i,this.instrumentationScope=t;let o=a.meterProvider?a.meterProvider.getMeter(`@opentelemetry/sdk-trace`,Jn):e();this._tracerMetrics=new Gn(o)}startSpan(e,t={},n=s.active()){t.root&&(n=l.deleteSpan(n));let i=l.getSpan(n);if(b(n))return m.debug(`Instrumentation suppressed, returning Noop Span`),l.wrapSpanContext(ee);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),c,d,f;!a||!l.isSpanContextValid(a)?d=this._idGenerator.generateTraceId():(d=a.traceId,f=a.traceState,c=a);let h=t.kind??u.INTERNAL,g=(t.links??[]).map(e=>({context:e.context,attributes:S(e.attributes)})),_=S(t.attributes),v=this._sampler.shouldSample(n,d,e,h,_,g),te=this._tracerMetrics.startSpan(a,v.decision);f=v.traceState??f;let ne=v.decision===p.RECORD_AND_SAMPLED?r.SAMPLED:r.NONE,y={traceId:d,spanId:o,traceFlags:ne,traceState:f};if(v.decision===p.NOT_RECORD)return m.debug(`Recording is off, propagating context in a non-recording span`),l.wrapSpanContext(y);let re=S(Object.assign(_,v.attributes));return new Cn({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:h,links:g,parentSpanContext:c,attributes:re,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 c=a??s.active(),u=this.startSpan(e,i,c),d=l.setSpan(c,u);return s.with(d,o,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Xn=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=>{C(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)})}},Q;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Q||={});var Zn=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=mt({},En(),An(e));this._resource=t.resource??kt(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new Xn(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Yn({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.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=Q.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Q.timeout&&(r=Q.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Q.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Q.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},Qn=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Me(e.startTime),duration:Me(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:j.SUCCESS})}},$n=class{_enabled=!1;_currentContext=d;_bindFunction(e=d,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=d,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=d,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||d;try{return t.call(n,...r)}finally{this._currentContext=i}}};function er(e){if(e!==null){if(e===void 0){let e=new $n;e.enable(),s.setGlobalContextManager(e);return}e.enable(),s.setGlobalContextManager(e)}}function tr(e){if(e!==null){if(e===void 0){c.setGlobalPropagator(new Ie({propagators:[new Qe,new ue]}));return}c.setGlobalPropagator(e)}}var nr=class extends Zn{constructor(e={}){super(e)}register(e={}){l.setGlobalTracerProvider(this),tr(e.propagator),er(e.contextManager)}},$;function rr(e){if($||!(e.enabled??!!e.otlpEndpoint))return!1;let t=e.otlpEndpoint?new xn({url:e.otlpEndpoint,...e.otlpHeaders?{headers:e.otlpHeaders}:{}}):new Qn;return $=new nr({resource:Ot({[Ce]:e.serviceName,[we]:e.serviceVersion??`0.0.0`}),spanProcessors:[new Mn(t)]}),$.register(),!0}export{rr as initObservabilityWeb};
2
- //# sourceMappingURL=web-Dr6mdA1A.js.map
1
+ import{Ct as e,Dt as t,Et as n,St as r,Tt as i,_t as a,bt as o,gt as s,ht as c,mt as l,vt as u,wt as d,xt as ee,yt as f}from"./index-DojEUBpq.js";var p;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(p||={});var m=t.instance(),h=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()}},g=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function _(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function v(e){if(e!=null)return async()=>e}function te(e,t,n){return{timeoutMillis:_(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function ne(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var y=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 re(e){return new y(e.concurrencyLimit)}var ie=i(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function ae(e){return e.setValue(ie,!0)}function b(e){return e.getValue(ie)===!0}var x=`baggage`,oe=4096;function se(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function ce(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 le(e){if(!e)return;let t=e.indexOf(`;`),r=t===-1?e:e.substring(0,t),i=r.indexOf(`=`);if(i<=0)return;let a=r.substring(0,i).trim(),o=r.substring(i+1).trim();if(!a||!o)return;let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch{return}let l;return t!==-1&&t<e.length-1&&(l=n(e.substring(t+1))),{key:s,value:c,metadata:l}}var ue=class{inject(e,t,n){let r=c.getBaggage(e);if(!r||b(e))return;let i=se(ce(r).filter(e=>e.length<=oe).slice(0,180));i.length>0&&n.set(t,x,i)}extract(e,t,n){let r=n.get(t,x),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=le(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:c.setBaggage(e,c.createBaggage(a))}fields(){return[x]}};function S(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!de(n)){m.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!fe(r)){m.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function de(e){return typeof e==`string`&&e!==``}function fe(e){return e==null?!0:Array.isArray(e)?pe(e):me(typeof e)}function pe(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(me(e)){t=e;continue}return!1}return!1}}return!0}function me(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function he(){return e=>{m.error(ge(e))}}function ge(e){return typeof e==`string`?e:JSON.stringify(_e(e))}function _e(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 ve=he();function C(e){try{ve(e)}catch{}}var ye=`2.7.0`,be=`exception.message`,xe=`exception.stacktrace`,Se=`exception.type`,Ce=`service.name`,we=`service.version`,w=`telemetry.sdk.language`,Te=`webjs`,T=`telemetry.sdk.name`,E=`telemetry.sdk.version`,Ee=`process.runtime.name`,D={[T]:`opentelemetry`,[Ee]:`browser`,[w]:Te,[E]:ye},O=performance,De=9,Oe=10**6,k=10**De;function A(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Oe)]}function ke(e){return Fe(A(O.timeOrigin),A(typeof e==`number`?e:O.now()))}function Ae(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=k),[n,r]}function je(e){return e[0]*k+e[1]}function Me(e){return e[0]*1e6+e[1]/1e3}function Ne(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Pe(e){return Ne(e)||typeof e==`number`||e instanceof Date}function Fe(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=k&&(n[1]-=k,n[0]+=1),n}var j;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(j||={});var Ie=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(e=>typeof e.fields==`function`?e.fields():[]).reduce((e,t)=>e.concat(t),[])))}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){m.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){m.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},M=`[_0-9a-z-*/]`,Le=`[a-z]${M}{0,255}`,Re=`[a-z0-9]${M}{0,240}@[a-z]${M}{0,13}`,ze=RegExp(`^(?:${Le}|${Re})$`),Be=/^[ -~]{0,255}[!-~]$/,Ve=/,|=/;function He(e){return ze.test(e)}function Ue(e){return Be.test(e)&&!Ve.test(e)}var We=32,Ge=512,Ke=`,`,qe=`=`,Je=class e{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,t){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,t),n}unset(e){let t=this._clone();return t._internalState.delete(e),t}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,t)=>(e.push(t+qe+this.get(t)),e),[]).join(Ke)}_parse(e){e.length>Ge||(this._internalState=e.split(Ke).reverse().reduce((e,t)=>{let n=t.trim(),r=n.indexOf(qe);if(r!==-1){let i=n.slice(0,r),a=n.slice(r+1,t.length);He(i)&&Ue(a)&&e.set(i,a)}return e},new Map),this._internalState.size>We&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,We))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let t=new e;return t._internalState=new Map(this._internalState),t}},N=`traceparent`,P=`tracestate`,Ye=`00`,Xe=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function Ze(e){let t=Xe.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Qe=class{inject(e,t,n){let i=l.getSpanContext(e);if(!i||b(e)||!f(i))return;let a=`${Ye}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||r.NONE).toString(16)}`;n.set(t,N,a),i.traceState&&n.set(t,P,i.traceState.serialize())}extract(e,t,n){let r=n.get(t,N);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Ze(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,P);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Je(typeof e==`string`?e:void 0)}return l.setSpanContext(e,a)}fields(){return[N,P]}},$e=`[object Object]`,et=`[object Null]`,tt=`[object Undefined]`,nt=Function.prototype.toString,rt=nt.call(Object),it=Object.getPrototypeOf,at=Object.prototype,ot=at.hasOwnProperty,F=Symbol?Symbol.toStringTag:void 0,st=at.toString;function ct(e){if(!lt(e)||ut(e)!==$e)return!1;let t=it(e);if(t===null)return!0;let n=ot.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&nt.call(n)===rt}function lt(e){return typeof e==`object`&&!!e}function ut(e){return e==null?e===void 0?tt:et:F&&F in Object(e)?dt(e):ft(e)}function dt(e){let t=ot.call(e,F),n=e[F],r=!1;try{e[F]=void 0,r=!0}catch{}let i=st.call(e);return r&&(t?e[F]=n:delete e[F]),i}function ft(e){return st.call(e)}var pt=20;function mt(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ht(t,e.shift(),0,n);return t}function I(e){return L(e)?e.slice():e}function ht(e,t,n=0,r){let i;if(!(n>pt)){if(n++,z(e)||z(t)||_t(t))i=I(t);else if(L(e)){if(i=e.slice(),L(t))for(let e=0,n=t.length;e<n;e++)i.push(I(t[e]));else if(R(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]=I(t[r]))}}}else if(R(e))if(R(t)){if(!vt(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(z(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(gt(e,s,r)||gt(t,s,r))delete i[s];else{if(R(a)&&R(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]=ht(i[s],c,n,r)}}}}else i=t;return i}}function gt(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 L(e){return Array.isArray(e)}function _t(e){return typeof e==`function`}function R(e){return!z(e)&&!L(e)&&!_t(e)&&typeof e==`object`}function z(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function vt(e,t){return!(!ct(e)||!ct(t))}var yt=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)}},bt=class{_isCalled=!1;_deferred=new yt;_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 xt(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function St(){return{handleResponse(e){e==null||!xt(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||m.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var Ct=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=m.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:j.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:j.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:j.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:j.FAILED,error:e.error});return}else e.status===`retryable`?t({code:j.FAILED,error:e.error??new g(`Export failed with retryable status`)}):t({code:j.FAILED,error:new g(`Export failed with unknown error`)})},e=>t({code:j.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function wt(e,t){return new Ct(e.transport,e.serializer,St(),e.promiseHandler,t.timeout)}function Tt(e,t,n){return wt({transport:n,serializer:t,promiseHandler:re(e)},{timeout:e.timeoutMillis})}var B;function Et(){if(B===void 0)try{let e=globalThis.process.argv0;B=e?`unknown_service:${e}`:`unknown_service`}catch{B=`unknown_service`}return B}var V=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Dt=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=At(t),r._asyncAttributesPending=t.filter(([e,t])=>V(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(V(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=At(this._rawAttributes),this._schemaUrl=jt(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,V(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&m.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(V(n)){m.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=Mt(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ot(e,t){return Dt.FromAttributeList(Object.entries(e),t)}function kt(){return Ot({[Ce]:Et(),[w]:D[w],[T]:D[T],[E]:D[E]})}function At(e){return e.map(([e,t])=>V(t)?[e,t.catch(t=>{m.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function jt(e){if(typeof e==`string`||e===void 0)return e;m.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Mt(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;m.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}function Nt(e,t){let n={attributes:H(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Pt(e){return{name:e.name,version:e.version}}function H(e,t){return Object.keys(e).map(n=>Ft(n,e[n],t))}function Ft(e,t,n){return{key:e,value:U(t,n)}}function U(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=U(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:U(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}function It(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Lt(e){return It(e).toString()}var Rt=typeof BigInt<`u`?Lt:je;function zt(e){return e}var Bt={encodeHrTime:Rt,encodeSpanContext:zt,encodeOptionalSpanContext:zt,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}},Vt=256,Ht=512;function Ut(e,t){let n=e&255|Vt;return t&&(n|=Ht),n}function Wt(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:H(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Kt(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Gt(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Ut(n.traceFlags,e.parentSpanContext?.isRemote)}}function Gt(e,t){return{attributes:e.attributes?H(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Ut(e.context.traceFlags,e.context.isRemote)}}function Kt(e,t){return{attributes:e.attributes?H(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function qt(e,t){return{resourceSpans:Yt(e,t)}}function Jt(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 Yt(e,t){let n=Jt(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=>Wt(e,t));o.push({scope:Pt(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Nt(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var Xt={serializeRequest:e=>{let t=qt(e,Bt);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return m.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},W=5,Zt=1e3,Qt=5e3,$t=1.5,en=.2;function tn(){return 2*en*Math.random()-en}var nn=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=W,r=Zt,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+tn()),Qt),0);r*=$t;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return m.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;m.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?m.verbose(`Export succeeded after ${W-n} retry attempts.`):a.status===`retryable`?m.info(`Export failed after maximum retry attempts (${W}).`):m.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function rn(e){return new nn(e.transport)}function an(e){return e===429||e===502||e===503||e===504}function on(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 sn=60*1024,cn=9,G=0,K=0,ln=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=G+a>sn,s=!o&&!(K>=cn);if(s)G+=a,K++;else{let e=o?`size limit`:`count limit`;m.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${K} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(m.debug(`export response success (status: ${r.status})`),{status:`success`}):an(r.status)?(m.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:on(r.headers.get(`Retry-After`))}):(m.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return dn(e)?(m.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(m.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(G-=a,K--)}}shutdown(){}};function un(e){return new ln(e)}function dn(e){return e instanceof TypeError&&!e.cause}function fn(e,t){return Tt(e,t,rn({transport:un(e)}))}function pn(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?m.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function mn(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,pn(await e())),Object.assign(i,r)}}function hn(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 gn(e,t,n){return{...te(e,t,n),headers:mn(e.headers,t.headers,n.headers),url:hn(e.url)??t.url??n.url}}function _n(e,t){return{...ne(),headers:async()=>e,url:`http://localhost:4318/`+t}}function vn(e){return typeof e.headers==`function`?e.headers:v(e.headers)}function yn(e,t,n){return gn({url:e.url,timeoutMillis:e.timeoutMillis,headers:vn(e),concurrencyLimit:e.concurrencyLimit},{},_n(n,t))}function bn(e,t,n,r){return fn(yn(e,n,r),t)}var xn=class extends h{constructor(e={}){super(bn(e,Xt,`v1/traces`,{"Content-Type":`application/json`}))}},Sn=`exception`,Cn=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:a.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=O.now(),this._performanceOffset=t-(this._performanceStartTime+O.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 m.warn(`Invalid attribute key: ${e}`),this;if(!fe(t))return m.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 m.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&m.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Pe(t)&&(Pe(n)||(n=t),t=void 0);let i=S(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&&m.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=S(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===a.UNSET||this.status.code===a.OK)return this;let t={code:e.code};return e.code===a.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&m.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()){m.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=Ae(this.startTime,this.endTime),this._duration[0]<0&&(m.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&&m.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&m.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<=O.now())return ke(e+this._performanceOffset);if(typeof e==`number`)return A(e);if(e instanceof Date)return A(e.getTime());if(Ne(e))return e;if(this._startTimeProvided)return A(Date.now());let t=O.now()-this._performanceStartTime;return Fe(this.startTime,A(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[be]=e:e&&(e.code?n[Se]=e.code.toString():e.name&&(n[Se]=e.name),e.message&&(n[be]=e.message),e.stack&&(n[xe]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Sn,n,t):m.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}}`);m.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?(m.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}},q;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(q||={});var J=class{shouldSample(){return{decision:q.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Y=class{shouldSample(){return{decision:q.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},X=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(C(Error(`ParentBasedSampler must have a root sampler configured`)),new Y),this._remoteParentSampled=e.remoteParentSampled??new Y,this._remoteParentNotSampled=e.remoteParentNotSampled??new J,this._localParentSampled=e.localParentSampled??new Y,this._localParentNotSampled=e.localParentNotSampled??new J}shouldSample(e,t,n,i,a,o){let s=l.getSpanContext(e);return!s||!f(s)?this._root.shouldSample(e,t,n,i,a,o):s.isRemote?s.traceFlags&r.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,i,a,o):this._remoteParentNotSampled.shouldSample(e,t,n,i,a,o):s.traceFlags&r.SAMPLED?this._localParentSampled.shouldSample(e,t,n,i,a,o):this._localParentNotSampled.shouldSample(e,t,n,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()}}`}},wn=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:o(t)&&this._accumulate(t)<this._upperBound?q.RECORD_AND_SAMPLED:q.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<e.length/8;n++){let r=n*8,i=parseInt(e.slice(r,r+8),16);t=(t^i)>>>0}return t}},Z;(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`})(Z||={});var Tn=1;function En(){return{sampler:Dn(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Dn(){let e=Z.ParentBasedAlwaysOn;switch(e){case Z.AlwaysOn:return new Y;case Z.AlwaysOff:return new J;case Z.ParentBasedAlwaysOn:return new X({root:new Y});case Z.ParentBasedAlwaysOff:return new X({root:new J});case Z.TraceIdRatio:return new wn(On());case Z.ParentBasedTraceIdRatio:return new X({root:new wn(On())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Z.ParentBasedAlwaysOn}".`),new X({root:new Y})}}function On(){return m.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Tn}.`),Tn}function kn(e){let t={sampler:Dn()},n=En(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function An(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 jn=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new bt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(m.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&r.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&m.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(m.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);s.with(ae(s.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,r=>{clearTimeout(n),r.code===j.SUCCESS?e():t(r.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=>{C(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,C(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)}},Mn=class extends jn{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{C(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{C(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))}},Nn=16,Pn=8,Fn=new Uint8Array(Nn),In=new Uint8Array(Pn),Ln=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Rn(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 zn(e){let t=``;for(let n=0;n<e.length;n++)t+=Ln[e[n]];return t}var Bn=class{generateTraceId(){return Rn(Fn),zn(Fn)}generateSpanId(){return Rn(In),zn(In)}},Vn=`otel.span.parent.origin`,Hn=`otel.span.sampling_result`,Un=`otel.sdk.span.live`,Wn=`otel.sdk.span.started`,Gn=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Wn,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(Un,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=qn(t);if(this.startedSpans.add(1,{[Vn]:Kn(e),[Hn]:n}),t===q.NOT_RECORD)return()=>{};let r={[Hn]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Kn(e){return e?e.isRemote?`remote`:`local`:`none`}function qn(e){switch(e){case q.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case q.RECORD:return`RECORD_ONLY`;case q.NOT_RECORD:return`DROP`}}var Jn=`2.7.0`,Yn=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(t,n,r,i){let a=kn(n);this._sampler=a.sampler,this._generalLimits=a.generalLimits,this._spanLimits=a.spanLimits,this._idGenerator=n.idGenerator||new Bn,this._resource=r,this._spanProcessor=i,this.instrumentationScope=t;let o=a.meterProvider?a.meterProvider.getMeter(`@opentelemetry/sdk-trace`,Jn):e();this._tracerMetrics=new Gn(o)}startSpan(e,t={},n=s.active()){t.root&&(n=l.deleteSpan(n));let i=l.getSpan(n);if(b(n))return m.debug(`Instrumentation suppressed, returning Noop Span`),l.wrapSpanContext(ee);let a=i?.spanContext(),o=this._idGenerator.generateSpanId(),c,d,f;!a||!l.isSpanContextValid(a)?d=this._idGenerator.generateTraceId():(d=a.traceId,f=a.traceState,c=a);let h=t.kind??u.INTERNAL,g=(t.links??[]).map(e=>({context:e.context,attributes:S(e.attributes)})),_=S(t.attributes),v=this._sampler.shouldSample(n,d,e,h,_,g),te=this._tracerMetrics.startSpan(a,v.decision);f=v.traceState??f;let ne=v.decision===p.RECORD_AND_SAMPLED?r.SAMPLED:r.NONE,y={traceId:d,spanId:o,traceFlags:ne,traceState:f};if(v.decision===p.NOT_RECORD)return m.debug(`Recording is off, propagating context in a non-recording span`),l.wrapSpanContext(y);let re=S(Object.assign(_,v.attributes));return new Cn({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:h,links:g,parentSpanContext:c,attributes:re,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 c=a??s.active(),u=this.startSpan(e,i,c),d=l.setSpan(c,u);return s.with(d,o,void 0,u)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Xn=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=>{C(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)})}},Q;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Q||={});var Zn=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=mt({},En(),An(e));this._resource=t.resource??kt(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new Xn(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Yn({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.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=Q.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Q.timeout&&(r=Q.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Q.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Q.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},Qn=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Me(e.startTime),duration:Me(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:j.SUCCESS})}},$n=class{_enabled=!1;_currentContext=d;_bindFunction(e=d,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=d,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=d,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||d;try{return t.call(n,...r)}finally{this._currentContext=i}}};function er(e){if(e!==null){if(e===void 0){let e=new $n;e.enable(),s.setGlobalContextManager(e);return}e.enable(),s.setGlobalContextManager(e)}}function tr(e){if(e!==null){if(e===void 0){c.setGlobalPropagator(new Ie({propagators:[new Qe,new ue]}));return}c.setGlobalPropagator(e)}}var nr=class extends Zn{constructor(e={}){super(e)}register(e={}){l.setGlobalTracerProvider(this),tr(e.propagator),er(e.contextManager)}},$;function rr(e){if($||!(e.enabled??!!e.otlpEndpoint))return!1;let t=e.otlpEndpoint?new xn({url:e.otlpEndpoint,...e.otlpHeaders?{headers:e.otlpHeaders}:{}}):new Qn;return $=new nr({resource:Ot({[Ce]:e.serviceName,[we]:e.serviceVersion??`0.0.0`}),spanProcessors:[new Mn(t)]}),$.register(),!0}export{rr as initObservabilityWeb};
2
+ //# sourceMappingURL=web-DAgGdiC_.js.map