@kanorio/elements 1.1.0 → 1.2.0

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 (198) hide show
  1. package/README.md +4 -1
  2. package/dist/AudioPlayer-DKUAB5KE.js +2 -0
  3. package/dist/AudioPlayer-S7YF7A2E.js +2 -0
  4. package/dist/CustomerAccountPanel-DJKV7LT4.js +2 -0
  5. package/dist/CustomerAccountPanel-RWEHWBJY.js +2 -0
  6. package/dist/FormAddressField-C6VN7J6I.js +2 -0
  7. package/dist/FormAddressField-QR7ZCH77.js +2 -0
  8. package/dist/FormChoiceDropdown-SJXD26CC.js +2 -0
  9. package/dist/FormChoiceDropdown-U3NIOOHG.js +2 -0
  10. package/dist/FormFileField-LZDCXI2Z.js +2 -0
  11. package/dist/FormFileField-ONL4Q55V.js +2 -0
  12. package/dist/FormTaxIdField-K34MDUPW.js +2 -0
  13. package/dist/FormTaxIdField-XMK5WRQO.js +2 -0
  14. package/dist/KanorioAccount-EN3TM67X.js +2 -0
  15. package/dist/KanorioAccount-XGVSGVYN.js +2 -0
  16. package/dist/KanorioAnalytics-NEKTFQEE.js +2 -0
  17. package/dist/KanorioAnalytics-UMCUWQM7.js +2 -0
  18. package/dist/KanorioCurriculum-3QSCOHK7.js +2 -0
  19. package/dist/KanorioCurriculum-RUIGZ5X7.js +2 -0
  20. package/dist/KanorioForm-GUA5GEJY.js +2 -0
  21. package/dist/KanorioForm-KXV7D2TU.js +2 -0
  22. package/dist/KanorioLightbox-M72HNQQX.js +2 -0
  23. package/dist/KanorioLightbox-TQ3Q73TD.js +2 -0
  24. package/dist/KanorioLogin-5XFN3YEE.js +2 -0
  25. package/dist/KanorioLogin-AJHHVQGV.js +2 -0
  26. package/dist/KanorioMedia-ADKUDH5C.js +2 -0
  27. package/dist/KanorioMedia-DLBSXCKA.js +2 -0
  28. package/dist/KanorioReviews-42FZSXTI.js +2 -0
  29. package/dist/KanorioReviews-7LD5WKFG.js +2 -0
  30. package/dist/KanorioUnit-NWBX5DEI.js +2 -0
  31. package/dist/KanorioUnit-SIM3344J.js +2 -0
  32. package/dist/MediaPlayer-F43FPK4E.js +2 -0
  33. package/dist/MediaPlayer-JHFZFOOG.js +2 -0
  34. package/dist/{PDFViewerFull-KMUVT2BL.js → PDFViewerFull-CB44M7GW.js} +3 -3
  35. package/dist/{PDFViewerFull-FBLYNUDX.js → PDFViewerFull-INVHZL4V.js} +2 -2
  36. package/dist/VideoPlayer-FWZF4DQK.js +2 -0
  37. package/dist/VideoPlayer-LNS7XJ4C.js +2 -0
  38. package/dist/account.d.ts +165 -0
  39. package/dist/account.js +2 -0
  40. package/dist/analytics.d.ts +44 -0
  41. package/dist/analytics.js +2 -0
  42. package/dist/bot-protection.d.ts +297 -0
  43. package/dist/bot-protection.js +2 -0
  44. package/dist/chunk-2E6RCDAA.js +2 -0
  45. package/dist/chunk-2FSD3N7F.js +6 -0
  46. package/dist/chunk-2J5XQK4H.js +2 -0
  47. package/dist/chunk-2LOQXVFI.js +2 -0
  48. package/dist/chunk-2ONAW3CA.js +2 -0
  49. package/dist/chunk-33AQQY6T.js +69 -0
  50. package/dist/chunk-36YEGBKK.js +2 -0
  51. package/dist/chunk-4BBERZ6T.js +2 -0
  52. package/dist/chunk-4BEKWYEW.js +2 -0
  53. package/dist/chunk-4DPSNQEI.js +2 -0
  54. package/dist/chunk-4KA3HSRQ.js +2 -0
  55. package/dist/chunk-4MOCTNN7.js +2 -0
  56. package/dist/chunk-5AUWUK5R.js +2 -0
  57. package/dist/chunk-5G3PQI25.js +2 -0
  58. package/dist/chunk-5HWAL7VK.js +2 -0
  59. package/dist/chunk-63XJWMJG.js +2 -0
  60. package/dist/chunk-66XN5RR4.js +2 -0
  61. package/dist/chunk-6RZBXZFP.js +2 -0
  62. package/dist/chunk-763LNERD.js +2 -0
  63. package/dist/chunk-7XWBVRXP.js +15 -0
  64. package/dist/chunk-A4DPHHAP.js +42 -0
  65. package/dist/chunk-AF46NLXK.js +2 -0
  66. package/dist/chunk-AFNEGNVJ.js +2 -0
  67. package/dist/chunk-AQ6F6MIJ.js +2 -0
  68. package/dist/chunk-ARU5PTJV.js +2 -0
  69. package/dist/chunk-B7KLKVIM.js +2 -0
  70. package/dist/chunk-BGVTMWPN.js +2 -0
  71. package/dist/chunk-BKNL7ZCI.js +2 -0
  72. package/dist/chunk-BU7KUHZK.js +8 -0
  73. package/dist/chunk-C7HUM2EN.js +2 -0
  74. package/dist/chunk-CU2JJTXI.js +2 -0
  75. package/dist/{chunk-5U2SZE3H.js → chunk-CUQUEGX2.js} +2 -2
  76. package/dist/chunk-D7K3YCBR.js +2 -0
  77. package/dist/chunk-DLJDYXKL.js +2 -0
  78. package/dist/chunk-DTBRUBPG.js +2 -0
  79. package/dist/chunk-E77WGXYW.js +2 -0
  80. package/dist/chunk-EE4S6NRV.js +3 -0
  81. package/dist/chunk-ET57PWXC.js +2 -0
  82. package/dist/chunk-EZMTUAQX.js +2 -0
  83. package/dist/chunk-FFAWYDLJ.js +2 -0
  84. package/dist/chunk-FQCA2VGY.js +2 -0
  85. package/dist/chunk-FSY5GB5E.js +3 -0
  86. package/dist/chunk-G4U6BFZY.js +2 -0
  87. package/dist/chunk-GJY6AQIS.js +2 -0
  88. package/dist/chunk-GMW7AUSG.js +2 -0
  89. package/dist/chunk-GZCED6V3.js +2 -0
  90. package/dist/chunk-H2XQYT62.js +2 -0
  91. package/dist/chunk-H7VP4BYY.js +2 -0
  92. package/dist/chunk-HFYLTH5B.js +2 -0
  93. package/dist/chunk-IAXVJLJ3.js +2 -0
  94. package/dist/chunk-IXDKZO42.js +2 -0
  95. package/dist/chunk-J37D44SX.js +2 -0
  96. package/dist/chunk-JH5D6YJX.js +2 -0
  97. package/dist/chunk-JREL5347.js +2 -0
  98. package/dist/chunk-K2XZKV3Q.js +2 -0
  99. package/dist/chunk-K4VRRKYJ.js +2 -0
  100. package/dist/chunk-KBKDMTYF.js +2 -0
  101. package/dist/chunk-KDNGDR64.js +2 -0
  102. package/dist/chunk-KNNN5V3T.js +2 -0
  103. package/dist/chunk-LWKCGUHS.js +2 -0
  104. package/dist/chunk-LWRWKZBC.js +2 -0
  105. package/dist/chunk-LXNMHQFN.js +2 -0
  106. package/dist/chunk-MC63CLSM.js +2 -0
  107. package/dist/chunk-MIQK3T3Y.js +2 -0
  108. package/dist/chunk-MQ7PBFUM.js +4 -0
  109. package/dist/chunk-MWPRTK32.js +2 -0
  110. package/dist/chunk-MXGMJAWS.js +2 -0
  111. package/dist/chunk-N4BGAMWD.js +2 -0
  112. package/dist/chunk-N5PIQM4L.js +3 -0
  113. package/dist/chunk-NBDRYQZV.js +2 -0
  114. package/dist/chunk-NGRNPVON.js +2 -0
  115. package/dist/chunk-NSY72ZYX.js +15 -0
  116. package/dist/chunk-O2SYHUQF.js +2 -0
  117. package/dist/chunk-OIKRLEW6.js +2 -0
  118. package/dist/chunk-OTK4YNSG.js +2 -0
  119. package/dist/chunk-OU4IOHLN.js +15 -0
  120. package/dist/chunk-PR2NRUEI.js +2 -0
  121. package/dist/chunk-QGR3QAQB.js +3 -0
  122. package/dist/chunk-QOQQCCID.js +2 -0
  123. package/dist/chunk-RG5JA44V.js +2 -0
  124. package/dist/chunk-RKEHHJDU.js +2 -0
  125. package/dist/chunk-S2NFWI7C.js +69 -0
  126. package/dist/chunk-S7FE2XRA.js +2 -0
  127. package/dist/chunk-SUXTLVTX.js +2 -0
  128. package/dist/chunk-SVWEVSYJ.js +2 -0
  129. package/dist/chunk-TEUQV3AT.js +2 -0
  130. package/dist/chunk-U7H3W23Q.js +2 -0
  131. package/dist/chunk-U7KVGD47.js +2 -0
  132. package/dist/chunk-UIHBR4NU.js +3 -0
  133. package/dist/chunk-UM74DXPE.js +2 -0
  134. package/dist/chunk-VKSYPXNL.js +2 -0
  135. package/dist/chunk-VUTODQFX.js +2 -0
  136. package/dist/chunk-VYSRVTYI.js +2 -0
  137. package/dist/chunk-W32ZFOPN.js +2 -0
  138. package/dist/chunk-W63RJF6Q.js +2 -0
  139. package/dist/chunk-WM5S3YN5.js +2 -0
  140. package/dist/chunk-WP7UEAIB.js +2 -0
  141. package/dist/chunk-WXIUWMFR.js +2 -0
  142. package/dist/chunk-Z4A5NQWJ.js +2 -0
  143. package/dist/chunk-Z4OV6QHI.js +2 -0
  144. package/dist/curriculum.d.ts +20 -0
  145. package/dist/curriculum.js +2 -0
  146. package/dist/deliverables-BDS7WMBC.js +99 -0
  147. package/dist/deliverables-C5RD2ASE.js +131 -0
  148. package/dist/elements.css +1 -1
  149. package/dist/events-CJeBru-H.d.ts +11 -0
  150. package/dist/form.d.ts +775 -0
  151. package/dist/form.js +2 -0
  152. package/dist/forms-answers-address-7P6EVFY5.js +2 -0
  153. package/dist/forms-answers-address-IQV2Y56H.js +2 -0
  154. package/dist/forms-answers-phone-2VZ46OME.js +2 -0
  155. package/dist/forms-answers-phone-5PUB5WKD.js +2 -0
  156. package/dist/forms-answers-tax-id-D4GOUC6N.js +2 -0
  157. package/dist/forms-answers-tax-id-WJD7K3PG.js +2 -0
  158. package/dist/index.d.ts +17 -3045
  159. package/dist/index.js +1 -1
  160. package/dist/kanorio-elements.js +9 -73
  161. package/dist/lightbox-DEvsB5dB.d.ts +100 -0
  162. package/dist/lightbox.d.ts +5 -0
  163. package/dist/lightbox.js +2 -0
  164. package/dist/login.d.ts +14 -0
  165. package/dist/login.js +2 -0
  166. package/dist/media.d.ts +85 -0
  167. package/dist/media.js +2 -0
  168. package/dist/phone-input-Q5AV6KSW.js +2 -0
  169. package/dist/phone-input-T6QX2TDS.js +2 -0
  170. package/dist/provider-CMLzyAjJ.d.ts +1277 -0
  171. package/dist/provider.d.ts +4 -0
  172. package/dist/provider.js +2 -0
  173. package/dist/reviews.d.ts +42 -0
  174. package/dist/reviews.js +2 -0
  175. package/dist/unit.d.ts +118 -0
  176. package/dist/unit.js +2 -0
  177. package/dist/{vidstack-BmcqUMKx-XYI2YLUH.js → vidstack-BmcqUMKx-FXVV4FRB.js} +2 -2
  178. package/dist/{vidstack-GkTzay8D-PBE5ZIYA.js → vidstack-GkTzay8D-53C3FRCO.js} +2 -2
  179. package/dist/web-components.d.ts +13 -1
  180. package/dist/web-components.js +1 -1
  181. package/dist/wire-ofSodpi1.d.ts +176 -0
  182. package/package.json +46 -2
  183. package/dist/MediaPlayer-7IBSXL7Q.js +0 -2
  184. package/dist/MediaPlayer-HTXF4T2V.js +0 -2
  185. package/dist/chunk-2UVUNYL6.js +0 -2
  186. package/dist/chunk-3OGF7I4H.js +0 -2
  187. package/dist/chunk-5AWUTOK7.js +0 -2
  188. package/dist/chunk-DTDUK36B.js +0 -8
  189. package/dist/chunk-JZXJO62T.js +0 -15
  190. package/dist/chunk-LLHBSWTL.js +0 -2
  191. package/dist/chunk-NOCGHD2O.js +0 -2
  192. package/dist/chunk-S4ZA2INU.js +0 -415
  193. package/dist/chunk-TLBIYET7.js +0 -404
  194. package/dist/chunk-TLRFFLH4.js +0 -94
  195. package/dist/chunk-U3U5KVR6.js +0 -2
  196. package/dist/chunk-UBMXRFSK.js +0 -4
  197. package/dist/deliverables-FBCRGMTB.js +0 -93
  198. package/dist/deliverables-FMKPDHJH.js +0 -92
