slice-machine-ui 2.19.2-alpha.xru-unskip-e2e-test-redirection.3 → 2.19.2-beta.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.
Files changed (31) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/4ZbwQOH1s2JwSCJTqy_83/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/125-00b909bdbab2ca15.js +1 -0
  4. package/out/_next/static/chunks/{344-fdb3008f4bb3b0c1.js → 344-b64f09e670634ed1.js} +1 -1
  5. package/out/_next/static/chunks/{500-d3989390f5e8da53.js → 444-d39213143f782fec.js} +1 -1
  6. package/out/_next/static/chunks/66-d9d3bcb5d041cb6d.js +1 -0
  7. package/out/_next/static/chunks/907-bf4215e6fc238ea0.js +1 -0
  8. package/out/_next/static/chunks/pages/{_app-16f6b4e78aee4de1.js → _app-83c4f5b209504941.js} +1 -1
  9. package/out/_next/static/chunks/pages/{changes-8af4acbb8f974cb2.js → changes-7f24b37f5bf872ae.js} +1 -1
  10. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-af9376721beb489e.js → [customTypeId]-1b47424a37b49dff.js} +1 -1
  11. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-a24665e91b882169.js → [pageTypeId]-385f933c203e8b16.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-e973a443d8b8a75d.js → [variation]-08cdeefc96106c0c.js} +1 -1
  13. package/out/_next/static/chunks/pages/{slices-81c1c3f1bcad60f4.js → slices-bedcb854fbdca8cd.js} +1 -1
  14. package/out/changelog.html +1 -1
  15. package/out/changes.html +1 -1
  16. package/out/custom-types/[customTypeId].html +1 -1
  17. package/out/custom-types.html +1 -1
  18. package/out/index.html +1 -1
  19. package/out/labs.html +1 -1
  20. package/out/page-types/[pageTypeId].html +1 -1
  21. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  22. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  23. package/out/slices.html +1 -1
  24. package/package.json +3 -3
  25. package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +218 -42
  26. package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/SliceCard.tsx +1 -1
  27. package/test/__setup__.ts +7 -0
  28. package/out/_next/static/chunks/907-180eb33eefccc237.js +0 -1
  29. package/out/_next/static/chunks/918-fa4f2563cb5fd014.js +0 -1
  30. package/out/_next/static/ozLxtHVNjWiKZIA1HFFVA/_buildManifest.js +0 -1
  31. /package/out/_next/static/{ozLxtHVNjWiKZIA1HFFVA → 4ZbwQOH1s2JwSCJTqy_83}/_ssgManifest.js +0 -0
@@ -18,12 +18,15 @@ import {
18
18
  } from "@prismicio/editor-ui";
19
19
  import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
20
20
  import { useEffect, useRef, useState } from "react";
21
+ import { useHotkeys } from "react-hotkeys-hook";
21
22
  import { toast } from "react-toastify";
23
+ import { z } from "zod";
22
24
 
23
25
  import { getState, telemetry } from "@/apiClient";
24
26
  import { addAiFeedback } from "@/features/aiFeedback";
25
27
  import { useOnboarding } from "@/features/onboarding/useOnboarding";
26
28
  import { useAutoSync } from "@/features/sync/AutoSyncProvider";
29
+ import { useExperimentVariant } from "@/hooks/useExperimentVariant";
27
30
  import { managerClient } from "@/managerClient";
28
31
  import useSliceMachineActions from "@/modules/useSliceMachineActions";
29
32
 
@@ -44,6 +47,12 @@ interface CreateSliceFromImageModalProps {
44
47
  onClose: () => void;
45
48
  }
46
49
 
