slice-machine-ui 2.15.2-beta.3 → 2.15.2-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/09Fk-HOSbprFhdehl9Cvz/_buildManifest.js +1 -0
- package/out/_next/static/chunks/154-7a7fbf12ee00e12f.js +1 -0
- package/out/_next/static/chunks/473-944c28c328500eba.js +1 -0
- package/out/_next/static/chunks/pages/{_app-f553eb6e95598c92.js → _app-8ebe9acc4f19e5c5.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-1d5fce0cf51a6d9a.js → [customTypeId]-494a273bdfe05981.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-f2e44ff7187ee6db.js → [pageTypeId]-f67cee98ab2e606f.js} +1 -1
- package/out/_next/static/chunks/pages/slices-4b5da413adf7c51c.js +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/features/customTypes/customTypesBuilder/{GenerateSliceWithAiModal/GenerateSliceWithAiModal.tsx → CreateSliceFromImageModal/CreateSliceFromImageModal.tsx} +164 -27
- package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/index.tsx +1 -0
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +3 -3
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +18 -46
- package/src/pages/slices.tsx +96 -14
- package/out/_next/static/_k5jLoab8iwAmuuwsO_mJ/_buildManifest.js +0 -1
- package/out/_next/static/chunks/746-7460407fe64ee9d6.js +0 -1
- package/out/_next/static/chunks/pages/slices-ad46bb83bbfff9e1.js +0 -1
- package/src/features/customTypes/customTypesBuilder/GenerateSliceWithAiModal/index.tsx +0 -1
- package/test/pages/slices.test.tsx +0 -362
- /package/out/_next/static/{_k5jLoab8iwAmuuwsO_mJ → 09Fk-HOSbprFhdehl9Cvz}/_ssgManifest.js +0 -0
- /package/src/features/customTypes/customTypesBuilder/{GenerateSliceWithAiModal → CreateSliceFromImageModal}/SliceCard.tsx +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/16242b5f7b1aa074.css" as="style"/><link rel="stylesheet" href="/_next/static/css/16242b5f7b1aa074.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-
|
|
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/16242b5f7b1aa074.css" as="style"/><link rel="stylesheet" href="/_next/static/css/16242b5f7b1aa074.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-8ebe9acc4f19e5c5.js" defer=""></script><script src="/_next/static/chunks/pages/_error-1b183d3cf5ea03f9.js" defer=""></script><script src="/_next/static/09Fk-HOSbprFhdehl9Cvz/_buildManifest.js" defer=""></script><script src="/_next/static/09Fk-HOSbprFhdehl9Cvz/_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":"09Fk-HOSbprFhdehl9Cvz","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,c,a,e,t,i,d,n,b,u,f,h,l,k,p,j,g,o,r){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[a,p,j,"static/chunks/pages/index-48edd85de6369519.js"],"/_error":["static/chunks/pages/_error-1b183d3cf5ea03f9.js"],"/changelog":[s,e,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-fd749acf98af82da.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-38ab72e6ee071fec.js",c,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-1d07d031e49cd4fa.js"],"/custom-types":[a,p,j,"static/chunks/pages/custom-types-4f95d75a29e9c7b1.js"],"/custom-types/[customTypeId]":[s,n,b,u,f,e,i,h,g,c,a,l,k,o,r,"static/chunks/pages/custom-types/[customTypeId]-494a273bdfe05981.js"],"/labs":["static/chunks/pages/labs-41db727cff0af1a9.js"],"/page-types/[pageTypeId]":[s,n,b,u,f,e,i,h,g,c,a,l,k,o,r,"static/chunks/pages/page-types/[pageTypeId]-f67cee98ab2e606f.js"],"/settings":["static/css/e5f781f20e24a5ea.css","static/chunks/pages/settings-4efa7c64dc4f2468.js"],"/slices":[s,t,i,c,d,k,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-4b5da413adf7c51c.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,n,b,u,f,e,i,h,c,l,d,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-2db7593b552cc395.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/157-7733f7f59581b0b5.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-682a7ae967ddc9e8.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/772-dc8d1f404dd4eed4.js","static/chunks/910-1979bde4d15e9a4b.js","static/chunks/183-b1a9f55f45cb8d8e.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/44-a2056f993381ad0f.js","static/chunks/639-424b570eee9a37fb.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/349-6ad3cca7ea294292.js","static/chunks/356-09138784e77f5f66.js","static/chunks/473-944c28c328500eba.js","static/chunks/764-dd770255e3082305.js","static/css/4e475d945cf8a890.css","static/chunks/479-6205c85aa978fc0b.js","static/chunks/154-7a7fbf12ee00e12f.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[154],{7154:function(e,t,l){"use strict";l.d(t,{H:function(){return e8}});var i=l(52322),n=l(7729),a=l(97729),r=l.n(a),o=l(5632),s=l(2784),c=l(56580),d=l(23335),u=l(93216),m=l(6697),h=l(63447),x=l(5335),p=l(74217),v=l(93188),y=l(80546),f=l(43874),g=l(41067),j=l(77507);let b=(0,s.createContext)(void 0);function S(e){let{children:t,initialCustomType:l}=e,[n,a]=(0,s.useState)(l),r=(0,u.y6)(n),o=j.$[r],{actionQueueStatus:c,setNextAction:d}=(0,f.c)({errorMessage:o.autoSaveFailed}),{saveCustomTypeSuccess:m}=(0,g.Z)(),h=(0,p.R9)(m),{syncChanges:x}=(0,y.g)(),S=(0,s.useCallback)((e,t)=>{a(e),d(async()=>{let{errors:l}=await (0,v.KA)(e);if(l.length>0)throw l;h(e),x(),null==t||t()})},[d,h,x]),C=(0,s.useMemo)(()=>({actionQueueStatus:c,customType:n,setCustomType:S}),[c,n,S]);return(0,i.jsx)(b.Provider,{value:C,children:"function"==typeof t?t(C):t})}function C(){let e=(0,s.useContext)(b);if(!e)throw Error("CustomTypeProvider not found");return e}var I=l(30195);function T(){var e;let[t,l]=(0,s.useState)(!1),{customType:a,setCustomType:r}=C(),[o,c]=null!==(e=(0,u.j5)(a))&&void 0!==e?e:[],d=c?(0,u.N3)(c):"",[m,h]=(0,s.useState)(null!=d?d:""),[x,v]=(0,s.useState)();(0,p.pQ)(t,()=>{t||(h(null!=d?d:""),v(void 0))});let y=(0,s.useCallback)(()=>(0,i.jsx)(n.JO$,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,i.jsxs)(n.VqE,{open:t,onOpenChange:l,size:"small",trigger:(0,i.jsx)(n.zxk,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:y,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,i.jsx)(n.fKu,{title:"Edit the UID label"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsxs)(n.l09,{onSubmit:function(){x||(r(c?(0,u.eK)(m,a):(0,u.H8)(m,a)),l(!1))},children:[(0,i.jsx)(n.xuv,{flexDirection:"column",padding:16,gap:4,children:(0,i.jsx)(n.ytj,{type:"text",label:"Label *",placeholder:"UID",value:m,onValueChange:function(e){h(e),v(function(e){let t=w.safeParse(e,{errorMap:_});if(t.error)return t.error.errors[0].message}(e))},error:x,description:"A label for the UID"})}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",disabled:!!x,children:"Save"})]})]})})]})}let w=I.z.string().max(35).min(1),_=e=>{switch(e.code){case I.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case I.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var D=l(95799),k=l(1490),z=l(63397),A=l(75289);let Z=e=>{let{name:t,label:l,placeholder:n,error:a,...r}=e;return(0,i.jsxs)(A.xu,{mb:3,children:[(0,i.jsx)(A.__,{htmlFor:t,mb:2,children:l}),(0,i.jsx)(z.gN,{name:t,type:"text",placeholder:n,as:A.II,autoComplete:"off",...r}),a?(0,i.jsx)(A.xv,{sx:{color:"error",mt:1},children:a}):null]})};var N=e=>{let{isOpen:t,onSubmit:l,close:n,tabIds:a}=e;return(0,i.jsx)(k.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,onSubmit:e=>{l(e),n()},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,i.jsx)(Z,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},M=e=>{let{isOpen:t,onSubmit:l,close:n}=e;return(0,i.jsx)(k.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),n()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,i.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(A.X6,{as:"h4",children:"Remove this tab?"}),(0,i.jsx)(A.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,i.jsx)(A.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),n()},children:"Yes, remove tab"})]})})},O=e=>{let{isOpen:t,onSubmit:l,close:n,tabIds:a,initialTabKey:r}=e;return(0,i.jsx)(k.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),n()},initialValues:{id:r},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:r,isValid:o}=e;return(0,i.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(Z,{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&&r("id",e.target.value.trim())},onChange:e=>{r("id",e.target.value)}}),(0,i.jsx)(A.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!o,onClick:()=>{a.id&&a.id.length&&l({id:a.id.trim()}),n()},children:"Save"})]})}})},E=l(28316),F=l(88932),P=l(80775),K=l(30988),L=l(67389),R=l(85357),X=l(99510),U=l(50268),V=l(44266),B=l(64602),G=l(18183),$=l(65077),J=l(17662),H=l(7192);let q=e=>{let{openCreateSliceModal:t,openCreateSliceFromImageModal:l,openUpdateSliceZoneModal:a,openSlicesTemplatesModal:r,projectHasAvailableSlices:o,isSlicesTemplatesSupported:s}=e,c=(0,J.l)();return(0,i.jsxs)(n.R$c,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,i.jsx)(n.avq,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,i.jsx)(n._T6,{size:"big",children:"Add slices"}),(0,i.jsx)(n.nfr,{children:"Slices are website sections that you can reuse on different pages with different content. Each slice has its own component in your code."}),(0,i.jsx)(n.QjJ,{children:(0,i.jsxs)(n.S0S,{children:[c.eligible&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"autoFixHigh",size:"small",iconSize:"medium",color:"purple",variant:"solid",radius:6}),onClick:l,description:"Build a Slice based on your design image.",children:"Generate from image"}),(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"add",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:t,description:"Build a custom Slice your way.",children:"Start from scratch"}),s&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"contentCopy",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:r,description:"Choose from ready-made examples.",children:"Use a template"}),o&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"folder",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:a,description:"Select from your created Slices.",children:"Reuse an existing Slice"})]})})]})};var Q=l(65856);function Y(e){let{customType:t,tabId:l,slices:i}=e,n={...t};return i.forEach(e=>{n={...n,tabs:n.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}),n}var W=l(18566),ee=l(70647);async function et(){try{let{templates:e,errors:t}=await ee.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 el=l(17889),ei=l(91133),en=l(68916),ea=l(47861),er=l(76805),eo=l(11104);let es=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,i.jsx)(eo.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,i.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,i.jsxs)(A.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,i.jsx)(A.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,i.jsx)(A.x8,{type:"button",onClick:l})]}),Footer:()=>(0,i.jsxs)(A.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,i.jsx)(ea.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(ea.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,i.jsx)(A.nv,{children:"You're about to delete Slice Zone."})})})};var ec=l(61502),ed=l(80218),eu=l(3181),em=l(99923),eh=l(17766),ex=l.n(eh);let ep=e=>{var t;let{isOpen:l,close:a,onSubmit:r,isLoading:o,slice:d,libraries:u}=e,{remoteSlices:m}=(0,c.v9)(e=>({remoteSlices:(0,en.sT)(e)})),h={from:null===(t=u[0])||void 0===t?void 0:t.name,sliceName:(0,X.MP)(d.key)},[x,v]=(0,s.useState)(h),[y,f]=(0,s.useState)();function g(e){v(e),f((0,em.h)(e,u,m))}return(0,p.pQ)(l,()=>{l||(v(h),f(void 0))}),(0,i.jsxs)(n.VqE,{open:l,onOpenChange:e=>!e&&a(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Upgrade slice"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){y&&Object.keys(y).length>0||r({libraryID:x.from,sliceID:x.sliceName})},children:(0,i.jsxs)(n.xuv,{flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ex().scrollArea,children:[(0,i.jsx)(n.xvT,{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,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,i.jsxs)(n.xuv,{flexDirection:"column",gap:4,children:[(0,i.jsx)(n.ytj,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,X.MP)(d.key),")"),error:null==y?void 0:y.sliceName,value:x.sliceName,onValueChange:e=>g({...x,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,i.jsxs)(n.xuv,{flexDirection:"column",gap:4,children:[(0,i.jsx)("label",{className:ex().label,children:(0,i.jsx)(n.xvT,{variant:"bold",children:"Slice library *"})}),(0,i.jsx)(n.PhF,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:x.from,onValueChange:e=>{e&&g({...x,from:e})},children:u.map(e=>(0,i.jsx)(n.QlF,{value:e.name,children:e.name},e.name))}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:o,disabled:y&&Object.keys(y).length>0,children:"Upgrade"})]})]})})})]})};var ev=l(96009),ey=l.n(ev);let ef=e=>{var t,l;let{isOpen:a,close:r,onSubmit:o,isLoading:c,slice:d,sliceName:u,libraries:m,localSharedSlices:h}=e,x={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:u},[v,y]=(0,s.useState)(!0),[f,g]=(0,s.useState)(x),[j,b]=(0,s.useState)({});function S(e){g(e),b(eg(e,m))}return(0,p.pQ)(a,()=>{a||(g(x),b({}))}),(0,i.jsxs)(n.VqE,{open:a,onOpenChange:e=>!e&&r(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Convert to slice variation"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){Object.keys(j).length>0||o(f)},children:(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ex().scrollArea,children:[(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ex().label,children:[(0,i.jsx)(n.xvT,{variant:"bold",children:"Target slice *"}),"string"==typeof j.libraryID?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:j.libraryID}):null,"string"==typeof j.sliceID?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:j.sliceID}):null]}),(0,i.jsx)(n.PhF,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:"".concat(f.libraryID,"::").concat(f.sliceID),onValueChange:e=>{if(e){let[t,l]=e.split("::");S({...f,libraryID:t,sliceID:l})}},children:h.map(e=>(0,i.jsxs)(n.QlF,{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,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,i.jsx)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:(0,i.jsx)(n.ytj,{label:"Variation name *",placeholder:u,error:j.variationName,value:f.variationName,onValueChange:e=>{let t={...f,variationName:e.slice(0,30)};v&&(t.variationID=ey()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,i.jsx)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:(0,i.jsx)(n.ytj,{label:"ID *",placeholder:ey()(d.key),error:j.variationID,value:f.variationID,onValueChange:e=>{y(!1),S({...f,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:c,disabled:Object.keys(j).length>0,children:"Convert"})]})]})})})]})},eg=(e,t)=>{let l={};e.libraryID||(l.libraryID="Cannot be empty.");let i=t.find(t=>t.path===e.libraryID);l.libraryID||i||(l.libraryID="Does not exist."),e.sliceID||(l.sliceID="Cannot be empty.");let n=null==i?void 0:i.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||n||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var a;(null!==(a=null==n?void 0:n.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:r,onSubmit:o,isLoading:c,identicalSlices:d}=e,u=null!==(l=null===(t=d[0])||void 0===t?void 0:t.path)&&void 0!==l?l:"",[m,h]=(0,s.useState)(u),[x,v]=(0,s.useState)();return(0,p.pQ)(a,()=>{a||(h(u),v(void 0))}),(0,i.jsxs)(n.VqE,{open:a,onOpenChange:e=>!e&&r(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Merge with an existing slice"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){if(x)return;let[e,t,l]=m.split("::");o({libraryID:e,sliceID:t,variationID:l})},children:(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ex().scrollArea,children:[(0,i.jsx)(n.xvT,{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,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ex().label,children:[(0,i.jsx)(n.xvT,{variant:"bold",children:"Target slice*"}),"string"==typeof x?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:x}):null]}),(0,i.jsx)(n.PhF,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:m,onValueChange:function(e){h(e),e||v("Cannot be empty.")},children:d.map(e=>(0,i.jsx)(n.QlF,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:c,disabled:!!x,children:"Merge"})]})]})})})]})},eb=e=>{var t;let{slice:l,path:a}=e,{refreshState:r}=(0,g.Z)(),[o,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)(),{setCustomType:h}=C(),{libraries:x}=(0,c.v9)(e=>({libraries:(0,en.Sd)(e)})),p="Slice"===l.value.type&&null!==(t=l.value.fieldset)&&void 0!==t?t:l.key,y=x.filter(e=>e.isLocal),f=y.map(e=>e.components).flat(),j=eS(l,p,f),b=async e=>{var t,i,n;if(!u)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:u});let{errors:o}=await ee.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...a,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(i=e.variationName)&&void 0!==i?i:"Default",variationID:null!==(n=e.variationID)&&void 0!==n?n:"default"}});if(o.length)throw console.error("Could not convert slice `".concat(p,"`"),o),F.Am.error("Could not convert slice `".concat(p,"`")),o;let{model:s,errors:c}=await ee.managerClient.customTypes.readCustomType({id:a.customTypeID});if(c.length||!s){console.error("Could not refresh custom type view `".concat(a.customTypeID,"`"),c),F.Am.error("Could not refresh custom type view `".concat(a.customTypeID,"`"));return}switch(r(await (0,v.y0)()),d(!1),m(void 0),u){case"as_new_slice":F.Am.success("".concat(p," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":F.Am.success("".concat(p," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:F.Am.success("".concat(p," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h(s)},S={path:a,slice:l,sliceName:p,libraries:y,localSharedSlices:f,identicalSlices:j,close:()=>m(void 0),onSubmit:b,isLoading:o};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h_2,{children:[(0,i.jsx)(n.$FS,{children:(0,i.jsx)(n.zxk,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,i.jsxs)(n.AWV,{align:"start",children:[(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>m("as_new_slice"),children:"Upgrade slice"}),(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>m("as_new_variation"),disabled:!f.length,children:"Convert to slice variation"}),(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>m("merge_with_identical"),disabled:!j.length,children:"Merge with another slice"})]})]}),(0,i.jsx)(ep,{...S,isOpen:"as_new_slice"===u}),(0,i.jsx)(ef,{...S,isOpen:"as_new_variation"===u}),(0,i.jsx)(ej,{...S,isOpen:"merge_with_identical"===u})]})},eS=(e,t,l)=>(0,s.useMemo)(()=>{let i=[],n=(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);n.primary===l.primary&&n.items===l.items&&i.push({libraryID:e.from,sliceID:e.model.id,variationID:t.id,path:"".concat(e.from,"::").concat(e.model.id,"::").concat(t.id)})}return i},[e,t,l]),eC=e=>{let{slice:t,path:l}=e,[a]=(0,ec.E)("legacySliceUpgrader"),r=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,i.jsxs)(ed.Zb,{children:[(0,i.jsx)(ed.ZB,{component:"div",children:(0,i.jsx)(n.xuv,{alignItems:"center",justifyContent:"center",children:(0,i.jsx)(n.xvT,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,i.jsxs)(ed.T$,{children:[(0,i.jsx)(n.ua7,{content:r,side:"bottom",children:(0,i.jsx)(n.Cts,{color:"purple",title:"Legacy Slice"})}),a.enabled?(0,i.jsx)(eb,{slice:t,path:l}):null]}),(0,i.jsx)(ed.eW,{subtitle:"1 variation",title:(0,eu.Dj)(t.value)})]})};var eI=l(53850),eT=l(42849);let ew=e=>{let{slices:t,format:l,path:n,onRemoveSharedSlice:a}=e,r=t.some(e=>"SharedSlice"!==e.type),o=j.$[l],[c]=(0,ec.E)("legacySliceUpgrader");return(0,s.useEffect)(()=>{r&&(c.enabled?F.Am.info("This ".concat(o.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):F.Am.warning("This ".concat(o.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[r]),(0,i.jsx)(eT.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,i.jsx)(eC,{slice:t,path:n})}{let t=e.payload;return(0,i.jsx)(eI.b,{action:{type:"remove",onRemove:()=>{a(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function e_(e){try{let{templateIDs:t,localLibrariesNames:l,location:i,onSuccess:n}=e,{data:a,errors:r}=await ee.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(r.length>0||void 0===a)throw r;a.sliceIDs.forEach((e,n)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:i,mode:"template",sliceTemplate:t[n]})}),await n(a.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),F.Am.error(e)}}var eD=l(80410);let ek=[{extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:{id:"video_highlights",name:"VideoHighlights",type:"SharedSlice",variations:[{description:"",docURL:"",id:"default",name:"Default",version:"sktwi1xtmkfgx8626"}]},screenshots:{default:{url:"/videoHighlights.png"}}}];var ez=e=>{let{availableSlices:t,values:l,placeholderSlices:n}=e;return(0,i.jsx)(z.F2,{name:"sliceKeys",render:e=>(0,i.jsx)(eT.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{var a;let r=null!==(a=null==n?void 0:n.some(e=>e.model.id===t.model.id))&&void 0!==a&&a,o=l.sliceKeys.includes(t.model.id);return(0,i.jsx)(eI.b,{action:{type:"checkbox"},isComingSoon:r,mode:"selection",onSelectedChange:i=>{i?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:o,slice:t,variant:"outlined"})}})})};let eA=e=>{let{formId:t,close:l,onSuccess:n,availableSlicesTemplates:a,localLibraries:r,location:o}=e,{createSliceSuccess:s}=(0,g.Z)();return(0,i.jsx)(k.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;e_({templateIDs:t,localLibrariesNames:r.map(e=>e.name),location:o,onSuccess:async e=>{s((await (0,v.y0)()).libraries),n(await Promise.all(e.map(async e=>(await ee.managerClient.slices.readSlice({libraryID:r[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,i.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,i.jsx)(ez,{values:t,placeholderSlices:ek,availableSlices:[...a.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:eD.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})})),...ek]})}})};var eZ=e=>{let{formId:t,close:l,onSubmit:n,availableSlices:a}=e;return(0,i.jsx)(k.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;n(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,i.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,i.jsx)(ez,{values:t,availableSlices:a})}})};let eN=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:i,notFound:n}=e.value.reduce((e,t)=>{let{key:i,value:n}=t;if("SharedSlice"===n.type){let t=l.find(e=>e.model.id===i);return t?{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"SharedSlice",payload:t}]}:{...e,notFound:[...e.notFound,{key:i}]}}return{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"Slice",payload:{key:i,value:n}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:i,notFound:n}};var eM=e=>{var t;let{customType:l,onCreateSliceZone:a,onDeleteSliceZone:r,onRemoveSharedSlice:o,sliceZone:d,tabId:u}=e,m=(0,J.l)(),h=(0,W.QT)(et,[]),[x,p]=(0,s.useState)(!1),[y,f]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[S,I]=(0,s.useState)(!1),{remoteSlices:T,libraries:w}=(0,c.v9)(e=>({remoteSlices:(0,en.sT)(e),libraries:(0,en.Sd)(e),slices:(0,en.xC)(e)})),{setCustomType:_}=C(),{completeStep:k}=(0,Q.k)(),{openLoginModal:z}=(0,g.Z)(),A=w.filter(e=>e.isLocal),{availableSlices:Z,slicesInSliceZone:N,notFound:M}=(0,s.useMemo)(()=>d?eN(d,w):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,w]),[O,E]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(null==M?void 0:M.length)&&M.forEach(e=>{let{key:t}=e;o(t)})},[M]);let K=N.filter(e=>"SharedSlice"===e.type).map(e=>e.payload),L=Z.filter(e=>!K.some(t=>t.model.id===e.model.id)),R=()=>{f(!0)},X=()=>{b(!0)},U=async()=>{await ee.managerClient.user.checkIsLoggedIn()?I(!0):z()},V=()=>{p(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},B=()=>{f(!1)},G=()=>{b(!1)},ea=()=>{I(!1)},er=()=>{p(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(P.Bu,{actions:d?(0,i.jsxs)(n.h_2,{children:[(0,i.jsx)(n.$FS,{children:(0,i.jsx)(n.zxk,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(n.AWV,{align:"end",children:[m.eligible&&(0,i.jsx)(n.Xiv,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"autoFixHigh",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"purple"}),onSelect:()=>void U(),description:"Build a Slice based on your design image.",children:"Generate from image"}),(0,i.jsx)(n.Xiv,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"add",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),onSelect:X,description:"Build a custom Slice your way.",children:"Start from scratch"}),h.length>0?(0,i.jsx)(n.Xiv,{onSelect:V,renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"contentCopy",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),description:"Choose from ready-made examples.",children:"Use a template"}):void 0,L.length>0?(0,i.jsx)(n.Xiv,{onSelect:R,renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"folder",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),description:"Select from your created Slices.",children:"Reuse an existing Slice"}):void 0]})]}):void 0,toggle:"page"!==l.format||"Main"!==u?(0,i.jsx)(n.rsf,{checked:!!d,onCheckedChange:e=>{e?a():E(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:"Slices"}),d?N.length>0?(0,i.jsx)($.xR,{children:(0,i.jsx)(ew,{slices:N,format:l.format,path:{customTypeID:l.id,tabID:u,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:o})}):(0,i.jsx)(n.xuv,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,i.jsx)(q,{openUpdateSliceZoneModal:R,openCreateSliceModal:X,openCreateSliceFromImageModal:()=>void U(),openSlicesTemplatesModal:V,projectHasAvailableSlices:L.length>0,isSlicesTemplatesSupported:h.length>0})}):void 0,y&&(0,i.jsx)(eZ,{formId:"tab-slicezone-form-".concat(u),availableSlices:L,onSubmit:e=>{let t=Y({customType:l,tabId:u,slices:e});_(D.Dc.fromSM(t),()=>{F.Am.success("Slice(s) added to slice zone")}),k("createSlice"),B()},close:B}),x&&(0,i.jsx)(eA,{formId:"tab-slicezone-form-".concat(u),availableSlicesTemplates:h,localLibraries:A,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=Y({customType:l,tabId:u,slices:e});_(D.Dc.fromSM(t),()=>{F.Am.success((0,i.jsx)(ei.GX,{message:"Slice template(s) added to slice zone and created at: ",path:"".concat(A[0].name,"/")}))}),k("createSlice"),er()},close:er}),O&&(0,i.jsx)(es,{closeDeleteSliceZoneModal:()=>{E(!1)},deleteSliceZone:()=>{r(),E(!1)}}),(null==A?void 0:A.length)!==0&&j&&(0,i.jsx)(el.c,{onSuccess:e=>{let t=Y({customType:l,tabId:u,slices:[e]});_(D.Dc.fromSM(t),()=>{F.Am.success((0,i.jsx)(ei.GX,{message:"New slice added to slice zone and created at: ",path:"".concat(A[0].name,"/")}))}),G()},localLibraries:A,location:"".concat(l.format,"_type"),remoteSlices:T,onClose:G}),(0,i.jsx)(H.S,{open:S,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:n}=e,a=Y({customType:l,tabId:u,slices:t.map(e=>e.model)});_(D.Dc.fromSM(a),()=>{F.Am.success((0,i.jsx)(ei.GX,{message:"Slice(s) added to slice zone and created at: ",path:n}))}),ea()},onClose:ea})]})};let eO=[L.C.UID,L.C.Image,L.C.Text,L.C.StructuredText,L.C.Link,L.C.Select,L.C.Boolean,L.C.Number,L.C.Color,L.C.Date,L.C.Table,L.C.Embed,L.C.Timestamp,L.C.GeoPoint,L.C.ContentRelationship,L.C.LinkToMedia,L.C.Group,L.C.NestedGroup];var eE=e=>{var t,l,a,r;let{tabId:o}=e,{customType:c,setCustomType:d}=C(),m=D.Dc.toSM(c),h=null===(t=m.tabs.find(e=>e.key===o))||void 0===t?void 0:t.sliceZone,x=null!==(a=null===(l=m.tabs.find(e=>e.key===o))||void 0===l?void 0:l.value)&&void 0!==a?a:[],p="page"===m.format&&m.repeatable?x.filter(e=>"uid"!==e.key):x,v=m.tabs.reduce((e,t)=>[...e,...t.value],[]),y=e=>{var t;let{apiId:l,value:i}=e,n=null===(t=i.config)||void 0===t?void 0:t.label;if((0,R.Ss)(L.C,i.type)||null==n)return;if("Range"===i.type||"IntegrationFields"===i.type||"Separator"===i.type)throw Error("Unsupported Field Type: ".concat(i.type));let a=L.C[i.type];try{a.schema.validateSync(i,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(i.type,'".'))}let r=D.L$.fromSM(i);d((0,u.xS)({customType:c,newField:r,newFieldId:l,sectionId:o}),()=>{F.Am.success("".concat("Group"===i.type?"Group":"Field"," added"))}),(0,U.V)({id:l,field:r})},f=e=>{let{apiId:t,newKey:l,value:i,inGroupFieldAction:n}=e;if((0,R.Ss)(L.C,i.type))return;let a=D.L$.fromSM(i);d((0,u.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:a,sectionId:o}),()=>{"add"===n&&F.Am.success("Field added")}),n||(0,V.Z)({previousId:t,id:l,field:a})};return(0,i.jsx)(K.S,{children:(0,i.jsx)(s.Suspense,{fallback:(0,i.jsx)(n.xuv,{padding:32,children:(0,i.jsx)(n._3P,{})}),children:(0,i.jsxs)(P.aV,{border:!1,style:{flexGrow:1},children:[(0,i.jsx)(G.Z,{zoneType:"customType",zoneTypeFormat:null!==(r=c.format)&&void 0!==r?r:"custom",tabId:o,title:"Static zone",dataTip:"",fields:p,poolOfFieldsToCheck:v,showHints:!0,EditModal:B.Z,widgetsArray:eO,onDeleteItem:e=>{d((0,u.AK)({customType:c,fieldId:e,sectionId:o}))},onSave:e=>""===e.apiId?y({...e,apiId:e.newKey}):f(e),onDragEnd:e=>{if((0,R.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let i=(0,u.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:o});(0,E.flushSync)(()=>d(i))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,X.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,X.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,i.jsx)(eM,{customType:m,tabId:o,sliceZone:h,onRemoveSharedSlice:e=>{d((0,u.EN)({customType:c,sectionId:o,sliceId:e}))},onCreateSliceZone:()=>{d((0,u.Tr)(c,o))},onDeleteSliceZone:()=>{d((0,u.E3)(c,o))}})]})})})};let eF=()=>{var e,t,l;let{customType:a,setCustomType:r}=C(),o=D.Dc.toSM(a),[c,d]=(0,s.useState)(null===(e=o.tabs[0])||void 0===e?void 0:e.key),[m,h]=(0,s.useState)(),x=(null===(l=o.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,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.Rz2,{sx:x?{flexGrow:1}:void 0,children:["page"===a.format?(0,i.jsx)(n.pyJ,{title:a.repeatable?(0,i.jsx)(T,{}):void 0}):void 0,(0,i.jsxs)(n.KCD,{onValueChange:d,value:c,children:[(0,i.jsx)(n.mYC,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:o.tabs.map(e=>(0,i.jsx)(n.wfd,{menu:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Xiv,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,i.jsx)(n.JO$,{name:"edit"}),children:"Rename"}),(0,i.jsx)(n.Xiv,{color:"tomato",disabled:function(e){if(o.tabs.length<=1)return!0;let t=o.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,i.jsx)(n.JO$,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),o.tabs.map(e=>(0,i.jsx)(n.e$b,{value:e.key,children:(0,i.jsx)(eE,{tabId:e.key})},e.key))]})]}),(null==m?void 0:m.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(N,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;r((0,u.vB)(a,t)),d(t)},tabIds:o.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(O,{close:()=>{h(void 0)},initialTabKey:m.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;r((0,u.HO)(a,m.tabKey,t)),c===m.tabKey&&d(t)},tabIds:o.tabs.filter(e=>e.key!==m.tabKey).map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,i.jsx)(M,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(r((0,u.F$)(a,m.tabKey)),c===m.tabKey){var e;let t=null===(e=o.tabs.find(e=>e.key!==m.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eP=l(1744),eK=l(40572),eL=l(64910),eR=l(9975),eX=l(41329),eU=l.n(eX);let eV=e=>{let{tabs:t,...l}=e;return(0,i.jsxs)(eR.fC,{...l,className:eU().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,i.jsx)(eR.aV,{className:eU().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,i.jsx)(eR.xz,{className:eU().trigger,value:l,children:(0,i.jsx)(n.xvT,{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,i.jsx)(eR.VY,{className:eU().content,value:l,children:(0,i.jsx)(n.xrM,{className:eU().scrollArea,children:a})},"".concat(l,"-content").concat(t+1))})]})};var eB=l(11290),eG=l(88241),e$=l(58133),eJ=l(37628),eH=l.n(eJ);let eq=e=>{var t,l;let{inline:a,...r}=e,o=(0,e$.p)();if(!0===a)return(0,i.jsx)("code",{...r,className:eH().inlineCode});let s=(()=>{var e,t,l,i,n;if((null===(t=r.node)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.meta)!==void 0){let e=null===(i=r.node)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.meta;return{fileName:e.substring(1,e.length-1),language:null===(n=r.className)||void 0===n?void 0:n.split("-")[1]}}return null})(),c=null===(t=/language-(\w+)/.exec(null!==(l=r.className)&&void 0!==l?l:""))||void 0===t?void 0:t[1];return(0,i.jsx)(n.dnZ,{...r,onCopy:()=>{v.Xe.track({event:"page-type:copy-snippet",framework:o})},language:c,code:String(r.children).replace(/\n$/,""),title:null==s?void 0:s.fileName})},eQ=e=>{let{markdown:t}=e;return(0,i.jsx)(eB.D,{children:t,linkTarget:"_blank",remarkPlugins:[eG.Z],components:{code:e=>(0,i.jsx)(eq,{...e}),h1:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,i.jsx)(n.xvT,{className:eH().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,i.jsx)(n.xvT,{className:eH().section,children:e.children,component:"pre",variant:"normal"})}})};async function eY(e){let t=JSON.parse(e),{errors:l,documentation:i}=await ee.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return i}var eW=l(83321),e0=l.n(eW);let e1=e=>{var t;let{model:l}=e,a=(0,e$.p)(),r=(t={kind:"PageSnippet",data:{model:l}},(0,W.QT)(eY,[JSON.stringify(t)])),{completeStep:o}=(0,Q.k)();return 0===r.length?null:(0,i.jsxs)(n.VqE,{size:"small",trigger:(0,i.jsx)(n.zxk,{color:"grey",onClick:()=>{o("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:a})},startIcon:"code",children:"Page snippet"}),children:[(0,i.jsx)(n.fKu,{icon:"code",title:"Page snippet"}),(0,i.jsx)("section",{className:e0().content,children:r.length>1?(0,i.jsx)(eV,{style:{flex:1},tabs:r.map((e,t)=>{let{label:l,content:n}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,i.jsx)(eQ,{markdown:n})}})}):(0,i.jsx)(n.xrM,{style:{flex:1,padding:16},children:(0,i.jsx)(eQ,{markdown:r[0].content})})})]})},e6=e=>{let{model:t}=e;return(0,i.jsx)("div",{children:(0,i.jsx)(K.S,{children:(0,i.jsx)(s.Suspense,{fallback:(0,i.jsx)(n.zxk,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,i.jsx)(e1,{model:t})})})})},e8=()=>{let e=(0,o.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eK.Jk)(t,(0,h.Ag)(e.query))}));return((0,s.useEffect)(()=>{t&&(0,eP.TG)(t)||e.replace("/")},[t,e]),t&&(0,eP.TG)(t))?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsxs)("title",{children:[t.local.label," - Slice Machine"]})}),(0,i.jsx)(e2,{customType:t.local})]}):(0,i.jsx)(x.LN,{})},e2=e=>{let{customType:t}=e;return null===t?(0,i.jsx)(x.LN,{}):(0,i.jsx)(x.LN,{children:(0,i.jsx)(S,{initialCustomType:D.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:a,customType:r,setCustomType:o}=e,s=(0,u.y6)(r),c=h.cd[t.format],p=j.$[t.format];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(x.wd,{children:[(0,i.jsx)(x.Xq,{url:c.tablePagePathname}),(0,i.jsxs)(x.Cx,{children:[(0,i.jsx)(d.g,{children:p.name({start:!0,plural:!0})}),(0,i.jsx)(d.g,{active:!0,children:null!==(l=r.label)&&void 0!==l?l:r.id})]}),(0,i.jsxs)(x.K2,{children:[(0,i.jsx)(m.X,{status:a}),"page"===r.format?(0,i.jsx)(e6,{model:r}):void 0,(0,i.jsx)(eL._,{isChangesLocal:!0,format:s,customType:r,setLocalCustomType:o})]})]}),(0,i.jsx)(x.RN,{children:(0,i.jsx)(n.xuv,{flexDirection:"column",minWidth:0,children:(0,i.jsx)(eF,{})})})]})}})})}},61502:function(e,t,l){"use strict";l.d(t,{E:function(){return n}});var i=l(29806);function n(e){var t,l;let[n,a]=(0,i.f)(),r=async t=>{let l={...n,labs:{...n.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await a(l)};return[{enabled:null!==(l=null==n?void 0:null===(t=n.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},r]}},29806:function(e,t,l){"use strict";l.d(t,{f:function(){return a}});var i=l(18566),n=l(70647);function a(){return[(0,i.QT)(r,[]),async e=>{await n.managerClient.project.writeSliceMachineConfig({config:e}),(0,i.VA)(r,[],e)}]}async function r(){return n.managerClient.project.getSliceMachineConfig()}},41329: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"}},83321:function(e){e.exports={content:"PageSnippetDialog_content__jIN6d"}},37628:function(e){e.exports={section:"MarkdownRenderer_section__uNS1M",inlineCode:"MarkdownRenderer_inlineCode__lmGTi"}},17766:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__xf3vM",label:"ConvertLegacySliceButton_label__BK0Gd"}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[473],{17662:function(e,t,r){r.d(t,{l:function(){return n}});var a=r(53085);function n(){let e=(0,a.L)("slicemachine-image-to-slice");return{eligible:(null==e?void 0:e.value)==="on"}}},7192:function(e,t,r){r.d(t,{S:function(){return h}});var a=r(52322),n=r(7729),l=r(2784),s=r(88932),i=r(93188),c=r(93085),o=r(65856),u=r(80546),d=r(70647),m=r(41067),g=r(80218);function p(e){let{slice:t}=e,r="uploading"===t.status||"generating"===t.status,l="uploadError"===t.status||"generateError"===t.status,s="generateError"===t.status||"generating"===t.status||"success"===t.status;return(0,a.jsxs)(g.Zb,{disabled:r,children:[s?(0,a.jsx)(g.ZB,{src:t.thumbnailUrl}):(0,a.jsx)(g.ZB,{component:"div"}),(0,a.jsx)(g.eW,{loading:r,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:t.image.name,subtitle:function(e){switch(e){case"uploading":return"Uploading...";case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t.status),error:l,action:l?(0,a.jsx)(n.zxk,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):void 0})]})}function h(e){let{open:t,location:r,onSuccess:g,onClose:h}=e,[j,w]=(0,l.useState)([]),[S,C]=(0,l.useState)(!1),{syncChanges:v}=(0,u.g)(),{createSliceSuccess:I}=(0,m.Z)(),{completeStep:E}=(0,o.k)(),N=(0,l.useRef)(crypto.randomUUID()),k=e=>{let{index:t,slice:r}=e;w(e=>e.map((e,a)=>a===t?r(e):e))},U=e=>{if(e.length>10){s.Am.error("You can only upload ".concat(10," images at a time."));return}w(e.map(e=>({status:"uploading",image:e}))),e.forEach((e,t)=>A({index:t,image:e}))},A=e=>{let{index:t,image:r}=e,a=N.current;k({index:t,slice:e=>({...e,status:"uploading"})}),x({image:r}).then(e=>{a===N.current&&Z({index:t,imageUrl:e})},()=>{a===N.current&&k({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>A({index:t,image:r})})})})},D=function(e){let{open:t}=e,r=(0,l.useRef)([]);return(0,l.useEffect)(()=>{t&&(r.current=[],d.managerClient.slices.readAllSlices().then(e=>{r.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),r}({open:t}),Z=e=>{let{index:t,imageUrl:r}=e,a=N.current;k({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:r})}),d.managerClient.customTypes.inferSlice({imageUrl:r}).then(e=>{let{slice:n,langSmithUrl:l}=e;a===N.current&&w(e=>e.map((a,s)=>s===t?{...a,status:"success",thumbnailUrl:r,model:function(e){let{existingSlices:t,newSlices:r,slice:a}=e,n=new Set,l=new Set;for(let{id:e,name:r}of t)n.add(e),l.add(r.toLowerCase());for(let e of r)"success"===e.status&&(n.add(e.model.id),l.add(e.model.name.toLowerCase()));let s=a.id,i=2;for(;n.has(s);)s="".concat(a.id,"_").concat(i),i++;let c=a.name;for(i=2;l.has(c.toLowerCase());)c="".concat(a.name).concat(i),i++;return{...a,id:s,name:c}}({existingSlices:D.current,newSlices:e,slice:n}),langSmithUrl:l}:a))},()=>{a===N.current&&k({index:t,slice:e=>({...e,status:"generateError",thumbnailUrl:r,onRetry:()=>Z({index:t,imageUrl:r})})})})},_=j.some(e=>"uploading"===e.status||"generating"===e.status),R=j.filter(e=>"success"===e.status),F=R.length>0;return(0,a.jsxs)(n.VqE,{open:t,onOpenChange:e=>{e||S||(h(),N.current=crypto.randomUUID(),w([]))},children:[(0,a.jsx)(n.fKu,{title:"Generate from image"}),(0,a.jsxs)(n.cZJ,{gap:0,children:[(0,a.jsx)(n.BeV,{hidden:!0,children:"Upload images to generate slices with AI"}),0===j.length?(0,a.jsx)(n.xuv,{padding:16,height:"100%",children:(0,a.jsx)(n.Zzl,{onFilesSelected:U,assetType:"image",maxFiles:10,overlay:(0,a.jsx)(f,{onFilesSelected:U,droppingFiles:!0}),children:(0,a.jsx)(f,{onFilesSelected:U})})}):(0,a.jsx)(n.xrM,{stableScrollbar:!1,children:(0,a.jsx)(n.xuv,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:j.map((e,t)=>(0,a.jsx)(p,{slice:e},"slice-".concat(t)))})}),(0,a.jsxs)(n.kXR,{children:[(0,a.jsx)(n.POh,{disabled:S}),(0,a.jsxs)(n._dX,{disabled:!F||_,loading:S,onClick:()=>{let e=j.reduce((e,t)=>("success"===t.status&&e.push(t),e),[]);if(!e.length)return;let t=N.current;C(!0),y(e).then(async e=>{let{slices:a,library:n}=e;if(t===N.current)for(let{model:e,langSmithUrl:t}of(I((await (0,i.y0)()).libraries),v(),g({slices:a,library:n}),C(!1),N.current=crypto.randomUUID(),w([]),E("createSlice"),a))i.Xe.track({event:"slice:created",id:e.id,name:e.name,library:n,location:r,mode:"ai",langSmithUrl:t}),(0,c.nZ)({type:"model",library:n,sliceId:e.id,variationId:e.variations[0].id,langSmithUrl:t})}).catch(()=>{t===N.current&&(C(!1),s.Am.error("An unexpected error happened while adding slices."))})},children:[b(r)," (",R.length,")"]})]})]})]})}function f(e){let{droppingFiles:t=!1,onFilesSelected:r}=e;return(0,a.jsx)(n.xuv,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:t?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:t?"purple9":"grey6",children:(0,a.jsxs)(n.R$c,{children:[(0,a.jsx)(n.avq,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,a.jsx)(n._T6,{children:"Upload your design images."}),(0,a.jsx)(n.nfr,{children:"Once uploaded, you can generate slices automatically using AI."}),(0,a.jsx)(n.QjJ,{children:(0,a.jsx)(n.KH,{startIcon:"attachFile",onFilesSelected:r,color:"grey",children:"Add images"})})]})})}async function x(e){let{image:t}=e,r=[await d.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await d.managerClient.screenshots.initS3ACL();let{url:a}=await d.managerClient.screenshots.uploadScreenshot({keyPrefix:r,data:t});return a}async function y(e){let{libraries:t=[]}=await d.managerClient.project.getSliceMachineConfig(),r=t[0];if(!r)throw Error("No library found in the config.");for(let{model:t}of e){let{errors:e}=await d.managerClient.slices.createSlice({libraryID:r,model:t});if(e.length)throw Error("Failed to create slice ".concat(t.id,"."))}let a=await Promise.all(e.map(async e=>{let{model:t,image:a,langSmithUrl:n}=e;return await d.managerClient.slices.updateSliceScreenshot({libraryID:r,sliceID:t.id,variationID:t.variations[0].id,data:a}),{model:t,langSmithUrl:n}}));return{library:r,slices:a}}let b=e=>{switch(e){case"custom_type":return"Add to type";case"page_type":return"Add to page";case"slices":return"Add to slices"}}},17889:function(e,t,r){r.d(t,{c:function(){return b}});var a=r(52322),n=r(2784),l=r(36131),s=r(75289),i=r(93188),c=r(65856),o=r(88932),u=r(3181),d=r(99510),m=r(70647);async function g(e){let{sliceName:t,libraryName:r,location:a,onSuccess:n}=e;try{let e=(0,u.fo)(t),{errors:l}=await m.managerClient.slices.createSlice({libraryID:r,model:e});if(l.length>0)throw l;i.Xe.track({event:"slice:created",id:(0,d.MP)(t),name:t,library:r,location:a,mode:"manual"}),await n(e)}catch(r){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,r),o.Am.error(e)}}var p=r(80546),h=r(1490),f=r(41067),x=r(28801),y=r(99923);let b=e=>{let{onClose:t,onSuccess:r,localLibraries:o,location:u,remoteSlices:d}=e,{createSliceSuccess:m}=(0,f.Z)(),[b,j]=(0,n.useState)(!1),{syncChanges:w}=(0,p.g)(),{completeStep:S}=(0,c.k)(),C=async e=>{let t=e.sliceName,a=e.from;j(!0),await g({sliceName:t,libraryName:a,location:u,onSuccess:async e=>{m((await (0,i.y0)()).libraries),r(e,a),w(),S("createSlice")}})};return(0,a.jsx)(h.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:b,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{C(e)},initialValues:{sliceName:"",from:o[0].name},validate:e=>(0,y.h)(e,o,d),content:{title:"Create a new slice"},children:e=>{let{touched:t,values:r,setFieldValue:n,errors:i}=e;return(0,a.jsxs)(s.xu,{children:[(0,a.jsx)(x.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?i.sliceName:void 0,testId:"slice-name-input"}),(0,a.jsx)(s.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,a.jsx)(l.ZP,{name:"from",options:o.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void n("from",e.value):null,defaultValue:{value:r.from,label:r.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},99923:function(e,t,r){r.d(t,{h:function(){return c}});var a=r(96009),n=r.n(a),l=r(74600),s=r.n(l),i=r(17186);function c(e,t,r){let{sliceName:a}=e;return a?i.lS.includes(a.toLowerCase())?{sliceName:'Name "'.concat(a,'" is reserved for Slice Machine use.')}:i.xo.exec(a)?s()(n()(a)).replace(/\s/gm,"")!==a.trim()?{sliceName:"Value has to be PascalCased."}:a.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...r.map(e=>e.name)].includes(a)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},42849:function(e,t,r){var a=r(52322),n=r(75289);t.Z=function(e){let{elems:t,renderElem:r,defineElementKey:l,gridTemplateMinPx:s="320px",gridGap:i="16px",sx:c}=e;return(0,a.jsx)(n.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(s,", 1fr))"),gridGap:i,pt:2,...c},children:t.map((e,t)=>e?(0,a.jsx)("span",{children:r(e,t)},"".concat(l(e),"-").concat(t+1)):null)})}}}]);
|