@semiont/cli 0.4.14 → 0.4.15

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 (127) hide show
  1. package/dist/cli.mjs +15470 -4962
  2. package/dist/frontend/dist/assets/{ArrowsRightLeftIcon-CMDe963r.js → ArrowsRightLeftIcon-BzLgl5o9.js} +2 -2
  3. package/dist/frontend/dist/assets/{ArrowsRightLeftIcon-CMDe963r.js.map → ArrowsRightLeftIcon-BzLgl5o9.js.map} +1 -1
  4. package/dist/frontend/dist/assets/{ChevronLeftIcon-CMXd_XZQ.js → ChevronLeftIcon-BLyRNZuL.js} +2 -2
  5. package/dist/frontend/dist/assets/{ChevronLeftIcon-CMXd_XZQ.js.map → ChevronLeftIcon-BLyRNZuL.js.map} +1 -1
  6. package/dist/frontend/dist/assets/{CommandLineIcon-BBerq9Nd.js → CommandLineIcon-Ba4gpk8e.js} +2 -2
  7. package/dist/frontend/dist/assets/{CommandLineIcon-BBerq9Nd.js.map → CommandLineIcon-Ba4gpk8e.js.map} +1 -1
  8. package/dist/frontend/dist/assets/{CookiePreferences-Cbur0STI.js → CookiePreferences-CO_BNHwm.js} +2 -2
  9. package/dist/frontend/dist/assets/{CookiePreferences-Cbur0STI.js.map → CookiePreferences-CO_BNHwm.js.map} +1 -1
  10. package/dist/frontend/dist/assets/PdfAnnotationCanvas.client-CHDCGQBR-BLaEAPe0.js +2 -0
  11. package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-CW6SKH2U-DIkAGn7X.js.map → PdfAnnotationCanvas.client-CHDCGQBR-BLaEAPe0.js.map} +1 -1
  12. package/dist/frontend/dist/assets/StreamStatusContext-BNiTXRfJ.js +2 -0
  13. package/dist/frontend/dist/assets/{StreamStatusContext-BuPATpTz.js.map → StreamStatusContext-BNiTXRfJ.js.map} +1 -1
  14. package/dist/frontend/dist/assets/ToolbarPanels-DRHyLUHl.js +2 -0
  15. package/dist/frontend/dist/assets/ToolbarPanels-DRHyLUHl.js.map +1 -0
  16. package/dist/frontend/dist/assets/{XMarkIcon-6m9KVFaj.js → XMarkIcon-KMKD47CF.js} +2 -2
  17. package/dist/frontend/dist/assets/{XMarkIcon-6m9KVFaj.js.map → XMarkIcon-KMKD47CF.js.map} +1 -1
  18. package/dist/frontend/dist/assets/{browser-ponyfill-DkbQZCyF.js → browser-ponyfill-D2ngVqWO.js} +2 -2
  19. package/dist/frontend/dist/assets/{browser-ponyfill-DkbQZCyF.js.map → browser-ponyfill-D2ngVqWO.js.map} +1 -1
  20. package/dist/frontend/dist/assets/client-RpFyflU_.js +2 -0
  21. package/dist/frontend/dist/assets/{client-BiL3eI7d.js.map → client-RpFyflU_.js.map} +1 -1
  22. package/dist/frontend/dist/assets/{client-BnL1es01.js → client-bqO7W1Xj.js} +2 -2
  23. package/dist/frontend/dist/assets/{client-BnL1es01.js.map → client-bqO7W1Xj.js.map} +1 -1
  24. package/dist/frontend/dist/assets/{client-DrQUcCJy.js → client-ekxuarKC.js} +2 -2
  25. package/dist/frontend/dist/assets/{client-DrQUcCJy.js.map → client-ekxuarKC.js.map} +1 -1
  26. package/dist/frontend/dist/assets/{client-BPbsU2tc.js → client-xJTgSko3.js} +2 -2
  27. package/dist/frontend/dist/assets/{client-BPbsU2tc.js.map → client-xJTgSko3.js.map} +1 -1
  28. package/dist/frontend/dist/assets/{i18n-BYxb14hm.js → i18n-BbpF47i1.js} +2 -2
  29. package/dist/frontend/dist/assets/{i18n-BYxb14hm.js.map → i18n-BbpF47i1.js.map} +1 -1
  30. package/dist/frontend/dist/assets/{index-CNb3PHS7.css → index-BUe9tsov.css} +1 -1
  31. package/dist/frontend/dist/assets/index-XWcEpo5a.js +159 -0
  32. package/dist/frontend/dist/assets/index-XWcEpo5a.js.map +1 -0
  33. package/dist/frontend/dist/assets/layout-BFanPfv_.js +2 -0
  34. package/dist/frontend/dist/assets/layout-BFanPfv_.js.map +1 -0
  35. package/dist/frontend/dist/assets/layout-BN0UEIdX.js +2 -0
  36. package/dist/frontend/dist/assets/layout-BN0UEIdX.js.map +1 -0
  37. package/dist/frontend/dist/assets/layout-ChyKFPPP.js +2 -0
  38. package/dist/frontend/dist/assets/layout-ChyKFPPP.js.map +1 -0
  39. package/dist/frontend/dist/assets/layout-DmjP6diV.js +2 -0
  40. package/dist/frontend/dist/assets/layout-DmjP6diV.js.map +1 -0
  41. package/dist/frontend/dist/assets/{not-found-CwWw1pZc.js → not-found-BboGygIW.js} +2 -2
  42. package/dist/frontend/dist/assets/{not-found-CwWw1pZc.js.map → not-found-BboGygIW.js.map} +1 -1
  43. package/dist/frontend/dist/assets/page-8F47gNEm.js +2 -0
  44. package/dist/frontend/dist/assets/page-8F47gNEm.js.map +1 -0
  45. package/dist/frontend/dist/assets/page-8x98ZAYe.js +2 -0
  46. package/dist/frontend/dist/assets/{page-iSL5E639.js.map → page-8x98ZAYe.js.map} +1 -1
  47. package/dist/frontend/dist/assets/page-BaqIbrus.js +2 -0
  48. package/dist/frontend/dist/assets/{page-Deep7E5d.js.map → page-BaqIbrus.js.map} +1 -1
  49. package/dist/frontend/dist/assets/page-BfhPRgzq.js +2 -0
  50. package/dist/frontend/dist/assets/{page-ZBwMTeR-.js.map → page-BfhPRgzq.js.map} +1 -1
  51. package/dist/frontend/dist/assets/page-Bht4dePL.js +5 -0
  52. package/dist/frontend/dist/assets/{page-CelRTchO.js.map → page-Bht4dePL.js.map} +1 -1
  53. package/dist/frontend/dist/assets/page-BtqPeWyh.js +2 -0
  54. package/dist/frontend/dist/assets/page-BtqPeWyh.js.map +1 -0
  55. package/dist/frontend/dist/assets/{page-Dv386AZD.js → page-CG7C0ib3.js} +3 -3
  56. package/dist/frontend/dist/assets/{page-Dv386AZD.js.map → page-CG7C0ib3.js.map} +1 -1
  57. package/dist/frontend/dist/assets/page-CJnfSnRg.js +2 -0
  58. package/dist/frontend/dist/assets/page-CJnfSnRg.js.map +1 -0
  59. package/dist/frontend/dist/assets/page-Cct5hwIU.js +8 -0
  60. package/dist/frontend/dist/assets/{page-E99MPOn5.js.map → page-Cct5hwIU.js.map} +1 -1
  61. package/dist/frontend/dist/assets/page-CnJVZMgv.js +2 -0
  62. package/dist/frontend/dist/assets/page-CnJVZMgv.js.map +1 -0
  63. package/dist/frontend/dist/assets/page-CpbZG7nR.js +2 -0
  64. package/dist/frontend/dist/assets/{page-C5bIvv1V.js.map → page-CpbZG7nR.js.map} +1 -1
  65. package/dist/frontend/dist/assets/{page-D_nHe9FT.js → page-CzvERJKF.js} +2 -2
  66. package/dist/frontend/dist/assets/{page-D_nHe9FT.js.map → page-CzvERJKF.js.map} +1 -1
  67. package/dist/frontend/dist/assets/page-DB8grXzl.js +2 -0
  68. package/dist/frontend/dist/assets/{page-Zq6ARIvg.js.map → page-DB8grXzl.js.map} +1 -1
  69. package/dist/frontend/dist/assets/page-DI1MUp4X.js +2 -0
  70. package/dist/frontend/dist/assets/{page-xdXYx3nl.js.map → page-DI1MUp4X.js.map} +1 -1
  71. package/dist/frontend/dist/assets/{page-CslYhbgz.js → page-Dhi8hP-S.js} +2 -2
  72. package/dist/frontend/dist/assets/{page-CslYhbgz.js.map → page-Dhi8hP-S.js.map} +1 -1
  73. package/dist/frontend/dist/assets/{page-BmHLf-7O.js → page-FovvpNWp.js} +2 -2
  74. package/dist/frontend/dist/assets/{page-BmHLf-7O.js.map → page-FovvpNWp.js.map} +1 -1
  75. package/dist/frontend/dist/assets/{page-KtkB4tEv.js → page-T424mvNp.js} +2 -2
  76. package/dist/frontend/dist/assets/{page-KtkB4tEv.js.map → page-T424mvNp.js.map} +1 -1
  77. package/dist/frontend/dist/assets/{page-1BwlyTUj.js → page-knhbwxzQ.js} +2 -2
  78. package/dist/frontend/dist/assets/{page-1BwlyTUj.js.map → page-knhbwxzQ.js.map} +1 -1
  79. package/dist/frontend/dist/assets/privacy-B5TeXaed.js +2 -0
  80. package/dist/frontend/dist/assets/{privacy-DO1oxJpM.js.map → privacy-B5TeXaed.js.map} +1 -1
  81. package/dist/frontend/dist/assets/{query-ATBhtd3K.js → query-B6BuIB0M.js} +3 -3
  82. package/dist/frontend/dist/assets/{query-ATBhtd3K.js.map → query-B6BuIB0M.js.map} +1 -1
  83. package/dist/frontend/dist/assets/{routing-DMdXWYXo.js → routing-By_4TZHr.js} +2 -2
  84. package/dist/frontend/dist/assets/{routing-DMdXWYXo.js.map → routing-By_4TZHr.js.map} +1 -1
  85. package/dist/frontend/dist/assets/{routing-tJ_HbFRP.js → routing-vcvYfuPO.js} +2 -2
  86. package/dist/frontend/dist/assets/{routing-tJ_HbFRP.js.map → routing-vcvYfuPO.js.map} +1 -1
  87. package/dist/frontend/dist/assets/{vendor-EnoIVk-c.js → vendor-DJo4KD8w.js} +2 -2
  88. package/dist/frontend/dist/assets/{vendor-EnoIVk-c.js.map → vendor-DJo4KD8w.js.map} +1 -1
  89. package/dist/frontend/dist/index.html +5 -5
  90. package/dist/frontend/package.json +1 -1
  91. package/package.json +9 -9
  92. package/dist/frontend/dist/assets/PdfAnnotationCanvas.client-CW6SKH2U-DIkAGn7X.js +0 -2
  93. package/dist/frontend/dist/assets/StreamStatusContext-BuPATpTz.js +0 -2
  94. package/dist/frontend/dist/assets/ToolbarPanels-rN1MIRTV.js +0 -2
  95. package/dist/frontend/dist/assets/ToolbarPanels-rN1MIRTV.js.map +0 -1
  96. package/dist/frontend/dist/assets/client-BiL3eI7d.js +0 -2
  97. package/dist/frontend/dist/assets/en-IUV4ZXKH-BY1RKeLS.js +0 -135
  98. package/dist/frontend/dist/assets/en-IUV4ZXKH-BY1RKeLS.js.map +0 -1
  99. package/dist/frontend/dist/assets/index-DA31r_0s.js +0 -27
  100. package/dist/frontend/dist/assets/index-DA31r_0s.js.map +0 -1
  101. package/dist/frontend/dist/assets/layout-B8IinUdt.js +0 -2
  102. package/dist/frontend/dist/assets/layout-B8IinUdt.js.map +0 -1
  103. package/dist/frontend/dist/assets/layout-BjpW078f.js +0 -2
  104. package/dist/frontend/dist/assets/layout-BjpW078f.js.map +0 -1
  105. package/dist/frontend/dist/assets/layout-CDIjxs5a.js +0 -6
  106. package/dist/frontend/dist/assets/layout-CDIjxs5a.js.map +0 -1
  107. package/dist/frontend/dist/assets/layout-DKm9XdRr.js +0 -2
  108. package/dist/frontend/dist/assets/layout-DKm9XdRr.js.map +0 -1
  109. package/dist/frontend/dist/assets/page-BQ00VxR5.js +0 -2
  110. package/dist/frontend/dist/assets/page-BQ00VxR5.js.map +0 -1
  111. package/dist/frontend/dist/assets/page-C5bIvv1V.js +0 -2
  112. package/dist/frontend/dist/assets/page-CelRTchO.js +0 -5
  113. package/dist/frontend/dist/assets/page-Cf9cnqhC.js +0 -2
  114. package/dist/frontend/dist/assets/page-Cf9cnqhC.js.map +0 -1
  115. package/dist/frontend/dist/assets/page-DEjlNEY0.js +0 -2
  116. package/dist/frontend/dist/assets/page-DEjlNEY0.js.map +0 -1
  117. package/dist/frontend/dist/assets/page-DLtwpo78.js +0 -2
  118. package/dist/frontend/dist/assets/page-DLtwpo78.js.map +0 -1
  119. package/dist/frontend/dist/assets/page-Deep7E5d.js +0 -2
  120. package/dist/frontend/dist/assets/page-E99MPOn5.js +0 -8
  121. package/dist/frontend/dist/assets/page-ZBwMTeR-.js +0 -2
  122. package/dist/frontend/dist/assets/page-Zq6ARIvg.js +0 -2
  123. package/dist/frontend/dist/assets/page-iSL5E639.js +0 -2
  124. package/dist/frontend/dist/assets/page-xdXYx3nl.js +0 -2
  125. package/dist/frontend/dist/assets/privacy-DO1oxJpM.js +0 -2
  126. package/dist/frontend/dist/assets/useAuth-yUx5lBP5.js +0 -2
  127. package/dist/frontend/dist/assets/useAuth-yUx5lBP5.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e}from"./vendor-EnoIVk-c.js";function a({title:r,titleId:t,...o},n){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},o),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}const i=e.forwardRef(a);export{i as F};
