slice-machine-ui 1.23.2-beta.8 → 1.24.0

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 (132) hide show
  1. package/.depcheckrc +3 -0
  2. package/components/ChangesEmptyState/OfflinePage.tsx +1 -1
  3. package/components/ChangesItems/ChangesItems.tsx +6 -2
  4. package/components/CustomTypeTable/changesPage.tsx +12 -7
  5. package/components/DeleteSliceModal/index.tsx +3 -0
  6. package/components/DeleteVariationModal/index.tsx +1 -0
  7. package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +4 -0
  8. package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -1
  9. package/components/Forms/RenameCustomTypeModal/RenameCustomTypeModal.tsx +6 -1
  10. package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +3 -0
  11. package/components/Forms/RenameVariationModal/RenameVariationModal.tsx +0 -1
  12. package/components/LoginModal/index.tsx +40 -2
  13. package/components/ModalFormCard/index.tsx +0 -1
  14. package/components/Navigation/ChangesItem.tsx +117 -0
  15. package/components/Navigation/Environment.tsx +51 -4
  16. package/components/Navigation/index.css.ts +1 -2
  17. package/components/Navigation/index.test.tsx +5 -85
  18. package/components/Navigation/index.tsx +32 -20
  19. package/components/ReviewModal/ReviewForm.tsx +0 -1
  20. package/lib/builders/SliceBuilder/index.tsx +3 -3
  21. package/lib/builders/common/EditModal/Form.jsx +0 -1
  22. package/lib/builders/common/Zone/Card/components/NewField.tsx +0 -1
  23. package/lib/models/common/ModelStatus/index.ts +25 -0
  24. package/out/404.html +1 -1
  25. package/out/_next/static/chunks/18539003-5f78714a35fde4a1.js +97 -0
  26. package/out/_next/static/chunks/25-3aa4d4b24167d340.js +1 -0
  27. package/out/_next/static/chunks/318-19dbcae10cdb6408.js +1 -0
  28. package/out/_next/static/chunks/727-de03055e40815a3a.js +1 -0
  29. package/out/_next/static/chunks/777-8c5507e3b119b5dc.js +8 -0
  30. package/out/_next/static/chunks/799-0af1215eb2b3c17e.js +1 -0
  31. package/out/_next/static/chunks/904-40686b0426716111.js +1 -0
  32. package/out/_next/static/chunks/pages/_app-bca191df4ac7078e.js +434 -0
  33. package/out/_next/static/chunks/pages/{changelog-afd18276fe018b24.js → changelog-cb1df3a70b20f1b8.js} +1 -1
  34. package/out/_next/static/chunks/pages/changes-ccfd715c2bdc4f83.js +1 -0
  35. package/out/_next/static/chunks/pages/{labs-ee206005948f8e87.js → labs-2adfb5127f9c4081.js} +1 -1
  36. package/out/_next/static/chunks/pages/settings-94bcd7422e8b237d.js +1 -0
  37. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-52c3e1f9d14160b8.js → simulator-aaf65fbec8f5839c.js} +1 -1
  38. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-90bb2ea76d2abf42.js +1 -0
  39. package/out/_next/static/chunks/pages/slices-e0ce615c38e8338d.js +1 -0
  40. package/out/_next/static/css/39e089aad1742a3a.css +1 -0
  41. package/out/_next/static/css/{37153180c3b0dd66.css → 838fd8bb5a7c32b0.css} +1 -1
  42. package/out/_next/static/css/ca32882a5d2d8d88.css +1 -0
  43. package/out/_next/static/eNujlD43QIdmra7ggcNtK/_buildManifest.js +1 -0
  44. package/out/changelog.html +1 -1
  45. package/out/changes.html +1 -1
  46. package/out/custom-types/[customTypeId].html +1 -1
  47. package/out/custom-types.html +1 -1
  48. package/out/index.html +1 -1
  49. package/out/labs.html +1 -1
  50. package/out/page-types/[pageTypeId].html +1 -1
  51. package/out/settings.html +1 -0
  52. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  53. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  54. package/out/slices.html +1 -1
  55. package/package.json +10 -8
  56. package/pages/_app.tsx +34 -32
  57. package/pages/changes.tsx +27 -41
  58. package/pages/settings.tsx +1 -0
  59. package/postcss.config.js +10 -0
  60. package/src/components/FieldSet/FieldSet.stories.tsx +20 -11
  61. package/src/components/RelativeTime/RelativeTime.stories.tsx +25 -0
  62. package/src/components/RelativeTime/RelativeTime.tsx +40 -0
  63. package/src/components/RelativeTime/index.ts +1 -0
  64. package/src/components/SideNav/SideNav.css.ts +1 -1
  65. package/src/components/SideNav/SideNav.tsx +9 -5
  66. package/src/components/SideNav/SideNavEnvironmentSelector.tsx +31 -11
  67. package/src/domain/__tests__/customType.test.ts +26 -19
  68. package/src/domain/customType.ts +22 -5
  69. package/src/features/autoSave/AutoSaveStatusIndicator.tsx +4 -4
  70. package/src/features/customTypes/customTypesBuilder/CustomTypeProvider.tsx +11 -10
  71. package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -3
  72. package/src/features/environments/actions/setEnvironment.ts +4 -4
  73. package/src/features/settings/SettingsPage.tsx +47 -0
  74. package/src/features/settings/git/ConnectGitRepository.tsx +126 -0
  75. package/src/features/settings/git/ConnectGitRepositoryBlankSlate.tsx +33 -0
  76. package/src/features/settings/git/GitOwnerSelect.tsx +71 -0
  77. package/src/features/settings/git/GitProvider.ts +40 -0
  78. package/src/features/settings/git/GitProviderConnectButtons.tsx +63 -0
  79. package/src/features/settings/git/GitRepositoriesList.tsx +76 -0
  80. package/src/features/settings/git/GitRepositoriesSearch.tsx +69 -0
  81. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +85 -0
  82. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +60 -0
  83. package/src/features/settings/git/useGitIntegrationExperiment.ts +8 -0
  84. package/src/features/settings/git/useGitOwners.ts +12 -0
  85. package/src/features/settings/git/useGitRepos.ts +24 -0
  86. package/src/features/settings/git/useLinkedGitRepos.ts +41 -0
  87. package/src/features/settings/git/useWriteAPIToken.ts +23 -0
  88. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +0 -1
  89. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +0 -1
  90. package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +0 -1
  91. package/src/features/slices/sliceBuilder/SliceBuilderProvider.tsx +12 -10
  92. package/src/features/sync/AutoSyncProvider.tsx +252 -0
  93. package/src/features/sync/components/AutoSyncStatusIndicator.module.css +17 -0
  94. package/src/features/sync/components/AutoSyncStatusIndicator.module.css.d.ts +5 -0
  95. package/src/features/sync/components/AutoSyncStatusIndicator.tsx +58 -0
  96. package/src/features/sync/fetchUnSyncChanges.ts +40 -0
  97. package/src/features/sync/getUnSyncChanges.ts +144 -0
  98. package/src/features/sync/useUnSyncChanges.ts +32 -0
  99. package/src/hooks/useActionQueue.tsx +177 -0
  100. package/src/hooks/useAuthStatus.ts +12 -0
  101. package/src/hooks/useUser.ts +14 -0
  102. package/src/icons/SettingsIcon.tsx +19 -0
  103. package/src/icons/SyncFailed.tsx +30 -0
  104. package/src/icons/Synced.tsx +19 -0
  105. package/src/icons/Syncing.tsx +23 -0
  106. package/test/__testutils__/index.tsx +8 -5
  107. package/test/src/modules/__fixtures__/serverState.ts +1 -2
  108. package/components/Navigation/ChangesListItem.tsx +0 -74
  109. package/components/Navigation/ChangesRightElement.tsx +0 -33
  110. package/out/_next/static/chunks/18539003-5cc559566b738915.js +0 -97
  111. package/out/_next/static/chunks/25-01f422cea8066349.js +0 -1
  112. package/out/_next/static/chunks/318-387e3f23d717c53d.js +0 -1
  113. package/out/_next/static/chunks/376-7e784d6069e01654.js +0 -8
  114. package/out/_next/static/chunks/727-358d7fae68a880b3.js +0 -1
  115. package/out/_next/static/chunks/799-d95a93e965557aeb.js +0 -1
  116. package/out/_next/static/chunks/904-1ff7519adece2b55.js +0 -1
  117. package/out/_next/static/chunks/pages/_app-e31adcf75e9176d3.js +0 -432
  118. package/out/_next/static/chunks/pages/changes-92c84f6cac0285fd.js +0 -1
  119. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-608d206d10a719e3.js +0 -1
  120. package/out/_next/static/chunks/pages/slices-b0b58192a87df822.js +0 -1
  121. package/out/_next/static/css/200244e3e0463c39.css +0 -1
  122. package/out/_next/static/vxOhh_oqUIQ5PTSKUKgMR/_buildManifest.js +0 -1
  123. package/src/features/autoSave/useAutoSave.tsx +0 -177
  124. package/src/features/legacyState/actions/getLegacySliceMachineState.ts +0 -53
  125. package/src/features/legacyState/useLegacySliceMachineState.ts +0 -7
  126. package/src/hooks/useModelStatus.ts +0 -78
  127. package/src/hooks/useUnSyncChanges.ts +0 -88
  128. package/test/components/LoginModal.test.tsx +0 -67
  129. package/test/src/hooks/useModelStatus.test.ts +0 -115
  130. /package/out/_next/static/{vxOhh_oqUIQ5PTSKUKgMR → eNujlD43QIdmra7ggcNtK}/_ssgManifest.js +0 -0
  131. /package/src/features/{changes → sync}/actions/pushChanges.ts +0 -0
  132. /package/src/features/{changes → sync}/actions/trackPushChangesSuccess.ts +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(57825)}])},39576:function(e,n,r){"use strict";r.d(n,{Z:function(){return d}});var i=r(62230),s=r(52322);r(2784);var t=r(59326),a=r(75289),o=r(61183),c=function(e){return{subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"},]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10},]},]}};o.Z.registerLanguage("svelte",c);var l=["javascript","bash","xml","html","json"],d=function(e){var n,r=e.children,c=e.lang,d=e.sx,g=e.codeStyle,x=e.codeClass,p=e.Header,u=(0,t.B7)().theme,h=c?o.Z.highlight(r,{language:"vue"===c?"html":c}).value:o.Z.highlightAuto(r,l).value;return(0,s.jsxs)(a.kC,{as:"pre",sx:d,children:[p?(0,s.jsx)(p,{}):null,(0,s.jsx)("code",{className:"hljs".concat(x?" ".concat(x):""),style:(0,i.Z)({overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=u.colors)||void 0===n?void 0:n.textClear)},g),dangerouslySetInnerHTML:{__html:h}})]})}},57825:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return H}});var i,s,t=r(52322),a=r(97729),o=r.n(a),c=r(22715),l=r(65077),d=r(75289),g=r(56580),x=r(39092),p=r(2784),u=r(62230),h=r(12170),v=function(e){var n=e.type,r=e.hasUpToDateVersions;return(0,t.jsx)(d.xv,{sx:(0,u.Z)({padding:"0px 4px",borderRadius:"2px",fontSize:"8px",fontWeight:600,lineHeight:"16px",textTransform:"uppercase"},(n===i.Latest||n===i.LatestNonBreaking)&&{bg:"grey02",color:"code.gray"},n===i.Current&&r&&{bg:"lightGreen",color:"code.green"},n===i.Current&&!r&&{bg:"lightOrange",color:"code.orange"}),children:n})},f=function(e){var n=e.isSelected,r=e.onClick,i=e.versionNumber,s=e.tags,a=e.hasUpToDateVersions;return(0,t.jsxs)(d.kC,{sx:(0,u.Z)({p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center"},n?{color:"purple",bg:(0,h.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}),onClick:r,children:[(0,t.jsx)(d.xv,{children:i}),(0,t.jsx)(d.kC,{sx:{gap:"8px"},children:s.map(function(e){return(0,t.jsx)(v,{type:e,hasUpToDateVersions:a},e)})})]})};(s=i||(i={})).Latest="LATEST",s.LatestNonBreaking="LATEST-NON-BREAKING",s.Current="CURRENT";var m=function(e){var n,r=e.changelog,s=e.selectedVersion,a=e.selectVersion,o=function(e){var n=[];return e===l?n.push(i.Latest):e===r.sliceMachine.latestNonBreakingVersion&&n.push(i.LatestNonBreaking),e===r.sliceMachine.currentVersion&&n.push(i.Current),n},l=null===(n=r.sliceMachine.versions[0])||void 0===n?void 0:n.versionNumber,g=!r.adapter.updateAvailable&&!r.sliceMachine.updateAvailable;return(0,t.jsxs)(d.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:c.TV.color.greyLight6,flexDirection:"column",paddingRight:"48px"},children:[(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,paddingBottom:"28px"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,t.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,t.jsx)(d.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:r.sliceMachine.versions.map(function(e,n){return(0,t.jsx)(f,{isSelected:(null==s?void 0:s.versionNumber)===e.versionNumber,onClick:function(){return a(e)},versionNumber:e.versionNumber,tags:o(e.versionNumber),hasUpToDateVersions:g},"versionBadge-".concat(e.versionNumber,"-").concat(n))})})]})},b={MAJOR:"MAJOR",MINOR:"MINOR",PATCH:"PATCH",FIRST:"FIRST"},j=function(e){var n=e.versionKind,r=(0,u.Z)({fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase"},n===b.MAJOR?{color:"purple",bg:(0,h.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"});return(0,t.jsx)(d.xv,{sx:r,children:n})},k=r(19870),C=function(e){var n=e.releaseNote;return(0,t.jsx)(d.xv,{sx:{"h1, h2, h3":{fontSize:"16px",fontWeight:600,lineHeight:"20px"},p:{fontSize:"14px",fontWeight:400,lineHeight:"20px"},b:{fontSize:"14px",fontWeight:600,lineHeight:"20px"},code:{color:"code.orange"},li:{listStyleType:"disc",marginLeft:"25px",paddingLeft:"5px"}},dangerouslySetInnerHTML:{__html:k.TU.parse(n)}})},N=r(951),y=r(39576),T=function(e){var n,r,i,s,a,o=e.changelog,c=e.selectedVersion,l=e.packageManager,g=c.versionNumber===o.sliceMachine.versions[0].versionNumber,x=(n={sliceMachineVersionToInstall:g?"latest":c.versionNumber,isLatestSliceMachineVersion:g,adapterName:o.adapter.name},r=n.sliceMachineVersionToInstall,i=n.isLatestSliceMachineVersion,s=n.adapterName,a=["slice-machine-ui@".concat(r)],i&&a.push("".concat(s,"@latest")),a),p=function(e,n){var r=n.join(" ");switch(e){case"bun":return"bun add --development ".concat(r);case"npm":return"npm install --save-dev ".concat(r);case"pnpm":case"pnpm@6":return"pnpm add --save-dev ".concat(r);case"yarn":case"yarn@berry":return"yarn add --dev ".concat(r)}}(l,x),u=o.adapter.updateAvailable&&!o.sliceMachine.updateAvailable;return(0,t.jsxs)(t.Fragment,{children:[u&&g&&(0,t.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},children:[(0,t.jsx)(N.CSE,{size:"24px"}),"It looks like you are using an outdated version of the adapter. Run this command to update your adapter:"]}),(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,t.jsxs)(d.kC,{sx:{gap:"8px"},children:[(0,t.jsx)(y.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:p}),(0,t.jsx)(d.zx,{variant:"secondary",onClick:function(){navigator.clipboard.writeText(p)},children:"Copy"})]})]})]})},S=function(){return(0,t.jsxs)("div",{children:["Could not fetch release notes."," ",(0,t.jsx)("a",{href:"https://github.com/prismicio/slice-machine/releases",target:"_blank",rel:"noopener noreferrer",children:"Find out more on GitHub"})]})},M=function(e){var n,r=e.changelog,i=e.selectedVersion,s=e.packageManager;return(0,t.jsxs)(d.kC,{sx:{flexDirection:"column"},children:[(0,t.jsxs)(d.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(i.versionNumber)}),!!i.kind&&(0,t.jsx)(j,{versionKind:i.kind})]}),(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null===(n=i.releaseNote)||void 0===n?void 0:n.includes("# Breaking Change"))&&(0,t.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},"data-testid":"breaking-changes-warning",children:[(0,t.jsx)(N.CSE,{size:"24px"}),"This update includes breaking changes. To update correctly, follow the steps below."]}),(0,t.jsx)(T,{changelog:r,selectedVersion:i,packageManager:s}),(null==i?void 0:i.releaseNote)?(0,t.jsx)(C,{releaseNote:i.releaseNote}):(0,t.jsx)(S,{})]})]})},L=r(32665),V=r(3098),R=r(29930);function w(){var e=(0,g.v9)(function(e){return{changelog:(0,x.Sx)(e),packageManager:(0,x.Ak)(e),isChangelogLoading:(0,L.hg)(e,V.z.CHANGELOG)}}),n=e.changelog,r=e.packageManager,i=e.isChangelogLoading,s=n.sliceMachine.versions[0],a=(0,p.useState)(s||void 0),o=a[0],u=a[1];(0,p.useEffect)(function(){u(s)},[s]);var h=0===n.sliceMachine.versions.length||!o;return(0,t.jsx)(R.LN,{children:(0,t.jsx)(R.RN,{children:(0,t.jsx)(l.xR,{sx:{display:"flex",minWidth:0},children:i?(0,t.jsx)(c._3,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{changelog:n,selectedVersion:o,selectVersion:function(e){return u(e)}}),h?(0,t.jsx)(d.kC,{sx:{paddingLeft:"32px"},children:(0,t.jsx)(S,{})}):(0,t.jsx)(M,{changelog:n,selectedVersion:o,packageManager:r})]})})})})}function H(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o(),{children:(0,t.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,t.jsx)(w,{})]})}}},function(e){e.O(0,[898,183,870,774,888,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[477],{37782:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changelog",function(){return r(57825)}])},39576:function(e,n,r){"use strict";r.d(n,{Z:function(){return d}});var i=r(62230),s=r(52322);r(2784);var t=r(59326),a=r(75289),o=r(61183),c=function(e){return{subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"},]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10},]},]}};o.Z.registerLanguage("svelte",c);var l=["javascript","bash","xml","html","json"],d=function(e){var n,r=e.children,c=e.lang,d=e.sx,g=e.codeStyle,x=e.codeClass,p=e.Header,u=(0,t.B7)().theme,h=c?o.Z.highlight(r,{language:"vue"===c?"html":c}).value:o.Z.highlightAuto(r,l).value;return(0,s.jsxs)(a.kC,{as:"pre",sx:d,children:[p?(0,s.jsx)(p,{}):null,(0,s.jsx)("code",{className:"hljs".concat(x?" ".concat(x):""),style:(0,i.Z)({overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=u.colors)||void 0===n?void 0:n.textClear)},g),dangerouslySetInnerHTML:{__html:h}})]})}},57825:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return H}});var i,s,t=r(52322),a=r(97729),o=r.n(a),c=r(22715),l=r(65077),d=r(75289),g=r(56580),x=r(39092),p=r(2784),u=r(62230),h=r(12170),v=function(e){var n=e.type,r=e.hasUpToDateVersions;return(0,t.jsx)(d.xv,{sx:(0,u.Z)({padding:"0px 4px",borderRadius:"2px",fontSize:"8px",fontWeight:600,lineHeight:"16px",textTransform:"uppercase"},(n===i.Latest||n===i.LatestNonBreaking)&&{bg:"grey02",color:"code.gray"},n===i.Current&&r&&{bg:"lightGreen",color:"code.green"},n===i.Current&&!r&&{bg:"lightOrange",color:"code.orange"}),children:n})},f=function(e){var n=e.isSelected,r=e.onClick,i=e.versionNumber,s=e.tags,a=e.hasUpToDateVersions;return(0,t.jsxs)(d.kC,{sx:(0,u.Z)({p:1,borderRadius:"4px",cursor:"pointer",transition:"200ms all",justifyContent:"space-between",alignItems:"center"},n?{color:"purple",bg:(0,h.DZ)("purple",.95)}:{"&:hover":{bg:"grey01"}}),onClick:r,children:[(0,t.jsx)(d.xv,{children:i}),(0,t.jsx)(d.kC,{sx:{gap:"8px"},children:s.map(function(e){return(0,t.jsx)(v,{type:e,hasUpToDateVersions:a},e)})})]})};(s=i||(i={})).Latest="LATEST",s.LatestNonBreaking="LATEST-NON-BREAKING",s.Current="CURRENT";var m=function(e){var n,r=e.changelog,s=e.selectedVersion,a=e.selectVersion,o=function(e){var n=[];return e===l?n.push(i.Latest):e===r.sliceMachine.latestNonBreakingVersion&&n.push(i.LatestNonBreaking),e===r.sliceMachine.currentVersion&&n.push(i.Current),n},l=null===(n=r.sliceMachine.versions[0])||void 0===n?void 0:n.versionNumber,g=!r.adapter.updateAvailable&&!r.sliceMachine.updateAvailable;return(0,t.jsxs)(d.kC,{sx:{minWidth:"228px",borderRight:"1px dashed",borderColor:c.TV.color.greyLight6,flexDirection:"column",paddingRight:"48px"},children:[(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,paddingBottom:"28px"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"20px",fontWeight:500,lineHeight:"32px"},children:"Changelog"}),(0,t.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",marginTop:"28px"},children:"All versions"})]}),(0,t.jsx)(d.kC,{sx:{mt:"24px",flexDirection:"column",gap:"4px",overflow:"auto"},children:r.sliceMachine.versions.map(function(e,n){return(0,t.jsx)(f,{isSelected:(null==s?void 0:s.versionNumber)===e.versionNumber,onClick:function(){return a(e)},versionNumber:e.versionNumber,tags:o(e.versionNumber),hasUpToDateVersions:g},"versionBadge-".concat(e.versionNumber,"-").concat(n))})})]})},b={MAJOR:"MAJOR",MINOR:"MINOR",PATCH:"PATCH",FIRST:"FIRST"},j=function(e){var n=e.versionKind,r=(0,u.Z)({fontSize:"14px",padding:"2px 4px",borderRadius:"4px",textTransform:"uppercase"},n===b.MAJOR?{color:"purple",bg:(0,h.DZ)("purple",.85)}:{color:"grey05",bg:"grey02"});return(0,t.jsx)(d.xv,{sx:r,children:n})},k=r(19870),C=function(e){var n=e.releaseNote;return(0,t.jsx)(d.xv,{sx:{"h1, h2, h3":{fontSize:"16px",fontWeight:600,lineHeight:"20px"},p:{fontSize:"14px",fontWeight:400,lineHeight:"20px"},b:{fontSize:"14px",fontWeight:600,lineHeight:"20px"},code:{color:"code.orange"},li:{listStyleType:"disc",marginLeft:"25px",paddingLeft:"5px"}},dangerouslySetInnerHTML:{__html:k.TU.parse(n)}})},N=r(951),y=r(39576),T=function(e){var n,r,i,s,a,o=e.changelog,c=e.selectedVersion,l=e.packageManager,g=c.versionNumber===o.sliceMachine.versions[0].versionNumber,x=(n={sliceMachineVersionToInstall:g?"latest":c.versionNumber,isLatestSliceMachineVersion:g,adapterName:o.adapter.name},r=n.sliceMachineVersionToInstall,i=n.isLatestSliceMachineVersion,s=n.adapterName,a=["slice-machine-ui@".concat(r)],i&&a.push("".concat(s,"@latest")),a),p=function(e,n){var r=n.join(" ");switch(e){case"bun":return"bun add --development ".concat(r);case"npm":return"npm install --save-dev ".concat(r);case"pnpm":case"pnpm@6":return"pnpm add --save-dev ".concat(r);case"yarn":case"yarn@berry":return"yarn add --dev ".concat(r)}}(l,x),u=o.adapter.updateAvailable&&!o.sliceMachine.updateAvailable;return(0,t.jsxs)(t.Fragment,{children:[u&&g&&(0,t.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},children:[(0,t.jsx)(N.CSE,{size:"24px"}),"It looks like you are using an outdated version of the adapter. Run this command to update your adapter:"]}),(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",gap:"16px",padding:"16px",bg:"grey01"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"20px"},children:"How to install"}),(0,t.jsxs)(d.kC,{sx:{gap:"8px"},children:[(0,t.jsx)(y.Z,{codeStyle:{color:"white",flex:1,padding:"8px"},sx:{flex:1},children:p}),(0,t.jsx)(d.zx,{variant:"secondary",onClick:function(){navigator.clipboard.writeText(p)},children:"Copy"})]})]})]})},S=function(){return(0,t.jsxs)("div",{children:["Could not fetch release notes."," ",(0,t.jsx)("a",{href:"https://github.com/prismicio/slice-machine/releases",target:"_blank",rel:"noopener noreferrer",children:"Find out more on GitHub"})]})},M=function(e){var n,r=e.changelog,i=e.selectedVersion,s=e.packageManager;return(0,t.jsxs)(d.kC,{sx:{flexDirection:"column"},children:[(0,t.jsxs)(d.kC,{sx:{padding:"0px 0px 32px 32px",borderBottom:"1px dashed",borderColor:c.TV.color.greyLight6,justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsx)(d.xv,{sx:{fontSize:"24px",fontWeight:600,lineHeight:"32px"},children:"Version ".concat(i.versionNumber)}),!!i.kind&&(0,t.jsx)(j,{versionKind:i.kind})]}),(0,t.jsxs)(d.kC,{sx:{flexDirection:"column",padding:"24px 0px 0px 32px",gap:"24px"},children:[(null===(n=i.releaseNote)||void 0===n?void 0:n.includes("# Breaking Change"))&&(0,t.jsxs)(d.kC,{sx:{padding:"16px",bg:"lightOrange",color:"darkOrange",fontSize:"13px",lineHeight:"24px",borderRadius:"4px",gap:"16px"},"data-testid":"breaking-changes-warning",children:[(0,t.jsx)(N.CSE,{size:"24px"}),"This update includes breaking changes. To update correctly, follow the steps below."]}),(0,t.jsx)(T,{changelog:r,selectedVersion:i,packageManager:s}),(null==i?void 0:i.releaseNote)?(0,t.jsx)(C,{releaseNote:i.releaseNote}):(0,t.jsx)(S,{})]})]})},L=r(32665),V=r(3098),R=r(22840);function w(){var e=(0,g.v9)(function(e){return{changelog:(0,x.Sx)(e),packageManager:(0,x.Ak)(e),isChangelogLoading:(0,L.hg)(e,V.z.CHANGELOG)}}),n=e.changelog,r=e.packageManager,i=e.isChangelogLoading,s=n.sliceMachine.versions[0],a=(0,p.useState)(s||void 0),o=a[0],u=a[1];(0,p.useEffect)(function(){u(s)},[s]);var h=0===n.sliceMachine.versions.length||!o;return(0,t.jsx)(R.LN,{children:(0,t.jsx)(R.RN,{children:(0,t.jsx)(l.xR,{sx:{display:"flex",minWidth:0},children:i?(0,t.jsx)(c._3,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{changelog:n,selectedVersion:o,selectVersion:function(e){return u(e)}}),h?(0,t.jsx)(d.kC,{sx:{paddingLeft:"32px"},children:(0,t.jsx)(S,{})}):(0,t.jsx)(M,{changelog:n,selectedVersion:o,packageManager:r})]})})})})}function H(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o(),{children:(0,t.jsx)("title",{children:"Changelog - Slice Machine"})}),(0,t.jsx)(w,{})]})}}},function(e){e.O(0,[898,183,870,774,888,179],function(){return e(e.s=37782)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return t(58928)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return u}});var s=t(62230),i=t(85244),r=t(98240),o=t(52322),c=t(2784),l=t(75289),a=function(e,n){return e?"".concat(e,"-").concat(n):""},d=function(e){switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},u=(0,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,u=e.type,x=e.form,h=e.isLoading,m=void 0!==h&&h,f=e.disabled,p=e.onClick,g=e.sx,j=e.iconSize,v=void 0===j?16:j,y=e.iconFill,b=e.variant,_=void 0===b?"primary":b,C=(0,r.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,o.jsx)(l.zx,(0,i.Z)((0,s.Z)({ref:n,sx:(0,s.Z)((0,i.Z)((0,s.Z)({},void 0===g?{}:g),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),m?{cursor:"wait !important"}:{}),type:u,form:x,disabled:void 0!==f&&f||m,onClick:m?void 0:p,variant:_},C),{children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.$j,{size:v,color:d(_),"data-cy":a(C["data-cy"],"spinner")}),c&&t]}):(0,o.jsxs)(o.Fragment,{children:[c&&(0,o.jsx)(c,{size:v,fill:y,"data-cy":a(C["data-cy"],"icon")}),t]})}))})},59469:function(e,n,t){"use strict";var s=t(62230),i=t(52322),r=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,o=e.defineElementKey,c=e.gridTemplateMinPx,l=e.gridGap,a=e.sx;return(0,i.jsx)(r.xu,{as:"section",sx:(0,s.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===c?"320px":c,", 1fr))"),gridGap:void 0===l?"16px":l,pt:2},a),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(o(e),"-").concat(n+1)):null})})}},58928:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ex}});var s=t(22710),i=t(99267),r=t(52322),o=t(22715),c=t(2784),l=t(88932),a=t(97729),d=t.n(a),u=t(65077),x=t(5632),h=t.n(x),m=t(22840),f=t(951),p=t(75289),g=function(e){var n=e.children;return(0,r.jsx)(p.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px",width:"100%"},children:n})},j=t(39097),v=t.n(j),y=t(7819),b=t(34728),_=t(67445),C=function(e){var n=e.ct,t=e.status,s=e.authStatus,i=e.isOnline;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.xu,{as:"td",style:{width:"40%"},children:(0,r.jsx)(p.xv,{sx:{fontWeight:500},children:n.label})}),(0,r.jsx)(p.xu,{as:"td",style:{width:"40%"},children:n.id}),(0,r.jsx)(p.xu,{as:"td",style:{width:"20%"},children:(0,r.jsx)(b.O,{authStatus:s,isOnline:i,modelStatus:t,modelType:"CustomType"})})]})},S=function(e){var n=e.customTypes,t=e.modelsStatuses,s=e.authStatus,i=e.isOnline;return(0,r.jsxs)(p.xu,{as:"table","data-legacy-component":!0,children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"transparent small",children:[(0,r.jsx)(p.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,r.jsx)(p.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,r.jsx)(p.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,r.jsx)("tbody",{children:n.map(function(e){return(0,y.TG)(e)?(0,r.jsx)(v(),{passHref:!0,href:_.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,r.jsx)("tr",{tabIndex:0,"data-cy":"custom-type-".concat(e.local.id),children:(0,r.jsx)(C,{ct:e.local,status:t.customTypes[e.local.id],authStatus:s,isOnline:i},e.local.id)})},e.local.id):(0,r.jsx)("tr",{tabIndex:0,className:"disabled","data-cy":"custom-type-".concat(e.remote.id),children:(0,r.jsx)(C,{ct:e.remote,status:t.customTypes[e.remote.id],authStatus:s,isOnline:i},e.remote.id)},e.remote.id)})})]})},k=t(59469),w=t(15836),z=t(5479),D=t(47731),T=t(32681),Z=t(71749),O=t(11563),F=t(82770);function I(){var e=(0,O.L)("slicemachine-dev-collaboration"),n=(0,c.useState)(!1),t=n[0],s=n[1],i=null==e?void 0:e.payload;return((0,c.useEffect)(function(){(null==e?void 0:e.value)==="on"&&void 0!==i&&F.Xe.track({event:"dev-collab:workflow-stub-displayed"})},[e,i]),(null==e?void 0:e.value)!=="on"||void 0===i)?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.xu,{alignItems:"flex-start",border:{bottom:!0,left:!0,right:!0,top:!0},borderRadius:6,borderStyle:"dashed",flexDirection:"column",flexShrink:0,gap:8,padding:16,width:320,children:[(0,r.jsxs)(o.xu,{flexDirection:"column",gap:2,children:[(0,r.jsx)(o.xv,{variant:"smallBold",children:i.cardTitle}),(0,r.jsx)(o.xv,{color:"grey11",variant:"small",children:i.cardDescription})]}),(0,r.jsx)(o.zx,{color:"grey",onClick:function(){F.Xe.track({event:"dev-collab:set-up-workflow-opened"}),s(!0)},children:i.cardButtonLabel})]}),(0,r.jsxs)(o.Vq,{onOpenChange:function(e){e||s(!1)},open:t,size:{height:"auto",width:448},children:[(0,r.jsx)(o.fK,{title:i.dialogTitle}),(0,r.jsx)(o.cZ,{children:(0,r.jsxs)(o.xu,{flexDirection:"column",children:[(0,r.jsx)(o.xu,{flexDirection:"column",padding:16,children:(0,r.jsx)(o.xv,{children:i.dialogDescription})}),(0,r.jsx)(o.kX,{cancel:{text:"Cancel"},ok:{text:i.dialogButtonLabel,onClick:function(){F.Xe.track({event:"dev-collab:join-beta-clicked"}),window.open(i.dialogButtonLink,"_blank"),s(!1)}},size:"medium"})]})})]})]})}var N=function(e){var n=e.unSyncedCustomTypes,t=e.unSyncedSlices,s=e.modelsStatuses,i=e.authStatus,l=e.isOnline,a=(0,D.H)(),d=a.modalPayload,u=a.onOpenModal,x=d.sliceFilterFn,h=d.defaultVariationSelector,m=t.filter(function(e){return s.slices[e.model.id]!==T.GJ.Deleted});return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(o.xu,{gap:16,alignItems:"flex-start",children:[(0,r.jsxs)(o.xu,{flexDirection:"column",flexGrow:1,children:[n.length>0&&(0,r.jsxs)(o.xu,{flexDirection:"column",children:[(0,r.jsx)(g,{children:(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(o.xv,{variant:"h5",children:"Types"}),(0,r.jsx)(o.xv,{variant:"h5",sx:{marginLeft:8},children:n.length})]})}),(0,r.jsx)(S,{customTypes:n,modelsStatuses:s,authStatus:i,isOnline:l})]}),t.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xu,{padding:{bottom:8},children:(0,r.jsxs)(g,{children:[(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(o.xv,{variant:"h5",children:"Slices"}),(0,r.jsx)(o.xv,{variant:"h5",sx:{marginLeft:8},children:t.length})]}),(0,r.jsxs)(o.xu,{children:[t.some(function(e){return(0,z.cx)(e)>0&&s.slices[e.model.id]!==T.GJ.Deleted})&&(0,r.jsxs)(o.xv,{color:"amber11",sx:{marginRight:8,alignSelf:"center"},children:[(0,r.jsx)(f.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,r.jsxs)(o.zx,{color:"dark",onClick:function(){return u({sliceFilterFn:function(e){return e}})},children:[(0,r.jsx)(f.hOO,{style:{color:"#FFF",fontSize:"15px",position:"relative",top:"3px",marginRight:"4px"}})," ","Update all screenshots"]})]})]})}),(0,r.jsx)(k.Z,{gridGap:"32px 16px",elems:t,gridTemplateMinPx:"305px",defineElementKey:function(e){return e.model.name},renderElem:function(e){var n=s.slices[e.model.id];return(0,r.jsx)(Z.b,{action:{type:"status",authStatus:i,isOnline:l,modelStatus:n},isDeleted:n===T.GJ.Deleted,mode:"navigation",onUpdateScreenshot:function(){u({sliceFilterFn:function(n){return n.filter(function(n){return n.model.id===e.model.id})}})},slice:e,variant:"solid"})}}),(0,r.jsx)(w.Z,{slices:x(m),defaultVariationSelector:h})]})]}),(0,r.jsx)(o.SV,{children:(0,r.jsx)(c.Suspense,{children:(0,r.jsx)(I,{})})})]})})},R=t(91914),E=function(){return(0,r.jsx)(p.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,r.jsxs)(p.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,r.jsx)(R.wQ1,{size:48}),(0,r.jsx)(p.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px",textAlign:"center"},children:"No internet connection"}),(0,r.jsx)(p.xv,{sx:{fontSize:"13px",lineHeight:"24px",textAlign:"center"},children:"Connect to the internet to sync your changes."})]})})},L=t(90374),A=t(79096),B=function(e){var n=e.authStatus,t=(0,L.Z)().openLoginModal;return(0,r.jsxs)(o.xu,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[n===A.t.FORBIDDEN?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xv,{variant:"h3",align:"center",children:"It seems like you are logged out"}),(0,r.jsx)(o.xv,{align:"center",children:"Log in to connect to your repository."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xv,{variant:"h3",align:"center",children:"It seems like you don't have access to this repository"}),(0,r.jsx)(o.xv,{align:"center",children:"Check that the repository name is correct, then contact your repository administrator."})]}),(0,r.jsxs)(o.xv,{align:"center",children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,r.jsx)(o.hh,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),n===A.t.FORBIDDEN&&(0,r.jsx)(o.zx,{onClick:function(){return t()},children:"Log in to Prismic"})]})},P=t(2754),H=t(34543),M=t(62230),W=t(85244),V=t(98240),X=t(6277);t(25977);var G={primary:"_1ecs97dbc8 _1ecs97dbjl _1ecs97dbc2 _1ecs97dbjf _1ecs97dbca _1ecs97dbjn",secondary:"_1ecs97daji _1ecs97dah3 _1ecs97dajc _1ecs97dagx _1ecs97dajk _1ecs97dah5"},U={normal:"ovkapw1",smallBold:"ovkapw2",inherit:"ovkapw3 _1ecs97df47"},Y=function(e){var n=e.children,t=e.color,s=e.endIcon,i=e.href,l=e.textVariant,a=void 0===l?"smallBold":l,d=(0,V.Z)(e,["children","color","endIcon","href","textVariant"]);return(0,r.jsxs)("a",(0,W.Z)((0,M.Z)({href:i,target:"_blank",rel:"noreferrer"},d),{className:(0,X.Z)("ovkapw0 _1ecs97dez0 _1ecs97df41 _1ecs97dez2 _1ecs97dez8",G[void 0===t?"primary":t]),children:[(0,r.jsx)(o.xv,{component:"span",color:"inherit",variant:a,children:n}),(0,c.isValidElement)(s)?(0,c.cloneElement)(s,{className:(0,X.Z)(s.props.className,"_1ecs97dfhw",U[a])}):null]}))},K=t(56580),Q=t(39092),J=function(){var e,n=(e=(0,K.v9)(function(e){return{repoName:(0,Q.MY)(e)}}).repoName,"https://".concat(e,".prismic.io/documents/working"));return(0,r.jsxs)(P.R$,{style:{alignSelf:"center",marginTop:o.TV.size[72]},children:[(0,r.jsx)(P.u2,{children:(0,r.jsx)(o.Ee,{src:"/blank-slate-changes-uptodate.png",sizing:"cover"})}),(0,r.jsxs)(P.T9,{children:[(0,r.jsx)(P._T,{children:"Everything up-to-date"}),(0,r.jsx)(P.nf,{children:"You have no changes staged. Your changes appear here after you have saved them, while they're waiting to be pushed to the Page Builder. Ready to get going?"}),(0,r.jsxs)(P.Qj,{children:[(0,r.jsx)(o.zx,{onClick:function(){h().push("/")},children:"Create a page type"}),(0,r.jsx)(Y,{endIcon:(0,r.jsx)(H.AlO,{}),textVariant:"normal",href:n,children:"Create content"})]})]})]})},$=t(56577),q=t(31667);t(78656);var ee=function(e){var n=e.ctName,t=e.numberOfDocuments,s=e.link,i=e.isOverLimit;return(0,r.jsxs)(p.Zb,{sx:{mb:12},variant:"drawerCard","data-cy":"AssociatedDocumentsCard-".concat(n),children:[(0,r.jsxs)(p.kC,{sx:{flexDirection:"column"},children:[(0,r.jsx)(p.xv,{children:n}),(0,r.jsxs)(p.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[t," documents"]})]}),(0,r.jsx)(p.rU,{href:s,target:"_blank",variant:"cardSmall",sx:{color:void 0!==i&&i?"danger":"purple08"},children:"View documents"})]})},en=t(79797),et=t(54132),es=function(e){var n=e.isOpen,t=e.title,s=e.footer,i=e.explanations,o=e.onClose;return(0,r.jsx)(en.Z,{placement:"right",open:n,level:null,onClose:o,width:496,children:(0,r.jsx)(et.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:function(){return(0,r.jsxs)(p.kC,{sx:{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.jsx)(p.kC,{sx:{alignItems:"center"},children:(0,r.jsx)(p.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:t})}),(0,r.jsx)(p.x8,{type:"button",onClick:function(){return o()}})]})},Footer:function(){return(0,r.jsx)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",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:"white",padding:20},children:s})},children:i})})},ei=function(e){var n=e.onToggle,t=e.isConfirmed,s=e.sx;return(0,r.jsxs)(p.kC,{sx:(0,M.Z)({borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%"},s),children:[(0,r.jsx)(p.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,r.jsxs)(p.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,r.jsx)(p.XZ,{defaultChecked:t,onChange:n,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},er=function(e){var n=e.pushChanges,t=e.modalData,s=e.onClose,i=(0,c.useState)(!1),o=i[0],l=i[1],a=(0,K.v9)(function(e){return{remoteOnlyCustomTypes:(0,q.Ch)(e).filter(y.yp)}}).remoteOnlyCustomTypes;if((null==t?void 0:t.type)!=="SOFT")return null;var d=t.details.customTypes.map(function(e){var n,t=a.find(function(n){return(0,y.n5)(n)===e.id});return void 0===t?null:(0,r.jsx)(ee,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,r.jsx)(es,{isOpen:"SOFT"===t.type,title:"Confirm deletion",onClose:s,footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ei,{onToggle:function(){l(!o)},isConfirmed:o,sx:{mb:10}}),(0,r.jsx)($.z,{label:"Push changes",variant:"primary",onClick:function(){n(o)},disabled:!o,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,r.jsxs)(p.xv,{sx:{mb:24},children:[t.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),d]})})},eo=function(e){var n=e.pushChanges,t=e.modalData,s=e.onClose,i=(0,K.v9)(function(e){return{remoteOnlyCustomTypes:(0,q.Ch)(e).filter(y.yp)}}).remoteOnlyCustomTypes;if((null==t?void 0:t.type)!=="HARD")return null;var o=t.details.customTypes.map(function(e){var n,t=i.find(function(n){return(0,y.n5)(n)===e.id});return void 0===t?null:(0,r.jsx)(ee,{isOverLimit:!0,ctName:null!==(n=t.remote.label)&&void 0!==n?n:t.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,r.jsx)(es,{isOpen:"HARD"===t.type,title:"Manual action required",onClose:s,footer:(0,r.jsx)($.z,{label:"Try again",variant:"primary",onClick:function(){n(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",t.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,r.jsxs)(p.xv,{sx:{mb:24},children:[t.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),o]})})},ec=t(46326),el=t(41834),ea=t(80262),ed=t(16847),eu=t(50950),ex=function(){var e,n=(0,el.X)(),t=n.unSyncedSlices,a=n.unSyncedCustomTypes,h=n.changedCustomTypes,f=n.changedSlices,p=n.modelsStatuses,g=(0,ea.L)(),j=(0,ed.n)(),v=(0,L.Z)(),y=v.pushChangesSuccess,b=v.refreshState,_=(0,c.useState)(!1),C=_[0],S=_[1],k=(0,c.useState)(void 0),w=k[0],z=k[1],D=(0,eu.g)().autoSyncStatus,T=(0,x.useRouter)(),Z=t.length+a.length;(0,c.useEffect)(function(){("synced"===D||"failed"===D||"syncing"===D)&&T.push("/")},[D,T]);var O=(e=(0,s.Z)(function(e){var n,t,s;return(0,i.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),S(!0),z(void 0),[4,(0,ec.t)({confirmDeleteDocuments:e,changedCustomTypes:h,changedSlices:f})];case 1:if(!(void 0!==(n=t.sent())))return[3,2];return z(n),[3,4];case 2:return[4,(0,F.y0)()];case 3:b(t.sent()),y(),l.Am.success("All slices and types have been pushed"),t.label=4;case 4:return[3,6];case 5:return s=t.sent(),console.error("Something went wrong when manually pushing your changes",s),l.Am.error("Something went wrong when pushing your changes. Check your terminal logs."),[3,6];case 6:return S(!1),[2]}})}),function(n){return e.apply(this,arguments)}),I=(0,c.useMemo)(function(){return g?j===A.t.UNAUTHORIZED||j===A.t.FORBIDDEN?(0,r.jsx)(B,{authStatus:j}):0===Z?(0,r.jsx)(J,{}):(0,r.jsx)(N,{unSyncedSlices:t,unSyncedCustomTypes:a,modelsStatuses:p,authStatus:j,isOnline:g}):(0,r.jsx)(E,{})},[g,j,Z,t,a,p,]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d(),{children:(0,r.jsx)("title",{children:"Changes - Slice Machine"})}),(0,r.jsxs)(m.LN,{children:[(0,r.jsxs)(m.wd,{children:[(0,r.jsx)(m.Cx,{folder:"Changes"}),(0,r.jsx)(m.K2,{children:(0,r.jsx)(o.zx,{onClick:function(){O(!1)},loading:C,disabled:0===Z||!g||j===A.t.UNAUTHORIZED||j===A.t.FORBIDDEN||C,"data-cy":"push-changes",children:"Push Changes"})})]}),(0,r.jsx)(m.RN,{children:(0,r.jsxs)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:[I,(0,r.jsx)(er,{pushChanges:function(e){O(e)},modalData:w,onClose:function(){return z(void 0)}}),(0,r.jsx)(eo,{pushChanges:function(e){O(e)},modalData:w,onClose:function(){return z(void 0)}})]})})]})]})}},2754:function(e,n,t){"use strict";t.d(n,{R$:function(){return d},Qj:function(){return f},T9:function(){return x},nf:function(){return m},u2:function(){return u},_T:function(){return h}});var s=t(67557),i=t(62230),r=t(85244),o=t(98240),c=t(52322),l=t(6277),a=t(22715);t(69143);var d=function(e){var n=e.backgroundImage,t=e.style,a=(0,o.Z)(e,["backgroundImage","style"]),d=void 0!==n;return(0,c.jsx)("article",(0,r.Z)((0,i.Z)({},a),{className:(0,l.Z)("_18bjhbz0 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dfiv _1ecs97dfix _1ecs97dfiz _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezp",(0,s.Z)({},"_18bjhbz1 _1ecs97dezx _1ecs97df4v",d)),style:(0,i.Z)({backgroundImage:d?"url(".concat(n,")"):void 0},t)}))},u=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97d6r8 _1ecs97d6yl _1ecs97df29 _1ecs97df2l _1ecs97dezp"}))},x=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz3 _1ecs97dez0 _1ecs97dez1 _1ecs97dez2 _1ecs97dezb _1ecs97dffv"}))},h=function(e){return(0,c.jsx)(a.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz4"}))},m=function(e){return(0,c.jsx)(a.xv,(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz5",color:"grey11"}))},f=function(e){return(0,c.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_18bjhbz6 _1ecs97dez0 _1ecs97dez8 _1ecs97dez1 _1ecs97dez2 _1ecs97df95 _1ecs97dfdl",color:"grey"}))}},69143:function(){},25977:function(){}},function(e){e.O(0,[898,789,123,543,918,25,286,774,888,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[274],{41535:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return r(8951)}])},8951:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return j}});var t=r(52322),i=r(2784),s=r(22715),a=r(97729),c=r.n(a),l=r(29930),o=r(22710),u=r(17064),d=r(99267),h=r(90374),f=r(40432),x=function(e){var n=e.title,r=e.enabled,i=e.onToggle,a=e.children;return(0,t.jsx)(s.Zb,{variant:"outlined",children:(0,t.jsxs)(s.xu,{gap:8,padding:16,children:[(0,t.jsx)(s.xu,{padding:{top:6},children:(0,t.jsx)(s.I5,{name:"viewDay",size:"medium",color:"grey11"})}),(0,t.jsxs)(s.xu,{flexDirection:"column",flexGrow:1,children:[(0,t.jsx)(s.xv,{variant:"h3",children:n}),(0,t.jsx)(s.xv,{variant:"normal",children:a})]}),(0,t.jsx)(s.xu,{width:128,justifyContent:"end",children:(0,t.jsx)(s.rs,{size:"medium",checked:r,onCheckedChange:function(e){return i(e)}})})]})})},g=r(65988),b=function(){var e,n,r,i,a,c,l,b=(0,u.Z)((e="legacySliceUpgrader",n="Legacy Slice Upgrader",i=(0,h.Z)().openToaster,a=(0,u.Z)((0,g.E)(e),2),c=a[0],l=a[1],[c,(r=(0,o.Z)(function(e){var r;return(0,d.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,l(e)];case 1:return t.sent(),i(e?"Labs: enabled ".concat(n):"Labs: disabled ".concat(n),f.Jf.SUCCESS),[3,3];case 2:return r=t.sent(),console.error(r),i(e?"Labs: failed to enable ".concat(n):"Labs: failed to disable ".concat(n),f.Jf.ERROR),[3,3];case 3:return[2]}})}),function(e){return r.apply(this,arguments)})]),2),j=b[0],p=b[1];return(0,t.jsxs)(s.xu,{flexDirection:"column",gap:32,children:[(0,t.jsx)("header",{children:(0,t.jsx)(s.xv,{variant:"normal",children:"Slice Machine Labs gives you early access to new features before they're widely released. Experimental features are works-in-progress and potentially unstable, so you may find some bugs and breaking changes along the way."})}),(0,t.jsx)(s.xu,{flexDirection:"column",gap:16,children:(0,t.jsxs)(x,{title:"Legacy Slice Upgrader",enabled:j.enabled,onToggle:function(e){p(e)},children:["The Legacy Slice Upgrader allows you to convert old slices (legacy and composite slices) to slices managed by Slice Machine (shared slices). This feature is experimental, and we strongly recommend that you test it with a"," ",(0,t.jsx)("a",{href:"https://prismic.io/docs/environments",target:"_blank",children:"Prismic environment"})," ","or you'll be at risk of losing past content."]})})]})},j=function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsx)("title",{children:"Labs - Slice Machine"})}),(0,t.jsx)(s.SV,{renderError:function(){return(0,t.jsx)(p,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your labs configuration."})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(s._3,{})}),children:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(b,{})})})})]})},p=function(e){var n=e.children,r=e.withHeader;return(0,t.jsxs)(l.LN,{children:[void 0!==r&&r?(0,t.jsx)(l.wd,{children:(0,t.jsx)(l.Cx,{folder:"Labs"})}):null,(0,t.jsx)(l.RN,{children:n})]})}},65988:function(e,n,r){"use strict";r.d(n,{E:function(){return h}});var t=r(22710),i=r(62230),s=r(85244),a=r(17064),c=r(99267),l=r(17329),o=r(81038);function u(){return d.apply(this,arguments)}function d(){return(d=(0,t.Z)(function(){return(0,c.__generator)(this,function(e){return[2,o.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}function h(e){var n,r,d,h,f,x,g=(0,a.Z)((n=(0,l.QT)(u,[]),r=(0,t.Z)(function(e){return(0,c.__generator)(this,function(n){switch(n.label){case 0:return[4,o.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,l.VA)(u,[],e),[2]}})}),[n,d=function(e){return r.apply(this,arguments)}]),2),b=g[0],j=g[1],p=(x=(0,t.Z)(function(n){var r;return(0,c.__generator)(this,function(t){switch(t.label){case 0:return r=(0,s.Z)((0,i.Z)({},b),{labs:(0,i.Z)({},b.labs)}),n?r.labs[e]=n:e in r.labs&&delete r.labs[e],0===Object.keys(r.labs).length&&delete r.labs,[4,j(r)];case 1:return t.sent(),[2]}})}),function(e){return x.apply(this,arguments)});return[{enabled:null!==(f=null==b?void 0:null===(h=b.labs)||void 0===h?void 0:h[e])&&void 0!==f&&f},p]}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=41535)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[274],{41535:function(e,n,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/labs",function(){return r(8951)}])},8951:function(e,n,r){"use strict";r.r(n),r.d(n,{default:function(){return j}});var t=r(52322),i=r(2784),s=r(22715),c=r(97729),a=r.n(c),l=r(22840),o=r(22710),u=r(17064),d=r(99267),h=r(90374),f=r(40432),x=function(e){var n=e.title,r=e.enabled,i=e.onToggle,c=e.children;return(0,t.jsx)(s.Zb,{variant:"outlined",children:(0,t.jsxs)(s.xu,{gap:8,padding:16,children:[(0,t.jsx)(s.xu,{padding:{top:6},children:(0,t.jsx)(s.I5,{name:"viewDay",size:"medium",color:"grey11"})}),(0,t.jsxs)(s.xu,{flexDirection:"column",flexGrow:1,children:[(0,t.jsx)(s.xv,{variant:"h3",children:n}),(0,t.jsx)(s.xv,{variant:"normal",children:c})]}),(0,t.jsx)(s.xu,{width:128,justifyContent:"end",children:(0,t.jsx)(s.rs,{size:"medium",checked:r,onCheckedChange:function(e){return i(e)}})})]})})},g=r(63269),b=function(){var e,n,r,i,c,a,l,b=(0,u.Z)((e="legacySliceUpgrader",n="Legacy Slice Upgrader",i=(0,h.Z)().openToaster,c=(0,u.Z)((0,g.E)(e),2),a=c[0],l=c[1],[a,(r=(0,o.Z)(function(e){var r;return(0,d.__generator)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,l(e)];case 1:return t.sent(),i(e?"Labs: enabled ".concat(n):"Labs: disabled ".concat(n),f.Jf.SUCCESS),[3,3];case 2:return r=t.sent(),console.error(r),i(e?"Labs: failed to enable ".concat(n):"Labs: failed to disable ".concat(n),f.Jf.ERROR),[3,3];case 3:return[2]}})}),function(e){return r.apply(this,arguments)})]),2),j=b[0],p=b[1];return(0,t.jsxs)(s.xu,{flexDirection:"column",gap:32,children:[(0,t.jsx)("header",{children:(0,t.jsx)(s.xv,{variant:"normal",children:"Slice Machine Labs gives you early access to new features before they're widely released. Experimental features are works-in-progress and potentially unstable, so you may find some bugs and breaking changes along the way."})}),(0,t.jsx)(s.xu,{flexDirection:"column",gap:16,children:(0,t.jsxs)(x,{title:"Legacy Slice Upgrader",enabled:j.enabled,onToggle:function(e){p(e)},children:["The Legacy Slice Upgrader allows you to convert old slices (legacy and composite slices) to slices managed by Slice Machine (shared slices). This feature is experimental, and we strongly recommend that you test it with a"," ",(0,t.jsx)("a",{href:"https://prismic.io/docs/environments",target:"_blank",children:"Prismic environment"})," ","or you'll be at risk of losing past content."]})})]})},j=function(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a(),{children:(0,t.jsx)("title",{children:"Labs - Slice Machine"})}),(0,t.jsx)(s.SV,{renderError:function(){return(0,t.jsx)(p,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your labs configuration."})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(s._3,{})}),children:(0,t.jsx)(p,{withHeader:!0,children:(0,t.jsx)(b,{})})})})]})},p=function(e){var n=e.children,r=e.withHeader;return(0,t.jsxs)(l.LN,{children:[void 0!==r&&r?(0,t.jsx)(l.wd,{children:(0,t.jsx)(l.Cx,{folder:"Labs"})}):null,(0,t.jsx)(l.RN,{children:n})]})}},63269:function(e,n,r){"use strict";r.d(n,{E:function(){return o}});var t=r(22710),i=r(62230),s=r(85244),c=r(17064),a=r(99267),l=r(19334);function o(e){var n,r,o,u=(0,c.Z)((0,l.f)(),2),d=u[0],h=u[1],f=(o=(0,t.Z)(function(n){var r;return(0,a.__generator)(this,function(t){switch(t.label){case 0:return r=(0,s.Z)((0,i.Z)({},d),{labs:(0,i.Z)({},d.labs)}),n?r.labs[e]=n:e in r.labs&&delete r.labs[e],0===Object.keys(r.labs).length&&delete r.labs,[4,h(r)];case 1:return t.sent(),[2]}})}),function(e){return o.apply(this,arguments)});return[{enabled:null!==(r=null==d?void 0:null===(n=d.labs)||void 0===n?void 0:n[e])&&void 0!==r&&r},f]}},19334:function(e,n,r){"use strict";r.d(n,{f:function(){return a}});var t=r(22710),i=r(99267),s=r(17329),c=r(81038);function a(){var e,n=(0,s.QT)(l,[]),r=(e=(0,t.Z)(function(e){return(0,i.__generator)(this,function(n){switch(n.label){case 0:return[4,c.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,s.VA)(l,[],e),[2]}})}),function(n){return e.apply(this,arguments)});return[n,r]}function l(){return o.apply(this,arguments)}function o(){return(o=(0,t.Z)(function(){return(0,i.__generator)(this,function(e){return[2,c.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=41535)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{24994:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return t(45332)}])},45332:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return em}});var r=t(52322),i=t(22715),o=t(97729),c=t.n(o),s=t(5632),l=t(2784),a=t(22840),u=t(37792),d=t(62230),h=t(85244),x=t(98240),f=t(88921),p=t.n(f),_=function(e){return(0,r.jsx)("div",(0,h.Z)((0,d.Z)({},e),{className:p().root}))},g=function(e){var n=e.children,t=(0,x.Z)(e,["children"]);return(0,r.jsx)("div",(0,h.Z)((0,d.Z)({},t),{className:p().legend,children:(0,r.jsx)(i.xv,{color:"grey11",component:"span",noWrap:!0,variant:"smallBold",children:n})}))},m=function(e){return(0,r.jsx)("div",(0,h.Z)((0,d.Z)({},e),{className:p().header}))},j=function(e){return(0,r.jsx)("div",(0,h.Z)((0,d.Z)({},e),{className:p().content}))},v=function(e){return(0,r.jsx)("div",(0,h.Z)((0,d.Z)({},e),{className:p().list}))},w=function(e){var n=e.action,t=e.children,o=(0,x.Z)(e,["action","children"]);return(0,r.jsxs)("div",(0,h.Z)((0,d.Z)({},o),{className:p().listItem,children:[(0,r.jsx)(i.xv,{className:p().listItemText,component:"span",noWrap:!0,variant:"bold",children:t}),n]}))},y=function(e){var n=e.action,t=e.children,o=(0,x.Z)(e,["action","children"]);return(0,r.jsxs)("div",(0,h.Z)((0,d.Z)({},o),{className:p().footer,children:[(0,r.jsx)(i.xv,{className:p().footerText,color:"grey11",component:"span",noWrap:!0,variant:"small",children:t}),n]}))},C=function(e){var n=e.title,t=e.description,o=e.action;return(0,r.jsxs)(i.xu,{flexDirection:"column",padding:{block:72,inline:100},children:[(0,r.jsx)(i.xv,{align:"center",variant:"emphasized",children:n}),(0,r.jsx)(i.xv,{align:"center",color:"grey11",children:t}),Boolean(o)?(0,r.jsx)(i.hE,{sx:{alignSelf:"center",marginTop:8},children:o}):void 0]})},S=t(22710),b=t(99267),k=t(98863),Z=t(88932),F=function(e){return(0,r.jsx)("svg",(0,h.Z)((0,d.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.77596 5.47599C4.84147 5.44648 4.91265 5.43167 4.9845 5.4326L19.3525 5.43506C19.4243 5.43413 19.4955 5.44894 19.561 5.47845C19.6265 5.50796 19.6848 5.55146 19.7317 5.60588C19.7786 5.6603 19.8131 5.72433 19.8326 5.79348C19.8521 5.86262 19.8563 5.93521 19.8448 6.00614L19.1802 10.0751H9.71803L10.5722 14.6018H11.1162L11.1162 14.6018H13.7846L14.56 10.0751H19.1803L17.7575 18.8357C17.7387 18.9522 17.6786 19.058 17.5882 19.1339C17.4979 19.2098 17.3832 19.2507 17.2652 19.2492H7.23692C7.2134 19.249 7.19001 19.2476 7.16682 19.2449C7.03392 19.2298 6.90803 19.175 6.80603 19.0868C6.68704 18.9851 6.60772 18.8448 6.58203 18.6904L4.49219 6.00367C4.48069 5.93275 4.48485 5.86016 4.50438 5.79102C4.52392 5.72187 4.55835 5.65784 4.60527 5.60342C4.65218 5.54899 4.71044 5.5055 4.77596 5.47599Z",fill:"currentColor"})}))},L=function(e){return(0,r.jsx)("svg",(0,h.Z)((0,d.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,r.jsx)("path",{d:"M12 4C7.57486 4 4 7.57486 4 12C4 15.5246 6.30057 18.5257 9.47429 19.6C9.87429 19.6754 10.0251 19.4251 10.0251 19.2251V17.8754C7.8 18.3497 7.32457 16.8 7.32457 16.8C6.94971 15.8743 6.42514 15.6251 6.42514 15.6251C5.70057 15.1246 6.47543 15.1497 6.47543 15.1497C7.27543 15.2 7.69943 15.9749 7.69943 15.9749C8.42514 17.2 9.57486 16.8503 10.0251 16.6491C10.1006 16.1246 10.2994 15.7749 10.5246 15.5749C8.74971 15.3749 6.87543 14.6754 6.87543 11.6251C6.87543 10.7497 7.17486 10.0503 7.69943 9.47543C7.62514 9.27543 7.34971 8.45029 7.77486 7.34971C7.77486 7.34971 8.44914 7.12457 9.97486 8.17486C10.6266 7.99627 11.2991 7.90405 11.9749 7.90057C12.6491 7.90057 13.3497 8 13.9749 8.17486C15.5006 7.14971 16.1749 7.34971 16.1749 7.34971C16.6 8.45029 16.3246 9.27543 16.2503 9.47543C16.776 10.024 17.0754 10.7497 17.0754 11.624C17.0754 14.6994 15.2 15.3749 13.4251 15.5749C13.6994 15.8251 13.9749 16.2994 13.9749 17.0491V19.2503C13.9749 19.4754 14.1246 19.7246 14.5246 19.6251C17.7006 18.5246 20 15.5246 20 12C20 7.57486 16.4251 4 12 4Z",fill:"currentColor"})}))},N=function(e){return(0,r.jsx)("svg",(0,h.Z)((0,d.Z)({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.7881 10.5954L16.5431 5.20756C16.6328 4.93081 17.0594 4.93081 17.1492 5.20756L18.9076 10.5954H14.7881ZM6.6192 5.20756L4.86353 10.5954H8.97968L7.22468 5.20756C7.1349 4.93081 6.70898 4.93081 6.6192 5.20756ZM4.0299 13.2981L4.86352 10.5954H4.86353H8.979H14.7881H18.9076L19.7392 13.2981C19.7796 13.4207 19.7802 13.553 19.7408 13.676C19.7014 13.799 19.624 13.9063 19.5198 13.9826L11.893 19.5257L11.8879 19.5319L11.8923 19.5378L11.8865 19.5336L11.8835 19.5371L11.8852 19.5326L4.24927 13.9826C4.0299 13.8246 3.95092 13.5458 4.0299 13.2981Z",fill:"currentColor"})}))},I=t(81038),T={gitHub:{connect:(0,S.Z)(function(){var e,n;return(0,b.__generator)(this,function(t){switch(t.label){case 0:return[4,I.j.git.createGitHubAuthState()];case 1:return e=t.sent(),(n=new URL("https://github.com/apps/".concat("prismic-io","/installations/new"))).searchParams.set("state",e.key),window.open(n,"git-hub-app-installation"),[2]}})}),Icon:L,name:"GitHub",supported:!0},bitbucket:{connect:function(){throw Error("Not implemented.")},Icon:F,name:"Bitbucket",supported:!1},gitLab:{connect:function(){throw Error("Not implemented.")},Icon:N,name:"GitLab",supported:!1}},R=function(){return(0,r.jsx)(i.hE,{children:(0,k.XP)(T).map(function(e){return(0,r.jsx)(q,{provider:e,sx:{flexBasis:0,flexGrow:1}},e)})})},q=function(e){var n=e.provider,t=e.sx,o=T[n],c=o.connect,s=o.Icon,a=o.name,u=o.supported,d=(0,l.useState)(!1),h=d[0],x=d[1];return(0,r.jsxs)(i.zx,{color:"grey",disabled:!u,loading:h,onClick:function(){(0,S.Z)(function(){var e,n;return(0,b.__generator)(this,function(t){switch(t.label){case 0:x(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,c()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),n="Could not connect to ".concat(a),console.error(n,e),Z.Am.error(n),x(!1),[3,4];case 4:return[2]}})})()},renderStartIcon:function(){return(0,r.jsx)(s,{color:i.TV.color.greyLight11})},sx:t,children:[a,u?void 0:(0,r.jsx)(i.xv,{color:"inherit",variant:"small",children:" (soon)"})]})},P=t(81541),A=function(e){var n=e.date,t=(0,x.Z)(e,["date"]);return(0,r.jsx)(i.xv,(0,h.Z)((0,d.Z)({},t),{color:"inherit",variant:"inherit",children:function(e){var n,t,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return H.format((n=e,t=o,r=D(n),i=D(t),Math.round((+r-+i)/864e5)),"day")}(n)}))},H=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"narrow"});function D(e){var n=new Date(e);return n.setHours(0,0,0,0),n}var E=t(63397),z=t(17064),G=t(19334),M=function(e){var n,t,o,c,s=e.linkRepo,l=e.repo,a=e.trigger,u=T[l.provider],d=(n={git:l},t=(0,z.Z)((0,G.f)(),1)[0],{updateToken:(o=(0,S.Z)(function(e){return(0,b.__generator)(this,function(r){switch(r.label){case 0:return[4,I.j.git.updateWriteAPIToken({prismic:{domain:t.repositoryName},git:n.git,token:e})];case 1:return r.sent(),[2]}})}),function(e){return o.apply(this,arguments)})}).updateToken;return(0,r.jsxs)(i.Vq,{size:{width:448,height:"auto"},trigger:a,children:[(0,r.jsx)(i.fK,{title:"Prismic Write API token required"}),(0,r.jsx)(i.cZ,{children:(0,r.jsx)(E.J9,{initialValues:{writeAPIToken:""},validate:function(e){if(0===e.writeAPIToken.length)return{writeAPIToken:"Cannot be empty"}},onSubmit:(c=(0,S.Z)(function(e){var n,t;return(0,b.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,s(l)];case 1:return r.sent(),[4,d(e.writeAPIToken)];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),t="Could not connect to ".concat(l.name),console.error(t,n),Z.Am.error(t),[3,4];case 4:return[2]}})}),function(e){return c.apply(this,arguments)}),children:function(e){return(0,r.jsxs)("form",{onSubmit:e.handleSubmit,children:[(0,r.jsxs)(i.xu,{flexDirection:"column",gap:4,padding:16,children:[(0,r.jsx)(i.yt,{disabled:e.isSubmitting,error:"string"==typeof e.errors.writeAPIToken,label:"Paste your Write API token",onValueChange:function(n){e.setFieldValue("writeAPIToken",n)},placeholder:"Write API token",size:"large",value:e.values.writeAPIToken}),(0,r.jsxs)(i.xv,{color:"grey11",children:["Required to sync models from ",u.name," to Prismic."]})]}),(0,r.jsx)(i.kX,{cancel:{text:"Cancel"},ok:{disabled:!e.isValid,loading:e.isSubmitting,onClick:function(){e.submitForm()},text:"Save Token"},size:"medium"})]})}})})]})},V=function(e){var n=e.repo,t=e.trigger,o=e.unlinkRepo,c=(0,l.useState)(!1),s=c[0],a=c[1];return(0,r.jsxs)(i.Vq,{size:{width:448,height:"auto"},trigger:t,children:[(0,r.jsx)(i.fK,{title:"Remove Git Connection"}),(0,r.jsx)(i.cZ,{children:(0,r.jsx)(i.xu,{flexDirection:"column",padding:16,children:(0,r.jsx)(i.xv,{children:"You will not be able to push your code alongside your models anymore. Note that you can reconnect your Git repository at any time. Are you sure you want to continue?"})})}),(0,r.jsx)(i.kX,{asFooter:!0,cancel:{text:"Cancel"},ok:{color:"tomato",loading:s,onClick:function(){(0,S.Z)(function(){var e,t;return(0,b.__generator)(this,function(r){switch(r.label){case 0:a(!0),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,o(n)];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),t="Could not disconnect from ".concat(n.name),console.error(t,e),Z.Am.error(t),[3,4];case 4:return a(!1),[2]}})})()},text:"Disconnect"},size:"medium"})]})},B=t(17329);function O(){var e,n,t=(0,z.Z)((0,G.f)(),1)[0];return{linkedGitRepos:(0,B.QT)(W,[t.repositoryName]),linkRepo:(e=(0,S.Z)(function(e){return(0,b.__generator)(this,function(n){switch(n.label){case 0:return[4,I.j.git.linkRepo({prismic:{domain:t.repositoryName},git:e})];case 1:return n.sent(),[4,(0,B.gw)(W,[t.repositoryName])];case 2:return n.sent(),[2]}})}),function(n){return e.apply(this,arguments)}),unlinkRepo:(n=(0,S.Z)(function(e){return(0,b.__generator)(this,function(n){switch(n.label){case 0:return[4,I.j.git.unlinkRepo({prismic:{domain:t.repositoryName},git:e})];case 1:return n.sent(),[4,(0,B.gw)(W,[t.repositoryName])];case 2:return n.sent(),[2]}})}),function(e){return n.apply(this,arguments)})}}function W(e){return Q.apply(this,arguments)}function Q(){return(Q=(0,S.Z)(function(e){return(0,b.__generator)(this,function(n){switch(n.label){case 0:return[4,I.j.git.fetchLinkedRepos({prismic:{domain:e}})];case 1:return[2,n.sent()]}})})).apply(this,arguments)}var K=function(e){var n=e.mode,t=e.repos,o=O(),c=o.linkRepo,s=o.unlinkRepo;return(0,r.jsx)(v,{children:"link"===n?t.map(function(e){return(0,r.jsxs)(w,{action:(0,r.jsx)(M,{linkRepo:c,repo:e,trigger:(0,r.jsx)(i.zx,{color:"grey",children:"Connect"})}),children:[e.name,(0,r.jsxs)(i.xv,{color:"grey11",children:[" • ",(0,r.jsx)(A,{date:e.pushedAt})]})]},"".concat(e.provider,"@").concat(e.id))}):t.map(function(e){return(0,r.jsx)(w,{action:(0,r.jsx)(V,{repo:e,trigger:(0,r.jsx)(i.zx,{color:"grey",children:"Disconnect"}),unlinkRepo:s}),children:e.name},"".concat(e.provider,"@").concat(e.owner,"/").concat(e.name))})})},X=function(){return(0,r.jsx)(v,{children:(0,P.Z)([,,,,].keys()).map(function(e){return(0,r.jsx)(w,{action:(0,r.jsx)(i.Od,{height:32,width:67.59}),children:(0,r.jsx)(i.Od,{height:24,sx:{verticalAlign:"middle"},width:129.92})},e)})})},U=function(e){var n=e.disabled,t=e.owners,o=void 0===t?[]:t,c=e.selectedOwner,s=e.onSelectedOwnerChange,l=e.sx;return(0,r.jsx)(i.Ph,{color:"grey",constrainContentWidth:!0,disabled:n,flexContent:!0,onValueChange:function(e){var n,t=(0,z.Z)((n=e,n.split("@")),2),r=t[0],i=t[1],c=o.find(function(e){return e.provider===r&&e.id===i});c&&(null==s||s(c))},placeholder:"Owner",renderStartIcon:function(){return(0,r.jsx)(J,{owner:c})},size:"large",sx:l,value:c?Y(c):void 0,children:o.map(function(e){return(0,r.jsx)(i.Ql,{renderStartIcon:function(){return(0,r.jsx)(J,{owner:e})},size:"large",value:Y(e),children:e.name},Y(e))})})},J=function(e){var n,t=e.owner,o=T[null!==(n=null==t?void 0:t.provider)&&void 0!==n?n:"gitHub"].Icon;return(0,r.jsx)(o,{color:i.TV.color.greyLight11})};function Y(e){return"".concat(e.provider,"@").concat(e.id)}function $(e,n,t,r){return ee.apply(this,arguments)}function ee(){return(ee=(0,S.Z)(function(e,n,t,r){return(0,b.__generator)(this,function(i){switch(i.label){case 0:return[4,I.j.git.fetchRepos({provider:e,owner:n,query:t,page:r})];case 1:return[2,i.sent()]}})})).apply(this,arguments)}var en=function(e){var n=e.owners,t=(0,l.useState)(n[0]),i=t[0],o=t[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m,{children:(0,r.jsx)(U,{owners:n,selectedOwner:i,onSelectedOwnerChange:o,sx:{width:"calc(50% - 8px)"}})}),(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(er,{gitOwnerSelect:!1}),children:(0,r.jsx)(et,{owner:i})})]})},et=function(e){var n,t=e.owner,i=(n={provider:t.provider,owner:t.name},(0,B.QT)($,[n.provider,n.owner,n.query,n.page,]));return i.length>0?(0,r.jsx)(K,{mode:"link",repos:i}):(0,r.jsx)(j,{children:(0,r.jsx)(C,{title:"No Results Found",description:"Try selecting a different Git account or organization on the top left."})})},er=function(e){var n=e.gitOwnerSelect;return(0,r.jsxs)(r.Fragment,{children:[n?(0,r.jsx)(m,{children:(0,r.jsx)(U,{disabled:!0,sx:{width:"calc(50% - 8px)"}})}):void 0,(0,r.jsx)(X,{})]})};function ei(){return eo.apply(this,arguments)}function eo(){return(eo=(0,S.Z)(function(){return(0,b.__generator)(this,function(e){switch(e.label){case 0:return[4,I.j.git.fetchOwners()];case 1:return[2,e.sent()]}})})).apply(this,arguments)}function ec(){return es.apply(this,arguments)}function es(){return(es=(0,S.Z)(function(){var e;return(0,b.__generator)(this,function(e){switch(e.label){case 0:return[4,I.j.user.checkIsLoggedIn()];case 1:return[2,{isLoggedIn:e.sent()}]}})})).apply(this,arguments)}var el=t(90374),ea=function(){return(0,r.jsxs)(_,{children:[(0,r.jsx)(g,{children:"Connected Git Repository"}),(0,r.jsx)(i.SV,{renderError:ex,children:(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(er,{gitOwnerSelect:!0}),children:(0,r.jsx)(eu,{})})}),(0,r.jsx)(y,{action:(0,r.jsx)(i.u,{content:"Documentation is coming soon.",side:"bottom",children:(0,r.jsx)(i.hU,{disabled:!0,icon:"openInNew"})}),children:"Learn more about Prismic for Git"})]})},eu=function(){return(0,B.QT)(ec,[]).isLoggedIn?(0,r.jsx)(ed,{}):(0,r.jsx)(ef,{})},ed=function(){var e=O().linkedGitRepos;return e.length>0?(0,r.jsx)(K,{mode:"unlink",repos:e}):(0,r.jsx)(eh,{})},eh=function(){var e=(0,B.QT)(ei,[]);return e.length>0?(0,r.jsx)(en,{owners:e}):(0,r.jsx)(j,{children:(0,r.jsx)(R,{})})};function ex(e,n){return(0,u.TW)(e)?(0,r.jsx)(ep,{}):(0,r.jsx)(e_,{reset:n})}var ef=function(){var e=(0,el.Z)().openLoginModal;return(0,r.jsx)(j,{children:(0,r.jsx)(C,{title:"It seems like you are logged out",description:"Log in to connect a Git repository.",action:(0,r.jsx)(i.zx,{onClick:e,children:"Log in to Prismic"})})})},ep=function(){return(0,r.jsx)(j,{children:(0,r.jsx)(C,{title:"It seems like you do not have permission",description:"An owner or admin is required to connect a Git repository."})})},e_=function(e){var n=e.reset;return(0,r.jsx)(j,{children:(0,r.jsx)(C,{title:"Unable to fetch data",description:"An error occurred while fetching the list of connected Git repositories.",action:(0,r.jsx)(i.zx,{color:"grey",onClick:n,children:"Retry"})})})},eg=t(80299),em=function(){var e=(0,eg.M)(),n=(0,s.useRouter)();return((0,l.useEffect)(function(){e.eligible||n.replace("/")},[e.eligible,n]),e.eligible)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c(),{children:(0,r.jsx)("title",{children:"Settings - Slice Machine"})}),(0,r.jsxs)(a.LN,{children:[(0,r.jsx)(a.wd,{children:(0,r.jsx)(a.Cx,{folder:"Settings"})}),(0,r.jsx)(a.RN,{children:(0,r.jsx)(i.xu,{flexDirection:"column",maxWidth:600,children:(0,r.jsx)(ea,{})})})]})]}):null}},19334:function(e,n,t){"use strict";t.d(n,{f:function(){return s}});var r=t(22710),i=t(99267),o=t(17329),c=t(81038);function s(){var e,n=(0,o.QT)(l,[]),t=(e=(0,r.Z)(function(e){return(0,i.__generator)(this,function(n){switch(n.label){case 0:return[4,c.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,o.VA)(l,[],e),[2]}})}),function(n){return e.apply(this,arguments)});return[n,t]}function l(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(function(){return(0,i.__generator)(this,function(e){return[2,c.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}},88921:function(e){e.exports={flex:"FieldSet_flex__qy2tm",column:"FieldSet_column__NS4qQ FieldSet_flex__qy2tm",root:"FieldSet_root__XVbMv FieldSet_column__NS4qQ FieldSet_flex__qy2tm",row:"FieldSet_row__END9k FieldSet_flex__qy2tm",borderBottom:"FieldSet_borderBottom__L01vK",legend:"FieldSet_legend__JjRCM FieldSet_row__END9k FieldSet_flex__qy2tm FieldSet_borderBottom__L01vK",header:"FieldSet_header__0Q7YD FieldSet_row__END9k FieldSet_flex__qy2tm FieldSet_borderBottom__L01vK",content:"FieldSet_content__PDj3t FieldSet_column__NS4qQ FieldSet_flex__qy2tm",list:"FieldSet_list__HoMpl FieldSet_column__NS4qQ FieldSet_flex__qy2tm",listItem:"FieldSet_listItem__P0SKW FieldSet_row__END9k FieldSet_flex__qy2tm FieldSet_borderBottom__L01vK",listItemText:"FieldSet_listItemText__J0_Fr",borderTop:"FieldSet_borderTop__qyC9U",footer:"FieldSet_footer__thBWh FieldSet_row__END9k FieldSet_flex__qy2tm FieldSet_borderTop__qyC9U",footerText:"FieldSet_footerText__mKIv2"}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=24994)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33],{30755:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return t(23261)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322),c=t(2784),a=t(75289),l=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,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,x=e.form,f=e.isLoading,h=void 0!==f&&f,p=e.disabled,v=e.onClick,m=e.sx,g=e.iconSize,b=void 0===g?16:g,C=e.iconFill,j=e.variant,S=void 0===j?"primary":j,k=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(a.zx,(0,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.Z)({},void 0===m?{}:m),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),h?{cursor:"wait !important"}:{}),type:d,form:x,disabled:void 0!==p&&p||h,onClick:h?void 0:v,variant:S},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(S),"data-cy":l(k["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-cy":l(k["data-cy"],"icon")}),t]})}))})},54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322);t(2784);var c=t(75289),a=function(e){var n=e.bg,t=e.background,i=e.sx,o=e.withRadius,a=e.radius,l=e.children;return(0,s.jsx)(c.xu,{sx:(0,r.Z)({p:4,bg:n||t},o?{borderBottomLeftRadius:a,borderBottomRightRadius:a}:null,i),children:l})},l=function(e){var n=e.Header,t=void 0===n?null:n,l=e.SubHeader,u=void 0===l?null:l,d=e.Body,x=void 0===d?null:d,f=e.Footer,h=void 0===f?null:f,p=e.borderFooter,v=e.radius,m=void 0===v?"6px":v,g=e.bodySx,b=e.footerSx,C=e.sx,j=e.bg,S=e.background,k=e.children,y=(0,o.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(c.Zb,(0,i.Z)((0,r.Z)({sx:(0,r.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:m},void 0===C?null:C)},y),{children:[t?(0,s.jsx)(t,{radius:m}):null,u?(0,s.jsx)(u,{radius:m}):null,(0,s.jsxs)(a,{bg:j,background:S,sx:void 0===g?{}:g,withRadius:!h,children:[x?(0,s.jsx)(x,{}):null,k||null]}),h?(0,s.jsx)(a,{bg:j,background:S,sx:(0,r.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===b?{}:b),radius:m,withRadius:!0,children:"object"==typeof h?h:(0,s.jsx)(h,{})}):null]}))}},61931:function(e,n,t){"use strict";t.d(n,{q:function(){return l}});var r=t(62230),i=t(52322),o=t(2784),s=t(75289),c=t(65186),a=(0,o.memo)(function(e){var n=e.src;return(0,i.jsx)(s.Ee,{src:n,alt:"Preview image",sx:{maxHeight:"100%"}})}),l=function(e){var n=e.src,t=e.sx;return(0,i.jsx)(s.kC,{sx:(0,r.Z)({position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px"},t),children:void 0!==n?(0,i.jsx)(a,{src:n}):(0,i.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(c.eJU,{}),"You have no screenshot yet."]})})}},23261:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ej}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(5632),d=t.n(u),x=t(62230),f=t(85244),h=t(2784),p=t(71463),v=t(22715),m=t(75289),g=t(65077),b=t(56577),C=t(19909),j=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(m.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,c.jsxs)(m.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(m.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(S,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},S=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(m.xu,{sx:{px:3,py:2,color:t?"primary":"",cursor:"pointer",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(t?null==n?void 0:n.primary:null==n?void 0:n.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(null==n?void 0:n.primary)}}},onClick:function(){return r(n)},children:n.name})},k=t(75100),y=function(e){var n=e.buttonSx,t=e.defaultValue,r=e.variations,i=e.onNewVariation,o=e.onChange,s=e.sx,a=e.disabled,l=(0,h.useState)(!1),u=l[0],d=l[1],f=(0,h.useState)(t||r[0]),p=f[0],v=f[1];(0,h.useEffect)(function(){t&&v(t)},[t]);var g=function(e){d(!1),v(e),setTimeout(function(){return o(e)},210)},b=(0,c.jsx)(m.xu,{sx:{p:2},children:(0,c.jsx)(m.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){d(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(m.xu,{sx:s,children:(0,c.jsx)(C.Popover,{align:"start",isOpen:u,onClickOutside:function(){return d(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(j,{defaultValue:p,variations:r,onChange:g,MenuItemAction:i?b:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(m.zx,{sx:(0,x.Z)({},n),variant:"dropDownButton",onClick:function(){return d(!u)},disabled:a,children:[p.name," ",u?(0,c.jsx)(k.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(k.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},E=function(e){return(0,c.jsxs)("svg",(0,f.Z)((0,x.Z)({viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3304 19.693C50.9182 18.9787 50.2527 18.6526 50.2527 18.6526L64.7906 10.2077C65.5266 9.78011 66.4679 10.0339 66.8929 10.7745C67.3179 11.5151 67.0657 12.4622 66.3294 12.8898L52.639 20.8424C52.639 20.8424 51.7428 20.4072 51.3304 19.693Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.6775 54.7814C58.0794 48.7394 61.6433 35.3572 55.6378 24.8917C54.7801 23.397 53.7736 22.0427 52.6481 20.8367L32.9428 32.2832C32.2068 32.7108 31.2655 32.457 30.8405 31.7165C30.4155 30.9757 30.6677 30.0287 31.4039 29.6011L50.2693 18.6425C43.486 13.2668 33.8645 12.2736 25.9299 16.8827C15.5282 22.9249 11.9642 36.3071 17.9697 46.7727C18.8274 48.2671 19.8339 49.6216 20.9595 50.8276L41.1791 39.0822C41.9151 38.6546 42.8564 38.9086 43.2814 39.6492C43.7064 40.3897 43.4542 41.3368 42.7182 41.7644L23.3384 53.0217C30.1217 58.3975 39.7432 59.3906 47.6775 54.7814Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.20645 61.7656C4.78145 61.0248 5.03367 60.078 5.76978 59.6502L20.9371 50.8398C20.9371 50.8398 21.8578 51.2406 22.3053 51.7062C22.7528 52.1717 23.361 53.0078 23.361 53.0078L7.30887 62.3323C6.57274 62.7599 5.63144 62.5061 5.20645 61.7656Z",fill:"current"})]}))},w=t(56580),I=t(52039),_=function(e,n,t){if(!n){d().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,x,f=(i=(r={lib:e.href,sliceName:e.model.name,variationId:null==n?void 0:n.id,isSimulator:t}).lib,o=r.sliceName,s=r.variationId,a=void 0===(c=r.options)?{}:c,l=r.isSimulator,u="/slices/[lib]/[sliceName]/[variation]".concat(l?"/simulator":""),x="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:x,options:a,all:[u,x,a]});d().push(f.href,f.as,f.options)},D=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=(0,w.v9)(function(e){return{savingMock:(0,I.S3)(e)}}).savingMock;return(0,c.jsxs)(m.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(m.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(E,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(m.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(y,{defaultValue:t,variations:n.model.variations,onChange:function(e){return _(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(m.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(m.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(m.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(m.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(m.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(b.z,{"data-cy":"save-mock",onClick:o,label:"Save mock content",disabled:a||s,variant:"primary",sx:{borderRadius:"6px",color:"#F1EEFE",fontWeight:"bold",border:"1px solid #5842C3",backgroundColor:"#6E56CF",boxShadow:"0px 1px 0px rgba(0, 0, 0, 0.04)","&:hover":{"&:not([disabled])":{backgroundColor:"#5842C3"}}}})]})]})},Z=t(82770),R=t(39092),F=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(m.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,c.jsx)(m.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(z,{value:e,isActive:e===n,onClick:r})})})})},z=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(m.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},T=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,h.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(m.xu,{children:(0,c.jsx)(C.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(F,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(m.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(k.bOz,{size:"24px"}):(0,c.jsx)(k.mEq,{size:"24px"})]})})})},N=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var O=(i={},(0,N.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,N.Z)(i,r.TABLET,{width:1080,height:810}),(0,N.Z)(i,r.MOBILE,{width:390,height:844}),i),A=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(m.kC,{sx:(0,x.Z)({alignItems:"center"},i),children:[(0,c.jsx)(m.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:"6px 0px 0px 6px",width:26,height:30,color:"greyIcon",fontWeight:"bold",fontSize:"14px",alignItems:"center",justifyContent:"center",position:"absolute",ml:"1px"},htmlFor:"".concat(n,"-screensize-input"),children:n}),(0,c.jsx)(m.II,{type:"number",name:"".concat(n,"-screensize-input"),disabled:o,sx:{width:80,height:32,p:0,border:"1px solid #E4E2E4",borderRadius:"6px","&::-webkit-outer-spin-button,&::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},color:"greyIcon",textAlign:"center",paddingLeft:26,"&:disabled":{cursor:"not-allowed","&:hover":{border:"1px solid #E4E2E4"},"&:active":{border:"1px solid #E4E2E4",boxShadow:"none"}}},onChange:r,value:t,min:"0",onKeyDown:function(e){s.includes(e.key)&&e.preventDefault()}})]})},L=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,h.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(O[e])},u=function(e){var t=Object.values(O).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(O)[t];a(i),n(e)};return(0,c.jsx)(m.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(m.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(T,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(A,{label:"W",startValue:t.width.toString(),onChange:function(e){u((0,f.Z)((0,x.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(k.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(A,{label:"H",startValue:t.height.toString(),onChange:function(e){u((0,f.Z)((0,x.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},M=t(25812),U=t(77174),P=t(24340),B=t(90374),W=t(54132),H=t(61931),V=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,w.v9)(function(e){return{isScreenshotModalOpen:(0,U.gP)(e,P.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,B.Z)().closeModals;return(0,c.jsx)(M.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(W.Z,{radius:"0px",bodySx:{p:0,bg:"#FFF",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},Header:function(){return(0,c.jsxs)(m.kC,{sx:{position:"sticky",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,c.jsxs)(m.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(m.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(m.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(m.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(H.q,{src:t,sx:{height:"320px"}})})})},q=t(25242),X=t(81541),G=function(e,n,t){var r=(0,h.useState)(e()),i=r[0],o=r[1],s=(0,h.useRef)(Date.now());return(0,h.useEffect)(function(){var t=setTimeout(function(){Date.now()-s.current>=n&&(o(e()),s.current=Date.now())},n-(Date.now()-s.current));return function(){clearTimeout(t)}},[n].concat((0,X.Z)(t))),i},K=t(22710),Y=t(17064),J=t(99267),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,u=e.screenDimensions,d=e.simulatorUrl,f=e.dryRun,p=e.isScreenshot,v=void 0!==p&&p,g=(0,Y.Z)((t=(n=(0,h.useState)())[0],r=n[1],i=(0,h.useRef)(),o=(0,h.useRef)(),a=(0,h.useCallback)((s=(0,K.Z)(function(e){var n,t,s,c;return(0,J.__generator)(this,function(a){switch(a.label){case 0:if(null===(n=i.current)||void 0===n||n.disconnect(),null===(t=o.current)||void 0===t||t.disconnect(),r(void 0),!(null!=e))return[3,4];i.current=new Q.SH(e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.current.connect()];case 2:var l;return a.sent(),r(i.current),l=(0,K.Z)(function(){var e;return(0,J.__generator)(this,function(n){switch(n.label){case 0:return r(void 0),[4,null===(e=i.current)||void 0===e?void 0:e.connect({},!0)];case 1:return n.sent(),r(i.current),[2]}})}),s=function(){return l.apply(this,arguments)},o.current=new MutationObserver(function(e){e.forEach(function(e){"src"===e.attributeName&&s().catch(function(e){throw e})})}),o.current.observe(e,{attributeFilter:["src"]}),[3,4];case 3:return c=a.sent(),console.error(c),[3,4];case 4:return[2]}})}),function(e){return s.apply(this,arguments)}),[]),[t,a]),2),b=g[0],C=g[1],j=(0,B.Z)(),S=j.connectToSimulatorSuccess,k=j.connectToSimulatorFailure;(0,h.useEffect)(function(){var e;if(!d){k();return}if(void 0!==b){if(!b.connected){k(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,K.Z)(function(){return(0,J.__generator)(this,function(e){switch(e.label){case 0:return[4,b.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){S()}).catch(function(){k()})}},[b,l,d]);var y,E,w,I,_,D,Z,R,F,z=(0,h.useState)(),T=z[0],N=z[1],O=(y=function(e){var n;N({height:e.blockSize,width:e.inlineSize})},w=(0,h.useRef)(),(0,h.useCallback)(function(e){var n;null===(n=w.current)||void 0===n||n.disconnect(),null!==e&&(w.current=new ResizeObserver(function(n){var t,r=(0,Y.Z)(n,1)[0].contentRect;y({blockSize:r.height,inlineSize:r.width},e)}),w.current.observe(e))},[]));return(0,c.jsx)(m.kC,{ref:O,sx:(0,x.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:v?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:v?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==f&&f?{display:"none"}:{}),children:d?(0,c.jsx)("iframe",{ref:C,src:d,style:(0,x.Z)({border:"none",maxHeight:"".concat(u.height,"px"),maxWidth:"".concat(u.width,"px"),minHeight:"".concat(u.height,"px"),minWidth:"".concat(u.width,"px"),overflowY:"auto"},T?{transform:"scale(".concat((I=u,_=T,D=I.height,Z=I.width,R=_.height,F=_.width,Z>F||D>R?Z-F>D-R?F/Z:R/D:1),")")}:{display:"none"})}):null})},ee=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(m.kC,{sx:(0,x.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(m.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},en=t(85819),et=function(e){var n=e.onRetrigger;return(0,c.jsxs)(ee,{children:[(0,c.jsx)(m.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(m.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(m.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,c.jsx)("br",{}),(0,c.jsx)(m.xv,{as:"code",variant:"styles.inlineCode",sx:{padding:"4px",borderRadius:"6px"},children:"npm run dev"}),"\xa0 in your terminal at the root of your website directory.",(0,c.jsx)("br",{})," If that doesn't work, see the\xa0",(0,c.jsx)(m.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(b.z,{onClick:n,label:"Refresh",Icon:en.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},er=t(98240),ei=t(92928),eo=t(33402),es=t(59326),ec=t(86741),ea=t(65186),el=function(e){var n=e.children;return(0,c.jsx)(m.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},eu=function(e){var n,t=e.children,r=(0,er.Z)(e,["children"]),i=(0,es.B7)().theme,o=(0,h.useState)(!1),s=o[0],a=o[1],l=(0,h.useRef)(null),u=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(m.xu,(0,f.Z)((0,x.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(m.kC,{sx:{px:"26px",py:"22px",color:"#FFF",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(111, 110, 119, 0.2)"},children:[(0,c.jsx)(m.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(m.zx,{onClick:u,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(ea.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(ea.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(m.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ed={code:function(e){var n=e.children;return(0,c.jsx)(el,{children:n})},pre:function(e){var n=e.children,t=(0,er.Z)(e,["children"]);return(0,c.jsx)(eu,(0,f.Z)((0,x.Z)({},t),{children:n}))}},ex=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,eo.Z)(e,ec.W_)&&e.attribs){var n=(0,ec.du)(e.children,i),t=(0,x.Z)({},r,ed)[e.name];if(t)return(0,c.jsx)(t,(0,f.Z)((0,x.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,ec.ZP)(n,i)})},ef=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(el,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},eh=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,er.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(ei.OK,(0,f.Z)((0,x.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(m.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(ev,{number:n}),(0,c.jsxs)(m.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(m.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ef,{children:t})}),r&&(0,c.jsx)(m.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ef,{children:r})})]})]})}))};eh.tabsRole="Tab";var ep,ev=function(e){var n=e.number;return(0,c.jsx)(m.kC,{sx:{height:"32px",width:"32px",alignItems:"center",justifyContent:"center",border:"1px solid #E4E2E4",borderRadius:"6px",bg:"grey07",color:"textClear",flexShrink:"0",fontSize:"13px"},children:n})},em=function(e){var n=e.isOpen,t=(0,w.v9)(function(e){return{isSimulatorAvailableForFramework:(0,R.Ql)(e),setupSteps:(0,I.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,h.useEffect)(function(){n&&Z.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(M.Z,{isOpen:n,children:(0,c.jsx)(W.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(m.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"grey07",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:(0,c.jsx)(m.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(ei.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(ei.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(eh,{number:n+1,title:e.title,excerpt:e.description},e.title)})}),r?(0,c.jsx)(c.Fragment,{children:i.map(function(e){return(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(ex,{html:e.body})},e.title)})}):(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eg=t(53559);(ep=o||(o={})).LOADING_SETUP="LOADING_SETUP",ep.LOADING_IFRAME="LOADING_IFRAME",ep.FAILED_SETUP="FAILED_SETUP",ep.FAILED_CONNECT="FAILED_CONNECT",ep.SUCCESS="SUCCESS";var eb=function(e){var n,t,i=e.slice,s=e.variation,a=(0,B.Z)(),l=a.checkSimulatorSetup,u=a.connectToSimulatorIframe,d=a.saveSliceMock,b=(0,w.v9)(function(e){return{simulatorUrl:(0,R.x0)(e),iframeStatus:(0,I.NL)(e),manifestStatus:(0,I.tD)(e).manifest,isWaitingForIFrameCheck:(0,I.oM)(e),endpoints:(0,R.gZ)(e)}}),C=b.simulatorUrl,j=b.iframeStatus,S=b.manifestStatus,k=b.isWaitingForIFrameCheck,y=b.endpoints,E=(0,h.useMemo)(function(){return{embedsUrl:y.PrismicOembed,env:"prod",unsplashUrl:y.PrismicUnsplash}},[y.PrismicOembed,y.PrismicUnsplash]),_=(0,h.useRef)(null),F=(0,h.useCallback)(function(){return l()},[]);(0,h.useEffect)(function(){l(),Z.Xe.track({event:"slice-simulator:open"})},[]);var z=(0,h.useRef)(!1);(0,h.useEffect)(function(){z.current=!0},[]);var T=function(e){z.current&&(z.current=!1,Z.Xe.track({event:"editor:widget-used",sliceId:e}))},N="ko"===S?o.FAILED_SETUP:"ok"===S?k||!j?o.LOADING_IFRAME:"ok"!==j?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,h.useEffect)(function(){if(N===o.FAILED_SETUP&&!_.current){var e=setInterval(function(){F()},3e3);_.current=e}},[N]),(0,h.useEffect)(function(){"ok"===S&&(_.current&&clearInterval(_.current),u())},[S]),(0,h.useEffect)(function(){N===o.FAILED_CONNECT&&Z.Xe.track({event:"slice-simulator:is-not-running"})},[N]),(0,h.useEffect)(function(){N===o.SUCCESS&&eo(!0)},[N]);var A=function(){u()},M=(0,h.useState)(O[r.DESKTOP]),U=M[0],P=M[1],W=(0,h.useMemo)(function(){return eg.id.fromSM(i.model)},[i.model]),H=(0,h.useState)(null),X=H[0],K=H[1],Y=(0,h.useMemo)(function(){var e,n;return(null==X?void 0:X.variation)===s.id?X:(null===(e=i.mocks)||void 0===e?void 0:e.find(function(e){return e.variation===s.id}))||{__TYPE__:"SharedSliceContent",variation:n=s.id,primary:{},items:[]}},[X,s.id]),J=(0,h.useMemo)(function(){return(0,q.renderSliceMock)(W,Y).id},[]),Q=(0,h.useCallback)(function(){return function(){return(0,f.Z)((0,x.Z)({},(0,q.renderSliceMock)(W,Y)),{id:J})}},[W,Y]),en=G(Q,800,[W,Y,]),er=(0,h.useState)(!1),ei=er[0],eo=er[1];return(0,c.jsxs)(m.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(em,{isOpen:N===o.FAILED_SETUP}),(0,c.jsx)(D,{slice:i,variation:s,isDisplayEditor:ei,actionsDisabled:N!==o.SUCCESS,toggleIsDisplayEditor:function(){return eo(!ei)},onSaveMock:function(){return X&&d({libraryID:i.from,sliceID:i.model.id,mocks:(i.mocks||[]).filter(function(e){return e.variation!==X.variation}).concat(X)})}}),(0,c.jsx)(m.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(m.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(g.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(L,{handleScreenSizeChange:P,screenDimensions:U,actionsDisabled:N!==o.SUCCESS}),N===o.FAILED_CONNECT?(0,c.jsx)(et,{onRetrigger:A}):null,N===o.SUCCESS?(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C}):(0,c.jsx)(c.Fragment,{children:N===o.LOADING_IFRAME?(0,c.jsxs)(ee,{children:[(0,c.jsx)(m.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C,dryRun:!0})]}):null})]}),N===o.SUCCESS&&ei?(0,c.jsx)(m.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,c.jsx)(v.SV,{renderError:function(){return(0,c.jsx)(v.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(h.Suspense,{children:(0,c.jsx)(p.kS,{config:E,content:Y,onContentChange:function(e){K(e),T(i.model.id)},sharedSlice:W},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(V,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},eC=t(25998);function ej(){var e=(0,u.useRouter)(),n=(0,eC.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsx)("title",{children:"Simulator: ".concat(t.model.name," - Slice Machine")})}),(0,c.jsx)(eb,{slice:t,variation:r})]})}},25998:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var r=t(5632),i=t(56580),o=t(75992),s=function(e,n,t){var r,i=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(function(e){return e.name.replace(/\//g,"--")===n});return null==i?void 0:i.components.find(function(e){return e.model.name===t})},c=function(){var e=(0,r.useRouter)(),n=(0,i.v9)(function(n){return{slice:s(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}:{}}}},function(e){e.O(0,[789,872,851,376,774,888,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[33],{30755:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices/[lib]/[sliceName]/[variation]/simulator",function(){return t(23261)}])},56577:function(e,n,t){"use strict";t.d(n,{z:function(){return d}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322),c=t(2784),a=t(75289),l=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,c.forwardRef)(function(e,n){var t=e.label,c=e.Icon,d=e.type,x=e.form,f=e.isLoading,h=void 0!==f&&f,p=e.disabled,v=e.onClick,m=e.sx,g=e.iconSize,b=void 0===g?16:g,C=e.iconFill,j=e.variant,S=void 0===j?"primary":j,k=(0,o.Z)(e,["label","Icon","type","form","isLoading","disabled","onClick","sx","iconSize","iconFill","variant"]);return(0,s.jsx)(a.zx,(0,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.Z)({},void 0===m?{}:m),{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"}),h?{cursor:"wait !important"}:{}),type:d,form:x,disabled:void 0!==p&&p||h,onClick:h?void 0:v,variant:S},k),{children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.$j,{size:b,color:u(S),"data-cy":l(k["data-cy"],"spinner")}),c&&t]}):(0,s.jsxs)(s.Fragment,{children:[c&&(0,s.jsx)(c,{size:b,fill:C,"data-cy":l(k["data-cy"],"icon")}),t]})}))})},54132:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(62230),i=t(85244),o=t(98240),s=t(52322);t(2784);var c=t(75289),a=function(e){var n=e.bg,t=e.background,i=e.sx,o=e.withRadius,a=e.radius,l=e.children;return(0,s.jsx)(c.xu,{sx:(0,r.Z)({p:4,bg:n||t},o?{borderBottomLeftRadius:a,borderBottomRightRadius:a}:null,i),children:l})},l=function(e){var n=e.Header,t=void 0===n?null:n,l=e.SubHeader,u=void 0===l?null:l,d=e.Body,x=void 0===d?null:d,f=e.Footer,h=void 0===f?null:f,p=e.borderFooter,v=e.radius,m=void 0===v?"6px":v,g=e.bodySx,b=e.footerSx,C=e.sx,j=e.bg,S=e.background,k=e.children,y=(0,o.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(c.Zb,(0,i.Z)((0,r.Z)({sx:(0,r.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:m},void 0===C?null:C)},y),{children:[t?(0,s.jsx)(t,{radius:m}):null,u?(0,s.jsx)(u,{radius:m}):null,(0,s.jsxs)(a,{bg:j,background:S,sx:void 0===g?{}:g,withRadius:!h,children:[x?(0,s.jsx)(x,{}):null,k||null]}),h?(0,s.jsx)(a,{bg:j,background:S,sx:(0,r.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===b?{}:b),radius:m,withRadius:!0,children:"object"==typeof h?h:(0,s.jsx)(h,{})}):null]}))}},61931:function(e,n,t){"use strict";t.d(n,{q:function(){return l}});var r=t(62230),i=t(52322),o=t(2784),s=t(75289),c=t(65186),a=(0,o.memo)(function(e){var n=e.src;return(0,i.jsx)(s.Ee,{src:n,alt:"Preview image",sx:{maxHeight:"100%"}})}),l=function(e){var n=e.src,t=e.sx;return(0,i.jsx)(s.kC,{sx:(0,r.Z)({position:"relative",alignItems:"center",justifyContent:"center",overflow:"hidden",backgroundImage:"url(/pattern.png)",backgroundColor:"headSection",backgroundRepeat:"repeat",backgroundSize:"20px",borderRadius:"4px"},t),children:void 0!==n?(0,i.jsx)(a,{src:n}):(0,i.jsxs)(s.xv,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,i.jsx)(c.eJU,{}),"You have no screenshot yet."]})})}},23261:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return ej}});var r,i,o,s,c=t(52322),a=t(97729),l=t.n(a),u=t(5632),d=t.n(u),x=t(62230),f=t(85244),h=t(2784),p=t(71463),v=t(22715),m=t(75289),g=t(65077),b=t(56577),C=t(19909),j=function(e){var n=e.defaultValue,t=e.variations,r=e.MenuItemAction,i=e.onChange;return(0,c.jsxs)(m.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"4px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:250,maxWidth:350,color:"text"},children:[(0,c.jsxs)(m.xv,{sx:{p:3,fontSize:12,color:"textClear"},children:[t.length," VARIATION",t.length>1?"S":""]}),(0,c.jsxs)(m.kC,{sx:{p:0,flexDirection:"column"},children:[t.map(function(e){return(0,c.jsx)(S,{value:e,isActive:e.id===n.id,onClick:i},e.id)}),r||null]})]})},S=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(m.xu,{sx:{px:3,py:2,color:t?"primary":"",cursor:"pointer",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(t?null==n?void 0:n.primary:null==n?void 0:n.background)},borderRadius:0,bg:"background",":hover":{bg:"hoverBackground",borderLeft:function(e){var n=e.colors;return"2px solid ".concat(null==n?void 0:n.primary)}}},onClick:function(){return r(n)},children:n.name})},k=t(75100),y=function(e){var n=e.buttonSx,t=e.defaultValue,r=e.variations,i=e.onNewVariation,o=e.onChange,s=e.sx,a=e.disabled,l=(0,h.useState)(!1),u=l[0],d=l[1],f=(0,h.useState)(t||r[0]),p=f[0],v=f[1];(0,h.useEffect)(function(){t&&v(t)},[t]);var g=function(e){d(!1),v(e),setTimeout(function(){return o(e)},210)},b=(0,c.jsx)(m.xu,{sx:{p:2},children:(0,c.jsx)(m.zx,{variant:"transparent",sx:{color:"text"},onClick:function(){d(!1),i&&i()},children:"+ Add new variation"})});return(0,c.jsx)(m.xu,{sx:s,children:(0,c.jsx)(C.Popover,{align:"start",isOpen:u,onClickOutside:function(){return d(!1)},positions:["bottom"],padding:10,content:function(){return(0,c.jsx)(j,{defaultValue:p,variations:r,onChange:g,MenuItemAction:i?b:void 0})},containerClassName:"variationSelectorContainer",children:(0,c.jsxs)(m.zx,{sx:(0,x.Z)({},n),variant:"dropDownButton",onClick:function(){return d(!u)},disabled:a,children:[p.name," ",u?(0,c.jsx)(k.bOz,{size:"16px","aria-label":"Collapse variations"}):(0,c.jsx)(k.mEq,{size:"16px","aria-label":"Expand variations"})]})})})},E=function(e){return(0,c.jsxs)("svg",(0,f.Z)((0,x.Z)({viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3304 19.693C50.9182 18.9787 50.2527 18.6526 50.2527 18.6526L64.7906 10.2077C65.5266 9.78011 66.4679 10.0339 66.8929 10.7745C67.3179 11.5151 67.0657 12.4622 66.3294 12.8898L52.639 20.8424C52.639 20.8424 51.7428 20.4072 51.3304 19.693Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M47.6775 54.7814C58.0794 48.7394 61.6433 35.3572 55.6378 24.8917C54.7801 23.397 53.7736 22.0427 52.6481 20.8367L32.9428 32.2832C32.2068 32.7108 31.2655 32.457 30.8405 31.7165C30.4155 30.9757 30.6677 30.0287 31.4039 29.6011L50.2693 18.6425C43.486 13.2668 33.8645 12.2736 25.9299 16.8827C15.5282 22.9249 11.9642 36.3071 17.9697 46.7727C18.8274 48.2671 19.8339 49.6216 20.9595 50.8276L41.1791 39.0822C41.9151 38.6546 42.8564 38.9086 43.2814 39.6492C43.7064 40.3897 43.4542 41.3368 42.7182 41.7644L23.3384 53.0217C30.1217 58.3975 39.7432 59.3906 47.6775 54.7814Z",fill:"current"}),(0,c.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.20645 61.7656C4.78145 61.0248 5.03367 60.078 5.76978 59.6502L20.9371 50.8398C20.9371 50.8398 21.8578 51.2406 22.3053 51.7062C22.7528 52.1717 23.361 53.0078 23.361 53.0078L7.30887 62.3323C6.57274 62.7599 5.63144 62.5061 5.20645 61.7656Z",fill:"current"})]}))},w=t(56580),I=t(52039),_=function(e,n,t){if(!n){d().push("/".concat(e.href,"/").concat(e.model.name));return}var r,i,o,s,c,a,l,u,x,f=(i=(r={lib:e.href,sliceName:e.model.name,variationId:null==n?void 0:n.id,isSimulator:t}).lib,o=r.sliceName,s=r.variationId,a=void 0===(c=r.options)?{}:c,l=r.isSimulator,u="/slices/[lib]/[sliceName]/[variation]".concat(l?"/simulator":""),x="/slices/".concat(i,"/").concat(o,"/").concat(s).concat(l?"/simulator":""),{href:u,as:x,options:a,all:[u,x,a]});d().push(f.href,f.as,f.options)},D=function(e){var n=e.slice,t=e.variation,r=e.isDisplayEditor,i=e.toggleIsDisplayEditor,o=e.onSaveMock,s=e.actionsDisabled,a=(0,w.v9)(function(e){return{savingMock:(0,I.S3)(e)}}).savingMock;return(0,c.jsxs)(m.kC,{sx:{p:"16px",display:"flex",bg:"grey07",gridTemplateRows:"1fr",borderBottom:"1px solid #DCDBDD",justifyContent:"space-between"},children:[(0,c.jsxs)(m.kC,{sx:{alignItems:"center"},children:[(0,c.jsx)(E,{height:"20px",width:"20px",fill:"#1A1523"}),(0,c.jsx)(m.xv,{sx:{ml:2,mr:"12px",fontSize:"14px",color:"#1A1523",fontWeight:"600",letterSpacing:"-0.15px"},children:n.model.name}),(0,c.jsx)(y,{defaultValue:t,variations:n.model.variations,onChange:function(e){return _(n,e,!0)},disabled:n.model.variations.length<=1||s})]}),(0,c.jsxs)(m.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,c.jsx)(m.kC,{sx:{alignItems:"center",justifyContent:"space-around"},children:(0,c.jsxs)(m.kC,{sx:{alignItems:"center",mr:4},children:[(0,c.jsx)(m.__,{htmlFor:"show-mock-editor",sx:{color:"#6F6E77",lineHeight:"16px",fontSize:"12px",fontWeight:"600",letterSpacing:"0px"},children:"Editor"}),(0,c.jsx)(m.rs,{id:"show-mock-editor",checked:r,onChange:i,disabled:s})]})}),(0,c.jsx)(b.z,{"data-cy":"save-mock",onClick:o,label:"Save mock content",disabled:a||s,variant:"primary",sx:{borderRadius:"6px",color:"#F1EEFE",fontWeight:"bold",border:"1px solid #5842C3",backgroundColor:"#6E56CF",boxShadow:"0px 1px 0px rgba(0, 0, 0, 0.04)","&:hover":{"&:not([disabled])":{backgroundColor:"#5842C3"}}}})]})]})},Z=t(82770),R=t(39092),F=function(e){var n=e.defaultValue,t=e.options,r=e.onChange;return(0,c.jsx)(m.xu,{sx:{py:0,flexDirection:"column",backgroundColor:"headSection",overflow:"auto",display:"flex",borderRadius:"6px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},boxShadow:"0 10px 10px rgba(0, 0, 0, 0.05)",maxHeight:340,minWidth:180,maxWidth:350,color:"text"},children:(0,c.jsx)(m.kC,{sx:{p:0,flexDirection:"column"},children:t.map(function(e){return(0,c.jsx)(z,{value:e,isActive:e===n,onClick:r})})})})},z=function(e){var n=e.value,t=e.isActive,r=e.onClick;return(0,c.jsx)(m.xu,{sx:{p:2,cursor:"pointer",fontSize:"14px",borderRadius:0,bg:t?"hoverBackground":"background",":hover":{bg:"hoverBackground"}},onClick:function(){return r(n)},children:n})},T=function(e){var n=e.buttonSx,t=e.currentValue,r=e.options,i=e.onChange,o=e.disabled,s=(0,h.useState)(!1),a=s[0],l=s[1],u=function(e){l(!1),setTimeout(function(){return i(e)},210)};return(0,c.jsx)(m.xu,{children:(0,c.jsx)(C.Popover,{align:"start",isOpen:a,onClickOutside:function(){return l(!1)},positions:["bottom"],padding:2,content:function(){return(0,c.jsx)(F,{defaultValue:t,options:r,onChange:u})},children:(0,c.jsxs)(m.zx,{sx:n,variant:"dropDownButton",onClick:function(){return l(!a)},disabled:o,children:[t," ",a?(0,c.jsx)(k.bOz,{size:"24px"}):(0,c.jsx)(k.mEq,{size:"24px"})]})})})},N=t(67557);(s=r||(r={})).DESKTOP="Desktop",s.TABLET="Tablet",s.MOBILE="Mobile",s.CUSTOM="Custom";var O=(i={},(0,N.Z)(i,r.DESKTOP,{width:1280,height:800}),(0,N.Z)(i,r.TABLET,{width:1080,height:810}),(0,N.Z)(i,r.MOBILE,{width:390,height:844}),i),A=function(e){var n=e.label,t=e.startValue,r=e.onChange,i=e.sx,o=e.disabled,s=["e","-","+",",","."];return(0,c.jsxs)(m.kC,{sx:(0,x.Z)({alignItems:"center"},i),children:[(0,c.jsx)(m.__,{sx:{backgroundColor:"grey07",border:"transparent",borderRight:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:"6px 0px 0px 6px",width:26,height:30,color:"greyIcon",fontWeight:"bold",fontSize:"14px",alignItems:"center",justifyContent:"center",position:"absolute",ml:"1px"},htmlFor:"".concat(n,"-screensize-input"),children:n}),(0,c.jsx)(m.II,{type:"number",name:"".concat(n,"-screensize-input"),disabled:o,sx:{width:80,height:32,p:0,border:"1px solid #E4E2E4",borderRadius:"6px","&::-webkit-outer-spin-button,&::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},color:"greyIcon",textAlign:"center",paddingLeft:26,"&:disabled":{cursor:"not-allowed","&:hover":{border:"1px solid #E4E2E4"},"&:active":{border:"1px solid #E4E2E4",boxShadow:"none"}}},onChange:r,value:t,min:"0",onKeyDown:function(e){s.includes(e.key)&&e.preventDefault()}})]})},L=function(e){var n=e.handleScreenSizeChange,t=e.screenDimensions,i=e.actionsDisabled,o=(0,h.useState)(r.DESKTOP),s=o[0],a=o[1],l=function(e){a(e),e!==r.CUSTOM&&n(O[e])},u=function(e){var t=Object.values(O).findIndex(function(n){return JSON.stringify(n)===JSON.stringify(e)}),i=t<0?r.CUSTOM:Object.keys(O)[t];a(i),n(e)};return(0,c.jsx)(m.kC,{sx:{alignItems:"center",pb:"16px",justifyContent:"space-between",variant:"small"},children:(0,c.jsxs)(m.kC,{sx:{alignItems:"center",flex:1},children:[(0,c.jsx)(T,{options:Object.values(r),onChange:l,buttonSx:{alignSelf:"start"},currentValue:s,disabled:i}),(0,c.jsx)(A,{label:"W",startValue:t.width.toString(),onChange:function(e){u((0,f.Z)((0,x.Z)({},t),{width:Number(e.target.value)}))},disabled:i,sx:{mx:2}}),(0,c.jsx)(k.eSQ,{size:16,color:"#6F6E77"}),(0,c.jsx)(A,{label:"H",startValue:t.height.toString(),onChange:function(e){u((0,f.Z)((0,x.Z)({},t),{height:Number(e.target.value)}))},disabled:i,sx:{ml:2}})]})})},M=t(25812),U=t(77174),P=t(24340),B=t(90374),W=t(54132),H=t(61931),V=function(e){var n=e.sliceName,t=e.screenshotUrl,r=(0,w.v9)(function(e){return{isScreenshotModalOpen:(0,U.gP)(e,P.q.SCREENSHOT_PREVIEW)}}).isScreenshotModalOpen,i=(0,B.Z)().closeModals;return(0,c.jsx)(M.Z,{isOpen:r,shouldCloseOnOverlayClick:!0,contentLabel:"Screenshot Preview",portalClassName:"ScreenshotPreviewModal",onRequestClose:i,children:(0,c.jsx)(W.Z,{radius:"0px",bodySx:{p:0,bg:"#FFF",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},Header:function(){return(0,c.jsxs)(m.kC,{sx:{position:"sticky",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,c.jsxs)(m.X6,{sx:{fontSize:"14px"},children:["Screenshot Preview for ",n]}),(0,c.jsx)(m.x8,{type:"button",onClick:function(){return i()}})]})},Footer:function(){return(0,c.jsx)(m.kC,{style:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:"1px solid #DCDBDD"},children:(0,c.jsx)(m.zx,{variant:"secondary",sx:{fontWeight:600},onClick:function(){return i()},children:"Close"})})},children:(0,c.jsx)(H.q,{src:t,sx:{height:"320px"}})})})},q=t(25242),X=t(81541),G=function(e,n,t){var r=(0,h.useState)(e()),i=r[0],o=r[1],s=(0,h.useRef)(Date.now());return(0,h.useEffect)(function(){var t=setTimeout(function(){Date.now()-s.current>=n&&(o(e()),s.current=Date.now())},n-(Date.now()-s.current));return function(){clearTimeout(t)}},[n].concat((0,X.Z)(t))),i},K=t(22710),Y=t(17064),J=t(99267),Q=t(16),$=function(e){var n,t,r,i,o,s,a,l=e.apiContent,u=e.screenDimensions,d=e.simulatorUrl,f=e.dryRun,p=e.isScreenshot,v=void 0!==p&&p,g=(0,Y.Z)((t=(n=(0,h.useState)())[0],r=n[1],i=(0,h.useRef)(),o=(0,h.useRef)(),a=(0,h.useCallback)((s=(0,K.Z)(function(e){var n,t,s,c;return(0,J.__generator)(this,function(a){switch(a.label){case 0:if(null===(n=i.current)||void 0===n||n.disconnect(),null===(t=o.current)||void 0===t||t.disconnect(),r(void 0),!(null!=e))return[3,4];i.current=new Q.SH(e),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.current.connect()];case 2:var l;return a.sent(),r(i.current),l=(0,K.Z)(function(){var e;return(0,J.__generator)(this,function(n){switch(n.label){case 0:return r(void 0),[4,null===(e=i.current)||void 0===e?void 0:e.connect({},!0)];case 1:return n.sent(),r(i.current),[2]}})}),s=function(){return l.apply(this,arguments)},o.current=new MutationObserver(function(e){e.forEach(function(e){"src"===e.attributeName&&s().catch(function(e){throw e})})}),o.current.observe(e,{attributeFilter:["src"]}),[3,4];case 3:return c=a.sent(),console.error(c),[3,4];case 4:return[2]}})}),function(e){return s.apply(this,arguments)}),[]),[t,a]),2),b=g[0],C=g[1],j=(0,B.Z)(),S=j.connectToSimulatorSuccess,k=j.connectToSimulatorFailure;(0,h.useEffect)(function(){var e;if(!d){k();return}if(void 0!==b){if(!b.connected){k(),console.warn("Trying to use a disconnected simulator client.");return}(e=(0,K.Z)(function(){return(0,J.__generator)(this,function(e){switch(e.label){case 0:return[4,b.setSliceZone([l])];case 1:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().then(function(){S()}).catch(function(){k()})}},[b,l,d]);var y,E,w,I,_,D,Z,R,F,z=(0,h.useState)(),T=z[0],N=z[1],O=(y=function(e){var n;N({height:e.blockSize,width:e.inlineSize})},w=(0,h.useRef)(),(0,h.useCallback)(function(e){var n;null===(n=w.current)||void 0===n||n.disconnect(),null!==e&&(w.current=new ResizeObserver(function(n){var t,r=(0,Y.Z)(n,1)[0].contentRect;y({blockSize:r.height,inlineSize:r.width},e)}),w.current.observe(e))},[]));return(0,c.jsx)(m.kC,{ref:O,sx:(0,x.Z)({alignItems:"center",backgroundColor:"headSection",backgroundImage:"url(/pattern.png)",backgroundRepeat:"repeat",backgroundSize:"10px",border:v?void 0:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorder))},borderRadius:v?void 0:8,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden"},void 0!==f&&f?{display:"none"}:{}),children:d?(0,c.jsx)("iframe",{ref:C,src:d,style:(0,x.Z)({border:"none",maxHeight:"".concat(u.height,"px"),maxWidth:"".concat(u.width,"px"),minHeight:"".concat(u.height,"px"),minWidth:"".concat(u.width,"px"),overflowY:"auto"},T?{transform:"scale(".concat((I=u,_=T,D=I.height,Z=I.width,R=_.height,F=_.width,Z>F||D>R?Z-F>D-R?F/Z:R/D:1),")")}:{display:"none"})}):null})},ee=function(e){var n=e.children,t=e.sx;return(0,c.jsx)(m.kC,{sx:(0,x.Z)({bg:"grey07",height:"90%",width:"100%",justifyContent:"center",alignItems:"center",zIndex:"1"},t),children:(0,c.jsx)(m.kC,{sx:{marginTop:"-128px",justifyContent:"center",flexDirection:"column",alignItems:"center"},children:n})})},en=t(85819),et=function(e){var n=e.onRetrigger;return(0,c.jsxs)(ee,{children:[(0,c.jsx)(m.Ee,{src:"/iframe-not-running.png",sx:{width:"320px"}}),(0,c.jsx)(m.xv,{sx:{color:"textClear",mb:2,fontSize:"14px",lineHeight:"24px",fontWeight:"600"},children:"Slice Machine can't render your Slice"}),(0,c.jsxs)(m.xv,{sx:{color:"failedConnectText",maxWidth:"400px",textAlign:"center",fontSize:"12px",lineHeight:"22px"},children:["Ensure your website's development server is running by typing",(0,c.jsx)("br",{}),(0,c.jsx)(m.xv,{as:"code",variant:"styles.inlineCode",sx:{padding:"4px",borderRadius:"6px"},children:"npm run dev"}),"\xa0 in your terminal at the root of your website directory.",(0,c.jsx)("br",{})," If that doesn't work, see the\xa0",(0,c.jsx)(m.rU,{target:"_blank",href:"https://prismic.io/docs/slice-machine",sx:{color:"link"},children:"troubleshooting instructions."})]}),(0,c.jsx)(b.z,{onClick:n,label:"Refresh",Icon:en.Fer,iconSize:20,iconFill:"#6F6E77",variant:"secondaryMedium",sx:{mt:"16px"}})]})},er=t(98240),ei=t(92928),eo=t(33402),es=t(59326),ec=t(86741),ea=t(65186),el=function(e){var n=e.children;return(0,c.jsx)(m.xu,{as:"code",sx:{bg:"rgba(0, 0, 0, 0.05)",borderRadius:3,padding:"2px 4px"},children:n})},eu=function(e){var n,t=e.children,r=(0,er.Z)(e,["children"]),i=(0,es.B7)().theme,o=(0,h.useState)(!1),s=o[0],a=o[1],l=(0,h.useRef)(null),u=function(){l.current&&navigator.clipboard.writeText(l.current.innerText).then(function(){a(!0),setTimeout(function(){a(!1)},1200)}).catch(function(){})};return(0,c.jsxs)(m.xu,(0,f.Z)((0,x.Z)({},r),{sx:{backgroundColor:"codeBlockBackground",borderRadius:8},children:[(0,c.jsxs)(m.kC,{sx:{px:"26px",py:"22px",color:"#FFF",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid rgba(111, 110, 119, 0.2)"},children:[(0,c.jsx)(m.kC,{sx:{alignItems:"center"}}),(0,c.jsxs)(m.zx,{onClick:u,variant:"transparent",sx:{display:"flex",justifyContent:"center",alignItems:"center",p:0,fontSize:"12px",color:"#FFF"},children:["Copy\xa0",s?(0,c.jsx)(ea.HhX,{size:16,color:String(null==i?void 0:null===(n=i.colors)||void 0===n?void 0:n.success)}):(0,c.jsx)(ea.Fqs,{size:16,style:{marginLeft:"8px"}})]})]}),(0,c.jsx)(m.xu,{ref:l,as:"pre",sx:{color:"#c9d1d9",padding:"16px 20px",overflow:"auto"},children:t})]}))},ed={code:function(e){var n=e.children;return(0,c.jsx)(el,{children:n})},pre:function(e){var n=e.children,t=(0,er.Z)(e,["children"]);return(0,c.jsx)(eu,(0,f.Z)((0,x.Z)({},t),{children:n}))}},ex=function(e){var n=e.html,t=e.components,r=void 0===t?{}:t,i={replace:function(e){if((0,eo.Z)(e,ec.W_)&&e.attribs){var n=(0,ec.du)(e.children,i),t=(0,x.Z)({},r,ed)[e.name];if(t)return(0,c.jsx)(t,(0,f.Z)((0,x.Z)({name:e.name},e.attribs),{children:n}))}}};return(0,c.jsx)(c.Fragment,{children:(0,ec.ZP)(n,i)})},ef=function(e){var n=e.children.split("`").map(function(e,n){return n%2==1?(0,c.jsx)(el,{children:e}):e});return(0,c.jsx)(c.Fragment,{children:n})},eh=function(e){var n=e.number,t=e.title,r=e.excerpt,i=(0,er.Z)(e,["number","title","excerpt"]);return(0,c.jsx)(ei.OK,(0,f.Z)((0,x.Z)({className:"react-tabs__vertical__tab",selectedClassName:"react-tabs__vertical__tab--selected"},i),{children:(0,c.jsxs)(m.kC,{sx:{alignItems:"flex-start"},children:[(0,c.jsx)(ev,{number:n}),(0,c.jsxs)(m.xu,{sx:{ml:3,alignSelf:"center"},children:[(0,c.jsx)(m.X6,{as:"h4",sx:{color:"whiteButtonText",fontSize:"14px",fontWeight:"600"},children:(0,c.jsx)(ef,{children:t})}),r&&(0,c.jsx)(m.xv,{as:"p",sx:{mt:2,color:"textClear",fontSize:"13px",lineHeight:"24px"},children:(0,c.jsx)(ef,{children:r})})]})]})}))};eh.tabsRole="Tab";var ep,ev=function(e){var n=e.number;return(0,c.jsx)(m.kC,{sx:{height:"32px",width:"32px",alignItems:"center",justifyContent:"center",border:"1px solid #E4E2E4",borderRadius:"6px",bg:"grey07",color:"textClear",flexShrink:"0",fontSize:"13px"},children:n})},em=function(e){var n=e.isOpen,t=(0,w.v9)(function(e){return{isSimulatorAvailableForFramework:(0,R.Ql)(e),setupSteps:(0,I.qe)(e)}}),r=t.isSimulatorAvailableForFramework,i=t.setupSteps||[];return(0,h.useEffect)(function(){n&&Z.Xe.track({event:"slice-simulator:setup"})},[n]),(0,c.jsx)(M.Z,{isOpen:n,children:(0,c.jsx)(W.Z,{bodySx:{p:0,bg:"grey07",height:4===i.length?"640px":"480px"},Header:function(e){var n=e.radius;return(0,c.jsx)(m.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"grey07",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:(0,c.jsx)(m.X6,{sx:{fontSize:"14px",fontWeight:"600"},as:"h5",children:"Set up the simulator"})})},children:(0,c.jsxs)(ei.mQ,{defaultFocus:!0,className:"react-tabs__vertical",children:[(0,c.jsx)(ei.td,{className:"react-tabs__vertical__tab-list",children:i.map(function(e,n){return(0,c.jsx)(eh,{number:n+1,title:e.title,excerpt:e.description},e.title)})}),r?(0,c.jsx)(c.Fragment,{children:i.map(function(e){return(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:(0,c.jsx)(ex,{html:e.body})},e.title)})}):(0,c.jsx)(ei.x4,{selectedClassName:"react-tabs__vertical__tab-panel--selected",className:"react-tabs__vertical__tab-panel",children:"Framework not supported."})]})})})},eg=t(53559);(ep=o||(o={})).LOADING_SETUP="LOADING_SETUP",ep.LOADING_IFRAME="LOADING_IFRAME",ep.FAILED_SETUP="FAILED_SETUP",ep.FAILED_CONNECT="FAILED_CONNECT",ep.SUCCESS="SUCCESS";var eb=function(e){var n,t,i=e.slice,s=e.variation,a=(0,B.Z)(),l=a.checkSimulatorSetup,u=a.connectToSimulatorIframe,d=a.saveSliceMock,b=(0,w.v9)(function(e){return{simulatorUrl:(0,R.x0)(e),iframeStatus:(0,I.NL)(e),manifestStatus:(0,I.tD)(e).manifest,isWaitingForIFrameCheck:(0,I.oM)(e),endpoints:(0,R.gZ)(e)}}),C=b.simulatorUrl,j=b.iframeStatus,S=b.manifestStatus,k=b.isWaitingForIFrameCheck,y=b.endpoints,E=(0,h.useMemo)(function(){return{embedsUrl:y.PrismicOembed,env:"prod",unsplashUrl:y.PrismicUnsplash}},[y.PrismicOembed,y.PrismicUnsplash]),_=(0,h.useRef)(null),F=(0,h.useCallback)(function(){return l()},[]);(0,h.useEffect)(function(){l(),Z.Xe.track({event:"slice-simulator:open"})},[]);var z=(0,h.useRef)(!1);(0,h.useEffect)(function(){z.current=!0},[]);var T=function(e){z.current&&(z.current=!1,Z.Xe.track({event:"editor:widget-used",sliceId:e}))},N="ko"===S?o.FAILED_SETUP:"ok"===S?k||!j?o.LOADING_IFRAME:"ok"!==j?o.FAILED_CONNECT:o.SUCCESS:(0,o.LOADING_SETUP);(0,h.useEffect)(function(){if(N===o.FAILED_SETUP&&!_.current){var e=setInterval(function(){F()},3e3);_.current=e}},[N]),(0,h.useEffect)(function(){"ok"===S&&(_.current&&clearInterval(_.current),u())},[S]),(0,h.useEffect)(function(){N===o.FAILED_CONNECT&&Z.Xe.track({event:"slice-simulator:is-not-running"})},[N]),(0,h.useEffect)(function(){N===o.SUCCESS&&eo(!0)},[N]);var A=function(){u()},M=(0,h.useState)(O[r.DESKTOP]),U=M[0],P=M[1],W=(0,h.useMemo)(function(){return eg.id.fromSM(i.model)},[i.model]),H=(0,h.useState)(null),X=H[0],K=H[1],Y=(0,h.useMemo)(function(){var e,n;return(null==X?void 0:X.variation)===s.id?X:(null===(e=i.mocks)||void 0===e?void 0:e.find(function(e){return e.variation===s.id}))||{__TYPE__:"SharedSliceContent",variation:n=s.id,primary:{},items:[]}},[X,s.id]),J=(0,h.useMemo)(function(){return(0,q.renderSliceMock)(W,Y).id},[]),Q=(0,h.useCallback)(function(){return function(){return(0,f.Z)((0,x.Z)({},(0,q.renderSliceMock)(W,Y)),{id:J})}},[W,Y]),en=G(Q,800,[W,Y,]),er=(0,h.useState)(!1),ei=er[0],eo=er[1];return(0,c.jsxs)(m.kC,{sx:{flexDirection:"column",height:"100vh"},children:[(0,c.jsx)(em,{isOpen:N===o.FAILED_SETUP}),(0,c.jsx)(D,{slice:i,variation:s,isDisplayEditor:ei,actionsDisabled:N!==o.SUCCESS,toggleIsDisplayEditor:function(){return eo(!ei)},onSaveMock:function(){return X&&d({libraryID:i.from,sliceID:i.model.id,mocks:(i.mocks||[]).filter(function(e){return e.variation!==X.variation}).concat(X)})}}),(0,c.jsx)(m.xu,{sx:{flex:1,bg:"grey07",p:3,display:"flex",flexDirection:"column",height:"calc(100% - 73px - 16px)"},children:(0,c.jsxs)(m.kC,{sx:{flex:1,flexDirection:"row",position:"relative",width:"100%",height:"100%"},children:[(0,c.jsxs)(g.xR,{sx:{display:"flex",height:"100%",flexDirection:"column",flex:1,minWidth:0},children:[(0,c.jsx)(L,{handleScreenSizeChange:P,screenDimensions:U,actionsDisabled:N!==o.SUCCESS}),N===o.FAILED_CONNECT?(0,c.jsx)(et,{onRetrigger:A}):null,N===o.SUCCESS?(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C}):(0,c.jsx)(c.Fragment,{children:N===o.LOADING_IFRAME?(0,c.jsxs)(ee,{children:[(0,c.jsx)(m.$j,{variant:"styles.spinner"}),(0,c.jsx)($,{apiContent:en,screenDimensions:U,simulatorUrl:C,dryRun:!0})]}):null})]}),N===o.SUCCESS&&ei?(0,c.jsx)(m.kC,{className:"editor",sx:{flexDirection:"column",marginLeft:"16px",maxWidth:"440px",minWidth:"440px",overflowY:"auto"},children:(0,c.jsx)(v.SV,{renderError:function(){return(0,c.jsx)(v.Iq,{title:"Editor error",description:"An error occurred while rendering the editor."})},children:(0,c.jsx)(h.Suspense,{children:(0,c.jsx)(p.kS,{config:E,content:Y,onContentChange:function(e){K(e),T(i.model.id)},sharedSlice:W},s.id)})})}):null]})}),!!(null===(n=i.screenshots[s.id])||void 0===n?void 0:n.url)&&(0,c.jsx)(V,{sliceName:i.model.name,screenshotUrl:null===(t=i.screenshots[s.id])||void 0===t?void 0:t.url})]})},eC=t(25998);function ej(){var e=(0,u.useRouter)(),n=(0,eC.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(l(),{children:(0,c.jsx)("title",{children:"Simulator: ".concat(t.model.name," - Slice Machine")})}),(0,c.jsx)(eb,{slice:t,variation:r})]})}},25998:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var r=t(5632),i=t(56580),o=t(95200),s=function(e,n,t){var r,i=null===(r=(0,o.Sd)(e))||void 0===r?void 0:r.find(function(e){return e.name.replace(/\//g,"--")===n});return null==i?void 0:i.components.find(function(e){return e.model.name===t})},c=function(){var e=(0,r.useRouter)(),n=(0,i.v9)(function(n){return{slice:s(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}:{}}}},function(e){e.O(0,[789,872,851,777,774,888,179],function(){return e(e.s=30755)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
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 eI}});var i=t(52322),r=t(97729),o=t.n(r),a=t(5632),s=t(22715),c=t(28316),u=t(83462),l=t(38876),d=t(2353),f=t(44384),v=t(28173),p=t(53559),m=t(22710),h=t(62230),y=t(85244),x=t(99267),g=t(2784),j=t(74217),b=t(82770),Z=t(90374),I=t(50950),w=t(26921),S=(0,g.createContext)(void 0);function k(e){var n=e.children,t=e.initialSlice,r=(0,a.useRouter)(),o=(0,g.useState)(t),s=o[0],c=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,Z.Z)().saveSliceSuccess,v=(0,j.R9)(f),p=(0,I.g)().syncChanges,k=(0,g.useMemo)(function(){var e=r.query.variation,n=s.model.variations.find(function(n){return n.id===e});if(n)return n;throw Error("Variation not found")},[s,r]),C=(0,g.useCallback)(function(e){c(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 v((0,y.Z)((0,h.Z)({},e),{mocks:o})),p(),[2]}})}))},[d,v,p]),T=(0,g.useMemo)(function(){return{actionQueueStatus:l,slice:s,setSlice:C,variation:k}},[l,s,C,k]);return(0,i.jsx)(S.Provider,{value:T,children:"function"==typeof n?n(T):n})}function C(){var e=(0,g.useContext)(S);if(!e)throw Error("SliceBuilderProvider not found");return e}var T=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,T.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,s=i.value,c=(0,T.L4)({slice:n,variationId:r.id,widgetArea:e,previousFieldId:o,newFieldId:a,newField:s});t(c)}},s=function(e){return function(i){var o=i.id,a=i.label,s=i.widgetTypeName,c=d[s];c||console.log('Could not find widget with type name "'.concat(s,'". Please contact us!'));var u=c.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,T.xS)({slice:n,variationId:r.id,widgetArea:e,newFieldId:o,newField:u});t(f)}},m=function(e){return function(i){if(!(0,u.uS)(i)){var o=i.source,a=i.destination;if(a){var s=(0,T.gR)({slice:n,variationId:r.id,widgetArea:e,sourceIndex:o.index,destinationIndex:a.index});(0,c.flushSync)(function(){return t(s)})}}}};return(0,i.jsxs)(v.aV,{children:[(0,i.jsx)(F.Z,{zoneType:"slice",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(p.Rt.Primary),onSave:a(p.Rt.Primary),onSaveNewField:s(p.Rt.Primary),onDragEnd:m(p.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))},dataCy:"static-zone-content",isRepeatableCustomType:void 0}),(0,i.jsx)(F.Z,{zoneType:"slice",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(p.Rt.Items),onSave:a(p.Rt.Items),onSaveNewField:s(p.Rt.Items),onDragEnd:m(p.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))},dataCy:"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,s=e.headerSx,c=void 0===s?{}:s;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)}},c),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})},P=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!"})},z=function(e){var n=e.isOpen,t=e.onClose,r=e.onSubmit,o=e.initialVariation,a=e.variations,c=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,s=t&&t.length?null:{name:"Required!"},c=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,s,c,u)},u=function(e){w((0,D.camelCase)(e))},l=function(e){E(e),k&&u(e)},d=function(e){C(!1),u(e)},f=function(){v(),t()},v=function(){w(""),E(""),b({}),C(!0),V({value:o.id,label:o.name})},p=(0,g.useState)({}),j=p[0],b=p[1],Z=(0,g.useState)(""),I=Z[0],w=Z[1],S=(0,g.useState)(!0),k=S[0],C=S[1],T=(0,g.useState)(""),F=T[0],E=T[1],A=(0,g.useState)({value:o.id,label:o.name}),R=A[0],V=A[1],z=(0,g.useState)(!1),K=z[0],q=z[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=c({id:I,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(I,F,n)];case 2:t.sent(),q(!1),f(),t.label=3;case 3:return[2]}})})).apply(this,arguments)}return(0,g.useEffect)(function(){v()},[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:I,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)(s.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)(s.xu,{gap:16,alignItems:"center",children:[(0,i.jsx)(s.zx,{onClick:f,color:"grey",children:"Cancel"}),(0,i.jsx)(s.zx,{loading:K,children:"Submit"})]}),close:f,children:[(0,i.jsxs)(s.xu,{flexDirection:"column",padding:{block:16},children:[(0,i.jsxs)(N.__,{htmlFor:"name",sx:{mb:1},children:["Variation name*",j.name?(0,i.jsx)(P,{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)(s.xu,{flexDirection:"column",padding:{bottom:16},children:[(0,i.jsxs)(N.__,{htmlFor:"id",sx:{mb:1},children:["Variation ID*",j.id?(0,i.jsx)(P,{msg:j.id}):""]}),(0,i.jsx)(_.gN,{autoComplete:"off",id:"id",name:"id",placeholder:"e.g. GridWithIcon",as:N.II,maxLength:30,value:I,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)(s.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,s,c,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,(s=o.errors).length>0)throw s;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 c=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:c}),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,c=(0,a.useRouter)(),u=(0,g.useState)(!1),l=u[0],d=u[1],f=(0,Z.Z)().saveSliceSuccess,v=C().setSlice;return(0,i.jsxs)(s.Vq,{open:n,onOpenChange:function(e){return!e&&t()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"delete",title:"Delete variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsxs)(s.xu,{flexDirection:"column",children:[(0,i.jsxs)(s.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)(s.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:c,saveSliceSuccess:f,variation:o})];case 2:return v(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)(s.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,s,c,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,(s=o.errors).length>0)throw s;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 c=n.sent().mocks,u=(0,y.Z)((0,h.Z)({},e.component),{model:a,mocks:c}),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,c=e.variation,u=(0,g.useState)(!1),l=u[0],d=u[1],f=C().setSlice,v=(0,Z.Z)().saveSliceSuccess;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.Vq,{open:r,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(s.fK,{icon:"edit",title:"Rename variation"}),(0,i.jsx)(s.cZ,{children:(0,i.jsx)(_.J9,{validateOnMount:!0,initialValues:{variationName:null!==(n=null==c?void 0:c.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(!c)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:v,variation:c,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)(s.xu,{flexDirection:"column",gap:8,padding:16,children:[(0,i.jsx)(s.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)(s.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:"_1ecs97dez4 _1ecs97dez8 _1ecs97df90",children:[(0,i.jsx)(s.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(s.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(s.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)(s.kX,{ok:{text:"Rename",onClick:function(){e.submitForm()},loading:l,disabled:!e.isValid},cancel:{text:"Cancel"},size:"medium"})]})}})})]})})},W=t(15836),Q=t(71749),G=t(47731),$=function(){var e,n=C(),t=n.slice,r=n.variation,o=n.setSlice,c=(0,g.useState)(),u=c[0],l=c[1],d=(0,G.H)(),f=d.modalPayload,v=f.sliceFilterFn,p=f.defaultVariationSelector,h=f.onUploadSuccess,y=(0,a.useRouter)(),j=(0,Z.Z)().saveSliceSuccess;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.xu,{flexDirection:"column",gap:16,children:[t.model.variations.map(function(e){return(0,i.jsx)(Q.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)(s.xu,{backgroundColor:"grey2",bottom:0,flexDirection:"column",padding:{bottom:40,inline:24},position:"sticky",style:{marginBottom:"-16px"},children:[(0,i.jsx)(s.ph,{sx:{left:0,position:"absolute",right:0}}),(0,i.jsx)(s.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:v([t]),defaultVariationSelector:p,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)(z,{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,s,c,u,l;return(0,x.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),a=(r=(0,T.Kp)({slice:t,id:e,name:n,copiedVariation:i})).slice,s=r.variation,[4,(0,b.Ve)(a)];case 1:return d.sent(),j(a),o(a),c=K.Y.getBuilderPagePathname({libraryName:a.href,sliceName:a.model.name,variationId:s.id}),y.replace(c),[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(56580),Y=t(75329),ee=t(33710),en=t(42189),et=t(17036),ei=t(39295),er=t(22342),eo=function(){return(0,i.jsx)(ei.X,{children:(0,i.jsxs)(ee.Z,{clickable:!0,place:"bottom",effect:"solid",delayHide:500,id:"simulator-button-tooltip",children:[(0,i.jsx)(N.xv,{as:"b",children:"Framework not supported"}),(0,i.jsx)(N.xv,{as:"p",children:"Slice Simulator does not support your framework yet."})]})})},ea=function(e){var n=e.children,t=e.open,r=e.onClose;return(0,i.jsxs)(er.zs,{open:t,trigger:n,onClose:r,children:[(0,i.jsx)(er.Ev,{children:"Simulate your slices"}),(0,i.jsx)(er.LB,{component:"video",cloudName:"dmtf1daqp",loop:!1,autoPlay:!1,publicId:Y.Sn,poster:"/simulator-video-thumbnail.png",controls:!0,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:Y.Sn})}}),(0,i.jsx)(er.OJ,{children:"Minimize context-switching by previewing your Slice components in the simulator."}),(0,i.jsx)(er.Rp,{children:"Got it"})]})},es=function(e){var n=e.isSimulatorAvailableForFramework,t=e.disabled,r=(0,a.useRouter)(),o=(0,g.useRef)(null),c=(0,Z.Z)().setSeenSimulatorToolTip,u=(0,J.v9)(function(e){return{hasSeenSimulatorTooltip:(0,et.bv)(e)}}).hasSeenSimulatorTooltip;(0,g.useEffect)(function(){var e=o.current;e&&n&&!u&&setTimeout(function(){return ee.Z.show(e)},5e3)},[n,u]);var l=function(){if(c(),o.current){var e=o.current;ee.Z.hide(e)}};return(0,i.jsxs)("span",{"data-tip":!0,"data-tip-disable":!1,"data-for":"simulator-button-tooltip",ref:o,children:[(0,i.jsx)(ea,{open:n&&!u,onClose:l,children:(0,i.jsx)(s.zx,{"data-tip":!0,"data-testid":"simulator-open-button",onClick:function(){l(),window.open("".concat(r.asPath,"/simulator"),Y.pq)},disabled:t,renderStartIcon:function(){return(0,i.jsx)(en.z,{color:s.TV.color.greyLight1,height:s.TV.size[24],style:{transform:"scale(calc(4 / 3))"},width:s.TV.size[24]})},children:"Simulate"})}),!1===n?(0,i.jsx)(eo,{}):void 0]})},ec=t(22840),eu=t(17329),el=t(81038);function ed(e){return ef.apply(this,arguments)}function ef(){return(ef=(0,m.Z)(function(e){var n,t,i;return(0,x.__generator)(this,function(r){switch(r.label){case 0:return[4,el.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 ev=t(67445),ep=t(64722),em=t(20812),eh=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"})]}))},ey=function(){var e,n,t=(e=(0,ep.l)().source,n=(0,ev.Ag)(e.query),void 0!==n&&(0,ev.ne)(e.asPath,n)?n:void 0);return void 0!==t?(0,i.jsx)(s.SV,{children:(0,i.jsx)(g.Suspense,{children:(0,i.jsx)(s.xu,{bottom:32,justifyContent:"center",position:"fixed",right:0,width:"100vw",children:(0,i.jsx)(ex,{sourceCustomTypeId:t})})})}):null},ex=function(e){var n,t=(n=e.sourceCustomTypeId,(0,eu.QT)(ed,[n])),r=(0,g.useState)(!0),o=r[0],c=r[1],u=(0,a.useRouter)();if(void 0===t||!o)return null;var l=t.format,d=t.id,f=ev.cd[l].getBuilderPagePathname(d);return(0,i.jsxs)(s.hE,{density:"compact",color:"dark",children:[(0,i.jsxs)(s.zx,{onClick:function(){u.push(f)},renderStartIcon:function(){return(0,i.jsx)(eh,{})},children:["Return to ",t.label]}),(0,i.jsx)(s.zx,{onClick:function(){c(!1)},renderStartIcon:function(){return(0,i.jsx)(em.T,{})}})]})},eg=t(39092),ej=t(47976),eb=function(){var e=C(),n=e.slice,t=e.actionQueueStatus,r=(0,J.v9)(eg.Ql);return(0,i.jsxs)(ec.LN,{children:[(0,i.jsxs)(ec.wd,{children:[(0,i.jsx)(ec.Xq,{url:"/slices"}),(0,i.jsx)(ec.Cx,{folder:"Slices",page:n.model.name}),(0,i.jsxs)(ec.K2,{children:[(0,i.jsx)(ej.X,{status:t}),(0,i.jsx)(es,{isSimulatorAvailableForFramework:r,disabled:"done"!==t})]})]}),(0,i.jsxs)(ec.RN,{children:[(0,i.jsxs)(s.xu,{alignItems:"flex-start",display:"grid",gap:16,gridTemplateColumns:"320px 1fr",children:[(0,i.jsx)($,{}),(0,i.jsx)(A,{})]}),(0,i.jsx)(ey,{})]})]})},eZ=t(25998);function eI(){var e=(0,a.useRouter)(),n=(0,eZ.Z)(),t=n.slice,r=n.variation;return void 0===t||void 0===r?(e.replace("/"),null):(0,i.jsx)(k,{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)(eb,{})]})}})}},91061:function(e,n,t){"use strict";t.d(n,{AK:function(){return b},E3:function(){return p},EN:function(){return m},F$:function(){return x},GA:function(){return C},HO:function(){return g},L4:function(){return Z},Tr:function(){return v},Ue:function(){return O},gR:function(){return I},j6:function(){return S},kQ:function(){return w},l9:function(){return k},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),s=t(88866),c=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===s.SlicesFieldType})}function v(e,n){if(t=e,d=f(t,c=n),(v=(0,a.Z)(null!=d?d:[],2))[0],null!==(u=null==(p=v[1])?void 0:p.config)&&void 0!==u?u:void 0)return e;var t,c,u,d,v,p,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===s.SlicesFieldType})}),c=r;do t="slices".concat(0!==c?c.toString():""),c++;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:s.SlicesFieldType,fieldset:"Slice Zone"}))))})}function p(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===s.SlicesFieldType});if(void 0===a)return e;var u=(0,c.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 v=Object.keys(f).find(function(e){return f[e].type===s.SlicesFieldType});if(void 0===v)return a;var p=f[v];if(p.type!==s.SlicesFieldType)return a;var m=(0,c.ud)(null!==(t=null===(n=p.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)({},v,(0,o.Z)((0,r.Z)({},p),{config:(0,o.Z)((0,r.Z)({},p.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 s=(0,a.Z)(i,1)[0];t=v(t,s)}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,c.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,c=e.newField,u=e.newFieldId,l=n.json[t],d=f(n,t),v=Object.fromEntries(Object.entries(l).filter(function(e){var n=(0,a.Z)(e,2);return(n[0],n[1]).type!==s.SlicesFieldType})),p=(0,o.Z)((0,r.Z)({},v),(0,i.Z)({},u,c));if(void 0!==d){var m=(0,a.Z)(d,2),h=m[0],y=m[1];p[h]=y}return T({customType:n,sectionId:t,updatedSection:p})}function b(e){var n=e.customType,t=e.sectionId,i=e.fieldId,r=(0,c.ud)(n.json[t],i);return T({customType:n,sectionId:t,updatedSection:r})}function Z(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 T({customType:n,sectionId:t,updatedSection:a})}function I(e){var n=e.customType,t=e.sectionId,i=e.sourceIndex,r=e.destinationIndex,o=n.json[t],c=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!==s.SlicesFieldType})),l=E({fields:u,sourceIndex:i,destinationIndex:r});if(void 0!==c){var d=(0,a.Z)(c,2),v=d[0],p=d[1];l[v]=p}return T({customType:n,sectionId:t,updatedSection:l})}function w(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.newField,u=e.newFieldId,l=A({customType:t,sectionId:a,groupFieldId:s}),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,c)));return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,f))})}function S(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,u=e.fieldId,l=A({customType:t,sectionId:a,groupFieldId:s}),d=null==l?void 0:null===(n=l.config)||void 0===n?void 0:n.fields;if(!l||!d)return t;var f=(0,c.ud)(d,u),v=R(l,f);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function k(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.previousFieldId,u=e.newFieldId,l=e.newField,d=A({customType:t,sectionId:a,groupFieldId:s}),f=null==d?void 0:null===(n=d.config)||void 0===n?void 0:n.fields;if(!d||!f)return t;var v=F({fields:f,previousFieldId:c,newFieldId:u,newField:l}),p=R(d,v);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,p))})}function C(e){var n,t=e.customType,a=e.sectionId,s=e.groupFieldId,c=e.sourceIndex,u=e.destinationIndex,l=A({customType:t,sectionId:a,groupFieldId:s}),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:c,destinationIndex:u}),v=R(l,f);return T({customType:t,sectionId:a,updatedSection:(0,o.Z)((0,r.Z)({},t.json[a]),(0,i.Z)({},s,v))})}function T(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),s=o[0],c=o[1];return s===t?e[i]=r:s!==i&&(e[s]=c),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===s.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,s=e.format,c=(n=a,t=s,!1===n&&"page"===t?(0,r.Z)({},N,V):!1===n?_:"page"===t?(0,r.Z)({},L,V):D);return{format:s,id:i,json:c,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 s}});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})},s=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 s(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function c(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 s(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([s(e.key),s(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&v([s(e.key),s(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 v(e){var n=Array.isArray(e)?e:[e];"meta"===e?l.clear():n.forEach(function(e){return l.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 m=function(e,n,t){void 0===t&&(t=!1);var i,r,o=n.alt,a=n.meta,c=n.mod,u=n.shift,f=n.ctrl,v=n.keys,p=e.key,m=e.code,h=e.ctrlKey,y=e.metaKey,x=e.shiftKey,g=e.altKey,j=s(m),b=p.toLowerCase();if(!t){if(!g===o&&"alt"!==b||!x===u&&"shift"!==b)return!1;if(c){if(!y&&!h)return!1}else if(!y===a&&"meta"!==b&&"os"!==b||!h===f&&"ctrl"!==b&&"control"!==b)return!1}return!!(v&&1===v.length&&(v.includes(b)||v.includes(j)))||(v?(void 0===r&&(r=","),(d(i=v)?i:i.split(r)).every(function(e){return l.has(e.trim().toLowerCase())})):!v)},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,Z=d(e)?e.join(null==b?void 0:b.splitKey):e,I=t instanceof Array?t:r instanceof Array?r:void 0,w=(0,i.useCallback)(n,null!=I?I:[]),S=(0,i.useRef)(w);I?S.current=w:S.current=n;var k=(!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,T=(0,i.useContext)(h);return g(function(){if((null==k?void 0:k.enabled)!==!1&&(e=C,n=null==k?void 0:k.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==k?void 0:k.enableOnFormTags)||null!=k&&null!=k.ignoreEventWhen&&k.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!=k&&k.enableOnContentEditable)&&c(Z,null==k?void 0:k.splitKey).forEach(function(t){var i,r,o,a,s,c,l,d=u(t,null==k?void 0:k.combinationKey);if(m(e,d,null==k?void 0:k.ignoreModifiers)||null!=(l=d.keys)&&l.includes("*")){if(n&&j.current)return;if(i=e,r=d,("function"==typeof(o=null==k?void 0:k.preventDefault)&&o(i,r)||!0===o)&&i.preventDefault(),a=e,s=d,"function"==typeof(c=null==k?void 0:k.enabled)?!c(a,s):!0!==c&&void 0!==c){x(e);return}S.current(e,d),n||(j.current=!0)}})}},i=function(e){void 0!==e.key&&(f(s(e.code)),((null==k?void 0:k.keydown)===void 0&&(null==k?void 0:k.keyup)!==!0||null!=k&&k.keydown)&&t(e))},r=function(e){void 0!==e.key&&(v(s(e.code)),j.current=!1,null!=k&&k.keyup&&t(e,!0))},o=l.current||(null==b?void 0:b.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",i),T&&c(Z,null==k?void 0:k.splitKey).forEach(function(e){return T.addHotkey(u(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",i),T&&c(Z,null==k?void 0:k.splitKey).forEach(function(e){return T.removeHotkey(u(e,null==k?void 0:k.combinationKey,null==k?void 0:k.description))})}}},[Z,k,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()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,n,t){var r=t(34311),i=t(23779),o=r(function(e,n,t){return e+(t?" ":"")+i(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 r=t(62230),i=t(85244),o=t(98240),l=t(52322),c=t(2784),a=t(75289),s=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,c.forwardRef)(function(e,n){var t=e.label,c=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,i.Z)((0,r.Z)({ref:n,sx:(0,r.Z)((0,i.Z)((0,r.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-cy":s(C["data-cy"],"spinner")}),c&&t]}):(0,l.jsxs)(l.Fragment,{children:[c&&(0,l.jsx)(c,{size:b,fill:g,"data-cy":s(C["data-cy"],"icon")}),t]})}))})},45466:function(e,n,t){"use strict";t.d(n,{c:function(){return S}});var r=t(22710),i=t(62230),o=t(85244),l=t(99267),c=t(52322),a=t(75289),s=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,r.Z)(function(e){var n,t,r,i,o,c,a;return(0,l.__generator)(this,function(l){switch(l.label){case 0:n=e.sliceName,t=e.libraryName,r=e.onSuccess,l.label=1;case 1:return l.trys.push([1,4,,5]),i=(0,x.fo)(n),[4,p.j.slices.createSlice({libraryID:t,model:i})];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,r(i)];case 3:return l.sent(),[3,5];case 4:return c=l.sent(),a="An unexpected error happened while creating slice ".concat(n,"."),console.error(a,c),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,s.useState)(!1),C=S[0],w=S[1],k=(0,b.g)().syncChanges,I=(n=(0,r.Z)(function(e){var n,t;return(0,l.__generator)(this,function(i){switch(i.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,r.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 i.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,c.jsx)(d.Z,{dataCy:"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,r=e.setFieldValue,l=e.errors;return(0,c.jsxs)(a.xu,{children:[(0,c.jsx)(j.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,dataCy:"slice-name-input"}),(0,c.jsx)(a.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,c.jsx)(u.ZP,{name:"from",options:m.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void r("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,i.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,i.Z)({},e),{colors:(0,o.Z)((0,i.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},70041:function(e,n,t){"use strict";t.d(n,{W:function(){return c}});var r=t(62230),i=t(52322);t(2784);var o=t(63397),l=t(75289),c=function(e){var n=e.name,t=e.label,c=e.placeholder,a=e.error,s=e.dataCy,u=e.onChange;return(0,i.jsxs)(l.xu,{mb:3,children:[(0,i.jsx)(l.__,{htmlFor:n,mb:2,children:t}),(0,i.jsx)(o.gN,(0,r.Z)({name:n,type:"text",placeholder:c,as:l.II,autoComplete:"off"},u?{onChange:u}:null,s?{"data-cy":s}:null)),a?(0,i.jsx)(l.xv,{"data-cy":s?"".concat(s,"-error"):"input-error",sx:{color:"error",mt:1},children:a}):null]})}},66443:function(e,n,t){"use strict";t.d(n,{h:function(){return s}});var r=t(81541),i=t(75329),o=t(96009),l=t.n(o),c=t(74600),a=t.n(c);function s(e,n,t){var o=e.sliceName;if(!o)return{sliceName:"Cannot be empty"};if(!i.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(i.lS.includes(o))return{sliceName:"".concat(o," is reserved for Slice Machine use")};var c=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),s=t.map(function(e){return e.name});if((0,r.Z)(c).concat((0,r.Z)(s)).includes(o))return{sliceName:"Slice name is already taken."}}},59469:function(e,n,t){"use strict";var r=t(62230),i=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,c=e.gridTemplateMinPx,a=e.gridGap,s=e.sx;return(0,i.jsx)(o.xu,{as:"section",sx:(0,r.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===c?"320px":c,", 1fr))"),gridGap:void 0===a?"16px":a,pt:2},s),children:n.map(function(e,n){return e?(0,i.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},68780:function(e,n,t){"use strict";var r=t(62230),i=t(85244),o=t(52322),l=t(37149),c=t.n(l),a=t(25812),s=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.dataCy,N=e.actionMessage;return c().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)(s.J9,{initialValues:v,validate:function(e){return p?p(e):void 0},onSubmit:function(e){h(e)},children:function(e){var l=e.isValid,c=e.isSubmitting,a=e.values,p=e.errors,h=e.touched,x=e.setFieldValue,v=e.setValues;return(0,o.jsx)(s.l0,(0,i.Z)((0,r.Z)({id:m},null!=I?{"data-cy":I}:null),{children:(0,o.jsx)(f.Z,(0,i.Z)((0,r.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:c||C,children:"Cancel"}),(0,o.jsx)(d.z,{label:k,form:m,type:"submit",disabled:!l||c||C,isLoading:c||C,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:n({isValid:l,isSubmitting:c,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 X}});var r=t(81541),i=t(52322),o=t(22715),l=t(2784),c=t(97729),a=t.n(c),s=t(65077),u=t(75289),d=t(56580),f=t(5632),m=t(88932),p=t(75329),h=t(22840),x=t(45466),v=t(59469),y=t(36887),b=t(82770),g=function(e){var n=e.title,t=e.onCreateNew,r=e.buttonText,o=e.documentationComponent,l=e.videoPublicIdUrl;return(0,i.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},children:[(0,i.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,i.jsx)(y.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:l,onPlay:function(){b.Xe.track({event:"open-video-tutorials",video:l})}})}),(0,i.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,i.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,i.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:n}),(0,i.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,i.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(u.zx,{onClick:t,"data-cy":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:r}),(0,i.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"})]})]})]})},j=t(15836),S=t(22710),C=t(99267),w=t(90374),k=t(95200),I=t(81038),N=t(5479),L=t(53559);function Z(){return(Z=(0,S.Z)(function(e){var n,t,r,i,o,l,c;return(0,C.__generator)(this,function(a){switch(a.label){case 0:n=e.slice,t=e.newSliceName,r=e.onSuccess,a.label=1;case 1:return a.trys.push([1,3,,4]),i=(0,N.PQ)(n,t),[4,I.j.slices.renameSlice({libraryID:n.from,model:L.id.fromSM(i.model)})];case 2:if((o=a.sent().errors).length>0)throw o;return r(i),m.Am.success("Slice name updated"),[3,4];case 3:return l=a.sent(),c="An unexpected error happened while renaming “".concat(n.model.name,"”."),console.error(c,l),m.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var E=t(50950),_=t(70041),P=t(68780),A=t(66443),O=function(e){var n,t,r,o=e.slice,l=e.isOpen,c=e.onClose,a=(0,w.Z)().renameSliceSuccess,s=(0,E.g)().syncChanges,f=(0,d.v9)(function(e){return{localLibs:(0,k.Sd)(e),remoteLibs:(0,k.sT)(e)}}),m=f.localLibs,p=f.remoteLibs,h=null!==(n=null==o?void 0:o.model.name)&&void 0!==n?n:"",x=(r=(0,S.Z)(function(e){return(0,C.__generator)(this,function(n){switch(n.label){case 0:if(!o)return[3,2];return[4,function(e){return Z.apply(this,arguments)}({slice:o,newSliceName:e.sliceName,onSuccess:function(e){a(e.from,e.model),s()}})];case 1:n.sent(),c(),n.label=2;case 2:return[2]}})}),function(e){return r.apply(this,arguments)});return(0,i.jsx)(P.Z,{dataCy:"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:c,buttonLabel:"Rename",onSubmit:function(e){x(e)},initialValues:{sliceName:h},content:{title:"Rename a slice"},validate:function(e){return(0,A.h)(e,m,p)},children:function(e){var n=e.touched,t=e.errors;return(0,i.jsx)(u.xu,{children:(0,i.jsx)(_.W,{name:"sliceName",label:"Slice Name","data-cy":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?t.sliceName:void 0,dataCy:"slice-name-input"})})}})},R=t(65186),z=t(59326),F=t(25812),D=t(54132),W=t(56577);function T(){return(T=(0,S.Z)(function(e){var n,t,r,i,o,l,c;return(0,C.__generator)(this,function(a){switch(a.label){case 0:n=e.sliceName,t=e.sliceID,r=e.libraryID,i=e.onSuccess,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,I.j.slices.deleteSlice({libraryID:r,sliceID:t})];case 2:if((o=a.sent().errors).length>0)throw o;return i(),m.Am.success("Successfully deleted slice “".concat(n,"”")),[3,4];case 3:return l=a.sent(),c="An unexpected error happened while deleting slice “".concat(n,"”."),console.error(c,l),m.Am.error(c),[3,4];case 4:return[2]}})})).apply(this,arguments)}var V=function(e){var n,t=e.sliceId,r=e.sliceName,o=e.libName,c=e.isOpen,a=e.onClose,s=(0,l.useState)(!1),d=s[0],f=s[1],m=(0,w.Z)().deleteSliceSuccess,p=(0,E.g)().syncChanges,h=(0,z.B7)().theme,x=(n=(0,S.Z)(function(){return(0,C.__generator)(this,function(e){switch(e.label){case 0:return f(!0),[4,function(e){return T.apply(this,arguments)}({sliceID:t,sliceName:r,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,i.jsx)(F.Z,{isOpen:c,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:a,children:(0,i.jsx)(D.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,i.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,i.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(R.$vK,{size:20,color:null===(e=h.colors)||void 0===e?void 0:e.greyIcon}),(0,i.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(u.x8,{type:"button",onClick:a})]})},Footer:function(){return(0,i.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,i.jsx)(W.z,{label:"Cancel",variant:"secondary",onClick:a,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(W.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:function(){x()}})]})},children:(0,i.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[o,"/",r,"/"]})," ","directory."]}),(0,i.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,i.jsx)("ul",{children:(0,i.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."]})})})},K=t(47731),B=t(71749),M=t(49451),H=t(13858),X=function(){var e,n,t,c=(0,f.useRouter)(),y=(0,K.H)(),b=y.modalPayload,S=y.onOpenModal,C=b.sliceFilterFn,w=b.defaultVariationSelector,I=(0,d.v9)(function(e){return{remoteSlices:(0,k.sT)(e),libraries:(0,k.Sd)(e)}}),N=I.remoteSlices,L=I.libraries,Z=(0,l.useState)(!1),E=Z[0],_=Z[1],P=(0,l.useState)(!1),A=P[0],R=P[1],z=(0,l.useState)(!1),F=z[0],D=z[1],W=L.filter(function(e){return e.isLocal}),T=L.map(function(e){return e.components=(0,r.Z)(e.components).sort(function(e,n){return e.model.name.localeCompare(n.model.name)}),e}),X=(L||[]).map(function(e){return e.components}).flat(),q=X.length,U=(0,l.useState)(),G=U[0],Q=U[1],Y=function(){R(!0)},$=function(){D(!0)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a(),{children:(0,i.jsx)("title",{children:"Slices - Slice Machine"})}),(0,i.jsxs)(h.LN,{children:[(0,i.jsxs)(h.wd,{children:[(0,i.jsx)(h.Cx,{folder:"Slices"}),(null==W?void 0:W.length)!==0&&0!==q?(0,i.jsx)(h.K2,{children:(0,i.jsx)(o.zx,{"data-testid":"create-slice","data-cy":"create-slice",onClick:function(){_(!0)},startIcon:"add",children:"Create"})}):void 0]}),(0,i.jsxs)(h.RN,{children:[(0,i.jsx)(s.xR,{sx:{display:"flex",flexDirection:"column"},children:T.length>0?(0,i.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===q?(0,i.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(g,{title:"What are Slices?",onCreateNew:function(){_(!0)},buttonText:"Create one",videoPublicIdUrl:p.rd,documentationComponent:(0,i.jsxs)(i.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,i.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"}),"."]})})}):T.map(function(e){var n=e.name,t=e.isLocal,r=e.components;return(0,i.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(u.xv,{children:n})}),!t&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(v.Z,{elems:r,defineElementKey:function(e){return e.model.name},renderElem:function(e){return(0,i.jsx)(B.b,{action:{type:"menu",onRemove:function(){Q(e),Y()},onRename:function(){Q(e),$()}},mode:"navigation",onUpdateScreenshot:function(){S({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,i.jsx)(j.Z,{slices:C(X),defaultVariationSelector:w}),(null==W?void 0:W.length)>0&&E&&(0,i.jsx)(x.c,{localLibraries:W,remoteSlices:N,onSuccess:function(e,n){var t=e.variations[0].id,r=M.Y.getBuilderPagePathname({libraryName:n,sliceName:e.name,variationId:t});c.push(r),m.Am.success((0,H.kQ)({path:"".concat(n,"/").concat(e.name,"/model.json")}))},onClose:function(){_(!1)}}),(0,i.jsx)(O,{isOpen:F,slice:G,onClose:function(){D(!1)},"data-cy":"rename-slice-modal"}),(0,i.jsx)(V,{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(){R(!1)}})]})]})]})}},76473:function(e,n,t){"use strict";t.d(n,{y1:function(){return g}});var r=t(2784);function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}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 c(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 s(e,n,t){void 0===n&&(n="+");var r,l=e.toLocaleLowerCase().split(n).map(function(e){return c(e)});return i({},{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([c(e.key),c(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&m([c(e.key),c(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){return Array.isArray(e)}function f(e){var 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 r=t&&t.tagName;return d(n)?Boolean(r&&n&&n.some(function(e){return e.toLowerCase()===r.toLowerCase()})):Boolean(r&&n&&!0===n)}var h=function(e,n,t){void 0===t&&(t=!1);var r,i,o=n.alt,l=n.meta,a=n.mod,s=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=c(h),j=p.toLowerCase();if(!t){if(!b===o&&"alt"!==j||!y===s&&"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===i&&(i=","),(d(r=m)?r:r.split(i)).every(function(e){return u.has(e.trim().toLowerCase())})):!m)},x=(0,r.createContext)(void 0),v=(0,r.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),y=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function g(e,n,t,i){var o,l,u=(0,r.useRef)(null),g=(0,r.useRef)(!1),j=t instanceof Array?i instanceof Array?void 0:i:t,S=d(e)?e.join(null==j?void 0:j.splitKey):e,C=t instanceof Array?t:i instanceof Array?i:void 0,w=(0,r.useCallback)(n,null!=C?C:[]),k=(0,r.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(r,i){return r&&e(n[i],t[i])},!0):n===t}((l=(0,r.useRef)(void 0)).current,j)&&(l.current=j),l.current),N=(0,r.useContext)(v).enabledScopes,L=(0,r.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,r;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 r,i,o,l,c,a,u,d=s(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(r=e,i=d,("function"==typeof(o=null==I?void 0:I.preventDefault)&&o(r,i)||!0===o)&&r.preventDefault(),l=e,c=d,"function"==typeof(a=null==I?void 0:I.enabled)?!a(l,c):!0!==a&&void 0!==a){y(e);return}k.current(e,d),n||(g.current=!0)}})}},r=function(e){void 0!==e.key&&(f(c(e.code)),((null==I?void 0:I.keydown)===void 0&&(null==I?void 0:I.keyup)!==!0||null!=I&&I.keydown)&&t(e))},i=function(e){void 0!==e.key&&(m(c(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",i),o.addEventListener("keydown",r),L&&a(S,null==I?void 0:I.splitKey).forEach(function(e){return L.addHotkey(s(e,null==I?void 0:I.combinationKey,null==I?void 0:I.description))}),function(){o.removeEventListener("keyup",i),o.removeEventListener("keydown",r),L&&a(S,null==I?void 0:I.splitKey).forEach(function(e){return L.removeHotkey(s(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()}]);