@prismicio/next 2.0.1-alpha.0 → 2.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/{PrismicNextImage.mjs → PrismicNextImage.cjs} +22 -21
  2. package/dist/PrismicNextImage.cjs.map +1 -0
  3. package/dist/PrismicNextLink.cjs +23 -0
  4. package/dist/PrismicNextLink.cjs.map +1 -0
  5. package/dist/PrismicPreview.cjs +39 -0
  6. package/dist/PrismicPreview.cjs.map +1 -0
  7. package/dist/{PrismicPreviewClient.mjs → PrismicPreviewClient.cjs} +14 -14
  8. package/dist/{PrismicPreviewClient.mjs.map → PrismicPreviewClient.cjs.map} +1 -1
  9. package/dist/createLocaleRedirect.cjs +8 -0
  10. package/dist/{createLocaleRedirect.mjs.map → createLocaleRedirect.cjs.map} +1 -1
  11. package/dist/enableAutoPreviews.cjs +51 -0
  12. package/dist/{enableAutoPreviews.mjs.map → enableAutoPreviews.cjs.map} +1 -1
  13. package/dist/exitPreview.cjs +35 -0
  14. package/dist/{exitPreview.mjs.map → exitPreview.cjs.map} +1 -1
  15. package/dist/imgixLoader.cjs +17 -0
  16. package/dist/{imgixLoader.mjs.map → imgixLoader.cjs.map} +1 -1
  17. package/dist/index.cjs +19 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/lib/devMsg.cjs +8 -0
  20. package/dist/lib/{devMsg.mjs.map → devMsg.cjs.map} +1 -1
  21. package/dist/lib/resolveCJS.cjs +7 -0
  22. package/dist/lib/resolveCJS.cjs.map +1 -0
  23. package/dist/lib/resolveCJS.d.ts +9 -0
  24. package/dist/package.json.cjs +5 -0
  25. package/dist/package.json.cjs.map +1 -0
  26. package/dist/pages/{PrismicPreview.mjs → PrismicPreview.cjs} +20 -20
  27. package/dist/pages/{PrismicPreview.mjs.map → PrismicPreview.cjs.map} +1 -1
  28. package/dist/pages/{enableAutoPreviews.mjs → enableAutoPreviews.cjs} +4 -4
  29. package/dist/pages/{enableAutoPreviews.mjs.map → enableAutoPreviews.cjs.map} +1 -1
  30. package/dist/pages/{exitPreview.mjs → exitPreview.cjs} +4 -4
  31. package/dist/pages/{exitPreview.mjs.map → exitPreview.cjs.map} +1 -1
  32. package/dist/pages/{redirectToPreviewURL.mjs → redirectToPreviewURL.cjs} +4 -4
  33. package/dist/pages/{redirectToPreviewURL.mjs.map → redirectToPreviewURL.cjs.map} +1 -1
  34. package/dist/pages/setPreviewData.cjs +11 -0
  35. package/dist/pages/{setPreviewData.mjs.map → setPreviewData.cjs.map} +1 -1
  36. package/dist/pages.cjs +21 -0
  37. package/dist/pages.cjs.map +1 -0
  38. package/dist/redirectToPreviewURL.cjs +46 -0
  39. package/dist/{redirectToPreviewURL.mjs.map → redirectToPreviewURL.cjs.map} +1 -1
  40. package/package.json +3 -4
  41. package/src/PrismicNextImage.tsx +9 -4
  42. package/src/PrismicNextLink.tsx +6 -2
  43. package/src/PrismicPreview.tsx +4 -1
  44. package/src/lib/resolveCJS.ts +12 -0
  45. package/dist/PrismicNextImage.mjs.map +0 -1
  46. package/dist/PrismicNextLink.mjs +0 -21
  47. package/dist/PrismicNextLink.mjs.map +0 -1
  48. package/dist/PrismicPreview.mjs +0 -15
  49. package/dist/PrismicPreview.mjs.map +0 -1
  50. package/dist/createLocaleRedirect.mjs +0 -8
  51. package/dist/enableAutoPreviews.mjs +0 -29
  52. package/dist/exitPreview.mjs +0 -13
  53. package/dist/imgixLoader.mjs +0 -17
  54. package/dist/index.mjs +0 -19
  55. package/dist/index.mjs.map +0 -1
  56. package/dist/lib/devMsg.mjs +0 -8
  57. package/dist/package.json.mjs +0 -5
  58. package/dist/package.json.mjs.map +0 -1
  59. package/dist/pages/setPreviewData.mjs +0 -11
  60. package/dist/pages.mjs +0 -21
  61. package/dist/pages.mjs.map +0 -1
  62. package/dist/redirectToPreviewURL.mjs +0 -24
@@ -1,12 +1,14 @@
1
1
  "use client";
2
- import { jsx, Fragment } from "react/jsx-runtime";
3
- import { forwardRef } from "react";
4
- import Image from "next/image";
5
- import { buildURL } from "imgix-url-builder";
6
- import { isFilled } from "@prismicio/client";
7
- import { DEV } from "esm-env";
8
- import { devMsg } from "./lib/devMsg.mjs";
9
- import { imgixLoader } from "./imgixLoader.mjs";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const react = require("react");
6
+ const Image = require("next/image");
7
+ const imgixUrlBuilder = require("imgix-url-builder");
8
+ const client = require("@prismicio/client");
9
+ const devMsg = require("./lib/devMsg.cjs");
10
+ const resolveCJS = require("./lib/resolveCJS.cjs");
11
+ const imgixLoader = require("./imgixLoader.cjs");
10
12
  const castInt = (input) => {
11
13
  if (typeof input === "number" || typeof input === "undefined") {
12
14
  return input;
@@ -19,17 +21,17 @@ const castInt = (input) => {
19
21
  }
20
22
  }
21
23
  };
