@kanorio/elements 1.2.0 → 1.3.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.
- package/README.md +1 -1
- package/dist/CustomerAccountPanel-FXJEOS4F.js +2 -0
- package/dist/CustomerAccountPanel-LK4GSYYU.js +2 -0
- package/dist/{FormAddressField-QR7ZCH77.js → FormAddressField-NH5LD6K7.js} +2 -2
- package/dist/{FormAddressField-C6VN7J6I.js → FormAddressField-Z5XT2ELO.js} +2 -2
- package/dist/FormFileField-5YFTKIRZ.js +2 -0
- package/dist/FormFileField-D2XIGIML.js +2 -0
- package/dist/{FormTaxIdField-K34MDUPW.js → FormTaxIdField-GGBQOVZE.js} +2 -2
- package/dist/{FormTaxIdField-XMK5WRQO.js → FormTaxIdField-XJSMW3II.js} +2 -2
- package/dist/KanorioAccount-GXRAMZCI.js +2 -0
- package/dist/KanorioAccount-P6IIPIZ2.js +2 -0
- package/dist/KanorioAnalytics-KYTK3T2L.js +2 -0
- package/dist/KanorioAnalytics-XHKBWYTS.js +2 -0
- package/dist/KanorioCurriculum-3TLNLUL4.js +2 -0
- package/dist/KanorioCurriculum-SQ4S3U5T.js +2 -0
- package/dist/KanorioForm-FDS5UKUT.js +2 -0
- package/dist/KanorioForm-K3H3YUQH.js +2 -0
- package/dist/KanorioLightbox-QPJQJLNO.js +2 -0
- package/dist/KanorioLightbox-WBMR7MLG.js +2 -0
- package/dist/KanorioLogin-JMHHBRU7.js +2 -0
- package/dist/KanorioLogin-QMPBTK55.js +2 -0
- package/dist/KanorioMedia-5P63OK4U.js +2 -0
- package/dist/KanorioMedia-LONTU7H2.js +2 -0
- package/dist/KanorioReviews-AAQ27MYU.js +2 -0
- package/dist/KanorioReviews-LUB4KF23.js +2 -0
- package/dist/KanorioUnit-ADFQ7POH.js +2 -0
- package/dist/KanorioUnit-YBKFHGLB.js +2 -0
- package/dist/{MediaPlayer-F43FPK4E.js → MediaPlayer-C5KI6N5V.js} +2 -2
- package/dist/{MediaPlayer-JHFZFOOG.js → MediaPlayer-PMAEZSCZ.js} +2 -2
- package/dist/{PDFViewerFull-INVHZL4V.js → PDFViewerFull-6MZJTHN2.js} +2 -2
- package/dist/{PDFViewerFull-CB44M7GW.js → PDFViewerFull-P3HCVGDZ.js} +2 -2
- package/dist/account.d.ts +3 -2
- package/dist/account.js +1 -1
- package/dist/analytics.js +1 -1
- package/dist/ar-JXAEXYYY.js +2 -0
- package/dist/ar-UXUCJCPY.js +2 -0
- package/dist/bg-EUIPVVBX.js +2 -0
- package/dist/bg-HEU3KGAJ.js +2 -0
- package/dist/{bn-BHRS66N3.js → bn-L35GOE5D.js} +2 -2
- package/dist/{bn-DM5WNGJ5.js → bn-LMQOF3SO.js} +2 -2
- package/dist/bot-protection.d.ts +67 -36
- package/dist/bot-protection.js +1 -1
- package/dist/chunk-2H3LTDAA.js +2 -0
- package/dist/chunk-3NXF6SCJ.js +2 -0
- package/dist/{chunk-EE4S6NRV.js → chunk-4OC7BRQS.js} +2 -2
- package/dist/{chunk-DTBRUBPG.js → chunk-56UUP6CI.js} +2 -2
- package/dist/{chunk-IAXVJLJ3.js → chunk-65RP744E.js} +2 -2
- package/dist/chunk-APWDEDWM.js +2 -0
- package/dist/{chunk-H7VP4BYY.js → chunk-CD7JDUB6.js} +2 -2
- package/dist/{chunk-4KA3HSRQ.js → chunk-CIVS7LYU.js} +2 -2
- package/dist/chunk-CMYBXWO5.js +3 -0
- package/dist/{chunk-WM5S3YN5.js → chunk-CTMHQZAU.js} +2 -2
- package/dist/chunk-D4KDA3KL.js +2 -0
- package/dist/{chunk-36YEGBKK.js → chunk-EGJ6SNTR.js} +2 -2
- package/dist/chunk-G5673RJK.js +3 -0
- package/dist/{chunk-2ONAW3CA.js → chunk-GWUOOGNK.js} +2 -2
- package/dist/{chunk-FQCA2VGY.js → chunk-HAHAYDYM.js} +2 -2
- package/dist/chunk-IDY2ZCXL.js +2 -0
- package/dist/{chunk-NGRNPVON.js → chunk-II7PVZWZ.js} +2 -2
- package/dist/chunk-J5SMJRYC.js +2 -0
- package/dist/{chunk-N5PIQM4L.js → chunk-KW2CH7SS.js} +2 -2
- package/dist/chunk-KYXZNMNA.js +2 -0
- package/dist/{chunk-QOQQCCID.js → chunk-L3BUSP27.js} +2 -2
- package/dist/{chunk-B7KLKVIM.js → chunk-L66F3USG.js} +2 -2
- package/dist/{chunk-NBDRYQZV.js → chunk-OLGITMLA.js} +2 -2
- package/dist/{chunk-BGVTMWPN.js → chunk-OWXGUUSI.js} +2 -2
- package/dist/chunk-Q4APVE7S.js +2 -0
- package/dist/chunk-QF55WZDP.js +2 -0
- package/dist/{chunk-4MOCTNN7.js → chunk-QRKYFFDH.js} +2 -2
- package/dist/chunk-QYTK2CW3.js +2 -0
- package/dist/chunk-R5M6FXXQ.js +2 -0
- package/dist/chunk-RI64PHGM.js +2 -0
- package/dist/chunk-RNRIZCZS.js +2 -0
- package/dist/chunk-RTF2NUMK.js +3 -0
- package/dist/chunk-SB5665ZK.js +2 -0
- package/dist/{chunk-5HWAL7VK.js → chunk-SGFVHVLE.js} +2 -2
- package/dist/{chunk-K4VRRKYJ.js → chunk-UDNUWN4W.js} +2 -2
- package/dist/{chunk-AF46NLXK.js → chunk-UITC3NFQ.js} +2 -2
- package/dist/chunk-VGQ2N7JH.js +2 -0
- package/dist/chunk-WJPCDZSL.js +2 -0
- package/dist/{chunk-LWRWKZBC.js → chunk-WKKPZXK3.js} +2 -2
- package/dist/{chunk-Z4OV6QHI.js → chunk-Y5JA6B5O.js} +2 -2
- package/dist/cs-LY4LE4NI.js +2 -0
- package/dist/cs-MGLMNU2K.js +2 -0
- package/dist/curriculum.d.ts +3 -2
- package/dist/curriculum.js +1 -1
- package/dist/da-LQTLZNBW.js +2 -0
- package/dist/da-X5HKEDEL.js +2 -0
- package/dist/de-M3M4VBDR.js +2 -0
- package/dist/de-Y5ELIZBU.js +2 -0
- package/dist/{deliverables-C5RD2ASE.js → deliverables-EOIAZFWB.js} +25 -25
- package/dist/{deliverables-BDS7WMBC.js → deliverables-NO5NEFRM.js} +2 -2
- package/dist/{el-SMBF7FG4.js → el-7YYYEHW6.js} +2 -2
- package/dist/{el-G2AWU43W.js → el-YZGS3PLP.js} +2 -2
- package/dist/elements.css +1 -1
- package/dist/en-AU-IUEA3YQP.js +2 -0
- package/dist/en-AU-RQ2DVIXE.js +2 -0
- package/dist/en-CA-OFK46Q44.js +2 -0
- package/dist/en-CA-QDP57WHG.js +2 -0
- package/dist/en-GB-URCOTEDK.js +2 -0
- package/dist/en-GB-VNG2IO2E.js +2 -0
- package/dist/en-JSBHSC4K.js +2 -0
- package/dist/en-MCRNEXQP.js +2 -0
- package/dist/en-US-5RT4SJ3V.js +2 -0
- package/dist/en-US-IWMVMSUT.js +2 -0
- package/dist/es-419-53Z5HI6Z.js +2 -0
- package/dist/es-419-JFUQ3D4V.js +2 -0
- package/dist/es-ES-BMD6JJEO.js +2 -0
- package/dist/es-ES-PBIVNTAT.js +2 -0
- package/dist/fa-57P7R77M.js +2 -0
- package/dist/{fa-OYP2Q5EV.js → fa-NE4XJTHW.js} +2 -2
- package/dist/fi-G5MG7VJ2.js +2 -0
- package/dist/fi-SCTIKRMX.js +2 -0
- package/dist/form.d.ts +393 -23
- package/dist/form.js +1 -1
- package/dist/{forms-answers-address-7P6EVFY5.js → forms-answers-address-5MXQYIH3.js} +2 -2
- package/dist/{forms-answers-address-IQV2Y56H.js → forms-answers-address-BGBI445K.js} +2 -2
- package/dist/{forms-answers-tax-id-WJD7K3PG.js → forms-answers-tax-id-3AYXCNP5.js} +2 -2
- package/dist/{forms-answers-tax-id-D4GOUC6N.js → forms-answers-tax-id-LSWOEHJ4.js} +2 -2
- package/dist/fr-CA-4X7URW4M.js +2 -0
- package/dist/fr-CA-RQDI3NIQ.js +2 -0
- package/dist/fr-FR-EDVHTVOW.js +2 -0
- package/dist/fr-FR-KGXOTINP.js +2 -0
- package/dist/{gu-BREQK3GJ.js → gu-7AJCL43I.js} +2 -2
- package/dist/{gu-RNCZTEOA.js → gu-QE53XIWR.js} +2 -2
- package/dist/he-UWYKIUPF.js +2 -0
- package/dist/he-VLGZUN42.js +2 -0
- package/dist/{hi-DKG5TPYX.js → hi-5M4U37GW.js} +2 -2
- package/dist/{hi-F7Y62LAZ.js → hi-KXKJMKZF.js} +2 -2
- package/dist/{hu-3Y5YEIFL.js → hu-JU7V3YQX.js} +2 -2
- package/dist/{hu-L6W5O2G5.js → hu-YRF3KPIJ.js} +2 -2
- package/dist/id-IRL2KCIE.js +2 -0
- package/dist/id-SXO4Z54V.js +2 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1 -1
- package/dist/it-55QCLHB7.js +2 -0
- package/dist/it-RBRELRA3.js +2 -0
- package/dist/ja-2WRUVHKU.js +2 -0
- package/dist/ja-3HZPHYZS.js +2 -0
- package/dist/kanorio-elements.js +1 -1
- package/dist/{km-HPCMYWAG.js → km-EW4ISUB7.js} +2 -2
- package/dist/{km-PHVYTPLT.js → km-SL6MZB3H.js} +2 -2
- package/dist/{kn-QAWBGLHG.js → kn-RUSRJNGR.js} +2 -2
- package/dist/kn-YGEU3PSD.js +2 -0
- package/dist/ko-2GI6Z5YH.js +2 -0
- package/dist/ko-QK33QMU2.js +2 -0
- package/dist/{lightbox-DEvsB5dB.d.ts → lightbox-BmkHgtZg.d.ts} +1 -1
- package/dist/lightbox.d.ts +4 -3
- package/dist/lightbox.js +1 -1
- package/dist/{lo-JNUKFIQV.js → lo-PPDKXTQQ.js} +2 -2
- package/dist/{lo-YRHYLRZC.js → lo-ZRV6OAH6.js} +2 -2
- package/dist/login.d.ts +3 -2
- package/dist/login.js +1 -1
- package/dist/media.d.ts +3 -2
- package/dist/media.js +1 -1
- package/dist/{ml-QO64O4H6.js → ml-BIZEFHNR.js} +2 -2
- package/dist/{ml-3LXSDTNF.js → ml-KO2JGAL5.js} +2 -2
- package/dist/{mr-PLM72664.js → mr-J4AGQFC7.js} +2 -2
- package/dist/{mr-5WLN37JQ.js → mr-PZNRW5MW.js} +2 -2
- package/dist/{ms-PIAATVMD.js → ms-NYWKJQEQ.js} +2 -2
- package/dist/{ms-N544Y63H.js → ms-OMUKF5WC.js} +2 -2
- package/dist/{my-3J665CWK.js → my-FHI5JEQF.js} +2 -2
- package/dist/{my-6IKSM3XW.js → my-R4OXNUDW.js} +2 -2
- package/dist/nb-EC6AP76Y.js +2 -0
- package/dist/nb-U4QN5GJE.js +2 -0
- package/dist/{ne-ASFNHMO3.js → ne-DRPNDCZH.js} +2 -2
- package/dist/ne-J3XQJZAY.js +2 -0
- package/dist/nl-BE-QIH5K6WQ.js +2 -0
- package/dist/nl-BE-VHBDCIRF.js +2 -0
- package/dist/nl-NL-FZMZRVH4.js +2 -0
- package/dist/nl-NL-USXHXD5U.js +2 -0
- package/dist/nn-IPL74C6S.js +2 -0
- package/dist/nn-UCSEDGDB.js +2 -0
- package/dist/{pa-P2GAYL5A.js → pa-LTF7CWS2.js} +2 -2
- package/dist/{pa-VX5TUNDP.js → pa-NTK4KSUF.js} +2 -2
- package/dist/{phone-input-Q5AV6KSW.js → phone-input-DOL46AIF.js} +2 -2
- package/dist/{phone-input-T6QX2TDS.js → phone-input-PXLNDXAB.js} +2 -2
- package/dist/pl-6FXX3WNC.js +2 -0
- package/dist/pl-YWCG2YWW.js +2 -0
- package/dist/{provider-CMLzyAjJ.d.ts → provider-BYGVc6kS.d.ts} +3 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.js +1 -1
- package/dist/pt-BR-5JRKIQVH.js +2 -0
- package/dist/pt-BR-CIJCMCLE.js +2 -0
- package/dist/pt-PT-A7F2KKCY.js +2 -0
- package/dist/pt-PT-Y2UCAKHP.js +2 -0
- package/dist/reviews.d.ts +3 -2
- package/dist/reviews.js +1 -1
- package/dist/ro-6MQF2KY2.js +2 -0
- package/dist/ro-YISUN7LU.js +2 -0
- package/dist/ru-KGU3SC3S.js +2 -0
- package/dist/ru-RMPFJQSL.js +2 -0
- package/dist/{si-5VUM5FGR.js → si-CTQN6I2M.js} +2 -2
- package/dist/{si-5F7RWQIE.js → si-N5U32GIL.js} +2 -2
- package/dist/sv-36EB3HIA.js +2 -0
- package/dist/sv-QGZRDKBJ.js +2 -0
- package/dist/sw-CWIRVHYD.js +2 -0
- package/dist/sw-OUQYTLJF.js +2 -0
- package/dist/{ta-MNWTH3F5.js → ta-E3ZBHC6A.js} +2 -2
- package/dist/{ta-R73RBA23.js → ta-N7BHKWBO.js} +2 -2
- package/dist/{te-5SBVH4OF.js → te-7JC2KGAU.js} +2 -2
- package/dist/{te-GVW56XDM.js → te-CTCZQKFU.js} +2 -2
- package/dist/{th-G6SY3D2Q.js → th-AN5CLQP6.js} +2 -2
- package/dist/{th-2GWK7DBB.js → th-JVK4E2AJ.js} +2 -2
- package/dist/tl-BSWGJB7O.js +2 -0
- package/dist/tl-X72423V3.js +2 -0
- package/dist/tr-22NUPSET.js +2 -0
- package/dist/tr-AZ2PLRZY.js +2 -0
- package/dist/{uk-PGHXMWJR.js → uk-POKPJJDZ.js} +2 -2
- package/dist/uk-UOTQJ3E7.js +2 -0
- package/dist/unit.d.ts +3 -1
- package/dist/unit.js +1 -1
- package/dist/{ur-4CR64XUI.js → ur-6LBRTMAE.js} +2 -2
- package/dist/{ur-J5HV4NTW.js → ur-NRHFTLO5.js} +2 -2
- package/dist/vi-3ZVAOXIJ.js +2 -0
- package/dist/vi-XC4CGJHX.js +2 -0
- package/dist/web-components.js +1 -1
- package/dist/zh-CN-EKEY2CLM.js +2 -0
- package/dist/zh-CN-XW3PLUG5.js +2 -0
- package/dist/zh-HK-25OZZBHO.js +2 -0
- package/dist/zh-HK-EPQAUBL3.js +2 -0
- package/dist/zh-Hant-LFJZCOMK.js +2 -0
- package/dist/zh-Hant-RQMTFZSE.js +2 -0
- package/package.json +2 -2
- package/dist/CustomerAccountPanel-DJKV7LT4.js +0 -2
- package/dist/CustomerAccountPanel-RWEHWBJY.js +0 -2
- package/dist/FormFileField-LZDCXI2Z.js +0 -2
- package/dist/FormFileField-ONL4Q55V.js +0 -2
- package/dist/KanorioAccount-EN3TM67X.js +0 -2
- package/dist/KanorioAccount-XGVSGVYN.js +0 -2
- package/dist/KanorioAnalytics-NEKTFQEE.js +0 -2
- package/dist/KanorioAnalytics-UMCUWQM7.js +0 -2
- package/dist/KanorioCurriculum-3QSCOHK7.js +0 -2
- package/dist/KanorioCurriculum-RUIGZ5X7.js +0 -2
- package/dist/KanorioForm-GUA5GEJY.js +0 -2
- package/dist/KanorioForm-KXV7D2TU.js +0 -2
- package/dist/KanorioLightbox-M72HNQQX.js +0 -2
- package/dist/KanorioLightbox-TQ3Q73TD.js +0 -2
- package/dist/KanorioLogin-5XFN3YEE.js +0 -2
- package/dist/KanorioLogin-AJHHVQGV.js +0 -2
- package/dist/KanorioMedia-ADKUDH5C.js +0 -2
- package/dist/KanorioMedia-DLBSXCKA.js +0 -2
- package/dist/KanorioReviews-42FZSXTI.js +0 -2
- package/dist/KanorioReviews-7LD5WKFG.js +0 -2
- package/dist/KanorioUnit-NWBX5DEI.js +0 -2
- package/dist/KanorioUnit-SIM3344J.js +0 -2
- package/dist/ar-3VA7IUCO.js +0 -2
- package/dist/ar-AUQCHHZG.js +0 -2
- package/dist/bg-IRGRVWOG.js +0 -2
- package/dist/bg-QWC2KG3G.js +0 -2
- package/dist/chunk-4BBERZ6T.js +0 -2
- package/dist/chunk-5AUWUK5R.js +0 -2
- package/dist/chunk-66XN5RR4.js +0 -2
- package/dist/chunk-EZMTUAQX.js +0 -2
- package/dist/chunk-FSY5GB5E.js +0 -3
- package/dist/chunk-G4U6BFZY.js +0 -2
- package/dist/chunk-GJY6AQIS.js +0 -2
- package/dist/chunk-IXDKZO42.js +0 -2
- package/dist/chunk-MIQK3T3Y.js +0 -2
- package/dist/chunk-QGR3QAQB.js +0 -3
- package/dist/chunk-SUXTLVTX.js +0 -2
- package/dist/chunk-UIHBR4NU.js +0 -3
- package/dist/chunk-WXIUWMFR.js +0 -2
- package/dist/cs-3IX2ZQKJ.js +0 -2
- package/dist/cs-NZW6FBFY.js +0 -2
- package/dist/da-AFMLFM32.js +0 -2
- package/dist/da-PZ32KKTE.js +0 -2
- package/dist/de-5JPEK4HF.js +0 -2
- package/dist/de-MVL4XGYR.js +0 -2
- package/dist/en-AIAENVLI.js +0 -2
- package/dist/en-AU-LB5UVGIW.js +0 -2
- package/dist/en-AU-Q2O2HPJ2.js +0 -2
- package/dist/en-CA-AZDOY7PW.js +0 -2
- package/dist/en-CA-PVKXM3WS.js +0 -2
- package/dist/en-GB-2N4WB6SL.js +0 -2
- package/dist/en-GB-Y5QRPC7S.js +0 -2
- package/dist/en-SAXQF5YW.js +0 -2
- package/dist/en-US-74L4OI3J.js +0 -2
- package/dist/en-US-EKS52JBW.js +0 -2
- package/dist/es-419-Q5IH6W5F.js +0 -2
- package/dist/es-419-VSZWGONE.js +0 -2
- package/dist/es-ES-7L55KPLO.js +0 -2
- package/dist/es-ES-ETSYFLPQ.js +0 -2
- package/dist/fa-WRJCKGS3.js +0 -2
- package/dist/fi-44ST6B6Q.js +0 -2
- package/dist/fi-J6NJBPNK.js +0 -2
- package/dist/fr-CA-KXRNFZBP.js +0 -2
- package/dist/fr-CA-PWWAPLBH.js +0 -2
- package/dist/fr-FR-FMLQPLOD.js +0 -2
- package/dist/fr-FR-MQAFE7IX.js +0 -2
- package/dist/he-GNC45OCB.js +0 -2
- package/dist/he-VXZCGAHY.js +0 -2
- package/dist/id-7DWHYYFC.js +0 -2
- package/dist/id-DCV57AQB.js +0 -2
- package/dist/it-7RASZ4SK.js +0 -2
- package/dist/it-JICU5WVL.js +0 -2
- package/dist/ja-4V7QJLTM.js +0 -2
- package/dist/ja-52MBIM3T.js +0 -2
- package/dist/kn-5DYCOYAN.js +0 -2
- package/dist/ko-55JV4VQK.js +0 -2
- package/dist/ko-FZIJZG6K.js +0 -2
- package/dist/nb-345ACUTX.js +0 -2
- package/dist/nb-F33WYJ6T.js +0 -2
- package/dist/ne-AAIECB2W.js +0 -2
- package/dist/nl-BE-SHZLAL5T.js +0 -2
- package/dist/nl-BE-WK4C6XRZ.js +0 -2
- package/dist/nl-NL-2YLHGJZL.js +0 -2
- package/dist/nl-NL-PHRY43UB.js +0 -2
- package/dist/nn-I5A2LCBH.js +0 -2
- package/dist/nn-S3SNETRB.js +0 -2
- package/dist/pl-4Y4BWTLT.js +0 -2
- package/dist/pl-SGPLZAER.js +0 -2
- package/dist/pt-BR-CW3MRSRP.js +0 -2
- package/dist/pt-BR-WKEKB5CG.js +0 -2
- package/dist/pt-PT-AJZQS2C6.js +0 -2
- package/dist/pt-PT-ZTPCI2K6.js +0 -2
- package/dist/ro-ANISGUFX.js +0 -2
- package/dist/ro-HRV64STT.js +0 -2
- package/dist/ru-7U566HR4.js +0 -2
- package/dist/ru-PKSZKOLH.js +0 -2
- package/dist/sv-HZVCM7LG.js +0 -2
- package/dist/sv-UOGO55PW.js +0 -2
- package/dist/sw-5XU65KFC.js +0 -2
- package/dist/sw-KVAYRFED.js +0 -2
- package/dist/tl-OCD2O6J3.js +0 -2
- package/dist/tl-PZNXANIM.js +0 -2
- package/dist/tr-2BDM6H5Q.js +0 -2
- package/dist/tr-VFMHVRQX.js +0 -2
- package/dist/uk-OQRACKKD.js +0 -2
- package/dist/vi-MQSOSIUY.js +0 -2
- package/dist/vi-U7OT2LM7.js +0 -2
- package/dist/zh-CN-CCYHPSVA.js +0 -2
- package/dist/zh-CN-RNW2BEY7.js +0 -2
- package/dist/zh-HK-HE2T63O2.js +0 -2
- package/dist/zh-HK-RKREDSAO.js +0 -2
- package/dist/zh-Hant-GBQLGJDF.js +0 -2
- package/dist/zh-Hant-T6KHSA5B.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as ot,b as st,c as at,d as lt,e as ct,f as ut,g as z,h as mt,j as dt,l as pt,m as j,o as gt,p as ft,q as xt,r as ht}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as ot,b as st,c as at,d as lt,e as ct,f as ut,g as z,h as mt,j as dt,l as pt,m as j,o as gt,p as ft,q as xt,r as ht}from"./chunk-65RP744E.js";import{ba as f}from"./chunk-S2NFWI7C.js";import{a as k}from"./chunk-OU4IOHLN.js";import{a as rt}from"./chunk-6LGTFWQS.js";import{c as T}from"./chunk-CDG7S4P5.js";var x=T(rt());var Mt=T(k()),Wt={},G=(0,x.createContext)(Wt);function Kt({facts:n,children:t}){let i=(0,x.useContext)(G),r=(0,x.useMemo)(()=>!n||Object.keys(n).length===0?i:Object.keys(i).length===0?n:{...i,...n},[i,n]);return(0,Mt.jsx)(G.Provider,{value:r,children:t})}function Tt(n){return dt((0,x.useContext)(G),n)}var W=T(rt());var _t=125;function bt(n,t,i,r){let s=r&&r.length>0?r[0].trim():null,m=t?.trim()||"",l=i?.trim()||"";return n==="logo"?m||l||"logo":m?s&&!m.includes(s)?`${s} ${m}`:m:l?s&&!l.includes(s)?`${s} ${l}`:l:s||"image"}function Ft(n,t,i,r){return`${bt(n,i,void 0,r)} (${t+1})`}function St(n){let{explicitAlt:t,assetAltText:i,type:r,name:s,fallback:m,index:l,seoKeywords:A,websiteName:X}=n,p=M=>M.length<=_t?M:M.slice(0,_t);if(t&&t.trim().length>0)return p(t.trim());if(r!=="logo"&&i&&i.trim().length>0)return p(i.trim());let a=s?.trim()||m||X?.trim(),d;return l!=null?d=Ft(r,l,a||void 0,A):d=bt(r,a||void 0,void 0,A),p(d)}var o=T(k());function Ht(n){return n.includes("imagedelivery.net")||n.includes("/cdn-cgi/imagedelivery/")}function Rt(n){let t=at(n)??{x:0,y:0,w:1,h:1},i=r=>`${Math.round(r*1e4)/100}%`;return{left:i(-t.x/t.w),top:i(-t.y/t.h),width:i(1/t.w),height:i(1/t.h)}}var Ut=[{device:"mobile",suffix:"m",position:{crop:"absolute",flow:"relative"}},{device:"tablet",suffix:"t",position:{crop:"md:absolute",flow:"md:relative"}},{device:"desktop",suffix:"d",position:{crop:"lg:absolute",flow:"lg:relative"}}],zt="max-h-none max-w-none left-[var(--crop-l-m)] top-[var(--crop-t-m)] w-[var(--crop-w-m)] h-[var(--crop-h-m)] md:left-[var(--crop-l-t)] md:top-[var(--crop-t-t)] md:w-[var(--crop-w-t)] md:h-[var(--crop-h-t)] lg:left-[var(--crop-l-d)] lg:top-[var(--crop-t-d)] lg:w-[var(--crop-w-d)] lg:h-[var(--crop-h-d)]",jt=(0,W.forwardRef)(function({src:t,alt:i,altType:r,altName:s,explicitAlt:m,index:l,seoKeywords:A,websiteName:X,useCase:p="general",width:a,height:d,fit:M,responsive:Ct=!1,sizes:_,fill:c=!1,objectFit:F="cover",framing:g,deviceRatios:u,tabletInherits:v="desktop",priority:K=!1,containBackdrop:Et,className:b,style:S,onError:Pt,...D},It){let[At,vt]=(0,W.useState)(null),w=Tt({url:t}),C=c?u&&ot(u)?st(u):"absolute inset-0 h-full w-full":void 0;if(!t||At===t)return(0,o.jsx)("span",{"aria-hidden":"true",className:f("block bg-zinc-100 dark:bg-zinc-800",C,b),style:{aspectRatio:a&&d?`${a} / ${d}`:"4 / 3",...S}});let Dt=i??(r?St({explicitAlt:m,assetAltText:w?.altText,type:r,name:s,index:l,seoKeywords:A,websiteName:X}):""),B=!Ht(t),N=pt(t),E=g?.fitMode==="contain",Y=E?"contain":F,q=E?"scale-down":M,h=E?null:ct(g),H=E?"single":ft({src:t,framing:g,deviceRatios:u,tabletInherits:v}),O={ref:It,alt:Dt,loading:K?"eager":"lazy",fetchPriority:K?"high":"auto",decoding:"async",draggable:!1,onError:e=>{vt(t),Pt?.(e)}};if(H==="picture"&&u){let e=ht({src:t,useCase:p,ratios:u,framing:g,tabletInherits:v,sizes:_?{desktop:_,tablet:_,mobile:_}:void 0,maxWidth:a});if(e)return(0,o.jsxs)("picture",{className:f(c&&f("block",C)),children:[(0,o.jsx)("source",{media:e.mobile.media,srcSet:e.mobile.srcSet,sizes:e.mobile.sizes}),e.tablet?(0,o.jsx)("source",{media:e.tablet.media,srcSet:e.tablet.srcSet,sizes:e.tablet.sizes}):null,(0,o.jsx)("img",{...O,src:e.desktop.src,srcSet:e.desktop.srcSet,sizes:e.desktop.sizes,width:c?void 0:e.desktop.width,height:c?void 0:e.desktop.height??void 0,className:f(C,b),style:{objectFit:F,...S},...D})]})}if(H==="single-trim"&&u?.desktop){let e=xt({src:t,useCase:p,width:a,ratio:u.desktop,framing:g,tabletInherits:v});return(0,o.jsx)("img",{...O,src:e.src,width:c?void 0:e.width,height:c?void 0:e.height,className:f(C,b),style:{objectFit:F,...S},...D})}if(H==="css-fallback"&&c&&u){let e={},Q=[],tt=null;for(let{device:et,suffix:L,position:kt}of Ut){let nt=u[et],I={left:"0%",top:"0%",width:"100%",height:"auto"},$="flow";if(nt){$="crop";let it=ut({framing:g,device:et,targetRatio:nt,tabletInherits:v,source:g?.source??null});I=it.derived?{left:"0%",top:"0%",width:"100%",height:"100%"}:Rt(it.rect)}e[`--crop-l-${L}`]=I.left,e[`--crop-t-${L}`]=I.top,e[`--crop-w-${L}`]=I.width,e[`--crop-h-${L}`]=I.height,$!==tt&&Q.push(kt[$]),tt=$}let $t=N?t:j(t,{useCase:p,...a!=null?{width:a}:{}});return(0,o.jsx)("img",{...O,src:$t,referrerPolicy:B?"no-referrer":void 0,className:f(Q,zt,b),style:{...e,objectFit:"cover",...h?{objectPosition:z(h)}:{},...S},...D})}let P={useCase:p};a!=null&&(P.width=a),d!=null&&(P.height=d),q!=null&&(P.fit=q),h&&(P.focus=h);let R=Ct&&!N?gt(t):null,wt=N?t:R?.src??j(t,P),Nt=R?.srcSet,Ot=_??R?.sizes,Z=Et??(c&&Y==="contain"||E),y=mt(w?.edgeColor),yt=lt(g?.padColor),U=Z?yt??(y&&y!=="transparent"?y:void 0):void 0,V=Z&&!U&&!y&&w?.lqip&&!N?w.lqip:void 0,Lt={objectFit:Y,...h?{objectPosition:z(h)}:{},...U?{backgroundColor:U}:{},...S},J=(0,o.jsx)("img",{...O,src:wt,srcSet:Nt,sizes:Ot,width:c?void 0:a,height:c?void 0:d,referrerPolicy:B?"no-referrer":void 0,className:f(C,b),style:Lt,...D});return V?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{"aria-hidden":"true","data-testid":"site-image-blur-backdrop",className:"pointer-events-none absolute inset-0 overflow-hidden",children:(0,o.jsx)("img",{src:V,alt:"",className:"h-full w-full scale-125 object-cover blur-xl"})}),J]}):J});jt.displayName="SiteImage";export{Kt as a,Tt as b,jt as c};
|
|
2
|
+
//# sourceMappingURL=chunk-II7PVZWZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{BotProtectionAltcha,BotProtectionFields,ThirdPartyCaptcha,parsePublicBotProtectionConfig,preloadAltchaWidget,useBotProtection,useBotProtectionConfig}from"./chunk-KYXZNMNA.js";import{useIsInsideElementsRoot}from"./chunk-QRKYFFDH.js";import{PartScopeProvider}from"./chunk-763LNERD.js";import{useOptionalSiteLabels}from"./chunk-U7H3W23Q.js";import{ELEMENTS_PART_CLASS,markScope,optionalSiteUrl,resolveLocale,resolveVisitorLocale,useBrandStyle,useElementsMessages,useKanorioProviderConfig,useKanorioSiteUrl,useSiteMeta}from"./chunk-RI64PHGM.js";import{useEffect,useMemo as useMemo2}from"react";import{createContext,useContext,useMemo}from"react";import{jsx}from"react/jsx-runtime";var BotProtectionContext=createContext(null);import{Fragment,jsx as jsx2,jsxs}from"react/jsx-runtime";function useKanorioBotProtection(options={}){const siteUrl=useKanorioSiteUrl(options.siteUrl);const entry=options.entry??"forms";const contextConfig=useBotProtectionConfig();const givenConfig=options.config!==void 0?options.config:contextConfig;const readsSite=givenConfig===null&&options.config===void 0;const{site,error:siteError}=useSiteMeta(siteUrl,readsSite);const siteConfig=useMemo2(()=>site?parsePublicBotProtectionConfig(site.botProtection):null,[site]);const pending=readsSite&&siteConfig===null&&!siteError;const raw=useBotProtection({...options,entry,config:readsSite?siteConfig:givenConfig,variant:options.variant??"full",challengeUrl:`${siteUrl}/api/form-protection/challenge`,altchaChallengeUrl:`${siteUrl}/api/form-protection/altcha`});const captcha=raw.challengeProps.captcha;const fieldProps=useMemo2(()=>({...raw.fieldProps,captcha,pending}),[raw.fieldProps,captcha,pending]);return{...raw,isReady:raw.isReady&&!pending,isSubmittable:raw.isSubmittable&&!pending,fieldProps}}var ENGLISH_ALTCHA_LABELS={botProtection:"Human verification",botProtectionLoading:"Loading human verification"};function useBotProtectionPart(theme,localeProp,wantsAltcha){const parent=useKanorioProviderConfig();const insideRoot=useIsInsideElementsRoot();const locale=resolveLocale(localeProp??parent?.locale);const hostTheme=theme??(parent?.theme==="light"||parent?.theme==="dark"?parent.theme:null);const resolvedTheme=insideRoot?null:hostTheme;const brandSiteUrl=wantsAltcha&&!insideRoot&&parent!==null&&parent.brand!==false?optionalSiteUrl(parent.siteUrl):null;const{site}=useSiteMeta(brandSiteUrl??"",brandSiteUrl!==null);const brandScope=useBrandStyle(site,locale,brandSiteUrl!==null);const scope=useMemo2(()=>insideRoot?null:{className:ELEMENTS_PART_CLASS,mark:element=>markScope(element,resolvedTheme,brandScope)},[insideRoot,resolvedTheme,brandScope]);const rootLabels=useOptionalSiteLabels();const english=resolveVisitorLocale(locale).startsWith("en");const{messages}=useElementsMessages(locale,wantsAltcha&&rootLabels===null&&!english);const labels=useMemo2(()=>{if(rootLabels)return void 0;if(!messages||english)return ENGLISH_ALTCHA_LABELS;return{botProtection:messages.ui.botProtection,botProtectionLoading:messages.ui.botProtectionLoading}},[rootLabels,messages,english]);useEffect(()=>{if(wantsAltcha)preloadAltchaWidget(locale)},[wantsAltcha,locale]);return{scope,labels,locale,theme:resolvedTheme}}function KanorioBotProtection({theme,captcha,pending,...props}){return jsxs(Fragment,{children:[props.renderAltcha===false?null:jsx2(KanorioBotProtectionAltcha,{theme,captcha,pending,...props}),jsx2(BotProtectionFields,{...props,renderAltcha:false})]})}function KanorioBotProtectionAltcha({theme,captcha,pending,...props}){const part=useBotProtectionPart(theme,props.locale,props.variant==="full"&&!captcha&&!pending);const{scope,labels,locale}=part;if(pending)return null;if(captcha){return jsx2(PartScopeProvider,{value:scope,children:jsx2(ThirdPartyCaptcha,{provider:captcha.provider,siteKey:captcha.siteKey,action:captcha.action,cData:captcha.cData,recaptchaVersion:captcha.recaptchaVersion,locale,theme:part.theme,generation:captcha.generation,onVerified:captcha.onVerified,onInvalidated:captcha.onInvalidated,registerExecutor:captcha.registerExecutor,className:props.className})})}return jsx2(PartScopeProvider,{value:scope,children:jsx2(BotProtectionAltcha,{...props,locale,labels})})}export{useKanorioBotProtection,ENGLISH_ALTCHA_LABELS,KanorioBotProtection,KanorioBotProtectionAltcha};
|
|
2
|
+
//# sourceMappingURL=chunk-J5SMJRYC.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as bt,f as Ct,g as yt}from"./chunk-EZMTUAQX.js";import{a as ft,b as mt,c as gt}from"./chunk-VYSRVTYI.js";import{e as ht,f as re}from"./chunk-2LOQXVFI.js";import{b as te}from"./chunk-2E6RCDAA.js";import{A as ct,C as dt,Q as pt,U as fe,b as st,ba as m,d as at,g as Te,p as lt,u as _e,y as ut}from"./chunk-S2NFWI7C.js";import{a as L}from"./chunk-OU4IOHLN.js";import{a as pe}from"./chunk-6LGTFWQS.js";import{c as k}from"./chunk-CDG7S4P5.js";var u=k(pe());var B="text-[var(--site-fg,#18181b)]",D="text-[var(--site-fg-muted,#71717a)]",At=`mb-1.5 block text-sm font-medium ${B}`,H=`text-sm ${D}`,St="mt-1 text-sm text-red-600 dark:text-red-400",br="min-h-11 rounded-[var(--site-radius-lg,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] px-3 text-[length:var(--site-input-text,16px)] text-[var(--site-fg,#18181b)] outline-none transition placeholder:text-[var(--site-fg-muted,#71717a)] focus:border-[var(--site-fg-muted,#71717a)] focus:ring-2 focus:ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)] disabled:cursor-not-allowed disabled:opacity-60",Cr=`w-full ${br}`,yr="border-red-400 hover:border-red-400 focus:border-red-400 dark:border-red-500 dark:hover:border-red-500 dark:focus:border-red-500";function Et(e,t){return m(Cr,e&&yr,t)}var Ar="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--site-radius-button,0.75rem)] text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-color,#18181b)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--site-surface,#ffffff)] disabled:cursor-not-allowed disabled:opacity-60",Sr={primary:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)] hover:brightness-110",secondary:"border border-[var(--site-border,rgba(0,0,0,0.12))] bg-transparent text-[var(--site-fg,#18181b)] "+re,ghost:"bg-transparent text-[var(--site-fg-muted,#71717a)] hover:text-[var(--site-fg,#18181b)] "+re,danger:"border border-red-300 bg-transparent text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/40"},Er={md:"min-h-11 px-4",lg:"min-h-12 px-5"};function me(e){return[Ar,Sr[e?.variant??"primary"],Er[e?.size??"md"],e?.block?"flex w-full":"",e?.extra??""].filter(Boolean).join(" ")}var Rt="rounded-[var(--site-radius-card,1rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] text-[var(--site-fg,#18181b)]",ge="border-t border-[var(--site-border,rgba(0,0,0,0.12))]",Ie="rounded-[var(--site-radius-lg,0.5rem)] border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",Rr={neutral:"text-[var(--site-fg,#18181b)] "+ht,success:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",warning:"bg-amber-50 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300",info:"bg-sky-50 text-sky-700 dark:bg-sky-950/40 dark:text-sky-300",brand:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]"};function wt(e="neutral"){return`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium ${Rr[e]}`}var Pe=`inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium transition hover:text-[var(--site-fg,#18181b)] disabled:cursor-not-allowed disabled:opacity-60 ${D}`;var kt=k(pe());var he=k(L()),U=(0,kt.forwardRef)(function({variant:t,size:r,block:o,loading:i,leading:a,className:p,disabled:g,type:c="button",children:l,...h},d){return(0,he.jsxs)("button",{ref:d,type:c,disabled:g||i,"aria-busy":i||void 0,className:me({variant:t,size:r,block:o,extra:p}),...h,children:[i?(0,he.jsx)(ct,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):a,l]})});var K=k(pe());var z=k(L());function vt({length:e=6,value:t,onChange:r,onComplete:o,disabled:i,invalid:a,autoFocus:p,label:g,id:c,className:l}){let h=(0,K.useId)(),d=c??h,x=(0,K.useRef)(null),[O,A]=(0,K.useState)(!1),W=(0,K.useRef)(null),b=t.replace(/\D/g,"").slice(0,e);(0,K.useEffect)(()=>{b.length===e&&W.current!==b&&(W.current=b,o?.(b)),b.length<e&&(W.current=null)},[b,e,o]);let v=E=>{let T=E.clipboardData.getData("text").replace(/\D/g,"").slice(0,e);T&&(E.preventDefault(),r(T))},oe=E=>{E.key},Ee=Array.from({length:e},(E,T)=>b[T]??""),Re=Math.min(b.length,e-1);return(0,z.jsxs)("div",{className:m("relative",l),onClick:()=>x.current?.focus(),children:[(0,z.jsx)("div",{className:"flex gap-2","aria-hidden":"true",children:Ee.map((E,T)=>{let y=O&&T===Re&&!i;return(0,z.jsx)("div",{className:m("flex h-12 min-w-0 flex-1 items-center justify-center rounded-[var(--site-radius-lg,0.5rem)] border bg-[var(--site-surface,#ffffff)] font-mono text-xl font-semibold text-[var(--site-fg,#18181b)] transition",a?"border-red-400 dark:border-red-500":y?"border-[var(--brand-color,#18181b)] ring-2 ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)]":"border-[var(--site-border,rgba(0,0,0,0.12))]",i&&"opacity-60"),children:E||(y?(0,z.jsx)("span",{className:"h-6 w-px animate-pulse bg-[var(--site-fg,#18181b)]"}):null)},T)})}),(0,z.jsx)("input",{ref:x,id:d,type:"text",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"one-time-code",maxLength:e,value:b,disabled:i,autoFocus:p,"aria-label":g,"aria-invalid":a||void 0,onChange:E=>r(E.target.value.replace(/\D/g,"").slice(0,e)),onPaste:v,onKeyDown:oe,onFocus:()=>A(!0),onBlur:()=>A(!1),className:"absolute inset-0 h-full w-full cursor-text opacity-0"})]})}var be=k(pe());var F=k(L());function Tt({label:e,hint:t,error:r,labelTrailing:o,htmlFor:i,className:a,children:p}){return(0,F.jsxs)("div",{className:a,children:[(0,F.jsxs)("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[(0,F.jsx)("label",{htmlFor:i,className:m(At,"mb-0"),children:e}),o]}),p,r?(0,F.jsx)("p",{className:St,role:"alert",children:r}):t?(0,F.jsx)("p",{className:m(H,"mt-1"),children:t}):null]})}var _t=(0,be.forwardRef)(function({invalid:t,className:r,id:o,onKeyDown:i,onCompositionStart:a,onCompositionEnd:p,...g},c){let l=(0,be.useId)(),h=ft({onKeyDown:i,onCompositionStart:a,onCompositionEnd:p}),d=gt(c);return mt(d.ref,g.onChange),(0,F.jsx)("input",{ref:d.setRef,id:o??l,"aria-invalid":t||void 0,className:Et(t,r),...h.props,...g})});var J=k(L());function It({className:e}){return(0,J.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,role:"img","aria-label":"Google",children:[(0,J.jsx)("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"var(--platform-icon-mono, #4285F4)"}),(0,J.jsx)("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"var(--platform-icon-mono, #34A853)"}),(0,J.jsx)("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"var(--platform-icon-mono, #FBBC05)"}),(0,J.jsx)("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"var(--platform-icon-mono, #EA4335)"})]})}var _={index:"/account",login:"/account/login",orders:"/account/orders",order:e=>`/account/orders/${e}`,content:"/account/content",contentItem:e=>`/account/content/${encodeURIComponent(e)}`,courses:"/account/courses",settings:"/account/settings",profile:"/account/profile",devices:"/account/devices",apiSession:"/account/api/session",apiChallenge:"/account/api/challenge",apiVerify:"/account/api/verify",apiOauthStart:"/account/api/oauth/start",apiOauth2Authorize:"/account/api/oauth2/authorize",apiPasskeyLoginOptions:"/account/api/auth/passkey/options",apiPasskeyLoginVerify:"/account/api/auth/passkey/verify",apiPasskeys:"/account/api/passkeys",apiPasskey:e=>`/account/api/passkeys/${encodeURIComponent(e)}`,apiPasskeyRegisterOptions:"/account/api/passkeys/register/options",apiPasskeyRegister:"/account/api/passkeys/register",apiProfile:"/account/api/profile",apiEmailChange:"/account/api/email-change",apiEmailChangeVerify:"/account/api/email-change/verify",apiAddresses:"/account/api/addresses",apiAddress:e=>`/account/api/addresses/${encodeURIComponent(e)}`,apiAddressDefault:e=>`/account/api/addresses/${encodeURIComponent(e)}/default`,apiTaxIdentities:"/account/api/tax-identities",apiTaxIdentity:e=>`/account/api/tax-identities/${encodeURIComponent(e)}`,apiConsents:"/account/api/consents",apiData:"/account/api/data",apiErasure:"/account/api/erasure",apiContentOpen:e=>`/account/api/content/${encodeURIComponent(e)}/open`,apiContentQuiz:e=>`/account/api/content/${encodeURIComponent(e)}/quiz`,apiContentTranscript:e=>`/account/api/content/${encodeURIComponent(e)}/transcript`,apiProgress:"/account/api/progress",apiCertificate:e=>`/account/api/deliverables/${encodeURIComponent(e)}/certificate`,apiOrderReceipt:e=>`/account/api/orders/${encodeURIComponent(e)}/receipt`};var gn="knr_customer";var Pt=["passkey","google","apple","line","kakao","external_oidc","email_code","email_link"],wr=["passkey","google","email_code","email_link"],kr="email_code",vr=["email_code","email_link"];function xe(e){return typeof e=="string"&&Pt.includes(e)}function hn(e){let t=new Set(Array.isArray(e)?e.filter(xe).filter(r=>wr.includes(r)):vr);return t.add(kr),Pt.filter(r=>t.has(r))}function Oe(e,t=_.index){if(typeof e!="string")return t;let r=e.trim();return!r||r.length>512||!r.startsWith("/")||r.startsWith("//")||r.startsWith("/\\")||/[\r\n\0]/.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r)?t:r}var Tr=[{id:"orders",order:10,route:_.orders,navLabelKey:"orders",icon:"shopping-bag",apiResourcePrefixes:["/orders","/reviews"],visibility:"capability"},{id:"content",order:20,route:_.content,navLabelKey:"content",icon:"book-open",apiResourcePrefixes:["/deliverables","/units","/progress","/access"],visibility:"capability"},{id:"account",order:90,route:_.settings,navLabelKey:"account",icon:"user",apiResourcePrefixes:["/me","/session","/sessions","/email-change","/addresses","/tax-identities","/consents","/passkeys","/data","/erasure"],visibility:"always"}];function xt(e){let t=new Set(e.filter(r=>r.visible).map(r=>r.id));return[...Tr].filter(r=>t.has(r.id)).sort((r,o)=>r.order-o.order)}function _r(e,t){let r=e?.get("utm_source")?.toLowerCase()??"";if(/^(ig|instagram|threads|fb|facebook)/.test(r))return!0;let o=(t??"").toLowerCase();return[/threads\.net/i,/threads\.com/i,/instagram\.com/i,/m\.facebook\.com/i,/l\.facebook\.com/i,/lm\.facebook\.com/i].some(a=>a.test(o))}function Ot(e){if(typeof navigator>"u")return!1;let t=navigator.userAgent?.toLowerCase()??"";return!!([/\bbarcelona\b/i,/fban|fbav/i,/fb_iab/i,/fb_iab\/threads|fban\/threads|fbios.*threads/i,/instagram/i,/threads/i,/fbios/i,/line\//i,/wechat/i,/micromessenger/i,/twitter/i,/linkedin/i,/reddit/i,/pinterest/i,/discord/i,/snapchat/i,/tiktok/i,/kakaotalk/i,/naver/i,/webview/i].some(o=>o.test(t))||e&&_r(e.searchParams,e.referrer))}var Ce="NETWORK_ERROR";async function Nt(e,t){let r=await e.json().catch(()=>null);return!e.ok||!r?.ok?{ok:!1,code:r?.code??t,...typeof r?.retryAfter=="number"?{retryAfter:r.retryAfter}:{}}:r}async function G(e,t,r){try{let o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t??{})});return await Nt(o,r)}catch{return{ok:!1,code:Ce}}}function En(){let e=_;return{altchaChallengeUrl:"/api/form-protection/altcha",challengeUrl:"/api/form-protection/challenge",requestChallenge:({email:t,locale:r,returnTo:o,protection:i})=>G(e.apiChallenge,{email:t,locale:r,returnTo:o,...i},"SERVER_ERROR"),verifyCode:({email:t,code:r})=>G(e.apiVerify,{method:"code",email:t,code:r},"INVALID_CODE"),verifyToken:({method:t,token:r})=>G(e.apiVerify,{method:t,token:r},"CODE_EXPIRED"),startOauth:({method:t,returnTo:r,locale:o})=>G(e.apiOauthStart,{method:t,returnTo:r,locale:o},"METHOD_DISABLED"),passkeyLoginOptions:()=>G(e.apiPasskeyLoginOptions,{},"SERVER_ERROR"),passkeyLoginVerify:t=>G(e.apiPasskeyLoginVerify,t,"PASSKEY_FAILED"),listPasskeys:async()=>{try{let t=await fetch(e.apiPasskeys,{credentials:"same-origin"});return await Nt(t,"UNAUTHENTICATED")}catch{return{ok:!1,code:Ce}}},passkeyRegisterOptions:()=>G(e.apiPasskeyRegisterOptions,{},"SERVER_ERROR"),passkeyRegister:t=>G(e.apiPasskeyRegister,t,"PASSKEY_FAILED"),session:async()=>{let t=await fetch(e.apiSession,{credentials:"same-origin"});if(t.status===401)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);let r=await t.json();return!r?.ok||!r.contact?null:{contact:r.contact,sections:r.sections??[],landing:r.landing??e.index}},signOut:async()=>{await fetch(e.apiSession,{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mode:"current"})}).catch(()=>{})}}}var Lt=new Set(["PASSKEY_CANCELLED"]);function Ne(e,t){switch((e??"").toUpperCase()){case"INVALID_EMAIL":return t.errorInvalidEmail;case"INVALID_CODE":return t.errorInvalidCode;case"CODE_EXPIRED":return t.errorCodeExpired;case"TOO_MANY_ATTEMPTS":return t.errorTooManyAttempts;case"ACCOUNT_BLOCKED":return t.errorAccountBlocked;case"RATE_LIMITED":return t.errorRateLimited;case"BOT_PROTECTION_FAILED":return t.errorBotProtection;case"SIGNUP_DISABLED":return t.errorSignupDisabled;case"SEND_FAILED":return t.errorSendFailed;case"METHOD_DISABLED":return t.errorMethodDisabled;case"EMAIL_NOT_VERIFIED":return t.errorEmailNotVerified;case"NO_EMAIL":return t.errorNoEmail;case"PROVIDER_DENIED":case"TOKEN_EXCHANGE_FAILED":case"INVALID_ID_TOKEN":case"INVALID_STATE":return t.errorProviderFailed;case"PASSKEY_UNSUPPORTED":return t.errorPasskeyUnsupported;case"PASSKEY_FAILED":case"NOT_FOUND":case"VERIFY_FAILED":case"CHALLENGE_EXPIRED":case"NO_HOST":return t.errorPasskeyFailed;case"ALREADY_REGISTERED":return t.errorPasskeyAlreadyRegistered;case"SERVICE_UNAVAILABLE":return t.errorServiceUnavailable;case"SHARED_SENDER_PAUSED":return t.errorEmailSignInPaused;case Ce:default:return t.errorGeneric}}function I(e){let t=new Uint8Array(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function q(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,o=t.padEnd(t.length+r,"="),i=atob(o),a=new ArrayBuffer(i.length),p=new Uint8Array(a);for(let g=0;g<i.length;g++)p[g]=i.charCodeAt(g);return a}function M(){return Ir.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}var Ir={stubThis:e=>e};function ye(e){let{id:t}=e;return{...e,id:q(t),transports:e.transports,type:e.type}}function ne(e){return e==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var C=class extends Error{constructor({message:t,code:r,cause:o,name:i}){super(t,{cause:o}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i??o.name,this.code=r}};function Dt({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new C({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(r.authenticatorSelection?.requireResidentKey===!0)return new C({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&r.authenticatorSelection?.userVerification==="required")return new C({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(r.authenticatorSelection?.userVerification==="required")return new C({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new C({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new C({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return r.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new C({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new C({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){let o=globalThis.location.hostname;if(ne(o)){if(r.rp.id!==o)return new C({message:`The RP ID "${r.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new C({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new C({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new C({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}var Le=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){let t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}},Q=new Le;var Pr=["cross-platform","platform"];function Ae(e){if(e&&!(Pr.indexOf(e)<0))return e}async function Ut(e){!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:r=!1}=e;if(!M())throw new Error("WebAuthn is not supported in this browser");let o={...t,challenge:q(t.challenge),user:{...t.user,id:q(t.user.id)},excludeCredentials:t.excludeCredentials?.map(ye)},i={};r&&(i.mediation="conditional"),i.publicKey=o,i.signal=Q.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(A){throw Dt({error:A,options:i})}if(!a)throw new Error("Registration was not completed");let{id:p,rawId:g,response:c,type:l}=a,h;typeof c.getTransports=="function"&&(h=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm=="function")try{d=c.getPublicKeyAlgorithm()}catch(A){De("getPublicKeyAlgorithm()",A)}let x;if(typeof c.getPublicKey=="function")try{let A=c.getPublicKey();A!==null&&(x=I(A))}catch(A){De("getPublicKey()",A)}let O;if(typeof c.getAuthenticatorData=="function")try{O=I(c.getAuthenticatorData())}catch(A){De("getAuthenticatorData()",A)}return{id:p,rawId:I(g),response:{attestationObject:I(c.attestationObject),clientDataJSON:I(c.clientDataJSON),transports:h,publicKeyAlgorithm:d,publicKey:x,authenticatorData:O},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Ae(a.authenticatorAttachment)}}function De(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
1
|
+
import{g as bt,h as Ct,i as yt}from"./chunk-WJPCDZSL.js";import{a as ft,b as mt,c as gt}from"./chunk-VYSRVTYI.js";import{e as ht,f as re}from"./chunk-2LOQXVFI.js";import{b as te}from"./chunk-2E6RCDAA.js";import{A as ct,C as dt,Q as pt,U as fe,b as st,ba as m,d as at,g as Te,p as lt,u as _e,y as ut}from"./chunk-S2NFWI7C.js";import{a as L}from"./chunk-OU4IOHLN.js";import{a as pe}from"./chunk-6LGTFWQS.js";import{c as k}from"./chunk-CDG7S4P5.js";var u=k(pe());var B="text-[var(--site-fg,#18181b)]",D="text-[var(--site-fg-muted,#71717a)]",At=`mb-1.5 block text-sm font-medium ${B}`,H=`text-sm ${D}`,St="mt-1 text-sm text-red-600 dark:text-red-400",br="min-h-11 rounded-[var(--site-radius-lg,0.5rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] px-3 text-[length:var(--site-input-text,16px)] text-[var(--site-fg,#18181b)] outline-none transition placeholder:text-[var(--site-fg-muted,#71717a)] focus:border-[var(--site-fg-muted,#71717a)] focus:ring-2 focus:ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)] disabled:cursor-not-allowed disabled:opacity-60",Cr=`w-full ${br}`,yr="border-red-400 hover:border-red-400 focus:border-red-400 dark:border-red-500 dark:hover:border-red-500 dark:focus:border-red-500";function Et(e,t){return m(Cr,e&&yr,t)}var Ar="inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[var(--site-radius-button,0.75rem)] text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-color,#18181b)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--site-surface,#ffffff)] disabled:cursor-not-allowed disabled:opacity-60",Sr={primary:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)] hover:brightness-110",secondary:"border border-[var(--site-border,rgba(0,0,0,0.12))] bg-transparent text-[var(--site-fg,#18181b)] "+re,ghost:"bg-transparent text-[var(--site-fg-muted,#71717a)] hover:text-[var(--site-fg,#18181b)] "+re,danger:"border border-red-300 bg-transparent text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-950/40"},Er={md:"min-h-11 px-4",lg:"min-h-12 px-5"};function me(e){return[Ar,Sr[e?.variant??"primary"],Er[e?.size??"md"],e?.block?"flex w-full":"",e?.extra??""].filter(Boolean).join(" ")}var Rt="rounded-[var(--site-radius-card,1rem)] border border-[var(--site-border,rgba(0,0,0,0.12))] bg-[var(--site-surface,#ffffff)] text-[var(--site-fg,#18181b)]",ge="border-t border-[var(--site-border,rgba(0,0,0,0.12))]",Ie="rounded-[var(--site-radius-lg,0.5rem)] border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",Rr={neutral:"text-[var(--site-fg,#18181b)] "+ht,success:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",warning:"bg-amber-50 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-300",info:"bg-sky-50 text-sky-700 dark:bg-sky-950/40 dark:text-sky-300",brand:"bg-[var(--brand-color,#18181b)] text-[var(--brand-foreground,#ffffff)]"};function wt(e="neutral"){return`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium ${Rr[e]}`}var Pe=`inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium transition hover:text-[var(--site-fg,#18181b)] disabled:cursor-not-allowed disabled:opacity-60 ${D}`;var kt=k(pe());var he=k(L()),U=(0,kt.forwardRef)(function({variant:t,size:r,block:o,loading:i,leading:a,className:p,disabled:g,type:c="button",children:l,...h},d){return(0,he.jsxs)("button",{ref:d,type:c,disabled:g||i,"aria-busy":i||void 0,className:me({variant:t,size:r,block:o,extra:p}),...h,children:[i?(0,he.jsx)(ct,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}):a,l]})});var K=k(pe());var z=k(L());function vt({length:e=6,value:t,onChange:r,onComplete:o,disabled:i,invalid:a,autoFocus:p,label:g,id:c,className:l}){let h=(0,K.useId)(),d=c??h,x=(0,K.useRef)(null),[O,A]=(0,K.useState)(!1),W=(0,K.useRef)(null),b=t.replace(/\D/g,"").slice(0,e);(0,K.useEffect)(()=>{b.length===e&&W.current!==b&&(W.current=b,o?.(b)),b.length<e&&(W.current=null)},[b,e,o]);let v=E=>{let T=E.clipboardData.getData("text").replace(/\D/g,"").slice(0,e);T&&(E.preventDefault(),r(T))},oe=E=>{E.key},Ee=Array.from({length:e},(E,T)=>b[T]??""),Re=Math.min(b.length,e-1);return(0,z.jsxs)("div",{className:m("relative",l),onClick:()=>x.current?.focus(),children:[(0,z.jsx)("div",{className:"flex gap-2","aria-hidden":"true",children:Ee.map((E,T)=>{let y=O&&T===Re&&!i;return(0,z.jsx)("div",{className:m("flex h-12 min-w-0 flex-1 items-center justify-center rounded-[var(--site-radius-lg,0.5rem)] border bg-[var(--site-surface,#ffffff)] font-mono text-xl font-semibold text-[var(--site-fg,#18181b)] transition",a?"border-red-400 dark:border-red-500":y?"border-[var(--brand-color,#18181b)] ring-2 ring-[color-mix(in_srgb,var(--brand-color,#18181b)_35%,transparent)]":"border-[var(--site-border,rgba(0,0,0,0.12))]",i&&"opacity-60"),children:E||(y?(0,z.jsx)("span",{className:"h-6 w-px animate-pulse bg-[var(--site-fg,#18181b)]"}):null)},T)})}),(0,z.jsx)("input",{ref:x,id:d,type:"text",inputMode:"numeric",pattern:"[0-9]*",autoComplete:"one-time-code",maxLength:e,value:b,disabled:i,autoFocus:p,"aria-label":g,"aria-invalid":a||void 0,onChange:E=>r(E.target.value.replace(/\D/g,"").slice(0,e)),onPaste:v,onKeyDown:oe,onFocus:()=>A(!0),onBlur:()=>A(!1),className:"absolute inset-0 h-full w-full cursor-text opacity-0"})]})}var be=k(pe());var F=k(L());function Tt({label:e,hint:t,error:r,labelTrailing:o,htmlFor:i,className:a,children:p}){return(0,F.jsxs)("div",{className:a,children:[(0,F.jsxs)("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[(0,F.jsx)("label",{htmlFor:i,className:m(At,"mb-0"),children:e}),o]}),p,r?(0,F.jsx)("p",{className:St,role:"alert",children:r}):t?(0,F.jsx)("p",{className:m(H,"mt-1"),children:t}):null]})}var _t=(0,be.forwardRef)(function({invalid:t,className:r,id:o,onKeyDown:i,onCompositionStart:a,onCompositionEnd:p,...g},c){let l=(0,be.useId)(),h=ft({onKeyDown:i,onCompositionStart:a,onCompositionEnd:p}),d=gt(c);return mt(d.ref,g.onChange),(0,F.jsx)("input",{ref:d.setRef,id:o??l,"aria-invalid":t||void 0,className:Et(t,r),...h.props,...g})});var J=k(L());function It({className:e}){return(0,J.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,role:"img","aria-label":"Google",children:[(0,J.jsx)("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"var(--platform-icon-mono, #4285F4)"}),(0,J.jsx)("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"var(--platform-icon-mono, #34A853)"}),(0,J.jsx)("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"var(--platform-icon-mono, #FBBC05)"}),(0,J.jsx)("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"var(--platform-icon-mono, #EA4335)"})]})}var _={index:"/account",login:"/account/login",orders:"/account/orders",order:e=>`/account/orders/${e}`,content:"/account/content",contentItem:e=>`/account/content/${encodeURIComponent(e)}`,courses:"/account/courses",settings:"/account/settings",profile:"/account/profile",devices:"/account/devices",apiSession:"/account/api/session",apiChallenge:"/account/api/challenge",apiVerify:"/account/api/verify",apiOauthStart:"/account/api/oauth/start",apiOauth2Authorize:"/account/api/oauth2/authorize",apiPasskeyLoginOptions:"/account/api/auth/passkey/options",apiPasskeyLoginVerify:"/account/api/auth/passkey/verify",apiPasskeys:"/account/api/passkeys",apiPasskey:e=>`/account/api/passkeys/${encodeURIComponent(e)}`,apiPasskeyRegisterOptions:"/account/api/passkeys/register/options",apiPasskeyRegister:"/account/api/passkeys/register",apiProfile:"/account/api/profile",apiEmailChange:"/account/api/email-change",apiEmailChangeVerify:"/account/api/email-change/verify",apiAddresses:"/account/api/addresses",apiAddress:e=>`/account/api/addresses/${encodeURIComponent(e)}`,apiAddressDefault:e=>`/account/api/addresses/${encodeURIComponent(e)}/default`,apiTaxIdentities:"/account/api/tax-identities",apiTaxIdentity:e=>`/account/api/tax-identities/${encodeURIComponent(e)}`,apiConsents:"/account/api/consents",apiData:"/account/api/data",apiErasure:"/account/api/erasure",apiContentOpen:e=>`/account/api/content/${encodeURIComponent(e)}/open`,apiContentQuiz:e=>`/account/api/content/${encodeURIComponent(e)}/quiz`,apiContentTranscript:e=>`/account/api/content/${encodeURIComponent(e)}/transcript`,apiProgress:"/account/api/progress",apiCertificate:e=>`/account/api/deliverables/${encodeURIComponent(e)}/certificate`,apiOrderReceipt:e=>`/account/api/orders/${encodeURIComponent(e)}/receipt`};var gn="knr_customer";var Pt=["passkey","google","apple","line","kakao","external_oidc","email_code","email_link"],wr=["passkey","google","email_code","email_link"],kr="email_code",vr=["email_code","email_link"];function xe(e){return typeof e=="string"&&Pt.includes(e)}function hn(e){let t=new Set(Array.isArray(e)?e.filter(xe).filter(r=>wr.includes(r)):vr);return t.add(kr),Pt.filter(r=>t.has(r))}function Oe(e,t=_.index){if(typeof e!="string")return t;let r=e.trim();return!r||r.length>512||!r.startsWith("/")||r.startsWith("//")||r.startsWith("/\\")||/[\r\n\0]/.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r)?t:r}var Tr=[{id:"orders",order:10,route:_.orders,navLabelKey:"orders",icon:"shopping-bag",apiResourcePrefixes:["/orders","/reviews"],visibility:"capability"},{id:"content",order:20,route:_.content,navLabelKey:"content",icon:"book-open",apiResourcePrefixes:["/deliverables","/units","/progress","/access"],visibility:"capability"},{id:"account",order:90,route:_.settings,navLabelKey:"account",icon:"user",apiResourcePrefixes:["/me","/session","/sessions","/email-change","/addresses","/tax-identities","/consents","/passkeys","/data","/erasure"],visibility:"always"}];function xt(e){let t=new Set(e.filter(r=>r.visible).map(r=>r.id));return[...Tr].filter(r=>t.has(r.id)).sort((r,o)=>r.order-o.order)}function _r(e,t){let r=e?.get("utm_source")?.toLowerCase()??"";if(/^(ig|instagram|threads|fb|facebook)/.test(r))return!0;let o=(t??"").toLowerCase();return[/threads\.net/i,/threads\.com/i,/instagram\.com/i,/m\.facebook\.com/i,/l\.facebook\.com/i,/lm\.facebook\.com/i].some(a=>a.test(o))}function Ot(e){if(typeof navigator>"u")return!1;let t=navigator.userAgent?.toLowerCase()??"";return!!([/\bbarcelona\b/i,/fban|fbav/i,/fb_iab/i,/fb_iab\/threads|fban\/threads|fbios.*threads/i,/instagram/i,/threads/i,/fbios/i,/line\//i,/wechat/i,/micromessenger/i,/twitter/i,/linkedin/i,/reddit/i,/pinterest/i,/discord/i,/snapchat/i,/tiktok/i,/kakaotalk/i,/naver/i,/webview/i].some(o=>o.test(t))||e&&_r(e.searchParams,e.referrer))}var Ce="NETWORK_ERROR";async function Nt(e,t){let r=await e.json().catch(()=>null);return!e.ok||!r?.ok?{ok:!1,code:r?.code??t,...typeof r?.retryAfter=="number"?{retryAfter:r.retryAfter}:{}}:r}async function G(e,t,r){try{let o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t??{})});return await Nt(o,r)}catch{return{ok:!1,code:Ce}}}function En(){let e=_;return{altchaChallengeUrl:"/api/form-protection/altcha",challengeUrl:"/api/form-protection/challenge",requestChallenge:({email:t,locale:r,returnTo:o,protection:i})=>G(e.apiChallenge,{email:t,locale:r,returnTo:o,...i},"SERVER_ERROR"),verifyCode:({email:t,code:r})=>G(e.apiVerify,{method:"code",email:t,code:r},"INVALID_CODE"),verifyToken:({method:t,token:r})=>G(e.apiVerify,{method:t,token:r},"CODE_EXPIRED"),startOauth:({method:t,returnTo:r,locale:o})=>G(e.apiOauthStart,{method:t,returnTo:r,locale:o},"METHOD_DISABLED"),passkeyLoginOptions:()=>G(e.apiPasskeyLoginOptions,{},"SERVER_ERROR"),passkeyLoginVerify:t=>G(e.apiPasskeyLoginVerify,t,"PASSKEY_FAILED"),listPasskeys:async()=>{try{let t=await fetch(e.apiPasskeys,{credentials:"same-origin"});return await Nt(t,"UNAUTHENTICATED")}catch{return{ok:!1,code:Ce}}},passkeyRegisterOptions:()=>G(e.apiPasskeyRegisterOptions,{},"SERVER_ERROR"),passkeyRegister:t=>G(e.apiPasskeyRegister,t,"PASSKEY_FAILED"),session:async()=>{let t=await fetch(e.apiSession,{credentials:"same-origin"});if(t.status===401)return null;if(!t.ok)throw new Error(`HTTP ${t.status}`);let r=await t.json();return!r?.ok||!r.contact?null:{contact:r.contact,sections:r.sections??[],landing:r.landing??e.index}},signOut:async()=>{await fetch(e.apiSession,{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mode:"current"})}).catch(()=>{})}}}var Lt=new Set(["PASSKEY_CANCELLED"]);function Ne(e,t){switch((e??"").toUpperCase()){case"INVALID_EMAIL":return t.errorInvalidEmail;case"INVALID_CODE":return t.errorInvalidCode;case"CODE_EXPIRED":return t.errorCodeExpired;case"TOO_MANY_ATTEMPTS":return t.errorTooManyAttempts;case"ACCOUNT_BLOCKED":return t.errorAccountBlocked;case"RATE_LIMITED":return t.errorRateLimited;case"BOT_PROTECTION_FAILED":return t.errorBotProtection;case"SIGNUP_DISABLED":return t.errorSignupDisabled;case"SEND_FAILED":return t.errorSendFailed;case"METHOD_DISABLED":return t.errorMethodDisabled;case"EMAIL_NOT_VERIFIED":return t.errorEmailNotVerified;case"NO_EMAIL":return t.errorNoEmail;case"PROVIDER_DENIED":case"TOKEN_EXCHANGE_FAILED":case"INVALID_ID_TOKEN":case"INVALID_STATE":return t.errorProviderFailed;case"PASSKEY_UNSUPPORTED":return t.errorPasskeyUnsupported;case"PASSKEY_FAILED":case"NOT_FOUND":case"VERIFY_FAILED":case"CHALLENGE_EXPIRED":case"NO_HOST":return t.errorPasskeyFailed;case"ALREADY_REGISTERED":return t.errorPasskeyAlreadyRegistered;case"SERVICE_UNAVAILABLE":return t.errorServiceUnavailable;case"SHARED_SENDER_PAUSED":return t.errorEmailSignInPaused;case Ce:default:return t.errorGeneric}}function I(e){let t=new Uint8Array(e),r="";for(let i of t)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function q(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,o=t.padEnd(t.length+r,"="),i=atob(o),a=new ArrayBuffer(i.length),p=new Uint8Array(a);for(let g=0;g<i.length;g++)p[g]=i.charCodeAt(g);return a}function M(){return Ir.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}var Ir={stubThis:e=>e};function ye(e){let{id:t}=e;return{...e,id:q(t),transports:e.transports,type:e.type}}function ne(e){return e==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var C=class extends Error{constructor({message:t,code:r,cause:o,name:i}){super(t,{cause:o}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i??o.name,this.code=r}};function Dt({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new C({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(r.authenticatorSelection?.requireResidentKey===!0)return new C({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&r.authenticatorSelection?.userVerification==="required")return new C({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(r.authenticatorSelection?.userVerification==="required")return new C({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new C({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new C({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return r.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new C({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new C({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){let o=globalThis.location.hostname;if(ne(o)){if(r.rp.id!==o)return new C({message:`The RP ID "${r.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new C({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new C({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new C({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}var Le=class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){let t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}},Q=new Le;var Pr=["cross-platform","platform"];function Ae(e){if(e&&!(Pr.indexOf(e)<0))return e}async function Ut(e){!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:r=!1}=e;if(!M())throw new Error("WebAuthn is not supported in this browser");let o={...t,challenge:q(t.challenge),user:{...t.user,id:q(t.user.id)},excludeCredentials:t.excludeCredentials?.map(ye)},i={};r&&(i.mediation="conditional"),i.publicKey=o,i.signal=Q.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(A){throw Dt({error:A,options:i})}if(!a)throw new Error("Registration was not completed");let{id:p,rawId:g,response:c,type:l}=a,h;typeof c.getTransports=="function"&&(h=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm=="function")try{d=c.getPublicKeyAlgorithm()}catch(A){De("getPublicKeyAlgorithm()",A)}let x;if(typeof c.getPublicKey=="function")try{let A=c.getPublicKey();A!==null&&(x=I(A))}catch(A){De("getPublicKey()",A)}let O;if(typeof c.getAuthenticatorData=="function")try{O=I(c.getAuthenticatorData())}catch(A){De("getAuthenticatorData()",A)}return{id:p,rawId:I(g),response:{attestationObject:I(c.attestationObject),clientDataJSON:I(c.clientDataJSON),transports:h,publicKeyAlgorithm:d,publicKey:x,authenticatorData:O},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Ae(a.authenticatorAttachment)}}function De(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
2
2
|
`,t)}function Se(){if(!M())return Ue.stubThis(new Promise(t=>t(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Ue.stubThis(new Promise(t=>t(!1))):Ue.stubThis(e.isConditionalMediationAvailable())}var Ue={stubThis:e=>e};function Mt({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new C({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new C({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){let o=globalThis.location.hostname;if(ne(o)){if(r.rpId!==o)return new C({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new C({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new C({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}async function Bt(e){!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:r=!1,verifyBrowserAutofillInput:o=!0}=e;if(!M())throw new Error("WebAuthn is not supported in this browser");let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(ye));let a={...t,challenge:q(t.challenge),allowCredentials:i},p={};if(r){if(!await Se())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&o)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');p.mediation="conditional",a.allowCredentials=[]}p.publicKey=a,p.signal=Q.createNewAbortSignal();let g;try{g=await navigator.credentials.get(p)}catch(O){throw Mt({error:O,options:p})}if(!g)throw new Error("Authentication was not completed");let{id:c,rawId:l,response:h,type:d}=g,x;return h.userHandle&&(x=I(h.userHandle)),{id:c,rawId:I(l),response:{authenticatorData:I(h.authenticatorData),clientDataJSON:I(h.clientDataJSON),signature:I(h.signature),userHandle:x},type:d,clientExtensionResults:g.getClientExtensionResults(),authenticatorAttachment:Ae(g.authenticatorAttachment)}}async function Me(){if(typeof PublicKeyCredential.getClientCapabilities=="function"){let e=await PublicKeyCredential.getClientCapabilities(),t=V(e.userVerifyingPlatformAuthenticator);t==="unknown"&&typeof PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable=="function"&&(await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()?t="supported":t="unsupported");let r=V(e.conditionalGet);return r==="unknown"&&typeof PublicKeyCredential.isConditionalMediationAvailable=="function"&&(await PublicKeyCredential.isConditionalMediationAvailable()?r="supported":r="unsupported"),Kt.stubThis({conditionalCreate:V(e.conditionalCreate),conditionalGet:r,hybridTransport:V(e.hybridTransport),passkeyPlatformAuthenticator:V(e.passkeyPlatformAuthenticator),userVerifyingPlatformAuthenticator:t,relatedOrigins:V(e.relatedOrigins),signalAllAcceptedCredentials:V(e.signalAllAcceptedCredentials),signalCurrentUserDetails:V(e.signalCurrentUserDetails),signalUnknownCredential:V(e.signalUnknownCredential)})}return Kt.stubThis({conditionalCreate:"unknown",conditionalGet:"unknown",hybridTransport:"unknown",passkeyPlatformAuthenticator:"unknown",userVerifyingPlatformAuthenticator:"unknown",relatedOrigins:"unknown",signalAllAcceptedCredentials:"unknown",signalCurrentUserDetails:"unknown",signalUnknownCredential:"unknown"})}function V(e){if(e===!0)return"supported";if(e===!1)return"unsupported";if(typeof e>"u")return"unknown";throw new Error("Unexpected capability value:",e)}var Kt={stubThis:e=>e};function Vt(){return typeof window<"u"&&M()}function $t(){return Vt()?Se().catch(()=>!1):Promise.resolve(!1)}async function Ht(){if(!Vt())return!1;try{return(await Me()).userVerifyingPlatformAuthenticator==="supported"}catch{return!1}}function Ft(e){return e instanceof C?e.code==="ERROR_CEREMONY_ABORTED":e instanceof Error&&(e.name==="NotAllowedError"||e.name==="AbortError")}function Z(){Q.cancelCeremony()}async function Gt(e,t){let r=await e.passkeyLoginOptions();if(!r.ok)return r;let o;try{o=await Bt({optionsJSON:r.options,useBrowserAutofill:t.useBrowserAutofill??!1})}catch(i){return{ok:!1,code:Ft(i)?"PASSKEY_CANCELLED":"PASSKEY_FAILED"}}return t.onAssertion?.(),e.passkeyLoginVerify({challengeId:r.challengeId,response:o,returnTo:t.returnTo,locale:t.locale})}async function Wt(e,t={}){let r=await e.passkeyRegisterOptions();if(!r.ok)return r;let o;try{o=await Ut({optionsJSON:r.options})}catch(i){return i instanceof C&&i.code==="ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"?{ok:!1,code:"ALREADY_REGISTERED"}:{ok:!1,code:Ft(i)?"PASSKEY_CANCELLED":"PASSKEY_FAILED"}}return e.passkeyRegister({response:o,name:t.name})}var Yt="kanorio.customer.last-method",Be="kanorio.customer.passkey-offer",zt=2;function Jt(e){try{return typeof localStorage>"u"?null:localStorage.getItem(e)}catch{return null}}function Ke(e,t){try{if(typeof localStorage>"u")return;t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}function Ve(e){let t=Jt(`${Yt}:${e}`);return xe(t)?t:null}function $e(e,t){Ke(`${Yt}:${e}`,t)}function qt(e){let t=Number(Jt(`${Be}:${e}`)??"0");return Number.isFinite(t)&&t>0?t:0}function jt(e){Ke(`${Be}:${e}`,String(qt(e)+1))}function Xt(e){Ke(`${Be}:${e}`,String(zt))}function Qt(e){return qt(e)>=zt}var n=k(L()),xr=30,Or=15e3,Nr=3e3,Lr=new Set(["email_code","email_link"]),Dr={"shopping-bag":pt,"book-open":at,user:fe};function Zt(){if(!(typeof window>"u"))try{let e=new URL(window.location.href),t=!1;for(let r of["token","handoff","error","verify"])e.searchParams.has(r)&&(e.searchParams.delete(r),t=!0);t&&window.history.replaceState(window.history.state,"",e.toString())}catch{}}function Ur(e){let[t,r]=(0,u.useState)(()=>Date.now());return(0,u.useEffect)(()=>{if(e===null||e<=Date.now())return;let o=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(o)},[e]),e===null?0:Math.max(0,Math.ceil((e-t)/1e3))}function ti({variant:e,auth:t,initial:r,returnTo:o,onNavigate:i,onSignedIn:a,onSignedOut:p,className:g}){let{transport:c,messages:l,methods:h,siteId:d,siteName:x,locale:O,siteLocale:A,accountBaseUrl:W}=t,[b,v]=(0,u.useState)(()=>r?.token?.trim()||r?.handoff?.trim()?{kind:"consuming"}:r?.verify&&r.email?.trim()?{kind:"code",email:r.email.trim(),sentAt:Date.now()}:{kind:"identify"}),[oe,Ee]=(0,u.useState)(r?.email??""),[Re,E]=(0,u.useState)(""),[T,y]=(0,u.useState)(null),[He,R]=(0,u.useState)(()=>r?.error?Ne(r.error,l):null),[er,tr]=(0,u.useState)(null),[Fe,rr]=(0,u.useState)(!1),w=(0,u.useRef)(!0),Ge=(0,u.useRef)(null),We=(0,u.useMemo)(()=>h.filter(s=>!Lr.has(s)),[h]),Ye=We.length>0?l.signInSubtitleChoose:l.signInSubtitle,ie=h.includes("passkey"),$=o?Oe(o):null,{getProtectionData:ze,isSubmittable:se,registerFocus:ae,reset:Je,fieldProps:nr,challengeProps:qe,provider:we,prepare:je,renewCaptcha:Xe}=yt({variant:"full",context:`customer-login:${d}`,challengeUrl:c.challengeUrl,altchaChallengeUrl:c.altchaChallengeUrl,entry:"customer_login"}),Qe=we==="hcaptcha"||we==="recaptcha"&&qe.captcha?.recaptchaVersion==="v2",[Ze,le]=(0,u.useState)(!1),[or,ir]=(0,u.useState)(0),j=(0,u.useRef)(null),X=(0,u.useRef)(null),ue=(0,u.useCallback)(()=>{j.current=null,X.current&&(clearTimeout(X.current),X.current=null)},[]),et=(0,u.useCallback)(s=>{if(se){s();return}if(Qe){y(null),R(l.errorBotProtection);return}j.current=s,X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{j.current&&(j.current=null,y(null),le(!0),R(l.errorBotProtection))},Or)},[se,Qe,l.errorBotProtection]);(0,u.useEffect)(()=>{if(!se||!j.current)return;let s=j.current;ue(),s()},[se,ue]);let ce=(0,u.useRef)(null),sr=(0,u.useCallback)(s=>{ce.current&&(clearTimeout(ce.current),ce.current=null),s==="error"?le(!0):s==="verifying"&&(ce.current=setTimeout(()=>le(!0),Nr))},[]),tt=(0,u.useCallback)(()=>{Je(),ae(),Xe(),ir(s=>s+1)},[Je,ae,Xe]);(0,u.useEffect)(()=>(w.current=!0,rr(Ot()),tr(Ve(d)),()=>{w.current=!1,ue(),Z()}),[d,ue]),(0,u.useEffect)(()=>{let s=f=>{f.persisted&&y(null)};return window.addEventListener("pageshow",s),()=>window.removeEventListener("pageshow",s)},[]);let P=(0,u.useCallback)((s,f)=>{w.current&&(!f?.raw&&Lt.has(s.toUpperCase())||R(f?.raw?s:Ne(s,l)))},[l]),de=(0,u.useCallback)(s=>{if(e==="page"){v({kind:"redirecting"});let f=Oe(s.returnTo??$??`${W}${t.landing??_.index}`);window.location.assign(f);return}y(null),v({kind:"identify"})},[e,$,W,t.landing]),ee=(0,u.useCallback)(async(s,f)=>{$e(d,f),a?.(s,f);let S=await c.session().then(Y=>({known:!0,overview:Y}),()=>({known:!1}));if(w.current){if(S.known?t.applySession(S.overview):t.retrySession(),f!=="passkey"&&ie&&!Qt(d)&&await Ht()){let Y=await c.listPasskeys();if(!w.current)return;if(Y.ok&&Y.passkeys.length===0){y(null),R(null),v({kind:"passkey-offer",grant:s});return}}de(s)}},[d,a,c,t,ie,de]),ar=(0,u.useRef)(r);(0,u.useEffect)(()=>{let s=ar.current;if(!s)return;(s.error||s.verify)&&Zt();let f=s.token?.trim()||null,S=s.handoff?.trim()||null;if(f||S){Zt();let Y=f?"link":"handoff",ke=f??S;if(Ge.current===ke)return;Ge.current=ke,c.verifyToken({method:Y,token:ke}).then(ve=>{if(!w.current)return;if(!ve.ok){v({kind:"identify"}),P(ve.code);return}let hr=Y==="link"?"email_link":Ve(d)??"google";return ee(ve,hr)}).catch(()=>{w.current&&(v({kind:"identify"}),P("SERVER_ERROR"))});return}},[]);let rt=(0,u.useCallback)(async(s,f)=>{y(f==="first"?"challenge":"resend"),R(null),await je();let S=await c.requestChallenge({email:s,locale:A,returnTo:$??void 0,protection:ze()});if(w.current){if(y(null),tt(),!S.ok){S.code==="BOT_PROTECTION_FAILED"&&le(!0),P(S.code);return}E(""),v({kind:"code",email:s,sentAt:Date.now()})}},[c,A,$,ze,tt,P,je]),lr=s=>{s.preventDefault();let f=oe.trim();if(!f||!f.includes("@")){R(l.errorInvalidEmail);return}Z(),R(null),y("challenge"),et(()=>{rt(f,"first")})},ur=s=>{y("resend"),et(()=>{rt(s,"resend")})},cr=(0,u.useCallback)(async(s,f)=>{if(!/^\d{6}$/.test(f)){R(l.errorInvalidCode);return}y("verify"),R(null);let S=await c.verifyCode({email:s,code:f});if(w.current){if(!S.ok){y(null),E(""),P(S.code);return}await ee(S,"email_code")}},[c,l.errorInvalidCode,P,ee]),nt=(0,u.useCallback)(async s=>{s||(Z(),y("passkey"),R(null));let f=await Gt(c,{useBrowserAutofill:s,returnTo:$??void 0,locale:A,onAssertion:()=>{w.current&&v({kind:"consuming"})}});if(w.current){if(!f.ok){y(null),v(S=>S.kind==="consuming"?{kind:"identify"}:S),P(f.code);return}await ee(f,"passkey")}},[c,$,A,P,ee]);(0,u.useEffect)(()=>{if(!ie||b.kind!=="identify"||t.user)return;let s=!1;return $t().then(f=>{!s&&f&&nt(!0)}),()=>{s=!0,Z()}},[ie,b.kind,t.user]);let dr=(0,u.useCallback)(async s=>{if(Fe){v({kind:"in-app"});return}Z(),y("oauth"),R(null);let f=await c.startOauth({method:s,returnTo:$??void 0,locale:A});if(w.current){if(!f.ok){y(null),P(f.code);return}$e(d,s),window.location.assign(f.url)}},[Fe,c,$,A,d,P]),pr=async s=>{y("passkey-register"),R(null);let f=await Wt(c);if(w.current){if(y(null),!f.ok){P(f.code);return}Xt(d),de(s)}},fr=s=>{jt(d),de(s)},mr=async()=>{y("verify"),await t.signOut(),w.current&&(y(null),p?.(),i?.())},gr=te(l.signInTitle,{siteName:x}).trim(),ot=He?(0,n.jsx)("div",{role:"alert",className:m(Ie,"mb-4"),children:He}):null,N;b.kind==="consuming"||b.kind==="redirecting"?N=(0,n.jsx)("p",{className:m("py-8 text-center text-sm",D),"aria-live":"polite",children:l.verifying}):b.kind==="passkey-offer"?N=(0,n.jsx)(Yr,{messages:l,busy:T==="passkey-register",onCreate:()=>{pr(b.grant)},onSkip:()=>fr(b.grant)}):b.kind==="in-app"?N=(0,n.jsx)(zr,{messages:l,onBack:()=>v({kind:"identify"})}):b.kind==="code"?N=(0,n.jsx)(Gr,{email:b.email,sentAt:b.sentAt,code:Re,onCodeChange:E,busy:T,messages:l,onVerify:s=>{cr(b.email,s)},onResend:()=>ur(b.email),onChangeEmail:()=>{v({kind:"identify"}),E(""),R(null)}}):t.pending?N=(0,n.jsxs)("p",{className:m("flex items-center gap-2 py-6 text-sm",D),role:"status","aria-live":"polite",children:[(0,n.jsx)("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent","aria-hidden":"true"}),l.sessionChecking]}):t.sessionUnavailable?N=(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{role:"alert",className:m(Ie,"mb-4"),children:l.errorServiceUnavailable}),(0,n.jsx)(U,{type:"button",block:!0,onClick:t.retrySession,children:l.contentRetry})]}):t.user?N=e==="panel"?(0,n.jsx)(Wr,{auth:t,busy:T!==null,onNavigate:i,onSignOut:()=>{mr()}}):(0,n.jsx)("p",{className:m("text-sm",D),children:(0,n.jsx)("a",{href:`${W}${t.landing??_.index}`,className:me({block:!0}),children:l.signedInContinue})}):N=(0,n.jsx)(Mr,{email:oe,onEmailChange:s=>{ae(),Ee(s)},onEmailFocus:ae,onSubmit:lr,otherMethods:We,lastMethod:er,busy:T,messages:l,onPasskey:()=>{nt(!1)},onOauth:s=>{dr(s)}});let it=b.kind==="identify"&&(t.pending||t.sessionUnavailable)?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ct,{...nr,locale:O,renderAltcha:!1}),(0,n.jsx)(bt,{...qe,locale:O,invisible:!0,revealed:Ze,generation:or,onStateChange:sr,onCaptchaError:()=>R(l.errorBotProtection),className:Ze||we!=="kanorio"?"mt-3":void 0})]});return e==="page"?(0,n.jsx)("div",{className:m("mx-auto w-full max-w-md",g),children:(0,n.jsxs)("div",{className:m(Rt,"p-6 sm:p-8"),children:[(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)("h1",{className:m("text-xl font-semibold",B),children:gr}),b.kind==="identify"&&!t.user&&!t.pending&&!t.sessionUnavailable?(0,n.jsx)("p",{className:m("mt-1",H),children:Ye}):null]}),ot,N,b.kind==="identify"||b.kind==="code"?it:null]})}):(0,n.jsxs)("div",{className:g,children:[b.kind==="identify"&&!t.user&&!t.pending&&!t.sessionUnavailable?(0,n.jsx)("p",{className:m("mb-4",H),children:Ye}):null,ot,N,b.kind==="identify"||b.kind==="code"?it:null]})}function Mr({email:e,onEmailChange:t,onEmailFocus:r,onSubmit:o,otherMethods:i,lastMethod:a,busy:p,messages:g,onPasskey:c,onOauth:l}){let h=p!==null;return(0,n.jsxs)("div",{className:"space-y-4",children:[i.length>0?(0,n.jsxs)("div",{className:"space-y-2",children:[i.map(d=>(0,n.jsx)(Hr,{method:d,last:a===d,loading:d==="passkey"&&p==="passkey"||d!=="passkey"&&p==="oauth",disabled:h,messages:g,onClick:()=>d==="passkey"?c():l(d)},d)),(0,n.jsxs)("div",{className:"flex items-center gap-3 py-1","aria-hidden":"true",children:[(0,n.jsx)("span",{className:m("h-px flex-1",ge)}),(0,n.jsx)("span",{className:m("text-xs uppercase tracking-wide",D),children:g.orContinueWith}),(0,n.jsx)("span",{className:m("h-px flex-1",ge)})]})]}):null,(0,n.jsxs)("form",{onSubmit:o,className:"space-y-3",noValidate:!0,children:[(0,n.jsx)(Tt,{label:g.emailLabel,htmlFor:"customer-login-email",hint:i.length>0?g.emailCodeHint:void 0,children:(0,n.jsx)(_t,{id:"customer-login-email",type:"email",name:"email",inputMode:"email",required:!0,autoComplete:"username webauthn",value:e,onFocus:r,onChange:d=>t(d.target.value),placeholder:g.emailPlaceholder,disabled:h&&p!=="passkey"})}),(0,n.jsx)(U,{type:"submit",block:!0,loading:p==="challenge",disabled:h,leading:a==="email_code"||a==="email_link"?(0,n.jsx)(Fr,{}):void 0,children:g.continueWithEmail})]})]})}var Br=({className:e})=>(0,n.jsx)(ut,{className:e,"aria-hidden":"true"}),Kr={passkey:({className:e})=>(0,n.jsx)(_e,{className:e,"aria-hidden":"true"}),google:({className:e})=>(0,n.jsx)(It,{className:e})},Vr={apple:"Apple",line:"LINE",kakao:"Kakao",external_oidc:"SSO"};function $r(e,t){return e==="passkey"?t.continueWithPasskey:e==="google"?t.continueWithGoogle:te(t.continueWithProvider,{provider:Vr[e]??e})}function Hr({method:e,last:t,loading:r,disabled:o,messages:i,onClick:a}){let p=Kr[e]??Br;return(0,n.jsxs)(U,{type:"button",variant:"secondary",block:!0,loading:r,disabled:o,onClick:a,leading:(0,n.jsx)(p,{className:"h-4 w-4"}),className:"relative",children:[(0,n.jsx)("span",{children:$r(e,i)}),t?(0,n.jsx)("span",{className:m(wt("neutral"),"absolute right-3"),children:i.lastUsed}):null]})}function Fr(){return(0,n.jsx)(Te,{className:"h-4 w-4","aria-hidden":"true"})}function Gr({email:e,sentAt:t,code:r,onCodeChange:o,busy:i,messages:a,onVerify:p,onResend:g,onChangeEmail:c}){let l=Ur(t+xr*1e3),h=i==="verify";return(0,n.jsxs)("form",{onSubmit:d=>{d.preventDefault(),h||p(r)},className:"space-y-4",noValidate:!0,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:m("text-base font-semibold",B),children:a.codeStepTitle}),(0,n.jsx)("p",{className:m("mt-1 break-words",H),children:te(a.codeSentHint,{email:e})})]}),(0,n.jsx)(vt,{label:a.codeLabel,value:r,onChange:o,onComplete:d=>!h&&p(d),disabled:h,autoFocus:!0}),(0,n.jsx)(U,{type:"submit",block:!0,loading:h,disabled:i!==null||r.length!==6,children:a.verifyAndSignIn}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[(0,n.jsx)("button",{type:"button",className:Pe,disabled:l>0||i!==null,onClick:g,"aria-live":"polite",children:i==="resend"?a.sendingCode:l>0?te(a.resendIn,{seconds:String(l)}):a.resendCode}),(0,n.jsxs)("button",{type:"button",className:Pe,disabled:i!==null,onClick:c,children:[(0,n.jsx)(st,{className:"h-4 w-4","aria-hidden":"true"}),a.useAnotherEmail]})]})]})}function Wr({auth:e,busy:t,onNavigate:r,onSignOut:o}){let{messages:i,accountBaseUrl:a}=e,p=e.user,g=xt(e.sections),l=(p.name?.trim()||p.email||"").trim().charAt(0).toUpperCase();return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-base font-semibold",style:{backgroundColor:"var(--brand-color, #18181b)",color:"var(--brand-foreground, #ffffff)"},"aria-hidden":"true",children:l||(0,n.jsx)(fe,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[p.name?.trim()?(0,n.jsx)("p",{className:m("truncate text-sm font-semibold",B),children:p.name}):null,p.email?(0,n.jsx)("p",{className:m("truncate text-sm",D),children:p.email}):null]})]}),(0,n.jsx)("nav",{"aria-label":i.shell.menu,children:(0,n.jsxs)("ul",{className:"-mx-2 space-y-0.5",children:[(g.length>0?g:null)?.map(h=>{let d=Dr[h.icon];return(0,n.jsx)("li",{children:(0,n.jsxs)("a",{href:`${a}${h.route}`,onClick:r,className:m("flex min-h-11 items-center gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 text-sm font-medium transition "+re,B),children:[(0,n.jsx)(d,{className:m("h-4 w-4 shrink-0",D),"aria-hidden":"true"}),i.nav[h.navLabelKey]]})},h.id)}),g.length===0?(0,n.jsx)("li",{children:(0,n.jsxs)("a",{href:`${a}${_.index}`,onClick:r,className:m("flex min-h-11 items-center gap-3 rounded-[var(--site-radius-button,0.5rem)] px-2 text-sm font-medium",B),children:[(0,n.jsx)(fe,{className:m("h-4 w-4 shrink-0",D),"aria-hidden":"true"}),i.title]})}):null]})}),(0,n.jsx)("div",{className:m("pt-3",ge),children:(0,n.jsx)(U,{type:"button",variant:"ghost",block:!0,loading:t,onClick:o,leading:(0,n.jsx)(dt,{className:"h-4 w-4","aria-hidden":"true"}),children:i.signOut})})]})}function Yr({messages:e,busy:t,onCreate:r,onSkip:o}){return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--brand-color,#18181b)_12%,transparent)] text-[var(--brand-text,var(--brand-color,#18181b))]","aria-hidden":"true",children:(0,n.jsx)(_e,{className:"h-5 w-5"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:m("text-base font-semibold",B),children:e.passkeyOfferTitle}),(0,n.jsx)("p",{className:m("mt-1",H),children:e.passkeyOfferBody})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)(U,{type:"button",block:!0,loading:t,onClick:r,children:e.passkeyOfferCreate}),(0,n.jsx)(U,{type:"button",variant:"ghost",block:!0,disabled:t,onClick:o,children:e.passkeyOfferSkip})]})]})}function zr({messages:e,onBack:t}){let[r,o]=(0,u.useState)(!1),i=async()=>{try{await navigator.clipboard.writeText(window.location.href),o(!0),setTimeout(()=>o(!1),3e3)}catch{o(!1)}};return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:m("text-base font-semibold",B),children:e.inAppBrowserTitle}),(0,n.jsx)("p",{className:m("mt-1",H),children:e.inAppBrowserBody})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)(U,{type:"button",variant:"secondary",block:!0,onClick:()=>{i()},leading:r?(0,n.jsx)(Te,{className:"h-4 w-4","aria-hidden":"true"}):(0,n.jsx)(lt,{className:"h-4 w-4","aria-hidden":"true"}),children:r?e.inAppBrowserCopied:e.inAppBrowserCopyLink}),(0,n.jsx)(U,{type:"button",variant:"ghost",block:!0,onClick:t,children:e.inAppBrowserUseEmail})]})]})}export{me as a,gn as b,hn as c,En as d,Ne as e,xr as f,ti as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-KW2CH7SS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{TONE_BG_TINT_STRONG}from"./chunk-RKEHHJDU.js";import{runAltchaLoadedHook}from"./chunk-JH5D6YJX.js";import{cn}from"./chunk-VUTODQFX.js";import{usePartScope}from"./chunk-763LNERD.js";import{useOptionalSiteLabels}from"./chunk-U7H3W23Q.js";import{useResolvedCaptchaTheme}from"./chunk-Q4APVE7S.js";import{createContext,useContext}from"react";import{jsx}from"react/jsx-runtime";var BotProtectionConfigContext=createContext(null);function BotProtectionConfigProvider({value,children}){return jsx(BotProtectionConfigContext.Provider,{value,children})}function useBotProtectionConfig(){return useContext(BotProtectionConfigContext)}function defineProtectionEntry(definition){return definition}var PROTECTION_ENTRIES=[defineProtectionEntry({id:"forms",builtinVariant:"full",providerSelectable:true}),defineProtectionEntry({id:"customer_login",builtinVariant:"full",providerSelectable:true}),defineProtectionEntry({id:"checkout_draft",builtinVariant:"standard",providerSelectable:false})];var SELECTABLE_PROTECTION_ENTRY_IDS=PROTECTION_ENTRIES.filter(entry=>entry.providerSelectable).map(entry=>entry.id);function protectionEntryAction(id){return id}var BOT_PROTECTION_PROVIDERS=["kanorio","turnstile","recaptcha","hcaptcha"];function isBotProtectionProvider(value){return typeof value==="string"&&BOT_PROTECTION_PROVIDERS.includes(value)}function isThirdPartyBotProtectionProvider(value){return isBotProtectionProvider(value)&&value!=="kanorio"}function protectionCData(context){return context.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,255)}var BUILTIN_PUBLIC_BOT_PROTECTION={provider:"kanorio",recaptchaVersion:null,entries:{}};function parsePublicBotProtectionConfig(raw){if(!raw||typeof raw!=="object")return{...BUILTIN_PUBLIC_BOT_PROTECTION,entries:{}};const value=raw;if(!isThirdPartyBotProtectionProvider(value.provider))return{...BUILTIN_PUBLIC_BOT_PROTECTION,entries:{}};const entries={};const rawEntries=value.entries&&typeof value.entries==="object"?value.entries:{};for(const id of SELECTABLE_PROTECTION_ENTRY_IDS){const entry=rawEntries[id];if(entry&&typeof entry.siteKey==="string"&&entry.siteKey){entries[id]={siteKey:entry.siteKey,action:typeof entry.action==="string"?entry.action:protectionEntryAction(id)}}}const recaptchaVersion=value.recaptchaVersion==="v2"||value.recaptchaVersion==="v3"?value.recaptchaVersion:null;if(value.provider==="recaptcha"&&!recaptchaVersion)return{...BUILTIN_PUBLIC_BOT_PROTECTION,entries:{}};return{provider:value.provider,recaptchaVersion:value.provider==="recaptcha"?recaptchaVersion:null,entries}}import{useCallback}from"react";var BOT_PROTECTION_DEFAULTS={MIN_SUBMIT_TIME:5e3,MAX_SUBMIT_TIME:15*60*1e3,TOKEN_EXPIRY:60*60*1e3,INTERACTION_DELAY_MS:2e3};var ALTCHA_CHALLENGE_TTL_MS=10*60*1e3;var ALTCHA_WIDGET_EXPIRE_MS=ALTCHA_CHALLENGE_TTL_MS-60*1e3;var HONEYPOT_FIELD_NAME="_kfp_a";var HONEYPOT_FIELD_WP="_kfp_b";var HONEYPOT_FIELD_CO="_kfp_c";import{useEffect,useRef,createElement,useState}from"react";function resolveAltchaStateChange(detail){if(detail.state==="verified"&&detail.payload){return{kind:"verified",payload:detail.payload}}return{kind:"invalidated",state:detail.state}}var LOADERS={ar:()=>import("./ar-HRZRFWUW.js"),bg:()=>import("./bg-TNDZDXHZ.js"),bn:()=>import("./bn-L44L7SBD.js"),cs:()=>import("./cs-OMRFBZVP.js"),da:()=>import("./da-MEA64IPM.js"),de:()=>import("./de-7GBTXFMH.js"),el:()=>import("./el-BCFO2NS3.js"),en:()=>import("./en-LHV2B2XG.js"),"es-419":()=>import("./es-419-CN2GZEOV.js"),"es-es":()=>import("./es-es-GNKRK4H2.js"),fa:()=>import("./fa-FBR4MORA.js"),fi:()=>import("./fi-BATN376F.js"),"fr-ca":()=>import("./fr-ca-A4GWIOE7.js"),"fr-fr":()=>import("./fr-fr-FEUFFV6I.js"),he:()=>import("./he-RZE7SAH3.js"),hi:()=>import("./hi-G5IRZBZ5.js"),hu:()=>import("./hu-BPCAJCJ3.js"),id:()=>import("./id-E4ZYT3YK.js"),it:()=>import("./it-BGPYU5QL.js"),ja:()=>import("./ja-MA2A5SFZ.js"),ko:()=>import("./ko-G4I5K2UY.js"),mr:()=>import("./mr-HGKBSCPM.js"),nb:()=>import("./nb-ZOWEL6VQ.js"),nl:()=>import("./nl-4KAIKVKC.js"),pl:()=>import("./pl-BRJ5H72A.js"),"pt-br":()=>import("./pt-br-IOF65TN2.js"),"pt-pt":()=>import("./pt-pt-7BYW57KC.js"),ro:()=>import("./ro-GDWJ3F3A.js"),ru:()=>import("./ru-2GEOOKZX.js"),sv:()=>import("./sv-UJ5LCXFA.js"),sw:()=>import("./sw-HPTUVWO6.js"),ta:()=>import("./ta-TOIAFCN5.js"),te:()=>import("./te-PWIXXRJP.js"),th:()=>import("./th-3VH5JHWP.js"),tr:()=>import("./tr-TCPMEXLQ.js"),uk:()=>import("./uk-6S7TMK7C.js"),ur:()=>import("./ur-CV7QI6IC.js"),vi:()=>import("./vi-THIT43PD.js"),"zh-cn":()=>import("./zh-cn-NBHEPFJJ.js"),"zh-tw":()=>import("./zh-tw-HNBFCMMO.js")};var ALIASES={"zh-hant":"zh-tw","zh-hk":"zh-tw","zh-tw":"zh-tw",zh:"zh-cn","zh-cn":"zh-cn","zh-hans":"zh-cn",es:"es-es",fr:"fr-fr",pt:"pt-pt","nl-nl":"nl","nl-be":"nl","en-us":"en","en-gb":"en","en-au":"en","en-ca":"en",no:"nb",nn:"nb",ms:"id"};function resolveAltchaLanguage(locale){const raw=(locale??"").trim().toLowerCase();if(!raw)return"en";if(ALIASES[raw])return ALIASES[raw];if(LOADERS[raw])return raw;const base=raw.split("-")[0];if(ALIASES[base])return ALIASES[base];if(LOADERS[base])return base;return"en"}async function loadAltchaLanguage(locale){const code=resolveAltchaLanguage(locale);await LOADERS[code]();return code}import{jsx as jsx2}from"react/jsx-runtime";function loadAltchaWidget(locale){return Promise.all([import("./altcha-NPBMCOEY.js"),loadAltchaLanguage(locale)]).then(([,language])=>{runAltchaLoadedHook();return language})}function preloadAltchaWidget(locale){loadAltchaWidget(locale).catch(()=>{})}var THEME_CLASS=cn("block w-full","[--altcha-max-width:100%] [--altcha-border-width:1px]","[--altcha-border-radius:0.5rem]","[--altcha-color-base:var(--site-field-bg,rgba(255,255,255,0.9))]","[--altcha-color-border:var(--site-field-border,rgba(0,0,0,0.15))]","[--altcha-color-border-focus:var(--site-field-accent,var(--brand-color,#FF5733))]","[--altcha-color-active:var(--site-field-accent,var(--brand-color,#FF5733))]","[--altcha-color-text:inherit]","text-[15px] text-[var(--site-field-fg,#18181b)]","[&_.altcha-checkbox_input]:accent-[var(--site-field-accent,var(--brand-color,#FF5733))] [&_.altcha-spinner]:text-[var(--site-field-fg-muted,#71717a)]","[&_.altcha-main]:min-h-11 [&_.altcha-main]:px-3.5 [&_.altcha-main]:py-2.5");function AltchaWidget({challengeUrl,onVerified,onInvalidated,expireMs=ALTCHA_WIDGET_EXPIRE_MS,locale,className,invisible=false,revealed=false,generation=0,onStateChange,labels}){const siteLabels=useOptionalSiteLabels();const text=labels??siteLabels?.ui;const containerRef=useRef(null);const scope=usePartScope(containerRef);const[language,setLanguage]=useState(null);useEffect(()=>{let cancelled=false;void loadAltchaWidget(locale).then(code=>{if(!cancelled)setLanguage(code)});return()=>{cancelled=true}},[locale]);useEffect(()=>{if(!onVerified)return;const widget=containerRef.current?.querySelector("altcha-widget");if(!widget)return;const handler=ev=>{const detail=ev.detail;const transition=resolveAltchaStateChange(detail);if(transition.kind==="verified")onVerified(transition.payload);else onInvalidated?.();onStateChange?.(transition.kind==="verified"?"verified":transition.state)};widget.addEventListener("statechange",handler);return()=>widget.removeEventListener("statechange",handler)},[onVerified,onInvalidated,onStateChange,language,generation]);if(!text)throw new Error("AltchaWidget: pass `labels` or render it inside a SiteLabelsProvider");const hidden=invisible&&!revealed;if(!language){if(hidden)return null;return jsx2("div",{ref:scope.ref,className:cn("h-11 w-full animate-pulse rounded-lg "+TONE_BG_TINT_STRONG,scope.className,className),"aria-label":text.botProtectionLoading})}return jsx2("div",{ref:scope.ref,className:cn(THEME_CLASS,scope.className,className,hidden&&"hidden"),"aria-label":text.botProtection,hidden:hidden||void 0,children:createElement("altcha-widget",{key:generation,challengeurl:challengeUrl,expire:expireMs,language,...invisible?{auto:"onload"}:{},hidefooter:true,hidelogo:true})})}import{useEffect as useEffect2,useRef as useRef2}from"react";import{jsx as jsx3}from"react/jsx-runtime";var captchaGlobals=()=>globalThis;var scriptPromises=new Map;function loadScript(src,ready){const existing=scriptPromises.get(src);if(existing)return existing;const promise=new Promise((resolve,reject)=>{if(ready()){resolve();return}const script=document.createElement("script");script.src=src;script.async=true;script.defer=true;script.onerror=()=>{scriptPromises.delete(src);reject(new Error(`Failed to load ${src}`))};script.onload=()=>{const started=Date.now();const poll=()=>{if(ready())resolve();else if(Date.now()-started>1e4)reject(new Error(`Timed out waiting for ${src}`));else setTimeout(poll,50)};poll()};document.head.appendChild(script)});scriptPromises.set(src,promise);return promise}function hlParam(locale){return locale?`&hl=${encodeURIComponent(locale)}`:""}function ThirdPartyCaptcha({provider,siteKey,action,cData,recaptchaVersion,locale,invisible=false,theme,generation=0,onVerified,onInvalidated,onError,registerExecutor,className}){const containerRef=useRef2(null);const scope=usePartScope(containerRef);const widgetRef=useRef2(null);const callbacks=useRef2({onVerified,onInvalidated,onError});callbacks.current={onVerified,onInvalidated,onError};const isV3=provider==="recaptcha"&&recaptchaVersion==="v3";const resolvedTheme=useResolvedCaptchaTheme(theme,containerRef,!isV3);useEffect2(()=>{if(resolvedTheme===void 0)return;let cancelled=false;const el=containerRef.current;const verified=token=>!cancelled&&callbacks.current.onVerified(token);const invalidated=()=>!cancelled&&callbacks.current.onInvalidated();const failed=()=>{if(cancelled)return;callbacks.current.onInvalidated();callbacks.current.onError?.()};const themeOption=resolvedTheme?{theme:resolvedTheme}:{};if(provider==="turnstile"){loadScript("https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",()=>Boolean(captchaGlobals().turnstile?.render)).then(()=>{const api=captchaGlobals().turnstile;if(cancelled||!el||!api)return;widgetRef.current=api.render(el,{sitekey:siteKey,action,...cData?{cData}:{},theme:resolvedTheme??"auto",size:"flexible",appearance:invisible?"interaction-only":"always","refresh-expired":"auto",callback:verified,"expired-callback":invalidated,"timeout-callback":invalidated,"error-callback":failed})}).catch(failed)}else if(provider==="hcaptcha"){loadScript(`https://js.hcaptcha.com/1/api.js?render=explicit&recaptchacompat=off${hlParam(locale)}`,()=>Boolean(captchaGlobals().hcaptcha?.render)).then(()=>{const api=captchaGlobals().hcaptcha;if(cancelled||!el||!api)return;widgetRef.current=api.render(el,{sitekey:siteKey,...themeOption,callback:verified,"expired-callback":invalidated,"chalexpired-callback":invalidated,"error-callback":failed})}).catch(failed)}else if(isV3){loadScript(`https://www.google.com/recaptcha/api.js?render=${encodeURIComponent(siteKey)}${hlParam(locale)}`,()=>Boolean(captchaGlobals().grecaptcha?.execute)).then(()=>{if(cancelled)return;registerExecutor?.(()=>new Promise(resolve=>{const api=captchaGlobals().grecaptcha;if(!api)return resolve(null);api.ready(()=>{api.execute(siteKey,{action}).then(resolve,()=>resolve(null))})}))}).catch(failed)}else{loadScript(`https://www.google.com/recaptcha/api.js?render=explicit${hlParam(locale)}`,()=>Boolean(captchaGlobals().grecaptcha?.render)).then(()=>{const api=captchaGlobals().grecaptcha;if(cancelled||!el||!api)return;api.ready(()=>{if(cancelled||widgetRef.current!==null)return;widgetRef.current=api.render(el,{sitekey:siteKey,...themeOption,callback:verified,"expired-callback":invalidated,"error-callback":failed})})}).catch(failed)}return()=>{cancelled=true;registerExecutor?.(null);const id=widgetRef.current;widgetRef.current=null;if(id===null)return;try{if(provider==="turnstile")captchaGlobals().turnstile?.remove(id);else if(provider==="hcaptcha")captchaGlobals().hcaptcha?.remove(id)}catch{}}},[provider,siteKey,action,cData,isV3,invisible,locale,resolvedTheme]);useEffect2(()=>{if(generation===0)return;const id=widgetRef.current;if(id===null)return;try{if(provider==="turnstile")captchaGlobals().turnstile?.reset(id);else if(provider==="hcaptcha")captchaGlobals().hcaptcha?.reset(id);else if(!isV3)captchaGlobals().grecaptcha?.reset(id)}catch{}},[generation,provider,isV3]);if(isV3)return null;return jsx3("div",{ref:scope.ref,className:cn("min-h-[65px] w-full",scope.className,className),"data-captcha-provider":provider})}import{Fragment,jsx as jsx4,jsxs}from"react/jsx-runtime";var HONEYPOT_WRAPPER_STYLE={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0};function appendContext(url,context){if(!context)return url;const sep=url.includes("?")?"&":"?";return`${url}${sep}context=${encodeURIComponent(context)}`}function BotProtectionAltcha({variant,altchaChallengeUrl,context,onAltchaVerified,onAltchaInvalidated,locale,className,invisible,revealed,generation,onStateChange,labels}){if(variant!=="full"||!altchaChallengeUrl||!onAltchaVerified)return null;return jsx4(AltchaWidget,{challengeUrl:appendContext(altchaChallengeUrl,context),onVerified:onAltchaVerified,onInvalidated:onAltchaInvalidated,locale,className,invisible,revealed,generation,onStateChange,labels})}function BotProtectionChallenge({provider,fieldProps,captcha,locale,className,invisible,revealed,generation,onStateChange,onCaptchaError,theme}){if(provider!=="kanorio"&&captcha){return jsx4(ThirdPartyCaptcha,{provider:captcha.provider,siteKey:captcha.siteKey,action:captcha.action,cData:captcha.cData,recaptchaVersion:captcha.recaptchaVersion,locale,invisible,generation:captcha.generation,onVerified:captcha.onVerified,onInvalidated:captcha.onInvalidated,onError:onCaptchaError,registerExecutor:captcha.registerExecutor,theme,className})}return jsx4(BotProtectionAltcha,{...fieldProps,locale,className,invisible,revealed,generation,onStateChange})}function BotProtectionFields({variant,altchaChallengeUrl,context,onAltchaVerified,onAltchaInvalidated,onHoneypotChange,onHoneypotWpChange,onHoneypotCoChange,locale,renderAltcha=true}){const handleHpChange=useCallback(e=>{onHoneypotChange?.(e.target.value)},[onHoneypotChange]);const handleWpChange=useCallback(e=>{onHoneypotWpChange?.(e.target.value)},[onHoneypotWpChange]);const handleCoChange=useCallback(e=>{onHoneypotCoChange?.(e.target.value)},[onHoneypotCoChange]);const honeypots=[{name:HONEYPOT_FIELD_NAME,onChange:handleHpChange},{name:HONEYPOT_FIELD_WP,onChange:handleWpChange},{name:HONEYPOT_FIELD_CO,onChange:handleCoChange}];return jsxs(Fragment,{children:[renderAltcha&&jsx4(BotProtectionAltcha,{variant,altchaChallengeUrl,context,onAltchaVerified,onAltchaInvalidated,locale}),honeypots.map(({name,onChange})=>jsxs("div",{style:HONEYPOT_WRAPPER_STYLE,"aria-hidden":"true",children:[jsx4("label",{htmlFor:name,children:"Leave this field empty"}),jsx4("input",{type:"text",id:name,name,autoComplete:"one-time-code",tabIndex:-1,onChange})]},name))]})}import{useCallback as useCallback2,useEffect as useEffect3,useMemo,useRef as useRef3,useState as useState2}from"react";var SIGNED_TOKEN_REFRESH_MS=10*60*1e3;function useBotProtection(options={}){const{variant="standard",challengeUrl="/api/form-protection/challenge",altchaChallengeUrl="/api/form-protection/altcha",context="",entry,needsUploadToken=false}=options;const contextConfig=useBotProtectionConfig();const config=options.config!==void 0?options.config:contextConfig;const thirdPartyEntry=entry&&config&&config.provider!=="kanorio"?config.entries[entry]:void 0;const provider=thirdPartyEntry&&config?config.provider:"kanorio";const isThirdParty=provider!=="kanorio";const recaptchaVersion=isThirdParty?config?.recaptchaVersion??null:null;const isRecaptchaV3=provider==="recaptcha"&&recaptchaVersion==="v3";const wantsSignedToken=!isThirdParty&&variant==="standard"||isThirdParty&&needsUploadToken;const[isReady,setIsReady]=useState2(variant==="full"||isThirdParty);const[isSubmittable,setIsSubmittable]=useState2(false);const[isAltchaVerified,setIsAltchaVerified]=useState2(false);const[isCaptchaVerified,setIsCaptchaVerified]=useState2(false);const[hasSignedToken,setHasSignedToken]=useState2(false);const[captchaGeneration,setCaptchaGeneration]=useState2(0);const loadTimestampRef=useRef3(0);const tokenRef=useRef3("");const signedTokenRef=useRef3("");const captchaTokenRef=useRef3("");const captchaExecutorRef=useRef3(null);const honeypotRef=useRef3("");const honeypotWpRef=useRef3("");const honeypotCoRef=useRef3("");const firstFocusTimeRef=useRef3(0);const timerRef=useRef3(null);const registerAltchaPayload=useCallback2(payload=>{tokenRef.current=payload;setIsAltchaVerified(true)},[]);const invalidateAltchaPayload=useCallback2(()=>{tokenRef.current="";setIsAltchaVerified(false)},[]);const registerCaptchaToken=useCallback2(token=>{captchaTokenRef.current=token;setIsCaptchaVerified(true)},[]);const invalidateCaptchaToken=useCallback2(()=>{captchaTokenRef.current="";setIsCaptchaVerified(false)},[]);const registerCaptchaExecutor=useCallback2(executor=>{captchaExecutorRef.current=executor},[]);useEffect3(()=>{loadTimestampRef.current=Date.now();honeypotRef.current="";honeypotWpRef.current="";honeypotCoRef.current="";if(!wantsSignedToken){setIsReady(true);return}const url=`${challengeUrl}?context=${encodeURIComponent(context)}`;const fetchToken=()=>fetch(url).then(res=>res.ok?res.json():Promise.reject(new Error("Challenge fetch failed"))).then(data=>{const token=`${data.nonce}|${data.ts}|${data.sig}`;if(isThirdParty)signedTokenRef.current=token;else tokenRef.current=token;setHasSignedToken(true)}).catch(()=>{});void fetchToken().finally(()=>setIsReady(true));const refresh=setInterval(()=>void fetchToken(),SIGNED_TOKEN_REFRESH_MS);return()=>clearInterval(refresh)},[wantsSignedToken,isThirdParty,challengeUrl,context]);useEffect3(()=>()=>{if(timerRef.current)clearTimeout(timerRef.current)},[]);const registerFocus=useCallback2(()=>{if(firstFocusTimeRef.current===0){firstFocusTimeRef.current=Date.now();if(timerRef.current)clearTimeout(timerRef.current);timerRef.current=setTimeout(()=>{setIsSubmittable(true);timerRef.current=null},BOT_PROTECTION_DEFAULTS.INTERACTION_DELAY_MS)}},[]);const effectiveSubmittable=isThirdParty?isSubmittable&&(isRecaptchaV3||isCaptchaVerified):variant==="full"?isSubmittable&&isAltchaVerified:isSubmittable;const baseData=useCallback2(()=>({_hp:honeypotRef.current,_wp:honeypotWpRef.current,_co:honeypotCoRef.current,_ts:loadTimestampRef.current,...context?{_ctx:context}:{}}),[context]);const getProtectionData=useCallback2(()=>{if(isThirdParty)return{...baseData(),_tk:"",captchaToken:captchaTokenRef.current};return{...baseData(),_tk:tokenRef.current}},[baseData,isThirdParty]);const getUploadProtectionData=useCallback2(()=>{if(isThirdParty)return{...baseData(),_tk:signedTokenRef.current};return{...baseData(),_tk:tokenRef.current}},[baseData,isThirdParty]);const prepare=useCallback2(async()=>{if(!isRecaptchaV3)return;const token=await captchaExecutorRef.current?.()??"";captchaTokenRef.current=token;setIsCaptchaVerified(Boolean(token))},[isRecaptchaV3]);const renewCaptcha=useCallback2(()=>{if(!isThirdParty)return;captchaTokenRef.current="";setIsCaptchaVerified(false);setCaptchaGeneration(generation=>generation+1)},[isThirdParty]);const reset=useCallback2(()=>{loadTimestampRef.current=Date.now();honeypotRef.current="";honeypotWpRef.current="";honeypotCoRef.current="";firstFocusTimeRef.current=0;setIsSubmittable(false);setIsAltchaVerified(false);if(timerRef.current){clearTimeout(timerRef.current);timerRef.current=null}if(isThirdParty){captchaTokenRef.current="";setIsCaptchaVerified(false);setCaptchaGeneration(generation=>generation+1);return}if(variant==="standard"){const url=`${challengeUrl}?context=${encodeURIComponent(context)}`;fetch(url).then(res=>res.ok?res.json():Promise.reject(new Error("Challenge fetch failed"))).then(data=>{tokenRef.current=`${data.nonce}|${data.ts}|${data.sig}`}).catch(()=>{tokenRef.current=""})}else{tokenRef.current=""}},[isThirdParty,variant,challengeUrl,context]);const setHoneypotValue=useCallback2(value=>{honeypotRef.current=value},[]);const setHoneypotWpValue=useCallback2(value=>{honeypotWpRef.current=value},[]);const setHoneypotCoValue=useCallback2(value=>{honeypotCoRef.current=value},[]);const fieldProps=useMemo(()=>({variant,context,altchaChallengeUrl,onAltchaVerified:variant==="full"?registerAltchaPayload:void 0,onAltchaInvalidated:variant==="full"?invalidateAltchaPayload:void 0,onHoneypotChange:setHoneypotValue,onHoneypotWpChange:setHoneypotWpValue,onHoneypotCoChange:setHoneypotCoValue}),[variant,context,altchaChallengeUrl,registerAltchaPayload,invalidateAltchaPayload,setHoneypotValue,setHoneypotWpValue,setHoneypotCoValue]);const captcha=useMemo(()=>isThirdParty&&thirdPartyEntry?{provider,siteKey:thirdPartyEntry.siteKey,action:thirdPartyEntry.action,cData:provider==="turnstile"?protectionCData(context):null,recaptchaVersion,generation:captchaGeneration,onVerified:registerCaptchaToken,onInvalidated:invalidateCaptchaToken,registerExecutor:registerCaptchaExecutor}:null,[isThirdParty,thirdPartyEntry,provider,context,recaptchaVersion,captchaGeneration,registerCaptchaToken,invalidateCaptchaToken,registerCaptchaExecutor]);return{getProtectionData,getUploadProtectionData,isReady,isSubmittable:effectiveSubmittable,isUploadReady:isThirdParty?hasSignedToken:effectiveSubmittable,registerFocus,registerAltchaPayload:variant==="full"&&!isThirdParty?registerAltchaPayload:void 0,reset,prepare,renewCaptcha,provider,fieldProps,challengeProps:{provider,fieldProps,captcha},_setHoneypotValue:setHoneypotValue,_setHoneypotWpValue:setHoneypotWpValue,_setHoneypotCoValue:setHoneypotCoValue}}export{BotProtectionConfigProvider,useBotProtectionConfig,parsePublicBotProtectionConfig,preloadAltchaWidget,ThirdPartyCaptcha,BotProtectionAltcha,BotProtectionChallenge,BotProtectionFields,useBotProtection};
|
|
2
|
+
//# sourceMappingURL=chunk-KYXZNMNA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{clampText}from"./chunk-O2SYHUQF.js";var WATERMARK_POSITIONS=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"];var WATERMARK_SOURCES=["logo","text","image"];var WATERMARK_SIZE_RANGE={min:5,max:50,default:20};var WATERMARK_OPACITY_RANGE={min:10,max:100,default:60};var WATERMARK_TEXT_MAX_LENGTH=60;var DEFAULT_WATERMARK_APPLY={pages:true,articles:true,products:false};var DEFAULT_MEDIA_WATERMARK={enabled:false,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:WATERMARK_SIZE_RANGE.default,opacity:WATERMARK_OPACITY_RANGE.default,apply:DEFAULT_WATERMARK_APPLY,overlay:null,version:null,activatedAt:null,deactivatedAt:null};var DEFAULT_MEDIA_PROTECTION={allowDownload:true,keepCopyright:true,deterrence:false,watermark:DEFAULT_MEDIA_WATERMARK};function clampInt(value,range){if(typeof value!=="number"||!Number.isFinite(value))return range.default;return Math.min(range.max,Math.max(range.min,Math.round(value)))}function pick(value,options,fallback){return typeof value==="string"&&options.includes(value)?value:fallback}function parseWatermarkApply(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_WATERMARK_APPLY[key];return{pages:flag("pages"),articles:flag("articles"),products:flag("products")}}function parseMediaWatermark(value){const raw=value&&typeof value==="object"?value:{};const overlayRaw=raw.overlay&&typeof raw.overlay==="object"?raw.overlay:null;const overlay=overlayRaw&&typeof overlayRaw.url==="string"&&typeof overlayRaw.width==="number"&&typeof overlayRaw.height==="number"&&typeof overlayRaw.key==="string"?{url:overlayRaw.url,width:overlayRaw.width,height:overlayRaw.height,key:overlayRaw.key}:null;const regenHistory=Array.isArray(raw.regenHistory)?raw.regenHistory.filter(item=>typeof item==="string"&&!Number.isNaN(Date.parse(item))):void 0;const scheduledAt=isoOrNull(raw.scheduledAt);return{enabled:raw.enabled===true,source:pick(raw.source,WATERMARK_SOURCES,DEFAULT_MEDIA_WATERMARK.source),text:typeof raw.text==="string"?clampText(raw.text,WATERMARK_TEXT_MAX_LENGTH):"",image:typeof raw.image==="string"&&raw.image?raw.image:null,layout:raw.layout==="tile"?"tile":"single",position:pick(raw.position,WATERMARK_POSITIONS,DEFAULT_MEDIA_WATERMARK.position),size:clampInt(raw.size,WATERMARK_SIZE_RANGE),opacity:clampInt(raw.opacity,WATERMARK_OPACITY_RANGE),apply:parseWatermarkApply(raw.apply),overlay,version:typeof raw.version==="string"&&raw.version?raw.version:null,activatedAt:isoOrNull(raw.activatedAt),deactivatedAt:isoOrNull(raw.deactivatedAt),...regenHistory&®enHistory.length>0?{regenHistory}:{},...scheduledAt?{scheduledAt}:{}}}function isoOrNull(value){return typeof value==="string"&&!Number.isNaN(Date.parse(value))?value:null}function parseMediaProtection(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_MEDIA_PROTECTION[key];return{allowDownload:flag("allowDownload"),keepCopyright:flag("keepCopyright"),deterrence:flag("deterrence"),watermark:parseMediaWatermark(raw.watermark)}}function canVisitorsDownloadImages(protection){return protection.allowDownload&&!protection.deterrence}function canVisitorsShareImages(protection){return!protection.deterrence}import{createContext,useContext,useMemo}from"react";var HERO_BANNER_PRESET_RATIOS=["24:9","21:9","16:9","4:3","1:1","4:5"];var SPLIT_IMAGE_PRESET_RATIOS=["16:9","4:3","1:1","3:4","4:5"];var CARD_PRESET_RATIOS=["4:3","1:1","3:4"];function parseAspectRatio(ratio){if(typeof ratio!=="string")return null;const match=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(ratio.trim());if(!match)return null;const w=Number(match[1]);const h=Number(match[2]);if(!Number.isFinite(w)||!Number.isFinite(h)||w<=0||h<=0)return null;const value=w/h;if(value<.25-1e-6||value>5+1e-6)return null;return value}function hasNaturalDevice(ratios){return ratios.desktop===null||ratios.tablet===null||ratios.mobile===null}var FILL_POSITION_CLASSES={mobile:{fill:"absolute inset-0 h-full w-full",flow:"relative h-auto w-full"},tablet:{fill:"md:absolute md:inset-0 md:h-full",flow:"md:relative md:inset-auto md:h-auto"},desktop:{fill:"lg:absolute lg:inset-0 lg:h-full",flow:"lg:relative lg:inset-auto lg:h-auto"}};function buildResponsiveFillClasses(ratios){const mode=ratio=>ratio&&parseAspectRatio(ratio)?"fill":"flow";const m=mode(ratios.mobile);const t=mode(ratios.tablet);const d=mode(ratios.desktop);const classes=[FILL_POSITION_CLASSES.mobile[m]];if(t!==m)classes.push(FILL_POSITION_CLASSES.tablet[t]);if(d!==t)classes.push(FILL_POSITION_CLASSES.desktop[d]);return classes.join(" ")}function bannerHeightDefaultRatio(bannerHeight){switch(bannerHeight??"standard"){case"compact":return"24:9";case"tall":return"16:9";case"standard":default:return"21:9"}}var SECTION_RATIO_POLICIES={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:false,fixedHeight:true},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:CARD_PRESET_RATIOS,allowCustomRatio:false},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:false}};function resolveDeviceValue(input,fallback,tabletInherits="desktop"){if(input===void 0||input===null){return{desktop:fallback,tablet:fallback,mobile:fallback}}if(typeof input!=="object"){return{desktop:input,tablet:input,mobile:input}}const record=input;const desktop=record.desktop??fallback;const mobile=record.mobile??desktop;const tablet=record.tablet??(tabletInherits==="mobile"?mobile:desktop);return{desktop,tablet,mobile}}function resolvePageMainVisualRatios(input){const layout=input.layout??"banner-profile";if(layout==="overlay-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:overlay-hero"];return{policy:policy2,ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:true}}if(layout==="split-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:split-hero"];const raw2=resolveDeviceValue(input.imageRatio,"4:3",policy2.tabletInherits);return{policy:policy2,ratios:{desktop:raw2.desktop==="natural"||!parseAspectRatio(raw2.desktop)?"4:3":raw2.desktop,tablet:raw2.tablet==="natural"||!parseAspectRatio(raw2.tablet)?"4:3":raw2.tablet,mobile:raw2.mobile==="natural"||!parseAspectRatio(raw2.mobile)?"4:3":raw2.mobile},fixedHeight:false}}const policy=SECTION_RATIO_POLICIES["page-main-visual:banner-profile"];const fallback=bannerHeightDefaultRatio(input.bannerHeight);const raw=resolveDeviceValue(input.imageRatio,fallback,policy.tabletInherits);return{policy,ratios:{desktop:raw.desktop==="natural"||!parseAspectRatio(raw.desktop)?fallback:raw.desktop,tablet:raw.tablet==="natural"||!parseAspectRatio(raw.tablet)?fallback:raw.tablet,mobile:raw.mobile==="natural"||!parseAspectRatio(raw.mobile)?fallback:raw.mobile},fixedHeight:false}}function toFocusFrameSpecs(ratios){const d=ratios.desktop;const t=ratios.tablet;const m=ratios.mobile;if(!d&&!t&&!m)return null;if(d&&d===t&&d===m){return[{device:"all",ratio:d}]}const frames=[];if(d)frames.push({device:"desktop",ratio:d});if(t&&t!==d&&t!==m)frames.push({device:"tablet",ratio:t});if(m&&m!==d)frames.push({device:"mobile",ratio:m});return frames.length>0?frames:null}function pageMainVisualFocusFrames(input){const{ratios}=resolvePageMainVisualRatios(input??{});return toFocusFrameSpecs(ratios)??[{device:"all",ratio:"21:9"}]}var HERO_FOCUS_FRAMES=pageMainVisualFocusFrames();var MIN_CROP_RECT_SPAN=.05;function clampUnit(value){return Math.min(1,Math.max(0,value))}function normalizeImageFocus(value){if(!value||typeof value!=="object")return null;const{x,y}=value;if(typeof x!=="number"||typeof y!=="number")return null;if(!Number.isFinite(x)||!Number.isFinite(y))return null;return{x:clampUnit(x),y:clampUnit(y)}}function normalizeImageCropRect(value){if(!value||typeof value!=="object")return null;const{x,y,w,h}=value;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"||!Number.isFinite(x)||!Number.isFinite(y)||!Number.isFinite(w)||!Number.isFinite(h)){return null}const nw=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,w));const nh=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,h));const nx=Math.min(1-nw,Math.max(0,x));const ny=Math.min(1-nh,Math.max(0,y));return{x:nx,y:ny,w:nw,h:nh}}function normalizeImageScreenFraming(value){if(!value||typeof value!=="object")return null;const raw=value;if(typeof raw.ratio!=="string"||!parseAspectRatio(raw.ratio))return null;const rect=normalizeImageCropRect(raw.rect);if(!rect)return null;return{ratio:raw.ratio.trim(),rect}}function normalizePadColor(value){if(typeof value!=="string")return void 0;const trimmed=value.trim();return/^#[0-9a-fA-F]{6}$/.test(trimmed)?trimmed.toLowerCase():void 0}function isCenteredFocus(focus){return Math.abs(focus.x-.5)<.005&&Math.abs(focus.y-.5)<.005}function effectiveImageFocus(framing){const focus=normalizeImageFocus(framing?.focus);if(!focus||isCenteredFocus(focus))return null;return focus}function hasScreenFraming(framing){if(!framing?.screens||typeof framing.screens!=="object")return false;for(const device of["desktop","tablet","mobile"]){if(normalizeImageScreenFraming(framing.screens[device]))return true}return false}function deriveRectFromFocus(focus,sourceAspect,targetAspect){const f=normalizeImageFocus(focus)??{x:.5,y:.5};if(!Number.isFinite(sourceAspect)||sourceAspect<=0||!Number.isFinite(targetAspect)||targetAspect<=0){return{x:0,y:0,w:1,h:1}}if(sourceAspect>=targetAspect){const w2=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,targetAspect/sourceAspect));const h2=1;const x=Math.min(1-w2,Math.max(0,f.x-w2/2));return{x,y:0,w:w2,h:h2}}const w=1;const h=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,sourceAspect/targetAspect));const y=Math.min(1-h,Math.max(0,f.y-h/2));return{x:0,y,w,h}}function isScreenFramingCompatible(screen,targetRatio,source){if(!screen)return false;const savedAspect=parseAspectRatio(screen.ratio);const targetAspect=parseAspectRatio(targetRatio);if(!savedAspect||!targetAspect)return false;if(Math.abs(savedAspect-targetAspect)/targetAspect>.01)return false;if(source&&source.width>0&&source.height>0&&screen.rect.h>0){const actualAspect=screen.rect.w*source.width/(screen.rect.h*source.height);if(Math.abs(actualAspect-targetAspect)/targetAspect>.02)return false}return true}function resolveScreenFraming(input){const{framing,device,targetRatio,tabletInherits="desktop"}=input;const source=input.source??framing?.source??null;const screens=framing?.screens;const candidateOrder=device==="desktop"?["desktop"]:device==="mobile"?["mobile","desktop"]:tabletInherits==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"];let matched=null;let hadIncompatibleOnDevice=false;for(const candidate of candidateOrder){const screen=normalizeImageScreenFraming(screens?.[candidate]);if(!screen)continue;if(isScreenFramingCompatible(screen,targetRatio,source)){matched=screen;break}if(candidate===device){hadIncompatibleOnDevice=true}}if(matched){return{ratio:targetRatio,rect:matched.rect,derived:false,ratioMismatchFallback:false}}const targetAspect=parseAspectRatio(targetRatio)??16/9;const sourceAspect=source&&source.width>0&&source.height>0?source.width/source.height:targetAspect;return{ratio:targetRatio,rect:deriveRectFromFocus(framing?.focus,sourceAspect,targetAspect),derived:true,ratioMismatchFallback:hadIncompatibleOnDevice}}function rectToCloudflareTrim(rect,source){if(!source||!Number.isFinite(source.width)||!Number.isFinite(source.height))return null;if(source.width<=0||source.height<=0)return null;const r=normalizeImageCropRect(rect);if(!r)return null;const left=Math.max(0,Math.round(r.x*source.width));const top=Math.max(0,Math.round(r.y*source.height));const cropW=Math.max(1,Math.round(r.w*source.width));const cropH=Math.max(1,Math.round(r.h*source.height));const right=Math.max(0,source.width-left-cropW);const bottom=Math.max(0,source.height-top-cropH);if(top<=1&&right<=1&&bottom<=1&&left<=1)return null;return{top,right,bottom,left}}function focusToObjectPosition(focus){const percent=value=>`${Math.round(value*1e3)/10}%`;return`${percent(focus.x)} ${percent(focus.y)}`}function focusToGravity(focus){const fixed=value=>(Math.round(value*100)/100).toFixed(2);return`${fixed(focus.x)}x${fixed(focus.y)}`}var ASSET_REF_PREFIX="asset:";var ASSET_REF_VALUE=/^asset:[a-z0-9]+$/;function isAssetRefValue(value){return ASSET_REF_VALUE.test(value)}var CF_IMAGES_ACCOUNT_HASH="xu6i8N5WjaI_9HFe-hZzmg";var CF_IMAGES_DELIVERY_BASE=`https://img.kanorio.com/cdn-cgi/imagedelivery/${CF_IMAGES_ACCOUNT_HASH}`;var URL_TAIL=String.raw`[^\s"'()<>?#\\]+`;var CF_IMAGE_ID=String.raw`[A-Za-z0-9_.-]+`;function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var QUERY_TAIL=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var CF_IMAGE_URL=new RegExp(String.raw`^https://(?:imagedelivery\.net|[a-z0-9-]+\.kanorio\.com/cdn-cgi/imagedelivery|img\.kanorio\.com/wm/[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)/${escapeRegExp(CF_IMAGES_ACCOUNT_HASH)}/(${CF_IMAGE_ID})(?:[/?#]|$)`);function cloudflareImageIdOf(url){return url?CF_IMAGE_URL.exec(url)?.[1]??null:null}var MIXED_EDGE_COLOR="mixed";function publicEdgeColor(edgeColor){return edgeColor&&edgeColor!==MIXED_EDGE_COLOR?edgeColor:null}function displayFileName(contentName,facts){const name=contentName??"";if(!facts?.name)return name;if(!name||name===facts.name||facts.formerNames?.includes(name))return facts.name;const dot=facts.name.lastIndexOf(".");const own=name.lastIndexOf(".");if(dot<=0||own<=0)return name;return`${name.slice(0,own)}${facts.name.slice(dot)}`}function mediaFactsFor(facts,ref){if(ref.assetId){const byId=facts[`${ASSET_REF_PREFIX}${ref.assetId}`];if(byId)return byId}if(!ref.url)return void 0;if(isAssetRefValue(ref.url))return facts[ref.url];const cfId=cloudflareImageIdOf(ref.url);if(cfId)return facts[cfId];const path=ref.url.split(/[?#]/,1)[0];for(const[key,item]of Object.entries(facts)){if(!key.startsWith(ASSET_REF_PREFIX)&&path.endsWith(`/${key}`))return item}return void 0}var CLOUDFLARE_IMAGE_QUALITY=85;function extractImageIdFromUrl(url){if(!url)return void 0;try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"){if(pathParts.length>=2){return pathParts[1]}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"){if(pathParts.length>=4){return pathParts[3]}}return void 0}catch{return void 0}}function isSvgImageUrl(url){const path=url.split(/[?#]/,1)[0]??"";return path.toLowerCase().endsWith(".svg")}function isCloudflareImageUrl(url){if(!url)return false;try{const urlObj=new URL(url);if(urlObj.hostname==="imagedelivery.net"){return true}if(urlObj.hostname.endsWith(".kanorio.com")&&urlObj.pathname.startsWith("/cdn-cgi/imagedelivery/")){return true}return false}catch{return false}}function hasOptimizationParams(url){try{const urlObj=new URL(url);return urlObj.searchParams.has("width")||urlObj.searchParams.has("height")||urlObj.searchParams.has("quality")||urlObj.searchParams.has("fit")}catch{return false}}function getDefaultParamsForUseCase(useCase){switch(useCase){case"page-main-visual-background":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"image-text-split-image":return{width:1200,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"full-width-image":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"contain"};case"general":default:return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"}}}function parseCloudflareUrl(url){try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"&&pathParts.length>=3){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}`,accountHash:pathParts[0],imageId:pathParts[1],variant:pathParts[2]||"public"}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"&&pathParts.length>=5){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}/cdn-cgi/imagedelivery`,accountHash:pathParts[2],imageId:pathParts[3],variant:pathParts[4]||"public"}}return null}catch{return null}}function buildOptimizedUrl(parsed,options){const{baseUrl,accountHash,imageId}=parsed;const defaults=getDefaultParamsForUseCase(options.useCase);const width=options.width??defaults.width;const height=options.height??defaults.height;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit=options.fit??defaults.fit;const format=options.format;const params=[];if(options.trim){const{top,right,bottom,left}=options.trim;params.push(`trim=${Math.max(0,Math.round(top))};${Math.max(0,Math.round(right))};${Math.max(0,Math.round(bottom))};${Math.max(0,Math.round(left))}`)}if(width)params.push(`w=${width}`);if(height)params.push(`h=${height}`);if(fit)params.push(`fit=${fit}`);if(!options.trim&&options.focus&&width&&height&&(fit==="crop"||fit==="cover")){params.push(`gravity=${focusToGravity(options.focus)}`)}if(options.background&&/^#[0-9a-fA-F]{6}$/.test(options.background)){params.push(`background=${encodeURIComponent(options.background)}`)}params.push(`q=${quality}`);if(format)params.push(`f=${format}`);if(params.length>0){return`${baseUrl}/${accountHash}/${imageId}/${params.join(",")}`}return`${baseUrl}/${accountHash}/${imageId}/public`}function defaultWidthForUseCase(useCase){return getDefaultParamsForUseCase(useCase).width??1920}function getOptimizedImageUrl(originalUrl,options){if(!isCloudflareImageUrl(originalUrl)){return originalUrl}if(hasOptimizationParams(originalUrl)&&!options.format){return originalUrl}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return originalUrl}return buildOptimizedUrl(parsed,options)}function getOriginalImageUrl(url){if(!isCloudflareImageUrl(url)){return url}const parsed=parseCloudflareUrl(url);if(!parsed){return url}return`${parsed.baseUrl}/${parsed.accountHash}/${parsed.imageId}/public`}var MARKDOWN_IMAGE_SRCSET_WIDTHS=[400,800,1200,1600];var MARKDOWN_IMAGE_SIZES="(max-width: 768px) 100vw, 960px";function getResponsiveImageAttrs(originalUrl){if(!isCloudflareImageUrl(originalUrl)){return null}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return null}const{baseUrl,accountHash,imageId}=parsed;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit="scale-down";const srcSet=MARKDOWN_IMAGE_SRCSET_WIDTHS.map(w=>`${baseUrl}/${accountHash}/${imageId}/w=${w},fit=${fit},q=${quality} ${w}w`).join(", ");const src=`${baseUrl}/${accountHash}/${imageId}/w=800,fit=${fit},q=${quality}`;return{src,srcSet,sizes:MARKDOWN_IMAGE_SIZES}}var PICTURE_DEVICE_WIDTHS={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]};var PICTURE_DEVICE_MEDIA={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"};var PICTURE_DEVICES=["desktop","tablet","mobile"];function resolveDeviceCrops(input){const out={};for(const device of PICTURE_DEVICES){const ratio=input.ratios[device];if(!ratio){out[device]={ratio:null,rect:null};continue}const resolved=resolveScreenFraming({framing:input.framing,device,targetRatio:ratio,tabletInherits:input.tabletInherits,source:input.source});out[device]={ratio,rect:resolved.derived?null:resolved.rect}}return out}function isSameDeviceCrop(a,b){if(a.ratio!==b.ratio)return false;if(!a.rect||!b.rect)return a.rect===b.rect;return Math.abs(a.rect.x-b.rect.x)<5e-4&&Math.abs(a.rect.y-b.rect.y)<5e-4&&Math.abs(a.rect.w-b.rect.w)<5e-4&&Math.abs(a.rect.h-b.rect.h)<5e-4}function pictureWidthsFor(device,maxWidth){const base=PICTURE_DEVICE_WIDTHS[device];if(!maxWidth||maxWidth<=0||maxWidth>=base[base.length-1])return base;return[...base.filter(w=>w<maxWidth),Math.round(maxWidth)]}function resolveSiteImageRenderMode(input){const{src,framing,deviceRatios,tabletInherits="desktop"}=input;if(!src||!deviceRatios)return"single";const uniformRatio=deviceRatios.mobile===deviceRatios.desktop&&deviceRatios.tablet===deviceRatios.desktop;const hasScreens=hasScreenFraming(framing);if(!hasScreens&&uniformRatio)return"single";const trimmable=isCloudflareImageUrl(src)&&!isSvgImageUrl(src);if(!hasScreens)return trimmable?"picture":"single";const source=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const crops=resolveDeviceCrops({framing,ratios:deviceRatios,tabletInherits,source});const anyRect=PICTURE_DEVICES.some(device=>crops[device].rect!==null);if(!anyRect)return uniformRatio||!trimmable?"single":"picture";if(!trimmable||!source)return"css-fallback";if(uniformRatio&&isSameDeviceCrop(crops.desktop,crops.tablet)&&isSameDeviceCrop(crops.desktop,crops.mobile)){return"single-trim"}return"picture"}function buildSingleTrimImageUrl(input){const useCase=input.useCase??"general";const width=input.width??defaultWidthForUseCase(useCase);const ratioNum=parseAspectRatio(input.ratio)??16/9;const height=Math.max(1,Math.round(width/ratioNum));const source=input.framing?.source&&input.framing.source.width>0&&input.framing.source.height>0?input.framing.source:null;const resolved=resolveScreenFraming({framing:input.framing,device:"desktop",targetRatio:input.ratio,tabletInherits:input.tabletInherits,source});const trim=!resolved.derived&&source?rectToCloudflareTrim(resolved.rect,source):null;return{src:getOptimizedImageUrl(input.src,{useCase,width,height,fit:"crop",trim,focus:trim?null:effectiveImageFocus(input.framing)}),width,height}}function buildPictureSourcesPlan(input){const{src,useCase="general",ratios,framing,tabletInherits="desktop",maxWidth}=input;if(!isCloudflareImageUrl(src))return null;const sourceDims=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const focus=effectiveImageFocus(framing);const crops=resolveDeviceCrops({framing,ratios,tabletInherits,source:sourceDims});const buildForDevice=device=>{const{ratio,rect}=crops[device];const ratioNum=ratio?parseAspectRatio(ratio)??16/9:null;const trim=rect&&sourceDims?rectToCloudflareTrim(rect,sourceDims):null;const widths=pictureWidthsFor(device,maxWidth);const urls=[];const srcSetParts=widths.map(w=>{const url=ratioNum?getOptimizedImageUrl(src,{useCase,width:w,height:Math.max(1,Math.round(w/ratioNum)),fit:"crop",trim,focus:trim?null:focus}):getOptimizedImageUrl(src,{useCase,width:w,fit:"scale-down"});urls.push(url);return`${url} ${w}w`});const primaryW=widths[widths.length-1];const naturalAspect=sourceDims?sourceDims.width/sourceDims.height:null;const primaryH=ratioNum?Math.max(1,Math.round(primaryW/ratioNum)):naturalAspect?Math.max(1,Math.round(primaryW/naturalAspect)):null;const primaryUrl=urls[urls.length-1];return{device,media:device==="desktop"?void 0:PICTURE_DEVICE_MEDIA[device],src:primaryUrl,srcSet:srcSetParts.join(", "),sizes:input.sizes?.[device]??"100vw",width:primaryW,height:primaryH,urls}};const mobile=buildForDevice("mobile");const tabletDesc=buildForDevice("tablet");const desktop=buildForDevice("desktop");const tablet=isSameDeviceCrop(crops.tablet,crops.desktop)?null:tabletDesc;const preloads=tablet?[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:PICTURE_DEVICE_MEDIA.tablet,href:tablet.src,imageSrcSet:tablet.srcSet,imageSizes:tablet.sizes},{media:PICTURE_DEVICE_MEDIA.desktop,href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}]:[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:"(min-width: 768px)",href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}];const allVariantUrls=Array.from(new Set([...mobile.urls,...tablet?tablet.urls:[],...desktop.urls]));return{mobile,tablet,desktop,preloads,allVariantUrls}}import{jsx}from"react/jsx-runtime";var FALLBACK={protection:DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:()=>null};var MediaProtectionContext=createContext(FALLBACK);function MediaProtectionProvider({protection,websiteId,apiBase="",children}){const value=useMemo(()=>({protection:protection??DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:(imageUrl,name)=>{const imageId=extractImageIdFromUrl(imageUrl);if(!websiteId||!imageId)return null;const base=`${apiBase}/api/public/sites/${encodeURIComponent(websiteId)}/images/${encodeURIComponent(imageId)}/download`;const query=new URLSearchParams;if(name)query.set("name",name);const search=query.toString();return search?`${base}?${search}`:base}}),[protection,websiteId,apiBase]);return jsx(MediaProtectionContext.Provider,{value,children})}function useMediaProtection(){return useContext(MediaProtectionContext)}export{hasNaturalDevice,buildResponsiveFillClasses,normalizeImageCropRect,normalizePadColor,effectiveImageFocus,resolveScreenFraming,focusToObjectPosition,publicEdgeColor,displayFileName,mediaFactsFor,extractImageIdFromUrl,isSvgImageUrl,getOptimizedImageUrl,getOriginalImageUrl,getResponsiveImageAttrs,resolveSiteImageRenderMode,buildSingleTrimImageUrl,buildPictureSourcesPlan,parseMediaProtection,canVisitorsDownloadImages,canVisitorsShareImages,MediaProtectionProvider,useMediaProtection};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{clampText}from"./chunk-O2SYHUQF.js";var WATERMARK_POSITIONS=["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"];var WATERMARK_SOURCES=["logo","text","image"];var WATERMARK_SIZE_RANGE={min:5,max:50,default:20};var WATERMARK_OPACITY_RANGE={min:10,max:100,default:60};var WATERMARK_TEXT_MAX_LENGTH=60;var DEFAULT_WATERMARK_APPLY={pages:true,articles:true,products:false};var DEFAULT_MEDIA_WATERMARK={enabled:false,source:"logo",text:"",image:null,layout:"single",position:"bottom-right",size:WATERMARK_SIZE_RANGE.default,opacity:WATERMARK_OPACITY_RANGE.default,apply:DEFAULT_WATERMARK_APPLY,overlay:null,version:null,activatedAt:null,deactivatedAt:null};var DEFAULT_MEDIA_PROTECTION={allowDownload:true,keepCopyright:true,deterrence:false,watermark:DEFAULT_MEDIA_WATERMARK};function clampInt(value,range){if(typeof value!=="number"||!Number.isFinite(value))return range.default;return Math.min(range.max,Math.max(range.min,Math.round(value)))}function pick(value,options,fallback){return typeof value==="string"&&options.includes(value)?value:fallback}function parseWatermarkApply(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_WATERMARK_APPLY[key];return{pages:flag("pages"),articles:flag("articles"),products:flag("products")}}function parseMediaWatermark(value){const raw=value&&typeof value==="object"?value:{};const overlayRaw=raw.overlay&&typeof raw.overlay==="object"?raw.overlay:null;const overlay=overlayRaw&&typeof overlayRaw.url==="string"&&typeof overlayRaw.width==="number"&&typeof overlayRaw.height==="number"&&typeof overlayRaw.key==="string"?{url:overlayRaw.url,width:overlayRaw.width,height:overlayRaw.height,key:overlayRaw.key}:null;const regenHistory=Array.isArray(raw.regenHistory)?raw.regenHistory.filter(item=>typeof item==="string"&&!Number.isNaN(Date.parse(item))):void 0;const scheduledAt=isoOrNull(raw.scheduledAt);return{enabled:raw.enabled===true,source:pick(raw.source,WATERMARK_SOURCES,DEFAULT_MEDIA_WATERMARK.source),text:typeof raw.text==="string"?clampText(raw.text,WATERMARK_TEXT_MAX_LENGTH):"",image:typeof raw.image==="string"&&raw.image?raw.image:null,layout:raw.layout==="tile"?"tile":"single",position:pick(raw.position,WATERMARK_POSITIONS,DEFAULT_MEDIA_WATERMARK.position),size:clampInt(raw.size,WATERMARK_SIZE_RANGE),opacity:clampInt(raw.opacity,WATERMARK_OPACITY_RANGE),apply:parseWatermarkApply(raw.apply),overlay,version:typeof raw.version==="string"&&raw.version?raw.version:null,activatedAt:isoOrNull(raw.activatedAt),deactivatedAt:isoOrNull(raw.deactivatedAt),...regenHistory&®enHistory.length>0?{regenHistory}:{},...scheduledAt?{scheduledAt}:{}}}function isoOrNull(value){return typeof value==="string"&&!Number.isNaN(Date.parse(value))?value:null}function parseMediaProtection(value){const raw=value&&typeof value==="object"?value:{};const flag=key=>typeof raw[key]==="boolean"?raw[key]:DEFAULT_MEDIA_PROTECTION[key];return{allowDownload:flag("allowDownload"),keepCopyright:flag("keepCopyright"),deterrence:flag("deterrence"),watermark:parseMediaWatermark(raw.watermark)}}function canVisitorsDownloadImages(protection){return protection.allowDownload&&!protection.deterrence}function canVisitorsShareImages(protection){return!protection.deterrence}import{createContext,useContext,useMemo}from"react";var HERO_BANNER_PRESET_RATIOS=["24:9","21:9","16:9","4:3","1:1","4:5"];var SPLIT_IMAGE_PRESET_RATIOS=["16:9","4:3","1:1","3:4","4:5"];var CARD_PRESET_RATIOS=["4:3","1:1","3:4"];function parseAspectRatio(ratio){if(typeof ratio!=="string")return null;const match=/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(ratio.trim());if(!match)return null;const w=Number(match[1]);const h=Number(match[2]);if(!Number.isFinite(w)||!Number.isFinite(h)||w<=0||h<=0)return null;const value=w/h;if(value<.25-1e-6||value>5+1e-6)return null;return value}function hasNaturalDevice(ratios){return ratios.desktop===null||ratios.tablet===null||ratios.mobile===null}var FILL_POSITION_CLASSES={mobile:{fill:"absolute inset-0 h-full w-full",flow:"relative h-auto w-full"},tablet:{fill:"md:absolute md:inset-0 md:h-full",flow:"md:relative md:inset-auto md:h-auto"},desktop:{fill:"lg:absolute lg:inset-0 lg:h-full",flow:"lg:relative lg:inset-auto lg:h-auto"}};function buildResponsiveFillClasses(ratios){const mode=ratio=>ratio&&parseAspectRatio(ratio)?"fill":"flow";const m=mode(ratios.mobile);const t=mode(ratios.tablet);const d=mode(ratios.desktop);const classes=[FILL_POSITION_CLASSES.mobile[m]];if(t!==m)classes.push(FILL_POSITION_CLASSES.tablet[t]);if(d!==t)classes.push(FILL_POSITION_CLASSES.desktop[d]);return classes.join(" ")}function bannerHeightDefaultRatio(bannerHeight){switch(bannerHeight??"standard"){case"compact":return"24:9";case"tall":return"16:9";case"standard":default:return"21:9"}}var SECTION_RATIO_POLICIES={"page-main-visual:banner-profile":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:split-hero":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true},"page-main-visual:overlay-hero":{tabletInherits:"desktop",devices:["desktop","mobile"],presets:["16:9","4:5"],allowCustomRatio:false,fixedHeight:true},"image-text-split":{tabletInherits:"mobile",devices:["desktop","tablet","mobile"],presets:SPLIT_IMAGE_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"full-width-image":{tabletInherits:"desktop",devices:["desktop","tablet","mobile"],presets:HERO_BANNER_PRESET_RATIOS,allowCustomRatio:true,allowNatural:true},"card-grid":{tabletInherits:"desktop",devices:["desktop"],presets:CARD_PRESET_RATIOS,allowCustomRatio:false},"multi-link":{tabletInherits:"desktop",devices:["desktop"],presets:["4:3"],allowCustomRatio:false}};function resolveDeviceValue(input,fallback,tabletInherits="desktop"){if(input===void 0||input===null){return{desktop:fallback,tablet:fallback,mobile:fallback}}if(typeof input!=="object"){return{desktop:input,tablet:input,mobile:input}}const record=input;const desktop=record.desktop??fallback;const mobile=record.mobile??desktop;const tablet=record.tablet??(tabletInherits==="mobile"?mobile:desktop);return{desktop,tablet,mobile}}function resolvePageMainVisualRatios(input){const layout=input.layout??"banner-profile";if(layout==="overlay-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:overlay-hero"];return{policy:policy2,ratios:{desktop:"16:9",tablet:"16:9",mobile:"4:5"},fixedHeight:true}}if(layout==="split-hero"){const policy2=SECTION_RATIO_POLICIES["page-main-visual:split-hero"];const raw2=resolveDeviceValue(input.imageRatio,"4:3",policy2.tabletInherits);return{policy:policy2,ratios:{desktop:raw2.desktop==="natural"||!parseAspectRatio(raw2.desktop)?"4:3":raw2.desktop,tablet:raw2.tablet==="natural"||!parseAspectRatio(raw2.tablet)?"4:3":raw2.tablet,mobile:raw2.mobile==="natural"||!parseAspectRatio(raw2.mobile)?"4:3":raw2.mobile},fixedHeight:false}}const policy=SECTION_RATIO_POLICIES["page-main-visual:banner-profile"];const fallback=bannerHeightDefaultRatio(input.bannerHeight);const raw=resolveDeviceValue(input.imageRatio,fallback,policy.tabletInherits);return{policy,ratios:{desktop:raw.desktop==="natural"||!parseAspectRatio(raw.desktop)?fallback:raw.desktop,tablet:raw.tablet==="natural"||!parseAspectRatio(raw.tablet)?fallback:raw.tablet,mobile:raw.mobile==="natural"||!parseAspectRatio(raw.mobile)?fallback:raw.mobile},fixedHeight:false}}function toFocusFrameSpecs(ratios){const d=ratios.desktop;const t=ratios.tablet;const m=ratios.mobile;if(!d&&!t&&!m)return null;if(d&&d===t&&d===m){return[{device:"all",ratio:d}]}const frames=[];if(d)frames.push({device:"desktop",ratio:d});if(t&&t!==d&&t!==m)frames.push({device:"tablet",ratio:t});if(m&&m!==d)frames.push({device:"mobile",ratio:m});return frames.length>0?frames:null}function pageMainVisualFocusFrames(input){const{ratios}=resolvePageMainVisualRatios(input??{});return toFocusFrameSpecs(ratios)??[{device:"all",ratio:"21:9"}]}var HERO_FOCUS_FRAMES=pageMainVisualFocusFrames();var MIN_CROP_RECT_SPAN=.05;function clampUnit(value){return Math.min(1,Math.max(0,value))}function normalizeImageFocus(value){if(!value||typeof value!=="object")return null;const{x,y}=value;if(typeof x!=="number"||typeof y!=="number")return null;if(!Number.isFinite(x)||!Number.isFinite(y))return null;return{x:clampUnit(x),y:clampUnit(y)}}function normalizeImageCropRect(value){if(!value||typeof value!=="object")return null;const{x,y,w,h}=value;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"||!Number.isFinite(x)||!Number.isFinite(y)||!Number.isFinite(w)||!Number.isFinite(h)){return null}const nw=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,w));const nh=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,h));const nx=Math.min(1-nw,Math.max(0,x));const ny=Math.min(1-nh,Math.max(0,y));return{x:nx,y:ny,w:nw,h:nh}}function normalizeImageScreenFraming(value){if(!value||typeof value!=="object")return null;const raw=value;if(typeof raw.ratio!=="string"||!parseAspectRatio(raw.ratio))return null;const rect=normalizeImageCropRect(raw.rect);if(!rect)return null;return{ratio:raw.ratio.trim(),rect}}function normalizePadColor(value){if(typeof value!=="string")return void 0;const trimmed=value.trim();return/^#[0-9a-fA-F]{6}$/.test(trimmed)?trimmed.toLowerCase():void 0}function isCenteredFocus(focus){return Math.abs(focus.x-.5)<.005&&Math.abs(focus.y-.5)<.005}function effectiveImageFocus(framing){const focus=normalizeImageFocus(framing?.focus);if(!focus||isCenteredFocus(focus))return null;return focus}function hasScreenFraming(framing){if(!framing?.screens||typeof framing.screens!=="object")return false;for(const device of["desktop","tablet","mobile"]){if(normalizeImageScreenFraming(framing.screens[device]))return true}return false}function deriveRectFromFocus(focus,sourceAspect,targetAspect){const f=normalizeImageFocus(focus)??{x:.5,y:.5};if(!Number.isFinite(sourceAspect)||sourceAspect<=0||!Number.isFinite(targetAspect)||targetAspect<=0){return{x:0,y:0,w:1,h:1}}if(sourceAspect>=targetAspect){const w2=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,targetAspect/sourceAspect));const h2=1;const x=Math.min(1-w2,Math.max(0,f.x-w2/2));return{x,y:0,w:w2,h:h2}}const w=1;const h=Math.min(1,Math.max(MIN_CROP_RECT_SPAN,sourceAspect/targetAspect));const y=Math.min(1-h,Math.max(0,f.y-h/2));return{x:0,y,w,h}}function isScreenFramingCompatible(screen,targetRatio,source){if(!screen)return false;const savedAspect=parseAspectRatio(screen.ratio);const targetAspect=parseAspectRatio(targetRatio);if(!savedAspect||!targetAspect)return false;if(Math.abs(savedAspect-targetAspect)/targetAspect>.01)return false;if(source&&source.width>0&&source.height>0&&screen.rect.h>0){const actualAspect=screen.rect.w*source.width/(screen.rect.h*source.height);if(Math.abs(actualAspect-targetAspect)/targetAspect>.02)return false}return true}function resolveScreenFraming(input){const{framing,device,targetRatio,tabletInherits="desktop"}=input;const source=input.source??framing?.source??null;const screens=framing?.screens;const candidateOrder=device==="desktop"?["desktop"]:device==="mobile"?["mobile","desktop"]:tabletInherits==="mobile"?["tablet","mobile","desktop"]:["tablet","desktop"];let matched=null;let hadIncompatibleOnDevice=false;for(const candidate of candidateOrder){const screen=normalizeImageScreenFraming(screens?.[candidate]);if(!screen)continue;if(isScreenFramingCompatible(screen,targetRatio,source)){matched=screen;break}if(candidate===device){hadIncompatibleOnDevice=true}}if(matched){return{ratio:targetRatio,rect:matched.rect,derived:false,ratioMismatchFallback:false}}const targetAspect=parseAspectRatio(targetRatio)??16/9;const sourceAspect=source&&source.width>0&&source.height>0?source.width/source.height:targetAspect;return{ratio:targetRatio,rect:deriveRectFromFocus(framing?.focus,sourceAspect,targetAspect),derived:true,ratioMismatchFallback:hadIncompatibleOnDevice}}function rectToCloudflareTrim(rect,source){if(!source||!Number.isFinite(source.width)||!Number.isFinite(source.height))return null;if(source.width<=0||source.height<=0)return null;const r=normalizeImageCropRect(rect);if(!r)return null;const left=Math.max(0,Math.round(r.x*source.width));const top=Math.max(0,Math.round(r.y*source.height));const cropW=Math.max(1,Math.round(r.w*source.width));const cropH=Math.max(1,Math.round(r.h*source.height));const right=Math.max(0,source.width-left-cropW);const bottom=Math.max(0,source.height-top-cropH);if(top<=1&&right<=1&&bottom<=1&&left<=1)return null;return{top,right,bottom,left}}function focusToObjectPosition(focus){const percent=value=>`${Math.round(value*1e3)/10}%`;return`${percent(focus.x)} ${percent(focus.y)}`}function focusToGravity(focus){const fixed=value=>(Math.round(value*100)/100).toFixed(2);return`${fixed(focus.x)}x${fixed(focus.y)}`}var ASSET_REF_PREFIX="asset:";var ASSET_REF_VALUE=/^asset:[a-z0-9]+$/;function isAssetRefValue(value){return ASSET_REF_VALUE.test(value)}var CF_IMAGES_ACCOUNT_HASH="xu6i8N5WjaI_9HFe-hZzmg";var CF_IMAGES_DELIVERY_BASE=`https://img.kanorio.com/cdn-cgi/imagedelivery/${CF_IMAGES_ACCOUNT_HASH}`;var URL_TAIL=String.raw`[^\s"'()<>?#\\]+`;var CF_IMAGE_ID=String.raw`[A-Za-z0-9_.-]+`;function escapeRegExp(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var QUERY_TAIL=String.raw`(?:[?#][^\s"'()<>\\]*)?`;var CF_IMAGE_URL=new RegExp(String.raw`^https://(?:imagedelivery\.net|[a-z0-9-]+\.kanorio\.com/cdn-cgi/imagedelivery|img\.kanorio\.com/wm/[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)/${escapeRegExp(CF_IMAGES_ACCOUNT_HASH)}/(${CF_IMAGE_ID})(?:[/?#]|$)`);function cloudflareImageIdOf(url){return url?CF_IMAGE_URL.exec(url)?.[1]??null:null}var MIXED_EDGE_COLOR="mixed";function publicEdgeColor(edgeColor){return edgeColor&&edgeColor!==MIXED_EDGE_COLOR?edgeColor:null}function displayFileName(contentName,facts){const name=contentName??"";if(!facts?.name)return name;if(!name||name===facts.name||facts.formerNames?.includes(name))return facts.name;const dot=facts.name.lastIndexOf(".");const own=name.lastIndexOf(".");if(dot<=0||own<=0)return name;return`${name.slice(0,own)}${facts.name.slice(dot)}`}function mediaFactsFor(facts,ref){if(ref.assetId){const byId=facts[`${ASSET_REF_PREFIX}${ref.assetId}`];if(byId)return byId}if(!ref.url)return void 0;if(isAssetRefValue(ref.url))return facts[ref.url];const cfId=cloudflareImageIdOf(ref.url);if(cfId)return facts[cfId];const path=ref.url.split(/[?#]/,1)[0];for(const[key,item]of Object.entries(facts)){if(!key.startsWith(ASSET_REF_PREFIX)&&path.endsWith(`/${key}`))return item}return void 0}var CLOUDFLARE_IMAGE_QUALITY=85;var CF_ORIGINAL_SIZE_PARAMS=`w=12000,h=12000,fit=scale-down,q=${CLOUDFLARE_IMAGE_QUALITY}`;function extractImageIdFromUrl(url){if(!url)return void 0;try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"){if(pathParts.length>=2){return pathParts[1]}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"){if(pathParts.length>=4){return pathParts[3]}}return void 0}catch{return void 0}}function isSvgImageUrl(url){const path=url.split(/[?#]/,1)[0]??"";return path.toLowerCase().endsWith(".svg")}function isCloudflareImageUrl(url){if(!url)return false;try{const urlObj=new URL(url);if(urlObj.hostname==="imagedelivery.net"){return true}if(urlObj.hostname.endsWith(".kanorio.com")&&urlObj.pathname.startsWith("/cdn-cgi/imagedelivery/")){return true}return false}catch{return false}}function hasOptimizationParams(url){try{const urlObj=new URL(url);return urlObj.searchParams.has("width")||urlObj.searchParams.has("height")||urlObj.searchParams.has("quality")||urlObj.searchParams.has("fit")}catch{return false}}function getDefaultParamsForUseCase(useCase){switch(useCase){case"page-main-visual-background":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"cover"};case"page-main-visual-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"header-logo":return{width:600,height:600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"card-grid-carousel-image":return{width:800,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"image-text-split-image":return{width:1200,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"};case"multi-image-carousel-image":return{width:1600,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"lightbox-image":return{width:4096,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"scale-down"};case"full-width-image":return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"contain"};case"general":default:return{width:1920,quality:CLOUDFLARE_IMAGE_QUALITY,fit:"crop"}}}function parseCloudflareUrl(url){try{const urlObj=new URL(url);const pathParts=urlObj.pathname.split("/").filter(Boolean);if(urlObj.hostname==="imagedelivery.net"&&pathParts.length>=3){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}`,accountHash:pathParts[0],imageId:pathParts[1],variant:pathParts[2]||"public"}}if(urlObj.hostname.endsWith(".kanorio.com")&&pathParts[0]==="cdn-cgi"&&pathParts[1]==="imagedelivery"&&pathParts.length>=5){return{baseUrl:`${urlObj.protocol}//${urlObj.hostname}/cdn-cgi/imagedelivery`,accountHash:pathParts[2],imageId:pathParts[3],variant:pathParts[4]||"public"}}return null}catch{return null}}function buildOptimizedUrl(parsed,options){const{baseUrl,accountHash,imageId}=parsed;const defaults=getDefaultParamsForUseCase(options.useCase);const width=options.width??defaults.width;const height=options.height??defaults.height;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit=options.fit??defaults.fit;const format=options.format;const params=[];if(options.trim){const{top,right,bottom,left}=options.trim;params.push(`trim=${Math.max(0,Math.round(top))};${Math.max(0,Math.round(right))};${Math.max(0,Math.round(bottom))};${Math.max(0,Math.round(left))}`)}if(width)params.push(`w=${width}`);if(height)params.push(`h=${height}`);if(fit)params.push(`fit=${fit}`);if(!options.trim&&options.focus&&width&&height&&(fit==="crop"||fit==="cover")){params.push(`gravity=${focusToGravity(options.focus)}`)}if(options.background&&/^#[0-9a-fA-F]{6}$/.test(options.background)){params.push(`background=${encodeURIComponent(options.background)}`)}params.push(`q=${quality}`);if(format)params.push(`f=${format}`);if(params.length>0){return`${baseUrl}/${accountHash}/${imageId}/${params.join(",")}`}return`${baseUrl}/${accountHash}/${imageId}/public`}function defaultWidthForUseCase(useCase){return getDefaultParamsForUseCase(useCase).width??1920}function getOptimizedImageUrl(originalUrl,options){if(!isCloudflareImageUrl(originalUrl)){return originalUrl}if(hasOptimizationParams(originalUrl)&&!options.format){return originalUrl}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return originalUrl}return buildOptimizedUrl(parsed,options)}function getOriginalImageUrl(url){if(!isCloudflareImageUrl(url)){return url}const parsed=parseCloudflareUrl(url);if(!parsed){return url}return`${parsed.baseUrl}/${parsed.accountHash}/${parsed.imageId}/public`}var MARKDOWN_IMAGE_SRCSET_WIDTHS=[400,800,1200,1600];var MARKDOWN_IMAGE_SIZES="(max-width: 768px) 100vw, 960px";function getResponsiveImageAttrs(originalUrl){if(!isCloudflareImageUrl(originalUrl)){return null}const parsed=parseCloudflareUrl(originalUrl);if(!parsed){return null}const{baseUrl,accountHash,imageId}=parsed;const quality=CLOUDFLARE_IMAGE_QUALITY;const fit="scale-down";const srcSet=MARKDOWN_IMAGE_SRCSET_WIDTHS.map(w=>`${baseUrl}/${accountHash}/${imageId}/w=${w},fit=${fit},q=${quality} ${w}w`).join(", ");const src=`${baseUrl}/${accountHash}/${imageId}/w=800,fit=${fit},q=${quality}`;return{src,srcSet,sizes:MARKDOWN_IMAGE_SIZES}}var PICTURE_DEVICE_WIDTHS={mobile:[640,1080],tablet:[1024,1536],desktop:[1440,1920]};var PICTURE_DEVICE_MEDIA={mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"};var PICTURE_DEVICES=["desktop","tablet","mobile"];function resolveDeviceCrops(input){const out={};for(const device of PICTURE_DEVICES){const ratio=input.ratios[device];if(!ratio){out[device]={ratio:null,rect:null};continue}const resolved=resolveScreenFraming({framing:input.framing,device,targetRatio:ratio,tabletInherits:input.tabletInherits,source:input.source});out[device]={ratio,rect:resolved.derived?null:resolved.rect}}return out}function isSameDeviceCrop(a,b){if(a.ratio!==b.ratio)return false;if(!a.rect||!b.rect)return a.rect===b.rect;return Math.abs(a.rect.x-b.rect.x)<5e-4&&Math.abs(a.rect.y-b.rect.y)<5e-4&&Math.abs(a.rect.w-b.rect.w)<5e-4&&Math.abs(a.rect.h-b.rect.h)<5e-4}function pictureWidthsFor(device,maxWidth){const base=PICTURE_DEVICE_WIDTHS[device];if(!maxWidth||maxWidth<=0||maxWidth>=base[base.length-1])return base;return[...base.filter(w=>w<maxWidth),Math.round(maxWidth)]}function resolveSiteImageRenderMode(input){const{src,framing,deviceRatios,tabletInherits="desktop"}=input;if(!src||!deviceRatios)return"single";const uniformRatio=deviceRatios.mobile===deviceRatios.desktop&&deviceRatios.tablet===deviceRatios.desktop;const hasScreens=hasScreenFraming(framing);if(!hasScreens&&uniformRatio)return"single";const trimmable=isCloudflareImageUrl(src)&&!isSvgImageUrl(src);if(!hasScreens)return trimmable?"picture":"single";const source=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const crops=resolveDeviceCrops({framing,ratios:deviceRatios,tabletInherits,source});const anyRect=PICTURE_DEVICES.some(device=>crops[device].rect!==null);if(!anyRect)return uniformRatio||!trimmable?"single":"picture";if(!trimmable||!source)return"css-fallback";if(uniformRatio&&isSameDeviceCrop(crops.desktop,crops.tablet)&&isSameDeviceCrop(crops.desktop,crops.mobile)){return"single-trim"}return"picture"}function buildSingleTrimImageUrl(input){const useCase=input.useCase??"general";const width=input.width??defaultWidthForUseCase(useCase);const ratioNum=parseAspectRatio(input.ratio)??16/9;const height=Math.max(1,Math.round(width/ratioNum));const source=input.framing?.source&&input.framing.source.width>0&&input.framing.source.height>0?input.framing.source:null;const resolved=resolveScreenFraming({framing:input.framing,device:"desktop",targetRatio:input.ratio,tabletInherits:input.tabletInherits,source});const trim=!resolved.derived&&source?rectToCloudflareTrim(resolved.rect,source):null;return{src:getOptimizedImageUrl(input.src,{useCase,width,height,fit:"crop",trim,focus:trim?null:effectiveImageFocus(input.framing)}),width,height}}function buildPictureSourcesPlan(input){const{src,useCase="general",ratios,framing,tabletInherits="desktop",maxWidth}=input;if(!isCloudflareImageUrl(src))return null;const sourceDims=framing?.source&&framing.source.width>0&&framing.source.height>0?framing.source:null;const focus=effectiveImageFocus(framing);const crops=resolveDeviceCrops({framing,ratios,tabletInherits,source:sourceDims});const buildForDevice=device=>{const{ratio,rect}=crops[device];const ratioNum=ratio?parseAspectRatio(ratio)??16/9:null;const trim=rect&&sourceDims?rectToCloudflareTrim(rect,sourceDims):null;const widths=pictureWidthsFor(device,maxWidth);const urls=[];const srcSetParts=widths.map(w=>{const url=ratioNum?getOptimizedImageUrl(src,{useCase,width:w,height:Math.max(1,Math.round(w/ratioNum)),fit:"crop",trim,focus:trim?null:focus}):getOptimizedImageUrl(src,{useCase,width:w,fit:"scale-down"});urls.push(url);return`${url} ${w}w`});const primaryW=widths[widths.length-1];const naturalAspect=sourceDims?sourceDims.width/sourceDims.height:null;const primaryH=ratioNum?Math.max(1,Math.round(primaryW/ratioNum)):naturalAspect?Math.max(1,Math.round(primaryW/naturalAspect)):null;const primaryUrl=urls[urls.length-1];return{device,media:device==="desktop"?void 0:PICTURE_DEVICE_MEDIA[device],src:primaryUrl,srcSet:srcSetParts.join(", "),sizes:input.sizes?.[device]??"100vw",width:primaryW,height:primaryH,urls}};const mobile=buildForDevice("mobile");const tabletDesc=buildForDevice("tablet");const desktop=buildForDevice("desktop");const tablet=isSameDeviceCrop(crops.tablet,crops.desktop)?null:tabletDesc;const preloads=tablet?[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:PICTURE_DEVICE_MEDIA.tablet,href:tablet.src,imageSrcSet:tablet.srcSet,imageSizes:tablet.sizes},{media:PICTURE_DEVICE_MEDIA.desktop,href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}]:[{media:PICTURE_DEVICE_MEDIA.mobile,href:mobile.src,imageSrcSet:mobile.srcSet,imageSizes:mobile.sizes},{media:"(min-width: 768px)",href:desktop.src,imageSrcSet:desktop.srcSet,imageSizes:desktop.sizes}];const allVariantUrls=Array.from(new Set([...mobile.urls,...tablet?tablet.urls:[],...desktop.urls]));return{mobile,tablet,desktop,preloads,allVariantUrls}}import{jsx}from"react/jsx-runtime";var FALLBACK={protection:DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:()=>null};var MediaProtectionContext=createContext(FALLBACK);function MediaProtectionProvider({protection,websiteId,apiBase="",children}){const value=useMemo(()=>({protection:protection??DEFAULT_MEDIA_PROTECTION,imageDownloadUrl:(imageUrl,name)=>{const imageId=extractImageIdFromUrl(imageUrl);if(!websiteId||!imageId)return null;const base=`${apiBase}/api/public/sites/${encodeURIComponent(websiteId)}/images/${encodeURIComponent(imageId)}/download`;const query=new URLSearchParams;if(name)query.set("name",name);const search=query.toString();return search?`${base}?${search}`:base}}),[protection,websiteId,apiBase]);return jsx(MediaProtectionContext.Provider,{value,children})}function useMediaProtection(){return useContext(MediaProtectionContext)}export{hasNaturalDevice,buildResponsiveFillClasses,normalizeImageCropRect,normalizePadColor,effectiveImageFocus,resolveScreenFraming,focusToObjectPosition,publicEdgeColor,displayFileName,mediaFactsFor,extractImageIdFromUrl,isSvgImageUrl,getOptimizedImageUrl,getOriginalImageUrl,getResponsiveImageAttrs,resolveSiteImageRenderMode,buildSingleTrimImageUrl,buildPictureSourcesPlan,parseMediaProtection,canVisitorsDownloadImages,canVisitorsShareImages,MediaProtectionProvider,useMediaProtection};
|
|
2
|
+
//# sourceMappingURL=chunk-L3BUSP27.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{buildPictureSourcesPlan,buildResponsiveFillClasses,buildSingleTrimImageUrl,effectiveImageFocus,focusToObjectPosition,getOptimizedImageUrl,getResponsiveImageAttrs,hasNaturalDevice,isSvgImageUrl,mediaFactsFor,normalizeImageCropRect,normalizePadColor,publicEdgeColor,resolveScreenFraming,resolveSiteImageRenderMode}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{buildPictureSourcesPlan,buildResponsiveFillClasses,buildSingleTrimImageUrl,effectiveImageFocus,focusToObjectPosition,getOptimizedImageUrl,getResponsiveImageAttrs,hasNaturalDevice,isSvgImageUrl,mediaFactsFor,normalizeImageCropRect,normalizePadColor,publicEdgeColor,resolveScreenFraming,resolveSiteImageRenderMode}from"./chunk-L3BUSP27.js";import{cn}from"./chunk-VUTODQFX.js";import{createContext,useContext,useMemo}from"react";import{jsx}from"react/jsx-runtime";var EMPTY={};var MediaFactsContext=createContext(EMPTY);function MediaFactsProvider({facts,children}){const parent=useContext(MediaFactsContext);const merged=useMemo(()=>{if(!facts||Object.keys(facts).length===0)return parent;if(Object.keys(parent).length===0)return facts;return{...parent,...facts}},[parent,facts]);return jsx(MediaFactsContext.Provider,{value:merged,children})}function useMediaFacts(ref){return mediaFactsFor(useContext(MediaFactsContext),ref)}import{forwardRef,useState}from"react";var ALT_TEXT_RECOMMENDED_MAX=125;var ALT_MAX_LENGTH=ALT_TEXT_RECOMMENDED_MAX;function generateAltText(type,name,fallback,seoKeywords){const primaryKeyword=seoKeywords&&seoKeywords.length>0?seoKeywords[0].trim():null;const trimmedName=name?.trim()||"";const fallbackText=fallback?.trim()||"";if(type==="logo"){return trimmedName||fallbackText||"logo"}if(trimmedName){if(primaryKeyword&&!trimmedName.includes(primaryKeyword)){return`${primaryKeyword} ${trimmedName}`}return trimmedName}if(fallbackText){if(primaryKeyword&&!fallbackText.includes(primaryKeyword)){return`${primaryKeyword} ${fallbackText}`}return fallbackText}return primaryKeyword||"image"}function generateIndexedAltText(type,index,name,seoKeywords){const baseAlt=generateAltText(type,name,void 0,seoKeywords);return`${baseAlt} (${index+1})`}function resolveAlt(params){const{explicitAlt,assetAltText,type,name,fallback,index,seoKeywords,websiteName}=params;const truncate=value=>value.length<=ALT_MAX_LENGTH?value:value.slice(0,ALT_MAX_LENGTH);if(explicitAlt&&explicitAlt.trim().length>0){return truncate(explicitAlt.trim())}if(type!=="logo"&&assetAltText&&assetAltText.trim().length>0){return truncate(assetAltText.trim())}const nameOrFallback=name?.trim()||fallback||websiteName?.trim();let alt;if(index!=null){alt=generateIndexedAltText(type,index,nameOrFallback||void 0,seoKeywords)}else{alt=generateAltText(type,nameOrFallback||void 0,void 0,seoKeywords)}return truncate(alt)}import{Fragment,jsx as jsx2,jsxs}from"react/jsx-runtime";function isCloudflareImage(url){return url.includes("imagedelivery.net")||url.includes("/cdn-cgi/imagedelivery/")}function rectToCssFallbackBox(rect){const r=normalizeImageCropRect(rect)??{x:0,y:0,w:1,h:1};const pct=v=>`${Math.round(v*1e4)/100}%`;return{left:pct(-r.x/r.w),top:pct(-r.y/r.h),width:pct(1/r.w),height:pct(1/r.h)}}var CSS_FALLBACK_DEVICES=[{device:"mobile",suffix:"m",position:{crop:"absolute",flow:"relative"}},{device:"tablet",suffix:"t",position:{crop:"md:absolute",flow:"md:relative"}},{device:"desktop",suffix:"d",position:{crop:"lg:absolute",flow:"lg:relative"}}];var CSS_FALLBACK_BOX_CLASSES="max-h-none max-w-none left-[var(--crop-l-m)] top-[var(--crop-t-m)] w-[var(--crop-w-m)] h-[var(--crop-h-m)] md:left-[var(--crop-l-t)] md:top-[var(--crop-t-t)] md:w-[var(--crop-w-t)] md:h-[var(--crop-h-t)] lg:left-[var(--crop-l-d)] lg:top-[var(--crop-t-d)] lg:w-[var(--crop-w-d)] lg:h-[var(--crop-h-d)]";var SiteImage=forwardRef(function SiteImage2({src,alt,altType,altName,explicitAlt,index,seoKeywords,websiteName,useCase="general",width,height,fit,responsive=false,sizes,fill=false,objectFit="cover",framing,deviceRatios,tabletInherits="desktop",priority=false,containBackdrop,className,style,onError,...rest},ref){const[failedSrc,setFailedSrc]=useState(null);const mediaFacts=useMediaFacts({url:src});const fillClass=fill?deviceRatios&&hasNaturalDevice(deviceRatios)?buildResponsiveFillClasses(deviceRatios):"absolute inset-0 h-full w-full":void 0;if(!src||failedSrc===src){return jsx2("span",{"aria-hidden":"true",className:cn("block bg-zinc-100 dark:bg-zinc-800",fillClass,className),style:{aspectRatio:width&&height?`${width} / ${height}`:"4 / 3",...style}})}const resolvedAlt=alt??(altType?resolveAlt({explicitAlt,assetAltText:mediaFacts?.altText,type:altType,name:altName,index,seoKeywords,websiteName}):"");const external=!isCloudflareImage(src);const svg=isSvgImageUrl(src);const isFramingContain=framing?.fitMode==="contain";const effectiveObjectFit=isFramingContain?"contain":objectFit;const effectiveFit=isFramingContain?"scale-down":fit;const focus=isFramingContain?null:effectiveImageFocus(framing);const mode=isFramingContain?"single":resolveSiteImageRenderMode({src,framing,deviceRatios,tabletInherits});const commonImgProps={ref,alt:resolvedAlt,loading:priority?"eager":"lazy",fetchPriority:priority?"high":"auto",decoding:"async",draggable:false,onError:event=>{setFailedSrc(src);onError?.(event)}};if(mode==="picture"&&deviceRatios){const plan=buildPictureSourcesPlan({src,useCase,ratios:deviceRatios,framing,tabletInherits,sizes:sizes?{desktop:sizes,tablet:sizes,mobile:sizes}:void 0,maxWidth:width});if(plan){return jsxs("picture",{className:cn(fill&&cn("block",fillClass)),children:[jsx2("source",{media:plan.mobile.media,srcSet:plan.mobile.srcSet,sizes:plan.mobile.sizes}),plan.tablet?jsx2("source",{media:plan.tablet.media,srcSet:plan.tablet.srcSet,sizes:plan.tablet.sizes}):null,jsx2("img",{...commonImgProps,src:plan.desktop.src,srcSet:plan.desktop.srcSet,sizes:plan.desktop.sizes,width:fill?void 0:plan.desktop.width,height:fill?void 0:plan.desktop.height??void 0,className:cn(fillClass,className),style:{objectFit,...style},...rest})]})}}if(mode==="single-trim"&&deviceRatios?.desktop){const trimmed=buildSingleTrimImageUrl({src,useCase,width,ratio:deviceRatios.desktop,framing,tabletInherits});return jsx2("img",{...commonImgProps,src:trimmed.src,width:fill?void 0:trimmed.width,height:fill?void 0:trimmed.height,className:cn(fillClass,className),style:{objectFit,...style},...rest})}if(mode==="css-fallback"&&fill&&deviceRatios){const vars={};const positionClasses=[];let previous=null;for(const{device,suffix,position}of CSS_FALLBACK_DEVICES){const ratio=deviceRatios[device];let box={left:"0%",top:"0%",width:"100%",height:"auto"};let kind="flow";if(ratio){kind="crop";const resolved=resolveScreenFraming({framing,device,targetRatio:ratio,tabletInherits,source:framing?.source??null});box=resolved.derived?{left:"0%",top:"0%",width:"100%",height:"100%"}:rectToCssFallbackBox(resolved.rect)}vars[`--crop-l-${suffix}`]=box.left;vars[`--crop-t-${suffix}`]=box.top;vars[`--crop-w-${suffix}`]=box.width;vars[`--crop-h-${suffix}`]=box.height;if(kind!==previous)positionClasses.push(position[kind]);previous=kind}const fallbackSrc=svg?src:getOptimizedImageUrl(src,{useCase,...width!=null?{width}:{}});return jsx2("img",{...commonImgProps,src:fallbackSrc,referrerPolicy:external?"no-referrer":void 0,className:cn(positionClasses,CSS_FALLBACK_BOX_CLASSES,className),style:{...vars,objectFit:"cover",...focus?{objectPosition:focusToObjectPosition(focus)}:{},...style},...rest})}const optimizeOpts={useCase};if(width!=null)optimizeOpts.width=width;if(height!=null)optimizeOpts.height=height;if(effectiveFit!=null)optimizeOpts.fit=effectiveFit;if(focus)optimizeOpts.focus=focus;const responsiveAttrs=responsive&&!svg?getResponsiveImageAttrs(src):null;const finalSrc=svg?src:responsiveAttrs?.src??getOptimizedImageUrl(src,optimizeOpts);const finalSrcSet=responsiveAttrs?.srcSet;const finalSizes=sizes??responsiveAttrs?.sizes;const activeContainBackdrop=containBackdrop??(fill&&effectiveObjectFit==="contain"||isFramingContain);const normalizedEdgeColor=publicEdgeColor(mediaFacts?.edgeColor);const customPadColor=normalizePadColor(framing?.padColor);const solidEdgeColor=activeContainBackdrop?customPadColor??(normalizedEdgeColor&&normalizedEdgeColor!=="transparent"?normalizedEdgeColor:void 0):void 0;const blurBackdropLqip=activeContainBackdrop&&!solidEdgeColor&&!normalizedEdgeColor&&mediaFacts?.lqip&&!svg?mediaFacts.lqip:void 0;const mergedStyle={objectFit:effectiveObjectFit,...focus?{objectPosition:focusToObjectPosition(focus)}:{},...solidEdgeColor?{backgroundColor:solidEdgeColor}:{},...style};const imgNode=jsx2("img",{...commonImgProps,src:finalSrc,srcSet:finalSrcSet,sizes:finalSizes,width:fill?void 0:width,height:fill?void 0:height,referrerPolicy:external?"no-referrer":void 0,className:cn(fillClass,className),style:mergedStyle,...rest});if(!blurBackdropLqip){return imgNode}return jsxs(Fragment,{children:[jsx2("span",{"aria-hidden":"true","data-testid":"site-image-blur-backdrop",className:"pointer-events-none absolute inset-0 overflow-hidden",children:jsx2("img",{src:blurBackdropLqip,alt:"",className:"h-full w-full scale-125 object-cover blur-xl"})}),imgNode]})});SiteImage.displayName="SiteImage";export{MediaFactsProvider,useMediaFacts,SiteImage};
|
|
2
|
+
//# sourceMappingURL=chunk-L66F3USG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{extractImageIdFromUrl,getOptimizedImageUrl,getOriginalImageUrl,useMediaProtection}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{extractImageIdFromUrl,getOptimizedImageUrl,getOriginalImageUrl,useMediaProtection}from"./chunk-L3BUSP27.js";import{lockPageScroll}from"./chunk-HFYLTH5B.js";import{useSiteLabels}from"./chunk-U7H3W23Q.js";import{useState,useCallback,useEffect,useMemo}from"react";var IMAGE_EXTENSION_PATTERN=/\.(avif|gif|jpe?g|png|webp)$/i;function getJpegDownloadFilename(url,filename){const baseFilename=filename?.trim()||extractImageIdFromUrl(url)||"image";if(IMAGE_EXTENSION_PATTERN.test(baseFilename)){return baseFilename.replace(IMAGE_EXTENSION_PATTERN,".jpg")}return`${baseFilename}.jpg`}async function downloadImageAsFile(url,filename){const downloadUrl=getOptimizedImageUrl(url,{useCase:"lightbox-image",format:"jpeg"});const res=await fetch(downloadUrl);if(!res.ok){throw new Error(`Failed to fetch image: ${res.status} ${res.statusText}`)}const blob=await res.blob();const a=document.createElement("a");a.href=URL.createObjectURL(blob);a.download=getJpegDownloadFilename(url,filename);a.click();URL.revokeObjectURL(a.href)}var MIN_ZOOM=1;var MAX_ZOOM=3;var ZOOM_STEP=.2;var IMAGE_DISPLAY_WIDTH_RATIO=.95;var IMAGE_DISPLAY_HEIGHT_RATIO=.9;var LIGHTBOX_BUTTON_BASE="w-10 h-10 md:w-12 md:h-12 rounded-full bg-[color-mix(in_srgb,var(--media-fg)_10%,transparent)] hover:bg-[color-mix(in_srgb,var(--media-fg)_20%,transparent)] flex items-center justify-center transition-all";var LIGHTBOX_BUTTON_DISABLED=`${LIGHTBOX_BUTTON_BASE} disabled:opacity-30 disabled:cursor-not-allowed`;var LIGHTBOX_ZOOM_RESET_BUTTON="h-10 md:h-12 min-w-[50px] px-2 rounded-full text-[var(--media-fg)] text-xs md:text-sm font-medium tabular-nums text-center transition-colors enabled:hover:bg-[color-mix(in_srgb,var(--media-fg)_10%,transparent)] disabled:cursor-default";function getDragClientPoint(e){if("touches"in e&&e.touches.length>0){return{clientX:e.touches[0].clientX,clientY:e.touches[0].clientY}}if("changedTouches"in e&&e.changedTouches.length>0){return{clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY}}return{clientX:e.clientX,clientY:e.clientY}}function useImageLightbox({images,filenames,enableKeyboard=false,onDownload,onShare}){const{ui}=useSiteLabels();const{imageDownloadUrl}=useMediaProtection();const isDesktopPointerDevice=useCallback(()=>{if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}return window.matchMedia("(hover: hover) and (pointer: fine)").matches},[]);const[lightboxOpen,setLightboxOpen]=useState(false);const[lightboxIndex,setLightboxIndex]=useState(0);const[zoomLevel,setZoomLevel]=useState(1);const[position,setPosition]=useState({x:0,y:0});const[isDraggingLightbox,setIsDraggingLightbox]=useState(false);const[dragStart,setDragStart]=useState({x:0,y:0});const zoomIn=useCallback(()=>{setZoomLevel(prev=>{const newZoom=Math.min(prev+ZOOM_STEP,MAX_ZOOM);return Math.round(newZoom*10)/10})},[]);const zoomOut=useCallback(()=>{setZoomLevel(prev=>{const newZoom=Math.max(prev-ZOOM_STEP,MIN_ZOOM);const rounded=Math.round(newZoom*10)/10;if(rounded===1){setPosition({x:0,y:0})}return rounded})},[]);const resetZoom=useCallback(()=>{setZoomLevel(1);setPosition({x:0,y:0})},[]);const openLightbox=useCallback(index=>{setLightboxIndex(index);setLightboxOpen(true);setZoomLevel(1);setPosition({x:0,y:0})},[]);const closeLightbox=useCallback(()=>{setLightboxOpen(false);resetZoom()},[resetZoom]);useEffect(()=>{if(!lightboxOpen)return;return lockPageScroll()},[lightboxOpen]);const prevImage=useCallback(()=>{if(images.length<=1)return;setLightboxIndex(prev=>{if(prev===0)return prev;return prev-1});resetZoom()},[images.length,resetZoom]);const nextImage=useCallback(()=>{if(images.length<=1)return;setLightboxIndex(prev=>{if(prev===images.length-1)return prev;return prev+1});resetZoom()},[images.length,resetZoom]);useEffect(()=>{if(!lightboxOpen||!enableKeyboard)return;const handleKeyDown=e=>{const isDesktopMode=isDesktopPointerDevice();const hasZoomModifier=e.metaKey||e.ctrlKey;const isZoomInKey=e.key==="+"||e.key==="="||e.key==="NumpadAdd";const isZoomOutKey=e.key==="-"||e.key==="_"||e.key==="NumpadSubtract";const isZoomResetKey=e.key==="0"||e.key==="Numpad0";if(isDesktopMode&&(hasZoomModifier&&(isZoomInKey||isZoomOutKey||isZoomResetKey)||isZoomInKey||isZoomOutKey||isZoomResetKey)){e.preventDefault();if(isZoomInKey){zoomIn();return}if(isZoomOutKey){zoomOut();return}resetZoom();return}switch(e.key){case"Escape":closeLightbox();break;case"ArrowLeft":prevImage();break;case"ArrowRight":nextImage();break}};window.addEventListener("keydown",handleKeyDown);return()=>window.removeEventListener("keydown",handleKeyDown)},[lightboxOpen,enableKeyboard,closeLightbox,prevImage,nextImage,zoomIn,zoomOut,resetZoom,isDesktopPointerDevice]);const dragBounds=useMemo(()=>{if(zoomLevel<=1){return{maxOffsetX:0,maxOffsetY:0}}const viewportWidth=typeof window!=="undefined"?window.innerWidth:1920;const viewportHeight=typeof window!=="undefined"?window.innerHeight:1080;const imageDisplayWidth=viewportWidth*IMAGE_DISPLAY_WIDTH_RATIO;const imageDisplayHeight=viewportHeight*IMAGE_DISPLAY_HEIGHT_RATIO;const scaledWidth=imageDisplayWidth*zoomLevel;const scaledHeight=imageDisplayHeight*zoomLevel;const maxOffsetX=Math.max(0,(scaledWidth-imageDisplayWidth)/2);const maxOffsetY=Math.max(0,(scaledHeight-imageDisplayHeight)/2);return{maxOffsetX,maxOffsetY}},[zoomLevel]);const handleLightboxDragStart=useCallback(e=>{if(zoomLevel<=1)return;setIsDraggingLightbox(true);const{clientX,clientY}=getDragClientPoint(e);setDragStart({x:clientX-position.x,y:clientY-position.y})},[zoomLevel,position]);const handleLightboxDrag=useCallback(e=>{if(!isDraggingLightbox||zoomLevel<=1)return;const{clientX,clientY}=getDragClientPoint(e);let newX=clientX-dragStart.x;let newY=clientY-dragStart.y;newX=Math.max(-dragBounds.maxOffsetX,Math.min(dragBounds.maxOffsetX,newX));newY=Math.max(-dragBounds.maxOffsetY,Math.min(dragBounds.maxOffsetY,newY));setPosition({x:newX,y:newY})},[isDraggingLightbox,zoomLevel,dragStart,dragBounds]);const handleLightboxDragEnd=useCallback(()=>{setIsDraggingLightbox(false)},[]);const handleDownload=useCallback(async()=>{const imageUrl=images[lightboxIndex];if(!imageUrl)return;if(onDownload){const originalUrl2=getOriginalImageUrl(imageUrl);await onDownload(originalUrl2,lightboxIndex);return}const filename=filenames?.[lightboxIndex];const routeUrl=imageDownloadUrl(imageUrl,filename);if(routeUrl){const anchor=document.createElement("a");anchor.href=routeUrl;anchor.rel="noopener";anchor.click();return}const originalUrl=getOriginalImageUrl(imageUrl);await downloadImageAsFile(originalUrl,filename)},[images,lightboxIndex,onDownload,filenames,imageDownloadUrl]);const handleShare=useCallback(async()=>{const imageUrl=images[lightboxIndex];if(!imageUrl)return;if(onShare){await onShare(imageUrl,lightboxIndex);return}if(navigator.share){try{await navigator.share({title:ui.imageShareTitle,text:ui.imageShareText,url:imageUrl})}catch{}}else{try{await navigator.clipboard.writeText(imageUrl)}catch{}}},[images,lightboxIndex,onShare]);return{lightboxOpen,lightboxIndex,zoomLevel,position,isDraggingLightbox,openLightbox,closeLightbox,setLightboxIndex,prevImage,nextImage,zoomIn,zoomOut,resetZoom,handleLightboxDragStart,handleLightboxDrag,handleLightboxDragEnd,handleDownload,handleShare}}export{MIN_ZOOM,MAX_ZOOM,LIGHTBOX_BUTTON_BASE,LIGHTBOX_BUTTON_DISABLED,LIGHTBOX_ZOOM_RESET_BUTTON,useImageLightbox};
|
|
2
|
+
//# sourceMappingURL=chunk-OLGITMLA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useKanorioProviderConfig,useKanorioSiteUrl}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{useKanorioProviderConfig,useKanorioSiteUrl}from"./chunk-RI64PHGM.js";import{useEffect,useState}from"react";import{jsx,jsxs}from"react/jsx-runtime";function reviewDate(publishedAt,timeZone){if(!timeZone)return publishedAt.slice(0,10);try{return new Intl.DateTimeFormat("en-CA",{timeZone,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(publishedAt))}catch{return publishedAt.slice(0,10)}}function KanorioReviews({target,pageSize,loadMoreLabel,verifiedLabel,replyLabel,className,siteUrl:siteUrlProp,timeZone:timeZoneProp}){const siteUrl=useKanorioSiteUrl(siteUrlProp);const parent=useKanorioProviderConfig();const timeZone=timeZoneProp!==void 0?timeZoneProp:parent?.timeZone??null;const[items,setItems]=useState([]);const[nextCursor,setNextCursor]=useState(null);const[loading,setLoading]=useState(false);async function load(cursor,replace){const url=new URL("/api/v1/reviews",siteUrl);url.searchParams.set("target",target);if(pageSize)url.searchParams.set("limit",String(pageSize));if(cursor)url.searchParams.set("cursor",cursor);setLoading(true);try{const res=await fetch(url.toString());if(!res.ok)throw new Error(String(res.status));const body=await res.json();setItems(prev=>replace?body.data??[]:[...prev,...body.data??[]]);setNextCursor(body.nextCursor??null)}catch{if(replace)setItems([]);setNextCursor(null)}finally{setLoading(false)}}useEffect(()=>{let cancelled=false;const url=new URL("/api/v1/reviews",siteUrl);url.searchParams.set("target",target);if(pageSize)url.searchParams.set("limit",String(pageSize));fetch(url.toString()).then(res=>res.ok?res.json():Promise.reject(new Error(String(res.status)))).then(body=>{if(cancelled)return;setItems(body.data??[]);setNextCursor(body.nextCursor??null)}).catch(()=>{if(cancelled)return;setItems([]);setNextCursor(null)});return()=>{cancelled=true}},[siteUrl,target,pageSize]);if(items.length===0)return null;return jsxs("div",{className,"data-kanorio-reviews":target,children:[jsx("ul",{"data-kanorio-reviews-list":"",children:items.map(item=>jsxs("li",{"data-kanorio-review":"","data-rating":item.rating,"data-verified":item.verified?"":void 0,children:[jsxs("div",{"data-kanorio-review-head":"",children:[jsx("strong",{"data-kanorio-review-author":"",children:item.authorName}),jsxs("span",{"data-kanorio-review-rating":"","aria-label":`${item.rating} / 5`,children:[item.rating,"/5"]}),item.verified&&verifiedLabel?jsx("span",{"data-kanorio-review-verified":"",children:verifiedLabel}):null,jsx("time",{"data-kanorio-review-date":"",dateTime:item.publishedAt,children:reviewDate(item.publishedAt,timeZone)})]}),item.content?jsx("p",{"data-kanorio-review-content":"",children:item.content}):null,item.reply?.body&&replyLabel?jsxs("div",{"data-kanorio-review-reply":"",children:[jsx("span",{"data-kanorio-review-reply-label":"",children:replyLabel}),jsx("p",{"data-kanorio-review-reply-body":"",children:item.reply.body})]}):null]},item.id))}),nextCursor&&loadMoreLabel?jsx("button",{type:"button","data-kanorio-reviews-more":"",disabled:loading,onClick:()=>void load(nextCursor,false),children:loadMoreLabel}):null]})}function KanorioRating({target,countLabel,className,siteUrl:siteUrlProp}){const siteUrl=useKanorioSiteUrl(siteUrlProp);const[summary,setSummary]=useState(null);useEffect(()=>{let cancelled=false;const url=new URL("/api/v1/reviews/summary",siteUrl);url.searchParams.set("target",target);fetch(url.toString()).then(res=>res.ok?res.json():Promise.reject(new Error(String(res.status)))).then(body=>{if(!cancelled)setSummary(body)}).catch(()=>{if(!cancelled)setSummary(null)});return()=>{cancelled=true}},[siteUrl,target]);if(!summary||!summary.visible||summary.rating==null)return null;const rounded=Math.round(summary.rating*10)/10;return jsxs("p",{className,"data-kanorio-rating":target,"data-rating":rounded,"data-count":summary.count,children:[jsx("span",{"data-kanorio-rating-value":"","aria-label":`${rounded} / 5`,children:rounded.toFixed(1)}),jsx("span",{"data-kanorio-rating-count":"",children:countLabel?countLabel.replace("{count}",String(summary.count)):summary.count})]})}export{KanorioReviews,KanorioRating};
|
|
2
|
+
//# sourceMappingURL=chunk-OWXGUUSI.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEffect,useState}from"react";var HOST_DARK_MARKS=[".dark",'[data-theme="dark"]'];var HOST_DARK_MARK_SELECTOR=HOST_DARK_MARKS.join(", ");var THEME_ATTRIBUTE="data-kanorio-theme";var SYSTEM_DARK_QUERY="(prefers-color-scheme: dark)";function resolveAutoCaptchaTheme(container,systemDark){let scoped=false;let auto=false;for(let el=container.closest(`[${THEME_ATTRIBUTE}]`);el;el=el.parentElement?.closest(`[${THEME_ATTRIBUTE}]`)){scoped=true;const theme=el.getAttribute(THEME_ATTRIBUTE);if(theme==="dark")return"dark";if(theme!=="auto")continue;auto=true;if(el.parentElement?.closest(HOST_DARK_MARK_SELECTOR))return"dark"}if(!scoped)return container.parentElement?.closest(HOST_DARK_MARK_SELECTOR)||systemDark?"dark":"light";return auto&&systemDark?"dark":"light"}function systemPrefersDark(){return typeof window!=="undefined"&&typeof window.matchMedia==="function"?window.matchMedia(SYSTEM_DARK_QUERY):null}function useResolvedCaptchaTheme(theme,containerRef,enabled=true){const[auto,setAuto]=useState(void 0);const wantsAuto=theme==="auto"&&enabled;useEffect(()=>{if(!wantsAuto)return;const container=containerRef.current;if(!container)return;const media=systemPrefersDark();const update=()=>setAuto(resolveAutoCaptchaTheme(container,media?.matches??false));update();media?.addEventListener?.("change",update);const observer=typeof MutationObserver==="function"?new MutationObserver(update):null;if(observer){observer.observe(container,{attributes:true,attributeFilter:[THEME_ATTRIBUTE]});for(let el=container.parentElement;el;el=el.parentElement){observer.observe(el,{attributes:true,attributeFilter:["class","data-theme",THEME_ATTRIBUTE]})}}return()=>{media?.removeEventListener?.("change",update);observer?.disconnect()}},[wantsAuto,containerRef]);if(theme==="auto")return enabled?auto:null;return theme??null}export{HOST_DARK_MARKS,useResolvedCaptchaTheme};
|
|
2
|
+
//# sourceMappingURL=chunk-Q4APVE7S.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{FORM_LIMITS}from"./chunk-APWDEDWM.js";import{fileTypesFor}from"./chunk-FFAWYDLJ.js";var FORM_FILE_STALL_TIMEOUT_MS=3e4;var FORM_FILE_EXT_BY_MIME=Object.fromEntries(fileTypesFor("form").map(type=>[type.mime,type.extensions[0]]));function formFileAcceptedMimes(field){return field.accept.length>0?field.accept:Object.keys(FORM_FILE_EXT_BY_MIME)}function checkFormFile(field,file){if(!formFileAcceptedMimes(field).includes(file.type))return"file_type_not_allowed";if(file.size>FORM_LIMITS.FILE_MAX_BYTES)return"file_too_large";return null}function putWithProgress(url,file,headers,options){const{onProgress,onActivity,signal}=options;return new Promise((resolve,reject)=>{if(signal.aborted){reject(new Error("abort"));return}const xhr=new XMLHttpRequest;const abort=()=>xhr.abort();signal.addEventListener("abort",abort,{once:true});const settle=finish=>{signal.removeEventListener("abort",abort);finish()};xhr.open("PUT",url);for(const[k,v]of Object.entries(headers))xhr.setRequestHeader(k,v);xhr.upload.onprogress=e=>{onActivity();if(e.lengthComputable)onProgress(e.loaded/e.total)};xhr.upload.onload=onActivity;xhr.onprogress=onActivity;xhr.onload=()=>settle(()=>xhr.status>=200&&xhr.status<300?resolve():reject(new Error(`PUT ${xhr.status}`)));xhr.onerror=()=>settle(()=>reject(new Error("network")));xhr.onabort=()=>settle(()=>reject(new Error("abort")));xhr.send(file)})}async function uploadFormFile(params){const{signal}=params;if(signal?.aborted)return{ok:false,reason:"aborted"};const controller=new AbortController;const abortFromCaller=()=>controller.abort();signal?.addEventListener("abort",abortFromCaller,{once:true});let stalled=false;let stallTimer;const sawActivity=()=>{clearTimeout(stallTimer);stallTimer=setTimeout(()=>{stalled=true;controller.abort()},FORM_FILE_STALL_TIMEOUT_MS)};const stopped=()=>({ok:false,reason:stalled?"failed":"aborted"});try{sawActivity();const res=await fetch(params.uploadUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fieldId:params.fieldId,fileName:params.file.name,mimeType:params.file.type,fileSize:params.file.size,...params.protection}),signal:controller.signal});const data=await res.json().catch(()=>null);if(controller.signal.aborted)return stopped();if(!res.ok||data?.ok===false||!data?.uploadId||!data.uploadUrl){const reason=data?.reason??data?.error?.code?.toLowerCase();if(reason==="file_too_large"||reason==="file_type_not_allowed")return{ok:false,reason};return{ok:false,reason:"unavailable"}}params.onUploading?.();sawActivity();await putWithProgress(data.uploadUrl,params.file,data.headers??{},{onProgress:ratio=>params.onProgress?.(ratio),onActivity:sawActivity,signal:controller.signal});return{ok:true,uploadId:data.uploadId}}catch{return controller.signal.aborted?stopped():{ok:false,reason:"failed"}}finally{clearTimeout(stallTimer);signal?.removeEventListener("abort",abortFromCaller)}}export{FORM_FILE_EXT_BY_MIME,formFileAcceptedMimes,checkFormFile,uploadFormFile};
|
|
2
|
+
//# sourceMappingURL=chunk-QF55WZDP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{pickSiteLabels}from"./chunk-KNNN5V3T.js";import{PortalScopeProvider}from"./chunk-763LNERD.js";import{SiteLabelsProvider}from"./chunk-U7H3W23Q.js";import{BRAND_ATTRIBUTE,ELEMENTS_POPUP_CLASS,ELEMENTS_ROOT_CLASS,HOST_DARK_MARK_SELECTOR,markScope}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{pickSiteLabels}from"./chunk-KNNN5V3T.js";import{PortalScopeProvider}from"./chunk-763LNERD.js";import{SiteLabelsProvider}from"./chunk-U7H3W23Q.js";import{BRAND_ATTRIBUTE,ELEMENTS_POPUP_CLASS,ELEMENTS_ROOT_CLASS,HOST_DARK_MARK_SELECTOR,markScope}from"./chunk-RI64PHGM.js";import{createContext,useContext,useLayoutEffect,useMemo,useRef,useState}from"react";import{jsx}from"react/jsx-runtime";function isChainAttached(root){for(let link=root;link;link=link.parent)if(!link.element())return false;return true}var RootContext=createContext(null);function resolvePopupTheme(root){let auto=false;for(let link=root;link;link=link.parent){if(link.theme==="dark")return"dark";if(link.theme!=="auto")continue;auto=true;const marked=link.element()?.parentElement?.closest(HOST_DARK_MARK_SELECTOR);if(marked&&!marked.contains(document.body))return"dark"}return auto?"auto":"light"}function useIsInsideElementsRoot(){return useContext(RootContext)!==null}function ElementsRoot({context,loading=false,className,children,"aria-busy":ariaBusy,...rest}){const{theme,messages,locale,messagesError}=context;const parent=useContext(RootContext);const brandScope=context.brandScope??parent?.brandScope??null;const rootRef=useRef(null);const[ownMarkedEarly]=useState(()=>new Map);const markedEarly=parent?.markedEarly??ownMarkedEarly;const link=useMemo(()=>({theme,brandScope,element:()=>rootRef.current,parent,markedEarly}),[theme,brandScope,parent,markedEarly]);const popupScope=useMemo(()=>({className:ELEMENTS_POPUP_CLASS,mark:element=>{const apply=()=>markScope(element,resolvePopupTheme(link),link.brandScope);if(!isChainAttached(link))markedEarly.set(element,apply);apply()}}),[link,markedEarly]);useLayoutEffect(()=>{if(markedEarly.size===0||!isChainAttached(link))return;for(const[element,apply]of markedEarly)if(element.isConnected)apply();markedEarly.clear()});const labels=useMemo(()=>messages?pickSiteLabels(messages,locale):null,[messages,locale]);const textUnavailable=messages===null&&messagesError;return jsx(RootContext.Provider,{value:link,children:jsx(PortalScopeProvider,{value:popupScope,children:jsx("div",{ref:rootRef,...rest,className:className?`${ELEMENTS_ROOT_CLASS} ${className}`:ELEMENTS_ROOT_CLASS,"data-kanorio-theme":theme,...{[BRAND_ATTRIBUTE]:brandScope??void 0},"aria-busy":ariaBusy??(loading&&!textUnavailable?true:void 0),"data-kanorio-error":messagesError?"text_unavailable":void 0,children:labels?jsx(SiteLabelsProvider,{labels,children}):children})})})}export{useIsInsideElementsRoot,ElementsRoot};
|
|
2
|
+
//# sourceMappingURL=chunk-QRKYFFDH.js.map
|