50
+ const clipboardDataSchema = z.object({
51
+ __type: z.literal("figma-to-prismic/clipboard-data"),
52
+ name: z.string(),
53
+ image: z.string().startsWith("data:image/"),
54
+ });
55
+
47
56
  export function CreateSliceFromImageModal(
48
57
  props: CreateSliceFromImageModalProps,
49
58
  ) {
@@ -53,6 +62,7 @@ export function CreateSliceFromImageModal(
53
62
  const { syncChanges } = useAutoSync();
54
63
  const { createSliceSuccess } = useSliceMachineActions();
55
64
  const { completeStep } = useOnboarding();
65
+ const isFigmaEnabled = useIsFigmaEnabled();
56
66
 
57
67
  /**
58
68
  * Keeps track of the current instance id.
@@ -60,6 +70,15 @@ export function CreateSliceFromImageModal(
60
70
  */
61
71
  const id = useRef(crypto.randomUUID());
62
72
 
73
+ useHotkeys(
74
+ ["meta+v", "ctrl+v"],
75
+ (event) => {
76
+ event.preventDefault();
77
+ void handlePaste();
78
+ },
79
+ { enabled: open && isFigmaEnabled },
80
+ );
81
+
63
82
  const setSlice = (args: {
64
83
  index: number;
65
84
  slice: (prevSlice: Slice) => Slice;
@@ -85,16 +104,23 @@ export function CreateSliceFromImageModal(
85
104
 
86
105
  setSlices(
87
106
  images.map((image) => ({
107
+ source: "upload",
88
108
  status: "uploading",
89
109
  image,
90
110
  })),
91
111
  );
92
112
 
93
- images.forEach((image, index) => uploadImage({ index, image }));
113
+ images.forEach((image, index) =>
114
+ uploadImage({ index, image, source: "upload" }),
115
+ );
94
116
  };
95
117
 
96
- const uploadImage = (args: { index: number; image: File }) => {
97
- const { index, image } = args;
118
+ const uploadImage = (args: {
119
+ index: number;
120
+ image: File;
121
+ source: "upload" | "figma";
122
+ }) => {
123
+ const { index, image, source } = args;
98
124
  const currentId = id.current;
99
125
 
100
126
  setSlice({
@@ -102,13 +128,14 @@ export function CreateSliceFromImageModal(
102
128
  slice: (prevSlice) => ({
103
129
  ...prevSlice,
104
130
  status: "uploading",
131
+ source,
105
132
  }),
106
133
  });
107
134
 
108
135
  getImageUrl({ image }).then(
109
136
  (imageUrl) => {
110
137
  if (currentId !== id.current) return;
111
- inferSlice({ index, imageUrl });
138
+ void inferSlice({ index, imageUrl, source });
112
139
  },
113
140
  () => {
114
141
  if (currentId !== id.current) return;
@@ -117,7 +144,7 @@ export function CreateSliceFromImageModal(
117
144
  slice: (prevSlice) => ({
118
145
  ...prevSlice,
119
146
  status: "uploadError",
120
- onRetry: () => uploadImage({ index, image }),
147
+ onRetry: () => uploadImage({ index, image, source }),
121
148
  }),
122
149
  });
123
150
  },
@@ -126,10 +153,16 @@ export function CreateSliceFromImageModal(
126
153
 
127
154
  const existingSlices = useExistingSlices({ open });
128
155
 
129
- const inferSlice = (args: { index: number; imageUrl: string }) => {
130
- const { index, imageUrl } = args;
156
+ const inferSlice = async (args: {
157
+ index: number;
158
+ imageUrl: string;
159
+ source: "upload" | "figma";
160
+ }) => {
161
+ const { index, imageUrl, source } = args;
131
162
  const currentId = id.current;
132
163
 
164
+ const libraryID = await getLibraryID();
165
+
133
166
  setSlice({
134
167
  index,
135
168
  slice: (prevSlice) => ({
@@ -139,46 +172,52 @@ export function CreateSliceFromImageModal(
139
172
  }),
140
173
  });
141
174
 
142
- managerClient.customTypes.inferSlice({ imageUrl }).then(
143
- ({ slice, langSmithUrl }) => {
144
- if (currentId !== id.current) return;
175
+ try {
176
+ const inferResult = await managerClient.customTypes.inferSlice({
177
+ imageUrl,
178
+ source,
179
+ libraryID,
180
+ });
181
+ if (currentId !== id.current) return;
145
182
 
146
- setSlices((prevSlices) =>
147
- prevSlices.map((prevSlice, i) =>
148
- i === index
149
- ? {
150
- ...prevSlice,
151
- status: "success",
152
- thumbnailUrl: imageUrl,
153
- model: sliceWithoutConflicts({
154
- existingSlices: existingSlices.current,
155
- newSlices: prevSlices,
156
- slice,
157
- }),
158
- langSmithUrl,
159
- }
160
- : prevSlice,
161
- ),
162
- );
163
- },
164
- () => {
165
- if (currentId !== id.current) return;
166
- setSlice({
167
- index,
168
- slice: (prevSlice) => ({
169
- ...prevSlice,
170
- status: "generateError",
171
- thumbnailUrl: imageUrl,
172
- onRetry: () => inferSlice({ index, imageUrl }),
173
- }),
174
- });
175
- },
176
- );
183
+ const model = sliceWithoutConflicts({
184
+ existingSlices: existingSlices.current,
185
+ newSlices: slices,
186
+ slice: inferResult.slice,
187
+ });
188
+
189
+ setSlices((prevSlices) =>
190
+ prevSlices.map((prevSlice, i) =>
191
+ i === index
192
+ ? {
193
+ ...prevSlice,
194
+ status: "success",
195
+ thumbnailUrl: imageUrl,
196
+ langSmithUrl: inferResult.langSmithUrl,
197
+ model,
198
+ }
199
+ : prevSlice,
200
+ ),
201
+ );
202
+ } catch {
203
+ if (currentId !== id.current) return;
204
+ setSlice({
205
+ index,
206
+ slice: (prevSlice) => ({
207
+ ...prevSlice,
208
+ status: "generateError",
209
+ thumbnailUrl: imageUrl,
210
+ onRetry: () => void inferSlice({ index, imageUrl, source }),
211
+ }),
212
+ });
213
+ }
177
214
  };
178
215
 
179
216
  const onSubmit = () => {
180
217
  const newSlices = slices.reduce<NewSlice[]>((acc, slice) => {
181
- if (slice.status === "success") acc.push(slice);
218
+ if (slice.status === "success" && slice.source === "upload") {
219
+ acc.push(slice);
220
+ }
182
221
  return acc;
183
222
  }, []);
184
223
  if (!newSlices.length) return;
@@ -228,6 +267,128 @@ export function CreateSliceFromImageModal(
228
267
  });
229
268
  };
230
269
 
270
+ const handlePaste = async () => {
271
+ if (
272
+ !open ||
273
+ !isFigmaEnabled ||
274
+ // For now we only support one Figma slice at a time
275
+ slices.some((slice) => slice.source === "figma")
276
+ ) {
277
+ return;
278
+ }
279
+
280
+ // Don't allow pasting while uploads or generation are in progress
281
+ const isLoading = slices.some(
282
+ (slice) => slice.status === "uploading" || slice.status === "generating",
283
+ );
284
+ if (isLoading) return;
285
+
286
+ const supportsClipboardRead =
287
+ typeof navigator.clipboard?.read === "function";
288
+
289
+ if (!supportsClipboardRead) {
290
+ toast.error("Clipboard paste is not supported in this browser.");
291
+ return;
292
+ }
293
+
294
+ try {
295
+ const clipboardItems = await navigator.clipboard.read();
296
+ if (clipboardItems.length === 0) {
297
+ toast.error("No data found in clipboard.");
298
+ return;
299
+ }
300
+
301
+ let imageName = "pasted-image.png";
302
+ let imageBlob: Blob | null = null;
303
+ let success = false;
304
+
305
+ // Method 1: Try to extract image from clipboard image/png blob (preferred)
306
+ for (const item of clipboardItems) {
307
+ const imageType = item.types.find((type) => type.startsWith("image/"));
308
+ if (imageType !== undefined) {
309
+ imageBlob = await item.getType(imageType);
310
+ break;
311
+ }
312
+ }
313
+
314
+ // Method 2: Read JSON from text/plain to get metadata and base64 image as fallback
315
+ for (const item of clipboardItems) {
316
+ if (item.types.includes("text/plain")) {
317
+ try {
318
+ const textBlob = await item.getType("text/plain");
319
+ const text = await textBlob.text();
320
+
321
+ const result = clipboardDataSchema.safeParse(JSON.parse(text));
322
+ if (result.success) {
323
+ success = true;
324
+ const data = result.data;
325
+ imageName = `${data.name}.png`;
326
+
327
+ // Use base64 image as fallback if no blob was found
328
+ if (!imageBlob) {
329
+ const response = await fetch(data.image);
330
+ imageBlob = await response.blob();
331
+ }
332
+ } else {
333
+ console.warn("Clipboard data validation failed:", result.error);
334
+ }
335
+ } catch (error) {
336
+ console.warn("Failed to parse JSON from clipboard:", error);
337
+ // Continue - we may still have imageBlob from Method 1
338
+ }
339
+ }
340
+ }
341
+
342
+ if (!imageBlob) {
343
+ if (success) {
344
+ toast.error(
345
+ "Could not extract Figma data from clipboard. Please try copying again using the Prismic Figma plugin.",
346
+ );
347
+ } else {
348
+ toast.error(
349
+ "No Figma data found in clipboard. Make sure you've copied a design using the Prismic Figma plugin.",
350
+ );
351
+ }
352
+ return;
353
+ }
354
+
355
+ // Check if we're at the limit
356
+ const currentSliceCount = slices.length;
357
+ if (currentSliceCount >= IMAGE_UPLOAD_LIMIT) {
358
+ toast.error(
359
+ `You can only upload ${IMAGE_UPLOAD_LIMIT} images at a time.`,
360
+ );
361
+ return;
362
+ }
363
+
364
+ // Create File object from blob and append to existing slices
365
+ const imageData = new File([imageBlob], imageName, {
366
+ type: imageBlob.type,
367
+ });
368
+ const newIndex = currentSliceCount;
369
+
370
+ // Append new slice to existing ones
371
+ setSlices((prevSlices) => [
372
+ ...prevSlices,
373
+ {
374
+ source: "figma",
375
+ status: "uploading",
376
+ image: imageData,
377
+ },
378
+ ]);
379
+
380
+ // Start uploading the new image
381
+ void uploadImage({ index: newIndex, image: imageData, source: "figma" });
382
+
383
+ toast.success(`Pasted ${imageName}${success ? " from Figma" : ""}`);
384
+ } catch (error) {
385
+ console.error("Failed to paste from clipboard:", error);
386
+ toast.error(
387
+ "Failed to paste from clipboard. Please check browser permissions and try again.",
388
+ );
389
+ }
390
+ };
391
+
231
392
  const areSlicesLoading = slices.some(
232
393
  (slice) => slice.status === "uploading" || slice.status === "generating",
233
394
  );
@@ -472,3 +633,18 @@ const getSubmitButtonLabel = (
472
633
  return "Add to slices";
473
634
  }
474
635
  };
636
+
637
+ function useIsFigmaEnabled() {
638
+ const experiment = useExperimentVariant("llm-proxy-access");
639
+ return experiment?.value === "on";
640
+ }
641
+
642
+ function getLibraryID() {
643
+ return managerClient.project.getSliceMachineConfig().then((smConfig) => {
644
+ const libraryID = smConfig?.libraries?.[0];
645
+ if (libraryID === undefined) {
646
+ throw new Error("No library found in the config.");
647
+ }
648
+ return libraryID;
649
+ });
650
+ }
@@ -45,7 +45,7 @@ export function SliceCard(props: SliceCardProps) {
45
45
  );
46
46
  }
47
47
 
48
- export type Slice = { image: File } & (
48
+ export type Slice = { image: File; source: "upload" | "figma" } & (
49
49
  | { status: "uploading" }
50
50
  | { status: "uploadError"; onRetry: () => void }
51
51
  | { status: "generating"; thumbnailUrl: string }
package/test/__setup__.ts CHANGED
@@ -144,6 +144,13 @@ vi.mock("@segment/analytics-node", () => {
144
144
  };
145
145
  });
146
146
 
147
+ vi.mock("@anthropic-ai/claude-agent-sdk", () => {
148
+ return {
149
+ createClient: vi.fn(),
150
+ Agent: vi.fn(),
151
+ };
152
+ });
153
+
147
154
  // We have to manually set this environment variable as there's no equivalent of
148
155
  // `next/jest` for Vitest. It means Vitest doesn't read Next.js's configuration
149
156
  // file and (in our case) the `experimental.newNextLinkBehavior` setting.
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[907],{91589:function(e,t,a){a.d(t,{S:function(){return h}});var r=a(52322),n=a(11699),i=a(2784),s=a(88932),l=a(94160),c=a(34166),o=a(98250),d=a(68968),u=a(80148),m=a(54597),p=a(62434);function g(e){let{slice:t}=e,a="uploading"===t.status||"generating"===t.status,i="uploadError"===t.status||"generateError"===t.status,s="generateError"===t.status||"generating"===t.status||"success"===t.status;return(0,r.jsxs)(p.Zb,{disabled:a,children:[s?(0,r.jsx)(p.ZB,{src:t.thumbnailUrl}):(0,r.jsx)(p.ZB,{component:"div"}),(0,r.jsx)(p.eW,{loading:a,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:t.image.name,subtitle:function(e){switch(e){case"uploading":return"Uploading...";case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t.status),error:i,action:i?(0,r.jsx)(n.E,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):void 0})]})}function h(e){let{open:t,location:a,onSuccess:p,onClose:h}=e,[j,w]=(0,i.useState)([]),[b,C]=(0,i.useState)(!1),{syncChanges:v}=(0,d.g)(),{createSliceSuccess:I}=(0,m.Z)(),{completeStep:A}=(0,o.k)(),k=(0,i.useRef)(crypto.randomUUID()),E=e=>{let{index:t,slice:a}=e;w(e=>e.map((e,r)=>r===t?a(e):e))},U=e=>{if(e.length>10){s.Am.error("You can only upload ".concat(10," images at a time."));return}w(e.map(e=>({status:"uploading",image:e}))),e.forEach((e,t)=>N({index:t,image:e}))},N=e=>{let{index:t,image:a}=e,r=k.current;E({index:t,slice:e=>({...e,status:"uploading"})}),x({image:a}).then(e=>{r===k.current&&D({index:t,imageUrl:e})},()=>{r===k.current&&E({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>N({index:t,image:a})})})})},L=function(e){let{open:t}=e,a=(0,i.useRef)([]);return(0,i.useEffect)(()=>{t&&(a.current=[],u.managerClient.slices.readAllSlices().then(e=>{a.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),a}({open:t}),D=e=>{let{index:t,imageUrl:a}=e,r=k.current;E({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:a})}),u.managerClient.customTypes.inferSlice({imageUrl:a}).then(e=>{let{slice:n,langSmithUrl:i}=e;r===k.current&&w(e=>e.map((r,s)=>s===t?{...r,status:"success",thumbnailUrl:a,model:function(e){let{existingSlices:t,newSlices:a,slice:r}=e,n=new Set,i=new Set;for(let{id:e,name:a}of t)n.add(e),i.add(a.toLowerCase());for(let e of a)"success"===e.status&&(n.add(e.model.id),i.add(e.model.name.toLowerCase()));let s=r.id,l=2;for(;n.has(s);)s="".concat(r.id,"_").concat(l),l++;let c=r.name;for(l=2;i.has(c.toLowerCase());)c="".concat(r.name).concat(l),l++;return{...r,id:s,name:c}}({existingSlices:L.current,newSlices:e,slice:n}),langSmithUrl:i}:r))},()=>{r===k.current&&E({index:t,slice:e=>({...e,status:"generateError",thumbnailUrl:a,onRetry:()=>D({index:t,imageUrl:a})})})})},B=j.some(e=>"uploading"===e.status||"generating"===e.status),F=j.filter(e=>"success"===e.status),z=F.length>0;return(0,r.jsxs)(n.ae,{open:t,onOpenChange:e=>{e||b||(h(),k.current=crypto.randomUUID(),w([]))},children:[(0,r.jsx)(n.al,{title:"Generate from image"}),(0,r.jsxs)(n.aj,{gap:0,children:[(0,r.jsx)(n.ak,{hidden:!0,children:"Upload images to generate slices with AI"}),0===j.length?(0,r.jsx)(n.D,{padding:16,height:"100%",children:(0,r.jsx)(n.aF,{onFilesSelected:U,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(f,{onFilesSelected:U,droppingFiles:!0}),children:(0,r.jsx)(f,{onFilesSelected:U})})}):(0,r.jsx)(n.bn,{stableScrollbar:!1,children:(0,r.jsx)(n.D,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:j.map((e,t)=>(0,r.jsx)(g,{slice:e},"slice-".concat(t)))})}),(0,r.jsxs)(n.ah,{children:[(0,r.jsx)(n.ai,{disabled:b}),(0,r.jsxs)(n.af,{disabled:!z||B,loading:b,onClick:()=>{let e=j.reduce((e,t)=>("success"===t.status&&e.push(t),e),[]);if(!e.length)return;let t=k.current;C(!0),y(e).then(async e=>{let{slices:r,library:n}=e;if(t===k.current)for(let{model:e,langSmithUrl:t}of(I((await (0,l.y0)()).libraries),v(),p({slices:r,library:n}),C(!1),k.current=crypto.randomUUID(),w([]),A("createSlice"),r))l.Xe.track({event:"slice:created",id:e.id,name:e.name,library:n,location:a,mode:"ai",langSmithUrl:t}),(0,c.nZ)({type:"model",library:n,sliceId:e.id,variationId:e.variations[0].id,langSmithUrl:t})}).catch(()=>{t===k.current&&(C(!1),s.Am.error("An unexpected error happened while adding slices."))})},children:[S(a)," (",F.length,")"]})]})]})]})}function f(e){let{droppingFiles:t=!1,onFilesSelected:a}=e;return(0,r.jsx)(n.D,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:t?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:t?"purple9":"grey6",children:(0,r.jsxs)(n.s,{children:[(0,r.jsx)(n.x,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(n.z,{children:"Upload your design images."}),(0,r.jsx)(n.w,{children:"Once uploaded, you can generate slices automatically using AI."}),(0,r.jsx)(n.v,{children:(0,r.jsx)(n.aG,{startIcon:"attachFile",onFilesSelected:a,color:"grey",children:"Add images"})})]})})}async function x(e){let{image:t}=e,a=[await u.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await u.managerClient.screenshots.initS3ACL();let{url:r}=await u.managerClient.screenshots.uploadScreenshot({keyPrefix:a,data:t});return r}async function y(e){let{libraries:t=[]}=await u.managerClient.project.getSliceMachineConfig(),a=t[0];if(!a)throw Error("No library found in the config.");for(let{model:t}of e){let{errors:e}=await u.managerClient.slices.createSlice({libraryID:a,model:t});if(e.length)throw Error("Failed to create slice ".concat(t.id,"."))}let r=await Promise.all(e.map(async e=>{let{model:t,image:r,langSmithUrl:n}=e;return await u.managerClient.slices.updateSliceScreenshot({libraryID:a,sliceID:t.id,variationID:t.variations[0].id,data:r}),{model:t,langSmithUrl:n}}));return{library:a,slices:r}}let S=e=>{switch(e){case"custom_type":return"Add to type";case"page_type":return"Add to page";case"slices":return"Add to slices"}}},27213:function(e,t,a){a.d(t,{F:function(){return i}});var r=a(52322),n=a(11699);let i=e=>{let{menuType:t}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(n.B,{name:"autoFixHigh",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"purple",variant:"solid",radius:6}),title:"Generate from image",description:"Build a slice based on your design image."},fromScratch:{BackgroundIcon:(0,r.jsx)(n.B,{name:"add",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Start from scratch",description:"Build a custom slice your way."},fromTemplate:{BackgroundIcon:(0,r.jsx)(n.B,{name:"contentCopy",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Use a template",description:"Choose from ready-made examples."},fromExisting:{BackgroundIcon:(0,r.jsx)(n.B,{name:"folder",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Reuse an existing slice",description:"Select from your created slices."}}}},6256:function(e,t,a){a.d(t,{c:function(){return S}});var r=a(52322),n=a(2784),i=a(36131),s=a(75289),l=a(94160),c=a(98250),o=a(88932),d=a(63908),u=a(358),m=a(80148);async function p(e){let{sliceName:t,libraryName:a,location:r,onSuccess:n}=e;try{let e=(0,d.fo)(t),{errors:i}=await m.managerClient.slices.createSlice({libraryID:a,model:e});if(i.length>0)throw i;l.Xe.track({event:"slice:created",id:(0,u.MP)(t),name:t,library:a,location:r,mode:"manual"}),await n(e)}catch(a){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,a),o.Am.error(e)}}var g=a(68968),h=a(59532),f=a(54597),x=a(46999),y=a(63019);let S=e=>{let{onClose:t,onSuccess:a,localLibraries:o,location:d,remoteSlices:u}=e,{createSliceSuccess:m}=(0,f.Z)(),[S,j]=(0,n.useState)(!1),{syncChanges:w}=(0,g.g)(),{completeStep:b}=(0,c.k)(),C=async e=>{let t=e.sliceName,r=e.from;j(!0),await p({sliceName:t,libraryName:r,location:d,onSuccess:async e=>{m((await (0,l.y0)()).libraries),a(e,r),w(),b("createSlice")}})};return(0,r.jsx)(h.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{C(e)},initialValues:{sliceName:"",from:o[0].name},validate:e=>(0,y.h)(e,o,u),content:{title:"Create a new slice"},children:e=>{let{touched:t,values:a,setFieldValue:n,errors:l}=e;return(0,r.jsxs)(s.xu,{children:[(0,r.jsx)(x.W,{name:"sliceName",label:"Slice name",placeholder:"Pascalised slice API ID (e.g. TextBlock)",error:t.sliceName?l.sliceName:void 0,testId:"slice-name-input"}),(0,r.jsx)(s.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(i.ZP,{name:"from",options:o.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void n("from",e.value):null,defaultValue:{value:a.from,label:a.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,t,a){a.d(t,{h:function(){return c}});var r=a(96009),n=a.n(r),i=a(74600),s=a.n(i),l=a(7974);function c(e,t,a){let{sliceName:r}=e;return r?l.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:l.xo.exec(r)?s()(n()(r)).replace(/\s/gm,"")!==r.trim()?{sliceName:"Value has to be PascalCased."}:r.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...a.map(e=>e.name)].includes(r)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},21151:function(e,t,a){var r=a(52322),n=a(75289);t.Z=function(e){let{elems:t,renderElem:a,defineElementKey:i,gridTemplateMinPx:s="320px",gridGap:l="16px",sx:c}=e;return(0,r.jsx)(n.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(s,", 1fr))"),gridGap:l,pt:2,...c},children:t.map((e,t)=>e?(0,r.jsx)("span",{children:a(e,t)},"".concat(i(e),"-").concat(t+1)):null)})}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[918],{72779:function(e,t){var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=r.apply(null,n);a&&e.push(a)}}else if("object"===i){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var c in n)o.call(n,c)&&n[c]&&e.push(c)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0!==(n=(function(){return r}).apply(t,[]))&&(e.exports=n)}()},79797:function(e,t,n){"use strict";n.d(t,{Z:function(){return en}});var o,r=n(7896),i=n(59740),a=n(9249),c=n(87371),l=n(45754),s=n(4309),u=n(80753),d=n(56666),f=n(86522),p=n(2784),m=function(e){return+setTimeout(e,16)},v=function(e){return clearTimeout(e)};"undefined"!=typeof window&&"requestAnimationFrame"in window&&(m=function(e){return window.requestAnimationFrame(e)},v=function(e){return window.cancelAnimationFrame(e)});var h=0,y=new Map,g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=h+=1;return!function t(o){if(0===o)y.delete(n),e();else{var r=m(function(){t(o-1)});y.set(n,r)}}(t),n};g.cancel=function(e){var t=y.get(e);return y.delete(t),v(t)};var E=n(28316);function C(){return!!("undefined"!=typeof window&&window.document&&window.document.createElement)}var w=(0,p.forwardRef)(function(e,t){var n=e.didUpdate,o=e.getContainer,r=e.children,i=(0,p.useRef)(),a=(0,p.useRef)();(0,p.useImperativeHandle)(t,function(){return{}});var c=(0,p.useRef)(!1);return!c.current&&C()&&(a.current=o(),i.current=a.current.parentNode,c.current=!0),(0,p.useEffect)(function(){null==n||n(e)}),(0,p.useEffect)(function(){return null===a.current.parentNode&&null!==i.current&&i.current.appendChild(a.current),function(){var e,t;null===(e=a.current)||void 0===e||null===(t=e.parentNode)||void 0===t||t.removeChild(a.current)}},[]),a.current?E.createPortal(r,a.current):null});function b(e){if("undefined"==typeof document)return 0;if(e||void 0===o){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var n=document.createElement("div"),r=n.style;r.position="absolute",r.top="0",r.left="0",r.pointerEvents="none",r.visibility="hidden",r.width="200px",r.height="150px",r.overflow="hidden",n.appendChild(t),document.body.appendChild(n);var i=t.offsetWidth;n.style.overflow="scroll";var a=t.offsetWidth;i===a&&(a=n.clientWidth),document.body.removeChild(n),o=i-a}return o}var k=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return{};var n=t.element,o=void 0===n?document.body:n,r={},i=Object.keys(e);return i.forEach(function(e){r[e]=o.style[e]}),i.forEach(function(t){o.style[t]=e[t]}),r},N={},S=function(e){if(document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth||e){var t="ant-scrolling-effect",n=RegExp("".concat(t),"g"),o=document.body.className;if(e){if(!n.test(o))return;k(N),N={},document.body.className=o.replace(n,"").trim();return}var r=b();if(r&&(N=k({position:"relative",width:"calc(100% - ".concat(r,"px)")}),!n.test(o))){var i="".concat(o," ").concat(t);document.body.className=i.trim()}}},T=n(51171),A=0,L=[],O="ant-scrolling-effect",Z=RegExp("".concat(O),"g"),M=new Map,R=(0,c.Z)(function e(t){var n=this;(0,a.Z)(this,e),(0,d.Z)(this,"lockTarget",void 0),(0,d.Z)(this,"options",void 0),(0,d.Z)(this,"getContainer",function(){var e;return null===(e=n.options)||void 0===e?void 0:e.container}),(0,d.Z)(this,"reLock",function(e){var t=L.find(function(e){return e.target===n.lockTarget});t&&n.unLock(),n.options=e,t&&(t.options=e,n.lock())}),(0,d.Z)(this,"lock",function(){if(!L.some(function(e){return e.target===n.lockTarget})){if(L.some(function(e){var t,o=e.options;return(null==o?void 0:o.container)===(null===(t=n.options)||void 0===t?void 0:t.container)})){L=[].concat((0,T.Z)(L),[{target:n.lockTarget,options:n.options}]);return}var e,t=0,o=(null===(e=n.options)||void 0===e?void 0:e.container)||document.body;(o===document.body&&window.innerWidth-document.documentElement.clientWidth>0||o.scrollHeight>o.clientHeight)&&"hidden"!==getComputedStyle(o).overflow&&(t=b());var r=o.className;if(0===L.filter(function(e){var t,o=e.options;return(null==o?void 0:o.container)===(null===(t=n.options)||void 0===t?void 0:t.container)}).length&&M.set(o,k({width:0!==t?"calc(100% - ".concat(t,"px)"):void 0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden"},{element:o})),!Z.test(r)){var i="".concat(r," ").concat(O);o.className=i.trim()}L=[].concat((0,T.Z)(L),[{target:n.lockTarget,options:n.options}])}}),(0,d.Z)(this,"unLock",function(){var e,t=L.find(function(e){return e.target===n.lockTarget});if(L=L.filter(function(e){return e.target!==n.lockTarget}),!(!t||L.some(function(e){var n,o=e.options;return(null==o?void 0:o.container)===(null===(n=t.options)||void 0===n?void 0:n.container)}))){var o=(null===(e=n.options)||void 0===e?void 0:e.container)||document.body,r=o.className;Z.test(r)&&(k(M.get(o),{element:o}),M.delete(o),o.className=o.className.replace(Z,"").trim())}}),this.lockTarget=A++,this.options=t}),D=0,P=C(),_={},I=function(e){if(!P)return null;if(e){if("string"==typeof e)return document.querySelectorAll(e)[0];if("function"==typeof e)return e();if("object"===(0,f.Z)(e)&&e instanceof window.HTMLElement)return e}return document.body},U=function(e){(0,l.Z)(n,e);var t=(0,s.Z)(n);function n(e){var o;return(0,a.Z)(this,n),o=t.call(this,e),(0,d.Z)((0,u.Z)(o),"container",void 0),(0,d.Z)((0,u.Z)(o),"componentRef",p.createRef()),(0,d.Z)((0,u.Z)(o),"rafId",void 0),(0,d.Z)((0,u.Z)(o),"scrollLocker",void 0),(0,d.Z)((0,u.Z)(o),"renderComponent",void 0),(0,d.Z)((0,u.Z)(o),"updateScrollLocker",function(e){var t=(e||{}).visible,n=o.props,r=n.getContainer,i=n.visible;i&&i!==t&&P&&I(r)!==o.scrollLocker.getContainer()&&o.scrollLocker.reLock({container:I(r)})}),(0,d.Z)((0,u.Z)(o),"updateOpenCount",function(e){var t=e||{},n=t.visible,r=t.getContainer,i=o.props,a=i.visible,c=i.getContainer;a!==n&&P&&I(c)===document.body&&(a&&!n?D+=1:e&&(D-=1)),("function"==typeof c&&"function"==typeof r?c.toString()!==r.toString():c!==r)&&o.removeCurrentContainer()}),(0,d.Z)((0,u.Z)(o),"attachToParent",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e||o.container&&!o.container.parentNode){var t=I(o.props.getContainer);return!!t&&(t.appendChild(o.container),!0)}return!0}),(0,d.Z)((0,u.Z)(o),"getContainer",function(){return P?(o.container||(o.container=document.createElement("div"),o.attachToParent(!0)),o.setWrapperClassName(),o.container):null}),(0,d.Z)((0,u.Z)(o),"setWrapperClassName",function(){var e=o.props.wrapperClassName;o.container&&e&&e!==o.container.className&&(o.container.className=e)}),(0,d.Z)((0,u.Z)(o),"removeCurrentContainer",function(){var e,t;null===(e=o.container)||void 0===e||null===(t=e.parentNode)||void 0===t||t.removeChild(o.container)}),(0,d.Z)((0,u.Z)(o),"switchScrollingEffect",function(){1!==D||Object.keys(_).length?D||(k(_),_={},S(!0)):(S(),_=k({overflow:"hidden",overflowX:"hidden",overflowY:"hidden"}))}),o.scrollLocker=new R({container:I(e.getContainer)}),o}return(0,c.Z)(n,[{key:"componentDidMount",value:function(){var e=this;this.updateOpenCount(),this.attachToParent()||(this.rafId=g(function(){e.forceUpdate()}))}},{key:"componentDidUpdate",value:function(e){this.updateOpenCount(e),this.updateScrollLocker(e),this.setWrapperClassName(),this.attachToParent()}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.visible,n=e.getContainer;P&&I(n)===document.body&&(D=t&&D?D-1:D),this.removeCurrentContainer(),g.cancel(this.rafId)}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.forceRender,o=e.visible,r=null,i={getOpenCount:function(){return D},getContainer:this.getContainer,switchScrollingEffect:this.switchScrollingEffect,scrollLocker:this.scrollLocker};return(n||o||this.componentRef.current)&&(r=p.createElement(w,{getContainer:this.getContainer,ref:this.componentRef},t(i))),r}}]),n}(p.Component),H=n(33028),F=n(72779),K=n.n(F),W={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=W.F1&&t<=W.F12)return!1;switch(t){case W.ALT:case W.CAPS_LOCK:case W.CONTEXT_MENU:case W.CTRL:case W.DOWN:case W.END:case W.ESC:case W.HOME:case W.INSERT:case W.LEFT:case W.MAC_FF_META:case W.META:case W.NUMLOCK:case W.NUM_CENTER:case W.PAGE_DOWN:case W.PAGE_UP:case W.PAUSE:case W.PRINT_SCREEN:case W.RIGHT:case W.SHIFT:case W.UP:case W.WIN_KEY:case W.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=W.ZERO&&e<=W.NINE||e>=W.NUM_ZERO&&e<=W.NUM_MULTIPLY||e>=W.A&&e<=W.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case W.SPACE:case W.QUESTION_MARK:case W.NUM_PLUS:case W.NUM_MINUS:case W.NUM_PERIOD:case W.NUM_DIVISION:case W.SEMICOLON:case W.DASH:case W.EQUALS:case W.COMMA:case W.PERIOD:case W.SLASH:case W.APOSTROPHE:case W.SINGLE_QUOTE:case W.OPEN_SQUARE_BRACKET:case W.BACKSLASH:case W.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}},x={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"},j=Object.keys(x).filter(function(e){if("undefined"==typeof document)return!1;var t=document.getElementsByTagName("html")[0];return e in(t?t.style:{})})[0],B=x[j];function X(e,t,n,o){e.addEventListener?e.addEventListener(t,n,o):e.attachEvent&&e.attachEvent("on".concat(t),n)}function Y(e,t,n,o){e.removeEventListener?e.removeEventListener(t,n,o):e.attachEvent&&e.detachEvent("on".concat(t),n)}var V=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},G=!("undefined"!=typeof window&&window.document&&window.document.createElement),Q=function e(t,n,o,r){if(!n||n===document||n instanceof Document)return!1;if(n===t.parentNode)return!0;var i=Math.max(Math.abs(o),Math.abs(r))===Math.abs(r),a=Math.max(Math.abs(o),Math.abs(r))===Math.abs(o),c=n.scrollHeight-n.clientHeight,l=n.scrollWidth-n.clientWidth,s=document.defaultView.getComputedStyle(n),u="auto"===s.overflowY||"scroll"===s.overflowY,d="auto"===s.overflowX||"scroll"===s.overflowX,f=c&&u,p=l&&d;return(!!i&&(!f||!!f&&(n.scrollTop>=c&&r<0||n.scrollTop<=0&&r>0))||!!a&&(!p||!!p&&(n.scrollLeft>=l&&o<0||n.scrollLeft<=0&&o>0)))&&e(t,n.parentNode,o,r)},z=["className","children","style","width","height","defaultOpen","open","prefixCls","placement","level","levelMove","ease","duration","getContainer","handler","onChange","afterVisibleChange","showMask","maskClosable","maskStyle","onClose","onHandleClick","keyboard","getOpenCount","scrollLocker","contentWrapperStyle"],q={},$=function(e){(0,l.Z)(n,e);var t=(0,s.Z)(n);function n(e){var o;return(0,a.Z)(this,n),(o=t.call(this,e)).levelDom=void 0,o.dom=void 0,o.contentWrapper=void 0,o.contentDom=void 0,o.maskDom=void 0,o.handlerDom=void 0,o.drawerId=void 0,o.timeout=void 0,o.passive=void 0,o.startPos=void 0,o.domFocus=function(){o.dom&&o.dom.focus()},o.removeStartHandler=function(e){if(e.touches.length>1){o.startPos=null;return}o.startPos={x:e.touches[0].clientX,y:e.touches[0].clientY}},o.removeMoveHandler=function(e){if(!(e.changedTouches.length>1)&&o.startPos){var t=e.currentTarget,n=e.changedTouches[0].clientX-o.startPos.x,r=e.changedTouches[0].clientY-o.startPos.y;(t===o.maskDom||t===o.handlerDom||t===o.contentDom&&Q(t,e.target,n,r))&&e.cancelable&&e.preventDefault()}},o.transitionEnd=function(e){var t=e.target;Y(t,B,o.transitionEnd),t.style.transition=""},o.onKeyDown=function(e){if(e.keyCode===W.ESC){var t=o.props.onClose;e.stopPropagation(),t&&t(e)}},o.onWrapperTransitionEnd=function(e){var t=o.props,n=t.open,r=t.afterVisibleChange;e.target===o.contentWrapper&&e.propertyName.match(/transform$/)&&(o.dom.style.transition="",!n&&o.getCurrentDrawerSome()&&(document.body.style.overflowX="",o.maskDom&&(o.maskDom.style.left="",o.maskDom.style.width="")),r&&r(!!n))},o.openLevelTransition=function(){var e=o.props,t=e.open,n=e.width,r=e.height,i=o.getHorizontalBoolAndPlacementName(),a=i.isHorizontal,c=i.placementName,l=o.contentDom?o.contentDom.getBoundingClientRect()[a?"width":"height"]:0;o.setLevelAndScrolling(t,c,(a?n:r)||l)},o.setLevelTransform=function(e,t,n,r){var i=o.props,a=i.placement,c=i.levelMove,l=i.duration,s=i.ease,u=i.showMask;o.levelDom.forEach(function(i){i.style.transition="transform ".concat(l," ").concat(s),X(i,B,o.transitionEnd);var d=e?n:0;if(c){var f,p,m=(f={target:i,open:e},Array.isArray(p="function"==typeof c?c(f):c)?2===p.length?p:[p[0],p[1]]:[p]);d=e?m[0]:m[1]||0}var v="number"==typeof d?"".concat(d,"px"):d,h="left"===a||"top"===a?v:"-".concat(v);h=u&&"right"===a&&r?"calc(".concat(h," + ").concat(r,"px)"):h,i.style.transform=d?"".concat(t,"(").concat(h,")"):""})},o.setLevelAndScrolling=function(e,t,n){var r=o.props.onChange;if(!G){var i=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?b(!0):0;o.setLevelTransform(e,t,n,i),o.toggleScrollingToDrawerAndBody(i)}r&&r(e)},o.toggleScrollingToDrawerAndBody=function(e){var t=o.props,n=t.getContainer,r=t.showMask,i=t.open,a=n&&n();if(a&&a.parentNode===document.body&&r){var c=["touchstart"],l=[document.body,o.maskDom,o.handlerDom,o.contentDom];i&&"hidden"!==document.body.style.overflow?(e&&o.addScrollingEffect(e),document.body.style.touchAction="none",l.forEach(function(e,t){e&&X(e,c[t]||"touchmove",t?o.removeMoveHandler:o.removeStartHandler,o.passive)})):o.getCurrentDrawerSome()&&(document.body.style.touchAction="",e&&o.remScrollingEffect(e),l.forEach(function(e,t){e&&Y(e,c[t]||"touchmove",t?o.removeMoveHandler:o.removeStartHandler,o.passive)}))}},o.addScrollingEffect=function(e){var t=o.props,n=t.placement,r=t.duration,i=t.ease,a="width ".concat(r," ").concat(i),c="transform ".concat(r," ").concat(i);switch(o.dom.style.transition="none",n){case"right":o.dom.style.transform="translateX(-".concat(e,"px)");break;case"top":case"bottom":o.dom.style.width="calc(100% - ".concat(e,"px)"),o.dom.style.transform="translateZ(0)"}clearTimeout(o.timeout),o.timeout=setTimeout(function(){o.dom&&(o.dom.style.transition="".concat(c,",").concat(a),o.dom.style.width="",o.dom.style.transform="")})},o.remScrollingEffect=function(e){var t,n=o.props,r=n.placement,i=n.duration,a=n.ease;j&&(document.body.style.overflowX="hidden"),o.dom.style.transition="none";var c="width ".concat(i," ").concat(a),l="transform ".concat(i," ").concat(a);switch(r){case"left":o.dom.style.width="100%",c="width 0s ".concat(a," ").concat(i);break;case"right":o.dom.style.transform="translateX(".concat(e,"px)"),o.dom.style.width="100%",c="width 0s ".concat(a," ").concat(i),o.maskDom&&(o.maskDom.style.left="-".concat(e,"px"),o.maskDom.style.width="calc(100% + ".concat(e,"px)"));break;case"top":case"bottom":o.dom.style.width="calc(100% + ".concat(e,"px)"),o.dom.style.height="100%",o.dom.style.transform="translateZ(0)",t="height 0s ".concat(a," ").concat(i)}clearTimeout(o.timeout),o.timeout=setTimeout(function(){o.dom&&(o.dom.style.transition="".concat(l,",").concat(t?"".concat(t,","):"").concat(c),o.dom.style.transform="",o.dom.style.width="",o.dom.style.height="")})},o.getCurrentDrawerSome=function(){return!Object.keys(q).some(function(e){return q[e]})},o.getLevelDom=function(e){var t=e.level,n=e.getContainer;if(!G){var r=n&&n(),i=r?r.parentNode:null;(o.levelDom=[],"all"===t)?(i?Array.prototype.slice.call(i.children):[]).forEach(function(e){"SCRIPT"!==e.nodeName&&"STYLE"!==e.nodeName&&"LINK"!==e.nodeName&&e!==r&&o.levelDom.push(e)}):t&&(Array.isArray(t)?t:[t]).forEach(function(e){document.querySelectorAll(e).forEach(function(e){o.levelDom.push(e)})})}},o.getHorizontalBoolAndPlacementName=function(){var e=o.props.placement,t="left"===e||"right"===e;return{isHorizontal:t,placementName:"translate".concat(t?"X":"Y")}},o.state={_self:(0,u.Z)(o)},o}return(0,c.Z)(n,[{key:"componentDidMount",value:function(){var e,t=this;if(!G){var n=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return n=!0,null}}))}catch(e){}this.passive=!!n&&{passive:!1}}var o=this.props,r=o.open,i=o.getContainer,a=o.showMask,c=o.autoFocus,l=i&&i();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(9*Math.random()).toString())).toString(16)),this.getLevelDom(this.props),r&&(l&&l.parentNode===document.body&&(q[this.drawerId]=r),this.openLevelTransition(),this.forceUpdate(function(){c&&t.domFocus()}),a&&(null===(e=this.props.scrollLocker)||void 0===e||e.lock()))}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.open,o=t.getContainer,r=t.scrollLocker,i=t.showMask,a=t.autoFocus,c=o&&o();n!==e.open&&(c&&c.parentNode===document.body&&(q[this.drawerId]=!!n),this.openLevelTransition(),n?(a&&this.domFocus(),i&&(null==r||r.lock())):null==r||r.unLock())}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.open,n=e.scrollLocker;delete q[this.drawerId],t&&(this.setLevelTransform(!1),document.body.style.touchAction=""),null==n||n.unLock()}},{key:"render",value:function(){var e,t,n,o=this,a=this.props,c=a.className,l=a.children,s=a.style,u=a.width,f=a.height,m=(a.defaultOpen,a.open),v=a.prefixCls,h=a.placement,y=(a.level,a.levelMove,a.ease,a.duration,a.getContainer,a.handler),g=(a.onChange,a.afterVisibleChange,a.showMask),E=a.maskClosable,C=a.maskStyle,w=a.onClose,b=a.onHandleClick,k=a.keyboard,N=(a.getOpenCount,a.scrollLocker,a.contentWrapperStyle),S=(0,i.Z)(a,z),T=!!this.dom&&m,A=K()(v,(n={},(0,d.Z)(n,"".concat(v,"-").concat(h),!0),(0,d.Z)(n,"".concat(v,"-open"),T),(0,d.Z)(n,c||"",!!c),(0,d.Z)(n,"no-mask",!g),n)),L=this.getHorizontalBoolAndPlacementName().placementName,O=T?"":"".concat(L,"(").concat("left"===h||"top"===h?"-100%":"100%",")"),Z=y&&p.cloneElement(y,{onClick:function(e){y.props.onClick&&y.props.onClick(),b&&b(e)},ref:function(e){o.handlerDom=e}});return p.createElement("div",(0,r.Z)({},(e=["switchScrollingEffect","autoFocus"],t=(0,H.Z)({},S),Array.isArray(e)&&e.forEach(function(e){delete t[e]}),t),{tabIndex:-1,className:A,style:s,ref:function(e){o.dom=e},onKeyDown:T&&k?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),g&&p.createElement("div",{className:"".concat(v,"-mask"),onClick:E?w:void 0,style:C,ref:function(e){o.maskDom=e}}),p.createElement("div",{className:"".concat(v,"-content-wrapper"),style:(0,H.Z)({transform:O,msTransform:O,width:V(u)?"".concat(u,"px"):u,height:V(f)?"".concat(f,"px"):f},N),ref:function(e){o.contentWrapper=e}},p.createElement("div",{className:"".concat(v,"-content"),ref:function(e){o.contentDom=e}},l),Z))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,o=t._self;if(void 0!==n){var r=e.placement,i=e.level;r!==n.placement&&(o.contentDom=null),i!==n.level&&o.getLevelDom(e)}return{prevProps:e}}}]),n}(p.Component),J=["defaultOpen","getContainer","wrapperClassName","forceRender","handler"],ee=["visible","afterClose"],et=function(e){(0,l.Z)(n,e);var t=(0,s.Z)(n);function n(e){(0,a.Z)(this,n),(o=t.call(this,e)).dom=void 0,o.onHandleClick=function(e){var t=o.props,n=t.onHandleClick,r=t.open;if(n&&n(e),void 0===r){var i=o.state.open;o.setState({open:!i})}},o.onClose=function(e){var t=o.props,n=t.onClose,r=t.open;n&&n(e),void 0===r&&o.setState({open:!1})};var o,r=void 0!==e.open?e.open:!!e.defaultOpen;return o.state={open:r},"onMaskClick"in e&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),o}return(0,c.Z)(n,[{key:"render",value:function(){var e=this,t=this.props,n=(t.defaultOpen,t.getContainer),o=t.wrapperClassName,a=t.forceRender,c=t.handler,l=(0,i.Z)(t,J),s=this.state.open;return n?p.createElement(U,{visible:s,forceRender:!!c||a,getContainer:n,wrapperClassName:o},function(t){var n=t.visible,o=t.afterClose,a=(0,i.Z)(t,ee);return p.createElement($,(0,r.Z)({},l,a,{open:void 0!==n?n:s,afterVisibleChange:void 0!==o?o:l.afterVisibleChange,handler:c,onClose:e.onClose,onHandleClick:e.onHandleClick}))}):p.createElement("div",{className:o,ref:function(t){e.dom=t}},p.createElement($,(0,r.Z)({},l,{open:s,handler:c,getContainer:function(){return e.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,o={prevProps:e};return void 0!==n&&e.open!==n.open&&(o.open=e.open),o}}]),n}(p.Component);et.defaultProps={prefixCls:"drawer",placement:"left",getContainer:"body",defaultOpen:!1,level:"all",duration:".3s",ease:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",onChange:function(){},afterVisibleChange:function(){},handler:p.createElement("div",{className:"drawer-handle"},p.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1,autoFocus:!0};var en=et},76473:function(e,t,n){"use strict";n.d(t,{y1:function(){return C}});var o=n(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}n(52322);var i=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function c(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function l(e,t){return void 0===t&&(t=","),e.split(t)}function s(e,t,n){void 0===t&&(t="+");var o=e.toLocaleLowerCase().split(t).map(function(e){return c(e)}),a={alt:o.includes("alt"),ctrl:o.includes("ctrl")||o.includes("control"),shift:o.includes("shift"),meta:o.includes("meta"),mod:o.includes("mod")},l=o.filter(function(e){return!i.includes(e)});return r({},a,{keys:l,description:n})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([c(e.key),c(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&p([c(e.key),c(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var t=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){return!i.includes(e)&&u.delete(e.toLowerCase())}),t.forEach(function(e){return u.add(e.toLowerCase())})}function p(e){var t=Array.isArray(e)?e:[e];"meta"===e?u.clear():t.forEach(function(e){return u.delete(e.toLowerCase())})}function m(e,t){var n=e.target;void 0===t&&(t=!1);var o=n&&n.tagName;return d(t)?!!(o&&t&&t.some(function(e){return e.toLowerCase()===o.toLowerCase()})):!!(o&&t&&!0===t)}var v=function(e,t,n){void 0===n&&(n=!1);var o,r=t.alt,i=t.meta,a=t.mod,l=t.shift,s=t.ctrl,f=t.keys,p=e.key,m=e.code,v=e.ctrlKey,h=e.metaKey,y=e.shiftKey,g=e.altKey,E=c(m),C=p.toLowerCase();if(!n){if(!g===r&&"alt"!==C||!y===l&&"shift"!==C)return!1;if(a){if(!h&&!v)return!1}else if(!h===i&&"meta"!==C&&"os"!==C||!v===s&&"ctrl"!==C&&"control"!==C)return!1}return!!(f&&1===f.length&&(f.includes(C)||f.includes(E)))||(f?(void 0===o&&(o=","),(d(f)?f:f.split(o)).every(function(e){return u.has(e.trim().toLowerCase())})):!f)},h=(0,o.createContext)(void 0),y=(0,o.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),g=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},E="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;function C(e,t,n,r){var i,a=(0,o.useRef)(null),u=(0,o.useRef)(!1),C=n instanceof Array?r instanceof Array?void 0:r:n,w=d(e)?e.join(null==C?void 0:C.splitKey):e,b=n instanceof Array?n:r instanceof Array?r:void 0,k=(0,o.useCallback)(t,null!=b?b:[]),N=(0,o.useRef)(k);b?N.current=k:N.current=t;var S=(!function e(t,n){return t&&n&&"object"==typeof t&&"object"==typeof n?Object.keys(t).length===Object.keys(n).length&&Object.keys(t).reduce(function(o,r){return o&&e(t[r],n[r])},!0):t===n}((i=(0,o.useRef)(void 0)).current,C)&&(i.current=C),i.current),T=(0,o.useContext)(y).enabledScopes,A=(0,o.useContext)(h);return E(function(){if((null==S?void 0:S.enabled)!==!1&&(e=null==S?void 0:S.scopes,0===T.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||T.some(function(t){return e.includes(t)})||T.includes("*")))){var e,t=function(e,t){var n;if(void 0===t&&(t=!1),!(m(e,["input","textarea","select"])&&!m(e,null==S?void 0:S.enableOnFormTags)||null!=S&&null!=S.ignoreEventWhen&&S.ignoreEventWhen(e))){if(null!==a.current&&document.activeElement!==a.current&&!a.current.contains(document.activeElement)){g(e);return}(null==(n=e.target)||!n.isContentEditable||null!=S&&S.enableOnContentEditable)&&l(w,null==S?void 0:S.splitKey).forEach(function(n){var o,r,i,a=s(n,null==S?void 0:S.combinationKey);if(v(e,a,null==S?void 0:S.ignoreModifiers)||null!=(i=a.keys)&&i.includes("*")){if(t&&u.current)return;if(("function"==typeof(o=null==S?void 0:S.preventDefault)&&o(e,a)||!0===o)&&e.preventDefault(),"function"==typeof(r=null==S?void 0:S.enabled)?!r(e,a):!0!==r&&void 0!==r){g(e);return}N.current(e,a),t||(u.current=!0)}})}},n=function(e){void 0!==e.key&&(f(c(e.code)),((null==S?void 0:S.keydown)===void 0&&(null==S?void 0:S.keyup)!==!0||null!=S&&S.keydown)&&t(e))},o=function(e){void 0!==e.key&&(p(c(e.code)),u.current=!1,null!=S&&S.keyup&&t(e,!0))},r=a.current||(null==C?void 0:C.document)||document;return r.addEventListener("keyup",o),r.addEventListener("keydown",n),A&&l(w,null==S?void 0:S.splitKey).forEach(function(e){return A.addHotkey(s(e,null==S?void 0:S.combinationKey,null==S?void 0:S.description))}),function(){r.removeEventListener("keyup",o),r.removeEventListener("keydown",n),A&&l(w,null==S?void 0:S.splitKey).forEach(function(e){return A.removeHotkey(s(e,null==S?void 0:S.combinationKey,null==S?void 0:S.description))})}}},[w,S,T]),a}},926:function(e,t,n){"use strict";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}n.d(t,{Z:function(){return o}})},9249:function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}n.d(t,{Z:function(){return o}})},87371:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var o=n(32802);function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(0,o.Z)(r.key),r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var o=n(95058),r=n(70352),i=n(86522),a=n(80753);function c(e){var t=(0,r.Z)();return function(){var n,r=(0,o.Z)(e);return n=t?Reflect.construct(r,arguments,(0,o.Z)(this).constructor):r.apply(this,arguments),function(e,t){if(t&&("object"===(0,i.Z)(t)||"function"==typeof t))return t;if(void 0!==t)throw TypeError("Derived constructors may only return object or undefined");return(0,a.Z)(e)}(this,n)}}},45754:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var o=n(88960);function r(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(0,o.Z)(e,t)}},59740:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var o=n(31461);function r(e,t){if(null==e)return{};var n,r,i=(0,o.Z)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},51171:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var o=n(926),r=n(59147);function i(e){return function(e){if(Array.isArray(e))return(0,o.Z)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||(0,r.Z)(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},59147:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});var o=n(926);function r(e,t){if(e){if("string"==typeof e)return(0,o.Z)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return(0,o.Z)(e,t)}}}}]);
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,u,d,h,f,k,j,l,p,g,o,r,m,_,y){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,e,p,g,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-8514e0696e90a1b2.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",a,n,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-8af4acbb8f974cb2.js"],"/custom-types":[s,e,p,g,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,u,d,h,f,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/custom-types/[customTypeId]-af9376721beb489e.js"],"/labs":["static/chunks/pages/labs-56fd818a63553497.js"],"/page-types/[pageTypeId]":[c,u,d,h,f,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/page-types/[pageTypeId]-a24665e91b882169.js"],"/slices":[c,i,_,s,b,y,a,n,l,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-81c1c3f1bcad60f4.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,u,d,h,f,_,s,t,b,k,y,"static/chunks/484-3e011e79c41f0342.js",a,j,n,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e973a443d8b8a75d.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/429-aab52070cad2884b.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-faeb6d2f77d97096.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-28725deef8b874b1.js","static/chunks/647-aa094286bc248d52.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-fdb3008f4bb3b0c1.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/256-07f768a2b19b0a0e.js","static/chunks/630-2bf927bca082a191.js","static/chunks/907-180eb33eefccc237.js","static/chunks/248-84a5987f0499b074.js","static/css/4e475d945cf8a890.css","static/chunks/422-c9192a1dbdd2ae0e.js","static/chunks/489-ce3053e1d81ade83.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/500-d3989390f5e8da53.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();