@@ -0,0 +1,100 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { K as KanorioConfig } from './provider-CMLzyAjJ.js';
4
+
5
+ interface ImageLightboxHandle {
6
+ openLightbox: (index: number) => void;
7
+ }
8
+
9
+ /**
10
+ * A site's media protection settings: effective immediately, without a full-site publish.
11
+ * Defaults apply when the value or a field is missing; audio, video and files in media sections follow their own "allow download" setting and are not affected by `allowDownload`.
12
+ */
13
+ interface MediaProtection {
14
+ /** Visitor downloads from the image lightbox and article PDFs */
15
+ allowDownload: boolean;
16
+ /** Images visitors download keep the copyright fields (location, camera and author are always removed); displayed images are not affected */
17
+ keepCopyright: boolean;
18
+ /** Images disable right-click, dragging and the long-press menu, and the lightbox hides download and share */
19
+ deterrence: boolean;
20
+ /** Watermark (available on every plan; whole-image watermarked versions are made in advance) */
21
+ watermark: MediaWatermark;
22
+ }
23
+ declare const WATERMARK_POSITIONS: readonly ["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"];
24
+ type WatermarkPosition = (typeof WATERMARK_POSITIONS)[number];
25
+ declare const WATERMARK_SOURCES: readonly ["logo", "text", "image"];
26
+ type WatermarkSource = (typeof WATERMARK_SOURCES)[number];
27
+ /** The part the owner can change; `overlay` and `version` are produced by the server on save */
28
+ interface MediaWatermarkSettings {
29
+ enabled: boolean;
30
+ /** Artwork: the brand logo, text, or an uploaded image (`image`, whose value is an `asset:` reference or the URL of an image on this site) */
31
+ source: WatermarkSource;
32
+ text: string;
33
+ image: string | null;
34
+ /** `single`: placed in one cell of a 3x3 grid; `tile`: tiled across the whole image (hardest to crop out) */
35
+ layout: "single" | "tile";
36
+ position: WatermarkPosition;
37
+ size: number;
38
+ opacity: number;
39
+ /** Which images get it; logos, site icons, header and footer, share images and post covers never do and are not options */
40
+ apply: WatermarkApply;
41
+ }
42
+ /**
43
+ * Chosen per category: the version visitors download follows the displayed image (watermarked if that one is), with no separate option.
44
+ * Product images are off by default: Google Merchant Center does not accept watermarked product images, and structured data and share images always use the original.
45
+ */
46
+ interface WatermarkApply {
47
+ /** Photos in page sections */
48
+ pages: boolean;
49
+ /** Images in blog post content */
50
+ articles: boolean;
51
+ /** Product images in product sections and on product pages */
52
+ products: boolean;
53
+ }
54
+ interface WatermarkOverlay {
55
+ url: string;
56
+ width: number;
57
+ height: number;
58
+ /** Hash of the inputs that produced this overlay (artwork source, text, image, layout, brand logo); a different hash means it must be produced again */
59
+ key: string;
60
+ }
61
+ interface MediaWatermark extends MediaWatermarkSettings {
62
+ /**
63
+ * The PNG laid over images (a Cloudflare Images derivative, not counted toward quota): SVG logos and text are converted to PNG first,
64
+ * and spacing is already included when tiling. Watermarked versions are made by compositing this image.
65
+ */
66
+ overlay: WatermarkOverlay | null;
67
+ /** Settings version: changes whenever the overlay or how it is applied changes, and watermarked versions are made per version */
68
+ version: string | null;
69
+ /**
70
+ * When the watermark was last turned on (ISO). While a watermarked version is not ready, images that existed before this show the original (they were already public),
71
+ * and images uploaded or replaced afterwards show only a placeholder; an original without a watermark is never served.
72
+ */
73
+ activatedAt: string | null;
74
+ /** When the watermark was last turned off (ISO); watermarked versions are removed after 30 days off, and turning it back on before then reuses them */
75
+ deactivatedAt: string | null;
76
+ /** Times a full-site redo was triggered in the last 24 hours (an ISO array; at most 3 per 24 hours) */
77
+ regenHistory?: string[];
78
+ /** When the limit of 3 full-site redos per 24 hours is exceeded, the time the new style is scheduled to start applying (ISO) */
79
+ scheduledAt?: string | null;
80
+ }
81
+
82
+ interface KanorioLightboxProps extends Pick<KanorioConfig, "locale" | "theme" | "siteUrl" | "brand"> {
83
+ images: string[];
84
+ alts?: Array<string | undefined>;
85
+ filenames?: Array<string | undefined>;
86
+ /** Lightbox protection (allow downloads, discourage right-click and so on); omit to read the site's protection settings; null means the default (downloads allowed) */
87
+ protection?: Partial<MediaProtection> | null;
88
+ /** Site id; only with it does the platform's image download endpoint apply (watermarked version, capture details removed). Taken from the site when omitted and no protection is passed */
89
+ websiteId?: string | null;
90
+ /** Platform API URL (the image download endpoint is on the app host, not the site); defaults to `https://app.kanorio.com` (the apex answers 308 for `/api/*`, so it cannot be the default) */
91
+ apiBase?: string;
92
+ /** Your own trigger; calls back with `open(index)` */
93
+ renderTrigger?: (open: (index: number) => void) => ReactNode;
94
+ /** Columns of the built-in thumbnail grid (3 by default) */
95
+ columns?: number;
96
+ className?: string;
97
+ }
98
+ declare const KanorioLightbox: react.ForwardRefExoticComponent<KanorioLightboxProps & react.RefAttributes<ImageLightboxHandle>>;
99
+
100
+ export { type ImageLightboxHandle as I, KanorioLightbox as K, type KanorioLightboxProps as a };
@@ -0,0 +1,5 @@
1
+ export { K as KanorioLightbox, a as KanorioLightboxProps } from './lightbox-DEvsB5dB.js';
2
+ import 'react';
3
+ import './provider-CMLzyAjJ.js';
4
+ import 'react/jsx-runtime';
5
+ import '@kanorio/sdk';
@@ -0,0 +1,2 @@
1
+ import{KanorioLightbox}from"./chunk-FQCA2VGY.js";import"./chunk-NBDRYQZV.js";import"./chunk-B7KLKVIM.js";import"./chunk-QOQQCCID.js";import"./chunk-Z4A5NQWJ.js";import"./chunk-HFYLTH5B.js";import"./chunk-O2SYHUQF.js";import"./chunk-33AQQY6T.js";import"./chunk-VUTODQFX.js";import"./chunk-4MOCTNN7.js";import"./chunk-KNNN5V3T.js";import"./chunk-763LNERD.js";import"./chunk-U7H3W23Q.js";import"./chunk-MIQK3T3Y.js";import"./chunk-CU2JJTXI.js";import"./chunk-3ZTUZPSD.js";export{KanorioLightbox};
2
+ //# sourceMappingURL=lightbox.js.map
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { KanorioAccountProps } from './account.js';
3
+ import { V as VisitorMessages } from './provider-CMLzyAjJ.js';
4
+ export { L as LOGIN_EVENT } from './events-CJeBru-H.js';
5
+ import 'react';
6
+ import '@kanorio/sdk';
7
+
8
+ type KanorioLoginProps = KanorioAccountProps;
9
+
10
+ /** @deprecated Use `customerAuthErrorMessage` */
11
+ declare function mapLoginErrorCode(code: string | undefined, messages: VisitorMessages["account"]): string;
12
+ declare function KanorioLogin(props: KanorioLoginProps): react_jsx_runtime.JSX.Element;
13
+
14
+ export { KanorioLogin, type KanorioLoginProps, mapLoginErrorCode };
package/dist/login.js ADDED
@@ -0,0 +1,2 @@
1
+ import{KanorioLogin,mapLoginErrorCode}from"./chunk-5HWAL7VK.js";import"./chunk-UIHBR4NU.js";import"./chunk-EE4S6NRV.js";import"./chunk-AQ6F6MIJ.js";import"./chunk-63XJWMJG.js";import"./chunk-E77WGXYW.js";import"./chunk-C7HUM2EN.js";import{LOGIN_EVENT}from"./chunk-LWKCGUHS.js";import"./chunk-TEUQV3AT.js";import"./chunk-IXDKZO42.js";import"./chunk-RKEHHJDU.js";import"./chunk-JH5D6YJX.js";import"./chunk-Z4A5NQWJ.js";import"./chunk-HFYLTH5B.js";import"./chunk-33AQQY6T.js";import"./chunk-VUTODQFX.js";import"./chunk-4MOCTNN7.js";import"./chunk-KNNN5V3T.js";import"./chunk-763LNERD.js";import"./chunk-U7H3W23Q.js";import"./chunk-MIQK3T3Y.js";import"./chunk-CU2JJTXI.js";import"./chunk-3ZTUZPSD.js";export{KanorioLogin,LOGIN_EVENT,mapLoginErrorCode};
2
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1,85 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { K as KanorioConfig } from './provider-CMLzyAjJ.js';
3
+ import 'react';
4
+ import '@kanorio/sdk';
5
+
6
+ /**
7
+ * Playback events (for watch history): `seeked` carries the destination, `ratechange` the playback rate and `quality` the video height;
8
+ * `started` is the first time playback actually begins (for time to first frame), and `waiting` and `playing` pair up to measure stalls. Times are always media seconds.
9
+ */
10
+ type MediaPlaybackEvent = {
11
+ type: "play" | "pause" | "ended" | "waiting" | "playing" | "started";
12
+ time: number;
13
+ } | {
14
+ type: "seeked";
15
+ time: number;
16
+ } | {
17
+ type: "ratechange";
18
+ time: number;
19
+ rate: number;
20
+ } | {
21
+ type: "quality";
22
+ time: number;
23
+ height: number | null;
24
+ };
25
+ /** Caption track: VTT URL, BCP 47 locale, source (AI transcription, upload, automatic translation) and whether it was edited; hidden by default until the viewer turns captions on */
26
+ interface CaptionTrack {
27
+ locale: string;
28
+ url: string;
29
+ source: "ai" | "upload" | "translation";
30
+ edited: boolean;
31
+ }
32
+ /** Where the player frame's corner radius comes from (see `radius`) */
33
+ type MediaPlayerRadius = "site" | "app-inner";
34
+ interface MediaPlayerProps {
35
+ src: string;
36
+ mimeType: string;
37
+ captions?: CaptionTrack[];
38
+ captionLocale?: string | null;
39
+ onCaptionChange?: (locale: string | null) => void;
40
+ /** The video's HLS master manifest, the VTT of seek-bar thumbnails, and whether renditions are still processing (meaningful for video only) */
41
+ hlsSrc?: string;
42
+ thumbnails?: string;
43
+ streamingPartial?: boolean;
44
+ title?: string;
45
+ /** File name and size shown when a format without a previewer (Office, EPUB, ZIP) renders as a download card */
46
+ fileName?: string;
47
+ fileSize?: number;
48
+ /** File card layout: tile for multi-column grids, matching video and PDF cards; row for a single column or inside an article */
49
+ fileCardVariant?: "row" | "tile";
50
+ thumbnailUrl?: string;
51
+ /** Cover alt text; players fall back to the title when it is empty */
52
+ thumbnailAlt?: string;
53
+ pageCount?: number;
54
+ autoPlay?: boolean;
55
+ loop?: boolean;
56
+ muted?: boolean;
57
+ /** Key for remembering playback position and volume (the asset id) */
58
+ storageKey?: string;
59
+ /** The second to start playing from (resume across devices; server progress wins over the local record) */
60
+ startTime?: number;
61
+ /** External seek (clicking a line in the transcript panel): it seeks again only when `nonce` differs */
62
+ seekTo?: {
63
+ time: number;
64
+ nonce: number;
65
+ } | null;
66
+ /** Chapters VTT URL (the `chapters` entry of `renditions[]`) */
67
+ chapters?: string;
68
+ onTimeUpdate?: (currentTime: number, duration: number) => void;
69
+ onComplete?: () => void;
70
+ onPlaybackEvent?: (event: MediaPlaybackEvent) => void;
71
+ allowDownload?: boolean;
72
+ downloadUrl?: string;
73
+ /**
74
+ * Frame corner radius: `site` (default) follows the site's corner radius setting (`--site-radius-media`: 8px square, 24px standard, 48px rounded);
75
+ * `app-inner` is for players embedded in Kanorio's own dashboard (8px). The dashboard has no site radius, so without it the standard 24px would apply.
76
+ */
77
+ radius?: MediaPlayerRadius;
78
+ className?: string;
79
+ }
80
+
81
+ interface KanorioMediaProps extends MediaPlayerProps, Pick<KanorioConfig, "locale" | "theme" | "siteUrl" | "brand"> {
82
+ }
83
+ declare function KanorioMedia({ locale, theme, siteUrl, brand, ...props }: KanorioMediaProps): react_jsx_runtime.JSX.Element;
84
+
85
+ export { KanorioMedia, type KanorioMediaProps };
package/dist/media.js ADDED
@@ -0,0 +1,2 @@
1
+ import{KanorioMedia}from"./chunk-36YEGBKK.js";import"./chunk-AF46NLXK.js";import"./chunk-4MOCTNN7.js";import"./chunk-KNNN5V3T.js";import"./chunk-763LNERD.js";import"./chunk-U7H3W23Q.js";import"./chunk-MIQK3T3Y.js";import"./chunk-CU2JJTXI.js";import"./chunk-3ZTUZPSD.js";export{KanorioMedia};
2
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1,2 @@
1
+ "use client";import{SearchablePicker,getCountryDisplayName,regionFlag}from"./chunk-2FSD3N7F.js";import"./chunk-GZCED6V3.js";import{AsYouType,DEFAULT_PHONE_REGION,getCountries,getCountryCallingCode,getExampleNumber,joinToE164,metadata_min_json_default,parsePhoneNumberWithError,splitE164}from"./chunk-KBKDMTYF.js";import{Input}from"./chunk-W32ZFOPN.js";import"./chunk-S7FE2XRA.js";import"./chunk-AQ6F6MIJ.js";import"./chunk-63XJWMJG.js";import"./chunk-RG5JA44V.js";import"./chunk-C7HUM2EN.js";import"./chunk-33AQQY6T.js";import{cn}from"./chunk-VUTODQFX.js";import"./chunk-763LNERD.js";import{useSiteLabels}from"./chunk-U7H3W23Q.js";import"./chunk-3ZTUZPSD.js";import*as React2 from"react";function withMetadataArgument(func,_arguments){var args=Array.prototype.slice.call(_arguments);args.push(metadata_min_json_default);return func.apply(this,args)}function parsePhoneNumberWithError2(){return withMetadataArgument(parsePhoneNumberWithError,arguments)}function AsYouType2(country){return AsYouType.call(this,country,metadata_min_json_default)}AsYouType2.prototype=Object.create(AsYouType.prototype,{});AsYouType2.prototype.constructor=AsYouType2;function getCountries2(){return withMetadataArgument(getCountries,arguments)}function getCountryCallingCode2(){return withMetadataArgument(getCountryCallingCode,arguments)}function getExampleNumber2(){return withMetadataArgument(getExampleNumber,arguments)}var PRIORITY_REGIONS=["TW","HK","MO","CN","JP","KR","SG","MY","TH","VN","PH","ID","US","CA","GB","AU","NZ","FR","DE","IT","ES","NL","BE","CH","AT","SE","NO","DK","FI","RU","KZ","IN","AE","SA","EG","ZA","BR","MX","AR","CL","CO","PE","TR","IR","PK","BD","LK","MM","KH","LA","BN","TL"];var catalog=null;function loadCatalog(){if(catalog)return catalog;let list=[];try{list=getCountries2().map(region=>({region,callingCode:getCountryCallingCode2(region),flag:regionFlag(region)}))}catch{list=[]}catalog={list,byRegion:new Map(list.map(country=>[country.region,country]))};return catalog}function findPhoneCountry(region){return region?loadCatalog().byRegion.get(region.toUpperCase()):void 0}var sortedByLocale=new Map;function listPhoneCountries(locale){const cacheKey=locale??"";const cached=sortedByLocale.get(cacheKey);if(cached)return cached;const{list}=loadCatalog();let collator;try{collator=new Intl.Collator(locale)}catch{collator=new Intl.Collator("en")}const sorted=list.map(country=>({country,name:getCountryDisplayName(country.region,locale)})).sort((a,b)=>collator.compare(a.name,b.name)).map(({country})=>country);if(list.length>0)sortedByLocale.set(cacheKey,sorted);return sorted}function phoneCountryPinnedRegions(homeRegion){const home=homeRegion?.toUpperCase();const regions=home?[home,...PRIORITY_REGIONS]:PRIORITY_REGIONS;return[...new Set(regions)].filter(region=>findPhoneCountry(region)!==void 0)}function phoneCountrySearchKeywords(region,locale){const country=findPhoneCountry(region);if(!country)return[region];return[getCountryDisplayName(country.region,locale),getCountryDisplayName(country.region,"en"),country.region,country.callingCode]}import*as React from"react";var examples_mobile_json_default={"AC":"40123","AD":"312345","AE":"501234567","AF":"701234567","AG":"2684641234","AI":"2642351234","AL":"672123456","AM":"77123456","AO":"923123456","AR":"91123456789","AS":"6847331234","AT":"664123456","AU":"412345678","AW":"5601234","AX":"412345678","AZ":"401234567","BA":"61123456","BB":"2462501234","BD":"1812345678","BE":"470123456","BF":"70123456","BG":"43012345","BH":"36001234","BI":"79561234","BJ":"0195123456","BL":"690001234","BM":"4413701234","BN":"7123456","BO":"71234567","BQ":"3181234","BR":"11961234567","BS":"2423591234","BT":"17123456","BW":"71123456","BY":"294911911","BZ":"6221234","CA":"5062345678","CC":"412345678","CD":"991234567","CF":"70012345","CG":"061234567","CH":"781234567","CI":"0123456789","CK":"71234","CL":"221234567","CM":"671234567","CN":"13123456789","CO":"3211234567","CR":"83123456","CU":"51234567","CV":"9911234","CW":"95181234","CX":"412345678","CY":"96123456","CZ":"601123456","DE":"15123456789","DJ":"77831001","DK":"34412345","DM":"7672251234","DO":"8092345678","DZ":"551234567","EC":"991234567","EE":"51234567","EG":"1001234567","EH":"650123456","ER":"7123456","ES":"612345678","ET":"911234567","FI":"412345678","FJ":"7012345","FK":"51234","FM":"3501234","FO":"211234","FR":"612345678","GA":"06031234","GB":"7400123456","GD":"4734031234","GE":"555123456","GF":"694201234","GG":"7781123456","GH":"231234567","GI":"57123456","GL":"221234","GM":"3012345","GN":"601123456","GP":"690001234","GQ":"222123456","GR":"6912345678","GT":"51234567","GU":"6713001234","GW":"955012345","GY":"6091234","HK":"51234567","HN":"91234567","HR":"921234567","HT":"34101234","HU":"201234567","ID":"812345678","IE":"850123456","IL":"502345678","IM":"7924123456","IN":"8123456789","IO":"3801234","IQ":"7912345678","IR":"9123456789","IS":"6111234","IT":"3123456789","JE":"7797712345","JM":"8762101234","JO":"790123456","JP":"9012345678","KE":"712123456","KG":"700123456","KH":"91234567","KI":"72001234","KM":"3212345","KN":"8697652917","KP":"1921234567","KR":"1020000000","KW":"50012345","KY":"3453231234","KZ":"7710009998","LA":"2023123456","LB":"71123456","LC":"7582845678","LI":"660234567","LK":"712345678","LR":"770123456","LS":"50123456","LT":"61234567","LU":"628123456","LV":"21234567","LY":"912345678","MA":"650123456","MC":"612345678","MD":"62112345","ME":"60123456","MF":"690001234","MG":"321234567","MH":"2351234","MK":"72345678","ML":"65012345","MM":"92123456","MN":"88123456","MO":"66123456","MP":"6702345678","MQ":"696201234","MR":"22123456","MS":"6644923456","MT":"96961234","MU":"52512345","MV":"7712345","MW":"991234567","MX":"2221234567","MY":"123456789","MZ":"821234567","NA":"811234567","NC":"751234","NE":"93123456","NF":"381234","NG":"8021234567","NI":"81234567","NL":"612345678","NO":"40612345","NP":"9841234567","NR":"5551234","NU":"8884012","NZ":"211234567","OM":"92123456","PA":"61234567","PE":"912345678","PF":"87123456","PG":"70123456","PH":"9051234567","PK":"3012345678","PL":"512345678","PM":"551234","PR":"7872345678","PS":"599123456","PT":"912345678","PW":"6201234","PY":"961456789","QA":"33123456","RE":"692123456","RO":"712034567","RS":"601234567","RU":"9123456789","RW":"720123456","SA":"512345678","SB":"7421234","SC":"2510123","SD":"911231234","SE":"701234567","SG":"81234567","SH":"51234","SI":"31234567","SJ":"41234567","SK":"912123456","SL":"25123456","SM":"66661212","SN":"701234567","SO":"71123456","SR":"7412345","SS":"977123456","ST":"9812345","SV":"70123456","SX":"7215205678","SY":"944567890","SZ":"76123456","TA":"8999","TC":"6492311234","TD":"63012345","TG":"90112345","TH":"812345678","TJ":"917123456","TK":"7290","TL":"77212345","TM":"66123456","TN":"20123456","TO":"7715123","TR":"5012345678","TT":"8682911234","TV":"901234","TW":"912345678","TZ":"621234567","UA":"501234567","UG":"712345678","US":"2015550123","UY":"94231234","UZ":"912345678","VA":"3123456789","VC":"7844301234","VE":"4121234567","VG":"2843001234","VI":"3406421234","VN":"912345678","VU":"5912345","WF":"821234","WS":"7212345","XK":"43201234","YE":"712345678","YT":"639012345","ZA":"711234567","ZM":"955123456","ZW":"712345678"};function formatNationalAsYouType(region,digits){const raw=(digits||"").replace(/\D/g,"");if(!region||raw==="")return raw;try{return new AsYouType2(region).input(raw)}catch{return raw}}function formatE164ForDisplay(e164,region,nationalDigits){if(e164){try{const parsed=parsePhoneNumberWithError2(e164);if(parsed){const national=parsed.formatNational();if(/\D/.test(national))return national}}catch{}}return formatNationalAsYouType(region,nationalDigits)}function getNationalPlaceholder(region){if(!region)return void 0;try{return getExampleNumber2(region,examples_mobile_json_default)?.formatNational()}catch{return void 0}}function usePhoneNumberInput({value,onChange,fallbackRegion,lockedRegion}){const[region,setRegion]=React.useState(()=>lockedRegion??splitE164(value)?.region??fallbackRegion);const[display,setDisplay]=React.useState(()=>{const parts=splitE164(value);return formatE164ForDisplay(value,parts?.region??fallbackRegion,parts?.nationalDigits??"")});React.useEffect(()=>{if(value===joinToE164(region,display))return;if(value){const parts=splitE164(value);if(parts){setRegion(parts.region);setDisplay(formatE164ForDisplay(value,parts.region,parts.nationalDigits))}}else{setRegion(fallbackRegion);setDisplay("")}},[value]);const displayRef=React.useRef(display);const onChangeRef=React.useRef(onChange);React.useEffect(()=>{displayRef.current=display;onChangeRef.current=onChange},[display,onChange]);const changeRegion=React.useCallback(next=>{const digits=displayRef.current.replace(/\D/g,"");setRegion(next);setDisplay(formatNationalAsYouType(next,digits));onChangeRef.current?.(joinToE164(next,digits))},[]);const changeNumber=raw=>{const digits=raw.replace(/\D/g,"");setDisplay(formatNationalAsYouType(region,digits));onChange?.(joinToE164(region,digits))};const normalizeOnBlur=()=>{const e164=joinToE164(region,display);if(!e164)return;const canonical=formatE164ForDisplay(e164,region,display.replace(/\D/g,""));if(canonical)setDisplay(canonical)};const example=React.useMemo(()=>getNationalPlaceholder(region),[region]);return{region,display,example,changeRegion,changeNumber,normalizeOnBlur}}import{Fragment,jsx,jsxs}from"react/jsx-runtime";function PhoneInput({value,onChange,onBlur,className,controlClassName,disabled=false,placeholder,error=false,locale,defaultCountry,lockedCountry}){const siteLabels=useSiteLabels();const{ui}=siteLabels;const displayLocale=locale??siteLabels.locale;const lockedRegion=lockedCountry?.toUpperCase();const fallbackRegion=lockedRegion??defaultCountry?.toUpperCase()??DEFAULT_PHONE_REGION;const phone=usePhoneNumberInput({value,onChange,fallbackRegion,lockedRegion});const{region}=phone;const handleBlur=()=>{phone.normalizeOnBlur();onBlur?.()};const resolvedPlaceholder=phone.example??placeholder??ui.phonePlaceholder;const pickerLabels=React2.useMemo(()=>({title:ui.selectCountry,search:ui.countrySearch,noMatch:ui.countryNoMatch,pinned:ui.countryGroupCommon,all:ui.countryGroupAll}),[ui.selectCountry,ui.countrySearch,ui.countryNoMatch,ui.countryGroupCommon,ui.countryGroupAll]);return jsxs("div",{className:cn("flex gap-2",className),children:[jsx(CountryPicker,{region,homeRegion:defaultCountry?.toUpperCase(),locale:displayLocale,disabled:disabled||Boolean(lockedRegion),error,controlClassName,labels:pickerLabels,onRegionChange:phone.changeRegion}),jsx(Input,{type:"tel",value:phone.display,onChange:e=>phone.changeNumber(e.target.value),onBlur:handleBlur,placeholder:resolvedPlaceholder,disabled,className:cn("flex-1 h-11",controlClassName),"aria-invalid":error})]})}var CountryPicker=React2.memo(function CountryPicker2({region,homeRegion,locale,disabled,error,controlClassName,labels,onRegionChange}){const selectedCountry=findPhoneCountry(region);const items=React2.useMemo(()=>listPhoneCountries(locale).map(country=>({value:country.region,label:getCountryDisplayName(country.region,locale),description:`+${country.callingCode}`,leading:jsx("span",{"aria-hidden":true,children:country.flag}),keywords:phoneCountrySearchKeywords(country.region,locale)})),[locale]);const pinnedValues=React2.useMemo(()=>phoneCountryPinnedRegions(homeRegion),[homeRegion]);const triggerAriaLabel=selectedCountry?`${getCountryDisplayName(selectedCountry.region,locale)} +${selectedCountry.callingCode}`:labels.title;return jsx(SearchablePicker,{items,value:region,onChange:onRegionChange,labels,pinnedValues,disabled,error,triggerAriaLabel,triggerClassName:cn("w-[112px] shrink-0",controlClassName),trigger:selectedCountry?jsxs(Fragment,{children:[jsx("span",{"aria-hidden":true,children:selectedCountry.flag}),jsxs("span",{className:"font-mono",children:["+",selectedCountry.callingCode]})]}):jsx("span",{className:"truncate text-zinc-500",children:labels.title})})});export{PhoneInput};
2
+ //# sourceMappingURL=phone-input-Q5AV6KSW.js.map
@@ -0,0 +1,2 @@
1
+ "use client";import{a as W,b as k,c as K,d as w,e as Z,f as S,g as v,i as E,j as R}from"./chunk-7XWBVRXP.js";import{a as J,b as C,c as _}from"./chunk-BU7KUHZK.js";import"./chunk-A4DPHHAP.js";import"./chunk-ARU5PTJV.js";import{a as V}from"./chunk-KDNGDR64.js";import"./chunk-D7K3YCBR.js";import"./chunk-VYSRVTYI.js";import"./chunk-W63RJF6Q.js";import"./chunk-U7KVGD47.js";import"./chunk-ET57PWXC.js";import{ba as A}from"./chunk-S2NFWI7C.js";import{b as Y}from"./chunk-AFNEGNVJ.js";import{a as H}from"./chunk-OU4IOHLN.js";import"./chunk-NSY72ZYX.js";import{a as F}from"./chunk-6LGTFWQS.js";import{c as M}from"./chunk-CDG7S4P5.js";var y=M(F());function d(e,r){var t=Array.prototype.slice.call(r);return t.push(S),e.apply(this,t)}function I(){return d(k,arguments)}function b(e){return K.call(this,e,S)}b.prototype=Object.create(K.prototype,{});b.prototype.constructor=b;function O(){return d(w,arguments)}function T(){return d(W,arguments)}function U(){return d(Z,arguments)}var X=["TW","HK","MO","CN","JP","KR","SG","MY","TH","VN","PH","ID","US","CA","GB","AU","NZ","FR","DE","IT","ES","NL","BE","CH","AT","SE","NO","DK","FI","RU","KZ","IN","AE","SA","EG","ZA","BR","MX","AR","CL","CO","PE","TR","IR","PK","BD","LK","MM","KH","LA","BN","TL"],L=null;function z(){if(L)return L;let e=[];try{e=O().map(r=>({region:r,callingCode:T(r),flag:_(r)}))}catch{e=[]}return L={list:e,byRegion:new Map(e.map(r=>[r.region,r]))},L}function G(e){return e?z().byRegion.get(e.toUpperCase()):void 0}var Q=new Map;function $(e){let r=e??"",t=Q.get(r);if(t)return t;let{list:i}=z(),o;try{o=new Intl.Collator(e)}catch{o=new Intl.Collator("en")}let c=i.map(a=>({country:a,name:C(a.region,e)})).sort((a,u)=>o.compare(a.name,u.name)).map(({country:a})=>a);return i.length>0&&Q.set(r,c),c}function j(e){let r=e?.toUpperCase(),t=r?[r,...X]:X;return[...new Set(t)].filter(i=>G(i)!==void 0)}function q(e,r){let t=G(e);return t?[C(t.region,r),C(t.region,"en"),t.region,t.callingCode]:[e]}var m=M(F());var ee={AC:"40123",AD:"312345",AE:"501234567",AF:"701234567",AG:"2684641234",AI:"2642351234",AL:"672123456",AM:"77123456",AO:"923123456",AR:"91123456789",AS:"6847331234",AT:"664123456",AU:"412345678",AW:"5601234",AX:"412345678",AZ:"401234567",BA:"61123456",BB:"2462501234",BD:"1812345678",BE:"470123456",BF:"70123456",BG:"43012345",BH:"36001234",BI:"79561234",BJ:"0195123456",BL:"690001234",BM:"4413701234",BN:"7123456",BO:"71234567",BQ:"3181234",BR:"11961234567",BS:"2423591234",BT:"17123456",BW:"71123456",BY:"294911911",BZ:"6221234",CA:"5062345678",CC:"412345678",CD:"991234567",CF:"70012345",CG:"061234567",CH:"781234567",CI:"0123456789",CK:"71234",CL:"221234567",CM:"671234567",CN:"13123456789",CO:"3211234567",CR:"83123456",CU:"51234567",CV:"9911234",CW:"95181234",CX:"412345678",CY:"96123456",CZ:"601123456",DE:"15123456789",DJ:"77831001",DK:"34412345",DM:"7672251234",DO:"8092345678",DZ:"551234567",EC:"991234567",EE:"51234567",EG:"1001234567",EH:"650123456",ER:"7123456",ES:"612345678",ET:"911234567",FI:"412345678",FJ:"7012345",FK:"51234",FM:"3501234",FO:"211234",FR:"612345678",GA:"06031234",GB:"7400123456",GD:"4734031234",GE:"555123456",GF:"694201234",GG:"7781123456",GH:"231234567",GI:"57123456",GL:"221234",GM:"3012345",GN:"601123456",GP:"690001234",GQ:"222123456",GR:"6912345678",GT:"51234567",GU:"6713001234",GW:"955012345",GY:"6091234",HK:"51234567",HN:"91234567",HR:"921234567",HT:"34101234",HU:"201234567",ID:"812345678",IE:"850123456",IL:"502345678",IM:"7924123456",IN:"8123456789",IO:"3801234",IQ:"7912345678",IR:"9123456789",IS:"6111234",IT:"3123456789",JE:"7797712345",JM:"8762101234",JO:"790123456",JP:"9012345678",KE:"712123456",KG:"700123456",KH:"91234567",KI:"72001234",KM:"3212345",KN:"8697652917",KP:"1921234567",KR:"1020000000",KW:"50012345",KY:"3453231234",KZ:"7710009998",LA:"2023123456",LB:"71123456",LC:"7582845678",LI:"660234567",LK:"712345678",LR:"770123456",LS:"50123456",LT:"61234567",LU:"628123456",LV:"21234567",LY:"912345678",MA:"650123456",MC:"612345678",MD:"62112345",ME:"60123456",MF:"690001234",MG:"321234567",MH:"2351234",MK:"72345678",ML:"65012345",MM:"92123456",MN:"88123456",MO:"66123456",MP:"6702345678",MQ:"696201234",MR:"22123456",MS:"6644923456",MT:"96961234",MU:"52512345",MV:"7712345",MW:"991234567",MX:"2221234567",MY:"123456789",MZ:"821234567",NA:"811234567",NC:"751234",NE:"93123456",NF:"381234",NG:"8021234567",NI:"81234567",NL:"612345678",NO:"40612345",NP:"9841234567",NR:"5551234",NU:"8884012",NZ:"211234567",OM:"92123456",PA:"61234567",PE:"912345678",PF:"87123456",PG:"70123456",PH:"9051234567",PK:"3012345678",PL:"512345678",PM:"551234",PR:"7872345678",PS:"599123456",PT:"912345678",PW:"6201234",PY:"961456789",QA:"33123456",RE:"692123456",RO:"712034567",RS:"601234567",RU:"9123456789",RW:"720123456",SA:"512345678",SB:"7421234",SC:"2510123",SD:"911231234",SE:"701234567",SG:"81234567",SH:"51234",SI:"31234567",SJ:"41234567",SK:"912123456",SL:"25123456",SM:"66661212",SN:"701234567",SO:"71123456",SR:"7412345",SS:"977123456",ST:"9812345",SV:"70123456",SX:"7215205678",SY:"944567890",SZ:"76123456",TA:"8999",TC:"6492311234",TD:"63012345",TG:"90112345",TH:"812345678",TJ:"917123456",TK:"7290",TL:"77212345",TM:"66123456",TN:"20123456",TO:"7715123",TR:"5012345678",TT:"8682911234",TV:"901234",TW:"912345678",TZ:"621234567",UA:"501234567",UG:"712345678",US:"2015550123",UY:"94231234",UZ:"912345678",VA:"3123456789",VC:"7844301234",VE:"4121234567",VG:"2843001234",VI:"3406421234",VN:"912345678",VU:"5912345",WF:"821234",WS:"7212345",XK:"43201234",YE:"712345678",YT:"639012345",ZA:"711234567",ZM:"955123456",ZW:"712345678"};function B(e,r){let t=(r||"").replace(/\D/g,"");if(!e||t==="")return t;try{return new b(e).input(t)}catch{return t}}function D(e,r,t){if(e)try{let i=I(e);if(i){let o=i.formatNational();if(/\D/.test(o))return o}}catch{}return B(r,t)}function re(e){if(e)try{return U(e,ee)?.formatNational()}catch{return}}function te({value:e,onChange:r,fallbackRegion:t,lockedRegion:i}){let[o,c]=m.useState(()=>i??E(e)?.region??t),[a,u]=m.useState(()=>{let n=E(e);return D(e,n?.region??t,n?.nationalDigits??"")});m.useEffect(()=>{if(e!==R(o,a))if(e){let n=E(e);n&&(c(n.region),u(D(e,n.region,n.nationalDigits)))}else c(t),u("")},[e]);let h=m.useRef(a),l=m.useRef(r);m.useEffect(()=>{h.current=a,l.current=r},[a,r]);let x=m.useCallback(n=>{let f=h.current.replace(/\D/g,"");c(n),u(B(n,f)),l.current?.(R(n,f))},[]),N=n=>{let f=n.replace(/\D/g,"");u(B(o,f)),r?.(R(o,f))},s=()=>{let n=R(o,a);if(!n)return;let f=D(n,o,a.replace(/\D/g,""));f&&u(f)},g=m.useMemo(()=>re(o),[o]);return{region:o,display:a,example:g,changeRegion:x,changeNumber:N,normalizeOnBlur:s}}var p=M(H());function ze({value:e,onChange:r,onBlur:t,className:i,controlClassName:o,disabled:c=!1,placeholder:a,error:u=!1,locale:h,defaultCountry:l,lockedCountry:x}){let N=Y(),{ui:s}=N,g=h??N.locale,n=x?.toUpperCase(),f=n??l?.toUpperCase()??v,P=te({value:e,onChange:r,fallbackRegion:f,lockedRegion:n}),{region:oe}=P,ne=()=>{P.normalizeOnBlur(),t?.()},ae=P.example??a??s.phonePlaceholder,ie=y.useMemo(()=>({title:s.selectCountry,search:s.countrySearch,noMatch:s.countryNoMatch,pinned:s.countryGroupCommon,all:s.countryGroupAll}),[s.selectCountry,s.countrySearch,s.countryNoMatch,s.countryGroupCommon,s.countryGroupAll]);return(0,p.jsxs)("div",{className:A("flex gap-2",i),children:[(0,p.jsx)(ue,{region:oe,homeRegion:l?.toUpperCase(),locale:g,disabled:c||!!n,error:u,controlClassName:o,labels:ie,onRegionChange:P.changeRegion}),(0,p.jsx)(V,{type:"tel",value:P.display,onChange:se=>P.changeNumber(se.target.value),onBlur:ne,placeholder:ae,disabled:c,className:A("flex-1 h-11",o),"aria-invalid":u})]})}var ue=y.memo(function({region:r,homeRegion:t,locale:i,disabled:o,error:c,controlClassName:a,labels:u,onRegionChange:h}){let l=G(r),x=y.useMemo(()=>$(i).map(g=>({value:g.region,label:C(g.region,i),description:`+${g.callingCode}`,leading:(0,p.jsx)("span",{"aria-hidden":!0,children:g.flag}),keywords:q(g.region,i)})),[i]),N=y.useMemo(()=>j(t),[t]),s=l?`${C(l.region,i)} +${l.callingCode}`:u.title;return(0,p.jsx)(J,{items:x,value:r,onChange:h,labels:u,pinnedValues:N,disabled:o,error:c,triggerAriaLabel:s,triggerClassName:A("w-[112px] shrink-0",a),trigger:l?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{"aria-hidden":!0,children:l.flag}),(0,p.jsxs)("span",{className:"font-mono",children:["+",l.callingCode]})]}):(0,p.jsx)("span",{className:"truncate text-zinc-500",children:u.title})})});export{ze as PhoneInput};
2
+ //# sourceMappingURL=phone-input-T6QX2TDS.js.map