@page-speed/lightbox 0.0.1 → 0.0.2

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.
@@ -983,7 +983,7 @@ var require_react_development = __commonJS({
983
983
  }
984
984
  return lazyType;
985
985
  }
986
- function forwardRef(render) {
986
+ function forwardRef2(render) {
987
987
  {
988
988
  if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
989
989
  error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
@@ -1044,7 +1044,7 @@ var require_react_development = __commonJS({
1044
1044
  }
1045
1045
  return false;
1046
1046
  }
1047
- function memo(type, compare) {
1047
+ function memo2(type, compare) {
1048
1048
  {
1049
1049
  if (!isValidElementType(type)) {
1050
1050
  error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
@@ -1104,11 +1104,11 @@ var require_react_development = __commonJS({
1104
1104
  var dispatcher = resolveDispatcher();
1105
1105
  return dispatcher.useReducer(reducer, initialArg, init);
1106
1106
  }
1107
- function useRef3(initialValue) {
1107
+ function useRef4(initialValue) {
1108
1108
  var dispatcher = resolveDispatcher();
1109
1109
  return dispatcher.useRef(initialValue);
1110
1110
  }
1111
- function useEffect5(create, deps) {
1111
+ function useEffect6(create, deps) {
1112
1112
  var dispatcher = resolveDispatcher();
1113
1113
  return dispatcher.useEffect(create, deps);
1114
1114
  }
@@ -1124,11 +1124,11 @@ var require_react_development = __commonJS({
1124
1124
  var dispatcher = resolveDispatcher();
1125
1125
  return dispatcher.useCallback(callback, deps);
1126
1126
  }
1127
- function useMemo(create, deps) {
1127
+ function useMemo3(create, deps) {
1128
1128
  var dispatcher = resolveDispatcher();
1129
1129
  return dispatcher.useMemo(create, deps);
1130
1130
  }
1131
- function useImperativeHandle(ref, create, deps) {
1131
+ function useImperativeHandle2(ref, create, deps) {
1132
1132
  var dispatcher = resolveDispatcher();
1133
1133
  return dispatcher.useImperativeHandle(ref, create, deps);
1134
1134
  }
@@ -1881,24 +1881,24 @@ var require_react_development = __commonJS({
1881
1881
  exports2.createElement = createElement$1;
1882
1882
  exports2.createFactory = createFactory;
1883
1883
  exports2.createRef = createRef;
1884
- exports2.forwardRef = forwardRef;
1884
+ exports2.forwardRef = forwardRef2;
1885
1885
  exports2.isValidElement = isValidElement;
1886
1886
  exports2.lazy = lazy;
1887
- exports2.memo = memo;
1887
+ exports2.memo = memo2;
1888
1888
  exports2.startTransition = startTransition;
1889
1889
  exports2.unstable_act = act;
1890
1890
  exports2.useCallback = useCallback5;
1891
1891
  exports2.useContext = useContext;
1892
1892
  exports2.useDebugValue = useDebugValue;
1893
1893
  exports2.useDeferredValue = useDeferredValue;
1894
- exports2.useEffect = useEffect5;
1894
+ exports2.useEffect = useEffect6;
1895
1895
  exports2.useId = useId;
1896
- exports2.useImperativeHandle = useImperativeHandle;
1896
+ exports2.useImperativeHandle = useImperativeHandle2;
1897
1897
  exports2.useInsertionEffect = useInsertionEffect;
1898
1898
  exports2.useLayoutEffect = useLayoutEffect;
1899
- exports2.useMemo = useMemo;
1899
+ exports2.useMemo = useMemo3;
1900
1900
  exports2.useReducer = useReducer;
1901
- exports2.useRef = useRef3;
1901
+ exports2.useRef = useRef4;
1902
1902
  exports2.useState = useState8;
1903
1903
  exports2.useSyncExternalStore = useSyncExternalStore;
1904
1904
  exports2.useTransition = useTransition;
@@ -20882,11 +20882,11 @@ __export(dist_exports, {
20882
20882
  useZoom: () => useZoom
20883
20883
  });
20884
20884
  function usePDFDocument(url, onError) {
20885
- const [document2, setDocument] = (0, import_react2.useState)(null);
20886
- const [loading, setLoading] = (0, import_react2.useState)(true);
20887
- const [error, setError] = (0, import_react2.useState)(null);
20888
- const [pdfDoc, setPdfDoc] = (0, import_react2.useState)(null);
20889
- (0, import_react2.useEffect)(() => {
20885
+ const [document2, setDocument] = (0, import_react6.useState)(null);
20886
+ const [loading, setLoading] = (0, import_react6.useState)(true);
20887
+ const [error, setError] = (0, import_react6.useState)(null);
20888
+ const [pdfDoc, setPdfDoc] = (0, import_react6.useState)(null);
20889
+ (0, import_react6.useEffect)(() => {
20890
20890
  if (!url) return;
20891
20891
  setLoading(true);
20892
20892
  setError(null);
@@ -20933,17 +20933,17 @@ function usePageState({
20933
20933
  totalPages,
20934
20934
  initialPage = 1
20935
20935
  }) {
20936
- const [currentPage, setCurrentPage] = (0, import_react3.useState)(
20936
+ const [currentPage, setCurrentPage] = (0, import_react7.useState)(
20937
20937
  Math.max(1, Math.min(initialPage, totalPages))
20938
20938
  );
20939
- const goToPage = (0, import_react3.useCallback)((page) => {
20939
+ const goToPage = (0, import_react7.useCallback)((page) => {
20940
20940
  const validPage = Math.max(1, Math.min(page, totalPages));
20941
20941
  setCurrentPage(validPage);
20942
20942
  }, [totalPages]);
20943
- const nextPage = (0, import_react3.useCallback)(() => {
20943
+ const nextPage = (0, import_react7.useCallback)(() => {
20944
20944
  goToPage(currentPage + 1);
20945
20945
  }, [currentPage, goToPage]);
20946
- const prevPage = (0, import_react3.useCallback)(() => {
20946
+ const prevPage = (0, import_react7.useCallback)(() => {
20947
20947
  goToPage(currentPage - 1);
20948
20948
  }, [currentPage, goToPage]);
20949
20949
  return {
@@ -20956,10 +20956,10 @@ function usePageState({
20956
20956
  };
20957
20957
  }
20958
20958
  function usePageRenderer(pdfDoc) {
20959
- const cacheRef = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
20960
- const [rendering, setRendering] = (0, import_react4.useState)(false);
20961
- const [pageInfo, setPageInfo] = (0, import_react4.useState)(null);
20962
- const renderPage = (0, import_react4.useCallback)(
20959
+ const cacheRef = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
20960
+ const [rendering, setRendering] = (0, import_react8.useState)(false);
20961
+ const [pageInfo, setPageInfo] = (0, import_react8.useState)(null);
20962
+ const renderPage = (0, import_react8.useCallback)(
20963
20963
  async (pageNumber, scale = DEFAULT_SCALE, rotation = 0) => {
20964
20964
  if (!pdfDoc) return null;
20965
20965
  try {
@@ -21018,21 +21018,21 @@ function usePageRenderer(pdfDoc) {
21018
21018
  return { renderPage, rendering, pageInfo };
21019
21019
  }
21020
21020
  function useZoom(initialZoom = 1.5) {
21021
- const [zoomLevel, setZoomLevel] = (0, import_react5.useState)(
21021
+ const [zoomLevel, setZoomLevel] = (0, import_react9.useState)(
21022
21022
  typeof initialZoom === "number" ? initialZoom : 1.5
21023
21023
  );
21024
- const [zoomMode, setZoomMode] = (0, import_react5.useState)(
21024
+ const [zoomMode, setZoomMode] = (0, import_react9.useState)(
21025
21025
  typeof initialZoom === "string" ? initialZoom : "custom"
21026
21026
  );
21027
- const zoomIn = (0, import_react5.useCallback)(() => {
21027
+ const zoomIn = (0, import_react9.useCallback)(() => {
21028
21028
  setZoomLevel((prev) => Math.min(MAX_ZOOM, prev + ZOOM_STEP));
21029
21029
  setZoomMode("custom");
21030
21030
  }, []);
21031
- const zoomOut = (0, import_react5.useCallback)(() => {
21031
+ const zoomOut = (0, import_react9.useCallback)(() => {
21032
21032
  setZoomLevel((prev) => Math.max(MIN_ZOOM, prev - ZOOM_STEP));
21033
21033
  setZoomMode("custom");
21034
21034
  }, []);
21035
- const setZoom = (0, import_react5.useCallback)((level) => {
21035
+ const setZoom = (0, import_react9.useCallback)((level) => {
21036
21036
  if (typeof level === "number") {
21037
21037
  setZoomLevel(Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, level)));
21038
21038
  setZoomMode("custom");
@@ -21051,11 +21051,11 @@ function useZoom(initialZoom = 1.5) {
21051
21051
  };
21052
21052
  }
21053
21053
  function useSearch(pdfDoc) {
21054
- const [query, setQuery] = (0, import_react6.useState)("");
21055
- const [results, setResults] = (0, import_react6.useState)([]);
21056
- const [searching, setSearching] = (0, import_react6.useState)(false);
21057
- const [currentResultIndex, setCurrentResultIndex] = (0, import_react6.useState)(0);
21058
- const search = (0, import_react6.useCallback)(
21054
+ const [query, setQuery] = (0, import_react10.useState)("");
21055
+ const [results, setResults] = (0, import_react10.useState)([]);
21056
+ const [searching, setSearching] = (0, import_react10.useState)(false);
21057
+ const [currentResultIndex, setCurrentResultIndex] = (0, import_react10.useState)(0);
21058
+ const search = (0, import_react10.useCallback)(
21059
21059
  async (searchText) => {
21060
21060
  if (!pdfDoc || !searchText.trim()) {
21061
21061
  setResults([]);
@@ -21092,10 +21092,10 @@ function useSearch(pdfDoc) {
21092
21092
  },
21093
21093
  [pdfDoc]
21094
21094
  );
21095
- const nextResult = (0, import_react6.useCallback)(() => {
21095
+ const nextResult = (0, import_react10.useCallback)(() => {
21096
21096
  setCurrentResultIndex((prev) => (prev + 1) % results.length);
21097
21097
  }, [results.length]);
21098
- const prevResult = (0, import_react6.useCallback)(() => {
21098
+ const prevResult = (0, import_react10.useCallback)(() => {
21099
21099
  setCurrentResultIndex((prev) => (prev - 1 + results.length) % results.length);
21100
21100
  }, [results.length]);
21101
21101
  return {
@@ -21114,9 +21114,9 @@ function PDFCanvas({
21114
21114
  scale,
21115
21115
  onRender
21116
21116
  }) {
21117
- const containerRef = (0, import_react7.useRef)(null);
21118
- const [canvas, setCanvas] = (0, import_react7.useState)(null);
21119
- (0, import_react7.useEffect)(() => {
21117
+ const containerRef = (0, import_react11.useRef)(null);
21118
+ const [canvas, setCanvas] = (0, import_react11.useState)(null);
21119
+ (0, import_react11.useEffect)(() => {
21120
21120
  const render = async () => {
21121
21121
  const renderedCanvas = await onRender(pageNumber, scale, 0);
21122
21122
  if (renderedCanvas && containerRef.current) {
@@ -21131,7 +21131,7 @@ function PDFCanvas({
21131
21131
  render();
21132
21132
  }
21133
21133
  }, [pdfDoc, pageNumber, scale, onRender]);
21134
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: containerRef, className: PDFViewer_default.canvas });
21134
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: containerRef, className: PDFViewer_default.canvas });
21135
21135
  }
21136
21136
  function PDFControls({
21137
21137
  pageState,
@@ -21144,8 +21144,8 @@ function PDFControls({
21144
21144
  url
21145
21145
  }) {
21146
21146
  if (!pdfDocument) return null;
21147
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: PDFViewer_default.controls, children: [
21148
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21147
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: PDFViewer_default.controls, children: [
21148
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21149
21149
  "button",
21150
21150
  {
21151
21151
  onClick: pageState.prevPage,
@@ -21154,7 +21154,7 @@ function PDFControls({
21154
21154
  children: "<"
21155
21155
  }
21156
21156
  ),
21157
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21157
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21158
21158
  "input",
21159
21159
  {
21160
21160
  type: "number",
@@ -21165,11 +21165,11 @@ function PDFControls({
21165
21165
  className: PDFViewer_default.pageInput
21166
21166
  }
21167
21167
  ),
21168
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: PDFViewer_default.pageTotal, children: [
21168
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.pageTotal, children: [
21169
21169
  "of ",
21170
21170
  pdfDocument.numPages
21171
21171
  ] }),
21172
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21172
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21173
21173
  "button",
21174
21174
  {
21175
21175
  onClick: pageState.nextPage,
@@ -21178,7 +21178,7 @@ function PDFControls({
21178
21178
  children: ">"
21179
21179
  }
21180
21180
  ),
21181
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21181
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21182
21182
  "button",
21183
21183
  {
21184
21184
  onClick: zoom.zoomOut,
@@ -21187,11 +21187,11 @@ function PDFControls({
21187
21187
  children: "-"
21188
21188
  }
21189
21189
  ),
21190
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: PDFViewer_default.zoomLevel, children: [
21190
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.zoomLevel, children: [
21191
21191
  Math.round(zoom.zoomLevel * 100),
21192
21192
  "%"
21193
21193
  ] }),
21194
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21194
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21195
21195
  "button",
21196
21196
  {
21197
21197
  onClick: zoom.zoomIn,
@@ -21200,7 +21200,7 @@ function PDFControls({
21200
21200
  children: "+"
21201
21201
  }
21202
21202
  ),
21203
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21203
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21204
21204
  "input",
21205
21205
  {
21206
21206
  type: "text",
@@ -21210,13 +21210,13 @@ function PDFControls({
21210
21210
  className: PDFViewer_default.searchInput
21211
21211
  }
21212
21212
  ),
21213
- search.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: PDFViewer_default.searchResults, children: [
21213
+ search.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: PDFViewer_default.searchResults, children: [
21214
21214
  search.results.length,
21215
21215
  " results"
21216
21216
  ] }),
21217
- enableDownload && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: url, download: true, className: PDFViewer_default.button, title: "Download", children: "Download" }),
21218
- enablePrint && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { onClick: () => window.print(), title: "Print", children: "Print" }),
21219
- enableFullscreen && typeof document !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
21217
+ enableDownload && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: url, download: true, className: PDFViewer_default.button, title: "Download", children: "Download" }),
21218
+ enablePrint && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => window.print(), title: "Print", children: "Print" }),
21219
+ enableFullscreen && typeof document !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21220
21220
  "button",
21221
21221
  {
21222
21222
  onClick: () => {
@@ -21238,8 +21238,8 @@ function PDFThumbnails({
21238
21238
  onSelectPage,
21239
21239
  numPages
21240
21240
  }) {
21241
- const [thumbnails, setThumbnails] = (0, import_react8.useState)([]);
21242
- (0, import_react8.useEffect)(() => {
21241
+ const [thumbnails, setThumbnails] = (0, import_react12.useState)([]);
21242
+ (0, import_react12.useEffect)(() => {
21243
21243
  const generateThumbnails = async () => {
21244
21244
  if (!pdfDoc) return;
21245
21245
  const thumbs = [];
@@ -21268,13 +21268,13 @@ function PDFThumbnails({
21268
21268
  };
21269
21269
  generateThumbnails();
21270
21270
  }, [pdfDoc, numPages]);
21271
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: PDFViewer_default.thumbnails, children: thumbnails.map((thumb, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
21271
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: PDFViewer_default.thumbnails, children: thumbnails.map((thumb, idx) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
21272
21272
  "div",
21273
21273
  {
21274
21274
  className: `${PDFViewer_default.thumbnail} ${idx + 1 === currentPage ? PDFViewer_default.active : ""}`,
21275
21275
  onClick: () => onSelectPage(idx + 1),
21276
21276
  children: [
21277
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
21277
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21278
21278
  "canvas",
21279
21279
  {
21280
21280
  width: thumb.width,
@@ -21289,7 +21289,7 @@ function PDFThumbnails({
21289
21289
  }
21290
21290
  }
21291
21291
  ),
21292
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: PDFViewer_default.pageNumber, children: idx + 1 })
21292
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: PDFViewer_default.pageNumber, children: idx + 1 })
21293
21293
  ]
21294
21294
  },
21295
21295
  idx
@@ -21326,35 +21326,35 @@ function PDFViewer({
21326
21326
  const { renderPage, pageInfo } = usePageRenderer(pdfDoc);
21327
21327
  const zoom = useZoom(initialZoom);
21328
21328
  const search = useSearch(pdfDoc);
21329
- (0, import_react.useEffect)(() => {
21329
+ (0, import_react5.useEffect)(() => {
21330
21330
  if (document2) {
21331
21331
  onDocumentLoad?.(document2);
21332
21332
  }
21333
21333
  }, [document2, onDocumentLoad]);
21334
- (0, import_react.useEffect)(() => {
21334
+ (0, import_react5.useEffect)(() => {
21335
21335
  onPageChange?.(pageState.currentPage);
21336
21336
  }, [pageState.currentPage, onPageChange]);
21337
- (0, import_react.useEffect)(() => {
21337
+ (0, import_react5.useEffect)(() => {
21338
21338
  if (search.results.length > 0) {
21339
21339
  onSearchResults?.(search.results);
21340
21340
  }
21341
21341
  }, [search.results, onSearchResults]);
21342
21342
  if (error) {
21343
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: PDFViewer_default.error, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { children: [
21343
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: PDFViewer_default.error, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { children: [
21344
21344
  "Failed to load PDF: ",
21345
21345
  error.message
21346
21346
  ] }) });
21347
21347
  }
21348
21348
  if (loading) {
21349
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: PDFViewer_default.loading, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "Loading PDF..." }) });
21349
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: PDFViewer_default.loading, style: { height, width }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "Loading PDF..." }) });
21350
21350
  }
21351
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
21351
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
21352
21352
  "div",
21353
21353
  {
21354
21354
  className: `${PDFViewer_default.viewer} ${className || ""}`,
21355
21355
  style: { height, width, ...style },
21356
21356
  children: [
21357
- showControls && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21357
+ showControls && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21358
21358
  PDFControls,
21359
21359
  {
21360
21360
  pageState,
@@ -21367,8 +21367,8 @@ function PDFViewer({
21367
21367
  url
21368
21368
  }
21369
21369
  ),
21370
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: PDFViewer_default.content, children: [
21371
- showThumbnails && document2 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21370
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: PDFViewer_default.content, children: [
21371
+ showThumbnails && document2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21372
21372
  PDFThumbnails,
21373
21373
  {
21374
21374
  pdfDoc,
@@ -21377,7 +21377,7 @@ function PDFViewer({
21377
21377
  numPages: document2.numPages
21378
21378
  }
21379
21379
  ),
21380
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
21380
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21381
21381
  PDFCanvas,
21382
21382
  {
21383
21383
  pdfDoc,
@@ -21455,22 +21455,22 @@ function createProgressiveFetchHandler(onProgress) {
21455
21455
  return response.arrayBuffer();
21456
21456
  };
21457
21457
  }
21458
- var import_react, import_react2, pdfjsLib, import_react3, import_react4, import_react5, import_react6, import_react7, import_jsx_runtime3, import_jsx_runtime4, import_react8, import_jsx_runtime5, import_jsx_runtime6, DEFAULT_SCALE, CACHE_SIZE, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, PDFViewer_default, linearizedPDFConfig;
21458
+ var import_react5, import_react6, pdfjsLib, import_react7, import_react8, import_react9, import_react10, import_react11, import_jsx_runtime4, import_jsx_runtime5, import_react12, import_jsx_runtime6, import_jsx_runtime7, DEFAULT_SCALE, CACHE_SIZE, MIN_ZOOM, MAX_ZOOM, ZOOM_STEP, PDFViewer_default, linearizedPDFConfig;
21459
21459
  var init_dist = __esm({
21460
21460
  "node_modules/.pnpm/@page-speed+pdf-viewer@0.0.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/pdf-viewer/dist/index.js"() {
21461
- import_react = __toESM(require_react());
21462
- import_react2 = __toESM(require_react());
21463
- pdfjsLib = __toESM(require_pdf());
21464
- import_react3 = __toESM(require_react());
21465
- import_react4 = __toESM(require_react());
21466
21461
  import_react5 = __toESM(require_react());
21467
21462
  import_react6 = __toESM(require_react());
21463
+ pdfjsLib = __toESM(require_pdf());
21468
21464
  import_react7 = __toESM(require_react());
21469
- import_jsx_runtime3 = __toESM(require_jsx_runtime());
21470
- import_jsx_runtime4 = __toESM(require_jsx_runtime());
21471
21465
  import_react8 = __toESM(require_react());
21466
+ import_react9 = __toESM(require_react());
21467
+ import_react10 = __toESM(require_react());
21468
+ import_react11 = __toESM(require_react());
21469
+ import_jsx_runtime4 = __toESM(require_jsx_runtime());
21472
21470
  import_jsx_runtime5 = __toESM(require_jsx_runtime());
21471
+ import_react12 = __toESM(require_react());
21473
21472
  import_jsx_runtime6 = __toESM(require_jsx_runtime());
21473
+ import_jsx_runtime7 = __toESM(require_jsx_runtime());
21474
21474
  if (typeof window !== "undefined") {
21475
21475
  pdfjsLib.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjsLib.version}/pdf.worker.min.js`;
21476
21476
  }
@@ -21506,6 +21506,649 @@ var init_dist = __esm({
21506
21506
  }
21507
21507
  });
21508
21508
 
21509
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/Img.js
21510
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
21511
+ var import_react4 = __toESM(require_react(), 1);
21512
+
21513
+ // node_modules/.pnpm/@page-speed+hooks@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/hooks/dist/chunk-JSF23IF7.js
21514
+ var import_react = __toESM(require_react(), 1);
21515
+ var BASE_URL = "https://octane.cdn.ing/api/v1/images/transform?";
21516
+ var DPR_MULTIPLIERS = [1, 2];
21517
+ function useOptimizedImage(options) {
21518
+ const {
21519
+ src,
21520
+ eager = false,
21521
+ threshold = 0.1,
21522
+ rootMargin = "50px",
21523
+ width,
21524
+ height,
21525
+ optixFlowConfig
21526
+ } = options;
21527
+ const optixFlowApiKey = (0, import_react.useMemo)(() => {
21528
+ return optixFlowConfig?.apiKey;
21529
+ }, [optixFlowConfig?.apiKey]);
21530
+ const useOptixFlow = (0, import_react.useMemo)(() => {
21531
+ return optixFlowApiKey ? true : false;
21532
+ }, [optixFlowApiKey]);
21533
+ const [state, setState] = (0, import_react.useState)({
21534
+ isLoaded: false,
21535
+ isInView: false
21536
+ });
21537
+ const [size, setSize] = (0, import_react.useState)({
21538
+ width: width ?? 0,
21539
+ height: height ?? 0
21540
+ });
21541
+ const imgRef = (0, import_react.useRef)(null);
21542
+ const observerRef = (0, import_react.useRef)(null);
21543
+ (0, import_react.useEffect)(() => {
21544
+ if (width !== void 0 || height !== void 0) {
21545
+ setSize((prev) => ({
21546
+ width: width ?? prev.width,
21547
+ height: height ?? prev.height
21548
+ }));
21549
+ }
21550
+ }, [width, height]);
21551
+ (0, import_react.useEffect)(() => {
21552
+ if (!imgRef.current) return;
21553
+ const calculateRenderedSize = () => {
21554
+ const img2 = imgRef.current;
21555
+ if (!img2) return;
21556
+ const renderedWidth = width ?? (Math.round(img2.clientWidth) || img2.naturalWidth || 0);
21557
+ const renderedHeight = height ?? (Math.round(img2.clientHeight) || img2.naturalHeight || 0);
21558
+ if (renderedWidth > 0 || renderedHeight > 0) {
21559
+ setSize((prev) => {
21560
+ if (prev.width !== renderedWidth || prev.height !== renderedHeight) {
21561
+ return { width: renderedWidth, height: renderedHeight };
21562
+ }
21563
+ return prev;
21564
+ });
21565
+ }
21566
+ };
21567
+ if (imgRef.current.clientWidth > 0) {
21568
+ calculateRenderedSize();
21569
+ }
21570
+ const img = imgRef.current;
21571
+ img.addEventListener("load", calculateRenderedSize);
21572
+ let resizeObserver = null;
21573
+ if (typeof ResizeObserver !== "undefined") {
21574
+ resizeObserver = new ResizeObserver(() => {
21575
+ calculateRenderedSize();
21576
+ });
21577
+ resizeObserver.observe(img);
21578
+ }
21579
+ return () => {
21580
+ img.removeEventListener("load", calculateRenderedSize);
21581
+ resizeObserver?.disconnect();
21582
+ };
21583
+ }, [width, height, state.isLoaded]);
21584
+ const buildOptixFlowUrl = (0, import_react.useCallback)(
21585
+ (imgWidth, imgHeight, format) => {
21586
+ if (!useOptixFlow) return src;
21587
+ if (!imgWidth || !imgHeight) return src;
21588
+ const params = new URLSearchParams();
21589
+ params.set("url", src);
21590
+ params.set("w", String(imgWidth));
21591
+ params.set("h", String(imgHeight));
21592
+ params.set("q", String(optixFlowConfig?.compressionLevel ?? 75));
21593
+ params.set("f", format);
21594
+ params.set("apiKey", optixFlowApiKey);
21595
+ return `${BASE_URL}${params.toString()}`;
21596
+ },
21597
+ [useOptixFlow, src, optixFlowConfig?.compressionLevel, optixFlowApiKey]
21598
+ );
21599
+ const generateSrcset = (0, import_react.useCallback)(
21600
+ (baseWidth, baseHeight, format) => {
21601
+ if (!useOptixFlow || baseWidth === 0 || baseHeight === 0) return "";
21602
+ return DPR_MULTIPLIERS.map((dpr) => {
21603
+ const scaledWidth = Math.round(baseWidth * dpr);
21604
+ const scaledHeight = Math.round(baseHeight * dpr);
21605
+ const url = buildOptixFlowUrl(scaledWidth, scaledHeight, format);
21606
+ return `${url} ${dpr}x`;
21607
+ }).join(", ");
21608
+ },
21609
+ [useOptixFlow, buildOptixFlowUrl]
21610
+ );
21611
+ const primarySrc = (0, import_react.useMemo)(() => {
21612
+ const hasDimensions = size.width > 0 && size.height > 0;
21613
+ if (!useOptixFlow || !hasDimensions) return src;
21614
+ const fallbackFormat = optixFlowConfig?.renderedFileType ?? "jpeg";
21615
+ return buildOptixFlowUrl(size.width, size.height, fallbackFormat);
21616
+ }, [useOptixFlow, src, size.width, size.height, optixFlowConfig?.renderedFileType, buildOptixFlowUrl]);
21617
+ const srcset = (0, import_react.useMemo)(() => {
21618
+ return {
21619
+ avif: generateSrcset(size.width, size.height, "avif"),
21620
+ webp: generateSrcset(size.width, size.height, "webp"),
21621
+ jpeg: generateSrcset(size.width, size.height, "jpeg")
21622
+ };
21623
+ }, [size.width, size.height, generateSrcset]);
21624
+ const sizes = (0, import_react.useMemo)(() => {
21625
+ if (size.width === 0) return "";
21626
+ return `${size.width}px`;
21627
+ }, [size.width]);
21628
+ (0, import_react.useEffect)(() => {
21629
+ if (typeof window === "undefined" || !imgRef.current) {
21630
+ return;
21631
+ }
21632
+ if (eager) {
21633
+ setState({ isLoaded: false, isInView: true });
21634
+ return;
21635
+ }
21636
+ observerRef.current = new IntersectionObserver(
21637
+ ([entry]) => {
21638
+ if (entry.isIntersecting) {
21639
+ setState((prev) => ({ ...prev, isInView: true }));
21640
+ observerRef.current?.disconnect();
21641
+ }
21642
+ },
21643
+ { threshold, rootMargin }
21644
+ );
21645
+ observerRef.current.observe(imgRef.current);
21646
+ return () => {
21647
+ observerRef.current?.disconnect();
21648
+ };
21649
+ }, [eager, threshold, rootMargin]);
21650
+ (0, import_react.useEffect)(() => {
21651
+ if (!imgRef.current) return;
21652
+ const handleLoad = () => {
21653
+ setState((prev) => ({ ...prev, isLoaded: true }));
21654
+ };
21655
+ const img = imgRef.current;
21656
+ if (img.complete) {
21657
+ handleLoad();
21658
+ } else {
21659
+ img.addEventListener("load", handleLoad);
21660
+ return () => img.removeEventListener("load", handleLoad);
21661
+ }
21662
+ }, [state.isInView]);
21663
+ const ref = (0, import_react.useCallback)((node) => {
21664
+ imgRef.current = node;
21665
+ }, []);
21666
+ const emptySrcset = { avif: "", webp: "", jpeg: "" };
21667
+ return {
21668
+ ref,
21669
+ // Primary src uses exact rendered dimensions for Lighthouse "Properly size images" compliance
21670
+ src: state.isInView || eager ? primarySrc : src,
21671
+ // Srcset with format variants and DPR multipliers for <picture> element
21672
+ srcset: state.isInView || eager ? srcset : emptySrcset,
21673
+ // Sizes attribute for responsive image selection
21674
+ sizes: state.isInView || eager ? sizes : "",
21675
+ isLoaded: state.isLoaded,
21676
+ isInView: state.isInView,
21677
+ loading: eager ? "eager" : "lazy",
21678
+ size
21679
+ };
21680
+ }
21681
+
21682
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/utils/cache.js
21683
+ var l2Cache = /* @__PURE__ */ new Map();
21684
+ function cacheGet(key) {
21685
+ return l2Cache.get(key);
21686
+ }
21687
+ function cacheSet(key, value) {
21688
+ l2Cache.set(key, value);
21689
+ }
21690
+
21691
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/utils/api.js
21692
+ var DEFAULT_CDN_HOST = "https://cdn.ing";
21693
+ function normalizeHost(cdnHost) {
21694
+ return (cdnHost ?? DEFAULT_CDN_HOST).replace(/\/$/, "");
21695
+ }
21696
+ function buildPrimaryImageUrl(mediaId, cdnHost) {
21697
+ const host = normalizeHost(cdnHost);
21698
+ return `${host}/assets/images/${mediaId}`;
21699
+ }
21700
+ function buildLegacyImageUrl(mediaId, cdnHost) {
21701
+ const host = normalizeHost(cdnHost);
21702
+ return `${host}/i/r/${mediaId}`;
21703
+ }
21704
+ function buildPlaceholderImageUrl(mediaId, cdnHost) {
21705
+ const host = normalizeHost(cdnHost);
21706
+ return `${host}/assets/low_res_thumb/${mediaId}`;
21707
+ }
21708
+ function hasRenderableUrlVariant(variant) {
21709
+ if (!variant)
21710
+ return false;
21711
+ const candidates = [variant.sm, variant.md, variant.lg, variant.full];
21712
+ return candidates.some((value) => typeof value === "string" && value.trim().length > 0);
21713
+ }
21714
+ function imageVariantsHaveRenderableSource(variants) {
21715
+ if (!variants)
21716
+ return false;
21717
+ return ["AVIF", "WEBP", "JPEG"].some((format) => {
21718
+ const entry = variants?.[format];
21719
+ return hasRenderableUrlVariant(entry);
21720
+ });
21721
+ }
21722
+ function hasUrlValue(value) {
21723
+ return typeof value === "string" && value.trim().length > 0;
21724
+ }
21725
+ function imageDataHasRenderableSource(data) {
21726
+ if (!data)
21727
+ return false;
21728
+ if (imageVariantsHaveRenderableSource(data.variants_data?.variants ?? null)) {
21729
+ return true;
21730
+ }
21731
+ const raw = data;
21732
+ const directFields = [
21733
+ raw.img_url,
21734
+ raw.file_data_url,
21735
+ raw.file_data_thumbnail_url,
21736
+ raw.img_src,
21737
+ raw.med_src,
21738
+ raw.thumb_src,
21739
+ raw.low_res_thumb
21740
+ ];
21741
+ return directFields.some(hasUrlValue);
21742
+ }
21743
+ async function fetchFrom(url, signal) {
21744
+ const res = await fetch(url, { signal });
21745
+ if (!res.ok) {
21746
+ const error = new Error(`Failed to fetch image data (status ${res.status}) from ${url}`);
21747
+ error.status = res.status;
21748
+ throw error;
21749
+ }
21750
+ return await res.json();
21751
+ }
21752
+ async function fetchImageData(mediaId, options = {}) {
21753
+ if (!Number.isFinite(mediaId)) {
21754
+ throw new Error("Invalid mediaId provided to fetchImageData");
21755
+ }
21756
+ const host = normalizeHost(options.cdnHost);
21757
+ const cacheKey = `image:${host}:${mediaId}`;
21758
+ if (!options.bypassCache) {
21759
+ const cached = cacheGet(cacheKey);
21760
+ if (cached)
21761
+ return cached;
21762
+ }
21763
+ const urls = [buildPrimaryImageUrl(mediaId, host), buildLegacyImageUrl(mediaId, host)];
21764
+ let lastError;
21765
+ for (const url of urls) {
21766
+ try {
21767
+ const data = await fetchFrom(url, options.signal);
21768
+ if (imageDataHasRenderableSource(data)) {
21769
+ cacheSet(cacheKey, data);
21770
+ }
21771
+ return data;
21772
+ } catch (err) {
21773
+ if (err?.name === "AbortError") {
21774
+ throw err;
21775
+ }
21776
+ lastError = err;
21777
+ }
21778
+ }
21779
+ if (lastError instanceof Error) {
21780
+ throw lastError;
21781
+ }
21782
+ throw new Error(`Failed to fetch image data for mediaId ${mediaId}`);
21783
+ }
21784
+
21785
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/useMediaSelectionEffect.js
21786
+ var import_react2 = __toESM(require_react(), 1);
21787
+ var MEDIA_SELECTED_EVENT = "dt:media-selected";
21788
+ function useMediaSelectionEffect() {
21789
+ (0, import_react2.useEffect)(() => {
21790
+ if (typeof window === "undefined")
21791
+ return;
21792
+ const handler = () => {
21793
+ };
21794
+ window.addEventListener(MEDIA_SELECTED_EVENT, handler);
21795
+ return () => window.removeEventListener(MEDIA_SELECTED_EVENT, handler);
21796
+ }, []);
21797
+ }
21798
+
21799
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/useResponsiveReset.js
21800
+ var import_react3 = __toESM(require_react(), 1);
21801
+ function resetResponsivePictureState(element) {
21802
+ if (!element)
21803
+ return;
21804
+ element.querySelectorAll("source").forEach((source) => {
21805
+ const srcset = source.getAttribute("srcset");
21806
+ if (srcset) {
21807
+ source.setAttribute("data-srcset", srcset);
21808
+ source.removeAttribute("srcset");
21809
+ requestAnimationFrame(() => {
21810
+ source.setAttribute("srcset", srcset);
21811
+ });
21812
+ }
21813
+ });
21814
+ }
21815
+ function useResponsiveReset(ref) {
21816
+ (0, import_react3.useEffect)(() => {
21817
+ const element = ref.current;
21818
+ if (!element)
21819
+ return;
21820
+ if (element instanceof HTMLPictureElement) {
21821
+ resetResponsivePictureState(element);
21822
+ } else if (element.parentElement instanceof HTMLPictureElement) {
21823
+ resetResponsivePictureState(element.parentElement);
21824
+ }
21825
+ }, [ref]);
21826
+ }
21827
+
21828
+ // node_modules/.pnpm/@page-speed+img@0.4.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@page-speed/img/dist/core/Img.js
21829
+ var DEFAULT_WIDTHS = {
21830
+ sm: 640,
21831
+ md: 1024,
21832
+ lg: 1536,
21833
+ full: 2560
21834
+ };
21835
+ var MAX_VARIANT_REFRESH_ATTEMPTS = 5;
21836
+ var VARIANT_REFRESH_DELAY_MS = 3e3;
21837
+ var TRANSPARENT_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
21838
+ var defaultOptixFlowConfig;
21839
+ var deprecatedMediaWarnings = /* @__PURE__ */ new Set();
21840
+ var readGlobalOptixFlowConfig = () => {
21841
+ if (typeof globalThis === "undefined")
21842
+ return void 0;
21843
+ const globalAny = globalThis;
21844
+ return globalAny.PageSpeedImgDefaults?.optixFlowConfig || globalAny.OpensiteImgDefaults?.optixFlowConfig || globalAny.PAGE_SPEED_IMG_DEFAULTS?.optixFlowConfig;
21845
+ };
21846
+ var resolveOptixFlowConfig = (config) => {
21847
+ return config ?? defaultOptixFlowConfig ?? readGlobalOptixFlowConfig();
21848
+ };
21849
+ var warnDeprecatedMediaId = (mediaId) => {
21850
+ if (!Number.isFinite(mediaId) || mediaId == null)
21851
+ return;
21852
+ const id = mediaId;
21853
+ if (deprecatedMediaWarnings.has(id))
21854
+ return;
21855
+ deprecatedMediaWarnings.add(id);
21856
+ if (typeof console !== "undefined" && console.warn) {
21857
+ console.warn("[DEPRECATED] <Img mediaId> is deprecated. Provide src + optixFlowConfig instead.", { mediaId: id });
21858
+ }
21859
+ };
21860
+ var isUrlString = (value) => typeof value === "string" && value.trim().length > 0;
21861
+ var parseDimension = (value) => {
21862
+ if (value === "" || value === null || typeof value === "undefined")
21863
+ return void 0;
21864
+ if (typeof value === "number" && Number.isFinite(value))
21865
+ return value;
21866
+ if (typeof value === "string") {
21867
+ const numeric = Number(value);
21868
+ if (Number.isFinite(numeric))
21869
+ return numeric;
21870
+ }
21871
+ return void 0;
21872
+ };
21873
+ var composeRefs = (hookRef, forwardedRef, localRef) => (0, import_react4.useCallback)((node) => {
21874
+ hookRef(node);
21875
+ localRef.current = node;
21876
+ if (typeof forwardedRef === "function") {
21877
+ forwardedRef(node);
21878
+ } else if (forwardedRef && typeof forwardedRef === "object") {
21879
+ forwardedRef.current = node;
21880
+ }
21881
+ }, [hookRef, forwardedRef, localRef]);
21882
+ function widthMapFromMetadata(v) {
21883
+ const w = v?.widths;
21884
+ if (!w)
21885
+ return null;
21886
+ return {
21887
+ sm: w.small ?? w.sm ?? DEFAULT_WIDTHS.sm,
21888
+ md: w.medium ?? w.md ?? DEFAULT_WIDTHS.md,
21889
+ lg: w.large ?? w.lg ?? DEFAULT_WIDTHS.lg,
21890
+ full: w.full_size ?? w.full ?? DEFAULT_WIDTHS.full
21891
+ };
21892
+ }
21893
+ function pickBest(sizes) {
21894
+ if (!sizes)
21895
+ return void 0;
21896
+ return sizes.md || sizes.lg || sizes.sm || sizes.full || Object.values(sizes).find(Boolean);
21897
+ }
21898
+ var DEFAULT_SIZES = "(max-width:640px) 640px, (max-width:1024px) 1024px, 1536px";
21899
+ var ModernImg = ({ sizes, loading, decoding, alt, title, src: directSrc, eager, intersectionMargin, intersectionThreshold, optixFlowConfig, forwardedRef, ...rest }) => {
21900
+ const imgRef = (0, import_react4.useRef)(null);
21901
+ const pictureRef = (0, import_react4.useRef)(null);
21902
+ useResponsiveReset(pictureRef);
21903
+ useMediaSelectionEffect();
21904
+ const normalizedSrc = (0, import_react4.useMemo)(() => typeof directSrc === "string" ? directSrc.trim() : "", [directSrc]);
21905
+ const numericWidth = (0, import_react4.useMemo)(() => parseDimension(rest.width), [rest]);
21906
+ const numericHeight = (0, import_react4.useMemo)(() => parseDimension(rest.height), [rest]);
21907
+ const resolvedOptixConfig = (0, import_react4.useMemo)(() => resolveOptixFlowConfig(optixFlowConfig), [optixFlowConfig]);
21908
+ const eagerLoad = eager ?? loading === "eager";
21909
+ const { ref: hookRef, src, srcset, sizes: computedSizes, loading: hookLoading, size } = useOptimizedImage({
21910
+ src: normalizedSrc,
21911
+ eager: eagerLoad,
21912
+ width: numericWidth,
21913
+ height: numericHeight,
21914
+ rootMargin: intersectionMargin ?? "200px",
21915
+ threshold: intersectionThreshold ?? 0.1,
21916
+ optixFlowConfig: resolvedOptixConfig
21917
+ });
21918
+ const mergedRef = composeRefs(hookRef, forwardedRef, imgRef);
21919
+ const { width, height, ...restProps } = rest;
21920
+ const sizesAttr = sizes ?? (computedSizes || void 0);
21921
+ const loadingAttr = loading ?? hookLoading ?? "lazy";
21922
+ const decodingAttr = decoding ?? "async";
21923
+ const hasSrcSet = Boolean(srcset.avif || srcset.webp || srcset.jpeg);
21924
+ const imgSrc = src || normalizedSrc || TRANSPARENT_PIXEL;
21925
+ const inlineSrcSet = hasSrcSet && !srcset.avif && !srcset.webp ? srcset.jpeg : "";
21926
+ const parsedWidth = parseDimension(width);
21927
+ const parsedHeight = parseDimension(height);
21928
+ const widthAttr = parsedWidth ?? (size.width || numericWidth || void 0);
21929
+ const heightAttr = parsedHeight ?? (size.height || numericHeight || void 0);
21930
+ if (!hasSrcSet) {
21931
+ return (0, import_jsx_runtime.jsx)("img", { ref: mergedRef, src: imgSrc, loading: loadingAttr, decoding: decodingAttr, alt, title, width: widthAttr, height: heightAttr, ...restProps });
21932
+ }
21933
+ return (0, import_jsx_runtime.jsxs)("picture", { ref: pictureRef, children: [srcset.avif ? (0, import_jsx_runtime.jsx)("source", { type: "image/avif", srcSet: srcset.avif, sizes: sizesAttr }) : null, srcset.webp ? (0, import_jsx_runtime.jsx)("source", { type: "image/webp", srcSet: srcset.webp, sizes: sizesAttr }) : null, (0, import_jsx_runtime.jsx)("img", { ref: mergedRef, src: imgSrc, srcSet: inlineSrcSet || void 0, sizes: inlineSrcSet ? sizesAttr : void 0, loading: loadingAttr, decoding: decodingAttr, alt, title, width: widthAttr, height: heightAttr, ...restProps })] });
21934
+ };
21935
+ var LegacyImg = ({ mediaId, cdnHost, sizes, onImageData, loading, decoding, alt, title, src: directSrc, forwardedRef, ...rest }) => {
21936
+ const imgRef = (0, import_react4.useRef)(null);
21937
+ const pictureRef = (0, import_react4.useRef)(null);
21938
+ (0, import_react4.useImperativeHandle)(forwardedRef, () => imgRef.current);
21939
+ useResponsiveReset(pictureRef);
21940
+ useMediaSelectionEffect();
21941
+ const [data, setData] = (0, import_react4.useState)(null);
21942
+ const [retryCount, setRetryCount] = (0, import_react4.useState)(0);
21943
+ const hasMediaId = Number.isFinite(mediaId);
21944
+ const loadingAttr = loading ?? "lazy";
21945
+ const decodingAttr = decoding ?? "async";
21946
+ const [isInView, setIsInView] = (0, import_react4.useState)(() => !hasMediaId || loadingAttr !== "lazy");
21947
+ const cdnOrigin = (0, import_react4.useMemo)(() => (cdnHost ?? DEFAULT_CDN_HOST).replace(/\/$/, ""), [cdnHost]);
21948
+ (0, import_react4.useEffect)(() => {
21949
+ if (!hasMediaId) {
21950
+ setData(null);
21951
+ setRetryCount(0);
21952
+ return;
21953
+ }
21954
+ setData(null);
21955
+ setRetryCount(0);
21956
+ }, [hasMediaId, mediaId, cdnHost]);
21957
+ (0, import_react4.useEffect)(() => {
21958
+ if (!hasMediaId) {
21959
+ return;
21960
+ }
21961
+ const controller = new AbortController();
21962
+ fetchImageData(mediaId, {
21963
+ cdnHost,
21964
+ signal: controller.signal,
21965
+ bypassCache: retryCount > 0
21966
+ }).then((d) => {
21967
+ setData(d);
21968
+ onImageData?.(d);
21969
+ }).catch((err) => {
21970
+ if (err?.name !== "AbortError") {
21971
+ console.warn("Image data fetch failed:", err);
21972
+ }
21973
+ });
21974
+ return () => controller.abort();
21975
+ }, [hasMediaId, mediaId, cdnHost, onImageData, retryCount]);
21976
+ (0, import_react4.useEffect)(() => {
21977
+ if (!hasMediaId || loadingAttr !== "lazy") {
21978
+ setIsInView(true);
21979
+ return;
21980
+ }
21981
+ setIsInView(false);
21982
+ }, [hasMediaId, mediaId, loadingAttr]);
21983
+ (0, import_react4.useEffect)(() => {
21984
+ if (!hasMediaId || loadingAttr !== "lazy" || isInView) {
21985
+ return;
21986
+ }
21987
+ if (typeof window === "undefined" || typeof window.IntersectionObserver === "undefined") {
21988
+ setIsInView(true);
21989
+ return;
21990
+ }
21991
+ const node = imgRef.current;
21992
+ if (!node) {
21993
+ return;
21994
+ }
21995
+ const observer = new IntersectionObserver((entries) => {
21996
+ if (entries.some((entry) => entry.isIntersecting)) {
21997
+ setIsInView(true);
21998
+ observer.disconnect();
21999
+ }
22000
+ }, { rootMargin: "200px" });
22001
+ observer.observe(node);
22002
+ return () => observer.disconnect();
22003
+ }, [hasMediaId, loadingAttr, isInView]);
22004
+ const picture = (0, import_react4.useMemo)(() => {
22005
+ if (!data)
22006
+ return null;
22007
+ const v = data.variants_data?.variants ?? {};
22008
+ const webp2 = v.WEBP;
22009
+ const avif2 = v.AVIF;
22010
+ const jpeg2 = v.JPEG;
22011
+ const widths = widthMapFromMetadata(v.WEBP?.metadata) || widthMapFromMetadata(v.JPEG?.metadata) || { ...DEFAULT_WIDTHS };
22012
+ const ensureAbsolute = (url) => {
22013
+ if (!isUrlString(url))
22014
+ return void 0;
22015
+ if (/^https?:\/\//i.test(url) || url.startsWith("data:"))
22016
+ return url;
22017
+ if (url.startsWith("//"))
22018
+ return `https:${url}`;
22019
+ if (url.startsWith("/"))
22020
+ return `${cdnOrigin}${url}`;
22021
+ return `${cdnOrigin}/${url}`;
22022
+ };
22023
+ const normalizeCandidate = (candidate) => ensureAbsolute(typeof candidate === "string" ? candidate : void 0);
22024
+ const variantCandidates = [
22025
+ pickBest(webp2),
22026
+ pickBest(jpeg2),
22027
+ pickBest(avif2),
22028
+ webp2?.sm,
22029
+ webp2?.md,
22030
+ webp2?.lg,
22031
+ webp2?.full,
22032
+ jpeg2?.sm,
22033
+ jpeg2?.md,
22034
+ jpeg2?.lg,
22035
+ jpeg2?.full,
22036
+ avif2?.sm,
22037
+ avif2?.md,
22038
+ avif2?.lg,
22039
+ avif2?.full
22040
+ ].map((candidate) => normalizeCandidate(candidate ?? void 0)).filter(isUrlString);
22041
+ const raw = data;
22042
+ const directCandidates = [
22043
+ raw.img_url,
22044
+ raw.file_data_url,
22045
+ raw.file_data_thumbnail_url,
22046
+ raw.img_src,
22047
+ raw.med_src,
22048
+ raw.thumb_src,
22049
+ raw.low_res_thumb
22050
+ ].map((candidate) => isUrlString(candidate) ? normalizeCandidate(candidate) : void 0).filter(isUrlString);
22051
+ const fallbackCandidates = raw.fallback_url ? [normalizeCandidate(raw.fallback_url)].filter(isUrlString) : [];
22052
+ const fallback2 = [...variantCandidates, ...directCandidates, ...fallbackCandidates][0];
22053
+ if (!fallback2) {
22054
+ return null;
22055
+ }
22056
+ const toSrcSet2 = (sizes2) => {
22057
+ if (!sizes2)
22058
+ return void 0;
22059
+ const entries = [];
22060
+ const push = (url, width) => {
22061
+ const absolute = normalizeCandidate(url);
22062
+ if (absolute && width)
22063
+ entries.push(`${absolute} ${width}w`);
22064
+ };
22065
+ push(sizes2.sm, widths.sm);
22066
+ push(sizes2.md, widths.md);
22067
+ push(sizes2.lg, widths.lg);
22068
+ push(sizes2.full, widths.full);
22069
+ return entries.length ? entries.join(", ") : void 0;
22070
+ };
22071
+ return { webp: webp2, avif: avif2, jpeg: jpeg2, toSrcSet: toSrcSet2, fallback: fallback2, widths, hasVariantSource: variantCandidates.length > 0 };
22072
+ }, [data, cdnOrigin]);
22073
+ const hasVariantEntries = (0, import_react4.useMemo)(() => imageVariantsHaveRenderableSource(data?.variants_data?.variants ?? null), [data]);
22074
+ const variantsStatus = (0, import_react4.useMemo)(() => {
22075
+ const status = data?.variants_data?.status ?? data?.variants_status ?? "";
22076
+ return typeof status === "string" ? status.toLowerCase() : "";
22077
+ }, [data]);
22078
+ const variantsFailed = variantsStatus === "failed" || variantsStatus === "error";
22079
+ const shouldPollForVariants = hasMediaId && Boolean(data) && !variantsFailed && !hasVariantEntries && retryCount < MAX_VARIANT_REFRESH_ATTEMPTS;
22080
+ (0, import_react4.useEffect)(() => {
22081
+ if (!shouldPollForVariants) {
22082
+ return;
22083
+ }
22084
+ if (typeof window === "undefined") {
22085
+ return;
22086
+ }
22087
+ const timeoutId = window.setTimeout(() => {
22088
+ setRetryCount((count) => count + 1);
22089
+ }, VARIANT_REFRESH_DELAY_MS);
22090
+ return () => window.clearTimeout(timeoutId);
22091
+ }, [shouldPollForVariants]);
22092
+ const altAttr = (0, import_react4.useMemo)(() => {
22093
+ if (typeof alt === "string")
22094
+ return alt;
22095
+ return data?.meta?.content_manifest?.summary ?? void 0;
22096
+ }, [alt, data]);
22097
+ const titleAttr = (0, import_react4.useMemo)(() => {
22098
+ if (typeof title === "string")
22099
+ return title;
22100
+ return data?.meta?.content_manifest?.title ?? void 0;
22101
+ }, [title, data]);
22102
+ const widthAttr = (0, import_react4.useMemo)(() => data?.meta?.sizing?.width ?? data?.variants_data?.metadata?.width ?? void 0, [data]);
22103
+ const heightAttr = (0, import_react4.useMemo)(() => data?.meta?.sizing?.height ?? data?.variants_data?.metadata?.height ?? void 0, [data]);
22104
+ const dataFilename = (0, import_react4.useMemo)(() => {
22105
+ const base = data?.meta?.content_manifest?.optimized_filename;
22106
+ if (!base)
22107
+ return void 0;
22108
+ const href = picture?.fallback;
22109
+ if (!href)
22110
+ return void 0;
22111
+ const dot = href.lastIndexOf(".");
22112
+ const ext = dot > -1 ? href.slice(dot + 1).toLowerCase() : "jpg";
22113
+ return `${base}.${ext}`;
22114
+ }, [data, picture]);
22115
+ if (!hasMediaId) {
22116
+ const r = { ...rest };
22117
+ return (0, import_jsx_runtime.jsx)("img", { ref: imgRef, src: directSrc, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: r.width, height: r.height, ...r });
22118
+ }
22119
+ const placeholderSrc = buildPlaceholderImageUrl(mediaId, cdnHost);
22120
+ if (!data || !picture || !isInView) {
22121
+ const r = { ...rest };
22122
+ return (0, import_jsx_runtime.jsx)("img", { ref: imgRef, src: placeholderSrc, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: r.width ?? widthAttr, height: r.height ?? heightAttr, ...r });
22123
+ }
22124
+ const sizesAttr = sizes ?? DEFAULT_SIZES;
22125
+ const { webp, avif, jpeg, toSrcSet, fallback } = picture;
22126
+ const webpSet = toSrcSet(webp);
22127
+ const avifSet = toSrcSet(avif);
22128
+ const jpegSet = toSrcSet(jpeg);
22129
+ if (webpSet || avifSet || jpegSet) {
22130
+ return (0, import_jsx_runtime.jsxs)("picture", { children: [avifSet ? (0, import_jsx_runtime.jsx)("source", { type: "image/avif", srcSet: avifSet, sizes: sizesAttr }) : null, webpSet ? (0, import_jsx_runtime.jsx)("source", { type: "image/webp", srcSet: webpSet, sizes: sizesAttr }) : null, (0, import_jsx_runtime.jsx)("img", { ref: imgRef, src: fallback, srcSet: jpegSet && !webpSet && !avifSet ? jpegSet : void 0, sizes: jpegSet && !webpSet && !avifSet ? sizesAttr : void 0, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: widthAttr, height: heightAttr, "data-filename": dataFilename, ...rest })] });
22131
+ }
22132
+ return (0, import_jsx_runtime.jsx)("img", { ref: imgRef, src: fallback, loading: loadingAttr, decoding: decodingAttr, alt: altAttr, title: titleAttr, width: widthAttr, height: heightAttr, "data-filename": dataFilename, ...rest });
22133
+ };
22134
+ var ImgBase = (0, import_react4.forwardRef)(function Img(props, ref) {
22135
+ const hasMediaId = Number.isFinite(props.mediaId);
22136
+ if (hasMediaId) {
22137
+ warnDeprecatedMediaId(props.mediaId);
22138
+ return (0, import_jsx_runtime.jsx)(LegacyImg, { ...props, forwardedRef: ref });
22139
+ }
22140
+ const hasSrc = typeof props.src === "string" && props.src.trim().length > 0;
22141
+ if (!hasSrc) {
22142
+ if (typeof console !== "undefined" && console.warn) {
22143
+ console.warn("<Img /> requires either src or mediaId. No src provided, rendering null.");
22144
+ }
22145
+ return null;
22146
+ }
22147
+ return (0, import_jsx_runtime.jsx)(ModernImg, { ...props, forwardedRef: ref });
22148
+ });
22149
+ var Img2 = (0, import_react4.memo)(ImgBase);
22150
+ Img2.displayName = "PageSpeedImg";
22151
+
21509
22152
  // src/styles/Lightbox.module.css
21510
22153
  var Lightbox_default = {
21511
22154
  lightboxPortal: "Lightbox_lightboxPortal2",
@@ -21528,26 +22171,35 @@ var Lightbox_default = {
21528
22171
  };
21529
22172
 
21530
22173
  // src/renderers/ImageRenderer.tsx
21531
- var import_jsx_runtime = __toESM(require_jsx_runtime());
21532
- function ImageRenderer({ item }) {
22174
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime());
22175
+ var toImgOptixFlowConfig = (config) => {
22176
+ if (!config) return void 0;
22177
+ const { compression, ...rest } = config;
22178
+ const base = rest;
22179
+ return {
22180
+ ...base,
22181
+ compressionLevel: typeof compression === "number" ? compression : base.compressionLevel
22182
+ };
22183
+ };
22184
+ function ImageRenderer({ item, optixFlowConfig }) {
21533
22185
  if (!item.src) return null;
21534
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
21535
- "img",
22186
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
22187
+ Img2,
21536
22188
  {
21537
22189
  className: Lightbox_default.media,
21538
22190
  src: item.src,
21539
- srcSet: item.srcSet,
21540
22191
  alt: item.alt || item.title || "",
21541
- loading: "lazy"
22192
+ loading: "lazy",
22193
+ optixFlowConfig: toImgOptixFlowConfig(optixFlowConfig)
21542
22194
  }
21543
22195
  );
21544
22196
  }
21545
22197
 
21546
22198
  // src/renderers/VideoRenderer.tsx
21547
- var import_jsx_runtime2 = __toESM(require_jsx_runtime());
22199
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime());
21548
22200
  function VideoRenderer({ item }) {
21549
22201
  if (!item.src) return null;
21550
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
22202
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
21551
22203
  "video",
21552
22204
  {
21553
22205
  className: Lightbox_default.media,
@@ -21559,8 +22211,8 @@ function VideoRenderer({ item }) {
21559
22211
  }
21560
22212
 
21561
22213
  // src/renderers/PDFRenderer.tsx
21562
- var import_react9 = __toESM(require_react());
21563
- var import_jsx_runtime7 = __toESM(require_jsx_runtime());
22214
+ var import_react13 = __toESM(require_react());
22215
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime());
21564
22216
  function loadPDFViewer() {
21565
22217
  return Promise.resolve().then(() => (init_dist(), dist_exports)).then((mod) => ({
21566
22218
  // The PDF viewer package exposes a named PDFViewer export.
@@ -21568,25 +22220,25 @@ function loadPDFViewer() {
21568
22220
  default: mod.PDFViewer
21569
22221
  }));
21570
22222
  }
21571
- var LazyPDFViewer = import_react9.default.lazy(loadPDFViewer);
22223
+ var LazyPDFViewer = import_react13.default.lazy(loadPDFViewer);
21572
22224
  var AnyPDFViewer = LazyPDFViewer;
21573
22225
  function PDFRenderer({ item }) {
21574
22226
  if (!item.src) return null;
21575
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: Lightbox_default.pdfContainer, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
21576
- import_react9.Suspense,
22227
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: Lightbox_default.pdfContainer, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
22228
+ import_react13.Suspense,
21577
22229
  {
21578
- fallback: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: Lightbox_default.pdfFallback, children: "Loading document..." }),
21579
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AnyPDFViewer, { url: item.src })
22230
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: Lightbox_default.pdfFallback, children: "Loading document..." }),
22231
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AnyPDFViewer, { url: item.src })
21580
22232
  }
21581
22233
  ) });
21582
22234
  }
21583
22235
 
21584
22236
  // src/renderers/ComponentRenderer.tsx
21585
- var import_jsx_runtime8 = __toESM(require_jsx_runtime());
22237
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime());
21586
22238
  function ComponentRenderer({ item }) {
21587
22239
  if (!item.component) return null;
21588
22240
  const Component = item.component;
21589
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Component, { ...item.data || {} });
22241
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, { ...item.data || {} });
21590
22242
  }
21591
22243
  export {
21592
22244
  ComponentRenderer,