slice-machine-ui 2.20.5-alpha.jp-import-slices-2.1 → 2.20.5-alpha.lg-import-slices.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 (53) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/GzPwmcuyHg0TUP7cX7YSA/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/{248-2902bda47821f37b.js → 248-84a5987f0499b074.js} +1 -1
  4. package/out/_next/static/chunks/422-c7a16d95b75c9e1c.js +1 -0
  5. package/out/_next/static/chunks/489-c9535ef34da63d1a.js +1 -0
  6. package/out/_next/static/chunks/585-c89bb2471e85b9f8.js +1 -0
  7. package/out/_next/static/chunks/{630-4fe1e982234bd925.js → 630-2bf927bca082a191.js} +1 -1
  8. package/out/_next/static/chunks/{647-a29bee23cb9ac7a2.js → 647-aa094286bc248d52.js} +1 -1
  9. package/out/_next/static/chunks/{882-8ab59c0c72307c87.js → 882-48d61b2fabee28d8.js} +1 -1
  10. package/out/_next/static/chunks/954-bedaaabf664584a0.js +1 -0
  11. package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +28 -0
  12. package/out/_next/static/chunks/pages/{_app-a60aecdbaa4efedd.js → _app-0668d41463a0a907.js} +217 -217
  13. package/out/_next/static/chunks/pages/{changelog-bc83e25e8d316ca9.js → changelog-8514e0696e90a1b2.js} +1 -1
  14. package/out/_next/static/chunks/pages/{changes-6f371ebe52dbe76a.js → changes-e66094f57453cf9c.js} +1 -1
  15. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-80defa14b6ea36f7.js → [customTypeId]-273e9a82c085b596.js} +1 -1
  16. package/out/_next/static/chunks/pages/{labs-16d118a80936d583.js → labs-56fd818a63553497.js} +1 -1
  17. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f4ff9ad74b44bf09.js → [pageTypeId]-3fa7667de1a790d9.js} +1 -1
  18. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-873c0c89aaf50b3c.js → simulator-8c70298caf51bed0.js} +1 -1
  19. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-0e9aa745ed9fe1ec.js → [variation]-22ffa2561ac66557.js} +1 -1
  20. package/out/_next/static/chunks/pages/slices-76679cf064761d2b.js +1 -0
  21. package/out/_next/static/chunks/{webpack-e986dd216b883a74.js → webpack-24ddb02bea621501.js} +1 -1
  22. package/out/_next/static/css/bc89f2cd4e4781f5.css +1 -0
  23. package/out/changelog.html +1 -1
  24. package/out/changes.html +1 -1
  25. package/out/custom-types/[customTypeId].html +1 -1
  26. package/out/custom-types.html +1 -1
  27. package/out/index.html +1 -1
  28. package/out/labs.html +1 -1
  29. package/out/page-types/[pageTypeId].html +1 -1
  30. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  31. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  32. package/out/slices.html +1 -1
  33. package/package.json +6 -6
  34. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ImportSlicesFromLibraryModal.tsx +285 -104
  35. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/hooks/useImportSlicesFromGithub.ts +4 -7
  36. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +18 -4
  37. package/src/features/customTypes/customTypesBuilder/shared/getSubmitButtonLabel.ts +5 -3
  38. package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +14 -0
  39. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +72 -0
  40. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +3 -1
  41. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +79 -31
  42. package/src/pages/slices.tsx +30 -0
  43. package/out/_next/static/60BSwFmsh1-aNIyMe29hH/_buildManifest.js +0 -1
  44. package/out/_next/static/chunks/21-f3962d02eda0a46e.js +0 -1
  45. package/out/_next/static/chunks/633-2d20c3e815c79c7f.js +0 -1
  46. package/out/_next/static/chunks/660-a3ec593dcfbb44c9.js +0 -1
  47. package/out/_next/static/chunks/6611d287.1714222015f895ea.js +0 -28
  48. package/out/_next/static/chunks/pages/slices-93fc784c443a996c.js +0 -1
  49. package/out/_next/static/css/b30fbbc3ed00a725.css +0 -1
  50. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LibrarySlicesTab.tsx +0 -125
  51. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LocalSlicesTab.tsx +0 -67
  52. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ReuseExistingSlicesContext.tsx +0 -279
  53. /package/out/_next/static/{60BSwFmsh1-aNIyMe29hH → GzPwmcuyHg0TUP7cX7YSA}/_ssgManifest.js +0 -0
