slice-machine-ui 1.26.1-beta.4 → 1.26.1-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.
Files changed (44) hide show
  1. package/components/AppLayout/index.tsx +2 -2
  2. package/lib/builders/SliceBuilder/index.tsx +5 -1
  3. package/out/404.html +1 -1
  4. package/out/_next/static/{zMlvOMtDAareAu0eymqLx → 90I9r-r0EJ5L9L71lZ_H-}/_buildManifest.js +1 -1
  5. package/out/_next/static/chunks/{727-2c302be2def92786.js → 727-7536690b0938f88f.js} +1 -1
  6. package/out/_next/static/chunks/{904-c9221a5cb09524e8.js → 904-cac58924044acc83.js} +1 -1
  7. package/out/_next/static/chunks/pages/{_app-084b9a738425d5ce.js → _app-98898cc8c45f6edb.js} +1 -1
  8. package/out/_next/static/chunks/pages/{changelog-5c9ac93faf0df06b.js → changelog-4cee9fbfd4fdfc70.js} +1 -1
  9. package/out/_next/static/chunks/pages/changes-b1d7cb1c845848ee.js +1 -0
  10. package/out/_next/static/chunks/pages/{labs-6f5925cd6cdcee9e.js → labs-566a982a3e954547.js} +1 -1
  11. package/out/_next/static/chunks/pages/{settings-f0620e5b727cda03.js → settings-6c2777758905c784.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-24acc6726cb20b65.js +1 -0
  13. package/out/_next/static/chunks/pages/slices-a633527fee62b6cd.js +1 -0
  14. package/out/_next/static/css/{238631d146c5ed97.css → 82840c077aa9a9d5.css} +1 -1
  15. package/out/changelog.html +1 -1
  16. package/out/changes.html +1 -1
  17. package/out/custom-types/[customTypeId].html +1 -1
  18. package/out/custom-types.html +1 -1
  19. package/out/index.html +1 -1
  20. package/out/labs.html +1 -1
  21. package/out/page-types/[pageTypeId].html +1 -1
  22. package/out/settings.html +1 -1
  23. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  24. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  25. package/out/slices.html +1 -1
  26. package/package.json +3 -3
  27. package/pages/changes.tsx +4 -1
  28. package/pages/slices.tsx +4 -1
  29. package/src/components/Breadcrumb/Breadcrumb.module.css +11 -0
  30. package/src/components/Breadcrumb/Breadcrumb.module.css.d.ts +6 -0
  31. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +34 -0
  32. package/src/components/Breadcrumb/Breadcrumb.tsx +43 -25
  33. package/src/components/Breadcrumb/index.ts +1 -1
  34. package/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +5 -6
  35. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +9 -4
  36. package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +11 -12
  37. package/src/features/labs/labsList/LabsPage.tsx +4 -1
  38. package/src/features/settings/SettingsPage.tsx +4 -1
  39. package/out/_next/static/chunks/pages/changes-3e4989e09fd412a8.js +0 -1
  40. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-8d7043e6638d65cd.js +0 -1
  41. package/out/_next/static/chunks/pages/slices-77cff50b1df13579.js +0 -1
  42. package/src/components/Breadcrumb/Breadcrumb.css.ts +0 -5
  43. package/src/components/Breadcrumb/Breadcrumb.stories.ts +0 -32
  44. /package/out/_next/static/{zMlvOMtDAareAu0eymqLx → 90I9r-r0EJ5L9L71lZ_H-}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[136],{31314:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]",function(){return t(79336)}])},79336:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return eb}});var i=t(52322),r=t(97729),o=t.n(r),a=t(5632),c=t(22715),s=t(28316),u=t(83462),l=t(38876),d=t(2353),f=t(44384),p=t(28173),v=t(53559),m=t(22710),h=t(62230),y=t(85244),x=t(99267),g=t(2784),j=t(74217),b=t(82770),I=t(90374),Z=t(50950),w=t(26921),S=(0,g.createContext)(void 0);function T(e){var n=e.children,t=e.initialSlice,r=(0,a.useRouter)(),o=(0,g.useState)(t),c=o[0],s=o[1],u=(0,w.c)({errorMessage:"Failed to save slice. Check your browser's console for more information."}),l=u.actionQueueStatus,d=u.setNextAction,f=(0,I.Z)().saveSliceSuccess,p=(0,j.R9)(f),v=(0,Z.g)().syncChanges,T=(0,g.useMemo)(function(){var e=r.query.variation,n=c.model.variations.find(function(n){return n.id===e});if(n)return n;throw Error("Variation not found")},[c,r]),C=(0,g.useCallback)(function(e){s(e),d((0,m.Z)(function(){var n,t,i,r,o;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,b.Ve)(e)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.pL)({libraryID:e.from,sliceID:e.model.id})];case 2:if(r=(i=n.sent()).errors,o=i.mocks,r.length>0)throw r;return p((0,y.Z)((0,h.Z)({},e),{mocks:o})),v(),[2]}})}))},[d,p,v]),k=(0,g.useMemo)(function(){return{actionQueueStatus:l,slice:c,setSlice:C,variation:T}},[l,c,C,T]);return(0,i.jsx)(S.Provider,{value:k,children:"function"==typeof n?n(k):n})}function C(){var e=(0,g.useContext)(S);if(!e)throw Error("SliceBuilderProvider not found");return e}var k=t(5479),F=t(8482),E=t(4092),A=function(){var e=C(),n=e.slice,t=e.setSlice,r=e.variation,o=function(e){return function(i){var o=(0,k.AK)({slice:n,variationId:r.id,widgetArea:e,fieldId:i});t(o)}},a=function(e){return function(i){var o=i.apiId,a=i.newKey,c=i.value,s=(0,k.L4)({slice:n,variationId:r.id,widgetArea:e,previousFieldId:o,newFieldId:a,newField:c});t(s)}},c=function(e){return function(i){var o=i.id,a=i.label,c=i.widgetTypeName,s=d[c];s||console.log('Could not find widget with type name "'.concat(c,'". Please contact us!'));var u=s.create(a);if("Range"===u.type||"IntegrationFields"===u.type||"Separator"===u.type)throw Error("Unsupported Field Type: ".concat(u.type));try{d[u.type].schema.validateSync(u,{stripUnknown:!1})}catch(l){throw Error('Model is invalid for widget "'.concat(u.type,'".'))}var f=(0,k.xS)({slice:n,variationId:r.id,widgetArea:e,newFieldId:o,newField:u});t(f),b.Xe.track({event:"field:added",id:o,name:a,type:c,isInAGroup:!1,contentType:"slice"})}},m=function(e){return function(i){if(!(0,u.uS)(i)){var o=i.source,a=i.destination;if(a){var c=(0,k.gR)({slice:n,variationId:r.id,widgetArea:e,sourceIndex:o.index,destinationIndex:a.index});(0,s.flushSync)(function(){return t(c)})}}}};return(0,i.jsxs)(p.aV,{children:[(0,i.jsx)(F.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,title:"Non-Repeatable Zone",dataTip:" The non-repeatable zone\n is for fields<br/> that should appear once, like a<br/>\n section title.\n",fields:r.primary,EditModal:E.Z,widgetsArray:f.Z,onDeleteItem:o(v.Rt.Primary),onSave:a(v.Rt.Primary),onSaveNewField:c(v.Rt.Primary),onDragEnd:m(v.Rt.Primary),poolOfFieldsToCheck:r.primary||[],renderHintBase:function(e){var n=e.item;return"slice.primary".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.primary".concat((0,l.Ti)(e))},testId:"static-zone-content",isRepeatableCustomType:void 0}),(0,i.jsx)(F.Z,{zoneType:"slice",zoneTypeFormat:void 0,tabId:void 0,isRepeatable:!0,title:"Repeatable Zone",dataTip:"The repeatable zone is for a group<br/>\n of fields that you want to be able to repeat an<br/>\n indeterminate number of times, like FAQs",widgetsArray:f.Z,fields:r.items,EditModal:E.Z,onDeleteItem:o(v.Rt.Items),onSave:a(v.Rt.Items),onSaveNewField:c(v.Rt.Items),onDragEnd:m(v.Rt.Items),poolOfFieldsToCheck:r.items||[],renderHintBase:function(e){var n=e.item;return"item".concat((0,l.Ti)(n.key))},renderFieldAccessor:function(e){return"slice.items[i]".concat((0,l.Ti)(e))},testId:"slice-repeatable-zone",isRepeatableCustomType:void 0})]})},R=t(88932),O=t(36131),_=t(63397),N=t(75289),D=t(76635),L=t(25812),V=t(54132),M=function(e){var n=e.children,t=e.FooterContent,r=e.HeaderContent,o=e.close,a=e.sx,c=e.headerSx,s=void 0===c?{}:c;return(0,i.jsx)(V.Z,{borderFooter:!0,footerSx:{p:0},bodySx:{pt:2,pb:4,px:4},sx:(0,h.Z)({border:"none"},void 0===a?{}:a),Header:function(e){var n=e.radius;return(0,i.jsxs)(N.kC,{sx:(0,h.Z)({p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},s),children:[r,o?(0,i.jsx)(N.x8,{onClick:o,type:"button"}):null]})},Footer:t?(0,i.jsxs)(N.kC,{sx:{alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(N.xu,{sx:{ml:"auto"}}),t]}):null,children:n})},z=function(e){var n=e.msg;return(0,i.jsx)(N.xv,{as:"span",sx:{fontSize:12,color:"error",mt:"5px",ml:2},children:n||"Error!"})},P=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,s=function(e){var n=e.id,t=e.name,i=e.origin,r=n&&n.length?null:{id:"Required!"},o=a.find(function(e){return e.id===n})?{id:"This id already exists!"}:null,c=t&&t.length?null:{name:"Required!"},s=i.value.length&&a.find(function(e){return e.id===i.value})?null:{id:"You must select an existing variation!"},u=n&&n.length&&!/^[A-Za-z0-9]+([A-Za-z0-9]+)*$/.exec(n)&&{id:"No special characters allowed"};return(0,h.Z)({},r,o,c,s,u)},u=function(e){w((0,D.camelCase)(e))},l=function(e){E(e),T&&u(e)},d=function(e){C(!1),u(e)},f=function(){p(),t()},p=function(){w(""),E(""),b({}),C(!0),V({value:o.id,label:o.name})},v=(0,g.useState)({}),j=v[0],b=v[1],I=(0,g.useState)(""),Z=I[0],w=I[1],S=(0,g.useState)(!0),T=S[0],C=S[1],k=(0,g.useState)(""),F=k[0],E=k[1],A=(0,g.useState)({value:o.id,label:o.name}),R=A[0],V=A[1],P=(0,g.useState)(!1),K=P[0],q=P[1];function B(){return H.apply(this,arguments)}function H(){return(H=(0,m.Z)(function(){var e,n;return(0,x.__generator)(this,function(t){switch(t.label){case 0:if(!Object.keys(e=s({id:Z,name:F,origin:R})).length)return[3,1];return b(e),[3,3];case 1:if(!(n=a.find(function(e){return e.id===R.value})))return[3,3];return q(!0),[4,r(Z,F,n)];case 2:t.sent(),q(!1),f(),t.label=3;case 3:return[2]}})})).apply(this,arguments)}return(0,g.useEffect)(function(){p()},[o,n]),(0,i.jsx)(L.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,onRequestClose:function(){return f()},contentLabel:"Widget Form Modal",style:{content:{maxWidth:"700px"}},children:(0,i.jsx)(_.J9,{initialValues:{id:Z,name:F,origin:R},onSubmit:B,children:(0,i.jsx)(_.l0,{id:"variation-add",onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),B())},children:(0,i.jsx)(c.xu,{children:(0,i.jsxs)(M,{sx:{textAlign:"left"},HeaderContent:(0,i.jsx)(N.xv,{as:"h2",children:"Add new Variation"}),FooterContent:(0,i.jsxs)(c.xu,{gap:16,alignItems:"center",children:[(0,i.jsx)(c.zx,{onClick:f,color:"grey",children:"Cancel"}),(0,i.jsx)(c.zx,{loading:K,children:"Submit"})]}),close:f,children:[(0,i.jsxs)(c.xu,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(N.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",j.name?(0,i.jsx)(z,{msg:j.name}):""]}),(0,i.jsx)(_.gN,{autoComplete:"off",id:"name",name:"name",placeholder:"e.g. Grid - With Icon",as:N.II,maxLength:30,value:F,onChange:function(e){return l(e.currentTarget.value)}}),(0,i.jsx)(N.xv,{children:"It will appear here in Slice Machine, and in the page editor in Prismic"})]}),(0,i.jsxs)(c.xu,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(N.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",j.id?(0,i.jsx)(z,{msg:j.id}):""]}),(0,i.jsx)(_.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:N.II,maxLength:30,value:Z,onChange:function(e){return d(e.currentTarget.value)}}),(0,i.jsx)(N.xv,{children:"It's generated automatically based on the variation name and will appear in the API responses."})]}),(0,i.jsxs)(c.xu,{flexDirection:"column",padding:{bottom:8},children:[(0,i.jsx)(N.__,{htmlFor:"origin",sx:{mb:1},children:"Duplicate from"}),(0,i.jsx)(O.ZP,{name:"origin",options:a.map(function(e){return{value:e.id,label:e.name}}),onChange:function(e){e&&V(e)},defaultValue:R,maxMenuHeight:150,theme:function(e){return(0,y.Z)((0,h.Z)({},e),{colors:(0,y.Z)((0,h.Z)({},e.colors),{text:"text",primary:"background"})})}})]})]})})})})})},K=t(49451);function q(){return(q=(0,m.Z)(function(e){var n,t,i,r,o,a,c,s,u,l,d,f;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),[4,(0,b.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.Xi)({libraryID:e.component.from,sliceID:e.component.model.id,variationID:e.variation.id})];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,b.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(c=o.errors).length>0)throw c;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,b.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return s=n.sent().mocks,u=K.Y.getBuilderPagePathname({libraryName:e.component.href,sliceName:a.name,variationId:a.variations[0].id}),[4,e.router.replace(u)];case 5:return n.sent(),l=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:s}),e.saveSliceSuccess(l),[2,l];case 6:throw d=n.sent(),f="Could not delete variation `".concat(e.variation.name,"`"),console.error(f,d),R.Am.error(f),d;case 7:return[2]}})})).apply(this,arguments)}var B=function(e){var n=e.isOpen,t=e.onClose,r=e.slice,o=e.variation,s=(0,a.useRouter)(),u=(0,g.useState)(!1),l=u[0],d=u[1],f=(0,I.Z)().saveSliceSuccess,p=C().setSlice;return(0,i.jsxs)(c.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(c.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(c.cZ,{children:(0,i.jsxs)(c.xu,{flexDirection:"column",children:[(0,i.jsxs)(c.xv,{color:"grey11",sx:{marginBlock:16,marginInline:16},children:["This action will remove the variation from the slice model and delete associated files. When you push your changes, the variation will disappear from your repository. This update will"," ",(0,i.jsx)(H,{children:"not"})," affect your documents until you ",(0,i.jsx)(H,{children:"edit"})," ","them manually."]}),(0,i.jsx)(c.kX,{ok:{text:"Delete",color:"tomato",onClick:function(){o&&(0,m.Z)(function(){var e;return(0,x.__generator)(this,function(e){switch(e.label){case 0:d(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,function(e){return q.apply(this,arguments)}({component:r,router:s,saveSliceSuccess:f,variation:o})];case 2:return p(e.sent()),[3,4];case 3:return e.sent(),[3,4];case 4:return d(!1),t(),[2]}})})()},loading:l},cancel:{text:"Cancel"},size:"medium"})]})})]})},H=function(e){return(0,i.jsx)(c.xv,(0,y.Z)((0,h.Z)({},e),{color:"inherit",component:"span",variant:"bold"}))};function X(){return(X=(0,m.Z)(function(e){var n,t,i,r,o,a,c,s,u,l,d;return(0,x.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,(0,b.Ve)(e.component)];case 1:if((t=n.sent().errors).length>0)throw t;return[4,(0,b.eH)(e.component,(0,y.Z)((0,h.Z)({},e.variation),{name:e.variationName}))];case 2:if((r=n.sent().errors).length>0)throw r;return[4,(0,b.X$)(e.component.from,e.component.model.id)];case 3:if(a=(o=n.sent()).slice,(c=o.errors).length>0)throw c;if(!a)throw Error("Could not read variation `".concat(e.variation.name,"`"));return[4,(0,b.pL)({libraryID:e.component.from,sliceID:e.component.model.id})];case 4:return s=n.sent().mocks,u=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:s}),e.saveSliceSuccess(u),[2,u];case 5:throw l=n.sent(),d="Could not rename variation `".concat(e.variation.name,"`"),console.error(d,l),R.Am.error(d),l;case 6:return[2]}})})).apply(this,arguments)}var U=function(e){var n,t,r=e.isOpen,o=e.onClose,a=e.slice,s=e.variation,u=(0,g.useState)(!1),l=u[0],d=u[1],f=C().setSlice,p=(0,I.Z)().saveSliceSuccess;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(c.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(c.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(c.cZ,{children:(0,i.jsx)(_.J9,{validateOnMount:!0,initialValues:{variationName:null!==(n=null==s?void 0:s.name)&&void 0!==n?n:""},validate:function(e){if(0===e.variationName.length)return{variationName:"Cannot be empty"}},onSubmit:(t=(0,m.Z)(function(e){var n;return(0,x.__generator)(this,function(n){switch(n.label){case 0:if(!s)return[2];d(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,function(e){return X.apply(this,arguments)}({component:a,saveSliceSuccess:p,variation:s,variationName:e.variationName.trim()})];case 2:return f(n.sent()),[3,4];case 3:return n.sent(),[3,4];case 4:return d(!1),o(),[2]}})}),function(e){return t.apply(this,arguments)}),children:function(e){return(0,i.jsxs)("form",{children:[(0,i.jsxs)(c.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(c.xv,{variant:"normal",color:"grey11",children:"This action will rename the variation in the slice model. When you push your changes, the variation will be renamed in your repository."}),(0,i.jsxs)(c.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(c.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(c.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(c.yt,{placeholder:"Variation name",error:"string"==typeof e.errors.variationName,value:e.values.variationName,onValueChange:function(n){e.setFieldValue("variationName",n.slice(0,30))}})]})]}),(0,i.jsx)(c.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:l,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},W=t(15836),G=t(71749),Q=t(47731),$=function(){var e,n=C(),t=n.slice,r=n.variation,o=n.setSlice,s=(0,g.useState)(),u=s[0],l=s[1],d=(0,Q.H)(),f=d.modalPayload,p=f.sliceFilterFn,v=f.defaultVariationSelector,h=f.onUploadSuccess,y=(0,a.useRouter)(),j=(0,I.Z)().saveSliceSuccess;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c.xu,{flexDirection:"column",gap:16,children:[t.model.variations.map(function(e){return(0,i.jsx)(G.b,{action:{type:"menu",onRename:function(){l({type:"RENAME_VARIATION",variation:e})},onRemove:function(){l({type:"DELETE_VARIATION",variation:e})},removeDisabled:t.model.variations.length<=1},mode:"navigation",onUpdateScreenshot:function(){d.onOpenModal({sliceFilterFn:function(e){return e},defaultVariationSelector:{sliceID:t.model.id,variationID:e.id},onUploadSuccess:function(e){o(e)}})},replace:!0,selected:e.id===r.id,slice:t,variant:"outlined",variationId:e.id},e.id)}),(0,i.jsxs)(c.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(c.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(c.zx,{onClick:function(){l({type:"ADD_VARIATION"})},startIcon:"add",sx:{position:"relative"},color:"grey",children:"Add a new variation"})]})]}),(0,i.jsx)(W.Z,{slices:p([t]),defaultVariationSelector:v,onUploadSuccess:h}),(0,i.jsx)(U,{isOpen:(null==u?void 0:u.type)==="RENAME_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(B,{isOpen:(null==u?void 0:u.type)==="DELETE_VARIATION",onClose:function(){l(void 0)},slice:t,variation:null==u?void 0:u.variation}),(0,i.jsx)(P,{initialVariation:r,isOpen:(null==u?void 0:u.type)==="ADD_VARIATION",onClose:function(){l(void 0)},onSubmit:(e=(0,m.Z)(function(e,n,i){var r,a,c,s,u,l;return(0,x.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),a=(r=(0,k.Kp)({slice:t,id:e,name:n,copiedVariation:i})).slice,c=r.variation,[4,(0,b.Ve)(a)];case 1:return d.sent(),j(a),o(a),s=K.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:c.id}),y.replace(s),[3,3];case 2:return u=d.sent(),l="Could not add variation `".concat(n,"`"),console.error(l,u),R.Am.error(l),[3,3];case 3:return[2]}})}),function(n,t,i){return e.apply(this,arguments)}),variations:t.model.variations})]})},J=t(75329),Y=t(33710),ee=t(42189),en=t(17036),et=t(56580),ei=t(22342),er=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(ei.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(ei.Ev,{children:"Simulate your slices"}),(0,i.jsx)(ei.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:J.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:J.Sn})}}),(0,i.jsx)(ei.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(ei.Rp,{children:"Got it"})]})},eo=function(e){var n=e.disabled,t=(0,a.useRouter)(),r=(0,g.useRef)(null),o=(0,I.Z)().setSeenSimulatorToolTip,s=(0,et.v9)(function(e){return{hasSeenSimulatorTooltip:(0,en.bv)(e)}}).hasSeenSimulatorTooltip;(0,g.useEffect)(function(){var e=r.current;e&&!s&&setTimeout(function(){return Y.Z.show(e)},5e3)},[s]);var u=function(){if(o(),r.current){var e=r.current;Y.Z.hide(e)}};return(0,i.jsx)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:r,children:(0,i.jsx)(er,{open:!s,onClose:u,children:(0,i.jsx)(c.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){u(),window.open("".concat(t.asPath,"/simulator"),J.pq)},disabled:n,renderStartIcon:function(){return(0,i.jsx)(ee.z,{color:c.TV.color.greyLight1,height:c.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:c.TV.size[24]})},children:"Simulate"})})})},ea=t(53220),ec=t(17329),es=t(81038);function eu(e){return el.apply(this,arguments)}function el(){return(el=(0,m.Z)(function(e){var n,t,i;return(0,x.__generator)(this,function(r){switch(r.label){case 0:return[4,es.j.customTypes.readCustomType({id:e})];case 1:if(t=(n=r.sent()).errors,i=n.model,t.length>0)throw t;return[2,i]}})})).apply(this,arguments)}var ed=t(67445),ef=t(64722),ep=t(20812),ev=function(e){return(0,i.jsxs)("svg",(0,y.Z)((0,h.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M9.5 12L6 9.5L9.5 7V9.5V12Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M6 9.5H11C14.3 9.5 17 12.2 17 15.5V17.5M6 9.5L9.5 12V9.5V7L6 9.5Z",stroke:"currentColor",strokeLinecap:"round"})]}))},em=t(8564),eh=function(){var e,n,t=(e=(0,ef.l)().source,n=(0,ed.Ag)(e.query),void 0!==n&&(0,ed.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(em.S,{children:(0,i.jsx)(g.Suspense,{children:(0,i.jsx)(c.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(ey,{sourceCustomTypeId:t})})})}):null},ey=function(e){var n,t=(n=e.sourceCustomTypeId,(0,ec.QT)(eu,[n])),r=(0,g.useState)(!0),o=r[0],s=r[1],u=(0,a.useRouter)();if(void 0===t||!o)return null;var l=t.format,d=t.id,f=ed.cd[l].getBuilderPagePathname(d);return(0,i.jsxs)(c.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(c.zx,{onClick:function(){u.push(f)},renderStartIcon:function(){return(0,i.jsx)(ev,{})},children:["Return to ",t.label]}),(0,i.jsx)(c.zx,{onClick:function(){s(!1)},renderStartIcon:function(){return(0,i.jsx)(ep.T,{})}})]})},ex=t(47976),eg=function(){var e=C(),n=e.slice,t=e.actionQueueStatus;return(0,i.jsxs)(ea.LN,{children:[(0,i.jsxs)(ea.wd,{children:[(0,i.jsx)(ea.Xq,{url:"/slices"}),(0,i.jsx)(ea.Cx,{folder:"Slices",page:n.model.name}),(0,i.jsxs)(ea.K2,{children:[(0,i.jsx)(ex.X,{status:t}),(0,i.jsx)(eo,{disabled:"done"!==t})]})]}),(0,i.jsxs)(ea.RN,{children:[(0,i.jsxs)(c.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)($,{}),(0,i.jsx)(A,{})]}),(0,i.jsx)(eh,{})]})]})},ej=t(25998);function eb(){var e=(0,a.useRouter)(),n=(0,ej.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,i.jsx)(T,{initialSlice:t,children:function(e){var n=e.slice;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsxs)("title",{children:[n.model.name," - Slice Machine"]})}),(0,i.jsx)(eg,{})]})}})}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return b},E3:function(){return v},EN:function(){return m},F$:function(){return x},GA:function(){return C},HO:function(){return g},L4:function(){return I},Tr:function(){return p},Ue:function(){return O},gR:function(){return Z},j6:function(){return S},kQ:function(){return w},l9:function(){return T},mf:function(){return h},vB:function(){return y},xS:function(){return j},y6:function(){return u}});var i=t(67557),r=t(62230),o=t(85244),a=t(17064),c=t(88866),s=t(98863);function u(e){var n;return null!==(n=e.format)&&void 0!==n?n:"custom"}function l(e){return Object.entries(e.json)}function d(e,n){return e.json[n]}function f(e,n){var t=d(e,n);if(void 0!==t)return Object.entries(t).find(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type===c.SlicesFieldType})}function p(e,n){if(t=e,d=f(t,s=n),(p=(0,a.Z)(null!=d?d:[],2))[0],null!==(u=null==(v=p[1])?void 0:v.config)&&void 0!==u?u:void 0)return e;var t,s,u,d,p,v,m=function(e,n){var t,i=l(e),r=i.findIndex(function(e){return(0,a.Z)(e,1)[0]===n}),o=i.flatMap(function(e){var n=(0,a.Z)(e,2),t=(n[0],n[1]);return Object.keys(t).filter(function(e){return t[e].type===c.SlicesFieldType})}),s=r;do t="slices".concat(0!==s?s.toString():""),s++;while(o.includes(t));return t}(e,n);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,(0,o.Z)((0,r.Z)({},e.json[n]),(0,i.Z)({},m,{type:c.SlicesFieldType,fieldset:"Slice Zone"}))))})}function v(e,n){var t=d(e,n);if(void 0===t)return e;var a=Object.keys(t).find(function(e){return t[e].type===c.SlicesFieldType});if(void 0===a)return e;var u=(0,s.ud)(t,a);return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,u))})}function m(e){var n,t,a=e.customType,u=e.sectionId,l=e.sliceId,f=d(a,u);if(void 0===f)return a;var p=Object.keys(f).find(function(e){return f[e].type===c.SlicesFieldType});if(void 0===p)return a;var v=f[p];if(v.type!==c.SlicesFieldType)return a;var m=(0,s.ud)(null!==(t=null===(n=v.config)||void 0===n?void 0:n.choices)&&void 0!==t?t:{},l);return(0,o.Z)((0,r.Z)({},a),{json:(0,o.Z)((0,r.Z)({},a.json),(0,i.Z)({},u,(0,o.Z)((0,r.Z)({},f),(0,i.Z)({},p,(0,o.Z)((0,r.Z)({},v),{config:(0,o.Z)((0,r.Z)({},v.config),{choices:m})})))))})}function h(e){var n,t=(0,o.Z)((0,r.Z)({},e),{format:"page"}),i=l(e)[0];if(i){var c=(0,a.Z)(i,1)[0];t=p(t,c)}return t}function y(e,n){return(0,o.Z)((0,r.Z)({},e),{json:(0,o.Z)((0,r.Z)({},e.json),(0,i.Z)({},n,{}))})}function x(e,n){var t=(0,s.ud)(e.json,n);return(0,o.Z)((0,r.Z)({},e),{json:t})}function g(e,n,t){if(n===t)return e;var i=Object.keys(e.json).reduce(function(i,r){return r===n?i[t]=e.json[r]:i[r]=e.json[r],i},{});return(0,o.Z)((0,r.Z)({},e),{json:i})}function j(e){var n=e.customType,t=e.sectionId,s=e.newField,u=e.newFieldId,l=n.json[t],d=f(n,t),p=Object.fromEntries(Object.entries(l).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),v=(0,o.Z)((0,r.Z)({},p),(0,i.Z)({},u,s));if(void 0!==d){var m=(0,a.Z)(d,2),h=m[0],y=m[1];v[h]=y}return k({customType:n,sectionId:t,updatedSection:v})}function b(e){var n=e.customType,t=e.sectionId,i=e.fieldId,r=(0,s.ud)(n.json[t],i);return k({customType:n,sectionId:t,updatedSection:r})}function I(e){var n=e.customType,t=e.sectionId,i=e.previousFieldId,r=e.newFieldId,o=e.newField,a=F({fields:n.json[t],previousFieldId:i,newFieldId:r,newField:o});return k({customType:n,sectionId:t,updatedSection:a})}function Z(e){var n=e.customType,t=e.sectionId,i=e.sourceIndex,r=e.destinationIndex,o=n.json[t],s=f(n,t),u=Object.fromEntries(Object.entries(o).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==c.SlicesFieldType})),l=E({fields:u,sourceIndex:i,destinationIndex:r});if(void 0!==s){var d=(0,a.Z)(s,2),p=d[0],v=d[1];l[p]=v}return k({customType:n,sectionId:t,updatedSection:l})}function w(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.newField,u=e.newFieldId,l=A({customType:t,sectionId:a,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l)return t;var f=R(l,(0,o.Z)((0,r.Z)({},d),(0,i.Z)({},u,s)));return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,f))})}function S(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,u=e.fieldId,l=A({customType:t,sectionId:a,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,s.ud)(d,u),p=R(l,f);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,p))})}function T(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.previousFieldId,u=e.newFieldId,l=e.newField,d=A({customType:t,sectionId:a,groupFieldId:c}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var p=F({fields:f,previousFieldId:s,newFieldId:u,newField:l}),v=R(d,p);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,v))})}function C(e){var n,t=e.customType,a=e.sectionId,c=e.groupFieldId,s=e.sourceIndex,u=e.destinationIndex,l=A({customType:t,sectionId:a,groupFieldId:c}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=E({fields:d,sourceIndex:s,destinationIndex:u}),p=R(l,f);return k({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},c,p))})}function k(e){var n=e.customType,t=e.sectionId,a=e.updatedSection;return(0,o.Z)((0,r.Z)({},n),{json:(0,o.Z)((0,r.Z)({},n.json),(0,i.Z)({},t,a))})}function F(e){var n=e.fields,t=e.previousFieldId,i=e.newFieldId,r=e.newField;return Object.entries(n).reduce(function(e,n){var o=(0,a.Z)(n,2),c=o[0],s=o[1];return c===t?e[i]=r:c!==i&&(e[c]=s),e},{})}function E(e){var n=e.fields,t=e.sourceIndex,i=e.destinationIndex,r=Object.entries(n),o=(0,a.Z)(r.splice(t,1),1)[0];return r.splice(i,0,o),Object.fromEntries(r)}function A(e){var n=e.customType,t=e.sectionId,i=e.groupFieldId,r=n.json[t][i];if(r.type===c.GroupFieldType)return r}function R(e,n){return(0,o.Z)((0,r.Z)({},e),{config:(0,o.Z)((0,r.Z)({},e.config),{fields:n})})}function O(e){var n,t,i=e.id,o=e.label,a=e.repeatable,c=e.format,s=(n=a,t=c,!1===n&&"page"===t?(0,r.Z)({},N,V):!1===n?_:"page"===t?(0,r.Z)({},L,V):D);return{format:c,id:i,json:s,label:o,repeatable:a,status:!0}}var _={Main:{}},N={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},D={Main:{uid:{config:{label:"UID"},type:"UID"}}},L={Main:(0,r.Z)({},D.Main,N.Main)},V={"SEO & Metadata":{meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"},meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"}}}},25998:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var i=t(5632),r=t(56580),o=t(95200),a=function(e,n,t){var i,r=null===(i=(0,o.Sd)(e))||void 0===i?void 0:i.find(function(e){return e.name.replace(/\//g,"--")===n});return null==r?void 0:r.components.find(function(e){return e.model.name===t})},c=function(){var e=(0,i.useRouter)(),n=(0,r.v9)(function(n){return{slice:a(n,e.query.lib,e.query.sliceName)}}).slice;if(!n)return{};var t=n.model.variations.find(function(n){return n.id===e.query.variation});return t?{slice:n,variation:t}:{}}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return j}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function c(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function s(e,n){return void 0===n&&(n=","),e.split(n)}function u(e,n,t){void 0===n&&(n="+");var i,a=e.toLocaleLowerCase().split(n).map(function(e){return c(e)});return r({},{alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod")},{keys:a.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([c(e.key),c(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&p([c(e.key),c(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){l.clear()});var l=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];l.has("meta")&&l.forEach(function(e){var n;return!o.includes(e)&&l.delete(e.toLowerCase())}),n.forEach(function(e){return l.add(e.toLowerCase())})}function p(e){var n=Array.isArray(e)?e:[e];"meta"===e?l.clear():n.forEach(function(e){return l.delete(e.toLowerCase())})}function v(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,s=n.mod,u=n.shift,f=n.ctrl,p=n.keys,v=e.key,m=e.code,h=e.ctrlKey,y=e.metaKey,x=e.shiftKey,g=e.altKey,j=c(m),b=v.toLowerCase();if(!t){if(!g===o&&"alt"!==b||!x===u&&"shift"!==b)return!1;if(s){if(!y&&!h)return!1}else if(!y===a&&"meta"!==b&&"os"!==b||!h===f&&"ctrl"!==b&&"control"!==b)return!1}return!!(p&&1===p.length&&(p.includes(b)||p.includes(j)))||(p?(void 0===r&&(r=","),(d(i=p)?i:i.split(r)).every(function(e){return l.has(e.trim().toLowerCase())})):!p)},h=(0,i.createContext)(void 0),y=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),x=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},g="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function j(e,n,t,r){var o,a,l=(0,i.useRef)(null),j=(0,i.useRef)(!1),b=t instanceof Array?r instanceof Array?void 0:r:t,I=d(e)?e.join(null==b?void 0:b.splitKey):e,Z=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=Z?Z:[]),S=(0,i.useRef)(w);Z?S.current=w:S.current=n;var T=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((a=(0,i.useRef)(void 0)).current,b)&&(a.current=b),a.current),C=(0,i.useContext)(y).enabledScopes,k=(0,i.useContext)(h);return g(function(){if((null==T?void 0:T.enabled)!==!1&&(e=C,n=null==T?void 0:T.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(v(e,["input","textarea","select"])&&!v(e,null==T?void 0:T.enableOnFormTags)||null!=T&&null!=T.ignoreEventWhen&&T.ignoreEventWhen(e))){if(null!==l.current&&document.activeElement!==l.current&&!l.current.contains(document.activeElement)){x(e);return}(null==(t=e.target)||!t.isContentEditable||null!=T&&T.enableOnContentEditable)&&s(I,null==T?void 0:T.splitKey).forEach(function(t){var i,r,o,a,c,s,l,d=u(t,null==T?void 0:T.combinationKey);if(m(e,d,null==T?void 0:T.ignoreModifiers)||null!=(l=d.keys)&&l.includes("*")){if(n&&j.current)return;if(i=e,r=d,("function"==typeof(o=null==T?void 0:T.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,c=d,"function"==typeof(s=null==T?void 0:T.enabled)?!s(a,c):!0!==s&&void 0!==s){x(e);return}S.current(e,d),n||(j.current=!0)}})}},i=function(e){void 0!==e.key&&(f(c(e.code)),((null==T?void 0:T.keydown)===void 0&&(null==T?void 0:T.keyup)!==!0||null!=T&&T.keydown)&&t(e))},r=function(e){void 0!==e.key&&(p(c(e.code)),j.current=!1,null!=T&&T.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),k&&s(I,null==T?void 0:T.splitKey).forEach(function(e){return k.addHotkey(u(e,null==T?void 0:T.combinationKey,null==T?void 0:T.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),k&&s(I,null==T?void 0:T.splitKey).forEach(function(e){return k.removeHotkey(u(e,null==T?void 0:T.combinationKey,null==T?void 0:T.description))})}}},[I,T,C]),l}}},function(e){e.O(0,[898,789,917,525,461,139,183,50,543,696,25,318,286,774,888,179],function(){return e(e.s=31314)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var i=t(34311),r=t(23779),o=i(function(e,n,t){return e+(t?" ":"")+r(n)});e.exports=o},26688:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return t(72085)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),s=t(2784),a=t(75289),c=function(e,n){return e?"".concat(e,"-").concat(n):""},u=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},d=(0,s.forwardRef)(function(e,n){var t=e.label,s=e.Icon,d=e.type,f=e.form,m=e.isLoading,p=void 0!==m&&m,h=e.disabled,x=e.onClick,v=e.sx,y=e.iconSize,b=void 0===y?16:y,g=e.iconFill,j=e.variant,S=void 0===j?"primary":j,C=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,l.jsx)(a.zx,(0,r.Z)((0,i.Z)({ref:n,sx:(0,i.Z)((0,r.Z)((0,i.Z)({},void 0===v?{}:v),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),p?{cursor:"wait !important"}:{}),type:d,form:f,disabled:void 0!==h&&h||p,onClick:p?void 0:x,variant:S},C),{children:p?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(a.$j,{size:b,color:u(S),"data-testid":c(C["data-testid"],"spinner")}),s&&t]}):(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(s,{size:b,fill:g,"data-testid":c(C["data-testid"],"icon")}),t]})}))})},45466:function(e,n,t){"use strict";t.d(n,{c:function(){return S}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),s=t(52322),a=t(75289),c=t(2784),u=t(36131),d=t(68780),f=t(88932),m=t(38876),p=t(81038),h=t(82770),x=t(5479);function v(){return(v=(0,i.Z)(function(e){var n,t,i,r,o,s,a;return(0,l.__generator)(this,function(l){switch(l.label){case 0:n=e.sliceName,t=e.libraryName,i=e.onSuccess,l.label=1;case 1:return l.trys.push([1,4,,5]),r=(0,x.fo)(n),[4,p.j.slices.createSlice({libraryID:t,model:r})];case 2:if((o=l.sent().errors).length>0)throw o;return h.Xe.track({event:"slice:created",id:(0,m.MP)(n),name:n,library:t}),[4,i(r)];case 3:return l.sent(),[3,5];case 4:return s=l.sent(),a="An unexpected error happened while creating slice ".concat(n,"."),console.error(a,s),f.Am.error(a),[3,5];case 5:return[2]}})})).apply(this,arguments)}var y=t(90374),b=t(50950),g=t(66443),j=t(70041),S=function(e){var n,t=e.onClose,f=e.onSuccess,m=e.localLibraries,p=e.remoteSlices,x=(0,y.Z)().createSliceSuccess,S=(0,c.useState)(!1),C=S[0],w=S[1],k=(0,b.g)().syncChanges,I=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,w(!0),[4,function(e){return v.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,h.y0)()];case 1:return x(n.sent().libraries),f(e,t),k(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,s.jsx)(d.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:C,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){I(e)},initialValues:{sliceName:"",from:m[0].name},validate:function(e){return(0,g.h)(e,m,p)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,s.jsxs)(a.xu,{children:[(0,s.jsx)(j.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,testId:"slice-name-input"}),(0,s.jsx)(a.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,s.jsx)(u.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return s}});var i=t(62230),r=t(52322);t(2784);var o=t(63397),l=t(75289),s=function(e){var n=e.name,t=e.label,s=e.placeholder,a=e.error,c=e.testId,u=e.onChange;return(0,r.jsxs)(l.xu,{mb:3,children:[(0,r.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,r.jsx)(o.gN,(0,i.Z)({name:n,type:"text",placeholder:s,as:l.II,autoComplete:"off"},u?{onChange:u}:null,c?{"data-testid":c}:null)),a?(0,r.jsx)(l.xv,{"data-testid":c?"".concat(c,"-error"):"input-error",sx:{color:"error",mt:1},children:a}):null]})}},66443:function(e,n,t){"use strict";t.d(n,{h:function(){return c}});var i=t(81541),r=t(75329),o=t(96009),l=t.n(o),s=t(74600),a=t.n(s);function c(e,n,t){var o=e.sliceName;if(!o)return{sliceName:"Cannot be empty"};if(!r.xo.exec(o))return{sliceName:"No special characters allowed"};if(a()(l()(o)).replace(/\s/gm,"")!==o.trim())return{sliceName:"Value has to be PascalCased"};if(o.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(r.lS.includes(o))return{sliceName:"".concat(o," is reserved for Slice Machine use")};var s=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),c=t.map(function(e){return e.name});if((0,i.Z)(s).concat((0,i.Z)(c)).includes(o))return{sliceName:"Slice name is already taken."}}},59469:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,s=e.gridTemplateMinPx,a=e.gridGap,c=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===s?"320px":s,", 1fr))"),gridGap:void 0===a?"16px":a,pt:2},c),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},68780:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(52322),l=t(37149),s=t.n(l),a=t(25812),c=t(63397),u=t(75289),d=t(56577),f=t(54132);n.Z=function(e){var n=e.children,t=e.close,l=e.isOpen,m=e.formId,p=e.validate,h=e.onSubmit,x=e.widthInPx,v=e.initialValues,y=e.content.title,b=e.cardProps,g=e.omitFooter,j=void 0!==g&&g,S=e.isLoading,C=void 0!==S&&S,w=e.buttonLabel,k=void 0===w?"Save":w,I=e.testId,N=e.actionMessage;return s().setAppElement("#__next"),(0,o.jsx)(a.Z,{isOpen:l,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:y,style:{content:{width:null!=x?x:"900px"}},children:(0,o.jsx)(c.J9,{initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){h(e)},children:function(e){var l=e.isValid,s=e.isSubmitting,a=e.values,p=e.errors,h=e.touched,x=e.setFieldValue,v=e.setValues;return(0,o.jsx)(c.l0,(0,r.Z)((0,i.Z)({id:m},null!=I?{"data-testid":I}:null),{children:(0,o.jsx)(f.Z,(0,r.Z)((0,i.Z)({borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"}},b),{Header:function(e){var n=e.radius;return(0,o.jsxs)(u.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,o.jsx)(u.X6,{sx:{fontSize:"20px"},children:y}),(0,o.jsx)(u.x8,{type:"button",onClick:t})]})},Footer:j?null:(0,o.jsxs)(u.kC,{sx:{alignItems:"space-between"},children:[(0,o.jsx)(u.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof N?N(e):N}),(0,o.jsxs)(u.kC,{sx:{ml:"auto"},children:[(0,o.jsx)(u.zx,{mr:2,type:"button",onClick:t,variant:"secondary",disabled:s||C,children:"Cancel"}),(0,o.jsx)(d.z,{label:k,form:m,type:"submit",disabled:!l||s||C,isLoading:s||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:l,isSubmitting:s,values:a,errors:p,touched:h,setFieldValue:x,setValues:v})}))}))}})})}},72085:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return G}});var i=t(81541),r=t(52322),o=t(22715),l=t(2784),s=t(97729),a=t.n(s),c=t(65077),u=t(75289),d=t(56580),f=t(5632),m=t(88932),p=t(75329),h=t(53220),x=t(45466),v=t(59469),y=t(62230),b=t(85244),g=t(98240),j=t(36887),S=t(82770),C=function(e){var n=e.title,t=e.onCreateNew,i=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl,s=(0,g.Z)(e,["title","onCreateNew","buttonText","documentationComponent","videoPublicIdUrl"]);return(0,r.jsxs)(u.xu,(0,b.Z)((0,y.Z)({sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"}},s),{children:[(0,r.jsx)(u.xu,{sx:function(e){var n;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:(0,r.jsx)(j.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){S.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,r.jsxs)(u.xu,{sx:function(e){var n;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,r.jsxs)(u.xu,{sx:function(e){var n;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.grey02)}},children:[(0,r.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,r.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,r.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,r.jsx)(u.zx,{onClick:t,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:i}),(0,r.jsx)(u.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]}))},w=t(15836),k=t(22710),I=t(99267),N=t(90374),Z=t(95200),L=t(81038),E=t(5479),_=t(53559);function P(){return(P=(0,k.Z)(function(e){var n,t,i,r,o,l,s;return(0,I.__generator)(this,function(a){switch(a.label){case 0:n=e.slice,t=e.newSliceName,i=e.onSuccess,a.label=1;case 1:return a.trys.push([1,3,,4]),r=(0,E.PQ)(n,t),[4,L.j.slices.renameSlice({libraryID:n.from,model:_.id.fromSM(r.model)})];case 2:if((o=a.sent().errors).length>0)throw o;return i(r),m.Am.success("Slice name updated"),[3,4];case 3:return l=a.sent(),s="An unexpected error happened while renaming “".concat(n.model.name,"”."),console.error(s,l),m.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var A=t(50950),O=t(70041),R=t(68780),z=t(66443),F=function(e){var n,t,i,o=e.slice,l=e.isOpen,s=e.onClose,a=(0,N.Z)().renameSliceSuccess,c=(0,A.g)().syncChanges,f=(0,d.v9)(function(e){return{localLibs:(0,Z.Sd)(e),remoteLibs:(0,Z.sT)(e)}}),m=f.localLibs,p=f.remoteLibs,h=null!==(n=null==o?void 0:o.model.name)&&void 0!==n?n:"",x=(i=(0,k.Z)(function(e){return(0,I.__generator)(this,function(n){switch(n.label){case 0:if(!o)return[3,2];return[4,function(e){return P.apply(this,arguments)}({slice:o,newSliceName:e.sliceName,onSuccess:function(e){a(e.from,e.model),c()}})];case 1:n.sent(),s(),n.label=2;case 2:return[2]}})}),function(e){return i.apply(this,arguments)});return(0,r.jsx)(R.Z,{testId:"rename-slice-modal",isOpen:l,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(t=null==o?void 0:o.model.id)&&void 0!==t?t:""),close:s,buttonLabel:"Rename",onSubmit:function(e){x(e)},initialValues:{sliceName:h},content:{title:"Rename a slice"},validate:function(e){return(0,z.h)(e,m,p)},children:function(e){var n=e.touched,t=e.errors;return(0,r.jsx)(u.xu,{children:(0,r.jsx)(O.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,testId:"slice-name-input"})})}})},D=t(65186),W=t(59326),T=t(25812),V=t(54132),K=t(56577);function B(){return(B=(0,k.Z)(function(e){var n,t,i,r,o,l,s;return(0,I.__generator)(this,function(a){switch(a.label){case 0:n=e.sliceName,t=e.sliceID,i=e.libraryID,r=e.onSuccess,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,L.j.slices.deleteSlice({libraryID:i,sliceID:t})];case 2:if((o=a.sent().errors).length>0)throw o;return r(),m.Am.success("Successfully deleted slice “".concat(n,"”")),[3,4];case 3:return l=a.sent(),s="An unexpected error happened while deleting slice “".concat(n,"”."),console.error(s,l),m.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var M=function(e){var n,t=e.sliceId,i=e.sliceName,o=e.libName,s=e.isOpen,a=e.onClose,c=(0,l.useState)(!1),d=c[0],f=c[1],m=(0,N.Z)().deleteSliceSuccess,p=(0,A.g)().syncChanges,h=(0,W.B7)().theme,x=(n=(0,k.Z)(function(){return(0,I.__generator)(this,function(e){switch(e.label){case 0:return f(!0),[4,function(e){return B.apply(this,arguments)}({sliceID:t,sliceName:i,libraryID:o,onSuccess:function(){m(t,o),p()}})];case 1:return e.sent(),a(),f(!1),[2]}})}),function(){return n.apply(this,arguments)});return(0,r.jsx)(T.Z,{isOpen:s,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:a,children:(0,r.jsx)(V.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:function(){var e;return(0,r.jsxs)(u.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(D.$vK,{size:20,color:null===(e=h.colors)||void 0===e?void 0:e.greyIcon}),(0,r.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,r.jsx)(u.x8,{type:"button",onClick:a})]})},Footer:function(){return(0,r.jsxs)(u.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,r.jsx)(K.z,{label:"Cancel",variant:"secondary",onClick:a,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,r.jsx)(K.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:function(){x()}})]})},children:(0,r.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[o,"/",i,"/"]})," ","directory."]}),(0,r.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})},H=t(47731),X=t(71749),U=t(49451),q=t(13858),G=function(){var e,n,t,s=(0,f.useRouter)(),y=(0,H.H)(),b=y.modalPayload,g=y.onOpenModal,j=b.sliceFilterFn,S=b.defaultVariationSelector,k=(0,d.v9)(function(e){return{remoteSlices:(0,Z.sT)(e),libraries:(0,Z.Sd)(e)}}),I=k.remoteSlices,N=k.libraries,L=(0,l.useState)(!1),E=L[0],_=L[1],P=(0,l.useState)(!1),A=P[0],O=P[1],R=(0,l.useState)(!1),z=R[0],D=R[1],W=N.filter(function(e){return e.isLocal}),T=N.map(function(e){return e.components=(0,i.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),V=(N||[]).map(function(e){return e.components}).flat(),K=V.length,B=(0,l.useState)(),G=B[0],Q=B[1],Y=function(){O(!0)},$=function(){D(!0)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(),{children:(0,r.jsx)("title",{children:"Slices - Slice Machine"})}),(0,r.jsxs)(h.LN,{children:[(0,r.jsxs)(h.wd,{children:[(0,r.jsx)(h.Cx,{folder:"Slices"}),(null==W?void 0:W.length)!==0&&0!==K?(0,r.jsx)(h.K2,{children:(0,r.jsx)(o.zx,{"data-testid":"create-slice",onClick:function(){_(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,r.jsxs)(h.RN,{children:[(0,r.jsx)(c.xR,{sx:{display:"flex",flexDirection:"column"},children:T.length>0?(0,r.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===K?(0,r.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(C,{title:"What are Slices?",onCreateNew:function(){_(!0)},buttonText:"Create one",videoPublicIdUrl:p.rd,documentationComponent:(0,r.jsxs)(r.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange Slices to compose dynamic layouts for any page design.'," ",(0,r.jsx)(u.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:function(e){var n;return{color:null==e?void 0:null===(n=e.colors)||void 0===n?void 0:n.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):T.map(function(e){var n=e.name,t=e.isLocal,i=e.components;return(0,r.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,r.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,r.jsx)(u.xv,{children:n})}),!t&&(0,r.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,r.jsx)(v.Z,{elems:i,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,r.jsx)(X.b,{action:{type:"menu",onRemove:function(){Q(e),Y()},onRename:function(){Q(e),$()}},mode:"navigation",onUpdateScreenshot:function(){g({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})},gridGap:"32px 16px"})]},n)})}):void 0}),(null==W?void 0:W.length)>0&&(0,r.jsx)(w.Z,{slices:j(V),defaultVariationSelector:S}),(null==W?void 0:W.length)>0&&E&&(0,r.jsx)(x.c,{localLibraries:W,remoteSlices:I,onSuccess:function(e,n){var t=e.variations[0].id,i=U.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});s.push(i),m.Am.success((0,q.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){_(!1)}}),(0,r.jsx)(F,{isOpen:z,slice:G,onClose:function(){D(!1)},"data-testid":"rename-slice-modal"}),(0,r.jsx)(M,{isOpen:A,libName:null!==(e=null==G?void 0:G.from)&&void 0!==e?e:"",sliceId:null!==(n=null==G?void 0:G.model.id)&&void 0!==n?n:"",sliceName:null!==(t=null==G?void 0:G.model.name)&&void 0!==t?t:"",onClose:function(){O(!1)}})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var i=t(2784);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}t(52322);var o=["shift","alt","meta","mod","ctrl"],l={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function s(e){return(l[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function a(e,n){return void 0===n&&(n=","),e.split(n)}function c(e,n,t){void 0===n&&(n="+");var i,l=e.toLocaleLowerCase().split(n).map(function(e){return s(e)});return r({},{alt:l.includes("alt"),ctrl:l.includes("ctrl")||l.includes("control"),shift:l.includes("shift"),meta:l.includes("meta"),mod:l.includes("mod")},{keys:l.filter(function(e){return!o.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&f([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([s(e.key),s(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){var n;return!o.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function m(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var i=t&&t.tagName;return d(n)?Boolean(i&&n&&n.some(function(e){return e.toLowerCase()===i.toLowerCase()})):Boolean(i&&n&&!0===n)}var h=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,l=n.meta,a=n.mod,c=n.shift,f=n.ctrl,m=n.keys,p=e.key,h=e.code,x=e.ctrlKey,v=e.metaKey,y=e.shiftKey,b=e.altKey,g=s(h),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===c&&"shift"!==j)return!1;if(a){if(!v&&!x)return!1}else if(!v===l&&"meta"!==j&&"os"!==j||!x===f&&"ctrl"!==j&&"control"!==j)return!1}return!!(m&&1===m.length&&(m.includes(j)||m.includes(g)))||(m?(void 0===r&&(r=","),(d(i=m)?i:i.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},x=(0,i.createContext)(void 0),v=(0,i.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;function g(e,n,t,r){var o,l,u=(0,i.useRef)(null),g=(0,i.useRef)(!1),j=t instanceof Array?r instanceof Array?void 0:r:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=C?C:[]),k=(0,i.useRef)(w);C?k.current=w:k.current=n;var I=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(i,r){return i&&e(n[r],t[r])},!0):n===t}((l=(0,i.useRef)(void 0)).current,j)&&(l.current=j),l.current),N=(0,i.useContext)(v).enabledScopes,Z=(0,i.useContext)(x);return b(function(){if((null==I?void 0:I.enabled)!==!1&&(e=N,n=null==I?void 0:I.scopes,0===e.length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!n||e.some(function(e){return n.includes(e)})||e.includes("*")))){var e,n,t=function(e,n){var t,i;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==I?void 0:I.enableOnFormTags)||null!=I&&null!=I.ignoreEventWhen&&I.ignoreEventWhen(e))){if(null!==u.current&&document.activeElement!==u.current&&!u.current.contains(document.activeElement)){y(e);return}(null==(t=e.target)||!t.isContentEditable||null!=I&&I.enableOnContentEditable)&&a(S,null==I?void 0:I.splitKey).forEach(function(t){var i,r,o,l,s,a,u,d=c(t,null==I?void 0:I.combinationKey);if(h(e,d,null==I?void 0:I.ignoreModifiers)||null!=(u=d.keys)&&u.includes("*")){if(n&&g.current)return;if(i=e,r=d,("function"==typeof(o=null==I?void 0:I.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),l=e,s=d,"function"==typeof(a=null==I?void 0:I.enabled)?!a(l,s):!0!==a&&void 0!==a){y(e);return}k.current(e,d),n||(g.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==I?void 0:I.keydown)===void 0&&(null==I?void 0:I.keyup)!==!0||null!=I&&I.keydown)&&t(e))},r=function(e){void 0!==e.key&&(m(s(e.code)),g.current=!1,null!=I&&I.keyup&&t(e,!0))},o=u.current||(null==j?void 0:j.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),Z&&a(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.addHotkey(c(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),Z&&a(S,null==I?void 0:I.splitKey).forEach(function(e){return Z.removeHotkey(c(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))})}}},[S,I,N]),u}}},function(e){e.O(0,[898,789,50,25,286,774,888,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
@@ -1,5 +0,0 @@
1
- import { style } from "@vanilla-extract/css";
2
-
3
- export const pageSpan = style({
4
- fontWeight: "500",
5
- });
@@ -1,32 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
-
3
- import { Breadcrumb } from "./Breadcrumb";
4
-
5
- type Story = StoryObj<typeof meta>;
6
-
7
- const meta = {
8
- component: Breadcrumb,
9
- } satisfies Meta<typeof Breadcrumb>;
10
-
11
- export default meta;
12
-
13
- export const Default = {
14
- args: {
15
- folder: "folder",
16
- page: "page",
17
- },
18
- } satisfies Story;
19
-
20
- export const FolderOnly = {
21
- args: {
22
- folder: "folder",
23
- },
24
- } satisfies Story;
25
-
26
- export const CustomSeparator = {
27
- args: {
28
- folder: "folder",
29
- page: "page",
30
- separator: ">",
31
- },
32
- } satisfies Story;