22
- const PrismicNextImage = forwardRef(function PrismicNextImage2({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, loader = imgixLoader, ...restProps }, ref) {
23
- if (DEV) {
24
+ const PrismicNextImage = react.forwardRef(function PrismicNextImage2({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, loader = imgixLoader.imgixLoader, ...restProps }, ref) {
25
+ if (process.env.NODE_ENV === "development") {
24
26
  if (typeof alt === "string" && alt !== "") {
25
- console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
27
+ console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg.devMsg("alt-must-be-an-empty-string")}`);
26
28
  }
27
29
  if (typeof fallbackAlt === "string" && fallbackAlt !== "") {
28
- console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
30
+ console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg.devMsg("alt-must-be-an-empty-string")}`);
29
31
  }
30
32
  }
31
- if (!isFilled.imageThumbnail(field)) {
32
- return jsx(Fragment, { children: fallback });
33
+ if (!client.isFilled.imageThumbnail(field)) {
34
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
33
35
  }
34
36
  const resolvedImgixParams = imgixParams;
35
37
  for (const x in imgixParams) {
@@ -37,7 +39,7 @@ const PrismicNextImage = forwardRef(function PrismicNextImage2({ field, imgixPar
37
39
  resolvedImgixParams[x] = void 0;
38
40
  }
39
41
  }
40
- const src = buildURL(field.url, imgixParams);
42
+ const src = imgixUrlBuilder.buildURL(field.url, imgixParams);
41
43
  const ar = field.dimensions.width / field.dimensions.height;
42
44
  const castedWidth = castInt(width);
43
45
  const castedHeight = castInt(height);
@@ -49,12 +51,11 @@ const PrismicNextImage = forwardRef(function PrismicNextImage2({ field, imgixPar
49
51
  resolvedWidth = castedHeight * ar;
50
52
  }
51
53
  const resolvedAlt = alt ?? (field.alt || fallbackAlt);
52
- if (DEV && typeof resolvedAlt !== "string") {
54
+ if (process.env.NODE_ENV === "development" && typeof resolvedAlt !== "string") {
53
55
  console.error(`[PrismicNextImage] The following image is missing an "alt" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \`alt=""\` or \`fallbackAlt=""\`.`, src);
54
56
  }
55
- return jsx(Image, { ref, src, width: fill ? void 0 : resolvedWidth, height: fill ? void 0 : resolvedHeight, alt: resolvedAlt, fill, loader: loader === null ? void 0 : loader, ...restProps });
57
+ const ResolvedImage = resolveCJS.resolveCJS(Image);
58
+ return jsxRuntime.jsx(ResolvedImage, { ref, src, width: fill ? void 0 : resolvedWidth, height: fill ? void 0 : resolvedHeight, alt: resolvedAlt, fill, loader: loader === null ? void 0 : loader, ...restProps });
56
59
  });
57
- export {
58
- PrismicNextImage
59
- };
60
- //# sourceMappingURL=PrismicNextImage.mjs.map
60
+ exports.PrismicNextImage = PrismicNextImage;
61
+ //# sourceMappingURL=PrismicNextImage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextImage.cjs","sources":["../src/PrismicNextImage.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n\tforwardRef,\n\tForwardRefExoticComponent,\n\tPropsWithoutRef,\n\tRefAttributes,\n} from \"react\";\nimport Image, { ImageProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\nimport { ImageFieldImage, isFilled } from \"@prismicio/client\";\n\nimport { devMsg } from \"./lib/devMsg\";\nimport { resolveCJS } from \"./lib/resolveCJS\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<\n\tImageProps,\n\t\"src\" | \"alt\" | \"loader\"\n> & {\n\t/** The Prismic Image field or thumbnail to render. */\n\tfield: ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null };\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n\n\tloader?: ImageProps[\"loader\"] | null;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n *\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\n// The type annotation is necessary to avoid a type reference issue.\nexport const PrismicNextImage: ForwardRefExoticComponent<\n\tPropsWithoutRef<PrismicNextImageProps> & RefAttributes<HTMLImageElement>\n> = forwardRef<HTMLImageElement, PrismicNextImageProps>(\n\tfunction PrismicNextImage(\n\t\t{\n\t\t\tfield,\n\t\t\timgixParams = {},\n\t\t\talt,\n\t\t\tfallbackAlt,\n\t\t\tfill,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tfallback = null,\n\t\t\tloader = imgixLoader,\n\t\t\t...restProps\n\t\t},\n\t\tref,\n\t) {\n\t\tif (process.env.NODE_ENV === \"development\") {\n\t\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!isFilled.imageThumbnail(field)) {\n\t\t\treturn <>{fallback}</>;\n\t\t}\n\n\t\tconst resolvedImgixParams = imgixParams;\n\t\tfor (const x in imgixParams) {\n\t\t\tif (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {\n\t\t\t\tresolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst src = buildURL(field.url, imgixParams as ImgixURLParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.height;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\t// A non-null assertion is required since we can't statically\n\t\t// know if an alt attribute is available.\n\t\tconst resolvedAlt = (alt ?? (field.alt || fallbackAlt))!;\n\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\ttypeof resolvedAlt !== \"string\"\n\t\t) {\n\t\t\tconsole.error(\n\t\t\t\t`[PrismicNextImage] The following image is missing an \"alt\" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \\`alt=\"\"\\` or \\`fallbackAlt=\"\"\\`.`,\n\t\t\t\tsrc,\n\t\t\t);\n\t\t}\n\n\t\tconst ResolvedImage = resolveCJS(Image);\n\n\t\treturn (\n\t\t\t<ResolvedImage\n\t\t\t\tref={ref}\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\talt={resolvedAlt}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={loader === null ? undefined : loader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t},\n);\n"],"names":["forwardRef","PrismicNextImage","imgixLoader","devMsg","isFilled","_jsx","_Fragment","buildURL","resolveCJS"],"mappings":";;;;;;;;;;;AAiBA,MAAM,UAAU,CAAC,UAA0D;AAC1E,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa;AACvD,WAAA;AAAA,EAAA,OACD;AACA,UAAA,SAAS,OAAO,SAAS,KAAK;AAEhC,QAAA,OAAO,MAAM,MAAM,GAAG;AAClB,aAAA;AAAA,IAAA,OACD;AACC,aAAA;AAAA,IAAA;AAAA,EACR;AAEF;AA2Da,MAAA,mBAETA,MAAAA,WACH,SAASC,kBACR,EACC,OACA,cAAc,CAAA,GACd,KACA,aACA,MACA,OACA,QACA,WAAW,MACX,SAASC,yBACT,GAAG,UAAS,GAEb,KAAG;AAEC,MAAA,QAAQ,IAAI,aAAa,eAAe;AAC3C,QAAI,OAAO,QAAQ,YAAY,QAAQ,IAAI;AAC1C,cAAQ,KACP,yQAAyQC,OAAAA,OACxQ,6BAA6B,CAC7B,EAAE;AAAA,IAAA;AAIL,QAAI,OAAO,gBAAgB,YAAY,gBAAgB,IAAI;AAC1D,cAAQ,KACP,ySAAySA,OAAAA,OACxS,6BAA6B,CAC7B,EAAE;AAAA,IAAA;AAAA,EAEL;AAGD,MAAI,CAACC,OAAA,SAAS,eAAe,KAAK,GAAG;AACpC,WAAOC,WAAA,IAAAC,WAAA,UAAA,EAAA,UAAG,UAAQ;AAAA,EAAA;AAGnB,QAAM,sBAAsB;AAC5B,aAAW,KAAK,aAAa;AACxB,QAAA,oBAAoB,CAAqC,MAAM,MAAM;AACxE,0BAAoB,CAAqC,IAAI;AAAA,IAAA;AAAA,EAC9D;AAGD,QAAM,MAAMC,gBAAA,SAAS,MAAM,KAAK,WAA6B;AAE7D,QAAM,KAAK,MAAM,WAAW,QAAQ,MAAM,WAAW;AAE/C,QAAA,cAAc,QAAQ,KAAK;AAC3B,QAAA,eAAe,QAAQ,MAAM;AAE/B,MAAA,gBAAgB,eAAe,MAAM,WAAW;AAChD,MAAA,iBAAiB,gBAAgB,MAAM,WAAW;AAElD,MAAA,eAAe,QAAQ,gBAAgB,MAAM;AAChD,qBAAiB,cAAc;AAAA,EACrB,WAAA,eAAe,QAAQ,gBAAgB,MAAM;AACvD,oBAAgB,eAAe;AAAA,EAAA;AAK1B,QAAA,cAAe,QAAQ,MAAM,OAAO;AAE1C,MACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,UACtB;AACO,YAAA,MACP,mNACA,GAAG;AAAA,EAAA;AAIC,QAAA,gBAAgBC,sBAAW,KAAK;AAGrC,SAAAH,eAAC,eAAa,EACb,KACA,KACA,OAAO,OAAO,SAAY,eAC1B,QAAQ,OAAO,SAAY,gBAC3B,KAAK,aACL,MACA,QAAQ,WAAW,OAAO,SAAY,QAAM,GACxC,UAAA,CAAS;AAGhB,CAAC;;"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const Link = require("next/link");
6
+ const client = require("@prismicio/client");
7
+ const resolveCJS = require("./lib/resolveCJS.cjs");
8
+ const PrismicNextLink = react.forwardRef(function PrismicNextLink2(props, ref) {
9
+ const { field, document, linkResolver, children, ...restProps } = props;
10
+ const { href: computedHref, rel: computedRel, ...attrs } = client.asLinkAttrs(field ?? document, {
11
+ linkResolver,
12
+ rel: typeof restProps.rel === "function" ? restProps.rel : void 0
13
+ });
14
+ const href = ("href" in restProps ? restProps.href : computedHref) || "";
15
+ let rel = computedRel;
16
+ if ("rel" in restProps && typeof restProps.rel !== "function") {
17
+ rel = restProps.rel;
18
+ }
19
+ const ResolvedLink = resolveCJS.resolveCJS(Link);
20
+ return jsxRuntime.jsx(ResolvedLink, { ref, ...attrs, ...restProps, href, rel, children: "children" in props ? children : field == null ? void 0 : field.text });
21
+ });
22
+ exports.PrismicNextLink = PrismicNextLink;
23
+ //# sourceMappingURL=PrismicNextLink.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextLink.cjs","sources":["../src/PrismicNextLink.tsx"],"sourcesContent":["import { ComponentProps, forwardRef } from \"react\";\nimport Link from \"next/link\";\nimport {\n\tAsLinkAttrsConfig,\n\tLinkField,\n\tLinkResolverFunction,\n\tPrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\";\n\nimport { resolveCJS } from \"./lib/resolveCJS\";\n\nexport type PrismicNextLinkProps = Omit<\n\tComponentProps<typeof Link>,\n\t\"field\" | \"document\" | \"href\" | \"rel\"\n> & {\n\tlinkResolver?: LinkResolverFunction;\n\trel?: string | AsLinkAttrsConfig[\"rel\"];\n} & (\n\t\t| {\n\t\t\t\tfield: LinkField | null | undefined;\n\t\t\t\tdocument?: never;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument: PrismicDocument | null | undefined;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument?: never;\n\t\t\t\thref: ComponentProps<typeof Link>[\"href\"];\n\t\t }\n\t);\n\nexport const PrismicNextLink = forwardRef<\n\tHTMLAnchorElement,\n\tPrismicNextLinkProps\n>(function PrismicNextLink(props, ref) {\n\tconst { field, document, linkResolver, children, ...restProps } = props;\n\tconst {\n\t\thref: computedHref,\n\t\trel: computedRel,\n\t\t...attrs\n\t} = asLinkAttrs(field ?? document, {\n\t\tlinkResolver,\n\t\trel: typeof restProps.rel === \"function\" ? restProps.rel : undefined,\n\t});\n\n\tconst href = (\"href\" in restProps ? restProps.href : computedHref) || \"\";\n\n\tlet rel = computedRel;\n\tif (\"rel\" in restProps && typeof restProps.rel !== \"function\") {\n\t\trel = restProps.rel;\n\t}\n\n\tconst ResolvedLink = resolveCJS(Link);\n\n\treturn (\n\t\t<ResolvedLink ref={ref} {...attrs} {...restProps} href={href} rel={rel}>\n\t\t\t{\"children\" in props ? children : field?.text}\n\t\t</ResolvedLink>\n\t);\n});\n"],"names":["forwardRef","PrismicNextLink","asLinkAttrs","resolveCJS","_jsx"],"mappings":";;;;;;;AAoCO,MAAM,kBAAkBA,MAAAA,WAG7B,SAASC,iBAAgB,OAAO,KAAG;AACpC,QAAM,EAAE,OAAO,UAAU,cAAc,UAAU,GAAG,cAAc;AAC5D,QAAA,EACL,MAAM,cACN,KAAK,aACL,GAAG,UACAC,OAAAA,YAAY,SAAS,UAAU;AAAA,IAClC;AAAA,IACA,KAAK,OAAO,UAAU,QAAQ,aAAa,UAAU,MAAM;AAAA,EAAA,CAC3D;AAED,QAAM,QAAQ,UAAU,YAAY,UAAU,OAAO,iBAAiB;AAEtE,MAAI,MAAM;AACV,MAAI,SAAS,aAAa,OAAO,UAAU,QAAQ,YAAY;AAC9D,UAAM,UAAU;AAAA,EAAA;AAGX,QAAA,eAAeC,sBAAW,IAAI;AAEpC,SACCC,WAAAA,IAAC,cAAY,EAAC,KAAc,GAAA,UAAW,WAAW,MAAY,eAC5D,cAAc,QAAQ,WAAW,+BAAO,MAAI;AAGhD,CAAC;;"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ const jsxRuntime = require("react/jsx-runtime");
26
+ const Script = require("next/script");
27
+ const client = require("@prismicio/client");
28
+ const resolveCJS = require("./lib/resolveCJS.cjs");
29
+ const PrismicPreviewClient = require("./PrismicPreviewClient.cjs");
30
+ const PrismicPreview = async (props) => {
31
+ const { repositoryName, children, ...otherProps } = props;
32
+ const { draftMode } = await import("next/headers");
33
+ const toolbarSrc = client.getToolbarSrc(repositoryName);
34
+ const isDraftMode = (await draftMode()).isEnabled;
35
+ const ResolvedScript = resolveCJS.resolveCJS(Script);
36
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(PrismicPreviewClient.PrismicPreviewClient, { repositoryName, isDraftMode, ...otherProps }), jsxRuntime.jsx(ResolvedScript, { src: toolbarSrc, strategy: "lazyOnload" })] });
37
+ };
38
+ exports.PrismicPreview = PrismicPreview;
39
+ //# sourceMappingURL=PrismicPreview.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreview.cjs","sources":["../src/PrismicPreview.tsx"],"sourcesContent":["import type { FC, ReactNode } from \"react\";\nimport Script from \"next/script\";\nimport { getToolbarSrc } from \"@prismicio/client\";\n\nimport { resolveCJS } from \"./lib/resolveCJS\";\nimport { PrismicPreviewClient } from \"./PrismicPreviewClient\";\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = async (props) => {\n\tconst { repositoryName, children, ...otherProps } = props;\n\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { draftMode } = await import(\"next/headers\");\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName);\n\tconst isDraftMode = (await draftMode()).isEnabled;\n\n\tconst ResolvedScript = resolveCJS(Script);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<PrismicPreviewClient\n\t\t\t\trepositoryName={repositoryName}\n\t\t\t\tisDraftMode={isDraftMode}\n\t\t\t\t{...otherProps}\n\t\t\t/>\n\t\t\t<ResolvedScript src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n"],"names":["getToolbarSrc","resolveCJS","_jsxs","_Fragment","_jsx","PrismicPreviewClient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCa,MAAA,iBAA0C,OAAO,UAAS;AACtE,QAAM,EAAE,gBAAgB,UAAU,GAAG,WAAe,IAAA;AAKpD,QAAM,EAAE,UAAA,IAAc,MAAM,OAAO,cAAc;AAE3C,QAAA,aAAaA,qBAAc,cAAc;AACzC,QAAA,eAAe,MAAM,UAAA,GAAa;AAElC,QAAA,iBAAiBC,sBAAW,MAAM;AAGvC,SAAAC,WAAA,KAAAC,qBAAA,EAAA,UAAA,CACE,UACDC,eAACC,qBAAAA,sBACA,EAAA,gBACA,aAAwB,GACpB,YAAU,GAEfD,eAAC,gBAAc,EAAC,KAAK,YAAY,UAAS,cAAe,CAAA,GAAA;AAG5D;;"}
@@ -1,11 +1,13 @@
1
1
  "use client";
2
- import { useEffect } from "react";
3
- import { cookie } from "@prismicio/client";
4
- import { useRouter } from "next/navigation";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const react = require("react");
5
+ const client = require("@prismicio/client");
6
+ const navigation = require("next/navigation");
5
7
  const PrismicPreviewClient = (props) => {
6
8
  const { repositoryName, isDraftMode, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" } = props;
7
- const { refresh } = useRouter();
8
- useEffect(() => {
9
+ const { refresh } = navigation.useRouter();
10
+ react.useEffect(() => {
9
11
  const controller = new AbortController();
10
12
  window.addEventListener("prismicPreviewUpdate", onUpdate, {
11
13
  signal: controller.signal
@@ -13,8 +15,8 @@ const PrismicPreviewClient = (props) => {
13
15
  window.addEventListener("prismicPreviewEnd", onEnd, {
14
16
  signal: controller.signal
15
17
  });
16
- const cookie2 = getPrismicPreviewCookie(window.document.cookie);
17
- const cookieRepositoryName = cookie2 ? (decodeURIComponent(cookie2).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0;
18
+ const cookie = getPrismicPreviewCookie(window.document.cookie);
19
+ const cookieRepositoryName = cookie ? (decodeURIComponent(cookie).match(/"([^"]+)\.prismic\.io"/) || [])[1] : void 0;
18
20
  const hasCookieForRepository = cookieRepositoryName === repositoryName;
19
21
  if (hasCookieForRepository && !isDraftMode) {
20
22
  console.log("starting preview link");
@@ -55,17 +57,15 @@ function getPrismicPreviewCookie(cookieJar) {
55
57
  }
56
58
  const cookies = cookieJar.split("; ");
57
59
  let value;
58
- for (const cookie$1 of cookies) {
59
- const parts = cookie$1.split("=");
60
+ for (const cookie of cookies) {
61
+ const parts = cookie.split("=");
60
62
  const name = readValue(parts[0]).replace(/%3D/g, "=");
61
- if (name === cookie.preview) {
63
+ if (name === client.cookie.preview) {
62
64
  value = readValue(parts.slice(1).join("="));
63
65
  continue;
64
66
  }
65
67
  }
66
68
  return value;
67
69
  }
68
- export {
69
- PrismicPreviewClient
70
- };
71
- //# sourceMappingURL=PrismicPreviewClient.mjs.map
70
+ exports.PrismicPreviewClient = PrismicPreviewClient;
71
+ //# sourceMappingURL=PrismicPreviewClient.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreviewClient.mjs","sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect } from \"react\";\nimport { cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/navigation\";\n\ntype PrismicPreviewClientProps = {\n\trepositoryName: string;\n\tisDraftMode: boolean;\n\tupdatePreviewURL?: string;\n\texitPreviewURL?: string;\n};\n\nexport const PrismicPreviewClient: FC<PrismicPreviewClientProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tisDraftMode,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t} = props;\n\n\tconst { refresh } = useRouter();\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\tconst cookie = getPrismicPreviewCookie(window.document.cookie);\n\t\tconst cookieRepositoryName = cookie\n\t\t\t? (decodeURIComponent(cookie).match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n\t\t\t: undefined;\n\t\tconst hasCookieForRepository = cookieRepositoryName === repositoryName;\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\tif (hasCookieForRepository && !isDraftMode) {\n\t\t\tconsole.log(\"starting preview link\");\n\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and draft mode\n\t\t\t// is active.\n\t\t\tglobalThis\n\t\t\t\t.fetch(updatePreviewURL, {\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tglobalThis\n\t\t\t\t.fetch(exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);\n\n\treturn null;\n};\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the\n * cookie.\n *\n * @returns The value of the cookie, if it exists.\n */\nfunction getPrismicPreviewCookie(cookieJar: string): string | undefined {\n\tfunction readValue(value: string): string {\n\t\treturn value.replace(/%3B/g, \";\");\n\t}\n\n\tconst cookies = cookieJar.split(\"; \");\n\n\tlet value: string | undefined;\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\");\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\");\n\n\t\tif (name === prismicCookie.preview) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"));\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn value;\n}\n"],"names":["cookie","value","prismicCookie"],"mappings":";;;;AAaa,MAAA,uBAAsD,CAAC,UAAS;AAC5E,QAAM,EACL,gBACA,aACA,mBAAmB,gBACnB,iBAAiB,wBACd;AAEE,QAAA,EAAE,QAAO,IAAK;AAEpB,YAAU,MAAK;AACR,UAAA,aAAa,IAAI;AAEhB,WAAA,iBAAiB,wBAAwB,UAAU;AAAA,MACzD,QAAQ,WAAW;AAAA,IAAA,CACnB;AACM,WAAA,iBAAiB,qBAAqB,OAAO;AAAA,MACnD,QAAQ,WAAW;AAAA,IAAA,CACnB;AAED,UAAMA,UAAS,wBAAwB,OAAO,SAAS,MAAM;AACvD,UAAA,uBAAuBA,WACzB,mBAAmBA,OAAM,EAAE,MAAM,wBAAwB,KAAK,CAAA,GAAI,CAAC,IACpE;AACH,UAAM,yBAAyB,yBAAyB;AAKpD,QAAA,0BAA0B,CAAC,aAAa;AAC3C,cAAQ,IAAI,uBAAuB;AAMnC,iBACE,MAAM,kBAAkB;AAAA,QACxB,UAAU;AAAA,QACV,QAAQ,WAAW;AAAA,MAAA,CACnB,EACA,KAAK,CAAC,QAAO;AACT,YAAA,IAAI,SAAS,kBAAkB;AAC1B,kBAAA,MACP,yDAAyD,gBAAgB,mBAAmB;AAG7F;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGH,aAAS,SAAS,OAAY;AAC7B,YAAM,eAAc;;;AAIrB,aAAS,MAAM,OAAY;AAC1B,YAAM,eAAc;AAElB,iBAAA,MAAM,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,EACnD,KAAK,CAAC,QAAO;AACT,YAAA,CAAC,IAAI,IAAI;AACJ,kBAAA,MACP,6DAA6D,cAAc,gCAAgC;AAG5G;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGI,WAAA,MAAM,WAAW;KACtB,CAAC,gBAAgB,aAAa,kBAAkB,gBAAgB,OAAO,CAAC;AAEpE,SAAA;AACR;AAUA,SAAS,wBAAwB,WAAiB;AACjD,WAAS,UAAUC,QAAa;AACxBA,WAAAA,OAAM,QAAQ,QAAQ,GAAG;AAAA,EAAA;AAG3B,QAAA,UAAU,UAAU,MAAM,IAAI;AAEhC,MAAA;AAEJ,aAAWD,YAAU,SAAS;AACvB,UAAA,QAAQA,SAAO,MAAM,GAAG;AACxB,UAAA,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,QAAQ,QAAQ,GAAG;AAEhD,QAAA,SAASE,OAAc,SAAS;AACnC,cAAQ,UAAU,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAC1C;AAAA,IAAA;AAAA,EACD;AAGM,SAAA;AACR;"}
1
+ {"version":3,"file":"PrismicPreviewClient.cjs","sources":["../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect } from \"react\";\nimport { cookie as prismicCookie } from \"@prismicio/client\";\nimport { useRouter } from \"next/navigation\";\n\ntype PrismicPreviewClientProps = {\n\trepositoryName: string;\n\tisDraftMode: boolean;\n\tupdatePreviewURL?: string;\n\texitPreviewURL?: string;\n};\n\nexport const PrismicPreviewClient: FC<PrismicPreviewClientProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tisDraftMode,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t} = props;\n\n\tconst { refresh } = useRouter();\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\tconst cookie = getPrismicPreviewCookie(window.document.cookie);\n\t\tconst cookieRepositoryName = cookie\n\t\t\t? (decodeURIComponent(cookie).match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n\t\t\t: undefined;\n\t\tconst hasCookieForRepository = cookieRepositoryName === repositoryName;\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\tif (hasCookieForRepository && !isDraftMode) {\n\t\t\tconsole.log(\"starting preview link\");\n\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and draft mode\n\t\t\t// is active.\n\t\t\tglobalThis\n\t\t\t\t.fetch(updatePreviewURL, {\n\t\t\t\t\tredirect: \"manual\",\n\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\trefresh();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tglobalThis\n\t\t\t\t.fetch(exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\t// noop\n\t\t\t\t});\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [repositoryName, isDraftMode, updatePreviewURL, exitPreviewURL, refresh]);\n\n\treturn null;\n};\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the\n * cookie.\n *\n * @returns The value of the cookie, if it exists.\n */\nfunction getPrismicPreviewCookie(cookieJar: string): string | undefined {\n\tfunction readValue(value: string): string {\n\t\treturn value.replace(/%3B/g, \";\");\n\t}\n\n\tconst cookies = cookieJar.split(\"; \");\n\n\tlet value: string | undefined;\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\");\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\");\n\n\t\tif (name === prismicCookie.preview) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"));\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn value;\n}\n"],"names":["useRouter","useEffect","value","prismicCookie"],"mappings":";;;;;;AAaa,MAAA,uBAAsD,CAAC,UAAS;AAC5E,QAAM,EACL,gBACA,aACA,mBAAmB,gBACnB,iBAAiB,wBACd;AAEE,QAAA,EAAE,QAAO,IAAKA;AAEpBC,QAAAA,UAAU,MAAK;AACR,UAAA,aAAa,IAAI;AAEhB,WAAA,iBAAiB,wBAAwB,UAAU;AAAA,MACzD,QAAQ,WAAW;AAAA,IAAA,CACnB;AACM,WAAA,iBAAiB,qBAAqB,OAAO;AAAA,MACnD,QAAQ,WAAW;AAAA,IAAA,CACnB;AAED,UAAM,SAAS,wBAAwB,OAAO,SAAS,MAAM;AACvD,UAAA,uBAAuB,UACzB,mBAAmB,MAAM,EAAE,MAAM,wBAAwB,KAAK,IAAI,CAAC,IACpE;AACH,UAAM,yBAAyB,yBAAyB;AAKpD,QAAA,0BAA0B,CAAC,aAAa;AAC3C,cAAQ,IAAI,uBAAuB;AAMnC,iBACE,MAAM,kBAAkB;AAAA,QACxB,UAAU;AAAA,QACV,QAAQ,WAAW;AAAA,MAAA,CACnB,EACA,KAAK,CAAC,QAAO;AACT,YAAA,IAAI,SAAS,kBAAkB;AAC1B,kBAAA,MACP,yDAAyD,gBAAgB,mBAAmB;AAG7F;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGH,aAAS,SAAS,OAAY;AAC7B,YAAM,eAAc;;;AAIrB,aAAS,MAAM,OAAY;AAC1B,YAAM,eAAc;AAElB,iBAAA,MAAM,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,EACnD,KAAK,CAAC,QAAO;AACT,YAAA,CAAC,IAAI,IAAI;AACJ,kBAAA,MACP,6DAA6D,cAAc,gCAAgC;AAG5G;AAAA,QAAA;;OAID,EACA,MAAM,MAAK;AAAA,MAAA,CAEX;AAAA,IAAA;AAGI,WAAA,MAAM,WAAW;KACtB,CAAC,gBAAgB,aAAa,kBAAkB,gBAAgB,OAAO,CAAC;AAEpE,SAAA;AACR;AAUA,SAAS,wBAAwB,WAAiB;AACjD,WAAS,UAAUC,QAAa;AACxBA,WAAAA,OAAM,QAAQ,QAAQ,GAAG;AAAA,EAAA;AAG3B,QAAA,UAAU,UAAU,MAAM,IAAI;AAEhC,MAAA;AAEJ,aAAW,UAAU,SAAS;AACvB,UAAA,QAAQ,OAAO,MAAM,GAAG;AACxB,UAAA,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,QAAQ,QAAQ,GAAG;AAEhD,QAAA,SAASC,cAAc,SAAS;AACnC,cAAQ,UAAU,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAC1C;AAAA,IAAA;AAAA,EACD;AAGM,SAAA;AACR;;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const devMsg = require("./lib/devMsg.cjs");
4
+ function createLocaleRedirect() {
5
+ throw new Error(`createLocaleRedirect() has been removed due to performance issues. See ${devMsg.devMsg("replace-createLocaleRedirect")} for more details.`);
6
+ }
7
+ exports.createLocaleRedirect = createLocaleRedirect;
8
+ //# sourceMappingURL=createLocaleRedirect.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createLocaleRedirect.mjs","sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\";\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect() {\n\tthrow new Error(\n\t\t`createLocaleRedirect() has been removed due to performance issues. See ${devMsg(\n\t\t\t\"replace-createLocaleRedirect\",\n\t\t)} for more details.`,\n\t);\n}\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport type CreateLocaleRedirectConfig = never;\n"],"names":[],"mappings":";SAMgB,uBAAoB;AACnC,QAAM,IAAI,MACT,0EAA0E,OACzE,8BAA8B,CAC9B,oBAAoB;AAEvB;"}
1
+ {"version":3,"file":"createLocaleRedirect.cjs","sources":["../src/createLocaleRedirect.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\";\n\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport function createLocaleRedirect() {\n\tthrow new Error(\n\t\t`createLocaleRedirect() has been removed due to performance issues. See ${devMsg(\n\t\t\t\"replace-createLocaleRedirect\",\n\t\t)} for more details.`,\n\t);\n}\n/**\n * @deprecated `createLocaleRedirect()` has been removed due to performance\n * issues.\n */\nexport type CreateLocaleRedirectConfig = never;\n"],"names":["devMsg"],"mappings":";;;SAMgB,uBAAoB;AACnC,QAAM,IAAI,MACT,0EAA0EA,OACzE,OAAA,8BAA8B,CAC9B,oBAAoB;AAEvB;;"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ const client = require("@prismicio/client");
26
+ function enableAutoPreviews(config) {
27
+ config.client.queryContentFromRef(async () => {
28
+ var _a;
29
+ const { cookies, draftMode } = await import("next/headers");
30
+ let isDraftModeEnabled = false;
31
+ try {
32
+ isDraftModeEnabled = (await draftMode()).isEnabled;
33
+ } catch {
34
+ return;
35
+ }
36
+ if (!isDraftModeEnabled) {
37
+ return;
38
+ }
39
+ const cookie = (_a = (await cookies()).get(client.cookie.preview)) == null ? void 0 : _a.value;
40
+ if (!cookie) {
41
+ return;
42
+ }
43
+ const isActiveCookie = cookie.includes("websitePreviewId=");
44
+ if (!isActiveCookie) {
45
+ return;
46
+ }
47
+ return cookie;
48
+ });
49
+ }
50
+ exports.enableAutoPreviews = enableAutoPreviews;
51
+ //# sourceMappingURL=enableAutoPreviews.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableAutoPreviews.mjs","sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\";\n\n/** Configuration for `enableAutoPreviews`. */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">;\n};\n\n/**\n * Configures a Prismic client to automatically query draft content during a\n * preview session.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\t// We use a function value so the cookie is checked on every\n\t// request. We don't have a static value to read from.\n\tconfig.client.queryContentFromRef(async () => {\n\t\t// Need this to avoid the following Next.js build-time error:\n\t\t// You're importing a component that needs next/headers. That only works\n\t\t// in a Server Component which is not supported in the pages/ directory.\n\t\tconst { cookies, draftMode } = await import(\"next/headers\");\n\n\t\tlet isDraftModeEnabled = false;\n\t\ttry {\n\t\t\tisDraftModeEnabled = (await draftMode()).isEnabled;\n\t\t} catch {\n\t\t\t// `draftMode()` may have been called in a palce that\n\t\t\t// does not have access to its async storage. This\n\t\t\t// occurs in places like `generateStaticParams()`. We\n\t\t\t// can ignore this case.\n\t\t\treturn;\n\t\t}\n\t\tif (!isDraftModeEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value;\n\t\tif (!cookie) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\");\n\t\tif (!isActiveCookie) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn cookie;\n\t});\n}\n"],"names":["cookie","prismicCookie"],"mappings":";AAiBM,SAAU,mBAAmB,QAAgC;AAG3D,SAAA,OAAO,oBAAoB,YAAW;;AAI5C,UAAM,EAAE,SAAS,cAAc,MAAM,OAAO,cAAc;AAE1D,QAAI,qBAAqB;AACrB,QAAA;AACmB,4BAAA,MAAM,aAAa;AAAA,IAAA,QAClC;AAKP;AAAA,IAAA;AAED,QAAI,CAAC,oBAAoB;AACxB;AAAA,IAAA;AAGD,UAAMA,YAAU,YAAM,QAAA,GAAW,IAAIC,OAAc,OAAO,MAA1C,mBAA6C;AAC7D,QAAI,CAACD,UAAQ;AACZ;AAAA,IAAA;AAGK,UAAA,iBAAiBA,SAAO,SAAS,mBAAmB;AAC1D,QAAI,CAAC,gBAAgB;AACpB;AAAA,IAAA;AAGM,WAAAA;AAAAA,EAAA,CACP;AACF;"}
1
+ {"version":3,"file":"enableAutoPreviews.cjs","sources":["../src/enableAutoPreviews.ts"],"sourcesContent":["import { type Client, cookie as prismicCookie } from \"@prismicio/client\";\n\n/** Configuration for `enableAutoPreviews`. */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">;\n};\n\n/**\n * Configures a Prismic client to automatically query draft content during a\n * preview session.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\t// We use a function value so the cookie is checked on every\n\t// request. We don't have a static value to read from.\n\tconfig.client.queryContentFromRef(async () => {\n\t\t// Need this to avoid the following Next.js build-time error:\n\t\t// You're importing a component that needs next/headers. That only works\n\t\t// in a Server Component which is not supported in the pages/ directory.\n\t\tconst { cookies, draftMode } = await import(\"next/headers\");\n\n\t\tlet isDraftModeEnabled = false;\n\t\ttry {\n\t\t\tisDraftModeEnabled = (await draftMode()).isEnabled;\n\t\t} catch {\n\t\t\t// `draftMode()` may have been called in a palce that\n\t\t\t// does not have access to its async storage. This\n\t\t\t// occurs in places like `generateStaticParams()`. We\n\t\t\t// can ignore this case.\n\t\t\treturn;\n\t\t}\n\t\tif (!isDraftModeEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value;\n\t\tif (!cookie) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\");\n\t\tif (!isActiveCookie) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn cookie;\n\t});\n}\n"],"names":["prismicCookie"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBM,SAAU,mBAAmB,QAAgC;AAG3D,SAAA,OAAO,oBAAoB,YAAW;;AAI5C,UAAM,EAAE,SAAS,cAAc,MAAM,OAAO,cAAc;AAE1D,QAAI,qBAAqB;AACrB,QAAA;AACmB,4BAAA,MAAM,aAAa;AAAA,IAAA,QAClC;AAKP;AAAA,IAAA;AAED,QAAI,CAAC,oBAAoB;AACxB;AAAA,IAAA;AAGD,UAAM,UAAU,YAAM,QAAA,GAAW,IAAIA,OAAA,OAAc,OAAO,MAA1C,mBAA6C;AAC7D,QAAI,CAAC,QAAQ;AACZ;AAAA,IAAA;AAGK,UAAA,iBAAiB,OAAO,SAAS,mBAAmB;AAC1D,QAAI,CAAC,gBAAgB;AACpB;AAAA,IAAA;AAGM,WAAA;AAAA,EAAA,CACP;AACF;;"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
+ async function exitPreview() {
26
+ const { draftMode } = await import("next/headers");
27
+ (await draftMode()).disable();
28
+ return new Response(JSON.stringify({ success: true }), {
29
+ headers: {
30
+ "Cache-Control": "no-store"
31
+ }
32
+ });
33
+ }
34
+ exports.exitPreview = exitPreview;
35
+ //# sourceMappingURL=exitPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.mjs","sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be\n * used in a Router Handler.\n *\n * @example\n *\n * ```typescript\n * // src/app/api/exit-preview/route.js\n *\n * import { exitPreview } from \"@prismicio/next\";\n *\n * export async function GET() {\n * \treturn await exitPreview();\n * }\n * ```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { draftMode } = await import(\"next/headers\");\n\n\t(await draftMode()).disable();\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t});\n}\n"],"names":[],"mappings":"AAgBA,eAAsB,cAAW;AAIhC,QAAM,EAAE,UAAA,IAAc,MAAM,OAAO,cAAc;AAEhD,GAAA,MAAM,UAAS,GAAI;AAGb,SAAA,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,KAAA,CAAM,GAAG;AAAA,IACtD,SAAS;AAAA,MACR,iBAAiB;AAAA,IAAA;AAAA,EACjB,CACD;AACF;"}
1
+ {"version":3,"file":"exitPreview.cjs","sources":["../src/exitPreview.ts"],"sourcesContent":["/**\n * Ends a Prismic preview session within a Next.js app. This function should be\n * used in a Router Handler.\n *\n * @example\n *\n * ```typescript\n * // src/app/api/exit-preview/route.js\n *\n * import { exitPreview } from \"@prismicio/next\";\n *\n * export async function GET() {\n * \treturn await exitPreview();\n * }\n * ```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { draftMode } = await import(\"next/headers\");\n\n\t(await draftMode()).disable();\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t});\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,eAAsB,cAAW;AAIhC,QAAM,EAAE,UAAA,IAAc,MAAM,OAAO,cAAc;AAEhD,GAAA,MAAM,UAAS,GAAI;AAGb,SAAA,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,KAAA,CAAM,GAAG;AAAA,IACtD,SAAS;AAAA,MACR,iBAAiB;AAAA,IAAA;AAAA,EACjB,CACD;AACF;;"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const imgixUrlBuilder = require("imgix-url-builder");
4
+ const imgixLoader = (args) => {
5
+ const url = new URL(args.src);
6
+ const params = {
7
+ fit: url.searchParams.get("fit") || "max",
8
+ w: args.width,
9
+ h: void 0
10
+ };
11
+ if (args.quality) {
12
+ params.q = args.quality;
13
+ }
14
+ return imgixUrlBuilder.buildURL(args.src, params);
15
+ };
16
+ exports.imgixLoader = imgixLoader;
17
+ //# sourceMappingURL=imgixLoader.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.mjs","sources":["../src/imgixLoader.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src);\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t};\n\n\tif (args.quality) {\n\t\tparams.q = args.quality;\n\t}\n\n\treturn buildURL(args.src, params);\n};\n"],"names":[],"mappings":";AAUa,MAAA,cAAc,CAAC,SAAkC;AAC7D,QAAM,MAAM,IAAI,IAAI,KAAK,GAAG;AAE5B,QAAM,SAAyB;AAAA,IAC9B,KAAM,IAAI,aAAa,IAAI,KAAK,KAA+B;AAAA,IAC/D,GAAG,KAAK;AAAA,IACR,GAAG;AAAA;AAGJ,MAAI,KAAK,SAAS;AACjB,WAAO,IAAI,KAAK;AAAA,EAAA;AAGV,SAAA,SAAS,KAAK,KAAK,MAAM;AACjC;"}
1
+ {"version":3,"file":"imgixLoader.cjs","sources":["../src/imgixLoader.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src);\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t};\n\n\tif (args.quality) {\n\t\tparams.q = args.quality;\n\t}\n\n\treturn buildURL(args.src, params);\n};\n"],"names":["buildURL"],"mappings":";;;AAUa,MAAA,cAAc,CAAC,SAAkC;AAC7D,QAAM,MAAM,IAAI,IAAI,KAAK,GAAG;AAE5B,QAAM,SAAyB;AAAA,IAC9B,KAAM,IAAI,aAAa,IAAI,KAAK,KAA+B;AAAA,IAC/D,GAAG,KAAK;AAAA,IACR,GAAG;AAAA;AAGJ,MAAI,KAAK,SAAS;AACjB,WAAO,IAAI,KAAK;AAAA,EAAA;AAGV,SAAAA,yBAAS,KAAK,KAAK,MAAM;AACjC;;"}
package/dist/index.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const exitPreview = require("./exitPreview.cjs");
4
+ const PrismicPreview = require("./PrismicPreview.cjs");
5
+ const PrismicNextLink = require("./PrismicNextLink.cjs");
6
+ const enableAutoPreviews = require("./enableAutoPreviews.cjs");
7
+ const redirectToPreviewURL = require("./redirectToPreviewURL.cjs");
8
+ const PrismicNextImage = require("./PrismicNextImage.cjs");
9
+ const imgixLoader = require("./imgixLoader.cjs");
10
+ const createLocaleRedirect = require("./createLocaleRedirect.cjs");
11
+ exports.exitPreview = exitPreview.exitPreview;
12
+ exports.PrismicPreview = PrismicPreview.PrismicPreview;
13
+ exports.PrismicNextLink = PrismicNextLink.PrismicNextLink;
14
+ exports.enableAutoPreviews = enableAutoPreviews.enableAutoPreviews;
15
+ exports.redirectToPreviewURL = redirectToPreviewURL.redirectToPreviewURL;
16
+ exports.PrismicNextImage = PrismicNextImage.PrismicNextImage;
17
+ exports.imgixLoader = imgixLoader.imgixLoader;
18
+ exports.createLocaleRedirect = createLocaleRedirect.createLocaleRedirect;
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _package = require("../package.json.cjs");
4
+ const devMsg = (slug) => {
5
+ return `https://prismic.dev/msg/next/v${_package.version}/${slug}`;
6
+ };
7
+ exports.devMsg = devMsg;
8
+ //# sourceMappingURL=devMsg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.mjs","sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string) => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"names":[],"mappings":";AAiBa,MAAA,SAAS,CAAC,SAAgB;AAC/B,SAAA,iCAAiC,OAAO,IAAI,IAAI;AACxD;"}
1
+ {"version":3,"file":"devMsg.cjs","sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string) => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`;\n};\n"],"names":["version"],"mappings":";;;AAiBa,MAAA,SAAS,CAAC,SAAgB;AAC/B,SAAA,iCAAiCA,SAAAA,OAAO,IAAI,IAAI;AACxD;;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function resolveCJS(mod) {
4
+ return "default" in mod ? mod.default : mod;
5
+ }
6
+ exports.resolveCJS = resolveCJS;
7
+ //# sourceMappingURL=resolveCJS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveCJS.cjs","sources":["../../src/lib/resolveCJS.ts"],"sourcesContent":["/**\n * Resolves a CommonJS import that might have a `default` property. This happens\n * when named and default exports are mixed in modules. Next.js seems to do this\n * in the exact set up `@prismicio/next` uses.\n *\n * This is _should_ be a temporary hack until Next.js and Node.js resolve their\n * ESM difficulties. This will likely not be removed any time soon.\n */\nexport function resolveCJS<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod;\n}\n"],"names":[],"mappings":";;AAQM,SAAU,WAAc,KAAM;AAE5B,SAAA,aAAc,MAAe,IAAY,UAAU;AAC3D;;"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves a CommonJS import that might have a `default` property. This happens
3
+ * when named and default exports are mixed in modules. Next.js seems to do this
4
+ * in the exact set up `@prismicio/next` uses.
5
+ *
6
+ * This is _should_ be a temporary hack until Next.js and Node.js resolve their
7
+ * ESM difficulties. This will likely not be removed any time soon.
8
+ */
9
+ export declare function resolveCJS<T>(mod: T): T;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const version = "2.0.1-alpha.1";
4
+ exports.version = version;
5
+ //# sourceMappingURL=package.json.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,13 +1,15 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import { useRouter } from "next/router";
4
- import Script from "next/script";
5
- import { getToolbarSrc, cookie } from "@prismicio/client";
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("react");
5
+ const router = require("next/router");
6
+ const Script = require("next/script");
7
+ const client = require("@prismicio/client");
6
8
  const PrismicPreview = (props) => {
7
9
  const { repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview", children } = props;
8
- const router = useRouter();
9
- const toolbarSrc = getToolbarSrc(repositoryName);
10
- useEffect(() => {
10
+ const router$1 = router.useRouter();
11
+ const toolbarSrc = client.getToolbarSrc(repositoryName);
12
+ react.useEffect(() => {
11
13
  const controller = new AbortController();
12
14
  window.addEventListener("prismicPreviewUpdate", onUpdate, {
13
15
  signal: controller.signal
@@ -15,12 +17,12 @@ const PrismicPreview = (props) => {
15
17
  window.addEventListener("prismicPreviewEnd", onEnd, {
16
18
  signal: controller.signal
17
19
  });
18
- if (window.location.href.startsWith(window.location.origin + router.basePath) && getPreviewCookieRepositoryName() === repositoryName && !router.isPreview) {
20
+ if (window.location.href.startsWith(window.location.origin + router$1.basePath) && getPreviewCookieRepositoryName() === repositoryName && !router$1.isPreview) {
19
21
  start();
20
22
  }
21
23
  function onEnd(event) {
22
24
  event.preventDefault();
23
- fetch(router.basePath + exitPreviewURL, { signal: controller.signal }).then((res) => {
25
+ fetch(router$1.basePath + exitPreviewURL, { signal: controller.signal }).then((res) => {
24
26
  if (!res.ok) {
25
27
  console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${exitPreviewURL}" API endpoint. Does it exist?`);
26
28
  return;
@@ -34,7 +36,7 @@ const PrismicPreview = (props) => {
34
36
  start();
35
37
  }
36
38
  function start() {
37
- fetch(router.basePath + updatePreviewURL, {
39
+ fetch(router$1.basePath + updatePreviewURL, {
38
40
  redirect: "manual",
39
41
  signal: controller.signal
40
42
  }).then((res) => {
@@ -47,18 +49,16 @@ const PrismicPreview = (props) => {
47
49
  });
48
50
  }
49
51
  function refresh() {
50
- router.replace(router.asPath, void 0, { scroll: false });
52
+ router$1.replace(router$1.asPath, void 0, { scroll: false });
51
53
  }
52
54
  return () => controller.abort();
53
- }, [exitPreviewURL, updatePreviewURL, repositoryName, router]);
54
- return jsxs(Fragment, { children: [children, jsx(Script, { src: toolbarSrc, strategy: "lazyOnload" })] });
55
+ }, [exitPreviewURL, updatePreviewURL, repositoryName, router$1]);
56
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(Script, { src: toolbarSrc, strategy: "lazyOnload" })] });
55
57
  };
56
58
  function getPreviewCookieRepositoryName() {
57
59
  var _a;
58
- const cookie$1 = (_a = window.document.cookie.split("; ").find((row) => row.startsWith(`${cookie.preview}=`))) == null ? void 0 : _a.split("=")[1];
59
- return (decodeURIComponent(cookie$1 ?? "").match(/"([^"]+)\.prismic\.io"/) || [])[1];
60
+ const cookie = (_a = window.document.cookie.split("; ").find((row) => row.startsWith(`${client.cookie.preview}=`))) == null ? void 0 : _a.split("=")[1];
61
+ return (decodeURIComponent(cookie ?? "").match(/"([^"]+)\.prismic\.io"/) || [])[1];
60
62
  }
61
- export {
62
- PrismicPreview
63
- };
64
- //# sourceMappingURL=PrismicPreview.mjs.map
63
+ exports.PrismicPreview = PrismicPreview;
64
+ //# sourceMappingURL=PrismicPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.mjs","sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { type ReactNode, useEffect, FC } from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\nimport { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\";\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props;\n\n\tconst router = useRouter();\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName);\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(\n\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tstart();\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false });\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1];\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) ||\n\t\t[])[1];\n}\n"],"names":["_jsxs","_Fragment","_jsx","cookie","prismicCookie"],"mappings":";;;;;AAsCa,MAAA,iBAA0C,CAAC,UAAS;AAChE,QAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;AAEJ,QAAM,SAAS,UAAS;AAElB,QAAA,aAAa,cAAc,cAAc;AAE/C,YAAU,MAAK;AACR,UAAA,aAAa,IAAI;AAEhB,WAAA,iBAAiB,wBAAwB,UAAU;AAAA,MACzD,QAAQ,WAAW;AAAA,IAAA,CACnB;AACM,WAAA,iBAAiB,qBAAqB,OAAO;AAAA,MACnD,QAAQ,WAAW;AAAA,IAAA,CACnB;AAQD,QACC,OAAO,SAAS,KAAK,WACpB,OAAO,SAAS,SAAS,OAAO,QAAQ,KAEzC,+BAA8B,MAAO,kBACrC,CAAC,OAAO,WACP;;;AAIF,aAAS,MAAM,OAAY;AAC1B,YAAM,eAAc;AACd,YAAA,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,OAAQ,CAAA,EACnE,KAAK,CAAC,QAAO;AACT,YAAA,CAAC,IAAI,IAAI;AACJ,kBAAA,MACP,6DAA6D,cAAc,gCAAgC;AAG5G;AAAA,QAAA;;OAID,EACA,MAAM,MAAO;AAAA,MAAA,CAAC;AAAA,IAAA;AAGjB,aAAS,SAAS,OAAY;AAC7B,YAAM,eAAc;;;AAIrB,aAAS,QAAK;AAKP,YAAA,OAAO,WAAW,kBAAkB;AAAA,QACzC,UAAU;AAAA,QACV,QAAQ,WAAW;AAAA,MAAA,CACnB,EACC,KAAK,CAAC,QAAO;AACT,YAAA,IAAI,SAAS,kBAAkB;AAC1B,kBAAA,MACP,mEAAmE,gBAAgB,mBAAmB;AAGvG;AAAA,QAAA;;OAID,EACA,MAAM,MAAO;AAAA,MAAA,CAAC;AAAA,IAAA;AAGjB,aAAS,UAAO;AACf,aAAO,QAAQ,OAAO,QAAQ,QAAW,EAAE,QAAQ,OAAO;AAAA,IAAA;AAGpD,WAAA,MAAM,WAAW;KACtB,CAAC,gBAAgB,kBAAkB,gBAAgB,MAAM,CAAC;AAE7D,SACCA,KACEC,UAAA,EAAA,UAAA,CAAA,UACDC,IAAC,QAAO,EAAA,KAAK,YAAY,UAAS,aAAe,CAAA,CAAA,GAAA;AAGpD;AAEA,SAAS,iCAA8B;;AAChC,QAAAC,YAAS,YAAO,SAAS,OAC7B,MAAM,IAAI,EACV,KAAK,CAAC,QAAQ,IAAI,WAAW,GAAGC,OAAc,OAAO,GAAG,CAAC,MAF5C,mBAGZ,MAAM,KAAK;AAEN,UAAA,mBAAmBD,YAAU,EAAE,EAAE,MAAM,wBAAwB,KACtE,CAAA,GAAI,CAAC;AACP;"}
1
+ {"version":3,"file":"PrismicPreview.cjs","sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { type ReactNode, useEffect, FC } from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\nimport { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\";\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props;\n\n\tconst router = useRouter();\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName);\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController();\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(\n\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart();\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault();\n\t\t\tstart();\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh();\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false });\n\t\t}\n\n\t\treturn () => controller.abort();\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n};\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1];\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) ||\n\t\t[])[1];\n}\n"],"names":["router","useRouter","getToolbarSrc","useEffect","_jsxs","_Fragment","_jsx","prismicCookie"],"mappings":";;;;;;;AAsCa,MAAA,iBAA0C,CAAC,UAAS;AAChE,QAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;AAEJ,QAAMA,WAASC,OAAAA,UAAS;AAElB,QAAA,aAAaC,qBAAc,cAAc;AAE/CC,QAAAA,UAAU,MAAK;AACR,UAAA,aAAa,IAAI;AAEhB,WAAA,iBAAiB,wBAAwB,UAAU;AAAA,MACzD,QAAQ,WAAW;AAAA,IAAA,CACnB;AACM,WAAA,iBAAiB,qBAAqB,OAAO;AAAA,MACnD,QAAQ,WAAW;AAAA,IAAA,CACnB;AAQD,QACC,OAAO,SAAS,KAAK,WACpB,OAAO,SAAS,SAASH,SAAO,QAAQ,KAEzC,+BAA8B,MAAO,kBACrC,CAACA,SAAO,WACP;;;AAIF,aAAS,MAAM,OAAY;AAC1B,YAAM,eAAc;AACd,YAAAA,SAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,OAAQ,CAAA,EACnE,KAAK,CAAC,QAAO;AACT,YAAA,CAAC,IAAI,IAAI;AACJ,kBAAA,MACP,6DAA6D,cAAc,gCAAgC;AAG5G;AAAA,QAAA;;OAID,EACA,MAAM,MAAO;AAAA,MAAA,CAAC;AAAA,IAAA;AAGjB,aAAS,SAAS,OAAY;AAC7B,YAAM,eAAc;;;AAIrB,aAAS,QAAK;AAKP,YAAAA,SAAO,WAAW,kBAAkB;AAAA,QACzC,UAAU;AAAA,QACV,QAAQ,WAAW;AAAA,MAAA,CACnB,EACC,KAAK,CAAC,QAAO;AACT,YAAA,IAAI,SAAS,kBAAkB;AAC1B,kBAAA,MACP,mEAAmE,gBAAgB,mBAAmB;AAGvG;AAAA,QAAA;;OAID,EACA,MAAM,MAAO;AAAA,MAAA,CAAC;AAAA,IAAA;AAGjB,aAAS,UAAO;AACfA,eAAO,QAAQA,SAAO,QAAQ,QAAW,EAAE,QAAQ,OAAO;AAAA,IAAA;AAGpD,WAAA,MAAM,WAAW;KACtB,CAAC,gBAAgB,kBAAkB,gBAAgBA,QAAM,CAAC;AAE7D,SACCI,gBACEC,WAAA,UAAA,EAAA,UAAA,CAAA,UACDC,WAAC,IAAA,QAAO,EAAA,KAAK,YAAY,UAAS,aAAe,CAAA,CAAA,GAAA;AAGpD;AAEA,SAAS,iCAA8B;;AAChC,QAAA,UAAS,YAAO,SAAS,OAC7B,MAAM,IAAI,EACV,KAAK,CAAC,QAAQ,IAAI,WAAW,GAAGC,cAAc,OAAO,GAAG,CAAC,MAF5C,mBAGZ,MAAM,KAAK;AAEN,UAAA,mBAAmB,UAAU,EAAE,EAAE,MAAM,wBAAwB,KACtE,CAAA,GAAI,CAAC;AACP;;"}