2
- //# sourceMappingURL=ArrowsRightLeftIcon-CMDe963r.js.map
1
+ import{r as e}from"./vendor-DJo4KD8w.js";function a({title:r,titleId:t,...o},n){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},o),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}const i=e.forwardRef(a);export{i as F};
2
+ //# sourceMappingURL=ArrowsRightLeftIcon-BzLgl5o9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrowsRightLeftIcon-CMDe963r.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowsRightLeftIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowsRightLeftIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowsRightLeftIcon);\nexport default ForwardRef;"],"names":["ArrowsRightLeftIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef"],"mappings":"yCACA,SAASA,EAAoB,CAC3B,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,4EACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAmB","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"ArrowsRightLeftIcon-BzLgl5o9.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowsRightLeftIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowsRightLeftIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowsRightLeftIcon);\nexport default ForwardRef;"],"names":["ArrowsRightLeftIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef"],"mappings":"yCACA,SAASA,EAAoB,CAC3B,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,4EACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAmB","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./vendor-EnoIVk-c.js";function a({title:r,titleId:t,...n},o){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":t},n),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"}))}const l=e.forwardRef(a);function s({title:r,titleId:t,...n},o){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":t},n),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const c=e.forwardRef(s);export{l as F,c as a};
2
- //# sourceMappingURL=ChevronLeftIcon-CMXd_XZQ.js.map
1
+ import{r as e}from"./vendor-DJo4KD8w.js";function a({title:r,titleId:t,...n},o){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":t},n),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"}))}const l=e.forwardRef(a);function s({title:r,titleId:t,...n},o){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":t},n),r?e.createElement("title",{id:t},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const c=e.forwardRef(s);export{l as F,c as a};
2
+ //# sourceMappingURL=ChevronLeftIcon-BLyRNZuL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChevronLeftIcon-CMXd_XZQ.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/Bars3Icon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ChevronLeftIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction Bars3Icon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(Bars3Icon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ChevronLeftIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M15.75 19.5 8.25 12l7.5-7.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);\nexport default ForwardRef;"],"names":["Bars3Icon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef","ChevronLeftIcon"],"mappings":"yCACA,SAASA,EAAU,CACjB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,8CACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAS,ECvB3D,SAASQ,EAAgB,CACvB,MAAAP,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,6BACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBC,CAAe","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"ChevronLeftIcon-BLyRNZuL.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/Bars3Icon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ChevronLeftIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction Bars3Icon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(Bars3Icon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ChevronLeftIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M15.75 19.5 8.25 12l7.5-7.5\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ChevronLeftIcon);\nexport default ForwardRef;"],"names":["Bars3Icon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef","ChevronLeftIcon"],"mappings":"yCACA,SAASA,EAAU,CACjB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,8CACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAS,ECvB3D,SAASQ,EAAgB,CACvB,MAAAP,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,6BACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBC,CAAe","x_google_ignoreList":[0,1]}
@@ -1,2 +1,2 @@
1
- import{r as e}from"./vendor-EnoIVk-c.js";function a({title:r,titleId:o,...t},n){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":o},t),r?e.createElement("title",{id:o},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"}))}const s=e.forwardRef(a);export{s as F};
2
- //# sourceMappingURL=CommandLineIcon-BBerq9Nd.js.map
1
+ import{r as e}from"./vendor-DJo4KD8w.js";function a({title:r,titleId:o,...t},n){return e.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":o},t),r?e.createElement("title",{id:o},r):null,e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"}))}const s=e.forwardRef(a);export{s as F};
2
+ //# sourceMappingURL=CommandLineIcon-Ba4gpk8e.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandLineIcon-BBerq9Nd.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/CommandLineIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction CommandLineIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CommandLineIcon);\nexport default ForwardRef;"],"names":["CommandLineIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef"],"mappings":"yCACA,SAASA,EAAgB,CACvB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,uJACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAe","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"CommandLineIcon-Ba4gpk8e.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/CommandLineIcon.js"],"sourcesContent":["import * as React from \"react\";\nfunction CommandLineIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CommandLineIcon);\nexport default ForwardRef;"],"names":["CommandLineIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef"],"mappings":"yCACA,SAASA,EAAgB,CACvB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,uJACP,CAAG,CAAC,CACJ,CACK,MAACC,EAA2BC,EAAAA,WAAiBP,CAAe","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- import{j as e}from"./query-ATBhtd3K.js";import{r}from"./vendor-EnoIVk-c.js";import{g as v,C as N,e as k,s as C,d as E}from"./privacy-DO1oxJpM.js";import{u as D}from"./i18n-BYxb14hm.js";import{F as L,a as g}from"./XMarkIcon-6m9KVFaj.js";function R({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const M=r.forwardRef(R);function S({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const A=r.forwardRef(S);function F({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"}))}const $=r.forwardRef(F);function H({isOpen:a,onClose:n}){const{t:l}=D(),t=(s,i)=>l(`CookiePreferences.${s}`,i),[o,m]=r.useState(null),[d,u]=r.useState(!1),[b,x]=r.useState(!1),f=r.useRef(n);r.useEffect(()=>{f.current=n}),r.useEffect(()=>{if(a){const s=v();m(s||{necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:"1.0"})}},[a]),r.useEffect(()=>{if(!a)return;const s=i=>{i.key==="Escape"&&f.current()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[a]);const p=async()=>{o&&(u(!0),C(o),u(!1),n())},j=s=>{s==="necessary"||!o||m(i=>i?{...i,[s]:!i[s]}:null)},y=()=>{const s=k(),i=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),h=URL.createObjectURL(i),c=document.createElement("a");c.href=h,c.download=`semiont-user-data-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(h)},w=()=>{E()};return!a||!o?null:e.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[e.jsx("div",{className:"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75",onClick:n}),e.jsxs("div",{className:"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative",children:[e.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1","aria-label":"Close",children:e.jsx(L,{className:"h-6 w-6"})}),e.jsxs("div",{className:"sm:flex sm:items-start",children:[e.jsx("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10",children:e.jsx(A,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8",children:[e.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:t("title")}),e.jsx("div",{className:"mt-2",children:e.jsx("p",{className:"text-sm text-gray-500",children:t("description")})})]})]}),e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx($,{className:"h-5 w-5 text-green-500 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t("currentSettings")})]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:[e.jsx("p",{children:t("lastUpdated",{date:new Date(o.timestamp).toLocaleDateString()})}),e.jsx("p",{children:t("version",{version:o.version})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900",children:t("cookieCategories")}),N.map(s=>e.jsx("div",{className:"border border-gray-200 rounded-lg p-4",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{id:`pref-${s.id}`,type:"checkbox",checked:o[s.id]||!1,onChange:()=>j(s.id),disabled:s.required||d,className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50"}),e.jsxs("label",{htmlFor:`pref-${s.id}`,className:"ml-3 text-sm font-medium text-gray-900 cursor-pointer",children:[s.name,s.required&&e.jsx("span",{className:"text-xs text-gray-500 ml-1",children:t("required")})]})]}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:s.description}),e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800",children:t("viewCookies",{count:s.cookies.length})}),e.jsx("div",{className:"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2",children:e.jsx("ul",{className:"list-disc list-inside space-y-1",children:s.cookies.map(i=>e.jsx("li",{children:i},i))})})]})]})})},s.id))]}),e.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 mb-4",children:t("dataManagement")}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("button",{onClick:y,className:"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),t("exportMyData")]}),e.jsxs("button",{onClick:()=>x(!0),className:"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),t("deleteAllData")]})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-500",children:t("dataManagementDescription")})]})]})}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-2 justify-center",children:[e.jsx("button",{type:"button",onClick:()=>{m(s=>s?{...s,necessary:!0,analytics:!1,marketing:!1,preferences:!1}:null)},disabled:d,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors",children:t("rejectAll")}),e.jsx("button",{type:"button",onClick:()=>{m(s=>s?{...s,necessary:!0,analytics:!0,marketing:!0,preferences:!0}:null)},disabled:d,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors",children:t("acceptAll")})]}),e.jsxs("div",{className:"mt-6 sm:flex sm:flex-row-reverse",children:[e.jsx("button",{type:"button",onClick:p,disabled:d,className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50",children:t(d?"saving":"saveChanges")}),e.jsx("button",{type:"button",onClick:n,className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm",children:t("cancel")})]})]})]}),b&&e.jsx("div",{className:"fixed inset-0 z-60 overflow-y-auto",children:e.jsxs("div",{className:"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[e.jsx("div",{className:"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75"}),e.jsxs("div",{className:"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6",children:[e.jsxs("div",{className:"sm:flex sm:items-start",children:[e.jsx("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:e.jsx(g,{className:"h-6 w-6 text-red-600"})}),e.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[e.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:t("deleteConfirmTitle")}),e.jsx("div",{className:"mt-2",children:e.jsx("p",{className:"text-sm text-gray-500",children:t("deleteConfirmDescription")})})]})]}),e.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse",children:[e.jsx("button",{type:"button",onClick:w,className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm",children:t("deleteAllData")}),e.jsx("button",{type:"button",onClick:()=>x(!1),className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm",children:t("cancel")})]})]})]})})]})}export{H as C,$ as F};
2
- //# sourceMappingURL=CookiePreferences-Cbur0STI.js.map
1
+ import{j as e}from"./query-B6BuIB0M.js";import{r}from"./vendor-DJo4KD8w.js";import{g as v,C as N,e as k,s as C,d as E}from"./privacy-B5TeXaed.js";import{u as D}from"./i18n-BbpF47i1.js";import{F as L,a as g}from"./XMarkIcon-KMKD47CF.js";function R({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const M=r.forwardRef(R);function S({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495"}))}const A=r.forwardRef(S);function F({title:a,titleId:n,...l},t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},l),a?r.createElement("title",{id:n},a):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"}))}const $=r.forwardRef(F);function H({isOpen:a,onClose:n}){const{t:l}=D(),t=(s,i)=>l(`CookiePreferences.${s}`,i),[o,m]=r.useState(null),[d,u]=r.useState(!1),[b,x]=r.useState(!1),f=r.useRef(n);r.useEffect(()=>{f.current=n}),r.useEffect(()=>{if(a){const s=v();m(s||{necessary:!0,analytics:!1,marketing:!1,preferences:!1,timestamp:new Date().toISOString(),version:"1.0"})}},[a]),r.useEffect(()=>{if(!a)return;const s=i=>{i.key==="Escape"&&f.current()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[a]);const p=async()=>{o&&(u(!0),C(o),u(!1),n())},j=s=>{s==="necessary"||!o||m(i=>i?{...i,[s]:!i[s]}:null)},y=()=>{const s=k(),i=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),h=URL.createObjectURL(i),c=document.createElement("a");c.href=h,c.download=`semiont-user-data-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(h)},w=()=>{E()};return!a||!o?null:e.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[e.jsx("div",{className:"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75",onClick:n}),e.jsxs("div",{className:"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative",children:[e.jsx("button",{onClick:n,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1","aria-label":"Close",children:e.jsx(L,{className:"h-6 w-6"})}),e.jsxs("div",{className:"sm:flex sm:items-start",children:[e.jsx("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10",children:e.jsx(A,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8",children:[e.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:t("title")}),e.jsx("div",{className:"mt-2",children:e.jsx("p",{className:"text-sm text-gray-500",children:t("description")})})]})]}),e.jsx("div",{className:"mt-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx($,{className:"h-5 w-5 text-green-500 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t("currentSettings")})]}),e.jsxs("div",{className:"mt-2 text-xs text-gray-600",children:[e.jsx("p",{children:t("lastUpdated",{date:new Date(o.timestamp).toLocaleDateString()})}),e.jsx("p",{children:t("version",{version:o.version})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900",children:t("cookieCategories")}),N.map(s=>e.jsx("div",{className:"border border-gray-200 rounded-lg p-4",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{id:`pref-${s.id}`,type:"checkbox",checked:o[s.id]||!1,onChange:()=>j(s.id),disabled:s.required||d,className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50"}),e.jsxs("label",{htmlFor:`pref-${s.id}`,className:"ml-3 text-sm font-medium text-gray-900 cursor-pointer",children:[s.name,s.required&&e.jsx("span",{className:"text-xs text-gray-500 ml-1",children:t("required")})]})]}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:s.description}),e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"text-xs text-blue-600 cursor-pointer hover:text-blue-800",children:t("viewCookies",{count:s.cookies.length})}),e.jsx("div",{className:"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2",children:e.jsx("ul",{className:"list-disc list-inside space-y-1",children:s.cookies.map(i=>e.jsx("li",{children:i},i))})})]})]})})},s.id))]}),e.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[e.jsx("h4",{className:"text-base font-medium text-gray-900 mb-4",children:t("dataManagement")}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("button",{onClick:y,className:"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),t("exportMyData")]}),e.jsxs("button",{onClick:()=>x(!0),className:"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500",children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),t("deleteAllData")]})]}),e.jsx("p",{className:"mt-2 text-xs text-gray-500",children:t("dataManagementDescription")})]})]})}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-2 justify-center",children:[e.jsx("button",{type:"button",onClick:()=>{m(s=>s?{...s,necessary:!0,analytics:!1,marketing:!1,preferences:!1}:null)},disabled:d,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors",children:t("rejectAll")}),e.jsx("button",{type:"button",onClick:()=>{m(s=>s?{...s,necessary:!0,analytics:!0,marketing:!0,preferences:!0}:null)},disabled:d,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors",children:t("acceptAll")})]}),e.jsxs("div",{className:"mt-6 sm:flex sm:flex-row-reverse",children:[e.jsx("button",{type:"button",onClick:p,disabled:d,className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50",children:t(d?"saving":"saveChanges")}),e.jsx("button",{type:"button",onClick:n,className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm",children:t("cancel")})]})]})]}),b&&e.jsx("div",{className:"fixed inset-0 z-60 overflow-y-auto",children:e.jsxs("div",{className:"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[e.jsx("div",{className:"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75"}),e.jsxs("div",{className:"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6",children:[e.jsxs("div",{className:"sm:flex sm:items-start",children:[e.jsx("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:e.jsx(g,{className:"h-6 w-6 text-red-600"})}),e.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[e.jsx("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:t("deleteConfirmTitle")}),e.jsx("div",{className:"mt-2",children:e.jsx("p",{className:"text-sm text-gray-500",children:t("deleteConfirmDescription")})})]})]}),e.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse",children:[e.jsx("button",{type:"button",onClick:w,className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm",children:t("deleteAllData")}),e.jsx("button",{type:"button",onClick:()=>x(!1),className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm",children:t("cancel")})]})]})]})})]})}export{H as C,$ as F};
2
+ //# sourceMappingURL=CookiePreferences-CO_BNHwm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookiePreferences-Cbur0STI.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowDownTrayIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/CogIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ShieldCheckIcon.js","../../src/components/CookiePreferences.tsx"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowDownTrayIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowDownTrayIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction CogIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CogIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ShieldCheckIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ShieldCheckIcon);\nexport default ForwardRef;","\"use client\";\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n getCookieConsent,\n setCookieConsent,\n COOKIE_CATEGORIES,\n CookieConsent,\n exportUserData,\n deleteAllUserData,\n type CookieCategory\n} from '@/lib/cookies';\nimport {\n CogIcon,\n TrashIcon,\n ArrowDownTrayIcon,\n ShieldCheckIcon,\n XMarkIcon\n} from '@heroicons/react/24/outline';\n\ninterface CookiePreferencesProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function CookiePreferences({ isOpen, onClose }: CookiePreferencesProps) {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`CookiePreferences.${k}`, p as any) as string;\n const [consent, setConsent] = useState<CookieConsent | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n // Store callback in ref to avoid including in dependency arrays\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n });\n\n useEffect(() => {\n if (isOpen) {\n const currentConsent = getCookieConsent();\n setConsent(currentConsent || {\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: '1.0'\n });\n }\n }, [isOpen]);\n\n // Handle ESC key to close modal\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onCloseRef.current();\n }\n };\n\n document.addEventListener('keydown', handleEsc);\n return () => {\n document.removeEventListener('keydown', handleEsc);\n };\n }, [isOpen]);\n\n const handleSave = async () => {\n if (!consent) return;\n \n setIsLoading(true);\n setCookieConsent(consent);\n setIsLoading(false);\n onClose();\n };\n\n const handleCategoryToggle = (categoryId: keyof Omit<CookieConsent, 'timestamp' | 'version'>) => {\n if (categoryId === 'necessary' || !consent) return;\n \n setConsent(prev => prev ? {\n ...prev,\n [categoryId]: !prev[categoryId]\n } : null);\n };\n\n const handleExportData = () => {\n const data = exportUserData();\n const blob = new Blob([JSON.stringify(data, null, 2)], { \n type: 'application/json' \n });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `semiont-user-data-${new Date().toISOString().split('T')[0]}.json`;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n };\n\n const handleDeleteAllData = () => {\n deleteAllUserData();\n };\n\n if (!isOpen || !consent) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n {/* Background overlay */}\n <div \n className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\"\n onClick={onClose}\n />\n\n {/* Modal panel */}\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative\">\n {/* Close button in upper right */}\n <button\n onClick={onClose}\n className=\"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1\"\n aria-label=\"Close\"\n >\n <XMarkIcon className=\"h-6 w-6\" />\n </button>\n\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10\">\n <CogIcon className=\"h-6 w-6 text-blue-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('title')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('description')}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"mt-6\">\n <div className=\"space-y-6\">\n {/* Current consent info */}\n <div className=\"bg-gray-50 rounded-lg p-4\">\n <div className=\"flex items-center\">\n <ShieldCheckIcon className=\"h-5 w-5 text-green-500 mr-2\" />\n <span className=\"text-sm font-medium text-gray-900\">\n {t('currentSettings')}\n </span>\n </div>\n <div className=\"mt-2 text-xs text-gray-600\">\n <p>{t('lastUpdated', { date: new Date(consent.timestamp).toLocaleDateString() })}</p>\n <p>{t('version', { version: consent.version })}</p>\n </div>\n </div>\n\n {/* Cookie categories */}\n <div className=\"space-y-4\">\n <h4 className=\"text-base font-medium text-gray-900\">\n {t('cookieCategories')}\n </h4>\n \n {COOKIE_CATEGORIES.map((category: CookieCategory) => (\n <div key={category.id} className=\"border border-gray-200 rounded-lg p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1\">\n <div className=\"flex items-center\">\n <input\n id={`pref-${category.id}`}\n type=\"checkbox\"\n checked={consent[category.id] || false}\n onChange={() => handleCategoryToggle(category.id)}\n disabled={category.required || isLoading}\n className=\"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50\"\n />\n <label\n htmlFor={`pref-${category.id}`}\n className=\"ml-3 text-sm font-medium text-gray-900 cursor-pointer\"\n >\n {category.name}\n {category.required && (\n <span className=\"text-xs text-gray-500 ml-1\">{t('required')}</span>\n )}\n </label>\n </div>\n <p className=\"mt-1 text-sm text-gray-600\">\n {category.description}\n </p>\n <details className=\"mt-2\">\n <summary className=\"text-xs text-blue-600 cursor-pointer hover:text-blue-800\">\n {t('viewCookies', { count: category.cookies.length })}\n </summary>\n <div className=\"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2\">\n <ul className=\"list-disc list-inside space-y-1\">\n {category.cookies.map(cookie => (\n <li key={cookie}>{cookie}</li>\n ))}\n </ul>\n </div>\n </details>\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Data management section */}\n <div className=\"border-t border-gray-200 pt-6\">\n <h4 className=\"text-base font-medium text-gray-900 mb-4\">\n {t('dataManagement')}\n </h4>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <button\n onClick={handleExportData}\n className=\"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n >\n <ArrowDownTrayIcon className=\"h-4 w-4 mr-2\" />\n {t('exportMyData')}\n </button>\n\n <button\n onClick={() => setShowDeleteConfirm(true)}\n className=\"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500\"\n >\n <TrashIcon className=\"h-4 w-4 mr-2\" />\n {t('deleteAllData')}\n </button>\n </div>\n\n <p className=\"mt-2 text-xs text-gray-500\">\n {t('dataManagementDescription')}\n </p>\n </div>\n </div>\n </div>\n\n {/* Quick Actions */}\n <div className=\"mt-6 flex flex-wrap gap-2 justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('rejectAll')}\n </button>\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: true,\n marketing: true,\n preferences: true\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('acceptAll')}\n </button>\n </div>\n\n {/* Action buttons */}\n <div className=\"mt-6 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={isLoading}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50\"\n >\n {isLoading ? t('saving') : t('saveChanges')}\n </button>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n\n {/* Delete confirmation modal */}\n {showDeleteConfirm && (\n <div className=\"fixed inset-0 z-60 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n <div className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\" />\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6\">\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10\">\n <TrashIcon className=\"h-6 w-6 text-red-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('deleteConfirmTitle')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('deleteConfirmDescription')}\n </p>\n </div>\n </div>\n </div>\n <div className=\"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleDeleteAllData}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm\"\n >\n {t('deleteAllData')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(false)}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default CookiePreferences;"],"names":["ArrowDownTrayIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef","CogIcon","ShieldCheckIcon","CookiePreferences","isOpen","onClose","_t","useTranslation","k","p","consent","setConsent","useState","isLoading","setIsLoading","showDeleteConfirm","setShowDeleteConfirm","onCloseRef","useRef","useEffect","currentConsent","getCookieConsent","handleEsc","event","handleSave","setCookieConsent","handleCategoryToggle","categoryId","prev","handleExportData","data","exportUserData","blob","url","a","handleDeleteAllData","deleteAllUserData","jsxs","jsx","XMarkIcon","COOKIE_CATEGORIES","category","cookie","TrashIcon"],"mappings":"4OACA,SAASA,EAAkB,CACzB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,8GAC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B,EAAK,EACzC,UAAU,sQAET,WAAE,QAAQ,CAAA,CAAA,CACb,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EAEJ,CAEJ","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"CookiePreferences-CO_BNHwm.js","sources":["../../../../node_modules/@heroicons/react/24/outline/esm/ArrowDownTrayIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/CogIcon.js","../../../../node_modules/@heroicons/react/24/outline/esm/ShieldCheckIcon.js","../../src/components/CookiePreferences.tsx"],"sourcesContent":["import * as React from \"react\";\nfunction ArrowDownTrayIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ArrowDownTrayIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction CogIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M4.5 12a7.5 7.5 0 0 0 15 0m-15 0a7.5 7.5 0 1 1 15 0m-15 0H3m16.5 0H21m-1.5 0H12m-8.457 3.077 1.41-.513m14.095-5.13 1.41-.513M5.106 17.785l1.15-.964m11.49-9.642 1.149-.964M7.501 19.795l.75-1.3m7.5-12.99.75-1.3m-6.063 16.658.26-1.477m2.605-14.772.26-1.477m0 17.726-.26-1.477M10.698 4.614l-.26-1.477M16.5 19.794l-.75-1.299M7.5 4.205 12 12m6.894 5.785-1.149-.964M6.256 7.178l-1.15-.964m15.352 8.864-1.41-.513M4.954 9.435l-1.41-.514M12.002 12l-3.75 6.495\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(CogIcon);\nexport default ForwardRef;","import * as React from \"react\";\nfunction ShieldCheckIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(ShieldCheckIcon);\nexport default ForwardRef;","\"use client\";\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n getCookieConsent,\n setCookieConsent,\n COOKIE_CATEGORIES,\n CookieConsent,\n exportUserData,\n deleteAllUserData,\n type CookieCategory\n} from '@/lib/cookies';\nimport {\n CogIcon,\n TrashIcon,\n ArrowDownTrayIcon,\n ShieldCheckIcon,\n XMarkIcon\n} from '@heroicons/react/24/outline';\n\ninterface CookiePreferencesProps {\n isOpen: boolean;\n onClose: () => void;\n}\n\nexport function CookiePreferences({ isOpen, onClose }: CookiePreferencesProps) {\n const { t: _t } = useTranslation();\n const t = (k: string, p?: Record<string, unknown>) => _t(`CookiePreferences.${k}`, p as any) as string;\n const [consent, setConsent] = useState<CookieConsent | null>(null);\n const [isLoading, setIsLoading] = useState(false);\n const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);\n\n // Store callback in ref to avoid including in dependency arrays\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n });\n\n useEffect(() => {\n if (isOpen) {\n const currentConsent = getCookieConsent();\n setConsent(currentConsent || {\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false,\n timestamp: new Date().toISOString(),\n version: '1.0'\n });\n }\n }, [isOpen]);\n\n // Handle ESC key to close modal\n useEffect(() => {\n if (!isOpen) {\n return undefined;\n }\n\n const handleEsc = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onCloseRef.current();\n }\n };\n\n document.addEventListener('keydown', handleEsc);\n return () => {\n document.removeEventListener('keydown', handleEsc);\n };\n }, [isOpen]);\n\n const handleSave = async () => {\n if (!consent) return;\n \n setIsLoading(true);\n setCookieConsent(consent);\n setIsLoading(false);\n onClose();\n };\n\n const handleCategoryToggle = (categoryId: keyof Omit<CookieConsent, 'timestamp' | 'version'>) => {\n if (categoryId === 'necessary' || !consent) return;\n \n setConsent(prev => prev ? {\n ...prev,\n [categoryId]: !prev[categoryId]\n } : null);\n };\n\n const handleExportData = () => {\n const data = exportUserData();\n const blob = new Blob([JSON.stringify(data, null, 2)], { \n type: 'application/json' \n });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = `semiont-user-data-${new Date().toISOString().split('T')[0]}.json`;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n URL.revokeObjectURL(url);\n };\n\n const handleDeleteAllData = () => {\n deleteAllUserData();\n };\n\n if (!isOpen || !consent) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n {/* Background overlay */}\n <div \n className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\"\n onClick={onClose}\n />\n\n {/* Modal panel */}\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6 relative\">\n {/* Close button in upper right */}\n <button\n onClick={onClose}\n className=\"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 rounded-lg p-1\"\n aria-label=\"Close\"\n >\n <XMarkIcon className=\"h-6 w-6\" />\n </button>\n\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10\">\n <CogIcon className=\"h-6 w-6 text-blue-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left flex-1 pr-8\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('title')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('description')}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"mt-6\">\n <div className=\"space-y-6\">\n {/* Current consent info */}\n <div className=\"bg-gray-50 rounded-lg p-4\">\n <div className=\"flex items-center\">\n <ShieldCheckIcon className=\"h-5 w-5 text-green-500 mr-2\" />\n <span className=\"text-sm font-medium text-gray-900\">\n {t('currentSettings')}\n </span>\n </div>\n <div className=\"mt-2 text-xs text-gray-600\">\n <p>{t('lastUpdated', { date: new Date(consent.timestamp).toLocaleDateString() })}</p>\n <p>{t('version', { version: consent.version })}</p>\n </div>\n </div>\n\n {/* Cookie categories */}\n <div className=\"space-y-4\">\n <h4 className=\"text-base font-medium text-gray-900\">\n {t('cookieCategories')}\n </h4>\n \n {COOKIE_CATEGORIES.map((category: CookieCategory) => (\n <div key={category.id} className=\"border border-gray-200 rounded-lg p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1\">\n <div className=\"flex items-center\">\n <input\n id={`pref-${category.id}`}\n type=\"checkbox\"\n checked={consent[category.id] || false}\n onChange={() => handleCategoryToggle(category.id)}\n disabled={category.required || isLoading}\n className=\"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded-sm disabled:opacity-50\"\n />\n <label\n htmlFor={`pref-${category.id}`}\n className=\"ml-3 text-sm font-medium text-gray-900 cursor-pointer\"\n >\n {category.name}\n {category.required && (\n <span className=\"text-xs text-gray-500 ml-1\">{t('required')}</span>\n )}\n </label>\n </div>\n <p className=\"mt-1 text-sm text-gray-600\">\n {category.description}\n </p>\n <details className=\"mt-2\">\n <summary className=\"text-xs text-blue-600 cursor-pointer hover:text-blue-800\">\n {t('viewCookies', { count: category.cookies.length })}\n </summary>\n <div className=\"mt-1 text-xs text-gray-500 bg-gray-50 rounded-sm p-2\">\n <ul className=\"list-disc list-inside space-y-1\">\n {category.cookies.map(cookie => (\n <li key={cookie}>{cookie}</li>\n ))}\n </ul>\n </div>\n </details>\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Data management section */}\n <div className=\"border-t border-gray-200 pt-6\">\n <h4 className=\"text-base font-medium text-gray-900 mb-4\">\n {t('dataManagement')}\n </h4>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <button\n onClick={handleExportData}\n className=\"flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-xs text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n >\n <ArrowDownTrayIcon className=\"h-4 w-4 mr-2\" />\n {t('exportMyData')}\n </button>\n\n <button\n onClick={() => setShowDeleteConfirm(true)}\n className=\"flex items-center justify-center px-4 py-2 border border-red-300 rounded-md shadow-xs text-sm font-medium text-red-700 bg-white hover:bg-red-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500\"\n >\n <TrashIcon className=\"h-4 w-4 mr-2\" />\n {t('deleteAllData')}\n </button>\n </div>\n\n <p className=\"mt-2 text-xs text-gray-500\">\n {t('dataManagementDescription')}\n </p>\n </div>\n </div>\n </div>\n\n {/* Quick Actions */}\n <div className=\"mt-6 flex flex-wrap gap-2 justify-center\">\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: false,\n marketing: false,\n preferences: false\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('rejectAll')}\n </button>\n <button\n type=\"button\"\n onClick={() => {\n setConsent(prev => prev ? {\n ...prev,\n necessary: true,\n analytics: true,\n marketing: true,\n preferences: true\n } : null);\n }}\n disabled={isLoading}\n className=\"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-colors\"\n >\n {t('acceptAll')}\n </button>\n </div>\n\n {/* Action buttons */}\n <div className=\"mt-6 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={isLoading}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:opacity-50\"\n >\n {isLoading ? t('saving') : t('saveChanges')}\n </button>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n\n {/* Delete confirmation modal */}\n {showDeleteConfirm && (\n <div className=\"fixed inset-0 z-60 overflow-y-auto\">\n <div className=\"flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\">\n <div className=\"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75\" />\n <div className=\"inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6\">\n <div className=\"sm:flex sm:items-start\">\n <div className=\"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10\">\n <TrashIcon className=\"h-6 w-6 text-red-600\" />\n </div>\n <div className=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left\">\n <h3 className=\"text-lg leading-6 font-medium text-gray-900\">\n {t('deleteConfirmTitle')}\n </h3>\n <div className=\"mt-2\">\n <p className=\"text-sm text-gray-500\">\n {t('deleteConfirmDescription')}\n </p>\n </div>\n </div>\n </div>\n <div className=\"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse\">\n <button\n type=\"button\"\n onClick={handleDeleteAllData}\n className=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-xs px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm\"\n >\n {t('deleteAllData')}\n </button>\n <button\n type=\"button\"\n onClick={() => setShowDeleteConfirm(false)}\n className=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-xs px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-hidden focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm\"\n >\n {t('cancel')}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default CookiePreferences;"],"names":["ArrowDownTrayIcon","title","titleId","props","svgRef","React.createElement","ForwardRef","React.forwardRef","CogIcon","ShieldCheckIcon","CookiePreferences","isOpen","onClose","_t","useTranslation","k","p","consent","setConsent","useState","isLoading","setIsLoading","showDeleteConfirm","setShowDeleteConfirm","onCloseRef","useRef","useEffect","currentConsent","getCookieConsent","handleEsc","event","handleSave","setCookieConsent","handleCategoryToggle","categoryId","prev","handleExportData","data","exportUserData","blob","url","a","handleDeleteAllData","deleteAllUserData","jsxs","jsx","XMarkIcon","COOKIE_CATEGORIES","category","cookie","TrashIcon"],"mappings":"4OACA,SAASA,EAAkB,CACzB,MAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAGC,EAAQ,CACT,OAAoBC,gBAAoB,MAAO,OAAO,OAAO,CAC3D,MAAO,6BACP,KAAM,OACN,QAAS,YACT,YAAa,IACb,OAAQ,eACR,cAAe,OACf,YAAa,OACb,IAAKD,EACL,kBAAmBF,CACvB,EAAKC,CAAK,EAAGF,EAAqBI,EAAAA,cAAoB,QAAS,CAC3D,GAAIH,CACR,EAAKD,CAAK,EAAI,KAAmBI,EAAAA,cAAoB,OAAQ,CACzD,cAAe,QACf,eAAgB,QAChB,EAAG,8GACP,CAAG,CAAC,CACJ,CACA,MAAMC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,QAAQ,CAAA,CAAA,CACb,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EAEJ,CAEJ","x_google_ignoreList":[0,1,2]}
@@ -0,0 +1,2 @@
1
+ import{I as lt,J as dt}from"./index-XWcEpo5a.js";import{r as l}from"./vendor-DJo4KD8w.js";import{j as u}from"./query-B6BuIB0M.js";import"./i18n-BbpF47i1.js";function ut(t,d,s,o,a=1){const w=Math.min(t.startX,t.endX),j=Math.min(t.startY,t.endY),S=Math.max(t.startX,t.endX),b=Math.max(t.startY,t.endY),F=w/a,D=(S-w)/a,E=o-b/a,h=(b-j)/a;return{page:d,x:Math.round(F),y:Math.round(E),width:Math.round(D),height:Math.round(h)}}function J(t,d,s=1){const o=t.x*s,a=t.width*s,w=(d-t.y-t.height)*s,j=t.height*s;return{x:o,y:w,width:a,height:j}}function ht(t){return`page=${t.page}&viewrect=${t.x},${t.y},${t.width},${t.height}`}function V(t){try{const d=t.match(/page=(\d+)/);if(!d)return null;const s=parseInt(d[1],10),o=t.match(/viewrect=([\d.]+),([\d.]+),([\d.]+),([\d.]+)/);return o?{page:s,x:parseFloat(o[1]),y:parseFloat(o[2]),width:parseFloat(o[3]),height:parseFloat(o[4])}:null}catch{return null}}function ft(t){const d=t.match(/page=(\d+)/);return d?parseInt(d[1],10):null}async function gt(){return typeof window<"u"&&window.pdfjsLib?window.pdfjsLib:new Promise((t,d)=>{const s=document.createElement("script");s.src="/pdfjs/pdf.min.mjs",s.type="module",s.onload=()=>{const o=window.pdfjsLib;if(!o){d(new Error("PDF.js loaded but pdfjsLib not available"));return}o.GlobalWorkerOptions.workerSrc="/pdfjs/pdf.worker.min.mjs",t(o)},s.onerror=()=>{d(new Error("Failed to load PDF.js from /pdfjs/pdf.min.mjs"))},document.head.appendChild(s)})}async function mt(t){return(await gt()).getDocument({url:t}).promise}async function pt(t,d=1){const s=t.getViewport({scale:d}),o=document.createElement("canvas"),a=o.getContext("2d");if(!a)throw new Error("Failed to get 2D context");return o.width=s.width,o.height=s.height,await t.render({canvasContext:a,viewport:s}).promise,{dataUrl:o.toDataURL("image/png"),width:s.width,height:s.height}}function K(t){if(!t)return{stroke:"rgb(156, 163, 175)",fill:"rgba(156, 163, 175, 0.2)"};switch(t){case"highlighting":return{stroke:"rgb(250, 204, 21)",fill:"rgba(250, 204, 21, 0.3)"};case"linking":return{stroke:"rgb(59, 130, 246)",fill:"rgba(59, 130, 246, 0.2)"};case"assessing":return{stroke:"rgb(239, 68, 68)",fill:"rgba(239, 68, 68, 0.2)"};case"commenting":return{stroke:"rgb(255, 255, 255)",fill:"rgba(255, 255, 255, 0.2)"};default:return{stroke:"rgb(156, 163, 175)",fill:"rgba(156, 163, 175, 0.2)"}}}function xt({pdfUrl:t,existingAnnotations:d=[],drawingMode:s,selectedMotivation:o,eventBus:a,hoveredAnnotationId:w,selectedAnnotationId:j,hoverDelayMs:S=150}){const[b,F]=l.useState(null),[D,E]=l.useState(0),[h,W]=l.useState(1),[N,Q]=l.useState(null),[A,C]=l.useState(!0),[H,L]=l.useState(null),[f,Z]=l.useState(null),[m,U]=l.useState(null),[z]=l.useState(1.5),[M,v]=l.useState(!1),[r,y]=l.useState(null),B=l.useRef(null),g=l.useRef(null);l.useEffect(()=>{let e=!1;async function n(){try{C(!0),L(null);const c=await mt(t);if(e)return;F(c),E(c.numPages),C(!1)}catch(c){if(e)return;console.error("Error loading PDF:",c),L("Failed to load PDF"),C(!1)}}return n(),()=>{e=!0}},[t]),l.useEffect(()=>{if(!b)return;let e=!1;const n=b;async function c(){try{const i=await n.getPage(h);if(e)return;const p=i.getViewport({scale:1});Z({width:p.width,height:p.height});const{dataUrl:x}=await pt(i,z);if(e)return;Q(x)}catch(i){if(e)return;console.error("Error loading page:",i),L("Failed to load page")}}return c(),()=>{e=!0}},[b,h,z]),l.useEffect(()=>{const e=()=>{g.current&&U({width:g.current.clientWidth,height:g.current.clientHeight})};e();let n=null;try{n=new ResizeObserver(e),g.current&&n.observe(g.current)}catch{console.warn("ResizeObserver not supported, falling back to window resize listener"),window.addEventListener("resize",e)}return()=>{n?n.disconnect():window.removeEventListener("resize",e)}},[N]);const tt=l.useCallback(e=>{if(!s||!g.current)return;const n=g.current.getBoundingClientRect(),c=e.clientX-n.left,i=e.clientY-n.top;v(!0),y({startX:c,startY:i,endX:c,endY:i})},[s]),et=l.useCallback(e=>{if(!M||!r||!g.current)return;const n=g.current.getBoundingClientRect();y({...r,endX:e.clientX-n.left,endY:e.clientY-n.top})},[M,r]),nt=l.useCallback(()=>{if(!M||!r||!f||!m||!a){v(!1),y(null);return}if(Math.sqrt(Math.pow(r.endX-r.startX,2)+Math.pow(r.endY-r.startY,2))<10){if(d.length>0){const k=$.find(T=>{const Y=I(T.target);if(!Y)return!1;const _=V(Y.value);if(!_)return!1;const P=J(_,f.height,1),R=m.width/f.width,q=m.height/f.height,O=P.x*R,G=P.y*q,it=P.width*R,ct=P.height*q;return r.endX>=O&&r.endX<=O+it&&r.endY>=G&&r.endY<=G+ct});if(k){a==null||a.get("browse:click").next({annotationId:k.id,motivation:k.motivation}),v(!1),y(null);return}}v(!1),y(null);return}const c=f.width/m.width,i=f.height/m.height,p={startX:r.startX*c,startY:r.startY*i,endX:r.endX*c,endY:r.endY*i},x=ut(p,h,f.width,f.height,1),X=ht(x);o&&a.get("mark:requested").next({selector:{type:"FragmentSelector",conformsTo:"http://tools.ietf.org/rfc/rfc3778",value:X},motivation:o}),v(!1)},[M,r,h,f,m,o,d]),I=e=>{const n=lt(e);if(!n)return null;const i=(Array.isArray(n)?n:[n]).find(p=>p.type==="FragmentSelector");return!i||i.type!=="FragmentSelector"?null:i},$=d.filter(e=>{const n=I(e.target);return n?ft(n.value)===h:!1}),{handleMouseEnter:rt,handleMouseLeave:st}=l.useMemo(()=>dt(e=>a==null?void 0:a.get("beckon:hover").next({annotationId:e}),S),[a,S]),{stroke:ot,fill:at}=K(o??null);return H?u.jsx("div",{className:"semiont-pdf-annotation-canvas__error",children:H}):u.jsxs("div",{className:"semiont-pdf-annotation-canvas",children:[A&&u.jsx("div",{className:"semiont-pdf-annotation-canvas__loading",children:"Loading PDF..."}),u.jsxs("div",{ref:B,className:"semiont-pdf-annotation-canvas__container",style:{display:A?"none":void 0},onMouseDown:tt,onMouseMove:et,onMouseUp:nt,onMouseLeave:()=>{M&&(v(!1),y(null))},"data-drawing-mode":s||"none",children:[N&&u.jsx("img",{ref:g,src:N,alt:`PDF page ${h}`,className:"semiont-pdf-annotation-canvas__image",draggable:!1,style:{pointerEvents:"none"},onLoad:()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{g.current&&U({width:g.current.clientWidth,height:g.current.clientHeight})})})}}),m&&f&&u.jsx("div",{className:"semiont-pdf-annotation-canvas__overlay-container",children:u.jsx("div",{className:"semiont-pdf-annotation-canvas__overlay",children:u.jsxs("svg",{className:"semiont-pdf-annotation-canvas__svg",width:m.width,height:m.height,children:[$.map(e=>{const n=I(e.target);if(!n)return null;const c=V(n.value);if(!c)return null;const i=J(c,f.height,1),p=m.width/f.width,x=m.height/f.height,X=e.id===w,k=e.id===j,T=e.motivation,{stroke:Y,fill:_}=K(T);return u.jsx("rect",{x:i.x*p,y:i.y*x,width:i.width*p,height:i.height*x,stroke:Y,strokeWidth:k?4:X?3:2,fill:_,style:{pointerEvents:"auto",cursor:"pointer",opacity:k?1:X?.9:.7},onClick:()=>a==null?void 0:a.get("browse:click").next({annotationId:e.id,motivation:e.motivation}),onMouseEnter:()=>rt(e.id),onMouseLeave:st},e.id)}),r&&(()=>{const e=Math.min(r.startX,r.endX),n=Math.min(r.startY,r.endY),c=Math.abs(r.endX-r.startX),i=Math.abs(r.endY-r.startY);return u.jsx("rect",{x:e,y:n,width:c,height:i,stroke:ot,strokeWidth:2,strokeDasharray:"5,5",fill:at,pointerEvents:"none"})})()]})})})]}),D>0&&u.jsxs("div",{className:"semiont-pdf-annotation-canvas__controls",children:[u.jsx("button",{disabled:h<=1,onClick:()=>W(h-1),className:"semiont-pdf-annotation-canvas__button",children:"Previous"}),u.jsxs("span",{className:"semiont-pdf-annotation-canvas__page-info",children:["Page ",h," of ",D]}),u.jsx("button",{disabled:h>=D,onClick:()=>W(h+1),className:"semiont-pdf-annotation-canvas__button",children:"Next"})]})]})}export{xt as PdfAnnotationCanvas};
2
+ //# sourceMappingURL=PdfAnnotationCanvas.client-CHDCGQBR-BLaEAPe0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PdfAnnotationCanvas.client-CW6SKH2U-DIkAGn7X.js","sources":["../../../../packages/react-ui/dist/PdfAnnotationCanvas.client-CW6SKH2U.mjs"],"sourcesContent":["'use client';\n\"use client\";\nimport {\n createHoverHandlers\n} from \"./chunk-BQJWOK4C.mjs\";\nimport \"./chunk-HNZOXH4L.mjs\";\nimport \"./chunk-D4GAAQMM.mjs\";\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { useRef, useState, useCallback, useEffect, useMemo } from \"react\";\nimport { getTargetSelector } from \"@semiont/api-client\";\n\n// src/lib/pdf-coordinates.ts\nfunction canvasToPdfCoordinates(canvasRect, page, _pageWidth, pageHeight, scale = 1) {\n const x1 = Math.min(canvasRect.startX, canvasRect.endX);\n const y1 = Math.min(canvasRect.startY, canvasRect.endY);\n const x2 = Math.max(canvasRect.startX, canvasRect.endX);\n const y2 = Math.max(canvasRect.startY, canvasRect.endY);\n const pdfX = x1 / scale;\n const pdfWidth = (x2 - x1) / scale;\n const pdfY = pageHeight - y2 / scale;\n const pdfHeight = (y2 - y1) / scale;\n return {\n page,\n x: Math.round(pdfX),\n y: Math.round(pdfY),\n width: Math.round(pdfWidth),\n height: Math.round(pdfHeight)\n };\n}\nfunction pdfToCanvasCoordinates(pdfCoord, pageHeight, scale = 1) {\n const canvasX = pdfCoord.x * scale;\n const canvasWidth = pdfCoord.width * scale;\n const canvasY = (pageHeight - pdfCoord.y - pdfCoord.height) * scale;\n const canvasHeight = pdfCoord.height * scale;\n return {\n x: canvasX,\n y: canvasY,\n width: canvasWidth,\n height: canvasHeight\n };\n}\nfunction createFragmentSelector(coord) {\n return `page=${coord.page}&viewrect=${coord.x},${coord.y},${coord.width},${coord.height}`;\n}\nfunction parseFragmentSelector(fragment) {\n try {\n const pageMatch = fragment.match(/page=(\\d+)/);\n if (!pageMatch) return null;\n const page = parseInt(pageMatch[1], 10);\n const viewrectMatch = fragment.match(/viewrect=([\\d.]+),([\\d.]+),([\\d.]+),([\\d.]+)/);\n if (!viewrectMatch) return null;\n return {\n page,\n x: parseFloat(viewrectMatch[1]),\n y: parseFloat(viewrectMatch[2]),\n width: parseFloat(viewrectMatch[3]),\n height: parseFloat(viewrectMatch[4])\n };\n } catch {\n return null;\n }\n}\nfunction getPageFromFragment(fragment) {\n const match = fragment.match(/page=(\\d+)/);\n return match ? parseInt(match[1], 10) : null;\n}\n\n// src/lib/browser-pdfjs.ts\nasync function ensurePdfJs() {\n if (typeof window !== \"undefined\" && window.pdfjsLib) {\n return window.pdfjsLib;\n }\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"/pdfjs/pdf.min.mjs\";\n script.type = \"module\";\n script.onload = () => {\n const pdfjsLib = window.pdfjsLib;\n if (!pdfjsLib) {\n reject(new Error(\"PDF.js loaded but pdfjsLib not available\"));\n return;\n }\n pdfjsLib.GlobalWorkerOptions.workerSrc = \"/pdfjs/pdf.worker.min.mjs\";\n resolve(pdfjsLib);\n };\n script.onerror = () => {\n reject(new Error(\"Failed to load PDF.js from /pdfjs/pdf.min.mjs\"));\n };\n document.head.appendChild(script);\n });\n}\nasync function loadPdfDocument(url) {\n const pdfjsLib = await ensurePdfJs();\n const loadingTask = pdfjsLib.getDocument({ url });\n return loadingTask.promise;\n}\nasync function renderPdfPageToDataUrl(page, scale = 1) {\n const viewport = page.getViewport({ scale });\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"Failed to get 2D context\");\n }\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n const renderTask = page.render({\n canvasContext: context,\n viewport\n });\n await renderTask.promise;\n return {\n dataUrl: canvas.toDataURL(\"image/png\"),\n width: viewport.width,\n height: viewport.height\n };\n}\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nfunction getMotivationColor(motivation) {\n if (!motivation) {\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n switch (motivation) {\n case \"highlighting\":\n return { stroke: \"rgb(250, 204, 21)\", fill: \"rgba(250, 204, 21, 0.3)\" };\n case \"linking\":\n return { stroke: \"rgb(59, 130, 246)\", fill: \"rgba(59, 130, 246, 0.2)\" };\n case \"assessing\":\n return { stroke: \"rgb(239, 68, 68)\", fill: \"rgba(239, 68, 68, 0.2)\" };\n case \"commenting\":\n return { stroke: \"rgb(255, 255, 255)\", fill: \"rgba(255, 255, 255, 0.2)\" };\n default:\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n}\nfunction PdfAnnotationCanvas({\n pdfUrl,\n existingAnnotations = [],\n drawingMode,\n selectedMotivation,\n eventBus,\n hoveredAnnotationId,\n selectedAnnotationId,\n hoverDelayMs = 150\n}) {\n const [pdfDoc, setPdfDoc] = useState(null);\n const [numPages, setNumPages] = useState(0);\n const [pageNumber, setPageNumber] = useState(1);\n const [pageImageUrl, setPageImageUrl] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n const [pageDimensions, setPageDimensions] = useState(null);\n const [displayDimensions, setDisplayDimensions] = useState(null);\n const [scale] = useState(1.5);\n const [isDrawing, setIsDrawing] = useState(false);\n const [selection, setSelection] = useState(null);\n const containerRef = useRef(null);\n const imageRef = useRef(null);\n useEffect(() => {\n let cancelled = false;\n async function loadPdf() {\n try {\n setIsLoading(true);\n setError(null);\n const doc = await loadPdfDocument(pdfUrl);\n if (cancelled) return;\n setPdfDoc(doc);\n setNumPages(doc.numPages);\n setIsLoading(false);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading PDF:\", err);\n setError(\"Failed to load PDF\");\n setIsLoading(false);\n }\n }\n loadPdf();\n return () => {\n cancelled = true;\n };\n }, [pdfUrl]);\n useEffect(() => {\n if (!pdfDoc) return;\n let cancelled = false;\n const doc = pdfDoc;\n async function loadPage() {\n try {\n const page = await doc.getPage(pageNumber);\n if (cancelled) return;\n const viewport = page.getViewport({ scale: 1 });\n setPageDimensions({\n width: viewport.width,\n height: viewport.height\n });\n const { dataUrl } = await renderPdfPageToDataUrl(page, scale);\n if (cancelled) return;\n setPageImageUrl(dataUrl);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading page:\", err);\n setError(\"Failed to load page\");\n }\n }\n loadPage();\n return () => {\n cancelled = true;\n };\n }, [pdfDoc, pageNumber, scale]);\n useEffect(() => {\n const updateDisplayDimensions = () => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n };\n updateDisplayDimensions();\n let resizeObserver = null;\n try {\n resizeObserver = new ResizeObserver(updateDisplayDimensions);\n if (imageRef.current) {\n resizeObserver.observe(imageRef.current);\n }\n } catch (error2) {\n console.warn(\"ResizeObserver not supported, falling back to window resize listener\");\n window.addEventListener(\"resize\", updateDisplayDimensions);\n }\n return () => {\n if (resizeObserver) {\n resizeObserver.disconnect();\n } else {\n window.removeEventListener(\"resize\", updateDisplayDimensions);\n }\n };\n }, [pageImageUrl]);\n const handleMouseDown = useCallback((e) => {\n if (!drawingMode) return;\n if (!imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setIsDrawing(true);\n setSelection({\n startX: x,\n startY: y,\n endX: x,\n endY: y\n });\n }, [drawingMode]);\n const handleMouseMove = useCallback((e) => {\n if (!isDrawing || !selection || !imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n setSelection({\n ...selection,\n endX: e.clientX - rect.left,\n endY: e.clientY - rect.top\n });\n }, [isDrawing, selection]);\n const handleMouseUp = useCallback(() => {\n if (!isDrawing || !selection || !pageDimensions || !displayDimensions || !eventBus) {\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const dragDistance = Math.sqrt(\n Math.pow(selection.endX - selection.startX, 2) + Math.pow(selection.endY - selection.startY, 2)\n );\n const MIN_DRAG_DISTANCE = 10;\n if (dragDistance < MIN_DRAG_DISTANCE) {\n if (existingAnnotations.length > 0) {\n const clickedAnnotation = pageAnnotations.find((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const pdfCoord2 = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord2) return false;\n const rect = pdfToCanvasCoordinates(pdfCoord2, pageDimensions.height, 1);\n const scaleX2 = displayDimensions.width / pageDimensions.width;\n const scaleY2 = displayDimensions.height / pageDimensions.height;\n const displayX = rect.x * scaleX2;\n const displayY = rect.y * scaleY2;\n const displayWidth = rect.width * scaleX2;\n const displayHeight = rect.height * scaleY2;\n return selection.endX >= displayX && selection.endX <= displayX + displayWidth && selection.endY >= displayY && selection.endY <= displayY + displayHeight;\n });\n if (clickedAnnotation) {\n eventBus?.get(\"browse:click\").next({ annotationId: clickedAnnotation.id, motivation: clickedAnnotation.motivation });\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n }\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const scaleX = pageDimensions.width / displayDimensions.width;\n const scaleY = pageDimensions.height / displayDimensions.height;\n const nativeSelection = {\n startX: selection.startX * scaleX,\n startY: selection.startY * scaleY,\n endX: selection.endX * scaleX,\n endY: selection.endY * scaleY\n };\n const pdfCoord = canvasToPdfCoordinates(\n nativeSelection,\n pageNumber,\n pageDimensions.width,\n pageDimensions.height,\n 1\n // Use scale 1.0 since we already scaled to native coords\n );\n const fragmentSelector = createFragmentSelector(pdfCoord);\n if (selectedMotivation) {\n eventBus.get(\"mark:requested\").next({\n selector: {\n type: \"FragmentSelector\",\n conformsTo: \"http://tools.ietf.org/rfc/rfc3778\",\n value: fragmentSelector\n },\n motivation: selectedMotivation\n });\n }\n setIsDrawing(false);\n }, [isDrawing, selection, pageNumber, pageDimensions, displayDimensions, selectedMotivation, existingAnnotations]);\n const getFragmentSelector = (target) => {\n const selector = getTargetSelector(target);\n if (!selector) return null;\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find((s) => s.type === \"FragmentSelector\");\n if (!found || found.type !== \"FragmentSelector\") return null;\n return found;\n };\n const pageAnnotations = existingAnnotations.filter((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const page = getPageFromFragment(fragmentSel.value);\n return page === pageNumber;\n });\n const { handleMouseEnter, handleMouseLeave } = useMemo(\n () => createHoverHandlers((annotationId) => eventBus?.get(\"beckon:hover\").next({ annotationId }), hoverDelayMs),\n [eventBus, hoverDelayMs]\n );\n const { stroke, fill } = getMotivationColor(selectedMotivation ?? null);\n if (error) {\n return /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__error\", children: error });\n }\n return /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas\", children: [\n isLoading && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__loading\", children: \"Loading PDF...\" }),\n /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: containerRef,\n className: \"semiont-pdf-annotation-canvas__container\",\n style: { display: isLoading ? \"none\" : void 0 },\n onMouseDown: handleMouseDown,\n onMouseMove: handleMouseMove,\n onMouseUp: handleMouseUp,\n onMouseLeave: () => {\n if (isDrawing) {\n setIsDrawing(false);\n setSelection(null);\n }\n },\n \"data-drawing-mode\": drawingMode || \"none\",\n children: [\n pageImageUrl && /* @__PURE__ */ jsx(\n \"img\",\n {\n ref: imageRef,\n src: pageImageUrl,\n alt: `PDF page ${pageNumber}`,\n className: \"semiont-pdf-annotation-canvas__image\",\n draggable: false,\n style: { pointerEvents: \"none\" },\n onLoad: () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n });\n });\n }\n }\n ),\n displayDimensions && pageDimensions && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay-container\", children: /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay\", children: /* @__PURE__ */ jsxs(\n \"svg\",\n {\n className: \"semiont-pdf-annotation-canvas__svg\",\n width: displayDimensions.width,\n height: displayDimensions.height,\n children: [\n pageAnnotations.map((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return null;\n const pdfCoord = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord) return null;\n const rect = pdfToCanvasCoordinates(pdfCoord, pageDimensions.height, 1);\n const scaleX = displayDimensions.width / pageDimensions.width;\n const scaleY = displayDimensions.height / pageDimensions.height;\n const isHovered = ann.id === hoveredAnnotationId;\n const isSelected = ann.id === selectedAnnotationId;\n const annMotivation = ann.motivation;\n const { stroke: annStroke, fill: annFill } = getMotivationColor(annMotivation);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rect.x * scaleX,\n y: rect.y * scaleY,\n width: rect.width * scaleX,\n height: rect.height * scaleY,\n stroke: annStroke,\n strokeWidth: isSelected ? 4 : isHovered ? 3 : 2,\n fill: annFill,\n style: {\n pointerEvents: \"auto\",\n cursor: \"pointer\",\n opacity: isSelected ? 1 : isHovered ? 0.9 : 0.7\n },\n onClick: () => eventBus?.get(\"browse:click\").next({ annotationId: ann.id, motivation: ann.motivation }),\n onMouseEnter: () => handleMouseEnter(ann.id),\n onMouseLeave: handleMouseLeave\n },\n ann.id\n );\n }),\n selection && (() => {\n const rectX = Math.min(selection.startX, selection.endX);\n const rectY = Math.min(selection.startY, selection.endY);\n const rectWidth = Math.abs(selection.endX - selection.startX);\n const rectHeight = Math.abs(selection.endY - selection.startY);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rectX,\n y: rectY,\n width: rectWidth,\n height: rectHeight,\n stroke,\n strokeWidth: 2,\n strokeDasharray: \"5,5\",\n fill,\n pointerEvents: \"none\"\n }\n );\n })()\n ]\n }\n ) }) })\n ]\n }\n ),\n numPages > 0 && /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas__controls\", children: [\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber <= 1,\n onClick: () => setPageNumber(pageNumber - 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Previous\"\n }\n ),\n /* @__PURE__ */ jsxs(\"span\", { className: \"semiont-pdf-annotation-canvas__page-info\", children: [\n \"Page \",\n pageNumber,\n \" of \",\n numPages\n ] }),\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber >= numPages,\n onClick: () => setPageNumber(pageNumber + 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Next\"\n }\n )\n ] })\n ] });\n}\nexport {\n PdfAnnotationCanvas\n};\n//# sourceMappingURL=PdfAnnotationCanvas.client-CW6SKH2U.mjs.map"],"names":["canvasToPdfCoordinates","canvasRect","page","_pageWidth","pageHeight","scale","x1","y1","x2","y2","pdfX","pdfWidth","pdfY","pdfHeight","pdfToCanvasCoordinates","pdfCoord","canvasX","canvasWidth","canvasY","canvasHeight","createFragmentSelector","coord","parseFragmentSelector","fragment","pageMatch","viewrectMatch","getPageFromFragment","match","ensurePdfJs","resolve","reject","script","pdfjsLib","loadPdfDocument","url","renderPdfPageToDataUrl","viewport","canvas","context","getMotivationColor","motivation","PdfAnnotationCanvas","pdfUrl","existingAnnotations","drawingMode","selectedMotivation","eventBus","hoveredAnnotationId","selectedAnnotationId","hoverDelayMs","pdfDoc","setPdfDoc","useState","numPages","setNumPages","pageNumber","setPageNumber","pageImageUrl","setPageImageUrl","isLoading","setIsLoading","error","setError","pageDimensions","setPageDimensions","displayDimensions","setDisplayDimensions","isDrawing","setIsDrawing","selection","setSelection","containerRef","useRef","imageRef","useEffect","cancelled","loadPdf","doc","err","loadPage","dataUrl","updateDisplayDimensions","resizeObserver","handleMouseDown","useCallback","rect","x","y","handleMouseMove","handleMouseUp","clickedAnnotation","pageAnnotations","ann","fragmentSel","getFragmentSelector","pdfCoord2","scaleX2","scaleY2","displayX","displayY","displayWidth","displayHeight","scaleX","scaleY","nativeSelection","fragmentSelector","target","selector","getTargetSelector","found","s","handleMouseEnter","handleMouseLeave","useMemo","createHoverHandlers","annotationId","stroke","fill","jsx","jsxs","isHovered","isSelected","annMotivation","annStroke","annFill","rectX","rectY","rectWidth","rectHeight"],"mappings":"+LAaA,SAASA,GAAuBC,EAAYC,EAAMC,EAAYC,EAAYC,EAAQ,EAAG,CACnF,MAAMC,EAAK,KAAK,IAAIL,EAAW,OAAQA,EAAW,IAAI,EAChDM,EAAK,KAAK,IAAIN,EAAW,OAAQA,EAAW,IAAI,EAChDO,EAAK,KAAK,IAAIP,EAAW,OAAQA,EAAW,IAAI,EAChDQ,EAAK,KAAK,IAAIR,EAAW,OAAQA,EAAW,IAAI,EAChDS,EAAOJ,EAAKD,EACZM,GAAYH,EAAKF,GAAMD,EACvBO,EAAOR,EAAaK,EAAKJ,EACzBQ,GAAaJ,EAAKF,GAAMF,EAC9B,MAAO,CACL,KAAAH,EACA,EAAG,KAAK,MAAMQ,CAAI,EAClB,EAAG,KAAK,MAAME,CAAI,EAClB,MAAO,KAAK,MAAMD,CAAQ,EAC1B,OAAQ,KAAK,MAAME,CAAS,CAChC,CACA,CACA,SAASC,EAAuBC,EAAUX,EAAYC,EAAQ,EAAG,CAC/D,MAAMW,EAAUD,EAAS,EAAIV,EACvBY,EAAcF,EAAS,MAAQV,EAC/Ba,GAAWd,EAAaW,EAAS,EAAIA,EAAS,QAAUV,EACxDc,EAAeJ,EAAS,OAASV,EACvC,MAAO,CACL,EAAGW,EACH,EAAGE,EACH,MAAOD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AAE,UAAW,0CAA2C,SAAU,CAC5FD,EAAAA,IACd,SACA,CACE,SAAU/D,GAAc,EACxB,QAAS,IAAMC,EAAcD,EAAa,CAAC,EAC3C,UAAW,wCACX,SAAU,UACpB,CACA,EACsBgE,EAAAA,KAAK,OAAQ,CAAE,UAAW,2CAA4C,SAAU,CAC9F,QACAhE,EACA,OACAF,CACR,EAAS,EACaiE,EAAAA,IACd,SACA,CACE,SAAU/D,GAAcF,EACxB,QAAS,IAAMG,EAAcD,EAAa,CAAC,EAC3C,UAAW,wCACX,SAAU,MACpB,CACA,CACA,CAAK,CAAE,CACP,EAAK,CACL"}
1
+ {"version":3,"file":"PdfAnnotationCanvas.client-CHDCGQBR-BLaEAPe0.js","sources":["../../../../packages/react-ui/dist/PdfAnnotationCanvas.client-CHDCGQBR.mjs"],"sourcesContent":["'use client';\n\"use client\";\nimport {\n createHoverHandlers\n} from \"./chunk-VN5NY4SN.mjs\";\nimport \"./chunk-OZICDVH7.mjs\";\nimport \"./chunk-D4GAAQMM.mjs\";\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { useRef, useState, useCallback, useEffect, useMemo } from \"react\";\nimport { getTargetSelector } from \"@semiont/api-client\";\n\n// src/lib/pdf-coordinates.ts\nfunction canvasToPdfCoordinates(canvasRect, page, _pageWidth, pageHeight, scale = 1) {\n const x1 = Math.min(canvasRect.startX, canvasRect.endX);\n const y1 = Math.min(canvasRect.startY, canvasRect.endY);\n const x2 = Math.max(canvasRect.startX, canvasRect.endX);\n const y2 = Math.max(canvasRect.startY, canvasRect.endY);\n const pdfX = x1 / scale;\n const pdfWidth = (x2 - x1) / scale;\n const pdfY = pageHeight - y2 / scale;\n const pdfHeight = (y2 - y1) / scale;\n return {\n page,\n x: Math.round(pdfX),\n y: Math.round(pdfY),\n width: Math.round(pdfWidth),\n height: Math.round(pdfHeight)\n };\n}\nfunction pdfToCanvasCoordinates(pdfCoord, pageHeight, scale = 1) {\n const canvasX = pdfCoord.x * scale;\n const canvasWidth = pdfCoord.width * scale;\n const canvasY = (pageHeight - pdfCoord.y - pdfCoord.height) * scale;\n const canvasHeight = pdfCoord.height * scale;\n return {\n x: canvasX,\n y: canvasY,\n width: canvasWidth,\n height: canvasHeight\n };\n}\nfunction createFragmentSelector(coord) {\n return `page=${coord.page}&viewrect=${coord.x},${coord.y},${coord.width},${coord.height}`;\n}\nfunction parseFragmentSelector(fragment) {\n try {\n const pageMatch = fragment.match(/page=(\\d+)/);\n if (!pageMatch) return null;\n const page = parseInt(pageMatch[1], 10);\n const viewrectMatch = fragment.match(/viewrect=([\\d.]+),([\\d.]+),([\\d.]+),([\\d.]+)/);\n if (!viewrectMatch) return null;\n return {\n page,\n x: parseFloat(viewrectMatch[1]),\n y: parseFloat(viewrectMatch[2]),\n width: parseFloat(viewrectMatch[3]),\n height: parseFloat(viewrectMatch[4])\n };\n } catch {\n return null;\n }\n}\nfunction getPageFromFragment(fragment) {\n const match = fragment.match(/page=(\\d+)/);\n return match ? parseInt(match[1], 10) : null;\n}\n\n// src/lib/browser-pdfjs.ts\nasync function ensurePdfJs() {\n if (typeof window !== \"undefined\" && window.pdfjsLib) {\n return window.pdfjsLib;\n }\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"/pdfjs/pdf.min.mjs\";\n script.type = \"module\";\n script.onload = () => {\n const pdfjsLib = window.pdfjsLib;\n if (!pdfjsLib) {\n reject(new Error(\"PDF.js loaded but pdfjsLib not available\"));\n return;\n }\n pdfjsLib.GlobalWorkerOptions.workerSrc = \"/pdfjs/pdf.worker.min.mjs\";\n resolve(pdfjsLib);\n };\n script.onerror = () => {\n reject(new Error(\"Failed to load PDF.js from /pdfjs/pdf.min.mjs\"));\n };\n document.head.appendChild(script);\n });\n}\nasync function loadPdfDocument(url) {\n const pdfjsLib = await ensurePdfJs();\n const loadingTask = pdfjsLib.getDocument({ url });\n return loadingTask.promise;\n}\nasync function renderPdfPageToDataUrl(page, scale = 1) {\n const viewport = page.getViewport({ scale });\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"Failed to get 2D context\");\n }\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n const renderTask = page.render({\n canvasContext: context,\n viewport\n });\n await renderTask.promise;\n return {\n dataUrl: canvas.toDataURL(\"image/png\"),\n width: viewport.width,\n height: viewport.height\n };\n}\n\n// src/components/pdf-annotation/PdfAnnotationCanvas.tsx\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nfunction getMotivationColor(motivation) {\n if (!motivation) {\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n switch (motivation) {\n case \"highlighting\":\n return { stroke: \"rgb(250, 204, 21)\", fill: \"rgba(250, 204, 21, 0.3)\" };\n case \"linking\":\n return { stroke: \"rgb(59, 130, 246)\", fill: \"rgba(59, 130, 246, 0.2)\" };\n case \"assessing\":\n return { stroke: \"rgb(239, 68, 68)\", fill: \"rgba(239, 68, 68, 0.2)\" };\n case \"commenting\":\n return { stroke: \"rgb(255, 255, 255)\", fill: \"rgba(255, 255, 255, 0.2)\" };\n default:\n return { stroke: \"rgb(156, 163, 175)\", fill: \"rgba(156, 163, 175, 0.2)\" };\n }\n}\nfunction PdfAnnotationCanvas({\n pdfUrl,\n existingAnnotations = [],\n drawingMode,\n selectedMotivation,\n eventBus,\n hoveredAnnotationId,\n selectedAnnotationId,\n hoverDelayMs = 150\n}) {\n const [pdfDoc, setPdfDoc] = useState(null);\n const [numPages, setNumPages] = useState(0);\n const [pageNumber, setPageNumber] = useState(1);\n const [pageImageUrl, setPageImageUrl] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n const [pageDimensions, setPageDimensions] = useState(null);\n const [displayDimensions, setDisplayDimensions] = useState(null);\n const [scale] = useState(1.5);\n const [isDrawing, setIsDrawing] = useState(false);\n const [selection, setSelection] = useState(null);\n const containerRef = useRef(null);\n const imageRef = useRef(null);\n useEffect(() => {\n let cancelled = false;\n async function loadPdf() {\n try {\n setIsLoading(true);\n setError(null);\n const doc = await loadPdfDocument(pdfUrl);\n if (cancelled) return;\n setPdfDoc(doc);\n setNumPages(doc.numPages);\n setIsLoading(false);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading PDF:\", err);\n setError(\"Failed to load PDF\");\n setIsLoading(false);\n }\n }\n loadPdf();\n return () => {\n cancelled = true;\n };\n }, [pdfUrl]);\n useEffect(() => {\n if (!pdfDoc) return;\n let cancelled = false;\n const doc = pdfDoc;\n async function loadPage() {\n try {\n const page = await doc.getPage(pageNumber);\n if (cancelled) return;\n const viewport = page.getViewport({ scale: 1 });\n setPageDimensions({\n width: viewport.width,\n height: viewport.height\n });\n const { dataUrl } = await renderPdfPageToDataUrl(page, scale);\n if (cancelled) return;\n setPageImageUrl(dataUrl);\n } catch (err) {\n if (cancelled) return;\n console.error(\"Error loading page:\", err);\n setError(\"Failed to load page\");\n }\n }\n loadPage();\n return () => {\n cancelled = true;\n };\n }, [pdfDoc, pageNumber, scale]);\n useEffect(() => {\n const updateDisplayDimensions = () => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n };\n updateDisplayDimensions();\n let resizeObserver = null;\n try {\n resizeObserver = new ResizeObserver(updateDisplayDimensions);\n if (imageRef.current) {\n resizeObserver.observe(imageRef.current);\n }\n } catch (error2) {\n console.warn(\"ResizeObserver not supported, falling back to window resize listener\");\n window.addEventListener(\"resize\", updateDisplayDimensions);\n }\n return () => {\n if (resizeObserver) {\n resizeObserver.disconnect();\n } else {\n window.removeEventListener(\"resize\", updateDisplayDimensions);\n }\n };\n }, [pageImageUrl]);\n const handleMouseDown = useCallback((e) => {\n if (!drawingMode) return;\n if (!imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setIsDrawing(true);\n setSelection({\n startX: x,\n startY: y,\n endX: x,\n endY: y\n });\n }, [drawingMode]);\n const handleMouseMove = useCallback((e) => {\n if (!isDrawing || !selection || !imageRef.current) return;\n const rect = imageRef.current.getBoundingClientRect();\n setSelection({\n ...selection,\n endX: e.clientX - rect.left,\n endY: e.clientY - rect.top\n });\n }, [isDrawing, selection]);\n const handleMouseUp = useCallback(() => {\n if (!isDrawing || !selection || !pageDimensions || !displayDimensions || !eventBus) {\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const dragDistance = Math.sqrt(\n Math.pow(selection.endX - selection.startX, 2) + Math.pow(selection.endY - selection.startY, 2)\n );\n const MIN_DRAG_DISTANCE = 10;\n if (dragDistance < MIN_DRAG_DISTANCE) {\n if (existingAnnotations.length > 0) {\n const clickedAnnotation = pageAnnotations.find((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const pdfCoord2 = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord2) return false;\n const rect = pdfToCanvasCoordinates(pdfCoord2, pageDimensions.height, 1);\n const scaleX2 = displayDimensions.width / pageDimensions.width;\n const scaleY2 = displayDimensions.height / pageDimensions.height;\n const displayX = rect.x * scaleX2;\n const displayY = rect.y * scaleY2;\n const displayWidth = rect.width * scaleX2;\n const displayHeight = rect.height * scaleY2;\n return selection.endX >= displayX && selection.endX <= displayX + displayWidth && selection.endY >= displayY && selection.endY <= displayY + displayHeight;\n });\n if (clickedAnnotation) {\n eventBus?.get(\"browse:click\").next({ annotationId: clickedAnnotation.id, motivation: clickedAnnotation.motivation });\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n }\n setIsDrawing(false);\n setSelection(null);\n return;\n }\n const scaleX = pageDimensions.width / displayDimensions.width;\n const scaleY = pageDimensions.height / displayDimensions.height;\n const nativeSelection = {\n startX: selection.startX * scaleX,\n startY: selection.startY * scaleY,\n endX: selection.endX * scaleX,\n endY: selection.endY * scaleY\n };\n const pdfCoord = canvasToPdfCoordinates(\n nativeSelection,\n pageNumber,\n pageDimensions.width,\n pageDimensions.height,\n 1\n // Use scale 1.0 since we already scaled to native coords\n );\n const fragmentSelector = createFragmentSelector(pdfCoord);\n if (selectedMotivation) {\n eventBus.get(\"mark:requested\").next({\n selector: {\n type: \"FragmentSelector\",\n conformsTo: \"http://tools.ietf.org/rfc/rfc3778\",\n value: fragmentSelector\n },\n motivation: selectedMotivation\n });\n }\n setIsDrawing(false);\n }, [isDrawing, selection, pageNumber, pageDimensions, displayDimensions, selectedMotivation, existingAnnotations]);\n const getFragmentSelector = (target) => {\n const selector = getTargetSelector(target);\n if (!selector) return null;\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find((s) => s.type === \"FragmentSelector\");\n if (!found || found.type !== \"FragmentSelector\") return null;\n return found;\n };\n const pageAnnotations = existingAnnotations.filter((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return false;\n const page = getPageFromFragment(fragmentSel.value);\n return page === pageNumber;\n });\n const { handleMouseEnter, handleMouseLeave } = useMemo(\n () => createHoverHandlers((annotationId) => eventBus?.get(\"beckon:hover\").next({ annotationId }), hoverDelayMs),\n [eventBus, hoverDelayMs]\n );\n const { stroke, fill } = getMotivationColor(selectedMotivation ?? null);\n if (error) {\n return /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__error\", children: error });\n }\n return /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas\", children: [\n isLoading && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__loading\", children: \"Loading PDF...\" }),\n /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: containerRef,\n className: \"semiont-pdf-annotation-canvas__container\",\n style: { display: isLoading ? \"none\" : void 0 },\n onMouseDown: handleMouseDown,\n onMouseMove: handleMouseMove,\n onMouseUp: handleMouseUp,\n onMouseLeave: () => {\n if (isDrawing) {\n setIsDrawing(false);\n setSelection(null);\n }\n },\n \"data-drawing-mode\": drawingMode || \"none\",\n children: [\n pageImageUrl && /* @__PURE__ */ jsx(\n \"img\",\n {\n ref: imageRef,\n src: pageImageUrl,\n alt: `PDF page ${pageNumber}`,\n className: \"semiont-pdf-annotation-canvas__image\",\n draggable: false,\n style: { pointerEvents: \"none\" },\n onLoad: () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (imageRef.current) {\n setDisplayDimensions({\n width: imageRef.current.clientWidth,\n height: imageRef.current.clientHeight\n });\n }\n });\n });\n }\n }\n ),\n displayDimensions && pageDimensions && /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay-container\", children: /* @__PURE__ */ jsx(\"div\", { className: \"semiont-pdf-annotation-canvas__overlay\", children: /* @__PURE__ */ jsxs(\n \"svg\",\n {\n className: \"semiont-pdf-annotation-canvas__svg\",\n width: displayDimensions.width,\n height: displayDimensions.height,\n children: [\n pageAnnotations.map((ann) => {\n const fragmentSel = getFragmentSelector(ann.target);\n if (!fragmentSel) return null;\n const pdfCoord = parseFragmentSelector(fragmentSel.value);\n if (!pdfCoord) return null;\n const rect = pdfToCanvasCoordinates(pdfCoord, pageDimensions.height, 1);\n const scaleX = displayDimensions.width / pageDimensions.width;\n const scaleY = displayDimensions.height / pageDimensions.height;\n const isHovered = ann.id === hoveredAnnotationId;\n const isSelected = ann.id === selectedAnnotationId;\n const annMotivation = ann.motivation;\n const { stroke: annStroke, fill: annFill } = getMotivationColor(annMotivation);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rect.x * scaleX,\n y: rect.y * scaleY,\n width: rect.width * scaleX,\n height: rect.height * scaleY,\n stroke: annStroke,\n strokeWidth: isSelected ? 4 : isHovered ? 3 : 2,\n fill: annFill,\n style: {\n pointerEvents: \"auto\",\n cursor: \"pointer\",\n opacity: isSelected ? 1 : isHovered ? 0.9 : 0.7\n },\n onClick: () => eventBus?.get(\"browse:click\").next({ annotationId: ann.id, motivation: ann.motivation }),\n onMouseEnter: () => handleMouseEnter(ann.id),\n onMouseLeave: handleMouseLeave\n },\n ann.id\n );\n }),\n selection && (() => {\n const rectX = Math.min(selection.startX, selection.endX);\n const rectY = Math.min(selection.startY, selection.endY);\n const rectWidth = Math.abs(selection.endX - selection.startX);\n const rectHeight = Math.abs(selection.endY - selection.startY);\n return /* @__PURE__ */ jsx(\n \"rect\",\n {\n x: rectX,\n y: rectY,\n width: rectWidth,\n height: rectHeight,\n stroke,\n strokeWidth: 2,\n strokeDasharray: \"5,5\",\n fill,\n pointerEvents: \"none\"\n }\n );\n })()\n ]\n }\n ) }) })\n ]\n }\n ),\n numPages > 0 && /* @__PURE__ */ jsxs(\"div\", { className: \"semiont-pdf-annotation-canvas__controls\", children: [\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber <= 1,\n onClick: () => setPageNumber(pageNumber - 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Previous\"\n }\n ),\n /* @__PURE__ */ jsxs(\"span\", { className: \"semiont-pdf-annotation-canvas__page-info\", children: [\n \"Page \",\n pageNumber,\n \" of \",\n numPages\n ] }),\n /* @__PURE__ */ jsx(\n \"button\",\n {\n disabled: pageNumber >= numPages,\n onClick: () => setPageNumber(pageNumber + 1),\n className: \"semiont-pdf-annotation-canvas__button\",\n children: \"Next\"\n }\n )\n ] })\n ] });\n}\nexport {\n PdfAnnotationCanvas\n};\n//# sourceMappingURL=PdfAnnotationCanvas.client-CHDCGQBR.mjs.map"],"names":["canvasToPdfCoordinates","canvasRect","page","_pageWidth","pageHeight","scale","x1","y1","x2","y2","pdfX","pdfWidth","pdfY","pdfHeight","pdfToCanvasCoordinates","pdfCoord","canvasX","canvasWidth","canvasY","canvasHeight","createFragmentSelector","coord","parseFragmentSelector","fragment","pageMatch","viewrectMatch","getPageFromFragment","match","ensurePdfJs","resolve","reject","script","pdfjsLib","loadPdfDocument","url","renderPdfPageToDataUrl","viewport","canvas","context","getMotivationColor","motivation","PdfAnnotationCanvas","pdfUrl","existingAnnotations","drawingMode","selectedMotivation","eventBus","hoveredAnnotationId","selectedAnnotationId","hoverDelayMs","pdfDoc","setPdfDoc","useState","numPages","setNumPages","pageNumber","setPageNumber","pageImageUrl","setPageImageUrl","isLoading","setIsLoading","error","setError","pageDimensions","setPageDimensions","displayDimensions","setDisplayDimensions","isDrawing","setIsDrawing","selection","setSelection","containerRef","useRef","imageRef","useEffect","cancelled","loadPdf","doc","err","loadPage","dataUrl","updateDisplayDimensions","resizeObserver","handleMouseDown","useCallback","rect","x","y","handleMouseMove","handleMouseUp","clickedAnnotation","pageAnnotations","ann","fragmentSel","getFragmentSelector","pdfCoord2","scaleX2","scaleY2","displayX","displayY","displayWidth","displayHeight","scaleX","scaleY","nativeSelection","fragmentSelector","target","selector","getTargetSelector","found","s","handleMouseEnter","handleMouseLeave","useMemo","createHoverHandlers","annotationId","stroke","fill","jsx","jsxs","isHovered","isSelected","annMotivation","annStroke","annFill","rectX","rectY","rectWidth","rectHeight"],"mappings":"6JAaA,SAASA,GAAuBC,EAAYC,EAAMC,EAAYC,EAAYC,EAAQ,EAAG,CACnF,MAAMC,EAAK,KAAK,IAAIL,EAAW,OAAQA,EAAW,IAAI,EAChDM,EAAK,KAAK,IAAIN,EAAW,OAAQA,EAAW,IAAI,EAChDO,EAAK,KAAK,IAAIP,EAAW,OAAQA,EAAW,IAAI,EAChDQ,EAAK,KAAK,IAAIR,EAAW,OAAQA,EAAW,IAAI,EAChDS,EAAOJ,EAAKD,EACZM,GAAYH,EAAKF,GAAMD,EACvBO,EAAOR,EAAaK,EAAKJ,EACzBQ,GAAaJ,EAAKF,GAAMF,EAC9B,MAAO,CACL,KAAAH,EACA,EAAG,KAAK,MAAMQ,CAAI,EAClB,EAAG,KAAK,MAAME,CAAI,EAClB,MAAO,KAAK,MAAMD,CAAQ,EAC1B,OAAQ,KAAK,MAAME,CAAS,CAChC,CACA,CACA,SAASC,EAAuBC,EAAUX,EAAYC,EAAQ,EAAG,CAC/D,MAAMW,EAAUD,EAAS,EAAIV,EACvBY,EAAcF,EAAS,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KAAAC,GACA,cAAe,MACrC,CACA,CACgB,GAAC,CACjB,CACA,CACA,CAAW,CAAE,CAAC,CAAE,CAChB,CACA,CACA,EACIhE,EAAW,GAAqBkE,OAAK,MAAO,CAAE,UAAW,0CAA2C,SAAU,CAC5FD,EAAAA,IACd,SACA,CACE,SAAU/D,GAAc,EACxB,QAAS,IAAMC,EAAcD,EAAa,CAAC,EAC3C,UAAW,wCACX,SAAU,UACpB,CACA,EACsBgE,EAAAA,KAAK,OAAQ,CAAE,UAAW,2CAA4C,SAAU,CAC9F,QACAhE,EACA,OACAF,CACR,EAAS,EACaiE,EAAAA,IACd,SACA,CACE,SAAU/D,GAAcF,EACxB,QAAS,IAAMG,EAAcD,EAAa,CAAC,EAC3C,UAAW,wCACX,SAAU,MACpB,CACA,CACA,CAAK,CAAE,CACP,EAAK,CACL"}
@@ -0,0 +1,2 @@
1
+ import{r as t}from"./vendor-DJo4KD8w.js";const e=t.createContext("disconnected");function o(){return t.useContext(e)}export{e as S,o as u};
2
+ //# sourceMappingURL=StreamStatusContext-BNiTXRfJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StreamStatusContext-BuPATpTz.js","sources":["../../src/contexts/StreamStatusContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { StreamStatus } from '@semiont/react-ui';\n\nexport const StreamStatusContext = createContext<StreamStatus>('disconnected');\n\nexport function useStreamStatus(): StreamStatus {\n return useContext(StreamStatusContext);\n}\n"],"names":["StreamStatusContext","createContext","useStreamStatus","useContext"],"mappings":"yCAGO,MAAMA,EAAsBC,EAAAA,cAA4B,cAAc,EAEtE,SAASC,GAAgC,CAC9C,OAAOC,EAAAA,WAAWH,CAAmB,CACvC"}
1
+ {"version":3,"file":"StreamStatusContext-BNiTXRfJ.js","sources":["../../src/contexts/StreamStatusContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { StreamStatus } from '@semiont/react-ui';\n\nexport const StreamStatusContext = createContext<StreamStatus>('disconnected');\n\nexport function useStreamStatus(): StreamStatus {\n return useContext(StreamStatusContext);\n}\n"],"names":["StreamStatusContext","createContext","useStreamStatus","useContext"],"mappings":"yCAGO,MAAMA,EAAsBC,EAAAA,cAA4B,cAAc,EAEtE,SAASC,GAAgC,CAC9C,OAAOC,EAAAA,WAAWH,CAAmB,CACvC"}
@@ -0,0 +1,2 @@
1
+ import{j as e}from"./query-B6BuIB0M.js";import{r as a}from"./vendor-DJo4KD8w.js";import{u as z,m as H,ad as G,ae as Q,af as Y,a8 as L,ag as V,ah as J,ai as X,aj as q,ak as ee,al as te,am as se,h as ne,an as ae,ao as ie,ap as re}from"./index-XWcEpo5a.js";import{u as P,a as oe,b as le}from"./routing-By_4TZHr.js";import{u as T}from"./i18n-BbpF47i1.js";import{a as ce,F as de}from"./XMarkIcon-KMKD47CF.js";function me({title:n,titleId:t,...i},r){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},i),n?a.createElement("title",{id:t},n):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9"}))}const ue=a.forwardRef(me);function he({title:n,titleId:t,...i},r){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},i),n?a.createElement("title",{id:t},n):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const pe=a.forwardRef(he);function ge({title:n,titleId:t,...i},r){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},i),n?a.createElement("title",{id:t},n):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}const xe=a.forwardRef(ge),_="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTYiIGZpbGw9IiM2QjcyODAiLz4KPHBhdGggZD0iTTE2IDE2QzE4LjIwOTEgMTYgMjAgMTQuMjA5MSAyMCAxMkMyMCA5Ljc5MDg2IDE4LjIwOTEgOCAxNiA4QzEzLjc5MDkgOCAxMiA5Ljc5MDg2IDEyIDEyQzEyIDE0LjIwOTEgMTMuNzkwOSAxNiAxNiAxNloiIGZpbGw9IiNFNUU3RUIiLz4KPHBhdGggZD0iTTI0IDI1QzI0IDIxLjY4NjMgMjAuNDE4MyAxOSAxNiAxOUMxMS41ODE3IDE5IDggMjEuNjg2MyA4IDI1IiBzdHJva2U9IiNFNUU3RUIiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPg==";function fe(){const{t:n}=T(),t=(g,x)=>n(`UserPanel.${g}`,x),{displayName:i,avatarUrl:r,userDomain:d,isAdmin:m,isModerator:u,activeKnowledgeBase:l,signOut:o}=z(),f=H(),j=P(),[c,S]=a.useState(!1),{timeRemaining:w}=G(),I=Y(w)??"Unknown",N=(()=>{if(!r||c)return _;const g=Q(r);return g||(console.warn("Invalid profile image URL detected, using fallback"),_)})(),A=async()=>{try{await f.logout()}catch{}l&&o(l.id),j.push("/")};return e.jsxs("div",{className:"semiont-user-panel",children:[e.jsx("h3",{className:"semiont-user-panel__title",children:t("account")}),l&&e.jsx("div",{style:{padding:"0 0.75rem 0.5rem",fontSize:"0.8rem",color:"var(--semiont-color-neutral-400)"},children:l.label}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:N,alt:t("profileAlt",{name:i||t("user")}),width:48,height:48,className:"w-12 h-12 rounded-full object-cover",onError:()=>S(!0)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"semiont-panel-text",children:i||t("user")}),d&&e.jsxs("div",{className:"semiont-panel-text-secondary",children:["@",d]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"semiont-panel-label",children:t("session")}),e.jsx("div",{className:"semiont-session-box",children:e.jsx("div",{className:"semiont-panel-hint",children:t("expiresIn",{time:I})})})]}),(m||u)&&e.jsxs("div",{children:[e.jsx("label",{className:"semiont-panel-label",children:t("privileges")}),e.jsxs("div",{className:"space-y-1",children:[m&&e.jsx("div",{className:"semiont-privilege-badge semiont-privilege-badge--admin",children:e.jsx("span",{className:"semiont-privilege-text",children:t("administrator")})}),u&&e.jsx("div",{className:"semiont-privilege-badge semiont-privilege-badge--moderator",children:e.jsx("span",{className:"semiont-privilege-text",children:t("moderator")})})]})]}),e.jsx("div",{className:"semiont-panel-divider",children:e.jsx("button",{onClick:A,className:"semiont-signout-button",children:t("signOut")})})]})]})}const je={authenticated:"var(--semiont-color-success-500, #22c55e)",expired:"var(--semiont-color-warning-500, #eab308)","signed-out":"var(--semiont-color-neutral-400, #9ca3af)",unreachable:"var(--semiont-color-error-500, #ef4444)"},ve={authenticated:"statusConnected",expired:"statusExpired","signed-out":"statusSignedOut",unreachable:"statusUnreachable"};function ye({status:n,t}){return e.jsx("span",{title:t(ve[n]),style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",backgroundColor:je[n],flexShrink:0}})}function be({t:n,onSubmit:t,onCancel:i,error:r,isSubmitting:d,autoFocus:m,pulsing:u,initialHost:l="localhost",initialPort:o=4e3,initialEmail:f="admin@example.com"}){const[j,c]=a.useState(l),[S,w]=a.useState(String(o)),[I,N]=a.useState(f),[A,g]=a.useState("");return e.jsxs("div",{className:u?"semiont-panel__login-form--pulsing":"",style:{margin:"0.5rem",padding:"0.75rem",border:"1px solid var(--semiont-color-neutral-200, #e5e7eb)",borderRadius:"var(--semiont-panel-border-radius, 0.5rem)",background:"var(--semiont-bg-secondary, transparent)"},children:[e.jsx("h3",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.5rem"},children:n("connectTitle")}),e.jsxs("form",{onSubmit:x=>{x.preventDefault(),t(j,parseInt(S,10)||4e3,I,A)},style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsx("input",{type:"text",value:j,onChange:x=>c(x.target.value),placeholder:"Host",className:"semiont-input",style:{flex:1},autoFocus:m}),e.jsx("input",{type:"number",value:S,onChange:x=>w(x.target.value),placeholder:"Port",className:"semiont-input",style:{width:"5rem"}})]}),e.jsx("input",{type:"email",value:I,onChange:x=>N(x.target.value),placeholder:"Email",className:"semiont-input"}),e.jsx("input",{type:"password",value:A,onChange:x=>g(x.target.value),placeholder:"Password",className:"semiont-input"}),r&&e.jsx("div",{style:{color:"var(--semiont-color-error-500, #ef4444)",fontSize:"0.75rem"},children:r}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsx("button",{type:"submit",className:"semiont-button semiont-button--primary",style:{flex:1},disabled:d,children:n(d?"connecting":"connect")}),e.jsx("button",{type:"button",className:"semiont-button",onClick:i,children:e.jsx(de,{style:{width:"1rem",height:"1rem"}})})]})]})]})}function we({t:n,kb:t,onSubmit:i,onCancel:r,error:d,isSubmitting:m}){const[u,l]=a.useState("");return e.jsxs("form",{onSubmit:o=>{o.preventDefault(),i(u)},style:{padding:"0.5rem 0.75rem",display:"flex",flexDirection:"column",gap:"0.375rem"},children:[e.jsx("div",{style:{fontSize:"0.75rem",color:"var(--semiont-color-neutral-400)"},children:t.email}),e.jsx("input",{type:"password",value:u,onChange:o=>l(o.target.value),placeholder:"Password",className:"semiont-input",style:{fontSize:"0.8rem"},autoFocus:!0}),d&&e.jsx("div",{style:{color:"var(--semiont-color-error-500, #ef4444)",fontSize:"0.75rem"},children:d}),e.jsxs("div",{style:{display:"flex",gap:"0.375rem"},children:[e.jsx("button",{type:"submit",className:"semiont-button semiont-button--primary",style:{flex:1,fontSize:"0.8rem"},disabled:m,children:n(m?"signingIn":"signIn")}),e.jsx("button",{type:"button",className:"semiont-button",onClick:r,style:{fontSize:"0.8rem"},children:n("cancel")})]})]})}async function R(n,t,i,r,d){const m=`${i}://${n}:${t}`,u=new V({baseUrl:X(m),eventBus:new J}),l=await u.authenticatePassword(q(r),d),o=l.token??l.accessToken,f=l.refreshToken;if(!o)throw new Error("No access token received");if(!f)throw new Error("No refresh token received");let j=`${n}:${t}`;try{const c=await u.getStatus({auth:ee(o)});c.projectName&&(j=c.projectName)}catch{}return{token:o,refreshToken:f,label:j}}function Ne(){const{t:n}=T(),t=(s,h)=>n(`KnowledgeBasePanel.${s}`,h),{knowledgeBases:i,activeKnowledgeBase:r,setActiveKnowledgeBase:d,addKnowledgeBase:m,removeKnowledgeBase:u,updateKnowledgeBase:l,signIn:o,signOut:f}=z(),[j,c]=a.useState(!1),[S,w]=a.useState(null),[I,N]=a.useState(!1),[A,g]=a.useState(null),[x,k]=a.useState(null),[O,D]=a.useState(!1),[B,C]=a.useState(null),[,U]=a.useState(0);a.useEffect(()=>{i.length===0&&c(!0)},[i.length]),a.useEffect(()=>{const s=setInterval(()=>U(h=>h+1),3e4);return()=>clearInterval(s)},[]);const K=()=>{c(!0),g(null),w(null)},F=async(s,h,v,y)=>{w(null),N(!0);const b=te(s),E=i.find(p=>p.host===s&&p.port===h);if(E){try{const{token:p,refreshToken:M}=await R(s,h,b,v,y);o(E.id,p,M),c(!1)}catch(p){w(p instanceof Error?p.message:String(p))}finally{N(!1)}return}try{const{token:p,refreshToken:M,label:$}=await R(s,h,b,v,y);m({label:$,host:s,port:h,protocol:b,email:v},p,M),c(!1)}catch(p){w(p instanceof Error?p.message:String(p))}finally{N(!1)}},W=async(s,h)=>{const v=i.find(y=>y.id===s);if(v){k(null),D(!0);try{const{token:y,refreshToken:b,label:E}=await R(v.host,v.port,v.protocol,v.email,h);l(s,{label:E}),o(s,y,b),g(null)}catch(y){k(y instanceof Error?y.message:String(y))}finally{D(!1)}}},Z=s=>{L(s.id)==="authenticated"?d(s.id):(g(s.id),c(!1),k(null))};return e.jsxs("div",{className:"semiont-panel",children:[e.jsx("div",{className:"semiont-panel-header",children:e.jsxs("h2",{className:"semiont-panel-header__title",children:[e.jsx("span",{className:"semiont-panel-header__text",children:t("title")}),e.jsxs("span",{className:"semiont-panel-header__count",children:["(",i.length,")"]})]})}),e.jsxs("div",{className:"semiont-panel__content",children:[e.jsx("div",{className:"semiont-panel__list",children:i.map(s=>{const h=L(s.id),v=s.id===(r==null?void 0:r.id),y=A===s.id;return e.jsxs("div",{children:[e.jsxs("div",{className:`semiont-panel-item semiont-panel-item--clickable${v?" semiont-panel-item--selected":""}`,style:{display:"flex",flexDirection:"column",gap:"0.25rem",cursor:"pointer",padding:"0.5rem 0.75rem"},onClick:()=>Z(s),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx(ye,{status:h,t}),e.jsx("span",{className:"semiont-panel-text",style:{flex:1,fontWeight:500},children:s.label}),v&&e.jsx(pe,{style:{width:"1rem",height:"1rem",color:"var(--semiont-color-primary-500)",flexShrink:0}}),h==="authenticated"&&e.jsx("button",{onClick:b=>{b.stopPropagation(),f(s.id)},title:t("signOut"),style:{background:"none",border:"none",cursor:"pointer",padding:"0.125rem",color:"var(--semiont-color-neutral-400)"},children:e.jsx(ue,{style:{width:"0.875rem",height:"0.875rem"}})}),e.jsx("button",{onClick:b=>{b.stopPropagation(),C(s.id)},title:t("remove"),style:{background:"none",border:"none",cursor:"pointer",padding:"0.125rem",color:"var(--semiont-color-neutral-400)"},children:e.jsx(ce,{style:{width:"0.875rem",height:"0.875rem"}})})]}),e.jsxs("span",{className:"semiont-panel-text-secondary",style:{fontSize:"0.7rem",paddingLeft:"1rem"},children:[s.host,":",s.port]})]}),B===s.id&&e.jsxs("div",{style:{padding:"0.5rem 0.75rem",fontSize:"0.8rem",display:"flex",alignItems:"center",gap:"0.5rem",background:"var(--semiont-bg-secondary, #f9fafb)",borderBottom:"1px solid var(--semiont-color-neutral-200, #e5e7eb)"},children:[e.jsx("span",{style:{flex:1,color:"var(--semiont-color-neutral-500)"},children:t("removeConfirm",{label:s.label})}),e.jsx("button",{onClick:()=>{u(s.id),C(null)},className:"semiont-button",style:{fontSize:"0.75rem",padding:"0.2rem 0.5rem",color:"var(--semiont-color-error-500, #ef4444)"},children:t("remove")}),e.jsx("button",{onClick:()=>C(null),className:"semiont-button",style:{fontSize:"0.75rem",padding:"0.2rem 0.5rem"},children:t("cancel")})]}),y&&e.jsx(we,{t,kb:s,onSubmit:b=>W(s.id,b),onCancel:()=>g(null),error:x,isSubmitting:O})]},s.id)})}),j&&e.jsx(be,{t,onSubmit:F,onCancel:()=>c(!1),error:S,isSubmitting:I,autoFocus:i.length===0,pulsing:i.length===0})]}),!j&&e.jsx("div",{className:"semiont-panel-footer",children:e.jsxs("button",{onClick:K,className:"semiont-panel-item semiont-panel-item--clickable",style:{width:"100%",display:"flex",alignItems:"center",gap:"0.5rem",color:"var(--semiont-color-primary-600)"},children:[e.jsx(xe,{style:{width:"1rem",height:"1rem",flexShrink:0}}),e.jsx("span",{className:"semiont-panel-text",style:{color:"inherit"},children:t("addKnowledgeBase")})]})})]})}function Me({activePanel:n,theme:t,showLineNumbers:i,hoverDelayMs:r,children:d}){const{t:m}=T(),{isAuthenticated:u}=z(),l=oe(),o=P(),f=le(),[j,c]=a.useTransition(),{width:S,setWidth:w,minWidth:I,maxWidth:N}=se(),A=a.useCallback(({locale:g})=>{f&&c(()=>{o.replace(f,{locale:g})})},[f,o,c]);return ne({"settings:locale-changed":A}),!n||!d&&!ae.includes(n)?null:e.jsxs("div",{className:"semiont-toolbar-panels",style:{width:`${S}px`,position:"relative"},children:[e.jsx(ie,{onResize:w,minWidth:I,maxWidth:N,position:"left",ariaLabel:"Resize right panel"}),e.jsxs("div",{className:"semiont-toolbar-panels__content",children:[d,n==="knowledge-base"&&e.jsx(Ne,{}),n==="user"&&(u?e.jsx(fe,{}):e.jsxs("div",{className:"semiont-panel",children:[e.jsx("div",{className:"semiont-panel-header",children:e.jsx("h2",{className:"semiont-panel-header__title",children:e.jsx("span",{className:"semiont-panel-header__text",children:m("UserPanel.account")})})}),e.jsx("div",{className:"semiont-panel__content",style:{padding:"1rem",textAlign:"center"},children:e.jsx("p",{style:{color:"var(--semiont-color-neutral-400)",fontSize:"0.85rem",lineHeight:1.5},children:m("AccountPanel.notAuthenticated")})})]})),n==="settings"&&e.jsx(re,{showLineNumbers:i,theme:t,hoverDelayMs:r,locale:l,isPendingLocaleChange:j})]})]})}export{xe as F,Me as T};
2
+ //# sourceMappingURL=ToolbarPanels-DRHyLUHl.js.map