Web Stories - Version 1.23.2

Version Description

  • Fixes another issue related to story poster images.
Download this release

Release Info

Developer swissspidy
Plugin Icon 128x128 Web Stories
Version 1.23.2
Comparing to
See all releases

Code changes from version 1.23.1 to 1.23.2

assets/js/wp-dashboard.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-api-fetch', 'wp-dom-ready'), 'version' => '76d42626f28471345720');
1
+ <?php return array('dependencies' => array('wp-api-fetch', 'wp-dom-ready'), 'version' => '2c421a5dc5595fb56e8d');
assets/js/wp-dashboard.js CHANGED
@@ -92,7 +92,7 @@
92
  /* translators: %s: template title */
93
  (0,n.__)("Viewing %s","web-stories"),a.title))}),[k,d,e]),F=(0,h.useMemo)((()=>({createStoryFromTemplate:R,handleDetailsToggle:D,switchToTemplateByOffset:B})),[R,D,B]);return(0,h.useEffect)((()=>{S()}),[S]),(0,h.useEffect)((()=>{if(u.current&&k.length){if(!k.some((e=>e.id===parseInt(u.current))))return void d("");a(!0),x(parseInt(u.current))}}),[k,d,x]),r.createElement(Za.Provider,null,r.createElement(Pi,{isLoading:m&&!g,totalTemplates:P,searchOptions:N,view:O}),r.createElement(ki,{isLoading:m,allPagesFetched:p,page:I,templates:k,totalTemplates:P,search:C,view:O,templateActions:F}),r.createElement(Za.Fixed,null,r.createElement(No,null)),r.createElement(Xi,{activeTemplate:o,activeTemplateIndex:l,isDetailsViewOpen:t,templateActions:F,filteredTemplatesLength:k.length}))};const Ji=function(){const{storyError:e,templateError:t}=yr((e=>{let{state:{stories:{error:t},templates:{error:a}}}=e;return{storyError:t,templateError:a}})),{showSnackbar:a}=(0,un.useSnackbar)(),o=(0,h.useDebouncedCallback)((e=>a({message:e,dismissible:!0})),200);(0,h.useEffect)((()=>{e?.id&&o(e.message)}),[e,o]),(0,h.useEffect)((()=>{t?.id&&o(t.message)}),[t,o])};function FiltersProvider(e){let{children:t}=e;return r.createElement(StoryFiltersProvider,null,r.createElement(TemplateFiltersProvider,null,t))}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},el.apply(this,arguments)}const tl=e=>{let{additionalRoutes:t}=e;const{currentPath:a,templateId:o,availableRoutes:i}=so((e=>{let{state:t}=e;return{...t,templateId:t.queryParams.id}})),{push:l,setAvailableRoutes:s}=so((e=>{let{actions:t}=e;return t})),{canViewDefaultTemplates:c,leftRailSecondaryNavigation:d=[],documentTitleSuffix:u=(0,n.__)("Web Stories","web-stories")}=E(),{addInitialFetchListener:p}=yr((e=>{let{actions:{storyApi:{addInitialFetchListener:t}},state:{templates:{templates:a}}}=e;return{currentTemplate:void 0!==o?a[o]?.title:void 0,addInitialFetchListener:t}})),m=(0,h.useRef)(a===Fe.DASHBOARD),[b,f]=(0,h.useState)(!m.current);(0,h.useEffect)((()=>p?.((e=>{e?.all<=0&&m.current&&c&&l(Fe.TEMPLATES_GALLERY),f(!0)}))),[p,l,a,c]),(0,h.useEffect)((()=>{if(i.length>0)return;const e=t?t.map((e=>{let{path:t}=e;return t})):[];s([...Object.values(Fe),...e])}),[t,i.length,s]),(0,h.useEffect)((()=>{if(!b)return;const e=d.find((e=>e.value===a)),t=He[a]||e?.label||He.DEFAULT;document.title=(0,M.default)(
94
  /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
95
- (0,n.__)("%1$s ‹ %2$s","web-stories"),t,u),(0,y.trackScreenView)(t)}),[a,b,d,u]),Ji();const{clearSnackbar:_,removeSnack:g,placement:S,currentSnacks:T}=(0,un.useSnackbar)(),w=(0,h.usePrevious)(a);return(0,h.useEffect)((()=>{a!==w&&_()}),[_,a,w]),r.createElement(r.Fragment,null,r.createElement(qa,null,r.createElement(Io,null),r.createElement(FiltersProvider,null,r.createElement(Ka,null,r.createElement(uo,{exact:!0,isDefault:!0,path:Fe.DASHBOARD,component:r.createElement(_i,null)}),c&&r.createElement(uo,{path:Fe.TEMPLATES_GALLERY,component:r.createElement(Qi,null)}),t&&t.map((e=>r.createElement(uo,el({key:e.path},e))))))),r.createElement(pn.Snackbar.Container,{notifications:T,onRemove:g,placement:S,max:1}))};var al=a(43246),ol=a(51048),rl=a(89511),nl=a(88914),il=(a(88766),a(27342),a(40630),a(95740),a(98465),a(72858),a(28352));window.wp.domReady;var ll=a(6389);const sl=window.wp.apiFetch,cl=["id","title","status","date","date_gmt","modified","modified_gmt","link","meta.web_stories_poster","preview_link","edit_link","body","status","headers"].join(","),dl=["id","title"],ul=["title","link"],pl="wp:lock,wp:lockuser,author,wp:featuredmedia",ml="wp:action-edit",bl="wp:action-delete";function fl(e){const{id:t,title:a,status:o,date:r,date_gmt:n,modified:i,modified_gmt:l,link:s,preview_link:c,edit_link:d,meta:{web_stories_poster:u={}},_embedded:{author:p=[{name:"",id:0}],"wp:featuredmedia":m=[{source_url:""}],"wp:lock":b=[{locked:!1}],"wp:lockuser":f=[{id:0,name:""}]}={},_links:h={}}=e;if(!t)return null;const{source_url:_}=m[0],g={hasEditAction:Object.prototype.hasOwnProperty.call(h,ml),hasDeleteAction:Object.prototype.hasOwnProperty.call(h,bl)};return{id:t,status:o,title:a.raw,created:r,createdGmt:`${n}Z`,modified:i,modifiedGmt:`${l}Z`,author:{name:p[0].name,id:p[0].id},locked:b[0]?.locked,lockUser:{id:f[0].id,name:f[0].name,avatar:f[0]?.avatar_urls?.[96]||null},bottomTargetAction:d,featuredMediaUrl:u?.url||_,editStoryLink:d,previewLink:c,link:s,capabilities:g,poster:u}}function hl(e,t){const{page:a=1,perPage:o=$e,filters:r={},sort:n={}}=t,i={...{_embed:pl,context:"edit",_web_stories_envelope:!0,_fields:cl,...J.filters,...J.sort},page:a,per_page:o,...r,...n};return sl({path:(0,ll.default)(e.api.stories,i)}).then((e=>{let{body:t,headers:a}=e;const o=a&&parseInt(a["X-WP-TotalPages"]),r=a&&JSON.parse(a["X-WP-TotalByStatus"]),n=[];return{stories:t.reduce(((e,t)=>t?(n.push(t.id),e[t.id]=fl(t),e):e),{}),fetchedStoryIds:n,totalPages:o,totalStoriesByStatus:r}}))}function _l(e,t){const a=(0,ll.default)(`${e.api.stories}${t}`,{_method:"DELETE"});return sl({path:a,method:"POST"})}function gl(e,t){const a=(0,ll.default)(`${e.api.stories}${t.id}/`,{_embed:pl}),o={id:t.id,author:t.author.id,title:t.title?.raw||t.title};return sl({path:a,data:o,method:"POST"}).then(fl)}const El=async(e,t)=>{const o=(0,ll.default)(e.api.stories,{_fields:"edit_link"}),{createdBy:r,pages:n,version:i,colors:l}=t,{getStoryMarkup:s}=await a.e(5985).then(a.bind(a,7159)),c={featuredMedia:{id:0,url:""},publisherLogo:{url:""},title:""},d={content:s(c,n,{publisher:r}),pages:n,featuredMedia:c.featuredMedia,title:c.title,status:"auto-draft",meta:{web_stories_publisher_logo:c.publisherLogo.id}},u=l.map((e=>{let{color:t}=e;return(0,pa.default)(t)}));return sl({path:o,data:{...d,story_data:{pages:n,version:i,autoAdvance:!0,defaultPageDuration:7,currentStoryStyles:{colors:u}}},method:"POST"}).then(ol.snakeToCamelCaseObjectKeys)};function Sl(e,t){const a=(0,ll.default)(e.api.stories,{_embed:pl,_fields:cl});return sl({path:a,data:{original_id:t.id,status:"draft"},method:"POST"}).then(fl)}function Tl(e,t){return sl({path:(0,ll.default)(e.api.users,{per_page:"100",who:"authors",search:t})})}async function yl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=await sl({path:(0,ll.default)(e.api.taxonomies,{type:"web-story",context:"edit",...t})});return Object.values(a).map((e=>(e.restPath=e._links?.["wp:items"]?.[0]?.href,delete e._links,(0,ol.snakeToCamelCaseObjectKeys)(e,["capabilities","visibility"]))))}function wl(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return sl({url:(0,ll.default)(t,a)})}function vl(e,t){return sl({path:(0,ll.default)(e.api.products,{per_page:1,search:t})})}var Il=a(95370);const Ol={SETTINGS:{UPDATED:(0,n.__)("Setting saved.","web-stories")}},Cl={UPLOAD_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to add publisher logo","web-stories"),MESSAGE_PLURAL:(0,n.__)("Unable to add publisher logos","web-stories")},REMOVE_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to remove publisher logo","web-stories")},REMOVE_FONT:{MESSAGE:(0,n.__)("Unable to remove font","web-stories")},UPDATE_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to update publisher logo","web-stories")},LOAD_PUBLISHER_LOGOS:{MESSAGE:(0,n.__)("Unable to load publisher logos","web-stories")},LOAD_SETTINGS:{MESSAGE:(0,n.__)("Unable to load settings","web-stories")},UPDATE_EDITOR_SETTINGS:{MESSAGE:(0,n.__)("Unable to update settings data","web-stories")}},Al="/editor-settings",Ll=[{value:Al,label:(0,n.__)("Settings","web-stories")},{value:(0,n.__)("https://wordpress.org/support/plugin/web-stories/","web-stories"),label:(0,n.__)("Support","web-stories"),isExternal:!0,trackingEvent:"click_support_page"}],kl="none",Pl="adsense",Nl="admanager",Rl={DEFAULT:"default",DISABLED:"disabled",CUSTOM:"custom"},xl="none",Ml="woocommerce",Dl="shopify",Bl=(0,m.createGlobalStyle)(["body.web-story_page_stories-dashboard #wpbody{",";}.","{top:","px !important;left:","px !important;}body.folded .","{left:","px !important;}"],Il.scrollbarCSS,c.OVERLAY_CLASS,32,160,c.OVERLAY_CLASS,36);const Fl=function(){const{currentPath:e}=so((e=>{let{state:{currentPath:t}}=e;return{currentPath:t}}));(0,h.useEffect)((()=>{let t=`a[href$="#${e}"]`;e.length<=1&&(t='a[href$="page=stories-dashboard"]');const a=document.querySelectorAll("#menu-posts-web-story ul.wp-submenu li");a?.forEach((e=>{e.classList.remove("current"),e.querySelector("a")?.classList.remove("current"),e.querySelector("a")?.removeAttribute("aria-current")})),a?.forEach((e=>{e.querySelector(t)&&(e.classList.add("current"),e.querySelector("a")?.classList.add("current"),e.querySelector("a")?.setAttribute("aria-current","page"))}))}),[e])},Hl=(0,h.createContext)({state:{},actions:{}});const Ul=function(e){return(0,h.useContextSelector)(Hl,e??h.identity)};const Gl={getItemByKey:function(e){let t=null;try{const a=localStorage.getItem(e);t=JSON.parse(a)}catch(e){(0,y.trackError)("local_storage_read",e.message)}return t},setItemByKey:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){(0,y.trackError)("local_storage_write",e.message)}}},Yl="web_stories_tracking_optin_banner_closed";function zl(){const e=localStorage.getItem(Yl);return Boolean(JSON.parse(e))}function jl(){const{showSnackbar:e}=(0,un.useSnackbar)(),[t,a]=(0,h.useState)(zl),[o,r]=(0,h.useState)(!1),{currentUser:n,toggleWebStoriesTrackingOptIn:i}=Ul((e=>{let{state:{currentUser:t},actions:{usersApi:{toggleWebStoriesTrackingOptIn:a}}}=e;return{currentUser:t,toggleWebStoriesTrackingOptIn:a}})),{currentPath:l}=so((e=>{let{state:{currentPath:t}}=e;return{currentPath:t}})),s=void 0!==n.data.meta?.webStoriesTrackingOptin,c=Boolean(n.data.meta?.webStoriesTrackingOptin);(0,h.useEffect)((()=>{c?(0,y.enableTracking)():(0,y.disableTracking)()}),[c]);const d=(0,h.useCallback)((()=>{i(),Gl.setItemByKey(Yl,!0),r(!0),e({"aria-label":Ol.SETTINGS.UPDATED,message:Ol.SETTINGS.UPDATED,dismissible:!0})}),[e,i]),u=(0,h.useCallback)((()=>{a(!0),Gl.setItemByKey(Yl,!0)}),[]);let p=!0;return(t||l===Al||!s||!o&&c)&&(p=!1),{bannerVisible:p,optedIn:c,disabled:n.isUpdating,closeBanner:u,toggleWebStoriesTrackingOptIn:d}}const Vl=function(){const{settingsError:e,mediaError:t,settingSaved:a,publisherLogosError:o}=Ul((e=>{let{state:{settings:{error:t,settingSaved:a},media:{error:o},publisherLogos:{error:r,settingSaved:n}}}=e;return{settingsError:t,mediaError:o,settingSaved:a||n,publisherLogosError:r}})),{showSnackbar:r}=(0,un.useSnackbar)(),n=(0,h.useDebouncedCallback)((e=>r({"aria-label":e,message:e,dismissible:!0})),200);(0,h.useEffect)((()=>{e?.id&&n(e.message)}),[e,n]),(0,h.useEffect)((()=>{a&&n(Ol.SETTINGS.UPDATED)}),[n,a]),(0,h.useEffect)((()=>{t?.id&&n(t.message)}),[t,n]),(0,h.useEffect)((()=>{o?.id&&n(o.message)}),[o,n])},$l=m.default.div.withConfig({displayName:"editorSettings__Wrapper",componentId:"sc-1y9ilpk-0"})([""]),Wl=(0,m.default)(ha).withConfig({displayName:"editorSettings__Main",componentId:"sc-1y9ilpk-1"})(["display:flex;flex-direction:column;padding-top:36px;margin-top:20px;margin-bottom:56px;max-width:945px;"]),Zl=m.default.form.withConfig({displayName:"editorSettings__SettingForm",componentId:"sc-1y9ilpk-2"})(["display:grid;grid-template-columns:27% minmax(400px,1fr);column-gap:6.56%;padding-bottom:52px;@media ","{grid-template-columns:100%;row-gap:20px;}"],(e=>{let{theme:t}=e;return t.breakpoint.mobile})),ql=(0,m.default)(bo.Headline).attrs({as:"h3"}).withConfig({displayName:"editorSettings__SettingHeading",componentId:"sc-1y9ilpk-3"})(["",";margin:8px 0;"],(e=>{let{theme:t}=e;return ka.expandPresetStyles({preset:{...t.typography.presets.label[La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.LARGE]},theme:t})})),Kl=(0,m.default)(ea.Link).withConfig({displayName:"editorSettings__InlineLink",componentId:"sc-1y9ilpk-4"})(["display:inline-block;"]),Xl=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__HelperText",componentId:"sc-1y9ilpk-5"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary})),Ql=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__ConnectionHelperText",componentId:"sc-1y9ilpk-6"})(["padding-top:12px;color:",";"],(e=>{let{hasError:t,theme:a}=e;return t?a.colors.fg.negative:a.colors.fg.tertiary})),Jl=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__CenterMutedText",componentId:"sc-1y9ilpk-7"})(["color:",";text-align:center;"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary})),es=(0,m.default)(Xl).withConfig({displayName:"editorSettings__SettingSubheading",componentId:"sc-1y9ilpk-8"})(["padding:8px 0;"]),ts=(0,m.default)(Xl).withConfig({displayName:"editorSettings__TextInputHelperText",componentId:"sc-1y9ilpk-9"})(["padding-top:12px;"]),as=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__CheckboxLabel",componentId:"sc-1y9ilpk-10"})(["display:flex;justify-content:flex-start;margin-top:8px;cursor:pointer;"]),os=(0,m.default)(Xl).withConfig({displayName:"editorSettings__CheckboxLabelText",componentId:"sc-1y9ilpk-11"})(["margin-left:8px;"]),rs=(0,m.default)(Jl).withConfig({displayName:"editorSettings__Error",componentId:"sc-1y9ilpk-12"})(["padding-bottom:10px;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.negative})),ns=m.default.div.withConfig({displayName:"editorSettings__UploadedContainer",componentId:"sc-1y9ilpk-13"})(["display:grid;grid-template-columns:repeat(auto-fill,102px);grid-auto-rows:102px;grid-column-gap:12px;grid-row-gap:20px;padding-bottom:20px;margin-bottom:4px;border:1px solid transparent;",";"],Vt.focusableOutlineCSS),is=m.default.div.withConfig({displayName:"editorSettings__GridItemContainer",componentId:"sc-1y9ilpk-14"})(["position:relative;",";&:hover,&:focus-within{button{opacity:1 !important;}}"],(e=>{let{active:t,theme:a}=e;return t&&(0,m.css)(["border:1px solid ",";border-radius:",";"],a.colors.border.defaultActive,a.borders.radius.small)})),ls=m.default.button.withConfig({displayName:"editorSettings__GridItemButton",componentId:"sc-1y9ilpk-15"})(["display:block;background-color:transparent;border:2px solid transparent;width:100%;height:100%;border-radius:4px;padding:0;",";"],Vt.focusableOutlineCSS),ss=m.default.img.withConfig({displayName:"editorSettings__Logo",componentId:"sc-1y9ilpk-16"})(["object-fit:cover;width:100%;height:100%;border-radius:4px;"]),cs=m.default.div.withConfig({displayName:"editorSettings__MenuContainer",componentId:"sc-1y9ilpk-17"})(["position:absolute;top:0;width:100%;height:100%;"]),ds=(0,m.default)(Mt.Button).attrs({size:Dt.BUTTON_SIZES.SMALL,type:Dt.BUTTON_TYPES.SECONDARY,variant:Dt.BUTTON_VARIANTS.CIRCLE}).withConfig({displayName:"editorSettings__LogoMenuButton",componentId:"sc-1y9ilpk-18"})(["opacity:",";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);"],(e=>{let{isActive:t,menuOpen:a}=e;return a||t?1:0})),us=(0,m.default)(Mt.Button).withConfig({displayName:"editorSettings__SaveButton",componentId:"sc-1y9ilpk-19"})(["height:36px;"]),ps=(0,m.default)(Mt.Button).withConfig({displayName:"editorSettings__TestConnectionButton",componentId:"sc-1y9ilpk-20"})(["height:36px;margin-top:12px;"]),ms=m.default.div.withConfig({displayName:"editorSettings__InlineForm",componentId:"sc-1y9ilpk-21"})(["display:flex;align-items:flex-start;"]),bs=m.default.label.withConfig({displayName:"editorSettings__VisuallyHiddenLabel",componentId:"sc-1y9ilpk-22"})(Ta.visuallyHidden),fs=(0,m.default)(Ha).withConfig({displayName:"editorSettings__SettingsTextInput",componentId:"sc-1y9ilpk-23"})(["margin-right:8px;"]),hs=(m.default.span.withConfig({displayName:"editorSettings__VisuallyHiddenDescription",componentId:"sc-1y9ilpk-24"})(Ta.visuallyHidden),(0,m.default)(Zl).withConfig({displayName:"editorSettings__MultilineForm",componentId:"sc-1y9ilpk-25"})(["margin-bottom:28px;","{margin-top:20px;}"],ms)),_s={SLOT_ID_LABEL:(0,n.__)("Monetization type","web-stories"),HELPER_MESSAGE_ADSENSE:(0,n.__)("Learn more about <a>how to monetize your Web Stories</a> using AdSense. Once configured, AdSense will determine where and how to insert ads into the story. Consult <help>AdSense Help</help> for any further assistance.","web-stories"),HELPER_MESSAGE_ADMANAGER:(0,n.__)("Learn how to <a>enable programmatic demand in Web Stories</a> through Ad Manager.","web-stories"),HELPER_LINK_ADSENSE:(0,n.__)("https://support.google.com/adsense/answer/10175505","web-stories"),HELPER_LINK_ADSENSE_HELP:(0,n.__)("https://support.google.com/adsense/","web-stories"),HELPER_LINK_ADMANAGER:(0,n.__)("https://support.google.com/admanager/answer/9416436","web-stories")},gs=[{label:(0,n._x)("None","ad network","web-stories"),value:kl},{label:(0,n.__)("Google AdSense","web-stories"),value:Pl},{label:(0,n.__)("Google Ad Manager","web-stories"),value:Nl}];const Es=function AdNetworkSettings(e){let{adNetwork:t,handleUpdate:a}=e;const[o,n]=(0,h.useState)(t);(0,h.useEffect)((()=>n(t)),[t]);const i=(0,h.useMemo)((()=>Nl===o?_s.HELPER_MESSAGE_ADMANAGER:Pl===o?_s.HELPER_MESSAGE_ADSENSE:null),[o]),l=(0,h.useMemo)((()=>Nl===o?_s.HELPER_LINK_ADMANAGER:Pl===o?_s.HELPER_LINK_ADSENSE:null),[o]),s=(0,h.useCallback)((e=>(0,y.trackClick)(e,"click_monetization_docs")),[]);return r.createElement(r.Fragment,null,r.createElement(Lr.DropDown,{ariaLabel:_s.SLOT_ID_LABEL,options:gs,selectedValue:o,onMenuItemClick:(e,t)=>a(t),fillWidth:!0}),i&&r.createElement(ts,{size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},r.createElement(hr.default,{mapping:{a:r.createElement(Kl,{href:l,rel:"noreferrer",target:"_blank",onClick:s,size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL}),help:r.createElement(Kl,{href:_s.HELPER_LINK_ADSENSE_HELP,rel:"noreferrer",target:"_blank",size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL})}},i)))},Ss=/^\/\d+(,\d+)?(\/[\w\d_\-.*\\!<:()]{1,99}[^/])*$/;const Ts={SLOT_ID_CONTEXT:(0,M.default)(
96
  /* translators: %s: example value. */
97
  (0,n.__)("Example: %s","web-stories"),"/123456789/a4a/amp_story_dfp_example"),SLOT_ID_PLACEHOLDER:(0,n.__)("Enter your Slot ID","web-stories"),SLOT_ID_LABEL:(0,n.__)("Google Ad Manager Slot ID","web-stories"),INPUT_ERROR:(0,n.__)("Invalid ID format","web-stories"),SUBMIT_BUTTON:(0,n.__)("Save","web-stories")};const ys=function GoogleAdManagerSettings(e){let{slotId:t,handleUpdate:a}=e;const[o,n]=(0,h.useState)(t),[i,l]=(0,h.useState)(""),s=o!==t&&!i,c=!s;(0,h.useEffect)((()=>{n(t)}),[t]);const d=(0,h.useCallback)((e=>{const{value:t}=e.target;n(t),0===t.length||function(){return Boolean((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase().match(Ss))}(t)?l(""):l(Ts.INPUT_ERROR)}),[]),u=(0,h.useCallback)((()=>{s&&a(o)}),[s,o,a]),p=(0,h.useCallback)((e=>{"Enter"===e.key&&(e.preventDefault(),u())}),[u]);return r.createElement(r.Fragment,null,r.createElement(ms,null,r.createElement(bs,{htmlFor:"adManagerSlotId"},Ts.SLOT_ID_LABEL),r.createElement(fs,{id:"adManagerSlotId","aria-label":Ts.SLOT_ID_LABEL,value:o,onChange:d,onKeyDown:p,placeholder:Ts.SLOT_ID_PLACEHOLDER,hasError:Boolean(i),hint:i}),r.createElement(us,{type:Dt.BUTTON_TYPES.SECONDARY,size:Dt.BUTTON_SIZES.SMALL,disabled:c,onClick:u},Ts.SUBMIT_BUTTON)),r.createElement(ts,{size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},Ts.SLOT_ID_CONTEXT))},ws=/^(ca-)?pub-\d{16}$/;const vs=/^\d{10}$/;const Is={PUBLISHER_ID_CONTEXT:(0,M.default)(
98
  /* translators: 1: first example. 2: second example. */
92
  /* translators: %s: template title */
93
  (0,n.__)("Viewing %s","web-stories"),a.title))}),[k,d,e]),F=(0,h.useMemo)((()=>({createStoryFromTemplate:R,handleDetailsToggle:D,switchToTemplateByOffset:B})),[R,D,B]);return(0,h.useEffect)((()=>{S()}),[S]),(0,h.useEffect)((()=>{if(u.current&&k.length){if(!k.some((e=>e.id===parseInt(u.current))))return void d("");a(!0),x(parseInt(u.current))}}),[k,d,x]),r.createElement(Za.Provider,null,r.createElement(Pi,{isLoading:m&&!g,totalTemplates:P,searchOptions:N,view:O}),r.createElement(ki,{isLoading:m,allPagesFetched:p,page:I,templates:k,totalTemplates:P,search:C,view:O,templateActions:F}),r.createElement(Za.Fixed,null,r.createElement(No,null)),r.createElement(Xi,{activeTemplate:o,activeTemplateIndex:l,isDetailsViewOpen:t,templateActions:F,filteredTemplatesLength:k.length}))};const Ji=function(){const{storyError:e,templateError:t}=yr((e=>{let{state:{stories:{error:t},templates:{error:a}}}=e;return{storyError:t,templateError:a}})),{showSnackbar:a}=(0,un.useSnackbar)(),o=(0,h.useDebouncedCallback)((e=>a({message:e,dismissible:!0})),200);(0,h.useEffect)((()=>{e?.id&&o(e.message)}),[e,o]),(0,h.useEffect)((()=>{t?.id&&o(t.message)}),[t,o])};function FiltersProvider(e){let{children:t}=e;return r.createElement(StoryFiltersProvider,null,r.createElement(TemplateFiltersProvider,null,t))}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o])}return e},el.apply(this,arguments)}const tl=e=>{let{additionalRoutes:t}=e;const{currentPath:a,templateId:o,availableRoutes:i}=so((e=>{let{state:t}=e;return{...t,templateId:t.queryParams.id}})),{push:l,setAvailableRoutes:s}=so((e=>{let{actions:t}=e;return t})),{canViewDefaultTemplates:c,leftRailSecondaryNavigation:d=[],documentTitleSuffix:u=(0,n.__)("Web Stories","web-stories")}=E(),{addInitialFetchListener:p}=yr((e=>{let{actions:{storyApi:{addInitialFetchListener:t}},state:{templates:{templates:a}}}=e;return{currentTemplate:void 0!==o?a[o]?.title:void 0,addInitialFetchListener:t}})),m=(0,h.useRef)(a===Fe.DASHBOARD),[b,f]=(0,h.useState)(!m.current);(0,h.useEffect)((()=>p?.((e=>{e?.all<=0&&m.current&&c&&l(Fe.TEMPLATES_GALLERY),f(!0)}))),[p,l,a,c]),(0,h.useEffect)((()=>{if(i.length>0)return;const e=t?t.map((e=>{let{path:t}=e;return t})):[];s([...Object.values(Fe),...e])}),[t,i.length,s]),(0,h.useEffect)((()=>{if(!b)return;const e=d.find((e=>e.value===a)),t=He[a]||e?.label||He.DEFAULT;document.title=(0,M.default)(
94
  /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
95
+ (0,n.__)("%1$s ‹ %2$s","web-stories"),t,u),(0,y.trackScreenView)(t)}),[a,b,d,u]),Ji();const{clearSnackbar:_,removeSnack:g,placement:S,currentSnacks:T}=(0,un.useSnackbar)(),w=(0,h.usePrevious)(a);return(0,h.useEffect)((()=>{a!==w&&_()}),[_,a,w]),r.createElement(r.Fragment,null,r.createElement(qa,null,r.createElement(Io,null),r.createElement(FiltersProvider,null,r.createElement(Ka,null,r.createElement(uo,{exact:!0,isDefault:!0,path:Fe.DASHBOARD,component:r.createElement(_i,null)}),c&&r.createElement(uo,{path:Fe.TEMPLATES_GALLERY,component:r.createElement(Qi,null)}),t&&t.map((e=>r.createElement(uo,el({key:e.path},e))))))),r.createElement(pn.Snackbar.Container,{notifications:T,onRemove:g,placement:S,max:1}))};var al=a(43246),ol=a(51048),rl=a(89511),nl=a(88914),il=(a(88766),a(27342),a(40630),a(95740),a(98465),a(72858),a(28352));window.wp.domReady;var ll=a(6389);const sl=window.wp.apiFetch,cl=["id","title","status","date","date_gmt","modified","modified_gmt","story_poster","link","preview_link","edit_link","body","status","headers"].join(","),dl=["id","title"],ul=["title","link"],pl="wp:lock,wp:lockuser,author",ml="wp:action-edit",bl="wp:action-delete";function fl(e){const{id:t,title:a,status:o,date:r,date_gmt:n,modified:i,modified_gmt:l,link:s,preview_link:c,edit_link:d,story_poster:u,_embedded:{author:p=[{name:"",id:0}],"wp:lock":m=[{locked:!1}],"wp:lockuser":b=[{id:0,name:""}]}={},_links:f={}}=e;if(!t)return null;const h={hasEditAction:Object.prototype.hasOwnProperty.call(f,ml),hasDeleteAction:Object.prototype.hasOwnProperty.call(f,bl)};return{id:t,status:o,title:a.raw,created:r,createdGmt:`${n}Z`,modified:i,modifiedGmt:`${l}Z`,author:{name:p[0].name,id:p[0].id},locked:m[0]?.locked,lockUser:{id:b[0].id,name:b[0].name,avatar:b[0]?.avatar_urls?.[96]||null},bottomTargetAction:d,featuredMediaUrl:u?.url,editStoryLink:d,previewLink:c,link:s,capabilities:h}}function hl(e,t){const{page:a=1,perPage:o=$e,filters:r={},sort:n={}}=t,i={...{_embed:pl,context:"edit",_web_stories_envelope:!0,_fields:cl,...J.filters,...J.sort},page:a,per_page:o,...r,...n};return sl({path:(0,ll.default)(e.api.stories,i)}).then((e=>{let{body:t,headers:a}=e;const o=a&&parseInt(a["X-WP-TotalPages"]),r=a&&JSON.parse(a["X-WP-TotalByStatus"]),n=[];return{stories:t.reduce(((e,t)=>t?(n.push(t.id),e[t.id]=fl(t),e):e),{}),fetchedStoryIds:n,totalPages:o,totalStoriesByStatus:r}}))}function _l(e,t){const a=(0,ll.default)(`${e.api.stories}${t}`,{_method:"DELETE"});return sl({path:a,method:"POST"})}function gl(e,t){const a=(0,ll.default)(`${e.api.stories}${t.id}/`,{_embed:pl}),o={id:t.id,author:t.author.id,title:t.title?.raw||t.title};return sl({path:a,data:o,method:"POST"}).then(fl)}const El=async(e,t)=>{const o=(0,ll.default)(e.api.stories,{_fields:"edit_link"}),{createdBy:r,pages:n,version:i,colors:l}=t,{getStoryMarkup:s}=await a.e(5985).then(a.bind(a,7159)),c={featuredMedia:{id:0,url:""},publisherLogo:{url:""},title:""},d={content:s(c,n,{publisher:r}),pages:n,featuredMedia:c.featuredMedia,title:c.title,status:"auto-draft",meta:{web_stories_publisher_logo:c.publisherLogo.id}},u=l.map((e=>{let{color:t}=e;return(0,pa.default)(t)}));return sl({path:o,data:{...d,story_data:{pages:n,version:i,autoAdvance:!0,defaultPageDuration:7,currentStoryStyles:{colors:u}}},method:"POST"}).then(ol.snakeToCamelCaseObjectKeys)};function Sl(e,t){const a=(0,ll.default)(e.api.stories,{_embed:pl,_fields:cl});return sl({path:a,data:{original_id:t.id,status:"draft"},method:"POST"}).then(fl)}function Tl(e,t){return sl({path:(0,ll.default)(e.api.users,{per_page:"100",who:"authors",search:t})})}async function yl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=await sl({path:(0,ll.default)(e.api.taxonomies,{type:"web-story",context:"edit",...t})});return Object.values(a).map((e=>(e.restPath=e._links?.["wp:items"]?.[0]?.href,delete e._links,(0,ol.snakeToCamelCaseObjectKeys)(e,["capabilities","visibility"]))))}function wl(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return sl({url:(0,ll.default)(t,a)})}function vl(e,t){return sl({path:(0,ll.default)(e.api.products,{per_page:1,search:t})})}var Il=a(95370);const Ol={SETTINGS:{UPDATED:(0,n.__)("Setting saved.","web-stories")}},Cl={UPLOAD_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to add publisher logo","web-stories"),MESSAGE_PLURAL:(0,n.__)("Unable to add publisher logos","web-stories")},REMOVE_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to remove publisher logo","web-stories")},REMOVE_FONT:{MESSAGE:(0,n.__)("Unable to remove font","web-stories")},UPDATE_PUBLISHER_LOGO:{MESSAGE:(0,n.__)("Unable to update publisher logo","web-stories")},LOAD_PUBLISHER_LOGOS:{MESSAGE:(0,n.__)("Unable to load publisher logos","web-stories")},LOAD_SETTINGS:{MESSAGE:(0,n.__)("Unable to load settings","web-stories")},UPDATE_EDITOR_SETTINGS:{MESSAGE:(0,n.__)("Unable to update settings data","web-stories")}},Al="/editor-settings",Ll=[{value:Al,label:(0,n.__)("Settings","web-stories")},{value:(0,n.__)("https://wordpress.org/support/plugin/web-stories/","web-stories"),label:(0,n.__)("Support","web-stories"),isExternal:!0,trackingEvent:"click_support_page"}],kl="none",Pl="adsense",Nl="admanager",Rl={DEFAULT:"default",DISABLED:"disabled",CUSTOM:"custom"},xl="none",Ml="woocommerce",Dl="shopify",Bl=(0,m.createGlobalStyle)(["body.web-story_page_stories-dashboard #wpbody{",";}.","{top:","px !important;left:","px !important;}body.folded .","{left:","px !important;}"],Il.scrollbarCSS,c.OVERLAY_CLASS,32,160,c.OVERLAY_CLASS,36);const Fl=function(){const{currentPath:e}=so((e=>{let{state:{currentPath:t}}=e;return{currentPath:t}}));(0,h.useEffect)((()=>{let t=`a[href$="#${e}"]`;e.length<=1&&(t='a[href$="page=stories-dashboard"]');const a=document.querySelectorAll("#menu-posts-web-story ul.wp-submenu li");a?.forEach((e=>{e.classList.remove("current"),e.querySelector("a")?.classList.remove("current"),e.querySelector("a")?.removeAttribute("aria-current")})),a?.forEach((e=>{e.querySelector(t)&&(e.classList.add("current"),e.querySelector("a")?.classList.add("current"),e.querySelector("a")?.setAttribute("aria-current","page"))}))}),[e])},Hl=(0,h.createContext)({state:{},actions:{}});const Ul=function(e){return(0,h.useContextSelector)(Hl,e??h.identity)};const Gl={getItemByKey:function(e){let t=null;try{const a=localStorage.getItem(e);t=JSON.parse(a)}catch(e){(0,y.trackError)("local_storage_read",e.message)}return t},setItemByKey:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){(0,y.trackError)("local_storage_write",e.message)}}},Yl="web_stories_tracking_optin_banner_closed";function zl(){const e=localStorage.getItem(Yl);return Boolean(JSON.parse(e))}function jl(){const{showSnackbar:e}=(0,un.useSnackbar)(),[t,a]=(0,h.useState)(zl),[o,r]=(0,h.useState)(!1),{currentUser:n,toggleWebStoriesTrackingOptIn:i}=Ul((e=>{let{state:{currentUser:t},actions:{usersApi:{toggleWebStoriesTrackingOptIn:a}}}=e;return{currentUser:t,toggleWebStoriesTrackingOptIn:a}})),{currentPath:l}=so((e=>{let{state:{currentPath:t}}=e;return{currentPath:t}})),s=void 0!==n.data.meta?.webStoriesTrackingOptin,c=Boolean(n.data.meta?.webStoriesTrackingOptin);(0,h.useEffect)((()=>{c?(0,y.enableTracking)():(0,y.disableTracking)()}),[c]);const d=(0,h.useCallback)((()=>{i(),Gl.setItemByKey(Yl,!0),r(!0),e({"aria-label":Ol.SETTINGS.UPDATED,message:Ol.SETTINGS.UPDATED,dismissible:!0})}),[e,i]),u=(0,h.useCallback)((()=>{a(!0),Gl.setItemByKey(Yl,!0)}),[]);let p=!0;return(t||l===Al||!s||!o&&c)&&(p=!1),{bannerVisible:p,optedIn:c,disabled:n.isUpdating,closeBanner:u,toggleWebStoriesTrackingOptIn:d}}const Vl=function(){const{settingsError:e,mediaError:t,settingSaved:a,publisherLogosError:o}=Ul((e=>{let{state:{settings:{error:t,settingSaved:a},media:{error:o},publisherLogos:{error:r,settingSaved:n}}}=e;return{settingsError:t,mediaError:o,settingSaved:a||n,publisherLogosError:r}})),{showSnackbar:r}=(0,un.useSnackbar)(),n=(0,h.useDebouncedCallback)((e=>r({"aria-label":e,message:e,dismissible:!0})),200);(0,h.useEffect)((()=>{e?.id&&n(e.message)}),[e,n]),(0,h.useEffect)((()=>{a&&n(Ol.SETTINGS.UPDATED)}),[n,a]),(0,h.useEffect)((()=>{t?.id&&n(t.message)}),[t,n]),(0,h.useEffect)((()=>{o?.id&&n(o.message)}),[o,n])},$l=m.default.div.withConfig({displayName:"editorSettings__Wrapper",componentId:"sc-1y9ilpk-0"})([""]),Wl=(0,m.default)(ha).withConfig({displayName:"editorSettings__Main",componentId:"sc-1y9ilpk-1"})(["display:flex;flex-direction:column;padding-top:36px;margin-top:20px;margin-bottom:56px;max-width:945px;"]),Zl=m.default.form.withConfig({displayName:"editorSettings__SettingForm",componentId:"sc-1y9ilpk-2"})(["display:grid;grid-template-columns:27% minmax(400px,1fr);column-gap:6.56%;padding-bottom:52px;@media ","{grid-template-columns:100%;row-gap:20px;}"],(e=>{let{theme:t}=e;return t.breakpoint.mobile})),ql=(0,m.default)(bo.Headline).attrs({as:"h3"}).withConfig({displayName:"editorSettings__SettingHeading",componentId:"sc-1y9ilpk-3"})(["",";margin:8px 0;"],(e=>{let{theme:t}=e;return ka.expandPresetStyles({preset:{...t.typography.presets.label[La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.LARGE]},theme:t})})),Kl=(0,m.default)(ea.Link).withConfig({displayName:"editorSettings__InlineLink",componentId:"sc-1y9ilpk-4"})(["display:inline-block;"]),Xl=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__HelperText",componentId:"sc-1y9ilpk-5"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary})),Ql=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__ConnectionHelperText",componentId:"sc-1y9ilpk-6"})(["padding-top:12px;color:",";"],(e=>{let{hasError:t,theme:a}=e;return t?a.colors.fg.negative:a.colors.fg.tertiary})),Jl=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__CenterMutedText",componentId:"sc-1y9ilpk-7"})(["color:",";text-align:center;"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary})),es=(0,m.default)(Xl).withConfig({displayName:"editorSettings__SettingSubheading",componentId:"sc-1y9ilpk-8"})(["padding:8px 0;"]),ts=(0,m.default)(Xl).withConfig({displayName:"editorSettings__TextInputHelperText",componentId:"sc-1y9ilpk-9"})(["padding-top:12px;"]),as=(0,m.default)(Sa.Text).withConfig({displayName:"editorSettings__CheckboxLabel",componentId:"sc-1y9ilpk-10"})(["display:flex;justify-content:flex-start;margin-top:8px;cursor:pointer;"]),os=(0,m.default)(Xl).withConfig({displayName:"editorSettings__CheckboxLabelText",componentId:"sc-1y9ilpk-11"})(["margin-left:8px;"]),rs=(0,m.default)(Jl).withConfig({displayName:"editorSettings__Error",componentId:"sc-1y9ilpk-12"})(["padding-bottom:10px;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.negative})),ns=m.default.div.withConfig({displayName:"editorSettings__UploadedContainer",componentId:"sc-1y9ilpk-13"})(["display:grid;grid-template-columns:repeat(auto-fill,102px);grid-auto-rows:102px;grid-column-gap:12px;grid-row-gap:20px;padding-bottom:20px;margin-bottom:4px;border:1px solid transparent;",";"],Vt.focusableOutlineCSS),is=m.default.div.withConfig({displayName:"editorSettings__GridItemContainer",componentId:"sc-1y9ilpk-14"})(["position:relative;",";&:hover,&:focus-within{button{opacity:1 !important;}}"],(e=>{let{active:t,theme:a}=e;return t&&(0,m.css)(["border:1px solid ",";border-radius:",";"],a.colors.border.defaultActive,a.borders.radius.small)})),ls=m.default.button.withConfig({displayName:"editorSettings__GridItemButton",componentId:"sc-1y9ilpk-15"})(["display:block;background-color:transparent;border:2px solid transparent;width:100%;height:100%;border-radius:4px;padding:0;",";"],Vt.focusableOutlineCSS),ss=m.default.img.withConfig({displayName:"editorSettings__Logo",componentId:"sc-1y9ilpk-16"})(["object-fit:cover;width:100%;height:100%;border-radius:4px;"]),cs=m.default.div.withConfig({displayName:"editorSettings__MenuContainer",componentId:"sc-1y9ilpk-17"})(["position:absolute;top:0;width:100%;height:100%;"]),ds=(0,m.default)(Mt.Button).attrs({size:Dt.BUTTON_SIZES.SMALL,type:Dt.BUTTON_TYPES.SECONDARY,variant:Dt.BUTTON_VARIANTS.CIRCLE}).withConfig({displayName:"editorSettings__LogoMenuButton",componentId:"sc-1y9ilpk-18"})(["opacity:",";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);"],(e=>{let{isActive:t,menuOpen:a}=e;return a||t?1:0})),us=(0,m.default)(Mt.Button).withConfig({displayName:"editorSettings__SaveButton",componentId:"sc-1y9ilpk-19"})(["height:36px;"]),ps=(0,m.default)(Mt.Button).withConfig({displayName:"editorSettings__TestConnectionButton",componentId:"sc-1y9ilpk-20"})(["height:36px;margin-top:12px;"]),ms=m.default.div.withConfig({displayName:"editorSettings__InlineForm",componentId:"sc-1y9ilpk-21"})(["display:flex;align-items:flex-start;"]),bs=m.default.label.withConfig({displayName:"editorSettings__VisuallyHiddenLabel",componentId:"sc-1y9ilpk-22"})(Ta.visuallyHidden),fs=(0,m.default)(Ha).withConfig({displayName:"editorSettings__SettingsTextInput",componentId:"sc-1y9ilpk-23"})(["margin-right:8px;"]),hs=(m.default.span.withConfig({displayName:"editorSettings__VisuallyHiddenDescription",componentId:"sc-1y9ilpk-24"})(Ta.visuallyHidden),(0,m.default)(Zl).withConfig({displayName:"editorSettings__MultilineForm",componentId:"sc-1y9ilpk-25"})(["margin-bottom:28px;","{margin-top:20px;}"],ms)),_s={SLOT_ID_LABEL:(0,n.__)("Monetization type","web-stories"),HELPER_MESSAGE_ADSENSE:(0,n.__)("Learn more about <a>how to monetize your Web Stories</a> using AdSense. Once configured, AdSense will determine where and how to insert ads into the story. Consult <help>AdSense Help</help> for any further assistance.","web-stories"),HELPER_MESSAGE_ADMANAGER:(0,n.__)("Learn how to <a>enable programmatic demand in Web Stories</a> through Ad Manager.","web-stories"),HELPER_LINK_ADSENSE:(0,n.__)("https://support.google.com/adsense/answer/10175505","web-stories"),HELPER_LINK_ADSENSE_HELP:(0,n.__)("https://support.google.com/adsense/","web-stories"),HELPER_LINK_ADMANAGER:(0,n.__)("https://support.google.com/admanager/answer/9416436","web-stories")},gs=[{label:(0,n._x)("None","ad network","web-stories"),value:kl},{label:(0,n.__)("Google AdSense","web-stories"),value:Pl},{label:(0,n.__)("Google Ad Manager","web-stories"),value:Nl}];const Es=function AdNetworkSettings(e){let{adNetwork:t,handleUpdate:a}=e;const[o,n]=(0,h.useState)(t);(0,h.useEffect)((()=>n(t)),[t]);const i=(0,h.useMemo)((()=>Nl===o?_s.HELPER_MESSAGE_ADMANAGER:Pl===o?_s.HELPER_MESSAGE_ADSENSE:null),[o]),l=(0,h.useMemo)((()=>Nl===o?_s.HELPER_LINK_ADMANAGER:Pl===o?_s.HELPER_LINK_ADSENSE:null),[o]),s=(0,h.useCallback)((e=>(0,y.trackClick)(e,"click_monetization_docs")),[]);return r.createElement(r.Fragment,null,r.createElement(Lr.DropDown,{ariaLabel:_s.SLOT_ID_LABEL,options:gs,selectedValue:o,onMenuItemClick:(e,t)=>a(t),fillWidth:!0}),i&&r.createElement(ts,{size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},r.createElement(hr.default,{mapping:{a:r.createElement(Kl,{href:l,rel:"noreferrer",target:"_blank",onClick:s,size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL}),help:r.createElement(Kl,{href:_s.HELPER_LINK_ADSENSE_HELP,rel:"noreferrer",target:"_blank",size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL})}},i)))},Ss=/^\/\d+(,\d+)?(\/[\w\d_\-.*\\!<:()]{1,99}[^/])*$/;const Ts={SLOT_ID_CONTEXT:(0,M.default)(
96
  /* translators: %s: example value. */
97
  (0,n.__)("Example: %s","web-stories"),"/123456789/a4a/amp_story_dfp_example"),SLOT_ID_PLACEHOLDER:(0,n.__)("Enter your Slot ID","web-stories"),SLOT_ID_LABEL:(0,n.__)("Google Ad Manager Slot ID","web-stories"),INPUT_ERROR:(0,n.__)("Invalid ID format","web-stories"),SUBMIT_BUTTON:(0,n.__)("Save","web-stories")};const ys=function GoogleAdManagerSettings(e){let{slotId:t,handleUpdate:a}=e;const[o,n]=(0,h.useState)(t),[i,l]=(0,h.useState)(""),s=o!==t&&!i,c=!s;(0,h.useEffect)((()=>{n(t)}),[t]);const d=(0,h.useCallback)((e=>{const{value:t}=e.target;n(t),0===t.length||function(){return Boolean((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase().match(Ss))}(t)?l(""):l(Ts.INPUT_ERROR)}),[]),u=(0,h.useCallback)((()=>{s&&a(o)}),[s,o,a]),p=(0,h.useCallback)((e=>{"Enter"===e.key&&(e.preventDefault(),u())}),[u]);return r.createElement(r.Fragment,null,r.createElement(ms,null,r.createElement(bs,{htmlFor:"adManagerSlotId"},Ts.SLOT_ID_LABEL),r.createElement(fs,{id:"adManagerSlotId","aria-label":Ts.SLOT_ID_LABEL,value:o,onChange:d,onKeyDown:p,placeholder:Ts.SLOT_ID_PLACEHOLDER,hasError:Boolean(i),hint:i}),r.createElement(us,{type:Dt.BUTTON_TYPES.SECONDARY,size:Dt.BUTTON_SIZES.SMALL,disabled:c,onClick:u},Ts.SUBMIT_BUTTON)),r.createElement(ts,{size:La.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},Ts.SLOT_ID_CONTEXT))},ws=/^(ca-)?pub-\d{16}$/;const vs=/^\d{10}$/;const Is={PUBLISHER_ID_CONTEXT:(0,M.default)(
98
  /* translators: 1: first example. 2: second example. */
assets/js/wp-story-editor.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-api-fetch', 'wp-dom-ready'), 'version' => 'adfd6298c2248bc2f920');
1
+ <?php return array('dependencies' => array('wp-api-fetch', 'wp-dom-ready'), 'version' => 'a6e5409c1d1ff64f371e');
assets/js/wp-story-editor.js CHANGED
@@ -37,7 +37,7 @@ e=(0,We.default)(
37
  /* translators: %s: list of allowed file types. */
38
  (0,d.__)("Please choose only %s to upload.","web-stories"),(0,At.default)(n))),Mt("ValidError",t.name,e)}}}),[l,i,s,n]),p=(0,u.useCallback)((function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;c({file:n,overrideAllowedMimeTypes:a});const o={storyId:t,altText:V(n),mediaSource:"editor",...r};return e(n,o)}),[l,c,t,e]);return(0,u.useMemo)((()=>({actions:{uploadFile:p,validateFileForUpload:c}})),[c,p])};function Dt(){}const Bt=e=>e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."));const Ft=async function(e){const t=await re(e);return await le(t),ue(t)};var Ht=n(12902);const Ut="ADD_PAGE",jt="UPDATE_PAGE",zt="DELETE_PAGE",Gt="ARRANGE_PAGE",Yt="DELETE_ELEMENTS",Zt="ADD_ELEMENTS",Wt="UPDATE_ELEMENTS",Vt="UPDATE_ELEMENTS_BY_RESOURCE_ID",$t="DELETE_ELEMENTS_BY_RESOURCE_ID",qt="SET_BACKGROUND_ELEMENT",Kt="ARRANGE_ELEMENT",Xt="ARRANGE_GROUP",Qt="COMBINE_ELEMENTS",Jt="DUPLICATE_ELEMENTS_BY_ID",en="COPY_SELECTED_ELEMENT",tn="UPDATE_ELEMENTS_BY_FONT_FAMILY",nn="SET_CURRENT_PAGE",rn="SET_SELECTED_ELEMENTS",an="SELECT_ELEMENT",on="UNSELECT_ELEMENT",ln="TOGGLE_ELEMENT_IN_SELECTION",sn="TOGGLE_LAYER",cn="UPDATE_STORY",dn="UPDATE_ANIMATION_STATE",un="ADD_ANIMATIONS",pn="RESTORE",mn=["id","elements","groups"],gn=["id","isBackground","isDefaultBackground"],fn="ADD_GROUP",hn="UPDATE_GROUP",bn="DELETE_GROUP",En="DUPLICATE_GROUP",yn="REMOVE_ELEMENT_FROM_GROUP";function _n(e,t){return Object.keys(e).filter((e=>!t.includes(e))).reduce(((t,n)=>({...t,[n]:e[n]})),{})}function vn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e&&n?.length?n.reduce(((e,t)=>e.filter((e=>t.includes(e)))),e):e}function wn(e,t,n){return e>=t&&e<=n}function Tn(e,t,n){const r=e[t],a=[...e.slice(0,t),...e.slice(t+1)];return[...a.slice(0,n),r,...a.slice(n)]}function Sn(e){let{currentPosition:t,minPosition:n,maxPosition:r,desiredPosition:a}=e;if("number"==typeof a)return Math.min(r,Math.max(n,a));if("string"!=typeof a)return t;switch(a){case ke:return r;case Oe:return n;case Pe:return Math.min(r,t+1);case Ne:return Math.max(n,t-1);default:return t}}function Cn(e,t){const n=_n("function"==typeof t?t(e):t,gn);return 0===Object.keys(n).length?null:n.animation?n.animation:(Object.assign(e,n),null)}function In(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.reduce(((e,n)=>t.some((e=>n.targets?.includes(e)))?e:[...e,n]),[])}function xn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Object.values(Object.fromEntries(e.map((e=>[e.id,e]))))}function An(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=xn(t),r=e.map((e=>{let{id:t}=e;return t}));return n.filter((e=>{let{id:t}=e;return!r.includes(t)}))}const kn=(0,Ht.produce)(((e,t)=>{let{page:n,position:r}=t;if(!n.elements?.length)return;const a=null!==r&&wn(r,0,e.pages.length-1),o=e.pages.findIndex((t=>{let{id:n}=t;return n===e.current})),i=a?r:o+1;e.pages.splice(i,0,n),e.current=n.id,e.selection=[n.elements[0].id]})),On=(0,Ht.produce)(((e,t)=>{let{pageId:n}=t;if(e.pages.length<=1)return;const r=null===n?e.current:n,a=e.pages.findIndex((e=>{let{id:t}=e;return t===r}));if(-1!==a){if(e.pages.splice(a,1),r===e.current){const t=Math.min(e.pages.length-1,a);e.current=e.pages[t].id}e.selection=[]}})),Pn=(0,Ht.produce)(((e,t)=>{let{pageId:n,properties:r}=t;const a=null===n?e.current:n,o=e.pages.find((e=>{let{id:t}=e;return t===a}));if(!o)return;const i=_n(r,mn);Object.assign(o,i)})),Nn=(0,Ht.produce)(((e,t)=>{let{pageId:n,position:r}=t;if(e.pages.length<2)return;const a=e.pages.findIndex((e=>{let{id:t}=e;return t===n})),o=wn(r,0,e.pages.length-1);-1!==a&&o&&!(a===r)&&(e.pages=Tn(e.pages,a,r))}));var Mn=n(88914);const Rn=e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT},Ln=e=>{let{type:t}=e;return t!==Mn.ELEMENT_TYPES.PRODUCT},Dn=(0,Ht.produce)(((e,t)=>{let{elements:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=An(r.elements,n);if(0===a.length)return;const o=[],i=a.filter(Ln);i.length&&(r.elements=r.elements.concat(i),o.push(...i.map((e=>{let{id:t}=e;return t}))));const l=a.filter(Rn);if(l.length){const e=r.elements.filter(Rn).map((e=>{let{product:t}=e;return t?.productId})),t=l.filter((t=>{let{product:n}=t;return!e.includes(n?.productId)}));e.length+t.length<=6&&(r.elements=r.elements.concat(t),o.push(...t.map((e=>{let{id:t}=e;return t}))))}o.length>0&&(e.selection=o)})),Bn=(e,t)=>{let{elementIds:n}=t;const r=null===n?e.selection:n;if(0===r.length)return;const a=e.pages.find((t=>{let{id:n}=t;return n===e.current})),o=a.elements.map((e=>{let{id:t}=e;return t})),i=a.elements[0],l=r.some((e=>e===i.id)),s=i.isDefaultBackground,c=l&&s?r.filter((e=>e!==i.id)):r;vn(o,c).length>0&&(a.elements=a.elements.filter((e=>!c.includes(e.id))),l&&!s&&a.elements.unshift(a.defaultBackgroundElement),a.animations&&(a.animations=a.animations.filter((e=>e.targets.some((e=>!c.includes(e)))))),e.selection=e.selection.filter((e=>!c.includes(e))))},Fn=(0,Ht.produce)(Bn);var Hn=n(58373);const Un=(0,Ht.produce)(((e,t)=>{let{elementIds:n,properties:r}=t;if([Hn.STORY_ANIMATION_STATE.PLAYING,Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED,Hn.STORY_ANIMATION_STATE.SCRUBBING].includes(e.animationState))return;const a=null===n?e.selection:n,o=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i={};o.elements.filter((e=>{let{id:t}=e;return a.includes(t)})).forEach((e=>{const t=Cn(e,r);t&&(i[t.id]={...t,targets:[e.id]})}));Object.keys(i).length>0&&(o.animations=function(e,t){const n=e.reduce(((e,n)=>{const r=t[n.id];return delete t[n.id],r?.delete?e:r?[...e,r]:[...e,n]}),[]);return Object.values(t).forEach((e=>n.push(e))),n}(o.animations||[],i))})),jn=(0,Ht.produce)(((e,t)=>{let{id:n,properties:r}=t;n&&e.pages.forEach((e=>{e.elements.filter((e=>{let{resource:t}=e;return t?.id===n})).forEach((e=>Cn(e,r)))}))})),zn=(0,Ht.produce)(((e,t)=>{let{id:n}=t;if(null===n)return;if(!e.pages.some((e=>e.elements.some((e=>e.resource?.id===n)))))return;const r=[];e.pages.forEach((e=>{const{elements:t,animations:a}=e,o=t[0].resource?.id===n;e.elements=t.filter((e=>{const{id:t,resource:a}=e;return a?.id!==n||(r.push(t),!1)})),o&&e.elements.unshift(e.defaultBackgroundElement),a&&(e.animations=a.filter((e=>e.targets.some((e=>!r.includes(e))))))})),e.selection=e.selection.filter((e=>!r.includes(e)))})),Gn=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=r.elements[0];if(null===n){if(a.isDefaultBackground)return;r.elements.forEach((e=>{delete e.isBackground})),r.elements.unshift(r.defaultBackgroundElement),e.selection=[r.defaultBackgroundElement.id]}else{const t=r.elements.findIndex((e=>{let{id:t}=e;return t===n})),o=0===t;if(!(-1!==t)||o)return;a.isDefaultBackground&&(r.defaultBackgroundElement=a),r.elements.splice(0,1);const i=t-1;e.selection.includes(a.id)&&(e.selection=e.selection.filter((e=>e!==a.id))),r.elements=Tn(r.elements,i,0),r.elements.forEach((e=>{e.id===n&&(e.isBackground=!0,Object.prototype.hasOwnProperty.call(e,"opacity")&&(e.opacity=100))})),e.selection.includes(n)&&e.selection.length>1&&(e.selection=e.selection.filter((e=>e!==n)))}const o=r.elements.find((e=>e.isBackground));r.animations=In(r.animations,[n,o.id])})),Yn=(e,t)=>{let{elementId:n,position:r,groupId:a=!1}=t;if(null===n&&1!==e.selection.length)return;const o=null!==n?n:e.selection[0],i=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(i.elements.length<3)return;const l=i.elements.findIndex((e=>{let{id:t}=e;return t===o}));if(-1===l||i.elements[0].id===o)return;const s=Sn({currentPosition:l,minPosition:1,maxPosition:i.elements.length-1,desiredPosition:r}),c=i.elements[l].groupId;if(l!==s||c!==a){if(a){if(!i.groups[a])return;i.elements[l].groupId=a}else null==a&&delete i.elements[l].groupId;if(c){i.elements.some((e=>e.groupId===c))||delete i.groups[c]}i.elements=Tn(i.elements,l,s)}},Zn=(0,Ht.produce)(Yn);n(77461);const Wn=(0,Ht.produce)(((e,t)=>{let{groupId:n,position:r}=t;if(!n)return;const{elements:a,groups:o}=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i=e=>e.groupId===n;if(!o?.[n]||!a.some(i))return;const l=a.findIndex(i),s=a.findLastIndex(i)-l+1,c=a.splice(l,s,"dummy"),d=Sn({currentPosition:l,minPosition:1,maxPosition:a.length-1,desiredPosition:r});a.splice(a.indexOf("dummy"),1),a.splice(d,0,...c)}));var Vn=n(25784),$n=n(88766),qn=(n(27342),n(40630)),Kn=n(95740),Xn=n(98465),Qn=(n(72858),n(28352));function Jn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&"object"==typeof e?Object.assign({},...t.map((t=>e&&t in e?{[t]:e&&e[t]}:{}))):{}}const er=(0,Ht.produce)(((e,t)=>{let{firstElement:n,secondId:r,shouldRetainAnimations:a=!0}=t;if(!n||!r)return;const o=n.id,i=n,l=e.pages.find((t=>{let{id:n}=t;return n===e.current})),s=l.elements.findIndex((e=>{let{id:t}=e;return t===r})),c=l.elements[s];if(!i||!i.resource||!c)return;c.isDefaultBackground&&(l.defaultBackgroundElement={...c,id:(0,pe.default)()});const d=["alt","type","resource","scale","focalX","focalY","tracks","poster"];c.isBackground?d.push("flip","overlay","width","height","x","y"):(d.push("link"),d.push("border"),(0,Vn.canSupportMultiBorder)(c)&&d.push("borderRadius"));const u={..._n(c,["isDefaultBackground"]),...Xn.DEFAULT_ATTRIBUTES_FOR_MEDIA,...Jn(i,d)};l.elements=l.elements.filter((e=>{let{id:t}=e;return t!==o})).map((e=>e.id===r?u:e)),l.animations=In(l.animations,a?[o]:[o,r]),e.selection=[r]})),tr=(0,Ht.produce)(((e,t)=>{let{elementIds:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current}));let a=!1;n.forEach((t=>{const n=r.elements.findIndex((e=>{let{id:n}=e;return n===t}));if(n<0)return;const o=r.elements[n];if(o.isBackground)return;if(o.type===Mn.ELEMENT_TYPES.PRODUCT)return;const{element:i,elementAnimations:l}=(0,Mn.duplicateElement)({element:o,animations:r.animations,existingElements:r.elements});a||(a=!0,e.selection=[]),e.selection.push(i.id),r.animations&&(r.animations=r.animations.concat(l)),r.elements.splice(n+1,0,i)}))})),nr=["background","backgroundColor","backgroundTextMode","border","borderRadius","content","flip","font","fontSize","lineHeight","lockAspectRatio","opacity","overlay","padding","rotationAngle","textAlign"],rr=(0,Ht.produce)((e=>{if(1!==e.selection?.length||!e.selection[0])return;const t=e.pages.find((t=>{let{id:n}=t;return n===e.current})),n=t.elements.find((t=>{let{id:n}=t;return n===e.selection[0]})),r=(t.animations||[]).filter((e=>{let{targets:t}=e;return t.includes(n.id)})),a=Jn(n,nr);e.copiedElementState={animations:r,styles:a,type:n.type}})),ar=(0,Ht.produce)(((e,t)=>{let{family:n,properties:r}=t;n&&e.pages.forEach((e=>{e.elements.filter((e=>{let{font:t}=e;return t?.family===n})).forEach((e=>Cn(e,r)))}))})),or=(0,Ht.produce)(((e,t)=>{let{pageId:n}=t;const r=e.pages.some((e=>{let{id:t}=e;return t===n})),a=e.current===n;r&&!a&&(e.current=n,e.selection=[])})),ir=(e,t)=>{let{elementIds:n,withLinked:r=!1}=t;const a="function"==typeof n?n((0,Ht.current)(e.selection)):n;if(!Array.isArray(a))return;const o=e.pages.find((t=>{let{id:n}=t;return n===e.current}));let i=a;if(r){const e=o.elements.filter((e=>{let{id:t}=e;return a.includes(t)})).map((e=>{let{groupId:t}=e;return t})).filter(Boolean),t=o.elements.filter((t=>{let{groupId:n}=t;return e.includes(n)})).map((e=>{let{id:t}=e;return t}));i=i.concat(t)}const l=[...new Set(i)];if(e.selection.length===l.length){if(vn(e.selection,l).length===e.selection.length)return}const s=e=>o.elements.find((t=>{let{id:n}=t;return n===e})),c=l.length>1,d=c&&!r?l.filter((e=>(e=>o.elements[0].id!==e)(e)&&(e=>!s(e).resource?.isPlaceholder)(e)&&(e=>!s(e).isLocked)(e))):l;e.animationState=Hn.STORY_ANIMATION_STATE.RESET,e.selection=d},lr=(0,Ht.produce)(ir),sr=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;if(!n||e.selection.includes(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=e=>r.elements.find((t=>{let{id:n}=t;return n===e})),o=r.elements[0].id===n,i=a(n),l=i?.resource?.isPlaceholder,s=e.selection.length>0;if((o||l)&&s)return;const c=i?.isLocked,d=e.selection.includes(r.elements[0].id),u=e.selection.some((e=>a(e).isLocked));d||c||u?e.selection=[n]:e.selection.push(n)})),cr=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;const r=e.selection.indexOf(n);-1!==r&&e.selection.splice(r,1)})),dr=(e,t)=>{let{elementId:n,withLinked:r=!1}=t;if(!n)return;const a=e.selection.includes(n),o=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i=o.elements[0].id,l=i===n,s=e.selection.length>0,c=o.elements.find((e=>{let{id:t}=e;return t===n}))?.groupId;let d=[n];if(c&&r){const t=o.elements.filter((e=>{let{groupId:t}=e;return c===t})).map((e=>{let{id:t}=e;return t})),n=e.selection.concat(t);d=d.concat(n)}if(!a){if(l&&s)return;const t=e.selection.includes(i),r=e=>o.elements.find((t=>{let{id:n}=t;return n===e})),a=e.selection.length>0&&r(e.selection[0]).isLocked,c=r(n);return t||a||c.isLocked?void(e.selection=d):void(e.selection=[...new Set(e.selection.concat(d))])}e.selection=e.selection.filter((e=>!d.includes(e)))},ur=(0,Ht.produce)(dr),pr=(0,Ht.produce)(((e,t)=>{let{elementId:n,metaKey:r,shiftKey:a,withLinked:o=!1}=t;if(r)return void dr(e,{elementId:n,withLinked:o});if(e.selection.length<=0||!a)return void ir(e,{elementIds:[n],withLinked:o});const i=e.selection[0],l=e.pages.find((t=>{let{id:n}=t;return n===e.current})).elements.map((e=>e.id)),s=l.findIndex((e=>e===i)),c=l.findIndex((e=>e===n)),d=Math.min(s,c),u=Math.max(s,c),p=l.slice(d,u+1);i!==p[0]&&p.reverse(),ir(e,{elementIds:p,withLinked:o})})),mr=(0,Ht.produce)(((e,t)=>{let{animationState:n}=t;e.animationState=n})),gr=(0,Ht.produce)(((e,t)=>{let{animations:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current}));r.animations||(r.animations=[]),r.animations=r.animations.concat(An(r.animations,n))})),fr=(0,Ht.produce)(((e,t)=>{let{pages:n,current:r,selection:a,story:o,capabilities:i}=t;if(!Array.isArray(n)||0===n.length)return;const l="object"==typeof o?o:{},s="object"==typeof i?i:{},c=r??e.current,d=n.some((e=>{let{id:t}=e;return t===c}))?c:n[0].id;return{pages:n,current:d,selection:Array.isArray(a)?a:[],story:l,animationState:e.animationState,capabilities:s,copiedElementState:{}}})),hr=(0,Ht.produce)(((e,t)=>{let{properties:n}=t;"function"!=typeof n?Object.assign(e.story,n):e.story=n((0,Ht.current)(e.story))})),br=(e,t)=>{let{groupId:n,name:r,isLocked:a=!1}=t;if(!n||!r)return;const o=e.pages.find((t=>{let{id:n}=t;return n===e.current}));o.groups||(o.groups={}),o.groups[n]={name:r,isLocked:a}},Er=(0,Ht.produce)(br),yr=(0,Ht.produce)(((e,t)=>{let{groupId:n,properties:r}=t;if(!n)return;const{groups:a}=e.pages.find((t=>{let{id:n}=t;return n===e.current}));a?.[n]&&Object.assign(a[n],r)})),_r=(0,Ht.produce)(((e,t)=>{let{groupId:n,includeElements:r=!1}=t;const{elements:a,groups:o}=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(!n||!o?.[n])return;delete o[n];const i=a.filter((e=>e.groupId===n));if(r){const t=i.map((e=>{let{id:t}=e;return t}));Bn(e,{elementIds:t})}else i.forEach((e=>{delete e.groupId}))})),vr=(0,Ht.produce)(((e,t)=>{let{oldGroupId:n,groupId:r,name:a,isLocked:o}=t;if(!n||!r||!a)return;const i=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(!i.groups?.[n])return;const l=e=>e.groupId===n,s=i.elements.filter(l);if(!s.length)return;if(s.some((e=>{let{isBackground:t}=e;return t})))return;br(e,{groupId:r,name:a,isLocked:o});const c=s.map((e=>{const{element:t,elementAnimations:n}=(0,Mn.duplicateElement)({element:e,animations:i.animations,existingElements:i.elements});return t.groupId=r,n.length&&i.animations.push(...n),t})),d=i.elements.findLastIndex(l);i.elements.splice(d+1,0,...c),e.selection=c.map((e=>{let{id:t}=e;return t}))})),wr=(0,Ht.produce)(((e,t)=>{let{elementId:n,groupId:r}=t;const a=e.pages.find((t=>{let{id:n}=t;return n===e.current})),{elements:o}=a,i=o.find((e=>{let{id:t}=e;return t===n}));if(i.groupId!==r)return;const l=function(e){let{elements:t,groupId:n}=e;const r=e=>e.groupId===n;return t.findIndex(r)+t.filter(r).length-1}({elements:o,groupId:r});delete i.groupId,o[l]!==i&&Yn(e,{elementId:n,position:l})})),Tr=(0,u.createContext)({state:{},actions:{}});var Sr=n(49925),Cr=n(82302);const Ir=(0,u.createContext)({listeners:new Map});const xr=function(){const e=(0,u.useContext)(Ir);return(0,u.useCallback)(((t,n)=>{n?(e.listeners.has(t)||e.listeners.set(t,(e=>((e,t)=>{e.preventDefault(),e.returnValue=t})(e,t))),window.addEventListener("beforeunload",e.listeners.get(t))):(window.removeEventListener("beforeunload",e.listeners.get(t)),e.listeners.delete(t))}),[e])},Ar="set_state",kr="clear",Or="replay",Pr={entries:[],offset:0,requestedState:null,versionNumber:0},Nr=e=>(t,n)=>{let{type:r,payload:a}=n;const o=t.entries[t.offset];switch(r){case Ar:if(t.requestedState){if(Object.keys(t.requestedState).every((e=>t.requestedState[e]===a[e]))){const e=t.entries.indexOf(t.requestedState);if(o.pages!==t.requestedState.pages&&o.pages.length===t.requestedState.pages.length&&o.current!==t.requestedState.current){const n=o.pages.filter(((e,n)=>e!==t.requestedState.pages[n]));if(1===n.length){const r=n[0].id,a={...t.requestedState,current:r};return{...t,offset:e,requestedState:a}}}return{...t,offset:e,requestedState:null}}}return{entries:[a,...t.entries.slice(t.offset)].slice(0,e),versionNumber:t.versionNumber+1,offset:0,requestedState:null};case Or:return{...t,versionNumber:t.versionNumber+(t.offset-a),requestedState:t.entries[a]};case kr:return{...Pr};default:throw new Error(`Unknown history reducer action: ${r}`)}};const Mr=function(e){const[t,n]=(0,u.useReducer)(Nr(e),{...Pr}),{entries:r,offset:a,requestedState:o,versionNumber:i}=t,l=r.length,s=(0,u.useCallback)((e=>{const t=a+e;return!(t<0||t>l-1)&&(n({type:Or,payload:t}),!0)}),[n,a,l]),c=(0,u.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return s("number"==typeof e?e:1)}),[s]),d=(0,u.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return s("number"==typeof e?-e:-1)}),[s]),p=(0,u.useCallback)((()=>n({type:kr})),[n]);return{requestedState:o,stateToHistory:(0,u.useCallback)((e=>{n({type:Ar,payload:e})}),[n]),clearHistory:p,currentEntry:r?.[a],offset:a,historyLength:l,versionNumber:i,undo:c,redo:d}},Rr=(0,u.createContext)({state:{},actions:{}});function HistoryProvider(e){let{children:t,size:n}=e;const{requestedState:r,stateToHistory:a,clearHistory:o,currentEntry:i,offset:l,historyLength:s,undo:d,redo:p,versionNumber:m}=Mr(n),[g,f]=(0,u.useState)(!1),h=xr(),b=(0,u.useRef)(1);(0,u.useEffect)((()=>(h("history",g),()=>h("history",!1))),[h,g]),(0,u.useEffect)((()=>{f(m!==b.current)}),[m]);const E=(0,u.useCallback)((()=>{b.current=m,f(!1)}),[m]),y={state:{currentEntry:i,hasNewChanges:g,requestedState:r,canUndo:l<s-1,canRedo:l>0,versionNumber:m},actions:{stateToHistory:a,clearHistory:o,resetNewChanges:E,undo:d,redo:p}};return(0,Cr.useGlobalKeyDownEffect)({key:"undo",dialog:!0},(()=>d()),[d]),(0,Cr.useGlobalKeyDownEffect)({key:"redo",dialog:!0},(()=>p()),[p]),c.createElement(Rr.Provider,{value:y},t)}HistoryProvider.defaultProps={size:50};const Lr=HistoryProvider;const Dr=function(e){return(0,u.useContextSelector)(Rr,e??u.identity)};const Br=function(e){const t=e.map((e=>JSON.stringify(e)));return Array.from(new Set(t)).map((e=>JSON.parse(e)))};function Fr(e,t,n,r){const{title:{raw:a=""}={},status:o,slug:i,date:l,modified:s,excerpt:{raw:c=""}={},link:d,storyData:u,permalinkTemplate:p,stylePresets:m={},password:g,previewLink:f,editLink:h,embedPostLink:b,author:E,capabilities:y={publish:!1,"assign-author":!1},extras:_={},featuredMedia:v,publisherLogo:w,taxonomies:T,terms:S}=t,C=!["draft","auto-draft","pending"].includes(o)||l!==s&&l?l:null,[I,x]=p?p.split(/%(?:postname|pagename)%/):[],A=void 0!==I&&void 0!==x?{prefix:I,suffix:x}:null,k="auto-draft"===o?"draft":o;r();const O=u&&(0,Sr.migrate)(u,u.version||0),P=O?.pages?.length>0?O.pages:[(0,Mn.createPage)()],N={colors:m.colors?Br(m.colors):[],textStyles:m.textStyles?Br(m.textStyles):[]};n({pages:P,story:{storyId:e,title:a,status:k,author:E,date:C,modified:s,excerpt:c,slug:i,link:d,extras:_,featuredMedia:v,permalinkConfig:A,publisherLogo:w,password:g,previewLink:f,editLink:h,embedPostLink:b,currentStoryStyles:{colors:O?.currentStoryStyles?.colors?Br(O.currentStoryStyles.colors):[]},globalStoryStyles:N,autoAdvance:O?.autoAdvance,defaultPageDuration:O?.defaultPageDuration,backgroundAudio:O?.backgroundAudio,taxonomies:T,terms:S},selection:[],current:null,capabilities:y})}const Hr=function(e){let{storyId:t,story:n,shouldLoad:r,restore:a}=e;const{actions:{getStoryById:o}}=W(),{actions:{clearHistory:i}}=Dr();(0,u.useEffect)((()=>{t&&r&&(n?Fr(t,n,a,i):o(t).then((e=>{Fr(t,e,a,i)})))}),[t,n,r,a,o,i])};var Ur=n(96905),jr=n(58860);const zr=function(e,t){return(0,u.useCallback)((()=>{try{const n=new URL(t);n.hash=window.location.hash,window.history.replaceState({id:e},(0,We.default)(
39
  /* translators: %d: current story id. */
40
- (0,d.__)("Post %d","web-stories"),e),n.toString())}catch(e){}}),[e,t])},Gr=e=>{const t=[{src:"https://cdn.ampproject.org/v0.js"},{name:"amp-story",src:"https://cdn.ampproject.org/v0/amp-story-1.0.js"}],n={name:"amp-video",src:"https://cdn.ampproject.org/v0/amp-video-0.1.js"},r={name:"amp-story-captions",src:"https://cdn.ampproject.org/v0/amp-story-captions-0.1.js"},a={name:"amp-story-shopping",src:"https://cdn.ampproject.org/v0/amp-story-shopping-0.1.js"};for(const{elements:o,backgroundAudio:i}of e){i?.resource?.src&&i?.tracks?.length>0&&(t.push(n),t.push(r));for(const{type:e,tracks:i}of o)switch(e){case"video":t.push(n),i?.length>0&&t.push(r);break;case"gif":t.push(n);break;case"product":t.push(a)}}return[...new Set(t)]};const Yr=function Boilerplate(){return c.createElement(c.Fragment,null,c.createElement("style",{"amp-boilerplate":"",dangerouslySetInnerHTML:{__html:"body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}"}}),c.createElement("noscript",null,c.createElement("style",{"amp-boilerplate":"",dangerouslySetInnerHTML:{__html:"body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}"}})))};const Zr=function(e){return/^#(?:[a-f0-9]{3}){1,2}$/i.test(e)};const Wr=function CustomStyles(){const e=ee.PAGE_RATIO/ee.FULLBLEED_RATIO,t=1/e,n=ee.PAGE_RATIO,r=ee.FULLBLEED_RATIO,a=f.theme.colors.bg.primary,o=Zr(a)?a:"#1B1D1C";return c.createElement("style",{"amp-custom":"",dangerouslySetInnerHTML:{__html:`\n h1, h2, h3 { font-weight: normal; }\n\n amp-story-page {\n background-color: ${o};\n }\n\n amp-story-grid-layer {\n overflow: visible;\n }\n\n @media (max-aspect-ratio: 9 / 16) {\n @media (min-aspect-ratio: 320 / 678) {\n amp-story-grid-layer.grid-layer {\n margin-top: calc((100% / ${r} - 100% / ${n}) / 2);\n }\n }\n }\n \n @media not all and (min-resolution:.001dpcm) {\n @media {\n p.text-wrapper > span {\n font-size: calc(100% - 0.5px);\n }\n }\n }\n\n .page-fullbleed-area,\n .page-background-overlay-area {\n position: absolute;\n overflow: hidden;\n width: 100%;\n left: 0;\n height: calc(${e} * 100%);\n top: calc((1 - ${e}) * 100% / 2);\n }\n\n .element-overlay-area {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n }\n\n .page-safe-area {\n overflow: visible;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: calc(${t} * 100%);\n margin: auto 0;\n }\n\n .mask {\n position: absolute;\n overflow: hidden;\n }\n\n .fill {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n }\n\n @media (prefers-reduced-motion: no-preference) {\n .animation-wrapper {\n opacity: var(--initial-opacity);\n transform: var(--initial-transform);\n }\n }\n\n amp-story-grid-layer.align-bottom {\n align-content: end;\n padding: 0;\n }\n\n .captions-area {\n padding: 0 32px 0;\n }\n\n amp-story-captions {\n margin-bottom: 16px;\n text-align: center;\n }\n\n amp-story-captions span {\n display: inline-block;\n margin: 0;\n padding: 6px 12px;\n vertical-align: middle;\n border-radius: 15px;\n background: rgba(11, 11, 11, 0.6);\n color: rgba(255, 255, 255, 1);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;;\n font-size: calc(4 * var(--story-page-vw));\n line-height: 1.4;\n word-break: break-word;\n word-wrap: break-word;\n overflow-wrap: break-word;\n }\n `}})},Vr=["Karla","Lato","Lora","Merriweather","Montserrat","Nunito","Oswald","Playfair Display","Poppins","Raleway","Roboto","Roboto Condensed","Source Serif Pro","Titillium Web","Work Sans","Alegreya","Arimo","EB Garamond","IBM Plex Mono","IBM Plex Serif","Inconsolata","Mulish","Noto Sans","Noto Serif","Open Sans","PT Mono","PT Sans","PT Serif","Roboto Mono","Source Sans Pro","Ubuntu","Anton","BioRhyme","Bungee","Bungee Shade","Cookie","Dancing Script","Monoton","Nothing You Could Do","Parisienne","Rock Salt","UnifrakturMaguntia"];const $r=function(e,t){const n=function(e){const t=e.split(/[#?]/)[0].split(".").pop().trim();switch(t){case"woff":case"woff2":return t;case"ttf":return"truetype";case"otf":return"opentype";default:return null}}(t);return n?`@font-face {\n font-family: "${e}";\n src: url('${t}') format('${n}');\n font-weight: normal;\n font-display:swap;\n }`:null};const qr=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"swap";const n=new URL("https://fonts.googleapis.com/css2");n.searchParams.append("display",t);for(const{family:t,variants:r=[]}of e){const e=r.reduce(((e,t)=>{let[n,r]=t;return 1!==n||e.includes("ital")||e.push("ital"),r&&400!==r&&!e.includes("wght")&&e.push("wght"),e}),[]).sort();let a=t;const o=e.join(",");o&&(a+=":"+o);const i=r.sort(((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:e[1]-t[1])).map((t=>{let[n,r]=t;const a=[];return e.includes("ital")&&a.push(n),e.includes("wght")&&a.push(r),a})).join(";"),l="400"===i;i&&!l&&(a+="@"+i),n.searchParams.append("family",a)}return decodeURI(n.toString())};var Kr=n(56862);const Xr=(e,t)=>e.some((e=>e[0]===t[0]&&e[1]===t[1])),Qr=(e,t)=>Math.abs(e[0]+e[1]-t[0]-t[1]),Jr=(e,t)=>e.reduce(((e,n)=>Qr(n,t)<Qr(e,t)?n:e));const ea=function FontDeclarations(e){let{pages:t}=e;const n=new Map;for(const{elements:e}of t){const t=e.filter((e=>{let{type:t}=e;return"text"===t}));for(const{font:e,content:r}of t){const{service:t,family:a,variants:o=[],url:i}=e;if(!t||"system"===t)continue;const l=n.get(t)||new Map;n.set(t,l);const s=l.get(a)||{family:a,variants:[],url:i},c=(0,Kr.getFontVariants)(r);if(o.length>0)for(const e of c){const t=Jr(o,e),n=Xr(s.variants,t),r=Xr(o,t);!n&&r&&s.variants.push(t)}l.set(a,s)}}return c.createElement(c.Fragment,null,Array.from(n.keys()).map((e=>{const t=n.get(e);switch(e){case"fonts.google.com":return c.createElement("link",{key:e,href:qr(Array.from(t.values())),rel:"stylesheet"});case"custom":return Array.from(t.values()).map((e=>{let{family:t,url:n}=e;const r=$r(t,n);return c.createElement("style",{key:t,dangerouslySetInnerHTML:{__html:r}})}));default:return null}})))};var ta=n(18535);const na=7,ra=!0;var aa=n(1787);function oa(e,t){try{return new URL(t,e).href}catch(e){return t}}function ia(e){try{return new URL(e),!0}catch{return!1}}function la(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https";return/^(http:\/\/|https:\/\/|tel:|mailto:)/.test(e)?e:`${t}://${e}`}function sa(){return sa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sa.apply(this,arguments)}const ca=function WithLink(e){let{element:t,children:n,...r}=e;const a=t.link||{},{url:o,icon:i,desc:l,rel:s=[]}=a;if(!o)return n;const d=s.concat(["noreferrer"]),u=la(o);return c.createElement("a",sa({href:u,"data-tooltip-icon":i||void 0,"data-tooltip-text":l,target:"_blank",rel:d.join(" ")},r),n)};const da=function OutputElement(e){let{element:t,flags:n}=e;const{id:r,opacity:a,type:o,border:i,backgroundColor:l,backgroundTextMode:s,overlay:d}=t,{Output:u,isMaskable:p}=(0,Mn.getDefinitionForType)(o),m=(0,aa.getBox)(t,100,100),{x:g,y:f,width:h,height:b,rotationAngle:E}=m,y={backgroundClip:"content-box",...(0,ta.default)(l)};return c.createElement("div",{style:{position:"absolute",pointerEvents:"none",left:g?`${g}%`:0,top:f?`${f}%`:0,width:`${h}%`,height:`${b}%`,...(0,Vn.shouldDisplayBorder)(t)?(0,Vn.getBorderPositionCSS)({...i,width:`${h}%`,height:`${b}%`,posTop:`${f}%`,posLeft:`${g}%`}):null,transform:E?`rotate(${E}deg)`:null,opacity:void 0!==a?a/100:null}},c.createElement(Hn.StoryAnimation.AMPWrapper,{target:r},c.createElement(Vn.OutputWithMask,{className:p?"mask":void 0,element:t,id:"el-"+r,style:{...(0,Vn.shouldDisplayBorder)(t)?(0,Vn.getBorderStyle)(t):null,pointerEvents:"initial",width:"100%",height:"100%",display:"block",position:"absolute",top:0,left:0,zIndex:0,...(0,Vn.getBorderRadius)(t),...s===Mn.BACKGROUND_TEXT_MODE.FILL?y:null},skipDefaultMask:!0},c.createElement(ca,{element:t,style:{width:"100%",height:"100%",display:"block",position:"absolute",top:0,left:0}},c.createElement(u,{element:t,box:m,flags:n})),d&&c.createElement("div",{className:"element-overlay-area",style:(0,ta.default)(d)}))))};function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ua.apply(this,arguments)}const pa=function BackgroundAudio(e){let{backgroundAudio:t,id:n}=e;const{resource:r,tracks:a,loop:o}=t||{},{mimeType:i,src:l}=r,s={loop:o?"loop":void 0,id:`page-${n}-background-audio`,"captions-id":a?.length>0?`el-${n}-captions`:void 0,crossorigin:a?.length>0?"anonymous":void 0},d={type:i,src:l};return c.createElement("amp-story-grid-layer",{template:"fill"},c.createElement("amp-video",ua({autoPlay:"autoplay",layout:"fixed",width:"1",height:"1",poster:""},s),c.createElement("source",d),a&&a.map(((e,t)=>{let{srclang:n,label:r,kind:a,track:o,id:i}=e;return c.createElement("track",{srcLang:n,label:r,kind:a,src:o,key:i,default:0===t})}))))};const ma=function(e){return e.sort(((e,t)=>e.y-t.y)).reduce(((e,t)=>{let{id:n,fontSize:r,content:a,tagName:o}=t;if(o&&"auto"!==o)return e.set(n,o),e;if(a.length<=3)return e.set(n,"p"),e;const i=Array.from(e.values()).includes("h1");return r>=36&&!i?(e.set(n,"h1"),e):(r>=27?e.set(n,"h2"):r>=21?e.set(n,"h3"):e.set(n,"p"),e)}),new Map)};const ga=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.filter((e=>{let{type:t,loop:n}=e;const{isMedia:r}=(0,Mn.getDefinitionForType)(t);return r&&!n})).reduce(((e,n)=>n?.resource?.length?n?.resource?.length<t||e?.resource?.length>n?.resource?.length?e:n:e),void 0)};const fa=function(e){let{animations:t,defaultPageDuration:n=na,elements:r,backgroundAudio:a,id:o}=e;const{resource:i,loop:l}=a||{},s=(0,Hn.getTotalDuration)({animations:t})/1e3,c=!l&&i?.length?i.length:0,d=ga(r,Math.max(s||1,c));if(d?.id)return`el-${d?.id}-media`;const u=Math.max(s||0,c,n);return u>c?`${u}s`:`page-${o}-background-audio`};const ha=function Outlink(e){let{ctaText:t,url:n,icon:r,theme:a,rel:o=[]}=e;return c.createElement("amp-story-page-outlink",{layout:"nodisplay","cta-image":r||void 0,theme:a},c.createElement("a",{href:n,rel:o.join(" ")},t||(0,d.__)("Learn more","web-stories")))};const ba=function ShoppingAttachment(e){let{products:t,theme:n,ctaText:r}=e;return c.createElement("amp-story-shopping-attachment",{theme:n,"cta-text":r||void 0},c.createElement("script",{type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify({items:t})}}))};function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ea.apply(this,arguments)}const ya=`${ee.PAGE_WIDTH}:${ee.PAGE_HEIGHT}`;const _a=function OutputPage(e){let{page:t,autoAdvance:n=ra,defaultPageDuration:r=na,flags:a}=e;const{id:o,animations:i,elements:l,backgroundColor:s,backgroundAudio:d,pageAttachment:u={},shoppingAttachment:p={}}=t,[m,...g]=l,f=m?.resource?.baseColor,h=f?{backgroundColor:f}:{backgroundColor:"white",...(0,ta.default)(s)},b=n?fa({animations:i,elements:l,defaultPageDuration:r,backgroundAudio:d,id:o}):void 0,E=ma(g.filter((e=>{let{type:t}=e;return"text"===t}))),y=g.map((e=>{const t="text"===e.type,n=u?.url&&(0,Mn.isElementBelowLimit)(e);if(!(t||n))return e;const r={...e};return t&&(r.tagName=E.get(e.id)),n&&delete r.link,r})),_=l.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).map((e=>{let{product:t}=e;return t})).filter(Boolean),v=_.length>0,w=u?.url&&!v,T=l.filter((e=>{let{type:t,tracks:n}=e;return t===Mn.ELEMENT_TYPES.VIDEO&&n?.length>0})).map((e=>{let{id:t}=e;return`el-${t}-captions`})),S=d?.resource?.src,C=d?.tracks?.length>0,I=C||!1===d?.loop&&d?.resource?.length;return S&&C&&T.push(`el-${o}-captions`),c.createElement("amp-story-page",{id:o,"auto-advance-after":b,"background-audio":S&&!I?S:void 0},c.createElement(Hn.StoryAnimation.Provider,{animations:i,elements:l},c.createElement(Hn.StoryAnimation.AMPAnimations,null),m&&c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer"},c.createElement("div",{className:"page-fullbleed-area",style:h},c.createElement("div",{className:"page-safe-area"},c.createElement(da,{element:m,flags:a}),m.overlay&&c.createElement("div",{className:"page-background-overlay-area",style:(0,ta.default)(m.overlay)})))),c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer"},c.createElement("div",{className:"page-fullbleed-area"},c.createElement("div",{className:"page-safe-area"},y.map((e=>c.createElement(da,{key:e.id,element:e,flags:a}))))))),S&&I&&c.createElement(pa,{backgroundAudio:d,id:o}),T.length>0&&c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer align-bottom"},c.createElement("div",{className:"captions-area"},T.map((e=>c.createElement("amp-story-captions",{key:e,id:e,layout:"fixed-height",height:"100"}))))),w&&c.createElement(ha,u),v&&c.createElement(ba,Ea({products:_},p)))};const va=function(e){const t=[];if(0===e.length)return t;for(const{type:n,resource:r,isBackground:a}of e[0].elements){if(!["image","video","gif"].includes(n))continue;if(!a)continue;const e=r?.output?.src||r.src;t.push({url:e,type:"image"===n?"image":"video"})}return t};const wa=function OutputStory(e){let{story:{featuredMedia:t,link:n,title:r,autoAdvance:a,defaultPageDuration:o,backgroundAudio:i,publisherLogo:l},pages:s,metadata:{publisher:d},flags:u}=e;const p=Gr(s),m=va(s),g=t?.url||"",f=l?.url||"";return c.createElement("html",{amp:"",lang:"en"},c.createElement("head",null,c.createElement("meta",{charSet:"utf-8"}),c.createElement("meta",{name:"viewport",content:"width=device-width,minimum-scale=1,initial-scale=1"}),p.map((e=>{let{name:t,src:n}=e;return c.createElement("script",{key:n,async:"async",src:n,"custom-element":t})})),c.createElement(ea,{pages:s}),m.map((e=>{let{url:t,type:n}=e;return c.createElement("link",{key:t,href:t,rel:"preload",as:n})})),c.createElement(Yr,null),c.createElement(Wr,null),c.createElement("meta",{name:"web-stories-replace-head-start"}),c.createElement("title",null,r),n&&c.createElement("link",{rel:"canonical",href:n}),c.createElement("meta",{name:"web-stories-replace-head-end"})),c.createElement("body",null,c.createElement("amp-story",{standalone:"",publisher:d,"publisher-logo-src":f,title:r,"poster-portrait-src":g,"background-audio":i?.resource?.src??void 0},s.map((e=>c.createElement(_a,{key:e.id,page:e,autoAdvance:a,defaultPageDuration:o,flags:u}))))))};function Ta(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,u.renderToStaticMarkup)(c.createElement(wa,{story:e,pages:t,metadata:n,flags:r}))}const Sa=function(e){const t=[],n=[];return e.forEach((e=>{let{elements:r}=e;return r.forEach((e=>{let{product:r,type:a}=e;a===Mn.ELEMENT_TYPES.PRODUCT&&r&&!n.includes(r?.productId)&&(t.push(r),n.push(r?.productId))}))})),t};const Ca=function(e){let{story:t,pages:n,metadata:r,flags:a}=e;const{terms:o,featuredMedia:i,...l}=Jn(t,["title","status","author","date","modified","slug","excerpt","featuredMedia","password","currentStoryStyles","globalStoryStyles","autoAdvance","defaultPageDuration","backgroundAudio","terms"]),s=Sa(n);return{content:Ta(t,n,r,a),pages:n,...l,...o,featuredMedia:i,meta:{web_stories_publisher_logo:t.publisherLogo?.id,web_stories_products:s,web_stories_poster:i.isExternal?{url:i.url,width:i.width,height:i.height,needsProxy:i.needsProxy}:void 0}}},Ia={400:(0,d._x)("Bad Request","HTTP status description","web-stories"),401:(0,d._x)("Unauthorized","HTTP status description","web-stories"),403:(0,d._x)("Forbidden","HTTP status description","web-stories"),500:(0,d._x)("Internal Server Error","HTTP status description","web-stories")};const xa=function(e){let{storyId:t,pages:n,story:r,updateStory:a}=e;const{actions:{saveStoryById:o}}=W(),{actions:{resetNewChanges:i}}=Dr(),{metadata:l,flags:s}=U(),{showSnackbar:c}=(0,Ur.useSnackbar)(),[p,m]=(0,u.useState)(!1),[g,f]=(0,u.useState)(!1),[h,b]=(0,u.useState)(!1),{editLink:E}=r,y=zr(t,E),_=(0,u.useCallback)((e=>{m(!0);const u=["publish","future","private"].includes(r.status),p="pending"===r.status,g=(0,P.getTimeTracker)("load_save_story");return Promise.resolve().then((()=>o({storyId:t,...Ca({story:r,pages:n,metadata:l,flags:s}),...e}))).then((e=>{const{status:t,slug:n,link:r,previewLink:o,editLink:i,embedPostLink:l,featuredMedia:s}=e;a({properties:{status:t,slug:n,link:r,previewLink:o,editLink:i,embedPostLink:l,featuredMedia:s}}),y();const c=["publish","future","private"].includes(e.status),d="pending"===e.status;f(!u&&c),b(!p&&d)})).catch((e=>{const t=e.message?(0,jr.stripHTML)(e.message):null;let n=(0,d.__)("Failed to save the story","web-stories");t&&(n=(0,We.default)(
41
  /* translators: %s: error message */
42
  (0,d.__)("Failed to save the story: %s","web-stories"),t)),Object.prototype.hasOwnProperty.call(Ia,e?.data?.status)&&(n=t?(0,We.default)(
43
  /* translators: 1: error message. 2: status code */
@@ -173,7 +173,7 @@ e=(0,We.default)(
173
  /* translators: %d: number of results. */
174
  (0,d._n)("%d result found.","%d results found.",r,"web-stories"),r);b(a)}),300),_=(0,u.useMemo)((()=>(s[t.restBase]||[]).map((e=>Object.values(i[t.restBase]||{}).find((t=>t.id===e)))).filter((e=>void 0!==e)).map((e=>e.name))),[t,s,i]),v=(0,u.useCallback)((e=>i[t.restBase]?.[Bo(e)]?.name),[t,i]);return(0,u.useEffect)((()=>{!async function(){const e=await l(t,{orderby:"count",order:"desc",hide_empty:!0});a(e)}()}),[t,l]),c.createElement(c.Fragment,null,c.createElement(zM,null,t.labels.name),c.createElement("div",{key:t.slug},c.createElement(SR.Label,{htmlFor:`${t.slug}-input`},t.labels.addNewItem),c.createElement(SR.Input,{id:`${t.slug}-input`,"aria-describedby":`${t.slug}-description`,name:t.slug,onTagsChange:E,onInputChange:y,tagDisplayTransformer:v,tokens:_,onUndo:g,suggestedTerms:f,suggestedTermsLabel:t?.labels?.itemsList}),c.createElement(SR.Description,{id:`${t.slug}-description`},t.labels.separateItemsWithCommas),r.length>0&&c.createElement(ZM.Wrapper,{"data-testid":`${t.slug}-most-used`},c.createElement(ZM.Heading,null,t.labels.mostUsed),c.createElement(ZM.List,null,r.map(((e,n)=>c.createElement(ZM.ListItem,{key:e.id},c.createElement(ZM.Word,{onClick:()=>{s[t.restBase]?.includes(e.id)||m(t,e)}},e.name,n<r.length-1&&
175
  /* translators: delimiter used in a list */
176
- (0,d.__)(",","web-stories")),n<r.length-1&&" ")))))))};function IR(){return IR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},IR.apply(this,arguments)}const xR=(0,p.default)(uN).withConfig({displayName:"taxonomies__StyledSimplePanel",componentId:"sc-171mnp-0"})(["padding-left:0;padding-right:0;"]);const AR=function TaxonomiesPanel(e){let{nameOverride:t,...n}=e;const{capabilities:r}=Qa((e=>{let{state:{capabilities:t}}=e;return{capabilities:t}})),{taxonomies:a}=Yl((e=>{let{state:{taxonomies:t}}=e;return{taxonomies:t}}));if(!a?.length)return null;const o=a.filter((e=>Boolean(r[`assign-${e?.restBase}`]||r[`assign-${e?.slug}`])));return 0===o.length?null:c.createElement(xR,IR({name:t||"taxonomies",title:(0,d.__)("Taxonomies","web-stories")},n),o.map((e=>{const t=Boolean(r[`create-${e?.restBase}`]||r[`create-${e?.slug}`]);return c.createElement(YM,{key:e.slug},e.hierarchical?c.createElement(QM,{taxonomy:e,canCreateTerms:t}):c.createElement(CR,{taxonomy:e,canCreateTerms:t}))})))},kR=p.default.div.withConfig({displayName:"flipControls__ControlsContainer",componentId:"sc-1gcq876-0"})(["display:flex;justify-content:left;align-items:flex-start;"]),OR=p.default.div.withConfig({displayName:"flipControls__Space",componentId:"sc-1gcq876-1"})(["width:8px;"]),PR=(0,p.default)(hS).withConfig({displayName:"flipControls__StyledToggleButton",componentId:"sc-1gcq876-2"})(["",";"],sp);const NR=function FlipControls(e){let{value:t,onChange:n}=e;const r=(0,u.useCallback)((e=>!0===t[e]),[t]);return c.createElement(kR,null,c.createElement(Tooltip,{title:(0,d.__)("Flip horizontally","web-stories")},c.createElement(PR,{variant:g.BUTTON_VARIANTS.SQUARE,size:g.BUTTON_SIZES.SMALL,isToggled:!0===t.horizontal,onClick:()=>n({...t,horizontal:!r("horizontal")}),"aria-label":(0,d.__)("Flip horizontally","web-stories")},c.createElement(GE,null))),c.createElement(OR,null),c.createElement(Tooltip,{title:(0,d.__)("Flip vertically","web-stories")},c.createElement(PR,{variant:g.BUTTON_VARIANTS.SQUARE,size:g.BUTTON_SIZES.SMALL,isToggled:!0===t.vertical,onClick:()=>n({...t,vertical:!r("vertical")}),"aria-label":(0,d.__)("Flip vertically","web-stories")},c.createElement($E,null))))},MR=[{key:"sponsored",title:(0,d.__)("Sponsored","web-stories")},{key:"nofollow",title:(0,d.__)("Nofollow","web-stories")}],RR=p.default.div.withConfig({displayName:"linkRelations__CheckboxWrapper",componentId:"sc-123e3hl-0"})(["display:flex;padding:9px 0;"]),LR=p.default.label.withConfig({displayName:"linkRelations__Label",componentId:"sc-123e3hl-1"})(["margin-left:12px;"]),DR=(0,p.default)($e.Text).withConfig({displayName:"linkRelations__StyledText",componentId:"sc-123e3hl-2"})(["color:",";padding:8px 0;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary}));const BR=function LinkRelations(e){let{rel:t,onChangeRel:n}=e;const r=(0,d.__)("https://developers.google.com/search/docs/advanced/guidelines/qualify-outbound-links?hl=en","web-stories"),a=(0,u.useCallback)((e=>{const r=t.includes(e)?t.filter((t=>t!==e)):[...t,e];n(r)}),[n,t]);return c.createElement(GI,null,c.createElement("div",null,c.createElement(DR,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("Qualify outbound links","web-stories")),MR.map((e=>{let{key:n,title:r}=e;return c.createElement(RR,{key:n},c.createElement(nC.Checkbox,{id:n,name:n,checked:t?.includes(n),onChange:()=>a(n)}),c.createElement(LR,{htmlFor:n},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,as:"span"},r)))})),c.createElement(pu.Link,{rel:"noopener noreferrer",target:"_blank",href:r,size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.X_SMALL},(0,d.__)("Learn more","web-stories"))))};function FR(e,t){return void 0===e?t:e}const HR=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r="function"==typeof t?t:e=>e[t],a=FR(r(e[0]),n),o=e.every((e=>FR(r(e),n)===a));return o?a:ve};const UR=function(e,t,n){const r={},a=e.map((e=>e[t]||n));return Object.keys(n).forEach((e=>{r[e]=HR(a,e)})),r};const jR=function(e,t){return(0,u.useMemo)((()=>{const n=e.map((e=>e[t]));if(0===n.length)return null;if(1===n.length)return n[0];const r={};return n.forEach((e=>{const t=(0,BS.default)((0,ta.default)(e));t in r||(r[t]=e)})),1===Object.keys(r).length?Object.values(r)[0]:ve}),[e,t])};const zR=function(e,t,n){const r=UR(e,t,n),a=Object.keys(n).map((e=>r[e]));return(0,u.useMemo)((()=>r),a)};var GR=n(30963);function YR(){return YR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YR.apply(this,arguments)}const ZR=(0,u.forwardRef)((function FontPicker(e,t){let{zIndex:n,onChange:r,currentValue:a,highlightStylesOverride:o,showDropdownLabel:i,listStyleOverrides:l,containerStyleOverrides:s,className:p,tabIndex:m}=e;const{fonts:g=[],recentFonts:f=[],curatedFonts:h=[],customFonts:b=[],ensureMenuFontsLoaded:E,ensureCustomFontsLoaded:y,getFontsBySearch:_,getCustomFonts:v,getCuratedFonts:w}=Uo((e=>{let{actions:t,state:n}=e;return{getFontsBySearch:t.getFontsBySearch,ensureMenuFontsLoaded:t.ensureMenuFontsLoaded,ensureCustomFontsLoaded:t.ensureCustomFontsLoaded,getCuratedFonts:t.getCuratedFonts,getCustomFonts:t.getCustomFonts,recentFonts:n.recentFonts,curatedFonts:n.curatedFonts,fonts:n.fonts,customFonts:n.customFonts}}));(0,u.useEffect)((()=>{v(),w()}),[v,w]);const T=(0,u.useMemo)((()=>{const e=new Map;return g.forEach((t=>{e.set(t.id,t)})),b?.forEach((t=>{e.set(t.id,t)})),e}),[g,b]),S=(0,u.useCallback)((e=>{e.length&&(E(e.filter((e=>"fonts.google.com"===T.get(e)?.service))),y(e.filter((e=>"custom"===T.get(e)?.service))))}),[T,y,E]),C=(0,u.useCallback)(((e,t)=>{let{option:n,...r}=e;return c.createElement(GR.default.Option,YR({ref:t},r,{fontFamily:"fonts.google.com"===n.service?`'${n.name}::MENU'`:n.name}),a===n.id&&c.createElement(GR.default.Selected,{"aria-label":(0,d.__)("Selected","web-stories")}),n.name)}),[a]),I=(0,u.useMemo)((()=>[...b?.length?[{label:(0,d.__)("Your fonts","web-stories"),options:b}]:[],...f?.length?[{label:(0,d.__)("Recently used","web-stories"),options:f}]:[]]),[b,f]);return c.createElement(GR.default.DropDown,{ref:t,zIndex:n,tabIndex:m,highlightStylesOverride:o,"data-testid":"font",title:(0,d.__)("Available font families","web-stories"),dropdownButtonLabel:(0,d.__)("Font family","web-stories"),options:g,primaryOptions:h,primaryLabel:(0,d.__)("Recommended","web-stories"),priorityOptionGroups:I,searchResultsLabel:(0,d.__)("Search results","web-stories"),selectedId:ve===a?"":a,placeholder:ve===a?we:a,hasSearch:!0,getOptionsByQuery:_,onChange:r,onObserve:S,renderer:(0,u.forwardRef)(C),disabled:!g?.length,dropDownLabel:i?(0,d.__)("Font","web-stories"):null,listStyleOverrides:l,containerStyleOverrides:s,className:p})})),WR=ZR;var VR=n(15242);const $R={...Mn.ELEMENT_TYPES,MULTIPLE:"multiple",NONE:"none"};var qR=n(98448);const KR=(0,u.createContext)(null),XR={cleanup:null,focusGroups:{},cleanupCallbacks:{}},QR={addNodeToGroup:(e,t)=>{const{groupId:n,nodeTuple:r}=t.payload,a=e.focusGroups[n]||[];let o=[];const i=a.findIndex((e=>e[0]===r[0]));return o=-1===i?[...a,r]:[...a.slice(0,i),r,...a.slice(0,i+1)],{...e,focusGroups:{...e.focusGroups,[n]:o}}},removeNodeFromGroup:(e,t)=>{const{groupId:n,nodeTuple:r}=t.payload,a=(e.focusGroups[n]||[]).filter((e=>e[0]!==r[0]));return{...e,focusGroups:{...e.focusGroups,[n]:a}}},setFocusGroupCleanup:(e,t)=>{const{groupId:n,cleanup:r}=t.payload;return{...e,activeGroupKey:n,cleanupCallbacks:{...e.cleanupCallbacks,[n]:r}}}};function KeyBindings(e){let{uuid:t,node:n,focusGroup:r,exitFocusGroup:a}=e;const o=(0,u.useCallback)((e=>{e.preventDefault();const n=function(e,t){return function(n){if(!t)return;const r=t.findIndex((t=>t[0]===e));if(-1===r)return;const a=((r+n)%(o=t.length)+o)%o;var o;const[,i]=t[a];i?.focus()}}(t,r);e.shiftKey?n(-1):n(1)}),[r,t]),i=(0,u.useCallback)((e=>{e.preventDefault(),a?.()}),[a]);return(0,Cr.useKeyDownEffect)(n,{key:["tab"],allowDefault:!0,editable:!0,shift:!0},o,[o]),(0,Cr.useKeyDownEffect)(n,{key:["esc"],allowDefault:!0,editable:!0},i,[i]),null}KeyBindings.propTypes={uuid:za().string.isRequired,node:"undefined"!=typeof Element?za().instanceOf(Element).isRequired:za().any.isRequired,focusGroup:za().array.isRequired,exitFocusGroup:za().func};const JR=KeyBindings;const eL=function EditLayerFocusManager(e){let{children:t}=e;const[n,r]=(0,u.useReduction)(XR,QR),a=(0,u.useRef)(n);a.current=n;const o=(0,u.useCallback)((e=>{let{groupId:t}=e;const n=a.current.focusGroups?.[t]?.[0];if(n){const[,e]=n;e.focus()}}),[a]),i=Object.entries(n.focusGroups),l=n.cleanupCallbacks;return c.createElement(KR.Provider,{value:{enterFocusGroup:o,setFocusGroupCleanup:r.setFocusGroupCleanup,actions:r}},i.map((e=>{let[t,n]=e;return n.map((e=>{let[r,a]=e;return a&&c.createElement(JR,{key:r,uuid:r,node:a,focusGroup:n,exitFocusGroup:l[t]})}))})),t)};const tL=function(e){const t=(0,u.useContextSelector)(KR,(e=>e.actions)),n=(0,u.useInitializedValue)(pe.default);return(0,u.useCallback)((r=>{null!==r?t.addNodeToGroup({groupId:e,nodeTuple:[n,r]}):t.removeNodeFromGroup({groupId:e,nodeTuple:[n,r]})}),[t,e,n])};const nL=function(e){return(0,u.useContextSelector)(KR,e??u.identity)},rL={EDIT_ELEMENT:"EDIT_ELEMENT",ELEMENT_SELECTION:"ELEMENT_SELECTION"},aL=(0,u.createContext)({state:{},actions:{}});const oL=function(e){return(0,u.useContextSelector)(aL,e??u.identity)};const iL=function FloatingMenuProvider(e){let{handleDismiss:t,children:n}=e;const r={state:{},actions:{handleDismiss:t}};return c.createElement(aL.Provider,{value:r},n)},lL={left:0,right:0,top:0,bottom:0,lockedWidth:!0,color:(0,sT.default)(0,0,0)};function sL(){return sL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sL.apply(this,arguments)}const cL=function FloatingColor(e){const{hasInputs:t,hasEyedropper:n,allowsGradient:r=!0}=e,a=function(e,t){return(e?184:60)+(t?38:0)}(t,n);return c.createElement(tI,sL({width:a,maxHeight:362,pickerPlacement:Gd.PLACEMENT.TOP_START,isInDesignMenu:!0,allowsGradient:r,allowsSavedColors:!0,allowsSavedColorDeletion:!1,pickerHasEyedropper:!n,containerLabelBase:(0,d.__)("Color input (floating menu)","web-stories")},e))};var dL=n(87098);function uL(){return uL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uL.apply(this,arguments)}const pL=p.default.div.withConfig({displayName:"icon__IconWrapper",componentId:"sc-scm7dy-0"})(["width:32px;height:32px;display:flex;align-items:center;justify-content:center;> *{flex:1;}"]);const mL=function(e){let{children:t,title:n,className:r="",...a}=e;return c.createElement(c.Fragment,null,c.createElement(dL.VisuallyHidden,null,n),c.createElement(pL,uL({className:r},a),t))};var gL=n(51537);function fL(){return fL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fL.apply(this,arguments)}const hL=(0,u.forwardRef)((function ToggleButton(e,t){let{isToggled:n,children:r,...a}=e;const o="boolean"==typeof n?{type:n?g.BUTTON_TYPES.SECONDARY:g.BUTTON_TYPES.TERTIARY,"aria-pressed":n,role:"button"}:{};return c.createElement(gL.default,fL({ref:t},o,a),r)}));function bL(){return bL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bL.apply(this,arguments)}const EL=(0,u.memo)((0,u.forwardRef)((function IconButton(e,t){let{Icon:n,...r}=e;return c.createElement(Tooltip,{placement:Gd.PLACEMENT.BOTTOM,title:r.title},c.createElement(hL,bL({ref:t,tabIndex:-1},r),c.createElement(mL,{title:r.title},c.createElement(n,null))))}))),yL=EL,_L=(0,p.default)(FC).attrs({inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT}).withConfig({displayName:"input__Input",componentId:"sc-79zl03-0"})(["width:70px;flex:0 0 70px;"]);var vL=n(77568);const wL=vL.default;function TL(){return TL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TL.apply(this,arguments)}const SL=(0,p.default)(gL.default).withConfig({displayName:"text__Button",componentId:"sc-fb6dx4-0"})(["font-size:14px;padding:0 12px;font-weight:normal;letter-spacing:normal;"]),CL=(0,u.memo)((function TextButton(e){let{text:t,...n}=e;return c.createElement(SL,TL({forcePadding:!0,title:t},n,{tabIndex:-1}),t)}));const IL=function(e){return Qa((t=>{let{state:{selectedElements:n}}=t;return Jn(n[0],e)}))};function xL(e,t){return Object.fromEntries(Object.keys(t).map((n=>{const r=e[n]===ve,a=void 0!==e[n]&&!function(e,t){const n=e&&"object"==typeof e&&(e.type||e.color),r=t&&"object"==typeof t&&(t.type||t.color);return n&&r?(0,DS.default)(e,t):e===t}(e[n],t[n]);return r||a?[n,ve]:[n,t[n]]})))}const AL=function(e,t){const{hasCurrentEditor:n,selectionInfo:r,selectionActions:a}=(0,Kr.useRichText)((e=>{let{state:t,actions:n}=e;return{hasCurrentEditor:t.hasCurrentEditor,selectionInfo:t.selectionInfo,selectionActions:n.selectionActions}})),{clearEditing:o}=$s((e=>{let{actions:{clearEditing:t}}=e;return{clearEditing:t}})),i=(0,u.useMemo)((()=>n?r:e.map((e=>{let{content:t}=e;return t})).map(Kr.getHTMLInfo).reduce(xL,{})),[n,r,e]),l=(0,u.useCallback)((function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return t((t=>{let{content:n}=t;return{content:e(n,...r)}}),!0)}),[t]),s=(0,u.useRef)(null),c=(0,u.useCallback)((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];s.current=t}),[s]);(0,u.useEffect)((()=>{const e=s.current;e&&(l(...e),s.current=null)}),[e,s,l]);const d=(0,u.useMemo)((()=>{const e=(0,Kr.getHTMLFormatters)();return n?{handleClickBold:()=>a.toggleBoldInSelection(),handleSelectFontWeight:a.setFontWeightInSelection,handleClickItalic:a.toggleItalicInSelection,handleClickUnderline:a.toggleUnderlineInSelection,handleClickUppercase:a.toggleUppercaseInSelection,handleSetLetterSpacing:a.setLetterSpacingInSelection,handleSetColor:a.setColorInSelection,handleResetFontWeight:async t=>{await o(),c(e.setFontWeight,t)}}:{handleClickBold:t=>l(e.toggleBold,t),handleSelectFontWeight:t=>l(e.setFontWeight,t),handleClickItalic:t=>l(e.toggleItalic,t),handleClickUnderline:t=>l(e.toggleUnderline,t),handleClickUppercase:t=>l(e.toggleUppercase,t),handleSetLetterSpacing:t=>l(e.setLetterSpacing,t),handleSetColor:t=>l(e.setColor,t),handleResetFontWeight:t=>l(e.setFontWeight,t)}}),[n,a,l,o,c]),p=(0,u.useCallback)((()=>e.filter((e=>{let{type:t}=e;return"text"===t})).length>0),[e]);return(0,Cr.useGlobalKeyDownEffect)({key:["mod+b","mod+u","mod+i"]},(e=>{let{key:t}=e;if(p)switch(t){case"b":d.handleClickBold();break;case"i":d.handleClickItalic();break;case"u":d.handleClickUnderline()}}),[d,p]),{textInfo:i,handlers:d}};const kL=function(e){let{currentValue:t,handler:n,eventName:r}=e;const{content:a}=IL(["content"]),o=Qa((e=>e.actions.updateSelectedElements)),i=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:r,element:"text"}),o({properties:t=>hv(t,e,!0)})}),[o,r]),{textInfo:l,handlers:s}=AL([{content:a,type:"text"}],i);return{isToggled:l[t],toggle:()=>{(0,s[n])(!l[t])}}},OL=p.default.div.withConfig({displayName:"borderWidthAndColor__Container",componentId:"sc-1qijom4-0"})(["display:flex;align-items:center;"]),PL=p.default.div.withConfig({displayName:"borderWidthAndColor__Dash",componentId:"sc-1qijom4-1"})(["width:8px;height:1px;background-color:",";"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}));const NL={color:{r:0,g:0,b:0}},ML=(0,d.__)("Border width","web-stories"),RL=(0,d.__)("Border color","web-stories");const LL=function BorderWidthAndColor(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{border:n=lL,mask:r,type:a}=IL(["border","mask","type"]),o=Qa((e=>{let{actions:t}=e;return t.updateSelectedElements})),i=n?.left===n?.right&&n?.left===n?.top&&n?.left===n?.bottom;if(!n?.lockedWidth&&!i)return null;const l=(0,Vn.canSupportMultiBorder)({mask:r}),s=function(e){if(!e)return!1;const{left:t,right:n,top:r,bottom:a}=e;return Boolean(t||n||r||a)}(n);return c.createElement(OL,null,c.createElement(oT,{ref:t,inputRef:e,inputLabel:ML},c.createElement(_L,{tabIndex:-1,ref:e,suffix:c.createElement(Hf,null),value:n?.left||0,"aria-label":ML,onChange:(e,t)=>(e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_width",element:a}),o({properties:t=>{let{border:r}=t;return{border:{locked:!0,color:n?.color,...r,left:e,right:e,top:e,bottom:e}}}})})(t),onKeyDown:e=>{aT(e,t)}})),s&&c.createElement(c.Fragment,null,c.createElement(PL,null),c.createElement(cL,{tabIndex:-1,label:RL,value:n?.color||NL,onChange:e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_color",element:a}),o({properties:t=>{let{border:n}=t;return{border:{...n,color:e}}}})},hasInputs:!1,hasEyedropper:!1,allowsOpacity:l,allowsGradient:!1,allowsSavedColors:!1})))},DL=(0,p.css)(["position:relative;:focus-within{z-index:1;",";}"],(e=>{let{theme:t}=e;return lp.focusCSS(t.colors.border.focus,t.colors.bg.secondary)})),BL=(0,p.css)(["width:29px;height:29px;"]),FL=(0,p.default)(FC).withConfig({displayName:"stackableInput__StackableInput",componentId:"sc-bgp531-0"})(["svg{","}& > div{border-radius:0;margin-left:-1px;padding:2px 7px 2px 12px;",";}"],BL,DL),HL=p.default.div.withConfig({displayName:"stackableGroup__StackableContainer",componentId:"sc-ogfpu5-0"})(["display:flex;max-width:",";& > ","{border-radius:0;&:first-of-type > div{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}&:last-of-type > div{border-top-right-radius:4px;border-bottom-right-radius:4px;}}",""],(e=>{let{locked:t}=e;return t?"106px":"none"}),FL,(e=>{let{$stackableGroupStyleOverride:t}=e;return t}));const UL=function StackableGroup(e){let{children:t,locked:n,className:r,stackableGroupStyleOverride:a}=e;return c.createElement(HL,{$stackableGroupStyleOverride:a,locked:n,className:r},t)},jL={topLeft:0,topRight:0,bottomRight:0,bottomLeft:0,locked:!0},zL=p.default.div.withConfig({displayName:"radius__FlexContainer",componentId:"sc-10ryvqs-0"})(["display:flex;"]),GL=p.default.div.withConfig({displayName:"radius__LockContainer",componentId:"sc-10ryvqs-1"})(["position:relative;display:flex;align-items:center;width:32px;margin-left:8px;"]),YL=(0,p.default)(LockToggle).withConfig({displayName:"radius__StyledLockToggle",componentId:"sc-10ryvqs-2"})(["",";"],sp),ZL=(0,p.default)(Rh).withConfig({displayName:"radius__TopLeft",componentId:"sc-10ryvqs-3"})(["transform:rotate(90deg);"]),WL=(0,p.default)(Rh).withConfig({displayName:"radius__TopRight",componentId:"sc-10ryvqs-4"})(["transform:rotate(180deg);"]),VL=(0,p.default)(Rh).withConfig({displayName:"radius__BottomRight",componentId:"sc-10ryvqs-5"})(["transform:rotate(270deg);"]);const $L=function RadiusControls(e){let{selectedElements:t,pushUpdateForObject:n,stackableGroupStyleOverride:r}=e;const a=zR(t,"borderRadius",jL),o=t.every((e=>(0,Vn.canSupportMultiBorder)(e))),i=!0===a.locked,l=(0,u.useCallback)(((e,t)=>{n("borderRadius",i?{topLeft:t,topRight:t,bottomRight:t,bottomLeft:t}:{[e]:t},jL,!0)}),[n,i]),s=(0,u.useCallback)((e=>{const t=e?{locked:e,topLeft:a.topLeft,topRight:a.topLeft,bottomRight:a.topLeft,bottomLeft:a.topLeft}:{locked:e};n("borderRadius",t,jL,!0)}),[n,a]);if(!o)return null;const p=i?(0,d.__)("Corner Radius","web-stories"):(0,d.__)("Top left corner radius","web-stories");return c.createElement(zL,null,c.createElement(UL,{stackableGroupStyleOverride:r,locked:i},c.createElement(FL,{suffix:c.createElement(ZL,null),value:a.topLeft===ve?"":a.topLeft,"aria-label":p,onChange:(e,t)=>l("topLeft",t),placeholder:a.topLeft===ve?we:"",isIndeterminate:a.topLeft===ve}),!i&&c.createElement(c.Fragment,null,c.createElement(FL,{suffix:c.createElement(WL,null),value:a.topRight===ve?"":a.topRight,"aria-label":(0,d.__)("Top right corner radius","web-stories"),onChange:(e,t)=>l("topRight",t),placeholder:a.topRight===ve?we:"",isIndeterminate:a.topRight===ve}),c.createElement(FL,{value:a.bottomLeft===ve?"":a.bottomLeft,"aria-label":(0,d.__)("Bottom left corner radius","web-stories"),onChange:(e,t)=>l("bottomLeft",t),placeholder:a.bottomLeft===ve?we:"",suffix:c.createElement(Rh,null),isIndeterminate:a.bottomLeft===ve}),c.createElement(FL,{value:a.bottomRight===ve?"":a.bottomRight,"aria-label":(0,d.__)("Bottom right corner radius","web-stories"),onChange:(e,t)=>l("bottomRight",t),placeholder:a.bottomRight===ve?we:"",suffix:c.createElement(VL,null),isIndeterminate:a.bottomRight===ve}))),c.createElement(GL,null,c.createElement(Tooltip,{title:(0,d.__)("Toggle consistent corner radius","web-stories"),key:a.locked.toString()},c.createElement(YL,{isLocked:a.locked,onClick:()=>s(!a.locked),"aria-label":(0,d.__)("Toggle consistent corner radius","web-stories")}))))},qL=(0,d.__)("Corner Radius","web-stories");const KL=function BorderRadius(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{borderRadius:n=jL,mask:r,type:a}=IL(["borderRadius","mask","type"]),o=Qa((e=>e.actions.updateSelectedElements)),i=(0,Vn.canSupportMultiBorder)({mask:r}),l=n.topLeft===n.topRight&&n.topLeft===n.bottomLeft&&n.topLeft===n.bottomRight;return i&&(n.locked||l)?c.createElement(oT,{ref:t,inputRef:e,inputLabel:qL},c.createElement(_L,{tabIndex:-1,ref:e,suffix:c.createElement(Rh,null),value:n.topLeft,"aria-label":qL,onChange:(e,t)=>(e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_radius",element:a}),o({properties:{borderRadius:{locked:!0,topLeft:e,topRight:e,bottomRight:e,bottomLeft:e}}})})(t),onKeyDown:e=>{aT(e,t)}}),c.createElement(wL,null)):null};const XL=function(e){let{isMultiple:t}=e;const{type:n}=IL(["type"]),{handleDismiss:r}=oL((e=>{let{actions:{handleDismiss:t}}=e;return{handleDismiss:t}}));return c.createElement(yL,{Icon:op.default,title:(0,d.__)("Dismiss menu","web-stories"),onClick:()=>{(0,P.trackEvent)("floating_menu",{name:"dismiss_menu",element:t?"multiple":n}),r()}})},QL={startX:0,startY:0,endX:ee.PAGE_WIDTH,endY:ee.PAGE_HEIGHT,width:ee.PAGE_WIDTH,height:ee.PAGE_HEIGHT},JL="left",eD="right",tD="top",nD="bottom";const rD=function(e){let{selectedElements:t,updateElements:n,isFloatingMenu:r}=e;const a=t.length>2,o=(0,u.useMemo)((()=>t.map((e=>{const{id:t,groupId:n,x:r,y:a,width:o,height:i,rotationAngle:l}=e;let s=r,c=a,d=o,u=i;if(l){const e=(0,zs.calcRotatedObjectPositionAndSize)(l,r,a,o,i);s=e.x,c=e.y,d=e.width,u=e.height}return{id:t,groupId:n,x:r,y:a,width:o,height:i,frameX:s,frameY:c,frameWidth:d,frameHeight:u}}))),[t]),i=t[0].groupId,l=i&&t.every((e=>e.groupId&&e.groupId===i)),s=1===t.length||l?QL:(0,zs.default)(t),c=e=>{(0,P.trackEvent)(r?"floating_menu":"design_panel",{name:`set_alignment_${e}`,element:"multiple"})},d=e=>{c(e),n((n=>{const{id:r,groupId:a}=n,i=a?(0,zs.default)(t.filter((e=>e.groupId===a))):null,l=o.find((e=>e.id===r)),{width:c=0,height:d=0,frameWidth:u=0,frameHeight:p=0}=l||{},m=e===JL||e===eD?(u-c)/2:(p-d)/2,g=a?e===JL||e===eD?l.frameX-i.startX:l.frameY-i.startY:0,f=a?i.width:c,h=a?i.height:d;return e===JL||e===eD?{x:e===JL?s.startX+m+g:s.endX-f-m+g}:{y:e===tD?s.startY+m+g:s.endY-h-m+g}}))};return{isDistributionEnabled:a,handleAlignLeft:()=>d(JL),handleAlignCenter:()=>{c("center");const e=(s.endX+s.startX)/2;n((n=>{const{id:r,width:a,groupId:i}=n,l=i?(0,zs.default)(t.filter((e=>e.groupId===i))):null,s=i?l.width:a,c=o.find((e=>e.id===r)),d=i?c.frameX-l.startX:0;return{x:e-s/2+d}}))},handleAlignRight:()=>d(eD),handleAlignTop:()=>d(tD),handleAlignMiddle:()=>{c("middle");const e=(s.endY+s.startY)/2;n((n=>{const{id:r,height:a,groupId:i}=n,l=i?(0,zs.default)(t.filter((e=>e.groupId===i))):null,s=i?l.height:a,c=o.find((e=>e.id===r)),d=i?c.frameY-l.startY:0;return{y:e-s/2+d}}))},handleAlignBottom:()=>d(nD),handleHorizontalDistribution:()=>{c("horizontal_distribution");const e=[...o];e.sort(((e,t)=>(e.frameX+e.frameWidth)/2-(t.frameX+t.frameWidth)/2));const t=e.reduce(((e,t)=>e+t.frameWidth),0),r=s.width-t,a=(0,aa.dataPixels)(r/(e.length-1)),i={};let l=0;e.forEach(((t,n)=>{const{id:r,x:o,width:s,frameWidth:c}=t;0===n||n===e.length-1?(i[r]={x:o},l=o):i[r]={x:l+(c-s)/2},l+=c+a})),n((e=>{let{id:t}=e;return i[t]}))},handleVerticalDistribution:()=>{c("vertical_distribution");const e=[...o];e.sort(((e,t)=>(e.frameY+e.frameHeight)/2-(t.frameY+t.frameHeight)/2));const t=e.reduce(((e,t)=>e+t.frameHeight),0),r=s.height-t,a=(0,aa.dataPixels)(r/(e.length-1)),i={};let l=0;e.forEach(((t,n)=>{const{id:r,y:o,height:s,frameHeight:c}=t;0===n||n===e.length-1?(i[r]={y:o},l=o):i[r]={y:l+(c-s)/2},l+=c+a})),n((e=>{let{id:t}=e;return i[t]}))}}};const aD=function ElementAlignment(){const{selectedElements:e,updateSelectedElements:t}=Qa((e=>{let{state:{selectedElements:t},actions:{updateSelectedElements:n}}=e;return{selectedElements:t,updateSelectedElements:n}})),{isDistributionEnabled:n,handleAlignLeft:r,handleAlignCenter:a,handleAlignRight:o,handleAlignTop:i,handleAlignMiddle:l,handleAlignBottom:s,handleHorizontalDistribution:u,handleVerticalDistribution:p}=rD({selectedElements:e,updateElements:e=>t({properties:e}),isFloatingMenu:!0});return c.createElement(c.Fragment,null,n&&c.createElement(c.Fragment,null,c.createElement(yL,{Icon:Uh,title:(0,d.__)("Distribute horizontally","web-stories"),onClick:u}),c.createElement(yL,{Icon:Yh,title:(0,d.__)("Distribute vertically","web-stories"),onClick:p}),c.createElement(wL,null)),c.createElement(yL,{Icon:Lg,title:(0,d.__)("Align left","web-stories"),onClick:r}),c.createElement(yL,{Icon:Pg,title:(0,d.__)("Align center","web-stories"),onClick:a}),c.createElement(yL,{Icon:Gg,title:(0,d.__)("Align right","web-stories"),onClick:o}),c.createElement(yL,{Icon:of,title:(0,d.__)("Align top","web-stories"),onClick:i}),c.createElement(yL,{Icon:Hg,title:(0,d.__)("Align vertical center","web-stories"),onClick:l}),c.createElement(yL,{Icon:xg,title:(0,d.__)("Align bottom","web-stories"),onClick:s}))};const oD=function(e){const{flip:t,type:n}=IL(["flip","type"]),r=Qa((e=>e.actions.updateSelectedElements));return{[e]:t[e]||!1,toggle:()=>{(0,P.trackEvent)("floating_menu",{name:`set_flip_${e}`,element:n}),r({properties:t=>({flip:{...t.flip,[e]:!t.flip[e]||!1}})})}}};const iD=function FlipHorizontal(){const{horizontal:e,toggle:t}=oD("horizontal");return c.createElement(yL,{Icon:GE,title:(0,d.__)("Flip horizontally","web-stories"),onClick:t,isToggled:e})};const lD=function FlipVertical(){const{vertical:e,toggle:t}=oD("vertical");return c.createElement(yL,{Icon:$E,title:(0,d.__)("Flip vertically","web-stories"),onClick:t,isToggled:e})};var sD=n(32396);const cD=function(e){const{width:t,height:n,rotationAngle:r,x:a,y:o}=e,i=(0,aa.dataPixels)((0,qn.calculateTextHeight)(e,t)),[l,s]=(0,sD.default)(r,0,0,0,i-n);return{height:i,x:(0,aa.dataPixels)(a+l),y:(0,aa.dataPixels)(o+s)}},dD=400;const uD=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dD,t=arguments.length>1?arguments[1]:void 0;return e=parseInt(e),isNaN(parseInt(e))?dD:t&&0!==t.length?t.reduce(((t,n)=>{t=parseInt(t),n=parseInt(n);const r=Math.abs(t-e),a=Math.abs(n-e);return r===a?t<n?t:n:a<r?n:t})):e};function pD(){return pD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pD.apply(this,arguments)}const mD=(0,u.forwardRef)((function StoryFontPicker(e,t){let{...n}=e;const{updateSelectedElements:r,selectedElements:a}=Qa((e=>{let{state:t,actions:n}=e;return{updateSelectedElements:n.updateSelectedElements,selectedElements:t.selectedElements}})),o=(0,u.useCallback)(((e,t)=>{r({properties:n=>{const r=hv(n,e,t),a=cD({...n,...r});return{...r,...a}}})}),[r]),{textInfo:{fontWeight:i,isItalic:l},handlers:{handleResetFontWeight:s}}=AL(a,o),{addRecentFont:d,maybeEnqueueFontStyle:p}=Uo((e=>{let{actions:t}=e;return{addRecentFont:t.addRecentFont,maybeEnqueueFontStyle:t.maybeEnqueueFontStyle}})),m=HR(a,(e=>{let{font:t}=e;return t?.family})),g=l?"italic":"normal",f=(0,u.useCallback)((async e=>{const{id:t,name:n,value:r,...l}=e;(0,P.trackEvent)("font_family_changed",{name:n}),await p(a.map((e=>{let{content:t}=e;return{font:l,fontStyle:g,fontWeight:i,content:(0,jr.stripHTML)(t)}}))),d(e),o({font:l},!0);const c=uD(400,l.weights);await s(c)}),[d,g,i,p,o,a,s]);return c.createElement(WR,pD({onChange:f,currentValue:m},n,{ref:t}))})),gD=mD,fD=(0,p.default)(gD).withConfig({displayName:"fontFamily__StyledFontPicker",componentId:"sc-sk3dxe-0"})(["width:164px;"]),hD=(0,p.css)(["max-height:200px;"]),bD=(0,p.css)(["border:1px solid ",";"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}));const ED=function FontFamily(){return c.createElement(fD,{tabIndex:-1,listStyleOverrides:hD,containerStyleOverrides:bD})};const yD=function(e){const t=[{label:me[400],value:"400"}];return e?.weights?e.weights.map((e=>({label:me[e],value:e.toString()}))):t},_D={MIN:8,MAX:800},vD=p.default.div.withConfig({displayName:"font__Space",componentId:"sc-1upk4a3-0"})(["flex:0 0 10px;"]),wD=(0,p.default)(FC).withConfig({displayName:"font__StyledNumericInput",componentId:"sc-1upk4a3-1"})(["flex-basis:80px;text-align:center;"]),TD=(0,p.default)(xv.DropDown).withConfig({displayName:"font__StyledDropDown",componentId:"sc-1upk4a3-2"})(["background-color:transparent;"]);const SD=function FontControls(e){let{selectedElements:t,pushUpdate:n,highlightStylesOverride:r,fontDropdownRef:a}=e;const o=HR(t,(e=>{let{font:t}=e;return t?.family})),i=HR(t,"fontSize"),{textInfo:{fontWeight:l,isItalic:s},handlers:{handleSelectFontWeight:p}}=AL(t,n),{fonts:m=[],maybeEnqueueFontStyle:g,getFontByName:f}=Uo((e=>{let{actions:{maybeEnqueueFontStyle:t,getFontByName:n},state:{fonts:r}}=e;return{maybeEnqueueFontStyle:t,getFontByName:n,fonts:r}})),h=(0,u.useMemo)((()=>yD(f(o))),[f,o]),b=s?"italic":"normal",E=(0,u.useCallback)((async(e,n)=>{await g(t.map((e=>{let{font:t,content:r}=e;return{font:t,fontStyle:b,fontWeight:parseInt(n),content:(0,jr.stripHTML)(r)}}))),p(n)}),[b,p,g,t]);return wx((e=>{let{fontSize:t}=e;return{fontSize:(0,Xs.clamp)(t,_D)}}),[]),c.createElement(c.Fragment,null,m&&c.createElement(GI,null,c.createElement(gD,{ref:a,highlightStylesOverride:r,showDropdownLabel:!0})),c.createElement(GI,null,h&&c.createElement(c.Fragment,null,c.createElement(TD,{ariaLabel:(0,d.__)("Font weight","web-stories"),placeholder:we,options:h,selectedValue:ve===l?"":l,onMenuItemClick:E,selectButtonStylesOverride:sp}),c.createElement(vD,null)),c.createElement(wD,{"aria-label":(0,d.__)("Font size","web-stories"),isFloat:!0,value:i,onChange:(e,t)=>n({fontSize:t},!0),min:_D.MIN,max:_D.MAX,isIndeterminate:ve===i,placeholder:ve===i?we:null,containerStyleOverride:cp})))},CD=(0,p.default)(FC).attrs({inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT}).withConfig({displayName:"fontSize__Input",componentId:"sc-17k2x26-0"})(["width:50px;flex:0 0 50px;"]),ID=(0,d.__)("Font size","web-stories");const xD=function FontSize(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{fontSize:n,updateSelectedElements:r}=Qa((e=>{let{state:t,actions:n}=e;return{fontSize:t.selectedElements[0].fontSize,updateSelectedElements:n.updateSelectedElements}})),a=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_font_size"}),r({properties:t=>{const n=hv(t,e,!0),r=cD({...t,...n});return{...n,...r}}})}),[r]);return c.createElement(oT,{ref:t,inputRef:e,inputLabel:ID},c.createElement(CD,{tabIndex:-1,ref:e,"aria-label":ID,isFloat:!0,value:n,onChange:(e,t)=>a({fontSize:t}),min:_D.MIN,max:_D.MAX,placeholder:n,containerStyleOverride:cp,selectButtonStylesOverride:sp,onKeyDown:e=>{aT(e,t)}}))},AD={MIN:0,MAX:100};function kD(e){let{opacity:t}=e;return void 0!==t?t:AD.MAX}const OD=function OpacityControls(e){let{selectedElements:t,pushUpdate:n}=e;const r=HR(t,kD),a=(0,u.useCallback)(((e,t)=>n({opacity:t??100},!0)),[n]);return c.createElement(FC,{suffix:c.createElement(Ph,null),unit:(0,d._x)("%","Percentage","web-stories"),value:r,onChange:a,min:AD.MIN,max:AD.MAX,"aria-label":(0,d.__)("Opacity in percent","web-stories"),placeholder:r===ve?we:"",isIndeterminate:r===ve,containerStyleOverride:cp})},PD=(0,p.default)(FC).withConfig({displayName:"layerOpacity__Input",componentId:"sc-1pptz1t-0"})(["width:82px;flex:0 0 82px;"]),ND=(0,d.__)("Opacity in percent","web-stories");const MD=function LayerOpacity(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{opacity:n,type:r}=IL(["opacity","type"]),a=Qa((e=>e.actions.updateSelectedElements));return c.createElement(oT,{ref:t,inputRef:e,inputLabel:ND},c.createElement(PD,{ref:e,tabIndex:-1,suffix:c.createElement(Ph,null),unit:(0,d._x)("%","Percentage","web-stories"),value:n||0,"aria-label":ND,onChange:(e,t)=>{a({properties:()=>({opacity:t??100})}),(0,P.trackEvent)("floating_menu",{name:"set_opacity",element:r})},inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT,onKeyDown:e=>{aT(e,t)},min:AD.MIN,max:AD.MAX}))},RD=(0,p.default)(xM).withConfig({displayName:"loop__StyledLoopContent",componentId:"sc-154lze5-0"})(["gap:8px;"]);const LD=function Loop(){const{loop:e}=IL(["loop"]),t=Qa((e=>e.actions.updateSelectedElements));return c.createElement(RD,{tabIndex:-1,loop:e,onChange:()=>{(0,P.trackEvent)("floating_menu",{name:"set_loop"}),t({properties:e=>{let{loop:t}=e;return{loop:!t}}})}})};const DD=function More(){const e=cm((e=>{let{setHighlights:t}=e;return t})),t=Qa((e=>{let{state:t}=e;return t.selectedElements[0].type}));return c.createElement(CL,{text:(0,d._x)("More","Link to more options in design panel for selected element","web-stories"),onClick:()=>{e({highlight:hg.STYLE_PANE}),(0,P.trackEvent)("floating_menu",{name:"click_more_button",element:t})}})},BD=(0,u.createContext)({state:{},actions:{}});const FD=function(e){return(0,u.useContextSelector)(BD,e??u.identity)};const HD=function(e){let{resource:t,elementId:n,isSingleElement:r=!0}=e;const{isTranscodingEnabled:a}=lo(),{muteExistingVideo:o,isElementTrimming:i,isNewResourceMuting:l,canTranscodeResource:s}=Bl((e=>{let{state:{canTranscodeResource:t,isNewResourceMuting:n,isElementTrimming:r},actions:{muteExistingVideo:a}}=e;return{canTranscodeResource:t,isNewResourceMuting:n,isElementTrimming:r,muteExistingVideo:a}})),{isMuted:c,id:d=0}=t,p=!!r&&i(n),m=l(d),g=(0,u.useCallback)((()=>{o({resource:t})}),[t,o]),f=!s(t),h=a&&r&&(!c&&s(t)||m),{hasTrimMode:b,toggleTrimMode:E}=FD((e=>{let{state:{hasTrimMode:t},actions:{toggleTrimMode:n}}=e;return{hasTrimMode:t,toggleTrimMode:n}}));return{state:{canTrim:b,canMute:h,isTrimming:p,isMuting:m,isDisabled:f},actions:{handleMute:g,handleTrim:E}}};const UD=function Mute(){const{id:e,resource:t}=IL(["id","resource"]),{state:{canMute:n,isMuting:r,isDisabled:a},actions:{handleMute:o}}=HD({elementId:e,resource:t});if(!n)return null;const i=r?(0,d.__)("Removing audio","web-stories"):(0,d.__)("Remove audio","web-stories");return c.createElement(yL,{Icon:ty,title:i,disabled:a||r,onClick:e=>{(0,P.trackEvent)("floating_menu",{name:"set_mute"}),o(e)}})};const jD=function ShapeColor(){const{backgroundColor:e,updateSelectedElements:t}=Qa((e=>{let{state:t,actions:n}=e;return{backgroundColor:t.selectedElements[0].backgroundColor,updateSelectedElements:n.updateSelectedElements}})),n=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_shape_color",element:"shape"}),t({properties:()=>({backgroundColor:e})})}),[t]);return c.createElement(cL,{tabIndex:-1,label:(0,d.__)("Shape color","web-stories"),value:e,allowsSavedColors:!0,onChange:n,hasInputs:!0,hasEyedropper:!0,allowsOpacity:!0,allowsGradient:!0,opacityFocusTrap:!0,colorFocusTrap:!0})},zD=p.default.div.withConfig({displayName:"textAlign__SubMenuContainer",componentId:"sc-1i0z5qr-0"})(["position:absolute;top:calc(var(--height) + ","px);z-index:9999;"],3),GD=(0,p.default)(gL.default).withConfig({displayName:"textAlign__StyledMenuButton",componentId:"sc-1i0z5qr-1"})(["flex:0 0 60px;height:36px;border:1px solid ",";padding:2px 0;border-radius:4px;"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal})),YD=(0,p.default)(mL).withConfig({displayName:"textAlign__StyledMenuIcon",componentId:"sc-1i0z5qr-2"})(["width:auto;display:flex;overflow:hidden;svg{width:32px;}svg:last-child{margin-left:-8px;}"]),ZD=[{value:"left",icon:Qg,label:(0,d.__)("Align text left","web-stories")},{value:"center",icon:Wg,label:(0,d.__)("Align text center","web-stories")},{value:"right",icon:tf,label:(0,d.__)("Align text right","web-stories")},{value:"justify",icon:qg,label:(0,d.__)("Align text justified","web-stories")}];const WD=function TextAlign(){const{textAlign:e="left"}=IL(["textAlign"]),t=Qa((e=>e.actions.updateSelectedElements)),[n,r]=(0,u.useState)(!1),a=(0,u.useRef)(),o=(0,u.useRef)(),[i,l]=(0,u.useState)(0);(0,u.useEffect)((()=>l(o.current.parentNode.offsetLeft+-8)),[]);const s=e=>{e&&setTimeout((()=>e.focus()))},{icon:p,label:m}=ZD.find((t=>{let{value:n}=t;return n===e}))||ZD[0],g=e=>()=>{(0,P.trackEvent)("floating_menu",{name:`set_text_alignment_${e}`,element:"text"}),t({properties:{textAlign:e}})},f=()=>{r(!1),o.current.focus()},h=(0,d.__)("Change text alignment","web-stories"),b=n?"":h;return(0,Cr.useKeyDownEffect)(o,"down",(()=>r(!0)),[]),c.createElement(c.Fragment,null,c.createElement(Tooltip,{placement:Gd.PLACEMENT.BOTTOM,title:b},c.createElement(GD,{tabIndex:-1,ref:o,onClick:()=>r((e=>!e)),"aria-haspopup":"menu","aria-expanded":n,"aria-label":h},c.createElement(YD,{title:b},c.createElement(p,{role:"img","aria-label":m}),c.createElement(Fp.Disclosure,{style:{marginLeft:-8,marginRight:0},isOpen:n})))),c.createElement(zD,{ref:a,style:{left:`${i}px`}},c.createElement(qR.default,{onDismiss:f,isOpen:n,onCloseSubMenu:f,"aria-label":(0,d.__)("Text alignment options","web-stories"),isSubMenu:!0,isSecondary:!0,parentMenuRef:o,isHorizontal:!0},ZD.map((t=>{let{value:n,icon:r,label:a}=t;return c.createElement(yL,{isToggled:n===e,ref:n===e?s:null,key:n,Icon:r,title:a,onClick:g(n)})})))))};const VD=function TextColor(){const{content:e}=IL(["content"]),t=Qa((e=>e.actions.updateSelectedElements)),n=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_text_color",element:"text"}),t({properties:t=>hv(t,e,!0)})}),[t]),{textInfo:{color:r},handlers:{handleSetColor:a}}=AL([{content:e,type:"text"}],n);return c.createElement(cL,{tabIndex:-1,label:(0,d.__)("Text color","web-stories"),value:r,allowsSavedColors:!0,onChange:a,hasInputs:!1,hasEyedropper:!0,allowsOpacity:!0,allowsGradient:!1})};const $D=function ToggleBold(){const{isToggled:e,toggle:t}=kL({currentValue:"isBold",handler:"handleClickBold",eventName:"set_bold"});return c.createElement(yL,{isToggled:e,Icon:zb,title:(0,d.__)("Toggle bold","web-stories"),onClick:t,tabIndex:-1})};const qD=function ToggleItalics(){const{isToggled:e,toggle:t}=kL({currentValue:"isItalic",handler:"handleClickItalic",eventName:"set_italic"});return c.createElement(yL,{isToggled:e,Icon:Zb,title:(0,d.__)("Toggle italic","web-stories"),onClick:t,tabIndex:-1})};const KD=function ToggleUnderline(){const{isToggled:e,toggle:t}=kL({currentValue:"isUnderline",handler:"handleClickUnderline",eventName:"set_underline"});return c.createElement(yL,{isToggled:e,Icon:bE,title:(0,d.__)("Toggle underline","web-stories"),onClick:t,tabIndex:-1})};const XD=function Trim(){const{id:e,resource:t}=IL(["id","resource"]),{state:{canTrim:n,isTrimming:r,isDisabled:a},actions:{handleTrim:o}}=HD({elementId:e,resource:t});if(!n)return null;const i=r?(0,d.__)("Trimming video","web-stories"):(0,d.__)("Trim video","web-stories");return c.createElement(yL,{Icon:x_,title:i,disabled:a||r,onClick:e=>{(0,P.trackEvent)("floating_menu",{name:"set_trim"}),o(e)}})};const QD=function Trash(e){let{title:t,handleRemove:n}=e;return c.createElement(yL,{Icon:ev.default,title:t,onClick:n})},JD=(0,u.memo)((function FloatingImageMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),eB=(0,u.memo)((function FloatingMultipleMenu(){return c.createElement(c.Fragment,null,c.createElement(aD,null),c.createElement(wL,null),c.createElement(XL,{isMultiple:!0}))})),tB=(0,u.memo)((function FloatingShapeMenu(){return c.createElement(c.Fragment,null,c.createElement(jD,null),c.createElement(wL,null),c.createElement(KL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),nB=(0,u.memo)((function FloatingStickerMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),rB=(0,u.memo)((function FloatingTextMenu(){return c.createElement(c.Fragment,null,c.createElement(ED,null),c.createElement(xD,null),c.createElement(WD,null),c.createElement($D,null),c.createElement(qD,null),c.createElement(KD,null),c.createElement(wL,null),c.createElement(VD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),aB=(0,u.memo)((function FloatingVideoMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(LD,null),c.createElement(XD,null),c.createElement(UD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))}));function oB(){return oB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oB.apply(this,arguments)}const iB=function ProductDropdown(e){let{product:t,setProduct:n,...r}=e;const a=(0,u.useMemo)((()=>[{id:t?.productId,name:t?.productTitle,product:t}]),[t]),[o,i]=(0,u.useState)(!1),[l,s]=(0,u.useState)(a),{actions:{getProducts:p}}=W(),{isSaving:m,currentPageProductIds:g}=Qa((e=>{let{state:{meta:{isSaving:n},currentPage:r}}=e;return{isSaving:n,currentPageProductIds:r?.elements?.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).filter((e=>{let{product:n}=e;return n.productId!==t.productId})).map((e=>{let{product:t}=e;return t?.productId}))}})),f=(0,u.useCallback)((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{products:t}=await p(e);return t.filter((e=>e.productImages.length&&!g.includes(e.productId))).map((e=>({name:e.productTitle,id:e.productId,product:e})))}),[g,p]);(0,u.useEffect)((()=>{(async()=>{try{i(!0);const e=await f();s(e)}catch(e){s(a)}finally{i(!1)}})()}),[a]);const h={hasSearch:!0,lightMode:!0,onChange:e=>{let{product:t}=e;return n(t)},getOptionsByQuery:f,selectedId:t?.productId,dropDownLabel:(0,d.__)("Product","web-stories"),disabled:m,primaryOptions:o?a:l,zIndex:10};return c.createElement(GR.default.DropDown,oB({options:l,searchResultsLabel:(0,d.__)("Search results","web-stories"),"aria-label":(0,d.__)("Product","web-stories")},h,r))},lB=(0,p.default)(iB).withConfig({displayName:"product__StyledDropDown",componentId:"sc-6kpcrl-0"})(["width:240px;"]),sB=(0,u.memo)((function FloatingProductMenu(){const{selectedElement:e,updateSelectedElements:t,deleteSelectedElements:n}=Qa((e=>{let{actions:t,state:n}=e;return{updateSelectedElements:t.updateSelectedElements,selectedElement:n.selectedElements[0],deleteSelectedElements:t.deleteSelectedElements}})),{shoppingProvider:r}=U(),a="none"!==r,o=(0,u.useCallback)((e=>t({properties:{product:e}})),[t]);return c.createElement(c.Fragment,null,a&&c.createElement(c.Fragment,null,c.createElement(lB,{product:e?.product,setProduct:o}),c.createElement(wL,null)),c.createElement(QD,{title:(0,d.__)("Remove product","web-stories"),handleRemove:n}),c.createElement(XL,null))})),cB=sB,dB=(0,u.memo)((function FloatingMenuSelector(e){let{selectedElementType:t}=e;switch(t){case $R.MULTIPLE:return c.createElement(eB,null);case $R.GIF:case $R.IMAGE:return c.createElement(JD,null);case $R.SHAPE:return c.createElement(tB,null);case $R.STICKER:return c.createElement(nB,null);case $R.TEXT:return c.createElement(rB,null);case $R.VIDEO:return c.createElement(aB,null);case $R.PRODUCT:return c.createElement(cB,null);default:return null}})),uB=(0,d.__)("To exit the floating menu, press Escape.","web-stories"),pB=p.default.section.withConfig({displayName:"menu__MenuWrapper",componentId:"sc-pi2qzl-0"})(["display:flex;position:absolute;z-index:",";visibility:",";transition:140ms opacity;"],4,(e=>{let{visuallyHidden:t}=e;return t?"hidden":"visible"})),mB=(0,u.memo)((0,u.forwardRef)((function FloatingMenu(e,t){let{selectionIdentifier:n,selectedElementType:r,handleDismiss:a,visuallyHidden:o}=e;const i=tL(rL.EDIT_ELEMENT),l=(0,Tv.default)(),s=(0,u.useCallback)((()=>{l(uB)}),[l]);return(0,u.useLayoutEffect)((()=>{const e=t.current,n=()=>{e.style.width="";const t=e.getBoundingClientRect();e.style.setProperty("--width",`${t.width.toFixed(2)}px`),e.style.setProperty("--height",`${t.height.toFixed(2)}px`),e.style.width="var(--width)"};n();const r=new MutationObserver(n),a=e.querySelector("[role=menu]");return r.observe(a,{childList:!0}),()=>r.disconnect()}),[t,n]),c.createElement(pB,{ref:t,"aria-label":(0,d.__)("Design menu","web-stories"),visuallyHidden:o},c.createElement(iL,{handleDismiss:a},c.createElement(qR.default,{isInline:!0,isHorizontal:!0,isSecondary:!0,isAlwaysVisible:!0,tabIndex:-1,ref:i,dismissOnEscape:!1,onFocus:s,"aria-label":(0,d.__)("Design options for selected element","web-stories"),onMouseDown:e=>{e.stopPropagation()},popoverZIndex:4},c.createElement(dB,{selectedElementType:r}))))}))),gB=mB;const fB=function FloatingMenuLayer(){const{setMoveableMount:e,isEyedropperActive:t}=$s((e=>{let{actions:t,state:n}=e;return{setMoveableMount:t.setMoveableMount,isEyedropperActive:n.isEyedropperActive}})),{workspaceWidth:n,workspaceHeight:r}=cs((e=>{let{state:{workspaceWidth:t,workspaceHeight:n}}=e;return{workspaceWidth:t,workspaceHeight:n}})),{selectedElementType:a,selectionIdentifier:o}=Qa((e=>{let{state:{selectedElements:t}}=e;return{selectedElementType:1!==t.length||t[0].isBackground?t.length>1?$R.MULTIPLE:$R.NONE:t[0]?.type,selectionIdentifier:t.map((e=>{let{id:t}=e;return t})).join("")}})),i=(0,I.useTransform)((e=>{let{state:t}=e;return t.isAnythingTransforming})),[l,s]=(0,u.useState)(null),d=(0,u.useRef)(),p=(0,u.useRef)(),[m,g]=(0,u.useState)(!1),f=(0,u.useCallback)((()=>g(!0)),[]);(0,u.useEffect)((()=>g(!1)),[o]),(0,u.useEffect)((()=>(e((()=>s)),()=>e(null))),[e]),(0,u.useEffect)((()=>{g(!!t)}),[t]),(0,u.useEffect)((()=>{p.current={width:n,height:r}}),[n,r]);const h=function(e){switch(e){case $R.MULTIPLE:return!0;case $R.NONE:return!1;default:return(0,Mn.getDefinitionForType)(e)?.hasDesignMenu}}(a)&&!m&&l;return(0,u.useEffect)((()=>{const e=d.current;if(!e||!l)return;const t=()=>{const t=l.getRect(),{width:n,height:r}=p.current,a=t.left+t.width/2;e.style.left=`clamp(0px, ${a}px - (var(--width) / 2), ${n}px - var(--width))`;const o=t.top+t.height+10;e.style.top=`clamp(0px, ${o}px, ${r}px - var(--height))`};t();const n=new MutationObserver(t),r=document.querySelector(".moveable-control-box");return n.observe(r,{attributes:!0,subtree:!0,attributeFilter:["style"]}),()=>n.disconnect()}),[l,h]),!!h&&c.createElement(gB,{ref:d,handleDismiss:f,selectedElementType:a,selectionIdentifier:o,visuallyHidden:i})};const hB=async function(e,t,n,r){const{width:a,height:o,scale:i,focalX:l,focalY:s,flip:c}=e,{src:d,length:u}=t,p=r,m=p/o*a,g=Math.ceil(n/m),f=n/g,h=f/m*a,{width:b,height:E,offsetX:y,offsetY:_}=(0,kO.default)(t,h,o,i,c?.horizontal?100-l:l,c?.vertical?100-s:s),v=u/(g-1),w=await re(d);w.width=b,w.height=E,await le(w,1e-6);const T=document.createElement("canvas");T.width=n,T.height=r;const S=T.getContext("2d");let C=0,I=0;const x=async()=>{await le(w,C);const e=I*f;return(c.vertical||c.horizontal)&&(S.translate(e+f/2,p/2),S.scale(c.horizontal?-1:1,c.vertical?-1:1),S.translate(-(e+f/2),-p/2)),S.drawImage(w,y,_,h,o,e,0,f,p),S.setTransform(1,0,0,1,0,0),I+=1,I===g?Promise.resolve():(C+=v,x())};return x().then((()=>T.toDataURL()))};const bB=function(e,t,n){const[r,a]=(0,u.useState)(null);return(0,u.useEffect)((()=>{if(!e)return;const{element:r,resource:o}=t;hB(r,o,n,36).then(a)}),[e,t,n]),r};function EB(){return EB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EB.apply(this,arguments)}const yB=p.default.button.withConfig({displayName:"slider__Thumb",componentId:"sc-50zvue-0"})(["position:absolute;padding:0;"]);function _B(e){return e.pageX||e.clientX}const vB=function Slider(e){let{railWidth:t,min:n,max:r,step:a,minorStep:o=null,value:i=0,onChange:l=(()=>{}),getValueText:s=null,onPointerDown:d=(()=>{}),onNudge:p=(()=>{}),...m}=e;const g=(0,u.useRef)(),f=(0,u.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),g.current.focus(),d?.();const a=function(a){const o=_B(a)-_B(e);l(i+o/t*(r-n)),a.preventDefault(),a.stopPropagation()},o=function(){document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",o)};return document.addEventListener("pointermove",a),document.addEventListener("pointerup",o),o}),[i,r,n,l,t,d]),h=(0,u.useCallback)((e=>{l(i+e),p?.()}),[l,p,i]);(0,Cr.useKeyDownEffect)(g,"left",(()=>h(-a)),[h,a]),(0,Cr.useKeyDownEffect)(g,"shift+left",(()=>h(-o)),[h,o]),(0,Cr.useKeyDownEffect)(g,"right",(()=>h(a)),[h,a]),(0,Cr.useKeyDownEffect)(g,"shift+right",(()=>h(o)),[h,o]);const b={left:`${((i-n)/(r-n)*t).toFixed(2)}px`};return c.createElement(yB,EB({ref:g,onPointerDown:f,style:b,role:"slider","aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":i,"aria-valuetext":s?.(i)},m))};function wB(){return wB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wB.apply(this,arguments)}const TB=(0,p.default)(vB).withConfig({displayName:"currentTime__StyledSlider",componentId:"sc-tf91kz-0"})(["top:-3px;bottom:-3px;width:6px;margin-left:-3px;border-radius:6px;border-width:0;background-color:",";box-shadow:0px 1px 2px rgba(60,64,67,0.3),0px 1px 3px 1px rgba(60,64,67,0.15);"],(e=>{let{theme:t}=e;return t.colors.interactiveBg.primaryNormal}));const SB=function CurrentTime(e){const t=FD((e=>{let{state:{currentTime:t}}=e;return t}));return c.createElement(TB,wB({"aria-label":(0,d.__)("Current time","web-stories"),value:t,disabled:!0},e))},CB=p.default.aside.withConfig({displayName:"trimmerComponents__Menu",componentId:"sc-1vmlktu-0"})(["display:flex;justify-content:center;align-items:flex-start;height:","px;gap:14px;"],40),IB=p.default.div.withConfig({displayName:"trimmerComponents__RailWrapper",componentId:"sc-1vmlktu-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-end;"]),xB=p.default.div.withConfig({displayName:"trimmerComponents__Rail",componentId:"sc-1vmlktu-2"})(["position:relative;width:","px;height:","px;border-radius:4px;border:1px solid ",";background-color:",";"],(e=>{let{width:t}=e;return t}),36,(e=>{let{theme:t}=e;return t.colors.standard.white}),(e=>{let{theme:t}=e;return t.colors.standard.white}));function Duration(e){let{children:t}=e;return c.createElement($e.Text,{as:"span",size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.X_SMALL},t)}const AB=(0,p.default)(vB).withConfig({displayName:"trimmerComponents__Handle",componentId:"sc-1vmlktu-3"})(["top:6px;bottom:6px;width:6px;margin-left:-3px;border-radius:6px;background-color:",";border:1px solid ",";box-shadow:0px 1px 2px rgba(60,64,67,0.3),0px 1px 3px 1px rgba(60,64,67,0.15);cursor:col-resize;&:focus{border-color:",";}&.focus-visible{outline:none !important;}"],(e=>{let{theme:t}=e;return t.colors.bg.primary}),(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}),(e=>{let{theme:t}=e;return t.colors.border.focus})),kB=p.default.svg.withConfig({displayName:"trimmerComponents__SVG",componentId:"sc-1vmlktu-4"})(["position:absolute;top:-1px;"]),OB=p.default.div.withConfig({displayName:"trimmerComponents__ButtonWrapper",componentId:"sc-1vmlktu-5"})(["flex-grow:1;flex-basis:100px;display:flex;justify-content:",";"],(e=>{let{isStart:t}=e;return t?"flex-end":"flex-start"}));function PB(e){let{width:t,isLeftAligned:n=!1}=e;const r=n?{left:"-1px"}:{right:"-1px"},a=n?`M 4 0 h ${t} a 4 4 0 0 0 -4 4 v 28 a 4 4 0 0 0 4 4 h -${t} a 4 4 0 0 1 -4 -4 v -28 a 4 4 0 0 1 4 -4 Z`:`M 0 0 h ${t} a 4 4 0 0 1 4 4 v 28 a 4 4 0 0 1 -4 4 h -${t} a 4 4 0 0 0 4 -4 v -28 a 4 4 0 0 0 -4 -4 Z`;return c.createElement(kB,{style:{width:`${t+4}px`,...r},viewBox:`0 0 ${t+4} 36`},c.createElement("path",{stroke:"transparent",fill:"black",fillOpacity:"0.5",d:a}))}function NB(){return NB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},NB.apply(this,arguments)}const MB=function VideoTrimmer(){const{startOffset:e,endOffset:t,maxOffset:n,setStartOffset:r,setEndOffset:a,hasChanged:o,performTrim:i,setIsDraggingHandles:l,toggleTrimMode:s,videoData:p}=FD((e=>{let{state:{startOffset:t,endOffset:n,maxOffset:r,hasChanged:a,videoData:o},actions:{setStartOffset:i,setEndOffset:l,performTrim:s,toggleTrimMode:c,setIsDraggingHandles:d}}=e;return{startOffset:t,endOffset:n,maxOffset:r,setStartOffset:i,setEndOffset:l,hasChanged:a,performTrim:s,setIsDraggingHandles:d,toggleTrimMode:c,videoData:o}})),{workspaceWidth:f,pageWidth:h}=cs((e=>{let{state:{workspaceWidth:t,pageWidth:n}}=e;return{workspaceWidth:t,pageWidth:n}})),b=(0,u.useDebouncedCallback)((()=>l(!1)),1e3),E=(0,u.useRef)(null);lT({ref:E});const y=(0,u.useCallback)((e=>{e&&e.focus()}),[]),_=Math.min(h,f-260),v=h&&n&&p,w=bB(v,p,_),T={ref:E,"aria-label":(0,d.__)("Video trimmer","web-stories")};if(!v)return c.createElement(CB,T);const S={min:0,max:n,step:100,minorStep:10,onPointerDown:()=>l(!0),onPointerUp:()=>l(!1),onNudge:()=>{l(!0),b()}};return c.createElement(CB,T,c.createElement(OB,{isStart:!0},c.createElement(m.Button,{variant:g.BUTTON_VARIANTS.RECTANGLE,type:g.BUTTON_TYPES.SECONDARY,size:g.BUTTON_SIZES.SMALL,onClick:s,ref:y},(0,d.__)("Cancel","web-stories"))),c.createElement(IB,null,c.createElement(xB,{width:_,style:{backgroundImage:w?`url(${w})`:void 0}},c.createElement(PB,{isLeftAligned:!0,width:e/n*_}),c.createElement(PB,{width:(n-t)/n*_}),c.createElement(SB,NB({railWidth:_},S)),c.createElement(AB,NB({railWidth:_,value:e,"aria-label":(0,d.__)("Start offset","web-stories"),onChange:e=>r(e)},S)),c.createElement(AB,NB({railWidth:_,value:t,"aria-label":(0,d.__)("End offset","web-stories"),onChange:e=>a(e)},S))),c.createElement(Duration,null,oe(Math.ceil((t-e)/1e3)))),c.createElement(OB,null,c.createElement(m.Button,{variant:g.BUTTON_VARIANTS.RECTANGLE,type:g.BUTTON_TYPES.PRIMARY,size:g.BUTTON_SIZES.SMALL,onClick:i,disabled:!o},(0,d.__)("Trim","web-stories"))))};function RB(){return RB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RB.apply(this,arguments)}const LB={FLOAT_PANEL:11},DB=p.default.div.withConfig({displayName:"editElement__Wrapper",componentId:"sc-1w8k2uc-0"})([""," "," "," pointer-events:initial;"],$n.elementWithPosition,$n.elementWithSize,$n.elementWithRotation),BB=(0,u.memo)((0,u.forwardRef)((function EditElement(e,t){let{element:n,editWrapper:r,onResize:a}=e;const{id:o,type:i}=n,{getBox:l}=(0,Rc.default)((e=>({getBox:e.actions.getBox}))),{getProxiedUrl:s}=Jo(),{isRTL:d,styleConstants:{topOffset:p}={}}=U(),{actions:{maybeEnqueueFontStyle:m}}=Uo(),{updateElementById:g,deleteSelectedElements:f}=Qa((e=>({updateElementById:e.actions.updateElementById,deleteSelectedElements:e.actions.deleteSelectedElements}))),{isTrimMode:h,resource:b,setVideoNode:E}=FD((e=>{let{state:{isTrimMode:t,videoData:n},actions:{setVideoNode:r}}=e;return{isTrimMode:t,setVideoNode:r,resource:n?.resource}})),[y,_]=(0,u.useState)(null),{Edit:v}=(0,Mn.getDefinitionForType)(i),w=y?{...n,...y}:n,T=l(w);return c.createElement(DB,RB({"aria-labelledby":`layer-${o}`},T,{ref:t}),c.createElement(v,{element:w,box:T,editWrapper:r,onResize:a,setLocalProperties:_,getProxiedUrl:s,isRTL:d,topOffset:p,isTrimMode:h,resource:b,setVideoNode:E,updateElementById:g,deleteSelectedElements:f,maybeEnqueueFontStyle:m,zIndexCanvas:LB}))}))),FB=BB;var HB=n(94184),UB=n.n(HB);const jB=function(e){let{canSnap:t,otherNodes:n,snappingOffsetX:r=null,isDragging:a}=e;const o=Ks(Zs),i=Ks(Ws),l=$s((e=>{let{state:t}=e;return t.designSpaceGuideline})),{pageWidth:s,pageHeight:c}=cs((e=>{let{state:{pageWidth:t,pageHeight:n}}=e;return{pageWidth:t,pageHeight:n}})),{activeDropTargetId:d,isDropTargetingDisabled:p}=rs((e=>{let{state:t}=e;return{activeDropTargetId:t.activeDropTargetId,isDropTargetingDisabled:t.isDropTargetingDisabled}})),m=function(e){const t=e(Sc),{openToUnreadTip:n=Dt}=Tc((e=>{let{actions:t}=e;return{openToUnreadTip:t.openToUnreadTip}})),r=(0,u.useDebouncedCallback)(n,300);return(0,u.useCallback)((()=>{t===Sc.SAFE_ZONE&&r(nc)}),[t,r])}((e=>{let{SAFE_ZONE:t}=e;return t}));t=t&&!p&&!d;const g=(0,u.useCallback)((e=>{let{elements:t}=e;const n=t.flat().some((e=>{let{center:t,element:n}=e;return n===l&&!t}));a&&n&&m()}),[a,l,m]);if(!o||!i)return{};const f=r||o.x,h=Math.ceil(i.x-f),b=Math.floor(i.y-o.y),E=t?[h,h+s/2,h+s]:[],y=(s/ee.FULLBLEED_RATIO-c)/2,_={left:!0,top:!0,right:!0,bottom:!0,center:!0,middle:!0};return{snappable:t,snapGap:t,snapDirections:_,elementSnapDirections:_,isDisplaySnapDigit:!1,onSnap:g,horizontalGuidelines:t?[b-y,b,b+c/2,b+c,b+c+y]:[],verticalGuidelines:E,elementGuidelines:t?[...n,l]:[]}};const zB=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,u.useEffect)((()=>{let t=!0;const n=()=>{t&&e.current?.updateRect?.()};n();const r=setTimeout(n);return()=>{t=!1,clearTimeout(r)}}),t)};const GB=function(e){(0,u.useEffect)((()=>{const t=()=>e.current?.updateRect();return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}}),[e])};const YB=function(e,t){const{left:n,right:r,top:a,bottom:o}=e.getBoundingClientRect(),i=t.getBoundingClientRect();return n>i.right||r<i.left||o<i.top||a>i.bottom};const ZB=function(){const{deleteSelectedElements:e}=Qa((e=>({deleteSelectedElements:e.actions.deleteSelectedElements}))),{clearTransforms:t}=(0,I.useTransform)((e=>({clearTransforms:e.actions.clearTransforms}))),{fullbleedContainer:n}=$s((e=>{let{state:{fullbleedContainer:t}}=e;return{fullbleedContainer:t}}));return{handleElementOutOfCanvas:r=>!!YB(r,n)&&(e(),t(),!0)}};const WB=function(){const e=$s((e=>{let{state:{nodesById:t}}=e;return t})),t=Qa((e=>{let{state:t}=e;return t.currentPage?.elements?.find((e=>{let{isBackground:t}=e;return t}))})),n=(0,Rc.default)((e=>{let{actions:{getBox:t}}=e;return t})),r=e[t.id],{x:a,y:o,width:i,height:l}=r.getBoundingClientRect(),s=new(os().Box)(new(os().Vector)(a,o),i,l).toPolygon(),c=-n(t).y;return t=>{if(t.isBackground)return s;const{id:r,rotationAngle:a}=t;if(!e[r])return null;const o=n(t),i=new(os().Vector)(s.pos.x+o.x+o.width/2,s.pos.y+c+o.y+o.height/2),l=new(os().Box)(i,o.width,o.height).toPolygon(),d=new(os().Vector)(-o.width/2,-o.height/2);return l.setOffset(d),l.setAngle(a*Math.PI/180),l}};const VB=function(){const[e,t]=(0,u.useState)(Wo.getItemByKey(Zo.BACKGROUND_IS_SET_DIALOG_DISMISSED)),{setBackgroundElement:n,isDefaultBackground:r}=Qa((e=>({setBackgroundElement:e.actions.setBackgroundElement,isDefaultBackground:e.state.currentPage?.elements[0]?.isDefaultBackground}))),{fullbleedContainer:a}=$s((e=>{let{state:{fullbleedContainer:t}}=e;return{fullbleedContainer:t}})),{showSnackbar:o}=(0,Ur.useSnackbar)(),i=WB();return{handleFullbleedMediaAsBackground:l=>{if(r&&Mn.MEDIA_ELEMENT_TYPES.includes(l.type)){const r=i(l),s=a.getBoundingClientRect(),c=new(os().Box)(new(os().Vector)(s.x+2,s.y+2),s.width-4,s.height-4).toPolygon(),u=new(os().Response);os().testPolygonPolygon(r,c,u),u.bInA&&n({elementId:l.id}),e||(o({message:(0,d.__)("Full bleed images and videos are automatically set as background. Double click to scale and position at any time.","web-stories"),dismissible:!0}),Wo.setItemByKey(Zo.BACKGROUND_IS_SET_DIALOG_DISMISSED,!0),t(!0))}}}};const $B=function(e){let{setIsDragging:t,resetMoveable:n,selectedElement:r,setTransformStyle:a,frame:o}=e;const{isDropSource:i,handleDrag:l,handleDrop:s,setDraggingResource:c}=rs((e=>{let{actions:{handleDrag:t,handleDrop:n,isDropSource:r,setDraggingResource:a}}=e;return{handleDrag:t,handleDrop:n,setDraggingResource:a,isDropSource:r}})),{handleElementOutOfCanvas:d}=ZB(),{handleFullbleedMediaAsBackground:p}=VB(),{updateSelectedElements:m}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{editorToDataX:g,editorToDataY:f}=(0,Rc.default)((e=>{let{actions:{editorToDataX:t,editorToDataY:n}}=e;return{editorToDataX:t,editorToDataY:n}})),h=(0,u.useBatchingCallback)((e=>{t(!1),c(null),n(e)}),[t,c,n]);return{onDrag:e=>{let{target:n,beforeTranslate:s,clientX:d,clientY:u}=e;t(!0),i(r.type)&&c(r.resource),o.translate=s,a(n,o),i(r.type)&&l(r.resource,d,u,r.id)},throttleDrag:0,onDragStart:e=>{let{set:t}=e;t(o.translate)},onDragEnd:e=>{let{target:n,isDrag:a}=e;if(!a)return!1;if(d(n))return t(!1),void c(null);const l=e=>Math.abs(e)<=1?0:e,[u,b]=o.translate;let E={};0===u&&0===b||(E={x:l(r.x+g(u)),y:l(r.y+f(b))},m({properties:E}),i(r.type)&&s(r.resource,r.id)),h(n),p({...r,...E})}}},qB=[],KB=["n","s"],XB=["e","w"],QB=["nw","ne","sw","se"];function JB(e){let{vertical:t,horizontal:n,diagonal:r}=e;return[...t?KB:qB,...n?XB:qB,...r?QB:qB]}const eF=function(e){let{resetMoveable:t,selectedElement:n,setTransformStyle:r,frame:a,isEditMode:o,pushTransform:i,classNames:l,forceLockRatio:s}=e;const{updateSelectedElements:c}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{handleElementOutOfCanvas:d}=ZB(),{handleFullbleedMediaAsBackground:p}=VB(),{editorToDataX:m,editorToDataY:g,dataToEditorY:f,dataToEditorX:h}=(0,Rc.default)((e=>{let{actions:{editorToDataX:t,editorToDataY:n,dataToEditorY:r,dataToEditorX:a}}=e;return{editorToDataX:t,editorToDataY:n,dataToEditorY:r,dataToEditorX:a}})),{lockAspectRatio:b,type:E}=n,y="text"===E,[_,v]=(0,u.useState)(!0),w=!y&&(s||b)||y&&_,{resizeRules:T,updateForResizeEvent:S}=(0,Mn.getDefinitionForType)(E),C=h(T.minWidth),I=f(T.minHeight),x=n.width/n.height,A=n.width<=T.minWidth||n.height<=T.minHeight;return{onResize:e=>{let{target:t,direction:o,width:i,height:l,drag:s}=e,c=i,d=l,u=null;w?(c<C&&(c=C,d=c/x),d<I&&(d=I,c=I*x)):(d=Math.max(d,I),c=Math.max(c,C)),S&&(u=S(n,o,m(c,!1),g(d,!1))),u&&u.height&&(d=f(u.height)),u&&u.marginOffset&&(t.querySelector(".syncMargin").style.margin=-f(u.marginOffset)/2+"px 0"),t.style.width=`${c}px`,t.style.height=`${d}px`,a.direction=o,a.resize=[c,d],a.translate=s.beforeTranslate,a.updates=u,r(t,a)},onResizeStart:e=>{let{setOrigin:t,dragStart:r,direction:l}=e;t(["%","%"]),r&&r.set(a.translate);const s=0!==l[0]&&0!==l[1];_!==s&&y&&v(s),o&&i(n.id,a)},onResizeEnd:e=>{let{target:r}=e;if(d(r))return;const[o,i]=a.resize;let l={};if(0!==o&&0!==i){const{direction:e}=a,[t,r]=a.translate,s=m(o),d=g(i);l={width:s,height:d,x:n.x+m(t),y:n.y+g(r)},S&&Object.assign(l,S(n,e,s,d)),c({properties:l})}v(!0),t(r),p({...n,...l})},keepRatio:w,renderDirections:JB(T),className:UB()(l,{"visually-hide-handles":A})}};const utils_normalizeRotationDegrees=function(e){return(e%360+360)%360};const tF=function(e){let{selectedElement:t,isEditMode:n,pushTransform:r,frame:a,setTransformStyle:o,resetMoveable:i,throttleRotation:l}=e;const{updateSelectedElements:s}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{handleElementOutOfCanvas:c}=ZB();return{throttleRotate:l?30:0,onRotate:e=>{let{target:t,beforeRotate:n}=e;a.rotate=utils_normalizeRotationDegrees(n),o(t,a)},onRotateEnd:e=>{let{target:t}=e;if(c(t))return;const n={rotationAngle:Math.round(a.rotate)};s({properties:n}),i(t)},onRotateStart:e=>{let{set:o}=e;n&&r(t.id,a),o(a.rotate)}}};function nF(){return nF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nF.apply(this,arguments)}const rF=(0,u.forwardRef)((function SingleSelectionMoveable(e,t){let{selectedElement:n,targetEl:r,pushEvent:a,isEditMode:o,...i}=e;const l=(0,u.useRef)(null),[s,d]=(0,u.useState)(!1),p=$s((e=>{let{state:t}=e;return t.nodesById})),m=(0,Rc.default)((e=>{let{actions:t}=e;return t.getBox})),g=(0,I.useTransform)((e=>{let{actions:t}=e;return t.pushTransform})),{zoomSetting:f,scrollLeft:h,scrollTop:b}=cs((e=>{let{state:t}=e;return{zoomSetting:t.zoomSetting,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}})),{isLocked:E}=n,y=!n.isBackground&&!E,_=(0,u.useRef)(),v=Qa((e=>{let{state:t}=e;return t.currentPage?.elements[0]?.id})),w=(0,Cr.useGlobalIsKeyPressed)("shift");GB(l),(0,u.useEffect)((()=>{_.current=a}),[a]),(0,u.useEffect)((()=>{l.current&&l.current.updateRect()}),[h,b]),zB(l,[f]),(0,u.useEffect)((()=>{l.current&&(_.current&&r.contains(_.current.target)&&y&&l.current.moveable.dragStart(_.current),l.current.updateRect())}),[r,l,y]),(0,u.useEffect)((()=>{l.current&&l.current.updateRect()}));const T=m(n),S=(0,u.useMemo)((()=>({translate:[0,0],rotate:T.rotationAngle,resize:[0,0],updates:null})),[T.rotationAngle]),C=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S;S.translate=t.translate,S.direction=t.direction,S.resize=t.resize,S.updates=t.updates,S.rotate=t.rotate,e.style.transform=`translate(${S.translate[0]}px, ${S.translate[1]}px) rotate(${S.rotate}deg)`,S.resize[0]&&(e.style.width=`${S.resize[0]}px`),S.resize[1]&&(e.style.height=`${S.resize[1]}px`),g(n.id,S)},A=(0,u.useBatchingCallback)((e=>{l.current&&(S.direction=[0,0],S.translate=[0,0],S.resize=[0,0],S.updates=null,g(n.id,null),e.style.transform="",e.style.width="",e.style.height="",l.current.updateRect())}),[S,g,n.id]),k=!o,O=s,P=UB()("default-moveable",{"hide-handles":O,"type-text":"text"===n.type,immoveable:E}),N=$B({setIsDragging:d,resetMoveable:A,selectedElement:n,setTransformStyle:C,frame:S}),M=o?{onDrag:()=>!1,onDragEnd:()=>!1,onDragStart:()=>!1}:N,R=eF({resetMoveable:A,selectedElement:n,setTransformStyle:C,frame:S,isEditMode:o,pushTransform:g,classNames:P,forceLockRatio:w}),L=tF({selectedElement:n,isEditMode:o,pushTransform:g,frame:S,setTransformStyle:C,resetMoveable:A,throttleRotation:w}),D=Object.values(_n(p,[n.id,v])),B=jB({otherNodes:D,canSnap:k&&y,isDragging:s}),F=y&&!O&&!0!==n.lockDimensions,H=y&&!O&&!1!==n.supportsRotation;return c.createElement(x.Moveable,nF({},i,{className:P,zIndex:0,ref:(0,u.useCombinedRefs)(l,t),target:r,edge:!0,draggable:y,resizable:F,rotatable:H},M,R,L,B,{origin:!1,pinchable:!0}))})),aF=(0,x.withOverlay)((0,p.default)(Gv).withConfig({displayName:"editLayer__LayerWithGrayout",componentId:"sc-1j9iuj3-0"})(["background-color:",";"],(e=>{let{grayout:t,theme:n}=e;return t?n.colors.opacity.overlayDark:"transparent"}))),oF=(0,x.withOverlay)(rw);function EditLayerForElement(e){let{element:t,showOverflow:n}=e;const r=(0,u.useRef)(null),a=(0,u.useRef)(null),{editModeGrayout:o}=(0,Mn.getDefinitionForType)(t.type),{isTrimMode:i}=FD((e=>{let{state:{isTrimMode:t}}=e;return{isTrimMode:t}})),{clearEditing:l,onMoveableMount:s}=$s((e=>({clearEditing:e.actions.clearEditing,onMoveableMount:e.state.onMoveableMount}))),p=ws(),[m,g]=(0,u.useState)(null);(0,Cr.useKeyDownEffect)(r,{key:"esc",editable:!0},(()=>l()),[l]),(0,u.useEffect)((()=>()=>p(!1)),[p]);const f=(0,u.useRef)(null),h=(0,u.useCallback)((e=>{f.current=e,s?.(e)}),[s]),b=(0,u.useCallback)((()=>{f.current&&f.current.updateRect()}),[]),{hasEditModeMoveable:E}=(0,Mn.getDefinitionForType)(t.type);return c.createElement(aF,{ref:r,"aria-label":(0,d._x)("Edit layer","compound noun","web-stories"),"data-testid":"editLayer",grayout:o,zIndex:3,onPointerDown:e=>{e.target!==r.current&&e.target!==a.current||l()}},c.createElement(oF,{ref:a,fullBleedContainerLabel:(0,d.__)("Fullbleed area (Edit layer)","web-stories"),isControlled:!0,showOverflow:n,overflow:n?"visible":"hidden"},c.createElement(FB,{editWrapper:E&&m,onResize:b,element:t,ref:g})),E&&m&&c.createElement(rF,{selectedElement:t,targetEl:m,isEditMode:!0,ref:h}),i&&c.createElement(nw,{showOverflow:!0},c.createElement(MB,null)))}const iF=(0,u.memo)((function EditLayer(){const{currentPage:e}=Qa((e=>({currentPage:e.state.currentPage}))),{editingElement:t,showOverflow:n=!0}=$s((e=>{let{state:{editingElement:t,editingElementState:{showOverflow:n}={}}}=e;return{editingElement:t,showOverflow:n}})),r=t&&e&&e.elements.find((e=>e.id===t));return r?c.createElement(EditLayerForElement,{element:r,showOverflow:n}):null}));const lF=function(){const{pageAttachmentContainer:e}=$s((e=>({pageAttachmentContainer:e.state.pageAttachmentContainer}))),{hasLinksInAttachmentArea:t,hasInvalidLinkSelected:n,hasPageAttachment:r,hasElementsInAttachmentArea:a}=Qa((t=>{let{state:n}=t;const r=e=>{let{link:t}=e;return t?.url?.length},a=n.currentPage.elements.filter(r),o=Boolean(n.currentPage?.pageAttachment?.url?.length);return{hasInvalidLinkSelected:Boolean(e&&o&&n.selectedElements.filter(r).some(Mn.isElementBelowLimit)),hasLinksInAttachmentArea:Boolean(e&&a.some((e=>(0,Mn.isElementBelowLimit)(e,!0)))),hasElementsInAttachmentArea:Boolean(e&&o&&n.selectedElements.some((e=>(0,Mn.isElementBelowLimit)(e,!1)))),hasPageAttachment:o}}));return{hasLinksInAttachmentArea:t,hasInvalidLinkSelected:n,isElementInAttachmentArea:(0,u.useCallback)((t=>!!e&&(!!r&&(0,Mn.isElementBelowLimit)(t,!1))),[e,r]),hasElementsInAttachmentArea:a}};var sF,cF;function dF(){return dF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dF.apply(this,arguments)}const SvgDefaultIcon=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",dF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,sF||(sF=c.createElement("path",{fillOpacity:.1,d:"M12 0c6.6 0 12 5.4 12 12s-5.4 12-12 12S0 18.6 0 12 5.4 0 12 0z"})),cF||(cF=c.createElement("path",{d:"M13.8 14.6c.1.1.2.3.2.5s-.1.3-.2.5L12.3 17c-.7.7-1.7 1.1-2.7 1.1-1 0-1.9-.4-2.7-1.1-.7-.7-1.1-1.7-1.1-2.7 0-1 .4-1.9 1.1-2.7l1.5-1.5c.2 0 .3-.1.5-.1s.3.1.5.2c.1.1.2.3.2.5s-.1.4-.2.5l-1.5 1.5c-.5.5-.7 1.1-.7 1.7 0 .6.3 1.3.7 1.7.5.5 1.1.7 1.7.7s1.3-.3 1.7-.7l1.5-1.5c.3-.3.7-.3 1 0zM17 7c-.7-.7-1.7-1.1-2.7-1.1-1 0-1.9.4-2.7 1.1l-1.5 1.5c0 .1-.1.3-.1.4 0 .2.1.3.2.5.1.1.3.2.5.2s.3-.1.5-.2l1.5-1.5c.5-.5 1.1-.7 1.7-.7.6 0 1.3.3 1.7.7.5.5.7 1.1.7 1.7 0 .6-.3 1.3-.7 1.7l-1.5 1.5c-.1.1-.2.3-.2.5s.1.3.2.5c.1.1.3.2.5.2s.3-.1.5-.2l1.5-1.5c.7-.7 1.1-1.7 1.1-2.7-.1-1-.5-1.9-1.2-2.6zm-7.9 7.2c0 .2.1.3.2.5.1.1.3.2.5.2s.4-.1.5-.2l4.5-4.5c.1-.1.2-.3.2-.5s-.1-.4-.2-.5c-.3-.2-.8-.2-1 .1l-4.5 4.5c-.1.1-.2.3-.2.4z"})))},uF=(0,c.memo)(SvgDefaultIcon);var pF;function mF(){return mF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mF.apply(this,arguments)}const SvgArrowBar=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",mF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 8","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,pF||(pF=c.createElement("path",{d:"M18 7.7c-.2 0-.5-.1-.7-.2l-7.3-4-7.3 4c-.7.4-1.6.2-2-.6-.4-.7-.1-1.6.6-2l8-4.4c.5-.2 1-.2 1.5 0l8 4.4c.7.4 1 1.3.6 2-.4.5-.9.8-1.4.8z"})))},gF=(0,c.memo)(SvgArrowBar),fF=p.default.div.withConfig({displayName:"pageAttachment__Wrapper",componentId:"sc-1bseqmx-0"})(["position:absolute;display:flex;align-items:center;justify-content:flex-end;flex-direction:column;bottom:0;height:20%;width:100%;color:",";z-index:3;"],(e=>{let{theme:t}=e;return t.colors.standard.white})),hF=p.default.div.withConfig({displayName:"pageAttachment__Guideline",componentId:"sc-1bseqmx-1"})(["mix-blend-mode:difference;position:absolute;height:1px;bottom:20%;width:100%;background-image:",";background-position:top;background-size:16px 0.5px;background-repeat:repeat-x;z-index:3;"],(e=>{let{theme:t}=e;return`linear-gradient(to right, ${t.colors.standard.black} 50%, ${t.colors.standard.white} 0%)`})),bF=(0,p.default)(gF).withConfig({displayName:"pageAttachment__ArrowBar",componentId:"sc-1bseqmx-2"})(["display:block;cursor:pointer;margin-bottom:10px;filter:drop-shadow(0px 2px 6px rgba(0,0,0,0.3));width:20px;height:8px;"]),EF=p.default.div.withConfig({displayName:"pageAttachment__OutlinkChip",componentId:"sc-1bseqmx-3"})(["height:","px;display:flex;position:relative;padding:","px ","px;margin:0 0 20px;max-width:calc(100% - 64px);border-radius:30px;place-items:center;box-shadow:0px 4px 10px rgba(0,0,0,0.15);background:",";"],(e=>{let{$factor:t}=e;return t(36)}),(e=>{let{$factor:t}=e;return t(10)}),(e=>{let{$factor:t}=e;return t(6)}),(e=>{let{bgColor:t}=e;return t})),yF=p.default.span.withConfig({displayName:"pageAttachment__TextWrapper",componentId:"sc-1bseqmx-4"})(["font-family:Roboto,sans-serif;font-size:","px;line-height:18px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-inline-start:6px;padding-inline-end:8px;height:16px;letter-spacing:0.3px;font-weight:700;max-width:210px;color:",";"],(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{fgColor:t}=e;return t})),_F=p.default.div.withConfig({displayName:"pageAttachment__Tooltip",componentId:"sc-1bseqmx-5"})(["background-color:",";color:",";width:200px;padding:8px;font-size:14px;border-radius:4px;text-align:center;"],(e=>{let{theme:t}=e;return t.colors.standard.black}),(e=>{let{theme:t}=e;return t.colors.standard.white})),vF=p.default.img.withConfig({displayName:"pageAttachment__LinkImage",componentId:"sc-1bseqmx-6"})(["height:24px;width:24px;vertical-align:middle;border-radius:50%;border:0 none;object-fit:contain;"]),wF={x:8},TF="#FFFFFF",SF="#000000";const CF=function PageAttachment(e){let{pageAttachment:t={}}=e;const{displayLinkGuidelines:n,pageAttachmentContainer:r,setPageAttachmentContainer:a}=$s((e=>({displayLinkGuidelines:e.state.displayLinkGuidelines,pageAttachmentContainer:e.state.pageAttachmentContainer,setPageAttachmentContainer:e.actions.setPageAttachmentContainer}))),{dataToEditorY:o}=(0,Rc.default)((e=>{let{actions:{dataToEditorY:t}}=e;return{dataToEditorY:t}})),{hasInvalidLinkSelected:i}=lF(),{ctaText:l,url:s,icon:u,theme:p}=t,m=p===De?SF:TF,g=p===De?TF:SF;return c.createElement(c.Fragment,null,(n||i)&&c.createElement(hF,null),c.createElement(fF,{role:"presentation",ref:a},s?.length>0&&c.createElement(c.Fragment,null,c.createElement(bF,{fill:m}),c.createElement(EF,{bgColor:m,$factor:o},u?c.createElement(vF,{src:u,alt:(0,d.__)("Site Icon","web-stories"),decoding:"async",crossOrigin:"anonymous"}):c.createElement(uF,{fill:g,width:o(24),height:o(24)}),c.createElement(yF,{fgColor:g,$factor:o},l||(0,d.__)("Learn more","web-stories"))),r&&i&&c.createElement(nT.Popup,{anchor:{current:r},isOpen:!0,placement:Gd.PLACEMENT.LEFT,spacing:wF},c.createElement(_F,null,(0,d.__)("Links can not reside below the dashed line when a page attachment is present. Your viewers will not be able to click on the link.","web-stories"))))))};var IF;function xF(){return xF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xF.apply(this,arguments)}const AF=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",xF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 8","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,IF||(IF=c.createElement("path",{d:"M18 7.7c-.2 0-.5-.1-.7-.2l-7.3-4-7.3 4c-.7.4-1.6.2-2-.6-.4-.7-.1-1.6.6-2l8-4.4c.5-.2 1-.2 1.5 0l8 4.4c.7.4 1 1.3.6 2-.4.5-.9.8-1.4.8z"})))},kF=(0,c.memo)(AF),OF=p.default.div.withConfig({displayName:"shoppingPageAttachment__Wrapper",componentId:"sc-7unzl7-0"})(["position:absolute;display:flex;align-items:center;justify-content:flex-end;flex-direction:column;bottom:0;height:20%;width:100%;color:",";z-index:3;"],(e=>{let{theme:t}=e;return t.colors.standard.white})),PF=p.default.div.withConfig({displayName:"shoppingPageAttachment__InnerWrap",componentId:"sc-7unzl7-1"})(["position:relative;width:100%;height:100%;"]),NF=p.default.div.withConfig({displayName:"shoppingPageAttachment__Inner",componentId:"sc-7unzl7-2"})(["position:absolute;bottom:0;width:100%;",";display:flex;flex-direction:column;align-items:center;"],(e=>{let{$hasGradient:t}=e;return t&&"background: linear-gradient(0, rgba(0, 0, 0, 0.15), transparent) !important"})),MF=p.default.div.withConfig({displayName:"shoppingPageAttachment__ArrowWrap",componentId:"sc-7unzl7-3"})(["width:","px;min-height:","px;border-radius:50%;background:",";display:flex;align-items:center;justify-content:center;"],(e=>{let{$factor:t}=e;return t(32)}),(e=>{let{$factor:t}=e;return t(32)}),(e=>{let{bgColor:t}=e;return t})),RF=(0,p.default)(kF).withConfig({displayName:"shoppingPageAttachment__ArrowBar",componentId:"sc-7unzl7-4"})(["display:block;cursor:pointer;filter:drop-shadow(0px 2px 6px rgba(0,0,0,0.3));width:","px;height:","px;"],(e=>{let{$factor:t}=e;return t(20)}),(e=>{let{$factor:t}=e;return t(8)})),LF=p.default.div.withConfig({displayName:"shoppingPageAttachment__OutlinkChip",componentId:"sc-7unzl7-5"})(["height:","px;display:flex;position:relative;padding:","px ","px;margin:0 0 ","px;max-width:calc(100% - 64px);border-radius:30px;place-items:center;background:",";"],(e=>{let{$factor:t}=e;return t(36)}),(e=>{let{$factor:t}=e;return t(10)}),(e=>{let{$factor:t}=e;return t(6)}),(e=>{let{$factor:t}=e;return t(20)}),(e=>{let{bgColor:t}=e;return t})),DF=p.default.span.withConfig({displayName:"shoppingPageAttachment__TextWrapper",componentId:"sc-7unzl7-6"})(["font-family:Roboto,sans-serif;font-size:","px;line-height:18px;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-inline-start:6px;padding-inline-end:8px;height:","px;letter-spacing:0.3px;font-weight:700;max-width:210px;color:",";"],(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{fgColor:t}=e;return t})),BF="#FFFFFF",FF="#000000";const HF=function(e){let{ctaText:t,theme:n}=e;const r=n===De?BF:FF,a=n===De?FF:BF,{dataToEditorY:o}=(0,Rc.default)((e=>{let{actions:{dataToEditorY:t}}=e;return{dataToEditorY:t}}));return c.createElement(OF,{role:"presentation"},c.createElement(PF,null,c.createElement(NF,{$hasGradient:n!==De},c.createElement(MF,{bgColor:a,$factor:o},c.createElement(RF,{fill:r,$factor:o})),c.createElement(LF,{$factor:o},c.createElement(DF,{fgColor:a,$factor:o},t||(0,d.__)("Shop Now","web-stories"))))))};const UF=function(e){const t=/^(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})$/.exec(e);return t?3600*(t[1]?parseInt(t[1]):0)+60*parseInt(t[2])+parseInt(t[3])+parseInt(t[4])/1e3:null},jF=p.default.span.withConfig({displayName:"cue__CueWrapper",componentId:"sc-h5j1x4-0"})(["text-align:center;height:",";"],(e=>{let{$height:t}=e;return`${t}px`})),zF=p.default.span.withConfig({displayName:"cue__CueEl",componentId:"sc-h5j1x4-1"})(["color:",";"],(e=>{let{$isFutureCue:t,theme:n}=e;return t?n.colors.fg.black:n.colors.fg.white})),GF=p.default.span.withConfig({displayName:"cue__Section",componentId:"sc-h5j1x4-2"})(["margin:0 10px 10px;padding:6px 12px;vertical-align:middle;border-radius:15px;background:rgba(11,11,11,0.6);color:rgba(255,255,255,1);display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;line-height:1.4;word-break:break-word;word-wrap:break-word;overflow-wrap:break-word;"]);const YF=function Cue(e){let{cue:t,videoTime:n,height:r}=e;const a=t.getCueAsHTML();return c.createElement(jF,{$height:r},c.createElement(GF,null,[...a.childNodes].map((e=>{if("timestamp"===e.target)return null;{let t=null;"timestamp"===e.previousSibling?.target&&(t=UF(e.previousSibling.data));const r=t>n;return e.nodeType===Node.TEXT_NODE?null!==t?c.createElement("span",null,c.createElement(zF,{$isFutureCue:r},e.textContent)):c.createElement(zF,null,e.textContent):null!==t?c.createElement("span",null,c.createElement(zF,{$isFutureCue:r,dangerouslySetInnerHTML:{__html:e.innerHTML}})):c.createElement(zF,{dangerouslySetInnerHTML:{__html:e.innerHTML}})}}))))},ZF=p.default.div.withConfig({displayName:"trackRenderer__Track",componentId:"sc-7rx40r-0"})(["width:100%;height:100%;display:grid;align-content:end;font-size:",";"],(e=>{let{$fontSize:t}=e;return`${t}px`}));const WF=function TrackRenderer(e){let{elementId:t,trackIndex:n}=e;const{pageWidth:r,pageHeight:a}=cs((e=>{let{state:{pageWidth:t,pageHeight:n}}=e;return{pageWidth:t,pageHeight:n}})),o=.04*r,i=.2*a,[l,s]=(0,u.useState)(null),[d,p]=(0,u.useState)(0),[m,g]=(0,u.useState)([]),f=(0,u.useCallback)((()=>{const e=l?.activeCues?[...l.activeCues]:[];g(e)}),[l]);return(0,u.useEffect)((()=>{f(),p(0);const e=document.getElementById(t);if(!e)return;const r=e.textTracks?.[n];return r?(r.mode="hidden",f(),s(r),e.addEventListener("timeupdate",(()=>{p(e.currentTime)})),r.addEventListener("cuechange",f),()=>{r.removeEventListener("cuechange",f)}):void 0}),[n,f,t,r,a]),m&&l?c.createElement(ZF,{$fontSize:o},m.map(((e,t)=>c.createElement(YF,{key:t,cue:e,videoTime:d,height:i})))):null},VF=(0,p.default)(Gv).withConfig({displayName:"mediaCaptionsLayer__CaptionsLayer",componentId:"sc-11mx67a-0"})([""]),$F=(0,p.default)(rw).withConfig({displayName:"mediaCaptionsLayer__CaptionsPageArea",componentId:"sc-11mx67a-1"})(["position:absolute;pointer-events:none;"]),qF=p.default.div.withConfig({displayName:"mediaCaptionsLayer__CaptionsCanvas",componentId:"sc-11mx67a-2"})(["background:transparent;border-radius:5px;position:absolute;z-index:2;transform:translateZ(0);top:0;left:0;bottom:0;right:0;cursor:default;"]);const KF=function MediaCaptionsLayer(){const{isEditing:e}=$s((e=>{let{state:{isEditing:t}}=e;return{isEditing:t}})),{currentPageId:t,backgroundAudio:n,videoElement:r}=Qa((e=>{let{state:t}=e;const{selectedElements:n,currentPage:r}=t,{backgroundAudio:a}=r;let o=null,i=null;if(1===n.length){const e=n[0],{isBackground:t,type:r,tracks:l}=e;t&&a&&a?.tracks?.length>0&&(o=a),"video"===r&&l?.length>0&&(i=e)}return{currentPageId:r?.id,backgroundAudio:o,videoElement:i}})),[a,o]=(0,u.useState)(0),[i,l]=(0,u.useState)("");return(0,u.useEffect)((()=>{if(o(0),l(""),n)return l(`page-${t}-background-audio`),void o(n?.tracks?.length);!e&&r&&(l(`video-${r.id}`),o(r.tracks.length))}),[r,n,t,e]),a?c.createElement(VF,null,c.createElement($F,{withSafezone:!1,showOverflow:!0},c.createElement(qF,null,Array.from({length:a}).map(((e,t)=>c.createElement(WF,{key:t,elementId:i,trackIndex:t})))))):null},XF=(0,p.default)(rw).withConfig({displayName:"displayLayer__DisplayPageArea",componentId:"sc-13e1aq-0"})(["position:absolute;"]);function DisplayPage(e){let{pageElements:t,editingElement:n}=e;return t?t.map((e=>{if(n===e.id)return null;const r=t.filter((t=>{let{type:n}=t;return n===e.type})).length-1;return c.createElement(Zc,{key:e.id,element:e,isAnimatable:!0,siblingCount:r})})):null}function DisplayPageAnimationController(e){let{resetAnimationState:t}=e;const{animationState:n,pageId:r}=Qa((e=>{let{state:t}=e;return{animationState:t.animationState,pageId:t.currentPage?.id}})),a=(0,Hn.useStoryAnimationContext)((e=>{let{actions:t}=e;return t.WAAPIAnimationMethods}));return(0,u.useEffect)((()=>{switch(n){case Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED:case Hn.STORY_ANIMATION_STATE.PLAYING:return void a.play();case Hn.STORY_ANIMATION_STATE.RESET:return void a.reset();case Hn.STORY_ANIMATION_STATE.SCRUBBING:case Hn.STORY_ANIMATION_STATE.PAUSED:return void a.pause();default:return}}),[n,a]),(0,u.useEffect)((()=>t),[t,r]),null}function StoryAnimations(e){let{children:t}=e;const{isAnimationPlaying:n,currentPageAnimations:r,currentPageElements:a,selectedElements:o,updateAnimationState:i}=Qa((e=>{let{state:t,actions:n}=e;return{isAnimationPlaying:t.animationState===Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED,currentPageAnimations:t.currentPage?.animations||Ue,currentPageElements:t.currentPage?.elements||Ue,selectedElements:t.selectedElements,updateAnimationState:n.updateAnimationState}})),l=(0,u.useCallback)((()=>{i({animationState:Hn.STORY_ANIMATION_STATE.RESET})}),[i]),s=(0,u.useMemo)((()=>o.map((e=>e.id))),[o]);return c.createElement(Hn.StoryAnimation.Provider,{animations:r,elements:a,onWAAPIFinish:l,selectedElementIds:n?s:Ue},c.createElement(DisplayPageAnimationController,{resetAnimationState:l}),t)}DisplayPageAnimationController.propTypes={resetAnimationState:za().func};const QF=(0,u.memo)((function DisplayLayer(){const{backgroundColor:e,isBackgroundSelected:t,pageAttachment:n,shoppingAttachment:r,hasProducts:a}=Qa((e=>{let{state:t}=e;return{hasCurrentPage:Boolean(t.currentPage),backgroundColor:t.currentPage?.backgroundColor,isBackgroundSelected:t.selectedElements?.[0]?.isBackground,pageAttachment:t.currentPage?.pageAttachment||{},shoppingAttachment:t.currentPage?.shoppingAttachment||{},hasProducts:t.currentPage.elements?.some((e=>{let{type:t,product:n}=e;return t===Mn.ELEMENT_TYPES.PRODUCT&&n?.productId}))}})),o=Qa((e=>{let{state:t}=e;return t.currentPage?.elements||Ue})),i=qs(Ws),{editingElement:l,setPageContainer:s,setFullbleedContainer:p}=$s((e=>{let{state:{editingElement:t},actions:{setPageContainer:n,setFullbleedContainer:r}}=e;return{editingElement:t,setPageContainer:n,setFullbleedContainer:r}})),m=(0,u.useMemo)((()=>a?c.createElement(HF,r):c.createElement(CF,{pageAttachment:n})),[a,n,r]);return c.createElement(StoryAnimations,null,c.createElement(Gv,{"data-testid":"DisplayLayer",pointerEvents:"none","aria-label":(0,d._x)("Display layer","compound noun","web-stories")},c.createElement(XF,{ref:(0,u.useCombinedRefs)(s,i),fullbleedRef:p,background:e,isBackgroundSelected:t,fullBleedContainerLabel:(0,d.__)("Fullbleed area (Display layer)","web-stories"),overlay:m,isControlled:!0},c.createElement(DisplayPage,{pageElements:o,editingElement:l})),c.createElement(KF,null)))}));var JF=n(49640);const eH=function(e,t,n,r){if(!n||n.length>1)return{};let a=null;if("ArrowUp"===e&&(a=t?ke:Pe),"ArrowDown"===e&&(a=t?Oe:Ne),!a)return{};const{id:o,groupId:i}=n[0],l=r.findIndex((e=>{let{id:t}=e;return t===o}));if(i){const e=r[l-1]?.groupId!==i,t=r[l+1]?.groupId!==i;if(e&&a===Ne||t&&a===Pe)return{position:l,groupId:null}}else{if(r[l-1]?.groupId&&a===Ne)return{position:l,groupId:r[l-1].groupId};if(r[l+1]?.groupId&&a===Pe)return{position:l,groupId:r[l+1].groupId}}return{position:a}};const tH=function(e){const{selectedElementIds:t,selectedElements:n,arrangeSelection:r,deleteSelectedElements:a,duplicateElementsById:o,updateSelectedElements:i,setSelectedElementsById:l,currentPage:s,currentPageNumber:c,animationState:p,updateAnimationState:m,currentPageProductIds:g,pageElements:f}=Qa((e=>{let{state:{selectedElementIds:t,selectedElements:n,currentPage:r,currentPageNumber:a,animationState:o},actions:{arrangeSelection:i,deleteSelectedElements:l,duplicateElementsById:s,updateSelectedElements:c,setSelectedElementsById:d,updateAnimationState:u}}=e;return{currentPage:r,currentPageNumber:a,selectedElementIds:t,selectedElements:n,arrangeSelection:i,deleteSelectedElements:l,duplicateElementsById:s,updateSelectedElements:c,setSelectedElementsById:d,animationState:o,updateAnimationState:u,currentPageProductIds:r?.elements?.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).map((e=>{let{product:t}=e;return t?.productId})),pageElements:r?.elements}})),h=(0,Ur.useSnackbar)((e=>{let{showSnackbar:t}=e;return t})),{setHighlights:b}=cm((e=>{let{setHighlights:t}=e;return{setHighlights:t}})),{isEditing:E,getNodeForElement:y,setEditingElement:_}=$s((e=>{let{state:{isEditing:t},actions:{getNodeForElement:n,setEditingElement:r}}=e;return{isEditing:t,getNodeForElement:n,setEditingElement:r}})),v=(0,u.useRef)(null);v.current=t,(0,u.useEffect)((()=>{const t=e.current;if(!t)return;const n=t.ownerDocument,r=()=>{setTimeout((()=>{if(n.activeElement===n.body){const e=v.current,n=1===e?.length?y(e[0]):null;if(""!==window.getSelection().toString())return;n?n.focus({preventScroll:!0}):t.focus({preventScroll:!0})}}),300)};return n.addEventListener("focusout",r,!0),()=>{n.removeEventListener("focusout",r,!0)}}),[e,y]),(0,Cr.useGlobalKeyDownEffect)("delete",(()=>a()),[a]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+a"]},(()=>{const e=s.elements.map((e=>{let{id:t}=e;return t}));l({elementIds:e})}),[s,l]),(0,Cr.useGlobalKeyDownEffect)({key:["up","down","left","right"],shift:!0},(e=>{let{key:t,shiftKey:r}=e;if(E)return;const{isBackground:a,isLocked:o}=n?.[0]||{};if(a||o)return;const{dx:l,dy:s}=(0,JF.default)(t,r);i({properties:e=>{let{x:t,y:n}=e;return{x:t+l,y:n+s}}})}),[i,E,n]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+up","mod+down","mod+left","mod+right"],shift:!0},(e=>{const{key:t,shiftKey:a}=e;if(e.preventDefault(),1===n?.length){const{position:e,groupId:o}=eH(t,a,n,f);(e||o)&&r({position:e,groupId:o})}}),[r,n,f]),(0,Cr.useGlobalKeyDownEffect)({key:"enter",clickable:!1},(()=>{if(1!==n.length)return;const{type:e,id:t,isLocked:r}=n[0],{hasEditMode:a,hasEditModeIfLocked:o}=(0,Mn.getDefinitionForType)(e);!a||!o&&r||_(t)}),[n,_]);const w=(0,u.useCallback)((()=>{if(0!==n.length){for(const{type:e,product:t}of n){const{productId:n,productTitle:r,productImages:a}=t||{};e===Mn.ELEMENT_TYPES.PRODUCT&&n&&g.includes(n)&&h({message:(0,We.default)(
177
  /* translators: %s: product title. */
178
  (0,d.__)('Product "%s" already exists on the page.',"web-stories"),r),thumbnail:a?.[0]?.url&&{src:a[0].url,alt:a[0].alt}})}o({elementIds:n.map((e=>e.id))})}}),[o,n,g,h]);(0,Cr.useGlobalKeyDownEffect)("clone",(()=>w()),[w]);const T=[Hn.STORY_ANIMATION_STATE.PLAYING,Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED].includes(p);(0,Cr.useGlobalKeyDownEffect)({key:["mod+enter"]},(e=>{e.preventDefault(),1!==c&&(m({animationState:T?Hn.STORY_ANIMATION_STATE.RESET:Hn.STORY_ANIMATION_STATE.PLAYING}),(0,P.trackEvent)("canvas_play_animations",{status:T?"stop":"play"}))}),[T,m,c]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+k"]},(e=>{e.preventDefault(),n.length&&!n?.[0]?.isBackground&&b({elements:n,highlight:hg.LINK})}),[b,n])},nH=p.default.div.withConfig({displayName:"extraPages__ExtraPageWrapper",componentId:"sc-12b8j4d-0"})(["display:flex;overflow:hidden;justify-content:",";align-items:center;height:100%;"],(e=>{let{isPrevious:t}=e;return t?"flex-end":"flex-start"})),rH=p.default.ol.withConfig({displayName:"extraPages__ExtraPageList",componentId:"sc-12b8j4d-1"})(["display:flex;flex-direction:",";width:","px;height:","px;margin:0;padding:0 ","px;gap:","px;"],(e=>{let{isPrevious:t}=e;return t?"row-reverse":"row"}),(e=>{let{listWidth:t}=e;return t}),(e=>{let{extraPageHeight:t}=e;return t}),32,32),aH=p.default.li.withConfig({displayName:"extraPages__ExtraPage",componentId:"sc-12b8j4d-2"})(["display:block;width:","px;height:100%;border-radius:4px;background-color:white;opacity:0.5;transition:opacity 0.2s ease;&:hover{opacity:1;}"],(e=>{let{extraPageWidth:t}=e;return t-32})),oH=(0,p.default)(lO).withConfig({displayName:"extraPages__ExtraPagePreview",componentId:"sc-12b8j4d-3"})(["cursor:pointer;"]);function iH(e,t){return e<t?Array.from(Array(t-e)).map(((t,n)=>n+e)):[]}const lH=(0,u.memo)((function ExtraPages(e){let{isPrevious:t=!1}=e;const{currentPageIndex:n,pages:r,setCurrentPage:a}=Qa((e=>{let{state:{pages:t,currentPageIndex:n},actions:{setCurrentPage:r}}=e;return{currentPageIndex:n,pages:t,setCurrentPage:r}})),{hasExtraPages:o,extraPageWidth:i,extraPageCount:l}=cs((e=>{let{state:{hasExtraPages:t,extraPageWidth:n,extraPageCount:r}}=e;return{hasExtraPages:t,extraPageWidth:n,extraPageCount:r}})),s=(0,C.useFeature)("extraPages"),u=r?.length;if(!u||!s)return null;const p=function(e){let{isPrevious:t,hasExtraPages:n,currentPageIndex:r,extraPageCount:a,pageCount:o}=e;if(!n)return[];if(t)return iH(Math.max(0,r-a),r).reverse();return iH(r+1,Math.min(o,r+a+2))}({isPrevious:t,hasExtraPages:o,currentPageIndex:n,extraPageCount:l,pageCount:u});if(0===p.length)return null;const m=p.length*i,g=(i-32)/ee.PAGE_RATIO;return c.createElement(nH,{isPrevious:t},c.createElement(rH,{isPrevious:t,listWidth:m,extraPageHeight:g},p.map((e=>{return c.createElement(aH,{key:e,extraPageWidth:i},c.createElement(oH,{page:r[e],onClick:(t=r[e].id,()=>a({pageId:t})),"aria-label":(0,We.default)(
179
  /* translators: %s: page number. */
@@ -305,4 +305,4 @@ e=(0,We.default)(
305
  /* translators: %s: user's name */
306
  (0,d.__)("%s is already editing this story.","web-stories"),r?.name);return c.createElement(y,{isOpen:t,onClose:n,title:l,contentLabel:l,actions:c.createElement(c.Fragment,null,c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,href:a},(0,d.__)("Dashboard","web-stories")),c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,href:o,target:"_blank",rel:"noreferrer"},(0,d.__)("Preview","web-stories")),i&&c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,onClick:n},(0,d.__)("Take over","web-stories")))},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},r?.avatar&&c.createElement(D3,{src:r.avatar,alt:r.name,height:48,width:48,crossOrigin:"anonymous",decoding:"async"}),s))};const F3=function PostTakeOverDialog(e){let{isOpen:t,user:n,dashboardLink:r,onClose:a}=e;const o=(0,d.__)("Someone else has taken over this story.","web-stories"),i=(0,We.default)(
307
  /* translators: %s: user's name */
308
- (0,d.__)("%s now has editing control of this story.","web-stories"),n?.name);return c.createElement(y,{isOpen:t,title:o,contentLabel:o,onClose:a,actions:c.createElement(m.Button,{type:g.BUTTON_TYPES.QUATERNARY,size:g.BUTTON_SIZES.SMALL,variant:g.BUTTON_VARIANTS.RECTANGLE,href:r},(0,d.__)("Dashboard","web-stories"))},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},n.avatar&&c.createElement(D3,{src:n.avatar,alt:n.name,height:48,width:48,crossOrigin:"anonymous",decoding:"async"}),i))};const H3=function PostLock(){const{currentUser:e}=no((e=>{let{state:t}=e;return{currentUser:t.currentUser}})),{storyId:t,dashboardLink:n,nonce:r,postLock:{interval:a,showLockedDialog:o},api:{stories:i,storyLocking:l}}=U(),{previewLink:s,lockUser:d}=Qa((e=>{let{state:{story:{previewLink:t,extras:{lockUser:n={}}={}}}}=e;return{previewLink:t,lockUser:n}})),{enablePostLockingTakeOver:p}=(0,C.useFeatures)(),[m,g]=(0,u.useState)(!0),[f,h]=(0,u.useState)({}),[b,E]=(0,u.useState)(r),y=(0,u.useCallback)((()=>{p&&(h({}),L3(t,i))}),[p,t,i]),_=(0,u.useMemo)((()=>Boolean(Object.keys(e).length)),[e]),v=(0,u.useCallback)((()=>{o&&_&&function(e,t){const n=(0,R3.default)(`${t}${e}/lock/`,{_embed:"author"});return w5({path:n})}(t,i).then((n=>{let{locked:r,nonce:a,_embedded:o}=n;const l={id:o?.author?.[0]?.id||0,name:o?.author?.[0]?.name||"",avatar:o?.author?.[0]?.avatar_urls?.[96]||""};r&&l?.id&&l?.id!==e.id?h(l):L3(t,i),E(a)})).catch((e=>{(0,P.trackError)("post_lock",e.message)}))}),[h,t,i,e,o,_]),w=(0,u.useRef)(v);return(0,u.useEffect)((()=>{w.current=v}),[v,_]),(0,u.useEffect)((()=>{o&&_&&d?.id&&d?.id!==e.id&&h(d)}),[d,e,_,o]),(0,u.useEffect)((()=>{function e(){o&&f?.id&&b&&function(e,t,n){const r=new window.FormData;r.append("_wpnonce",t);const a=(0,R3.default)(n,{_method:"DELETE"});window.navigator.sendBeacon?.(a,r)}(0,b,l)}return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t,o,f,b,l]),(0,u.useEffect)((()=>{const e=setInterval((()=>{a&&_&&(w.current(),g(!1))}),1e3*a);return()=>clearInterval(e)}),[a,_]),o&&f?m?c.createElement(B3,{isOpen:Boolean(f?.id),user:f,onClose:y,previewLink:s,dashboardLink:n,showTakeOver:p}):p?c.createElement(F3,{isOpen:Boolean(f?.id),user:f,dashboardLink:n,onClose:y}):null:null},U3=(e,t,n)=>{if("object"==typeof n)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&U3(e,`${t}[${r}]`,n[r]);else e.append(t,n)},j3=U3;const z3=function(e){return"__WEB_STORIES_ENCODED__"+btoa(encodeURIComponent(e))};const G3=function(e){const{mime_type:t,web_stories_media_source:n,meta:{web_stories_is_gif:r=!1}={}}=e;return"gif-conversion"===n||r?function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a},mime_type:o,featured_media:i,featured_media_src:{src:l,width:s,height:c,generated:d},alt_text:u,source_url:p,meta:{web_stories_base_color:m,web_stories_blurhash:g}}=e;return J({baseColor:m,blurHash:g,type:"gif",mimeType:"image/gif",creationDate:n,src:p,...te({width:r,height:a,posterGenerated:d,posterWidth:s,posterHeight:c}),posterId:i,poster:l,id:t,alt:u,local:!1,isOptimized:!0,isExternal:!1,output:{mimeType:o,src:p}})}(e):"image"===Q(t)?function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a,sizes:o={}}={},mime_type:i,alt_text:l,source_url:s,meta:{web_stories_base_color:c,web_stories_blurhash:d}}=e,u=Object.entries(o).reduce(((e,t)=>{let[n,r]=t;return e[n]=(0,t5.snakeToCamelCaseObjectKeys)(r),e}),{});return J({baseColor:c,blurHash:d,mimeType:i,creationDate:n,src:s,width:r,height:a,id:t,alt:l,sizes:u,local:!1,isExternal:!1})}(e):function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a,length:o,length_formatted:i},mime_type:l,featured_media:s,featured_media_src:{src:c,width:d,height:u,generated:p},web_stories_is_muted:m,alt_text:g,source_url:f,web_stories_media_source:h,meta:{web_stories_trim_data:b,web_stories_base_color:E,web_stories_blurhash:y}}=e;return J({baseColor:E,blurHash:y,mimeType:l,creationDate:n,src:f,...te({width:r,height:a,posterGenerated:p,posterWidth:d,posterHeight:u}),poster:c,posterId:s,id:t,length:o,lengthFormatted:i,alt:g,local:!1,isExternal:!1,isOptimized:["video-optimization","recording"].includes(h),isMuted:m,trimData:b})}(e)};const Y3=function(e){const{_embedded:t={},meta:n,_links:r={},...a}=e,o=n.web_stories_poster,i=t?.["wp:featuredmedia"]?.[0],l={...(0,t5.snakeToCamelCaseObjectKeys)(a,["story_data"]),author:{id:t?.author?.[0].id||0,name:t?.author?.[0].name||""},capabilities:{},extras:{lockUser:{id:t?.["wp:lockuser"]?.[0].id||0,name:t?.["wp:lockuser"]?.[0].name||"",avatar:t?.["wp:lockuser"]?.[0].avatar_urls?.[96]||""}},featuredMedia:{id:i?.id||0,height:o?.height||i?.media_details?.height||0,width:o?.width||i?.media_details?.width||0,url:o?.url||i?.source_url||"",needsProxy:o?.needsProxy||!1,isExternal:Boolean(o)},publisherLogo:{id:t?.["wp:publisherlogo"]?.[0].id||0,height:t?.["wp:publisherlogo"]?.[0]?.media_details?.height||0,width:t?.["wp:publisherlogo"]?.[0]?.media_details?.width||0,url:t?.["wp:publisherlogo"]?.[0]?.source_url||""},taxonomies:r?.["wp:term"]?.map((e=>{let{taxonomy:t}=e;return t}))||[],terms:t?.["wp:term"]||[]};for(const e of Object.keys(r)){if(!e.startsWith("wp:action-"))continue;const t=e.replace("wp:action-","");l.capabilities[t]=!0}return l};const Z3=(0,d.__)("https://wordpress.org/support/plugin/web-stories/","web-stories");const W3=function StatusCheckFailed(e){let{isOpen:t,onClose:n}=e;const r=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_support_page")}),[]);return c.createElement(y,{isOpen:t,onClose:n,title:(0,d.__)("Unable to save your story","web-stories"),contentLabel:(0,d.__)("Unable to save your story","web-stories"),onPrimary:n,primaryText:(0,d.__)("Dismiss","web-stories")},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,href:Z3,target:"_blank",rel:"noopener noreferrer",onClick:r})}},(0,d.__)("We are currently unable to save your story, any changes you make may be lost. This may be due to temporary issues connecting to WordPress. <a>Submit a new support topic</a> for additional help.","web-stories"))))};const V3=function StatusCheck(){const[e,t]=(0,u.useState)(!1),n=(0,u.useCallback)((()=>t(!1)),[]),{api:{statusCheck:r},encodeMarkup:a}=U();return(0,u.useEffect)((()=>{(function(e,t,n){return w5({path:t,data:{content:n?z3(e):e},method:"POST"})})(Ta({storyId:1,title:"Story!",author:{id:1,name:"John Doe"},slug:"story",publisherLogo:{id:1,url:"https://example.com/logo.png",height:0,width:0},defaultPageDuration:7,status:"publish",date:"2020-04-10T07:06:26",modified:"",excerpt:"",featuredMedia:{id:123,url:"https://example.com/image.png",width:123,height:456},password:"",globalStoryStyles:""},[{type:"page",id:"2",elements:[]}],{publisher:"Web Stories"}),r,a).catch((e=>{t(!0),(0,P.trackError)("status_check",e.message)}))}),[a,r]),c.createElement(W3,{isOpen:e,onClose:n})};const $3=function CorsCheckFailed(e){let{isOpen:t,onClose:n}=e;const r=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_cors_check_docs")}),[]);return c.createElement(y,{isOpen:t,onClose:n,title:(0,d.__)("Unable to load media","web-stories"),contentLabel:(0,d.__)("Unable to load media","web-stories"),onPrimary:n,primaryText:(0,d.__)("Dismiss","web-stories")},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,href:"https://wp.stories.google/docs/troubleshooting/common-issues/",target:"_blank",rel:"noopener noreferrer",onClick:r})}},(0,d.__)("We detected a potential misconfiguration that prevents media items from loading correctly. This may be due to media being hosted on an external CDN. <a>Learn how to address this</a>.","web-stories"))))},q3=Zo.CORS_CHECK_DIALOG_DISMISSED;const K3=function CorsCheck(){const[e,t]=(0,u.useState)(!1),{actions:{getMediaForCorsCheck:n}}=W(),r=(0,u.useCallback)((()=>{t(!1),Wo.setItemByKey(q3,!0)}),[]),a=Boolean(Wo.getItemByKey(q3));return(0,u.useEffect)((()=>{(async()=>{if(a)return;let e;try{e=await n()}catch(e){return}if(e?.length)try{await Promise.all([...new Set(e.filter((e=>!e.startsWith(location.origin))))].map((e=>fetch(e,{method:"HEAD"}))))}catch(e){t(!0),(0,P.trackError)("cors_check",e.message)}})()}),[]),c.createElement($3,{isOpen:e,onClose:r})},X3=p.default.div.withConfig({displayName:"fontCheckDialog__DialogContent",componentId:"sc-5gbbgj-0"})(["display:grid;row-gap:20px;"]),Q3=(0,p.default)(fh).withConfig({displayName:"fontCheckDialog__ChevronRight",componentId:"sc-5gbbgj-1"})(["width:32px;height:32px;"]),J3=(0,p.default)(Q3).withConfig({displayName:"fontCheckDialog__ChevronLeft",componentId:"sc-5gbbgj-2"})(["transform:rotate(180deg);"]),e4=(0,p.default)(pu.Link).withConfig({displayName:"fontCheckDialog__StyledLink",componentId:"sc-5gbbgj-3"})(["display:flex;color:",";align-items:center;font-weight:normal;margin:0 auto 0 0;"],(e=>{let{theme:t}=e;return t.colors.standard.black})),t4=(0,p.default)(m.Button).withConfig({displayName:"fontCheckDialog__StyledButton",componentId:"sc-5gbbgj-4"})(["margin-left:16px;"]),n4=p.default.div.withConfig({displayName:"fontCheckDialog__ActionsWrap",componentId:"sc-5gbbgj-5"})(["display:flex;align-self:flex-end;width:100%;"]),FontCheckDialog=e=>{let{isOpen:t,defaultCloseAction:n,missingFont:r,closeDialog:a}=e;const{dashboardLink:o,dashboardSettingsLink:i,isRTL:l}=U(),[s,p]=(0,u.useState)(Mn.TEXT_ELEMENT_DEFAULT_FONT),{updateElementsByFontFamily:m}=Qa((e=>{let{actions:t}=e;return{updateElementsByFontFamily:t.updateElementsByFontFamily}})),f=(0,u.useCallback)((e=>{(0,P.trackEvent)("font_check_cancel"),n(e)}),[n]),h=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_font_check_settings")}),[]),b=(0,u.useCallback)((()=>{(0,P.trackEvent)("font_check_replace_default"),m({family:r,properties:{font:Mn.TEXT_ELEMENT_DEFAULT_FONT}}),a()}),[a,r,m]),E=(0,u.useCallback)((()=>{(0,P.trackEvent)("font_check_replace_selected"),m({family:r,properties:{font:s}}),a()}),[s,a,r,m]),_=l?Q3:J3;return c.createElement(y,{isOpen:t,onClose:f,title:(0,d.__)("Missing Fonts","web-stories"),contentLabel:(0,d.__)("Missing Fonts","web-stories"),actions:c.createElement(n4,null,c.createElement(e4,{href:o},c.createElement(_,null),(0,d.__)("Back to dashboard","web-stories")),c.createElement(t4,{type:g.BUTTON_TYPES.SECONDARY,size:g.BUTTON_SIZES.SMALL,onClick:b},(0,d.__)("Open anyway","web-stories")),c.createElement(t4,{type:g.BUTTON_TYPES.PRIMARY,size:g.BUTTON_SIZES.SMALL,onClick:E},(0,d.__)("Replace font","web-stories")))},c.createElement(X3,null,c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("This story contains the following font that is no longer available:","web-stories")),c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,isBold:!0},r),c.createElement("div",null,c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,onClick:h,href:i,isBold:!0})}},(0,d.__)("To replace this font with your own or re-add it, go to <a>Settings</a>. To replace this font with a default, open the story.","web-stories"))),c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("Or, choose replacement font below:","web-stories")),c.createElement(WR,{zIndex:10,currentValue:s.family,onChange:p})))},r4=()=>{const{dashboardLink:e}=U(),{isStoryLoaded:t,storyPages:n,updateElementsByFontFamily:r}=Qa((e=>{let{state:{pages:t},actions:n}=e;return{storyPages:t,updateElementsByFontFamily:n.updateElementsByFontFamily,isStoryLoaded:t.length>0}})),{actions:{getFonts:a}}=W(),[o,i]=(0,u.useState)(null),[l,s]=(0,u.useState)(!1),d=(0,u.useCallback)((()=>{window.location=e}),[e]);return(0,u.useEffect)((()=>{(async()=>{if(!t)return;const e=kJ(n),o=await a({include:e.join(",")});for(const t of e){const e=o.find((e=>e?.family===t));e&&r({family:t,properties:{font:e}})}const l=e.filter((e=>!new Set(o.map((e=>e.family))).has(e)));l&&l.length>=1&&(s(!0),i(l[0]))})()}),[t,r]),c.createElement(FontCheckDialog,{isOpen:l,missingFont:o||"",defaultCloseAction:d,closeDialog:()=>s(!1)})};function a4(e,t){return w5({path:(0,R3.default)(e.api.users,{per_page:"100",who:"authors",search:t})}).then((e=>e.map((e=>(delete e._links,(0,t5.snakeToCamelCaseObjectKeys)(e))))))}const o4=["id","title","status","slug","date","modified","excerpt","link","meta.web_stories_poster","story_data","preview_link","edit_link","embed_post_link","permalink_template","style_presets","password"].join(","),i4="wp:featuredmedia,wp:lockuser,author,wp:publisherlogo,wp:term",l4=["id","date_gmt","media_details","mime_type","featured_media","featured_media_src","alt_text","source_url","meta","web_stories_media_source","web_stories_is_muted","body","status","headers"].join(",");function s4(e,t){const n=(0,R3.default)(`${e.api.stories}${t}/`,{context:"edit",_embed:i4,_fields:o4});return w5({path:n}).then(Y3)}const c4=(e,t)=>{let{pages:n,featuredMedia:r,globalStoryStyles:a,publisherLogo:o,autoAdvance:i,defaultPageDuration:l,currentStoryStyles:s,backgroundAudio:c,content:d,author:u,products:p,...m}=e;return{story_data:{version:Sr.DATA_VERSION,pages:n,autoAdvance:i,defaultPageDuration:l,currentStoryStyles:s,backgroundAudio:c},featured_media:r.isExternal?null:r.id,style_presets:a,meta:{web_stories_publisher_logo:o?.id,web_stories_products:p,web_stories_poster:r.isExternal?{url:r.url,width:r.width,height:r.height,needsProxy:r.needsProxy}:void 0},publisher_logo:o,content:t?z3(d):d,author:u.id,...m}};function d4(e,t){const{storyId:n}=t,r=c4(t,e.encodeMarkup),a=(0,R3.default)(`${e.api.stories}${n}/`,{_fields:["status","slug","link","preview_link","edit_link","embed_post_link","meta.web_stories_poster"].join(","),_embed:i4});return w5({path:a,data:r,method:"POST"}).then((e=>{const{_embedded:t={},meta:n,...r}=e;let a={id:0,height:0,width:0,url:"",needsProxy:!1,isExternal:!1};const o=n.web_stories_poster,i=t?.["wp:featuredmedia"]?.[0];return i?.id?a={id:i.id,height:i.media_details?.height||0,width:i.media_details?.width||0,url:i.source_url||"",needsProxy:!1,isExternal:!1}:o?.url&&(a={id:0,height:o.height||0,width:o.width||0,url:o.url,needsProxy:Boolean(o.needsProxy),isExternal:!0}),{...(0,t5.snakeToCamelCaseObjectKeys)(r),featuredMedia:a}}))}function u4(e,t){const{storyId:n}=t,r=c4(t,e.encodeMarkup);return w5({path:`${e.api.stories}${n}/autosaves/`,data:r,method:"POST"}).then((e=>(0,t5.snakeToCamelCaseObjectKeys)(e,["story_data"])))}function p4(e,t){let{mediaType:n,searchTerm:r,pagingNum:a}=t,o=(0,R3.default)(e.api.media,{context:"view",per_page:50,page:a,_web_stories_envelope:!0,_fields:l4});return n&&(o=(0,R3.default)(o,{media_type:n})),r&&(o=(0,R3.default)(o,{search:r})),w5({path:o}).then((e=>{let{body:t,headers:n}=e;return{data:t.map(G3),headers:{...n,totalItems:n["X-WP-Total"],totalPages:n["X-WP-TotalPages"]}}}))}function m4(e){const t=(0,R3.default)(e.api.media,{context:"view",per_page:10,_fields:"source_url"});return w5({path:t}).then((e=>e.map((e=>e.source_url))))}function g4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:l4});return w5({path:n}).then(G3)}async function f4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"meta.web_stories_muted_id"}),r=await w5({path:n});return r?.meta?.web_stories_muted_id?g4(e,r.meta.web_stories_muted_id):null}async function h4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"meta.web_stories_optimized_id"}),r=await w5({path:n});return r?.meta?.web_stories_optimized_id?g4(e,r.meta.web_stories_optimized_id):null}async function b4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"featured_media"}),r=await w5({path:n});return r?.featured_media?g4(e,r.featured_media):null}function E4(e,t,n){const{originalId:r,mediaId:a,storyId:o,templateId:i,isMuted:l,mediaSource:s,trimData:c,baseColor:d,blurHash:u,isGif:p,altText:m}=n,g={web_stories_media_source:s,web_stories_is_muted:l,post:i||o||a,original_id:r,web_stories_trim_data:c,web_stories_base_color:d,web_stories_blurhash:u,alt_text:m};void 0!==p&&(g.meta={web_stories_is_gif:p}),Object.entries(g).forEach((e=>{let[t,n]=e;void 0===n&&delete g[t]}));const f=new window.FormData;return f.append("file",t,t.name||t.type.replace("/",".")),Object.entries(g).forEach((e=>{let[t,n]=e;return j3(f,t,n)})),w5({path:e.api.media,body:f,method:"POST"}).then((e=>G3(e)))}function y4(e,t,n){const{baseColor:r,blurHash:a,isMuted:o,mediaSource:i,optimizedId:l,mutedId:s,posterId:c,storyId:d,altText:u}=n,p={meta:{web_stories_base_color:r,web_stories_blurhash:a,web_stories_optimized_id:l,web_stories_muted_id:s,web_stories_poster_id:c},web_stories_is_muted:o,web_stories_media_source:i,featured_media:c,post:d,alt_text:u};return Object.entries(p.meta).forEach((e=>{let[t,n]=e;void 0===n&&delete p.meta[t]})),Object.entries(p).forEach((e=>{let[t,n]=e;void 0===n&&delete p[t]})),w5({path:`${e.api.media}${t}/`,data:p,method:"POST"}).then(G3)}function _4(e,t){w5({path:(0,R3.default)(`${e.api.media}${t}/`,{_method:"DELETE"}),data:{force:!0},method:"POST"})}function v4(e,t){const n=(0,R3.default)(e.api.link,{url:t});return w5({path:n})}const w4=["id","story_data","body","headers"],T4="wp:featuredmedia";function S4(e){const{_embedded:t={},id:n,story_data:r={}}=e;return{id:n,elements:[],...r,templateId:n,image:{id:t?.["wp:featuredmedia"]?.[0].id||0,height:t?.["wp:featuredmedia"]?.[0]?.media_details?.height||0,width:t?.["wp:featuredmedia"]?.[0]?.media_details?.width||0,url:t?.["wp:featuredmedia"]?.[0]?.source_url||"",needsProxy:!1,isExternal:!1}}}function C4(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=100,r=(0,R3.default)(e.api.pageTemplates,{context:"edit",per_page:n,page:t,_web_stories_envelope:!0,_fields:w4,_embed:T4});return w5({path:r}).then((e=>{let{headers:n,body:r}=e;const a=parseInt(n["X-WP-TotalPages"]);return{templates:r.map(S4),hasMore:a>t}}))}function I4(e,t){return w5({path:e.api.pageTemplates,data:{...t,status:"publish"},method:"POST"}).then(S4)}function x4(e,t,n){return w5({path:`${e.api.pageTemplates}${t}/`,data:{...n},method:"POST"}).then(S4)}function A4(e,t){return w5({path:(0,R3.default)(`${e.api.pageTemplates}${t}/`,{_method:"DELETE"}),data:{force:!0},method:"POST"})}function k4(e){return{id:e.id,trackingOptin:e.meta.web_stories_tracking_optin,onboarding:e.meta.web_stories_onboarding,mediaOptimization:e.meta.web_stories_media_optimization}}function O4(e){return w5({path:e.api.currentUser}).then(k4)}function P4(e,t){const{trackingOptin:n,onboarding:r,mediaOptimization:a}=t,o={meta:{web_stories_tracking_optin:n,web_stories_onboarding:r,web_stories_media_optimization:a}};return Object.entries(o.meta).forEach((e=>{let[t,n]=e;void 0===n&&delete o.meta[t]})),w5({path:e.api.currentUser,method:"POST",data:o}).then(k4)}function N4(e,t){const n=(0,R3.default)(e.api.hotlink,{url:t});return w5({path:n}).then(t5.snakeToCamelCaseObjectKeys)}function M4(e,t){return(0,R3.default)(e.api.proxy,{url:t,_wpnonce:e.nonce})}async function R4(e){const t=await w5({path:(0,R3.default)(e.api.taxonomies,{type:e.postType,context:"edit",show_ui:"true"})});return Object.values(t).map((e=>(e.restPath=e._links?.["wp:items"]?.[0]?.href,delete e._links,(0,t5.snakeToCamelCaseObjectKeys)(e,["capabilities","visibility"]))))}function L4(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return w5({url:(0,R3.default)(t,n)})}function D4(e,t,n){return w5({url:(0,R3.default)(t,n),method:"POST"})}function B4(e,t){let{include:n,search:r,service:a}=t,o=(0,R3.default)(`${e.api.fonts}`,{search:r,service:a});const i=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",").filter(Boolean).map((e=>`include[]=${encodeURI(e)}`)).join("&")}(n);return i.length>0&&(o+=o.includes("?")?`&${i}`:`?${i}`),w5({path:o})}async function F4(e,t,n,r,a){const o=await w5({path:(0,R3.default)(e.api.products,{per_page:50,page:n,search:t,orderby:r,order:a,_web_stories_envelope:!0})});return{products:o?.body,hasNextPage:"true"===o?.headers["X-WP-HasNextPage"]}}const H4=(0,p.createGlobalStyle)([".","{top:","px !important;left:","px !important;}body.folded .","{left:","px !important;}"],S.OVERLAY_CLASS,32,160,S.OVERLAY_CLASS,36);window.webStories=window.webStories||{},window.webStories.initializeStoryEditor=(e,t,n)=>{const r=document.getElementById(e);(0,e5.setAppElement)(r),(0,nu.updateSettings)(t.locale),(0,P.initializeTracking)("Editor"),Qn.default.forEach(Mn.registerElementType),n.story=n.story?Y3(n.story):null;const a={...t,apiCallbacks:(0,n5.default)(s,t),additionalTips:V5,MediaUpload:M3,styleConstants:{topOffset:32,leftOffset:36}};(0,u.render)(c.createElement(u.StrictMode,null,c.createElement(Pd,{config:a,initialEdits:n},c.createElement(H4,null),c.createElement(S3,null),c.createElement(r5,null),c.createElement(a5,null),c.createElement(V3,null),c.createElement(K3,null),c.createElement(r4,null),c.createElement(H3,null))),r)}}},i={};function __webpack_require__(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.m=o,__webpack_require__.amdO={},e=[],__webpack_require__.O=(t,n,r,a)=>{if(!n){var o=1/0;for(c=0;c<e.length;c++){for(var[n,r,a]=e[c],i=!0,l=0;l<n.length;l++)(!1&a||o>=a)&&Object.keys(__webpack_require__.O).every((e=>__webpack_require__.O[e](n[l])))?n.splice(l--,1):(i=!1,a<o&&(o=a));if(i){e.splice(c--,1);var s=r();void 0!==s&&(t=s)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,r,a]},__webpack_require__.F={},__webpack_require__.E=e=>{Object.keys(__webpack_require__.F).map((t=>{__webpack_require__.F[t](e)}))},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var a=Object.create(null);__webpack_require__.r(a);var o={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach((t=>o[t]=()=>e[t]));return o.default=()=>e,__webpack_require__.d(a,o),a},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.f={},__webpack_require__.e=e=>Promise.all(Object.keys(__webpack_require__.f).reduce(((t,n)=>(__webpack_require__.f[n](e,t),t)),[])),__webpack_require__.u=e=>({8:"chunk-web-stories-template-5",69:"chunk-web-stories-template-60-metaData",274:"chunk-web-stories-template-56",341:"chunk-react-color",354:"chunk-web-stories-template-19",410:"chunk-web-stories-template-24",533:"chunk-web-stories-template-42-metaData",824:"chunk-web-stories-template-36",827:"chunk-web-stories-template-27-metaData",884:"chunk-web-stories-template-18-metaData",907:"chunk-web-stories-template-57",1049:"chunk-web-stories-template-37",1066:"chunk-web-stories-template-44-metaData",1197:"chunk-web-animations-js",1231:"chunk-web-stories-template-12",1340:"chunk-web-stories-template-30-metaData",1380:"chunk-web-stories-template-33-metaData",1403:"chunk-web-stories-template-37-metaData",1738:"chunk-web-stories-template-32",1789:"chunk-web-stories-template-43",1813:"chunk-web-stories-template-10-metaData",1847:"chunk-web-stories-template-12-metaData",1858:"chunk-web-stories-template-1",1970:"chunk-web-stories-template-22-metaData",2068:"chunk-web-stories-template-46",2167:"chunk-web-stories-template-32-metaData",2191:"chunk-web-stories-template-49-metaData",2235:"chunk-web-stories-template-51-metaData",2246:"chunk-web-stories-template-45-metaData",2319:"chunk-web-stories-template-31-metaData",2338:"chunk-web-stories-template-25",2374:"chunk-web-stories-template-2-metaData",2392:"chunk-react-calendar",2454:"chunk-web-stories-template-6",2476:"chunk-web-stories-textset-0",2558:"chunk-web-stories-template-53-metaData",2563:"chunk-web-stories-textset-4",2634:"chunk-web-stories-textset-3",2761:"chunk-web-stories-textset-7",2776:"chunk-web-stories-template-9-metaData",2830:"chunk-web-stories-template-36-metaData",2880:"chunk-web-stories-template-8",2894:"chunk-web-stories-template-34-metaData",3041:"chunk-web-stories-template-15-metaData",3182:"chunk-html-to-image",3194:"chunk-web-stories-template-29-metaData",3245:"chunk-web-stories-template-28",3289:"chunk-web-stories-template-43-metaData",3304:"chunk-web-stories-template-49",3441:"chunk-web-stories-template-45",3529:"chunk-web-stories-template-39",3710:"chunk-web-stories-template-35",3772:"chunk-web-stories-template-60",3777:"chunk-web-stories-template-34",3864:"chunk-web-stories-template-4-metaData",3871:"chunk-web-stories-textset-2",3969:"chunk-web-stories-template-9",4051:"chunk-web-stories-template-40-metaData",4142:"chunk-web-stories-template-29",4178:"chunk-web-stories-template-24-metaData",4386:"chunk-web-stories-template-41",4585:"chunk-web-stories-template-38-metaData",4874:"chunk-web-stories-template-35-metaData",5016:"chunk-web-stories-template-21-metaData",5040:"chunk-web-stories-template-16",5157:"chunk-web-stories-template-33",5312:"chunk-web-stories-template-14",5372:"chunk-web-stories-template-6-metaData",5397:"chunk-web-stories-template-8-metaData",5432:"chunk-web-stories-template-26",5535:"chunk-web-stories-template-15",5543:"chunk-web-stories-template-31",5553:"chunk-web-stories-template-20-metaData",5570:"chunk-web-stories-template-54-metaData",5573:"chunk-web-stories-template-52-metaData",5575:"chunk-resize-observer-polyfill",5748:"chunk-web-stories-template-54",5835:"chunk-web-stories-template-30",6053:"chunk-web-stories-template-16-metaData",6188:"chunk-web-stories-template-42",6204:"chunk-web-stories-template-0-metaData",6271:"chunk-web-stories-template-39-metaData",6305:"chunk-web-stories-template-5-metaData",6311:"chunk-web-stories-template-23-metaData",6353:"chunk-web-stories-template-1-metaData",6406:"chunk-web-stories-template-4",6428:"chunk-web-stories-template-13",6500:"chunk-web-stories-template-0",6517:"chunk-web-stories-template-52",6539:"chunk-web-stories-template-58-metaData",6592:"chunk-web-stories-template-51",6641:"chunk-web-stories-template-28-metaData",6766:"chunk-web-stories-template-19-metaData",6841:"chunk-web-stories-template-58",6852:"chunk-web-stories-template-27",7098:"chunk-ffmpeg",7131:"chunk-web-stories-template-20",7314:"chunk-web-stories-template-25-metaData",7343:"chunk-web-stories-template-47",7346:"chunk-web-stories-template-7",7399:"chunk-web-stories-template-38",7441:"chunk-web-stories-template-48",7498:"chunk-colorthief",7502:"chunk-web-stories-template-23",7528:"chunk-web-stories-template-14-metaData",7586:"chunk-web-stories-template-40",7588:"chunk-web-stories-template-55-metaData",7611:"chunk-web-stories-textset-6",7685:"chunk-web-stories-template-59",7798:"chunk-web-stories-template-50-metaData",7799:"chunk-web-stories-template-3",7863:"chunk-web-stories-template-47-metaData",7952:"chunk-web-stories-template-3-metaData",8022:"chunk-web-stories-template-26-metaData",8189:"chunk-web-stories-template-56-metaData",8203:"chunk-web-stories-template-44",8257:"chunk-web-stories-template-22",8344:"chunk-web-stories-template-10",8422:"chunk-web-stories-template-41-metaData",8551:"chunk-web-stories-template-18",8624:"chunk-focus-visible",8768:"chunk-web-stories-template-11-metaData",8856:"chunk-web-stories-template-48-metaData",9027:"chunk-web-stories-textset-1",9074:"chunk-web-stories-template-7-metaData",9233:"chunk-web-stories-template-53",9288:"chunk-web-stories-template-55",9302:"chunk-web-stories-template-17-metaData",9375:"chunk-web-stories-template-57-metaData",9393:"chunk-web-stories-template-59-metaData",9557:"chunk-web-stories-template-13-metaData",9591:"chunk-web-stories-template-50",9603:"chunk-web-stories-template-17",9607:"chunk-web-stories-template-2",9700:"chunk-web-stories-template-11",9738:"chunk-web-stories-template-46-metaData",9811:"chunk-web-stories-template-21",9843:"chunk-web-stories-textset-5"}[e]+".js?v="+{8:"62f48c943362be75dde6",69:"ee8bf6a37ece865f9fde",274:"49986a50cfec69f8a8d8",341:"10acf2130e40fed0d75a",354:"21701c9bb7dc9de8e903",410:"f2b1685a440ddb51f829",533:"7031543bbf0ac9875728",824:"cca56f39ee2354beeb1c",827:"4f4dc18fab8674b3fa25",884:"d121f5f5280f132b5597",907:"ddf0d94935aeeb5f9b29",1049:"e051f32082205f79d19c",1066:"a635c0f83fd51db6ac06",1197:"45f526a251ead370165a",1231:"0e881ddf3a5dca4f5b43",1340:"658339eae27be828c9d2",1380:"2ca16dfc5daadd31e068",1403:"88b6b87bdb2c9e25e03e",1738:"c6d12e0233116e40adbe",1789:"d24574fa712b1479f5e8",1813:"38319dc6a0a3f890b221",1847:"a4057b4c746081be9263",1858:"a72c93c859283416ebac",1970:"78b7a2bd8812f2bf6406",2068:"47c0a6bcf385f89e3eee",2167:"63718570f9ee6fc4c997",2191:"9e9359bd105429600d80",2235:"235e98e7f0a194e663df",2246:"ad654f9224067fefa563",2319:"de459568067e6a86c7ac",2338:"45b0a0bddeaeccff92e4",2374:"bdfd30cc435b8733776b",2392:"fe88e944141fdcaf426f",2454:"c1f02d36e388601ee93a",2476:"cf7b7c8b0eeee417c304",2558:"dd3a56a23eef473743c2",2563:"c3d2e3c67c5096c4aa6d",2634:"7d5197e7c135c833e8d8",2761:"974eb6934de2afc38df2",2776:"2a94f2790f69801857f7",2830:"f8c41181823fb6e56a2a",2880:"5a970aa4c5ee275902ed",2894:"d72ef1b8371f0de9d4b7",3041:"acafde2d8f1a6980eb81",3182:"366847cef960fbf44a89",3194:"76e25e1bb5380222d1e6",3245:"dd9ae4e530a10801c9e9",3289:"667fa6d0a0f6165df08a",3304:"7c66775981ad6712995c",3441:"db38a2c18c581dab30d1",3529:"f735383152e06dee91d7",3710:"681c6765fe6ee63989df",3772:"0151a08850e7d199048e",3777:"32457dc282cf13690a58",3864:"205a38118d76188f1497",3871:"df558293ddbc80f5732f",3969:"5f3eeb34b188592586e9",4051:"a3859c6f25fb906796aa",4142:"00be70528ca40ed53b45",4178:"1bb9fee64db965ad4c77",4386:"ff7fe8d505c23dfcc14b",4585:"934e6e9b938e8e0c0832",4874:"8d02e508eb5953a8f03e",5016:"416c3be02c2ca809fc3f",5040:"280a87a741d45028bd72",5157:"b2e8a89540391dd72495",5312:"5ead1d2681b6c2e43ea0",5372:"8cff45ed4d0f60a1881d",5397:"59ce47b435a56f9e93f6",5432:"481f3754e9ebeb95086c",5535:"2ad146a9aff0b0c75a03",5543:"db8c05e7971e4e112526",5553:"46ade91fdf2e8a4501d5",5570:"1a2bca995e7c5853b966",5573:"d11139be60f7b14c9ffc",5575:"a97a5e5ec0e812a389ed",5748:"627091a0027160e28832",5835:"1d3dc9abe4467c369ae8",6053:"cd8f59acf99cb495fe77",6188:"3571ed18b36b107eb6dc",6204:"ffa8c4d1cc9dd090d896",6271:"49df2acd6d02d6aebdb7",6305:"f8bb7423de5e3aabca11",6311:"efd3cdbbbecec5cdafa2",6353:"78c4ce9232efce7cc087",6406:"6e024e0ebb0a89677d8b",6428:"6e42df44263b06907366",6500:"5b642d52229cff29396f",6517:"fe0aca5c0a8d5cf81a57",6539:"64a365f05a34a2adf367",6592:"535b235f72e0ff797e79",6641:"bade12d3bb5f6781a58f",6766:"1bc7a9e7a79469a5af79",6841:"73b31e266acf1281dcb1",6852:"35ddb0a2da2984a1b24b",7098:"c12e272d228a10b765cd",7131:"09333faf6e6735deb15e",7314:"979d5b962e46e47de7f7",7343:"8498b35b4fedfb63a2f9",7346:"10673013e512b913493a",7399:"e749dbd85fddb70d1d34",7441:"d269a6e18ed8f7a17697",7498:"afa32aef6dfc12d11c81",7502:"b6d691e97a889aa9db7b",7528:"8d631193e3fc67f254d9",7586:"47838fa1e9462f151802",7588:"ed34aaadc0ad2abddde5",7611:"287ab2128ad56bef327b",7685:"33264baee027a93c07f1",7798:"a03fe4c4b1d6abf8541f",7799:"37d47adb1bf1c3d9355b",7863:"582b6c2ce8eaad76fc82",7952:"f206bee0645c91e855ef",8022:"5bb8b28faa28034ae43b",8189:"37686cfc4a640c7e0f40",8203:"17070712208bfec54b06",8257:"2f339371692f425db1f0",8344:"e1e9ae4748303d0817ff",8422:"3f42e89ce0dd7e802975",8551:"1202b4bf2ee58bf65086",8624:"705c5bfc48fb43676444",8768:"04036e7d0f2b8b2c1b24",8856:"7e61600bafdf93fbef22",9027:"96de041a2c45d7717d50",9074:"c956f3be9f5f3f084d97",9233:"95aa91bc0f954778c4c0",9288:"678083dc9343a66fbd71",9302:"b0227828b5a500a82b1d",9375:"41a6095cbe70256cfb67",9393:"363f78c9382ef94434e8",9557:"39986c27dabeda720306",9591:"16deb0841809d79ab2eb",9603:"573e10b8e766bab31c0a",9607:"74a4b305f26ead9d17b0",9700:"84bb5757f7155a91741e",9738:"d8b00ffb3193a85920f1",9811:"47d5f65f0cf96d4f12ce",9843:"9e5f47d23114e0a591f9"}[e]),__webpack_require__.miniCssF=e=>{},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},a="web-stories-wp:",__webpack_require__.l=(e,t,n,o)=>{if(r[e])r[e].push(t);else{var i,l;if(void 0!==n)for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var d=s[c];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==a+n){i=d;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,__webpack_require__.nc&&i.setAttribute("nonce",__webpack_require__.nc),i.setAttribute("data-webpack",a+n),i.src=e),r[e]=[t];var u=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach((e=>e(n))),t)return t(n)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),l&&document.head.appendChild(i)}},__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="",(()=>{var e={9078:0};__webpack_require__.f.j=(t,n)=>{var r=__webpack_require__.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var a=new Promise(((n,a)=>r=e[t]=[n,a]));n.push(r[2]=a);var o=__webpack_require__.p+__webpack_require__.u(t),i=new Error;__webpack_require__.l(o,(n=>{if(__webpack_require__.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var a=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,r[1](i)}}),"chunk-"+t,t)}},__webpack_require__.F.j=t=>{if(!__webpack_require__.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");__webpack_require__.nc&&n.setAttribute("nonce",__webpack_require__.nc),n.rel="prefetch",n.as="script",n.href=__webpack_require__.p+__webpack_require__.u(t),document.head.appendChild(n)}},__webpack_require__.O.j=t=>0===e[t];var t=(t,n)=>{var r,a,[o,i,l]=n,s=0;if(o.some((t=>0!==e[t]))){for(r in i)__webpack_require__.o(i,r)&&(__webpack_require__.m[r]=i[r]);if(l)var c=l(__webpack_require__)}for(t&&t(n);s<o.length;s++)a=o[s],__webpack_require__.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return __webpack_require__.O(c)},n=globalThis.webpackChunkweb_stories_wp=globalThis.webpackChunkweb_stories_wp||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),__webpack_require__.O(0,[9078],(()=>{__webpack_require__.E(7498)}),5);var l=__webpack_require__.O(void 0,[3617,2505,1590,1814],(()=>__webpack_require__(52230)));l=__webpack_require__.O(l)})();
37
  /* translators: %s: list of allowed file types. */
38
  (0,d.__)("Please choose only %s to upload.","web-stories"),(0,At.default)(n))),Mt("ValidError",t.name,e)}}}),[l,i,s,n]),p=(0,u.useCallback)((function(n){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;c({file:n,overrideAllowedMimeTypes:a});const o={storyId:t,altText:V(n),mediaSource:"editor",...r};return e(n,o)}),[l,c,t,e]);return(0,u.useMemo)((()=>({actions:{uploadFile:p,validateFileForUpload:c}})),[c,p])};function Dt(){}const Bt=e=>e.substring(e.lastIndexOf("/")+1,e.lastIndexOf("."));const Ft=async function(e){const t=await re(e);return await le(t),ue(t)};var Ht=n(12902);const Ut="ADD_PAGE",jt="UPDATE_PAGE",zt="DELETE_PAGE",Gt="ARRANGE_PAGE",Yt="DELETE_ELEMENTS",Zt="ADD_ELEMENTS",Wt="UPDATE_ELEMENTS",Vt="UPDATE_ELEMENTS_BY_RESOURCE_ID",$t="DELETE_ELEMENTS_BY_RESOURCE_ID",qt="SET_BACKGROUND_ELEMENT",Kt="ARRANGE_ELEMENT",Xt="ARRANGE_GROUP",Qt="COMBINE_ELEMENTS",Jt="DUPLICATE_ELEMENTS_BY_ID",en="COPY_SELECTED_ELEMENT",tn="UPDATE_ELEMENTS_BY_FONT_FAMILY",nn="SET_CURRENT_PAGE",rn="SET_SELECTED_ELEMENTS",an="SELECT_ELEMENT",on="UNSELECT_ELEMENT",ln="TOGGLE_ELEMENT_IN_SELECTION",sn="TOGGLE_LAYER",cn="UPDATE_STORY",dn="UPDATE_ANIMATION_STATE",un="ADD_ANIMATIONS",pn="RESTORE",mn=["id","elements","groups"],gn=["id","isBackground","isDefaultBackground"],fn="ADD_GROUP",hn="UPDATE_GROUP",bn="DELETE_GROUP",En="DUPLICATE_GROUP",yn="REMOVE_ELEMENT_FROM_GROUP";function _n(e,t){return Object.keys(e).filter((e=>!t.includes(e))).reduce(((t,n)=>({...t,[n]:e[n]})),{})}function vn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e&&n?.length?n.reduce(((e,t)=>e.filter((e=>t.includes(e)))),e):e}function wn(e,t,n){return e>=t&&e<=n}function Tn(e,t,n){const r=e[t],a=[...e.slice(0,t),...e.slice(t+1)];return[...a.slice(0,n),r,...a.slice(n)]}function Sn(e){let{currentPosition:t,minPosition:n,maxPosition:r,desiredPosition:a}=e;if("number"==typeof a)return Math.min(r,Math.max(n,a));if("string"!=typeof a)return t;switch(a){case ke:return r;case Oe:return n;case Pe:return Math.min(r,t+1);case Ne:return Math.max(n,t-1);default:return t}}function Cn(e,t){const n=_n("function"==typeof t?t(e):t,gn);return 0===Object.keys(n).length?null:n.animation?n.animation:(Object.assign(e,n),null)}function In(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.reduce(((e,n)=>t.some((e=>n.targets?.includes(e)))?e:[...e,n]),[])}function xn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Object.values(Object.fromEntries(e.map((e=>[e.id,e]))))}function An(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=xn(t),r=e.map((e=>{let{id:t}=e;return t}));return n.filter((e=>{let{id:t}=e;return!r.includes(t)}))}const kn=(0,Ht.produce)(((e,t)=>{let{page:n,position:r}=t;if(!n.elements?.length)return;const a=null!==r&&wn(r,0,e.pages.length-1),o=e.pages.findIndex((t=>{let{id:n}=t;return n===e.current})),i=a?r:o+1;e.pages.splice(i,0,n),e.current=n.id,e.selection=[n.elements[0].id]})),On=(0,Ht.produce)(((e,t)=>{let{pageId:n}=t;if(e.pages.length<=1)return;const r=null===n?e.current:n,a=e.pages.findIndex((e=>{let{id:t}=e;return t===r}));if(-1!==a){if(e.pages.splice(a,1),r===e.current){const t=Math.min(e.pages.length-1,a);e.current=e.pages[t].id}e.selection=[]}})),Pn=(0,Ht.produce)(((e,t)=>{let{pageId:n,properties:r}=t;const a=null===n?e.current:n,o=e.pages.find((e=>{let{id:t}=e;return t===a}));if(!o)return;const i=_n(r,mn);Object.assign(o,i)})),Nn=(0,Ht.produce)(((e,t)=>{let{pageId:n,position:r}=t;if(e.pages.length<2)return;const a=e.pages.findIndex((e=>{let{id:t}=e;return t===n})),o=wn(r,0,e.pages.length-1);-1!==a&&o&&!(a===r)&&(e.pages=Tn(e.pages,a,r))}));var Mn=n(88914);const Rn=e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT},Ln=e=>{let{type:t}=e;return t!==Mn.ELEMENT_TYPES.PRODUCT},Dn=(0,Ht.produce)(((e,t)=>{let{elements:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=An(r.elements,n);if(0===a.length)return;const o=[],i=a.filter(Ln);i.length&&(r.elements=r.elements.concat(i),o.push(...i.map((e=>{let{id:t}=e;return t}))));const l=a.filter(Rn);if(l.length){const e=r.elements.filter(Rn).map((e=>{let{product:t}=e;return t?.productId})),t=l.filter((t=>{let{product:n}=t;return!e.includes(n?.productId)}));e.length+t.length<=6&&(r.elements=r.elements.concat(t),o.push(...t.map((e=>{let{id:t}=e;return t}))))}o.length>0&&(e.selection=o)})),Bn=(e,t)=>{let{elementIds:n}=t;const r=null===n?e.selection:n;if(0===r.length)return;const a=e.pages.find((t=>{let{id:n}=t;return n===e.current})),o=a.elements.map((e=>{let{id:t}=e;return t})),i=a.elements[0],l=r.some((e=>e===i.id)),s=i.isDefaultBackground,c=l&&s?r.filter((e=>e!==i.id)):r;vn(o,c).length>0&&(a.elements=a.elements.filter((e=>!c.includes(e.id))),l&&!s&&a.elements.unshift(a.defaultBackgroundElement),a.animations&&(a.animations=a.animations.filter((e=>e.targets.some((e=>!c.includes(e)))))),e.selection=e.selection.filter((e=>!c.includes(e))))},Fn=(0,Ht.produce)(Bn);var Hn=n(58373);const Un=(0,Ht.produce)(((e,t)=>{let{elementIds:n,properties:r}=t;if([Hn.STORY_ANIMATION_STATE.PLAYING,Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED,Hn.STORY_ANIMATION_STATE.SCRUBBING].includes(e.animationState))return;const a=null===n?e.selection:n,o=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i={};o.elements.filter((e=>{let{id:t}=e;return a.includes(t)})).forEach((e=>{const t=Cn(e,r);t&&(i[t.id]={...t,targets:[e.id]})}));Object.keys(i).length>0&&(o.animations=function(e,t){const n=e.reduce(((e,n)=>{const r=t[n.id];return delete t[n.id],r?.delete?e:r?[...e,r]:[...e,n]}),[]);return Object.values(t).forEach((e=>n.push(e))),n}(o.animations||[],i))})),jn=(0,Ht.produce)(((e,t)=>{let{id:n,properties:r}=t;n&&e.pages.forEach((e=>{e.elements.filter((e=>{let{resource:t}=e;return t?.id===n})).forEach((e=>Cn(e,r)))}))})),zn=(0,Ht.produce)(((e,t)=>{let{id:n}=t;if(null===n)return;if(!e.pages.some((e=>e.elements.some((e=>e.resource?.id===n)))))return;const r=[];e.pages.forEach((e=>{const{elements:t,animations:a}=e,o=t[0].resource?.id===n;e.elements=t.filter((e=>{const{id:t,resource:a}=e;return a?.id!==n||(r.push(t),!1)})),o&&e.elements.unshift(e.defaultBackgroundElement),a&&(e.animations=a.filter((e=>e.targets.some((e=>!r.includes(e))))))})),e.selection=e.selection.filter((e=>!r.includes(e)))})),Gn=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=r.elements[0];if(null===n){if(a.isDefaultBackground)return;r.elements.forEach((e=>{delete e.isBackground})),r.elements.unshift(r.defaultBackgroundElement),e.selection=[r.defaultBackgroundElement.id]}else{const t=r.elements.findIndex((e=>{let{id:t}=e;return t===n})),o=0===t;if(!(-1!==t)||o)return;a.isDefaultBackground&&(r.defaultBackgroundElement=a),r.elements.splice(0,1);const i=t-1;e.selection.includes(a.id)&&(e.selection=e.selection.filter((e=>e!==a.id))),r.elements=Tn(r.elements,i,0),r.elements.forEach((e=>{e.id===n&&(e.isBackground=!0,Object.prototype.hasOwnProperty.call(e,"opacity")&&(e.opacity=100))})),e.selection.includes(n)&&e.selection.length>1&&(e.selection=e.selection.filter((e=>e!==n)))}const o=r.elements.find((e=>e.isBackground));r.animations=In(r.animations,[n,o.id])})),Yn=(e,t)=>{let{elementId:n,position:r,groupId:a=!1}=t;if(null===n&&1!==e.selection.length)return;const o=null!==n?n:e.selection[0],i=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(i.elements.length<3)return;const l=i.elements.findIndex((e=>{let{id:t}=e;return t===o}));if(-1===l||i.elements[0].id===o)return;const s=Sn({currentPosition:l,minPosition:1,maxPosition:i.elements.length-1,desiredPosition:r}),c=i.elements[l].groupId;if(l!==s||c!==a){if(a){if(!i.groups[a])return;i.elements[l].groupId=a}else null==a&&delete i.elements[l].groupId;if(c){i.elements.some((e=>e.groupId===c))||delete i.groups[c]}i.elements=Tn(i.elements,l,s)}},Zn=(0,Ht.produce)(Yn);n(77461);const Wn=(0,Ht.produce)(((e,t)=>{let{groupId:n,position:r}=t;if(!n)return;const{elements:a,groups:o}=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i=e=>e.groupId===n;if(!o?.[n]||!a.some(i))return;const l=a.findIndex(i),s=a.findLastIndex(i)-l+1,c=a.splice(l,s,"dummy"),d=Sn({currentPosition:l,minPosition:1,maxPosition:a.length-1,desiredPosition:r});a.splice(a.indexOf("dummy"),1),a.splice(d,0,...c)}));var Vn=n(25784),$n=n(88766),qn=(n(27342),n(40630)),Kn=n(95740),Xn=n(98465),Qn=(n(72858),n(28352));function Jn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e&&"object"==typeof e?Object.assign({},...t.map((t=>e&&t in e?{[t]:e&&e[t]}:{}))):{}}const er=(0,Ht.produce)(((e,t)=>{let{firstElement:n,secondId:r,shouldRetainAnimations:a=!0}=t;if(!n||!r)return;const o=n.id,i=n,l=e.pages.find((t=>{let{id:n}=t;return n===e.current})),s=l.elements.findIndex((e=>{let{id:t}=e;return t===r})),c=l.elements[s];if(!i||!i.resource||!c)return;c.isDefaultBackground&&(l.defaultBackgroundElement={...c,id:(0,pe.default)()});const d=["alt","type","resource","scale","focalX","focalY","tracks","poster"];c.isBackground?d.push("flip","overlay","width","height","x","y"):(d.push("link"),d.push("border"),(0,Vn.canSupportMultiBorder)(c)&&d.push("borderRadius"));const u={..._n(c,["isDefaultBackground"]),...Xn.DEFAULT_ATTRIBUTES_FOR_MEDIA,...Jn(i,d)};l.elements=l.elements.filter((e=>{let{id:t}=e;return t!==o})).map((e=>e.id===r?u:e)),l.animations=In(l.animations,a?[o]:[o,r]),e.selection=[r]})),tr=(0,Ht.produce)(((e,t)=>{let{elementIds:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current}));let a=!1;n.forEach((t=>{const n=r.elements.findIndex((e=>{let{id:n}=e;return n===t}));if(n<0)return;const o=r.elements[n];if(o.isBackground)return;if(o.type===Mn.ELEMENT_TYPES.PRODUCT)return;const{element:i,elementAnimations:l}=(0,Mn.duplicateElement)({element:o,animations:r.animations,existingElements:r.elements});a||(a=!0,e.selection=[]),e.selection.push(i.id),r.animations&&(r.animations=r.animations.concat(l)),r.elements.splice(n+1,0,i)}))})),nr=["background","backgroundColor","backgroundTextMode","border","borderRadius","content","flip","font","fontSize","lineHeight","lockAspectRatio","opacity","overlay","padding","rotationAngle","textAlign"],rr=(0,Ht.produce)((e=>{if(1!==e.selection?.length||!e.selection[0])return;const t=e.pages.find((t=>{let{id:n}=t;return n===e.current})),n=t.elements.find((t=>{let{id:n}=t;return n===e.selection[0]})),r=(t.animations||[]).filter((e=>{let{targets:t}=e;return t.includes(n.id)})),a=Jn(n,nr);e.copiedElementState={animations:r,styles:a,type:n.type}})),ar=(0,Ht.produce)(((e,t)=>{let{family:n,properties:r}=t;n&&e.pages.forEach((e=>{e.elements.filter((e=>{let{font:t}=e;return t?.family===n})).forEach((e=>Cn(e,r)))}))})),or=(0,Ht.produce)(((e,t)=>{let{pageId:n}=t;const r=e.pages.some((e=>{let{id:t}=e;return t===n})),a=e.current===n;r&&!a&&(e.current=n,e.selection=[])})),ir=(e,t)=>{let{elementIds:n,withLinked:r=!1}=t;const a="function"==typeof n?n((0,Ht.current)(e.selection)):n;if(!Array.isArray(a))return;const o=e.pages.find((t=>{let{id:n}=t;return n===e.current}));let i=a;if(r){const e=o.elements.filter((e=>{let{id:t}=e;return a.includes(t)})).map((e=>{let{groupId:t}=e;return t})).filter(Boolean),t=o.elements.filter((t=>{let{groupId:n}=t;return e.includes(n)})).map((e=>{let{id:t}=e;return t}));i=i.concat(t)}const l=[...new Set(i)];if(e.selection.length===l.length){if(vn(e.selection,l).length===e.selection.length)return}const s=e=>o.elements.find((t=>{let{id:n}=t;return n===e})),c=l.length>1,d=c&&!r?l.filter((e=>(e=>o.elements[0].id!==e)(e)&&(e=>!s(e).resource?.isPlaceholder)(e)&&(e=>!s(e).isLocked)(e))):l;e.animationState=Hn.STORY_ANIMATION_STATE.RESET,e.selection=d},lr=(0,Ht.produce)(ir),sr=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;if(!n||e.selection.includes(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current})),a=e=>r.elements.find((t=>{let{id:n}=t;return n===e})),o=r.elements[0].id===n,i=a(n),l=i?.resource?.isPlaceholder,s=e.selection.length>0;if((o||l)&&s)return;const c=i?.isLocked,d=e.selection.includes(r.elements[0].id),u=e.selection.some((e=>a(e).isLocked));d||c||u?e.selection=[n]:e.selection.push(n)})),cr=(0,Ht.produce)(((e,t)=>{let{elementId:n}=t;const r=e.selection.indexOf(n);-1!==r&&e.selection.splice(r,1)})),dr=(e,t)=>{let{elementId:n,withLinked:r=!1}=t;if(!n)return;const a=e.selection.includes(n),o=e.pages.find((t=>{let{id:n}=t;return n===e.current})),i=o.elements[0].id,l=i===n,s=e.selection.length>0,c=o.elements.find((e=>{let{id:t}=e;return t===n}))?.groupId;let d=[n];if(c&&r){const t=o.elements.filter((e=>{let{groupId:t}=e;return c===t})).map((e=>{let{id:t}=e;return t})),n=e.selection.concat(t);d=d.concat(n)}if(!a){if(l&&s)return;const t=e.selection.includes(i),r=e=>o.elements.find((t=>{let{id:n}=t;return n===e})),a=e.selection.length>0&&r(e.selection[0]).isLocked,c=r(n);return t||a||c.isLocked?void(e.selection=d):void(e.selection=[...new Set(e.selection.concat(d))])}e.selection=e.selection.filter((e=>!d.includes(e)))},ur=(0,Ht.produce)(dr),pr=(0,Ht.produce)(((e,t)=>{let{elementId:n,metaKey:r,shiftKey:a,withLinked:o=!1}=t;if(r)return void dr(e,{elementId:n,withLinked:o});if(e.selection.length<=0||!a)return void ir(e,{elementIds:[n],withLinked:o});const i=e.selection[0],l=e.pages.find((t=>{let{id:n}=t;return n===e.current})).elements.map((e=>e.id)),s=l.findIndex((e=>e===i)),c=l.findIndex((e=>e===n)),d=Math.min(s,c),u=Math.max(s,c),p=l.slice(d,u+1);i!==p[0]&&p.reverse(),ir(e,{elementIds:p,withLinked:o})})),mr=(0,Ht.produce)(((e,t)=>{let{animationState:n}=t;e.animationState=n})),gr=(0,Ht.produce)(((e,t)=>{let{animations:n}=t;if(!Array.isArray(n))return;const r=e.pages.find((t=>{let{id:n}=t;return n===e.current}));r.animations||(r.animations=[]),r.animations=r.animations.concat(An(r.animations,n))})),fr=(0,Ht.produce)(((e,t)=>{let{pages:n,current:r,selection:a,story:o,capabilities:i}=t;if(!Array.isArray(n)||0===n.length)return;const l="object"==typeof o?o:{},s="object"==typeof i?i:{},c=r??e.current,d=n.some((e=>{let{id:t}=e;return t===c}))?c:n[0].id;return{pages:n,current:d,selection:Array.isArray(a)?a:[],story:l,animationState:e.animationState,capabilities:s,copiedElementState:{}}})),hr=(0,Ht.produce)(((e,t)=>{let{properties:n}=t;"function"!=typeof n?Object.assign(e.story,n):e.story=n((0,Ht.current)(e.story))})),br=(e,t)=>{let{groupId:n,name:r,isLocked:a=!1}=t;if(!n||!r)return;const o=e.pages.find((t=>{let{id:n}=t;return n===e.current}));o.groups||(o.groups={}),o.groups[n]={name:r,isLocked:a}},Er=(0,Ht.produce)(br),yr=(0,Ht.produce)(((e,t)=>{let{groupId:n,properties:r}=t;if(!n)return;const{groups:a}=e.pages.find((t=>{let{id:n}=t;return n===e.current}));a?.[n]&&Object.assign(a[n],r)})),_r=(0,Ht.produce)(((e,t)=>{let{groupId:n,includeElements:r=!1}=t;const{elements:a,groups:o}=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(!n||!o?.[n])return;delete o[n];const i=a.filter((e=>e.groupId===n));if(r){const t=i.map((e=>{let{id:t}=e;return t}));Bn(e,{elementIds:t})}else i.forEach((e=>{delete e.groupId}))})),vr=(0,Ht.produce)(((e,t)=>{let{oldGroupId:n,groupId:r,name:a,isLocked:o}=t;if(!n||!r||!a)return;const i=e.pages.find((t=>{let{id:n}=t;return n===e.current}));if(!i.groups?.[n])return;const l=e=>e.groupId===n,s=i.elements.filter(l);if(!s.length)return;if(s.some((e=>{let{isBackground:t}=e;return t})))return;br(e,{groupId:r,name:a,isLocked:o});const c=s.map((e=>{const{element:t,elementAnimations:n}=(0,Mn.duplicateElement)({element:e,animations:i.animations,existingElements:i.elements});return t.groupId=r,n.length&&i.animations.push(...n),t})),d=i.elements.findLastIndex(l);i.elements.splice(d+1,0,...c),e.selection=c.map((e=>{let{id:t}=e;return t}))})),wr=(0,Ht.produce)(((e,t)=>{let{elementId:n,groupId:r}=t;const a=e.pages.find((t=>{let{id:n}=t;return n===e.current})),{elements:o}=a,i=o.find((e=>{let{id:t}=e;return t===n}));if(i.groupId!==r)return;const l=function(e){let{elements:t,groupId:n}=e;const r=e=>e.groupId===n;return t.findIndex(r)+t.filter(r).length-1}({elements:o,groupId:r});delete i.groupId,o[l]!==i&&Yn(e,{elementId:n,position:l})})),Tr=(0,u.createContext)({state:{},actions:{}});var Sr=n(49925),Cr=n(82302);const Ir=(0,u.createContext)({listeners:new Map});const xr=function(){const e=(0,u.useContext)(Ir);return(0,u.useCallback)(((t,n)=>{n?(e.listeners.has(t)||e.listeners.set(t,(e=>((e,t)=>{e.preventDefault(),e.returnValue=t})(e,t))),window.addEventListener("beforeunload",e.listeners.get(t))):(window.removeEventListener("beforeunload",e.listeners.get(t)),e.listeners.delete(t))}),[e])},Ar="set_state",kr="clear",Or="replay",Pr={entries:[],offset:0,requestedState:null,versionNumber:0},Nr=e=>(t,n)=>{let{type:r,payload:a}=n;const o=t.entries[t.offset];switch(r){case Ar:if(t.requestedState){if(Object.keys(t.requestedState).every((e=>t.requestedState[e]===a[e]))){const e=t.entries.indexOf(t.requestedState);if(o.pages!==t.requestedState.pages&&o.pages.length===t.requestedState.pages.length&&o.current!==t.requestedState.current){const n=o.pages.filter(((e,n)=>e!==t.requestedState.pages[n]));if(1===n.length){const r=n[0].id,a={...t.requestedState,current:r};return{...t,offset:e,requestedState:a}}}return{...t,offset:e,requestedState:null}}}return{entries:[a,...t.entries.slice(t.offset)].slice(0,e),versionNumber:t.versionNumber+1,offset:0,requestedState:null};case Or:return{...t,versionNumber:t.versionNumber+(t.offset-a),requestedState:t.entries[a]};case kr:return{...Pr};default:throw new Error(`Unknown history reducer action: ${r}`)}};const Mr=function(e){const[t,n]=(0,u.useReducer)(Nr(e),{...Pr}),{entries:r,offset:a,requestedState:o,versionNumber:i}=t,l=r.length,s=(0,u.useCallback)((e=>{const t=a+e;return!(t<0||t>l-1)&&(n({type:Or,payload:t}),!0)}),[n,a,l]),c=(0,u.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return s("number"==typeof e?e:1)}),[s]),d=(0,u.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return s("number"==typeof e?-e:-1)}),[s]),p=(0,u.useCallback)((()=>n({type:kr})),[n]);return{requestedState:o,stateToHistory:(0,u.useCallback)((e=>{n({type:Ar,payload:e})}),[n]),clearHistory:p,currentEntry:r?.[a],offset:a,historyLength:l,versionNumber:i,undo:c,redo:d}},Rr=(0,u.createContext)({state:{},actions:{}});function HistoryProvider(e){let{children:t,size:n}=e;const{requestedState:r,stateToHistory:a,clearHistory:o,currentEntry:i,offset:l,historyLength:s,undo:d,redo:p,versionNumber:m}=Mr(n),[g,f]=(0,u.useState)(!1),h=xr(),b=(0,u.useRef)(1);(0,u.useEffect)((()=>(h("history",g),()=>h("history",!1))),[h,g]),(0,u.useEffect)((()=>{f(m!==b.current)}),[m]);const E=(0,u.useCallback)((()=>{b.current=m,f(!1)}),[m]),y={state:{currentEntry:i,hasNewChanges:g,requestedState:r,canUndo:l<s-1,canRedo:l>0,versionNumber:m},actions:{stateToHistory:a,clearHistory:o,resetNewChanges:E,undo:d,redo:p}};return(0,Cr.useGlobalKeyDownEffect)({key:"undo",dialog:!0},(()=>d()),[d]),(0,Cr.useGlobalKeyDownEffect)({key:"redo",dialog:!0},(()=>p()),[p]),c.createElement(Rr.Provider,{value:y},t)}HistoryProvider.defaultProps={size:50};const Lr=HistoryProvider;const Dr=function(e){return(0,u.useContextSelector)(Rr,e??u.identity)};const Br=function(e){const t=e.map((e=>JSON.stringify(e)));return Array.from(new Set(t)).map((e=>JSON.parse(e)))};function Fr(e,t,n,r){const{title:{raw:a=""}={},status:o,slug:i,date:l,modified:s,excerpt:{raw:c=""}={},link:d,storyData:u,permalinkTemplate:p,stylePresets:m={},password:g,previewLink:f,editLink:h,embedPostLink:b,author:E,capabilities:y={publish:!1,"assign-author":!1},extras:_={},featuredMedia:v,publisherLogo:w,taxonomies:T,terms:S}=t,C=!["draft","auto-draft","pending"].includes(o)||l!==s&&l?l:null,[I,x]=p?p.split(/%(?:postname|pagename)%/):[],A=void 0!==I&&void 0!==x?{prefix:I,suffix:x}:null,k="auto-draft"===o?"draft":o;r();const O=u&&(0,Sr.migrate)(u,u.version||0),P=O?.pages?.length>0?O.pages:[(0,Mn.createPage)()],N={colors:m.colors?Br(m.colors):[],textStyles:m.textStyles?Br(m.textStyles):[]};n({pages:P,story:{storyId:e,title:a,status:k,author:E,date:C,modified:s,excerpt:c,slug:i,link:d,extras:_,featuredMedia:v,permalinkConfig:A,publisherLogo:w,password:g,previewLink:f,editLink:h,embedPostLink:b,currentStoryStyles:{colors:O?.currentStoryStyles?.colors?Br(O.currentStoryStyles.colors):[]},globalStoryStyles:N,autoAdvance:O?.autoAdvance,defaultPageDuration:O?.defaultPageDuration,backgroundAudio:O?.backgroundAudio,taxonomies:T,terms:S},selection:[],current:null,capabilities:y})}const Hr=function(e){let{storyId:t,story:n,shouldLoad:r,restore:a}=e;const{actions:{getStoryById:o}}=W(),{actions:{clearHistory:i}}=Dr();(0,u.useEffect)((()=>{t&&r&&(n?Fr(t,n,a,i):o(t).then((e=>{Fr(t,e,a,i)})))}),[t,n,r,a,o,i])};var Ur=n(96905),jr=n(58860);const zr=function(e,t){return(0,u.useCallback)((()=>{try{const n=new URL(t);n.hash=window.location.hash,window.history.replaceState({id:e},(0,We.default)(
39
  /* translators: %d: current story id. */
40
+ (0,d.__)("Post %d","web-stories"),e),n.toString())}catch(e){}}),[e,t])},Gr=e=>{const t=[{src:"https://cdn.ampproject.org/v0.js"},{name:"amp-story",src:"https://cdn.ampproject.org/v0/amp-story-1.0.js"}],n={name:"amp-video",src:"https://cdn.ampproject.org/v0/amp-video-0.1.js"},r={name:"amp-story-captions",src:"https://cdn.ampproject.org/v0/amp-story-captions-0.1.js"},a={name:"amp-story-shopping",src:"https://cdn.ampproject.org/v0/amp-story-shopping-0.1.js"};for(const{elements:o,backgroundAudio:i}of e){i?.resource?.src&&i?.tracks?.length>0&&(t.push(n),t.push(r));for(const{type:e,tracks:i}of o)switch(e){case"video":t.push(n),i?.length>0&&t.push(r);break;case"gif":t.push(n);break;case"product":t.push(a)}}return[...new Set(t)]};const Yr=function Boilerplate(){return c.createElement(c.Fragment,null,c.createElement("style",{"amp-boilerplate":"",dangerouslySetInnerHTML:{__html:"body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}"}}),c.createElement("noscript",null,c.createElement("style",{"amp-boilerplate":"",dangerouslySetInnerHTML:{__html:"body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}"}})))};const Zr=function(e){return/^#(?:[a-f0-9]{3}){1,2}$/i.test(e)};const Wr=function CustomStyles(){const e=ee.PAGE_RATIO/ee.FULLBLEED_RATIO,t=1/e,n=ee.PAGE_RATIO,r=ee.FULLBLEED_RATIO,a=f.theme.colors.bg.primary,o=Zr(a)?a:"#1B1D1C";return c.createElement("style",{"amp-custom":"",dangerouslySetInnerHTML:{__html:`\n h1, h2, h3 { font-weight: normal; }\n\n amp-story-page {\n background-color: ${o};\n }\n\n amp-story-grid-layer {\n overflow: visible;\n }\n\n @media (max-aspect-ratio: 9 / 16) {\n @media (min-aspect-ratio: 320 / 678) {\n amp-story-grid-layer.grid-layer {\n margin-top: calc((100% / ${r} - 100% / ${n}) / 2);\n }\n }\n }\n \n @media not all and (min-resolution:.001dpcm) {\n @media {\n p.text-wrapper > span {\n font-size: calc(100% - 0.5px);\n }\n }\n }\n\n .page-fullbleed-area,\n .page-background-overlay-area {\n position: absolute;\n overflow: hidden;\n width: 100%;\n left: 0;\n height: calc(${e} * 100%);\n top: calc((1 - ${e}) * 100% / 2);\n }\n\n .element-overlay-area {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n }\n\n .page-safe-area {\n overflow: visible;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: calc(${t} * 100%);\n margin: auto 0;\n }\n\n .mask {\n position: absolute;\n overflow: hidden;\n }\n\n .fill {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n }\n\n @media (prefers-reduced-motion: no-preference) {\n .animation-wrapper {\n opacity: var(--initial-opacity);\n transform: var(--initial-transform);\n }\n }\n\n amp-story-grid-layer.align-bottom {\n align-content: end;\n padding: 0;\n }\n\n .captions-area {\n padding: 0 32px 0;\n }\n\n amp-story-captions {\n margin-bottom: 16px;\n text-align: center;\n }\n\n amp-story-captions span {\n display: inline-block;\n margin: 0;\n padding: 6px 12px;\n vertical-align: middle;\n border-radius: 15px;\n background: rgba(11, 11, 11, 0.6);\n color: rgba(255, 255, 255, 1);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;;\n font-size: calc(4 * var(--story-page-vw));\n line-height: 1.4;\n word-break: break-word;\n word-wrap: break-word;\n overflow-wrap: break-word;\n }\n `}})},Vr=["Karla","Lato","Lora","Merriweather","Montserrat","Nunito","Oswald","Playfair Display","Poppins","Raleway","Roboto","Roboto Condensed","Source Serif Pro","Titillium Web","Work Sans","Alegreya","Arimo","EB Garamond","IBM Plex Mono","IBM Plex Serif","Inconsolata","Mulish","Noto Sans","Noto Serif","Open Sans","PT Mono","PT Sans","PT Serif","Roboto Mono","Source Sans Pro","Ubuntu","Anton","BioRhyme","Bungee","Bungee Shade","Cookie","Dancing Script","Monoton","Nothing You Could Do","Parisienne","Rock Salt","UnifrakturMaguntia"];const $r=function(e,t){const n=function(e){const t=e.split(/[#?]/)[0].split(".").pop().trim();switch(t){case"woff":case"woff2":return t;case"ttf":return"truetype";case"otf":return"opentype";default:return null}}(t);return n?`@font-face {\n font-family: "${e}";\n src: url('${t}') format('${n}');\n font-weight: normal;\n font-display:swap;\n }`:null};const qr=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"swap";const n=new URL("https://fonts.googleapis.com/css2");n.searchParams.append("display",t);for(const{family:t,variants:r=[]}of e){const e=r.reduce(((e,t)=>{let[n,r]=t;return 1!==n||e.includes("ital")||e.push("ital"),r&&400!==r&&!e.includes("wght")&&e.push("wght"),e}),[]).sort();let a=t;const o=e.join(",");o&&(a+=":"+o);const i=r.sort(((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:e[1]-t[1])).map((t=>{let[n,r]=t;const a=[];return e.includes("ital")&&a.push(n),e.includes("wght")&&a.push(r),a})).join(";"),l="400"===i;i&&!l&&(a+="@"+i),n.searchParams.append("family",a)}return decodeURI(n.toString())};var Kr=n(56862);const Xr=(e,t)=>e.some((e=>e[0]===t[0]&&e[1]===t[1])),Qr=(e,t)=>Math.abs(e[0]+e[1]-t[0]-t[1]),Jr=(e,t)=>e.reduce(((e,n)=>Qr(n,t)<Qr(e,t)?n:e));const ea=function FontDeclarations(e){let{pages:t}=e;const n=new Map;for(const{elements:e}of t){const t=e.filter((e=>{let{type:t}=e;return"text"===t}));for(const{font:e,content:r}of t){const{service:t,family:a,variants:o=[],url:i}=e;if(!t||"system"===t)continue;const l=n.get(t)||new Map;n.set(t,l);const s=l.get(a)||{family:a,variants:[],url:i},c=(0,Kr.getFontVariants)(r);if(o.length>0)for(const e of c){const t=Jr(o,e),n=Xr(s.variants,t),r=Xr(o,t);!n&&r&&s.variants.push(t)}l.set(a,s)}}return c.createElement(c.Fragment,null,Array.from(n.keys()).map((e=>{const t=n.get(e);switch(e){case"fonts.google.com":return c.createElement("link",{key:e,href:qr(Array.from(t.values())),rel:"stylesheet"});case"custom":return Array.from(t.values()).map((e=>{let{family:t,url:n}=e;const r=$r(t,n);return c.createElement("style",{key:t,dangerouslySetInnerHTML:{__html:r}})}));default:return null}})))};var ta=n(18535);const na=7,ra=!0;var aa=n(1787);function oa(e,t){try{return new URL(t,e).href}catch(e){return t}}function ia(e){try{return new URL(e),!0}catch{return!1}}function la(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https";return/^(http:\/\/|https:\/\/|tel:|mailto:)/.test(e)?e:`${t}://${e}`}function sa(){return sa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sa.apply(this,arguments)}const ca=function WithLink(e){let{element:t,children:n,...r}=e;const a=t.link||{},{url:o,icon:i,desc:l,rel:s=[]}=a;if(!o)return n;const d=s.concat(["noreferrer"]),u=la(o);return c.createElement("a",sa({href:u,"data-tooltip-icon":i||void 0,"data-tooltip-text":l,target:"_blank",rel:d.join(" ")},r),n)};const da=function OutputElement(e){let{element:t,flags:n}=e;const{id:r,opacity:a,type:o,border:i,backgroundColor:l,backgroundTextMode:s,overlay:d}=t,{Output:u,isMaskable:p}=(0,Mn.getDefinitionForType)(o),m=(0,aa.getBox)(t,100,100),{x:g,y:f,width:h,height:b,rotationAngle:E}=m,y={backgroundClip:"content-box",...(0,ta.default)(l)};return c.createElement("div",{style:{position:"absolute",pointerEvents:"none",left:g?`${g}%`:0,top:f?`${f}%`:0,width:`${h}%`,height:`${b}%`,...(0,Vn.shouldDisplayBorder)(t)?(0,Vn.getBorderPositionCSS)({...i,width:`${h}%`,height:`${b}%`,posTop:`${f}%`,posLeft:`${g}%`}):null,transform:E?`rotate(${E}deg)`:null,opacity:void 0!==a?a/100:null}},c.createElement(Hn.StoryAnimation.AMPWrapper,{target:r},c.createElement(Vn.OutputWithMask,{className:p?"mask":void 0,element:t,id:"el-"+r,style:{...(0,Vn.shouldDisplayBorder)(t)?(0,Vn.getBorderStyle)(t):null,pointerEvents:"initial",width:"100%",height:"100%",display:"block",position:"absolute",top:0,left:0,zIndex:0,...(0,Vn.getBorderRadius)(t),...s===Mn.BACKGROUND_TEXT_MODE.FILL?y:null},skipDefaultMask:!0},c.createElement(ca,{element:t,style:{width:"100%",height:"100%",display:"block",position:"absolute",top:0,left:0}},c.createElement(u,{element:t,box:m,flags:n})),d&&c.createElement("div",{className:"element-overlay-area",style:(0,ta.default)(d)}))))};function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ua.apply(this,arguments)}const pa=function BackgroundAudio(e){let{backgroundAudio:t,id:n}=e;const{resource:r,tracks:a,loop:o}=t||{},{mimeType:i,src:l}=r,s={loop:o?"loop":void 0,id:`page-${n}-background-audio`,"captions-id":a?.length>0?`el-${n}-captions`:void 0,crossorigin:a?.length>0?"anonymous":void 0},d={type:i,src:l};return c.createElement("amp-story-grid-layer",{template:"fill"},c.createElement("amp-video",ua({autoPlay:"autoplay",layout:"fixed",width:"1",height:"1",poster:""},s),c.createElement("source",d),a&&a.map(((e,t)=>{let{srclang:n,label:r,kind:a,track:o,id:i}=e;return c.createElement("track",{srcLang:n,label:r,kind:a,src:o,key:i,default:0===t})}))))};const ma=function(e){return e.sort(((e,t)=>e.y-t.y)).reduce(((e,t)=>{let{id:n,fontSize:r,content:a,tagName:o}=t;if(o&&"auto"!==o)return e.set(n,o),e;if(a.length<=3)return e.set(n,"p"),e;const i=Array.from(e.values()).includes("h1");return r>=36&&!i?(e.set(n,"h1"),e):(r>=27?e.set(n,"h2"):r>=21?e.set(n,"h3"):e.set(n,"p"),e)}),new Map)};const ga=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.filter((e=>{let{type:t,loop:n}=e;const{isMedia:r}=(0,Mn.getDefinitionForType)(t);return r&&!n})).reduce(((e,n)=>n?.resource?.length?n?.resource?.length<t||e?.resource?.length>n?.resource?.length?e:n:e),void 0)};const fa=function(e){let{animations:t,defaultPageDuration:n=na,elements:r,backgroundAudio:a,id:o}=e;const{resource:i,loop:l}=a||{},s=(0,Hn.getTotalDuration)({animations:t})/1e3,c=!l&&i?.length?i.length:0,d=ga(r,Math.max(s||1,c));if(d?.id)return`el-${d?.id}-media`;const u=Math.max(s||0,c,n);return u>c?`${u}s`:`page-${o}-background-audio`};const ha=function Outlink(e){let{ctaText:t,url:n,icon:r,theme:a,rel:o=[]}=e;return c.createElement("amp-story-page-outlink",{layout:"nodisplay","cta-image":r||void 0,theme:a},c.createElement("a",{href:n,rel:o.join(" ")},t||(0,d.__)("Learn more","web-stories")))};const ba=function ShoppingAttachment(e){let{products:t,theme:n,ctaText:r}=e;return c.createElement("amp-story-shopping-attachment",{theme:n,"cta-text":r||void 0},c.createElement("script",{type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify({items:t})}}))};function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ea.apply(this,arguments)}const ya=`${ee.PAGE_WIDTH}:${ee.PAGE_HEIGHT}`;const _a=function OutputPage(e){let{page:t,autoAdvance:n=ra,defaultPageDuration:r=na,flags:a}=e;const{id:o,animations:i,elements:l,backgroundColor:s,backgroundAudio:d,pageAttachment:u={},shoppingAttachment:p={}}=t,[m,...g]=l,f=m?.resource?.baseColor,h=f?{backgroundColor:f}:{backgroundColor:"white",...(0,ta.default)(s)},b=n?fa({animations:i,elements:l,defaultPageDuration:r,backgroundAudio:d,id:o}):void 0,E=ma(g.filter((e=>{let{type:t}=e;return"text"===t}))),y=g.map((e=>{const t="text"===e.type,n=u?.url&&(0,Mn.isElementBelowLimit)(e);if(!(t||n))return e;const r={...e};return t&&(r.tagName=E.get(e.id)),n&&delete r.link,r})),_=l.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).map((e=>{let{product:t}=e;return t})).filter(Boolean),v=_.length>0,w=u?.url&&!v,T=l.filter((e=>{let{type:t,tracks:n}=e;return t===Mn.ELEMENT_TYPES.VIDEO&&n?.length>0})).map((e=>{let{id:t}=e;return`el-${t}-captions`})),S=d?.resource?.src,C=d?.tracks?.length>0,I=C||!1===d?.loop&&d?.resource?.length;return S&&C&&T.push(`el-${o}-captions`),c.createElement("amp-story-page",{id:o,"auto-advance-after":b,"background-audio":S&&!I?S:void 0},c.createElement(Hn.StoryAnimation.Provider,{animations:i,elements:l},c.createElement(Hn.StoryAnimation.AMPAnimations,null),m&&c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer"},c.createElement("div",{className:"page-fullbleed-area",style:h},c.createElement("div",{className:"page-safe-area"},c.createElement(da,{element:m,flags:a}),m.overlay&&c.createElement("div",{className:"page-background-overlay-area",style:(0,ta.default)(m.overlay)})))),c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer"},c.createElement("div",{className:"page-fullbleed-area"},c.createElement("div",{className:"page-safe-area"},y.map((e=>c.createElement(da,{key:e.id,element:e,flags:a}))))))),S&&I&&c.createElement(pa,{backgroundAudio:d,id:o}),T.length>0&&c.createElement("amp-story-grid-layer",{template:"vertical","aspect-ratio":ya,class:"grid-layer align-bottom"},c.createElement("div",{className:"captions-area"},T.map((e=>c.createElement("amp-story-captions",{key:e,id:e,layout:"fixed-height",height:"100"}))))),w&&c.createElement(ha,u),v&&c.createElement(ba,Ea({products:_},p)))};const va=function(e){const t=[];if(0===e.length)return t;for(const{type:n,resource:r,isBackground:a}of e[0].elements){if(!["image","video","gif"].includes(n))continue;if(!a)continue;const e=r?.output?.src||r.src;t.push({url:e,type:"image"===n?"image":"video"})}return t};const wa=function OutputStory(e){let{story:{featuredMedia:t,link:n,title:r,autoAdvance:a,defaultPageDuration:o,backgroundAudio:i,publisherLogo:l},pages:s,metadata:{publisher:d},flags:u}=e;const p=Gr(s),m=va(s),g=t?.url||"",f=l?.url||"";return c.createElement("html",{amp:"",lang:"en"},c.createElement("head",null,c.createElement("meta",{charSet:"utf-8"}),c.createElement("meta",{name:"viewport",content:"width=device-width,minimum-scale=1,initial-scale=1"}),p.map((e=>{let{name:t,src:n}=e;return c.createElement("script",{key:n,async:"async",src:n,"custom-element":t})})),c.createElement(ea,{pages:s}),m.map((e=>{let{url:t,type:n}=e;return c.createElement("link",{key:t,href:t,rel:"preload",as:n})})),c.createElement(Yr,null),c.createElement(Wr,null),c.createElement("meta",{name:"web-stories-replace-head-start"}),c.createElement("title",null,r),n&&c.createElement("link",{rel:"canonical",href:n}),c.createElement("meta",{name:"web-stories-replace-head-end"})),c.createElement("body",null,c.createElement("amp-story",{standalone:"",publisher:d,"publisher-logo-src":f,title:r,"poster-portrait-src":g,"background-audio":i?.resource?.src??void 0},s.map((e=>c.createElement(_a,{key:e.id,page:e,autoAdvance:a,defaultPageDuration:o,flags:u}))))))};function Ta(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,u.renderToStaticMarkup)(c.createElement(wa,{story:e,pages:t,metadata:n,flags:r}))}const Sa=function(e){const t=[],n=[];return e.forEach((e=>{let{elements:r}=e;return r.forEach((e=>{let{product:r,type:a}=e;a===Mn.ELEMENT_TYPES.PRODUCT&&r&&!n.includes(r?.productId)&&(t.push(r),n.push(r?.productId))}))})),t};const Ca=function(e){let{story:t,pages:n,metadata:r,flags:a}=e;const{terms:o,...i}=Jn(t,["title","status","author","date","modified","slug","excerpt","featuredMedia","publisherLogo","password","currentStoryStyles","globalStoryStyles","autoAdvance","defaultPageDuration","backgroundAudio","terms"]),l=Sa(n);return{content:Ta(t,n,r,a),pages:n,...i,...o,products:l}},Ia={400:(0,d._x)("Bad Request","HTTP status description","web-stories"),401:(0,d._x)("Unauthorized","HTTP status description","web-stories"),403:(0,d._x)("Forbidden","HTTP status description","web-stories"),500:(0,d._x)("Internal Server Error","HTTP status description","web-stories")};const xa=function(e){let{storyId:t,pages:n,story:r,updateStory:a}=e;const{actions:{saveStoryById:o}}=W(),{actions:{resetNewChanges:i}}=Dr(),{metadata:l,flags:s}=U(),{showSnackbar:c}=(0,Ur.useSnackbar)(),[p,m]=(0,u.useState)(!1),[g,f]=(0,u.useState)(!1),[h,b]=(0,u.useState)(!1),{editLink:E}=r,y=zr(t,E),_=(0,u.useCallback)((e=>{m(!0);const u=["publish","future","private"].includes(r.status),p="pending"===r.status,g=(0,P.getTimeTracker)("load_save_story");return Promise.resolve().then((()=>o({storyId:t,...Ca({story:r,pages:n,metadata:l,flags:s}),...e}))).then((e=>{const{status:t,slug:n,link:r,previewLink:o,editLink:i,embedPostLink:l,featuredMedia:s}=e;a({properties:{status:t,slug:n,link:r,previewLink:o,editLink:i,embedPostLink:l,featuredMedia:s}}),y();const c=["publish","future","private"].includes(e.status),d="pending"===e.status;f(!u&&c),b(!p&&d)})).catch((e=>{const t=e.message?(0,jr.stripHTML)(e.message):null;let n=(0,d.__)("Failed to save the story","web-stories");t&&(n=(0,We.default)(
41
  /* translators: %s: error message */
42
  (0,d.__)("Failed to save the story: %s","web-stories"),t)),Object.prototype.hasOwnProperty.call(Ia,e?.data?.status)&&(n=t?(0,We.default)(
43
  /* translators: 1: error message. 2: status code */
173
  /* translators: %d: number of results. */
174
  (0,d._n)("%d result found.","%d results found.",r,"web-stories"),r);b(a)}),300),_=(0,u.useMemo)((()=>(s[t.restBase]||[]).map((e=>Object.values(i[t.restBase]||{}).find((t=>t.id===e)))).filter((e=>void 0!==e)).map((e=>e.name))),[t,s,i]),v=(0,u.useCallback)((e=>i[t.restBase]?.[Bo(e)]?.name),[t,i]);return(0,u.useEffect)((()=>{!async function(){const e=await l(t,{orderby:"count",order:"desc",hide_empty:!0});a(e)}()}),[t,l]),c.createElement(c.Fragment,null,c.createElement(zM,null,t.labels.name),c.createElement("div",{key:t.slug},c.createElement(SR.Label,{htmlFor:`${t.slug}-input`},t.labels.addNewItem),c.createElement(SR.Input,{id:`${t.slug}-input`,"aria-describedby":`${t.slug}-description`,name:t.slug,onTagsChange:E,onInputChange:y,tagDisplayTransformer:v,tokens:_,onUndo:g,suggestedTerms:f,suggestedTermsLabel:t?.labels?.itemsList}),c.createElement(SR.Description,{id:`${t.slug}-description`},t.labels.separateItemsWithCommas),r.length>0&&c.createElement(ZM.Wrapper,{"data-testid":`${t.slug}-most-used`},c.createElement(ZM.Heading,null,t.labels.mostUsed),c.createElement(ZM.List,null,r.map(((e,n)=>c.createElement(ZM.ListItem,{key:e.id},c.createElement(ZM.Word,{onClick:()=>{s[t.restBase]?.includes(e.id)||m(t,e)}},e.name,n<r.length-1&&
175
  /* translators: delimiter used in a list */
176
+ (0,d.__)(",","web-stories")),n<r.length-1&&" ")))))))};function IR(){return IR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},IR.apply(this,arguments)}const xR=(0,p.default)(uN).withConfig({displayName:"taxonomies__StyledSimplePanel",componentId:"sc-171mnp-0"})(["padding-left:0;padding-right:0;"]);const AR=function TaxonomiesPanel(e){let{nameOverride:t,...n}=e;const{capabilities:r}=Qa((e=>{let{state:{capabilities:t}}=e;return{capabilities:t}})),{taxonomies:a}=Yl((e=>{let{state:{taxonomies:t}}=e;return{taxonomies:t}}));if(!a?.length)return null;const o=a.filter((e=>Boolean(r[`assign-${e?.restBase}`]||r[`assign-${e?.slug}`])));return 0===o.length?null:c.createElement(xR,IR({name:t||"taxonomies",title:(0,d.__)("Taxonomies","web-stories")},n),o.map((e=>{const t=Boolean(r[`create-${e?.restBase}`]||r[`create-${e?.slug}`]);return c.createElement(YM,{key:e.slug},e.hierarchical?c.createElement(QM,{taxonomy:e,canCreateTerms:t}):c.createElement(CR,{taxonomy:e,canCreateTerms:t}))})))},kR=p.default.div.withConfig({displayName:"flipControls__ControlsContainer",componentId:"sc-1gcq876-0"})(["display:flex;justify-content:left;align-items:flex-start;"]),OR=p.default.div.withConfig({displayName:"flipControls__Space",componentId:"sc-1gcq876-1"})(["width:8px;"]),PR=(0,p.default)(hS).withConfig({displayName:"flipControls__StyledToggleButton",componentId:"sc-1gcq876-2"})(["",";"],sp);const NR=function FlipControls(e){let{value:t,onChange:n}=e;const r=(0,u.useCallback)((e=>!0===t[e]),[t]);return c.createElement(kR,null,c.createElement(Tooltip,{title:(0,d.__)("Flip horizontally","web-stories")},c.createElement(PR,{variant:g.BUTTON_VARIANTS.SQUARE,size:g.BUTTON_SIZES.SMALL,isToggled:!0===t.horizontal,onClick:()=>n({...t,horizontal:!r("horizontal")}),"aria-label":(0,d.__)("Flip horizontally","web-stories")},c.createElement(GE,null))),c.createElement(OR,null),c.createElement(Tooltip,{title:(0,d.__)("Flip vertically","web-stories")},c.createElement(PR,{variant:g.BUTTON_VARIANTS.SQUARE,size:g.BUTTON_SIZES.SMALL,isToggled:!0===t.vertical,onClick:()=>n({...t,vertical:!r("vertical")}),"aria-label":(0,d.__)("Flip vertically","web-stories")},c.createElement($E,null))))},MR=[{key:"sponsored",title:(0,d.__)("Sponsored","web-stories")},{key:"nofollow",title:(0,d.__)("Nofollow","web-stories")}],RR=p.default.div.withConfig({displayName:"linkRelations__CheckboxWrapper",componentId:"sc-123e3hl-0"})(["display:flex;padding:9px 0;"]),LR=p.default.label.withConfig({displayName:"linkRelations__Label",componentId:"sc-123e3hl-1"})(["margin-left:12px;"]),DR=(0,p.default)($e.Text).withConfig({displayName:"linkRelations__StyledText",componentId:"sc-123e3hl-2"})(["color:",";padding:8px 0;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary}));const BR=function LinkRelations(e){let{rel:t,onChangeRel:n}=e;const r=(0,d.__)("https://developers.google.com/search/docs/advanced/guidelines/qualify-outbound-links?hl=en","web-stories"),a=(0,u.useCallback)((e=>{const r=t.includes(e)?t.filter((t=>t!==e)):[...t,e];n(r)}),[n,t]);return c.createElement(GI,null,c.createElement("div",null,c.createElement(DR,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("Qualify outbound links","web-stories")),MR.map((e=>{let{key:n,title:r}=e;return c.createElement(RR,{key:n},c.createElement(nC.Checkbox,{id:n,name:n,checked:t?.includes(n),onChange:()=>a(n)}),c.createElement(LR,{htmlFor:n},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,as:"span"},r)))})),c.createElement(pu.Link,{rel:"noopener noreferrer",target:"_blank",href:r,size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.X_SMALL},(0,d.__)("Learn more","web-stories"))))};function FR(e,t){return void 0===e?t:e}const HR=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r="function"==typeof t?t:e=>e[t],a=FR(r(e[0]),n),o=e.every((e=>FR(r(e),n)===a));return o?a:ve};const UR=function(e,t,n){const r={},a=e.map((e=>e[t]||n));return Object.keys(n).forEach((e=>{r[e]=HR(a,e)})),r};const jR=function(e,t){return(0,u.useMemo)((()=>{const n=e.map((e=>e[t]));if(0===n.length)return null;if(1===n.length)return n[0];const r={};return n.forEach((e=>{const t=(0,BS.default)((0,ta.default)(e));t in r||(r[t]=e)})),1===Object.keys(r).length?Object.values(r)[0]:ve}),[e,t])};const zR=function(e,t,n){const r=UR(e,t,n),a=Object.keys(n).map((e=>r[e]));return(0,u.useMemo)((()=>r),a)};var GR=n(30963);function YR(){return YR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YR.apply(this,arguments)}const ZR=(0,u.forwardRef)((function FontPicker(e,t){let{zIndex:n,onChange:r,currentValue:a,highlightStylesOverride:o,showDropdownLabel:i,listStyleOverrides:l,containerStyleOverrides:s,className:p,tabIndex:m}=e;const{fonts:g=[],recentFonts:f=[],curatedFonts:h=[],customFonts:b=[],ensureMenuFontsLoaded:E,ensureCustomFontsLoaded:y,getFontsBySearch:_,getCustomFonts:v,getCuratedFonts:w}=Uo((e=>{let{actions:t,state:n}=e;return{getFontsBySearch:t.getFontsBySearch,ensureMenuFontsLoaded:t.ensureMenuFontsLoaded,ensureCustomFontsLoaded:t.ensureCustomFontsLoaded,getCuratedFonts:t.getCuratedFonts,getCustomFonts:t.getCustomFonts,recentFonts:n.recentFonts,curatedFonts:n.curatedFonts,fonts:n.fonts,customFonts:n.customFonts}}));(0,u.useEffect)((()=>{v(),w()}),[v,w]);const T=(0,u.useMemo)((()=>{const e=new Map;return g.forEach((t=>{e.set(t.id,t)})),b?.forEach((t=>{e.set(t.id,t)})),e}),[g,b]),S=(0,u.useCallback)((e=>{e.length&&(E(e.filter((e=>"fonts.google.com"===T.get(e)?.service))),y(e.filter((e=>"custom"===T.get(e)?.service))))}),[T,y,E]),C=(0,u.useCallback)(((e,t)=>{let{option:n,...r}=e;return c.createElement(GR.default.Option,YR({ref:t},r,{fontFamily:"fonts.google.com"===n.service?`'${n.name}::MENU'`:n.name}),a===n.id&&c.createElement(GR.default.Selected,{"aria-label":(0,d.__)("Selected","web-stories")}),n.name)}),[a]),I=(0,u.useMemo)((()=>[...b?.length?[{label:(0,d.__)("Your fonts","web-stories"),options:b}]:[],...f?.length?[{label:(0,d.__)("Recently used","web-stories"),options:f}]:[]]),[b,f]);return c.createElement(GR.default.DropDown,{ref:t,zIndex:n,tabIndex:m,highlightStylesOverride:o,"data-testid":"font",title:(0,d.__)("Available font families","web-stories"),dropdownButtonLabel:(0,d.__)("Font family","web-stories"),options:g,primaryOptions:h,primaryLabel:(0,d.__)("Recommended","web-stories"),priorityOptionGroups:I,searchResultsLabel:(0,d.__)("Search results","web-stories"),selectedId:ve===a?"":a,placeholder:ve===a?we:a,hasSearch:!0,getOptionsByQuery:_,onChange:r,onObserve:S,renderer:(0,u.forwardRef)(C),disabled:!g?.length,dropDownLabel:i?(0,d.__)("Font","web-stories"):null,listStyleOverrides:l,containerStyleOverrides:s,className:p})})),WR=ZR;var VR=n(15242);const $R={...Mn.ELEMENT_TYPES,MULTIPLE:"multiple",NONE:"none"};var qR=n(98448);const KR=(0,u.createContext)(null),XR={cleanup:null,focusGroups:{},cleanupCallbacks:{}},QR={addNodeToGroup:(e,t)=>{const{groupId:n,nodeTuple:r}=t.payload,a=e.focusGroups[n]||[];let o=[];const i=a.findIndex((e=>e[0]===r[0]));return o=-1===i?[...a,r]:[...a.slice(0,i),r,...a.slice(0,i+1)],{...e,focusGroups:{...e.focusGroups,[n]:o}}},removeNodeFromGroup:(e,t)=>{const{groupId:n,nodeTuple:r}=t.payload,a=(e.focusGroups[n]||[]).filter((e=>e[0]!==r[0]));return{...e,focusGroups:{...e.focusGroups,[n]:a}}},setFocusGroupCleanup:(e,t)=>{const{groupId:n,cleanup:r}=t.payload;return{...e,activeGroupKey:n,cleanupCallbacks:{...e.cleanupCallbacks,[n]:r}}}};function KeyBindings(e){let{uuid:t,node:n,focusGroup:r,exitFocusGroup:a}=e;const o=(0,u.useCallback)((e=>{e.preventDefault();const n=function(e,t){return function(n){if(!t)return;const r=t.findIndex((t=>t[0]===e));if(-1===r)return;const a=((r+n)%(o=t.length)+o)%o;var o;const[,i]=t[a];i?.focus()}}(t,r);e.shiftKey?n(-1):n(1)}),[r,t]),i=(0,u.useCallback)((e=>{e.preventDefault(),a?.()}),[a]);return(0,Cr.useKeyDownEffect)(n,{key:["tab"],allowDefault:!0,editable:!0,shift:!0},o,[o]),(0,Cr.useKeyDownEffect)(n,{key:["esc"],allowDefault:!0,editable:!0},i,[i]),null}KeyBindings.propTypes={uuid:za().string.isRequired,node:"undefined"!=typeof Element?za().instanceOf(Element).isRequired:za().any.isRequired,focusGroup:za().array.isRequired,exitFocusGroup:za().func};const JR=KeyBindings;const eL=function EditLayerFocusManager(e){let{children:t}=e;const[n,r]=(0,u.useReduction)(XR,QR),a=(0,u.useRef)(n);a.current=n;const o=(0,u.useCallback)((e=>{let{groupId:t}=e;const n=a.current.focusGroups?.[t]?.[0];if(n){const[,e]=n;e.focus()}}),[a]),i=Object.entries(n.focusGroups),l=n.cleanupCallbacks;return c.createElement(KR.Provider,{value:{enterFocusGroup:o,setFocusGroupCleanup:r.setFocusGroupCleanup,actions:r}},i.map((e=>{let[t,n]=e;return n.map((e=>{let[r,a]=e;return a&&c.createElement(JR,{key:r,uuid:r,node:a,focusGroup:n,exitFocusGroup:l[t]})}))})),t)};const tL=function(e){const t=(0,u.useContextSelector)(KR,(e=>e.actions)),n=(0,u.useInitializedValue)(pe.default);return(0,u.useCallback)((r=>{null!==r?t.addNodeToGroup({groupId:e,nodeTuple:[n,r]}):t.removeNodeFromGroup({groupId:e,nodeTuple:[n,r]})}),[t,e,n])};const nL=function(e){return(0,u.useContextSelector)(KR,e??u.identity)},rL={EDIT_ELEMENT:"EDIT_ELEMENT",ELEMENT_SELECTION:"ELEMENT_SELECTION"},aL=(0,u.createContext)({state:{},actions:{}});const oL=function(e){return(0,u.useContextSelector)(aL,e??u.identity)};const iL=function FloatingMenuProvider(e){let{handleDismiss:t,children:n}=e;const r={state:{},actions:{handleDismiss:t}};return c.createElement(aL.Provider,{value:r},n)},lL={left:0,right:0,top:0,bottom:0,lockedWidth:!0,color:(0,sT.default)(0,0,0)};function sL(){return sL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sL.apply(this,arguments)}const cL=function FloatingColor(e){const{hasInputs:t,hasEyedropper:n,allowsGradient:r=!0}=e,a=function(e,t){return(e?184:60)+(t?38:0)}(t,n);return c.createElement(tI,sL({width:a,maxHeight:362,pickerPlacement:Gd.PLACEMENT.TOP_START,isInDesignMenu:!0,allowsGradient:r,allowsSavedColors:!0,allowsSavedColorDeletion:!1,pickerHasEyedropper:!n,containerLabelBase:(0,d.__)("Color input (floating menu)","web-stories")},e))};var dL=n(87098);function uL(){return uL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uL.apply(this,arguments)}const pL=p.default.div.withConfig({displayName:"icon__IconWrapper",componentId:"sc-scm7dy-0"})(["width:32px;height:32px;display:flex;align-items:center;justify-content:center;> *{flex:1;}"]);const mL=function(e){let{children:t,title:n,className:r="",...a}=e;return c.createElement(c.Fragment,null,c.createElement(dL.VisuallyHidden,null,n),c.createElement(pL,uL({className:r},a),t))};var gL=n(51537);function fL(){return fL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fL.apply(this,arguments)}const hL=(0,u.forwardRef)((function ToggleButton(e,t){let{isToggled:n,children:r,...a}=e;const o="boolean"==typeof n?{type:n?g.BUTTON_TYPES.SECONDARY:g.BUTTON_TYPES.TERTIARY,"aria-pressed":n,role:"button"}:{};return c.createElement(gL.default,fL({ref:t},o,a),r)}));function bL(){return bL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bL.apply(this,arguments)}const EL=(0,u.memo)((0,u.forwardRef)((function IconButton(e,t){let{Icon:n,...r}=e;return c.createElement(Tooltip,{placement:Gd.PLACEMENT.BOTTOM,title:r.title},c.createElement(hL,bL({ref:t,tabIndex:-1},r),c.createElement(mL,{title:r.title},c.createElement(n,null))))}))),yL=EL,_L=(0,p.default)(FC).attrs({inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT}).withConfig({displayName:"input__Input",componentId:"sc-79zl03-0"})(["width:70px;flex:0 0 70px;"]);var vL=n(77568);const wL=vL.default;function TL(){return TL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TL.apply(this,arguments)}const SL=(0,p.default)(gL.default).withConfig({displayName:"text__Button",componentId:"sc-fb6dx4-0"})(["font-size:14px;padding:0 12px;font-weight:normal;letter-spacing:normal;"]),CL=(0,u.memo)((function TextButton(e){let{text:t,...n}=e;return c.createElement(SL,TL({forcePadding:!0,title:t},n,{tabIndex:-1}),t)}));const IL=function(e){return Qa((t=>{let{state:{selectedElements:n}}=t;return Jn(n[0],e)}))};function xL(e,t){return Object.fromEntries(Object.keys(t).map((n=>{const r=e[n]===ve,a=void 0!==e[n]&&!function(e,t){const n=e&&"object"==typeof e&&(e.type||e.color),r=t&&"object"==typeof t&&(t.type||t.color);return n&&r?(0,DS.default)(e,t):e===t}(e[n],t[n]);return r||a?[n,ve]:[n,t[n]]})))}const AL=function(e,t){const{hasCurrentEditor:n,selectionInfo:r,selectionActions:a}=(0,Kr.useRichText)((e=>{let{state:t,actions:n}=e;return{hasCurrentEditor:t.hasCurrentEditor,selectionInfo:t.selectionInfo,selectionActions:n.selectionActions}})),{clearEditing:o}=$s((e=>{let{actions:{clearEditing:t}}=e;return{clearEditing:t}})),i=(0,u.useMemo)((()=>n?r:e.map((e=>{let{content:t}=e;return t})).map(Kr.getHTMLInfo).reduce(xL,{})),[n,r,e]),l=(0,u.useCallback)((function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return t((t=>{let{content:n}=t;return{content:e(n,...r)}}),!0)}),[t]),s=(0,u.useRef)(null),c=(0,u.useCallback)((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];s.current=t}),[s]);(0,u.useEffect)((()=>{const e=s.current;e&&(l(...e),s.current=null)}),[e,s,l]);const d=(0,u.useMemo)((()=>{const e=(0,Kr.getHTMLFormatters)();return n?{handleClickBold:()=>a.toggleBoldInSelection(),handleSelectFontWeight:a.setFontWeightInSelection,handleClickItalic:a.toggleItalicInSelection,handleClickUnderline:a.toggleUnderlineInSelection,handleClickUppercase:a.toggleUppercaseInSelection,handleSetLetterSpacing:a.setLetterSpacingInSelection,handleSetColor:a.setColorInSelection,handleResetFontWeight:async t=>{await o(),c(e.setFontWeight,t)}}:{handleClickBold:t=>l(e.toggleBold,t),handleSelectFontWeight:t=>l(e.setFontWeight,t),handleClickItalic:t=>l(e.toggleItalic,t),handleClickUnderline:t=>l(e.toggleUnderline,t),handleClickUppercase:t=>l(e.toggleUppercase,t),handleSetLetterSpacing:t=>l(e.setLetterSpacing,t),handleSetColor:t=>l(e.setColor,t),handleResetFontWeight:t=>l(e.setFontWeight,t)}}),[n,a,l,o,c]),p=(0,u.useCallback)((()=>e.filter((e=>{let{type:t}=e;return"text"===t})).length>0),[e]);return(0,Cr.useGlobalKeyDownEffect)({key:["mod+b","mod+u","mod+i"]},(e=>{let{key:t}=e;if(p)switch(t){case"b":d.handleClickBold();break;case"i":d.handleClickItalic();break;case"u":d.handleClickUnderline()}}),[d,p]),{textInfo:i,handlers:d}};const kL=function(e){let{currentValue:t,handler:n,eventName:r}=e;const{content:a}=IL(["content"]),o=Qa((e=>e.actions.updateSelectedElements)),i=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:r,element:"text"}),o({properties:t=>hv(t,e,!0)})}),[o,r]),{textInfo:l,handlers:s}=AL([{content:a,type:"text"}],i);return{isToggled:l[t],toggle:()=>{(0,s[n])(!l[t])}}},OL=p.default.div.withConfig({displayName:"borderWidthAndColor__Container",componentId:"sc-1qijom4-0"})(["display:flex;align-items:center;"]),PL=p.default.div.withConfig({displayName:"borderWidthAndColor__Dash",componentId:"sc-1qijom4-1"})(["width:8px;height:1px;background-color:",";"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}));const NL={color:{r:0,g:0,b:0}},ML=(0,d.__)("Border width","web-stories"),RL=(0,d.__)("Border color","web-stories");const LL=function BorderWidthAndColor(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{border:n=lL,mask:r,type:a}=IL(["border","mask","type"]),o=Qa((e=>{let{actions:t}=e;return t.updateSelectedElements})),i=n?.left===n?.right&&n?.left===n?.top&&n?.left===n?.bottom;if(!n?.lockedWidth&&!i)return null;const l=(0,Vn.canSupportMultiBorder)({mask:r}),s=function(e){if(!e)return!1;const{left:t,right:n,top:r,bottom:a}=e;return Boolean(t||n||r||a)}(n);return c.createElement(OL,null,c.createElement(oT,{ref:t,inputRef:e,inputLabel:ML},c.createElement(_L,{tabIndex:-1,ref:e,suffix:c.createElement(Hf,null),value:n?.left||0,"aria-label":ML,onChange:(e,t)=>(e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_width",element:a}),o({properties:t=>{let{border:r}=t;return{border:{locked:!0,color:n?.color,...r,left:e,right:e,top:e,bottom:e}}}})})(t),onKeyDown:e=>{aT(e,t)}})),s&&c.createElement(c.Fragment,null,c.createElement(PL,null),c.createElement(cL,{tabIndex:-1,label:RL,value:n?.color||NL,onChange:e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_color",element:a}),o({properties:t=>{let{border:n}=t;return{border:{...n,color:e}}}})},hasInputs:!1,hasEyedropper:!1,allowsOpacity:l,allowsGradient:!1,allowsSavedColors:!1})))},DL=(0,p.css)(["position:relative;:focus-within{z-index:1;",";}"],(e=>{let{theme:t}=e;return lp.focusCSS(t.colors.border.focus,t.colors.bg.secondary)})),BL=(0,p.css)(["width:29px;height:29px;"]),FL=(0,p.default)(FC).withConfig({displayName:"stackableInput__StackableInput",componentId:"sc-bgp531-0"})(["svg{","}& > div{border-radius:0;margin-left:-1px;padding:2px 7px 2px 12px;",";}"],BL,DL),HL=p.default.div.withConfig({displayName:"stackableGroup__StackableContainer",componentId:"sc-ogfpu5-0"})(["display:flex;max-width:",";& > ","{border-radius:0;&:first-of-type > div{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}&:last-of-type > div{border-top-right-radius:4px;border-bottom-right-radius:4px;}}",""],(e=>{let{locked:t}=e;return t?"106px":"none"}),FL,(e=>{let{$stackableGroupStyleOverride:t}=e;return t}));const UL=function StackableGroup(e){let{children:t,locked:n,className:r,stackableGroupStyleOverride:a}=e;return c.createElement(HL,{$stackableGroupStyleOverride:a,locked:n,className:r},t)},jL={topLeft:0,topRight:0,bottomRight:0,bottomLeft:0,locked:!0},zL=p.default.div.withConfig({displayName:"radius__FlexContainer",componentId:"sc-10ryvqs-0"})(["display:flex;"]),GL=p.default.div.withConfig({displayName:"radius__LockContainer",componentId:"sc-10ryvqs-1"})(["position:relative;display:flex;align-items:center;width:32px;margin-left:8px;"]),YL=(0,p.default)(LockToggle).withConfig({displayName:"radius__StyledLockToggle",componentId:"sc-10ryvqs-2"})(["",";"],sp),ZL=(0,p.default)(Rh).withConfig({displayName:"radius__TopLeft",componentId:"sc-10ryvqs-3"})(["transform:rotate(90deg);"]),WL=(0,p.default)(Rh).withConfig({displayName:"radius__TopRight",componentId:"sc-10ryvqs-4"})(["transform:rotate(180deg);"]),VL=(0,p.default)(Rh).withConfig({displayName:"radius__BottomRight",componentId:"sc-10ryvqs-5"})(["transform:rotate(270deg);"]);const $L=function RadiusControls(e){let{selectedElements:t,pushUpdateForObject:n,stackableGroupStyleOverride:r}=e;const a=zR(t,"borderRadius",jL),o=t.every((e=>(0,Vn.canSupportMultiBorder)(e))),i=!0===a.locked,l=(0,u.useCallback)(((e,t)=>{n("borderRadius",i?{topLeft:t,topRight:t,bottomRight:t,bottomLeft:t}:{[e]:t},jL,!0)}),[n,i]),s=(0,u.useCallback)((e=>{const t=e?{locked:e,topLeft:a.topLeft,topRight:a.topLeft,bottomRight:a.topLeft,bottomLeft:a.topLeft}:{locked:e};n("borderRadius",t,jL,!0)}),[n,a]);if(!o)return null;const p=i?(0,d.__)("Corner Radius","web-stories"):(0,d.__)("Top left corner radius","web-stories");return c.createElement(zL,null,c.createElement(UL,{stackableGroupStyleOverride:r,locked:i},c.createElement(FL,{suffix:c.createElement(ZL,null),value:a.topLeft===ve?"":a.topLeft,"aria-label":p,onChange:(e,t)=>l("topLeft",t),placeholder:a.topLeft===ve?we:"",isIndeterminate:a.topLeft===ve}),!i&&c.createElement(c.Fragment,null,c.createElement(FL,{suffix:c.createElement(WL,null),value:a.topRight===ve?"":a.topRight,"aria-label":(0,d.__)("Top right corner radius","web-stories"),onChange:(e,t)=>l("topRight",t),placeholder:a.topRight===ve?we:"",isIndeterminate:a.topRight===ve}),c.createElement(FL,{value:a.bottomLeft===ve?"":a.bottomLeft,"aria-label":(0,d.__)("Bottom left corner radius","web-stories"),onChange:(e,t)=>l("bottomLeft",t),placeholder:a.bottomLeft===ve?we:"",suffix:c.createElement(Rh,null),isIndeterminate:a.bottomLeft===ve}),c.createElement(FL,{value:a.bottomRight===ve?"":a.bottomRight,"aria-label":(0,d.__)("Bottom right corner radius","web-stories"),onChange:(e,t)=>l("bottomRight",t),placeholder:a.bottomRight===ve?we:"",suffix:c.createElement(VL,null),isIndeterminate:a.bottomRight===ve}))),c.createElement(GL,null,c.createElement(Tooltip,{title:(0,d.__)("Toggle consistent corner radius","web-stories"),key:a.locked.toString()},c.createElement(YL,{isLocked:a.locked,onClick:()=>s(!a.locked),"aria-label":(0,d.__)("Toggle consistent corner radius","web-stories")}))))},qL=(0,d.__)("Corner Radius","web-stories");const KL=function BorderRadius(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{borderRadius:n=jL,mask:r,type:a}=IL(["borderRadius","mask","type"]),o=Qa((e=>e.actions.updateSelectedElements)),i=(0,Vn.canSupportMultiBorder)({mask:r}),l=n.topLeft===n.topRight&&n.topLeft===n.bottomLeft&&n.topLeft===n.bottomRight;return i&&(n.locked||l)?c.createElement(oT,{ref:t,inputRef:e,inputLabel:qL},c.createElement(_L,{tabIndex:-1,ref:e,suffix:c.createElement(Rh,null),value:n.topLeft,"aria-label":qL,onChange:(e,t)=>(e=>{(0,P.trackEvent)("floating_menu",{name:"set_border_radius",element:a}),o({properties:{borderRadius:{locked:!0,topLeft:e,topRight:e,bottomRight:e,bottomLeft:e}}})})(t),onKeyDown:e=>{aT(e,t)}}),c.createElement(wL,null)):null};const XL=function(e){let{isMultiple:t}=e;const{type:n}=IL(["type"]),{handleDismiss:r}=oL((e=>{let{actions:{handleDismiss:t}}=e;return{handleDismiss:t}}));return c.createElement(yL,{Icon:op.default,title:(0,d.__)("Dismiss menu","web-stories"),onClick:()=>{(0,P.trackEvent)("floating_menu",{name:"dismiss_menu",element:t?"multiple":n}),r()}})},QL={startX:0,startY:0,endX:ee.PAGE_WIDTH,endY:ee.PAGE_HEIGHT,width:ee.PAGE_WIDTH,height:ee.PAGE_HEIGHT},JL="left",eD="right",tD="top",nD="bottom";const rD=function(e){let{selectedElements:t,updateElements:n,isFloatingMenu:r}=e;const a=t.length>2,o=(0,u.useMemo)((()=>t.map((e=>{const{id:t,groupId:n,x:r,y:a,width:o,height:i,rotationAngle:l}=e;let s=r,c=a,d=o,u=i;if(l){const e=(0,zs.calcRotatedObjectPositionAndSize)(l,r,a,o,i);s=e.x,c=e.y,d=e.width,u=e.height}return{id:t,groupId:n,x:r,y:a,width:o,height:i,frameX:s,frameY:c,frameWidth:d,frameHeight:u}}))),[t]),i=t[0].groupId,l=i&&t.every((e=>e.groupId&&e.groupId===i)),s=1===t.length||l?QL:(0,zs.default)(t),c=e=>{(0,P.trackEvent)(r?"floating_menu":"design_panel",{name:`set_alignment_${e}`,element:"multiple"})},d=e=>{c(e),n((n=>{const{id:r,groupId:a}=n,i=a?(0,zs.default)(t.filter((e=>e.groupId===a))):null,l=o.find((e=>e.id===r)),{width:c=0,height:d=0,frameWidth:u=0,frameHeight:p=0}=l||{},m=e===JL||e===eD?(u-c)/2:(p-d)/2,g=a?e===JL||e===eD?l.frameX-i.startX:l.frameY-i.startY:0,f=a?i.width:c,h=a?i.height:d;return e===JL||e===eD?{x:e===JL?s.startX+m+g:s.endX-f-m+g}:{y:e===tD?s.startY+m+g:s.endY-h-m+g}}))};return{isDistributionEnabled:a,handleAlignLeft:()=>d(JL),handleAlignCenter:()=>{c("center");const e=(s.endX+s.startX)/2;n((n=>{const{id:r,width:a,groupId:i}=n,l=i?(0,zs.default)(t.filter((e=>e.groupId===i))):null,s=i?l.width:a,c=o.find((e=>e.id===r)),d=i?c.frameX-l.startX:0;return{x:e-s/2+d}}))},handleAlignRight:()=>d(eD),handleAlignTop:()=>d(tD),handleAlignMiddle:()=>{c("middle");const e=(s.endY+s.startY)/2;n((n=>{const{id:r,height:a,groupId:i}=n,l=i?(0,zs.default)(t.filter((e=>e.groupId===i))):null,s=i?l.height:a,c=o.find((e=>e.id===r)),d=i?c.frameY-l.startY:0;return{y:e-s/2+d}}))},handleAlignBottom:()=>d(nD),handleHorizontalDistribution:()=>{c("horizontal_distribution");const e=[...o];e.sort(((e,t)=>(e.frameX+e.frameWidth)/2-(t.frameX+t.frameWidth)/2));const t=e.reduce(((e,t)=>e+t.frameWidth),0),r=s.width-t,a=(0,aa.dataPixels)(r/(e.length-1)),i={};let l=0;e.forEach(((t,n)=>{const{id:r,x:o,width:s,frameWidth:c}=t;0===n||n===e.length-1?(i[r]={x:o},l=o):i[r]={x:l+(c-s)/2},l+=c+a})),n((e=>{let{id:t}=e;return i[t]}))},handleVerticalDistribution:()=>{c("vertical_distribution");const e=[...o];e.sort(((e,t)=>(e.frameY+e.frameHeight)/2-(t.frameY+t.frameHeight)/2));const t=e.reduce(((e,t)=>e+t.frameHeight),0),r=s.height-t,a=(0,aa.dataPixels)(r/(e.length-1)),i={};let l=0;e.forEach(((t,n)=>{const{id:r,y:o,height:s,frameHeight:c}=t;0===n||n===e.length-1?(i[r]={y:o},l=o):i[r]={y:l+(c-s)/2},l+=c+a})),n((e=>{let{id:t}=e;return i[t]}))}}};const aD=function ElementAlignment(){const{selectedElements:e,updateSelectedElements:t}=Qa((e=>{let{state:{selectedElements:t},actions:{updateSelectedElements:n}}=e;return{selectedElements:t,updateSelectedElements:n}})),{isDistributionEnabled:n,handleAlignLeft:r,handleAlignCenter:a,handleAlignRight:o,handleAlignTop:i,handleAlignMiddle:l,handleAlignBottom:s,handleHorizontalDistribution:u,handleVerticalDistribution:p}=rD({selectedElements:e,updateElements:e=>t({properties:e}),isFloatingMenu:!0});return c.createElement(c.Fragment,null,n&&c.createElement(c.Fragment,null,c.createElement(yL,{Icon:Uh,title:(0,d.__)("Distribute horizontally","web-stories"),onClick:u}),c.createElement(yL,{Icon:Yh,title:(0,d.__)("Distribute vertically","web-stories"),onClick:p}),c.createElement(wL,null)),c.createElement(yL,{Icon:Lg,title:(0,d.__)("Align left","web-stories"),onClick:r}),c.createElement(yL,{Icon:Pg,title:(0,d.__)("Align center","web-stories"),onClick:a}),c.createElement(yL,{Icon:Gg,title:(0,d.__)("Align right","web-stories"),onClick:o}),c.createElement(yL,{Icon:of,title:(0,d.__)("Align top","web-stories"),onClick:i}),c.createElement(yL,{Icon:Hg,title:(0,d.__)("Align vertical center","web-stories"),onClick:l}),c.createElement(yL,{Icon:xg,title:(0,d.__)("Align bottom","web-stories"),onClick:s}))};const oD=function(e){const{flip:t,type:n}=IL(["flip","type"]),r=Qa((e=>e.actions.updateSelectedElements));return{[e]:t[e]||!1,toggle:()=>{(0,P.trackEvent)("floating_menu",{name:`set_flip_${e}`,element:n}),r({properties:t=>({flip:{...t.flip,[e]:!t.flip[e]||!1}})})}}};const iD=function FlipHorizontal(){const{horizontal:e,toggle:t}=oD("horizontal");return c.createElement(yL,{Icon:GE,title:(0,d.__)("Flip horizontally","web-stories"),onClick:t,isToggled:e})};const lD=function FlipVertical(){const{vertical:e,toggle:t}=oD("vertical");return c.createElement(yL,{Icon:$E,title:(0,d.__)("Flip vertically","web-stories"),onClick:t,isToggled:e})};var sD=n(32396);const cD=function(e){const{width:t,height:n,rotationAngle:r,x:a,y:o}=e,i=(0,aa.dataPixels)((0,qn.calculateTextHeight)(e,t)),[l,s]=(0,sD.default)(r,0,0,0,i-n);return{height:i,x:(0,aa.dataPixels)(a+l),y:(0,aa.dataPixels)(o+s)}},dD=400;const uD=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dD,t=arguments.length>1?arguments[1]:void 0;return e=parseInt(e),isNaN(parseInt(e))?dD:t&&0!==t.length?t.reduce(((t,n)=>{t=parseInt(t),n=parseInt(n);const r=Math.abs(t-e),a=Math.abs(n-e);return r===a?t<n?t:n:a<r?n:t})):e};function pD(){return pD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pD.apply(this,arguments)}const mD=(0,u.forwardRef)((function StoryFontPicker(e,t){let{...n}=e;const{updateSelectedElements:r,selectedElements:a}=Qa((e=>{let{state:t,actions:n}=e;return{updateSelectedElements:n.updateSelectedElements,selectedElements:t.selectedElements}})),o=(0,u.useCallback)(((e,t)=>{r({properties:n=>{const r=hv(n,e,t),a=cD({...n,...r});return{...r,...a}}})}),[r]),{textInfo:{fontWeight:i,isItalic:l},handlers:{handleResetFontWeight:s}}=AL(a,o),{addRecentFont:d,maybeEnqueueFontStyle:p}=Uo((e=>{let{actions:t}=e;return{addRecentFont:t.addRecentFont,maybeEnqueueFontStyle:t.maybeEnqueueFontStyle}})),m=HR(a,(e=>{let{font:t}=e;return t?.family})),g=l?"italic":"normal",f=(0,u.useCallback)((async e=>{const{id:t,name:n,value:r,...l}=e;(0,P.trackEvent)("font_family_changed",{name:n}),await p(a.map((e=>{let{content:t}=e;return{font:l,fontStyle:g,fontWeight:i,content:(0,jr.stripHTML)(t)}}))),d(e),o({font:l},!0);const c=uD(400,l.weights);await s(c)}),[d,g,i,p,o,a,s]);return c.createElement(WR,pD({onChange:f,currentValue:m},n,{ref:t}))})),gD=mD,fD=(0,p.default)(gD).withConfig({displayName:"fontFamily__StyledFontPicker",componentId:"sc-sk3dxe-0"})(["width:164px;"]),hD=(0,p.css)(["max-height:200px;"]),bD=(0,p.css)(["border:1px solid ",";"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}));const ED=function FontFamily(){return c.createElement(fD,{tabIndex:-1,listStyleOverrides:hD,containerStyleOverrides:bD})};const yD=function(e){const t=[{label:me[400],value:"400"}];return e?.weights?e.weights.map((e=>({label:me[e],value:e.toString()}))):t},_D={MIN:8,MAX:800},vD=p.default.div.withConfig({displayName:"font__Space",componentId:"sc-1upk4a3-0"})(["flex:0 0 10px;"]),wD=(0,p.default)(FC).withConfig({displayName:"font__StyledNumericInput",componentId:"sc-1upk4a3-1"})(["flex-basis:80px;text-align:center;"]),TD=(0,p.default)(xv.DropDown).withConfig({displayName:"font__StyledDropDown",componentId:"sc-1upk4a3-2"})(["background-color:transparent;"]);const SD=function FontControls(e){let{selectedElements:t,pushUpdate:n,highlightStylesOverride:r,fontDropdownRef:a}=e;const o=HR(t,(e=>{let{font:t}=e;return t?.family})),i=HR(t,"fontSize"),{textInfo:{fontWeight:l,isItalic:s},handlers:{handleSelectFontWeight:p}}=AL(t,n),{fonts:m=[],maybeEnqueueFontStyle:g,getFontByName:f}=Uo((e=>{let{actions:{maybeEnqueueFontStyle:t,getFontByName:n},state:{fonts:r}}=e;return{maybeEnqueueFontStyle:t,getFontByName:n,fonts:r}})),h=(0,u.useMemo)((()=>yD(f(o))),[f,o]),b=s?"italic":"normal",E=(0,u.useCallback)((async(e,n)=>{await g(t.map((e=>{let{font:t,content:r}=e;return{font:t,fontStyle:b,fontWeight:parseInt(n),content:(0,jr.stripHTML)(r)}}))),p(n)}),[b,p,g,t]);return wx((e=>{let{fontSize:t}=e;return{fontSize:(0,Xs.clamp)(t,_D)}}),[]),c.createElement(c.Fragment,null,m&&c.createElement(GI,null,c.createElement(gD,{ref:a,highlightStylesOverride:r,showDropdownLabel:!0})),c.createElement(GI,null,h&&c.createElement(c.Fragment,null,c.createElement(TD,{ariaLabel:(0,d.__)("Font weight","web-stories"),placeholder:we,options:h,selectedValue:ve===l?"":l,onMenuItemClick:E,selectButtonStylesOverride:sp}),c.createElement(vD,null)),c.createElement(wD,{"aria-label":(0,d.__)("Font size","web-stories"),isFloat:!0,value:i,onChange:(e,t)=>n({fontSize:t},!0),min:_D.MIN,max:_D.MAX,isIndeterminate:ve===i,placeholder:ve===i?we:null,containerStyleOverride:cp})))},CD=(0,p.default)(FC).attrs({inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT}).withConfig({displayName:"fontSize__Input",componentId:"sc-17k2x26-0"})(["width:50px;flex:0 0 50px;"]),ID=(0,d.__)("Font size","web-stories");const xD=function FontSize(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{fontSize:n,updateSelectedElements:r}=Qa((e=>{let{state:t,actions:n}=e;return{fontSize:t.selectedElements[0].fontSize,updateSelectedElements:n.updateSelectedElements}})),a=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_font_size"}),r({properties:t=>{const n=hv(t,e,!0),r=cD({...t,...n});return{...n,...r}}})}),[r]);return c.createElement(oT,{ref:t,inputRef:e,inputLabel:ID},c.createElement(CD,{tabIndex:-1,ref:e,"aria-label":ID,isFloat:!0,value:n,onChange:(e,t)=>a({fontSize:t}),min:_D.MIN,max:_D.MAX,placeholder:n,containerStyleOverride:cp,selectButtonStylesOverride:sp,onKeyDown:e=>{aT(e,t)}}))},AD={MIN:0,MAX:100};function kD(e){let{opacity:t}=e;return void 0!==t?t:AD.MAX}const OD=function OpacityControls(e){let{selectedElements:t,pushUpdate:n}=e;const r=HR(t,kD),a=(0,u.useCallback)(((e,t)=>n({opacity:t??100},!0)),[n]);return c.createElement(FC,{suffix:c.createElement(Ph,null),unit:(0,d._x)("%","Percentage","web-stories"),value:r,onChange:a,min:AD.MIN,max:AD.MAX,"aria-label":(0,d.__)("Opacity in percent","web-stories"),placeholder:r===ve?we:"",isIndeterminate:r===ve,containerStyleOverride:cp})},PD=(0,p.default)(FC).withConfig({displayName:"layerOpacity__Input",componentId:"sc-1pptz1t-0"})(["width:82px;flex:0 0 82px;"]),ND=(0,d.__)("Opacity in percent","web-stories");const MD=function LayerOpacity(){const e=(0,u.useRef)(),t=(0,u.useRef)(),{opacity:n,type:r}=IL(["opacity","type"]),a=Qa((e=>e.actions.updateSelectedElements));return c.createElement(oT,{ref:t,inputRef:e,inputLabel:ND},c.createElement(PD,{ref:e,tabIndex:-1,suffix:c.createElement(Ph,null),unit:(0,d._x)("%","Percentage","web-stories"),value:n||0,"aria-label":ND,onChange:(e,t)=>{a({properties:()=>({opacity:t??100})}),(0,P.trackEvent)("floating_menu",{name:"set_opacity",element:r})},inputClassName:tT.CONTEXT_MENU_SKIP_ELEMENT,onKeyDown:e=>{aT(e,t)},min:AD.MIN,max:AD.MAX}))},RD=(0,p.default)(xM).withConfig({displayName:"loop__StyledLoopContent",componentId:"sc-154lze5-0"})(["gap:8px;"]);const LD=function Loop(){const{loop:e}=IL(["loop"]),t=Qa((e=>e.actions.updateSelectedElements));return c.createElement(RD,{tabIndex:-1,loop:e,onChange:()=>{(0,P.trackEvent)("floating_menu",{name:"set_loop"}),t({properties:e=>{let{loop:t}=e;return{loop:!t}}})}})};const DD=function More(){const e=cm((e=>{let{setHighlights:t}=e;return t})),t=Qa((e=>{let{state:t}=e;return t.selectedElements[0].type}));return c.createElement(CL,{text:(0,d._x)("More","Link to more options in design panel for selected element","web-stories"),onClick:()=>{e({highlight:hg.STYLE_PANE}),(0,P.trackEvent)("floating_menu",{name:"click_more_button",element:t})}})},BD=(0,u.createContext)({state:{},actions:{}});const FD=function(e){return(0,u.useContextSelector)(BD,e??u.identity)};const HD=function(e){let{resource:t,elementId:n,isSingleElement:r=!0}=e;const{isTranscodingEnabled:a}=lo(),{muteExistingVideo:o,isElementTrimming:i,isNewResourceMuting:l,canTranscodeResource:s}=Bl((e=>{let{state:{canTranscodeResource:t,isNewResourceMuting:n,isElementTrimming:r},actions:{muteExistingVideo:a}}=e;return{canTranscodeResource:t,isNewResourceMuting:n,isElementTrimming:r,muteExistingVideo:a}})),{isMuted:c,id:d=0}=t,p=!!r&&i(n),m=l(d),g=(0,u.useCallback)((()=>{o({resource:t})}),[t,o]),f=!s(t),h=a&&r&&(!c&&s(t)||m),{hasTrimMode:b,toggleTrimMode:E}=FD((e=>{let{state:{hasTrimMode:t},actions:{toggleTrimMode:n}}=e;return{hasTrimMode:t,toggleTrimMode:n}}));return{state:{canTrim:b,canMute:h,isTrimming:p,isMuting:m,isDisabled:f},actions:{handleMute:g,handleTrim:E}}};const UD=function Mute(){const{id:e,resource:t}=IL(["id","resource"]),{state:{canMute:n,isMuting:r,isDisabled:a},actions:{handleMute:o}}=HD({elementId:e,resource:t});if(!n)return null;const i=r?(0,d.__)("Removing audio","web-stories"):(0,d.__)("Remove audio","web-stories");return c.createElement(yL,{Icon:ty,title:i,disabled:a||r,onClick:e=>{(0,P.trackEvent)("floating_menu",{name:"set_mute"}),o(e)}})};const jD=function ShapeColor(){const{backgroundColor:e,updateSelectedElements:t}=Qa((e=>{let{state:t,actions:n}=e;return{backgroundColor:t.selectedElements[0].backgroundColor,updateSelectedElements:n.updateSelectedElements}})),n=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_shape_color",element:"shape"}),t({properties:()=>({backgroundColor:e})})}),[t]);return c.createElement(cL,{tabIndex:-1,label:(0,d.__)("Shape color","web-stories"),value:e,allowsSavedColors:!0,onChange:n,hasInputs:!0,hasEyedropper:!0,allowsOpacity:!0,allowsGradient:!0,opacityFocusTrap:!0,colorFocusTrap:!0})},zD=p.default.div.withConfig({displayName:"textAlign__SubMenuContainer",componentId:"sc-1i0z5qr-0"})(["position:absolute;top:calc(var(--height) + ","px);z-index:9999;"],3),GD=(0,p.default)(gL.default).withConfig({displayName:"textAlign__StyledMenuButton",componentId:"sc-1i0z5qr-1"})(["flex:0 0 60px;height:36px;border:1px solid ",";padding:2px 0;border-radius:4px;"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal})),YD=(0,p.default)(mL).withConfig({displayName:"textAlign__StyledMenuIcon",componentId:"sc-1i0z5qr-2"})(["width:auto;display:flex;overflow:hidden;svg{width:32px;}svg:last-child{margin-left:-8px;}"]),ZD=[{value:"left",icon:Qg,label:(0,d.__)("Align text left","web-stories")},{value:"center",icon:Wg,label:(0,d.__)("Align text center","web-stories")},{value:"right",icon:tf,label:(0,d.__)("Align text right","web-stories")},{value:"justify",icon:qg,label:(0,d.__)("Align text justified","web-stories")}];const WD=function TextAlign(){const{textAlign:e="left"}=IL(["textAlign"]),t=Qa((e=>e.actions.updateSelectedElements)),[n,r]=(0,u.useState)(!1),a=(0,u.useRef)(),o=(0,u.useRef)(),[i,l]=(0,u.useState)(0);(0,u.useEffect)((()=>l(o.current.parentNode.offsetLeft+-8)),[]);const s=e=>{e&&setTimeout((()=>e.focus()))},{icon:p,label:m}=ZD.find((t=>{let{value:n}=t;return n===e}))||ZD[0],g=e=>()=>{(0,P.trackEvent)("floating_menu",{name:`set_text_alignment_${e}`,element:"text"}),t({properties:{textAlign:e}})},f=()=>{r(!1),o.current.focus()},h=(0,d.__)("Change text alignment","web-stories"),b=n?"":h;return(0,Cr.useKeyDownEffect)(o,"down",(()=>r(!0)),[]),c.createElement(c.Fragment,null,c.createElement(Tooltip,{placement:Gd.PLACEMENT.BOTTOM,title:b},c.createElement(GD,{tabIndex:-1,ref:o,onClick:()=>r((e=>!e)),"aria-haspopup":"menu","aria-expanded":n,"aria-label":h},c.createElement(YD,{title:b},c.createElement(p,{role:"img","aria-label":m}),c.createElement(Fp.Disclosure,{style:{marginLeft:-8,marginRight:0},isOpen:n})))),c.createElement(zD,{ref:a,style:{left:`${i}px`}},c.createElement(qR.default,{onDismiss:f,isOpen:n,onCloseSubMenu:f,"aria-label":(0,d.__)("Text alignment options","web-stories"),isSubMenu:!0,isSecondary:!0,parentMenuRef:o,isHorizontal:!0},ZD.map((t=>{let{value:n,icon:r,label:a}=t;return c.createElement(yL,{isToggled:n===e,ref:n===e?s:null,key:n,Icon:r,title:a,onClick:g(n)})})))))};const VD=function TextColor(){const{content:e}=IL(["content"]),t=Qa((e=>e.actions.updateSelectedElements)),n=(0,u.useCallback)((e=>{(0,P.trackEvent)("floating_menu",{name:"set_text_color",element:"text"}),t({properties:t=>hv(t,e,!0)})}),[t]),{textInfo:{color:r},handlers:{handleSetColor:a}}=AL([{content:e,type:"text"}],n);return c.createElement(cL,{tabIndex:-1,label:(0,d.__)("Text color","web-stories"),value:r,allowsSavedColors:!0,onChange:a,hasInputs:!1,hasEyedropper:!0,allowsOpacity:!0,allowsGradient:!1})};const $D=function ToggleBold(){const{isToggled:e,toggle:t}=kL({currentValue:"isBold",handler:"handleClickBold",eventName:"set_bold"});return c.createElement(yL,{isToggled:e,Icon:zb,title:(0,d.__)("Toggle bold","web-stories"),onClick:t,tabIndex:-1})};const qD=function ToggleItalics(){const{isToggled:e,toggle:t}=kL({currentValue:"isItalic",handler:"handleClickItalic",eventName:"set_italic"});return c.createElement(yL,{isToggled:e,Icon:Zb,title:(0,d.__)("Toggle italic","web-stories"),onClick:t,tabIndex:-1})};const KD=function ToggleUnderline(){const{isToggled:e,toggle:t}=kL({currentValue:"isUnderline",handler:"handleClickUnderline",eventName:"set_underline"});return c.createElement(yL,{isToggled:e,Icon:bE,title:(0,d.__)("Toggle underline","web-stories"),onClick:t,tabIndex:-1})};const XD=function Trim(){const{id:e,resource:t}=IL(["id","resource"]),{state:{canTrim:n,isTrimming:r,isDisabled:a},actions:{handleTrim:o}}=HD({elementId:e,resource:t});if(!n)return null;const i=r?(0,d.__)("Trimming video","web-stories"):(0,d.__)("Trim video","web-stories");return c.createElement(yL,{Icon:x_,title:i,disabled:a||r,onClick:e=>{(0,P.trackEvent)("floating_menu",{name:"set_trim"}),o(e)}})};const QD=function Trash(e){let{title:t,handleRemove:n}=e;return c.createElement(yL,{Icon:ev.default,title:t,onClick:n})},JD=(0,u.memo)((function FloatingImageMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),eB=(0,u.memo)((function FloatingMultipleMenu(){return c.createElement(c.Fragment,null,c.createElement(aD,null),c.createElement(wL,null),c.createElement(XL,{isMultiple:!0}))})),tB=(0,u.memo)((function FloatingShapeMenu(){return c.createElement(c.Fragment,null,c.createElement(jD,null),c.createElement(wL,null),c.createElement(KL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),nB=(0,u.memo)((function FloatingStickerMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),rB=(0,u.memo)((function FloatingTextMenu(){return c.createElement(c.Fragment,null,c.createElement(ED,null),c.createElement(xD,null),c.createElement(WD,null),c.createElement($D,null),c.createElement(qD,null),c.createElement(KD,null),c.createElement(wL,null),c.createElement(VD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))})),aB=(0,u.memo)((function FloatingVideoMenu(){return c.createElement(c.Fragment,null,c.createElement(MD,null),c.createElement(wL,null),c.createElement(iD,null),c.createElement(lD,null),c.createElement(wL,null),c.createElement(LL,null),c.createElement(wL,null),c.createElement(LD,null),c.createElement(XD,null),c.createElement(UD,null),c.createElement(wL,null),c.createElement(DD,null),c.createElement(wL,null),c.createElement(XL,null))}));function oB(){return oB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oB.apply(this,arguments)}const iB=function ProductDropdown(e){let{product:t,setProduct:n,...r}=e;const a=(0,u.useMemo)((()=>[{id:t?.productId,name:t?.productTitle,product:t}]),[t]),[o,i]=(0,u.useState)(!1),[l,s]=(0,u.useState)(a),{actions:{getProducts:p}}=W(),{isSaving:m,currentPageProductIds:g}=Qa((e=>{let{state:{meta:{isSaving:n},currentPage:r}}=e;return{isSaving:n,currentPageProductIds:r?.elements?.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).filter((e=>{let{product:n}=e;return n.productId!==t.productId})).map((e=>{let{product:t}=e;return t?.productId}))}})),f=(0,u.useCallback)((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{products:t}=await p(e);return t.filter((e=>e.productImages.length&&!g.includes(e.productId))).map((e=>({name:e.productTitle,id:e.productId,product:e})))}),[g,p]);(0,u.useEffect)((()=>{(async()=>{try{i(!0);const e=await f();s(e)}catch(e){s(a)}finally{i(!1)}})()}),[a]);const h={hasSearch:!0,lightMode:!0,onChange:e=>{let{product:t}=e;return n(t)},getOptionsByQuery:f,selectedId:t?.productId,dropDownLabel:(0,d.__)("Product","web-stories"),disabled:m,primaryOptions:o?a:l,zIndex:10};return c.createElement(GR.default.DropDown,oB({options:l,searchResultsLabel:(0,d.__)("Search results","web-stories"),"aria-label":(0,d.__)("Product","web-stories")},h,r))},lB=(0,p.default)(iB).withConfig({displayName:"product__StyledDropDown",componentId:"sc-6kpcrl-0"})(["width:240px;"]),sB=(0,u.memo)((function FloatingProductMenu(){const{selectedElement:e,updateSelectedElements:t,deleteSelectedElements:n}=Qa((e=>{let{actions:t,state:n}=e;return{updateSelectedElements:t.updateSelectedElements,selectedElement:n.selectedElements[0],deleteSelectedElements:t.deleteSelectedElements}})),{shoppingProvider:r}=U(),a="none"!==r,o=(0,u.useCallback)((e=>t({properties:{product:e}})),[t]);return c.createElement(c.Fragment,null,a&&c.createElement(c.Fragment,null,c.createElement(lB,{product:e?.product,setProduct:o}),c.createElement(wL,null)),c.createElement(QD,{title:(0,d.__)("Remove product","web-stories"),handleRemove:n}),c.createElement(XL,null))})),cB=sB,dB=(0,u.memo)((function FloatingMenuSelector(e){let{selectedElementType:t}=e;switch(t){case $R.MULTIPLE:return c.createElement(eB,null);case $R.GIF:case $R.IMAGE:return c.createElement(JD,null);case $R.SHAPE:return c.createElement(tB,null);case $R.STICKER:return c.createElement(nB,null);case $R.TEXT:return c.createElement(rB,null);case $R.VIDEO:return c.createElement(aB,null);case $R.PRODUCT:return c.createElement(cB,null);default:return null}})),uB=(0,d.__)("To exit the floating menu, press Escape.","web-stories"),pB=p.default.section.withConfig({displayName:"menu__MenuWrapper",componentId:"sc-pi2qzl-0"})(["display:flex;position:absolute;z-index:",";visibility:",";transition:140ms opacity;"],4,(e=>{let{visuallyHidden:t}=e;return t?"hidden":"visible"})),mB=(0,u.memo)((0,u.forwardRef)((function FloatingMenu(e,t){let{selectionIdentifier:n,selectedElementType:r,handleDismiss:a,visuallyHidden:o}=e;const i=tL(rL.EDIT_ELEMENT),l=(0,Tv.default)(),s=(0,u.useCallback)((()=>{l(uB)}),[l]);return(0,u.useLayoutEffect)((()=>{const e=t.current,n=()=>{e.style.width="";const t=e.getBoundingClientRect();e.style.setProperty("--width",`${t.width.toFixed(2)}px`),e.style.setProperty("--height",`${t.height.toFixed(2)}px`),e.style.width="var(--width)"};n();const r=new MutationObserver(n),a=e.querySelector("[role=menu]");return r.observe(a,{childList:!0}),()=>r.disconnect()}),[t,n]),c.createElement(pB,{ref:t,"aria-label":(0,d.__)("Design menu","web-stories"),visuallyHidden:o},c.createElement(iL,{handleDismiss:a},c.createElement(qR.default,{isInline:!0,isHorizontal:!0,isSecondary:!0,isAlwaysVisible:!0,tabIndex:-1,ref:i,dismissOnEscape:!1,onFocus:s,"aria-label":(0,d.__)("Design options for selected element","web-stories"),onMouseDown:e=>{e.stopPropagation()},popoverZIndex:4},c.createElement(dB,{selectedElementType:r}))))}))),gB=mB;const fB=function FloatingMenuLayer(){const{setMoveableMount:e,isEyedropperActive:t}=$s((e=>{let{actions:t,state:n}=e;return{setMoveableMount:t.setMoveableMount,isEyedropperActive:n.isEyedropperActive}})),{workspaceWidth:n,workspaceHeight:r}=cs((e=>{let{state:{workspaceWidth:t,workspaceHeight:n}}=e;return{workspaceWidth:t,workspaceHeight:n}})),{selectedElementType:a,selectionIdentifier:o}=Qa((e=>{let{state:{selectedElements:t}}=e;return{selectedElementType:1!==t.length||t[0].isBackground?t.length>1?$R.MULTIPLE:$R.NONE:t[0]?.type,selectionIdentifier:t.map((e=>{let{id:t}=e;return t})).join("")}})),i=(0,I.useTransform)((e=>{let{state:t}=e;return t.isAnythingTransforming})),[l,s]=(0,u.useState)(null),d=(0,u.useRef)(),p=(0,u.useRef)(),[m,g]=(0,u.useState)(!1),f=(0,u.useCallback)((()=>g(!0)),[]);(0,u.useEffect)((()=>g(!1)),[o]),(0,u.useEffect)((()=>(e((()=>s)),()=>e(null))),[e]),(0,u.useEffect)((()=>{g(!!t)}),[t]),(0,u.useEffect)((()=>{p.current={width:n,height:r}}),[n,r]);const h=function(e){switch(e){case $R.MULTIPLE:return!0;case $R.NONE:return!1;default:return(0,Mn.getDefinitionForType)(e)?.hasDesignMenu}}(a)&&!m&&l;return(0,u.useEffect)((()=>{const e=d.current;if(!e||!l)return;const t=()=>{const t=l.getRect(),{width:n,height:r}=p.current,a=t.left+t.width/2;e.style.left=`clamp(0px, ${a}px - (var(--width) / 2), ${n}px - var(--width))`;const o=t.top+t.height+10;e.style.top=`clamp(0px, ${o}px, ${r}px - var(--height))`};t();const n=new MutationObserver(t),r=document.querySelector(".moveable-control-box");return n.observe(r,{attributes:!0,subtree:!0,attributeFilter:["style"]}),()=>n.disconnect()}),[l,h]),!!h&&c.createElement(gB,{ref:d,handleDismiss:f,selectedElementType:a,selectionIdentifier:o,visuallyHidden:i})};const hB=async function(e,t,n,r){const{width:a,height:o,scale:i,focalX:l,focalY:s,flip:c}=e,{src:d,length:u}=t,p=r,m=p/o*a,g=Math.ceil(n/m),f=n/g,h=f/m*a,{width:b,height:E,offsetX:y,offsetY:_}=(0,kO.default)(t,h,o,i,c?.horizontal?100-l:l,c?.vertical?100-s:s),v=u/(g-1),w=await re(d);w.width=b,w.height=E,await le(w,1e-6);const T=document.createElement("canvas");T.width=n,T.height=r;const S=T.getContext("2d");let C=0,I=0;const x=async()=>{await le(w,C);const e=I*f;return(c.vertical||c.horizontal)&&(S.translate(e+f/2,p/2),S.scale(c.horizontal?-1:1,c.vertical?-1:1),S.translate(-(e+f/2),-p/2)),S.drawImage(w,y,_,h,o,e,0,f,p),S.setTransform(1,0,0,1,0,0),I+=1,I===g?Promise.resolve():(C+=v,x())};return x().then((()=>T.toDataURL()))};const bB=function(e,t,n){const[r,a]=(0,u.useState)(null);return(0,u.useEffect)((()=>{if(!e)return;const{element:r,resource:o}=t;hB(r,o,n,36).then(a)}),[e,t,n]),r};function EB(){return EB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EB.apply(this,arguments)}const yB=p.default.button.withConfig({displayName:"slider__Thumb",componentId:"sc-50zvue-0"})(["position:absolute;padding:0;"]);function _B(e){return e.pageX||e.clientX}const vB=function Slider(e){let{railWidth:t,min:n,max:r,step:a,minorStep:o=null,value:i=0,onChange:l=(()=>{}),getValueText:s=null,onPointerDown:d=(()=>{}),onNudge:p=(()=>{}),...m}=e;const g=(0,u.useRef)(),f=(0,u.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),g.current.focus(),d?.();const a=function(a){const o=_B(a)-_B(e);l(i+o/t*(r-n)),a.preventDefault(),a.stopPropagation()},o=function(){document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",o)};return document.addEventListener("pointermove",a),document.addEventListener("pointerup",o),o}),[i,r,n,l,t,d]),h=(0,u.useCallback)((e=>{l(i+e),p?.()}),[l,p,i]);(0,Cr.useKeyDownEffect)(g,"left",(()=>h(-a)),[h,a]),(0,Cr.useKeyDownEffect)(g,"shift+left",(()=>h(-o)),[h,o]),(0,Cr.useKeyDownEffect)(g,"right",(()=>h(a)),[h,a]),(0,Cr.useKeyDownEffect)(g,"shift+right",(()=>h(o)),[h,o]);const b={left:`${((i-n)/(r-n)*t).toFixed(2)}px`};return c.createElement(yB,EB({ref:g,onPointerDown:f,style:b,role:"slider","aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":i,"aria-valuetext":s?.(i)},m))};function wB(){return wB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wB.apply(this,arguments)}const TB=(0,p.default)(vB).withConfig({displayName:"currentTime__StyledSlider",componentId:"sc-tf91kz-0"})(["top:-3px;bottom:-3px;width:6px;margin-left:-3px;border-radius:6px;border-width:0;background-color:",";box-shadow:0px 1px 2px rgba(60,64,67,0.3),0px 1px 3px 1px rgba(60,64,67,0.15);"],(e=>{let{theme:t}=e;return t.colors.interactiveBg.primaryNormal}));const SB=function CurrentTime(e){const t=FD((e=>{let{state:{currentTime:t}}=e;return t}));return c.createElement(TB,wB({"aria-label":(0,d.__)("Current time","web-stories"),value:t,disabled:!0},e))},CB=p.default.aside.withConfig({displayName:"trimmerComponents__Menu",componentId:"sc-1vmlktu-0"})(["display:flex;justify-content:center;align-items:flex-start;height:","px;gap:14px;"],40),IB=p.default.div.withConfig({displayName:"trimmerComponents__RailWrapper",componentId:"sc-1vmlktu-1"})(["display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-end;"]),xB=p.default.div.withConfig({displayName:"trimmerComponents__Rail",componentId:"sc-1vmlktu-2"})(["position:relative;width:","px;height:","px;border-radius:4px;border:1px solid ",";background-color:",";"],(e=>{let{width:t}=e;return t}),36,(e=>{let{theme:t}=e;return t.colors.standard.white}),(e=>{let{theme:t}=e;return t.colors.standard.white}));function Duration(e){let{children:t}=e;return c.createElement($e.Text,{as:"span",size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.X_SMALL},t)}const AB=(0,p.default)(vB).withConfig({displayName:"trimmerComponents__Handle",componentId:"sc-1vmlktu-3"})(["top:6px;bottom:6px;width:6px;margin-left:-3px;border-radius:6px;background-color:",";border:1px solid ",";box-shadow:0px 1px 2px rgba(60,64,67,0.3),0px 1px 3px 1px rgba(60,64,67,0.15);cursor:col-resize;&:focus{border-color:",";}&.focus-visible{outline:none !important;}"],(e=>{let{theme:t}=e;return t.colors.bg.primary}),(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}),(e=>{let{theme:t}=e;return t.colors.border.focus})),kB=p.default.svg.withConfig({displayName:"trimmerComponents__SVG",componentId:"sc-1vmlktu-4"})(["position:absolute;top:-1px;"]),OB=p.default.div.withConfig({displayName:"trimmerComponents__ButtonWrapper",componentId:"sc-1vmlktu-5"})(["flex-grow:1;flex-basis:100px;display:flex;justify-content:",";"],(e=>{let{isStart:t}=e;return t?"flex-end":"flex-start"}));function PB(e){let{width:t,isLeftAligned:n=!1}=e;const r=n?{left:"-1px"}:{right:"-1px"},a=n?`M 4 0 h ${t} a 4 4 0 0 0 -4 4 v 28 a 4 4 0 0 0 4 4 h -${t} a 4 4 0 0 1 -4 -4 v -28 a 4 4 0 0 1 4 -4 Z`:`M 0 0 h ${t} a 4 4 0 0 1 4 4 v 28 a 4 4 0 0 1 -4 4 h -${t} a 4 4 0 0 0 4 -4 v -28 a 4 4 0 0 0 -4 -4 Z`;return c.createElement(kB,{style:{width:`${t+4}px`,...r},viewBox:`0 0 ${t+4} 36`},c.createElement("path",{stroke:"transparent",fill:"black",fillOpacity:"0.5",d:a}))}function NB(){return NB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},NB.apply(this,arguments)}const MB=function VideoTrimmer(){const{startOffset:e,endOffset:t,maxOffset:n,setStartOffset:r,setEndOffset:a,hasChanged:o,performTrim:i,setIsDraggingHandles:l,toggleTrimMode:s,videoData:p}=FD((e=>{let{state:{startOffset:t,endOffset:n,maxOffset:r,hasChanged:a,videoData:o},actions:{setStartOffset:i,setEndOffset:l,performTrim:s,toggleTrimMode:c,setIsDraggingHandles:d}}=e;return{startOffset:t,endOffset:n,maxOffset:r,setStartOffset:i,setEndOffset:l,hasChanged:a,performTrim:s,setIsDraggingHandles:d,toggleTrimMode:c,videoData:o}})),{workspaceWidth:f,pageWidth:h}=cs((e=>{let{state:{workspaceWidth:t,pageWidth:n}}=e;return{workspaceWidth:t,pageWidth:n}})),b=(0,u.useDebouncedCallback)((()=>l(!1)),1e3),E=(0,u.useRef)(null);lT({ref:E});const y=(0,u.useCallback)((e=>{e&&e.focus()}),[]),_=Math.min(h,f-260),v=h&&n&&p,w=bB(v,p,_),T={ref:E,"aria-label":(0,d.__)("Video trimmer","web-stories")};if(!v)return c.createElement(CB,T);const S={min:0,max:n,step:100,minorStep:10,onPointerDown:()=>l(!0),onPointerUp:()=>l(!1),onNudge:()=>{l(!0),b()}};return c.createElement(CB,T,c.createElement(OB,{isStart:!0},c.createElement(m.Button,{variant:g.BUTTON_VARIANTS.RECTANGLE,type:g.BUTTON_TYPES.SECONDARY,size:g.BUTTON_SIZES.SMALL,onClick:s,ref:y},(0,d.__)("Cancel","web-stories"))),c.createElement(IB,null,c.createElement(xB,{width:_,style:{backgroundImage:w?`url(${w})`:void 0}},c.createElement(PB,{isLeftAligned:!0,width:e/n*_}),c.createElement(PB,{width:(n-t)/n*_}),c.createElement(SB,NB({railWidth:_},S)),c.createElement(AB,NB({railWidth:_,value:e,"aria-label":(0,d.__)("Start offset","web-stories"),onChange:e=>r(e)},S)),c.createElement(AB,NB({railWidth:_,value:t,"aria-label":(0,d.__)("End offset","web-stories"),onChange:e=>a(e)},S))),c.createElement(Duration,null,oe(Math.ceil((t-e)/1e3)))),c.createElement(OB,null,c.createElement(m.Button,{variant:g.BUTTON_VARIANTS.RECTANGLE,type:g.BUTTON_TYPES.PRIMARY,size:g.BUTTON_SIZES.SMALL,onClick:i,disabled:!o},(0,d.__)("Trim","web-stories"))))};function RB(){return RB=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RB.apply(this,arguments)}const LB={FLOAT_PANEL:11},DB=p.default.div.withConfig({displayName:"editElement__Wrapper",componentId:"sc-1w8k2uc-0"})([""," "," "," pointer-events:initial;"],$n.elementWithPosition,$n.elementWithSize,$n.elementWithRotation),BB=(0,u.memo)((0,u.forwardRef)((function EditElement(e,t){let{element:n,editWrapper:r,onResize:a}=e;const{id:o,type:i}=n,{getBox:l}=(0,Rc.default)((e=>({getBox:e.actions.getBox}))),{getProxiedUrl:s}=Jo(),{isRTL:d,styleConstants:{topOffset:p}={}}=U(),{actions:{maybeEnqueueFontStyle:m}}=Uo(),{updateElementById:g,deleteSelectedElements:f}=Qa((e=>({updateElementById:e.actions.updateElementById,deleteSelectedElements:e.actions.deleteSelectedElements}))),{isTrimMode:h,resource:b,setVideoNode:E}=FD((e=>{let{state:{isTrimMode:t,videoData:n},actions:{setVideoNode:r}}=e;return{isTrimMode:t,setVideoNode:r,resource:n?.resource}})),[y,_]=(0,u.useState)(null),{Edit:v}=(0,Mn.getDefinitionForType)(i),w=y?{...n,...y}:n,T=l(w);return c.createElement(DB,RB({"aria-labelledby":`layer-${o}`},T,{ref:t}),c.createElement(v,{element:w,box:T,editWrapper:r,onResize:a,setLocalProperties:_,getProxiedUrl:s,isRTL:d,topOffset:p,isTrimMode:h,resource:b,setVideoNode:E,updateElementById:g,deleteSelectedElements:f,maybeEnqueueFontStyle:m,zIndexCanvas:LB}))}))),FB=BB;var HB=n(94184),UB=n.n(HB);const jB=function(e){let{canSnap:t,otherNodes:n,snappingOffsetX:r=null,isDragging:a}=e;const o=Ks(Zs),i=Ks(Ws),l=$s((e=>{let{state:t}=e;return t.designSpaceGuideline})),{pageWidth:s,pageHeight:c}=cs((e=>{let{state:{pageWidth:t,pageHeight:n}}=e;return{pageWidth:t,pageHeight:n}})),{activeDropTargetId:d,isDropTargetingDisabled:p}=rs((e=>{let{state:t}=e;return{activeDropTargetId:t.activeDropTargetId,isDropTargetingDisabled:t.isDropTargetingDisabled}})),m=function(e){const t=e(Sc),{openToUnreadTip:n=Dt}=Tc((e=>{let{actions:t}=e;return{openToUnreadTip:t.openToUnreadTip}})),r=(0,u.useDebouncedCallback)(n,300);return(0,u.useCallback)((()=>{t===Sc.SAFE_ZONE&&r(nc)}),[t,r])}((e=>{let{SAFE_ZONE:t}=e;return t}));t=t&&!p&&!d;const g=(0,u.useCallback)((e=>{let{elements:t}=e;const n=t.flat().some((e=>{let{center:t,element:n}=e;return n===l&&!t}));a&&n&&m()}),[a,l,m]);if(!o||!i)return{};const f=r||o.x,h=Math.ceil(i.x-f),b=Math.floor(i.y-o.y),E=t?[h,h+s/2,h+s]:[],y=(s/ee.FULLBLEED_RATIO-c)/2,_={left:!0,top:!0,right:!0,bottom:!0,center:!0,middle:!0};return{snappable:t,snapGap:t,snapDirections:_,elementSnapDirections:_,isDisplaySnapDigit:!1,onSnap:g,horizontalGuidelines:t?[b-y,b,b+c/2,b+c,b+c+y]:[],verticalGuidelines:E,elementGuidelines:t?[...n,l]:[]}};const zB=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,u.useEffect)((()=>{let t=!0;const n=()=>{t&&e.current?.updateRect?.()};n();const r=setTimeout(n);return()=>{t=!1,clearTimeout(r)}}),t)};const GB=function(e){(0,u.useEffect)((()=>{const t=()=>e.current?.updateRect();return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}}),[e])};const YB=function(e,t){const{left:n,right:r,top:a,bottom:o}=e.getBoundingClientRect(),i=t.getBoundingClientRect();return n>i.right||r<i.left||o<i.top||a>i.bottom};const ZB=function(){const{deleteSelectedElements:e}=Qa((e=>({deleteSelectedElements:e.actions.deleteSelectedElements}))),{clearTransforms:t}=(0,I.useTransform)((e=>({clearTransforms:e.actions.clearTransforms}))),{fullbleedContainer:n}=$s((e=>{let{state:{fullbleedContainer:t}}=e;return{fullbleedContainer:t}}));return{handleElementOutOfCanvas:r=>!!YB(r,n)&&(e(),t(),!0)}};const WB=function(){const e=$s((e=>{let{state:{nodesById:t}}=e;return t})),t=Qa((e=>{let{state:t}=e;return t.currentPage?.elements?.find((e=>{let{isBackground:t}=e;return t}))})),n=(0,Rc.default)((e=>{let{actions:{getBox:t}}=e;return t})),r=e[t.id],{x:a,y:o,width:i,height:l}=r.getBoundingClientRect(),s=new(os().Box)(new(os().Vector)(a,o),i,l).toPolygon(),c=-n(t).y;return t=>{if(t.isBackground)return s;const{id:r,rotationAngle:a}=t;if(!e[r])return null;const o=n(t),i=new(os().Vector)(s.pos.x+o.x+o.width/2,s.pos.y+c+o.y+o.height/2),l=new(os().Box)(i,o.width,o.height).toPolygon(),d=new(os().Vector)(-o.width/2,-o.height/2);return l.setOffset(d),l.setAngle(a*Math.PI/180),l}};const VB=function(){const[e,t]=(0,u.useState)(Wo.getItemByKey(Zo.BACKGROUND_IS_SET_DIALOG_DISMISSED)),{setBackgroundElement:n,isDefaultBackground:r}=Qa((e=>({setBackgroundElement:e.actions.setBackgroundElement,isDefaultBackground:e.state.currentPage?.elements[0]?.isDefaultBackground}))),{fullbleedContainer:a}=$s((e=>{let{state:{fullbleedContainer:t}}=e;return{fullbleedContainer:t}})),{showSnackbar:o}=(0,Ur.useSnackbar)(),i=WB();return{handleFullbleedMediaAsBackground:l=>{if(r&&Mn.MEDIA_ELEMENT_TYPES.includes(l.type)){const r=i(l),s=a.getBoundingClientRect(),c=new(os().Box)(new(os().Vector)(s.x+2,s.y+2),s.width-4,s.height-4).toPolygon(),u=new(os().Response);os().testPolygonPolygon(r,c,u),u.bInA&&n({elementId:l.id}),e||(o({message:(0,d.__)("Full bleed images and videos are automatically set as background. Double click to scale and position at any time.","web-stories"),dismissible:!0}),Wo.setItemByKey(Zo.BACKGROUND_IS_SET_DIALOG_DISMISSED,!0),t(!0))}}}};const $B=function(e){let{setIsDragging:t,resetMoveable:n,selectedElement:r,setTransformStyle:a,frame:o}=e;const{isDropSource:i,handleDrag:l,handleDrop:s,setDraggingResource:c}=rs((e=>{let{actions:{handleDrag:t,handleDrop:n,isDropSource:r,setDraggingResource:a}}=e;return{handleDrag:t,handleDrop:n,setDraggingResource:a,isDropSource:r}})),{handleElementOutOfCanvas:d}=ZB(),{handleFullbleedMediaAsBackground:p}=VB(),{updateSelectedElements:m}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{editorToDataX:g,editorToDataY:f}=(0,Rc.default)((e=>{let{actions:{editorToDataX:t,editorToDataY:n}}=e;return{editorToDataX:t,editorToDataY:n}})),h=(0,u.useBatchingCallback)((e=>{t(!1),c(null),n(e)}),[t,c,n]);return{onDrag:e=>{let{target:n,beforeTranslate:s,clientX:d,clientY:u}=e;t(!0),i(r.type)&&c(r.resource),o.translate=s,a(n,o),i(r.type)&&l(r.resource,d,u,r.id)},throttleDrag:0,onDragStart:e=>{let{set:t}=e;t(o.translate)},onDragEnd:e=>{let{target:n,isDrag:a}=e;if(!a)return!1;if(d(n))return t(!1),void c(null);const l=e=>Math.abs(e)<=1?0:e,[u,b]=o.translate;let E={};0===u&&0===b||(E={x:l(r.x+g(u)),y:l(r.y+f(b))},m({properties:E}),i(r.type)&&s(r.resource,r.id)),h(n),p({...r,...E})}}},qB=[],KB=["n","s"],XB=["e","w"],QB=["nw","ne","sw","se"];function JB(e){let{vertical:t,horizontal:n,diagonal:r}=e;return[...t?KB:qB,...n?XB:qB,...r?QB:qB]}const eF=function(e){let{resetMoveable:t,selectedElement:n,setTransformStyle:r,frame:a,isEditMode:o,pushTransform:i,classNames:l,forceLockRatio:s}=e;const{updateSelectedElements:c}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{handleElementOutOfCanvas:d}=ZB(),{handleFullbleedMediaAsBackground:p}=VB(),{editorToDataX:m,editorToDataY:g,dataToEditorY:f,dataToEditorX:h}=(0,Rc.default)((e=>{let{actions:{editorToDataX:t,editorToDataY:n,dataToEditorY:r,dataToEditorX:a}}=e;return{editorToDataX:t,editorToDataY:n,dataToEditorY:r,dataToEditorX:a}})),{lockAspectRatio:b,type:E}=n,y="text"===E,[_,v]=(0,u.useState)(!0),w=!y&&(s||b)||y&&_,{resizeRules:T,updateForResizeEvent:S}=(0,Mn.getDefinitionForType)(E),C=h(T.minWidth),I=f(T.minHeight),x=n.width/n.height,A=n.width<=T.minWidth||n.height<=T.minHeight;return{onResize:e=>{let{target:t,direction:o,width:i,height:l,drag:s}=e,c=i,d=l,u=null;w?(c<C&&(c=C,d=c/x),d<I&&(d=I,c=I*x)):(d=Math.max(d,I),c=Math.max(c,C)),S&&(u=S(n,o,m(c,!1),g(d,!1))),u&&u.height&&(d=f(u.height)),u&&u.marginOffset&&(t.querySelector(".syncMargin").style.margin=-f(u.marginOffset)/2+"px 0"),t.style.width=`${c}px`,t.style.height=`${d}px`,a.direction=o,a.resize=[c,d],a.translate=s.beforeTranslate,a.updates=u,r(t,a)},onResizeStart:e=>{let{setOrigin:t,dragStart:r,direction:l}=e;t(["%","%"]),r&&r.set(a.translate);const s=0!==l[0]&&0!==l[1];_!==s&&y&&v(s),o&&i(n.id,a)},onResizeEnd:e=>{let{target:r}=e;if(d(r))return;const[o,i]=a.resize;let l={};if(0!==o&&0!==i){const{direction:e}=a,[t,r]=a.translate,s=m(o),d=g(i);l={width:s,height:d,x:n.x+m(t),y:n.y+g(r)},S&&Object.assign(l,S(n,e,s,d)),c({properties:l})}v(!0),t(r),p({...n,...l})},keepRatio:w,renderDirections:JB(T),className:UB()(l,{"visually-hide-handles":A})}};const utils_normalizeRotationDegrees=function(e){return(e%360+360)%360};const tF=function(e){let{selectedElement:t,isEditMode:n,pushTransform:r,frame:a,setTransformStyle:o,resetMoveable:i,throttleRotation:l}=e;const{updateSelectedElements:s}=Qa((e=>({updateSelectedElements:e.actions.updateSelectedElements}))),{handleElementOutOfCanvas:c}=ZB();return{throttleRotate:l?30:0,onRotate:e=>{let{target:t,beforeRotate:n}=e;a.rotate=utils_normalizeRotationDegrees(n),o(t,a)},onRotateEnd:e=>{let{target:t}=e;if(c(t))return;const n={rotationAngle:Math.round(a.rotate)};s({properties:n}),i(t)},onRotateStart:e=>{let{set:o}=e;n&&r(t.id,a),o(a.rotate)}}};function nF(){return nF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nF.apply(this,arguments)}const rF=(0,u.forwardRef)((function SingleSelectionMoveable(e,t){let{selectedElement:n,targetEl:r,pushEvent:a,isEditMode:o,...i}=e;const l=(0,u.useRef)(null),[s,d]=(0,u.useState)(!1),p=$s((e=>{let{state:t}=e;return t.nodesById})),m=(0,Rc.default)((e=>{let{actions:t}=e;return t.getBox})),g=(0,I.useTransform)((e=>{let{actions:t}=e;return t.pushTransform})),{zoomSetting:f,scrollLeft:h,scrollTop:b}=cs((e=>{let{state:t}=e;return{zoomSetting:t.zoomSetting,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}})),{isLocked:E}=n,y=!n.isBackground&&!E,_=(0,u.useRef)(),v=Qa((e=>{let{state:t}=e;return t.currentPage?.elements[0]?.id})),w=(0,Cr.useGlobalIsKeyPressed)("shift");GB(l),(0,u.useEffect)((()=>{_.current=a}),[a]),(0,u.useEffect)((()=>{l.current&&l.current.updateRect()}),[h,b]),zB(l,[f]),(0,u.useEffect)((()=>{l.current&&(_.current&&r.contains(_.current.target)&&y&&l.current.moveable.dragStart(_.current),l.current.updateRect())}),[r,l,y]),(0,u.useEffect)((()=>{l.current&&l.current.updateRect()}));const T=m(n),S=(0,u.useMemo)((()=>({translate:[0,0],rotate:T.rotationAngle,resize:[0,0],updates:null})),[T.rotationAngle]),C=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S;S.translate=t.translate,S.direction=t.direction,S.resize=t.resize,S.updates=t.updates,S.rotate=t.rotate,e.style.transform=`translate(${S.translate[0]}px, ${S.translate[1]}px) rotate(${S.rotate}deg)`,S.resize[0]&&(e.style.width=`${S.resize[0]}px`),S.resize[1]&&(e.style.height=`${S.resize[1]}px`),g(n.id,S)},A=(0,u.useBatchingCallback)((e=>{l.current&&(S.direction=[0,0],S.translate=[0,0],S.resize=[0,0],S.updates=null,g(n.id,null),e.style.transform="",e.style.width="",e.style.height="",l.current.updateRect())}),[S,g,n.id]),k=!o,O=s,P=UB()("default-moveable",{"hide-handles":O,"type-text":"text"===n.type,immoveable:E}),N=$B({setIsDragging:d,resetMoveable:A,selectedElement:n,setTransformStyle:C,frame:S}),M=o?{onDrag:()=>!1,onDragEnd:()=>!1,onDragStart:()=>!1}:N,R=eF({resetMoveable:A,selectedElement:n,setTransformStyle:C,frame:S,isEditMode:o,pushTransform:g,classNames:P,forceLockRatio:w}),L=tF({selectedElement:n,isEditMode:o,pushTransform:g,frame:S,setTransformStyle:C,resetMoveable:A,throttleRotation:w}),D=Object.values(_n(p,[n.id,v])),B=jB({otherNodes:D,canSnap:k&&y,isDragging:s}),F=y&&!O&&!0!==n.lockDimensions,H=y&&!O&&!1!==n.supportsRotation;return c.createElement(x.Moveable,nF({},i,{className:P,zIndex:0,ref:(0,u.useCombinedRefs)(l,t),target:r,edge:!0,draggable:y,resizable:F,rotatable:H},M,R,L,B,{origin:!1,pinchable:!0}))})),aF=(0,x.withOverlay)((0,p.default)(Gv).withConfig({displayName:"editLayer__LayerWithGrayout",componentId:"sc-1j9iuj3-0"})(["background-color:",";"],(e=>{let{grayout:t,theme:n}=e;return t?n.colors.opacity.overlayDark:"transparent"}))),oF=(0,x.withOverlay)(rw);function EditLayerForElement(e){let{element:t,showOverflow:n}=e;const r=(0,u.useRef)(null),a=(0,u.useRef)(null),{editModeGrayout:o}=(0,Mn.getDefinitionForType)(t.type),{isTrimMode:i}=FD((e=>{let{state:{isTrimMode:t}}=e;return{isTrimMode:t}})),{clearEditing:l,onMoveableMount:s}=$s((e=>({clearEditing:e.actions.clearEditing,onMoveableMount:e.state.onMoveableMount}))),p=ws(),[m,g]=(0,u.useState)(null);(0,Cr.useKeyDownEffect)(r,{key:"esc",editable:!0},(()=>l()),[l]),(0,u.useEffect)((()=>()=>p(!1)),[p]);const f=(0,u.useRef)(null),h=(0,u.useCallback)((e=>{f.current=e,s?.(e)}),[s]),b=(0,u.useCallback)((()=>{f.current&&f.current.updateRect()}),[]),{hasEditModeMoveable:E}=(0,Mn.getDefinitionForType)(t.type);return c.createElement(aF,{ref:r,"aria-label":(0,d._x)("Edit layer","compound noun","web-stories"),"data-testid":"editLayer",grayout:o,zIndex:3,onPointerDown:e=>{e.target!==r.current&&e.target!==a.current||l()}},c.createElement(oF,{ref:a,fullBleedContainerLabel:(0,d.__)("Fullbleed area (Edit layer)","web-stories"),isControlled:!0,showOverflow:n,overflow:n?"visible":"hidden"},c.createElement(FB,{editWrapper:E&&m,onResize:b,element:t,ref:g})),E&&m&&c.createElement(rF,{selectedElement:t,targetEl:m,isEditMode:!0,ref:h}),i&&c.createElement(nw,{showOverflow:!0},c.createElement(MB,null)))}const iF=(0,u.memo)((function EditLayer(){const{currentPage:e}=Qa((e=>({currentPage:e.state.currentPage}))),{editingElement:t,showOverflow:n=!0}=$s((e=>{let{state:{editingElement:t,editingElementState:{showOverflow:n}={}}}=e;return{editingElement:t,showOverflow:n}})),r=t&&e&&e.elements.find((e=>e.id===t));return r?c.createElement(EditLayerForElement,{element:r,showOverflow:n}):null}));const lF=function(){const{pageAttachmentContainer:e}=$s((e=>({pageAttachmentContainer:e.state.pageAttachmentContainer}))),{hasLinksInAttachmentArea:t,hasInvalidLinkSelected:n,hasPageAttachment:r,hasElementsInAttachmentArea:a}=Qa((t=>{let{state:n}=t;const r=e=>{let{link:t}=e;return t?.url?.length},a=n.currentPage.elements.filter(r),o=Boolean(n.currentPage?.pageAttachment?.url?.length);return{hasInvalidLinkSelected:Boolean(e&&o&&n.selectedElements.filter(r).some(Mn.isElementBelowLimit)),hasLinksInAttachmentArea:Boolean(e&&a.some((e=>(0,Mn.isElementBelowLimit)(e,!0)))),hasElementsInAttachmentArea:Boolean(e&&o&&n.selectedElements.some((e=>(0,Mn.isElementBelowLimit)(e,!1)))),hasPageAttachment:o}}));return{hasLinksInAttachmentArea:t,hasInvalidLinkSelected:n,isElementInAttachmentArea:(0,u.useCallback)((t=>!!e&&(!!r&&(0,Mn.isElementBelowLimit)(t,!1))),[e,r]),hasElementsInAttachmentArea:a}};var sF,cF;function dF(){return dF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dF.apply(this,arguments)}const SvgDefaultIcon=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",dF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,sF||(sF=c.createElement("path",{fillOpacity:.1,d:"M12 0c6.6 0 12 5.4 12 12s-5.4 12-12 12S0 18.6 0 12 5.4 0 12 0z"})),cF||(cF=c.createElement("path",{d:"M13.8 14.6c.1.1.2.3.2.5s-.1.3-.2.5L12.3 17c-.7.7-1.7 1.1-2.7 1.1-1 0-1.9-.4-2.7-1.1-.7-.7-1.1-1.7-1.1-2.7 0-1 .4-1.9 1.1-2.7l1.5-1.5c.2 0 .3-.1.5-.1s.3.1.5.2c.1.1.2.3.2.5s-.1.4-.2.5l-1.5 1.5c-.5.5-.7 1.1-.7 1.7 0 .6.3 1.3.7 1.7.5.5 1.1.7 1.7.7s1.3-.3 1.7-.7l1.5-1.5c.3-.3.7-.3 1 0zM17 7c-.7-.7-1.7-1.1-2.7-1.1-1 0-1.9.4-2.7 1.1l-1.5 1.5c0 .1-.1.3-.1.4 0 .2.1.3.2.5.1.1.3.2.5.2s.3-.1.5-.2l1.5-1.5c.5-.5 1.1-.7 1.7-.7.6 0 1.3.3 1.7.7.5.5.7 1.1.7 1.7 0 .6-.3 1.3-.7 1.7l-1.5 1.5c-.1.1-.2.3-.2.5s.1.3.2.5c.1.1.3.2.5.2s.3-.1.5-.2l1.5-1.5c.7-.7 1.1-1.7 1.1-2.7-.1-1-.5-1.9-1.2-2.6zm-7.9 7.2c0 .2.1.3.2.5.1.1.3.2.5.2s.4-.1.5-.2l4.5-4.5c.1-.1.2-.3.2-.5s-.1-.4-.2-.5c-.3-.2-.8-.2-1 .1l-4.5 4.5c-.1.1-.2.3-.2.4z"})))},uF=(0,c.memo)(SvgDefaultIcon);var pF;function mF(){return mF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mF.apply(this,arguments)}const SvgArrowBar=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",mF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 8","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,pF||(pF=c.createElement("path",{d:"M18 7.7c-.2 0-.5-.1-.7-.2l-7.3-4-7.3 4c-.7.4-1.6.2-2-.6-.4-.7-.1-1.6.6-2l8-4.4c.5-.2 1-.2 1.5 0l8 4.4c.7.4 1 1.3.6 2-.4.5-.9.8-1.4.8z"})))},gF=(0,c.memo)(SvgArrowBar),fF=p.default.div.withConfig({displayName:"pageAttachment__Wrapper",componentId:"sc-1bseqmx-0"})(["position:absolute;display:flex;align-items:center;justify-content:flex-end;flex-direction:column;bottom:0;height:20%;width:100%;color:",";z-index:3;"],(e=>{let{theme:t}=e;return t.colors.standard.white})),hF=p.default.div.withConfig({displayName:"pageAttachment__Guideline",componentId:"sc-1bseqmx-1"})(["mix-blend-mode:difference;position:absolute;height:1px;bottom:20%;width:100%;background-image:",";background-position:top;background-size:16px 0.5px;background-repeat:repeat-x;z-index:3;"],(e=>{let{theme:t}=e;return`linear-gradient(to right, ${t.colors.standard.black} 50%, ${t.colors.standard.white} 0%)`})),bF=(0,p.default)(gF).withConfig({displayName:"pageAttachment__ArrowBar",componentId:"sc-1bseqmx-2"})(["display:block;cursor:pointer;margin-bottom:10px;filter:drop-shadow(0px 2px 6px rgba(0,0,0,0.3));width:20px;height:8px;"]),EF=p.default.div.withConfig({displayName:"pageAttachment__OutlinkChip",componentId:"sc-1bseqmx-3"})(["height:","px;display:flex;position:relative;padding:","px ","px;margin:0 0 20px;max-width:calc(100% - 64px);border-radius:30px;place-items:center;box-shadow:0px 4px 10px rgba(0,0,0,0.15);background:",";"],(e=>{let{$factor:t}=e;return t(36)}),(e=>{let{$factor:t}=e;return t(10)}),(e=>{let{$factor:t}=e;return t(6)}),(e=>{let{bgColor:t}=e;return t})),yF=p.default.span.withConfig({displayName:"pageAttachment__TextWrapper",componentId:"sc-1bseqmx-4"})(["font-family:Roboto,sans-serif;font-size:","px;line-height:18px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-inline-start:6px;padding-inline-end:8px;height:16px;letter-spacing:0.3px;font-weight:700;max-width:210px;color:",";"],(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{fgColor:t}=e;return t})),_F=p.default.div.withConfig({displayName:"pageAttachment__Tooltip",componentId:"sc-1bseqmx-5"})(["background-color:",";color:",";width:200px;padding:8px;font-size:14px;border-radius:4px;text-align:center;"],(e=>{let{theme:t}=e;return t.colors.standard.black}),(e=>{let{theme:t}=e;return t.colors.standard.white})),vF=p.default.img.withConfig({displayName:"pageAttachment__LinkImage",componentId:"sc-1bseqmx-6"})(["height:24px;width:24px;vertical-align:middle;border-radius:50%;border:0 none;object-fit:contain;"]),wF={x:8},TF="#FFFFFF",SF="#000000";const CF=function PageAttachment(e){let{pageAttachment:t={}}=e;const{displayLinkGuidelines:n,pageAttachmentContainer:r,setPageAttachmentContainer:a}=$s((e=>({displayLinkGuidelines:e.state.displayLinkGuidelines,pageAttachmentContainer:e.state.pageAttachmentContainer,setPageAttachmentContainer:e.actions.setPageAttachmentContainer}))),{dataToEditorY:o}=(0,Rc.default)((e=>{let{actions:{dataToEditorY:t}}=e;return{dataToEditorY:t}})),{hasInvalidLinkSelected:i}=lF(),{ctaText:l,url:s,icon:u,theme:p}=t,m=p===De?SF:TF,g=p===De?TF:SF;return c.createElement(c.Fragment,null,(n||i)&&c.createElement(hF,null),c.createElement(fF,{role:"presentation",ref:a},s?.length>0&&c.createElement(c.Fragment,null,c.createElement(bF,{fill:m}),c.createElement(EF,{bgColor:m,$factor:o},u?c.createElement(vF,{src:u,alt:(0,d.__)("Site Icon","web-stories"),decoding:"async",crossOrigin:"anonymous"}):c.createElement(uF,{fill:g,width:o(24),height:o(24)}),c.createElement(yF,{fgColor:g,$factor:o},l||(0,d.__)("Learn more","web-stories"))),r&&i&&c.createElement(nT.Popup,{anchor:{current:r},isOpen:!0,placement:Gd.PLACEMENT.LEFT,spacing:wF},c.createElement(_F,null,(0,d.__)("Links can not reside below the dashed line when a page attachment is present. Your viewers will not be able to click on the link.","web-stories"))))))};var IF;function xF(){return xF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xF.apply(this,arguments)}const AF=e=>{let{title:t,titleId:n,...r}=e;return c.createElement("svg",xF({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 8","aria-labelledby":n},r),t?c.createElement("title",{id:n},t):null,IF||(IF=c.createElement("path",{d:"M18 7.7c-.2 0-.5-.1-.7-.2l-7.3-4-7.3 4c-.7.4-1.6.2-2-.6-.4-.7-.1-1.6.6-2l8-4.4c.5-.2 1-.2 1.5 0l8 4.4c.7.4 1 1.3.6 2-.4.5-.9.8-1.4.8z"})))},kF=(0,c.memo)(AF),OF=p.default.div.withConfig({displayName:"shoppingPageAttachment__Wrapper",componentId:"sc-7unzl7-0"})(["position:absolute;display:flex;align-items:center;justify-content:flex-end;flex-direction:column;bottom:0;height:20%;width:100%;color:",";z-index:3;"],(e=>{let{theme:t}=e;return t.colors.standard.white})),PF=p.default.div.withConfig({displayName:"shoppingPageAttachment__InnerWrap",componentId:"sc-7unzl7-1"})(["position:relative;width:100%;height:100%;"]),NF=p.default.div.withConfig({displayName:"shoppingPageAttachment__Inner",componentId:"sc-7unzl7-2"})(["position:absolute;bottom:0;width:100%;",";display:flex;flex-direction:column;align-items:center;"],(e=>{let{$hasGradient:t}=e;return t&&"background: linear-gradient(0, rgba(0, 0, 0, 0.15), transparent) !important"})),MF=p.default.div.withConfig({displayName:"shoppingPageAttachment__ArrowWrap",componentId:"sc-7unzl7-3"})(["width:","px;min-height:","px;border-radius:50%;background:",";display:flex;align-items:center;justify-content:center;"],(e=>{let{$factor:t}=e;return t(32)}),(e=>{let{$factor:t}=e;return t(32)}),(e=>{let{bgColor:t}=e;return t})),RF=(0,p.default)(kF).withConfig({displayName:"shoppingPageAttachment__ArrowBar",componentId:"sc-7unzl7-4"})(["display:block;cursor:pointer;filter:drop-shadow(0px 2px 6px rgba(0,0,0,0.3));width:","px;height:","px;"],(e=>{let{$factor:t}=e;return t(20)}),(e=>{let{$factor:t}=e;return t(8)})),LF=p.default.div.withConfig({displayName:"shoppingPageAttachment__OutlinkChip",componentId:"sc-7unzl7-5"})(["height:","px;display:flex;position:relative;padding:","px ","px;margin:0 0 ","px;max-width:calc(100% - 64px);border-radius:30px;place-items:center;background:",";"],(e=>{let{$factor:t}=e;return t(36)}),(e=>{let{$factor:t}=e;return t(10)}),(e=>{let{$factor:t}=e;return t(6)}),(e=>{let{$factor:t}=e;return t(20)}),(e=>{let{bgColor:t}=e;return t})),DF=p.default.span.withConfig({displayName:"shoppingPageAttachment__TextWrapper",componentId:"sc-7unzl7-6"})(["font-family:Roboto,sans-serif;font-size:","px;line-height:18px;text-overflow:ellipsis;white-space:nowrap;position:relative;padding-inline-start:6px;padding-inline-end:8px;height:","px;letter-spacing:0.3px;font-weight:700;max-width:210px;color:",";"],(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{$factor:t}=e;return t(16)}),(e=>{let{fgColor:t}=e;return t})),BF="#FFFFFF",FF="#000000";const HF=function(e){let{ctaText:t,theme:n}=e;const r=n===De?BF:FF,a=n===De?FF:BF,{dataToEditorY:o}=(0,Rc.default)((e=>{let{actions:{dataToEditorY:t}}=e;return{dataToEditorY:t}}));return c.createElement(OF,{role:"presentation"},c.createElement(PF,null,c.createElement(NF,{$hasGradient:n!==De},c.createElement(MF,{bgColor:a,$factor:o},c.createElement(RF,{fill:r,$factor:o})),c.createElement(LF,{$factor:o},c.createElement(DF,{fgColor:a,$factor:o},t||(0,d.__)("Shop Now","web-stories"))))))};const UF=function(e){const t=/^(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})$/.exec(e);return t?3600*(t[1]?parseInt(t[1]):0)+60*parseInt(t[2])+parseInt(t[3])+parseInt(t[4])/1e3:null},jF=p.default.span.withConfig({displayName:"cue__CueWrapper",componentId:"sc-h5j1x4-0"})(["text-align:center;height:",";"],(e=>{let{$height:t}=e;return`${t}px`})),zF=p.default.span.withConfig({displayName:"cue__CueEl",componentId:"sc-h5j1x4-1"})(["color:",";"],(e=>{let{$isFutureCue:t,theme:n}=e;return t?n.colors.fg.black:n.colors.fg.white})),GF=p.default.span.withConfig({displayName:"cue__Section",componentId:"sc-h5j1x4-2"})(["margin:0 10px 10px;padding:6px 12px;vertical-align:middle;border-radius:15px;background:rgba(11,11,11,0.6);color:rgba(255,255,255,1);display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;line-height:1.4;word-break:break-word;word-wrap:break-word;overflow-wrap:break-word;"]);const YF=function Cue(e){let{cue:t,videoTime:n,height:r}=e;const a=t.getCueAsHTML();return c.createElement(jF,{$height:r},c.createElement(GF,null,[...a.childNodes].map((e=>{if("timestamp"===e.target)return null;{let t=null;"timestamp"===e.previousSibling?.target&&(t=UF(e.previousSibling.data));const r=t>n;return e.nodeType===Node.TEXT_NODE?null!==t?c.createElement("span",null,c.createElement(zF,{$isFutureCue:r},e.textContent)):c.createElement(zF,null,e.textContent):null!==t?c.createElement("span",null,c.createElement(zF,{$isFutureCue:r,dangerouslySetInnerHTML:{__html:e.innerHTML}})):c.createElement(zF,{dangerouslySetInnerHTML:{__html:e.innerHTML}})}}))))},ZF=p.default.div.withConfig({displayName:"trackRenderer__Track",componentId:"sc-7rx40r-0"})(["width:100%;height:100%;display:grid;align-content:end;font-size:",";"],(e=>{let{$fontSize:t}=e;return`${t}px`}));const WF=function TrackRenderer(e){let{elementId:t,trackIndex:n}=e;const{pageWidth:r,pageHeight:a}=cs((e=>{let{state:{pageWidth:t,pageHeight:n}}=e;return{pageWidth:t,pageHeight:n}})),o=.04*r,i=.2*a,[l,s]=(0,u.useState)(null),[d,p]=(0,u.useState)(0),[m,g]=(0,u.useState)([]),f=(0,u.useCallback)((()=>{const e=l?.activeCues?[...l.activeCues]:[];g(e)}),[l]);return(0,u.useEffect)((()=>{f(),p(0);const e=document.getElementById(t);if(!e)return;const r=e.textTracks?.[n];return r?(r.mode="hidden",f(),s(r),e.addEventListener("timeupdate",(()=>{p(e.currentTime)})),r.addEventListener("cuechange",f),()=>{r.removeEventListener("cuechange",f)}):void 0}),[n,f,t,r,a]),m&&l?c.createElement(ZF,{$fontSize:o},m.map(((e,t)=>c.createElement(YF,{key:t,cue:e,videoTime:d,height:i})))):null},VF=(0,p.default)(Gv).withConfig({displayName:"mediaCaptionsLayer__CaptionsLayer",componentId:"sc-11mx67a-0"})([""]),$F=(0,p.default)(rw).withConfig({displayName:"mediaCaptionsLayer__CaptionsPageArea",componentId:"sc-11mx67a-1"})(["position:absolute;pointer-events:none;"]),qF=p.default.div.withConfig({displayName:"mediaCaptionsLayer__CaptionsCanvas",componentId:"sc-11mx67a-2"})(["background:transparent;border-radius:5px;position:absolute;z-index:2;transform:translateZ(0);top:0;left:0;bottom:0;right:0;cursor:default;"]);const KF=function MediaCaptionsLayer(){const{isEditing:e}=$s((e=>{let{state:{isEditing:t}}=e;return{isEditing:t}})),{currentPageId:t,backgroundAudio:n,videoElement:r}=Qa((e=>{let{state:t}=e;const{selectedElements:n,currentPage:r}=t,{backgroundAudio:a}=r;let o=null,i=null;if(1===n.length){const e=n[0],{isBackground:t,type:r,tracks:l}=e;t&&a&&a?.tracks?.length>0&&(o=a),"video"===r&&l?.length>0&&(i=e)}return{currentPageId:r?.id,backgroundAudio:o,videoElement:i}})),[a,o]=(0,u.useState)(0),[i,l]=(0,u.useState)("");return(0,u.useEffect)((()=>{if(o(0),l(""),n)return l(`page-${t}-background-audio`),void o(n?.tracks?.length);!e&&r&&(l(`video-${r.id}`),o(r.tracks.length))}),[r,n,t,e]),a?c.createElement(VF,null,c.createElement($F,{withSafezone:!1,showOverflow:!0},c.createElement(qF,null,Array.from({length:a}).map(((e,t)=>c.createElement(WF,{key:t,elementId:i,trackIndex:t})))))):null},XF=(0,p.default)(rw).withConfig({displayName:"displayLayer__DisplayPageArea",componentId:"sc-13e1aq-0"})(["position:absolute;"]);function DisplayPage(e){let{pageElements:t,editingElement:n}=e;return t?t.map((e=>{if(n===e.id)return null;const r=t.filter((t=>{let{type:n}=t;return n===e.type})).length-1;return c.createElement(Zc,{key:e.id,element:e,isAnimatable:!0,siblingCount:r})})):null}function DisplayPageAnimationController(e){let{resetAnimationState:t}=e;const{animationState:n,pageId:r}=Qa((e=>{let{state:t}=e;return{animationState:t.animationState,pageId:t.currentPage?.id}})),a=(0,Hn.useStoryAnimationContext)((e=>{let{actions:t}=e;return t.WAAPIAnimationMethods}));return(0,u.useEffect)((()=>{switch(n){case Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED:case Hn.STORY_ANIMATION_STATE.PLAYING:return void a.play();case Hn.STORY_ANIMATION_STATE.RESET:return void a.reset();case Hn.STORY_ANIMATION_STATE.SCRUBBING:case Hn.STORY_ANIMATION_STATE.PAUSED:return void a.pause();default:return}}),[n,a]),(0,u.useEffect)((()=>t),[t,r]),null}function StoryAnimations(e){let{children:t}=e;const{isAnimationPlaying:n,currentPageAnimations:r,currentPageElements:a,selectedElements:o,updateAnimationState:i}=Qa((e=>{let{state:t,actions:n}=e;return{isAnimationPlaying:t.animationState===Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED,currentPageAnimations:t.currentPage?.animations||Ue,currentPageElements:t.currentPage?.elements||Ue,selectedElements:t.selectedElements,updateAnimationState:n.updateAnimationState}})),l=(0,u.useCallback)((()=>{i({animationState:Hn.STORY_ANIMATION_STATE.RESET})}),[i]),s=(0,u.useMemo)((()=>o.map((e=>e.id))),[o]);return c.createElement(Hn.StoryAnimation.Provider,{animations:r,elements:a,onWAAPIFinish:l,selectedElementIds:n?s:Ue},c.createElement(DisplayPageAnimationController,{resetAnimationState:l}),t)}DisplayPageAnimationController.propTypes={resetAnimationState:za().func};const QF=(0,u.memo)((function DisplayLayer(){const{backgroundColor:e,isBackgroundSelected:t,pageAttachment:n,shoppingAttachment:r,hasProducts:a}=Qa((e=>{let{state:t}=e;return{hasCurrentPage:Boolean(t.currentPage),backgroundColor:t.currentPage?.backgroundColor,isBackgroundSelected:t.selectedElements?.[0]?.isBackground,pageAttachment:t.currentPage?.pageAttachment||{},shoppingAttachment:t.currentPage?.shoppingAttachment||{},hasProducts:t.currentPage?.elements?.some((e=>{let{type:t,product:n}=e;return t===Mn.ELEMENT_TYPES.PRODUCT&&n?.productId}))}})),o=Qa((e=>{let{state:t}=e;return t.currentPage?.elements||Ue})),i=qs(Ws),{editingElement:l,setPageContainer:s,setFullbleedContainer:p}=$s((e=>{let{state:{editingElement:t},actions:{setPageContainer:n,setFullbleedContainer:r}}=e;return{editingElement:t,setPageContainer:n,setFullbleedContainer:r}})),m=(0,u.useMemo)((()=>a?c.createElement(HF,r):c.createElement(CF,{pageAttachment:n})),[a,n,r]);return c.createElement(StoryAnimations,null,c.createElement(Gv,{"data-testid":"DisplayLayer",pointerEvents:"none","aria-label":(0,d._x)("Display layer","compound noun","web-stories")},c.createElement(XF,{ref:(0,u.useCombinedRefs)(s,i),fullbleedRef:p,background:e,isBackgroundSelected:t,fullBleedContainerLabel:(0,d.__)("Fullbleed area (Display layer)","web-stories"),overlay:m,isControlled:!0},c.createElement(DisplayPage,{pageElements:o,editingElement:l})),c.createElement(KF,null)))}));var JF=n(49640);const eH=function(e,t,n,r){if(!n||n.length>1)return{};let a=null;if("ArrowUp"===e&&(a=t?ke:Pe),"ArrowDown"===e&&(a=t?Oe:Ne),!a)return{};const{id:o,groupId:i}=n[0],l=r.findIndex((e=>{let{id:t}=e;return t===o}));if(i){const e=r[l-1]?.groupId!==i,t=r[l+1]?.groupId!==i;if(e&&a===Ne||t&&a===Pe)return{position:l,groupId:null}}else{if(r[l-1]?.groupId&&a===Ne)return{position:l,groupId:r[l-1].groupId};if(r[l+1]?.groupId&&a===Pe)return{position:l,groupId:r[l+1].groupId}}return{position:a}};const tH=function(e){const{selectedElementIds:t,selectedElements:n,arrangeSelection:r,deleteSelectedElements:a,duplicateElementsById:o,updateSelectedElements:i,setSelectedElementsById:l,currentPage:s,currentPageNumber:c,animationState:p,updateAnimationState:m,currentPageProductIds:g,pageElements:f}=Qa((e=>{let{state:{selectedElementIds:t,selectedElements:n,currentPage:r,currentPageNumber:a,animationState:o},actions:{arrangeSelection:i,deleteSelectedElements:l,duplicateElementsById:s,updateSelectedElements:c,setSelectedElementsById:d,updateAnimationState:u}}=e;return{currentPage:r,currentPageNumber:a,selectedElementIds:t,selectedElements:n,arrangeSelection:i,deleteSelectedElements:l,duplicateElementsById:s,updateSelectedElements:c,setSelectedElementsById:d,animationState:o,updateAnimationState:u,currentPageProductIds:r?.elements?.filter((e=>{let{type:t}=e;return t===Mn.ELEMENT_TYPES.PRODUCT})).map((e=>{let{product:t}=e;return t?.productId})),pageElements:r?.elements}})),h=(0,Ur.useSnackbar)((e=>{let{showSnackbar:t}=e;return t})),{setHighlights:b}=cm((e=>{let{setHighlights:t}=e;return{setHighlights:t}})),{isEditing:E,getNodeForElement:y,setEditingElement:_}=$s((e=>{let{state:{isEditing:t},actions:{getNodeForElement:n,setEditingElement:r}}=e;return{isEditing:t,getNodeForElement:n,setEditingElement:r}})),v=(0,u.useRef)(null);v.current=t,(0,u.useEffect)((()=>{const t=e.current;if(!t)return;const n=t.ownerDocument,r=()=>{setTimeout((()=>{if(n.activeElement===n.body){const e=v.current,n=1===e?.length?y(e[0]):null;if(""!==window.getSelection().toString())return;n?n.focus({preventScroll:!0}):t.focus({preventScroll:!0})}}),300)};return n.addEventListener("focusout",r,!0),()=>{n.removeEventListener("focusout",r,!0)}}),[e,y]),(0,Cr.useGlobalKeyDownEffect)("delete",(()=>a()),[a]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+a"]},(()=>{const e=s.elements.map((e=>{let{id:t}=e;return t}));l({elementIds:e})}),[s,l]),(0,Cr.useGlobalKeyDownEffect)({key:["up","down","left","right"],shift:!0},(e=>{let{key:t,shiftKey:r}=e;if(E)return;const{isBackground:a,isLocked:o}=n?.[0]||{};if(a||o)return;const{dx:l,dy:s}=(0,JF.default)(t,r);i({properties:e=>{let{x:t,y:n}=e;return{x:t+l,y:n+s}}})}),[i,E,n]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+up","mod+down","mod+left","mod+right"],shift:!0},(e=>{const{key:t,shiftKey:a}=e;if(e.preventDefault(),1===n?.length){const{position:e,groupId:o}=eH(t,a,n,f);(e||o)&&r({position:e,groupId:o})}}),[r,n,f]),(0,Cr.useGlobalKeyDownEffect)({key:"enter",clickable:!1},(()=>{if(1!==n.length)return;const{type:e,id:t,isLocked:r}=n[0],{hasEditMode:a,hasEditModeIfLocked:o}=(0,Mn.getDefinitionForType)(e);!a||!o&&r||_(t)}),[n,_]);const w=(0,u.useCallback)((()=>{if(0!==n.length){for(const{type:e,product:t}of n){const{productId:n,productTitle:r,productImages:a}=t||{};e===Mn.ELEMENT_TYPES.PRODUCT&&n&&g.includes(n)&&h({message:(0,We.default)(
177
  /* translators: %s: product title. */
178
  (0,d.__)('Product "%s" already exists on the page.',"web-stories"),r),thumbnail:a?.[0]?.url&&{src:a[0].url,alt:a[0].alt}})}o({elementIds:n.map((e=>e.id))})}}),[o,n,g,h]);(0,Cr.useGlobalKeyDownEffect)("clone",(()=>w()),[w]);const T=[Hn.STORY_ANIMATION_STATE.PLAYING,Hn.STORY_ANIMATION_STATE.PLAYING_SELECTED].includes(p);(0,Cr.useGlobalKeyDownEffect)({key:["mod+enter"]},(e=>{e.preventDefault(),1!==c&&(m({animationState:T?Hn.STORY_ANIMATION_STATE.RESET:Hn.STORY_ANIMATION_STATE.PLAYING}),(0,P.trackEvent)("canvas_play_animations",{status:T?"stop":"play"}))}),[T,m,c]),(0,Cr.useGlobalKeyDownEffect)({key:["mod+k"]},(e=>{e.preventDefault(),n.length&&!n?.[0]?.isBackground&&b({elements:n,highlight:hg.LINK})}),[b,n])},nH=p.default.div.withConfig({displayName:"extraPages__ExtraPageWrapper",componentId:"sc-12b8j4d-0"})(["display:flex;overflow:hidden;justify-content:",";align-items:center;height:100%;"],(e=>{let{isPrevious:t}=e;return t?"flex-end":"flex-start"})),rH=p.default.ol.withConfig({displayName:"extraPages__ExtraPageList",componentId:"sc-12b8j4d-1"})(["display:flex;flex-direction:",";width:","px;height:","px;margin:0;padding:0 ","px;gap:","px;"],(e=>{let{isPrevious:t}=e;return t?"row-reverse":"row"}),(e=>{let{listWidth:t}=e;return t}),(e=>{let{extraPageHeight:t}=e;return t}),32,32),aH=p.default.li.withConfig({displayName:"extraPages__ExtraPage",componentId:"sc-12b8j4d-2"})(["display:block;width:","px;height:100%;border-radius:4px;background-color:white;opacity:0.5;transition:opacity 0.2s ease;&:hover{opacity:1;}"],(e=>{let{extraPageWidth:t}=e;return t-32})),oH=(0,p.default)(lO).withConfig({displayName:"extraPages__ExtraPagePreview",componentId:"sc-12b8j4d-3"})(["cursor:pointer;"]);function iH(e,t){return e<t?Array.from(Array(t-e)).map(((t,n)=>n+e)):[]}const lH=(0,u.memo)((function ExtraPages(e){let{isPrevious:t=!1}=e;const{currentPageIndex:n,pages:r,setCurrentPage:a}=Qa((e=>{let{state:{pages:t,currentPageIndex:n},actions:{setCurrentPage:r}}=e;return{currentPageIndex:n,pages:t,setCurrentPage:r}})),{hasExtraPages:o,extraPageWidth:i,extraPageCount:l}=cs((e=>{let{state:{hasExtraPages:t,extraPageWidth:n,extraPageCount:r}}=e;return{hasExtraPages:t,extraPageWidth:n,extraPageCount:r}})),s=(0,C.useFeature)("extraPages"),u=r?.length;if(!u||!s)return null;const p=function(e){let{isPrevious:t,hasExtraPages:n,currentPageIndex:r,extraPageCount:a,pageCount:o}=e;if(!n)return[];if(t)return iH(Math.max(0,r-a),r).reverse();return iH(r+1,Math.min(o,r+a+2))}({isPrevious:t,hasExtraPages:o,currentPageIndex:n,extraPageCount:l,pageCount:u});if(0===p.length)return null;const m=p.length*i,g=(i-32)/ee.PAGE_RATIO;return c.createElement(nH,{isPrevious:t},c.createElement(rH,{isPrevious:t,listWidth:m,extraPageHeight:g},p.map((e=>{return c.createElement(aH,{key:e,extraPageWidth:i},c.createElement(oH,{page:r[e],onClick:(t=r[e].id,()=>a({pageId:t})),"aria-label":(0,We.default)(
179
  /* translators: %s: page number. */
305
  /* translators: %s: user's name */
306
  (0,d.__)("%s is already editing this story.","web-stories"),r?.name);return c.createElement(y,{isOpen:t,onClose:n,title:l,contentLabel:l,actions:c.createElement(c.Fragment,null,c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,href:a},(0,d.__)("Dashboard","web-stories")),c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,href:o,target:"_blank",rel:"noreferrer"},(0,d.__)("Preview","web-stories")),i&&c.createElement(m.Button,{type:g.BUTTON_TYPES.TERTIARY,size:g.BUTTON_SIZES.SMALL,onClick:n},(0,d.__)("Take over","web-stories")))},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},r?.avatar&&c.createElement(D3,{src:r.avatar,alt:r.name,height:48,width:48,crossOrigin:"anonymous",decoding:"async"}),s))};const F3=function PostTakeOverDialog(e){let{isOpen:t,user:n,dashboardLink:r,onClose:a}=e;const o=(0,d.__)("Someone else has taken over this story.","web-stories"),i=(0,We.default)(
307
  /* translators: %s: user's name */
308
+ (0,d.__)("%s now has editing control of this story.","web-stories"),n?.name);return c.createElement(y,{isOpen:t,title:o,contentLabel:o,onClose:a,actions:c.createElement(m.Button,{type:g.BUTTON_TYPES.QUATERNARY,size:g.BUTTON_SIZES.SMALL,variant:g.BUTTON_VARIANTS.RECTANGLE,href:r},(0,d.__)("Dashboard","web-stories"))},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},n.avatar&&c.createElement(D3,{src:n.avatar,alt:n.name,height:48,width:48,crossOrigin:"anonymous",decoding:"async"}),i))};const H3=function PostLock(){const{currentUser:e}=no((e=>{let{state:t}=e;return{currentUser:t.currentUser}})),{storyId:t,dashboardLink:n,nonce:r,postLock:{interval:a,showLockedDialog:o},api:{stories:i,storyLocking:l}}=U(),{previewLink:s,lockUser:d}=Qa((e=>{let{state:{story:{previewLink:t,extras:{lockUser:n={}}={}}}}=e;return{previewLink:t,lockUser:n}})),{enablePostLockingTakeOver:p}=(0,C.useFeatures)(),[m,g]=(0,u.useState)(!0),[f,h]=(0,u.useState)({}),[b,E]=(0,u.useState)(r),y=(0,u.useCallback)((()=>{p&&(h({}),L3(t,i))}),[p,t,i]),_=(0,u.useMemo)((()=>Boolean(Object.keys(e).length)),[e]),v=(0,u.useCallback)((()=>{o&&_&&function(e,t){const n=(0,R3.default)(`${t}${e}/lock/`,{_embed:"author"});return w5({path:n})}(t,i).then((n=>{let{locked:r,nonce:a,_embedded:o}=n;const l={id:o?.author?.[0]?.id||0,name:o?.author?.[0]?.name||"",avatar:o?.author?.[0]?.avatar_urls?.[96]||""};r&&l?.id&&l?.id!==e.id?h(l):L3(t,i),E(a)})).catch((e=>{(0,P.trackError)("post_lock",e.message)}))}),[h,t,i,e,o,_]),w=(0,u.useRef)(v);return(0,u.useEffect)((()=>{w.current=v}),[v,_]),(0,u.useEffect)((()=>{o&&_&&d?.id&&d?.id!==e.id&&h(d)}),[d,e,_,o]),(0,u.useEffect)((()=>{function e(){o&&f?.id&&b&&function(e,t,n){const r=new window.FormData;r.append("_wpnonce",t);const a=(0,R3.default)(n,{_method:"DELETE"});window.navigator.sendBeacon?.(a,r)}(0,b,l)}return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t,o,f,b,l]),(0,u.useEffect)((()=>{const e=setInterval((()=>{a&&_&&(w.current(),g(!1))}),1e3*a);return()=>clearInterval(e)}),[a,_]),o&&f?m?c.createElement(B3,{isOpen:Boolean(f?.id),user:f,onClose:y,previewLink:s,dashboardLink:n,showTakeOver:p}):p?c.createElement(F3,{isOpen:Boolean(f?.id),user:f,dashboardLink:n,onClose:y}):null:null},U3=(e,t,n)=>{if("object"==typeof n)for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&U3(e,`${t}[${r}]`,n[r]);else e.append(t,n)},j3=U3;const z3=function(e){return"__WEB_STORIES_ENCODED__"+btoa(encodeURIComponent(e))};const G3=function(e){const{mime_type:t,web_stories_media_source:n,meta:{web_stories_is_gif:r=!1}={}}=e;return"gif-conversion"===n||r?function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a},mime_type:o,featured_media:i,featured_media_src:{src:l,width:s,height:c,generated:d},alt_text:u,source_url:p,meta:{web_stories_base_color:m,web_stories_blurhash:g}}=e;return J({baseColor:m,blurHash:g,type:"gif",mimeType:"image/gif",creationDate:n,src:p,...te({width:r,height:a,posterGenerated:d,posterWidth:s,posterHeight:c}),posterId:i,poster:l,id:t,alt:u,local:!1,isOptimized:!0,isExternal:!1,output:{mimeType:o,src:p}})}(e):"image"===Q(t)?function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a,sizes:o={}}={},mime_type:i,alt_text:l,source_url:s,meta:{web_stories_base_color:c,web_stories_blurhash:d}}=e,u=Object.entries(o).reduce(((e,t)=>{let[n,r]=t;return e[n]=(0,t5.snakeToCamelCaseObjectKeys)(r),e}),{});return J({baseColor:c,blurHash:d,mimeType:i,creationDate:n,src:s,width:r,height:a,id:t,alt:l,sizes:u,local:!1,isExternal:!1})}(e):function(e){const{id:t,date_gmt:n,media_details:{width:r,height:a,length:o,length_formatted:i},mime_type:l,featured_media:s,featured_media_src:{src:c,width:d,height:u,generated:p},web_stories_is_muted:m,alt_text:g,source_url:f,web_stories_media_source:h,meta:{web_stories_trim_data:b,web_stories_base_color:E,web_stories_blurhash:y}}=e;return J({baseColor:E,blurHash:y,mimeType:l,creationDate:n,src:f,...te({width:r,height:a,posterGenerated:p,posterWidth:d,posterHeight:u}),poster:c,posterId:s,id:t,length:o,lengthFormatted:i,alt:g,local:!1,isExternal:!1,isOptimized:["video-optimization","recording"].includes(h),isMuted:m,trimData:b})}(e)};const Y3=function(e){const{_embedded:t={},story_poster:n,_links:r={},...a}=e,o={...(0,t5.snakeToCamelCaseObjectKeys)(a,["story_data"]),author:{id:t?.author?.[0].id||0,name:t?.author?.[0].name||""},capabilities:{},extras:{lockUser:{id:t?.["wp:lockuser"]?.[0].id||0,name:t?.["wp:lockuser"]?.[0].name||"",avatar:t?.["wp:lockuser"]?.[0].avatar_urls?.[96]||""}},featuredMedia:n?{...n,isExternal:!n.id}:{id:0,height:0,width:0,url:"",needsProxy:!1,isExternal:!1},publisherLogo:{id:t?.["wp:publisherlogo"]?.[0].id||0,height:t?.["wp:publisherlogo"]?.[0]?.media_details?.height||0,width:t?.["wp:publisherlogo"]?.[0]?.media_details?.width||0,url:t?.["wp:publisherlogo"]?.[0]?.source_url||""},taxonomies:r?.["wp:term"]?.map((e=>{let{taxonomy:t}=e;return t}))||[],terms:t?.["wp:term"]||[]};for(const e of Object.keys(r)){if(!e.startsWith("wp:action-"))continue;const t=e.replace("wp:action-","");o.capabilities[t]=!0}return o};const Z3=(0,d.__)("https://wordpress.org/support/plugin/web-stories/","web-stories");const W3=function StatusCheckFailed(e){let{isOpen:t,onClose:n}=e;const r=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_support_page")}),[]);return c.createElement(y,{isOpen:t,onClose:n,title:(0,d.__)("Unable to save your story","web-stories"),contentLabel:(0,d.__)("Unable to save your story","web-stories"),onPrimary:n,primaryText:(0,d.__)("Dismiss","web-stories")},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,href:Z3,target:"_blank",rel:"noopener noreferrer",onClick:r})}},(0,d.__)("We are currently unable to save your story, any changes you make may be lost. This may be due to temporary issues connecting to WordPress. <a>Submit a new support topic</a> for additional help.","web-stories"))))};const V3=function StatusCheck(){const[e,t]=(0,u.useState)(!1),n=(0,u.useCallback)((()=>t(!1)),[]),{api:{statusCheck:r},encodeMarkup:a}=U();return(0,u.useEffect)((()=>{(function(e,t,n){return w5({path:t,data:{content:n?z3(e):e},method:"POST"})})(Ta({storyId:1,title:"Story!",author:{id:1,name:"John Doe"},slug:"story",publisherLogo:{id:1,url:"https://example.com/logo.png",height:0,width:0},defaultPageDuration:7,status:"publish",date:"2020-04-10T07:06:26",modified:"",excerpt:"",featuredMedia:{id:123,url:"https://example.com/image.png",width:123,height:456},password:"",globalStoryStyles:""},[{type:"page",id:"2",elements:[]}],{publisher:"Web Stories"}),r,a).catch((e=>{t(!0),(0,P.trackError)("status_check",e.message)}))}),[a,r]),c.createElement(W3,{isOpen:e,onClose:n})};const $3=function CorsCheckFailed(e){let{isOpen:t,onClose:n}=e;const r=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_cors_check_docs")}),[]);return c.createElement(y,{isOpen:t,onClose:n,title:(0,d.__)("Unable to load media","web-stories"),contentLabel:(0,d.__)("Unable to load media","web-stories"),onPrimary:n,primaryText:(0,d.__)("Dismiss","web-stories")},c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,href:"https://wp.stories.google/docs/troubleshooting/common-issues/",target:"_blank",rel:"noopener noreferrer",onClick:r})}},(0,d.__)("We detected a potential misconfiguration that prevents media items from loading correctly. This may be due to media being hosted on an external CDN. <a>Learn how to address this</a>.","web-stories"))))},q3=Zo.CORS_CHECK_DIALOG_DISMISSED;const K3=function CorsCheck(){const[e,t]=(0,u.useState)(!1),{actions:{getMediaForCorsCheck:n}}=W(),r=(0,u.useCallback)((()=>{t(!1),Wo.setItemByKey(q3,!0)}),[]),a=Boolean(Wo.getItemByKey(q3));return(0,u.useEffect)((()=>{(async()=>{if(a)return;let e;try{e=await n()}catch(e){return}if(e?.length)try{await Promise.all([...new Set(e.filter((e=>!e.startsWith(location.origin))))].map((e=>fetch(e,{method:"HEAD"}))))}catch(e){t(!0),(0,P.trackError)("cors_check",e.message)}})()}),[]),c.createElement($3,{isOpen:e,onClose:r})},X3=p.default.div.withConfig({displayName:"fontCheckDialog__DialogContent",componentId:"sc-5gbbgj-0"})(["display:grid;row-gap:20px;"]),Q3=(0,p.default)(fh).withConfig({displayName:"fontCheckDialog__ChevronRight",componentId:"sc-5gbbgj-1"})(["width:32px;height:32px;"]),J3=(0,p.default)(Q3).withConfig({displayName:"fontCheckDialog__ChevronLeft",componentId:"sc-5gbbgj-2"})(["transform:rotate(180deg);"]),e4=(0,p.default)(pu.Link).withConfig({displayName:"fontCheckDialog__StyledLink",componentId:"sc-5gbbgj-3"})(["display:flex;color:",";align-items:center;font-weight:normal;margin:0 auto 0 0;"],(e=>{let{theme:t}=e;return t.colors.standard.black})),t4=(0,p.default)(m.Button).withConfig({displayName:"fontCheckDialog__StyledButton",componentId:"sc-5gbbgj-4"})(["margin-left:16px;"]),n4=p.default.div.withConfig({displayName:"fontCheckDialog__ActionsWrap",componentId:"sc-5gbbgj-5"})(["display:flex;align-self:flex-end;width:100%;"]),FontCheckDialog=e=>{let{isOpen:t,defaultCloseAction:n,missingFont:r,closeDialog:a}=e;const{dashboardLink:o,dashboardSettingsLink:i,isRTL:l}=U(),[s,p]=(0,u.useState)(Mn.TEXT_ELEMENT_DEFAULT_FONT),{updateElementsByFontFamily:m}=Qa((e=>{let{actions:t}=e;return{updateElementsByFontFamily:t.updateElementsByFontFamily}})),f=(0,u.useCallback)((e=>{(0,P.trackEvent)("font_check_cancel"),n(e)}),[n]),h=(0,u.useCallback)((e=>{(0,P.trackClick)(e,"click_font_check_settings")}),[]),b=(0,u.useCallback)((()=>{(0,P.trackEvent)("font_check_replace_default"),m({family:r,properties:{font:Mn.TEXT_ELEMENT_DEFAULT_FONT}}),a()}),[a,r,m]),E=(0,u.useCallback)((()=>{(0,P.trackEvent)("font_check_replace_selected"),m({family:r,properties:{font:s}}),a()}),[s,a,r,m]),_=l?Q3:J3;return c.createElement(y,{isOpen:t,onClose:f,title:(0,d.__)("Missing Fonts","web-stories"),contentLabel:(0,d.__)("Missing Fonts","web-stories"),actions:c.createElement(n4,null,c.createElement(e4,{href:o},c.createElement(_,null),(0,d.__)("Back to dashboard","web-stories")),c.createElement(t4,{type:g.BUTTON_TYPES.SECONDARY,size:g.BUTTON_SIZES.SMALL,onClick:b},(0,d.__)("Open anyway","web-stories")),c.createElement(t4,{type:g.BUTTON_TYPES.PRIMARY,size:g.BUTTON_SIZES.SMALL,onClick:E},(0,d.__)("Replace font","web-stories")))},c.createElement(X3,null,c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("This story contains the following font that is no longer available:","web-stories")),c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,isBold:!0},r),c.createElement("div",null,c.createElement(uu.default,{mapping:{a:c.createElement(pu.Link,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL,onClick:h,href:i,isBold:!0})}},(0,d.__)("To replace this font with your own or re-add it, go to <a>Settings</a>. To replace this font with a default, open the story.","web-stories"))),c.createElement($e.Text,{size:qe.THEME_CONSTANTS.TYPOGRAPHY.PRESET_SIZES.SMALL},(0,d.__)("Or, choose replacement font below:","web-stories")),c.createElement(WR,{zIndex:10,currentValue:s.family,onChange:p})))},r4=()=>{const{dashboardLink:e}=U(),{isStoryLoaded:t,storyPages:n,updateElementsByFontFamily:r}=Qa((e=>{let{state:{pages:t},actions:n}=e;return{storyPages:t,updateElementsByFontFamily:n.updateElementsByFontFamily,isStoryLoaded:t.length>0}})),{actions:{getFonts:a}}=W(),[o,i]=(0,u.useState)(null),[l,s]=(0,u.useState)(!1),d=(0,u.useCallback)((()=>{window.location=e}),[e]);return(0,u.useEffect)((()=>{(async()=>{if(!t)return;const e=kJ(n),o=await a({include:e.join(",")});for(const t of e){const e=o.find((e=>e?.family===t));e&&r({family:t,properties:{font:e}})}const l=e.filter((e=>!new Set(o.map((e=>e.family))).has(e)));l&&l.length>=1&&(s(!0),i(l[0]))})()}),[t,r]),c.createElement(FontCheckDialog,{isOpen:l,missingFont:o||"",defaultCloseAction:d,closeDialog:()=>s(!1)})};function a4(e,t){return w5({path:(0,R3.default)(e.api.users,{per_page:"100",who:"authors",search:t})}).then((e=>e.map((e=>(delete e._links,(0,t5.snakeToCamelCaseObjectKeys)(e))))))}const o4=["id","title","status","slug","date","modified","excerpt","link","story_poster","story_data","preview_link","edit_link","embed_post_link","permalink_template","style_presets","password"].join(","),i4="wp:lockuser,author,wp:publisherlogo,wp:term",l4=["id","date_gmt","media_details","mime_type","featured_media","featured_media_src","alt_text","source_url","meta","web_stories_media_source","web_stories_is_muted","body","status","headers"].join(",");function s4(e,t){const n=(0,R3.default)(`${e.api.stories}${t}/`,{context:"edit",_embed:i4,_fields:o4});return w5({path:n}).then(Y3)}const c4=(e,t)=>{let{pages:n,featuredMedia:r,globalStoryStyles:a,publisherLogo:o,autoAdvance:i,defaultPageDuration:l,currentStoryStyles:s,backgroundAudio:c,content:d,author:u,products:p,...m}=e;return{story_data:{version:Sr.DATA_VERSION,pages:n,autoAdvance:i,defaultPageDuration:l,currentStoryStyles:s,backgroundAudio:c},featured_media:r.isExternal?null:r.id,style_presets:a,meta:{web_stories_publisher_logo:o?.id,web_stories_products:p,web_stories_poster:r.isExternal?{url:r.url,width:r.width,height:r.height,needsProxy:r.needsProxy}:null},publisher_logo:o,content:t?z3(d):d,author:u.id,...m}};function d4(e,t){const{storyId:n}=t,r=c4(t,e.encodeMarkup),a=(0,R3.default)(`${e.api.stories}${n}/`,{_fields:["status","slug","link","preview_link","edit_link","embed_post_link","story_poster"].join(","),_embed:i4});return w5({path:a,data:r,method:"POST"}).then((e=>{const{story_poster:t,...n}=e,r=t?{...t,isExternal:!t.id}:{id:0,height:0,width:0,url:"",needsProxy:!1,isExternal:!1};return{...(0,t5.snakeToCamelCaseObjectKeys)(n),featuredMedia:r}}))}function u4(e,t){const{storyId:n}=t,r=c4(t,e.encodeMarkup);return w5({path:`${e.api.stories}${n}/autosaves/`,data:r,method:"POST"}).then((e=>(0,t5.snakeToCamelCaseObjectKeys)(e,["story_data"])))}function p4(e,t){let{mediaType:n,searchTerm:r,pagingNum:a}=t,o=(0,R3.default)(e.api.media,{context:"view",per_page:50,page:a,_web_stories_envelope:!0,_fields:l4});return n&&(o=(0,R3.default)(o,{media_type:n})),r&&(o=(0,R3.default)(o,{search:r})),w5({path:o}).then((e=>{let{body:t,headers:n}=e;return{data:t.map(G3),headers:{...n,totalItems:n["X-WP-Total"],totalPages:n["X-WP-TotalPages"]}}}))}function m4(e){const t=(0,R3.default)(e.api.media,{context:"view",per_page:10,_fields:"source_url"});return w5({path:t}).then((e=>e.map((e=>e.source_url))))}function g4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:l4});return w5({path:n}).then(G3)}async function f4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"meta.web_stories_muted_id"}),r=await w5({path:n});return r?.meta?.web_stories_muted_id?g4(e,r.meta.web_stories_muted_id):null}async function h4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"meta.web_stories_optimized_id"}),r=await w5({path:n});return r?.meta?.web_stories_optimized_id?g4(e,r.meta.web_stories_optimized_id):null}async function b4(e,t){const n=(0,R3.default)(`${e.api.media}${t}/`,{context:"view",_fields:"featured_media"}),r=await w5({path:n});return r?.featured_media?g4(e,r.featured_media):null}function E4(e,t,n){const{originalId:r,mediaId:a,storyId:o,templateId:i,isMuted:l,mediaSource:s,trimData:c,baseColor:d,blurHash:u,isGif:p,altText:m}=n,g={web_stories_media_source:s,web_stories_is_muted:l,post:i||o||a,original_id:r,web_stories_trim_data:c,web_stories_base_color:d,web_stories_blurhash:u,alt_text:m};void 0!==p&&(g.meta={web_stories_is_gif:p}),Object.entries(g).forEach((e=>{let[t,n]=e;void 0===n&&delete g[t]}));const f=new window.FormData;return f.append("file",t,t.name||t.type.replace("/",".")),Object.entries(g).forEach((e=>{let[t,n]=e;return j3(f,t,n)})),w5({path:e.api.media,body:f,method:"POST"}).then((e=>G3(e)))}function y4(e,t,n){const{baseColor:r,blurHash:a,isMuted:o,mediaSource:i,optimizedId:l,mutedId:s,posterId:c,storyId:d,altText:u}=n,p={meta:{web_stories_base_color:r,web_stories_blurhash:a,web_stories_optimized_id:l,web_stories_muted_id:s,web_stories_poster_id:c},web_stories_is_muted:o,web_stories_media_source:i,featured_media:c,post:d,alt_text:u};return Object.entries(p.meta).forEach((e=>{let[t,n]=e;void 0===n&&delete p.meta[t]})),Object.entries(p).forEach((e=>{let[t,n]=e;void 0===n&&delete p[t]})),w5({path:`${e.api.media}${t}/`,data:p,method:"POST"}).then(G3)}function _4(e,t){w5({path:(0,R3.default)(`${e.api.media}${t}/`,{_method:"DELETE"}),data:{force:!0},method:"POST"})}function v4(e,t){const n=(0,R3.default)(e.api.link,{url:t});return w5({path:n})}const w4=["id","story_data","body","headers"],T4="wp:featuredmedia";function S4(e){const{_embedded:t={},id:n,story_data:r={}}=e;return{id:n,elements:[],...r,templateId:n,image:{id:t?.["wp:featuredmedia"]?.[0].id||0,height:t?.["wp:featuredmedia"]?.[0]?.media_details?.height||0,width:t?.["wp:featuredmedia"]?.[0]?.media_details?.width||0,url:t?.["wp:featuredmedia"]?.[0]?.source_url||"",needsProxy:!1,isExternal:!1}}}function C4(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=100,r=(0,R3.default)(e.api.pageTemplates,{context:"edit",per_page:n,page:t,_web_stories_envelope:!0,_fields:w4,_embed:T4});return w5({path:r}).then((e=>{let{headers:n,body:r}=e;const a=parseInt(n["X-WP-TotalPages"]);return{templates:r.map(S4),hasMore:a>t}}))}function I4(e,t){return w5({path:e.api.pageTemplates,data:{...t,status:"publish"},method:"POST"}).then(S4)}function x4(e,t,n){return w5({path:`${e.api.pageTemplates}${t}/`,data:{...n},method:"POST"}).then(S4)}function A4(e,t){return w5({path:(0,R3.default)(`${e.api.pageTemplates}${t}/`,{_method:"DELETE"}),data:{force:!0},method:"POST"})}function k4(e){return{id:e.id,trackingOptin:e.meta.web_stories_tracking_optin,onboarding:e.meta.web_stories_onboarding,mediaOptimization:e.meta.web_stories_media_optimization}}function O4(e){return w5({path:e.api.currentUser}).then(k4)}function P4(e,t){const{trackingOptin:n,onboarding:r,mediaOptimization:a}=t,o={meta:{web_stories_tracking_optin:n,web_stories_onboarding:r,web_stories_media_optimization:a}};return Object.entries(o.meta).forEach((e=>{let[t,n]=e;void 0===n&&delete o.meta[t]})),w5({path:e.api.currentUser,method:"POST",data:o}).then(k4)}function N4(e,t){const n=(0,R3.default)(e.api.hotlink,{url:t});return w5({path:n}).then(t5.snakeToCamelCaseObjectKeys)}function M4(e,t){return(0,R3.default)(e.api.proxy,{url:t,_wpnonce:e.nonce})}async function R4(e){const t=await w5({path:(0,R3.default)(e.api.taxonomies,{type:e.postType,context:"edit",show_ui:"true"})});return Object.values(t).map((e=>(e.restPath=e._links?.["wp:items"]?.[0]?.href,delete e._links,(0,t5.snakeToCamelCaseObjectKeys)(e,["capabilities","visibility"]))))}function L4(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return w5({url:(0,R3.default)(t,n)})}function D4(e,t,n){return w5({url:(0,R3.default)(t,n),method:"POST"})}function B4(e,t){let{include:n,search:r,service:a}=t,o=(0,R3.default)(`${e.api.fonts}`,{search:r,service:a});const i=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",").filter(Boolean).map((e=>`include[]=${encodeURI(e)}`)).join("&")}(n);return i.length>0&&(o+=o.includes("?")?`&${i}`:`?${i}`),w5({path:o})}async function F4(e,t,n,r,a){const o=await w5({path:(0,R3.default)(e.api.products,{per_page:50,page:n,search:t,orderby:r,order:a,_web_stories_envelope:!0})});return{products:o?.body,hasNextPage:"true"===o?.headers["X-WP-HasNextPage"]}}const H4=(0,p.createGlobalStyle)([".","{top:","px !important;left:","px !important;}body.folded .","{left:","px !important;}"],S.OVERLAY_CLASS,32,160,S.OVERLAY_CLASS,36);window.webStories=window.webStories||{},window.webStories.initializeStoryEditor=(e,t,n)=>{const r=document.getElementById(e);(0,e5.setAppElement)(r),(0,nu.updateSettings)(t.locale),(0,P.initializeTracking)("Editor"),Qn.default.forEach(Mn.registerElementType),n.story=n.story?Y3(n.story):null;const a={...t,apiCallbacks:(0,n5.default)(s,t),additionalTips:V5,MediaUpload:M3,styleConstants:{topOffset:32,leftOffset:36}};(0,u.render)(c.createElement(u.StrictMode,null,c.createElement(Pd,{config:a,initialEdits:n},c.createElement(H4,null),c.createElement(S3,null),c.createElement(r5,null),c.createElement(a5,null),c.createElement(V3,null),c.createElement(K3,null),c.createElement(r4,null),c.createElement(H3,null))),r)}}},i={};function __webpack_require__(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.m=o,__webpack_require__.amdO={},e=[],__webpack_require__.O=(t,n,r,a)=>{if(!n){var o=1/0;for(c=0;c<e.length;c++){for(var[n,r,a]=e[c],i=!0,l=0;l<n.length;l++)(!1&a||o>=a)&&Object.keys(__webpack_require__.O).every((e=>__webpack_require__.O[e](n[l])))?n.splice(l--,1):(i=!1,a<o&&(o=a));if(i){e.splice(c--,1);var s=r();void 0!==s&&(t=s)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,r,a]},__webpack_require__.F={},__webpack_require__.E=e=>{Object.keys(__webpack_require__.F).map((t=>{__webpack_require__.F[t](e)}))},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var a=Object.create(null);__webpack_require__.r(a);var o={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach((t=>o[t]=()=>e[t]));return o.default=()=>e,__webpack_require__.d(a,o),a},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.f={},__webpack_require__.e=e=>Promise.all(Object.keys(__webpack_require__.f).reduce(((t,n)=>(__webpack_require__.f[n](e,t),t)),[])),__webpack_require__.u=e=>({8:"chunk-web-stories-template-5",69:"chunk-web-stories-template-60-metaData",274:"chunk-web-stories-template-56",341:"chunk-react-color",354:"chunk-web-stories-template-19",410:"chunk-web-stories-template-24",533:"chunk-web-stories-template-42-metaData",824:"chunk-web-stories-template-36",827:"chunk-web-stories-template-27-metaData",884:"chunk-web-stories-template-18-metaData",907:"chunk-web-stories-template-57",1049:"chunk-web-stories-template-37",1066:"chunk-web-stories-template-44-metaData",1197:"chunk-web-animations-js",1231:"chunk-web-stories-template-12",1340:"chunk-web-stories-template-30-metaData",1380:"chunk-web-stories-template-33-metaData",1403:"chunk-web-stories-template-37-metaData",1738:"chunk-web-stories-template-32",1789:"chunk-web-stories-template-43",1813:"chunk-web-stories-template-10-metaData",1847:"chunk-web-stories-template-12-metaData",1858:"chunk-web-stories-template-1",1970:"chunk-web-stories-template-22-metaData",2068:"chunk-web-stories-template-46",2167:"chunk-web-stories-template-32-metaData",2191:"chunk-web-stories-template-49-metaData",2235:"chunk-web-stories-template-51-metaData",2246:"chunk-web-stories-template-45-metaData",2319:"chunk-web-stories-template-31-metaData",2338:"chunk-web-stories-template-25",2374:"chunk-web-stories-template-2-metaData",2392:"chunk-react-calendar",2454:"chunk-web-stories-template-6",2476:"chunk-web-stories-textset-0",2558:"chunk-web-stories-template-53-metaData",2563:"chunk-web-stories-textset-4",2634:"chunk-web-stories-textset-3",2761:"chunk-web-stories-textset-7",2776:"chunk-web-stories-template-9-metaData",2830:"chunk-web-stories-template-36-metaData",2880:"chunk-web-stories-template-8",2894:"chunk-web-stories-template-34-metaData",3041:"chunk-web-stories-template-15-metaData",3182:"chunk-html-to-image",3194:"chunk-web-stories-template-29-metaData",3245:"chunk-web-stories-template-28",3289:"chunk-web-stories-template-43-metaData",3304:"chunk-web-stories-template-49",3441:"chunk-web-stories-template-45",3529:"chunk-web-stories-template-39",3710:"chunk-web-stories-template-35",3772:"chunk-web-stories-template-60",3777:"chunk-web-stories-template-34",3864:"chunk-web-stories-template-4-metaData",3871:"chunk-web-stories-textset-2",3969:"chunk-web-stories-template-9",4051:"chunk-web-stories-template-40-metaData",4142:"chunk-web-stories-template-29",4178:"chunk-web-stories-template-24-metaData",4386:"chunk-web-stories-template-41",4585:"chunk-web-stories-template-38-metaData",4874:"chunk-web-stories-template-35-metaData",5016:"chunk-web-stories-template-21-metaData",5040:"chunk-web-stories-template-16",5157:"chunk-web-stories-template-33",5312:"chunk-web-stories-template-14",5372:"chunk-web-stories-template-6-metaData",5397:"chunk-web-stories-template-8-metaData",5432:"chunk-web-stories-template-26",5535:"chunk-web-stories-template-15",5543:"chunk-web-stories-template-31",5553:"chunk-web-stories-template-20-metaData",5570:"chunk-web-stories-template-54-metaData",5573:"chunk-web-stories-template-52-metaData",5575:"chunk-resize-observer-polyfill",5748:"chunk-web-stories-template-54",5835:"chunk-web-stories-template-30",6053:"chunk-web-stories-template-16-metaData",6188:"chunk-web-stories-template-42",6204:"chunk-web-stories-template-0-metaData",6271:"chunk-web-stories-template-39-metaData",6305:"chunk-web-stories-template-5-metaData",6311:"chunk-web-stories-template-23-metaData",6353:"chunk-web-stories-template-1-metaData",6406:"chunk-web-stories-template-4",6428:"chunk-web-stories-template-13",6500:"chunk-web-stories-template-0",6517:"chunk-web-stories-template-52",6539:"chunk-web-stories-template-58-metaData",6592:"chunk-web-stories-template-51",6641:"chunk-web-stories-template-28-metaData",6766:"chunk-web-stories-template-19-metaData",6841:"chunk-web-stories-template-58",6852:"chunk-web-stories-template-27",7098:"chunk-ffmpeg",7131:"chunk-web-stories-template-20",7314:"chunk-web-stories-template-25-metaData",7343:"chunk-web-stories-template-47",7346:"chunk-web-stories-template-7",7399:"chunk-web-stories-template-38",7441:"chunk-web-stories-template-48",7498:"chunk-colorthief",7502:"chunk-web-stories-template-23",7528:"chunk-web-stories-template-14-metaData",7586:"chunk-web-stories-template-40",7588:"chunk-web-stories-template-55-metaData",7611:"chunk-web-stories-textset-6",7685:"chunk-web-stories-template-59",7798:"chunk-web-stories-template-50-metaData",7799:"chunk-web-stories-template-3",7863:"chunk-web-stories-template-47-metaData",7952:"chunk-web-stories-template-3-metaData",8022:"chunk-web-stories-template-26-metaData",8189:"chunk-web-stories-template-56-metaData",8203:"chunk-web-stories-template-44",8257:"chunk-web-stories-template-22",8344:"chunk-web-stories-template-10",8422:"chunk-web-stories-template-41-metaData",8551:"chunk-web-stories-template-18",8624:"chunk-focus-visible",8768:"chunk-web-stories-template-11-metaData",8856:"chunk-web-stories-template-48-metaData",9027:"chunk-web-stories-textset-1",9074:"chunk-web-stories-template-7-metaData",9233:"chunk-web-stories-template-53",9288:"chunk-web-stories-template-55",9302:"chunk-web-stories-template-17-metaData",9375:"chunk-web-stories-template-57-metaData",9393:"chunk-web-stories-template-59-metaData",9557:"chunk-web-stories-template-13-metaData",9591:"chunk-web-stories-template-50",9603:"chunk-web-stories-template-17",9607:"chunk-web-stories-template-2",9700:"chunk-web-stories-template-11",9738:"chunk-web-stories-template-46-metaData",9811:"chunk-web-stories-template-21",9843:"chunk-web-stories-textset-5"}[e]+".js?v="+{8:"62f48c943362be75dde6",69:"ee8bf6a37ece865f9fde",274:"49986a50cfec69f8a8d8",341:"10acf2130e40fed0d75a",354:"21701c9bb7dc9de8e903",410:"f2b1685a440ddb51f829",533:"7031543bbf0ac9875728",824:"cca56f39ee2354beeb1c",827:"4f4dc18fab8674b3fa25",884:"d121f5f5280f132b5597",907:"ddf0d94935aeeb5f9b29",1049:"e051f32082205f79d19c",1066:"a635c0f83fd51db6ac06",1197:"45f526a251ead370165a",1231:"0e881ddf3a5dca4f5b43",1340:"658339eae27be828c9d2",1380:"2ca16dfc5daadd31e068",1403:"88b6b87bdb2c9e25e03e",1738:"c6d12e0233116e40adbe",1789:"d24574fa712b1479f5e8",1813:"38319dc6a0a3f890b221",1847:"a4057b4c746081be9263",1858:"a72c93c859283416ebac",1970:"78b7a2bd8812f2bf6406",2068:"47c0a6bcf385f89e3eee",2167:"63718570f9ee6fc4c997",2191:"9e9359bd105429600d80",2235:"235e98e7f0a194e663df",2246:"ad654f9224067fefa563",2319:"de459568067e6a86c7ac",2338:"45b0a0bddeaeccff92e4",2374:"bdfd30cc435b8733776b",2392:"fe88e944141fdcaf426f",2454:"c1f02d36e388601ee93a",2476:"cf7b7c8b0eeee417c304",2558:"dd3a56a23eef473743c2",2563:"c3d2e3c67c5096c4aa6d",2634:"7d5197e7c135c833e8d8",2761:"974eb6934de2afc38df2",2776:"2a94f2790f69801857f7",2830:"f8c41181823fb6e56a2a",2880:"5a970aa4c5ee275902ed",2894:"d72ef1b8371f0de9d4b7",3041:"acafde2d8f1a6980eb81",3182:"366847cef960fbf44a89",3194:"76e25e1bb5380222d1e6",3245:"dd9ae4e530a10801c9e9",3289:"667fa6d0a0f6165df08a",3304:"7c66775981ad6712995c",3441:"db38a2c18c581dab30d1",3529:"f735383152e06dee91d7",3710:"681c6765fe6ee63989df",3772:"0151a08850e7d199048e",3777:"32457dc282cf13690a58",3864:"205a38118d76188f1497",3871:"df558293ddbc80f5732f",3969:"5f3eeb34b188592586e9",4051:"a3859c6f25fb906796aa",4142:"00be70528ca40ed53b45",4178:"1bb9fee64db965ad4c77",4386:"ff7fe8d505c23dfcc14b",4585:"934e6e9b938e8e0c0832",4874:"8d02e508eb5953a8f03e",5016:"416c3be02c2ca809fc3f",5040:"280a87a741d45028bd72",5157:"b2e8a89540391dd72495",5312:"5ead1d2681b6c2e43ea0",5372:"8cff45ed4d0f60a1881d",5397:"59ce47b435a56f9e93f6",5432:"481f3754e9ebeb95086c",5535:"2ad146a9aff0b0c75a03",5543:"db8c05e7971e4e112526",5553:"46ade91fdf2e8a4501d5",5570:"1a2bca995e7c5853b966",5573:"d11139be60f7b14c9ffc",5575:"a97a5e5ec0e812a389ed",5748:"627091a0027160e28832",5835:"1d3dc9abe4467c369ae8",6053:"cd8f59acf99cb495fe77",6188:"3571ed18b36b107eb6dc",6204:"ffa8c4d1cc9dd090d896",6271:"49df2acd6d02d6aebdb7",6305:"f8bb7423de5e3aabca11",6311:"efd3cdbbbecec5cdafa2",6353:"78c4ce9232efce7cc087",6406:"6e024e0ebb0a89677d8b",6428:"6e42df44263b06907366",6500:"5b642d52229cff29396f",6517:"fe0aca5c0a8d5cf81a57",6539:"64a365f05a34a2adf367",6592:"535b235f72e0ff797e79",6641:"bade12d3bb5f6781a58f",6766:"1bc7a9e7a79469a5af79",6841:"73b31e266acf1281dcb1",6852:"35ddb0a2da2984a1b24b",7098:"c12e272d228a10b765cd",7131:"09333faf6e6735deb15e",7314:"979d5b962e46e47de7f7",7343:"8498b35b4fedfb63a2f9",7346:"10673013e512b913493a",7399:"e749dbd85fddb70d1d34",7441:"d269a6e18ed8f7a17697",7498:"afa32aef6dfc12d11c81",7502:"b6d691e97a889aa9db7b",7528:"8d631193e3fc67f254d9",7586:"47838fa1e9462f151802",7588:"ed34aaadc0ad2abddde5",7611:"287ab2128ad56bef327b",7685:"33264baee027a93c07f1",7798:"a03fe4c4b1d6abf8541f",7799:"37d47adb1bf1c3d9355b",7863:"582b6c2ce8eaad76fc82",7952:"f206bee0645c91e855ef",8022:"5bb8b28faa28034ae43b",8189:"37686cfc4a640c7e0f40",8203:"17070712208bfec54b06",8257:"2f339371692f425db1f0",8344:"e1e9ae4748303d0817ff",8422:"3f42e89ce0dd7e802975",8551:"1202b4bf2ee58bf65086",8624:"705c5bfc48fb43676444",8768:"04036e7d0f2b8b2c1b24",8856:"7e61600bafdf93fbef22",9027:"96de041a2c45d7717d50",9074:"c956f3be9f5f3f084d97",9233:"95aa91bc0f954778c4c0",9288:"678083dc9343a66fbd71",9302:"b0227828b5a500a82b1d",9375:"41a6095cbe70256cfb67",9393:"363f78c9382ef94434e8",9557:"39986c27dabeda720306",9591:"16deb0841809d79ab2eb",9603:"573e10b8e766bab31c0a",9607:"74a4b305f26ead9d17b0",9700:"84bb5757f7155a91741e",9738:"d8b00ffb3193a85920f1",9811:"47d5f65f0cf96d4f12ce",9843:"9e5f47d23114e0a591f9"}[e]),__webpack_require__.miniCssF=e=>{},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},a="web-stories-wp:",__webpack_require__.l=(e,t,n,o)=>{if(r[e])r[e].push(t);else{var i,l;if(void 0!==n)for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var d=s[c];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==a+n){i=d;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,__webpack_require__.nc&&i.setAttribute("nonce",__webpack_require__.nc),i.setAttribute("data-webpack",a+n),i.src=e),r[e]=[t];var u=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach((e=>e(n))),t)return t(n)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),l&&document.head.appendChild(i)}},__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="",(()=>{var e={9078:0};__webpack_require__.f.j=(t,n)=>{var r=__webpack_require__.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var a=new Promise(((n,a)=>r=e[t]=[n,a]));n.push(r[2]=a);var o=__webpack_require__.p+__webpack_require__.u(t),i=new Error;__webpack_require__.l(o,(n=>{if(__webpack_require__.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var a=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,r[1](i)}}),"chunk-"+t,t)}},__webpack_require__.F.j=t=>{if(!__webpack_require__.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");__webpack_require__.nc&&n.setAttribute("nonce",__webpack_require__.nc),n.rel="prefetch",n.as="script",n.href=__webpack_require__.p+__webpack_require__.u(t),document.head.appendChild(n)}},__webpack_require__.O.j=t=>0===e[t];var t=(t,n)=>{var r,a,[o,i,l]=n,s=0;if(o.some((t=>0!==e[t]))){for(r in i)__webpack_require__.o(i,r)&&(__webpack_require__.m[r]=i[r]);if(l)var c=l(__webpack_require__)}for(t&&t(n);s<o.length;s++)a=o[s],__webpack_require__.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return __webpack_require__.O(c)},n=globalThis.webpackChunkweb_stories_wp=globalThis.webpackChunkweb_stories_wp||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),__webpack_require__.O(0,[9078],(()=>{__webpack_require__.E(7498)}),5);var l=__webpack_require__.O(void 0,[3617,2505,1590,1814],(()=>__webpack_require__(52230)));l=__webpack_require__.O(l)})();
includes/Admin/Dashboard.php CHANGED
@@ -322,7 +322,7 @@ class Dashboard extends Service_Base {
322
  '_embed' => rawurlencode(
323
  implode(
324
  ',',
325
- [ 'wp:lock', 'wp:lockuser', 'author', 'wp:featuredmedia' ]
326
  )
327
  ),
328
  'context' => 'edit',
@@ -348,6 +348,7 @@ class Dashboard extends Service_Base {
348
  'date_gmt',
349
  'modified',
350
  'modified_gmt',
 
351
  'link',
352
  'preview_link',
353
  'edit_link',
322
  '_embed' => rawurlencode(
323
  implode(
324
  ',',
325
+ [ 'wp:lock', 'wp:lockuser', 'author' ]
326
  )
327
  ),
328
  'context' => 'edit',
348
  'date_gmt',
349
  'modified',
350
  'modified_gmt',
351
+ 'story_poster',
352
  'link',
353
  'preview_link',
354
  'edit_link',
includes/REST_API/Stories_Controller.php CHANGED
@@ -27,6 +27,7 @@
27
  namespace Google\Web_Stories\REST_API;
28
 
29
  use Google\Web_Stories\Demo_Content;
 
30
  use Google\Web_Stories\Story_Post_Type;
31
  use WP_Error;
32
  use WP_Post;
@@ -140,6 +141,13 @@ class Stories_Controller extends Stories_Base_Controller {
140
  $data['embed_post_link'] = add_query_arg( [ 'from-web-story' => $post->ID ], admin_url( 'post-new.php' ) );
141
  }
142
 
 
 
 
 
 
 
 
143
  $data = $this->filter_response_by_context( $data, $context );
144
  $links = $response->get_links();
145
 
@@ -232,6 +240,35 @@ class Stories_Controller extends Stories_Base_Controller {
232
  'default' => '',
233
  ];
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  $schema['properties']['status']['enum'][] = 'auto-draft';
236
 
237
  $this->schema = $schema;
@@ -608,4 +645,48 @@ class Stories_Controller extends Stories_Base_Controller {
608
 
609
  return $links;
610
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
611
  }
27
  namespace Google\Web_Stories\REST_API;
28
 
29
  use Google\Web_Stories\Demo_Content;
30
+ use Google\Web_Stories\Media\Image_Sizes;
31
  use Google\Web_Stories\Story_Post_Type;
32
  use WP_Error;
33
  use WP_Post;
141
  $data['embed_post_link'] = add_query_arg( [ 'from-web-story' => $post->ID ], admin_url( 'post-new.php' ) );
142
  }
143
 
144
+ if ( rest_is_field_included( 'story_poster', $fields ) ) {
145
+ $story_poster = $this->get_story_poster( $post );
146
+ if ( $story_poster ) {
147
+ $data['story_poster'] = $story_poster;
148
+ }
149
+ }
150
+
151
  $data = $this->filter_response_by_context( $data, $context );
152
  $links = $response->get_links();
153
 
240
  'default' => '',
241
  ];
242
 
243
+ $schema['properties']['story_poster'] = [
244
+ 'description' => __( 'Story poster image.', 'web-stories' ),
245
+ 'type' => 'object',
246
+ 'properties' => [
247
+ 'id' => [
248
+ 'type' => 'integer',
249
+ 'description' => __( 'Poster ID', 'web-stories' ),
250
+ ],
251
+ 'needsProxy' => [
252
+ 'description' => __( 'If poster needs to be proxied', 'web-stories' ),
253
+ 'type' => 'boolean',
254
+ ],
255
+ 'height' => [
256
+ 'type' => 'integer',
257
+ 'description' => __( 'Poster height', 'web-stories' ),
258
+ ],
259
+ 'url' => [
260
+ 'description' => __( 'Poster URL.', 'web-stories' ),
261
+ 'type' => 'string',
262
+ 'format' => 'uri',
263
+ ],
264
+ 'width' => [
265
+ 'description' => __( 'Poster width.', 'web-stories' ),
266
+ 'type' => 'integer',
267
+ ],
268
+ ],
269
+ 'default' => null,
270
+ ];
271
+
272
  $schema['properties']['status']['enum'][] = 'auto-draft';
273
 
274
  $this->schema = $schema;
645
 
646
  return $links;
647
  }
648
+
649
+
650
+ /**
651
+ * Helper method to get the story poster.
652
+ *
653
+ * Checks for the regular featured image as well as a hotlinked image.
654
+ *
655
+ * @since 1.23.2
656
+ *
657
+ * @param WP_Post $post Post Object.
658
+ * @return array{url:string, width: int, height: int, needsProxy: bool, id?: int}|null Story poster data.
659
+ */
660
+ private function get_story_poster( WP_Post $post ): ?array {
661
+ $thumbnail_id = (int) get_post_thumbnail_id( $post );
662
+
663
+ if ( 0 !== $thumbnail_id ) {
664
+ $poster_src = wp_get_attachment_image_src( $thumbnail_id, Image_Sizes::POSTER_PORTRAIT_IMAGE_SIZE );
665
+ if ( $poster_src ) {
666
+ [$url, $width, $height] = $poster_src;
667
+
668
+ return [
669
+ 'id' => $thumbnail_id,
670
+ 'url' => $url,
671
+ 'width' => $width,
672
+ 'height' => $height,
673
+ 'needsProxy' => false,
674
+ ];
675
+ }
676
+ } else {
677
+
678
+ /**
679
+ * Poster.
680
+ *
681
+ * @var array{url:string, width: int, height: int, needsProxy: bool}|false $poster
682
+ */
683
+ $poster = get_post_meta( $post->ID, Story_Post_Type::POSTER_META_KEY, true );
684
+
685
+ if ( ! empty( $poster ) ) {
686
+ return $poster;
687
+ }
688
+ }
689
+
690
+ return null;
691
+ }
692
  }
includes/Story_Post_Type.php CHANGED
@@ -238,7 +238,7 @@ class Story_Post_Type extends Post_Type_Base implements HasRequirements, HasMeta
238
  'description' => __( 'Poster height', 'web-stories' ),
239
  ],
240
  'url' => [
241
- 'description' => __( 'Poster url.', 'web-stories' ),
242
  'type' => 'string',
243
  'format' => 'uri',
244
  ],
@@ -247,7 +247,6 @@ class Story_Post_Type extends Post_Type_Base implements HasRequirements, HasMeta
247
  'type' => 'integer',
248
  ],
249
  ],
250
-
251
  ],
252
  ],
253
  'default' => [],
238
  'description' => __( 'Poster height', 'web-stories' ),
239
  ],
240
  'url' => [
241
+ 'description' => __( 'Poster URL.', 'web-stories' ),
242
  'type' => 'string',
243
  'format' => 'uri',
244
  ],
247
  'type' => 'integer',
248
  ],
249
  ],
 
250
  ],
251
  ],
252
  'default' => [],
includes/templates/admin/edit-story.php CHANGED
@@ -95,7 +95,7 @@ $story_query_params = [
95
  '_embed' => rawurlencode(
96
  implode(
97
  ',',
98
- [ 'wp:featuredmedia', 'wp:lockuser', 'author', 'wp:publisherlogo', 'wp:term' ]
99
  )
100
  ),
101
  'context' => 'edit',
@@ -111,7 +111,7 @@ $story_query_params = [
111
  'modified',
112
  'excerpt',
113
  'link',
114
- 'meta.web_stories_poster',
115
  'story_data',
116
  'preview_link',
117
  'edit_link',
95
  '_embed' => rawurlencode(
96
  implode(
97
  ',',
98
+ [ 'wp:lockuser', 'author', 'wp:publisherlogo', 'wp:term' ]
99
  )
100
  ),
101
  'context' => 'edit',
111
  'modified',
112
  'excerpt',
113
  'link',
114
+ 'story_poster',
115
  'story_data',
116
  'preview_link',
117
  'edit_link',
includes/vendor/autoload.php CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInitdd82be23d1ee77c18af581ffc7b03492::getLoader();
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInit2c173498cb65bf3731da0fa72ae22ac0::getLoader();
includes/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitdd82be23d1ee77c18af581ffc7b03492
6
  {
7
  private static $loader;
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInitdd82be23d1ee77c18af581ffc7b03492
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitdd82be23d1ee77c18af581ffc7b03492', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Google_Web_Stories_Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInitdd82be23d1ee77c18af581ffc7b03492', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Google_Web_Stories_Composer\Autoload\ComposerStaticInitdd82be23d1ee77c18af581ffc7b03492::getInitializer($loader));
31
 
32
  $loader->setClassMapAuthoritative(true);
33
  $loader->register(true);
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit2c173498cb65bf3731da0fa72ae22ac0
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit2c173498cb65bf3731da0fa72ae22ac0', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Google_Web_Stories_Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit2c173498cb65bf3731da0fa72ae22ac0', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
+ call_user_func(\Google_Web_Stories_Composer\Autoload\ComposerStaticInit2c173498cb65bf3731da0fa72ae22ac0::getInitializer($loader));
31
 
32
  $loader->setClassMapAuthoritative(true);
33
  $loader->register(true);
includes/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Google_Web_Stories_Composer\Autoload;
6
 
7
- class ComposerStaticInitdd82be23d1ee77c18af581ffc7b03492
8
  {
9
  public static $classMap = array (
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -187,7 +187,7 @@ class ComposerStaticInitdd82be23d1ee77c18af581ffc7b03492
187
  public static function getInitializer(ClassLoader $loader)
188
  {
189
  return \Closure::bind(function () use ($loader) {
190
- $loader->classMap = ComposerStaticInitdd82be23d1ee77c18af581ffc7b03492::$classMap;
191
 
192
  }, null, ClassLoader::class);
193
  }
4
 
5
  namespace Google_Web_Stories_Composer\Autoload;
6
 
7
+ class ComposerStaticInit2c173498cb65bf3731da0fa72ae22ac0
8
  {
9
  public static $classMap = array (
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
187
  public static function getInitializer(ClassLoader $loader)
188
  {
189
  return \Closure::bind(function () use ($loader) {
190
+ $loader->classMap = ComposerStaticInit2c173498cb65bf3731da0fa72ae22ac0::$classMap;
191
 
192
  }, null, ClassLoader::class);
193
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@
3
  Contributors: google
4
  Tested up to: 6.0
5
  Requires at least: 5.7
6
- Stable tag: 1.23.0
7
  License: Apache License 2.0
8
  License URI: https://www.apache.org/licenses/LICENSE-2.0
9
  Tags: web stories, stories, amp, storytelling, google
@@ -109,29 +109,27 @@ Web Stories are powered by [AMP](https://amp.dev/), which adds some restrictions
109
 
110
  For the plugin's full changelog, please see [the Releases page on GitHub](https://github.com/googleforcreators/web-stories-wp/releases).
111
 
112
- = 1.23.1 =
 
 
113
 
114
- **Release Date:** July 25, 2022.
115
 
116
  * Fixes an issue with story poster images not saving correctly.
117
 
118
  = 1.23.0 =
119
 
120
- **Release Date:** July 20, 2022.
121
-
122
  * New feature: record videos, GIFs, still pictures, and background audio directly within the editor.
123
  * New feature: added support for hotlinking story posters, video posters, and link icons.
124
  * New feature: you can now change the heading levels used for text elements in the Style panel.
125
  * Bumped minimum WordPress version requirement to 5.7.
126
  * Bug fixes and performance improvements.
127
 
128
- = 1.22.1 =
129
-
130
- **Release Date:** June 30, 2022.
131
 
132
- * Fixes an issue with inserting external media by URL.
133
 
134
- == Upgrade Notice ==
135
 
136
  = 1.23.1 =
137
 
@@ -140,7 +138,3 @@ This release fixes an issue with story poster images not saving correctly.
140
  = 1.23.0 =
141
 
142
  This release introduces webcam recording, more hotlinking capabilities, and a UI to change heading levels in the editor.
143
-
144
- = 1.22.1 =
145
-
146
- This release fixes an issue with inserting external media by URL.
3
  Contributors: google
4
  Tested up to: 6.0
5
  Requires at least: 5.7
6
+ Stable tag: 1.23.1
7
  License: Apache License 2.0
8
  License URI: https://www.apache.org/licenses/LICENSE-2.0
9
  Tags: web stories, stories, amp, storytelling, google
109
 
110
  For the plugin's full changelog, please see [the Releases page on GitHub](https://github.com/googleforcreators/web-stories-wp/releases).
111
 
112
+ = 1.23.2 =
113
+
114
+ * Fixes another issue related to story poster images.
115
 
116
+ = 1.23.1 =
117
 
118
  * Fixes an issue with story poster images not saving correctly.
119
 
120
  = 1.23.0 =
121
 
 
 
122
  * New feature: record videos, GIFs, still pictures, and background audio directly within the editor.
123
  * New feature: added support for hotlinking story posters, video posters, and link icons.
124
  * New feature: you can now change the heading levels used for text elements in the Style panel.
125
  * Bumped minimum WordPress version requirement to 5.7.
126
  * Bug fixes and performance improvements.
127
 
128
+ == Upgrade Notice ==
 
 
129
 
130
+ = 1.23.2 =
131
 
132
+ This release fixes another issue related to story poster images.
133
 
134
  = 1.23.1 =
135
 
138
  = 1.23.0 =
139
 
140
  This release introduces webcam recording, more hotlinking capabilities, and a UI to change heading levels in the editor.
 
 
 
 
third-party/vendor/autoload.php CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInit668ee93ce1171c0cf5a6afdaedc6aafb::getLoader();
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInit753d6b22e8b45810fd900ff11a15c789::getLoader();
third-party/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit668ee93ce1171c0cf5a6afdaedc6aafb
6
  {
7
  private static $loader;
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit668ee93ce1171c0cf5a6afdaedc6aafb
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit668ee93ce1171c0cf5a6afdaedc6aafb', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Google_Web_Stories_Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit668ee93ce1171c0cf5a6afdaedc6aafb', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Google_Web_Stories_Composer\Autoload\ComposerStaticInit668ee93ce1171c0cf5a6afdaedc6aafb::getInitializer($loader));
31
 
32
  $loader->setClassMapAuthoritative(true);
33
  $loader->register(true);
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit753d6b22e8b45810fd900ff11a15c789
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit753d6b22e8b45810fd900ff11a15c789', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Google_Web_Stories_Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit753d6b22e8b45810fd900ff11a15c789', 'loadClassLoader'));
28
 
29
  require __DIR__ . '/autoload_static.php';
30
+ call_user_func(\Google_Web_Stories_Composer\Autoload\ComposerStaticInit753d6b22e8b45810fd900ff11a15c789::getInitializer($loader));
31
 
32
  $loader->setClassMapAuthoritative(true);
33
  $loader->register(true);
third-party/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Google_Web_Stories_Composer\Autoload;
6
 
7
- class ComposerStaticInit668ee93ce1171c0cf5a6afdaedc6aafb
8
  {
9
  public static $classMap = array (
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -1213,7 +1213,7 @@ class ComposerStaticInit668ee93ce1171c0cf5a6afdaedc6aafb
1213
  public static function getInitializer(ClassLoader $loader)
1214
  {
1215
  return \Closure::bind(function () use ($loader) {
1216
- $loader->classMap = ComposerStaticInit668ee93ce1171c0cf5a6afdaedc6aafb::$classMap;
1217
 
1218
  }, null, ClassLoader::class);
1219
  }
4
 
5
  namespace Google_Web_Stories_Composer\Autoload;
6
 
7
+ class ComposerStaticInit753d6b22e8b45810fd900ff11a15c789
8
  {
9
  public static $classMap = array (
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
1213
  public static function getInitializer(ClassLoader $loader)
1214
  {
1215
  return \Closure::bind(function () use ($loader) {
1216
+ $loader->classMap = ComposerStaticInit753d6b22e8b45810fd900ff11a15c789::$classMap;
1217
 
1218
  }, null, ClassLoader::class);
1219
  }
web-stories.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin URI: https://wp.stories.google/
10
  * Author: Google
11
  * Author URI: https://opensource.google.com/
12
- * Version: 1.23.1
13
  * Requires at least: 5.7
14
  * Requires PHP: 7.2
15
  * Text Domain: web-stories
@@ -40,7 +40,7 @@ if ( ! defined( 'ABSPATH' ) ) {
40
  exit;
41
  }
42
 
43
- define( 'WEBSTORIES_VERSION', '1.23.1' );
44
  define( 'WEBSTORIES_DB_VERSION', '3.0.14' );
45
  define( 'WEBSTORIES_AMP_VERSION', '2.3.0' ); // Version of the AMP library included in the plugin.
46
  define( 'WEBSTORIES_PLUGIN_FILE', __FILE__ );
9
  * Plugin URI: https://wp.stories.google/
10
  * Author: Google
11
  * Author URI: https://opensource.google.com/
12
+ * Version: 1.23.2
13
  * Requires at least: 5.7
14
  * Requires PHP: 7.2
15
  * Text Domain: web-stories
40
  exit;
41
  }
42
 
43
+ define( 'WEBSTORIES_VERSION', '1.23.2' );
44
  define( 'WEBSTORIES_DB_VERSION', '3.0.14' );
45
  define( 'WEBSTORIES_AMP_VERSION', '2.3.0' ); // Version of the AMP library included in the plugin.
46
  define( 'WEBSTORIES_PLUGIN_FILE', __FILE__ );