slice-machine-ui 2.16.2-alpha.jp-cr-ui-legacy-and-new-picker.2 → 2.16.2-alpha.jp-cr-ui-legacy-and-new-picker.3
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/{YQMbzR_y6FmVlx0NEHprH → SCvtrCISRxCnbzgSweXaT}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/395-03eecd862e6ae694.js +1 -0
- package/out/_next/static/chunks/{630-db2634510e265e9a.js → 630-8b61616320ec01f5.js} +1 -1
- package/out/_next/static/chunks/{867-bb2db4d365ee7e40.js → 721-03cc30bfca172443.js} +1 -1
- package/out/_next/static/chunks/882-5982c7c198bf4c39.js +1 -0
- package/out/_next/static/chunks/pages/{_app-a0f5d6072fbbb633.js → _app-0cbce46360e6a451.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-389d1b7a492fb3e7.js → [customTypeId]-640dac1303370d01.js} +1 -1
- package/out/_next/static/chunks/pages/{custom-types-2a5fd94ee42ba593.js → custom-types-e170066a58cc3e32.js} +1 -1
- package/out/_next/static/chunks/pages/{index-02dd147957c8b40f.js → index-c191cf09e51bab2f.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-3589bd1f9138a97b.js → [pageTypeId]-752f9388f18c19b8.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ea369adbab9f9b47.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/CustomTypeProvider.tsx +3 -1
- package/src/features/customTypes/customTypesTable/useCustomTypes.ts +15 -4
- package/src/features/customTypes/fields/ContentRelationshipFieldPicker.tsx +12 -18
- package/out/_next/static/chunks/882-636039ab926dbc22.js +0 -1
- package/out/_next/static/chunks/895-e5bf82a4d5d7c3e1.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-85ab73c10f8322e1.js +0 -1
- /package/out/_next/static/{YQMbzR_y6FmVlx0NEHprH → SCvtrCISRxCnbzgSweXaT}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[882],{60882:function(e,t,l){"use strict";l.d(t,{H:function(){return e5}});var n=l(52322),a=l(56803),i=l(97729),o=l.n(i),r=l(5632),s=l(2784),c=l(56580),d=l(43388),u=l(77630),m=l(23094),h=l(59294),p=l(51384),x=l(74217),v=l(94160),b=l(7477),y=l(68968),f=l(23710),g=l(54597),j=l(98564);let S=(0,s.createContext)(void 0);function I(e){let{children:t,initialCustomType:l}=e,[a,i]=(0,s.useState)(l),o=(0,u.y6)(a),r=j.$[o],{actionQueueStatus:c,setNextAction:d}=(0,f.c)({errorMessage:r.autoSaveFailed}),{refreshState:m}=(0,g.Z)(),h=(0,x.R9)(m),{syncChanges:p}=(0,y.g)(),I=(0,s.useCallback)(e=>{let{customType:t,onSaveCallback:l,updateMeta:n}=e;i(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)()),(0,b.NG)(o),p(),null==l||l()})},[d,h,p,o]),C=(0,s.useMemo)(()=>({actionQueueStatus:c,customType:a,setCustomType:I}),[c,a,I]);return(0,n.jsx)(S.Provider,{value:C,children:"function"==typeof t?t(C):t})}function C(){let e=(0,s.useContext)(S);if(!e)throw Error("CustomTypeProvider not found");return e}var T=l(30195);function D(){var e;let[t,l]=(0,s.useState)(!1),{customType:i,setCustomType:o}=C(),[r,c]=null!==(e=(0,u.j5)(i))&&void 0!==e?e:[],d=c?(0,u.N3)(c):"",[m,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)(a.aX,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,n.jsxs)(a.ae,{open:t,onOpenChange:l,size:"small",trigger:(0,n.jsx)(a.E,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:b,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,n.jsx)(a.al,{title:"Edit the UID label"}),(0,n.jsx)(a.aj,{children:(0,n.jsxs)(a.aJ,{onSubmit:function(){p||(o({customType:c?(0,u.eK)(m,i):(0,u.H8)(m,i)}),l(!1))},children:[(0,n.jsx)(a.D,{flexDirection:"column",padding:16,gap:4,children:(0,n.jsx)(a.aM,{type:"text",label:"Label *",placeholder:"UID",value:m,onValueChange:function(e){h(e),v(function(e){let t=k.safeParse(e,{errorMap:w});if(t.error)return t.error.errors[0].message}(e))},error:p,description:"A label for the UID"})}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",disabled:!!p,children:"Save"})]})]})})]})}let k=T.z.string().max(35).min(1),w=e=>{switch(e.code){case T.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case T.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var _=l(94840),L=l(59532),A=l(63397),N=l(75289);let E=e=>{let{name:t,label:l,placeholder:a,error:i,...o}=e;return(0,n.jsxs)(N.xu,{mb:3,children:[(0,n.jsx)(N.__,{htmlFor:t,mb:2,children:l}),(0,n.jsx)(A.gN,{name:t,type:"text",placeholder:a,as:N.II,autoComplete:"off",...o}),i?(0,n.jsx)(N.xv,{sx:{color:"error",mt:1},children:i}):null]})};var M=e=>{let{isOpen:t,onSubmit:l,close:a,tabIds:i}=e;return(0,n.jsx)(L.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,onSubmit:e=>{l(e),a()},initialValues:{id:""},validate:e=>{let{id:t}=e;return t?i.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)(E,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},z=e=>{let{isOpen:t,onSubmit:l,close:a}=e;return(0,n.jsx)(L.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),a()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,n.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(N.X6,{as:"h4",children:"Remove this tab?"}),(0,n.jsx)(N.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,n.jsx)(N.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),a()},children:"Yes, remove tab"})]})})},Z=e=>{let{isOpen:t,onSubmit:l,close:a,tabIds:i,initialTabKey:o}=e;return(0,n.jsx)(L.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:a,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),a()},initialValues:{id:o},validate:e=>{let{id:t}=e;return t?i.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Rename Tab"},children:e=>{let{errors:t,values:i,setFieldValue:o,isValid:r}=e;return(0,n.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(E,{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=>{i.id!==e.target.value&&o("id",e.target.value.trim())},onChange:e=>{o("id",e.target.value)}}),(0,n.jsx)(N.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!r,onClick:()=>{i.id&&i.id.length&&l({id:i.id.trim()}),a()},children:"Save"})]})}})},O=l(28316),P=l(88932),F=l(35289),K=l(17378),B=l(57344),R=l(16086),U=l(358),V=l(5495),X=l(39302),G=l(3285),H=l(40141),Y=l(65077),q=l(22654),Q=l(63470),W=l(91589),$=l(27213),J=l(31860);let ee=e=>{let{openCreateSliceModal:t,openCreateSliceFromImageModal:l,openUpdateSliceZoneModal:i,openSlicesTemplatesModal:o,projectHasAvailableSlices:r,isSlicesTemplatesSupported:s}=e,c=(0,q.l)(),d=(0,Q.k)(),u=(0,$.F)({menuType:"ActionList",sectionsNamingExperiment:d});return(0,n.jsxs)(a.s,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,n.jsx)(a.x,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,n.jsxs)(a.z,{size:"big",children:["Add ",(0,J._)(d.value)]}),(0,n.jsxs)(a.w,{children:[(0,J._)((0,J.f)(d.value))," are website sections that you can reuse on different pages with different content. Each on different pages with different content. Each"," ",d.value," has its own component in your code."]}),(0,n.jsx)(a.v,{children:(0,n.jsxs)(a.A,{children:[c.eligible&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromImage.BackgroundIcon,onClick:l,description:u.fromImage.description,children:u.fromImage.title}),(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromScratch.BackgroundIcon,onClick:t,description:u.fromScratch.description,children:u.fromScratch.title}),s&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromTemplate.BackgroundIcon,onClick:o,description:u.fromTemplate.description,children:u.fromTemplate.title}),r&&(0,n.jsx)(a.b,{renderStartIcon:()=>u.fromExisting.BackgroundIcon,onClick:i,description:u.fromExisting.description,children:u.fromExisting.title})]})})]})};var et=l(98250);function el(e){let{customType:t,tabId:l,slices:n}=e,a={...t};return n.forEach(e=>{a={...a,tabs:a.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}),a}var en=l(18566),ea=l(80148);async function ei(){try{let{templates:e,errors:t}=await ea.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 eo=l(6256),er=l(39204),es=l(7723),ec=l(33986),ed=l(30527),eu=l(55862);let em=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,n.jsx)(eu.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,n.jsx)(ed.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)(N.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)(N.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,n.jsx)(N.x8,{type:"button",onClick:l})]}),Footer:()=>(0,n.jsxs)(N.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)(ec.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,n.jsx)(ec.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,n.jsx)(N.nv,{children:"You're about to delete Slice Zone."})})})};var eh=l(43776),ep=l(62434),ex=l(63908),ev=l(63019),eb=l(65375),ey=l.n(eb);let ef=e=>{var t;let{isOpen:l,close:i,onSubmit:o,isLoading:r,slice:d,libraries:u}=e,{remoteSlices:m}=(0,c.v9)(e=>({remoteSlices:(0,es.sT)(e)})),h={from:null===(t=u[0])||void 0===t?void 0:t.name,sliceName:(0,U.MP)(d.key)},[p,v]=(0,s.useState)(h),[b,y]=(0,s.useState)();function f(e){v(e),y((0,ev.h)(e,u,m))}return(0,x.pQ)(l,()=>{l||(v(h),y(void 0))}),(0,n.jsxs)(a.ae,{open:l,onOpenChange:e=>!e&&i(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Upgrade slice"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){b&&Object.keys(b).length>0||o({libraryID:p.from,sliceID:p.sliceName})},children:(0,n.jsxs)(a.D,{flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:ey().scrollArea,children:[(0,n.jsx)(a.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)(a.bL,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,n.jsxs)(a.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)(a.aM,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,U.MP)(d.key),")"),error:null==b?void 0:b.sliceName,value:p.sliceName,onValueChange:e=>f({...p,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,n.jsxs)(a.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)("label",{className:ey().label,children:(0,n.jsx)(a.bL,{variant:"bold",children:"Slice library *"})}),(0,n.jsx)(a.bq,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:p.from,onValueChange:e=>{e&&f({...p,from:e})},children:u.map(e=>(0,n.jsx)(a.bt,{value:e.name,children:e.name},e.name))}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:r,disabled:b&&Object.keys(b).length>0,children:"Upgrade"})]})]})})})]})};var eg=l(96009),ej=l.n(eg);let eS=e=>{var t,l;let{isOpen:i,close:o,onSubmit:r,isLoading:c,slice:d,sliceName:u,libraries:m,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:ej()(d.key),variationName:u},[v,b]=(0,s.useState)(!0),[y,f]=(0,s.useState)(p),[g,j]=(0,s.useState)({});function S(e){f(e),j(eI(e,m))}return(0,x.pQ)(i,()=>{i||(f(p),j({}))}),(0,n.jsxs)(a.ae,{open:i,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Convert to slice variation"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){Object.keys(g).length>0||r(y)},children:(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:ey().scrollArea,children:[(0,n.jsx)(a.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)(a.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ey().label,children:[(0,n.jsx)(a.bL,{variant:"bold",children:"Target slice *"}),"string"==typeof g.libraryID?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:g.libraryID}):null,"string"==typeof g.sliceID?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:g.sliceID}):null]}),(0,n.jsx)(a.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)(a.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)(a.bL,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,n.jsx)(a.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(a.aM,{label:"Variation name *",placeholder:u,error:g.variationName,value:y.variationName,onValueChange:e=>{let t={...y,variationName:e.slice(0,30)};v&&(t.variationID=ej()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,n.jsx)(a.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(a.aM,{label:"ID *",placeholder:ej()(d.key),error:g.variationID,value:y.variationID,onValueChange:e=>{b(!1),S({...y,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:c,disabled:Object.keys(g).length>0,children:"Convert"})]})]})})})]})},eI=(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 a=null==n?void 0:n.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||a||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var i;(null!==(i=null==a?void 0:a.model.variations.map(e=>e.id))&&void 0!==i?i:[]).includes(e.variationID)&&(l.variationID="Slice variation ID is already taken.")}else l.variationID="Cannot be empty.";return l},eC=e=>{var t,l;let{isOpen:i,close:o,onSubmit:r,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),[p,v]=(0,s.useState)();return(0,x.pQ)(i,()=>{i||(h(u),v(void 0))}),(0,n.jsxs)(a.ae,{open:i,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(a.al,{title:"Merge with an existing slice"}),(0,n.jsx)(a.aj,{children:(0,n.jsx)(a.aJ,{onSubmit:function(){if(p)return;let[e,t,l]=m.split("::");r({libraryID:e,sliceID:t,variationID:l})},children:(0,n.jsxs)(a.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(a.bn,{className:ey().scrollArea,children:[(0,n.jsx)(a.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)(a.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ey().label,children:[(0,n.jsx)(a.bL,{variant:"bold",children:"Target slice*"}),"string"==typeof p?(0,n.jsx)(a.bL,{variant:"small",color:"tomato10",children:p}):null]}),(0,n.jsx)(a.bq,{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,n.jsx)(a.bt,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,n.jsx)(a.bL,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,n.jsxs)(a.ah,{children:[(0,n.jsx)(a.ai,{size:"medium"}),(0,n.jsx)(a.af,{type:"submit",size:"medium",loading:c,disabled:!!p,children:"Merge"})]})]})})})]})},eT=e=>{var t;let{slice:l,path:i}=e,{refreshState:o}=(0,g.Z)(),[r,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)(),{setCustomType:h}=C(),{libraries:p}=(0,c.v9)(e=>({libraries:(0,es.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=eD(l,x,y),j=async e=>{var t,n,a;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:r}=await ea.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...i,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(n=e.variationName)&&void 0!==n?n:"Default",variationID:null!==(a=e.variationID)&&void 0!==a?a:"default"}});if(r.length)throw console.error("Could not convert slice `".concat(x,"`"),r),P.Am.error("Could not convert slice `".concat(x,"`")),r;let{model:s,errors:c}=await ea.managerClient.customTypes.readCustomType({id:i.customTypeID});if(c.length||!s){console.error("Could not refresh custom type view `".concat(i.customTypeID,"`"),c),P.Am.error("Could not refresh custom type view `".concat(i.customTypeID,"`"));return}switch(o(await (0,v.y0)()),d(!1),m(void 0),u){case"as_new_slice":P.Am.success("".concat(x," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":P.Am.success("".concat(x," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:P.Am.success("".concat(x," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h({customType:s})},S={path:i,slice:l,sliceName:x,libraries:b,localSharedSlices:y,identicalSlices:f,close:()=>m(void 0),onSubmit:j,isLoading:r};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.ar,{children:[(0,n.jsx)(a.av,{children:(0,n.jsx)(a.E,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,n.jsxs)(a.as,{align:"start",children:[(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>m("as_new_slice"),children:"Upgrade slice"}),(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>m("as_new_variation"),disabled:!y.length,children:"Convert to slice variation"}),(0,n.jsx)(a.at,{startIcon:(0,n.jsx)(a.aX,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>m("merge_with_identical"),disabled:!f.length,children:"Merge with another slice"})]})]}),(0,n.jsx)(ef,{...S,isOpen:"as_new_slice"===u}),(0,n.jsx)(eS,{...S,isOpen:"as_new_variation"===u}),(0,n.jsx)(eC,{...S,isOpen:"merge_with_identical"===u})]})},eD=(e,t,l)=>(0,s.useMemo)(()=>{let n=[],a=(0,ex.ux)(e.value,t);for(let e of l)for(let t of e.model.variations){let l=(0,ex.ux)(t,e.model.name);a.primary===l.primary&&a.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]),ek=e=>{let{slice:t,path:l}=e,[i]=(0,eh.E)("legacySliceUpgrader"),o=i.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)(ep.Zb,{children:[(0,n.jsx)(ep.ZB,{component:"div",children:(0,n.jsx)(a.D,{alignItems:"center",justifyContent:"center",children:(0,n.jsx)(a.bL,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,n.jsxs)(ep.T$,{children:[(0,n.jsx)(a.c3,{content:o,side:"bottom",children:(0,n.jsx)(a.m,{color:"purple",title:"Legacy Slice"})}),i.enabled?(0,n.jsx)(eT,{slice:t,path:l}):null]}),(0,n.jsx)(ep.eW,{subtitle:"1 variation",title:(0,ex.Dj)(t.value)})]})};var ew=l(51507),e_=l(21151);let eL=e=>{let{slices:t,format:l,path:a,onRemoveSharedSlice:i}=e,o=t.some(e=>"SharedSlice"!==e.type),r=j.$[l],[c]=(0,eh.E)("legacySliceUpgrader");return(0,s.useEffect)(()=>{o&&(c.enabled?P.Am.info("This ".concat(r.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):P.Am.warning("This ".concat(r.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[o]),(0,n.jsx)(e_.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)(ek,{slice:t,path:a})}{let t=e.payload;return(0,n.jsx)(ew.b,{action:{type:"remove",onRemove:()=>{i(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function eA(e){try{let{templateIDs:t,localLibrariesNames:l,location:n,onSuccess:a}=e,{data:i,errors:o}=await ea.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(o.length>0||void 0===i)throw o;i.sliceIDs.forEach((e,a)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:n,mode:"template",sliceTemplate:t[a]})}),await a(i.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),P.Am.error(e)}}var eN=l(26109);let eE=[{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 eM=e=>{let{availableSlices:t,values:l,placeholderSlices:a}=e;return(0,n.jsx)(A.F2,{name:"sliceKeys",render:e=>(0,n.jsx)(e_.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{var i;let o=null!==(i=null==a?void 0:a.some(e=>e.model.id===t.model.id))&&void 0!==i&&i,r=l.sliceKeys.includes(t.model.id);return(0,n.jsx)(ew.b,{action:{type:"checkbox"},isComingSoon:o,mode:"selection",onSelectedChange:n=>{n?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:r,slice:t,variant:"outlined"})}})})};let ez=e=>{let{formId:t,close:l,onSuccess:a,availableSlicesTemplates:i,localLibraries:o,location:r}=e,{createSliceSuccess:s}=(0,g.Z)(),c=(0,Q.k)();return(0,n.jsx)(L.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;eA({templateIDs:t,localLibrariesNames:o.map(e=>e.name),location:r,onSuccess:async e=>{s((await (0,v.y0)()).libraries),a(await Promise.all(e.map(async e=>(await ea.managerClient.slices.readSlice({libraryID:o[0].name,sliceID:e})).model).filter(e=>void 0!==e)))}})},initialValues:{sliceKeys:[]},content:{title:"Use template ".concat((0,J._)(c.value))},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)(N.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eM,{values:t,placeholderSlices:eE,availableSlices:[...i.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:eN.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})})),...eE]})}})};var eZ=e=>{let{formId:t,close:l,onSubmit:a,availableSlices:i}=e,o=(0,Q.k)();return(0,n.jsx)(L.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;a(t.map(e=>{var t;return null===(t=i.find(t=>t.model.id===e))||void 0===t?void 0:t.model}).filter(e=>void 0!==e))},initialValues:{sliceKeys:[]},content:{title:"Select existing ".concat((0,J._)(o.value))},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)(N.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(eM,{values:t,availableSlices:i})}})};let eO=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:n,notFound:a}=e.value.reduce((e,t)=>{let{key:n,value:a}=t;if("SharedSlice"===a.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:a}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:n,notFound:a}};var eP=e=>{var t;let{customType:l,onCreateSliceZone:i,onDeleteSliceZone:o,onRemoveSharedSlice:r,sliceZone:d,tabId:u}=e,m=(0,q.l)(),h=(0,en.QT)(ei,[]),[p,x]=(0,s.useState)(!1),[b,y]=(0,s.useState)(!1),[f,j]=(0,s.useState)(!1),[S,I]=(0,s.useState)(!1),{remoteSlices:T,libraries:D}=(0,c.v9)(e=>({remoteSlices:(0,es.sT)(e),libraries:(0,es.Sd)(e),slices:(0,es.xC)(e)})),{setCustomType:k}=C(),{completeStep:w}=(0,et.k)(),{openLoginModal:L}=(0,g.Z)(),A=(0,Q.k)(),N=(0,$.F)({menuType:"Dropdown",sectionsNamingExperiment:A}),E=D.filter(e=>e.isLocal),{availableSlices:M,slicesInSliceZone:z,notFound:Z}=(0,s.useMemo)(()=>d?eO(d,D):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,D]),[O,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=M.filter(e=>!B.some(t=>t.model.id===e.model.id)),U=()=>{y(!0)},V=()=>{j(!0)},X=async()=>{await ea.managerClient.user.checkIsLoggedIn()?I(!0):L()},G=()=>{x(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},H=()=>{y(!1)},ec=()=>{j(!1)},ed=()=>{I(!1)},eu=()=>{x(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(F.Bu,{actions:d?(0,n.jsxs)(a.ar,{children:[(0,n.jsx)(a.av,{children:(0,n.jsx)(a.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,n.jsxs)(a.as,{align:"end",children:[m.eligible&&(0,n.jsx)(a.at,{renderStartIcon:()=>N.fromImage.BackgroundIcon,onSelect:()=>void X(),description:N.fromImage.description,children:N.fromImage.title}),(0,n.jsx)(a.at,{renderStartIcon:()=>N.fromScratch.BackgroundIcon,onSelect:V,description:N.fromScratch.description,children:N.fromScratch.title}),h.length>0?(0,n.jsx)(a.at,{onSelect:G,renderStartIcon:()=>N.fromTemplate.BackgroundIcon,description:N.fromTemplate.description,children:N.fromTemplate.title}):void 0,R.length>0?(0,n.jsx)(a.at,{onSelect:U,renderStartIcon:()=>N.fromExisting.BackgroundIcon,description:N.fromExisting.description,children:N.fromExisting.title}):void 0]})]}):void 0,toggle:"page"!==l.format||"Main"!==u?(0,n.jsx)(a.bC,{checked:!!d,onCheckedChange:e=>{e?i():K(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:(0,J._)((0,J.f)(A.value))}),d?z.length>0?(0,n.jsx)(Y.xR,{children:(0,n.jsx)(eL,{slices:z,format:l.format,path:{customTypeID:l.id,tabID:u,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:r})}):(0,n.jsx)(a.D,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,n.jsx)(ee,{openUpdateSliceZoneModal:U,openCreateSliceModal:V,openCreateSliceFromImageModal:()=>void X(),openSlicesTemplatesModal:G,projectHasAvailableSlices:R.length>0,isSlicesTemplatesSupported:h.length>0})}):void 0,b&&(0,n.jsx)(eZ,{formId:"tab-slicezone-form-".concat(u),availableSlices:R,onSubmit:e=>{let t=el({customType:l,tabId:u,slices:e});k({customType:_.Dc.fromSM(t),onSaveCallback:()=>{P.Am.success("Slice(s) added to slice zone")}}),w("createSlice"),H()},close:H}),p&&(0,n.jsx)(ez,{formId:"tab-slicezone-form-".concat(u),availableSlicesTemplates:h,localLibraries:E,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=el({customType:l,tabId:u,slices:e});k({customType:_.Dc.fromSM(t),onSaveCallback:()=>{P.Am.success((0,n.jsx)(er.GX,{message:"".concat((0,J.f)(A.value)," template(s) added to ").concat(A.value," zone and created at: "),path:"".concat(E[0].name,"/")}))}}),w("createSlice"),eu()},close:eu}),O&&(0,n.jsx)(em,{closeDeleteSliceZoneModal:()=>{K(!1)},deleteSliceZone:()=>{o(),K(!1)}}),(null==E?void 0:E.length)!==0&&f&&(0,n.jsx)(eo.c,{onSuccess:e=>{let t=el({customType:l,tabId:u,slices:[e]});k({customType:_.Dc.fromSM(t),onSaveCallback:()=>{P.Am.success((0,n.jsx)(er.GX,{message:"New ".concat(A.value," added to ").concat(A.value," zone and created at: "),path:"".concat(E[0].name,"/")}))}}),ec()},localLibraries:E,location:"".concat(l.format,"_type"),remoteSlices:T,onClose:ec}),(0,n.jsx)(W.S,{open:S,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:a}=e,i=el({customType:l,tabId:u,slices:t.map(e=>e.model)});k({customType:_.Dc.fromSM(i),onSaveCallback:()=>{P.Am.success((0,n.jsx)(er.GX,{message:"".concat((0,J.f)(A.value),"(s) added to ").concat(A.value," zone and created at: "),path:a}))}}),ed()},onClose:ed})]})};let eF=[B.C.UID,B.C.Image,B.C.Text,B.C.StructuredText,B.C.Link,B.C.Select,B.C.Boolean,B.C.Number,B.C.Color,B.C.Date,B.C.Table,B.C.Embed,B.C.Timestamp,B.C.GeoPoint,B.C.ContentRelationship,B.C.LinkToMedia,B.C.Group,B.C.NestedGroup];var eK=e=>{var t,l,i,o;let{tabId:r}=e,{customType:c,setCustomType:d}=C(),m=_.Dc.toSM(c),h=null===(t=m.tabs.find(e=>e.key===r))||void 0===t?void 0:t.sliceZone,p=null!==(i=null===(l=m.tabs.find(e=>e.key===r))||void 0===l?void 0:l.value)&&void 0!==i?i:[],x="page"===m.format&&m.repeatable?p.filter(e=>"uid"!==e.key):p,v=m.tabs.reduce((e,t)=>[...e,...t.value],[]),b=e=>{var t;let{apiId:l,value:n}=e,a=null===(t=n.config)||void 0===t?void 0:t.label;if((0,R.Ss)(B.C,n.type)||null==a)return;if("Range"===n.type||"IntegrationFields"===n.type||"Separator"===n.type)throw Error("Unsupported Field Type: ".concat(n.type));let i=B.C[n.type];try{i.schema.validateSync(n,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(n.type,'".'))}let o=_.L$.fromSM(n);d({customType:(0,u.xS)({customType:c,newField:o,newFieldId:l,sectionId:r}),onSaveCallback:()=>{P.Am.success("".concat("Group"===n.type?"Group":"Field"," added"))}}),(0,V.V)({id:l,field:o})},y=e=>{let{apiId:t,newKey:l,value:n,inGroupFieldAction:a,updateMeta:i}=e;if((0,R.Ss)(B.C,n.type))return;let o=_.L$.fromSM(n);d({customType:(0,u.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:o,sectionId:r}),onSaveCallback:()=>{"add"===a&&P.Am.success("Field added")},updateMeta:i}),a||(0,X.Z)({previousId:t,id:l,field:o})};return(0,n.jsx)(K.S,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(a.D,{padding:32,children:(0,n.jsx)(a.bg,{})}),children:(0,n.jsxs)(F.aV,{border:!1,style:{flexGrow:1},children:[(0,n.jsx)(H.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:G.Z,widgetsArray:eF,onDeleteItem:e=>{d({customType:(0,u.AK)({customType:c,fieldId:e,sectionId:r})})},onSave:e=>""===e.apiId?b({...e,apiId:e.newKey}):y(e),onDragEnd:e=>{if((0,R.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let n=(0,u.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:r});(0,O.flushSync)(()=>d({customType:n}))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,U.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,U.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,n.jsx)(eP,{customType:m,tabId:r,sliceZone:h,onRemoveSharedSlice:e=>{d({customType:(0,u.EN)({customType:c,sectionId:r,sliceId:e})})},onCreateSliceZone:()=>{d({customType:(0,u.Tr)(c,r)})},onDeleteSliceZone:()=>{d({customType:(0,u.E3)(c,r)})}})]})})})};let eB=()=>{var e,t,l;let{customType:i,setCustomType:o}=C(),r=_.Dc.toSM(i),[c,d]=(0,s.useState)(null===(e=r.tabs[0])||void 0===e?void 0:e.key),[m,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)(a.c9,{sx:p?{flexGrow:1}:void 0,children:["page"===i.format?(0,n.jsx)(a.ca,{title:i.repeatable?(0,n.jsx)(D,{}):void 0}):void 0,(0,n.jsxs)(a.cb,{onValueChange:d,value:c,children:[(0,n.jsx)(a.cd,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:r.tabs.map(e=>(0,n.jsx)(a.ce,{menu:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.at,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(a.aX,{name:"edit"}),children:"Rename"}),(0,n.jsx)(a.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"===i.format&&i.repeatable&&(null==t?void 0:t.key)===e}(e.key),onSelect:()=>{h({type:"DELETE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(a.aX,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),r.tabs.map(e=>(0,n.jsx)(a.cc,{value:e.key,children:(0,n.jsx)(eK,{tabId:e.key})},e.key))]})]}),(null==m?void 0:m.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(M,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,u.vB)(i,t)}),d(t)},tabIds:r.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(Z,{close:()=>{h(void 0)},initialTabKey:m.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,u.HO)(i,m.tabKey,t)}),c===m.tabKey&&d(t)},tabIds:r.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,n.jsx)(z,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(o({customType:(0,u.F$)(i,m.tabKey)}),c===m.tabKey){var e;let t=null===(e=r.tabs.find(e=>e.key!==m.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eR=l(16442),eU=l(78254),eV=l(60867),eX=l(9975),eG=l(34919),eH=l.n(eG);let eY=e=>{let{tabs:t,...l}=e;return(0,n.jsxs)(eX.fC,{...l,className:eH().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,n.jsx)(eX.aV,{className:eH().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,n.jsx)(eX.xz,{className:eH().trigger,value:l,children:(0,n.jsx)(a.bL,{className:eH().triggerText,component:"span",color:"inherit",children:l})},"".concat(l,"-trig").concat(t+1))})}),t.map((e,t)=>{let{label:l,content:i}=e;return(0,n.jsx)(eX.VY,{className:eH().content,value:l,children:(0,n.jsx)(a.bn,{className:eH().scrollArea,children:i})},"".concat(l,"-content").concat(t+1))})]})};var eq=l(25661),eQ=l(88241),eW=l(32554),e$=l(44621),eJ=l.n(e$);let e0=e=>{var t,l;let{inline:i,...o}=e,r=(0,eW.p)();if(!0===i)return(0,n.jsx)("code",{...o,className:eJ().inlineCode});let s=(()=>{var e,t,l,n,a;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===(a=o.className)||void 0===a?void 0:a.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)(a.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})},e1=e=>{let{markdown:t}=e;return(0,n.jsx)(eq.D,{children:t,linkTarget:"_blank",remarkPlugins:[eQ.Z],components:{code:e=>(0,n.jsx)(e0,{...e}),h1:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,n.jsx)(a.bL,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,n.jsx)(a.bL,{className:eJ().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,n.jsx)(a.bL,{className:eJ().section,children:e.children,component:"pre",variant:"normal"})}})};async function e4(e){let t=JSON.parse(e),{errors:l,documentation:n}=await ea.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return n}var e3=l(65480),e6=l.n(e3);let e2=e=>{var t;let{model:l}=e,i=(0,eW.p)(),o=(t={kind:"PageSnippet",data:{model:l}},(0,en.QT)(e4,[JSON.stringify(t)])),{completeStep:r}=(0,et.k)();return 0===o.length?null:(0,n.jsxs)(a.ae,{size:"small",trigger:(0,n.jsx)(a.E,{color:"grey",onClick:()=>{r("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:i})},startIcon:"code",children:"Page snippet"}),children:[(0,n.jsx)(a.al,{icon:"code",title:"Page snippet"}),(0,n.jsx)("section",{className:e6().content,children:o.length>1?(0,n.jsx)(eY,{style:{flex:1},tabs:o.map((e,t)=>{let{label:l,content:a}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,n.jsx)(e1,{markdown:a})}})}):(0,n.jsx)(a.bn,{style:{flex:1,padding:16},children:(0,n.jsx)(e1,{markdown:o[0].content})})})]})},e8=e=>{let{model:t}=e;return(0,n.jsx)("div",{children:(0,n.jsx)(K.S,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(a.E,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,n.jsx)(e2,{model:t})})})})},e5=()=>{let e=(0,r.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eU.Jk)(t,(0,h.Ag)(e.query))}));return((0,s.useEffect)(()=>{t&&(0,eR.TG)(t)||e.replace("/")},[t,e]),t&&(0,eR.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)(e9,{customType:t.local})]}):(0,n.jsx)(p.LN,{})},e9=e=>{let{customType:t}=e;return null===t?(0,n.jsx)(p.LN,{}):(0,n.jsx)(p.LN,{children:(0,n.jsx)(I,{initialCustomType:_.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:i,customType:o,setCustomType:r}=e,s=(0,u.y6)(o),c=h.cd[t.format],x=j.$[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)(m.X,{status:i}),"page"===o.format?(0,n.jsx)(e8,{model:o}):void 0,(0,n.jsx)(eV._,{isChangesLocal:!0,format:s,customType:o,setLocalCustomType:r})]})]}),(0,n.jsx)(p.RN,{children:(0,n.jsx)(a.D,{flexDirection:"column",minWidth:0,children:(0,n.jsx)(eB,{})})})]})}})})}},43776:function(e,t,l){"use strict";l.d(t,{E:function(){return a}});var n=l(31470);function a(e){var t,l;let[a,i]=(0,n.f)(),o=async t=>{let l={...a,labs:{...a.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await i(l)};return[{enabled:null!==(l=null==a?void 0:null===(t=a.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},o]}},31470:function(e,t,l){"use strict";l.d(t,{f:function(){return i}});var n=l(18566),a=l(80148);function i(){return[(0,n.QT)(o,[]),async e=>{await a.managerClient.project.writeSliceMachineConfig({config:e}),(0,n.VA)(o,[],e)}]}async function o(){return a.managerClient.project.getSliceMachineConfig()}},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"}}}]);
|