package/out/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/b30fbbc3ed00a725.css" as="style"/><link rel="stylesheet" href="/_next/static/css/b30fbbc3ed00a725.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e986dd216b883a74.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-de87250a4e0c9fcf.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a60aecdbaa4efedd.js" defer=""></script><script src="/_next/static/chunks/pages/_error-fedd2c6ebd3d27b9.js" defer=""></script><script src="/_next/static/60BSwFmsh1-aNIyMe29hH/_buildManifest.js" defer=""></script><script src="/_next/static/60BSwFmsh1-aNIyMe29hH/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"60BSwFmsh1-aNIyMe29hH","runtimeConfig":{"sentryEnvironment":"alpha"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/bc89f2cd4e4781f5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/bc89f2cd4e4781f5.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-24ddb02bea621501.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-de87250a4e0c9fcf.js" defer=""></script><script src="/_next/static/chunks/pages/_app-0668d41463a0a907.js" defer=""></script><script src="/_next/static/chunks/pages/_error-fedd2c6ebd3d27b9.js" defer=""></script><script src="/_next/static/GzPwmcuyHg0TUP7cX7YSA/_buildManifest.js" defer=""></script><script src="/_next/static/GzPwmcuyHg0TUP7cX7YSA/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"GzPwmcuyHg0TUP7cX7YSA","runtimeConfig":{"sentryEnvironment":"alpha"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,n,u,d,f,h,k,j,l,p,g,o,r,m,_,y,I,N,T){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,t,r,m,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,i,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-8514e0696e90a1b2.js"],"/changes":[c,b,"static/chunks/8eec4907-b712959d9f984b68.js",a,"static/chunks/125-00b909bdbab2ca15.js",e,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-e66094f57453cf9c.js"],"/custom-types":[s,t,r,m,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,f,h,k,j,s,a,i,n,u,l,p,_,e,t,g,o,y,I,"static/chunks/pages/custom-types/[customTypeId]-273e9a82c085b596.js"],"/labs":["static/chunks/pages/labs-56fd818a63553497.js"],"/page-types/[pageTypeId]":[c,f,h,k,j,s,a,i,n,u,l,p,_,e,t,g,o,y,I,"static/chunks/pages/page-types/[pageTypeId]-3fa7667de1a790d9.js"],"/slices":[c,b,N,s,a,n,u,p,T,e,o,d,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-76679cf064761d2b.js"],"/slices/[lib]/[sliceName]/[variation]":[c,b,f,h,k,j,N,s,a,i,n,l,T,"static/chunks/484-3e011e79c41f0342.js",e,g,d,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-22ffa2561ac66557.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[b,"static/chunks/72585f70-28b4d7d5384b3703.js",u,"static/chunks/429-e5d7e39160de9f5e.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-8c70298caf51bed0.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/66-d9d3bcb5d041cb6d.js","static/chunks/882-48d61b2fabee28d8.js","static/chunks/647-aa094286bc248d52.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-b64f09e670634ed1.js","static/chunks/130-e1a16d2f94fb2b64.js","static/chunks/593-7ffd1197c3405ef8.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/954-bedaaabf664584a0.js","static/chunks/630-2bf927bca082a191.js","static/chunks/422-c7a16d95b75c9e1c.js","static/chunks/248-84a5987f0499b074.js","static/css/4e475d945cf8a890.css","static/chunks/585-c89bb2471e85b9f8.js","static/chunks/489-c9535ef34da63d1a.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/444-d39213143f782fec.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(18337),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(18337),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(98564),d=n(87446),u=n(58446),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=o.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),y=n(68968),S=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=o.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:d}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=o.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,y.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{d(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(S.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:d}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=o.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,d),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=o.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(d.h,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(11699),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(11699),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(98564),d=n(87446),u=n(58446),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=o.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),y=n(68968),S=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=o.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:d}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=o.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,y.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{d(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(S.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:d}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=o.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,d),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=o.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(d.h,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[422],{21446:function(e,t,n){n.d(t,{S:function(){return C}});var r=n(52322),a=n(74217),i=n(11699),o=n(37792),s=n(5632),l=n(2784),c=n(76473),d=n(88932),u=n(30195),m=n(94160),g=n(34166),h=n(98250),f=n(68968),p=n(96317);let y=(0,l.forwardRef)((e,t)=>{let{width:n,height:a}=e;return void 0===n&&void 0===a&&(n=10,a=16),(0,r.jsxs)("svg",{ref:t,viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:a,width:n,children:[(0,r.jsx)("path",{d:"M5 7.83323C5 6.45253 6.11928 5.33325 7.49997 5.33325C8.8807 5.33325 10 6.45255 10 7.83328V8.16656C10 9.54728 8.8807 10.6666 7.49997 10.6666C6.11928 10.6666 5 9.54731 5 8.16661V7.83323Z",fill:"#1ABCFE"}),(0,r.jsx)("path",{d:"M0 13.3334C0 11.8607 1.19391 10.6667 2.66667 10.6667H5V13.5001C5 14.8808 3.88071 16.0001 2.5 16.0001C1.11929 16.0001 0 14.8808 0 13.5001L0 13.3334Z",fill:"#0ACF83"}),(0,r.jsx)("path",{d:"M5 0V5.33333H7.33333C8.80609 5.33333 10 4.13943 10 2.66667C10 1.19391 8.80609 0 7.33333 0L5 0Z",fill:"#FF7262"}),(0,r.jsx)("path",{d:"M0 2.66659C0 4.13934 1.19391 5.33325 2.66667 5.33325L5 5.33325L5 -8.15392e-05L2.66667 -8.15392e-05C1.19391 -8.15392e-05 0 1.19383 0 2.66659Z",fill:"#F24E1E"}),(0,r.jsx)("path",{d:"M0 8.00008C0 9.47284 1.19391 10.6667 2.66667 10.6667H5L5 5.33341L2.66667 5.33341C1.19391 5.33341 0 6.52732 0 8.00008Z",fill:"#A259FF"})]})});var w=n(80148),x=n(54597),b=n(62434),j=n(56141);function v(e){let t;let{slice:n}=e,a="uploading"===n.status||"generating"===n.status,o="uploadError"===n.status||"generateError"===n.status||"cancelled"===n.status,s="pending"===n.status||"generateError"===n.status||"generating"===n.status||"success"===n.status||"cancelled"===n.status;return o?t=(0,r.jsx)(i.E,{startIcon:"refresh",color:"grey",onClick:n.onRetry,children:"Retry"}):"figma"===n.source&&(t=(0,r.jsx)(i.c3,{content:"Pasted from Figma",children:(0,r.jsx)(j.S,{})})),(0,r.jsxs)(b.Zb,{disabled:a,children:[s?(0,r.jsx)(b.ZB,{src:n.thumbnailUrl}):(0,r.jsx)(b.ZB,{component:"div"}),(0,r.jsx)(b.eW,{loading:a,startIcon:function(e){switch(e){case"uploadError":case"generateError":case"cancelled":return"close";case"pending":return"image";case"success":return"check";default:return}}(n.status),title:"success"===n.status?n.model.name:"figma"===n.source?n.image.name.split(".")[0]:n.image.name,subtitle:function(e){switch(e.status){case"uploading":return"Uploading...";case"pending":var t;return(t=e.image.size)<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," kB"):"".concat((t/1048576).toFixed(1)," MB");case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"cancelled":return"Cancelled";case"success":return"Generated"}}(n),error:o,action:t})]})}let S=u.z.object({__type:u.z.literal("figma-to-prismic/clipboard-data"),name:u.z.string(),image:u.z.string().startsWith("data:image/")});function C(e){let{open:t,location:n,onSuccess:u,onClose:p}=e,b=(0,s.useRouter)(),[j,C]=(0,l.useState)([]),[E,D]=(0,l.useState)(!1),[z,L]=(0,l.useState)(!1),{syncChanges:U}=(0,f.g)(),{createSliceSuccess:P,openLoginModal:B}=(0,x.Z)(),{completeStep:G}=(0,h.k)(),N=function(e){let{open:t}=e,n=(0,l.useRef)([]);return(0,l.useEffect)(()=>{t&&(n.current=[],w.managerClient.slices.readAllSlices().then(e=>{n.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),n}({open:t}),R=F(),{libraryID:H,isLoading:_}=function(){let[e,t]=(0,l.useState)();return(0,l.useEffect)(()=>{w.managerClient.project.getSliceMachineConfig().then(e=>{var n;let r=null==e?void 0:null===(n=e.libraries)||void 0===n?void 0:n[0];if(void 0===r)throw Error("No library found in the config.");t(r)}).catch(()=>{throw Error("Could not get library ID from the config.")})},[]),{libraryID:e,isLoading:void 0===e}}(),M=(0,a.R9)(Q),Z=(0,l.useRef)(crypto.randomUUID());(0,c.y1)(["meta+v","ctrl+v"],e=>{e.preventDefault(),K({isShortcut:!0})},{enabled:t&&R}),(0,l.useEffect)(()=>{if(!j.some(e=>"generating"===e.status))return;let e=e=>{M();let t="Your current generating slices will be cancelled.";return e.returnValue=t,t};return b.events.on("routeChangeStart",M),window.addEventListener("beforeunload",e),()=>{b.events.off("routeChangeStart",M),window.removeEventListener("beforeunload",e)}},[j,b.events,M]);let T=e=>{let{index:t,slice:n}=e;C(e=>e.map((e,r)=>r===t?n(e):e))},O=e=>{if(J)return;if(e.length>10){d.Am.error("You can only upload ".concat(10," images at a time."));return}let t=j.length;C(t=>[...t,...e.map(e=>({source:"upload",status:"uploading",image:e}))]),e.forEach((e,n)=>{q({index:t+n,image:e,source:"upload"})})},W=()=>{d.Am.error("Please log in and try again."),$(),B()},q=async e=>{let{index:t,image:n,source:r}=e,a=Z.current;T({index:t,slice:e=>({...e,status:"uploading",image:n,source:r})});try{let e=await A({image:n});if(a!==Z.current)return;T({index:t,slice:t=>({...t,status:"pending",thumbnailUrl:e})})}catch(e){if(a!==Z.current)return;if(T({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>void q({index:t,image:n,source:r})})}),(0,o.ff)(e)){W();return}}},V=async e=>{if(void 0===H)return;let{index:t,imageUrl:r,source:a}=e,i=Z.current,s=crypto.randomUUID();T({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:r,requestId:s})});try{let e=await w.managerClient.customTypes.inferSlice({source:a,libraryID:H,imageUrl:r,requestId:s});if(i!==Z.current)return;let o=function(e){let{existingSlices:t,newSlices:n,slice:r}=e,a=new Set,i=new Set;for(let{id:e,name:n}of t)a.add(e),i.add(n.toLowerCase());for(let e of n)"success"===e.status&&(a.add(e.model.id),i.add(e.model.name.toLowerCase()));let o=r.id,s=2;for(;a.has(o);)o="".concat(r.id,"_").concat(s),s++;let l=r.name;for(s=2;i.has(l.toLowerCase());)l="".concat(r.name).concat(s),s++;return{...r,id:o,name:l}}({existingSlices:N.current,newSlices:j,slice:e.slice});if(C(n=>n.map((n,a)=>a!==t?n:{...n,status:"success",thumbnailUrl:r,model:o,langSmithUrl:e.langSmithUrl})),"upload"===a){i=Z.current;let e=j[t],{errors:n}=await w.managerClient.slices.createSlice({libraryID:H,model:o});if(n.length)throw Error("Failed to create slice ".concat(o.id,"."));if(await w.managerClient.slices.updateSliceScreenshot({libraryID:H,sliceID:o.id,variationID:o.variations[0].id,data:e.image}),i!==Z.current)return}G("createSlice"),m.Xe.track({event:"slice:created",id:o.id,name:o.name,library:H,location:n,..."figma"===a?{mode:"figma-to-slice"}:{mode:"ai",langSmithUrl:e.langSmithUrl}}),m.Xe.track({event:"slice-generation:ended",error:!1,source:a}),(0,g.nZ)({type:"model",library:H,sliceId:o.id,variationId:o.variations[0].id,langSmithUrl:e.langSmithUrl})}catch(e){if(i!==Z.current)return;if(T({index:t,slice:n=>({...n,status:e instanceof Error&&"AbortError"===e.name?"cancelled":"generateError",thumbnailUrl:r,onRetry:()=>{V({index:t,imageUrl:r,source:a})}})}),(0,o.ff)(e)){W();return}m.Xe.track({event:"slice-generation:ended",error:!0,source:a})}},X=j.reduce((e,t)=>("generating"===t.status?e.generating++:"uploading"===t.status?e.uploading++:"pending"===t.status?e.pending++:"success"===t.status&&e.completed++,e.loading=e.generating+e.uploading,e.generate=e.loading+e.pending,e),{generating:0,uploading:0,pending:0,completed:0,loading:0,generate:0}),J=X.generating>0||X.completed>0,$=()=>{X.loading>0||(p(),Z.current=crypto.randomUUID(),setTimeout(()=>C([]),250))},Y=async()=>{if(void 0!==H)try{D(!0);let e=await (0,m.y0)();P(e.libraries),U(),u({slices:j.flatMap(e=>"success"===e.status?e.model:[]),library:H}),$()}finally{D(!1)}},K=async e=>{var n;let{isShortcut:r=!1}=null!=e?e:{};if(!(!t||!R||j.some(e=>"figma"===e.source)||j.some(e=>"uploading"===e.status||"generating"===e.status))){if("function"!=typeof(null===(n=navigator.clipboard)||void 0===n?void 0:n.read)){d.Am.error("Clipboard paste is not supported in this browser.");return}try{let e=await navigator.clipboard.read();if(0===e.length){d.Am.error("No data found in clipboard.");return}let t="pasted-image.png",n=null,a=!1;for(let t of e){let e=t.types.find(e=>e.startsWith("image/"));if(void 0!==e){n=await t.getType(e);break}}for(let r of e)if(r.types.includes("text/plain"))try{let e=await r.getType("text/plain"),i=await e.text(),o=S.safeParse(JSON.parse(i));if(o.success){a=!0;let e=o.data;if(t="".concat(e.name,".png"),!n){let t=await fetch(e.image);n=await t.blob()}}else console.warn("Clipboard data validation failed:",o.error)}catch(e){console.warn("Failed to parse JSON from clipboard:",e)}if(!n){a?d.Am.error("Could not extract Figma data from clipboard. Please try copying again using the Prismic Figma plugin."):d.Am.error("No Figma data found in clipboard. Make sure you've copied a design using the Prismic Figma plugin.");return}let i=j.length;if(i>=10){d.Am.error("You can only upload ".concat(10," images at a time."));return}let o=new File([n],t,{type:n.type});C(e=>[...e,{source:"figma",status:"uploading",image:o}]),q({index:i,image:o,source:"figma"}),m.Xe.track({event:"slice-generation:pasted-from-figma",source:r?"shortcut":"button"}),d.Am.success("Pasted ".concat(t).concat(a?" from Figma":""))}catch(e){console.error("Failed to paste from clipboard:",e),d.Am.error("Failed to paste from clipboard. Please check browser permissions and try again.")}}};function Q(){let e=j.flatMap(e=>"generating"===e.status?[e.requestId]:[]);0!==e.length&&e.forEach(e=>{w.managerClient.customTypes.cancelInferSlice({requestId:e})})}return(0,r.jsxs)(i.ae,{open:t,onOpenChange:e=>!e&&$(),children:[(0,r.jsx)(i.al,{title:"Generate slices with AI"}),(0,r.jsxs)(i.aj,{gap:0,children:[(0,r.jsx)(i.ak,{hidden:!0,children:"Upload images to generate slices with AI"}),_?(0,r.jsx)(i.D,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",children:(0,r.jsx)(i.bg,{color:"purple9"})}):(0,r.jsxs)(r.Fragment,{children:[0===j.length?(0,r.jsxs)(i.D,{padding:16,height:"100%",gap:16,display:"flex",flexDirection:"column",children:[R&&(0,r.jsxs)(i.D,{display:"flex",gap:16,alignItems:"center",backgroundColor:"grey2",padding:16,borderRadius:12,children:[(0,r.jsxs)(i.D,{display:"flex",gap:8,alignItems:"center",flexGrow:1,children:[(0,r.jsx)(i.D,{width:48,height:48,backgroundColor:"grey12",borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",children:(0,r.jsx)(y,{height:25})}),(0,r.jsxs)(i.D,{display:"flex",flexDirection:"column",flexGrow:1,children:[(0,r.jsx)(i.bL,{variant:"bold",children:"Want to work faster?"}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Copy frames from Figma with the Slice Machine plugin and paste them here."})]})]}),(0,r.jsx)(i.E,{endIcon:"arrowForward",color:"indigo",onClick:()=>{window.open("https://www.figma.com/community/plugin/1567955296461153730/figma-to-slice","_blank"),m.Xe.track({event:"slice-generation:plugin-installation-clicked"})},sx:{marginRight:8},invisible:!0,children:"Install plugin"})]}),(0,r.jsx)(i.aF,{onFilesSelected:O,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(I,{onFilesSelected:O,onPaste:K,droppingFiles:!0}),children:(0,r.jsx)(I,{onFilesSelected:O,onPaste:K})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.D,{display:"flex",alignItems:"center",justifyContent:"space-between",padding:16,children:[(0,r.jsx)(i.bL,{variant:"h3",children:"Design"}),(0,r.jsx)(i.aG,{size:"medium",color:"grey",onFilesSelected:O,startIcon:"attachFile",disabled:J,children:"Add images"})]}),(0,r.jsx)(i.bn,{stableScrollbar:!1,children:(0,r.jsx)(i.D,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:j.map((e,t)=>(0,r.jsx)(v,{slice:e},"slice-".concat(t)))})})]}),(0,r.jsxs)(i.ah,{children:[X.generating>0?(0,r.jsx)(i.ai,{onClick:()=>L(!0),size:"medium",sx:{marginRight:8},invisible:!0,children:"Cancel"}):(0,r.jsx)(i.ai,{onClick:()=>$(),size:"medium",sx:{marginRight:8},invisible:!0,children:"Close"}),0===X.completed||X.loading>0?(0,r.jsxs)(i.af,{color:"purple",startIcon:"autoFixHigh",onClick:()=>{void 0!==H&&j.forEach((e,t)=>{"pending"===e.status&&V({index:t,imageUrl:e.thumbnailUrl,source:e.source})})},disabled:J||X.loading>0||0===X.pending,loading:X.loading>0,size:"medium",children:["Generate ",X.generate>0?"(".concat(X.generate,") "):"",1===X.generate?"Slice":"Slices"]}):(0,r.jsx)(i.af,{color:"purple",onClick:()=>void Y(),loading:E,size:"medium",children:k(n,X.completed)})]})]})]}),(0,r.jsxs)(i.ae,{size:"small",open:z,onOpenChange:L,children:[(0,r.jsx)(i.al,{title:"Cancel generation"}),(0,r.jsxs)(i.aj,{children:[(0,r.jsx)(i.ak,{children:(0,r.jsx)(i.D,{display:"flex",flexDirection:"column",padding:{inline:16},children:(0,r.jsx)(i.bL,{variant:"bold",children:"Are you sure you want to cancel the generation for all slices?"})})}),(0,r.jsxs)(i.ah,{children:[(0,r.jsx)(i.ai,{onClick:()=>L(!1),size:"small",children:"Keep generating"}),(0,r.jsx)(i.af,{color:"tomato",onClick:()=>{L(!1),Q()},size:"small",children:"Confirm"})]})]})]})]})}function I(e){let{droppingFiles:t=!1,onFilesSelected:n,onPaste:a}=e,o=F();return(0,r.jsx)(i.D,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:t?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:t?"purple9":"grey6",borderRadius:12,flexGrow:1,children:(0,r.jsx)(i.s,{children:(0,r.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:16,alignItems:"center",children:[(0,r.jsx)(i.x,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,alignItems:"center",children:o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.bL,{children:"Generate slices from your designs"}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Upload your design images or paste them directly from Figma."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.bL,{children:"Upload your design images."}),(0,r.jsx)(i.bL,{variant:"small",color:"grey11",children:"Once uploaded, you can generate slices automatically using AI."})]})}),(0,r.jsx)(i.D,{display:"flex",alignItems:"center",gap:16,children:o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.E,{size:"small",renderStartIcon:()=>(0,r.jsx)(y,{height:16}),color:"grey",onClick:()=>void a(),children:"Paste from Figma"}),(0,r.jsx)(i.aG,{size:"small",onFilesSelected:n,color:"purple",invisible:!0,children:"Add images"})]}):(0,r.jsx)(i.aG,{startIcon:"attachFile",onFilesSelected:n,color:"grey",children:"Add images"})})]})})})}async function A(e){let{image:t}=e,n=[await w.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await w.managerClient.screenshots.initS3ACL();let{url:r}=await w.managerClient.screenshots.uploadScreenshot({keyPrefix:n,data:t});return r}let k=(e,t)=>{switch(e){case"custom_type":return"Add to type (".concat(t,")");case"page_type":return"Add to page (".concat(t,")");case"slices":return"Done"}};function F(){let e=(0,p.L)("llm-proxy-access");return(null==e?void 0:e.value)==="on"}},51967:function(e,t,n){n.d(t,{w:function(){return k}});var r=n(52322),a=n(11699),i=n(2784),o=n(88932),s=n(94160),l=n(98250),c=n(68968),d=n(54597);let u=e=>{switch(e){case"custom_type":return"Add to type";case"page_type":return"Add to page";case"slices":return"Add to slices"}};var m=n(80148),g=n(74686),h=n(88866),f=n(30195);async function p(e,t,n){let r=Array(e.length),a=0,i=Array(Math.min(t,e.length)).fill(null).map(async()=>{for(;;){let t=a++;if(t>=e.length)break;r[t]=await n(e[t],t)}});return await Promise.all(i),r}class y{getHeaders(){let e={Accept:"application/vnd.github.v3+json"};return void 0!==this.token&&(e.Authorization="Bearer ".concat(this.token)),e}async request(e,t){let n="".concat(this.baseUrl).concat(e),r=await fetch(n,{...t,headers:{...this.getHeaders(),...null==t?void 0:t.headers}});if(!r.ok)throw Error("GitHub API request failed: ".concat(r.status," ").concat(r.statusText));return r.json()}async getDefaultBranch(){let e=await this.request("/repos/".concat(this.owner,"/").concat(this.repo));return f.z.object({default_branch:f.z.string()}).parse(e).default_branch}async getFileContents(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=await this.request("/repos/".concat(this.owner,"/").concat(this.repo,"/contents/").concat(e,"?ref=").concat(t)),a=f.z.object({content:f.z.string(),encoding:f.z.string()}).parse(r);if("base64"!==a.encoding)throw Error("Unexpected encoding for ".concat(e,": ").concat(a.encoding));let i=atob(a.content.replace(/\s/g,""));if(!n)return i;{let e=new Uint8Array(i.length);for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer}}async getDirectoryContents(e){let t=await this.request("/repos/".concat(this.owner,"/").concat(this.repo,"/contents/").concat(e));return f.z.array(f.z.object({name:f.z.string(),type:f.z.string(),path:f.z.string()})).parse(t)}async searchCode(e){let{path:t,filename:n}=e,r=[];void 0!==t&&r.push("path:".concat(t)),void 0!==n&&r.push("filename:".concat(n)),r.push("repo:".concat(this.owner,"/").concat(this.repo));let a="/search/code?q=".concat(encodeURIComponent(r.join(" "))),i=await this.request(a);return f.z.object({items:f.z.array(f.z.object({path:f.z.string(),name:f.z.string()})).optional(),total_count:f.z.number().optional()}).parse(i)}async getSliceLibraries(e){let t=await this.request("/repos/".concat(this.owner,"/").concat(this.repo,"/contents/slicemachine.config.json?ref=").concat(e)),n=f.z.object({content:f.z.string().optional(),encoding:f.z.string().optional()}).parse(t);if("string"==typeof n.content){let e=atob(n.content.replace(/\s/g,""));return f.z.object({libraries:f.z.array(f.z.string())}).parse(JSON.parse(e)).libraries}throw Error("No content found in slicemachine.config.json")}constructor(e){this.baseUrl="https://api.github.com",this.owner=e.owner,this.repo=e.repo,this.token=e.token}}let w=e=>{let t=e.match(/github\.com\/([^\/]+)\/([^\/]+)(?:\/|$)/);if(!t)throw Error("Invalid GitHub URL format");let[,n,r]=t;return{owner:n,repo:r.replace(/\.git$/,"")}},x=async e=>{let{owner:t,repo:n}=e;return new y({owner:t,repo:n}).getDefaultBranch()},b=async e=>{let{owner:t,repo:n,branch:r}=e;return new y({owner:t,repo:n}).getSliceLibraries(r)},j=async e=>{let{owner:t,repo:n,branch:r,libraries:a}=e,i=new y({owner:t,repo:n}),o=[];for(let e of(console.log("Fetching slices from ".concat(a.length," library/libraries:"),a),a)){let t=e.replace(/^\.\//,""),n=[],a=!1;try{n=(await i.getDirectoryContents(t)).filter(e=>"dir"===e.type).map(e=>({name:e.name,path:e.path}))}catch(n){a=!0;let t=n instanceof Error?n.message:String(n);t.includes("403")?console.warn("GitHub API returned 403 for ".concat(e,", trying direct discovery...")):console.warn("GitHub API error for ".concat(e,", trying direct discovery..."),t)}if(a&&0===n.length){console.log("Attempting to discover slices using GitHub Search API for ".concat(e,"..."));try{let r=await i.searchCode({path:t,filename:"model.json"});if(r.items&&r.items.length>0){let a=new Set;for(let e of r.items){let t=e.path.split("/");if(t.length>=2){let e=t[t.length-2];e&&!a.has(e)&&a.add(e)}}n=Array.from(a).map(e=>({name:e,path:"".concat(t,"/").concat(e)})),console.log("Discovered ".concat(n.length," slice(s) via GitHub Search API for library ").concat(e))}else console.warn("GitHub Search API found no model.json files in ".concat(e))}catch(n){let t=n instanceof Error?n.message:String(n);t.includes("403")?console.warn("GitHub Search API also returned 403. Cannot discover slices without API access."):console.warn("Error using GitHub Search API for ".concat(e,":"),t)}}if(0===n.length){console.warn("No slices found in library ".concat(e,". The repository may be private or require authentication."));continue}console.log("Processing ".concat(n.length," slice(s) in library ").concat(e));let s=async e=>{try{let t,n,a,s;let l=await i.getFileContents("".concat(e.path,"/model.json"),r,!1);if("string"!=typeof l){console.warn("Failed to fetch model.json for slice: ".concat(e.name," - unexpected content type"));return}let c=h.SharedSlice.decode(JSON.parse(l));if("Left"===c._tag){console.warn("Failed to decode model.json for slice: ".concat(e.name));return}let d=c.right,u=[];try{u=await v({api:i,branch:r,directoryPath:e.path}),console.log("Fetched ".concat(u.length," file(s) for slice ").concat(e.name,":"),u.map(e=>"".concat(e.path).concat(e.isBinary?" (binary)":"")))}catch(t){console.warn("Failed to fetch files for slice ".concat(e.name,":"),t instanceof Error?t.message:String(t))}for(let r of u)if(void 0===t&&r.path.match(/^index\.(tsx?|jsx?|vue|svelte)$/)&&"string"==typeof r.contents&&(t=r.contents),"mocks.json"===r.path&&"string"==typeof r.contents)try{let t=g.SharedSliceContent.decode(JSON.parse(r.contents));if("Left"===t._tag)console.warn("Failed to decode mocks.json for slice: ".concat(e.name));else{let e=t.right;Array.isArray(e)&&e.length>0&&(n=e)}}catch(t){console.warn("Failed to decode mocks.json for slice: ".concat(e.name))}let m={};void 0!==d.variations&&d.variations.length>0&&(await Promise.allSettled(d.variations.map(async t=>{try{let n="".concat(e.path,"/screenshot-").concat(t.id,".png"),o=await i.getFileContents(n,r,!0);if(o instanceof ArrayBuffer){let e=new Blob([o],{type:"image/png"}),n=new File([e],"screenshot-".concat(t.id,".png"),{type:"image/png"});m[t.id]=n,void 0===a&&void 0!==d.variations[0]&&t.id===d.variations[0].id&&(a=URL.createObjectURL(e),s=n)}}catch(e){console.warn("Failed to fetch screenshot for variation ".concat(t.id,":"),e instanceof Error?e.message:String(e))}}))).forEach((e,t)=>{if("rejected"===e.status){var n;console.warn("Failed to fetch screenshot for variation ".concat(null===(n=d.variations[t])||void 0===n?void 0:n.id,":"),e.reason instanceof Error?e.reason.message:String(e.reason))}});let f=null!=s?s:new File([],"".concat(d.name,".json"),{type:"application/json"}),p={image:f,thumbnailUrl:null!=a?a:URL.createObjectURL(f),model:d,files:u,componentContents:t,mocks:n,screenshots:Object.keys(m).length>0?m:void 0};o.push(p)}catch(t){console.warn("Error fetching slice ".concat(e.name,":"),t instanceof Error?t.message:String(t))}};await p(n,6,s)}return o},v=async e=>{let{api:t,branch:n,directoryPath:r}=e,a=[],i=!1;try{let e=await t.getDirectoryContents(r);i=!0;let o=e.filter(e=>"file"===e.type),s=e.filter(e=>"dir"===e.type);for(let e of(await p(o,8,async e=>{if("model.json"===e.name)return null;try{let r=[".png",".jpg",".jpeg",".gif",".svg",".ico",".webp"].some(t=>e.name.toLowerCase().endsWith(t)),a=await t.getFileContents(e.path,n,r);return{path:e.name,contents:a,isBinary:r}}catch(t){return console.warn("Failed to fetch file ".concat(e.path,":"),t instanceof Error?t.message:String(t)),null}})))e&&a.push(e);for(let e of s)for(let r of(await v({api:t,branch:n,directoryPath:e.path})))a.push({...r,path:"".concat(e.name,"/").concat(r.path)})}catch(e){console.warn("GitHub API failed for directory ".concat(r,", trying Search API..."),e instanceof Error?e.message:String(e))}if(!i)try{console.log("Using GitHub Search API to find all files in ".concat(r,"..."));let e=await t.searchCode({path:r});if(e.items&&e.items.length>0){for(let i of(console.log("Found ".concat(e.items.length," file(s) via Search API for ").concat(r)),await p(e.items,8,async e=>{try{if("model.json"===e.name)return null;let a=e.path.startsWith(r+"/")?e.path.slice(r.length+1):e.name,i=[".png",".jpg",".jpeg",".gif",".svg",".ico",".webp",".woff",".woff2",".ttf",".eot",".otf",".pdf",".zip",".gz"].some(t=>e.name.toLowerCase().endsWith(t)),o=await t.getFileContents(e.path,n,i);return{path:a,contents:o,isBinary:i}}catch(t){return console.warn("Error fetching file ".concat(e.path,":"),t instanceof Error?t.message:String(t)),null}})))i&&a.push(i);console.log("Fetched ".concat(a.length," file(s) from ").concat(r," via Search API"))}else console.warn("GitHub Search API found no files in ".concat(r))}catch(t){let e=t instanceof Error?t.message:String(t);e.includes("403")?console.warn("GitHub Search API returned 403 for ".concat(r,". Cannot fetch files without API access.")):console.warn("Error using GitHub Search API for ".concat(r,":"),e)}return a};var S=n(62434);function C(e){let{thumbnailUrl:t,model:n,selected:i=!0,onSelectedChange:o}=e,s=(0,r.jsxs)(r.Fragment,{children:[void 0!==t&&t?(0,r.jsx)(S.ZB,{src:t}):(0,r.jsx)(S.ZB,{component:"div"}),(0,r.jsx)(S.eW,{title:n.name,action:(0,r.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,r.jsx)(a.U,{checked:i,onCheckedChange:o})})})]});return(0,r.jsx)(S.Zb,{interactive:!0,onClick:()=>{o(!i)},checked:i,size:"small",children:s})}async function I(e){let{libraries:t=[]}=await m.managerClient.project.getSliceMachineConfig(),n=t[0];if(!n)throw Error("No library found in the config.");await p(e,3,async e=>{let{errors:t}=await m.managerClient.slices.createSlice({libraryID:n,model:e.model,componentContents:e.componentContents});if(t.length)throw Error("Failed to create slice ".concat(e.model.id,"."))});let r=await p(e,3,async e=>{let{model:t,image:r,langSmithUrl:a,mocks:i,files:o,screenshots:s}=e;if(i&&Array.isArray(i)&&i.length>0){let{errors:e}=await m.managerClient.slices.updateSliceMocks({libraryID:n,sliceID:t.id,mocks:i});e.length&&console.warn("Failed to update mocks for slice ".concat(t.id,":"),e)}return s&&Object.keys(s).length>0?await Promise.all(Object.entries(s).map(async e=>{let[r,a]=e;a.size>0&&await m.managerClient.slices.updateSliceScreenshot({libraryID:n,sliceID:t.id,variationID:r,data:a})})):r.size>0&&void 0!==t.variations&&t.variations.length>0&&await m.managerClient.slices.updateSliceScreenshot({libraryID:n,sliceID:t.id,variationID:t.variations[0].id,data:r}),console.log("About to write files for slice ".concat(t.id,":"),o?"".concat(o.length," file(s) - ").concat(o.map(e=>e.path).join(", ")):"no files"),o&&o.length>0?await A({libraryID:n,sliceID:t.id,files:o}):console.warn("No files to write for slice ".concat(t.id,". Files:"),o),{model:t,langSmithUrl:a}});return{library:n,slices:r}}async function A(e){let{libraryID:t,sliceID:n,files:r}=e;if(0===r.length)return;let a=r.filter(e=>"mocks.json"!==e.path&&!e.path.startsWith("screenshot-")&&!e.path.match(/^index\.(tsx?|jsx?|vue|svelte)$/));if(console.log("Writing ".concat(a.length," additional file(s) for slice ").concat(n,":"),a.map(e=>e.path)),0!==a.length)try{let e=a.map(e=>{if(e.isBinary)return{path:e.path,contents:e.contents,isBinary:!0};if("string"==typeof e.contents)return{path:e.path,contents:e.contents,isBinary:!1};throw Error("Unexpected file contents type for ".concat(e.path))}),r=await m.managerClient.slices.writeSliceFiles({libraryID:t,sliceID:n,files:e});r.errors.length>0?console.error("Errors writing files for slice ".concat(n,":"),r.errors.map(e=>{var t;return null!==(t=e.message)&&void 0!==t?t:String(e)})):console.log("Successfully wrote ".concat(a.length," file(s) for slice ").concat(n))}catch(e){console.error("Error writing files for slice ".concat(n,":"),e instanceof Error?e.message:String(e))}}function k(e){let{open:t,location:n,onSuccess:g,onClose:h}=e,[f,p]=(0,i.useState)(!1),[y,v]=(0,i.useState)(""),[S,A]=(0,i.useState)(new Set),{syncChanges:k}=(0,c.g)(),{createSliceSuccess:F,updateSliceMockSuccess:E}=(0,d.Z)(),{completeStep:D}=(0,l.k)(),z=function(e){let{open:t}=e,n=(0,i.useRef)([]);return(0,i.useEffect)(()=>{t&&(n.current=[],m.managerClient.slices.readAllSlices().then(e=>{n.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),n}({open:t}),{isLoadingSlices:L,handleImportFromGithub:U,slices:P,resetSlices:B}=function(){let[e,t]=(0,i.useState)(!1),[n,r]=(0,i.useState)([]);return{isLoadingSlices:e,slices:n,resetSlices:()=>{r([]),t(!1)},handleImportFromGithub:async e=>{try{let n;t(!0);let{owner:a,repo:i}=w(e);if(!a||!i){o.Am.error("Invalid GitHub URL format"),t(!1);return}let s=await x({owner:a,repo:i});try{n=await b({owner:a,repo:i,branch:s})}catch(e){console.error("Failed to fetch slicemachine.config.json:",e),o.Am.error("Failed to fetch slicemachine.config.json: ".concat(e instanceof Error?e.message:"Unknown error")),t(!1);return}if(0===n.length){console.warn("No libraries were found in the SM config."),t(!1),o.Am.error("No libraries were found in the SM config.");return}let l=await j({owner:a,repo:i,branch:s,libraries:n});if(0===l.length){o.Am.error("Error fetching slices from the repository"),t(!1);return}r(l),t(!1),o.Am.success("Found ".concat(l.length," slice(s) from ").concat(n.length," library/libraries"))}catch(e){console.error("Error importing from GitHub:",e),o.Am.error("Error importing from GitHub: ".concat(e instanceof Error?e.message:"Unknown error")),t(!1)}}}}();(0,i.useEffect)(()=>{if(0===P.length)return;let e=new Set;for(let t of P)e.add(t.model.id);A(e)},[P]);let G=(0,i.useRef)(crypto.randomUUID()),N=P.filter(e=>S.has(e.model.id)),R=P.length>0&&S.size===P.length,H=S.size>0&&S.size<P.length,_="Select all slices";return R?_="Selected all slices (".concat(S.size,")"):H&&(_="".concat(S.size," of ").concat(P.length," selected")),(0,r.jsxs)(a.ae,{open:t,onOpenChange:e=>{e||f||(h(),G.current=crypto.randomUUID(),v(""),A(new Set),B())},children:[(0,r.jsx)(a.al,{title:"Import slices from library"}),(0,r.jsxs)(a.aj,{gap:0,children:[(0,r.jsx)(a.ak,{hidden:!0,children:"Import slices from a github repository"}),0===P.length?(0,r.jsx)(a.D,{padding:16,height:"100%",flexDirection:"column",gap:16,children:(0,r.jsx)(a.D,{flexDirection:"column",gap:8,children:(0,r.jsxs)(a.D,{display:"flex",flexDirection:"column",gap:8,padding:16,border:!0,borderRadius:8,children:[(0,r.jsx)(a.bL,{color:"grey11",children:"Import from GitHub"}),(0,r.jsx)(a.bN,{placeholder:"https://github.com/username/repository",value:y,onValueChange:v}),(0,r.jsx)(a.E,{onClick:()=>void U(y),disabled:!y.trim()||L,loading:L,color:"purple",children:L?"Loading slices...":"Import from GitHub"})]})})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.D,{display:"flex",alignItems:"center",justifyContent:"space-between",padding:16,border:{bottom:!0},children:(0,r.jsx)(a.D,{display:"flex",alignItems:"center",gap:8,children:(0,r.jsx)(a.aR,{value:_,children:(0,r.jsx)(a.U,{checked:R,indeterminate:H,onCheckedChange:e=>{if(e){let e=new Set;for(let t of P)e.add(t.model.id);A(e)}else A(new Set)}})})})}),(0,r.jsx)(a.bn,{stableScrollbar:!1,children:(0,r.jsx)(a.D,{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:16,padding:16,children:P.map(e=>(0,r.jsx)(C,{model:e.model,thumbnailUrl:e.thumbnailUrl,selected:S.has(e.model.id),onSelectedChange:t=>{t?A(t=>{let n=new Set(t);return n.add(e.model.id),n}):A(t=>{let n=new Set(t);return n.delete(e.model.id),n})}},e.model.id))})})]}),(0,r.jsxs)(a.ah,{children:[(0,r.jsx)(a.ai,{disabled:f}),(0,r.jsxs)(a.af,{disabled:0===N.length,loading:f,onClick:()=>{let e=P.reduce((e,t)=>(S.has(t.model.id)&&e.push({image:t.image,model:t.model,files:t.files,componentContents:t.componentContents,mocks:t.mocks,screenshots:t.screenshots}),e),[]);if(!e.length){o.Am.error("Please select at least one slice to import");return}let t=[];for(let n of e){let e=function(e){let{existingSlices:t,newSlices:n,slice:r}=e,a=new Set,i=new Set;for(let{id:e,name:n}of t)a.add(e),i.add(n.toLowerCase());for(let e of n)a.add(e.model.id),i.add(e.model.name.toLowerCase());let o=r.id,s=2;for(;a.has(o);)o="".concat(r.id,"_").concat(s),s++;let l=r.name;for(s=2;i.has(l.toLowerCase());)l="".concat(r.name).concat(s),s++;return{...r,id:o,name:l}}({existingSlices:z.current,newSlices:t,slice:n.model});t.push({...n,model:e})}let r=G.current;p(!0),I(t).then(async a=>{let{slices:i,library:o}=a;if(r===G.current){for(let n of(await new Promise(e=>setTimeout(e,100)),F((await (0,s.y0)()).libraries.map(e=>e.name!==o?e:{...e,components:e.components.map(e=>{let n=t.find(t=>t.model.id===e.model.id),r=e.mocks&&e.mocks.length>0?e.mocks:null==n?void 0:n.mocks;return{...e,mocks:null!=r?r:e.mocks}})})),e))n.mocks&&Array.isArray(n.mocks)&&n.mocks.length>0&&E({libraryID:o,sliceID:n.model.id,mocks:n.mocks});for(let{model:e}of(k(),g({slices:i,library:o}),p(!1),G.current=crypto.randomUUID(),B(),D("createSlice"),i))s.Xe.track({event:"slice:created",id:e.id,name:e.name,library:o,location:n,mode:"import"})}}).catch(()=>{r===G.current&&(p(!1),o.Am.error("An unexpected error happened while adding slices."))})},children:[u(n)," (",N.length,")"]})]})]})]})}},27213:function(e,t,n){n.d(t,{F:function(){return i}});var r=n(52322),a=n(11699);let i=e=>{let{menuType:t}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(a.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)(a.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)(a.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)(a.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."},importFromExternal:{BackgroundIcon:(0,r.jsx)(a.B,{name:"cloudUpload",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Add from external library",description:"Import slices from a github repository."}}}},6256:function(e,t,n){n.d(t,{c:function(){return x}});var r=n(52322),a=n(2784),i=n(36131),o=n(75289),s=n(94160),l=n(98250),c=n(88932),d=n(63908),u=n(358),m=n(80148);async function g(e){let{sliceName:t,libraryName:n,location:r,onSuccess:a}=e;try{let e=(0,d.fo)(t),{errors:i}=await m.managerClient.slices.createSlice({libraryID:n,model:e});if(i.length>0)throw i;s.Xe.track({event:"slice:created",id:(0,u.MP)(t),name:t,library:n,location:r,mode:"manual"}),await a(e)}catch(n){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,n),c.Am.error(e)}}var h=n(68968),f=n(59532),p=n(54597),y=n(46999),w=n(63019);let x=e=>{let{onClose:t,onSuccess:n,localLibraries:c,location:d,remoteSlices:u}=e,{createSliceSuccess:m}=(0,p.Z)(),[x,b]=(0,a.useState)(!1),{syncChanges:j}=(0,h.g)(),{completeStep:v}=(0,l.k)(),S=async e=>{let t=e.sliceName,r=e.from;b(!0),await g({sliceName:t,libraryName:r,location:d,onSuccess:async e=>{m((await (0,s.y0)()).libraries),n(e,r),j(),v("createSlice")}})};return(0,r.jsx)(f.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:x,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{S(e)},initialValues:{sliceName:"",from:c[0].name},validate:e=>(0,w.h)(e,c,u),content:{title:"Create a new slice"},children:e=>{let{touched:t,values:n,setFieldValue:a,errors:s}=e;return(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(y.W,{name:"sliceName",label:"Slice name",placeholder:"Pascalised slice API ID (e.g. TextBlock)",error:t.sliceName?s.sliceName:void 0,testId:"slice-name-input"}),(0,r.jsx)(o.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(i.ZP,{name:"from",options:c.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void a("from",e.value):null,defaultValue:{value:n.from,label:n.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,t,n){n.d(t,{h:function(){return l}});var r=n(96009),a=n.n(r),i=n(74600),o=n.n(i),s=n(7974);function l(e,t,n){let{sliceName:r}=e;return r?s.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:s.xo.exec(r)?o()(a()(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)),...n.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,n){var r=n(52322),a=n(75289);t.Z=function(e){let{elems:t,renderElem:n,defineElementKey:i,gridTemplateMinPx:o="320px",gridGap:s="16px",sx:l}=e;return(0,r.jsx)(a.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(o,", 1fr))"),gridGap:s,pt:2,...l},children:t.map((e,t)=>e?(0,r.jsx)("span",{children:n(e,t)},"".concat(i(e),"-").concat(t+1)):null)})}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[489],{19489:function(e,t,l){"use strict";l.d(t,{H:function(){return e6}});var n=l(52322),i=l(11699),a=l(97729),o=l.n(a),r=l(5632),s=l(2784),c=l(56580),d=l(43388),m=l(77630),u=l(23094),h=l(59294),p=l(58446),x=l(74217),v=l(94160),b=l(68968),y=l(23710),g=l(54597),f=l(98564);let j=(0,s.createContext)(void 0);function S(e){let{children:t,initialCustomType:l}=e,[i,a]=(0,s.useState)(l),o=(0,m.y6)(i),r=f.$[o],{actionQueueStatus:c,setNextAction:d}=(0,y.c)({errorMessage:r.autoSaveFailed}),{refreshState:u}=(0,g.Z)(),h=(0,x.R9)(u),{syncChanges:p}=(0,b.g)(),S=(0,s.useCallback)(e=>{let{customType:t,onSaveCallback:l,updateMeta:n}=e;a(t),d(async()=>{let{errors:e}=await (0,v.KA)({customType:t,updateMeta:n});if(e.length>0)throw e;h(await (0,v.y0)()),p(),null==l||l()})},[d,h,p]),I=(0,s.useMemo)(()=>({actionQueueStatus:c,customType:i,setCustomType:S}),[c,i,S]);return(0,n.jsx)(j.Provider,{value:I,children:"function"==typeof t?t(I):t})}function I(){let e=(0,s.useContext)(j);if(!e)throw Error("CustomTypeProvider not found");return e}var C=l(30195);function T(){var e;let[t,l]=(0,s.useState)(!1),{customType:a,setCustomType:o}=I(),[r,c]=null!==(e=(0,m.j5)(a))&&void 0!==e?e:[],d=c?(0,m.N3)(c):"",[u,h]=(0,s.useState)(null!=d?d:""),[p,v]=(0,s.useState)();(0,x.pQ)(t,()=>{t||(h(null!=d?d:""),v(void 0))});let b=(0,s.useCallback)(()=>(0,n.jsx)(i.aX,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,n.jsxs)(i.ae,{open:t,onOpenChange:l,size:"small",trigger:(0,n.jsx)(i.E,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:b,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,n.jsx)(i.al,{title:"Edit the UID label"}),(0,n.jsx)(i.aj,{children:(0,n.jsxs)(i.aJ,{onSubmit:function(){p||(o({customType:c?(0,m.eK)(u,a):(0,m.H8)(u,a)}),l(!1))},children:[(0,n.jsx)(i.D,{flexDirection:"column",padding:16,gap:4,children:(0,n.jsx)(i.aM,{type:"text",label:"Label *",placeholder:"UID",value:u,onValueChange:function(e){h(e),v(function(e){let t=D.safeParse(e,{errorMap:k});if(t.error)return t.error.errors[0].message}(e))},error:p,description:"A label for the UID"})}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",disabled:!!p,children:"Save"})]})]})})]})}let D=C.z.string().max(35).min(1),k=e=>{switch(e.code){case C.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case C.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var w=l(94840),_=l(59532),E=l(63397),L=l(75289);let A=e=>{let{name:t,label:l,placeholder:i,error:a,...o}=e;return(0,n.jsxs)(L.xu,{mb:3,children:[(0,n.jsx)(L.__,{htmlFor:t,mb:2,children:l}),(0,n.jsx)(E.gN,{name:t,type:"text",placeholder:i,as:L.II,autoComplete:"off",...o}),a?(0,n.jsx)(L.xv,{sx:{color:"error",mt:1},children:a}):null]})};var M=e=>{let{isOpen:t,onSubmit:l,close:i,tabIds:a}=e;return(0,n.jsx)(_.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,onSubmit:e=>{l(e),i()},initialValues:{id:""},validate:e=>{let{id:t}=e;return t?a.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Add Tab"},children:e=>{let{errors:t}=e;return(0,n.jsx)(A,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},N=e=>{let{isOpen:t,onSubmit:l,close:i}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),i()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,n.jsxs)(L.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(L.X6,{as:"h4",children:"Remove this tab?"}),(0,n.jsx)(L.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,n.jsx)(L.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),i()},children:"Yes, remove tab"})]})})},z=e=>{let{isOpen:t,onSubmit:l,close:i,tabIds:a,initialTabKey:o}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),i()},initialValues:{id:o},validate:e=>{let{id:t}=e;return t?a.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Rename Tab"},children:e=>{let{errors:t,values:a,setFieldValue:o,isValid:r}=e;return(0,n.jsxs)(L.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(A,{name:"id",label:"Rename Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id,onBlur:e=>{a.id!==e.target.value&&o("id",e.target.value.trim())},onChange:e=>{o("id",e.target.value)}}),(0,n.jsx)(L.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!r,onClick:()=>{a.id&&a.id.length&&l({id:a.id.trim()}),i()},children:"Save"})]})}})},Z=l(28316),O=l(88932),F=l(35289),P=l(87446),K=l(45440),B=l(16086),R=l(358),U=l(5495),V=l(39302),X=l(3285),G=l(40141),Y=l(65077),q=l(21446),H=l(51967),Q=l(27213);let W=e=>{let{openCreateSliceModal:t,openCreateSliceFromImageModal:l,openUpdateSliceZoneModal:a,openImportSlicesFromLibraryModal:o,openSlicesTemplatesModal:r,projectHasAvailableSlices:s,isSlicesTemplatesSupported:c}=e,d=(0,Q.F)({menuType:"ActionList"});return(0,n.jsxs)(i.s,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,n.jsx)(i.x,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,n.jsx)(i.z,{size:"big",children:"Add slices"}),(0,n.jsx)(i.w,{children:"Slices are reusable website sections. You can use them on different pages and write unique content for each. Each slice has its own component in your code."}),(0,n.jsx)(i.v,{children:(0,n.jsxs)(i.A,{children:[(0,n.jsx)(i.b,{renderStartIcon:()=>d.fromImage.BackgroundIcon,onClick:l,description:d.fromImage.description,children:d.fromImage.title}),(0,n.jsx)(i.b,{renderStartIcon:()=>d.fromScratch.BackgroundIcon,onClick:t,description:d.fromScratch.description,children:d.fromScratch.title}),c&&(0,n.jsx)(i.b,{renderStartIcon:()=>d.fromTemplate.BackgroundIcon,onClick:r,description:d.fromTemplate.description,children:d.fromTemplate.title}),s&&(0,n.jsx)(i.b,{renderStartIcon:()=>d.fromExisting.BackgroundIcon,onClick:a,description:d.fromExisting.description,children:d.fromExisting.title}),(0,n.jsx)(i.b,{renderStartIcon:()=>d.importFromExternal.BackgroundIcon,onClick:o,description:d.importFromExternal.description,children:d.importFromExternal.title})]})})]})};var $=l(98250);function J(e){let{customType:t,tabId:l,slices:n}=e,i={...t};return n.forEach(e=>{i={...i,tabs:i.tabs.map(t=>t.key===l&&t.sliceZone?{...t,sliceZone:{key:t.sliceZone.key,value:[{key:e.id,value:e},...t.sliceZone.value]}}:t)}}),v.Xe.track({event:"custom-type:slice-zone-updated",customTypeId:t.id}),i}var ee=l(18566),et=l(80148);async function el(){try{let{templates:e,errors:t}=await et.managerClient.sliceTemplateLibrary.readLibrary({});if(t.length>0)throw t;return e.map(e=>({model:e.model,screenshots:Object.fromEntries(Object.entries(e.screenshots).map(e=>{let[t,l]=e;return[t,URL.createObjectURL(l)]}))}))}catch(e){return[]}}var en=l(6256),ei=l(39204),ea=l(7723),eo=l(33986),er=l(30527),es=l(55862);let ec=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,n.jsx)(es.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,n.jsx)(er.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:(0,n.jsxs)(L.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,n.jsx)(L.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,n.jsx)(L.x8,{type:"button",onClick:l})]}),Footer:()=>(0,n.jsxs)(L.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,n.jsx)(eo.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,n.jsx)(eo.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,n.jsx)(L.nv,{children:"You're about to delete Slice Zone."})})})};var ed=l(84879),em=l(62434),eu=l(63908),eh=l(63019),ep=l(65375),ex=l.n(ep);let ev=e=>{var t;let{isOpen:l,close:a,onSubmit:o,isLoading:r,slice:d,libraries:m}=e,{remoteSlices:u}=(0,c.v9)(e=>({remoteSlices:(0,ea.sT)(e)})),h={from:null===(t=m[0])||void 0===t?void 0:t.name,sliceName:(0,R.MP)(d.key)},[p,v]=(0,s.useState)(h),[b,y]=(0,s.useState)();function g(e){v(e),y((0,eh.h)(e,m,u))}return(0,x.pQ)(l,()=>{l||(v(h),y(void 0))}),(0,n.jsxs)(i.ae,{open:l,onOpenChange:e=>!e&&a(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Upgrade slice"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){b&&Object.keys(b).length>0||o({libraryID:p.from,sliceID:p.sliceName})},children:(0,n.jsxs)(i.D,{flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ex().scrollArea,children:[(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"This will create a new slice with the same fields. The new slice will replace the legacy slice in all of your types, and the existing slice content will be re-mapped to the new slice."}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,n.jsxs)(i.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)(i.aM,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,R.MP)(d.key),")"),error:null==b?void 0:b.sliceName,value:p.sliceName,onValueChange:e=>g({...p,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,n.jsxs)(i.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)("label",{className:ex().label,children:(0,n.jsx)(i.bL,{variant:"bold",children:"Slice library *"})}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:p.from,onValueChange:e=>{e&&g({...p,from:e})},children:m.map(e=>(0,n.jsx)(i.bt,{value:e.name,children:e.name},e.name))}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:r,disabled:b&&Object.keys(b).length>0,children:"Upgrade"})]})]})})})]})};var eb=l(96009),ey=l.n(eb);let eg=e=>{var t,l;let{isOpen:a,close:o,onSubmit:r,isLoading:c,slice:d,sliceName:m,libraries:u,localSharedSlices:h}=e,p={libraryID:null===(t=h[0])||void 0===t?void 0:t.from,sliceID:null===(l=h[0])||void 0===l?void 0:l.model.id,variationID:ey()(d.key),variationName:m},[v,b]=(0,s.useState)(!0),[y,g]=(0,s.useState)(p),[f,j]=(0,s.useState)({});function S(e){g(e),j(ef(e,u))}return(0,x.pQ)(a,()=>{a||(g(p),j({}))}),(0,n.jsxs)(i.ae,{open:a,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Convert to slice variation"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){Object.keys(f).length>0||r(y)},children:(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ex().scrollArea,children:[(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ex().label,children:[(0,n.jsx)(i.bL,{variant:"bold",children:"Target slice *"}),"string"==typeof f.libraryID?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:f.libraryID}):null,"string"==typeof f.sliceID?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:f.sliceID}):null]}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:"".concat(y.libraryID,"::").concat(y.sliceID),onValueChange:e=>{if(e){let[t,l]=e.split("::");S({...y,libraryID:t,sliceID:l})}},children:h.map(e=>(0,n.jsxs)(i.bt,{value:"".concat(e.from,"::").concat(e.model.id),children:[e.from," ",">"," ",e.model.name," (",e.model.id,")"]},"".concat(e.from,"::").concat(e.model.id)))}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,n.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(i.aM,{label:"Variation name *",placeholder:m,error:f.variationName,value:y.variationName,onValueChange:e=>{let t={...y,variationName:e.slice(0,30)};v&&(t.variationID=ey()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,n.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(i.aM,{label:"ID *",placeholder:ey()(d.key),error:f.variationID,value:y.variationID,onValueChange:e=>{b(!1),S({...y,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:c,disabled:Object.keys(f).length>0,children:"Convert"})]})]})})})]})},ef=(e,t)=>{let l={};e.libraryID||(l.libraryID="Cannot be empty.");let n=t.find(t=>t.path===e.libraryID);l.libraryID||n||(l.libraryID="Does not exist."),e.sliceID||(l.sliceID="Cannot be empty.");let i=null==n?void 0:n.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||i||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var a;(null!==(a=null==i?void 0:i.model.variations.map(e=>e.id))&&void 0!==a?a:[]).includes(e.variationID)&&(l.variationID="Slice variation ID is already taken.")}else l.variationID="Cannot be empty.";return l},ej=e=>{var t,l;let{isOpen:a,close:o,onSubmit:r,isLoading:c,identicalSlices:d}=e,m=null!==(l=null===(t=d[0])||void 0===t?void 0:t.path)&&void 0!==l?l:"",[u,h]=(0,s.useState)(m),[p,v]=(0,s.useState)();return(0,x.pQ)(a,()=>{a||(h(m),v(void 0))}),(0,n.jsxs)(i.ae,{open:a,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Merge with an existing slice"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){if(p)return;let[e,t,l]=u.split("::");r({libraryID:e,sliceID:t,variationID:l})},children:(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ex().scrollArea,children:[(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"If you have multiple identical slices, you can merge them. All of your content will be remapped to the target slice."}),(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ex().label,children:[(0,n.jsx)(i.bL,{variant:"bold",children:"Target slice*"}),"string"==typeof p?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:p}):null]}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:u,onValueChange:function(e){h(e),e||v("Cannot be empty.")},children:d.map(e=>(0,n.jsx)(i.bt,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:c,disabled:!!p,children:"Merge"})]})]})})})]})},eS=e=>{var t;let{slice:l,path:a}=e,{refreshState:o}=(0,g.Z)(),[r,d]=(0,s.useState)(!1),[m,u]=(0,s.useState)(),{setCustomType:h}=I(),{libraries:p}=(0,c.v9)(e=>({libraries:(0,ea.Sd)(e)})),x="Slice"===l.value.type&&null!==(t=l.value.fieldset)&&void 0!==t?t:l.key,b=p.filter(e=>e.isLocal),y=b.map(e=>e.components).flat(),f=eI(l,x,y),j=async e=>{var t,n,i;if(!m)return;d(!0),v.Xe.track({event:"legacy-slice:converted",id:e.sliceID,variation:null!==(t=e.variationID)&&void 0!==t?t:"default",library:e.libraryID,conversionType:m});let{errors:r}=await et.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...a,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(n=e.variationName)&&void 0!==n?n:"Default",variationID:null!==(i=e.variationID)&&void 0!==i?i:"default"}});if(r.length)throw console.error("Could not convert slice `".concat(x,"`"),r),O.Am.error("Could not convert slice `".concat(x,"`")),r;let{model:s,errors:c}=await et.managerClient.customTypes.readCustomType({id:a.customTypeID});if(c.length||!s){console.error("Could not refresh custom type view `".concat(a.customTypeID,"`"),c),O.Am.error("Could not refresh custom type view `".concat(a.customTypeID,"`"));return}switch(o(await (0,v.y0)()),d(!1),u(void 0),m){case"as_new_slice":O.Am.success("".concat(x," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":O.Am.success("".concat(x," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:O.Am.success("".concat(x," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h({customType:s})},S={path:a,slice:l,sliceName:x,libraries:b,localSharedSlices:y,identicalSlices:f,close:()=>u(void 0),onSubmit:j,isLoading:r};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.ar,{children:[(0,n.jsx)(i.av,{children:(0,n.jsx)(i.E,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,n.jsxs)(i.as,{align:"start",children:[(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>u("as_new_slice"),children:"Upgrade slice"}),(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>u("as_new_variation"),disabled:!y.length,children:"Convert to slice variation"}),(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>u("merge_with_identical"),disabled:!f.length,children:"Merge with another slice"})]})]}),(0,n.jsx)(ev,{...S,isOpen:"as_new_slice"===m}),(0,n.jsx)(eg,{...S,isOpen:"as_new_variation"===m}),(0,n.jsx)(ej,{...S,isOpen:"merge_with_identical"===m})]})},eI=(e,t,l)=>(0,s.useMemo)(()=>{let n=[],i=(0,eu.ux)(e.value,t);for(let e of l)for(let t of e.model.variations){let l=(0,eu.ux)(t,e.model.name);i.primary===l.primary&&i.items===l.items&&n.push({libraryID:e.from,sliceID:e.model.id,variationID:t.id,path:"".concat(e.from,"::").concat(e.model.id,"::").concat(t.id)})}return n},[e,t,l]),eC=e=>{let{slice:t,path:l}=e,[a]=(0,ed.E)("legacySliceUpgrader"),o=a.enabled?"This Slice was created with the Legacy Builder. It needs to be converted first to be used within Slice Machine.":"This Slice was created with the Legacy Builder, and is incompatible with Slice Machine. You cannot edit, push, or delete it in Slice Machine. In order to proceed, manually remove the Slice from your type model. Then create a new Slice with the same fields using Slice Machine.";return(0,n.jsxs)(em.Zb,{children:[(0,n.jsx)(em.ZB,{component:"div",children:(0,n.jsx)(i.D,{alignItems:"center",justifyContent:"center",children:(0,n.jsx)(i.bL,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,n.jsxs)(em.T$,{children:[(0,n.jsx)(i.c3,{content:o,side:"bottom",children:(0,n.jsx)(i.m,{color:"purple",title:"Legacy Slice"})}),a.enabled?(0,n.jsx)(eS,{slice:t,path:l}):null]}),(0,n.jsx)(em.eW,{subtitle:"1 variation",title:(0,eu.Dj)(t.value)})]})};var eT=l(51507),eD=l(21151);let ek=e=>{let{slices:t,format:l,path:i,onRemoveSharedSlice:a}=e,o=t.some(e=>"SharedSlice"!==e.type),r=f.$[l],[c]=(0,ed.E)("legacySliceUpgrader");return(0,s.useEffect)(()=>{o&&(c.enabled?O.Am.info("This ".concat(r.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):O.Am.warning("This ".concat(r.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[o]),(0,n.jsx)(eD.Z,{elems:t,defineElementKey:e=>"SharedSlice"!==e.type?e.payload.key:e.payload.model.name,renderElem:e=>{if("SharedSlice"!==e.type){let t=e.payload;return(0,n.jsx)(eC,{slice:t,path:i})}{let t=e.payload;return(0,n.jsx)(eT.b,{action:{type:"remove",onRemove:()=>{a(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function ew(e){try{let{templateIDs:t,localLibrariesNames:l,location:n,onSuccess:i}=e,{data:a,errors:o}=await et.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(o.length>0||void 0===a)throw o;a.sliceIDs.forEach((e,i)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:n,mode:"template",sliceTemplate:t[i]})}),await i(a.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),O.Am.error(e)}}var e_=l(26109),eE=e=>{let{availableSlices:t,values:l}=e;return(0,n.jsx)(E.F2,{name:"sliceKeys",render:e=>(0,n.jsx)(eD.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{let i=l.sliceKeys.includes(t.model.id);return(0,n.jsx)(eT.b,{action:{type:"checkbox"},mode:"selection",onSelectedChange:n=>{n?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:i,slice:t,variant:"outlined"})}})})};let eL=e=>{let{formId:t,close:l,onSuccess:i,availableSlicesTemplates:a,localLibraries:o,location:r}=e,{createSliceSuccess:s}=(0,g.Z)();return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;ew({templateIDs:t,localLibrariesNames:o.map(e=>e.name),location:r,onSuccess:async e=>{s((await (0,v.y0)()).libraries),i(await Promise.all(e.map(async e=>(await et.managerClient.slices.readSlice({libraryID:o[0].name,sliceID:e})).model).filter(e=>void 0!==e)))}})},initialValues:{sliceKeys:[]},content:{title:"Use template slices"},validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one template to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(L.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eE,{values:t,availableSlices:a.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:e_.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})}))})}})};var eA=e=>{let{formId:t,close:l,onSubmit:i,availableSlices:a}=e;return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;i(t.map(e=>{var t;return null===(t=a.find(t=>t.model.id===e))||void 0===t?void 0:t.model}).filter(e=>void 0!==e))},initialValues:{sliceKeys:[]},content:{title:"Select existing slices"},testId:"update-slices-modal",validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one slice to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(L.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eE,{values:t,availableSlices:a})}})};let eM=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:n,notFound:i}=e.value.reduce((e,t)=>{let{key:n,value:i}=t;if("SharedSlice"===i.type){let t=l.find(e=>e.model.id===n);return t?{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"SharedSlice",payload:t}]}:{...e,notFound:[...e.notFound,{key:n}]}}return{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"Slice",payload:{key:n,value:i}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:n,notFound:i}};var eN=e=>{var t;let{customType:l,onCreateSliceZone:a,onDeleteSliceZone:o,onRemoveSharedSlice:r,sliceZone:d,tabId:m}=e,u=(0,ee.QT)(el,[]),[h,p]=(0,s.useState)(!1),[x,b]=(0,s.useState)(!1),[y,f]=(0,s.useState)(!1),[j,S]=(0,s.useState)(!1),[C,T]=(0,s.useState)(!1),{remoteSlices:D,libraries:k}=(0,c.v9)(e=>({remoteSlices:(0,ea.sT)(e),libraries:(0,ea.Sd)(e),slices:(0,ea.xC)(e)})),{setCustomType:_}=I(),{completeStep:E}=(0,$.k)(),{openLoginModal:L}=(0,g.Z)(),A=(0,Q.F)({menuType:"Dropdown"}),M=k.filter(e=>e.isLocal),{availableSlices:N,slicesInSliceZone:z,notFound:Z}=(0,s.useMemo)(()=>d?eM(d,k):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,k]),[P,K]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(null==Z?void 0:Z.length)&&Z.forEach(e=>{let{key:t}=e;r(t)})},[Z]);let B=z.filter(e=>"SharedSlice"===e.type).map(e=>e.payload),R=N.filter(e=>!B.some(t=>t.model.id===e.model.id)),U=()=>{b(!0)},V=()=>{f(!0)},X=async()=>{await et.managerClient.user.checkIsLoggedIn()?S(!0):L()},G=()=>{p(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},eo=()=>{T(!0)},er=()=>{b(!1)},es=()=>{f(!1)},ed=()=>{S(!1)},em=()=>{p(!1)},eu=()=>{T(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(F.Bu,{actions:d?(0,n.jsxs)(i.ar,{children:[(0,n.jsx)(i.av,{children:(0,n.jsx)(i.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,n.jsxs)(i.as,{align:"end",children:[(0,n.jsx)(i.at,{renderStartIcon:()=>A.fromImage.BackgroundIcon,onSelect:()=>void X(),description:A.fromImage.description,children:A.fromImage.title}),(0,n.jsx)(i.at,{renderStartIcon:()=>A.fromScratch.BackgroundIcon,onSelect:V,description:A.fromScratch.description,children:A.fromScratch.title}),u.length>0?(0,n.jsx)(i.at,{onSelect:G,renderStartIcon:()=>A.fromTemplate.BackgroundIcon,description:A.fromTemplate.description,children:A.fromTemplate.title}):void 0,R.length>0?(0,n.jsx)(i.at,{onSelect:U,renderStartIcon:()=>A.fromExisting.BackgroundIcon,description:A.fromExisting.description,children:A.fromExisting.title}):void 0,(0,n.jsx)(i.at,{onSelect:eo,renderStartIcon:()=>A.importFromExternal.BackgroundIcon,description:A.importFromExternal.description,children:A.importFromExternal.title})]})]}):void 0,toggle:"page"!==l.format||"Main"!==m?(0,n.jsx)(i.bC,{checked:!!d,onCheckedChange:e=>{e?a():K(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:"Slices"}),d?z.length>0?(0,n.jsx)(Y.xR,{children:(0,n.jsx)(ek,{slices:z,format:l.format,path:{customTypeID:l.id,tabID:m,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:r})}):(0,n.jsx)(i.D,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,n.jsx)(W,{openUpdateSliceZoneModal:U,openCreateSliceModal:V,openCreateSliceFromImageModal:()=>void X(),openImportSlicesFromLibraryModal:()=>void eo(),openSlicesTemplatesModal:G,projectHasAvailableSlices:R.length>0,isSlicesTemplatesSupported:u.length>0})}):void 0,x&&(0,n.jsx)(eA,{formId:"tab-slicezone-form-".concat(m),availableSlices:R,onSubmit:e=>{let t=J({customType:l,tabId:m,slices:e});_({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success("Slice(s) added to slice zone")}}),E("createSlice"),er()},close:er}),h&&(0,n.jsx)(eL,{formId:"tab-slicezone-form-".concat(m),availableSlicesTemplates:u,localLibraries:M,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=J({customType:l,tabId:m,slices:e});_({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(ei.GX,{message:"Slice template(s) added to slice zone and created at: ",path:"".concat(M[0].name,"/")}))}}),E("createSlice"),em()},close:em}),P&&(0,n.jsx)(ec,{closeDeleteSliceZoneModal:()=>{K(!1)},deleteSliceZone:()=>{o(),K(!1)}}),(null==M?void 0:M.length)!==0&&y&&(0,n.jsx)(en.c,{onSuccess:e=>{let t=J({customType:l,tabId:m,slices:[e]});_({customType:w.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(ei.GX,{message:"New slice added to slice zone and created at: ",path:"".concat(M[0].name,"/")}))}}),es()},localLibraries:M,location:"".concat(l.format,"_type"),remoteSlices:D,onClose:es}),(0,n.jsx)(q.S,{open:j,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:i}=e,a=J({customType:l,tabId:m,slices:t});_({customType:w.Dc.fromSM(a),onSaveCallback:()=>{O.Am.success((0,n.jsx)(ei.GX,{message:"Slice(s) added to slice zone and created at: ",path:i}))}}),ed()},onClose:ed}),(0,n.jsx)(H.w,{open:C,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:i}=e,a=J({customType:l,tabId:m,slices:t.map(e=>e.model)});_({customType:w.Dc.fromSM(a),onSaveCallback:()=>{O.Am.success((0,n.jsx)(ei.GX,{message:"Slice(s) added to slice zone and created at: ",path:i}))}}),eu()},onClose:eu})]})};let ez=[K.C.UID,K.C.Image,K.C.Text,K.C.StructuredText,K.C.Link,K.C.Select,K.C.Boolean,K.C.Number,K.C.Color,K.C.Date,K.C.Table,K.C.Embed,K.C.Timestamp,K.C.GeoPoint,K.C.ContentRelationship,K.C.LinkToMedia,K.C.Group,K.C.NestedGroup];var eZ=e=>{var t,l,a,o;let{tabId:r}=e,{customType:c,setCustomType:d}=I(),u=w.Dc.toSM(c),h=null===(t=u.tabs.find(e=>e.key===r))||void 0===t?void 0:t.sliceZone,p=null!==(a=null===(l=u.tabs.find(e=>e.key===r))||void 0===l?void 0:l.value)&&void 0!==a?a:[],x="page"===u.format&&u.repeatable?p.filter(e=>"uid"!==e.key):p,v=u.tabs.reduce((e,t)=>[...e,...t.value],[]),b=e=>{var t;let{apiId:l,value:n}=e,i=null===(t=n.config)||void 0===t?void 0:t.label;if((0,B.Ss)(K.C,n.type)||null==i)return;if("Range"===n.type||"IntegrationFields"===n.type||"Separator"===n.type)throw Error("Unsupported Field Type: ".concat(n.type));let a=K.C[n.type];try{a.schema.validateSync(n,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(n.type,'".'))}let o=w.L$.fromSM(n);d({customType:(0,m.xS)({customType:c,newField:o,newFieldId:l,sectionId:r}),onSaveCallback:()=>{O.Am.success("".concat("Group"===n.type?"Group":"Field"," added"))}}),(0,U.V)({id:l,field:o})},y=e=>{let{apiId:t,newKey:l,value:n,inGroupFieldAction:i,updateMeta:a}=e;if((0,B.Ss)(K.C,n.type))return;let o=w.L$.fromSM(n);d({customType:(0,m.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:o,sectionId:r}),onSaveCallback:()=>{"add"===i&&O.Am.success("Field added")},updateMeta:a}),i||(0,V.Z)({previousId:t,id:l,field:o})};return(0,n.jsx)(P.h,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(i.D,{padding:32,children:(0,n.jsx)(i.bg,{})}),children:(0,n.jsxs)(F.aV,{border:!1,style:{flexGrow:1},children:[(0,n.jsx)(G.Z,{zoneType:"customType",zoneTypeFormat:null!==(o=c.format)&&void 0!==o?o:"custom",tabId:r,title:"Static zone",dataTip:"",fields:x,poolOfFieldsToCheck:v,showHints:!0,EditModal:X.Z,widgetsArray:ez,onDeleteItem:e=>{d({customType:(0,m.AK)({customType:c,fieldId:e,sectionId:r})})},onSave:e=>""===e.apiId?b({...e,apiId:e.newKey}):y(e),onDragEnd:e=>{if((0,B.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let n=(0,m.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:r});(0,Z.flushSync)(()=>d({customType:n}))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,R.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,R.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,n.jsx)(eN,{customType:u,tabId:r,sliceZone:h,onRemoveSharedSlice:e=>{d({customType:(0,m.EN)({customType:c,sectionId:r,sliceId:e})})},onCreateSliceZone:()=>{d({customType:(0,m.Tr)(c,r)})},onDeleteSliceZone:()=>{d({customType:(0,m.E3)(c,r)})}})]})})})};let eO=()=>{var e,t,l;let{customType:a,setCustomType:o}=I(),r=w.Dc.toSM(a),[c,d]=(0,s.useState)(null===(e=r.tabs[0])||void 0===e?void 0:e.key),[u,h]=(0,s.useState)(),p=(null===(l=r.tabs.find(e=>e.key===c))||void 0===l?void 0:null===(t=l.sliceZone)||void 0===t?void 0:t.value.length)===0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.c9,{sx:p?{flexGrow:1}:void 0,children:["page"===a.format?(0,n.jsx)(i.ca,{title:a.repeatable?(0,n.jsx)(T,{}):void 0}):void 0,(0,n.jsxs)(i.cb,{onValueChange:d,value:c,children:[(0,n.jsx)(i.cd,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:r.tabs.map(e=>(0,n.jsx)(i.ce,{menu:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.at,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(i.aX,{name:"edit"}),children:"Rename"}),(0,n.jsx)(i.at,{color:"tomato",disabled:function(e){if(r.tabs.length<=1)return!0;let t=r.tabs.find(e=>e.value.find(e=>"uid"===e.key));return"page"===a.format&&a.repeatable&&(null==t?void 0:t.key)===e}(e.key),onSelect:()=>{h({type:"DELETE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(i.aX,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),r.tabs.map(e=>(0,n.jsx)(i.cc,{value:e.key,children:(0,n.jsx)(eZ,{tabId:e.key})},e.key))]})]}),(null==u?void 0:u.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(M,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,m.vB)(a,t)}),d(t)},tabIds:r.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==u?void 0:u.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(z,{close:()=>{h(void 0)},initialTabKey:u.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,m.HO)(a,u.tabKey,t)}),c===u.tabKey&&d(t)},tabIds:r.tabs.filter(e=>e.key!==u.tabKey).map(e=>e.key.toLowerCase())}):void 0,(null==u?void 0:u.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,n.jsx)(N,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(o({customType:(0,m.F$)(a,u.tabKey)}),c===u.tabKey){var e;let t=null===(e=r.tabs.find(e=>e.key!==u.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eF=l(16442),eP=l(78254),eK=l(60867),eB=l(11166),eR=l(34919),eU=l.n(eR);let eV=e=>{let{tabs:t,...l}=e;return(0,n.jsxs)(eB.fC,{...l,className:eU().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,n.jsx)(eB.aV,{className:eU().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,n.jsx)(eB.xz,{className:eU().trigger,value:l,children:(0,n.jsx)(i.bL,{className:eU().triggerText,component:"span",color:"inherit",children:l})},"".concat(l,"-trig").concat(t+1))})}),t.map((e,t)=>{let{label:l,content:a}=e;return(0,n.jsx)(eB.VY,{className:eU().content,value:l,children:(0,n.jsx)(i.bn,{className:eU().scrollArea,children:a})},"".concat(l,"-content").concat(t+1))})]})};var eX=l(25661),eG=l(88241),eY=l(32554),eq=l(44621),eH=l.n(eq);let eQ=e=>{var t,l;let{inline:a,...o}=e,r=(0,eY.p)();if(!0===a)return(0,n.jsx)("code",{...o,className:eH().inlineCode});let s=(()=>{var e,t,l,n,i;if((null===(t=o.node)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.meta)!==void 0){let e=null===(n=o.node)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.meta;return{fileName:e.substring(1,e.length-1),language:null===(i=o.className)||void 0===i?void 0:i.split("-")[1]}}return null})(),c=null===(t=/language-(\w+)/.exec(null!==(l=o.className)&&void 0!==l?l:""))||void 0===t?void 0:t[1];return(0,n.jsx)(i.W,{...o,onCopy:()=>{v.Xe.track({event:"page-type:copy-snippet",framework:r})},language:c,code:String(o.children).replace(/\n$/,""),title:null==s?void 0:s.fileName})},eW=e=>{let{markdown:t}=e;return(0,n.jsx)(eX.D,{children:t,linkTarget:"_blank",remarkPlugins:[eG.Z],components:{code:e=>(0,n.jsx)(eQ,{...e}),h1:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,n.jsx)(i.bL,{className:eH().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,n.jsx)(i.bL,{className:eH().section,children:e.children,component:"pre",variant:"normal"})}})};async function e$(e){let t=JSON.parse(e),{errors:l,documentation:n}=await et.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return n}var eJ=l(65480),e0=l.n(eJ);let e1=e=>{var t;let{model:l}=e,a=(0,eY.p)(),o=(t={kind:"PageSnippet",data:{model:l}},(0,ee.QT)(e$,[JSON.stringify(t)])),{completeStep:r}=(0,$.k)();return 0===o.length?null:(0,n.jsxs)(i.ae,{size:"small",trigger:(0,n.jsx)(i.E,{color:"grey",onClick:()=>{r("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:a})},startIcon:"code",children:"Page snippet"}),children:[(0,n.jsx)(i.al,{icon:"code",title:"Page snippet"}),(0,n.jsx)("section",{className:e0().content,children:o.length>1?(0,n.jsx)(eV,{style:{flex:1},tabs:o.map((e,t)=>{let{label:l,content:i}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,n.jsx)(eW,{markdown:i})}})}):(0,n.jsx)(i.bn,{style:{flex:1,padding:16},children:(0,n.jsx)(eW,{markdown:o[0].content})})})]})},e4=e=>{let{model:t}=e;return(0,n.jsx)("div",{children:(0,n.jsx)(P.h,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(i.E,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,n.jsx)(e1,{model:t})})})})},e6=()=>{let e=(0,r.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eP.Jk)(t,(0,h.Ag)(e.query))}));return((0,s.useEffect)(()=>{t&&(0,eF.TG)(t)||e.replace("/")},[t,e]),t&&(0,eF.TG)(t))?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o(),{children:(0,n.jsxs)("title",{children:[t.local.label," - Slice Machine"]})}),(0,n.jsx)(e8,{customType:t.local})]}):(0,n.jsx)(p.LN,{})},e8=e=>{let{customType:t}=e;return null===t?(0,n.jsx)(p.LN,{}):(0,n.jsx)(p.LN,{children:(0,n.jsx)(S,{initialCustomType:w.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:a,customType:o,setCustomType:r}=e,s=(0,m.y6)(o),c=h.cd[t.format],x=f.$[t.format];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(p.wd,{children:[(0,n.jsx)(p.Xq,{url:c.tablePagePathname}),(0,n.jsxs)(p.Cx,{children:[(0,n.jsx)(d.g,{children:x.name({start:!0,plural:!0})}),(0,n.jsx)(d.g,{active:!0,children:null!==(l=o.label)&&void 0!==l?l:o.id})]}),(0,n.jsxs)(p.K2,{children:[(0,n.jsx)(u.X,{status:a}),"page"===o.format?(0,n.jsx)(e4,{model:o}):void 0,(0,n.jsx)(eK._,{isChangesLocal:!0,format:s,customType:o,setLocalCustomType:r})]})]}),(0,n.jsx)(p.RN,{children:(0,n.jsx)(i.D,{flexDirection:"column",minWidth:0,children:(0,n.jsx)(eO,{})})})]})}})})}},84879:function(e,t,l){"use strict";l.d(t,{E:function(){return o}});var n=l(18566),i=l(80148);async function a(){return i.managerClient.project.getSliceMachineConfig()}function o(e){var t,l;let[o,r]=[(0,n.QT)(a,[]),async e=>{await i.managerClient.project.writeSliceMachineConfig({config:e}),(0,n.VA)(a,[],e)}],s=async t=>{let l={...o,labs:{...o.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await r(l)};return[{enabled:null!==(l=null==o?void 0:null===(t=o.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},s]}},34919:function(e){e.exports={flex:"ContentTabs_flex__T21Oc",column:"ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",root:"ContentTabs_root__Gn3Zg ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",list:"ContentTabs_list__rAZtl ContentTabs_flex__T21Oc",trigger:"ContentTabs_trigger__cTyPN ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",triggerText:"ContentTabs_triggerText__p_ZBl",content:"ContentTabs_content__H1Stj ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",scrollArea:"ContentTabs_scrollArea__DuDcQ"}},65480:function(e){e.exports={content:"PageSnippetDialog_content__jIN6d"}},44621:function(e){e.exports={section:"MarkdownRenderer_section__uNS1M",inlineCode:"MarkdownRenderer_inlineCode__lmGTi"}},65375:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__xf3vM",label:"ConvertLegacySliceButton_label__BK0Gd"}}}]);