@kanorio/elements 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +57 -2
- package/dist/MediaPlayer-MWIDJORE.js +2 -0
- package/dist/MediaPlayer-STITRANS.js +13 -0
- package/dist/PDFViewerFull-HIUSAO57.js +13 -0
- package/dist/PDFViewerFull-L7VMOAMU.js +28062 -0
- package/dist/altcha-DSOKKAAV.js +3153 -0
- package/dist/altcha-FLBUR2LJ.js +4 -0
- package/dist/ar-4CBE4BWH.js +1233 -0
- package/dist/ar-6G7ZVSQ3.js +2 -0
- package/dist/ar-XCPH4WO5.js +98 -0
- package/dist/ar-ZVJL6XGE.js +2 -0
- package/dist/bg-4WPFSAMC.js +2 -0
- package/dist/bg-BKFL64I6.js +98 -0
- package/dist/bg-CB273F4D.js +1233 -0
- package/dist/bg-HCH4LMEX.js +2 -0
- package/dist/bn-HLYDEXHQ.js +1233 -0
- package/dist/bn-HVEVBAGM.js +98 -0
- package/dist/bn-OY7YGJIT.js +2 -0
- package/dist/bn-XX3O4VQB.js +2 -0
- package/dist/chunk-2UBPQBQI.js +1848 -0
- package/dist/chunk-5OB57Z46.js +23620 -0
- package/dist/chunk-6LJZ4HRF.js +1350 -0
- package/dist/chunk-6TUB24LJ.js +415 -0
- package/dist/chunk-74RRJOB4.js +15 -0
- package/dist/chunk-7TNRMVML.js +2 -0
- package/dist/chunk-BH27SBYG.js +2 -0
- package/dist/chunk-BQU7QZGC.js +4 -0
- package/dist/chunk-CHSZMJ5D.js +15103 -0
- package/dist/chunk-DDKQOHPW.js +930 -0
- package/dist/chunk-E5ZVE4VL.js +5 -0
- package/dist/chunk-FGBB7FT5.js +4 -0
- package/dist/chunk-FSH5K5FU.js +57 -0
- package/dist/chunk-G3PMV62Z.js +36 -0
- package/dist/chunk-IUB5YLUU.js +1538 -0
- package/dist/chunk-J7AP6FJF.js +8616 -0
- package/dist/chunk-LKOMEUNH.js +72 -0
- package/dist/chunk-NB57OIQA.js +2 -0
- package/dist/chunk-NLJE74VA.js +2 -0
- package/dist/chunk-NQBPWU5Z.js +15 -0
- package/dist/chunk-OJQYDPRD.js +39 -0
- package/dist/chunk-PDKFEXLU.js +59 -0
- package/dist/chunk-POG53MIA.js +2 -0
- package/dist/chunk-PXABHOW4.js +10871 -0
- package/dist/chunk-QDUG7UMV.js +363 -0
- package/dist/chunk-RFBBAUMM.js +2 -0
- package/dist/chunk-RJTKNOYT.js +67 -0
- package/dist/chunk-VH4656UY.js +2 -0
- package/dist/chunk-XAORGJWX.js +2 -0
- package/dist/chunk-Y77XXKLY.js +1858 -0
- package/dist/cs-EDLILQAV.js +1233 -0
- package/dist/cs-EOBDWVFI.js +2 -0
- package/dist/cs-Q732FDDB.js +98 -0
- package/dist/cs-UO3FC3H4.js +2 -0
- package/dist/da-43RMOYSN.js +98 -0
- package/dist/da-ANHSL3GD.js +2 -0
- package/dist/da-RBW34GCF.js +2 -0
- package/dist/da-SJ7YQT4L.js +1233 -0
- package/dist/de-2D2GW24Z.js +2 -0
- package/dist/de-5WGC4CMF.js +1233 -0
- package/dist/de-CPU2ARG7.js +98 -0
- package/dist/de-GVWNGUWZ.js +2 -0
- package/dist/deliverables-QUJISOBO.js +98 -0
- package/dist/deliverables-Z6ZBT6D3.js +2046 -0
- package/dist/el-FRNBHLQF.js +98 -0
- package/dist/el-HCBWOOCJ.js +1233 -0
- package/dist/el-KK7DBDUW.js +2 -0
- package/dist/el-SK362ZEN.js +2 -0
- package/dist/elements.css +2 -0
- package/dist/en-AU-BQA3DX35.js +1233 -0
- package/dist/en-AU-VZAXNXRA.js +2 -0
- package/dist/en-CA-T2VRZJVQ.js +2 -0
- package/dist/en-CA-ZWY5HD2Z.js +1233 -0
- package/dist/en-GB-CH3IGZSE.js +1233 -0
- package/dist/en-GB-MZQ2MGOR.js +2 -0
- package/dist/en-M24TV37U.js +2 -0
- package/dist/en-OURP64TI.js +2 -0
- package/dist/en-US-VWMNQOMN.js +2 -0
- package/dist/en-US-WJZ2OBFI.js +1233 -0
- package/dist/en-USCPKTM6.js +1233 -0
- package/dist/en-YND44PUO.js +98 -0
- package/dist/errors-7SQHRWKX.js +77 -0
- package/dist/errors-S6NFCUG2.js +2 -0
- package/dist/es-419-EMD4NA5M.js +2 -0
- package/dist/es-419-GPBJSXLV.js +2 -0
- package/dist/es-419-S6IHEZ4E.js +1233 -0
- package/dist/es-419-XPZOWYCA.js +98 -0
- package/dist/es-ES-EGMSPSY2.js +1233 -0
- package/dist/es-ES-U6NF6JHU.js +2 -0
- package/dist/es-es-ILD7QLKC.js +98 -0
- package/dist/es-es-MPX25JA6.js +2 -0
- package/dist/fa-5J3M6LW4.js +2 -0
- package/dist/fa-OC7ZPRF2.js +98 -0
- package/dist/fa-OFIO7IXD.js +1233 -0
- package/dist/fa-ZTPM4LEB.js +2 -0
- package/dist/fi-2V2STXSQ.js +2 -0
- package/dist/fi-7J4LPMG2.js +98 -0
- package/dist/fi-FMEAITYP.js +1233 -0
- package/dist/fi-N3BC4FYB.js +2 -0
- package/dist/fr-CA-IKSBTBHG.js +2 -0
- package/dist/fr-CA-S23ERMPM.js +1233 -0
- package/dist/fr-FR-RRTMSQWD.js +2 -0
- package/dist/fr-FR-SOIXFVK2.js +1233 -0
- package/dist/fr-ca-SUWTTOEW.js +2 -0
- package/dist/fr-ca-UUHAWMHI.js +98 -0
- package/dist/fr-fr-SGQ77PBC.js +98 -0
- package/dist/fr-fr-XE2V7MKM.js +2 -0
- package/dist/gu-RT7GQT5B.js +2 -0
- package/dist/gu-Z2QX2VCX.js +1233 -0
- package/dist/he-27MBDHSP.js +2 -0
- package/dist/he-E7RIZOIT.js +1233 -0
- package/dist/he-QGD477CH.js +98 -0
- package/dist/he-R3UJFF46.js +2 -0
- package/dist/hi-2AVAXR7K.js +1233 -0
- package/dist/hi-6ZBMVMGH.js +2 -0
- package/dist/hi-SGQH4OWG.js +98 -0
- package/dist/hi-XJHFN25N.js +2 -0
- package/dist/hls-C5FWCMHH.js +37426 -0
- package/dist/hls-ZQNRY2TQ.js +45 -0
- package/dist/hu-IOGZTF7L.js +2 -0
- package/dist/hu-KNZXJ7ZI.js +98 -0
- package/dist/hu-ORVGO3ZY.js +1233 -0
- package/dist/hu-PKL3T3JT.js +2 -0
- package/dist/id-FKFVQIN6.js +2 -0
- package/dist/id-JH2DLDBA.js +98 -0
- package/dist/id-TMOJUCBD.js +1233 -0
- package/dist/id-WLBO2VOW.js +2 -0
- package/dist/index.d.ts +2955 -0
- package/dist/index.js +67 -0
- package/dist/it-AGUEDSVA.js +2 -0
- package/dist/it-PJAB5BQB.js +98 -0
- package/dist/it-WF5BTFFJ.js +2 -0
- package/dist/it-YMZRYSIJ.js +1233 -0
- package/dist/ja-2ZVND7MB.js +2 -0
- package/dist/ja-555SY4AF.js +1233 -0
- package/dist/ja-RMBJ7E5Z.js +2 -0
- package/dist/ja-ZKBUQDUT.js +98 -0
- package/dist/kanorio-elements.js +97 -0
- package/dist/km-DF366BBP.js +1233 -0
- package/dist/km-JIUQ7MSM.js +2 -0
- package/dist/kn-KTJPREMQ.js +2 -0
- package/dist/kn-MJKASLJD.js +1233 -0
- package/dist/ko-CGY75OW4.js +2 -0
- package/dist/ko-KECCYX66.js +2 -0
- package/dist/ko-L5735TRU.js +98 -0
- package/dist/ko-S3OTZKIG.js +1233 -0
- package/dist/lo-7R55FKUB.js +1233 -0
- package/dist/lo-DNWTAFYF.js +2 -0
- package/dist/ml-B4BJPFVQ.js +2 -0
- package/dist/ml-FCTNQ4SP.js +1233 -0
- package/dist/mr-FJ4EDO7F.js +2 -0
- package/dist/mr-TZTFABWX.js +2 -0
- package/dist/mr-VZ5Y74YA.js +1233 -0
- package/dist/mr-Y464JCKX.js +98 -0
- package/dist/ms-VCX47GHB.js +2 -0
- package/dist/ms-WAJKD7ZV.js +1233 -0
- package/dist/my-S5L32WDK.js +2 -0
- package/dist/my-T7Y3Y64H.js +1233 -0
- package/dist/nb-53GCFBHF.js +2 -0
- package/dist/nb-IJDALVGX.js +99 -0
- package/dist/nb-LXBBUZUD.js +1233 -0
- package/dist/nb-PWWLEFUC.js +2 -0
- package/dist/ne-F7EEIDMA.js +2 -0
- package/dist/ne-NDLRKG6T.js +1233 -0
- package/dist/nl-262SKC6R.js +98 -0
- package/dist/nl-BE-3KOYUD6Y.js +1233 -0
- package/dist/nl-BE-VZJDK6CH.js +2 -0
- package/dist/nl-NL-3OIKN2DQ.js +2 -0
- package/dist/nl-NL-T7SQOLLA.js +1233 -0
- package/dist/nl-XKCUNU3P.js +2 -0
- package/dist/nn-AHWRAFXZ.js +1233 -0
- package/dist/nn-YH7F7UK3.js +2 -0
- package/dist/pa-HC24FOUI.js +2 -0
- package/dist/pa-J26C5J7M.js +1233 -0
- package/dist/pl-QSTOYTPG.js +1233 -0
- package/dist/pl-T7J6A26Y.js +2 -0
- package/dist/pl-TYHET6JJ.js +2 -0
- package/dist/pl-XDJJ6AUG.js +98 -0
- package/dist/prod-MRWX5W24.js +38 -0
- package/dist/prod-YHXWTKNF.js +2 -0
- package/dist/pt-BR-4QRR4PXU.js +2 -0
- package/dist/pt-BR-7JM75AGX.js +1233 -0
- package/dist/pt-PT-W3WZEROD.js +1233 -0
- package/dist/pt-PT-Z5FI4CLF.js +2 -0
- package/dist/pt-br-2W4P4ZAJ.js +2 -0
- package/dist/pt-br-JP6VI5C5.js +98 -0
- package/dist/pt-pt-22LJFZT5.js +98 -0
- package/dist/pt-pt-HOBFIPWZ.js +2 -0
- package/dist/ro-3KXIEYVK.js +98 -0
- package/dist/ro-3YUPB2TJ.js +1233 -0
- package/dist/ro-JXHNIBOA.js +2 -0
- package/dist/ro-KHPOLQC6.js +2 -0
- package/dist/ru-5ZVLKPFN.js +2 -0
- package/dist/ru-ASND25AB.js +2 -0
- package/dist/ru-ATGZC5LB.js +1233 -0
- package/dist/ru-W44AHOIC.js +98 -0
- package/dist/si-RHXLIDQI.js +1233 -0
- package/dist/si-U3O6NRHE.js +2 -0
- package/dist/srt-parser-6DEDUV5P.js +43 -0
- package/dist/srt-parser-E666S3YO.js +3 -0
- package/dist/ssa-parser-5GJ737XF.js +309 -0
- package/dist/ssa-parser-BR3CTDHR.js +5 -0
- package/dist/sv-5LOOKXJA.js +98 -0
- package/dist/sv-6GKNCPMS.js +2 -0
- package/dist/sv-LL3HMUIA.js +1233 -0
- package/dist/sv-RRJ6LYFT.js +2 -0
- package/dist/sw-HBNHIHPG.js +2 -0
- package/dist/sw-HP7MYGQ5.js +1233 -0
- package/dist/sw-NTSCFQXY.js +2 -0
- package/dist/sw-YIUB7QN3.js +98 -0
- package/dist/ta-4RG3PWN5.js +98 -0
- package/dist/ta-ARSNSDK5.js +2 -0
- package/dist/ta-Q2LBTDH6.js +2 -0
- package/dist/ta-Z5EVUBYF.js +1233 -0
- package/dist/te-FAWIFHVW.js +2 -0
- package/dist/te-FXJYUGGL.js +98 -0
- package/dist/te-GDV3DJFJ.js +1233 -0
- package/dist/te-TIMB7HBY.js +2 -0
- package/dist/th-7CEFYE5H.js +2 -0
- package/dist/th-CFAEFK3E.js +1233 -0
- package/dist/th-KGPTXFIF.js +2 -0
- package/dist/th-TC6J25FB.js +98 -0
- package/dist/tl-2JDK2CBL.js +2 -0
- package/dist/tl-SGZM4XSX.js +1233 -0
- package/dist/tr-27OEWIPE.js +1233 -0
- package/dist/tr-2MEHQO75.js +98 -0
- package/dist/tr-7P2UAX7U.js +2 -0
- package/dist/tr-NKD6C4RY.js +2 -0
- package/dist/uk-CXQISVJP.js +2 -0
- package/dist/uk-EJIGGLKY.js +1233 -0
- package/dist/uk-JCI3UE6Q.js +98 -0
- package/dist/uk-QM5BBWP7.js +2 -0
- package/dist/ur-5EWYHPME.js +1233 -0
- package/dist/ur-IIOUQYSA.js +98 -0
- package/dist/ur-M3QWGAPF.js +2 -0
- package/dist/ur-TLLPXSTM.js +2 -0
- package/dist/vi-AXQYYRD3.js +2 -0
- package/dist/vi-JALLXYS7.js +1233 -0
- package/dist/vi-SS65KZTI.js +2 -0
- package/dist/vi-YQVNQEVG.js +98 -0
- package/dist/vidstack-B9fTkxQO-LJP5ADOO.js +215 -0
- package/dist/vidstack-B9fTkxQO-OCT23G55.js +2 -0
- package/dist/vidstack-BmcqUMKx-A2W3TQB6.js +2 -0
- package/dist/vidstack-BmcqUMKx-G6TB22IC.js +286 -0
- package/dist/vidstack-C0fPJIzs-7AH6MOHO.js +2 -0
- package/dist/vidstack-C0fPJIzs-PNQOR4TK.js +11 -0
- package/dist/vidstack-CHcsWfRV-UAVLHO6N.js +40 -0
- package/dist/vidstack-CHcsWfRV-V52LFHYG.js +2 -0
- package/dist/vidstack-CvezEmSQ-JXKCQ4VQ.js +2 -0
- package/dist/vidstack-CvezEmSQ-R32NZKJ2.js +130 -0
- package/dist/vidstack-D2vrrUMs-7XAY5IBS.js +2 -0
- package/dist/vidstack-D2vrrUMs-FNQR2A5M.js +467 -0
- package/dist/vidstack-Di0HObvT-6ND3AXWZ.js +112 -0
- package/dist/vidstack-Di0HObvT-ZV7XK2OT.js +2 -0
- package/dist/vidstack-DiaLSJYx-H762DXYG.js +2 -0
- package/dist/vidstack-DiaLSJYx-S7DDW2H3.js +380 -0
- package/dist/vidstack-Dy74GavT-EYLL6MEF.js +2 -0
- package/dist/vidstack-Dy74GavT-XNIJ7PF4.js +11 -0
- package/dist/vidstack-GkTzay8D-C7EJKMV4.js +2 -0
- package/dist/vidstack-GkTzay8D-SQU5IF3P.js +482 -0
- package/dist/web-components.d.ts +12 -0
- package/dist/web-components.js +123 -0
- package/dist/worker.js +1 -0
- package/dist/zh-CN-PVVDP25S.js +2 -0
- package/dist/zh-CN-TLPNCXUN.js +1233 -0
- package/dist/zh-HK-GOKVZUJZ.js +1233 -0
- package/dist/zh-HK-Z5B2ANLW.js +2 -0
- package/dist/zh-Hant-2R7T4HJT.js +1233 -0
- package/dist/zh-Hant-MWAFLLDD.js +2 -0
- package/dist/zh-cn-D36OS2SI.js +2 -0
- package/dist/zh-cn-Z5YVUN62.js +98 -0
- package/dist/zh-tw-JWILJCBD.js +2 -0
- package/dist/zh-tw-X7JGMR4G.js +98 -0
- package/package.json +84 -3
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
// ../shared/i18n/site-labels.ts
|
|
2
|
+
function pickSiteLabels(messages, locale) {
|
|
3
|
+
return {
|
|
4
|
+
locale,
|
|
5
|
+
ui: messages.ui,
|
|
6
|
+
search: messages.search,
|
|
7
|
+
shop: messages.shop,
|
|
8
|
+
blog: messages.blog,
|
|
9
|
+
productInfo: messages.productInfo,
|
|
10
|
+
delivery: messages.delivery,
|
|
11
|
+
paymentMethods: messages.orderStatus.methodTypes,
|
|
12
|
+
cookieSettings: messages.cookieConsent.settings,
|
|
13
|
+
curriculum: {
|
|
14
|
+
contentUnitsCount: messages.account.contentUnitsCount,
|
|
15
|
+
contentPreviewBadge: messages.account.contentPreviewBadge,
|
|
16
|
+
contentLocked: messages.account.contentLocked,
|
|
17
|
+
contentOptional: messages.account.contentOptional,
|
|
18
|
+
contentLoadError: messages.account.contentLoadError,
|
|
19
|
+
contentNoUnits: messages.account.contentNoUnits
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function fillLabel(template, vars) {
|
|
24
|
+
let text = template;
|
|
25
|
+
for (const [name, value] of Object.entries(vars)) text = text.replaceAll(`{${name}}`, value);
|
|
26
|
+
return text;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ../shared/storage/media-protection.ts
|
|
30
|
+
var WATERMARK_POSITIONS = [
|
|
31
|
+
"top-left",
|
|
32
|
+
"top",
|
|
33
|
+
"top-right",
|
|
34
|
+
"left",
|
|
35
|
+
"center",
|
|
36
|
+
"right",
|
|
37
|
+
"bottom-left",
|
|
38
|
+
"bottom",
|
|
39
|
+
"bottom-right"
|
|
40
|
+
];
|
|
41
|
+
var WATERMARK_SOURCES = ["logo", "text", "image"];
|
|
42
|
+
var WATERMARK_SIZE_RANGE = { min: 5, max: 50, default: 20 };
|
|
43
|
+
var WATERMARK_OPACITY_RANGE = { min: 10, max: 100, default: 60 };
|
|
44
|
+
var WATERMARK_TEXT_MAX_LENGTH = 60;
|
|
45
|
+
var DEFAULT_WATERMARK_APPLY = { pages: true, articles: true, products: false };
|
|
46
|
+
var DEFAULT_MEDIA_WATERMARK = {
|
|
47
|
+
enabled: false,
|
|
48
|
+
source: "logo",
|
|
49
|
+
text: "",
|
|
50
|
+
image: null,
|
|
51
|
+
layout: "single",
|
|
52
|
+
position: "bottom-right",
|
|
53
|
+
size: WATERMARK_SIZE_RANGE.default,
|
|
54
|
+
opacity: WATERMARK_OPACITY_RANGE.default,
|
|
55
|
+
apply: DEFAULT_WATERMARK_APPLY,
|
|
56
|
+
overlay: null,
|
|
57
|
+
version: null,
|
|
58
|
+
activatedAt: null,
|
|
59
|
+
deactivatedAt: null
|
|
60
|
+
};
|
|
61
|
+
var DEFAULT_MEDIA_PROTECTION = {
|
|
62
|
+
allowDownload: true,
|
|
63
|
+
keepCopyright: true,
|
|
64
|
+
deterrence: false,
|
|
65
|
+
watermark: DEFAULT_MEDIA_WATERMARK
|
|
66
|
+
};
|
|
67
|
+
function clampInt(value, range) {
|
|
68
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return range.default;
|
|
69
|
+
return Math.min(range.max, Math.max(range.min, Math.round(value)));
|
|
70
|
+
}
|
|
71
|
+
function pick(value, options, fallback) {
|
|
72
|
+
return typeof value === "string" && options.includes(value) ? value : fallback;
|
|
73
|
+
}
|
|
74
|
+
function parseWatermarkApply(value) {
|
|
75
|
+
const raw = value && typeof value === "object" ? value : {};
|
|
76
|
+
const flag = (key) => typeof raw[key] === "boolean" ? raw[key] : DEFAULT_WATERMARK_APPLY[key];
|
|
77
|
+
return { pages: flag("pages"), articles: flag("articles"), products: flag("products") };
|
|
78
|
+
}
|
|
79
|
+
function parseMediaWatermark(value) {
|
|
80
|
+
const raw = value && typeof value === "object" ? value : {};
|
|
81
|
+
const overlayRaw = raw.overlay && typeof raw.overlay === "object" ? raw.overlay : null;
|
|
82
|
+
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;
|
|
83
|
+
const regenHistory = Array.isArray(raw.regenHistory) ? raw.regenHistory.filter((item) => typeof item === "string" && !Number.isNaN(Date.parse(item))) : void 0;
|
|
84
|
+
const scheduledAt = isoOrNull(raw.scheduledAt);
|
|
85
|
+
return {
|
|
86
|
+
enabled: raw.enabled === true,
|
|
87
|
+
source: pick(raw.source, WATERMARK_SOURCES, DEFAULT_MEDIA_WATERMARK.source),
|
|
88
|
+
text: typeof raw.text === "string" ? raw.text.slice(0, WATERMARK_TEXT_MAX_LENGTH) : "",
|
|
89
|
+
image: typeof raw.image === "string" && raw.image ? raw.image : null,
|
|
90
|
+
layout: raw.layout === "tile" ? "tile" : "single",
|
|
91
|
+
position: pick(raw.position, WATERMARK_POSITIONS, DEFAULT_MEDIA_WATERMARK.position),
|
|
92
|
+
size: clampInt(raw.size, WATERMARK_SIZE_RANGE),
|
|
93
|
+
opacity: clampInt(raw.opacity, WATERMARK_OPACITY_RANGE),
|
|
94
|
+
apply: parseWatermarkApply(raw.apply),
|
|
95
|
+
overlay,
|
|
96
|
+
version: typeof raw.version === "string" && raw.version ? raw.version : null,
|
|
97
|
+
activatedAt: isoOrNull(raw.activatedAt),
|
|
98
|
+
deactivatedAt: isoOrNull(raw.deactivatedAt),
|
|
99
|
+
...regenHistory && regenHistory.length > 0 ? { regenHistory } : {},
|
|
100
|
+
...scheduledAt ? { scheduledAt } : {}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function isoOrNull(value) {
|
|
104
|
+
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? value : null;
|
|
105
|
+
}
|
|
106
|
+
function parseMediaProtection(value) {
|
|
107
|
+
const raw = value && typeof value === "object" ? value : {};
|
|
108
|
+
const flag = (key) => typeof raw[key] === "boolean" ? raw[key] : DEFAULT_MEDIA_PROTECTION[key];
|
|
109
|
+
return {
|
|
110
|
+
allowDownload: flag("allowDownload"),
|
|
111
|
+
keepCopyright: flag("keepCopyright"),
|
|
112
|
+
deterrence: flag("deterrence"),
|
|
113
|
+
watermark: parseMediaWatermark(raw.watermark)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function canVisitorsDownloadImages(protection) {
|
|
117
|
+
return protection.allowDownload && !protection.deterrence;
|
|
118
|
+
}
|
|
119
|
+
function canVisitorsShareImages(protection) {
|
|
120
|
+
return !protection.deterrence;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ../shared/components/media/MediaProtection.tsx
|
|
124
|
+
import { createContext, useContext, useMemo } from "react";
|
|
125
|
+
|
|
126
|
+
// ../shared/storage/section-aspect-ratios.ts
|
|
127
|
+
var HERO_BANNER_PRESET_RATIOS = [
|
|
128
|
+
"24:9",
|
|
129
|
+
"21:9",
|
|
130
|
+
"16:9",
|
|
131
|
+
"4:3",
|
|
132
|
+
"1:1",
|
|
133
|
+
"4:5"
|
|
134
|
+
];
|
|
135
|
+
var SPLIT_IMAGE_PRESET_RATIOS = [
|
|
136
|
+
"16:9",
|
|
137
|
+
"4:3",
|
|
138
|
+
"1:1",
|
|
139
|
+
"3:4",
|
|
140
|
+
"4:5"
|
|
141
|
+
];
|
|
142
|
+
var CARD_PRESET_RATIOS = [
|
|
143
|
+
"4:3",
|
|
144
|
+
"1:1",
|
|
145
|
+
"3:4"
|
|
146
|
+
];
|
|
147
|
+
function parseAspectRatio(ratio) {
|
|
148
|
+
if (typeof ratio !== "string") return null;
|
|
149
|
+
const match = /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(ratio.trim());
|
|
150
|
+
if (!match) return null;
|
|
151
|
+
const w = Number(match[1]);
|
|
152
|
+
const h = Number(match[2]);
|
|
153
|
+
if (!Number.isFinite(w) || !Number.isFinite(h) || w <= 0 || h <= 0) return null;
|
|
154
|
+
const value = w / h;
|
|
155
|
+
if (value < 0.25 - 1e-6 || value > 5 + 1e-6) return null;
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
function hasNaturalDevice(ratios) {
|
|
159
|
+
return ratios.desktop === null || ratios.tablet === null || ratios.mobile === null;
|
|
160
|
+
}
|
|
161
|
+
var FILL_POSITION_CLASSES = {
|
|
162
|
+
mobile: { fill: "absolute inset-0 h-full w-full", flow: "relative h-auto w-full" },
|
|
163
|
+
tablet: { fill: "md:absolute md:inset-0 md:h-full", flow: "md:relative md:inset-auto md:h-auto" },
|
|
164
|
+
desktop: { fill: "lg:absolute lg:inset-0 lg:h-full", flow: "lg:relative lg:inset-auto lg:h-auto" }
|
|
165
|
+
};
|
|
166
|
+
function buildResponsiveFillClasses(ratios) {
|
|
167
|
+
const mode = (ratio) => ratio && parseAspectRatio(ratio) ? "fill" : "flow";
|
|
168
|
+
const m = mode(ratios.mobile);
|
|
169
|
+
const t = mode(ratios.tablet);
|
|
170
|
+
const d = mode(ratios.desktop);
|
|
171
|
+
const classes = [FILL_POSITION_CLASSES.mobile[m]];
|
|
172
|
+
if (t !== m) classes.push(FILL_POSITION_CLASSES.tablet[t]);
|
|
173
|
+
if (d !== t) classes.push(FILL_POSITION_CLASSES.desktop[d]);
|
|
174
|
+
return classes.join(" ");
|
|
175
|
+
}
|
|
176
|
+
function bannerHeightDefaultRatio(bannerHeight) {
|
|
177
|
+
switch (bannerHeight ?? "standard") {
|
|
178
|
+
case "compact":
|
|
179
|
+
return "24:9";
|
|
180
|
+
case "tall":
|
|
181
|
+
return "16:9";
|
|
182
|
+
case "standard":
|
|
183
|
+
default:
|
|
184
|
+
return "21:9";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
var SECTION_RATIO_POLICIES = {
|
|
188
|
+
"page-main-visual:banner-profile": {
|
|
189
|
+
tabletInherits: "desktop",
|
|
190
|
+
devices: ["desktop", "tablet", "mobile"],
|
|
191
|
+
presets: HERO_BANNER_PRESET_RATIOS,
|
|
192
|
+
allowCustomRatio: true
|
|
193
|
+
},
|
|
194
|
+
"page-main-visual:split-hero": {
|
|
195
|
+
tabletInherits: "mobile",
|
|
196
|
+
devices: ["desktop", "tablet", "mobile"],
|
|
197
|
+
presets: SPLIT_IMAGE_PRESET_RATIOS,
|
|
198
|
+
allowCustomRatio: true
|
|
199
|
+
},
|
|
200
|
+
"page-main-visual:overlay-hero": {
|
|
201
|
+
tabletInherits: "desktop",
|
|
202
|
+
devices: ["desktop", "mobile"],
|
|
203
|
+
presets: ["16:9", "4:5"],
|
|
204
|
+
allowCustomRatio: false,
|
|
205
|
+
fixedHeight: true
|
|
206
|
+
},
|
|
207
|
+
"image-text-split": {
|
|
208
|
+
tabletInherits: "mobile",
|
|
209
|
+
devices: ["desktop", "tablet", "mobile"],
|
|
210
|
+
presets: SPLIT_IMAGE_PRESET_RATIOS,
|
|
211
|
+
allowCustomRatio: true,
|
|
212
|
+
allowNatural: true
|
|
213
|
+
},
|
|
214
|
+
"full-width-image": {
|
|
215
|
+
tabletInherits: "desktop",
|
|
216
|
+
devices: ["desktop", "tablet", "mobile"],
|
|
217
|
+
presets: HERO_BANNER_PRESET_RATIOS,
|
|
218
|
+
allowCustomRatio: true,
|
|
219
|
+
allowNatural: true
|
|
220
|
+
},
|
|
221
|
+
"card-grid": {
|
|
222
|
+
tabletInherits: "desktop",
|
|
223
|
+
devices: ["desktop"],
|
|
224
|
+
presets: CARD_PRESET_RATIOS,
|
|
225
|
+
allowCustomRatio: false
|
|
226
|
+
},
|
|
227
|
+
"multi-link": {
|
|
228
|
+
tabletInherits: "desktop",
|
|
229
|
+
devices: ["desktop"],
|
|
230
|
+
presets: ["4:3"],
|
|
231
|
+
allowCustomRatio: false
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
function resolveDeviceValue(input, fallback, tabletInherits = "desktop") {
|
|
235
|
+
if (input === void 0 || input === null) {
|
|
236
|
+
return { desktop: fallback, tablet: fallback, mobile: fallback };
|
|
237
|
+
}
|
|
238
|
+
if (typeof input !== "object") {
|
|
239
|
+
return { desktop: input, tablet: input, mobile: input };
|
|
240
|
+
}
|
|
241
|
+
const record = input;
|
|
242
|
+
const desktop = record.desktop ?? fallback;
|
|
243
|
+
const mobile = record.mobile ?? desktop;
|
|
244
|
+
const tablet = record.tablet ?? (tabletInherits === "mobile" ? mobile : desktop);
|
|
245
|
+
return { desktop, tablet, mobile };
|
|
246
|
+
}
|
|
247
|
+
function resolvePageMainVisualRatios(input) {
|
|
248
|
+
const layout = input.layout ?? "banner-profile";
|
|
249
|
+
if (layout === "overlay-hero") {
|
|
250
|
+
const policy2 = SECTION_RATIO_POLICIES["page-main-visual:overlay-hero"];
|
|
251
|
+
return {
|
|
252
|
+
policy: policy2,
|
|
253
|
+
ratios: { desktop: "16:9", tablet: "16:9", mobile: "4:5" },
|
|
254
|
+
fixedHeight: true
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
if (layout === "split-hero") {
|
|
258
|
+
const policy2 = SECTION_RATIO_POLICIES["page-main-visual:split-hero"];
|
|
259
|
+
const raw2 = resolveDeviceValue(input.imageRatio, "4:3", policy2.tabletInherits);
|
|
260
|
+
return {
|
|
261
|
+
policy: policy2,
|
|
262
|
+
ratios: {
|
|
263
|
+
desktop: raw2.desktop === "natural" || !parseAspectRatio(raw2.desktop) ? "4:3" : raw2.desktop,
|
|
264
|
+
tablet: raw2.tablet === "natural" || !parseAspectRatio(raw2.tablet) ? "4:3" : raw2.tablet,
|
|
265
|
+
mobile: raw2.mobile === "natural" || !parseAspectRatio(raw2.mobile) ? "4:3" : raw2.mobile
|
|
266
|
+
},
|
|
267
|
+
fixedHeight: false
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const policy = SECTION_RATIO_POLICIES["page-main-visual:banner-profile"];
|
|
271
|
+
const fallback = bannerHeightDefaultRatio(input.bannerHeight);
|
|
272
|
+
const raw = resolveDeviceValue(input.imageRatio, fallback, policy.tabletInherits);
|
|
273
|
+
return {
|
|
274
|
+
policy,
|
|
275
|
+
ratios: {
|
|
276
|
+
desktop: raw.desktop === "natural" || !parseAspectRatio(raw.desktop) ? fallback : raw.desktop,
|
|
277
|
+
tablet: raw.tablet === "natural" || !parseAspectRatio(raw.tablet) ? fallback : raw.tablet,
|
|
278
|
+
mobile: raw.mobile === "natural" || !parseAspectRatio(raw.mobile) ? fallback : raw.mobile
|
|
279
|
+
},
|
|
280
|
+
fixedHeight: false
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function toFocusFrameSpecs(ratios) {
|
|
284
|
+
const d = ratios.desktop;
|
|
285
|
+
const t = ratios.tablet;
|
|
286
|
+
const m = ratios.mobile;
|
|
287
|
+
if (!d && !t && !m) return null;
|
|
288
|
+
if (d && d === t && d === m) {
|
|
289
|
+
return [{ device: "all", ratio: d }];
|
|
290
|
+
}
|
|
291
|
+
const frames = [];
|
|
292
|
+
if (d) frames.push({ device: "desktop", ratio: d });
|
|
293
|
+
if (t && t !== d && t !== m) frames.push({ device: "tablet", ratio: t });
|
|
294
|
+
if (m && m !== d) frames.push({ device: "mobile", ratio: m });
|
|
295
|
+
return frames.length > 0 ? frames : null;
|
|
296
|
+
}
|
|
297
|
+
function pageMainVisualFocusFrames(input) {
|
|
298
|
+
const { ratios } = resolvePageMainVisualRatios(input ?? {});
|
|
299
|
+
return toFocusFrameSpecs(ratios) ?? [{ device: "all", ratio: "21:9" }];
|
|
300
|
+
}
|
|
301
|
+
var HERO_FOCUS_FRAMES = pageMainVisualFocusFrames();
|
|
302
|
+
|
|
303
|
+
// ../shared/storage/image-framing.ts
|
|
304
|
+
var MIN_CROP_RECT_SPAN = 0.05;
|
|
305
|
+
function clampUnit(value) {
|
|
306
|
+
return Math.min(1, Math.max(0, value));
|
|
307
|
+
}
|
|
308
|
+
function normalizeImageFocus(value) {
|
|
309
|
+
if (!value || typeof value !== "object") return null;
|
|
310
|
+
const { x, y } = value;
|
|
311
|
+
if (typeof x !== "number" || typeof y !== "number") return null;
|
|
312
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
|
|
313
|
+
return { x: clampUnit(x), y: clampUnit(y) };
|
|
314
|
+
}
|
|
315
|
+
function normalizeImageCropRect(value) {
|
|
316
|
+
if (!value || typeof value !== "object") return null;
|
|
317
|
+
const { x, y, w, h } = value;
|
|
318
|
+
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)) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
const nw = Math.min(1, Math.max(MIN_CROP_RECT_SPAN, w));
|
|
322
|
+
const nh = Math.min(1, Math.max(MIN_CROP_RECT_SPAN, h));
|
|
323
|
+
const nx = Math.min(1 - nw, Math.max(0, x));
|
|
324
|
+
const ny = Math.min(1 - nh, Math.max(0, y));
|
|
325
|
+
return { x: nx, y: ny, w: nw, h: nh };
|
|
326
|
+
}
|
|
327
|
+
function normalizeImageScreenFraming(value) {
|
|
328
|
+
if (!value || typeof value !== "object") return null;
|
|
329
|
+
const raw = value;
|
|
330
|
+
if (typeof raw.ratio !== "string" || !parseAspectRatio(raw.ratio)) return null;
|
|
331
|
+
const rect = normalizeImageCropRect(raw.rect);
|
|
332
|
+
if (!rect) return null;
|
|
333
|
+
return { ratio: raw.ratio.trim(), rect };
|
|
334
|
+
}
|
|
335
|
+
function normalizePadColor(value) {
|
|
336
|
+
if (typeof value !== "string") return void 0;
|
|
337
|
+
const trimmed = value.trim();
|
|
338
|
+
return /^#[0-9a-fA-F]{6}$/.test(trimmed) ? trimmed.toLowerCase() : void 0;
|
|
339
|
+
}
|
|
340
|
+
function isCenteredFocus(focus) {
|
|
341
|
+
return Math.abs(focus.x - 0.5) < 5e-3 && Math.abs(focus.y - 0.5) < 5e-3;
|
|
342
|
+
}
|
|
343
|
+
function effectiveImageFocus(framing) {
|
|
344
|
+
const focus = normalizeImageFocus(framing?.focus);
|
|
345
|
+
if (!focus || isCenteredFocus(focus)) return null;
|
|
346
|
+
return focus;
|
|
347
|
+
}
|
|
348
|
+
function hasScreenFraming(framing) {
|
|
349
|
+
if (!framing?.screens || typeof framing.screens !== "object") return false;
|
|
350
|
+
for (const device of ["desktop", "tablet", "mobile"]) {
|
|
351
|
+
if (normalizeImageScreenFraming(framing.screens[device])) return true;
|
|
352
|
+
}
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
function deriveRectFromFocus(focus, sourceAspect, targetAspect) {
|
|
356
|
+
const f = normalizeImageFocus(focus) ?? { x: 0.5, y: 0.5 };
|
|
357
|
+
if (!Number.isFinite(sourceAspect) || sourceAspect <= 0 || !Number.isFinite(targetAspect) || targetAspect <= 0) {
|
|
358
|
+
return { x: 0, y: 0, w: 1, h: 1 };
|
|
359
|
+
}
|
|
360
|
+
if (sourceAspect >= targetAspect) {
|
|
361
|
+
const w2 = Math.min(1, Math.max(MIN_CROP_RECT_SPAN, targetAspect / sourceAspect));
|
|
362
|
+
const h2 = 1;
|
|
363
|
+
const x = Math.min(1 - w2, Math.max(0, f.x - w2 / 2));
|
|
364
|
+
return { x, y: 0, w: w2, h: h2 };
|
|
365
|
+
}
|
|
366
|
+
const w = 1;
|
|
367
|
+
const h = Math.min(1, Math.max(MIN_CROP_RECT_SPAN, sourceAspect / targetAspect));
|
|
368
|
+
const y = Math.min(1 - h, Math.max(0, f.y - h / 2));
|
|
369
|
+
return { x: 0, y, w, h };
|
|
370
|
+
}
|
|
371
|
+
function isScreenFramingCompatible(screen, targetRatio, source) {
|
|
372
|
+
if (!screen) return false;
|
|
373
|
+
const savedAspect = parseAspectRatio(screen.ratio);
|
|
374
|
+
const targetAspect = parseAspectRatio(targetRatio);
|
|
375
|
+
if (!savedAspect || !targetAspect) return false;
|
|
376
|
+
if (Math.abs(savedAspect - targetAspect) / targetAspect > 0.01) return false;
|
|
377
|
+
if (source && source.width > 0 && source.height > 0 && screen.rect.h > 0) {
|
|
378
|
+
const actualAspect = screen.rect.w * source.width / (screen.rect.h * source.height);
|
|
379
|
+
if (Math.abs(actualAspect - targetAspect) / targetAspect > 0.02) return false;
|
|
380
|
+
}
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
function resolveScreenFraming(input) {
|
|
384
|
+
const { framing, device, targetRatio, tabletInherits = "desktop" } = input;
|
|
385
|
+
const source = input.source ?? framing?.source ?? null;
|
|
386
|
+
const screens = framing?.screens;
|
|
387
|
+
const candidateOrder = device === "desktop" ? ["desktop"] : device === "mobile" ? ["mobile", "desktop"] : tabletInherits === "mobile" ? ["tablet", "mobile", "desktop"] : ["tablet", "desktop"];
|
|
388
|
+
let matched = null;
|
|
389
|
+
let hadIncompatibleOnDevice = false;
|
|
390
|
+
for (const candidate of candidateOrder) {
|
|
391
|
+
const screen = normalizeImageScreenFraming(screens?.[candidate]);
|
|
392
|
+
if (!screen) continue;
|
|
393
|
+
if (isScreenFramingCompatible(screen, targetRatio, source)) {
|
|
394
|
+
matched = screen;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
if (candidate === device) {
|
|
398
|
+
hadIncompatibleOnDevice = true;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (matched) {
|
|
402
|
+
return {
|
|
403
|
+
ratio: targetRatio,
|
|
404
|
+
rect: matched.rect,
|
|
405
|
+
derived: false,
|
|
406
|
+
ratioMismatchFallback: false
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const targetAspect = parseAspectRatio(targetRatio) ?? 16 / 9;
|
|
410
|
+
const sourceAspect = source && source.width > 0 && source.height > 0 ? source.width / source.height : targetAspect;
|
|
411
|
+
return {
|
|
412
|
+
ratio: targetRatio,
|
|
413
|
+
rect: deriveRectFromFocus(framing?.focus, sourceAspect, targetAspect),
|
|
414
|
+
derived: true,
|
|
415
|
+
ratioMismatchFallback: hadIncompatibleOnDevice
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function rectToCloudflareTrim(rect, source) {
|
|
419
|
+
if (!source || !Number.isFinite(source.width) || !Number.isFinite(source.height)) return null;
|
|
420
|
+
if (source.width <= 0 || source.height <= 0) return null;
|
|
421
|
+
const r = normalizeImageCropRect(rect);
|
|
422
|
+
if (!r) return null;
|
|
423
|
+
const left = Math.max(0, Math.round(r.x * source.width));
|
|
424
|
+
const top = Math.max(0, Math.round(r.y * source.height));
|
|
425
|
+
const cropW = Math.max(1, Math.round(r.w * source.width));
|
|
426
|
+
const cropH = Math.max(1, Math.round(r.h * source.height));
|
|
427
|
+
const right = Math.max(0, source.width - left - cropW);
|
|
428
|
+
const bottom = Math.max(0, source.height - top - cropH);
|
|
429
|
+
if (top <= 1 && right <= 1 && bottom <= 1 && left <= 1) return null;
|
|
430
|
+
return { top, right, bottom, left };
|
|
431
|
+
}
|
|
432
|
+
function focusToObjectPosition(focus) {
|
|
433
|
+
const percent = (value) => `${Math.round(value * 1e3) / 10}%`;
|
|
434
|
+
return `${percent(focus.x)} ${percent(focus.y)}`;
|
|
435
|
+
}
|
|
436
|
+
function focusToGravity(focus) {
|
|
437
|
+
const fixed = (value) => (Math.round(value * 100) / 100).toFixed(2);
|
|
438
|
+
return `${fixed(focus.x)}x${fixed(focus.y)}`;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ../shared/storage/asset-refs.ts
|
|
442
|
+
var ASSET_REF_PREFIX = "asset:";
|
|
443
|
+
var ASSET_REF_VALUE = /^asset:[a-z0-9]+$/;
|
|
444
|
+
function isAssetRefValue(value) {
|
|
445
|
+
return ASSET_REF_VALUE.test(value);
|
|
446
|
+
}
|
|
447
|
+
var CF_IMAGES_ACCOUNT_HASH = "xu6i8N5WjaI_9HFe-hZzmg";
|
|
448
|
+
var CF_IMAGES_DELIVERY_BASE = `https://img.kanorio.com/cdn-cgi/imagedelivery/${CF_IMAGES_ACCOUNT_HASH}`;
|
|
449
|
+
var URL_TAIL = String.raw`[^\s"'()<>?#\\]+`;
|
|
450
|
+
var CF_IMAGE_ID = String.raw`[A-Za-z0-9_.-]+`;
|
|
451
|
+
function escapeRegExp(value) {
|
|
452
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
453
|
+
}
|
|
454
|
+
var QUERY_TAIL = String.raw`(?:[?#][^\s"'()<>\\]*)?`;
|
|
455
|
+
var CF_IMAGE_URL = new RegExp(
|
|
456
|
+
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})(?:[/?#]|$)`
|
|
457
|
+
);
|
|
458
|
+
function cloudflareImageIdOf(url) {
|
|
459
|
+
return url ? CF_IMAGE_URL.exec(url)?.[1] ?? null : null;
|
|
460
|
+
}
|
|
461
|
+
var MIXED_EDGE_COLOR = "mixed";
|
|
462
|
+
function publicEdgeColor(edgeColor) {
|
|
463
|
+
return edgeColor && edgeColor !== MIXED_EDGE_COLOR ? edgeColor : null;
|
|
464
|
+
}
|
|
465
|
+
function displayFileName(contentName, facts) {
|
|
466
|
+
const name = contentName ?? "";
|
|
467
|
+
if (!facts?.name) return name;
|
|
468
|
+
if (!name || name === facts.name || facts.formerNames?.includes(name)) return facts.name;
|
|
469
|
+
const dot = facts.name.lastIndexOf(".");
|
|
470
|
+
const own = name.lastIndexOf(".");
|
|
471
|
+
if (dot <= 0 || own <= 0) return name;
|
|
472
|
+
return `${name.slice(0, own)}${facts.name.slice(dot)}`;
|
|
473
|
+
}
|
|
474
|
+
function mediaFactsFor(facts, ref) {
|
|
475
|
+
if (ref.assetId) {
|
|
476
|
+
const byId = facts[`${ASSET_REF_PREFIX}${ref.assetId}`];
|
|
477
|
+
if (byId) return byId;
|
|
478
|
+
}
|
|
479
|
+
if (!ref.url) return void 0;
|
|
480
|
+
if (isAssetRefValue(ref.url)) return facts[ref.url];
|
|
481
|
+
const cfId = cloudflareImageIdOf(ref.url);
|
|
482
|
+
if (cfId) return facts[cfId];
|
|
483
|
+
const path = ref.url.split(/[?#]/, 1)[0];
|
|
484
|
+
for (const [key, item] of Object.entries(facts)) {
|
|
485
|
+
if (!key.startsWith(ASSET_REF_PREFIX) && path.endsWith(`/${key}`)) return item;
|
|
486
|
+
}
|
|
487
|
+
return void 0;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// ../shared/utils/cloudflare-images.ts
|
|
491
|
+
var CLOUDFLARE_IMAGE_QUALITY = 85;
|
|
492
|
+
function extractImageIdFromUrl(url) {
|
|
493
|
+
if (!url) return void 0;
|
|
494
|
+
try {
|
|
495
|
+
const urlObj = new URL(url);
|
|
496
|
+
const pathParts = urlObj.pathname.split("/").filter(Boolean);
|
|
497
|
+
if (urlObj.hostname === "imagedelivery.net") {
|
|
498
|
+
if (pathParts.length >= 2) {
|
|
499
|
+
return pathParts[1];
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (urlObj.hostname.endsWith(".kanorio.com") && pathParts[0] === "cdn-cgi" && pathParts[1] === "imagedelivery") {
|
|
503
|
+
if (pathParts.length >= 4) {
|
|
504
|
+
return pathParts[3];
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return void 0;
|
|
508
|
+
} catch {
|
|
509
|
+
return void 0;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function isSvgImageUrl(url) {
|
|
513
|
+
const path = url.split(/[?#]/, 1)[0] ?? "";
|
|
514
|
+
return path.toLowerCase().endsWith(".svg");
|
|
515
|
+
}
|
|
516
|
+
function isCloudflareImageUrl(url) {
|
|
517
|
+
if (!url) return false;
|
|
518
|
+
try {
|
|
519
|
+
const urlObj = new URL(url);
|
|
520
|
+
if (urlObj.hostname === "imagedelivery.net") {
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
if (urlObj.hostname.endsWith(".kanorio.com") && urlObj.pathname.startsWith("/cdn-cgi/imagedelivery/")) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
return false;
|
|
527
|
+
} catch {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function hasOptimizationParams(url) {
|
|
532
|
+
try {
|
|
533
|
+
const urlObj = new URL(url);
|
|
534
|
+
return urlObj.searchParams.has("width") || urlObj.searchParams.has("height") || urlObj.searchParams.has("quality") || urlObj.searchParams.has("fit");
|
|
535
|
+
} catch {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
function getDefaultParamsForUseCase(useCase) {
|
|
540
|
+
switch (useCase) {
|
|
541
|
+
case "page-main-visual-background":
|
|
542
|
+
return {
|
|
543
|
+
width: 1920,
|
|
544
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
545
|
+
fit: "cover"
|
|
546
|
+
};
|
|
547
|
+
case "page-main-visual-logo":
|
|
548
|
+
return {
|
|
549
|
+
width: 600,
|
|
550
|
+
height: 600,
|
|
551
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
552
|
+
fit: "scale-down"
|
|
553
|
+
};
|
|
554
|
+
case "header-logo":
|
|
555
|
+
return {
|
|
556
|
+
width: 600,
|
|
557
|
+
height: 600,
|
|
558
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
559
|
+
fit: "scale-down"
|
|
560
|
+
};
|
|
561
|
+
case "card-grid-carousel-image":
|
|
562
|
+
return {
|
|
563
|
+
width: 800,
|
|
564
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
565
|
+
fit: "crop"
|
|
566
|
+
};
|
|
567
|
+
case "image-text-split-image":
|
|
568
|
+
return {
|
|
569
|
+
width: 1200,
|
|
570
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
571
|
+
fit: "crop"
|
|
572
|
+
};
|
|
573
|
+
case "multi-image-carousel-image":
|
|
574
|
+
return {
|
|
575
|
+
width: 1600,
|
|
576
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
577
|
+
fit: "scale-down"
|
|
578
|
+
};
|
|
579
|
+
case "lightbox-image":
|
|
580
|
+
return {
|
|
581
|
+
width: 4096,
|
|
582
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
583
|
+
fit: "scale-down"
|
|
584
|
+
};
|
|
585
|
+
case "full-width-image":
|
|
586
|
+
return {
|
|
587
|
+
width: 1920,
|
|
588
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
589
|
+
fit: "contain"
|
|
590
|
+
};
|
|
591
|
+
case "general":
|
|
592
|
+
default:
|
|
593
|
+
return {
|
|
594
|
+
width: 1920,
|
|
595
|
+
quality: CLOUDFLARE_IMAGE_QUALITY,
|
|
596
|
+
fit: "crop"
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function parseCloudflareUrl(url) {
|
|
601
|
+
try {
|
|
602
|
+
const urlObj = new URL(url);
|
|
603
|
+
const pathParts = urlObj.pathname.split("/").filter(Boolean);
|
|
604
|
+
if (urlObj.hostname === "imagedelivery.net" && pathParts.length >= 3) {
|
|
605
|
+
return {
|
|
606
|
+
baseUrl: `${urlObj.protocol}//${urlObj.hostname}`,
|
|
607
|
+
accountHash: pathParts[0],
|
|
608
|
+
imageId: pathParts[1],
|
|
609
|
+
variant: pathParts[2] || "public"
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
if (urlObj.hostname.endsWith(".kanorio.com") && pathParts[0] === "cdn-cgi" && pathParts[1] === "imagedelivery" && pathParts.length >= 5) {
|
|
613
|
+
return {
|
|
614
|
+
baseUrl: `${urlObj.protocol}//${urlObj.hostname}/cdn-cgi/imagedelivery`,
|
|
615
|
+
accountHash: pathParts[2],
|
|
616
|
+
imageId: pathParts[3],
|
|
617
|
+
variant: pathParts[4] || "public"
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
return null;
|
|
621
|
+
} catch {
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
function buildOptimizedUrl(parsed, options) {
|
|
626
|
+
const { baseUrl, accountHash, imageId } = parsed;
|
|
627
|
+
const defaults = getDefaultParamsForUseCase(options.useCase);
|
|
628
|
+
const width = options.width ?? defaults.width;
|
|
629
|
+
const height = options.height ?? defaults.height;
|
|
630
|
+
const quality = CLOUDFLARE_IMAGE_QUALITY;
|
|
631
|
+
const fit = options.fit ?? defaults.fit;
|
|
632
|
+
const format = options.format;
|
|
633
|
+
const params = [];
|
|
634
|
+
if (options.trim) {
|
|
635
|
+
const { top, right, bottom, left } = options.trim;
|
|
636
|
+
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))}`);
|
|
637
|
+
}
|
|
638
|
+
if (width) params.push(`w=${width}`);
|
|
639
|
+
if (height) params.push(`h=${height}`);
|
|
640
|
+
if (fit) params.push(`fit=${fit}`);
|
|
641
|
+
if (!options.trim && options.focus && width && height && (fit === "crop" || fit === "cover")) {
|
|
642
|
+
params.push(`gravity=${focusToGravity(options.focus)}`);
|
|
643
|
+
}
|
|
644
|
+
if (options.background && /^#[0-9a-fA-F]{6}$/.test(options.background)) {
|
|
645
|
+
params.push(`background=${encodeURIComponent(options.background)}`);
|
|
646
|
+
}
|
|
647
|
+
params.push(`q=${quality}`);
|
|
648
|
+
if (format) params.push(`f=${format}`);
|
|
649
|
+
if (params.length > 0) {
|
|
650
|
+
return `${baseUrl}/${accountHash}/${imageId}/${params.join(",")}`;
|
|
651
|
+
}
|
|
652
|
+
return `${baseUrl}/${accountHash}/${imageId}/public`;
|
|
653
|
+
}
|
|
654
|
+
function defaultWidthForUseCase(useCase) {
|
|
655
|
+
return getDefaultParamsForUseCase(useCase).width ?? 1920;
|
|
656
|
+
}
|
|
657
|
+
function getOptimizedImageUrl(originalUrl, options) {
|
|
658
|
+
if (!isCloudflareImageUrl(originalUrl)) {
|
|
659
|
+
return originalUrl;
|
|
660
|
+
}
|
|
661
|
+
if (hasOptimizationParams(originalUrl) && !options.format) {
|
|
662
|
+
return originalUrl;
|
|
663
|
+
}
|
|
664
|
+
const parsed = parseCloudflareUrl(originalUrl);
|
|
665
|
+
if (!parsed) {
|
|
666
|
+
return originalUrl;
|
|
667
|
+
}
|
|
668
|
+
return buildOptimizedUrl(parsed, options);
|
|
669
|
+
}
|
|
670
|
+
function getOriginalImageUrl(url) {
|
|
671
|
+
if (!isCloudflareImageUrl(url)) {
|
|
672
|
+
return url;
|
|
673
|
+
}
|
|
674
|
+
const parsed = parseCloudflareUrl(url);
|
|
675
|
+
if (!parsed) {
|
|
676
|
+
return url;
|
|
677
|
+
}
|
|
678
|
+
return `${parsed.baseUrl}/${parsed.accountHash}/${parsed.imageId}/public`;
|
|
679
|
+
}
|
|
680
|
+
var MARKDOWN_IMAGE_SRCSET_WIDTHS = [400, 800, 1200, 1600];
|
|
681
|
+
var MARKDOWN_IMAGE_SIZES = "(max-width: 768px) 100vw, 960px";
|
|
682
|
+
function getResponsiveImageAttrs(originalUrl) {
|
|
683
|
+
if (!isCloudflareImageUrl(originalUrl)) {
|
|
684
|
+
return null;
|
|
685
|
+
}
|
|
686
|
+
const parsed = parseCloudflareUrl(originalUrl);
|
|
687
|
+
if (!parsed) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
const { baseUrl, accountHash, imageId } = parsed;
|
|
691
|
+
const quality = CLOUDFLARE_IMAGE_QUALITY;
|
|
692
|
+
const fit = "scale-down";
|
|
693
|
+
const srcSet = MARKDOWN_IMAGE_SRCSET_WIDTHS.map(
|
|
694
|
+
(w) => `${baseUrl}/${accountHash}/${imageId}/w=${w},fit=${fit},q=${quality} ${w}w`
|
|
695
|
+
).join(", ");
|
|
696
|
+
const src = `${baseUrl}/${accountHash}/${imageId}/w=800,fit=${fit},q=${quality}`;
|
|
697
|
+
return { src, srcSet, sizes: MARKDOWN_IMAGE_SIZES };
|
|
698
|
+
}
|
|
699
|
+
var PICTURE_DEVICE_WIDTHS = {
|
|
700
|
+
mobile: [640, 1080],
|
|
701
|
+
tablet: [1024, 1536],
|
|
702
|
+
desktop: [1440, 1920]
|
|
703
|
+
};
|
|
704
|
+
var PICTURE_DEVICE_MEDIA = {
|
|
705
|
+
mobile: "(max-width: 767px)",
|
|
706
|
+
tablet: "(min-width: 768px) and (max-width: 1023px)",
|
|
707
|
+
desktop: "(min-width: 1024px)"
|
|
708
|
+
};
|
|
709
|
+
var PICTURE_DEVICES = ["desktop", "tablet", "mobile"];
|
|
710
|
+
function resolveDeviceCrops(input) {
|
|
711
|
+
const out = {};
|
|
712
|
+
for (const device of PICTURE_DEVICES) {
|
|
713
|
+
const ratio = input.ratios[device];
|
|
714
|
+
if (!ratio) {
|
|
715
|
+
out[device] = { ratio: null, rect: null };
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
const resolved = resolveScreenFraming({
|
|
719
|
+
framing: input.framing,
|
|
720
|
+
device,
|
|
721
|
+
targetRatio: ratio,
|
|
722
|
+
tabletInherits: input.tabletInherits,
|
|
723
|
+
source: input.source
|
|
724
|
+
});
|
|
725
|
+
out[device] = { ratio, rect: resolved.derived ? null : resolved.rect };
|
|
726
|
+
}
|
|
727
|
+
return out;
|
|
728
|
+
}
|
|
729
|
+
function isSameDeviceCrop(a, b) {
|
|
730
|
+
if (a.ratio !== b.ratio) return false;
|
|
731
|
+
if (!a.rect || !b.rect) return a.rect === b.rect;
|
|
732
|
+
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;
|
|
733
|
+
}
|
|
734
|
+
function pictureWidthsFor(device, maxWidth) {
|
|
735
|
+
const base = PICTURE_DEVICE_WIDTHS[device];
|
|
736
|
+
if (!maxWidth || maxWidth <= 0 || maxWidth >= base[base.length - 1]) return base;
|
|
737
|
+
return [...base.filter((w) => w < maxWidth), Math.round(maxWidth)];
|
|
738
|
+
}
|
|
739
|
+
function resolveSiteImageRenderMode(input) {
|
|
740
|
+
const { src, framing, deviceRatios, tabletInherits = "desktop" } = input;
|
|
741
|
+
if (!src || !deviceRatios) return "single";
|
|
742
|
+
const uniformRatio = deviceRatios.mobile === deviceRatios.desktop && deviceRatios.tablet === deviceRatios.desktop;
|
|
743
|
+
const hasScreens = hasScreenFraming(framing);
|
|
744
|
+
if (!hasScreens && uniformRatio) return "single";
|
|
745
|
+
const trimmable = isCloudflareImageUrl(src) && !isSvgImageUrl(src);
|
|
746
|
+
if (!hasScreens) return trimmable ? "picture" : "single";
|
|
747
|
+
const source = framing?.source && framing.source.width > 0 && framing.source.height > 0 ? framing.source : null;
|
|
748
|
+
const crops = resolveDeviceCrops({ framing, ratios: deviceRatios, tabletInherits, source });
|
|
749
|
+
const anyRect = PICTURE_DEVICES.some((device) => crops[device].rect !== null);
|
|
750
|
+
if (!anyRect) return uniformRatio || !trimmable ? "single" : "picture";
|
|
751
|
+
if (!trimmable || !source) return "css-fallback";
|
|
752
|
+
if (uniformRatio && isSameDeviceCrop(crops.desktop, crops.tablet) && isSameDeviceCrop(crops.desktop, crops.mobile)) {
|
|
753
|
+
return "single-trim";
|
|
754
|
+
}
|
|
755
|
+
return "picture";
|
|
756
|
+
}
|
|
757
|
+
function buildSingleTrimImageUrl(input) {
|
|
758
|
+
const useCase = input.useCase ?? "general";
|
|
759
|
+
const width = input.width ?? defaultWidthForUseCase(useCase);
|
|
760
|
+
const ratioNum = parseAspectRatio(input.ratio) ?? 16 / 9;
|
|
761
|
+
const height = Math.max(1, Math.round(width / ratioNum));
|
|
762
|
+
const source = input.framing?.source && input.framing.source.width > 0 && input.framing.source.height > 0 ? input.framing.source : null;
|
|
763
|
+
const resolved = resolveScreenFraming({
|
|
764
|
+
framing: input.framing,
|
|
765
|
+
device: "desktop",
|
|
766
|
+
targetRatio: input.ratio,
|
|
767
|
+
tabletInherits: input.tabletInherits,
|
|
768
|
+
source
|
|
769
|
+
});
|
|
770
|
+
const trim = !resolved.derived && source ? rectToCloudflareTrim(resolved.rect, source) : null;
|
|
771
|
+
return {
|
|
772
|
+
src: getOptimizedImageUrl(input.src, {
|
|
773
|
+
useCase,
|
|
774
|
+
width,
|
|
775
|
+
height,
|
|
776
|
+
fit: "crop",
|
|
777
|
+
trim,
|
|
778
|
+
focus: trim ? null : effectiveImageFocus(input.framing)
|
|
779
|
+
}),
|
|
780
|
+
width,
|
|
781
|
+
height
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function buildPictureSourcesPlan(input) {
|
|
785
|
+
const { src, useCase = "general", ratios, framing, tabletInherits = "desktop", maxWidth } = input;
|
|
786
|
+
if (!isCloudflareImageUrl(src)) return null;
|
|
787
|
+
const sourceDims = framing?.source && framing.source.width > 0 && framing.source.height > 0 ? framing.source : null;
|
|
788
|
+
const focus = effectiveImageFocus(framing);
|
|
789
|
+
const crops = resolveDeviceCrops({ framing, ratios, tabletInherits, source: sourceDims });
|
|
790
|
+
const buildForDevice = (device) => {
|
|
791
|
+
const { ratio, rect } = crops[device];
|
|
792
|
+
const ratioNum = ratio ? parseAspectRatio(ratio) ?? 16 / 9 : null;
|
|
793
|
+
const trim = rect && sourceDims ? rectToCloudflareTrim(rect, sourceDims) : null;
|
|
794
|
+
const widths = pictureWidthsFor(device, maxWidth);
|
|
795
|
+
const urls = [];
|
|
796
|
+
const srcSetParts = widths.map((w) => {
|
|
797
|
+
const url = ratioNum ? getOptimizedImageUrl(src, {
|
|
798
|
+
useCase,
|
|
799
|
+
width: w,
|
|
800
|
+
height: Math.max(1, Math.round(w / ratioNum)),
|
|
801
|
+
fit: "crop",
|
|
802
|
+
trim,
|
|
803
|
+
focus: trim ? null : focus
|
|
804
|
+
}) : getOptimizedImageUrl(src, { useCase, width: w, fit: "scale-down" });
|
|
805
|
+
urls.push(url);
|
|
806
|
+
return `${url} ${w}w`;
|
|
807
|
+
});
|
|
808
|
+
const primaryW = widths[widths.length - 1];
|
|
809
|
+
const naturalAspect = sourceDims ? sourceDims.width / sourceDims.height : null;
|
|
810
|
+
const primaryH = ratioNum ? Math.max(1, Math.round(primaryW / ratioNum)) : naturalAspect ? Math.max(1, Math.round(primaryW / naturalAspect)) : null;
|
|
811
|
+
const primaryUrl = urls[urls.length - 1];
|
|
812
|
+
return {
|
|
813
|
+
device,
|
|
814
|
+
media: device === "desktop" ? void 0 : PICTURE_DEVICE_MEDIA[device],
|
|
815
|
+
src: primaryUrl,
|
|
816
|
+
srcSet: srcSetParts.join(", "),
|
|
817
|
+
sizes: input.sizes?.[device] ?? "100vw",
|
|
818
|
+
width: primaryW,
|
|
819
|
+
height: primaryH,
|
|
820
|
+
urls
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
const mobile = buildForDevice("mobile");
|
|
824
|
+
const tabletDesc = buildForDevice("tablet");
|
|
825
|
+
const desktop = buildForDevice("desktop");
|
|
826
|
+
const tablet = isSameDeviceCrop(crops.tablet, crops.desktop) ? null : tabletDesc;
|
|
827
|
+
const preloads = tablet ? [
|
|
828
|
+
{
|
|
829
|
+
media: PICTURE_DEVICE_MEDIA.mobile,
|
|
830
|
+
href: mobile.src,
|
|
831
|
+
imageSrcSet: mobile.srcSet,
|
|
832
|
+
imageSizes: mobile.sizes
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
media: PICTURE_DEVICE_MEDIA.tablet,
|
|
836
|
+
href: tablet.src,
|
|
837
|
+
imageSrcSet: tablet.srcSet,
|
|
838
|
+
imageSizes: tablet.sizes
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
media: PICTURE_DEVICE_MEDIA.desktop,
|
|
842
|
+
href: desktop.src,
|
|
843
|
+
imageSrcSet: desktop.srcSet,
|
|
844
|
+
imageSizes: desktop.sizes
|
|
845
|
+
}
|
|
846
|
+
] : [
|
|
847
|
+
{
|
|
848
|
+
media: PICTURE_DEVICE_MEDIA.mobile,
|
|
849
|
+
href: mobile.src,
|
|
850
|
+
imageSrcSet: mobile.srcSet,
|
|
851
|
+
imageSizes: mobile.sizes
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
media: "(min-width: 768px)",
|
|
855
|
+
href: desktop.src,
|
|
856
|
+
imageSrcSet: desktop.srcSet,
|
|
857
|
+
imageSizes: desktop.sizes
|
|
858
|
+
}
|
|
859
|
+
];
|
|
860
|
+
const allVariantUrls = Array.from(
|
|
861
|
+
/* @__PURE__ */ new Set([...mobile.urls, ...tablet ? tablet.urls : [], ...desktop.urls])
|
|
862
|
+
);
|
|
863
|
+
return {
|
|
864
|
+
mobile,
|
|
865
|
+
tablet,
|
|
866
|
+
desktop,
|
|
867
|
+
preloads,
|
|
868
|
+
allVariantUrls
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// ../shared/components/media/MediaProtection.tsx
|
|
873
|
+
import { jsx } from "react/jsx-runtime";
|
|
874
|
+
var FALLBACK = { protection: DEFAULT_MEDIA_PROTECTION, imageDownloadUrl: () => null };
|
|
875
|
+
var MediaProtectionContext = createContext(FALLBACK);
|
|
876
|
+
function MediaProtectionProvider({
|
|
877
|
+
protection,
|
|
878
|
+
websiteId,
|
|
879
|
+
apiBase = "",
|
|
880
|
+
children
|
|
881
|
+
}) {
|
|
882
|
+
const value = useMemo(
|
|
883
|
+
() => ({
|
|
884
|
+
protection: protection ?? DEFAULT_MEDIA_PROTECTION,
|
|
885
|
+
imageDownloadUrl: (imageUrl, name) => {
|
|
886
|
+
const imageId = extractImageIdFromUrl(imageUrl);
|
|
887
|
+
if (!websiteId || !imageId) return null;
|
|
888
|
+
const base = `${apiBase}/api/public/sites/${encodeURIComponent(websiteId)}/images/${encodeURIComponent(imageId)}/download`;
|
|
889
|
+
const query = new URLSearchParams();
|
|
890
|
+
if (name) query.set("name", name);
|
|
891
|
+
const search = query.toString();
|
|
892
|
+
return search ? `${base}?${search}` : base;
|
|
893
|
+
}
|
|
894
|
+
}),
|
|
895
|
+
[protection, websiteId, apiBase]
|
|
896
|
+
);
|
|
897
|
+
return /* @__PURE__ */ jsx(MediaProtectionContext.Provider, { value, children });
|
|
898
|
+
}
|
|
899
|
+
function useMediaProtection() {
|
|
900
|
+
return useContext(MediaProtectionContext);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
export {
|
|
904
|
+
pickSiteLabels,
|
|
905
|
+
fillLabel,
|
|
906
|
+
hasNaturalDevice,
|
|
907
|
+
buildResponsiveFillClasses,
|
|
908
|
+
normalizeImageCropRect,
|
|
909
|
+
normalizePadColor,
|
|
910
|
+
effectiveImageFocus,
|
|
911
|
+
resolveScreenFraming,
|
|
912
|
+
focusToObjectPosition,
|
|
913
|
+
publicEdgeColor,
|
|
914
|
+
displayFileName,
|
|
915
|
+
mediaFactsFor,
|
|
916
|
+
extractImageIdFromUrl,
|
|
917
|
+
isSvgImageUrl,
|
|
918
|
+
getOptimizedImageUrl,
|
|
919
|
+
getOriginalImageUrl,
|
|
920
|
+
getResponsiveImageAttrs,
|
|
921
|
+
resolveSiteImageRenderMode,
|
|
922
|
+
buildSingleTrimImageUrl,
|
|
923
|
+
buildPictureSourcesPlan,
|
|
924
|
+
parseMediaProtection,
|
|
925
|
+
canVisitorsDownloadImages,
|
|
926
|
+
canVisitorsShareImages,
|
|
927
|
+
MediaProtectionProvider,
|
|
928
|
+
useMediaProtection
|
|
929
|
+
};
|
|
930
|
+
//# sourceMappingURL=chunk-DDKQOHPW.js.map
|