You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
167 lines
4.1 MiB
JavaScript
167 lines
4.1 MiB
JavaScript
7 months ago
|
(()=>{var e,t,a,n,r,l={5822:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var n,r,l=a(67294);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const SvgAlignBottom=e=>{let{title:t,titleId:a,...C}=e;return l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},C),t?l.createElement("title",{id:a},t):null,n||(n=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M8.5 21h15"})),r||(r=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.5 10.5A1.5 1.5 0 0 0 14 12v5a1.5 1.5 0 0 0 1.5 1.5h1A1.5 1.5 0 0 0 18 17v-5a1.5 1.5 0 0 0-1.5-1.5h-1Z",clipRule:"evenodd"})))},C=(0,l.memo)(SvgAlignBottom)},10206:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var n,r,l=a(67294);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const SvgAlignCenter=e=>{let{title:t,titleId:a,...C}=e;return l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},C),t?l.createElement("title",{id:a},t):null,n||(n=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M16 8.5v3M16 20.5v3"})),r||(r=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.5 14a1.5 1.5 0 0 0-1.5 1.5v1a1.5 1.5 0 0 0 1.5 1.5h5a1.5 1.5 0 0 0 1.5-1.5v-1a1.5 1.5 0 0 0-1.5-1.5h-5Z",clipRule:"evenodd"})))},C=(0,l.memo)(SvgAlignCenter)},18118:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var n,r,l=a(67294);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const SvgAlignLeft=e=>{let{title:t,titleId:a,...C}=e;return l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},C),t?l.createElement("title",{id:a},t):null,n||(n=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M11 8.5v15"})),r||(r=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 14a1.5 1.5 0 0 0-1.5 1.5v1A1.5 1.5 0 0 0 15 18h5a1.5 1.5 0 0 0 1.5-1.5v-1A1.5 1.5 0 0 0 20 14h-5Z",clipRule:"evenodd"})))},C=(0,l.memo)(SvgAlignLeft)},51527:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var n,r,l=a(67294);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const SvgAlignMiddle=e=>{let{title:t,titleId:a,...C}=e;return l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},C),t?l.createElement("title",{id:a},t):null,n||(n=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M8.5 16h3M20.5 16h3"})),r||(r=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.5 12a1.5 1.5 0 0 0-1.5 1.5v5a1.5 1.5 0 0 0 1.5 1.5h1a1.5 1.5 0 0 0 1.5-1.5v-5a1.5 1.5 0 0 0-1.5-1.5h-1Z",clipRule:"evenodd"})))},C=(0,l.memo)(SvgAlignMiddle)},63736:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var n,r,l=a(67294);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const SvgAlignRight=e=>{let{title:t,titleId:a,...C}=e;return l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},C),t?l.createElement("title",{id:a},t):null,n||(n=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",stro
|
||
|
(0,C.__)("Valid values are %1$s or %2$s","web-stories"),"scaleIn","scaleOut"),type:E.DirectionPicker,values:[f.ScaleIn,f.ScaleOut],defaultValue:f.ScaleIn},duration:{label:(0,C.__)("Duration","web-stories"),type:E.Number,unit:(0,C._x)("ms","Time in milliseconds","web-stories"),defaultValue:2e3}},ue={fill:"forwards",duration:1e3};function AnimationSpin(e,t){let{rotation:a=0,stopAngle:n=0,type:r,...l}=e;const o=N(t),C={...ue,...l},i={transform:[o`rotateZ(${O(a,"deg")})`,o`rotateZ(${O(n,"deg")})`]};return R(i,C)}E.Text,E.Text;const pe=1,me=0;const fe={rotateInDir:{label:(0,C.__)("Direction","web-stories"),type:E.DirectionPicker,values:[p.LeftToRight,p.RightToLeft],defaultValue:p.LeftToRight}};function ge(e,t){let{zoomDirection:a=f.ScaleOut,transformOrigin:n,duration:r=2e3,delay:o=0,easing:C="cubic-bezier(.3,0,.55,1)"}=e;if(!("scale"in t))throw new Error("Should not happen");const s={MIN:I/(t.scale||1),MAX:T/(t.scale||1)},c=(0,l.progress)(50,{MIN:0,MAX:T}),d=(0,l.lerp)(c,{MIN:0,MAX:s.MAX}),u=1+(a===f.ScaleOut?1:-1)*d;return AnimationZoom({type:i.Zoom,zoomFrom:(0,l.clamp)(u,s),zoomTo:1,duration:r,delay:o,easing:C,targetLeafElement:!0,transformOrigin:n||K(t&&Y(t))})}const he={zoomDirection:{label:(0,C.__)("Direction","web-stories"),tooltip:(0,ce.default)(/* translators: 1: scaleIn. 2: scaleOut */
|
||
|
(0,C.__)("Valid values are %1$s or %2$s","web-stories"),"scaleIn","scaleOut"),type:E.DirectionPicker,values:[f.ScaleIn,f.ScaleOut],defaultValue:f.ScaleOut},duration:{label:(0,C.__)("Duration","web-stories"),type:E.Number,unit:(0,C._x)("ms","Time in milliseconds","web-stories"),defaultValue:2e3}};function Ee(e,t){let{panDir:a=p.RightToLeft,duration:n=2e3,easing:r="cubic-bezier(.3,0,.55,1)",type:l,...o}=e;const C={fill:"both",duration:n,easing:r,...o},i="translate3d(0%, 0, 0)",s="translate3d(0, 0%, 0)",c=t?Y(t):{top:0,right:0,bottom:0,left:0},d={from:{[p.RightToLeft]:`translate3d(${c.left}%, 0, 0)`,[p.LeftToRight]:`translate3d(${c.right}%, 0, 0)`,[p.BottomToTop]:`translate3d(0, ${c.top}%, 0)`,[p.TopToBottom]:`translate3d(0, ${c.bottom}%, 0)`},to:{[p.RightToLeft]:i,[p.LeftToRight]:i,[p.BottomToTop]:s,[p.TopToBottom]:s}},u={transform:[d.from[a],d.to[a]]};return R(u,C,!1,!0)}const be={panDir:{label:(0,C.__)("Direction","web-stories"),tooltip:(0,ce.default)(/* translators: 1: scaleIn. 2: scaleOut */
|
||
|
(0,C.__)("Valid values are %1$s or %2$s","web-stories"),"scaleIn","scaleOut"),type:E.DirectionPicker,values:[p.TopToBottom,p.BottomToTop,p.LeftToRight,p.RightToLeft],defaultValue:p.RightToLeft},duration:{label:(0,C.__)("Duration","web-stories"),type:E.Number,unit:(0,C._x)("ms","Time in milliseconds","web-stories"),defaultValue:2e3}},ye={fill:"forwards",duration:2e3,easing:"cubic-bezier(.14,.34,.47,.9)"};const ve=[{transform:"scale(0)",offset:0},{transform:"scale(1.27)",offset:.18},{transform:"scale(0.84)",offset:.28},{transform:"scale(0.84)",offset:.29},{transform:"scale(1.1)",offset:.4},{transform:"scale(1.1)",offset:.41},{transform:"scale(0.95)",offset:.52},{transform:"scale(0.95)",offset:.53},{transform:"scale(1.03)",offset:.6},{transform:"scale(1.03)",offset:.61},{transform:"scale(0.98)",offset:.7},{transform:"scale(0.98)",offset:.71},{transform:"scale(1.02)",offset:.8},{transform:"scale(1.02)",offset:.81},{transform:"scale(0.99)",offset:.9},{transform:"scale(0.99)",offset:.91},{transform:"scale(1)",offset:1}],_e={fill:"both",duration:1500};const we=function(e){return e.reduce(((t,a)=>({...t,[a]:e.filter((e=>e!==a))})),{})};const Me=function(e,t){return e.map((e=>Array(t).fill(e))).flat()},Le=10,Se=[0,.25,.75,1],Ie={fill:"forwards"};function Te(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Le;const t=we(Se);let a=null;const n=(r=e-2,Array(r).fill(0).map(((e,t)=>t))).map((()=>{const e=null!==a?t[a]:Se,n=e[Math.floor(Math.random()*e.length)];return a=n,n}));var r;return Me(n,3)}E.Number;const xe={fill:"both",duration:1e3},Ae={[g.Clockwise]:{[h.X]:{transform:["rotateX(90deg)","rotateX(0deg)"]},[h.Y]:{transform:["rotateY(90deg)","rotateY(0deg)"]}},[g.CounterClockwise]:{[h.X]:{transform:["rotateX(-90deg)","rotateX(0deg)"]},[h.Y]:{transform:["rotateY(-90deg)","rotateY(0deg)"]}},[g.PingPong]:{[h.X]:{transform:[]},[h.Y]:{transform:[]}}};E.Dropdown,h.X,h.Y,h.Y,E.Dropdown,g.Clockwise,g.CounterClockwise,g.Clockwise;const ke={fill:"both",duration:1e3},Ze={[p.TopToBottom]:{transform:["translateY(-100%)","translateY(0%)"]},[p.BottomToTop]:{transform:["translateY(100%)","translateY(0%)"]},[p.LeftToRight]:{transform:["translateX(-100%)","translateX(0%)"]},[p.RightToLeft]:{transform:["translateX(100%)","translateX(0%)"]}};E.Dropdown,p.TopToBottom,p.BottomToTop,p.LeftToRight,p.RightToLeft,p.BottomToTop;function EmptyAMPTarget(e){let{children:t,...a}=e;return n.createElement("div",a,t)}const Pe=function(){return{id:"-1",keyframes:{},generatedKeyframes:{},WAAPIAnimation:{keyframes:{},timings:{}},AMPTarget:EmptyAMPTarget,AMPAnimation:()=>null}};const Re=function(e,t){const a=function(e){let{easingPreset:t,easing:a,...n}=e;return{...n,easing:a||(t?_[t]:void 0)}}(e);switch(a.type){case i.BlinkOn:return function AnimationBlinkOn(e){let{blinkCount:t=Le,type:a,...n}=e;const r={...Ie,...n},l={opacity:[0,...Te(t),1]};return R(l,r)}(a);case i.Bounce:return function AnimationBounce(e){let{type:t,...a}=e;const n={..._e,...a};return R(ve,n)}(a);case i.Fade:return AnimationFade(a);case i.Flip:return function AnimationFlip(e){let{axis:t=h.Y,rotation:a=g.Clockwise,type:n,...r}=e;const l={...xe,...r},o=Ae[a][t];return R(o,l)}(a);case i.FloatOn:return function AnimationFloatOn(e){let{floatOnDir:t=p.BottomToTop,type:a,...n}=e;const r={...ke,...n},l=Ze[t];return R(l,r)}(a);case i.Move:return AnimationMove(a,t);case i.Pulse:return AnimationPulse(a);case i.Spin:return AnimationSpin(a,t);case i.Zoom:return AnimationZoom(a);case i.EffectDrop:return function EffectDrop(e,t){let{fill:a="both",duration:n=1600,delay:r=0}=e;const l={fill:a,duration:n,delay:r},o=Q(t);return R(o,l)}(a,t);case i.EffectFadeIn:return function EffectFadeIn(e){let{duration:t=600,delay:a=0,easing:n="cubic-bezier(0.4, 0.4, 0.0, 1)"}=e;return AnimationFade({fadeFrom:0,fadeTo:1,duration:t,delay:a,easing:n,type:i.Fade})}(a);case i.EffectFlyIn:return function EffectFlyIn(e,t){let{flyInDir:a=p.TopToBottom,duration:r=600,delay:l=0,easing:C="cubic-bezier(0.2, 0.6, 0.0, 1)"}=e;const s=(0,o.default)(),{offsetTop:c,offsetLeft:d,offsetRight:u,offsetBottom:m}=j(t),f={[p.TopToBottom]:
|
||
|
/* translators: Control key on the keyboard */
|
||
|
ctrl:(0,n.__)("Control","web-stories"),
|
||
|
/* translators: shift key on the keyboard */
|
||
|
shift:(0,n.__)("Shift","web-stories"),
|
||
|
/* translators: delete key on the keyboard */
|
||
|
delete:(0,n.__)("Delete","web-stories"),cmd:a,
|
||
|
/* translators: comma character ',' */
|
||
|
",":(0,n.__)("Comma","web-stories"),
|
||
|
/* translators: period character '.' */
|
||
|
".":(0,n.__)("Period","web-stories"),
|
||
|
/* translators: backtick character '`' */
|
||
|
"`":(0,n.__)("Backtick","web-stories")},i=t?" ":"+";
|
||
|
/* translators: Command key on the keyboard */return e.toLowerCase().replace("alt",C.alt).replace("ctrl",C.ctrl).replace("mod",C.mod).replace("cmd",C.cmd).replace("shift",C.shift).replace("delete",C.delete).replace(",",C[","]).replace(".",C["."]).replace("`",C["`"]).split(/[\s+]/).map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(i)}function g(e){const t=p()?"":"+";return e.toLowerCase().replace("alt",m("alt")).replace("ctrl",m("ctrl")).replace("mod",m("mod")).replace("cmd",m("cmd")).replace("shift",m("shift")).replace("left","←").replace("up","↑").replace("right","→").replace("down","↓").replace("delete","⌫").replace("enter","⏎").split("+").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(t)}},84705:(e,t,a)=>{"use strict";a.d(t,{LoadingBar:()=>LoadingBar});var n=a(67294),r=a(37723),l=a(12788),o=a(69845),C=a(31338);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},i.apply(this,arguments)}const s="loading-indicator",c=l.default.span.withConfig({displayName:"loadingBar__AriaOnlyAlert",componentId:"sc-11l744v-0"})(["",""],C.visuallyHidden),d=(0,l.keyframes)(["0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}"]),u=l.default.div.withConfig({displayName:"loadingBar__UploadingIndicator",componentId:"sc-11l744v-1"})(["height:4px;background:",";background-size:400% 400%;position:absolute;bottom:0px;border-radius:",";animation:"," 4s ease infinite;&.","{&.appear{width:0;}&.appear-done{width:100%;transition:1s ease-out;transition-property:width;}}"],(e=>{let{theme:t}=e;return t.colors.gradient.loading}),(e=>{let{theme:t}=e;return`0px 0px ${t.borders.radius.small} ${t.borders.radius.small}`}),d,s);function LoadingBar(e){let{loadingMessage:t,...a}=e;const l=(0,o.useRef)(null);return n.createElement(n.Fragment,null,t&&n.createElement(c,{role:"status"},t),n.createElement(r.default,{nodeRef:l,in:!0,appear:!0,timeout:0,className:s},n.createElement(u,i({ref:l},a))))}},97890:(e,t,a)=>{"use strict";a.d(t,{MediaVariant:()=>n});let n=function(e){return e.Circle="circle",e.Rectangle="rectangle",e.None="none",e}({})},28395:(e,t,a)=>{"use strict";a.d(t,{Placement:()=>r,PopupContainer:()=>l});var n=a(12788);let r=function(e){return e.Top="top",e.TopStart="top-start",e.TopEnd="top-end",e.Bottom="bottom",e.BottomStart="bottom-start",e.BottomEnd="bottom-end",e.Right="right",e.RightStart="right-start",e.RightEnd="right-end",e.Left="left",e.LeftStart="left-start",e.LeftEnd="left-end",e}({});r.Top,r.Top,r.TopStart,r.TopStart,r.TopEnd,r.TopEnd,r.Bottom,r.Bottom,r.BottomEnd,r.BottomEnd,r.BottomStart,r.BottomStart,r.Right,r.Left,r.RightStart,r.LeftStart,r.RightEnd,r.LeftEnd,r.Left,r.Right,r.LeftStart,r.RightStart,r.LeftEnd,r.RightEnd;const l=n.default.div.withConfig({displayName:"constants__PopupContainer",componentId:"sc-1f3rwe8-0"})(["/*! @noflip */ "," /*! @noflip */ left:0px;top:0px;position:fixed;",";max-height:",";"],(e=>{let{$offset:{x:t,y:a,width:n},fillWidth:r,transforms:l="",zIndex:o,maxWidth:C}=e;const i={};return r&&(C?i.minWidth=`${n}px`:i.width=`${n}px`),C&&!i.width&&(i.maxWidth=`${C}px`),{transform:`translate(${t}px, ${a}px) ${l}`,...i,zIndex:o}}),(e=>{let{noOverFlow:t}=e;return t?"":"overflow-y: auto;"}),(e=>{let{topOffset:t=0}=e;return`calc(100vh - ${t}px)`}))},1782:(e,t,a)=>{"use strict";a.d(t,{Z_INDEX:()=>r});var n=a(36823);(0,n.__)("Search","web-stories"),(0,n.__)("Clear Search","web-stories"),(0,n.__)("Search","web-stories");const r={CLEAR_BUTTON:5}},36594:(e,t,a)=>{"use strict";a.d(t,{default:()=>b});var n=a(67294),r=a(12788),l=a(69845),o=a(58979),C=a(97783),i=a(28395),s=a(46315);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},c.apply(this,arguments)}const d=24,u=(0,r.css)(["appearance:none;width:","px;height:","px;background-color:",";cursor:pointer;border-radius:50
|
||
|
(0,d._n)("Only %d item can be added per page.","Only %d items can be added per page.",y.MAX_PRODUCTS_PER_PAGE,"web-stories"),y.MAX_PRODUCTS_PER_PAGE.toString())}):C.forEach((e=>{let{productId:t,productTitle:a,productImages:n}=e;v.includes(t)&&w({message:(0,c.default)(/* translators: %s: product title. */
|
||
|
(0,d.__)('Product "%s" already exists on the page.',"web-stories"),a),thumbnail:n?.[0]?.url?{src:n[0].url,alt:n[0].alt}:void 0})}))),e(r,l,o)}),[e,t,w,v,a]),x=(0,r.useCallback)((e=>{const{clipboardData:t}=e;try{const a=!t?.files?.length&&(t?.getData("text/html")||t?.getData("text/plain"));if(a){const t=document.createElement("template");t.innerHTML=a.replace(/<meta[^>]+>/g,"").replace(/<\/?html>/g,"").replace(/<\/?body>/g,"");let n=T(t.content);n||(n=S(t.innerHTML)),n&&e.preventDefault()}if(!t)return;const{items:n}=t,r=[];for(let e=0;e<n.length;e++){const t=n[e].getAsFile();t&&r.push(t)}r.length>0&&M(r)}catch(e){}}),[T,S,M]);m(I,x)};function M(e,t){let{editingElement:a,editingElementState:n={}}=t;return{...e,editingElement:a,editingElementState:n}}const L=function(){const[e,t]=(0,r.useReducer)(M,{editingElement:null,editingElementState:{}}),[a,n]=(0,r.useState)({}),l=(0,r.useCallback)((()=>{t({editingElement:null})}),[]),o=(0,r.useCallback)((e=>{t({editingElement:e})}),[]),C=(0,r.useCallback)(((e,a)=>{t({editingElement:e,editingElementState:a})}),[]),i=(0,r.useCallback)(((e,t)=>n((a=>({...a,[e]:t})))),[n]),s=(0,r.useRef)(null);s.current=a;const c=(0,r.useCallback)((e=>s.current?.[e]),[]),{editingElement:d,editingElementState:u}=e;return(0,r.useMemo)((()=>({nodesById:a,editingElement:d,editingElementState:u,setEditingElementWithState:C,setEditingElementWithoutState:o,clearEditing:l,getNodeForElement:c,setNodeForElement:i})),[a,d,u,C,o,l,c,i])};var S=a(60529);const I="rectObservationKey",T={CANVAS_CONTAINER:"canvasContainer",PAGE_CONTAINER:"pageContainer"};const x=function CanvasProvider(e){let{children:t}=e;const[a,s]=(0,r.useState)({}),[c,d]=(0,r.useState)(null),u=(0,r.useRef)(null),[p,m]=(0,r.useState)(null),[f,g]=(0,r.useState)(null),[h,E]=(0,r.useState)(null),[b,y]=(0,r.useState)(null),[v,_]=(0,r.useState)(null),[M,T]=(0,r.useState)(!1),[x,A]=(0,r.useState)(null),[k,Z]=(0,r.useState)(null),[P,R]=(0,r.useState)(!1),[O,D]=(0,r.useState)(null),[N,B]=(0,r.useState)(null),[F,z]=(0,r.useState)((()=>{const e=o.localStore.getItemByKey(o.LOCAL_STORAGE_PREFIX.ELEMENT_TOOLBAR_SETTINGS);return e?.position})),[H,V]=(0,r.useState)((()=>{const e=o.localStore.getItemByKey(o.LOCAL_STORAGE_PREFIX.ELEMENT_TOOLBAR_SETTINGS);return e?.isDisplayed})),U=(0,r.useMemo)((()=>new window.IntersectionObserver((e=>{for(const t of e){if(!(t.target instanceof HTMLElement))return;if(!t.target.dataset[I])return;const e=t.target.dataset[I];s((a=>({...a,[e]:t.boundingClientRect})))}}))),[]);(0,r.useEffect)((()=>()=>U.disconnect()),[U]);const j=(0,C.useLayout)((e=>{let{state:{pageWidth:t,pageHeight:a}}=e;return{width:t,height:a}})),{nodesById:G,editingElement:W,editingElementState:$,setEditingElementWithState:Y,setEditingElementWithoutState:q,clearEditing:X,getNodeForElement:K,setNodeForElement:Q}=L(),{backgroundElementId:J,selectedElementIds:ee,toggleElementInSelection:te,setSelectedElementsById:ae}=(0,i.useStory)((e=>{let{state:{currentPage:t,selectedElementIds:a},actions:{toggleElementInSelection:n,setSelectedElementsById:r}}=e;const l=t?.elements||[];return{backgroundElementId:l[0]?.id,selectedElementIds:a,toggleElementInSelection:n,setSelectedElementsById:r}})),ne=(0,r.useCallback)(((e,t)=>{W&&W!==e&&X(),u.current===e&&"focus"===t.type||(u.current=e,t.shiftKey?te({elementId:e,withLinked:!t.altKey}):ae({elementIds:[e],withLinked:!t.altKey}),t.currentTarget instanceof HTMLElement&&t.currentTarget.focus({preventScroll:!0}),J!==e&&t.stopPropagation(),"mousedown"===t.type&&(d(t),t.target instanceof HTMLElement&&t.target.ownerDocument.addEventListener("mouseup",(()=>window.setTimeout(d,0,null)),{once:!0,capture:!0})))}),[W,J,X,te,ae]);(0,r.useEffect)((()=>{!W||1===ee.length&&ee[0]===W||X(),u.current&&!ee.includes(u.current)&&(u.current=null)}),[W,ee,X]),w();const[re,le]=(0,r.useState)(null),oe=(0,r.useMemo)((()=>({state:{pageContainer:f,canvasContainer:p,fullbleedContainer:h,nodesById:G,editingElement:W,editingElementState:$,isEditing:Boolean(W),lastSelectionEvent:c,displayLinkGuidelines:M,pageAttachmentContainer:v,designSpaceGuideline:b,isEyedropperActi
|
||
|
(0,l.__)("Powered by %s","web-stories"),e);function TenorAttribution(){return i.createElement("a",{href:"https://tenor.com?utm_source=web_stories_wordpress&utm_medium=referral",target:"_blank",rel:"noreferrer","aria-label":k(x),tabIndex:-1},i.createElement(_,{"aria-hidden":!0},i.createElement(I,null)))}const Z={[C.ProviderType.Unsplash]:{provider:C.ProviderType.Unsplash,displayName:(0,l.__)("Images","web-stories"),supportsCategories:!0,requiresAuthorAttribution:!0,attributionComponent:function UnsplashAttribution(){return i.createElement("a",{href:"https://unsplash.com?utm_source=web_stories_wordpress&utm_medium=referral",target:"_blank",rel:"noreferrer","aria-label":k(A),tabIndex:-1},i.createElement(_,{"aria-hidden":!0},i.createElement(w,{size:u.TextSize.XSmall},(0,l.__)("Powered by","web-stories")),i.createElement(L,null)))},fetchMediaErrorMessage:(0,o.default)(/* translators: %s: media provider name. */
|
||
|
(0,l.__)("Error loading media from %s","web-stories"),"Unsplash"),fetchCategoriesErrorMessage:(0,o.default)(/* translators: %s: media provider name. */
|
||
|
(0,l.__)("Error loading categories from %s","web-stories"),"Unsplash")},[C.ProviderType.Coverr]:{provider:C.ProviderType.Coverr,displayName:(0,l.__)("Video","web-stories"),supportsCategories:!0,requiresAuthorAttribution:!1,attributionComponent:function CoverrAttribution(){return i.createElement("a",{href:"https://coverr.co?utm_source=web_stories_wordpress&utm_medium=referral&utm_campaign=api_powered_by",target:"_blank",rel:"noreferrer","aria-label":k(T),tabIndex:-1},i.createElement(_,{"aria-hidden":!0},i.createElement(w,{size:u.TextSize.XSmall},(0,l.__)("Powered by","web-stories")),i.createElement(S,null)))},fetchMediaErrorMessage:(0,o.default)(/* translators: %s: media provider name. */
|
||
|
(0,l.__)("Error loading media from %s","web-stories"),"Coverr"),defaultPreviewWidth:640},[C.ProviderType.Tenor]:{provider:C.ProviderType.Tenor,displayName:(0,l.__)("GIFs","web-stories"),contentTypeFilter:C.ContentType.Gif,supportsCategories:!0,requiresAuthorAttribution:!1,attributionComponent:TenorAttribution,fetchMediaErrorMessage:(0,o.default)(/* translators: %s: media provider name. */
|
||
|
(0,l.__)("Error loading media from %s","web-stories"),"Tenor")},[C.ProviderType.TenorStickers]:{provider:C.ProviderType.Tenor,displayName:(0,l.__)("Stickers","web-stories"),contentTypeFilter:C.ContentType.Sticker,supportsCategories:!0,requiresAuthorAttribution:!1,attributionComponent:TenorAttribution,fetchMediaErrorMessage:(0,o.default)(/* translators: %s: media provider name. */
|
||
|
(0,l.__)("Error loading media from %s","web-stories"),"Tenor")}}},34150:(e,t,a)=>{"use strict";a.d(t,{ContentType:()=>r,INITIAL_STATE:()=>n,ProviderType:()=>l});const n="INITIAL_STATE";let r=function(e){return e.Image="image",e.Video="video",e.Gif="gif",e.Sticker="sticker",e}({}),l=function(e){return e.Unsplash="unsplash",e.Coverr="coverr",e.Tenor="tenor",e.TenorStickers="tenor_stickers",e}({})},95104:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(79737);const __WEBPACK_DEFAULT_EXPORT__=function(e){return(0,n.useContextSelector)(r.default,e??n.identity)}},18948:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(21530);const __WEBPACK_DEFAULT_EXPORT__=function(e){return e+"-poster."+n.MEDIA_POSTER_IMAGE_FILE_TYPE}},93952:(e,t,a)=>{"use strict";a.d(t,{default:()=>v});const n=function(e){const t=new window.FileReader;return new Promise(((a,n)=>{t.onload=()=>a(t),t.onerror=n,t.readAsArrayBuffer(e)}))};var r=a(42628),l=a(94245),o=a(84841),C=a(58001),i=a(543),s=a(46897),c=a(26157),d=a(78574),u=a(78716),p=a(58011),m=a(59119),f=a(71112),g=a(4301),h=a(3961),E=a(21530),b=a(18948);const y=e=>{const t=(0,o.default)(e),a=(0,g.default)(e.type),n=a===i.ResourceType.Image?"image/png":"video/mp4";return r={id:(0,h.default)(),type:a||i.ResourceType.Image,mimeType:n,src:"",...(0,s.default)({}),alt:t},(0,C.default)({...r,isPlaceholder:!0});var r};const v=async function(e){const t=(0,g.default)(e.type),a=y(e);let v,_=null;try{if(i.ResourceType.Image===t&&(v=await async function(e){const t=await n(e);if(!t.result)return null;const a=e.type,c=(0,r.createBlob)(new window.Blob([t.result],{type:a})),{width:d,height:u}=await(0,l.default)(c),p=(0,o.default)(e);return(0,C.default)({type:i.ResourceType.Image,mimeType:a,src:c,...(0,s.default)({width:d,height:u}),alt:p})}(e)),i.ResourceType.Video===t){const t=await async function(e){const t=await n(e);if(!t.result)return null;const a=e.type,g=(0,r.createBlob)(new Blob([t.result],{type:a})),y=await(0,c.default)(g),v=""!==y.canPlayType(a),{length:_,lengthFormatted:w}=(0,d.default)(y);await(0,u.default)(y);const M=y&&(0,p.default)(y),L=y?await(0,m.default)(y):null,S=L&&(0,f.default)(L,(0,b.default)((0,o.default)(e)),E.MEDIA_POSTER_IMAGE_MIME_TYPE),I=S?(0,r.createBlob)(S):void 0,{width:T,height:x}=I?await(0,l.default)(I):{width:void 0,height:void 0},A=(0,o.default)(e);return{resource:(0,C.default)({id:(0,h.default)(),type:i.ResourceType.Video,mimeType:a,src:v?g:"",...(0,s.default)({width:T,height:x}),poster:I,isMuted:!M,length:_,lengthFormatted:w,alt:A}),posterFile:S}}(e);t&&(v=t.resource,_=t.posterFile)}}catch{}return v||=a,v.id=(0,h.default)(),{resource:v,posterFile:_}}},67379:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(4301),r=a(543),l=a(26157),o=a(78716),C=a(78574),i=a(58011),s=a(94245),c=a(58001);const __WEBPACK_DEFAULT_EXPORT__=async function(e){const{src:t,mimeType:a,width:d=0,height:u=0,isMuted:p,length:m,lengthFormatted:f,...g}=e,h=(0,n.default)(a);if(![r.ResourceType.Image,r.ResourceType.Video].includes(h))throw new Error("Invalid media type.");const E=Boolean(d&&u),b=!E||null===p||null===m||null===f,y={};if(h===r.ResourceType.Video&&b){const e=await(0,l.default)(t);await(0,o.default)(e),y.width=e.videoWidth,y.height=e.videoHeight;const a=(0,C.default)(e);y.length=a.length,y.lengthFormatted=a.lengthFormatted,y.isMuted=!(0,i.default)(e)}if(h===r.ResourceType.Image&&!E){const e=await(0,s.default)(t);y.width=e.width,y.height=e.height}return(0,c.default)({type:h,width:d,height:u,isMuted:p,length:m,lengthFormatted:f,src:t,isExternal:!0,mimeType:a,...g,...y})}},12636:(e,t,a)=>{"use strict";a.d(t,{getPosterName:()=>p.default,getResourceFromMedia3p:()=>d,useUploadVideoFrame:()=>u.default});a(93952),a(41792),a(67602),a(53476);var n=a(58001),r=a(15882),l=a(86702);function o(e){if(e.imageUrls?.length<3)throw new Error("Invalid number of urls for asset. Need at least 3: "+e);const t=C(e,e.imageUrls),a=[["full",t[0]],["large",t[1]],...t.slice(2,t.length-1).map((e=>[e.width+"_"+e.height,e])),["web_stories
|
||
|
(0,ye.__)("Failed to save the story: %s","web-stories"),t)),e?.data?.status&&Object.prototype.hasOwnProperty.call(Ie,e?.data?.status)&&(a=t?(0,ve.default)(/* translators: 1: error message. 2: status code */
|
||
|
(0,ye.__)("Failed to save the story: %1$s (%2$s)","web-stories"),t,Ie[e.data.status]):(0,ve.default)(/* translators: %s: error message */
|
||
|
(0,ye.__)("Failed to save the story: %s","web-stories"),Ie[e.data.status])),console.log((0,ye.__)("Failed to save the story","web-stories"),e),(0,_e.trackError)("save_story",t||""),s({message:a,dismissible:!0})})).finally((()=>{d(!1),o(),m()}))}),[n,a,C,l,t,r,h,s,o,i]),isSaving:c,isFreshlyPublished:u,isFreshlyPending:m}};a(98858),a(61318),a(33228),a(20691);function xe(e){return new URLSearchParams(e.startsWith("#")?e.substr(1):e)}const Ae=function(e,t){const[a,n]=(0,ce.useState)((()=>{const a=xe(window.location.hash);let n=t;try{if(a.has(e)){const t=a.get(e);if(null===t)return t;n=JSON.parse(decodeURI(t))}}catch(e){}return n}));return(0,ce.useEffect)((()=>{const t=xe(window.location.hash);a?t.set(e,encodeURI(JSON.stringify(a))):t.delete(e),(window.location.hash||t.toString())&&history.replaceState(history.state,"",`#${t.toString()}`)}),[e,a]),[a,n]};a(13429),a(25564),a(16054);const ke=function(e){return t=>{e.forEach((e=>{const a=e.split(".");if(!a.length)return;if(1===a.length)return void delete t[a[0]];const n=a.pop(),r=a.pop(),l=a.reduce(((e,t)=>e?.[t]||e),t);l&&r&&n&&Object.prototype.hasOwnProperty.call(l,r)&&"object"==typeof l[r]&&l[r]&&delete l[r][n]}))}};var Ze=a(42628);const Pe=function(e){return e.some((e=>e.elements.some((e=>!(!v.elementIs.media(e)||!e.resource)&&(!!(0,Ze.isBlobURL)(e.resource.src)||v.elementIs.sequenceMedia(e)&&(0,Ze.isBlobURL)(e.resource.poster))))))},Re=["resource.baseColor","resource.blurHash","resource.id","resource.isMuted","resource.posterId","resource.poster","resource.font.metrics","resource.font.weights","resource.font.variants","resource.font.fallbacks","resource.font.styles","resource.isOptimized","resource.length","resource.lengthFormatted","resource.trimData.original","resource.trimData.start","resource.trimData.end","resource.creationDate"];const Oe=function(e){let{story:t,current:a,pages:n,selection:r,capabilities:l}=e;const{state:{currentEntry:o},actions:{stateToHistory:C}}=(0,fe.useHistory)(),i=(0,ce.useRef)(null);(0,ce.useEffect)((()=>{o&&(i.current=structuredClone(o))}),[o]);const s=(0,ce.useRef)(null),c=(0,ce.useRef)([]);(0,ce.useEffect)((()=>{s.current=a,c.current=r}),[a,r]);const d=e=>structuredClone(e).map((e=>(e.elements.forEach((e=>ke(Re)({...e}))),e)));(0,ce.useEffect)((()=>{let e=!1;if(Re.length&&i.current&&n?.length){const a={story:t,capabilities:l};if(Object.entries(a).every((e=>{let[t,a]=e;return JSON.stringify(a)===JSON.stringify(i.current?.[t])}))){const t=d(n),a=d(i.current.pages);e=JSON.stringify(t)===JSON.stringify(a)}Pe(n)&&(e=!0)}e||C({story:t,current:s.current,selection:c.current,pages:n,capabilities:l})}),[t,n,C,l])};const De=function(e){let{restore:t}=e;const{state:{requestedState:a}}=(0,fe.useHistory)();(0,ce.useEffect)((()=>{if(!a)return;const{current:e,pages:n,selection:r,story:l,capabilities:o}=a;t({pages:n,current:e,story:l,selection:r,capabilities:o})}),[t,a])};var Ne=a(64641);const Be={addPage:e=>t=>{let{page:a,position:n,updateSelection:r}=t;return e({type:l.AddPage,payload:{page:a,position:n,updateSelection:r}})},addPageAt:e=>t=>{let{page:a,position:n,updateSelection:r}=t;return e({type:l.AddPage,payload:{page:a,position:n,updateSelection:r}})},copySelectedElement:e=>()=>e({type:l.CopySelectedElement,payload:null}),deletePage:e=>t=>{let{pageId:a}=t;return e({type:l.DeletePage,payload:{pageId:a}})},deleteCurrentPage:e=>()=>e({type:l.DeletePage,payload:{pageId:null}}),updatePageProperties:e=>t=>{let{pageId:a,properties:n}=t;return e({type:l.UpdatePage,payload:{pageId:a,properties:n}})},updateCurrentPageProperties:e=>t=>{let{properties:a}=t;return e({type:l.UpdatePage,payload:{pageId:null,properties:a}})},arrangePage:e=>t=>{let{pageId:a,position:n}=t;return e({type:l.ArrangePage,payload:{pageId:a,position:n}})},setCurrentPage:e=>t=>{let{pageId:a}=t;return e({type:l.SetCurrentPage,payload:{pageId:a}})},addElements:e=>t=>{let{elements:a,pageId:n,updateSelection:r}=t;return e({type:l.AddElements,payload:{elements:a,pageId:n,updateSelection:r}})},addElement:e=>t=>{let{element:a,pageId:n,updateSelection:r}=t;return e({type:l.AddElements,payload:{elemen
|
||
|
(0,r.__)("Your file is too large (%1$s MB) and cannot be processed. Please try again with a file that is smaller than %2$s MB.","web-stories"),p(t.size),p(u.MEDIA_TRANSCODING_MAX_FILE_SIZE));throw d("SizeError",t.name,e)}}else{if(!b(t)){const e=(0,l.default)(/* translators: first %s is the file size in MB and second %s is the upload file limit in MB */
|
||
|
(0,r.__)("Your file is %1$sMB and the upload limit is %2$sMB. Please resize and try again!","web-stories"),p(t.size),p(a));throw d("SizeError",t.name,e)}if(!(e=>s.includes(e.type))(t)){let e=(0,r.__)("No file types are currently supported.","web-stories");const a=s.map((e=>(0,C.getExtensionsFromMimeType)(e))).flat();throw a.length&&(
|
||
|
/* translators: %s is a list of allowed file extensions. */
|
||
|
e=(0,l.default)(/* translators: %s: list of allowed file types. */
|
||
|
(0,r.__)("Please choose only %s to upload.","web-stories"),(0,o.default)(a))),d("ValidError",t.name,e)}}}),[E,h,b,a]),v=(0,n.useCallback)((function(a){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(y({file:a,overrideAllowedMimeTypes:arguments.length>2&&void 0!==arguments[2]?arguments[2]:E}),!e)throw d("UploadError",a.name,"");const r={storyId:t,altText:(0,i.default)(a),mediaSource:"editor",...n};return e(a,r)}),[E,y,t,e]);return(0,n.useMemo)((()=>({actions:{uploadFile:v,validateFileForUpload:y}})),[y,v])}},42191:(e,t,a)=>{"use strict";a.d(t,{default:()=>L});var n=a(67294),r=a(69845),l=a(12788),o=a(60531),C=a(55590),i=a(40292),s=a(69648),c=a(52264),d=a(80934),u=a(60238),p=a(11950),m=(a(41854),a(6025)),f=a(28154),g=a(55571);const h=(0,l.css)(["position:absolute !important;top:0;left:0;height:100%;width:100%;"]),E=(0,l.default)(g.Blurhash).withConfig({displayName:"renderResourcePlaceholder__BlurhashContainer",componentId:"sc-m9r2np-0"})(["",""],h),b=l.default.div.withConfig({displayName:"renderResourcePlaceholder__BaseColorContainer",componentId:"sc-m9r2np-1"})([""," background-color:",";"],h,(e=>{let{$baseColor:t}=e;return t}));const y=function(e){let{blurHash:t,baseColor:a}=e;return t?n.createElement(E,{hash:t,punch:1,height:"100%",width:"100%"}):a?n.createElement(b,{$baseColor:a}):null};function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},v.apply(this,arguments)}const _=l.default.div.attrs((e=>{let{previewMode:t,x:a,y:n,width:r,height:l,rotationAngle:o}=e;return t?{style:{position:"absolute",zIndex:1,left:`${a}px`,top:`${n}px`,width:`${r}px`,height:`${l}px`,transform:`rotate(${o}deg)`}}:{}})).withConfig({displayName:"displayElement__Wrapper",componentId:"sc-1uos4dq-0"})([""," "," "," contain:layout;transition:opacity 0.15s cubic-bezier(0,0,0.54,1);",""],(e=>{let{previewMode:t}=e;return!t&&u.elementWithPosition}),(e=>{let{previewMode:t}=e;return!t&&u.elementWithSize}),(e=>{let{previewMode:t}=e;return!t&&u.elementWithRotation}),(e=>{let{isBackground:t,theme:a}=e;return t&&(0,l.css)(["border-radius:",";overflow:hidden;"],a.borders.radius.small)})),w=l.default.div.withConfig({displayName:"displayElement__BackgroundOverlay",componentId:"sc-1uos4dq-1"})(["position:absolute;width:100%;height:100%;top:0;left:0;"]),M=l.default.div.withConfig({displayName:"displayElement__ReplacementContainer",componentId:"sc-1uos4dq-2"})(["transition:opacity 0.25s cubic-bezier(0,0,0.54,1);pointer-events:none;opacity:",";height:100%;"],(e=>{let{hasReplacement:t}=e;return t?1:0}));function AnimationWrapper(e){let{children:t,id:a,isAnimatable:r}=e;return r?n.createElement(s.WAAPIWrapper,{target:a},t):t}const L=(0,r.memo)((function DisplayElement(e){let{element:t,previewMode:a,isAnimatable:l=!1,siblingCount:s=0}=e;const{getBox:g,getBoxWithBorder:h,dataToEditorX:E}=(0,C.default)((e=>({getBox:e.actions.getBox,getBoxWithBorder:e.actions.getBoxWithBorder,dataToEditorX:e.actions.dataToEditorX}))),{getProxiedUrl:b}=(0,m.default)(),{actions:{maybeEnqueueFontStyle:L}}=(0,f.useFont)(),[S,I]=(0,r.useState)(null),T=Boolean(S),{id:x,opacity:A,type:k,isBackground:Z,overlay:P,border:R,flip:O,rotationAngle:D}=t,{isCurrentResourceProcessing:N,isCurrentResourceUploading:B}=(0,f.useLocalMedia)((e=>{let{state:t}=e;return d.ELEMENT_TYPES.IMAGE===k?{isCurrentResourceProcessing:t.isCurrentResourceProcessing,isCurrentResourceUploading:t.isCurrentResourceUploading}:{}})),F=T?{...t,type:S.resource.type,resource:S.resource,scale:S.scale,focalX:S.focalX,focalY:S.focalY,flip:Z?S.flip:O,overlay:Z?S.overlay:P}:null;let z;if(S?.resource.type){z=(0,d.getDefinitionForType)(S.resource.type).Display}const H=(0,r.useRef)(null),{left:V=0,right:U=0,top:j=0,bottom:G=0}=R||{};(0,c.useTransformHandler)(x,(e=>{const a=H.current;if(null===e)a.style.transform="",a.style.width="",a.style.height="";else{const{translate:n=[0,0],rotate:r,resize:l,dropTargets:o}=e;let C=0,s=0;if(l&&0!==l[0]&&0!==l[1]&&(a.style.width=`${l[0]}px`,a
|
||
|
(0,C.__)('Product "%s" already exists on the page.',"web-stories"),n),thumbnail:r?.[0]?.url?{src:r[0].url,alt:r[0].alt}:void 0})}l({elementIds:a.map((e=>e.id))})}}),[l,a,f,h]);(0,v.useGlobalKeyDownEffect)("clone",(()=>M()),[M]);const L=[Qa.StoryAnimationState.Playing,Qa.StoryAnimationState.PlayingSelected].includes(p);(0,v.useGlobalKeyDownEffect)({key:["mod+enter"]},(e=>{e.preventDefault(),1!==u&&(m({animationState:L?Qa.StoryAnimationState.Reset:Qa.StoryAnimationState.Playing}),(0,D.trackEvent)("canvas_play_animations",{status:L?"stop":"play"}))}),[L,m,u]),(0,v.useGlobalKeyDownEffect)({key:["mod+k"]},(e=>{e.preventDefault(),!a.length||d.elementIs.backgroundable(a[0])&&a[0].isBackground||E({elements:a,highlight:dt.states.Link})}),[E,a])};var fl=a(83485);const gl=l.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"})),hl=l.default.ol.withConfig({displayName:"extraPages__ExtraPageList",componentId:"sc-12b8j4d-1"})(["display:flex;flex-direction:",";width:","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}),32,32),El=l.default.li.withConfig({displayName:"extraPages__ExtraPage",componentId:"sc-12b8j4d-2"})(["display:block;width:","px;height:100%;border-radius:4px;background-color:white;opacity:",";transition:opacity 0.2s ease;&:hover{opacity:1;}",""],(e=>{let{extraPageWidth:t}=e;return t-32}),(e=>{let{$distance:t}=e;return.6-.15*t}),(e=>{let{$inert:t}=e;return t&&"pointer-events: none;"})),bl=(0,l.default)(fl.default).withConfig({displayName:"extraPages__ExtraPagePreview",componentId:"sc-12b8j4d-3"})(["cursor:pointer;"]);function yl(e,t){return e<t?Array.from(Array(t-e)).map(((t,a)=>a+e)):[]}const vl=(0,o.memo)((function ExtraPages(e){let{isPrevious:t=!1}=e;const{currentPageIndex:a,pages:n,setCurrentPage:l}=(0,i.useStory)((e=>{let{state:{pages:t,currentPageIndex:a},actions:{setCurrentPage:n}}=e;return{currentPageIndex:a,pages:t,setCurrentPage:n}})),{hasExtraPages:o,extraPageWidth:s,extraPageCount:c}=(0,i.useLayout)((e=>{let{state:{hasExtraPages:t,extraPageWidth:a,extraPageCount:n}}=e;return{hasExtraPages:t,extraPageWidth:a,extraPageCount:n}})),d=(0,Vn.useTransform)((e=>{let{state:{isAnythingTransforming:t}}=e;return t})),u=n?.length;if(!u)return null;const p=function(e){let{isPrevious:t,hasExtraPages:a,currentPageIndex:n,extraPageCount:r,pageCount:l}=e;if(!a)return[];if(t)return yl(Math.max(0,n-r),n).reverse();return yl(n+1,Math.min(l,n+r+2))}({isPrevious:t,hasExtraPages:o,currentPageIndex:a,extraPageCount:c,pageCount:u});if(0===p.length)return null;const m=p.length*s,f=(s-32)/on.PAGE_RATIO;return r.createElement(gl,{isPrevious:t},r.createElement(hl,{isPrevious:t,listWidth:m,extraPageHeight:f},p.map(((e,t)=>{return r.createElement(El,{key:e,extraPageWidth:s,$inert:d,$distance:t},r.createElement(bl,{page:n[e],onClick:(a=n[e].id,()=>l({pageId:a})),"aria-label":(0,cl.default)(/* translators: %s: page number. */
|
||
|
(0,C.__)("Go to page %s","web-stories"),e+1),width:s-32}));var a}))))}));var _l,wl,Ml=a(90180),Ll=a(84967),Sl=a(98309);function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Il.apply(this,arguments)}const SvgExternalLink=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",Il({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 50 50","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,_l||(_l=r.createElement("path",{fill:"currentColor",d:"m38.288 10.297 1.414 1.415-14.99 14.99-1.414-1.414z"})),wl||(wl=r.createElement("path",{fill:"currentColor",d:"M40 20h-2v-8h-8v-2h10zM35 38H15c-1.7 0-3-1.3-3-3V15c0-1.7 1.3-3 3-3h11v2H15c-.6 0-1 .4-1 1v20c0 .6.4 1 1 1h20c.6 0 1-.4 1-1V24h2v11c0 1.7-1.3 3-3 3z"})))},Tl=(0,r.memo)(SvgExternalLink);var xl=a(7601);const Al=(0,l.default)(K.default).withConfig({displayName:"frame__StyledTooltip",componentId:"sc-1fjzoyw-0"})(["box-shadow:0px 6px 10px ",";align-items:center;p{display:flex;max-width:100%;}"],(e=>{let{theme:t}=e;return(0,Ll.rgba)(t.colors.standard.black,.1)})),kl=l.default.span.withConfig({displayName:"frame__IconWrapper",componentId:"sc-1fjzoyw-1"})(["background-color:",";width:24px;height:24px;border-radius:50%;overflow:hidden;margin-right:8px;display:inline-block;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),Zl=l.default.img.withConfig({displayName:"frame__BrandIcon",componentId:"sc-1fjzoyw-2"})(["width:100%;height:100%;border:none;"]),Pl=l.default.span.withConfig({displayName:"frame__LinkDesc",componentId:"sc-1fjzoyw-3"})(["padding-top:2px;flex:1;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]),Rl=(0,l.default)(Tl).withConfig({displayName:"frame__ExternalLink",componentId:"sc-1fjzoyw-4"})(["width:24px;"]);const Ol=function WithLink(e){let{element:t,active:a,children:n,anchorRef:l}=e;const o=(0,xl.getLinkFromElement)(t),i=o?.url&&a?r.createElement(r.Fragment,null,o?.icon&&r.createElement(kl,null,r.createElement(Zl,{src:o.icon,alt:(0,C.__)("Site Icon","web-stories"),decoding:"async",crossOrigin:"anonymous"})),r.createElement(Pl,null,o.desc||(0,Sl.withoutProtocol)(o.url)),r.createElement(Rl,null)):null;return r.createElement(Al,{forceAnchorRef:l,placement:F.Placement.Top,title:i},n)};var Dl;function Nl(){return Nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Nl.apply(this,arguments)}const SvgPill=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",Nl({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 12 12","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,Dl||(Dl=r.createElement("path",{fill:"currentColor",d:"M11.49 5.755 6.24.505a1.16 1.16 0 0 0-.823-.338H1.334A1.17 1.17 0 0 0 .167 1.333v4.084c0 .32.128.612.344.828l5.25 5.25c.21.21.502.338.823.338.32 0 .612-.128.822-.344l4.083-4.083a1.14 1.14 0 0 0 .345-.823c0-.32-.134-.618-.345-.828ZM2.208 3.083a.874.874 0 1 1 0-1.75.874.874 0 1 1 0 1.75Z"})))},Bl=(0,r.memo)(SvgPill),Fl=(0,l.default)(K.default).withConfig({displayName:"frame__StyledTooltip",componentId:"sc-uvs0u9-0"})(["align-items:center;p{display:flex;max-width:100%;color:#fff;font-family:'Poppins',sans-serif;font-weight:700;font-size:14px;line-height:24px;padding:0;}background-color:rgba(125,125,125,0.75);border-radius:18px;padding-inline-start:6px;padding-inline-end:12px;cursor:pointer;height:36px;"]),zl=l.default.span.withConfig({displayName:"frame__PillImage",componentId:"sc-uvs0u9-1"})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:rgba(0,0,0,0.6);border-radius:100%;flex-shrink:0;margin-inline-end:4px;"]);function TooltipTitle(e){let{productTagText:t}=e;return r.createElement(r.Fragment,null,r.createElement(zl,null,r.createElement(Bl,{width:14,height:14,"aria-hidden":!0})),t)}const Hl=function WithProductPill(e){let{element:t,active:a,children:n
|
||
|
(0,C.__)("To exit the canvas area, press Escape. Press Tab to move to the next group or element. To enter floating menu, press %s.","web-stories"),(0,Ml.prettifyShortcut)("ctrl+alt+p"));const Yl=(0,o.memo)((function FrameElement(e){let{id:t}=e;const a=(0,f.default)(),{enterFocusGroup:n,setFocusGroupCleanup:l}=T((e=>{let{enterFocusGroup:t,setFocusGroupCleanup:a}=e;return{enterFocusGroup:t,setFocusGroupCleanup:a}})),[c,u]=(0,o.useState)(!1),p=I(x.ELEMENT_SELECTION),{setNodeForElement:m,handleSelectElement:g,isEditing:h,setEditingElement:E,setEditingElementWithState:b}=(0,i.useCanvas)((e=>{let{state:t,actions:a}=e;return{setNodeForElement:a.setNodeForElement,handleSelectElement:a.handleSelectElement,isEditing:t.isEditing,setEditingElement:a.setEditingElement,setEditingElementWithState:a.setEditingElementWithState}})),{isSelected:y,isOnlySelectedElement:_,isActive:w,isBackground:M,element:L}=(0,i.useStory)((e=>{let{state:a}=e;const n=a.selectedElementIds.includes(t),r=n&&1===a.selectedElementIds.length,l=r&&!c&&!h;return{isSelected:n,isBackground:a.currentPage?.elements[0].id===t,element:a.currentPage?.elements.find((e=>e.id===t)),isOnlySelectedElement:r,isActive:l}})),{type:S,flip:A,isLocked:k,isHidden:Z}=L,P=(!k||y)&&!Z,{Frame:R,isMaskable:O,Controls:D}=(0,d.getDefinitionForType)(S),B=(0,o.useRef)(),F=(0,o.useCombinedRefs)(B,p),[z,H]=(0,o.useState)(!1),{isRTL:V,styleConstants:{topOffset:U}={}}=(0,i.useConfig)(),{draggingResource:j,activeDropTargetId:G,isDropSource:W,registerDropTarget:$,unregisterDropTarget:Y}=(0,i.useDropTargets)((e=>{let{state:{draggingResource:t,activeDropTargetId:a},actions:{isDropSource:n,registerDropTarget:r,unregisterDropTarget:l}}=e;return{draggingResource:t,activeDropTargetId:a,isDropSource:n,registerDropTarget:r,unregisterDropTarget:l}})),q=(0,i.useTransform)((e=>{let{state:t}=e;return!y&&z&&!t.isAnythingTransforming}))&&!k,X=(0,Ka.default)((e=>{let{actions:t}=e;return t.getBoxWithBorder}));(0,o.useLayoutEffect)((()=>{m(t,B.current)}),[t,m]);const K=X(L);(0,Vn.useTransformHandler)(t,(e=>{const t=B.current;void 0!==e?.dropTargets?.hover&&(t.style.opacity=e.dropTargets.hover?0:1),u(null!==e)}));const{isMedia:Q}=(0,d.getDefinitionForType)(S),J=(0,o.useCallback)((e=>{y||g(t,e),E(t)}),[t,E,g,y]),ee=Vl(Pa.noop,J),te=(0,o.useCallback)((e=>{y||g(t,e),M||a($l)}),[g,t,M,y,a]),{clearTransforms:ae}=(0,i.useTransform)((e=>({clearTransforms:e.actions.clearTransforms}))),ne=(0,o.useCallback)((e=>{y||(g(t,e),ae()),B.current.focus({preventScroll:!0}),M||e.stopPropagation()}),[g,t,M,y,ae]);(0,Ul.default)({node:B.current,eventData:{...s.TRACKING_EVENTS.SELECT_ELEMENT,label:L.type},eventType:"pointerdown"}),(0,v.useKeyDownEffect)(B,{key:["ctrl+alt+p"]},(()=>{n({groupId:x.EDIT_ELEMENT})}),[n]),(0,o.useEffect)((()=>{y&&l({groupId:x.EDIT_ELEMENT,cleanup:()=>B.current?.focus()})}),[l,y]);const re=(0,d.getLayerName)(L),le=L.isLocked?(0,cl.default)(
|
||
|
// translators: %s: Name of element
|
||
|
(0,C.__)("Locked element: %s","web-stories"),re):(0,cl.default)(
|
||
|
// translators: %s: Name of element
|
||
|
(0,C.__)("Element: %s","web-stories"),re);return r.createElement(Hl,{element:L,active:q,anchorRef:B},r.createElement(Ol,{element:L,active:q,anchorRef:B},D&&r.createElement(D,{isTransforming:c,box:K,elementRef:B,element:L,isRTL:V,topOffset:U,isActive:w}),r.createElement(Gl,jl({ref:F,"data-element-id":t},K,{tabIndex:-1,role:"button","aria-label":le,hasMask:O,isClickable:P,"data-testid":"frameElement",onMouseDown:ne,onFocus:te,onPointerEnter:()=>H(!0),onPointerLeave:()=>H(!1),onClick:Q?ee(t):null}),r.createElement(N.FrameWithMask,{element:L,fill:!0,flip:A,draggingResource:j,activeDropTargetId:G,isDropSource:W,registerDropTarget:$,unregisterDropTarget:Y,isSelected:y},R?r.createElement(R,{wrapperRef:B,element:L,box:K,isOnlySelectedElement:_,setEditingElementWithState:b}):r.createElement(Wl,null)))))}));a(28244),a(30005),a(70560);const ql=function(e){let{targetList:t,frames:a,setTransformStyle:n,onGroupEventStart:r,onGroupEventEnd:l,isDragging:C,setIsDragging:s}=e;const{draggingResource:c}=(0,$n.useDropTargets)((e=>{let{state:{draggingResource:t}}=e;return{draggingResource:t}})),{nodesById:d,handleSelectElement:u}=(0,i.useCanvas)((e=>{let{state:{nodesById:t},actions:{handleSelectElement:a}}=e;return{nodesById:t,handleSelectElement:a}})),p=(0,o.useRef)({}),m=C||Boolean(c);return{onDragGroup:e=>{let{events:r}=e;r.forEach(((e,r)=>{let{target:l,beforeTranslate:o}=e;const C=a[r],{element:i}=t[r];C.translate=o,n(i,l,C)}))},onDragGroupEnd:e=>{let{targets:t,inputEvent:a}=e;s(!1),(e=>{if((0,va.areEventsDragging)(p.current,e))return!1;const t=Object.keys(d).find((t=>d[t].contains(e.target)));return t&&setTimeout((()=>{u(t,e)}),0),!0})(a)||l({targets:t})},onDragGroupStart:e=>{let{events:t,inputEvent:a}=e;(e=>{const{timeStamp:t,clientX:a,clientY:n}=e;p.current={timeStamp:t,clientX:a,clientY:n}})(a),C||s(!0),r({events:t,isDrag:!0})},className:"default-moveable "+(m?"hide-handles":""),resizable:!m,rotatable:!m}};const Xl=function(e){let{onGroupEventEnd:t,targetList:a,setTransformStyle:n,frames:r}=e;const{editorToDataX:l,editorToDataY:o,dataToEditorY:C,dataToEditorX:i}=(0,Ka.default)((e=>({editorToDataX:e.actions.editorToDataX,editorToDataY:e.actions.editorToDataY,dataToEditorY:e.actions.dataToEditorY,dataToEditorX:e.actions.dataToEditorX})));return{onResizeGroup:e=>{let{events:t}=e;t.forEach(((e,t)=>{let{target:s,direction:c,width:u,height:p,drag:m}=e;const f=r[t],{element:g,updateForResizeEvent:h}=a[t],{border:E,type:b}=g,{resizeRules:y}=(0,d.getDefinitionForType)(b),v=i(y.minWidth),_=C(y.minHeight),{left:w=0,right:M=0,top:L=0,bottom:S=0}=E||{};let I=u-(w+M),T=p-(L+S);const x=g.width/g.height;I<v&&(I=v,T=I/x),T<_&&(T=_,I=_*x);let A=null;h&&(A=h(g,c,l(I),o(T))),A&&A.height&&(T=C(A.height));const k=I+w+M,Z=T+L+S;s.style.width=`${k}px`,s.style.height=`${Z}px`,f.direction=c,f.resize=[k,Z],f.translate=m.beforeTranslate,f.updates=A,n(g,s,f)}))},onResizeGroupStart:e=>{let{events:t}=e;t.forEach(((e,t)=>{const a=r[t];e.setOrigin(["%","%"]),e.dragStart&&e.dragStart.set(a.translate)}))},onResizeGroupEnd:e=>{let{targets:a}=e;t({targets:a,isResize:!0})}}};const Kl=function(e){let{onGroupEventStart:t,setTransformStyle:a,onGroupEventEnd:n,targetList:r,frames:l}=e;return{onRotateGroup:e=>{let{events:t}=e;t.forEach(((e,t)=>{let{target:n,beforeRotate:o,drag:C}=e;const i=l[t],{element:s}=r[t];i.rotate=utils_normalizeRotationDegrees(o),i.translate=C.beforeTranslate,a(s,n,i)}))},onRotateGroupEnd:e=>{let{targets:t}=e;n({targets:t,isRotate:!0})},onRotateGroupStart:e=>{let{events:a}=e;t({events:a,isRotate:!0})},throttleRotate:(0,v.useGlobalIsKeyPressed)("shift")?30:0}};function Ql(){return Ql=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ql.apply(this,arguments)}const Jl=["nw","ne","sw","se"],eo=(0,o.forwardRef)((function MultiSelectionMoveable(e,t){let{selectedElements:a,...n}=e;const l=(0,o.useRef)(),[C,s]=(0,o.useState)(!1),c=a.some((e=>e.isLocked)),u=!c,{updateElementsById:p,deleteElementsById:m,backgroundElement:f}=(0,i.use
|
||
|
(0,C.__)("Reordering. Press Escape to abort. Release mouse to drop in position %d.","web-stories"),String(e));u(a)}}),[a,r,t,u]),{isReordering:a,currentSeparator:r,setCurrentSeparator:l,handleStartReordering:p,currentPosition:i}},Zo=l.default.div.withConfig({displayName:"reorderableScroller__Scroller",componentId:"sc-lvxibs-0"})(["z-index:3;opacity:0;position:sticky;"]),Po=(0,l.default)(Zo).withConfig({displayName:"reorderableScroller__HorizontalScroller",componentId:"sc-lvxibs-1"})(["padding-left:","px;height:100%;",""],(e=>{let{size:t}=e;return t}),(e=>{let{direction:t,size:a}=e;return-1===t?`\n left: 0px;\n margin-right: -${a}px;\n `:`\n right: 0px;\n margin-left: -${a}px;\n `})),Ro=(0,l.default)(Zo).withConfig({displayName:"reorderableScroller__VerticalScroller",componentId:"sc-lvxibs-2"})(["padding-top:","px;width:100%;",""],(e=>{let{size:t}=e;return t}),(e=>{let{direction:t,size:a}=e;return-1===t?`\n top: 0px;\n margin-bottom: -${a}px;\n `:`\n bottom: 0px;\n margin-top: -${a}px;\n `}));const Oo=(0,o.memo)((function ReorderableScroller(e){let{direction:t,size:a}=e;const{state:{canScrollEnd:n,canScrollStart:l,mode:C},actions:{startScroll:i}}=(0,o.useContext)(Ao),[s,c]=(0,o.useState)(!1),d=(0,o.useCallback)((()=>c(!0)),[]),u=(0,o.useCallback)((()=>c(!1)),[]);(0,o.useEffect)((()=>{if(s)return i(t)}),[t,i,s]);const p=-1===t&&l||1===t&&n;if((0,o.useEffect)((()=>{p||c(!1)}),[p]),!p)return null;const m="horizontal"===C?Po:Ro;return r.createElement(m,{size:a,direction:t,onPointerEnter:d,onPointerLeave:u,mode:C})}));const Do=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"horizontal",t=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;const[r,l]=(0,o.useState)(!1),[C,i]=(0,o.useState)(!1),[s,c]=(0,o.useState)(0),d=(0,o.useBatchingCallback)((()=>{const t=a.current;if(t)if("horizontal"===e){const e=t.scrollWidth-t.clientWidth;e<=0?(l(!1),i(!1)):(l(t.scrollLeft>0),i(t.scrollLeft<e))}else{const e=t.scrollHeight-t.clientHeight;e<=0?(l(!1),i(!1)):(l(t.scrollTop>0),i(t.scrollTop<e))}}),[e,a]),u=(0,o.useCallback)((e=>(c(e),()=>c(0))),[c]),p=t&&r,m=t&&C;return(0,o.useEffect)((()=>{if(0===s||!(p&&s<0||m&&s>0))return;let t=!0;const r=()=>{const l=Math.max(Math.min(.2*n,10),0);"horizontal"===e?a.current.scrollLeft+=s*l:a.current.scrollTop+=s*l,d(),t&&window.requestAnimationFrame(r)};return r(),()=>{t=!1}}),[s,d,p,m,n,e,a]),(0,o.useEffect)((()=>d()),[t,d]),{startScroll:u,canScrollEnd:m,canScrollStart:p}};function No(){return No=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},No.apply(this,arguments)}const Bo=l.default.div.attrs({role:"listbox"}).withConfig({displayName:"reorderable__ReorderableContainer",componentId:"sc-plmujd-0"})(["display:flex;"]),Fo=(0,o.forwardRef)((function Reorderable(e,t){let{children:a,onPositionChange:n,getItemSize:l,scrollSize:C=null,mode:i="horizontal",...s}=e;const c=(0,o.useRef)(null),d=t||c,{isReordering:u,currentSeparator:p,setCurrentSeparator:m,handleStartReordering:f,currentPosition:g}=ko(n,a.length),{startScroll:h,canScrollEnd:E,canScrollStart:b}=Do(i,u,d,l()),y={state:{isReordering:u,currentSeparator:p,containerRef:d,mode:i,canScrollEnd:E,canScrollStart:b,currentPosition:g},actions:{setCurrentSeparator:m,handleStartReordering:f,startScroll:h}},v=C||l();return r.createElement(Ao.Provider,{value:y},r.createElement(Bo,No({ref:d},s),r.createElement(Oo,{direction:-1,size:v}),a,r.createElement(Oo,{direction:1,size:v})))}));const zo=function(e){return(0,o.useContextSelector)(Ao,e??o.identity)};function Ho(){return Ho=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ho.apply(this,arguments)}const Vo=l.default.div.withConfig({displayName:"reorderableItem__Container",comp
|
||
|
(0,C.__)("Page %s (current page)","web-stories"),a+1):(0,cl.default)(/* translators: %s: page number. */
|
||
|
(0,C.__)("Go to page %s","web-stories"),a+1),isActive:d,page:c,width:n,height:l,isInteractive:u})),r.createElement(Qo,{position:a+1,$width:n,$height:l,margin:o},r.createElement(Xo,{$height:l}))):null};var tC=a(72666),aC=a(80856);const nC=l.default.li.attrs({role:"presentation"}).withConfig({displayName:"skeletonPage__EmptyPage",componentId:"sc-3wwzc9-0"})(["display:block;position:relative;flex:0 0;margin:0;padding:0;border-radius:4px;"]);const rC=function SkeletonPage(e){let{pageId:t,index:a}=e;const{pageThumbWidth:n,pageThumbHeight:l,pageThumbMargin:o,hasPage:C,bgColor:i}=_o((e=>{let{state:{pageThumbWidth:a,pageThumbHeight:n,pageThumbMargin:r,pages:l}}=e,o=null;const C=l.find((e=>{let{id:a}=e;return a===t}));if(C){o=C.backgroundColor;const e=C.elements[0];e&&d.elementIs.media(e)&&e.resource.baseColor&&(0,tC.default)(e.resource.baseColor)&&(o=(0,aC.default)(e.resource.baseColor.replace("#","")))}return{pageThumbWidth:a,pageThumbHeight:n,pageThumbMargin:r,hasPage:Boolean(C&&C.id),bgColor:o}}));return C?r.createElement(nC,{style:{flexBasis:`${n}px`,height:`${l}px`,marginLeft:`${0===a?o:0}px`,marginRight:`${o}px`,...(0,ln.default)(i)},"data-testid":`carousel-page-preview-skeleton-${t}`}):null},lC=(0,l.default)(Fo).attrs({role:"listbox","aria-orientation":"horizontal",mode:"horizontal"}).withConfig({displayName:"carouselList__PageList",componentId:"sc-1oa14z5-0"})(["grid-area:carousel;flex-direction:row;align-items:center;justify-content:center;overflow-x:hidden;overflow-y:hidden;width:","px;list-style:none;padding:4px 0;margin:-4px 0;",";::-webkit-scrollbar-thumb{border:6px solid transparent !important;}"],(e=>{let{$width:t}=e;return t}),(e=>{let{hasOverflow:t}=e;return t&&(0,l.css)(["overflow-x:visible;overflow-x:overlay;justify-content:flex-start;"])}));const oC=function CarouselList(){const{pageThumbWidth:e,carouselWidth:t,hasOverflow:a,pageIds:n,rearrangePages:l,setListRef:o,showSkeleton:i}=_o((e=>{let{state:{pageThumbWidth:t,carouselWidth:a,hasOverflow:n,pageIds:r,showSkeleton:l},actions:{rearrangePages:o,setListRef:C}}=e;return{pageThumbWidth:t,carouselWidth:a,hasOverflow:n,pageIds:r,rearrangePages:o,setListRef:C,showSkeleton:l}})),s=i?rC:eC;return r.createElement(lC,{mode:"horizontal",$width:t,ref:o,hasOverflow:a,"aria-label":(0,C.__)("Pages List","web-stories"),onPositionChange:l,getItemSize:()=>e},n.map(((e,t)=>r.createElement(s,{key:e,pageId:e,index:t}))))};var CC,iC=a(76517);function sC(){return sC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},sC.apply(this,arguments)}const SvgChevronUpSmall=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",sC({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,CC||(CC=r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"m12 17 4-3 4 3"})))},cC=(0,r.memo)(SvgChevronUpSmall),dC=(0,l.css)(["width:32px;margin:-8px;"]),uC=(0,l.default)(iC.default).withConfig({displayName:"carouselDrawerIcon__IconDown",componentId:"sc-b03fdn-0"})(["",""],dC),pC=(0,l.default)(cC).withConfig({displayName:"carouselDrawerIcon__IconUp",componentId:"sc-b03fdn-1"})(["",""],dC);const mC=function CarouselDrawerIcon(e){let{state:t}=e;return[s.CarouselState.Open,s.CarouselState.Closing].includes(t)?r.createElement(uC,null):r.createElement(pC,null)},fC=l.default.div.withConfig({displayName:"carouselDrawer__Wrapper",componentId:"sc-1dxh28m-0"})(["display:flex;justify-content:center;"]),gC=(0,l.default)(wa.Button).withConfig({displayName:"carouselDrawer__StyledButton",componentId:"sc-1dxh28m-1"})(["white-space:nowrap;gap:8px;"]);const hC=function CarouselDrawer(){const{carouselState:e,openCarousel:t,closeCarousel:a}=(0,i.useLayout)((e=>{let{state:{carouselState:t},actions:{openCarousel:a,closeCarousel:n}}=e;return{carouselState:t,openCarousel:a,closeCarousel:n}})),{currentPageNumber:n,pageCount:l}=(0,i.useStory)((e=>{let{state:{
|
||
|
(0,C._n)("%1$d of %2$d page","%1$d of %2$d pages",l,"web-stories"),n,l),r.createElement(mC,{state:e})))},EC=l.default.section.withConfig({displayName:"carouselLayout__Wrapper",componentId:"sc-iaovfa-0"})(["position:relative;display:grid;grid:'. d d d d d .' 32px '. . . . . . .' ","px '. p . c . n .' auto / 1fr ","px ","px auto ","px ","px 1fr;width:100%;height:auto;z-index:",";&.carousel-enter{top:","px;&.carousel-enter-active{top:0;transition:","ms ease-out;transition-property:top;}}&.carousel-exit{top:0;&.carousel-exit-active{top:","px;transition:","ms ease-out;transition-property:top;}}"],(e=>{let{isCollapsed:t}=e;return t?2:8}),sn,8,8,sn,h.Z_INDEX_FOOTER,(e=>{let{thumbHeight:t}=e;return t+6}),s.CAROUSEL_TRANSITION_DURATION,(e=>{let{thumbHeight:t}=e;return t+6}),s.CAROUSEL_TRANSITION_DURATION),bC=l.default.div.withConfig({displayName:"carouselLayout__Area",componentId:"sc-iaovfa-1"})(["grid-area:",";display:flex;align-items:center;justify-content:center;flex-direction:column;"],(e=>{let{area:t}=e;return t}));const yC=function CarouselLayout(){const{carouselState:e}=(0,i.useLayout)((e=>{let{state:{carouselState:t}}=e;return{carouselState:t}})),{numPages:t,pageThumbHeight:a}=_o((e=>{let{state:{numPages:t,pageThumbHeight:a}}=e;return{numPages:t,pageThumbHeight:a}})),n=(0,o.useRef)();if(t<=0)return null;const l=e===s.CarouselState.Closed,c=[s.CarouselState.Open,s.CarouselState.Opening].includes(e);return r.createElement(bo.default,{in:c,classNames:"carousel",containerRef:!0,nodeRef:n,timeout:s.CAROUSEL_TRANSITION_DURATION},r.createElement(EC,{ref:n,"aria-label":(0,C.__)("Page Carousel","web-stories"),isCollapsed:l,thumbHeight:a},r.createElement(bC,{area:"d"},r.createElement(hC,null)),!l&&r.createElement(r.Fragment,null,r.createElement(bC,{area:"p"},r.createElement(CarouselScrollBack,null)),r.createElement(bC,{area:"c"},r.createElement(oC,null)),r.createElement(bC,{area:"n"},r.createElement(CarouselScrollForward,null)))))},vC=l.default.div.withConfig({displayName:"carouselContainer__Wrapper",componentId:"sc-1dsu28u-0"})(["height:auto;width:100%;align-self:flex-end;"]);const _C=(0,o.memo)((function CarouselContainer(){const e=(0,o.useRef)(),[t,a]=(0,o.useState)(0);return(0,o.useResizeEffect)(e,(e=>{let{width:t}=e;return a(t)}),[]),r.createElement(To,{availableSpace:t},r.createElement(vC,{ref:e},r.createElement(yC,null)))}));var wC=a(76274);const MC=(0,l.css)(["width:80px;height:36px;padding:0 10px;border-width:1px;border-style:solid;border-color:",";background-color:",";transition:background-color ",";&:hover,&:focus,&:active{border-color:",";background-color:",";}span{height:100%;padding:0;display:flex;align-items:center;}svg{margin:0 -10px;}"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}),(e=>{let{theme:t}=e;return t.colors.bg.primary}),Q.BUTTON_TRANSITION_TIMING,(e=>{let{theme:t}=e;return t.colors.bg.secondary}),(e=>{let{theme:t}=e;return t.colors.bg.tertiary})),LC=[{label:(0,C._x)("100%","zoom level","web-stories"),value:1},{label:(0,C._x)("200%","zoom level","web-stories"),value:2},{label:(0,C._x)("Fill","zoom level","web-stories"),value:s.ZoomSetting.Fill},{label:(0,C._x)("Fit","zoom level","web-stories"),value:s.ZoomSetting.Fit}];const SC=function ZoomSelector(){const{zoomSetting:e,zoomLevel:t,setZoomSetting:a,setZoomLevel:n}=(0,fn.useLayout)((e=>{let{state:{zoomSetting:t,zoomLevel:a},actions:{setZoomSetting:n,setZoomLevel:r}}=e;return{zoomSetting:t,zoomLevel:a,setZoomSetting:n,setZoomLevel:r}})),l=(0,o.useMemo)((()=>{const a=LC.find((a=>{let{value:n}=a;return e===s.ZoomSetting.Fixed?n===t:n===e}));return a?a.label:(0,cl.default)(/* translators: %d: zoom level percentage value. */
|
||
|
(0,C._x)("%d%%","zoom level","web-stories"),Math.round(100*t))}),[e,t]),i=(0,o.useCallback)(((e,t)=>{Object.values(s.ZoomSetting).includes(t)?a(t):n(t)}),[a,n]);return r.createElement(wC.default,{ariaLabel:(0,C.__)("Zoom Level","web-stories"),placeholder:l,options:LC,placement:F.Placement.TopStart,onMenuItemClick:i,selectedValue:e,popupFillWidth:!1,selectButtonStylesOverride:MC,className:"zoom-selector-dropdown"})};var IC=a(98477),TC=a(95735),xC=a(192),AC=a(36594),kC=a(97959);const ZC=l.default.section.withConfig({displayName:"gridView__Container",componentId:"sc-ytsaos-0"})(["display:flex;flex-direction:column;height:100%;width:100%;padding:32px;"]),PC=l.default.header.withConfig({displayName:"gridView__TopRow",componentId:"sc-ytsaos-1"})(["display:flex;justify-content:space-between;align-items:center;margin-bottom:36px;@media ","{margin-bottom:72px;}@media ","{margin-bottom:112px;}"],(e=>{let{theme:t}=e;return t.breakpoint.desktop}),(e=>{let{theme:t}=e;return t.breakpoint.wide})),RC=(0,l.default)(Fo).withConfig({displayName:"gridView__Wrapper",componentId:"sc-ytsaos-2"})(["position:relative;overflow-y:auto;overflow-y:overlay;overflow-x:hidden;flex-grow:1;display:flex;flex-direction:column;pointer-events:all;padding:4px;"]),OC=l.default.div.withConfig({displayName:"gridView__Grid",componentId:"sc-ytsaos-3"})(["position:relative;display:grid;grid-template-columns:",";grid-template-rows:repeat(auto-fill,","px);grid-gap:","px;justify-content:center;align-items:flex-start;flex-grow:1;"],(e=>{let{pageWidth:t}=e;return`repeat(auto-fit, minmax(${t}px, max-content))`}),(e=>{let{pageHeight:t}=e;return t}),(e=>{let{gapWidth:t}=e;return t})),DC=l.default.div.withConfig({displayName:"gridView__NoButton",componentId:"sc-ytsaos-4"})(["flex:0 0 56px;"]),NC=(0,l.default)(wa.Button).withConfig({displayName:"gridView__ClickableButton",componentId:"sc-ytsaos-5"})(["pointer-events:all;"]),BC=(0,l.default)(AC.default).withConfig({displayName:"gridView__ClickableSlider",componentId:"sc-ytsaos-6"})(["pointer-events:all;width:366px;"]),FC=(0,l.default)(qo).withConfig({displayName:"gridView__PageSeparator",componentId:"sc-ytsaos-7"})(["position:absolute;bottom:0;left:","px;width:","px;height:","px;display:flex;justify-content:center;align-items:center;",""],(e=>{let{width:t}=e;return t/2}),(e=>{let{width:t,margin:a}=e;return t+a}),(e=>{let{height:t}=e;return t}),(e=>{let{before:t,width:a,margin:n}=e;return t&&`\n left: -${(a+2*n)/2}px;\n `})),zC=l.default.div.withConfig({displayName:"gridView__Line",componentId:"sc-ytsaos-8"})(["background:",";height:","px;width:2px;margin:0px;"],(e=>{let{theme:t}=e;return t.colors.border.selection}),(e=>{let{height:t}=e;return t})),HC=l.default.div.withConfig({displayName:"gridView__ItemContainer",componentId:"sc-ytsaos-9"})(["display:flex;flex-direction:row;position:relative;"]);const VC=function GridView(e){let{onClose:t}=e;const{pages:a,currentPageId:n,currentPageIndex:l,setCurrentPage:s,arrangePage:c}=(0,i.useStory)((e=>{let{state:{pages:t,currentPageIndex:a,currentPageId:n},actions:{setCurrentPage:r,arrangePage:l}}=e;return{pages:t,currentPageIndex:a,currentPageId:n,setCurrentPage:r,arrangePage:l}})),{isRTL:d}=(0,i.useConfig)(),[u,p]=(0,o.useState)(4),[m,f]=(0,o.useState)(null),g=(0,o.useRef)();(0,o.useResizeEffect)(g,(e=>{let{width:t}=e;return f(t)}),[]);const E=(m-20*(u-1))/u,b=12*Math.floor(E/12),y=b*u,v=Math.floor((m-y)/(u-1)),_=b/on.FULLBLEED_RATIO,w=e=>()=>s({pageId:e.id}),M=(0,o.useRef)(),L=(0,o.useRef)({}),S=(0,o.useCallback)(((e,t)=>{c({pageId:e,position:t})}),[c]);(0,kC.default)({containerRef:g,gridRef:M,itemRefs:L,isRTL:d,currentItemId:n,items:a,arrangeItem:S});const I=Math.min(_-24,64);return r.createElement(ZC,{"aria-label":(0,C.__)("Grid View","web-stories")},r.createElement(PC,null,r.createElement(NC,{variant:Q.ButtonVariant.Square,type:Q.ButtonType.Tertiary,size:Q.ButtonSize.Medium,onClick:t,"aria-label":(0,C.__)("Close","web-stories")},r.createElement(Ae.default,null)),r.createElement(BC,{min:4,max:12,majorStep:1,minorStep:1,value:u,handleChange:e=>p(e),"aria-label":(0,C.__)("Pag
|
||
|
(0,C.__)("Page %s (current page)","web-stories"),t+1):(0,cl.default)(/* translators: %s: page number. */
|
||
|
(0,C.__)("Page %s","web-stories"),t+1),tabIndex:n&&o?0:-1,isActive:n&&o,page:e,width:b,height:_,onClick:w(e),isInteractive:o,gridRef:M,role:"option"})),r.createElement(FC,{position:t+1,width:b,height:_,margin:v},r.createElement(zC,{height:I})))})))))},UC=l.default.div.withConfig({displayName:"gridViewButton__Box",componentId:"sc-1gc0r0y-0"})(["display:flex;justify-content:center;align-items:center;"]);const jC=function GridViewButton(){const[e,t]=(0,o.useState)(!1),a=(0,o.useCallback)((()=>{t((e=>{const t=!e;return(0,D.trackEvent)("grid_view_toggled",{status:t?"open":"closed"}),t}))}),[t]);return r.createElement(r.Fragment,null,r.createElement(UC,null,r.createElement(K.default,{title:(0,C.__)("Grid View","web-stories"),placement:F.Placement.Top,hasTail:!0},r.createElement(xC.ToggleButton,{isOpen:e,onClick:a,"aria-owns":"gridview_modal",MainIcon:IC.default,"aria-label":(0,C.__)("Grid View","web-stories"),label:(0,C.__)("Grid View","web-stories")}))),r.createElement(TC.default,{isOpen:e,onClose:a,contentLabel:(0,C.__)("Grid View","web-stories"),popupId:"gridview_modal",overlayStyles:{alignItems:"stretch",backgroundColor:"#131516"},contentStyles:{pointerEvents:"none",flex:1}},r.createElement(VC,{onClose:a})))};var GC,WC=a(82647),$C=a(835);a(16054);function YC(){return YC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},YC.apply(this,arguments)}const SvgChevronDown=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",YC({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,GC||(GC=r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M21.5 14 16 19.5 10.5 14"})))},qC=(0,r.memo)(SvgChevronDown);var XC;function KC(){return KC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},KC.apply(this,arguments)}const SvgGroup=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",KC({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21 21","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,XC||(XC=r.createElement("rect",{width:20,height:20,x:.5,y:.5,stroke:"currentColor",strokeDasharray:"2 2",rx:2.5})))},QC=(0,r.memo)(SvgGroup);var JC;function ei(){return ei=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ei.apply(this,arguments)}const SvgVisibilityOff=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",ei({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,JC||(JC=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m18.12 17.787.833.833.987.987 2.52 2.52-.94.94-2.867-2.867c-.833.3-1.72.467-2.653.467-3.333 0-6.18-2.074-7.333-5a7.972 7.972 0 0 1 2.28-3.167L9.26 10.813l.947-.94 1.853 1.854.987.986.833.834.847.846 2.546 2.547.847.847ZM16 12c2.527 0 4.78 1.42 5.88 3.667a6.507 6.507 0 0 1-1.773 2.22l.946.946a7.903 7.903 0 0 0 2.287-3.16c-1.16-2.933-4.007-5.006-7.34-5.006-.933 0-1.82.166-2.653.466L14.42 12.2A6.93 6.93 0 0 1 16 12Zm-.947.833 1.04 1.04c.92.047 1.647.78 1.694 1.694l1.04 1.04c.106-.294.173-.607.173-.94 0-1.654-1.347-3-3-3-.333 0-.647.066-.947.166Zm.854 4.627a1.784 1.784 0 0 1-1.694-1.693l1.694 1.693Zm-5.787-1.793A6.513 6.513 0 0 0 16 19.333c.54 0 1.067-.08 1.58-.2l-.633-.633c-.3.1-.614.167-.947.167-1.653 0-3-1.347-3-3 0-.334.067-.647.167-.947l-1.274-1.273a6.51 6.51 0 0 0-1.773 2.22Z",clipRule:"evenodd"})))},ti=(0,r.memo)(SvgVisibilityOff);var ai=a(37233);const ni=function(e){const{toggleLayer:t,groupLayers:a,selectedElementIds:n}=(0,i.useStory)((t=>{let{state:a,actions:n}=t;return{groupLayers:a.currentPage.elements.filter((t=>t.groupId===e)),selectedElementI
|
||
|
(0,C.__)("Layers (%d)","web-stories"),e)}))};var hs;function Es(){return Es=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Es.apply(this,arguments)}const SvgBoxWithDots=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",Es({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,hs||(hs=r.createElement("g",{fill:"currentColor",transform:"translate(0 2.045)"},r.createElement("path",{fillRule:"evenodd",d:"M7 11.5A1.5 1.5 0 0 1 8.5 10h15a1.5 1.5 0 0 1 1.5 1.5v4.91a1.5 1.5 0 0 1-1.5 1.5h-15a1.5 1.5 0 0 1-1.5-1.5Zm1.5-.5a.5.5 0 0 0-.5.5v4.91a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V11.5a.5.5 0 0 0-.5-.5z",clipRule:"evenodd"}),r.createElement("circle",{cx:10.25,cy:14.045,r:.75}),r.createElement("circle",{cx:12.75,cy:14.045,r:.75}),r.createElement("circle",{cx:15.75,cy:14.045,r:.75}),r.createElement("circle",{cx:18.75,cy:14.045,r:.75}),r.createElement("circle",{cx:21.75,cy:14.045,r:.75}))))},bs=(0,r.memo)(SvgBoxWithDots);var ys=a(88849);const vs=(0,l.default)(xC.ToggleButton).withConfig({displayName:"toolbarToggle__StyledButton",componentId:"sc-1hbzga5-0"})(["",""],(e=>{let{isHighlighted:t}=e;return t&&(0,l.css)([""," ",""],ys.default.OUTLINE,ys.default.FLASH)})),_s=bt.LOCAL_STORAGE_PREFIX.ELEMENT_TOOLBAR_SETTINGS;const ws=function ToolbarToggle(){const{displayFloatingMenu:e,setDisplayFloatingMenu:t}=(0,i.useCanvas)((e=>{let{state:t,actions:a}=e;return{displayFloatingMenu:t.displayFloatingMenu,setDisplayFloatingMenu:a.setDisplayFloatingMenu}})),{highlight:a,resetHighlight:n}=(0,dt.useHighlights)((e=>({highlight:e[dt.states.ElementToolbarToggle],resetHighlight:e.onFocusOut})));return e?null:r.createElement(K.default,{title:(0,C.__)("Show element toolbar","web-stories"),placement:F.Placement.Top,hasTail:!0},r.createElement(vs,{ref:e=>{e&&a?.focus&&a?.showEffect&&e.focus()},onClick:()=>{const e=bt.localStore.getItemByKey(_s)||{};bt.localStore.setItemByKey(_s,{...e,isDisplayed:!0}),t(!0)},"aria-label":(0,C.__)("Show element toolbar","web-stories"),label:(0,C.__)("Show element toolbar","web-stories"),isOpen:!1,isHighlighted:a?.showEffect,onAnimationEnd:()=>n(),MainIcon:bs}))},Ms=l.default.div.withConfig({displayName:"primaryMenu__Wrapper",componentId:"sc-1n6k8y9-0"})(["display:flex;align-items:flex-end;justify-content:flex-end;width:100%;height:100%;z-index:",";"],h.Z_INDEX_FOOTER),Ls=l.default.div.withConfig({displayName:"primaryMenu__MenuItems",componentId:"sc-1n6k8y9-1"})(["position:relative;display:flex;flex-direction:row;align-items:center;margin-right:","px;gap:","px;"],16,8);const Ss=function PrimaryMenu(){return r.createElement(Ms,null,r.createElement(Ls,{id:"primary-menu-items"},r.createElement(ws,null),r.createElement(SC,null),r.createElement(jC,null),r.createElement(gs,null)))};var Is,Ts,xs,As,ks,Zs,Ps,Rs,Os,Ds,Ns;function Bs(){return Bs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Bs.apply(this,arguments)}const SvgKeyboard=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",Bs({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,Is||(Is=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M7 11.5A1.5 1.5 0 0 1 8.5 10h15a1.5 1.5 0 0 1 1.5 1.5v8.91a1.5 1.5 0 0 1-1.5 1.5h-15a1.5 1.5 0 0 1-1.5-1.5V11.5Zm1.5-.5a.5.5 0 0 0-.5.5v8.91a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V11.5a.5.5 0 0 0-.5-.5h-15Z",clipRule:"evenodd"})),Ts||(Ts=r.createElement("rect",{width:7.3,height:1,x:12,y:18.5,fill:"currentColor",rx:.5})),xs||(xs=r.createElement("circle",{cx:10.25,cy:13.75,r:.75,fill:"currentColor"})),As||(As=r.createElement("circle",{cx:12.75,cy:13.75,r:.75,fill:"currentColor"})),ks||(ks=r.createElement("circle",{cx:15.75,cy:13.75,r:.75,fill:"currentColor"})),Zs||(Zs=r.createElement("circl
|
||
|
(0,C.__)("<lkbd>%s</lkbd> <span>+ click</span>","web-stories"),(0,Ml.prettifyShortcut)("shift"))))},{label:(0,C.__)("Move forward or back","web-stories"),shortcut:r.createElement("kbd",null,r.createElement(Vs.default,{mapping:{kbd:r.createElement("kbd",null),lkbd:r.createElement(LargeKey,null)}},(0,cl.default)(/* translators: 1: Cmd/Ctrl key. 2: Up key. 3: Down key. */
|
||
|
(0,C.__)("<lkbd>%1$s</lkbd> <kbd>%2$s</kbd> <span>or</span> <kbd>%3$s</kbd>","web-stories"),(0,Ml.prettifyShortcut)("mod"),(0,Ml.prettifyShortcut)("up"),(0,Ml.prettifyShortcut)("down"))))},{label:(0,C.__)("Move to front or back","web-stories"),shortcut:r.createElement("kbd",null,r.createElement(Vs.default,{mapping:{kbd:r.createElement("kbd",null),lkbd:r.createElement(LargeKey,null)}},(0,cl.default)(/* translators: 1: Cmd/Ctrl key. 2: Shift key. 3: Up key. 4: Down key. */
|
||
|
(0,C.__)("<lkbd>%1$s</lkbd> <lkbd>%2$s</lkbd> <kbd>%3$s</kbd> <span>or</span> <kbd>%4$s</kbd>","web-stories"),(0,Ml.prettifyShortcut)("mod"),(0,Ml.prettifyShortcut)("shift"),(0,Ml.prettifyShortcut)("up"),(0,Ml.prettifyShortcut)("down"))))},{label:(0,C.__)("Enter crop/edit mode","web-stories"),shortcut:r.createElement("kbd",null,r.createElement(Vs.default,{mapping:{kbd:r.createElement("kbd",null)}},(0,cl.default)(/* translators: %s: Enter key. */
|
||
|
(0,C.__)("<kbd>%s</kbd> <span>or double-click</span>","web-stories"),(0,Ml.prettifyShortcut)("enter"))))},{label:(0,C.__)("Delete","web-stories"),shortcut:r.createElement("kbd",null,r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("delete")))},{disabled:!0,label:(0,C.__)("Insert/edit link","web-stories"),shortcut:r.createElement("kbd",null,r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("mod")),r.createElement("kbd",null,"A"))},{label:(0,C.__)("Disable snapping and drop targeting","web-stories"),shortcut:r.createElement("kbd",null,r.createElement(Vs.default,{mapping:{lkbd:r.createElement(LargeKey,null)}},(0,cl.default)(/* translators: %s: Cmd/Ctrl key. */
|
||
|
(0,C.__)("<span>Hold</span> <lkbd>%s</lkbd>","web-stories"),(0,Ml.prettifyShortcut)("mod"))))},{label:(0,C.__)("Access floating toolbar","web-stories"),shortcut:r.createElement("kbd",null,r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("ctrl")),r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("alt")),r.createElement("kbd",null,"P"))},{label:(0,C.__)("Open context menu","web-stories"),shortcut:r.createElement("kbd",null,r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("mod")),r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("alt")),r.createElement("kbd",{className:"large-key"},(0,Ml.prettifyShortcut)("shift")),r.createElement("kbd",null,"M"))},{label:(0,C.__)("Move element 1px","web-stories"),shortcut:r.createElement("kbd",null,r.createElement(Vs.default,{mapping:{lkbd:r.createElement(LargeKey,null),shortcut:r.createElement(v.Shortcut,{shortcut:"shift"})}},(0,cl.default)(/* translators: 1: Shift key. */
|
||
|
(0,C.__)("<lkbd>%s</lkbd> <span>+ arrow keys</span>","web-stories"),(0,Ml.prettifyShortcut)("shift"))))}]}]},Ws=Gs.header,$s=Gs.landmarks.filter((e=>!e.disabled)),Ys=Gs.sections.map((e=>({...e,commands:e.commands.filter((e=>!e.disabled))})));var qs=a(38668);function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Xs.apply(this,arguments)}const Ks=l.default.dd.withConfig({displayName:"shortcutLabel__Wrapper",componentId:"sc-6tlmvo-0"})(["display:block;margin:0;kbd{"," display:flex;justify-content:",";align-items:center;margin:0;padding:0;color:",";background-color:transparent;& > kbd{display:flex;justify-content:center;align-items:center;padding:0 5px;height:24px;width:24px;border-radius:",";border:1px solid ",";color:",";}& > kbd.large-key{width:auto;}kbd + kbd{margin-left:2px;}kbd + span{margin-left:4px;}span + kbd{margin-left:4px;}}"],qs.expandTextPreset(((e,t)=>{let{paragraph:a}=e,{XSmall:n}=t;return a[n]})),(e=>{let{alignment:t}=e;return t}),(e=>{let{theme:t}=e;return t.colors.fg.secondary}),(e=>{let{theme:t}=e;return t.borders.radius.medium}),(e=>{let{theme:t}=e;return t.colors.border.defaultNormal}),(e=>{let{theme:t}=e;return t.colors.fg.primary}));const Qs=function ShortCutLabel(e){let{keys:t,alignment:a="center",...n}=e;return r.createElement(Ks,Xs({alignment:a},n),t)};function Js(){return Js=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Js.apply(this,arguments)}const ec=l.default.dl.withConfig({displayName:"headerShortcut__List",componentId:"sc-1egg06k-0"})(["margin:24px;display:flex;flex-shrink:0;"]),tc=l.default.dt.withConfig({displayName:"headerShortcut__Item",componentId:"sc-1egg06k-1"})(["margin:0 12px 0 0;"]);const ac=function HeaderShortcut(e){const{label:t,shortcut:a}=Ws;return r.createElement(ec,null,r.createElement(tc,null,r.createElement(Hs.Headline,Js({as:"h2",size:Va.TextSize.XSmall},e),t)),r.createElement(Qs,{keys:a}))},nc=l.default.dl.withConfig({displayName:"landmarkShortcuts__LandmarksWrapper",componentId:"sc-k7r8e2-0"})(["background-color:",";margin:0;padding:16px 24px;display:flex;justify-content:space-between;user-select:text;"],(e=>{let{theme:t}=e;return t.colors.bg.secondary})),rc=l.default.div.withConfig({displayName:"landmarkShortcuts__Landmark",componentId:"sc-k7r8e2-1"})(["display:flex;flex-direction:column;"]),lc=(0,l.default)(Ha.Text.Span).attrs({size:Va.TextSize.XSmall}).withConfig({displayName:"landmarkShortcuts__Label",componentId:"sc-k7r8e2-2"})(["text-align:center;margin-top:8px;white-space:nowrap;display:inline-block;"]);const oc=function LandmarkShortcuts(){return r.createElement(nc,null,$s.map((e=>{let{label:t,shortcut:a}=e;return r.createElement(rc,{key:t},r.createElement(Qs,{keys:a}),r.createElement("dt",null,r.createElement(lc,null,t)))})))},Cc=(0,l.default)(Hs.Headline).attrs({as:"h3",size:Va.TextSize.XXSmall}).withConfig({displayName:"shortcutMenuSection__Header",componentId:"sc-xssjcb-0"})(["margin-top:24px;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.primary})),ic=l.default.dl.withConfig({displayName:"shortcutMenuSection__List",componentId:"sc-xssjcb-1"})(["display:grid;grid-template-columns:1fr;row-gap:12px;align-items:center;margin:12px 0 0;"]),sc=l.default.div.withConfig({displayName:"shortcutMenuSection__ListRow",componentId:"sc-xssjcb-2"})(["display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto;column-gap:5px;align-items:center;dd{grid-column:1;grid-row:1;}dt{grid-column:2;grid-row:1;}"]),cc=(0,l.default)(Ha.Text.Span).attrs({size:Va.TextSize.Small}).withConfig({displayName:"shortcutMenuSection__Label",componentId:"sc-xssjcb-3"})(["display:inline-block;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.secondary}));const dc=function ShortcutMenuSection(e){let{title:t,commands:a}=e;const n=`header-${(0,S.default)()}`;return r.createElement(r.Fragment,null,r.createE
|
||
|
(0,C._n)("Help Center: %s unread notification","Help Center: %s unread notifications",l,"web-stories"),l):(0,C.__)("Help Center","web-stories"),onClick:n,isOpen:t,label:(0,C.__)("Help","web-stories"),MainIcon:kd,notificationCount:l})}const Zd=l.default.div.withConfig({displayName:"helpCenter__Wrapper",componentId:"sc-12zoy5g-0"})(["z-index:",";"],h.Z_INDEX_FOOTER),HelpCenter=e=>{let{components:t}=e;const a=(0,o.useRef)(null),{state:n,actions:l}=(0,Lc.useHelpCenter)();return(0,o.useEffect)((()=>{n.isOpen&&Tc()}),[n.isOpen]),(0,pe.useStoryTriggerListener)(pe.STORY_EVENTS.onReplaceBackgroundMedia,(0,o.useCallback)((()=>{l.openToUnreadTip(Sc.KEYS.ADD_BACKGROUND_MEDIA)}),[l])),(0,pe.useStoryTriggerListener)(pe.STORY_EVENTS.onReplaceForegroundMedia,(0,o.useCallback)((()=>{l.openToUnreadTip(Sc.KEYS.CROP_SELECTED_ELEMENTS)}),[l])),r.createElement(c.default,null,r.createElement(r.Fragment,null,r.createElement(Mc.Styles,null),r.createElement(Zd,{ref:a},r.createElement(ps.default,{popupId:Sc.POPUP_ID,isOpen:n.isOpen,ariaLabel:(0,C.__)("Help Center","web-stories")},r.createElement(Bc,{isOpen:n.isOpen,onNext:l.goToNext,onPrev:l.goToPrev,onAllTips:l.goToMenu,onClose:l.close,hasBottomNavigation:n.hasBottomNavigation,isNextDisabled:n.isNextDisabled,isPrevDisabled:n.isPrevDisabled},r.createElement(Id,{readTips:n.readTips,tipKey:n.navigationFlow[n.navigationIndex],onTipSelect:l.goToTip,isLeftToRightTransition:n.isLeftToRightTransition,components:t}))),r.createElement(Toggle,{isOpen:n.isOpen,onClick:l.toggle,notificationCount:n.unreadTipsCount,popupId:Sc.POPUP_ID}))))},Pd=l.default.div.withConfig({displayName:"secondaryMenu__Wrapper",componentId:"sc-4921wn-0"})(["display:flex;align-items:flex-end;justify-content:flex-start;width:100%;height:100%;"]),Rd=l.default.div.withConfig({displayName:"secondaryMenu__MenuItems",componentId:"sc-4921wn-1"})(["position:relative;display:flex;flex-direction:row;align-items:center;margin-left:","px;gap:","px;"],16,8),Od="help_center",Dd="checklist",Nd="keyboard_shortcuts";const Bd=function SecondaryMenu(e){let{menu:t}=e;const a=(0,o.useRef)(""),{close:n,isHelpCenterOpen:l}=(0,i.useHelpCenter)((e=>{let{actions:{close:t},state:{isOpen:a}}=e;return{close:t,isHelpCenterOpen:a}})),{close:C,open:s,isChecklistOpen:c}=(0,fo.useChecklist)((e=>{let{actions:{close:t,open:a},state:{isOpen:n}}=e;return{close:t,open:a,isChecklistOpen:n}})),{close:d,isKeyboardShortcutsMenuOpen:u}=Eo((e=>{let{actions:{close:t},state:{isOpen:a}}=e;return{close:t,isKeyboardShortcutsMenuOpen:a}})),{handleResetReviewChecklist:p,reviewChecklistRequested:m}=(0,fo.useCheckpoint)((e=>{let{actions:{handleResetReviewChecklist:t},state:{reviewChecklistRequested:a}}=e;return{reviewChecklistRequested:a,handleResetReviewChecklist:t}})),f=(0,i.useCanvas)((e=>{let{state:{editingElementState:{isTrimMode:t},isEditing:a}}=e;return t||a})),g=(0,o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";a.current=e}),[]);return(0,o.useEffect)((()=>{c&&a.current!==Dd&&(n(),d(),g(Dd))}),[n,d,c,g]),(0,o.useEffect)((()=>{l&&a.current!==Od&&(C(),d(),g(Od))}),[C,d,l,g]),(0,o.useEffect)((()=>{u&&a.current!==Nd&&(C(),n(),g(Nd))}),[C,n,u,g]),(0,o.useEffect)((()=>{m&&(g(),p(),s())}),[m,p,s,g]),(0,o.useEffect)((()=>{f&&a.current&&(g(),C(),n())}),[C,n,f,g]),r.createElement(Pd,null,r.createElement(Rd,null,r.createElement(HelpCenter,{components:t?.helpCenter}),t?.checklist&&r.createElement(fo.Checklist,{items:t.checklist}),r.createElement(wc,null)))},Fd=l.default.section.withConfig({displayName:"footerLayout__Wrapper",componentId:"sc-gme2s1-0"})(["position:relative;display:grid;grid:'secondary carousel primary' auto / 1fr minmax(auto,calc(100% - ","px)) 1fr;width:100%;max-width:100%;height:100%;"],3*pn),zd=l.default.div.withConfig({displayName:"footerLayout__Area",componentId:"sc-gme2s1-1"})(["grid-area:",";display:flex;align-items:flex-end;justify-content:center;z-index:",";"],(e=>{let{area:t}=e;return t}),(e=>{let{zIndex:t="auto"}=e;return t}));const Hd=function FooterLayout(e){let{footer:t,zIndex:a}=e;return r.createElement(c.default,null
|
||
|
(0,C.__)("Press %s to undo the last change","web-stories"),(0,Ml.prettifyShortcut)("mod+z"))})}),[l,e])},$u={width:24,height:24},Yu=(0,l.default)(_t).attrs($u).withConfig({displayName:"useMediaActions__StyledSettings",componentId:"sc-1770zw4-0"})([""]),qu=(0,l.default)(hu.default).attrs($u).withConfig({displayName:"useMediaActions__Mic",componentId:"sc-1770zw4-1"})([""]),Xu=(0,l.default)(bu).attrs($u).withConfig({displayName:"useMediaActions__MicOff",componentId:"sc-1770zw4-2"})([""]),Ku=(0,l.default)(vu.default).attrs($u).withConfig({displayName:"useMediaActions__Video",componentId:"sc-1770zw4-3"})([""]),Qu=(0,l.default)(wu).attrs($u).withConfig({displayName:"useMediaActions__VideoOff",componentId:"sc-1770zw4-4"})([""]),Ju=(0,l.default)(Su).attrs($u).withConfig({displayName:"useMediaActions__BackgroundBlur",componentId:"sc-1770zw4-5"})([""]),ep=(0,l.default)(xu).attrs($u).withConfig({displayName:"useMediaActions__BackgroundBlurOff",componentId:"sc-1770zw4-6"})([""]);const tp=function(e){let{actionProps:t,selectedElement:a,handleFocusPanel:n,resetProperties:r,commonActions:l}=e;const{capabilities:{hasUploadMediaAction:i}}=(0,sa.useConfig)(),s=(0,pe.useStoryTriggersDispatch)(),{toggleRecordingMode:c,toggleVideo:u,toggleAudio:p,hasVideo:m,hasAudio:f,videoEffect:g,setVideoEffect:h,toggleSettings:E,audioInput:b,videoInput:y,isReady:v,isProcessing:_,isAdjustingTrim:w,isProcessingTrim:M,startTrim:L}=(0,ya.useMediaRecording)((e=>{let{state:t,actions:a}=e;return{hasAudio:t.hasAudio,hasVideo:t.hasVideo,videoEffect:t.videoEffect,audioInput:t.audioInput,videoInput:t.videoInput,isReady:!("ready"!==t.inputStatus||t.file?.type?.startsWith("image")||t.isCountingDown||"ready"!==t.status&&"idle"!==t.status),isProcessing:t.isProcessing,isAdjustingTrim:t.isAdjustingTrim,isProcessingTrim:t.isProcessingTrim,toggleRecordingMode:a.toggleRecordingMode,toggleVideo:a.toggleVideo,toggleAudio:a.toggleAudio,toggleSettings:a.toggleSettings,muteAudio:a.muteAudio,unMuteAudio:a.unMuteAudio,startTrim:a.startTrim,setVideoEffect:a.setVideoEffect}})),S=r.length>0,I=(0,o.useMemo)((()=>{const e=[];return i&&e.push({Icon:Ru,label:ou.REPLACE_MEDIA.text,onClick:()=>{s(pe.STORY_EVENTS.onReplaceForegroundMedia),(0,D.trackEvent)("quick_action",{name:ou.REPLACE_MEDIA.trackingEventName,element:a?.type})},wrapWithMediaPicker:!0,...t}),[...e,...l]}),[i,l,t,s,a?.type]),{handleFocusAnimationPanel:T,handleFocusCaptionsPanel:x}=(0,o.useMemo)((()=>({handleFocusAnimationPanel:n(dt.states.Animation),handleFocusCaptionsPanel:n(dt.states.Captions)})),[n]),A=(0,o.useMemo)((()=>{const[e,n]=S?[I.slice(0,I.length-1),I.slice(-1)]:[I,[]];return[...e,{Icon:Bu,label:ou.ADD_CAPTIONS.text,onClick:e=>{x()(e),(0,D.trackEvent)("quick_action",{name:ou.ADD_CAPTIONS.trackingEventName,element:a?.type})},...t},...n]}),[t,I,x,a?.type,S]),k=Wu(),Z=(0,o.useMemo)((()=>{const e=[{Icon:Vu.default,label:ou.ADD_ANIMATION.text,onClick:e=>{T()(e),(0,D.trackEvent)("quick_action",{name:ou.ADD_ANIMATION.trackingEventName,element:a?.type,isBackground:!0})},...t}];i&&e.unshift({Icon:Ru,label:ou.REPLACE_BACKGROUND_MEDIA.text,onClick:()=>{s(pe.STORY_EVENTS.onReplaceBackgroundMedia),(0,D.trackEvent)("quick_action",{name:ou.REPLACE_BACKGROUND_MEDIA.trackingEventName,element:a?.type,isBackground:!0})},wrapWithMediaPicker:!0,...t});const n={Icon:ju,label:ou.RESET_ELEMENT.text,onClick:()=>{k({elementId:a?.id,resetProperties:r,elementType:d.ELEMENT_TYPES.IMAGE}),(0,D.trackEvent)("quick_action",{name:ou.RESET_ELEMENT.trackingEventName,element:a?.type,isBackground:!0})},separator:"top",...t};return S?[...e,n]:e}),[t,s,k,T,i,r,a?.id,a?.type,S]),P=(0,o.useMemo)((()=>[{Icon:Ae.default,label:(0,C.__)("Close","web-stories"),onClick:()=>{(0,D.trackEvent)("media_recording_mode_toggled",{status:"closed"}),c()},...t},{Icon:Yu,label:(0,C.__)("Options","web-stories"),onClick:()=>{(0,D.trackEvent)("media_recording_open_settings"),E()},disabled:!v,separator:"top",...t},b&&{Icon:f?qu:Xu,label:f?(0,C.__)("Disable Audio","web-stories"):(0,C.__)("Enable Audio","web-stories"),onClick:()=>{(0,D.trackEvent)("media_recording_audio_toggled"
|
||
|
(0,C.__)("Please choose only %s to insert into page.","web-stories"),(0,ip.default)(y)));const w=(0,o.useCallback)(((e,t)=>{cp.default.set(e.id,{url:t,type:"cached"}),d({elementIds:[c?.[0]?.id],properties:{type:e.type,resource:e}})}),[c,d]),M=(0,o.useCallback)((e=>{try{h&&g(e)&&(v.includes(e.mimeType)&&m({resource:e}),"image/gif"===e.mimeType&&f({resource:e})),w(e,e.sizes?.medium?.sourceUrl||e.src),p(e)}catch(e){E({message:e.message,dismissable:!0})}}),[h,g,w,p,v,m,f,E]);return r.createElement(s,pp({title:(0,C.__)("Replace media","web-stories"),buttonInsertText:(0,C.__)("Replace media","web-stories"),onSelect:M,onClose:u,type:b,onSelectErrorMessage:_,render:e=>t({onClick:e})},a))};var fp=a(6325);function gp(){return gp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},gp.apply(this,arguments)}const hp=(0,l.default)(wa.Button).withConfig({displayName:"pageMenuButton__StyledButton",componentId:"sc-x8fz92-0"})(["margin-top:12px;"]);const Ep=(0,o.forwardRef)((function PageMenuButtonWithRef(e,t){let{children:a,title:n,shortcut:l,...o}=e;return r.createElement(K.default,{title:n,shortcut:l,placement:F.Placement.Right,hasTail:!0},r.createElement(hp,gp({variant:Q.ButtonVariant.Square,type:Q.ButtonType.Secondary,size:Q.ButtonSize.Small,ref:t},o),a))}));Ep.propTypes={children:w().node,title:w().string,shortcut:w().string};const bp=Ep;var yp;function vp(){return vp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},vp.apply(this,arguments)}const SvgStopOutline=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",vp({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,yp||(yp=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M9 16a7 7 0 1 1 14 0 7 7 0 0 1-14 0Zm7-8a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-2 5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-4Z",clipRule:"evenodd"})))},_p=(0,r.memo)(SvgStopOutline);var wp;function Mp(){return Mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Mp.apply(this,arguments)}const SvgPlayOutline=e=>{let{title:t,titleId:a,...n}=e;return r.createElement("svg",Mp({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?r.createElement("title",{id:a},t):null,wp||(wp=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M9 16a7 7 0 1 1 14 0 7 7 0 0 1-14 0Zm7-8a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-1.215 11.38 4.276-2.575c.585-.353.585-1.257 0-1.61l-4.276-2.575c-.575-.346-1.285.098-1.285.804v5.152c0 .706.71 1.15 1.285.804Z",clipRule:"evenodd"})))},Lp=(0,r.memo)(SvgPlayOutline);const Sp=function AnimationToggle(){const{animationState:e,updateAnimationState:t,isFirstPage:a}=(0,i.useStory)((e=>{let{state:{animationState:t,currentPageNumber:a},actions:{updateAnimationState:n}}=e;return{animationState:t,updateAnimationState:n,isFirstPage:1===a}})),n=[Qa.StoryAnimationState.Playing,Qa.StoryAnimationState.PlayingSelected].includes(e),l=a?(0,C.__)("Animations Disabled","web-stories"):n?(0,C.__)("Stop","web-stories"):(0,C.__)("Play","web-stories"),s=a?(0,C.__)("Page Animations Disabled","web-stories"):n?(0,C.__)("Stop Page Animations","web-stories"):(0,C.__)("Play Page Animations","web-stories"),c=a?null:"mod+enter",d=n?_p:Lp,u=(0,o.useCallback)((()=>{t({animationState:n?Qa.StoryAnimationState.Reset:Qa.StoryAnimationState.Playing}),(0,D.trackEvent)("canvas_play_animations",{status:n?"stop":"play"})}),[n,t]);return r.createElement(bp,{title:l,shortcut:c,onClick:u,"aria-label":s,disabled:a},r.createElement(d,null))},Ip=l.default.div.withConfig({displayName:"pageMenu__Wrapper",componentId:"sc-m9u2n8-0"})(["margin-top:auto;padding:0 4px;pointer-events:all;"]);const Tp
|
||
|
(0,r.__)("Increase font size to %s or above","web-stories"),m),footer:(0,l.default)(/* translators: %d: minimum font size. */
|
||
|
(0,r.__)("Ensure legibility by selecting text size %d or greater","web-stories"),m)},imagesMissingAltText:{title:(0,r.__)("Add assistive text to images","web-stories"),footer:(0,r.__)("Optimize accessibility and indexability with meaningful text to better assist users.","web-stories")},linkTappableRegionTooBig:{title:(0,r.__)("Reduce link size","web-stories"),footer:(0,r.__)("Elements with links must not cover most of the page. Decrease the size of elements with links.","web-stories")},linkTappableRegionTooSmall:{title:(0,l.default)(/* translators: %s: minimum tappable region size width x minimum tappable region size height. */
|
||
|
(0,r.__)("Increase tap area size to at least %s","web-stories"),"48x48px"),footer:(0,r.__)("Optimize accessibility and indexability with meaningful text to better assist users","web-stories")},lowContrast:{title:(0,r.__)("Increase contrast between text and background color","web-stories"),footer:(0,r.__)("Ensure legibility of text and ease of reading by increasing color contrast","web-stories"),textPanel:(0,r.__)("This color or font size combination may be hard for some people to read.","web-stories"),backgroundPanel:(0,r.__)("This background color may make some text hard to read.","web-stories"),warningIcon:(0,r.__)("Low Warning","web-stories")},videoMissingCaptions:{title:(0,r.__)("Add video captions","web-stories"),footer:(0,r.__)("Keep the audience engaged even when they can't listen to the audio","web-stories")},videoMissingTitle:{title:(0,r.__)("Add video description","web-stories"),footer:(0,r.__)("Improves indexability and accessibility (for videos without captions)","web-stories")}},Z={storyTooShort:{title:(0,l.default)(/* translators: %d: maximum number of pages. */
|
||
|
(0,r._n)("Make Web Story at least %d page","Make Web Story at least %d pages",h,"web-stories"),h),footer:(0,l.default)(/* translators: 1: minimum number of pages. 2: maximum number of pages. */
|
||
|
(0,r.__)("It is recommended to have between %1$d and %2$d pages in your story","web-stories"),h,E)},storyTooLong:{title:(0,l.default)(/* translators: %d: minimum number of pages. */
|
||
|
(0,r._n)("Make Web Story fewer than %d page","Make Web Story fewer than %d pages",E,"web-stories"),E),footer:(0,l.default)(/* translators: 1: minimum number of pages. 2: maximum number of pages. */
|
||
|
(0,r.__)("It is recommended to have between %1$d and %2$d pages in your story","web-stories"),h,E)},tooLittlePageText:{title:(0,r.__)("Add more text to page","web-stories"),footer:(0,l.default)(/* translators: %d: minimum number of story characters. */
|
||
|
(0,r._n)("Include at least %d character","Include at least %d characters",f,"web-stories"),f)},tooMuchPageText:{title:(0,r.__)("Reduce text amount on page","web-stories"),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,l.default)(/* translators: %d: maximum number of story characters. */
|
||
|
(0,r._n)("Include no more than %d character","Include no more than %d characters",g,"web-stories"),g)),n.createElement("li",null,(0,r.__)("Use a page attachment breaking up the text into multiple screens; or","web-stories")),n.createElement("li",null,(0,l.default)(/* translators: %s: maximum percentage of characters, depending on number of pages. */
|
||
|
(0,r.__)("Keep the total number of text-heavy pages under %s of total number of story pages","web-stories"),"10%")))},tooManyLinksOnPage:{title:(0,l.default)(/* translators: %s: maximum number of links per page. */
|
||
|
(0,r.__)("Avoid including more than %s links per page","web-stories"),v),footer:(0,l.default)(/* translators: %s: maximum number of links per page. */
|
||
|
(0,r.__)("Avoid having more than %s links on one page","web-stories"),v)},imageResolutionTooLow:{title:(0,r.__)("Increase image resolution","web-stories"),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,r.__)("Use larger resolution (2x or 3x) images for best appearance on screens with high pixel density","web-stories")),n.createElement("li",null,(0,l.default)(/* translators: %s: minimum image size width x minimum image size height. */
|
||
|
(0,r.__)("For full-screen images, use a resolution of at least %s","web-stories"),"828x1792px")))},videoFrameRateTooLow:{title:(0,l.default)(/* translators: %d: minimum number of frames per second for video. */
|
||
|
(0,r.__)("Increase video frame rate to at least %d fps","web-stories"),24),footer:(0,l.default)(/* translators: %d: minimum number of frames per second for video. */
|
||
|
(0,r._n)("Ensure your video has a minimum of %d frame per second","Ensure your video has a minimum of %d frames per second",24,"web-stories"),24)},videoResolutionTooLow:{title:(0,r.__)("Increase video resolution","web-stories"),footer:(0,l.default)(/* translators: 1: minimum video resolution. 2: minimum video width x minimum video height in pixels. */
|
||
|
(0,r.__)("Consider using a minimum resolution of %1$s (%2$s) to represent portrait videos","web-stories"),"480p",`${w}x${_}px`)},videoTooLong:{title:(0,l.default)(/* translators: %d: maximum video length in minutes. */
|
||
|
(0,r._n)("Split videos into segments of %d minute or less","Split videos into segments of %d minutes or less",y,"web-stories"),y),footer:(0,r.__)("Shorter videos help readers navigate stories","web-stories")},firstPageAnimation:{title:(0,r.__)("First Page Animations","web-stories"),footer:(0,r.__)("Animations on the first page of a story are not supported for user experience and performance reasons.","web-stories"),animationPanel:(0,r.__)("Animations on the first page of a story are not supported for user experience and performance reasons.","web-stories")}},P={storyMissingDescription:{title:(0,r.__)("Add Web Story description","web-stories"),footer:(0,r.__)("Incorporate a brief description for better user experience","web-stories")},storyMissingTitle:{title:(0,r.__)("Add Web Story title","web-stories"),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,l.default)(/* translators: %d: maximum story title length in words. */
|
||
|
(0,r._n)("Keep under %d word","Keep under %d words",10,"web-stories"),10)),n.createElement("li",null,(0,l.default)(/* translators: %d: maximum story title length in characters. */
|
||
|
(0,r._n)("Don't exceed %d character","Don't exceed %d characters",b,"web-stories"),b)))},storyMissingPoster:{title:(0,r.__)("Add poster image","web-stories"),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,r.__)("Use as a representation of the story","web-stories")),n.createElement("li",null,(0,r.__)("Avoid images with embedded text","web-stories")),n.createElement("li",null,(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Use an image that's at least %s","web-stories"),`${M}x${L}px`)),n.createElement("li",null,(0,l.default)(/* translators: %s: aspect ratio. */
|
||
|
(0,r.__)("Maintain a %s aspect ratio","web-stories"),`${u}:${p}`)))},videoMissingPoster:{title:(0,r.__)("Add poster image to every video","web-stories"),footer:(0,r.__)("Ensure a better experience by displaying a poster while users wait for the video to load","web-stories")},storyTitleTooLong:{title:(0,l.default)(/* translators: %d: maximum number of story characters. */
|
||
|
(0,r._n)("Shorten title to fewer than %d character","Shorten title to fewer than %d characters",b,"web-stories"),b),footer:(0,l.default)(/* translators: %d: maximum number of story characters. */
|
||
|
(0,r._n)("Limit story title to %d character or less","Limit story title to %d characters or less",b,"web-stories"),b)},logoTooSmall:{title:(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Increase size of publisher logo to at least %s","web-stories"),`${S}x${S}px`),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Use an image that's at least %s","web-stories"),`${S}x${S}px`)),n.createElement("li",null,(0,l.default)(/* translators: %s: aspect ratio. */
|
||
|
(0,r.__)("Maintain a %s aspect ratio","web-stories"),"1x1px")))},noPublisherLogo:{title:(0,r.__)("Add a publisher logo to your story","web-stories"),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Use an image that's at least %s","web-stories"),`${S}x${S}px`)),n.createElement("li",null,(0,l.default)(/* translators: %s: aspect ratio. */
|
||
|
(0,r.__)("Maintain a %s aspect ratio","web-stories"),"1x1px")))},storyPosterSize:{title:(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Correct poster image aspect ratio to %s","web-stories"),`${M}x${L}px`),footer:n.createElement(n.Fragment,null,n.createElement("li",null,(0,l.default)(/* translators: %s: image dimensions. */
|
||
|
(0,r.__)("Use an image that's at least %s","web-stories"),`${M}x${L}px`)),n.createElement("li",null,(0,l.default)(/* translators: %s: aspect ratio. */
|
||
|
(0,r.__)("Maintain a %s aspect ratio","web-stories"),`${u}:${p}`)))},videoNotOptimized:{title:(0,r.__)("Optimize videos","web-stories"),footer:(0,l.default)(/* translators: %s: video resolution (720p) */
|
||
|
(0,r.__)("Videos larger than %s can cause slower loading and higher bandwidth costs.","web-stories"),"720p")},storyMissingPublisherName:{title:(0,r.__)("Add Site Title","web-stories")},ampValidation:{title:(0,r.__)("Compatibility","web-stories"),footer:n.createElement(o.default,{mapping:{a:n.createElement(i.Link,{href:"https://wp.stories.google/docs/faq/",rel:"noreferrer",target:"_blank",onClick:e=>(0,C.trackClick)(e,"click_checklist_amp_test"),size:s.TextSize.XSmall})}},(0,r.__)("Your story contains errors that can affect eligibility to appear on Google. Please see <a>our FAQ</a> for more information.","web-stories"))}},R={UNAVAILABLE:"unavailable",ONLY_RECOMMENDED:"recommended",ALL:"all"},O={[R.UNAVAILABLE]:[],[R.ONLY_RECOMMENDED]:[x.ACCESSIBILITY,x.DESIGN],[R.ALL]:Object.values(x)},D={[R.UNAVAILABLE]:null,[R.ONLY_RECOMMENDED]:x.DESIGN,[R.ALL]:x.PRIORITY}},2783:(e,t,a)=>{"use strict";a.d(t,{ChecklistCategoryProvider:()=>ChecklistCategoryProvider,ChecklistCountProvider:()=>ChecklistCountProvider,useCategoryCount:()=>c,useHasChecklist:()=>d,useRegisterCheck:()=>s});var n=a(67294),r=(a(67602),a(53476),a(49411),a(41792),a(69845)),l=a(67978);const o=(0,r.createContext)(null),C=(0,r.createContext)(null),i={[l.ISSUE_TYPES.PRIORITY]:{},[l.ISSUE_TYPES.DESIGN]:{},[l.ISSUE_TYPES.ACCESSIBILITY]:{}};function ChecklistCountProvider(e){let{hasChecklist:t,children:a}=e;const l=(0,r.useState)({...i,hasChecklist:t});return n.createElement(o.Provider,{value:l},a)}function ChecklistCategoryProvider(e){let{children:t,category:a}=e;const l=(0,r.useContext)(o)?.[1];if(!l)throw new Error("Cannot use `ChecklistCategoryProvider` outside of `ChecklistCountProvider`");const i=(0,r.useCallback)((e=>l((t=>({...t,[a]:{...t[a],...e}})))),[a,l]);return n.createElement(C.Provider,{value:i},t)}function s(e,t){const a=(0,r.useContext)(C);if(!a)throw new Error("Cannot use `useRegisterCheck` outside of `ChecklistCategoryProvider`");(0,r.useEffect)((()=>a({[e]:t})),[e,a,t])}function c(e){const t=(0,r.useContext)(o)?.[0];if(!t)throw new Error("Cannot use `useCategoryCount` outside of `ChecklistCountProvider`");return Object.values(t[e]||{}).filter((e=>e)).length}function d(){const e=(0,r.useContext)(o)?.[0];if(!e)throw new Error("Cannot use `useHasChecklist` outside of `ChecklistCountProvider`");const{hasChecklist:t}=e;return t}},27123:(e,t,a)=>{"use strict";a.d(t,{ACCESSIBILITY_COPY:()=>c.ACCESSIBILITY_COPY,CHECKLIST_PRIORITY_COPY:()=>c.PRIORITY_COPY,Checklist:()=>Checklist,ChecklistCheckpointProvider:()=>ChecklistCheckpointProvider,ChecklistCountProvider:()=>g.ChecklistCountProvider,ChecklistIcon:()=>xt,ChecklistProvider:()=>C,DESIGN_COPY:()=>c.DESIGN_COPY,ElementLinkTappableRegionTooBig:()=>me,ElementLinkTappableRegionTooSmall:()=>ge,FirstPageAnimation:()=>Ee,ImageElementMissingAlt:()=>ye,ImageElementResolution:()=>we,PPC_CHECKPOINT_STATE:()=>c.PPC_CHECKPOINT_STATE,PageBackgroundTextLowContrast:()=>ze,PageTooLittleText:()=>Ue,PageTooManyLinks:()=>Ge,PageTooMuchText:()=>$e,PublisherLogoMissing:()=>Ye,PublisherLogoSize:()=>qe,StoryAmpValidationErrors:()=>Xe,StoryMissingExcerpt:()=>Ke,StoryMissingTitle:()=>Qe,StoryPagesCount:()=>Je,StoryPosterAttached:()=>StoryPosterAttached,StoryPosterSize:()=>et,StoryTitleLength:()=>tt,TextElementFontSizeTooSmall:()=>nt,VideoElementMissingCaptions:()=>Ct,VideoElementMissingDescription:()=>st,VideoElementMissingPoster:()=>dt,VideoElementResolution:()=>pt,VideoOptimization:()=>It,getPagesWithFailedContrast:()=>Fe,useChecklist:()=>i,useCheckpoint:()=>f,useHasChecklist:()=>g.useHasChecklist,useIsChecklistMounted:()=>J,useRegisterCheck:()=>g.useRegisterCheck});var n=a(67294),r=a(69845),l=a(36382);const o=(0,r.createContext)({state:{},actions:{}}),C=e=>{let{children:t}=e;const[a,C]=(0,r.useState)(!1),[i,s]=(0,r.useState)(!1),[c,d]=(0,r.useState)(),[u,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{d(e)}),[d]),f=(0,r.useCallback)((()=>{(0,l.trackEvent)("checklist_toggled",{status:a?"closed":"open"}),C((e=>!e))}),[a]),g=(0,r.useCallback)((()=>{(0,l.trackEvent)("checklist_toggled",{status:"closed"}),C(!1)}),[]),h=(0,r.useCallback)(
|
||
|
(0,h._n)("%1$d %2$s issue","%1$d %2$s issues",t,"web-stories"),t,d)},d)),n.createElement(V,null,n.createElement(D,{"aria-hidden":!0},t)))),n.createElement(U,{"aria-hidden":!C,maxHeight:s},n.createElement(j,{id:p,"aria-labelledby":`${d}-${p}`,role:"tabpanel"},a)))};var W=a(21608),$=a(192),Y=a(91960);function Toggle(e){let{isOpen:t=!1,popupId:a="",onClick:l=Y.noop}=e;const o=(0,g.useCategoryCount)(c.ISSUE_TYPES.PRIORITY),{checkpoint:C}=f((e=>{let{state:{checkpoint:t}}=e;return{checkpoint:t}})),i=(0,r.useMemo)((()=>C===c.PPC_CHECKPOINT_STATE.ALL?o:0),[C,o]);return n.createElement($.ToggleButton,{"aria-owns":a,onClick:l,isOpen:t,MainIcon:W.default,label:(0,h.__)("Checklist","web-stories"),"aria-label":i>0?(0,w.default)(/* translators: %s: number of unaddressed issues. */
|
||
|
(0,h._n)("Checklist: %s unaddressed issue","Checklist: %s unaddressed issues",i,"web-stories"),i):(0,h.__)("Checklist","web-stories"),notificationCount:i})}var q=a(6992);const X=e=>{if(e)return`100vh - ${_.NAVIGATION_HEIGHT+60*e+_.DISTANCE_FROM_TOP+_.DISTANCE_FROM_BOTTOM}px`},K=(0,b.default)(G).withConfig({displayName:"checklist__StyledTablistPanel",componentId:"sc-1rujego-0"})(["height:",";visibility:",";button{display:",";}"],(e=>{let{badgeCount:t}=e;return 0===t?0:"auto"}),(e=>{let{badgeCount:t}=e;return 0===t?"hidden":"visible"}),(e=>{let{badgeCount:t}=e;return 0===t?"none":"auto"})),Q=(0,b.default)(q.Text.Paragraph).attrs({size:A.TextSize.Small}).withConfig({displayName:"checklist__PanelText",componentId:"sc-1rujego-1"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.secondary}));function J(){return i((e=>{let{state:t}=e;return t.isChecklistMounted}))}function DesignPanel(e){let{badgeCount:t=0,isOpen:a,maxHeight:r,onClick:l,title:o,children:C}=e;return J()?n.createElement(K,{badgeCount:t,isExpanded:Boolean(t)&&a,onClick:l,maxHeight:r,title:o},n.createElement(Q,null,(0,h.__)("Follow best practices for Web Stories.","web-stories")),C):C}function DesignChecks(e){return n.createElement(g.ChecklistCategoryProvider,{category:c.ISSUE_TYPES.DESIGN},n.createElement(DesignPanel,e,e.children))}function AccessibilityPanel(e){let{children:t,badgeCount:a,isOpen:r,onClick:l,maxHeight:o,title:C}=e;return J()?n.createElement(K,{badgeCount:a,isExpanded:Boolean(a)&&r,onClick:l,maxHeight:o,title:C},n.createElement(Q,null,(0,h.__)("Make your Web Story accessible.","web-stories")),t):t}function AccessibilityChecks(e){return n.createElement(g.ChecklistCategoryProvider,{category:c.ISSUE_TYPES.ACCESSIBILITY},n.createElement(AccessibilityPanel,e,e.children))}function PriorityPanel(e){let{children:t,badgeCount:a=0,isOpen:r,onClick:l,maxHeight:o,title:C}=e;return J()?n.createElement(K,{badgeCount:a,isExpanded:Boolean(a)&&r,onClick:l,maxHeight:o,status:S.DANGER,title:C},n.createElement(Q,null,(0,h.__)("Make this Web Story easier to discover.","web-stories")),t):t}function PriorityChecks(e){const t=(0,g.useCategoryCount)(c.ISSUE_TYPES.PRIORITY),{updateHighPriorityCount:a}=f((e=>{let{actions:{updateHighPriorityCount:t}}=e;return{updateHighPriorityCount:t}}));return(0,r.useEffect)((()=>{a(t)}),[a,t]),n.createElement(g.ChecklistCategoryProvider,{category:c.ISSUE_TYPES.PRIORITY},n.createElement(PriorityPanel,e,e.children))}var ee,te;function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ae.apply(this,arguments)}const SvgCheckmarkCircle=e=>{let{title:t,titleId:a,...r}=e;return n.createElement("svg",ae({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 58 58","aria-labelledby":a},r),t?n.createElement("title",{id:a},t):null,ee||(ee=n.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M29 54.146c13.888 0 25.147-11.259 25.147-25.147C54.147 15.11 42.888 3.852 29 3.852c-13.888 0-25.147 11.258-25.147 25.147 0 13.888 11.259 25.147 25.147 25.147z"})),te||(te=n.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M43.198 18.64a1.5 1.5 0 0 1 .037 2.12l-17.93 18.563a1.5 1.5 0 0 1-2.157 0l-7.383-7.643a1.5 1.5 0 1 1 2.158-2.084l6.304 6.526 16.85-17.445a1.5 1.5 0 0 1 2.121-.037z",clipRule:"evenodd"})))},ne=(0,n.memo)(SvgCheckmarkCircle),re=b.default.div.withConfig({displayName:"emptyContent__Wrapper",componentId:"sc-83zuqv-0"})(["display:grid;grid-template-rows:113px 64px;width:308px;margin:0 auto 32px;& > *{display:flex;align-self:center;justify-self:center;color:",";}p{width:226px;text-align:center;}"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),le=b.default.div.withConfig({displayName:"emptyContent__IconContainer",componentId:"sc-83zuqv-1"})(["height:50px;width:50px;"]),EmptyContent=()=>n.createElement(re,null,n.createElement(le,null,n.createElement(ne,null)),n.createElement(q.Text.Paragraph,{size:A.TextSize.Small},(0,h.__)
|
||
|
(0,h._n)("Optimizing %1$d of %2$d","Optimizing %1$d of %2$d",e,"web-stories"),e,d.length)}return M&&e&&n.createElement(de.ChecklistCard,{cta:n.createElement(yt,{type:Z.ButtonType.Secondary,size:Z.ButtonSize.Small,onClick:f,disabled:_},L),title:y,cardType:d.length>1?de.CARD_TYPE.MULTIPLE_ISSUE:de.CARD_TYPE.SINGLE_ISSUE,footer:n.createElement(de.DefaultFooterText,null,b),thumbnails:d.map((e=>n.createElement(ue.Thumbnail,{key:e.resource.id,onClick:E(e),isLoading:C(e.resource.id)||i(e.resource.id),type:ue.THUMBNAIL_TYPES.VIDEO,displayBackground:n.createElement(ue.LayerThumbnail,{page:e}),"aria-label":(0,h.__)("Go to offending video","web-stories"),isError:t[e.resource.id]===wt},n.createElement(bt.default,{title:t[e.resource.id]===Lt||C(e.resource.id)||i(e.resource.id)?(0,h.__)("Video optimization in progress","web-stories"):(0,h.__)("Optimize","web-stories")},n.createElement(ht.StyledVideoOptimizationIcon,null)))))})},It=()=>{const{isTranscodingEnabled:e}=(0,Et.default)();return e?n.createElement(BulkVideoOptimization,null):null};var Tt=a(48068);const xt=e=>{let{checkpoint:t,...a}=e;return t===c.PPC_CHECKPOINT_STATE.ALL?n.createElement(Tt.default,a):null}},22667:(e,t,a)=>{"use strict";a.d(t,{filterStoryElements:()=>n});a(67602),a(53476),a(49411),a(41792);function n(e,t){return(e||[]).flatMap((e=>(e?.elements||[]).map((t=>({...t,pageId:e.id}))))).filter(t)}},31592:(e,t,a)=>{"use strict";function n(e){return""===(e.featuredMedia?.url?.trim()||"")}a.d(t,{ThumbnailPagePreview:()=>ThumbnailPagePreview,characterCountForPage:()=>l,filterStoryElements:()=>C.filterStoryElements,filterStoryPages:()=>o,getSpansFromContent:()=>d,getVisibleThumbnails:()=>s,hasNoFeaturedMedia:()=>n});a(67602),a(30005);var r=a(22749);function l(e){let t=0;return e.elements.forEach((e=>{"text"===e.type&&(t+=(0,r.stripHTML)(e.content).length)})),t}a(53476);function o(e,t){return(e||[]).filter(t)}var C=a(22667),i=a(67978);function s(e){return e.length>i.THUMBNAIL_MAX?e.slice(0,i.THUMBNAIL_COUNT_FOR_OVERFLOW):e}let c;function d(e){return c||(c=document.createElement("div")),c.innerHTML=e,Array.prototype.slice.call(c.getElementsByTagName("span"))}var u=a(67294),p=(a(41854),a(83485)),m=a(90864);const ThumbnailPagePreview=e=>{let{page:t}=e;return u.createElement(p.default,{page:t,width:m.THUMBNAIL_DIMENSIONS.WIDTH,height:m.THUMBNAIL_DIMENSIONS.HEIGHT,as:"div",help:"checklist",isActive:!0,className:"pagePreviewOverrides"})}},88472:(e,t,a)=>{"use strict";a.d(t,{CARD_TYPE:()=>n,GRID_TEMPLATE_AREA:()=>l,GRID_VARIANT:()=>r,MAX_THUMBNAILS_DISPLAYED:()=>o});const n={SINGLE_ISSUE:"single_issue",MULTIPLE_ISSUE:"multiple_issue"},r={SINGLE_WITH_THUMBNAIL:"single_with_thumbnail",SINGLE:"single",DEFAULT:"single",MULTIPLE_WITH_THUMBNAIL:"multiple_with_thumbnail",MULTIPLE_WITH_THUMBNAIL_WITH_CTA:"multiple_with_thumbnail_with_cta",MULTIPLE_WITH_THUMBNAIL_OVERFLOW:" multiple_with_thumbnail_overflow"},l={[r.SINGLE]:"'title title title title' 'cta cta cta thumbnail' 'footer footer footer footer'",[r.SINGLE_WITH_THUMBNAIL]:"'title title title thumbnail' 'cta cta cta thumbnail' 'footer footer footer footer'",[r.MULTIPLE_WITH_THUMBNAIL]:"'title title title title' 'thumbnail thumbnail thumbnail thumbnail' 'footer footer footer footer'",[r.MULTIPLE_WITH_THUMBNAIL_WITH_CTA]:"'title title title title' 'thumbnail thumbnail thumbnail thumbnail' 'cta cta cta cta' 'footer footer footer footer'",[r.MULTIPLE_WITH_THUMBNAIL_WITH_CTA_OVERFLOW]:"'title title title title' 'thumbnail thumbnail thumbnail thumbnail' 'cta cta cta cta' 'footer footer footer footer'",[r.MULTIPLE_WITH_THUMBNAIL_OVERFLOW]:"'title title title title' 'thumbnail thumbnail thumbnail thumbnail' 'footer footer footer footer'"},o=3},88480:(e,t,a)=>{"use strict";a.d(t,{CARD_TYPE:()=>f.CARD_TYPE,ChecklistCard:()=>w,ChecklistCardStyles:()=>n,DefaultCtaButton:()=>DefaultCtaButton,DefaultFooterText:()=>DefaultFooterText});var n=a(42338),r=a(67294),l=a(49527),o=a(72165),C=a(12788),i=a(58228),s=a(5574),c=a(41708),d=a(73829),u=a(69845),p=a(36823),m=a(31592),f=a(88472);function g(){return g=Object.assign?Object.assign.bind():function(e){
|
||
|
(0,d.__)("Press Enter to edit %s","web-stories"),r),styleOverride:o},l)}))},33088:(e,t,a)=>{"use strict";a.d(t,{default:()=>d});var n=a(67294),r=(a(67602),a(30005),a(53476),a(69845)),l=a(36823),o=a(49775),C=a(80125),i=a(28154),s=a(21530);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},c.apply(this,arguments)}const d=(0,r.forwardRef)((function FontPicker(e,t){let{zIndex:a,onChange:d,currentValue:u,highlightStylesOverride:p,showDropdownLabel:m,listStyleOverrides:f,containerStyleOverrides:g,className:h,tabIndex:E}=e;const{fonts:b=[],recentFonts:y=[],curatedFonts:v=[],customFonts:_=[],ensureMenuFontsLoaded:w,ensureCustomFontsLoaded:M,getFontsBySearch:L,loadCustomFonts:S,loadCuratedFonts:I}=(0,i.useFont)((e=>{let{actions:t,state:a}=e;return{getFontsBySearch:t.getFontsBySearch,ensureMenuFontsLoaded:t.ensureMenuFontsLoaded,ensureCustomFontsLoaded:t.ensureCustomFontsLoaded,loadCuratedFonts:t.loadCuratedFonts,loadCustomFonts:t.loadCustomFonts,recentFonts:a.recentFonts,curatedFonts:a.curatedFonts,fonts:a.fonts,customFonts:a.customFonts}}));(0,r.useEffect)((()=>{S(),I()}),[S,I]);const T=(0,r.useMemo)((()=>{const e=new Map;return b.forEach((t=>{e.set(t.id,t)})),_?.forEach((t=>{e.set(t.id,t)})),e}),[b,_]),x=(0,r.useCallback)((e=>{e.length&&(w(e.filter((e=>"fonts.google.com"===T.get(e)?.service))),M(e.filter((e=>"custom"===T.get(e)?.service))))}),[T,M,w]),A=(0,r.useCallback)(((e,t)=>{let{option:a,...r}=e;return n.createElement(o.ListElement,c({ref:t},r,{fontFamily:"fonts.google.com"===a.service?`'${a.name}::MENU'`:a.name}),u===a.id&&n.createElement(o.Selected,{"aria-label":(0,l.__)("Selected","web-stories")}),a.name)}),[u]),k=(0,r.useMemo)((()=>[..._?.length?[{label:(0,l.__)("Your fonts","web-stories"),options:_}]:[],...y?.length?[{label:(0,l.__)("Recently used","web-stories"),options:y}]:[]]),[_,y]);return n.createElement(C.default,{ref:t,zIndex:a,tabIndex:E,highlightStylesOverride:p,"data-testid":"font",title:(0,l.__)("Available font families","web-stories"),dropdownButtonLabel:(0,l.__)("Font family","web-stories"),options:b,primaryOptions:v,primaryLabel:(0,l.__)("Recommended","web-stories"),priorityOptionGroups:k,searchResultsLabel:(0,l.__)("Search results","web-stories"),selectedId:s.MULTIPLE_VALUE===u?"":u,placeholder:s.MULTIPLE_VALUE===u?s.MULTIPLE_DISPLAY_VALUE:u,hasSearch:!0,getOptionsByQuery:L,onChange:d,onObserve:x,renderer:(0,r.forwardRef)(A),disabled:!b?.length,dropDownLabel:m?(0,l.__)("Font","web-stories"):null,listStyleOverrides:f,containerStyleOverrides:g,className:h})}))},83485:(e,t,a)=>{"use strict";a.d(t,{default:()=>y});var n=a(67294),r=(a(41792),a(12788)),l=a(84967),o=a(60531),C=a(82763),i=a(90996),s=a(69845),c=a(52264),d=(a(41854),a(70743)),u=a(42191),p=a(97931),m=a(21530);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},f.apply(this,arguments)}const g=r.default.button.withConfig({displayName:"pagepreview__Page",componentId:"sc-f0c590-0"})(["display:block;position:relative;cursor:",";padding:0;border:0;background-color:transparent;height:","px;width:","px;flex:none;outline:0;&::after{content:'';display:block;position:absolute;left:-4px;right:-4px;top:-4px;bottom:-4px;pointer-events:none;border-style:solid;border-width:1px;border-radius:8px;border-color:",";}",""],(e=>{let{isInteractive:t}=e;return t?"pointer":"default"}),(e=>{let{height:t}=e;return t}),(e=>{let{width:t}=e;return t}),(e=>{let{isActive:t,isInteractive:a,theme:n}=e;return a&&t?n.colors.border.defaultActive:"transparent"}),(e=>{let{isInteractive:t,isActive:a,theme:n}=e;return t&&(0,r.css)(["&:focus::after{border-color:",";}"],(0,l.rgba)(n.colors.border.selection,a?1:.7))})),h=r.default.div.withConfig({displayName:"pagepreview__PageOffset",componentId:"sc-f0c590-1"})(["position:relative;top:","px;"],(e=>{let{$top:t}=e;return t})),E=r.default.div.
|
||
|
(0,i.__)("Gradient stop at %d%%","web-stories"),Math.round(100-100*a))},n.createElement(at,{isSelected:l},n.createElement(He,null)),n.createElement(tt,{offset:-1},n.createElement(et,null),n.createElement(Je,{color:o})))}));nt.propTypes={position:C().number.isRequired,index:C().number.isRequired,isSelected:C().bool.isRequired,color:C().object.isRequired,onSelect:C().func.isRequired};const rt=nt;const lt=function(e,t){(0,x.useKeyDownEffect)(e,"left",(()=>t(.01)),[t]),(0,x.useKeyDownEffect)(e,"right",(()=>t(-.01)),[t])};const ot=function(e,t,a,n){(0,x.useKeyDownEffect)(e,"enter",(()=>{return t((e=function(e,t){const a=t===e.length-1;if(a&&e[t].position<1)return 1;if(0===t&&e[0].position>0)return 0;const n=a?e[t-1]:e[t],r=a?e[t]:e[t+1];return n.position+(r.position-n.position)/2}(a,n),r=4,Number(e.toFixed(r))));var e,r}),[t,a,n])};const Ct=function(e,t){(0,x.useKeyDownEffect)(e,"delete",(()=>{e.current.focus(),t()}),[t,e])};const it=function(e,t,a){const n=t.length,l=(0,r.useMemo)((()=>Array.from({length:n}).map(r.createRef)),[n]);return(0,r.useLayoutEffect)((()=>{e.current.contains(document.activeElement)&&l[a].current.focus()}),[a,l,n,e]),l};function st(e){return e.pageX||e.clientX}const ct=function(e,t){const[a,n]=(0,r.useState)(null);return(0,r.useLayoutEffect)((()=>{const a=e.current,r=a.getBoundingClientRect().left,l=e=>{if(e.target!==a)return;const l=(st(e)-r+7)/Ue;t(1.0625-l),n(null)},o=e=>{e.target===a?n(st(e)-r):n(null)},C=e=>{e.target===a&&n(null)};return a.addEventListener("pointermove",o),a.addEventListener("pointerleave",C),a.addEventListener("pointerdown",l),()=>{a.removeEventListener("pointermove",o),a.removeEventListener("pointerleave",C),a.removeEventListener("pointerdown",l)}}),[e,t]),a};const dt=function(e,t){const a=(0,r.useRef)(null);(0,r.useLayoutEffect)((()=>{const n=e.current,r=e=>{const n=st(e)-a.current;a.current=st(e),t(-n/Ue)},l=e=>{a.current=null,function(e){e.target.releasePointerCapture&&e.target.releasePointerCapture(e.pointerId)}(e),e.target.removeEventListener("pointermove",r),e.target.removeEventListener("pointerup",l)},o=e=>{e.target!==n&&(a.current=st(e),function(e){e.target.setPointerCapture&&e.target.setPointerCapture(e.pointerId)}(e),e.target.addEventListener("pointermove",r),e.target.addEventListener("pointerup",l))};return n.addEventListener("pointerdown",o),()=>n.removeEventListener("pointerdown",o)}),[e,t])},ut=l.default.div.withConfig({displayName:"gradientLine__Line",componentId:"sc-1k22wp0-0"})([""," width:","px;height:","px;border-radius:2px;position:relative;&:focus{outline:none;}"],B,Ue,je),pt=l.default.div.attrs((e=>{let{stops:t}=e;return{style:(0,N.default)({type:"linear",stops:t,rotation:.25})}})).withConfig({displayName:"gradientLine__Background",componentId:"sc-1k22wp0-1"})(["position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;"]),mt=(0,l.default)(fe).attrs((e=>{let{x:t}=e;return{style:{left:`${t}px`},offsetX:-6}})).withConfig({displayName:"gradientLine__TempPointer",componentId:"sc-1k22wp0-2"})(["height:","px;width:","px;opacity:0.6;top:1px;pointer-events:none;"],10,10);const ft=function GradientLine(e){let{stops:t,currentStopIndex:a,onSelect:l,onAdd:o,onDelete:C,onMove:c}=e;const d=(0,r.useRef)();lt(d,c),ot(d,o,t,a),Ct(d,C);const u=it(d,t,a);dt(d,c);const p=ct(d,o);return n.createElement(ut,{ref:d,"aria-label":(0,i.__)("Gradient line","web-stories"),tabIndex:"-1"},n.createElement(pt,{stops:t}),t.map(((e,t)=>{let{position:r,color:o}=e;return n.createElement(rt,{ref:e=>u[t].current=e,key:t,index:t,isSelected:t===a,position:r,onSelect:l,color:{color:o}},n.createElement(fe,{offsetX:-6}))})),p&&n.createElement(mt,{"aria-label":(0,s.default)(/* translators: %d: stop percentage */
|
||
|
(0,i.__)("Temporary gradient stop at %d%%","web-stories"),Math.round(p/Ue*100)),x:p}))},gt=l.default.div.withConfig({displayName:"gradientPicker__Wrapper",componentId:"sc-a6h8ls-0"})(["display:flex;justify-content:space-between;align-items:center;padding:16px 16px 0;height:60px;"]),ht=l.default.div.withConfig({displayName:"gradientPicker__Buttons",componentId:"sc-a6h8ls-1"})(["display:flex;gap:8px;"]),Et=(0,l.default)(p.Button).withConfig({displayName:"gradientPicker__SmallButton",componentId:"sc-a6h8ls-2"})(["width:24px;height:24px;padding:0;svg{width:24px;height:24px;}"]);const bt=function GradientPicker(e){let{stops:t,currentStopIndex:a,type:r,onSelect:l,onAdd:o,onDelete:C,onMove:s,onRotate:c,onReverse:d}=e;const u=(0,i.__)("Reverse gradient stops","web-stories"),p=(0,i.__)("Rotate gradient","web-stories"),f="radial"!==r;return n.createElement(gt,null,n.createElement(ft,{stops:t,currentStopIndex:a,onSelect:l,onAdd:o,onDelete:C,onMove:s}),n.createElement(ht,null,n.createElement(w.default,{hasTail:!0,title:u},n.createElement(Et,{"aria-label":u,onClick:d,type:m.ButtonType.Quaternary,size:m.ButtonSize.Small,variant:m.ButtonVariant.Square},n.createElement(Oe,null))),f&&n.createElement(w.default,{hasTail:!0,title:p},n.createElement(Et,{onClick:c,"aria-label":p,type:m.ButtonType.Quaternary,size:m.ButtonSize.Small,variant:m.ButtonVariant.Square},n.createElement(Be,{id:"gradient-rotator"})))))};var yt=a(25252),vt=a(18969);function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_t.apply(this,arguments)}const wt=l.default.div.withConfig({displayName:"header__Wrapper",componentId:"sc-3jvjbz-0"})(["display:flex;justify-content:space-between;align-items:center;height:","px;padding:4px 8px 4px 8px;position:relative;border-bottom:1px solid ",";"],44,(e=>{let{theme:t}=e;return t.colors.divider.tertiary})),Mt=l.default.div.withConfig({displayName:"header__Actions",componentId:"sc-3jvjbz-1"})(["display:flex;margin-left:auto;"]),Lt=(0,l.default)(p.Button).withConfig({displayName:"header__StyledButton",componentId:"sc-3jvjbz-2"})(["margin-left:8px;",";"],M.focusStyle);const St=function Header(e){let{children:t,handleClose:a,isEditMode:l=!1,setIsEditMode:o=oe.noop,hasPresets:C=!1}=e;const s=(0,r.useRef)();(0,r.useEffect)((()=>{s.current?.focus()}),[]);const c={type:m.ButtonType.Tertiary,size:m.ButtonSize.Small,variant:m.ButtonVariant.Square,onClick:e=>{e.stopPropagation(),o(!l)},isEditMode:l};return n.createElement(wt,null,t,n.createElement(Mt,null,C?l?n.createElement(Lt,_t({},c,{variant:m.ButtonVariant.Rectangle,"aria-label":(0,i.__)("Exit edit mode","web-stories")}),(0,i.__)("Done","web-stories")):n.createElement(Lt,_t({},c,{variant:m.ButtonVariant.Square,"aria-label":(0,i.__)("Edit colors","web-stories")}),n.createElement(yt.default,null)):null,n.createElement(Lt,{"aria-label":(0,i.__)("Close","web-stories"),onClick:a,type:m.ButtonType.Tertiary,size:m.ButtonSize.Small,variant:m.ButtonVariant.Square,ref:s},n.createElement(vt.default,null))))};var It,Tt=a(53279);function xt(){return xt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},xt.apply(this,arguments)}const SvgPatternSolid=e=>{let{title:t,titleId:a,...r}=e;return n.createElement("svg",xt({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},r),t?n.createElement("title",{id:a},t):null,It||(It=n.createElement("circle",{cx:16,cy:16,r:11.5,fill:"currentColor",stroke:"currentColor"})))},At=(0,n.memo)(SvgPatternSolid);var kt,Zt,Pt;function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Rt.apply(this,arguments)}const SvgPatternLinear=e=>{let{title:t,titleId:a,...r}=e;return n.createElement("svg",Rt({xmlns:"http://www.w3.org/2000
|
||
|
(0,i.__)("Delete %1$s color: %2$s","web-stories"),b,m):m,y=f===m;let v=t===E?0:-1;return h>=0?v=y?0:-1:d&&t===E&&(E++,v=-1),n.createElement(ConditionalTooltip,{key:m,tooltip:p},n.createElement(da,{onClick:()=>l(e,c),pattern:e,isSelected:y,isDisabled:d,tabIndex:v,title:g},u&&n.createElement(vt.default,null)))})),(c||d)&&n.createElement(Ca,{isLocal:c,isGlobal:d,isBackground:y})),!a.length&&(c||d)&&n.createElement(Ca,{isLocal:c,isGlobal:d,isBackground:y}))};var ma=a(83308),fa=a(30540);const ga=l.default.label.withConfig({displayName:"confirmationDialog__Label",componentId:"sc-bvt4vo-0"})(["margin-left:12px;"]),ha=l.default.footer.withConfig({displayName:"confirmationDialog__CheckboxWrapper",componentId:"sc-bvt4vo-1"})(["display:flex;margin-top:12px;padding:14px 0 0 9px;border-top:1px solid ",";"],(e=>{let{theme:t}=e;return t.colors.divider.primary}));const Ea=function ConfirmationDialog(e){let{onClose:t,onPrimary:a}=e;const[l,o]=(0,r.useState)(ta.localStore.getItemByKey(ta.LOCAL_STORAGE_PREFIX[Ye])),C=`cb-${(0,E.default)()}`;return n.createElement(fa.default,{isOpen:!0,onClose:t,secondaryText:(0,i.__)("Cancel","web-stories"),onPrimary:a,primaryText:(0,i.__)("Delete","web-stories")},n.createElement(X.Text.Paragraph,{size:K.TextSize.Small},(0,i.__)("This is a global color. Deleting this color will remove it from the Saved Colors across all stories and the color will no longer be available to any other users on the site.","web-stories")),n.createElement(ha,null,n.createElement(ma.default,{id:C,checked:l,onChange:()=>{ta.localStore.setItemByKey(ta.LOCAL_STORAGE_PREFIX[Ye],!l),o(!l)}}),n.createElement(ga,{htmlFor:C},n.createElement(X.Text.Span,{size:K.TextSize.Small},(0,i.__)("Don't ask for confirmation again.","web-stories")))))};var ba=a(84184);const ya=l.default.div.withConfig({displayName:"basicColorPicker__Body",componentId:"sc-c2cm2c-0"})(["display:flex;flex-direction:column;padding:8px 16px 0;overflow:auto;",";"],Jt.scrollbarCSS),va=l.default.div.withConfig({displayName:"basicColorPicker__Footer",componentId:"sc-c2cm2c-1"})(["padding:8px 16px 16px;display:flex;flex-direction:column;"]),_a=l.default.div.withConfig({displayName:"basicColorPicker__SavedColors",componentId:"sc-c2cm2c-2"})(["border-bottom:1px solid ",";padding-bottom:16px;"],(e=>{let{theme:t}=e;return t.colors.border.defaultNormal})),wa=l.default.div.withConfig({displayName:"basicColorPicker__DefaultColors",componentId:"sc-c2cm2c-3"})([""]),Ma=(0,l.default)(X.Text.Paragraph).attrs({size:K.TextSize.Small}).withConfig({displayName:"basicColorPicker__Label",componentId:"sc-c2cm2c-4"})(["color:",";margin:12px 0 10px;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),La=(0,l.default)(Ma).withConfig({displayName:"basicColorPicker__DefaultText",componentId:"sc-c2cm2c-5"})(["margin:0 0 0 8px;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.primary})),Sa=(0,l.default)(p.Button).withConfig({displayName:"basicColorPicker__StyledButton",componentId:"sc-c2cm2c-6"})(["display:flex;justify-content:center;align-items:center;gap:4px;flex-basis:100%;"]),Ia=(0,l.default)(X.Text.Paragraph).withConfig({displayName:"basicColorPicker__StyledText",componentId:"sc-c2cm2c-7"})(["padding:5px 10px;"]),Ta=(0,l.default)(ea.default).withConfig({displayName:"basicColorPicker__StyledPlus",componentId:"sc-c2cm2c-8"})(["width:32px;margin:-8px 0;"]),xa=l.default.div.withConfig({displayName:"basicColorPicker__EyedropperWrapper",componentId:"sc-c2cm2c-9"})(["display:flex;"]);const Aa=function BasicColorPicker(e){let{color:t,handleColorChange:a,allowsOpacity:l,allowsGradient:o,allowsSavedColors:C,showCustomPicker:s,handleClose:c,showDialog:d,setShowDialog:u,changedStyle:f,hasEyedropper:g,allowsSavedColorDeletion:E,shouldCloseOnSelection:b}=e;const{savedColors:y,storyColors:v}=(0,le.default)((e=>({savedColors:e.state.story?.globalStoryStyles?.colors||[],storyColors:e.state.story?.currentStoryStyles?.colors||[]}))),[w,M]=(0,r.useState)(!1),[L,S]=(0,r.useState)(null),I=v.length>0||y.length>0,{initEyedropper:T}=_({onChange:(0,r.useCallback)((e=>a({color:e})),[a])}),{deleteLocalColor:x,deleteGlo
|
||
|
(0,i.__)("%1$s: %2$s","web-stories"),p,u),D=c!==b.MULTIPLE_VALUE&&Boolean(d(c))&&x,{initEyedropper:N}=_({onChange:(0,r.useCallback)((e=>a({color:e})),[a])}),B=(0,i.__)("Pick a color from canvas","web-stories"),F=T||g?f.Placement.Bottom:f.Placement.BottomStart,z=A&&c===b.MULTIPLE_VALUE;return n.createElement(rn,{"aria-label":O,isInDesignMenu:T,width:!z&&A?A:null},g&&n.createElement(w.default,{title:B,hasTail:!0,placement:T?f.Placement.Bottom:f.Placement.BottomStart},n.createElement(sn,{id:(0,E.default)(),tabIndex:k,"aria-label":B,onClick:N(),onPointerEnter:N(!1)},n.createElement(h,null))),n.createElement(ln,{isInDesignMenu:T},n.createElement(Cn,{hasInputs:x},n.createElement(Wa,{ref:t,tabIndex:k,onChange:a,value:c,label:u,changedStyle:m,pickerPlacement:I,hasInputs:x,isInDesignMenu:T,spacing:T?an.FLOATING_MENU:an.DEFAULT_SIDEBAR,tooltipPlacement:F,colorFocusTrap:P,pickerProps:{allowsGradient:l,allowsOpacity:o,allowsSavedColors:C,hasEyedropper:y,allowsSavedColorDeletion:S,maxHeight:v,shouldCloseOnSelection:M}})),o&&D&&n.createElement(n.Fragment,null,n.createElement(on,null),n.createElement(tn,{handleOpacityChange:R,isInDesignMenu:T,opacityFocusTrap:Z,tabIndex:k,value:c}))))})),un=dn},81303:(e,t,a)=>{"use strict";a.d(t,{default:()=>l});var n=a(69845),r=a(91960);const l=(0,n.createContext)({isMultiple:!1,registerPresubmitHandler:r.noop})},46305:(e,t,a)=>{"use strict";a.d(t,{Color:()=>n.default,DateTime:()=>nt,FilterToggle:()=>E,HierarchicalInput:()=>Gt,LinkIcon:()=>ce,LinkInput:()=>ge,Media:()=>Ce,MediaUploadButton:()=>ye,Required:()=>ot,Row:()=>pe,Select:()=>Lt,Switch:()=>Le,TextArea:()=>xe,makeFlatOptionTree:()=>Dt,usePresubmitHandler:()=>Ae.default});var n=a(5420),r=a(67294),l=(a(67602),a(53476),a(12788)),o=a(60531),C=a(5574),i=a(6992),s=a(72165),c=a(79099);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d.apply(this,arguments)}const u=(0,l.css)(["width:100%;height:100%;position:absolute;top:0;left:0;border-radius:",";"],(e=>{let{theme:t}=e;return t.borders.radius.small})),p=l.default.div.withConfig({displayName:"filterToggle__Overlay",componentId:"sc-1xtaed1-0"})(["",";"],u),m=l.default.div.withConfig({displayName:"filterToggle__Filter",componentId:"sc-1xtaed1-1"})(["",";",";"],u,(e=>{let{filter:t}=e;return(0,o.default)(t)})),f=l.default.button.withConfig({displayName:"filterToggle__Button",componentId:"sc-1xtaed1-2"})((e=>{let{theme:t}=e;return(0,l.css)(["border-radius:",";width:100%;height:48px;position:relative;display:flex;align-items:center;justify-content:space-around;box-sizing:border-box;padding:0;margin:0;background:transparent;border:none;cursor:pointer;",";img{width:100%;height:100%;border-radius:",";}","{",";}&:active > ","{box-shadow:0px 0px 0 2px ",",0px 0px 0 3px ",";}&:disabled{pointer-events:none;","{background-color:",";}}transition:background-color ",",color ",";"],t.borders.radius.small,c.focusStyle,t.borders.radius.small,p,(e=>{let{isToggled:a}=e;return a&&`\n box-shadow:\n 0px 0px 0 2px ${t.colors.bg.secondary},\n 0px 0px 0 3px ${t.colors.fg.primary}`}),p,t.colors.bg.secondary,t.colors.fg.primary,p,t.colors.opacity.black64,C.BUTTON_TRANSITION_TIMING,C.BUTTON_TRANSITION_TIMING)})),g=l.default.div.withConfig({displayName:"filterToggle__Wrapper",componentId:"sc-1xtaed1-3"})(["width:60px;"]),h=(0,l.default)(i.Text.Span).attrs({size:s.TextSize.Small}).withConfig({displayName:"filterToggle__StyledText",componentId:"sc-1xtaed1-4"})(["color:",";margin-top:8px;text-align:center;width:100%;display:block;"],(e=>{let{theme:t}=e;return t.colors.border.defaultActive}));const E=function FilterToggle(e){let{isToggled:t,filter:a=null,children:n,label:l,...o}=e;return r.createElement(g,null,r.createElement(f,d({},o,{isToggled:t,"aria-pressed":t}),n,r.createElement(m,{filter:a}),r.createElement(p,null)),l&&r.createElement(h,null,l))};a(41792);var b,y,v=a(69845),_=a(47434),w=a(36823),M=a(83057),L=a(30385),S=a(97890),I=a(28154),T=a(67745),x=a(
|
||
|
(0,w.__)("Please choose only %s as an icon.","web-stories"),(0,L.default)(i))),e}),[i]),c=[C&&"upload","hotlink",a&&"remove"].filter(Boolean);return r.createElement(se,ie({value:a||"",cropParams:{width:96,height:96},onChange:t,onChangeErrorText:s,title:(0,w.__)("Select as link icon","web-stories"),ariaLabel:(0,w.__)("Edit link icon","web-stories"),buttonInsertText:(0,w.__)("Select as link icon","web-stories"),hotlinkTitle:(0,w.__)("Use external image as link icon","web-stories"),hotlinkInsertText:(0,w.__)("Use image as link icon","web-stories"),hotlinkInsertingText:(0,w.__)("Using image as link icon","web-stories"),type:o,isLoading:n,variant:S.MediaVariant.Circle,canUpload:0!==c.length,menuOptions:c},l))};var de=a(99270),ue=a(98309);const pe=l.default.div.withConfig({displayName:"row__Row",componentId:"sc-1olml0k-0"})(["display:flex;flex-direction:row;justify-content:flex-start;align-items:center;margin-bottom:16px;"," ",""],(e=>{let{spaceBetween:t=!0}=e;return t&&"justify-content: space-between;"}),(e=>{let{expand:t=!0}=e;return t&&"flex: 1;"}));function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},me.apply(this,arguments)}const fe={MIN:2,MAX:2048},ge=(0,v.forwardRef)((function LinkInput(e,t){let{onChange:a,onBlur:n,onFocus:l,value:o="",hint:C,hasError:i,...s}=e;const d=(o||"").trim(),u=(0,ue.isValidUrl)((0,ue.withProtocol)(d)),p=d.length>0&&!u;return r.createElement(pe,null,r.createElement(de.default,me({ref:t,placeholder:(0,w.__)("Web address","web-stories"),onChange:e=>a(e.target.value),onBlur:()=>{if(d?.length){const e=(0,ue.withProtocol)(d);e!==d&&a(e)}n&&n()},onFocus:l,value:o||"",minLength:fe.MIN,maxLength:fe.MAX,hasError:p||i,hint:p?(0,w.__)("Invalid web address.","web-stories"):C,containerStyleOverride:c.inputContainerStyleOverride,type:"url"},s)))}));var he=a(71028),Ee=a(67485),be=a(74515);const ye=function MediaUploadButton(e){let{onInsert:t,renderButton:a,buttonInsertText:n}=e;const{allowedMimeTypes:{image:l,vector:o,video:C},MediaUpload:i}=(0,I.useConfig)(),s=(0,v.useMemo)((()=>[...l,...o,...C]),[l,o,C]),c=(0,v.useMemo)((()=>s.map((e=>(0,_.getExtensionsFromMimeType)(e))).flat()),[s]),{canTranscodeResource:d,resetWithFetch:u,postProcessingResource:p,optimizeVideo:m,optimizeGif:f}=(0,I.useLocalMedia)((e=>{let{state:{canTranscodeResource:t},actions:{resetWithFetch:a,postProcessingResource:n,optimizeVideo:r,optimizeGif:l}}=e;return{canTranscodeResource:t,resetWithFetch:a,postProcessingResource:n,optimizeVideo:r,optimizeGif:l}})),{isTranscodingEnabled:g}=(0,Ee.default)(),{showSnackbar:h}=(0,he.useSnackbar)(),E=(0,v.useMemo)((()=>g?[...be.TRANSCODABLE_MIME_TYPES,...l,...o,...C]:[...l,...o,...C]),[l,o,C,g]);let b=(0,w.__)("No file types are currently supported.","web-stories");c.length&&(b=(0,M.default)(/* translators: %s: list of allowed file types. */
|
||
|
(0,w.__)("Please choose only %s to insert into page.","web-stories"),(0,L.default)(c)));const y=(0,v.useCallback)((e=>{try{g&&d(e)&&(!e.isOptimized&&be.TRANSCODABLE_MIME_TYPES.includes(e.mimeType)&&m({resource:e}),"image/gif"===e.mimeType&&f({resource:e})),t(e),p(e)}catch(e){h({message:e.message,dismissible:!0})}}),[g,d,t,f,m,p,h]);return r.createElement(i,{onSelect:y,onSelectErrorMessage:b,onClose:u,type:E,render:a,buttonInsertText:n})};var ve=a(33773),_e=a(58979);function we(){return we=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},we.apply(this,arguments)}const Me=(0,l.default)(ve.default).withConfig({displayName:"switch__StyledSwitch",componentId:"sc-xytur2-0"})(["label:focus-within ~ span{",";}"],(e=>{let{theme:t}=e;return`box-shadow: 0px 0px 0 2px ${t.colors.bg.secondary}, 0px 0px 0 4px ${t.colors.border.focus} !important;`}));const Le=function Switch(e){let{offLabel:t=(0,w.__)("Off","web-stories"),onChange:a,onLabel:n=(0,w.__)("On","web-stories"),value:l,...o}=e;const C=(0,v.useRef)(null),i=(0,v.useCallback)((e=>{a(e,!l)}),[a,l]);return(0,_e.useKeyDownEffect)(C,["space","enter","left","right","up","down"],i,[i,l]),r.createElement(Me,we({ref:C,offLabel:t,onChange:a,onLabel:n,value:l},o))};var Se=a(13070);function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ie.apply(this,arguments)}const Te=(0,v.forwardRef)(((e,t)=>{let{className:a,placeholder:n,value:l,disabled:o,rows:C=2,onChange:i,onBlur:s,...d}=e;const[u,p]=(0,v.useState)(l),m=(0,v.useCallback)((e=>{u!==l&&i(e)}),[u,i,l]);(0,v.useEffect)((()=>{p(l)}),[l]);const f=(0,v.useCallback)((e=>{m(e),s&&s(e)}),[s,m]);return r.createElement(Se.default,Ie({placeholder:n,value:u},d,{rows:C,containerStyleOverride:c.inputContainerStyleOverride,onChange:e=>p(e.target.value),onBlur:f,ref:t}))}));Te.displayName="TextArea";const xe=Te;var Ae=a(20371),ke=a(28721),Ze=a(8092),Pe=a(31119),Re=a(36313),Oe=a(37257),De=a(69486);const Ne=l.default.div.withConfig({displayName:"timeZone__Wrapper",componentId:"sc-1n80l1r-0"})(["white-space:nowrap;"]),Be=(0,l.default)(i.Text.Span).withConfig({displayName:"timeZone__StyledText",componentId:"sc-1n80l1r-1"})(["color:",";line-height:30px;"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary}));const Fe=function TimeZone(){const{timezone:e,gmtOffset:t,timezoneAbbr:a}=(0,Re.getSettings)(),n=(new Date).getTimezoneOffset()/60*-1;if(Number(t)===n)return null;const l=Number(t)>=0?"+":"",o=""!==a&&Number.isNaN(Number(a))?a:`UTC${l}${t}`,C="UTC"===e?(0,w.__)("Coordinated Universal Time","web-stories"):`(${o}) ${e.replace("_"," ")}`;return r.createElement(Ne,null,r.createElement(Oe.default,{hasTail:!0,title:C,placement:R.Placement.Top,popupZIndexOverride:De.Z_INDEX_TIME_PICKER_TOOLTIP},r.createElement(Be,{size:s.TextSize.XSmall},o)))},ze=l.default.div.withConfig({displayName:"timePicker__TimeWrapper",componentId:"sc-14og2kb-0"})(["margin-bottom:1em;padding:0 20px;"]),He=l.default.fieldset.withConfig({displayName:"timePicker__Fieldset",componentId:"sc-14og2kb-1"})(["margin-top:0.5em;position:relative;"]),Ve=l.default.legend.withConfig({displayName:"timePicker__Legend",componentId:"sc-14og2kb-2"})(["position:absolute;top:-999em;left:-999em;"]),Ue=l.default.div.withConfig({displayName:"timePicker__InputRow",componentId:"sc-14og2kb-3"})(["display:flex;"]),je=(0,l.default)(Pe.default).withConfig({displayName:"timePicker__NumberInput",componentId:"sc-14og2kb-4"})(["background-color:",";color:",";margin-right:4px;width:50%;max-width:50px;div{height:32px;}input{text-align:center;}"],(e=>{let{theme:t}=e;return t.colors.bg.tertiary}),(e=>{let{theme:t}=e;return t.colors.fg.tertiary})),Ge=l.default.span.withConfig({displayName:"timePicker__TimeSeparator",componentId:"sc-14og2kb-5"})(["padding:0 3px 0 0;color:#555d66;"]),We=l.default.div.withConfig({displayName:"timePicker__InputGroup",c
|
||
|
(0,w._n)("%d result found.","%d results found.",e,"web-stories"),e);u(t)}}),[u,C,a,L]),(0,_e.useKeyDownEffect)(p,{key:["up","down","shift+up","shift+down"]},b,[b]),(0,v.useEffect)((()=>{p.current?.contains(document.activeElement)&&h.current[f]?.focus()}),[f]);const S=Boolean(C.length)||Boolean(a.length);return r.createElement(Bt,{className:t},r.createElement(de.default,Nt({ref:m,value:a,onChange:y,label:l,type:"search",placeholder:(0,w.__)("Search","web-stories")},c)),S&&r.createElement(zt,null,r.createElement(At.default,null,r.createElement(Ht,{id:"checkbox_list",ref:p,tabIndex:0,onFocus:E,role:"tree","aria-activedescendant":-1!==f?jt(f):void 0,"aria-multiselectable":!0},C.length?C.map((e=>r.createElement(Option,Nt({key:e.id},e,{onChange:_,optionRefs:h})))):r.createElement(Ut,{role:"treeitem",size:s.TextSize.Small},o)))))}},10063:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(58979);const __WEBPACK_DEFAULT_EXPORT__=function(e){const t=(0,n.useCallback)((t=>{const a=e.current;if(!a)return;const n=Array.from(a.querySelectorAll('input[type="radio"]')),r=n.indexOf(document.activeElement);if(-1===r)return;const l=r+t;l<0||l>=n.length||(n[l].focus(),n[l].click())}),[e]),a=(0,n.useCallback)((()=>t(-1)),[t]);(0,r.useKeyDownEffect)(e,["up","left"],a,[a]);const l=(0,n.useCallback)((()=>t(1)),[t]);(0,r.useKeyDownEffect)(e,["down","right"],l,[l])}},43119:(e,t,a)=>{"use strict";a.d(t,{StackableGroup:()=>d,StackableInput:()=>s});var n=a(67294),r=a(12788),l=a(41708),o=a(31119);const C=(0,r.css)(["position:relative;:focus-within{z-index:1;",";}"],(e=>{let{theme:t}=e;return l.focusCSS(t.colors.border.focus,t.colors.bg.secondary)})),i=(0,r.css)(["width:29px;height:29px;"]),s=(0,r.default)(o.default).withConfig({displayName:"stackableInput__StackableInput",componentId:"sc-bgp531-0"})(["svg{","}& > div{border-radius:0;margin-left:-1px;padding:2px 7px 2px 12px;",";}"],i,C),c=r.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"}),s,(e=>{let{$stackableGroupStyleOverride:t}=e;return t}));const d=function StackableGroup(e){let{children:t,locked:a,className:r,stackableGroupStyleOverride:l}=e;return n.createElement(c,{$stackableGroupStyleOverride:l,locked:a,className:r},t)}},20371:(e,t,a)=>{"use strict";a.d(t,{default:()=>o});var n=a(69845),r=a(81303);const l=function(e){return(0,n.useContextSelector)(r.default,e??n.identity)};const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const a=l((e=>e.registerPresubmitHandler));(0,n.useEffect)((()=>a(e)),[a].concat(t||[]))}},66163:(e,t,a)=>{"use strict";a.d(t,{default:()=>_});var n=a(67294),r=a(36823),l=a(99270),o=a(12788),C=a(69845),i=a(30540),s=a(98309),c=a(94245),d=a(6025),u=a(91591),p=(a(98858),a(61318),a(33228),a(83057)),m=a(30385),f=a(13013),g=a(36382),h=a(18275),E=a(72165);function b(e){try{return"/"!==new URL(e).pathname}catch{return!1}}function CORSMessage(){return n.createElement(f.default,{mapping:{a:n.createElement(h.Link,{size:E.TextSize.Medium,href:"https://wp.stories.google/docs/troubleshooting/common-issues/",target:"_blank",rel:"noopener noreferrer",onClick:e=>(0,g.trackClick)(e,"click_cors_check_docs")})}},(0,r.__)("Unable to load media. Make sure CORS is set up correctly for the file. <a>Learn more</a>.","web-stories"))}const y=function(e){let{onSelect:t,onClose:a,onError:l,allowedFileTypes:o,canUseProxy:i,requiredImgDimensions:f}=e;const[g,h]=(0,C.useState)(!1),[E,y]=(0,C.useState)(""),[v,_]=(0,C.useState)(null),{actions:{getHotlinkInfo:w}}=(0,u.default)(),{checkResourceAccess:M,getProxiedUrl:L}=(0,d.default)(),S=v||!E||g,I=function(e){let t=(0,r.__)("No file types are currently supported.","web-stories");return e.length&&(t=(0,p.default)(/* translators: %s is a list of allowed file
|
||
|
(0,r.__)("You can insert %s.","web-stories"),(0,m.default)(e))),t}(o),T=(0,C.useCallback)((()=>{if(E?.length>0){const e=(0,s.withProtocol)(E.trim());y(e),b(e)||_((0,r.__)("Invalid link.","web-stories"))}}),[E,_,y]),x=(0,C.useCallback)((e=>{let{target:{value:t}}=e;v&&_(null),y(t)}),[v,y,_]),A=(0,C.useCallback)((()=>{a(),y(""),_(null),h(!1)}),[a]),k=(0,C.useCallback)((async()=>{if(E)if(b(E)){h(!0);try{const l=await w(E);if(!o.includes(l?.ext))return void _((0,r.__)("Invalid link.","web-stories"));const d=await M(E);if(d&&!i)return void _(n.createElement(CORSMessage,null));if("image"===l?.type&&f){const t=d?L({needsProxy:d},E):E,n=await(0,c.default)(t),o=(e=n.width,a=n.height,C=f?.width,s=f?.height,s&&s!==a&&C&&C!==e?(0,p.default)(/* translators: 1: image dimensions. 2: required dimensions. */
|
||
|
(0,r.__)("Image dimensions (%1$s) do not match required image dimensions (%2$s).","web-stories"),`${e}x${a}px`,`${C}x${s}px`):s&&s!==a?(0,p.default)(/* translators: 1: supplied height. 2: required height. */
|
||
|
(0,r.__)("Image height (%1$s) does not match required image height (%2$s).","web-stories"),`${a}px`,`${s}px`):C&&C!==e?(0,p.default)(/* translators: 1: supplied width. 2: required width. */
|
||
|
(0,r.__)("Image width (%1$s) does not match required image width (%2$s).","web-stories"),`${e}px`,`${C}px`):null);if(o)return void _(o);l.width=n.width,l.height=n.height}await t({link:E,hotlinkInfo:l,needsProxy:d}),y(""),_(null)}catch(e){l&&l(e),_(function(e,t){switch(e){case"rest_invalid_param":case"rest_invalid_url":return(0,r.__)("Invalid link.","web-stories");case"rest_invalid_ext":return(0,p.default)(/* translators: %s is the description with allowed file extensions. */
|
||
|
(0,r.__)("Invalid link. %s","web-stories"),t);default:return(0,r.__)("Media failed to load. Please ensure the link is valid and the site allows linking from external sites.","web-stories")}}(e.code,I))}finally{h(!1)}var e,a,C,s}else _((0,r.__)("Invalid link.","web-stories"))}),[E,w,o,M,i,f,t,L,l,I]);return{action:{onChange:x,onSubmit:(0,C.useCallback)((e=>{e.preventDefault(),S||k()}),[S,k]),onBlur:T,onCloseDialog:A,onInsert:k},state:{description:I,isInserting:g,link:E,errorMsg:v,isDisabled:S}}},v=o.default.form.withConfig({displayName:"hotlinkModal__InputWrapper",componentId:"sc-21vzo8-0"})(["margin:16px 4px;width:470px;height:100px;"]);const _=function HotlinkModal(e){let{isOpen:t,onClose:a,onSelect:o,onError:s,allowedFileTypes:c=[],insertText:d=(0,r.__)("Insert","web-stories"),insertingText:u=(0,r.__)("Inserting…","web-stories"),title:p,canUseProxy:m=!0,requiredImgDimensions:f={}}=e;const g=(0,C.useRef)(null),{action:{onSubmit:h,onBlur:E,onChange:b,onCloseDialog:_,onInsert:w},state:{errorMsg:M,isInserting:L,link:S,description:I,isDisabled:T}}=y({allowedFileTypes:c,onClose:a,onError:s,onSelect:o,canUseProxy:m,requiredImgDimensions:f}),x=L?u:d;return(0,C.useLayoutEffect)((()=>{const e=setTimeout((()=>{t&&g.current&&g.current.focus()}));return()=>clearTimeout(e)}),[t,g]),n.createElement(i.default,{onClose:_,isOpen:t,title:p,onPrimary:w,primaryText:x,secondaryText:(0,r.__)("Cancel","web-stories"),primaryRest:{disabled:T}},n.createElement(v,{onSubmit:h},n.createElement(l.default,{ref:g,onChange:b,value:S,hint:M||I,hasError:Boolean(M),onBlur:E,label:(0,r.__)("URL","web-stories"),type:"url",required:!0})))}},82961:(e,t,a)=>{"use strict";a.d(t,{PANE_IDS:()=>n});let n=function(e){return e.Media="media",e.Media3p="media3p",e.Text="text",e.Shapes="shapes",e.Elements="elements",e.PageTemplates="pageTemplates",e.Shopping="shopping",e}({})},81024:(e,t,a)=>{"use strict";a.d(t,{GalleryContainer:()=>c,MediaGalleryContainer:()=>d,MediaGalleryInnerContainer:()=>u,MediaGalleryLoadingPill:()=>p,MediaGalleryMessage:()=>m,PaneHeader:()=>s,PaneInner:()=>i,SearchInputContainer:()=>g,StyledPane:()=>f});var n=a(12788),r=a(84967),l=a(72165),o=a(6992),C=a(4063);const i=n.default.div.withConfig({displayName:"common__PaneInner",componentId:"sc-18rwr03-0"})(["height:100%;display:flex;flex-direction:column;"]),s=n.default.div.withConfig({displayName:"common__PaneHeader",componentId:"sc-18rwr03-1"})(["padding-top:24px;flex:0 1 auto;"]),c=n.default.div.withConfig({displayName:"common__GalleryContainer",componentId:"sc-18rwr03-2"})(["display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;"]),d=n.default.div.withConfig({displayName:"common__MediaGalleryContainer",componentId:"sc-18rwr03-3"})(["overflow-y:scroll;overflow-x:hidden;padding:0 ",";margin-top:1em;position:relative;width:100%;flex:1 1 auto;min-height:100px;"],C.PANE_PADDING),u=n.default.div.withConfig({displayName:"common__MediaGalleryInnerContainer",componentId:"sc-18rwr03-4"})(["width:calc(100% + ","px);"],l.TextSize.SCROLLBAR_WIDTH),p=n.default.div.withConfig({displayName:"common__MediaGalleryLoadingPill",componentId:"sc-18rwr03-5"})(["display:block;position:absolute;bottom:20px;left:60px;right:60px;width:240px;text-align:center;padding:8px 80px;background-color:",";border-radius:100px;"],(e=>{let{theme:t}=e;return(0,r.rgba)(t.colors.standard.black,.4)})),m=(0,n.default)(o.Text.Paragraph).attrs({size:l.TextSize.Medium}).withConfig({displayName:"common__MediaGalleryMessage",componentId:"sc-18rwr03-6"})(["color:",";padding:1em;text-align:center;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),f=(0,n.default)(C.Pane).withConfig({displayName:"common__StyledPane",componentId:"sc-18rwr03-7"})(["height:100%;padding:0;overflow:hidden;"]),g=n.default.div.withConfig({displayName:"common__SearchInputContainer",componentId:"sc-18rwr03-8"})(["padding:0 ",";"],C.PANE_PADDING)},4063:(e,t,a)=>{"use strict";a.d(t,{ActionButton:()=>I,ChipGroup:()=>v,LoadingContainer:()=>S,PANE_PADDING:()=>_,PageTemplateTitleContainer:()=>T,Pane:()=>w,getPaneId:()=>M,getTabId:()=>L});var n=a(12788
|
||
|
(0,m.__)("Reason: %s","web-stories"),n))))}const te=function ErrorDialog(){const{error:e,hasVideo:t}=(0,n.default)((e=>{let{state:t}=e;return{error:t.error,hasVideo:Boolean(t.videoInput)}}));return r.createElement(H,null,r.createElement(ErrorMessage,{error:e,hasVideo:t}))};const ae=function PermissionsDialog(){return r.createElement(H,null,r.createElement(B,null,r.createElement(l.ThemeProvider,{theme:{...X.theme,colors:K.light}},r.createElement(F,null,(0,m.__)("Media Recording","web-stories")),r.createElement(z,null,(0,m.__)("To get started, you need to allow access to your camera and microphone.","web-stories")))))};var ne=a(19574),re=a(92414);const le=l.default.div.withConfig({displayName:"processingOverlay__Wrapper",componentId:"sc-ksu3mm-0"})(["position:absolute;left:0;top:0;height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;background-color:rgba(0 0 0 / 0.5);gap:2em;padding:3em;"]);const oe=function ProcessingOverlay(){const e=(0,ne.default)();return(0,f.useEffect)((()=>{e((0,m.__)("Video trimming in progress. Please wait up to a few minutes depending on output video length.","web-stories"))}),[e]),r.createElement(le,null,r.createElement(re.default,null),r.createElement(o.Text.Paragraph,null,(0,m.__)("Video trimming in progress. Please wait up to a few minutes depending on output video length.","web-stories")))};const Ce=function MediaRecording(){const{status:e,error:t,needsPermissions:a,isProcessingTrim:l}=(0,n.default)((e=>{let{state:t}=e;return{status:t.status,error:t.error,needsPermissions:("idle"===t.status||"acquiring_media"===t.status)&&!t.videoInput,isProcessingTrim:t.isProcessingTrim}}));return"failed"===e||Boolean(t)?r.createElement(te,null):a?r.createElement(ae,null):r.createElement(r.Fragment,null,r.createElement(H,null,r.createElement(q,null),l&&r.createElement(oe,null)),r.createElement(u,null),r.createElement(i,null))};a(70928),a(30005);var ie=a(91703),se=a.n(ie),ce=a(54389),de=a(71028),ue=a(71112),pe=a(42628),me=a(36313),fe=a(36382),ge=a(26619),he=a(87215),Ee=a(67485);const be=function(e){let{setDuration:t,onTrimmed:a,file:n,isRecording:r}=e;const[l,o]=(0,f.useState)({start:0,end:null}),[C,i]=(0,f.useState)(!1),[s,c]=(0,f.useState)(!1),{trimVideo:d}=(0,Ee.default)(),u=(0,f.useRef)(),p=(0,f.useCallback)((async e=>{if(i(!1),e){u.current=!1,c(!0);const r=(0,he.default)(e.start),l=(0,he.default)(e.end),C=await d(n,r,l);if(u.current)return;o(e),c(!1),a(C),t(e.end-e.start)}}),[n,a,t,d]),m=(0,f.useCallback)((()=>i(!0)),[]),g=(0,f.useCallback)((()=>{i(!1),o({start:0,end:null})}),[]),h=(0,f.useCallback)((()=>{u.current=!0,c(!1)}),[]);return(0,f.useEffect)((()=>{r&&g()}),[r,g]),{trimData:l,isAdjustingTrim:C,isProcessingTrim:s,onTrim:p,startTrim:m,resetTrim:g,cancelTrim:h}};const ye=function MediaRecordingProvider(e){let{children:t}=e;const[a,n]=(0,f.useState)(!1),[l,o]=(0,f.useState)(!1),[C,i]=(0,f.useState)(!1),[s,d]=(0,f.useState)(null),[u,p]=(0,f.useState)(null),[g,h]=(0,f.useState)(null),[E,b]=(0,f.useState)(0),[y,v]=(0,f.useState)(0),[_,w]=(0,f.useState)(!1),[M,L]=(0,f.useState)(!0),[S,I]=(0,f.useState)(!0),[T,x]=(0,f.useState)(ce.localStore.getItemByKey(ce.LOCAL_STORAGE_PREFIX.MEDIA_RECORDING_VIDEO_INPUT)),[A,k]=(0,f.useState)(ce.localStore.getItemByKey(ce.LOCAL_STORAGE_PREFIX.MEDIA_RECORDING_AUDIO_INPUT)),[Z,P]=(0,f.useState)(ce.localStore.getItemByKey(ce.LOCAL_STORAGE_PREFIX.MEDIA_RECORDING_VIDEO_EFFECT)),[R,O]=(0,f.useState)([]),[D,N]=(0,f.useState)(null),[B,F]=(0,f.useState)(null);(0,f.useEffect)((()=>{R.length&&(x(R.find((e=>e.deviceId===T))?.deviceId||R.find((e=>"videoinput"===e.kind))?.deviceId),k(R.find((e=>e.deviceId===A))?.deviceId||R.find((e=>"audioinput"===e.kind))?.deviceId))}),[A,R,T]);const[z,H]=(0,f.useState)(),[V,U]=(0,f.useState)(),{showSnackbar:j}=(0,de.useSnackbar)(),G=(0,f.useCallback)((e=>{try{const t=(0,pe.createBlob)(e);U(t),H(t);const a=function(e,t){const a=t?c.VIDEO_FILE_TYPE:c.AUDIO_FILE_TYPE,n=t?c.VIDEO_MIME_TYPE:c.AUDIO_MIME_TYPE,r=t?"webcam":"audio";return(0,ue.default)(e,`${r}-capture-${(0,me.format)(new Da
|
||
|
(0,m._n)("Starting recording in %d second","Starting recording in %d seconds",c.COUNTDOWN_TIME_IN_SECONDS,"web-stories"),c.COUNTDOWN_TIME_IN_SECONDS)),u(0),p(c.COUNTDOWN_TIME_IN_SECONDS),V()}),[V,p,u,N]),[j,G]=(0,f.useState)(!1),W=["recording","stopping","stopped","paused"].includes(e),$="paused"===e,Y=(0,f.useCallback)((async()=>{G(!0),N((0,m.__)("Inserting…","web-stories"));const e={additionalData:{mediaSource:"recording",altText:(0,m.__)("Camera Capture","web-stories")}},{resource:n,posterFile:r}=await(0,Ne.default)(t);if(e.resource={...n,alt:(0,m.__)("Camera Capture","web-stories")},t.type.startsWith("video")){e.additionalData.isMuted=l,e.additionalData.isGif=a,e.resource.length=i,e.resource.lengthFormatted=(0,Ze.default)(i),e.resource.isOptimized=!0,e.resource.isMuted=l,e.posterFile=r;const{length:t,lengthFormatted:n}=(0,Pe.default)(O);e.resource.length=t||i,e.resource.lengthFormatted=t?n:(0,Ze.default)(i)}D([t],!0,e),W&&(d(null),y(null)),(0,fe.trackEvent)("media_recording_capture",{type:a?"gif":"video",muted:l,duration:i}),G(!1),v()}),[N,t,D,W,a,l,i,v,O,d,y]);(0,f.useEffect)((()=>{L&&!L.srcObject&&I&&(L.srcObject=I),L&&!I&&(L.srcObject=null)}),[L,I]);const{showSnackbar:q}=(0,de.useSnackbar)(),X=(0,f.useCallback)((async()=>{const e=x&&x!==c.VIDEO_EFFECTS.NONE,t=e?S:L;if(!t)return;let a;try{a=e?await(0,Re.default)(R):await(0,Oe.default)(t),d((0,pe.createBlob)(a))}catch(e){(0,fe.trackError)("media_recording_capture",e.message),q({message:(0,m.__)("There was an error taking a photo. Please try again.","web-stories"),dismissable:!0})}const n=(0,ue.default)(a,`image-capture-${(0,me.format)(new Date,"Y-m-d-H-i")}.${c.PHOTO_FILE_TYPE}`,c.PHOTO_MIME_TYPE);y(n),M()}),[M,y,d,q,L,S,x,R]),K=(0,f.useDebouncedCallback)(X,1e3*c.COUNTDOWN_TIME_IN_SECONDS),Q=(0,f.useCallback)((()=>{N((0,J.default)(/* translators: %d: countdown time in seconds. */
|
||
|
(0,m._n)("Taking photo in %d second","Taking photo in %d seconds",c.COUNTDOWN_TIME_IN_SECONDS,"web-stories"),c.COUNTDOWN_TIME_IN_SECONDS)),p(c.COUNTDOWN_TIME_IN_SECONDS),K(),(0,fe.trackEvent)("media_recording_capture",{type:"image"})}),[K,p,N]),{actions:{uploadFile:ee}}=(0,Fe.useUploader)(),{updateCurrentPageProperties:te,backgroundElementId:ae,setSelectedElementsById:re}=(0,ze.useStory)((e=>{let{state:{currentPage:t},actions:{updateCurrentPageProperties:a,setSelectedElementsById:n}}=e;return{backgroundElementId:t?.elements.find((e=>{let{isBackground:t}=e;return t}))?.id,updateCurrentPageProperties:a,setSelectedElementsById:n,currentPage:t}})),{setHighlights:le}=(0,He.useHighlights)((e=>{let{setHighlights:t}=e;return{setHighlights:t}})),{convertToMp3:oe}=(0,Ee.default)(),Ce=async()=>{G(!0),N((0,m.__)("Inserting…","web-stories"));const e=await oe(t),a=await ee(e,{mediaSource:"recording"},B),n={resource:(0,Ve.default)(a,Object.keys(De.BackgroundAudioPropTypeShape))};re({elementIds:[ae]}),le({highlight:He.states.PageBackgroundAudio}),te({properties:{backgroundAudio:n}}),G(!1),v()};return"acquiring_media"===e?null:Z?r.createElement(qe,{onClick:P},(0,m.__)("Cancel trimming","web-stories")):o?r.createElement(r.Fragment,null,r.createElement(qe,{onClick:H,disabled:j},(0,m.__)("Retry","web-stories")),r.createElement(Ye,{onClick:T?Y:Ce,disabled:j},j?(0,m.__)("Inserting…","web-stories"):T?(0,m.__)("Insert","web-stories"):(0,m.__)("Insert page background audio","web-stories"))):0===C?r.createElement(r.Fragment,null,W&&r.createElement(r.Fragment,null,r.createElement(Ge,{onClick:$?z:F,"aria-label":$?(0,m.__)("Resume Recording","web-stories"):(0,m.__)("Pause Recording","web-stories")},$?(0,m.__)("Resume","web-stories"):(0,m.__)("Pause","web-stories")),r.createElement(We,{onClick:b,"aria-label":(0,m.__)("Stop Recording","web-stories")},(0,m.__)("Stop","web-stories"))),!W&&!s&&(T?r.createElement(r.Fragment,null,r.createElement(je,{onClick:U},r.createElement(E.default,{width:24,height:24,"aria-hidden":!0}),(0,m.__)("Record Video","web-stories")),r.createElement($e,{onClick:Q},r.createElement(Ae,{width:24,height:24,"aria-hidden":!0}),(0,m.__)("Take a photo","web-stories"))):r.createElement(je,{onClick:U},r.createElement(ke.default,{width:24,height:24,"aria-hidden":!0}),(0,m.__)("Record Audio","web-stories")))):null};var Ke=a(28395),Qe=a(37257);const Je=(0,l.default)(o.Text.Paragraph).attrs({size:N.TextSize.Small}).withConfig({displayName:"durationIndicator__Wrapper",componentId:"sc-5z5bu3-0"})(["font-variant-numeric:tabular-nums;&:before{content:'';display:inline-block;width:10px;height:10px;margin-right:5px;border-radius:100%;background-color:",";}"],(e=>{let{theme:t}=e;return t.colors.interactiveBg.negativeNormal}));const et=function DurationIndicator(){const{duration:e,isRecording:t}=(0,n.default)((e=>{let{state:t}=e;return{duration:t.duration,isRecording:["recording","paused"].includes(t.status)}}));return t?r.createElement(Qe.default,{position:Ke.Placement.Top,title:(0,J.default)(/* translators: %s: number of minutes */
|
||
|
(0,m._n)("Maximum duration is %d minute","Maximum duration is %d minutes",c.MAX_RECORDING_DURATION_IN_MINUTES,"web-stories"),String(c.MAX_RECORDING_DURATION_IN_MINUTES)),styleOverride:{maxWidth:"20em"}},r.createElement(Je,null,(0,Ze.default)(e))):null}},7907:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(26619);const __WEBPACK_DEFAULT_EXPORT__=function(e){return(0,n.useContextSelector)(r.default,e??n.identity)}},85707:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});a(41792),a(67602),a(16054),a(53476),a(70928),a(31107),a(30005);var n=a(69845),r=a(82763),l=a(83919),o=a(528),C=a(61695),i=a(36382);const s={startX:0,startY:0,endX:r.PAGE_WIDTH,endY:r.PAGE_HEIGHT,width:r.PAGE_WIDTH,height:r.PAGE_HEIGHT},c="left",d="right",u="top",p="bottom";const __WEBPACK_DEFAULT_EXPORT__=function(e){let{selectedElements:t,updateElements:a,isFloatingMenu:r}=e;const m=t.length>2,f=(0,n.useMemo)((()=>t.map((e=>{const{id:t,groupId:a,x:n,y:r,width:o,height:C,rotationAngle:i}=e;let s=n,c=r,d=o,u=C;if(i){const e=(0,l.default)(i,n,r,o,C);s=e.x,c=e.y,d=e.width,u=e.height}return{id:t,groupId:a,x:n,y:r,width:o,height:C,frameX:s,frameY:c,frameWidth:d,frameHeight:u}}))),[t]),g=t[0].groupId,h=g&&t.every((e=>e.groupId&&e.groupId===g)),E=1===t.length||h?s:(0,o.default)(t),b=e=>{(0,i.trackEvent)(r?"floating_menu":"design_panel",{name:`set_alignment_${e}`,element:"multiple"})},y=e=>{b(e),a((a=>{const{id:n,groupId:r}=a,l=r?(0,o.default)(t.filter((e=>e.groupId===r))):null,C=f.find((e=>e.id===n)),{width:i=0,height:s=0,frameWidth:p=0,frameHeight:m=0}=C||{},g=e===c||e===d?(p-i)/2:(m-s)/2,h=r?e===c||e===d?C.frameX-l.startX:C.frameY-l.startY:0,b=r?l.width:i,y=r?l.height:s;return e===c||e===d?{x:e===c?E.startX+g+h:E.endX-b-g+h}:{y:e===u?E.startY+g+h:E.endY-y-g+h}}))};return{isDistributionEnabled:m,handleAlignLeft:()=>y(c),handleAlignCenter:()=>{b("center");const e=(E.endX+E.startX)/2;a((a=>{const{id:n,width:r,groupId:l}=a,C=l?(0,o.default)(t.filter((e=>e.groupId===l))):null,i=l?C.width:r,s=f.find((e=>e.id===n)),c=l?s.frameX-C.startX:0;return{x:e-i/2+c}}))},handleAlignRight:()=>y(d),handleAlignTop:()=>y(u),handleAlignMiddle:()=>{b("middle");const e=(E.endY+E.startY)/2;a((a=>{const{id:n,height:r,groupId:l}=a,C=l?(0,o.default)(t.filter((e=>e.groupId===l))):null,i=l?C.height:r,s=f.find((e=>e.id===n)),c=l?s.frameY-C.startY:0;return{y:e-i/2+c}}))},handleAlignBottom:()=>y(p),handleHorizontalDistribution:()=>{b("horizontal_distribution");const e=[...f];e.sort(((e,t)=>(e.frameX+e.frameWidth)/2-(t.frameX+t.frameWidth)/2));const t=e.reduce(((e,t)=>e+t.frameWidth),0),n=E.width-t,r=(0,C.dataPixels)(n/(e.length-1)),l={};let o=0;e.forEach(((t,a)=>{const{id:n,x:C,width:i,frameWidth:s}=t;0===a||a===e.length-1?(l[n]={x:C},o=C):l[n]={x:o+(s-i)/2},o+=s+r})),a((e=>{let{id:t}=e;return l[t]}))},handleVerticalDistribution:()=>{b("vertical_distribution");const e=[...f];e.sort(((e,t)=>(e.frameY+e.frameHeight)/2-(t.frameY+t.frameHeight)/2));const t=e.reduce(((e,t)=>e+t.frameHeight),0),n=E.height-t,r=(0,C.dataPixels)(n/(e.length-1)),l={};let o=0;e.forEach(((t,a)=>{const{id:n,y:C,height:i,frameHeight:s}=t;0===a||a===e.length-1?(l[n]={y:C},o=C):l[n]={y:o+(s-i)/2},o+=s+r})),a((e=>{let{id:t}=e;return l[t]}))}}}},29734:(e,t,a)=>{"use strict";a.d(t,{DEFAULT_BORDER:()=>n});const n={left:0,right:0,top:0,bottom:0,lockedWidth:!0,color:(0,a(84158).default)(0,0,0)}},87608:(e,t,a)=>{"use strict";a.d(t,{MIN_MAX:()=>d,default:()=>p});var n=a(67294),r=a(69845),l=a(36823),o=a(31119),C=a(2831),i=a(99082),s=a(79099),c=a(21530);const d={OPACITY:{MIN:0,MAX:100}};function u(e){let{opacity:t}=e;return void 0!==t?t:d.OPACITY.MAX}const p=function OpacityControls(e){let{selectedElements:t,pushUpdate:a}=e;const p=(0,i.default)(t,u),m=(0,r.useCallback)(((e,t)=>a({opacity:t??100},!0)),[a]);return n.createElement(o.default,{suffix:n.createElement(C.default,null),unit:(0,l._x)("%","Percentage","web-stories"),value:p,onChange:m,min:d.OPACITY.MIN,max:d.OPACITY.MAX,"aria-label":(0,l.__)("Opacity in percent","web-stories"),placeholder:p===c.MULTIPLE_VALUE?c.MULTIP
|
||
|
(0,n.__)("+ %s","web-stories"),t)))};var I=a(80934),T=a(6025),x=a(28154);const LayerThumbnail=e=>{let{page:t}=e;const{LayerIcon:a}=(0,I.getDefinitionForType)(t?.type),{getProxiedUrl:n}=(0,T.default)(),{isDefaultBackground:r}=t,l={element:t,getProxiedUrl:n,currentPageBackgroundColor:(0,x.useStory)((e=>{let{state:t}=e;return!r||t.currentPage?.backgroundColor}))};return"video"===t?.type&&(l.showVideoPreviewAsBackup=!0),s.createElement(a,l)}},192:(e,t,a)=>{"use strict";a.d(t,{ToggleButton:()=>M});var n=a(67294),r=a(45697),l=a.n(r),o=a(12788),C=a(58228),i=a(38668),s=a(72165),c=a(85703),d=a(56394),u=a(6992),p=a(28395),m=a(5574),f=a(73829),g=a(69845),h=a(37257);function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},E.apply(this,arguments)}const b=36,y=(0,o.default)(C.Button).withConfig({displayName:"toggleButton__Button",componentId:"sc-1de7s10-0"})(["width:auto;display:flex;align-items:center;justify-content:space-between;border-width:1px;border-style:solid;padding:0 10px;white-space:nowrap;"," > :not(svg):last-child{margin-right:0;}.main-icon{height:","px;width:auto;margin:-8px;display:block;}"],(e=>{let{isOpen:t,hasText:a,height:n=b,theme:r}=e;return(0,o.css)(["height:","px;min-width:","px;color:",";border-color:",";background-color:",";",""],n,n,r.colors.fg.primary,t?r.colors.bg.secondary:r.colors.border.defaultNormal,t?r.colors.bg.secondary:r.colors.bg.primary,a&&(0,o.css)(["",";"],i.expandPresetStyles({preset:{...r.typography.presets.paragraph[s.TextSize.Small]},theme:r})))}),c.THEME_CONSTANTS.ICON_SIZE);y.propTypes={hasText:l().bool,isOpen:l().bool,height:l().oneOfType([l().number,l().string])};const v=22,_=d.theme.typography.presets.label[s.TextSize.Small],w=(0,o.default)(u.Text.Span).withConfig({displayName:"toggleButton__CountBadge",componentId:"sc-1de7s10-1"})(["",""],(e=>{let{size:t=v,fontSize:a=_.size,theme:n}=e;return(0,o.css)(["min-width:","px;width:auto;height:","px;padding:0 ","px;margin:0 8px;display:flex;align-items:center;justify-content:center;color:",";background-color:",";border-radius:9999px;font-size:","px;line-height:0;"],t,t,t/4,n.colors.fg.primary,n.colors.bg.quaternary,a)}));w.propTypes={size:l().oneOfType([l().number,l().string]),fontSize:l().oneOfType([l().number,l().string])};const M=(0,g.forwardRef)(((e,t)=>{let{copy:a,isOpen:r=!1,notificationCount:l=0,MainIcon:o,label:C,shortcut:i,popupZIndexOverride:s,hasMenuList:c=!1,...d}=e;const u=l>0;return n.createElement(h.default,{hasTail:!0,title:C,placement:p.Placement.Top,shortcut:i,popupZIndexOverride:s},n.createElement(y,E({ref:t,"aria-haspopup":!0,"aria-pressed":r,"aria-expanded":r,hasText:Boolean(a),isOpen:r,isSquare:!u,type:m.ButtonType.Tertiary,variant:m.ButtonVariant.Rectangle,size:m.ButtonSize.Medium},d),o&&n.createElement(o,{className:"main-icon"}),a,u&&n.createElement(w,null,l),c&&n.createElement(f.default,{direction:"down",$isOpen:r})))}));M.displayName="ToggleButton"},37257:(e,t,a)=>{"use strict";a.d(t,{default:()=>Tooltip});var n=a(67294),r=a(28395),l=a(97783);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function Tooltip(e){let{hasTail:t=!0,placement:a=r.Placement.Bottom,...C}=e;return n.createElement(l.default,o({placement:a,hasTail:t},C))}},2076:(e,t,a)=>{"use strict";a.d(t,{ScheduledTransition:()=>ScheduledTransition});var n=a(67294),r=a(69845),l=a(12666);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}const C="entering",i="entered",s="exiting",c="default",d={default:{entering:C},entering:{entered:i},entered:{exiting:s},exiting:{exited:"exited"},exited:{entering:C}},u=(e,t)=>d[e]?.[t]||e,p=(0,r.forwardRef)(((e,t)=>{let{state:a,chil
|
||
|
(0,m.__)("You can upload %s.","web-stories"),(0,g.default)(s))),n.createElement(S,a,n.createElement(I,null,n.createElement(x,null),n.createElement(T,{isBold:!0,size:b.TextSize.Medium},t),n.createElement(T,{size:b.TextSize.Small},c)))}))},77554:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(21530),l=a(91960);const __WEBPACK_DEFAULT_EXPORT__=function(e){const[t,a]=(0,n.useState)(null),[o,C]=(0,n.useState)(null),[i,s]=(0,n.useState)(null),[c,d]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[g,h]=(0,n.useState)(null),[E,b]=(0,n.useState)(!1),y=(0,n.useRef)(!1);(0,n.useEffect)((()=>{g&&(y.current||(E?g.pause():(g.currentTime=o/1e3,g.play().catch(l.noop))))}),[g,E,o]);const v=g?g.paused:null;(0,n.useEffect)((()=>{E||(y.current=v)}),[v,E]),(0,n.useEffect)((()=>{e||(C(null),s(null),a(null),d(null),p(null),f(null))}),[e]),(0,n.useEffect)((()=>{if(g&&e)return isFinite(g.duration)&&null===o?n({target:g}):isFinite(g.duration)?g.addEventListener("loadedmetadata",n):(g.currentTime=Number.MAX_SAFE_INTEGER,g.addEventListener("timeupdate",n)),c&&g.addEventListener("timeupdate",r),()=>{g.removeEventListener("timeupdate",r),g.removeEventListener("timeupdate",n),g.removeEventListener("loadedmetadata",n)};function t(e){g.currentTime=e/1e3,g.play().catch(l.noop)}function n(n){if(!isFinite(n.target.duration))return;const r=Math.floor(1e3*n.target.duration);C(e.start),s(e.start),a(e.start),d(e.end??r),p(e.end??r),f(r),t(e.start)}function r(e){if(!c)return;const n=Math.floor(1e3*e.target.currentTime);a(Math.min(n,c)),n>c&&!y.current&&t(o)}}),[o,c,e,g]);const _=(0,n.useCallback)((e=>{e=Math.min(c-r.MEDIA_VIDEO_MINIMUM_DURATION,e),e=Math.max(0,e),C(e),g.currentTime=e/1e3}),[g,c]),w=(0,n.useCallback)((e=>{e=Math.max(o+r.MEDIA_VIDEO_MINIMUM_DURATION,e),e=Math.min(m,e),d(e),g.currentTime=e/1e3}),[g,o,m]);return{hasChanged:(0,n.useMemo)((()=>o!==i||c!==u),[o,i,c,u]),currentTime:t,startOffset:o,endOffset:c,maxOffset:m,videoNode:g,setStartOffset:_,setEndOffset:w,setVideoNode:h,setIsDraggingHandles:b}}},88791:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(84676);const __WEBPACK_DEFAULT_EXPORT__=function(e){return(0,n.useContextSelector)(r.default,e??n.identity)}},84676:(e,t,a)=>{"use strict";a.d(t,{default:()=>n});const n=(0,a(69845).createContext)({state:{},actions:{}})},21530:(e,t,a)=>{"use strict";a.d(t,{ADMIN_TOOLBAR_HEIGHT:()=>y,CANVAS_MIN_WIDTH:()=>w,CAROUSEL_TRANSITION_DURATION:()=>A,CarouselState:()=>x,DESIGN_SPACE_MARGIN:()=>P,FLOATING_MENU_DISTANCE:()=>S,FONT_WEIGHT:()=>D,FONT_WEIGHT_NAMES:()=>r,HEADER_GAP:()=>_,HEADER_HEIGHT:()=>v,HEADING_LEVELS:()=>b,HIDDEN_PADDING:()=>N,LayerDirection:()=>O,MAX_EXTRA_PAGES:()=>Z,MAX_PRODUCTS_PER_PAGE:()=>I,MEDIA_MIME_TYPES_OPTIMIZED_VIDEOS:()=>p,MEDIA_POSTER_IMAGE_FILE_TYPE:()=>o,MEDIA_POSTER_IMAGE_MIME_TYPE:()=>C,MEDIA_RECOMMENDED_MAX_VIDEO_DURATION:()=>m,MEDIA_RECOMMENDED_MIN_VIDEO_FPS:()=>f,MEDIA_TRANSCODED_FILE_TYPE:()=>s,MEDIA_TRANSCODED_MIME_TYPE:()=>i,MEDIA_TRANSCODING_MAX_FILE_SIZE:()=>l,MEDIA_VIDEO_DIMENSIONS_THRESHOLD:()=>d,MEDIA_VIDEO_FILE_SIZE_THRESHOLD:()=>u,MEDIA_VIDEO_MINIMUM_DURATION:()=>c,MULTIPLE_DISPLAY_VALUE:()=>h,MULTIPLE_VALUE:()=>g,OUTLINK_THEME:()=>F,PAGE_NAV_WIDTH:()=>L,PAGE_WIDTH_FACTOR:()=>k,PRESET_TYPES:()=>z,SAVED_STYLE_HEIGHT:()=>B,SIDEBAR_WIDTH:()=>M,STABLE_ARRAY:()=>H,TEXT_SET_SIZE:()=>R,TRACKING_EVENTS:()=>E,ZoomSetting:()=>T});var n=a(36823);const r={100:(0,n._x)("Thin","font weight","web-stories"),200:(0,n._x)("Extra-light","font weight","web-stories"),300:(0,n._x)("Light","font weight","web-stories"),400:(0,n._x)("Regular","font weight","web-stories"),500:(0,n._x)("Medium","font weight","web-stories"),600:(0,n._x)("Semi-bold","font weight","web-stories"),700:(0,n._x)("Bold","font weight","web-stories"),800:(0,n._x)("Extra-bold","font weight","web-stories"),900:(0,n._x)("Black","font weight","web-stories")},l=2147483648,o="jpeg",C="image/jpeg",i="video/mp4",s="mp4",c=100,d={HEIGHT:720,WIDTH:1280},u=4e6,p=["video/mp4"],m=15,f=24,g="((MULTIPLE))",h=(0,n.__)("Mix
|
||
|
(0,n.__)("Group %d","web-stories"),t.toString())}return(0,r.default)(/* translators: %s: name of layer. */
|
||
|
(0,n.__)("%s Copy","web-stories"),t)}},98489:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(82763),r=a(61695),l=a(80934);const o=[1,0];function C(e){return"number"==typeof e}const __WEBPACK_DEFAULT_EXPORT__=function(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=arguments.length>5?arguments[5]:void 0;if(C(t)||(t=C(a)?a*s:c?Math.min(c.width*n.DEFAULT_DPR,.8*n.PAGE_WIDTH):n.PAGE_WIDTH/2),!C(a)){const n=(0,l.getDefinitionForType)(e);if(n&&n.updateForResizeEvent&&n.defaultAttributes){const{updateForResizeEvent:e,defaultAttributes:r}=n,{height:l}=e({...r,...i},o,t,0);a=l}}if(C(a)||(a=t/s),t>n.PAGE_WIDTH||a>n.PAGE_HEIGHT){const e=t/a;e<=n.PAGE_WIDTH/n.PAGE_HEIGHT?a=(t=Math.min(t,n.PAGE_WIDTH))/e:t=(a=Math.min(a,n.PAGE_HEIGHT))*e}return{width:t=(0,r.dataPixels)(t),height:a=(0,r.dataPixels)(a)}}},93651:(e,t,a)=>{"use strict";a.d(t,{default:()=>o});var n=a(36382);a(41792);const r=function(e){return`#${e.map((e=>e.toString(16))).map((e=>e.padStart(2,"0"))).join("")}`};var l=a(60298);const o=async function(e){let t,o,C=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(!e)throw new Error("No source to image");const s=(0,n.getTimeTracker)("load_get_base_color");try{o=await(0,l.default)({src:e,width:C,height:i}),t=await async function(e){const{default:t}=await a.e(7498).then(a.bind(a,86078));return new Promise(((a,l)=>{try{const n=(new t).getColor(e);a(r(n))}catch(e){e instanceof Error&&(0,n.trackError)("image_base_color",e.message),l(e)}}))}(o)}catch(e){if(!(e instanceof TypeError))throw e;t="#ffffff"}finally{o?.remove(),s()}return t}},19510:(e,t,a)=>{"use strict";a.d(t,{default:()=>r});var n=a(38999);function r(e,t){return`${n.SESSION_STORAGE_PREFIX.LOCAL_AUTOSAVE_PREFIX}_${t?"auto-draft":e}`}},27205:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});a(41792),a(15716),a(33442),a(61964),a(69878),a(52915),a(97895),a(22275),a(20691);const __WEBPACK_DEFAULT_EXPORT__=function(e){const t=e.map((e=>JSON.stringify(e)));return Array.from(new Set(t)).map((e=>JSON.parse(e)))}},48853:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(61695),r=a(40292),l=a(60238);const __WEBPACK_DEFAULT_EXPORT__=function(e){const{width:t,height:a,rotationAngle:o,x:C,y:i}=e,s=(0,n.dataPixels)((0,l.calculateTextHeight)(e,t)),[c,d]=(0,r.default)(o,0,0,0,s-a);return{height:s,x:(0,n.dataPixels)(C+c),y:(0,n.dataPixels)(i+d)}}},69585:(e,t,a)=>{"use strict";a.d(t,{cancelIdleCallback:()=>r,requestIdleCallback:()=>n});const n=window.requestIdleCallback||function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=t.timeout||1,n=performance.now();return setTimeout((()=>{e({get didTimeout(){return void 0===t.timeout&&performance.now()-n-1>a},timeRemaining:function(){return Math.max(0,performance.now()-n+1)}})}),1)},r=window.cancelIdleCallback||function(e){clearTimeout(e)}},75145:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});const __WEBPACK_DEFAULT_EXPORT__=function(e,t){const{left:a,right:n,top:r,bottom:l}=e.getBoundingClientRect(),o=t.getBoundingClientRect();return a>o.right||n<o.left||l<o.top||r>o.bottom}},56247:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__,isKeyboardUser:()=>c});var n=a(67294),r=a(69845),l=a(12788);const o="useskeyboard",C=`.${o}`,i=(0,l.createGlobalStyle)(["body:not(",") *:focus{outline:none !important;}"],C),s=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Digit1","Digit2","Digit3"];function c(){return document.body.classList.contains(o)}const __WEBPACK_DEFAULT_EXPORT__=()=>{const[e,t]=(0,r.useState)(!1),a=a=>{!e&&s.includes(a.code)&&t(!0)},l=()=>{e&&t(!1)};return(0,r.useEffect)((()=>(document.addEventListener("keydown",a,!0),document.addEventListener("mousedown",l,!0),function(){document.removeEventListener("keydown",a,!0),document.removeEventListener("mousedown",l,!0)}))),(0,r.useEffect)((()=>{document.body.classList.toggle(o,e)}),[e]),
|
||
|
(0,l.__)("Post %d","web-stories"),e.toString()),a.toString())}catch(e){}}),[e,t])}},8092:(e,t,a)=>{"use strict";a.d(t,{default:()=>d});var n=a(69845),r=a(58979),l=a(38729);const o='[tabIndex="-1"]:not(:disabled)';function C(e,t){let a,n=t;for(;n>0;)a=a?a?.parentElement:e.parentElement,n--;return a}function i(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"firstChild";return C(e,t).parentNode[a].querySelector(o)}function s(e){const t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}function c(e,t,a){return a>0?function(e,t,a){const n=C(e,a);if(n){const e=n[t];return e?e.querySelector(o):null}return null}(e,t,a):function(e,t){let a=e[t];for(;a&&a.disabled;)a=a[t];return a}(e,t)}function d(e){let{ref:t}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const{isRTL:d}=(0,l.useConfig)(),u=(0,n.useCallback)((e=>{let{key:t,target:a}=e;const n=a,r=function(e,t){return(e?"ArrowRight"===t||"ArrowUp"===t||"PageUp"===t:"ArrowLeft"===t||"ArrowUp"===t||"PageUp"===t)?"previousSibling":"nextSibling"}(d,t),l=e=>{if(e){const t=o>0?C(e,o):e;n.tabIndex=-1,e.tabIndex=0,e.focus(),t.scrollIntoView("previousSibling"===r)}};if("ArrowLeft"===t||"ArrowRight"===t){const e=c(n,r,o);e&&l(e)}else if("ArrowUp"===t||"ArrowDown"===t){const e=function(e,t,a){const n=s(e);let r=null,l=null,o=null;for(let d=c(e,t,a);d;d=c(d,t,a)){const e=s(d);if(Math.floor(e.y)===Math.floor(n.y))continue;if(r&&Math.floor(e.y)>Math.floor(l.y))break;const t=(C=n,i=e,Math.pow(C.x-i.x,2)+Math.pow(C.y-i.y,2));(!o||t<o)&&(o=t,l=e,r=d)}var C,i;return r}(n,r,o);if(e)n.tabIndex=-1,e.tabIndex=0,e.focus();else if("ArrowUp"===t){l(o>0?i(n,o):n.parentNode.firstChild)}else{l(o>0?i(n,o,"lastChild"):n.parentNode.lastChild)}}else if("Home"===t){l(o>0?i(n,o):n.parentNode.firstChild)}else if("End"===t){l(o>0?i(n,o,"lastChild"):n.parentNode.lastChild)}else if("PageDown"===t||"PageUp"===t){let e=n;for(let t=0;c(e,r,o)&&t<5;e=c(e,r,o))t++;l(e)}}),[d,o]);(0,r.useKeyDownEffect)(t,{key:["up","down","left","right","pageup","pagedown","home","end"]},u,[t,u,...a])}},74926:(e,t,a)=>{"use strict";a.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=a(69845),r=a(11950),l=a(80934),o=a(28154),C=a(38375),i=a(11650);const __WEBPACK_DEFAULT_EXPORT__=e=>{const{updateElementById:t}=(0,o.useStory)((e=>{let{actions:t}=e;return{updateElementById:t.updateElementById,combineElements:t.combineElements}})),a=(0,C.default)(),{isMedia:s}=(0,l.getDefinitionForType)(e.type);return{hasShapeMask:s&&e?.mask?.type!==r.MaskTypes.RECTANGLE,removeShapeMask:(0,n.useCallback)((()=>{if(!e)return;const n=(0,i.default)(e,["x","y","width","height","scale","rotationAngle"]);a("shape",{...n,mask:{type:e.mask.type}}),t({elementId:e.id,properties:{mask:{type:r.MaskTypes.RECTANGLE}}})}),[e,a,t])}}},36382:(e,t,a)=>{"use strict";a.d(t,{getTimeTracker:()=>i.default,initializeTracking:()=>n.default,trackClick:()=>r.default,trackError:()=>l.default,trackEvent:()=>o.default,trackTiming:()=>C});var n=a(49388);a(57714),a(60946);a(49379);var r=a(36864),l=a(68729),o=a(5532);const C=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"click";(0,o.default)(n,{value:t,event_category:e,event_label:a})};a(87438);var i=a(26962)},52264:(e,t,a)=>{"use strict";a.d(t,{TransformProvider:()=>C,useTransform:()=>i,useTransformHandler:()=>s});var n=a(67294),r=(a(70560),a(67602),a(30005),a(16054),a(69845));const l=(0,r.createContext)({actions:{},state:{}});const o=e=>{if(null===e)return!0;return 1===Object.keys(e).length&&"dropTargets"in e},C=function TransformProvider(e){let{children:t}=e;const a=(0,r.useRef)({}),C=(0,r.useRef)({}),[i,s]=(0,r.useState)(!1),c={state:{isAnythingTransforming:i},actions:{registerTransformHandler:(0,r.useCallback)(((e,t)=>{const n=a.current,r=n[e]||(n[e]=[]);return r.push(t),()=>{r.splice(r.indexOf(t),1)}}),[]),pushTransform:(0,r.useCallback)(((e,t)=>{const n=a.current,r=C.current,l=n[e];if(l&&l.forEach((e=>e(t))),r[e]=null===t?null:{...r[e]
|
||
|
(0,o.__)("Please choose only %s as a poster.","web-stories"),(0,Pt.default)(s)));const p=[C&&"upload","hotlink"].filter(Boolean);return l.createElement(l.Fragment,null,l.createElement(nt.Headline,{as:"label",size:K.TextSize.XXSmall},(0,o.__)("Cover Preview","web-stories")),l.createElement(Dt,{width:232,height:c},l.createElement(Nt,{width:232,height:c},t?.url?l.createElement(Bt,{crossOrigin:"anonymous",decoding:"async",src:t.url,width:t.width,height:t.height,alt:(0,o.__)("Preview image","web-stories"),"data-testid":"story_preview_featured_media"}):l.createElement(Ft,null),l.createElement(zt,null),l.createElement(Ht,null,l.createElement(Vt,null,l.createElement(Ut,null,a?.url?.length>0&&l.createElement(jt,{crossOrigin:"anonymous",decoding:"async",width:a.width,height:a.height,src:a.url,alt:(0,o.__)("Publisher Logo","web-stories")}),l.createElement(Gt,{onChange:d,title:(0,o.__)("Select as poster image","web-stories"),hotlinkTitle:(0,o.__)("Use external image as poster image","web-stories"),hotlinkInsertText:(0,o.__)("Use image as poster image","web-stories"),hotlinkInsertingText:(0,o.__)("Using image as poster image","web-stories"),buttonInsertText:(0,o.__)("Select as poster image","web-stories"),type:r,ariaLabel:(0,o.__)("Poster image","web-stories"),onChangeErrorText:u,imgProps:t,variant:kt.MediaVariant.None,menuOptions:p,cropParams:{width:640,height:853}})),l.createElement(Wt,null,e&&l.createElement($t,null,e),i&&l.createElement(Yt,{"data-testid":"story_preview_publisher"},i)))))))};var Xt=a(21608),Kt=a(67978),Qt=a(2783),Jt=a(192);const ea=e=>{let{handleReviewChecklist:t}=e;const a=(0,Qt.useCategoryCount)(Kt.ISSUE_TYPES.PRIORITY);return l.createElement(Jt.ToggleButton,{MainIcon:Xt.default,label:(0,o.__)("Checklist","web-stories"),"aria-label":(0,o.__)("Checklist","web-stories"),popupZIndexOverride:it.Z_INDEX_STORY_DETAILS,onClick:t,notificationCount:a})},ta=i.default.div.withConfig({displayName:"content__Main",componentId:"sc-1d1lm9j-0"})(["display:grid;min-width:917px;width:100%;height:calc(100% - "," - ",");grid-template-columns:30.5% 34% 35.5%;grid-template-rows:auto;grid-template-areas:'preview mainPanel sidePanel' 'footer mainPanel sidePanel';"],"1px",ot),aa=i.default.div.withConfig({displayName:"content___StoryPreview",componentId:"sc-1d1lm9j-1"})(["grid-area:preview;margin:20px 18px 0 32px;"]),na=i.default.div.withConfig({displayName:"content___MainStoryInfo",componentId:"sc-1d1lm9j-2"})(["grid-area:mainPanel;display:flex;flex-direction:column;padding:0 16px;overflow-y:scroll;gap:34px;& > section{border:none;& > h2{padding-top:0;padding-bottom:2px;& > button{height:1em;}}}"]),ra=i.default.div.attrs({role:"tabpanel"}).withConfig({displayName:"content__PanelContainer",componentId:"sc-1d1lm9j-3"})(["grid-area:sidePanel;height:100%;margin-left:18px;background-color:",";border-bottom-right-radius:",";overflow-y:scroll;",";"],(e=>{let{theme:t}=e;return t.colors.bg.secondary}),(e=>{let{theme:t}=e;return t.borders.radius.medium}),E.scrollbarCSS),la=i.default.div.withConfig({displayName:"content__Footer",componentId:"sc-1d1lm9j-4"})(["grid-area:footer;display:flex;align-items:flex-end;margin:0 18px 20px 32px;"]),oa=e=>{let{handleReviewChecklist:t}=e;const{DocumentPane:a,id:n}=(0,ht.default)((e=>{let{data:t}=e;return t?.modalSidebarTab||{}})),r=(0,Je.useHasChecklist)();return l.createElement(ta,null,l.createElement(aa,null,l.createElement(qt,null)),l.createElement(na,null,l.createElement(At,null)),a&&l.createElement(ra,{"aria-label":(0,o.__)("Story Settings","web-stories"),id:n},l.createElement(a,null)),r&&l.createElement(la,null,l.createElement(ea,{handleReviewChecklist:t})))},Ca=i.default.div.withConfig({displayName:"publishModal__Container",componentId:"sc-16gvo2-0"})(["height:100%;color:",";background-color:",";border:",";border-radius:",";"],h.theme.colors.fg.primary,h.theme.colors.bg.primary,`1px solid ${h.theme.colors.divider.primary}`,h.theme.borders.radius.medium);const ia=function PublishModal(e){let{isOpen:t,onPublish:a,onClose:n,publishButtonDisabled:r,hasFutureDate:C}=e;const i=(0,Je.useCheckpoint)((e=>{let{act
|
||
|
(0,o._n)("Duration between %1$d and %2$d second.","Duration between %1$d and %2$d seconds.",ja.MAX,"web-stories"),ja.MIN,ja.MAX))))};const Wa=function PageAdvancementPanel(e){let{nameOverride:t}=e;const{globalPageDuration:a}=(0,P.useConfig)(),{autoAdvance:n,defaultPageDuration:r,updateStory:C}=(0,L.useStory)((e=>{let{state:{story:{autoAdvance:t,defaultPageDuration:n}},actions:{updateStory:r}}=e;return{autoAdvance:t,defaultPageDuration:n||a,updateStory:r}})),i=(0,b.useCallback)((e=>{const{pageDuration:t,...a}=e,n={...a,defaultPageDuration:t};C({properties:n})}),[C]);return l.createElement(Ga,{panelName:t||"pageAdvancement",collapsedByDefault:!1,onUpdate:i,autoAdvance:n,pageDuration:r},(0,o.__)("Control whether a story auto-advances between pages, or whether the reader has to manually tap to advance.","web-stories"))};var $a=a(99270),Ya=a(18275),qa=a(98309);const Xa={MIN:1,MAX:200},Ka=(0,i.default)(yt.Row).withConfig({displayName:"slug__PermalinkRow",componentId:"sc-12ylqoy-0"})(["margin-bottom:12px;input{color:",";:active,:focus,:focus-visible{color:",";}}"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary}),(e=>{let{theme:t}=e;return t.colors.fg.primary})),Qa=i.default.div.withConfig({displayName:"slug__LinkContainer",componentId:"sc-12ylqoy-1"})(["margin-bottom:16px;"]);const Ja=function SlugPanel(e){let{nameOverride:t}=e;const{slug:a,link:n,permalinkConfig:r,updateStory:C}=(0,L.useStory)((e=>{let{state:{story:{slug:t="",link:a,permalinkConfig:n}},actions:{updateStory:r}}=e;return{slug:(0,qa.safeDecodeURIComponent)(t),link:a,permalinkConfig:n,updateStory:r}})),[i,s]=(0,b.useState)(a);(0,b.useEffect)((()=>{s(a)}),[a]);const c=(0,b.useCallback)((e=>{const t=e.slice(0,Xa.MAX);C({properties:{slug:(0,z.default)(t)}})}),[C]),d=(0,b.useCallback)((e=>s((0,z.default)(e.target.value,!0))),[]),u=(0,b.useCallback)((e=>c(e.target.value)),[c]),p=i&&r&&((e,t)=>{let{MIN:a,MAX:n}=t;return e>=a&&e<=n})(i.length,Xa)?r.prefix+i+r.suffix:n;return l.createElement(vt.SimplePanel,{name:t||"permalink",title:(0,o.__)("Permalink","web-stories"),collapsedByDefault:!1},r&&l.createElement(Ka,null,l.createElement($a.default,{value:String(i),onChange:d,onBlur:u,placeholder:(0,o.__)("Enter slug","web-stories"),"aria-label":(0,o.__)("URL slug","web-stories"),minLength:Xa.MIN,maxLength:Xa.MAX,containerStyleOverride:Ba.inputContainerStyleOverride})),l.createElement(Qa,null,l.createElement(Ya.Link,{rel:"noopener noreferrer",target:"_blank",href:n,size:K.TextSize.Small},p)))};var en,tn,an,nn,rn=a(26157),ln=a(78574),on=a(6025),Cn=a(66163);function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},sn.apply(this,arguments)}const SvgRotate=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",sn({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,en||(en=l.createElement("path",{fill:"currentColor",d:"M22.02 21.785a.5.5 0 0 0-.687-.727l.687.727Zm-5.68 1.244c-3.262 0-6.01-2.124-6.891-5.023l-.957.29c1.01 3.321 4.146 5.733 7.849 5.733v-1Zm4.993-1.971a7.248 7.248 0 0 1-4.992 1.971v1a8.249 8.249 0 0 0 5.679-2.244l-.687-.727Z"})),tn||(tn=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M8.5 24v-5.647h5.647"})),an||(an=l.createElement("path",{fill:"currentColor",d:"M10.51 10.215a.5.5 0 0 0 .686.728l-.686-.728Zm5.679-1.244c3.262 0 6.01 2.124 6.891 5.023l.957-.29c-1.01-3.321-4.145-5.733-7.848-5.733v1Zm-4.993 1.972A7.248 7.248 0 0 1 16.19 8.97v-1a8.249 8.249 0 0 0-5.68 2.244l.687.728Z"})),nn||(nn=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,d:"M24.03 8v5.647h-5.648"})))},cn=(0,l.memo)(SvgRotate);var dn,un=a(21126);function pn(){return pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}retu
|
||
|
(0,o.__)("Please choose only %s to insert into page.","web-stories"),(0,Pt.default)(m)),w=(0,b.useCallback)((e=>{let{src:t,id:l,mimeType:o,needsProxy:C,length:i,lengthFormatted:s}=e;const c={resource:{src:t,id:l,mimeType:o,length:i,lengthFormatted:s,needsProxy:C}};n&&(c.tracks=[]),r&&(c.loop=!0),a(c)}),[n,r,a]),L=(0,b.useCallback)((async e=>{let{link:t,hotlinkInfo:a,needsProxy:n}=e;const{mimeType:r}=a,l=p({needsProxy:n},t),o=await(0,rn.default)(l),{length:C,lengthFormatted:i}=(0,ln.default)(o);w({src:t,mimeType:r,length:C,lengthFormatted:i,needsProxy:n}),u(!1),(0,_.trackEvent)(ar,{event_label:t,file_size:a.fileSize,file_type:a.mimeType,needs_proxy:n}),u(!1)}),[p,w]),S=(0,b.useCallback)((e=>(0,_.trackError)(ar,e?.message)),[]),I=(0,b.useCallback)((e=>{a({...t,tracks:e})}),[t,a]),T=(0,b.useCallback)((e=>{a({...t,loop:e.target.checked})}),[t,a]),x=(0,b.useCallback)((e=>{let t=[];if(e){const a=g.findIndex((t=>{let{id:a}=t;return a===e}));t=[...g.slice(0,a),...g.slice(a+1)]}I(t)}),[g,I]),A=(0,b.useCallback)((e=>{let{src:t="",id:a,needsProxy:n=!1}=e;const r={track:t,trackId:a,id:(0,Sa.default)(),kind:"captions",srclang:"",label:"",needsProxy:n};I([r])}),[I]),k=(0,b.useCallback)((e=>l.createElement(Jn,{onClick:e,type:M.ButtonType.Secondary,size:M.ButtonSize.Small,variant:M.ButtonVariant.Rectangle},(0,o.__)("Upload an audio file","web-stories"))),[]),Z=(0,b.useCallback)((e=>l.createElement(Jn,{onClick:e,type:M.ButtonType.Secondary,size:M.ButtonSize.Small,variant:M.ButtonVariant.Rectangle},(0,o.__)("Upload audio captions","web-stories"))),[]),R=(0,b.useCallback)((()=>{E.current&&E.current.pause(),a(null)}),[a,E]),O=[s&&{label:(0,o.__)("Upload a file","web-stories"),value:"upload",onClick:ae.noop,mediaPickerProps:{onSelect:w,onSelectErrorMessage:(0,o.__)("Please choose a VTT file to use as caption.","web-stories"),type:i,title:(0,o.__)("Upload an audio file","web-stories"),buttonInsertText:(0,o.__)("Select audio file","web-stories")}},{label:(0,o.__)("Link to a file","web-stories"),value:"hotlink",onClick:()=>{u(!0)}}].filter(Boolean);return l.createElement(l.Fragment,null,!f?.src&&l.createElement(er,{spaceBetween:!1},s&&l.createElement(c,{onSelect:w,onSelectErrorMessage:v,type:i,title:(0,o.__)("Upload an audio file","web-stories"),buttonInsertText:(0,o.__)("Select audio file","web-stories"),render:k}),l.createElement(Jn,{variant:M.ButtonVariant.Rectangle,type:M.ButtonType.Secondary,size:M.ButtonSize.Small,onClick:()=>u(!0)},(0,o.__)("Link to audio file","web-stories"))),f?.src&&l.createElement(l.Fragment,null,l.createElement(Nn,{id:f.id,src:f.src,title:f.src.split("/").pop(),isExternal:!f.id,options:O,onRemove:R,removeItemLabel:(0,o.__)("Remove file","web-stories")},l.createElement(Kn,{title:f.src.substring(f?.src.lastIndexOf("/")+1),src:y,mimeType:f.mimeType,tracks:g,audioId:C,playerRef:E,loop:h})),n&&l.createElement(l.Fragment,null,l.createElement(tr,null,(0,o.__)("Caption and Subtitles","web-stories")),l.createElement(Vn,{captionText:(0,o.__)("Upload a file","web-stories"),tracks:g||[],handleChangeTrack:A,handleRemoveTrack:x,renderUploadButton:Z})),r&&f?.length>0&&l.createElement(l.Fragment,null,l.createElement(tr,null,(0,o.__)("Options","web-stories")),l.createElement(yt.Row,{spaceBetween:!1},l.createElement(Un.default,{loop:h,onChange:T})))),l.createElement(Cn.default,{title:(0,o.__)("Insert external background audio","web-stories"),isOpen:d,onError:S,onSelect:L,onClose:()=>u(!1),allowedFileTypes:m,insertText:(0,o.__)("Use audio file","web-stories"),insertingText:(0,o.__)("Selecting audio file","web-stories"),canUseProxy:!n&&!r}))},rr=(0,i.default)(X.Text.Paragraph).attrs({size:K.TextSize.Small}).withConfig({displayName:"backgroundAudio__HelperText",componentId:"sc-1n4veap-0"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.secondary}));const lr=function BackgroundAudioPanel(e){let{nameOverride:t}=e;const{capabilities:{hasUploadMediaAction:a}}=(0,W.useConfig)(),{backgroundAudio:n,updateStory:r}=(0,L.useStory)((e=>{let{state:{story:{backgroundAudio:t}},actions:{updateStory:a}}=e;return{backgroundAudio:t,updateStory:a}
|
||
|
(0,o.__)("%s added.","web-stories"),a.labels.singular_name)),p(!1),A(),L(u)}),[r,x,m,t,A,g,u,a,R]),D=(0,b.useCallback)(((e,t)=>h(t)),[]);(0,b.useEffect)((()=>{const e=_.current;if(e){const t=e=>{"Enter"===e.key&&O(e)};return e.addEventListener("keypress",t),()=>{e.removeEventListener("keypress",t)}}return null}),[O,_]),(0,b.useEffect)((()=>{M&&w.current.focus()}),[M]);const N=(0,b.useMemo)((()=>(0,yt.makeFlatOptionTree)(d,S)),[d,S]),B=(0,b.useMemo)((()=>[{value:dr,label:(0,o._x)("None","parent taxonomy","web-stories")}].concat(N).map((e=>{let{$level:t,label:a,...n}=e;return{...n,label:`${Array.from({length:t},(()=>"— ")).join("")} ${a}`}}))),[N]);return l.createElement(ur,null,l.createElement(Cr,null,a.labels.name),l.createElement(yt.HierarchicalInput,{inputValue:S,onInputChange:T,label:a.labels.searchItems,options:N,onChange:k,noOptionsText:a.labels?.notFound}),n?l.createElement(l.Fragment,null,!u&&l.createElement(ir,{ref:w,"aria-expanded":!1,onClick:Z},a.labels.addNewItem),u?l.createElement(pr,{ref:_,onSubmit:O},l.createElement($a.default,{name:a.labels.newItemName,label:a.labels.newItemName,value:m,onChange:P,hasFocus:y}),l.createElement(fr,{htmlFor:E},a.labels.parentItem),l.createElement(or.default,{id:E,ariaLabel:a.labels.parentItem,options:B,selectedValue:g,onMenuItemClick:D}),l.createElement(mr,null,l.createElement(gr,{disabled:!m.length,type:"submit"},a.labels.addNewItem),l.createElement(gr,{"aria-expanded":!0,onClick:Z},(0,o.__)("Cancel","web-stories")))):null):null)};var Er=a(63995),br=a(80900);a(16054);function yr(e){return e.replace(/( +)/g," ").trim()}function vr(e){const t=new Map;return e.forEach((e=>{t.set((0,z.default)(e),e)})),[...t.values()]}const _r="updateValue",wr="submitValue",Mr="removeTag",Lr="resetOffset",Sr="resetValue",Ir="incrementOffset",Tr="decrementOffset",xr="updateTags";const Ar=function(e,t){switch(t.type){case _r:{const a=t.payload.split(",");if(a.length<=1)return{...e,value:t.payload};const n=a.slice(0,-1).map(yr).filter((e=>e.length)),r=a[a.length-1];return function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>e.includes(t)))}(n,e.tags)?{...e,value:r}:{...e,value:r,tagBuffer:vr([...e.tags.slice(0,e.tags.length-e.offset),...n,...e.tags.slice(e.tags.length-e.offset)])}}case wr:{const a=yr(t?.payload||e.value);return""===a||e.tags.includes(a)?{...e,value:""}:{...e,value:"",tagBuffer:vr([...e.tags.slice(0,e.tags.length-e.offset),a,...e.tags.slice(e.tags.length-e.offset)])}}case Mr:{const a="string"==typeof t.payload?e.tags.findIndex((e=>e===t.payload)):e.tags.length-1-e.offset;return a<0?e:{...e,tagBuffer:[...e.tags.slice(0,a),...e.tags.slice(a+1,e.tags.length)]}}case Ir:return{...e,offset:(0,Da.clamp)(e.offset+1,{MIN:0,MAX:e.tags.length})};case Tr:return{...e,offset:(0,Da.clamp)(e.offset-1,{MIN:0,MAX:e.tags.length})};case Lr:return{...e,offset:0};case Sr:return{...e,value:""};case xr:{const a=e.tags.map((e=>[(0,z.default)(e),e])),n=t.payload.map((e=>[(0,z.default)(e),e]));if(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length===t.length&&e.every((e=>t.includes(e)))}(a.map((e=>{let[t]=e;return t})),n.map((e=>{let[t]=e;return t}))))return e;const r=a.filter((e=>{let[t]=e;return n.map((e=>{let[t]=e;return t})).includes(t)})).map((e=>{let[,t]=e;return t})),l=n.filter((e=>{let[t]=e;return!a.map((e=>{let[t]=e;return t})).includes(t)})).map((e=>{let[,t]=e;return t}));return{...e,tags:[...r,...l],tagBuffer:null}}default:return e}},kr=i.default.button.withConfig({displayName:"tag__Dismiss",componentId:"sc-14unxs6-0"})(["all:unset;cursor:pointer;border-radius:",";",";width:22px;min-width:22px;height:22px;display:flex;justify-content:center;align-items:center;svg{height:20px;width:20px;margin:auto;}"],(e=>{let{theme:t}=e;return t.borders.radius.small}),wa.focusableOutlineCSS),Zr=i.default.span.withConfig({displayName:"tag__Token",componentId:"sc-14unxs6-1"})([""," position:relative;display:flex;align
|
||
|
(0,o._n)("%d result found.","%d results found.",n,"web-stories"),n);g(r)}),300),y=(0,b.useMemo)((()=>c.filter((e=>e.taxonomy===t.slug)).filter((e=>void 0!==e)).map((e=>e.name))),[c,t]),v=(0,b.useCallback)((e=>i.filter((t=>t.name===e))?.[0]?.name),[i]);return(0,b.useEffect)((()=>{!async function(){const e=await s({taxonomy:t,args:{orderby:"count",order:"desc",hide_empty:!0}});r(e)}()}),[t,s]),l.createElement(l.Fragment,null,l.createElement(Cr,null,t.labels.name),l.createElement("div",{key:t.slug},l.createElement(jr.Label,{htmlFor:`${t.slug}-input`},t.labels.addNewItem),l.createElement(jr.Input,{id:`${t.slug}-input`,"aria-describedby":`${t.slug}-description`,name:t.slug,onTagsChange:h,onInputChange:E,tagDisplayTransformer:v,tokens:y,onUndo:p,suggestedTerms:m,suggestedTermsLabel:t?.labels?.itemsList}),l.createElement(jr.Description,{id:`${t.slug}-description`},t.labels.separateItemsWithCommas),n?.length>0&&l.createElement(cr.Wrapper,{"data-testid":`${t.slug}-most-used`},l.createElement(cr.Heading,null,t.labels.mostUsed),l.createElement(cr.List,null,n.map(((e,t)=>l.createElement(cr.ListItem,{key:e.id},l.createElement(cr.Word,{onClick:()=>{c.map((e=>{let{id:t}=e;return t})).includes(e.id)||d([e])}},e.name,t<n.length-1&&/* translators: delimiter used in a list */
|
||
|
(0,o.__)(",","web-stories")),t<n.length-1&&" ")))))))};function Wr(){return Wr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Wr.apply(this,arguments)}const $r=(0,i.default)(vt.SimplePanel).withConfig({displayName:"taxonomies__StyledSimplePanel",componentId:"sc-171mnp-0"})(["padding-left:0;padding-right:0;"]);const Yr=function TaxonomiesPanel(e){let{nameOverride:t,...a}=e;const{capabilities:n}=(0,W.useStory)((e=>{let{state:{capabilities:t}}=e;return{capabilities:t}})),{taxonomies:r}=G((e=>{let{state:{taxonomies:t}}=e;return{taxonomies:t}}));if(!r?.length)return null;const C=r.filter((e=>Boolean(n[`assign-${e?.restBase}`]||n[`assign-${e?.slug}`])));return 0===C.length?null:l.createElement($r,Wr({name:t||"taxonomies",title:(0,o.__)("Taxonomies","web-stories")},a),C.map((e=>{const t=Boolean(n[`create-${e?.restBase}`]||n[`create-${e?.slug}`]);return l.createElement(sr,{key:e.slug},e.hierarchical?l.createElement(hr,{taxonomy:e,canCreateTerms:t}):l.createElement(Gr,{taxonomy:e,canCreateTerms:t}))})))};var qr=a(11173),Xr=a(33088),Kr=a(88480),Qr=(a(37418),a(23953),a(36814),a(26707)),Jr=a(75141),el=a(34636),tl=a(97931);function al(){return al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},al.apply(this,arguments)}const nl=i.default.ul.attrs({role:"tablist","aria-orientation":"horizontal"}).withConfig({displayName:"tabview__Tabs",componentId:"sc-10d408-0"})(["display:flex;flex-direction:row;align-items:stretch;width:100%;max-width:100%;justify-content:space-between;margin:0;padding:0;list-style:none;border-bottom:1px solid ",";"],(e=>{let{theme:t}=e;return t.colors.divider.secondary})),rl=i.default.li.attrs((e=>{let{isActive:t}=e;return{tabIndex:t?0:-1,role:"tab","aria-selected":t}})).withConfig({displayName:"tabview__TabElement",componentId:"sc-10d408-1"})(["cursor:pointer;border:none;background:none;padding:0 4px;margin:","px 12px 9px;height:","px;display:flex;align-items:center;justify-content:center;position:relative;transition:color 0.2s ease;color:",";border-radius:",";",";:hover{color:",";}"," svg{display:block;width:32px;height:32px;margin:0 -4px;transform-origin:center center;transition:transform 0.3s ease,color 0.2s ease;color:",";border-radius:",";pointer-events:none;}svg.alert{width:","px;margin-left:4px;color:",";}span,svg:not(.alert){",";}&:hover span,&:hover svg:not(.alert),&:active span,&:active svg:not(.alert){color:",";}&:focus-visible{svg:not(.alert){background-color:",";}}"],10,32,(e=>{let{theme:t,isActive:a}=e;return a?t.colors.fg.primary:t.colors.fg.tertiary}),(e=>{let{theme:t}=e;return t.borders.radius.small}),(e=>{let{theme:t}=e;return wa.focusableOutlineCSS(t.colors.border.focus,t.colors.bg.secondary)}),(e=>{let{theme:t}=e;return t.colors.fg.primary}),(e=>{let{isActive:t,theme:a}=e;return t&&(0,i.css)(["::after{content:'';position:absolute;background-color:",";height:2px;border-radius:1px;bottom:-10px;left:4px;right:4px;}"],a.colors.border.selection)}),(e=>{let{theme:t}=e;return t.colors.fg.tertiary}),(e=>{let{theme:t}=e;return t.borders.radius.small}),28,(e=>{let{theme:t}=e;return t.colors.fg.primary}),(e=>{let{isActive:t,theme:a}=e;return t&&`color: ${a.colors.fg.primary}`}),(e=>{let{theme:t}=e;return t.colors.fg.primary}),(e=>{let{theme:t}=e;return t.colors.interactiveBg.tertiaryHover})),ll=(0,i.default)(nt.Headline).attrs({as:"p",size:K.TextSize.XXXSmall}).withConfig({displayName:"tabview__TabText",componentId:"sc-10d408-2"})(["color:inherit;"]);const ol=(0,b.forwardRef)((function UnreffedTab(e,t){let{children:a,tooltip:n=null,placement:r,refId:o,tabRefs:C,...i}=e;const{id:s}=i,c=s.includes("library")?Ot.TRACKING_EVENTS.LIBRARY_PANEL_CLICK:Ot.TRACKING_EVENTS.DESIGN_PANEL_CLICK;(0,tl.default)({node:C?.[o]?.current,eventData:{...c,label:`${o}_tab`}});const d=l.createElement(rl,al({ref:t},i),a);return null!==n?l.createElement(Ve.default,{t
|
||
|
(0,o.__)("Press %s to undo the last change","web-stories"),(0,Gl.prettifyShortcut)("mod+z"));const $l=()=>{const e=(0,W.useHistory)((e=>{let{actions:t}=e;return t.undo})),{addAnimations:t,copySelectedElement:a,copiedElementState:n,selectedElement:r,selectedElementType:l,selectedElementAnimations:C,updateSelectedElements:i,isSelectedElementBackground:s}=(0,W.useStory)((e=>{let{state:t,actions:a}=e;return{addAnimations:a.addAnimations,copiedElementState:t.copiedElementState,copySelectedElement:a.copySelectedElement,selectedElement:t.selectedElements?.[0],selectedElementType:t.selectedElements?.[0]?.type,isSelectedElementBackground:t.selectedElements?.[0]?.isBackground,selectedElementAnimations:t.selectedElementAnimations,updateSelectedElements:a.updateSelectedElements}})),c=(0,ue.useSnackbar)((e=>e.showSnackbar)),d=(0,b.useRef)(e);d.current=e;const u=(0,b.useCallback)((()=>{a(),c({actionLabel:(0,o.__)("Undo","web-stories"),dismissible:!1,message:(0,o.__)("Copied style.","web-stories"),onAction:()=>{d.current(),(0,_.trackEvent)("context_menu_action",{name:"undo_copy_styles",element:l,isBackground:s})},actionHelpText:Wl}),(0,_.trackEvent)("context_menu_action",{name:"copy_styles",element:l,isBackground:s})}),[a,c,l,s]),p=(0,b.useCallback)(((e,t)=>{i({properties:a=>{const n=(0,zl.default)(a,e,t),r=(0,Vl.default)({...a,...n});return{...n,...r}}})}),[i]),m=Ul({pushUpdate:p}),f=(0,b.useCallback)((()=>{const e=r?.id;if(!e||l!==n.type)return;const a=C.length?{...C[0],delete:!0}:void 0,u=n.animations.map((e=>({...e,id:(0,Sa.default)(),targets:[r.id]})));if(t({animations:u}),"text"===n.type&&n.styles.content){const e=function(e,t){const{textStyles:a}=(0,jl.getTextPresets)([e.styles],{textStyles:[],colors:[]},Ot.PRESET_TYPES.STYLE),{colors:n}=(0,jl.getTextPresets)([e.styles],{textStyles:[],colors:[]},Ot.PRESET_TYPES.COLOR),{content:r,...l}=e.styles;return{...l,...a[0],...n[0].color,animation:t,border:l.border||null}}(n,a);m(e)}else i({properties:e=>(0,zl.default)(e,{...n.styles,animation:a},!0)});c({actionLabel:(0,o.__)("Undo","web-stories"),dismissible:!1,message:(0,o.__)("Pasted style.","web-stories"),onAction:()=>{d.current(),(0,_.trackEvent)("context_menu_action",{name:"undo_paste_styles",element:l,isBackground:s})},actionHelpText:Wl}),(0,_.trackEvent)("context_menu_action",{name:"paste_styles",element:l,isBackground:s})}),[t,n,m,r,C,c,i,l,s]);return{copiedElementType:n?.type,handleCopyStyles:u,handlePasteStyles:f}};var Yl=a(10364);const ql=()=>{const{clearBackgroundElement:e,duplicateElementsById:t,selectedElements:a,setBackgroundElement:n,updateElementsById:r,deleteGroupById:l,addGroup:C,groups:i,elements:s,arrangeElement:c}=(0,W.useStory)((e=>{let{state:t,actions:a}=e;return{clearBackgroundElement:a.clearBackgroundElement,duplicateElementsById:a.duplicateElementsById,selectedElements:t.selectedElements,setBackgroundElement:a.setBackgroundElement,updateElementsById:a.updateElementsById,addGroup:a.addGroup,deleteGroupById:a.deleteGroupById,groups:t.currentPage.groups,elements:t.currentPage?.elements||[],arrangeElement:a.arrangeElement}})),d=(0,ue.useSnackbar)((e=>e.showSnackbar)),u=(0,W.useCanvas)((e=>{let{actions:t}=e;return t.setEditingElement})),p=(0,W.useHistory)((e=>{let{actions:t}=e;return t.undo})),m=(0,b.useRef)(p);m.current=p;return{handleDuplicateSelectedElements:(0,b.useCallback)((()=>{a.length&&(t({elementIds:a.map((e=>{let{id:t}=e;return t}))}),d({actionLabel:(0,o.__)("Undo","web-stories"),dismissible:!1,message:(0,o.__)("Duplicated elements.","web-stories"),onAction:()=>{m.current(),(0,_.trackEvent)("context_menu_action",{name:"undo_duplicate_elements",elements:a.map((e=>e.type))})},actionHelpText:Wl}),(0,_.trackEvent)("context_menu_action",{name:"duplicate_elements",elements:a.map((e=>e.type))}))}),[t,a,d]),handleGroupSelectedElements:(0,b.useCallback)((()=>{if(!a.length)return;const e=(0,Sa.default)(),t=(0,Yl.default)(i);C({groupId:e,name:t}),r({elementIds:a.map((e=>{let{id:t}=e;return t})),properties:t=>(0,zl.default)(t,{groupId:e},!0)});const n=Math.max(...a.map((e=>s.findIndex((t=>{let{id:a}=t;return a===e?.i
|
||
|
(0,o.__)("Automatic (%s)","web-stories"),Ot.HEADING_LEVELS[f]):(0,o.__)("Automatic","web-stories")},{value:"h1",label:Ot.HEADING_LEVELS.h1},{value:"h2",label:Ot.HEADING_LEVELS.h2},{value:"h3",label:Ot.HEADING_LEVELS.h3},{value:"p",label:Ot.HEADING_LEVELS.p}].map((e=>{const{value:a}=e;return{key:a,supportsIcon:!0,icon:g===a?l.createElement(Ia.default,null):null,label:l.createElement("span",null,e.label),onClick:()=>{d({properties:e=>({...e,tagName:a})})},...t}}))}),[a,t,d,g,c,f]);return h.length>0?{label:fo.HEADING_LEVEL,openSubMenu:()=>C(!0),closeSubMenu:()=>C(!1),isHeadingSubMenuOpen:r,headingSubMenuItems:r?h:[],SuffixIcon:n?Wo:Mo,...t}:null};function Yo(){return Yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Yo.apply(this,arguments)}const qo=function TextMenu(e){let{parentMenuRef:t}=e;const{copiedElementType:a,selectedElementType:n}=(0,W.useStory)((e=>{let{state:t}=e;return{copiedElementType:t.copiedElementState.type,selectedElementType:t.selectedElements?.[0].type}})),{handleCopyStyles:r,handlePasteStyles:o}=$l(),{handleDuplicateSelectedElements:C}=ql(),{canElementMoveBackwards:i,canElementMoveForwards:s,handleSendBackward:c,handleSendToBack:d,handleBringForward:u,handleBringToFront:p}=Kl(),{handleAddColorPreset:m,handleAddTextPreset:f}=no(),g=(0,b.useRef)(),h=(0,b.useRef)(),{menuPosition:E,onCloseMenu:y}=(0,Pl.default)(),v=To({menuPosition:E,isMenuOpen:!0}),{closeSubMenu:_,isSubMenuOpen:w,subMenuItems:M,...L}=v||{},S=$o({menuPosition:E,isMenuOpen:!0}),{closeHeadingSubMenu:I,isHeadingSubMenuOpen:T,headingSubMenuItems:x,...A}=S||{};return l.createElement(l.Fragment,null,v&&l.createElement(l.Fragment,null,l.createElement(so,Yo({closeSubMenu:_,parentMenuRef:t,subMenuRef:g,isSubMenuOpen:w},L)),l.createElement(Po,{ref:g,position:{x:(t.current.firstChild?.offsetWidth||Ro)+2,y:0}},l.createElement(co.default,{onDismiss:y,isOpen:w,onCloseSubMenu:_,"aria-label":Oo,isSubMenu:!0,parentMenuRef:t},M.map((e=>{let{key:t,...a}=e;return l.createElement(Co.default,Yo({key:t},a))})))),l.createElement(uo.default,null)),S&&l.createElement(l.Fragment,null,l.createElement(so,Yo({closeSubMenu:I,parentMenuRef:t,subMenuRef:h,isSubMenuOpen:T},A)),l.createElement(Po,{ref:h,position:{x:(t.current.firstChild?.offsetWidth||Ro)+2,y:40}},l.createElement(co.default,{onDismiss:y,isOpen:T,onCloseSubMenu:I,"aria-label":fo.HEADING_LEVEL,isSubMenu:!0,parentMenuRef:t},x.map((e=>{let{key:t,...a}=e;return l.createElement(Co.default,Yo({key:t},a))})))),l.createElement(uo.default,null)),l.createElement(po.default,{onClick:C},fo.DUPLICATE_ELEMENTS(1)),l.createElement(uo.default,null),l.createElement(po.default,{disabled:!i,onClick:c},fo.SEND_BACKWARD,l.createElement(mo.default,null,ho.SEND_BACKWARD.display)),l.createElement(po.default,{disabled:!i,onClick:d},fo.SEND_TO_BACK,l.createElement(mo.default,null,ho.SEND_TO_BACK.display)),l.createElement(po.default,{disabled:!s,onClick:u},fo.BRING_FORWARD,l.createElement(mo.default,null,ho.BRING_FORWARD.display)),l.createElement(po.default,{disabled:!s,onClick:p},fo.BRING_TO_FRONT,l.createElement(mo.default,null,ho.BRING_TO_FRONT.display)),l.createElement(ko,null),l.createElement(Ao,null),l.createElement(xo,null),l.createElement(Zo,null),l.createElement(uo.default,null),l.createElement(po.default,{onClick:r},fo.COPY_STYLES,l.createElement(mo.default,null,ho.COPY_STYLES.display)),l.createElement(po.default,{disabled:a!==n,onClick:o},fo.PASTE_STYLES,l.createElement(mo.default,null,ho.PASTE_STYLES.display)),l.createElement(po.default,{onClick:f},fo.ADD_TO_TEXT_PRESETS),l.createElement(po.default,{onClick:m},fo.ADD_TO_COLOR_PRESETS))};function Xo(){return Xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Xo.apply(this,arguments)}const Ko=function ProductMenu(e){let{parentMenuRef:t}=e;const{canElementMoveBackwards:a,canElementMoveForwards:n,handleSendBackwa
|
||
|
(0,o._n)("%s result found.","%s results found.",p,"web-stories"),p)),!f&&l.createElement(UC,null,l.createElement(BC,null),l.createElement(PC,null),m&&l.createElement(Ve.default,{title:(0,o.__)("Upload","web-stories")},l.createElement(yt.MediaUploadButton,{renderButton:y,onInsert:h}))))),!C||a.length||n.length?l.createElement(gC,{providerType:"local",canEditMedia:m,resources:a,uploadingResources:n,isMediaLoading:r,isMediaLoaded:C,hasMore:t,onInsert:E,setNextPage:c,searchTerm:s}):l.createElement(uC.MediaGalleryMessage,null,f?(0,o.__)("No results found.","web-stories"):(0,o.__)("No media found.","web-stories")),l.createElement(_C,null)))};const $C=function MediaIcon(){return l.createElement(oC.default,{title:(0,o.__)("Media Gallery","web-stories")})};var YC=a(95104),qC=a(13013);const XC=function TermsDialog(){const e=yC.localStore.getItemByKey(yC.LOCAL_STORAGE_PREFIX.TERMS_MEDIA3P),[t,a]=(0,b.useState)(!e),n=(0,b.useCallback)((()=>{a(!1),yC.localStore.setItemByKey(yC.LOCAL_STORAGE_PREFIX.TERMS_MEDIA3P,!0),(0,_.trackEvent)("media3p_terms_acknowledged")}),[]);(0,b.useEffect)((()=>{a(!e)}),[e]);const r=(0,b.useCallback)((e=>{(0,_.trackClick)(e,"click_terms_of_service")}),[]);return e?null:l.createElement(C.default,{isOpen:t,contentLabel:(0,o.__)("Third party stock content terms","web-stories"),onClose:n,ariaHideApp:!1,onPrimary:n,primaryText:(0,o.__)("Dismiss","web-stories")},l.createElement(X.Text.Paragraph,{size:K.TextSize.Small},l.createElement(qC.default,{mapping:{a:l.createElement(Ya.Link,{size:K.TextSize.Small,href:"https://wp.stories.google/docs/terms/",rel:"noreferrer",target:"_blank","aria-label":(0,o.__)("Learn more by visiting Web Stories for WordPress","web-stories"),onClick:r})}},(0,o.__)("Your use of stock content is subject to third party terms. <a>Learn more.</a>","web-stories"))))},KC=(0,hC.getPaneId)("media3p");function QC(){return QC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},QC.apply(this,arguments)}const JC=(0,i.default)(X.Text.Span).withConfig({displayName:"providerTab__StyledText",componentId:"sc-1muzdn0-0"})(["color:inherit;"]),ei=i.default.button.withConfig({displayName:"providerTab__Tab",componentId:"sc-1muzdn0-1"})(["padding:6px 16px;background:none;border:none;color:",";position:relative;cursor:pointer;:hover{color:",";}border-radius:",";",";",""],(e=>{let{theme:t}=e;return t.colors.fg.secondary}),(e=>{let{theme:t}=e;return t.colors.fg.primary}),(e=>{let{theme:t}=e;return t.borders.radius.x_large}),Ba.focusStyle,(e=>{let{$isActive:t,theme:a}=e;return t&&(0,i.css)(["::after{content:'';position:absolute;background-color:",";height:2px;border-radius:1px;bottom:-17px;left:16px;right:16px;}"],a.colors.border.selection)}));const ti=function ProviderTab(e){let{name:t,isActive:a,...n}=e;return l.createElement(ei,QC({$isActive:a},n),l.createElement(JC,{size:K.TextSize.Small},t))},ai=i.default.div.attrs({role:"tablist"}).withConfig({displayName:"providerTabList__Section",componentId:"sc-19jgogw-0"})(["display:flex;flex-wrap:wrap;margin-top:16px;margin-bottom:16px;padding:0 1em;"]);const ni=function ProviderTabList(e){let{providers:t}=e;const{isRTL:a}=(0,P.useConfig)(),n=(0,b.useRef)(),{selectedProvider:r,setSelectedProvider:o}=(0,YC.default)((e=>{let{media3p:{state:{selectedProvider:t},actions:{setSelectedProvider:a}}}=e;return{selectedProvider:t,setSelectedProvider:a}})),[C,i]=(0,b.useState)(0),s=t.length;(0,b.useEffect)((()=>i(t.indexOf(r))),[t,r]);const c=(0,b.useCallback)((e=>{if(!n.current)return;n.current.children[e].focus()}),[]),d=(0,b.useCallback)((()=>o({provider:t[C]})),[C,o,t]),u=a?-1:1;return(0,pe.useKeyDownEffect)(n,"left",(()=>c((C-u+s)%s)),[c,C,u,s]),(0,pe.useKeyDownEffect)(n,"right",(()=>c((C+u+s)%s)),[c,C,u,s]),(0,pe.useKeyDownEffect)(n,"home",(()=>c(0)),[c]),(0,pe.useKeyDownEffect)(n,"end",(()=>c(s-1)),[c,s]),(0,pe.useKeyDownEffect)(n,["enter","space"],d,[d]),l.createElement(ai,{ref:n},t.map(((e,t)=>l.createElement(ti,{key:e,index:t,name:pC.PROVIDERS[e]
|
||
|
(0,o.__)("Apply preset: %s","web-stories"),t):null},L(),S&&!E&&l.createElement(_i.default,null),l.createElement(vi.default,{cloneElement:Yi,cloneProps:{children:L({fontSize:f(c),isClone:!0}),width:m(a.width),lineHeight:Math.ceil(f(c))},elementProps:a,type:"text",onClick:M}))},Xi=(0,hC.getPaneId)("text");var Ki=a(82223),Qi=a(61695),Ji=a(60238),es=a(98489),ts=a(98910);const as=(0,Qi.dataFontEm)(1),ns="text";const rs=function(e){let{shouldUseSmartColor:t}=e;const{insertElement:a}=tC((e=>({insertElement:e.actions.insertElement}))),{state:{versionNumber:n}}=(0,W.useHistory)(),r=(0,Jr.getHTMLFormatters)(),{setColor:l}=r,[o,C]=(0,b.useState)(null),[i,s]=(0,b.useState)(null),c=(0,b.useRef)(null),d=(0,ce.useCalculateAccessibleTextColors)();(0,b.useEffect)((()=>{c.current?.element&&!c.current.versionNumber?c.current.versionNumber=n:c.current?.versionNumber&&(c.current=null)}),[n]);const u=(0,b.useCallback)((e=>{const{y:t}=e;if(!c.current)return t;const{element:{height:a,y:n}}=c.current;let r=n+a+as;const{width:l,height:o}=(0,es.default)(ns,e.width,e.height,{...e,y:r});return r+o>=oe.PAGE_HEIGHT&&(r=t),{width:l,height:o,y:r}}),[]);(0,b.useEffect)((()=>{if(o&&i){const{content:e}=i,{color:t,backgroundColor:n}=o,r=n?{backgroundColor:{color:n},backgroundTextMode:Ql.BACKGROUND_TEXT_MODE.HIGHLIGHT,padding:(0,ts.applyHiddenPadding)(i)}:null,d={...i,content:t?l(e,{color:t}):e,...r},u=a(ns,{...d,height:(0,Ji.calculateTextHeight)(d,d.width)});c.current={versionNumber:null,element:u},C(null),s(null)}}),[o,i,a,l]);const p=(0,b.useCallback)((async function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isPositioned:r,accessibleColors:l}=n,o=r?{}:u(e);if(t){if(s({...e,...o}),l)return void C(l);C(await d({...e,...o}))}else{const t=a(ns,{...e,...o});c.current={versionNumber:null,element:t}}}),[u,d,t,a]);return{getPosition:u,insertPreset:p}};const ls=function(e){switch(e.length){case 0:return"";case 1:return e[0];case 2:return(0,Zt.default)(/* translators: %1$s: first item of list. %2$s: second item of list. */
|
||
|
(0,o.__)("%1$s and %2$s","web-stories"),e[0],e[1]);default:return(0,Zt.default)(/* translators: %1$s: is a comma separated list. %2$s: last entry in list */
|
||
|
(0,o.__)("%1$s, and %2$s","web-stories"),e.slice(0,e.length-1).join(/* translators: delimiter used in a list */
|
||
|
(0,o.__)(", ","web-stories")),e[e.length-1])}},os=i.default.div.withConfig({displayName:"common__FullWidthWrapper",componentId:"sc-10l2iqe-0"})(["margin-left:-",";margin-right:-",";"],hC.PANE_PADDING,hC.PANE_PADDING);function Cs(e){return Array.from(new Set(e.map((e=>{let{elements:t=[]}=e;return t.map((e=>Ql.elementIs.text(e)?e.font.family:null))})).flat().filter(Boolean)))||[]}const is=(0,i.css)(["margin-top:38px;padding-top:2px;width:100%;height:100%;"]),ss=i.default.div.withConfig({displayName:"virtualizedPanelGrid__VirtualizedWrapper",componentId:"sc-qhv222-0"})(["height:",";width:100%;position:relative;"],(e=>{let{height:t}=e;return`${t}px`}));ss.propTypes={height:Ie().number.isRequired};const cs=i.default.div.withConfig({displayName:"virtualizedPanelGrid__VirtualizedContainer",componentId:"sc-qhv222-1"})(["position:absolute;top:0;left:",";display:grid;grid-template-columns:1fr 1fr;grid-template-columns:",";grid-template-rows:",";gap:","px;width:calc(100% - ",");height:100%;margin-top:4px;"],(e=>{let{paneLeft:t=0}=e;return t}),(e=>{let{columnWidth:t}=e;return`\n repeat(auto-fill, ${t}px)`}),(e=>{let{rowHeight:t}=e;return`minmax(${t}px, auto)`}),(e=>{let{rowGap:t=12}=e;return t}),(e=>{let{paneLeft:t=0}=e;return t}));cs.propTypes={columnWidth:Ie().number.isRequired,rowHeight:Ie().number.isRequired,rowGap:Ie().number,paneLeft:Ie().oneOfType([Ie().string,Ie().number])};var ds,us,ps,ms=a(51093);function fs(){return fs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},fs.apply(this,arguments)}const SvgDesertBw=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",fs({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 274 118","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,ds||(ds=l.createElement("path",{fill:"#767E80",d:"M59.68 117.706 8.551 106.934C2.505 105.66-.951 99.261 1.3 93.506l1.18-3.019a10 10 0 0 1 7.987-6.268l78.794-10.544a10.003 10.003 0 0 0 2.525-.683l82.061-34.244a10 10 0 0 1 8.263.255l56.296 27.675c.436.215.886.397 1.349.545l26.84 8.637c9.132 2.939 9.287 15.804.228 18.962l-26.529 9.248c-.819.285-1.671.463-2.536.529L62.497 117.892a9.985 9.985 0 0 1-2.818-.186Z"})),us||(us=l.createElement("path",{fill:"#ADB1B3",fillRule:"evenodd",d:"M224 26a4 4 0 0 1 4-4h2a4 4 0 0 1 4 4v31h4V44a2 2 0 0 1 2-2h1a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-7v17h-10V49h-7a2 2 0 0 1-2-2V31a2 2 0 0 1 2-2h1a2 2 0 0 1 2 2v13h4V26ZM120.857 53.178a2.143 2.143 0 0 1 4.286 0v14.25h1.714v-5.357a1.072 1.072 0 0 1 2.143 0V68.5a1.146 1.146 0 0 1-.048.319 1.073 1.073 0 0 1-1.023.753h-2.786v5.892h-4.286v-7.892h-2.786A1.073 1.073 0 0 1 117 66.5v-6.429a1.072 1.072 0 0 1 2.143 0v5.358h1.714v-12.25ZM64.786 8a8 8 0 0 1 8-8h.428a8 8 0 0 1 8 8v34.643h6.572V22a4 4 0 0 1 4-4H92a4 4 0 0 1 4 4v24.857a4 4 0 0 1-4 4H81.214v42.786H64.786V78.857H54a3.987 3.987 0 0 1-2.828-1.171A3.988 3.988 0 0 1 50 74.857V50a4 4 0 0 1 4-4h.214a4 4 0 0 1 4 4v20.643h6.572V8Z",clipRule:"evenodd"})),ps||(ps=l.createElement("circle",{cx:213,cy:72,r:13,fill:"#E4E5E6"})))},gs=(0,l.memo)(SvgDesertBw),hs=i.default.div.withConfig({displayName:"emptyContentMessage__Message",componentId:"sc-vwmhk4-0"})(["display:flex;flex-direction:column;align-items:center;max-width:400px;margin:8vh auto;text-align:center;*{text-align:center;margin:0 auto;}"]),Es=(0,i.default)(gs).withConfig({displayName:"emptyContentMessage__EmptyImage",componentId:"sc-vwmhk4-1"})(["margin-bottom:48px;"]);const bs=function EmptyContentMessage(e){let{children:t,...a}=e;return l.createElement(hs,a,l.createElement(Es,{"aria-hidden":!0,width:274,height:118}),t)};var ys=a(78720),vs=a(90996),_s=a(78651);function ws(e,t){return e?{content:t?`<span style="color: #fff">${e}<span>`:e}:{}}function TextSetContainer(e){let{pageSize:t,children:a}=e;return t?l.createElement(vs.default,{pageSize:t},a):a}const Ms=function TextSetElements(e){let{elements:t,isForDisplay:a,pageSize:n}=e;const{textSetHeight:r,textSetWidth:o}=t[0],C=a?(oe.PAGE_WIDTH-o)/2:0,i=a?(oe.PAGE_WIDTH-r)/2:0;r
|
||
|
(0,o._n)("Text set %1$s with %2$s font","Text set %1$s with %2$s fonts",t.length,"web-stories"),ks[a],ls(t)),elements:n}}))}),[]),f=(0,b.useMemo)((()=>m(r?p():d?n?.[d]:s)),[d,n,s,m,p,r]),g=(0,b.useMemo)((()=>[{id:null,label:(0,o._x)("All","text sets","web-stories")},...Object.keys(n).map((e=>({id:e,label:ks[e]??e})))]),[n]),h=(0,fn.default)(),E=(0,b.useCallback)((e=>{u(e),h(null===e?(0,o.__)("Show all text sets","web-stories"):(0,Zt.default)(/* translators: %s: filter category name */
|
||
|
(0,o.__)("Selected text set filter %s","web-stories"),ks[e])),yC.localStore.setItemByKey(yC.LOCAL_STORAGE_PREFIX.TEXT_SET_SETTINGS,{selectedCategory:e}),i.current=!0}),[h]),y=(0,b.useCallback)((()=>{requestAnimationFrame((()=>C((e=>!e)))),i.current=!0}),[C]);(0,b.useEffect)((()=>{i.current&&(0,_.trackEvent)("search",{search_type:"textsets",search_term:"",search_category:d,search_filter:r?"show_in_use":void 0})}),[d,r]);const v=(0,b.useMemo)((()=>`section-${(0,Sa.default)()}`),[]),w=(0,b.useMemo)((()=>`toggle_text_sets_${(0,Sa.default)()}`),[]),M=(0,b.useMemo)((()=>r?(0,o.__)("No matching Text Sets available. Try adding text to your story.","web-stories"):(0,o.__)("No Text Sets available.","web-stories")),[r]);return l.createElement(cC,{id:v},l.createElement(Os,null,l.createElement(nt.Headline,{as:"h2",size:K.TextSize.XXXSmall},Zs.TITLE),l.createElement(Ds,null,l.createElement(X.Text.Label,{htmlFor:w,size:K.TextSize.Small},Zs.SWITCH_LABEL),l.createElement(Ra,{id:w,"aria-label":Zs.SWITCH_LABEL,name:w,checked:r,onChange:y}))),l.createElement(os,null,l.createElement(hC.ChipGroup,{items:g,selectedItemId:d,selectItem:E,deselectItem:()=>E(null),ariaLabel:(0,o.__)("Select filter for text sets list","web-stories")})),l.createElement(Ns,null,f?.length||a?l.createElement(Rs,{paneRef:t,filteredTextSets:f}):l.createElement(bs,null,M)))};var Fs=a(57685),zs=a(73829);const Hs=function(e){let{activeIndex:t,setActiveIndex:a,groupRef:n}=e;(0,pe.useKeyDownEffect)(n,{key:["up","down","left","right"]},(e=>{let{key:r}=e;if(n.current){const e=((e,t)=>{switch(e){case"ArrowUp":return-t;case"ArrowDown":return t;case"ArrowLeft":return-1;case"ArrowRight":return 1;default:return 0}})(r,2),l=n.current.querySelectorAll("button:not([disabled])"),o=l.length-1,C=(t??0)+e,i=Math.max(0,Math.min(o,C));a(i),l[i]&&l[i].focus()}}),[t,a,n])},Vs=i.default.button.withConfig({displayName:"styleItem__PresetButton",componentId:"sc-157dmik-0"})(["background-color:",";border-color:transparent;position:relative;cursor:pointer;border-width:0;border-radius:4px;padding:3px;height:100%;width:100%;display:flex;justify-content:center;align-items:center;> svg{width:","px;height:","px;position:absolute;top:calc(50% - ","px);left:calc(50% - ","px);color:",";filter:drop-shadow(0px 0px 4px rgba(0,0,0,0.4));}",""],(e=>{let{theme:t}=e;return t.colors.interactiveBg.secondaryNormal}),32,32,16,16,(e=>{let{theme:t}=e;return t.colors.fg.primary}),Ba.focusStyle),Us=i.default.span.withConfig({displayName:"styleItem__HighLight",componentId:"sc-157dmik-1"})(["padding:0 2px;"," box-decoration-break:clone;"],(e=>{let{background:t}=e;return(0,Te.default)(t)})),js=i.default.div.withConfig({displayName:"styleItem__TextWrapper",componentId:"sc-157dmik-2"})(["position:relative;display:inline-block;line-height:","px;max-height:","px;overflow:hidden;border-radius:4px;padding:3px;max-width:100%;"," font-size:12px;",""],20,43,(e=>{let{styles:t}=e;return t}),(e=>{let{background:t}=e;return t?(0,Te.default)(t):null}));const Gs=function StyleItem(e){let{style:t,i:a,activeIndex:n,handleOnClick:r,isEditMode:C,activeItemOverlay:i,applyLabel:s=(0,o.__)("Apply style","web-stories")}=e;const c=(0,L.useStory)((e=>{let{state:t}=e;return t.selectedElements})),[d,u]=(0,b.useState)(!1),p=()=>{i&&u(!0)},m=()=>{i&&u(!1)};if(!t)return null;const f=c[0]?.content?(0,$e.stripHTML)(c[0].content):(0,o.__)("Lorem ipsum dolor sit amet","web-stories");return l.createElement(Vs,{tabIndex:n===a?0:-1,style:t,onClick:()=>r(t),onPointerEnter:p,onFocus:p,onPointerLeave:m,onBlur:m,"aria-label":C?(0,o.__)("Delete style","web-stories"):s},(()=>{const e=t.backgroundTextMode===Ql.BACKGROUND_TEXT_MODE.HIGHLIGHT,a=t.backgroundTextMode===Ql.BACKGROUND_TEXT_MODE.FILL;return l.createElement(js,{styles:(0,jl.generatePresetStyle)(t,!0),background:a?t.backgroundColor:null},e?l.createElement(Us,{background:t.backgroundColor},f):f)})(),C&&l.createElement(at.default,null),!C&&d&&i)};function Ws(){return Ws=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnPro
|
||
|
(0,o._x)("%1$s %2$s","page template title","web-stories"),a.title,Rc[a.type].name),[c,d]=(0,b.useState)(!1);return l.createElement(Nc,{ref:t,role:"listitem"},l.createElement(Bc,Dc({columnWidth:n,tabIndex:r?0:-1,"aria-label":s,onPointerEnter:()=>d(!0),onPointerLeave:()=>d(!1),onFocus:()=>{d(!0),C?.()},onBlur:()=>d(!1)},i),a.png&&l.createElement(zc,{src:a.png,alt:(0,Zt.default)(/* translators: 1: page title */
|
||
|
(0,o.__)("Snapshot of page template for %1$s","web-stories"),a.title),crossOrigin:"anonymous",decoding:"async",draggable:!1}),c&&l.createElement(_i.default,null),a.title&&l.createElement(Fc,null,l.createElement(X.Text.Span,{size:K.TextSize.Small},s))))}));Hc.displayName="DefaultPageTemplate";const Vc=Hc;var Uc=a(25941),jc=a(43394),Gc=a(30952),Wc=a(12161);const $c=function DeleteDialog(e){let{onClose:t,onDelete:a}=e;return l.createElement(C.default,{isOpen:!0,onClose:t,title:(0,o.__)("Delete Page Template","web-stories"),secondaryText:(0,o.__)("Cancel","web-stories"),onPrimary:a,primaryText:(0,o.__)("Delete","web-stories")},l.createElement(X.Text.Paragraph,{size:K.TextSize.Small},(0,o.__)("Are you sure you want to delete this template? This action cannot be undone.","web-stories")))},Yc=i.default.form.withConfig({displayName:"nameDialog__InputWrapper",componentId:"sc-pqbhqw-0"})(["margin:16px 4px;width:470px;height:100px;"]);const qc=function NameDialog(e){let{onClose:t,onSave:a,title:n,placeholder:r,previousInput:i}=e;const[s,c]=(0,b.useState)(i);return l.createElement(C.default,{isOpen:!0,title:n,primaryText:(0,o.__)("Save","web-stories"),onPrimary:()=>{a(s)},secondaryText:(0,o.__)("Cancel","web-stories"),onSecondary:t,onClose:t},l.createElement(Yc,{onSubmit:e=>{e.preventDefault(),a(s)}},l.createElement($a.default,{onChange:e=>{c(e.target.value)},value:s,label:(0,o.__)("Template name","web-stories"),placeholder:r,type:"text"})))},Xc=(0,i.default)(hC.ActionButton).withConfig({displayName:"dropDownMenu__MoreButton",componentId:"sc-xiyx7c-0"})(["top:4px;right:4px;"]),Kc=i.default.div.withConfig({displayName:"dropDownMenu__DropDownContainer",componentId:"sc-xiyx7c-1"})(["margin-top:10px;"]),Qc=i.default.div.withConfig({displayName:"dropDownMenu__MenuContainer",componentId:"sc-xiyx7c-2"})(["z-index:1;"]),Jc=(0,i.css)(["min-width:160px;margin-top:0;li{display:block;}"]),ed="rename",td="delete";const ad=function(e){let{display:t,isMenuOpen:a,onMenuOpen:n,onMenuCancelled:r,onMenuSelected:C,setParentActive:i=En.noop,onDelete:s,onUpdateName:c,previousName:d}=e;const u=[{options:[{label:(0,o.__)("Rename Template","web-stories"),value:ed},{label:(0,o.__)("Delete Template","web-stories"),value:td}]}],[p,m]=(0,b.useState)(!1),[f,g]=(0,b.useState)(!1),h=(0,b.useRef)(),E=(0,b.useCallback)((()=>{r(),h.current?.focus(),i()}),[r,i]),y=(0,b.useCallback)((()=>{m(!1),E()}),[m,E]),v=(0,b.useCallback)((()=>{g(!1),E()}),[g,E]),_=(0,b.useMemo)((()=>`list-${(0,Sa.default)()}`),[]),w=(0,b.useMemo)((()=>`button-${(0,Sa.default)()}`),[]);return l.createElement(Qc,null,h.current&&l.createElement(vn.default,{target:h.current}),l.createElement(Xc,{ref:h,onClick:n,"aria-label":(0,o.__)("More","web-stories"),"aria-pressed":a,"aria-haspopup":!0,"aria-expanded":a,"aria-owns":a?_:null,id:w,$display:t,tabIndex:t||a?0:-1},l.createElement(Wc.default,null)),(t||a)&&l.createElement(bn.default,{anchor:h,placement:Ct.Placement.BottomStart,isOpen:a},l.createElement(Kc,null,l.createElement(yn.default,{parentId:w,listId:_,handleMenuItemSelect:(e,t)=>{switch(e.stopPropagation(),C(),t){case ed:g(!0);break;case td:m(!0)}},groups:u,onDismissMenu:E,hasMenuRole:!0,menuStylesOverride:Jc}))),p&&l.createElement($c,{onClose:y,onDelete:s}),f&&l.createElement(qc,{onClose:v,onSave:e=>{c(e),v()},title:(0,o.__)("Rename Page Template","web-stories"),placeholder:d||(0,o.__)("Untitled","web-stories"),previousInput:d||""}))},nd=i.default.img.withConfig({displayName:"savedPageTemplate__TemplateImage",componentId:"sc-5hfe38-0"})(["width:100%;height:auto;"]),rd=i.default.div.withConfig({displayName:"savedPageTemplate__PageTemplateWrapper",componentId:"sc-5hfe38-1"})(["position:relative;height:","px;width:","px;cursor:pointer;",";",";"],(e=>{let{pageSize:t}=e;return t.height}),(e=>{let{pageSize:t}=e;return t.width}),(e=>{let{isHighlighted:t}=e;return t&&wa.focusCSS}),Ba.focusStyle);rd.propTypes={pageSize:Ae.PageSizePropType.isRequired};const ld=i.default.button.withConfig({displayName:"savedPageTemplate__PreviewPageWrapper",componentId:"sc-5hfe38-2"})(["position:relative;padding:0;border:
|
||
|
(0,o._n)("Only %d item can be added per page.","Only %d items can be added per page.",Ot.MAX_PRODUCTS_PER_PAGE,"web-stories"),Ot.MAX_PRODUCTS_PER_PAGE),mu=(0,o.__)("Products without images cannot be added.","web-stories"),TooltipWrapper=e=>{let{hasImage:t,disabled:a,children:n}=e;return t?a?l.createElement(Ve.default,{hasTail:!0,title:pu},n):n:l.createElement(Ve.default,{hasTail:!0,title:mu},n)};const fu=function ProductButton(e){let{product:t,onClick:a,onFocus:n,isOnPage:r,canAddMore:C}=e;const i=(0,Zt.default)(/* translators: %s: product title. */
|
||
|
(0,o.__)("Add %s","web-stories"),t?.productTitle),s=Boolean(t?.productImages?.length),c=(0,Zt.default)(/* translators: %s: product title. */
|
||
|
(0,o.__)("Remove %s","web-stories"),t?.productTitle),d=!r&&!C;let u="";return u=s?r?c:d?pu:i:mu,l.createElement(TooltipWrapper,{hasImage:s,disabled:d},l.createElement(uu,null,l.createElement(du,{"aria-label":u,"aria-disabled":!s||d,onClick:s&&!d?()=>{a(t,r)}:ae.noop,type:M.ButtonType.Tertiary,size:M.ButtonSize.Small,variant:M.ButtonVariant.Square,onFocus:n},r?l.createElement(l.Fragment,null,l.createElement(su,null),l.createElement(cu,null)):l.createElement(iu,null))))},gu=(0,i.default)(X.Text.Paragraph).attrs({size:K.TextSize.XSmall}).withConfig({displayName:"productPrice__StyledPrice",componentId:"sc-1b0ir4w-0"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary}));const hu=function ProductPrice(e){let{price:t,currency:a}=e;const{locale:{locale:n}}=(0,P.useConfig)();return t&&a&&n?l.createElement(gu,null,new Intl.NumberFormat(n,{style:"currency",currency:a}).format(t)):null},Eu=i.default.div.withConfig({displayName:"product__StyledDescription",componentId:"sc-1bhc150-0"})(["padding-left:12px;"]),bu=(0,i.default)(X.Text.Paragraph).attrs({size:K.TextSize.Small}).withConfig({displayName:"product__StyledTitle",componentId:"sc-1bhc150-1"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.primary}));const yu=function Product(e){let{product:t,onClick:a,onFocus:n,isOnPage:r,canAddMore:o}=e;return l.createElement(l.Fragment,null,l.createElement(fu,{product:t,isOnPage:r,canAddMore:o,onClick:a,onFocus:n}),l.createElement(ru,{product:t,draggable:!r&&o}),l.createElement(Eu,null,l.createElement(bu,{isBold:!0},t?.productTitle),l.createElement(hu,{price:t?.productPrice,currency:t?.productPriceCurrency})))},vu=i.default.div.withConfig({displayName:"productList__StyledListItem",componentId:"sc-16x13t7-0"})(["display:flex;width:100%;padding:5px 0;align-items:center;border-bottom:1px solid ",";transition:background-color ease-in-out 300ms;"],(e=>{let{theme:t}=e;return t.colors.divider.tertiary}));const _u=function ProductList(e){let{products:t=[],onPageProducts:a=[],onClick:n,isMenuFocused:r=!0}=e;const{handleListNav:C,currentRowsRef:i,setCurrentFocusIndex:s}=Kd({isMenuFocused:r,products:t});(0,b.useEffect)((()=>{r||s(0)}),[r,s]);const c=a.length<Ot.MAX_PRODUCTS_PER_PAGE;return l.createElement("div",{"aria-label":(0,o.__)("Products list","web-stories"),role:"list",onKeyDown:C},t.map(((e,t)=>l.createElement(vu,{role:"listitem",key:e?.productId,tabIndex:-1,ref:e=>i.current[`row-${t}`]=e},l.createElement(yu,{product:e,canAddMore:c,isOnPage:a.some((t=>t.product.productId===e?.productId)),onClick:n,onFocus:e=>{((e,t)=>{i.current[`row-${t}`]&&"focus"===e.type&&s(t)})(e,t)}})))))};var wu;function Mu(){return Mu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Mu.apply(this,arguments)}const SvgSort=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",Mu({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,wu||(wu=l.createElement("path",{fill:"currentColor",d:"M6 36v-3h12v3Zm0-21v-3h36v3Zm0 10.5v-3h24v3Z"})))},Lu=(0,l.memo)(SvgSort),Su=(0,i.default)(xn).withConfig({displayName:"productSort__StyledDropDownMenu",componentId:"sc-1apxa0h-0"})(["margin-left:12px;"]),Iu=(0,i.default)(Lu).withConfig({displayName:"productSort__StyledIcon",componentId:"sc-1apxa0h-1"})(["width:28px !important;height:28px !important;"]),Tu=(0,i.css)(["min-width:180px;margin-top:0;"]),xu=[{value:"date-desc",orderby:"date",order:"desc",label:(0,o.__)("Recently Added","web-stories")},{value:"title-asc",orderby:"title",order:"asc",label:(0,o.__)("Alphabetical: A-Z","web-stories")},{value:"title-desc",orderby:"title",order:"desc",label:(0,o.__)("Alphabetical: Z-A","web-stories")},{value:"price-asc",orderby:"price",order:"asc",label:(0,o.__)("Lowest Price","web-stories")},{value:"price-desc",orderby:"price",order:"desc",label:(0,o.__)("Highest Price","web-stories")}];const Au=function ProductSort(e){let{onChange:t,value:a="date-desc"}=e;const[n,r]=(0,b.use
|
||
|
(0,o.__)("%s added to page","web-stories"),e.productTitle);n(t)}),[c,n,s,a]),H=(0,b.useCallback)((e=>{const t=C.find((t=>t.product.productId===e.productId));if(t){i({elementId:t.elementId});const a=(0,Zt.default)(/* translators: %s: product title. */
|
||
|
(0,o.__)("%s removed","web-stories"),e?.productTitle);n(a)}}),[i,C,n]),V=(0,b.useCallback)(((e,t)=>t?H(e):z(e)),[H,z]),U=(0,b.useCallback)((()=>{E(""),R("",1,w,S)}),[R,S,w]),j=(0,b.useCallback)((()=>{f&&Z(h,y+1,w,S)}),[f,Z,S,w,y,h]),G=y>1?(0,o.__)("No more products","web-stories"):"";return l.createElement(hC.Pane,ku({id:qd},e),l.createElement(Section,{"data-testid":"products-library-pane",title:(0,o.__)("Products","web-stories")},l.createElement(yt.Row,null,l.createElement(Pu,null,(0,o.__)("This will add products as a tappable dot on your story.","web-stories"))),D&&l.createElement(yt.Row,null,l.createElement(CC.default,{"aria-label":(0,o.__)("Product search","web-stories"),inputValue:h,onChange:O,placeholder:(0,o.__)("Search","web-stories"),onKeyDown:F,onFocus:()=>x(!1),isOpen:!0,ariaClearLabel:(0,o.__)("Clear product search","web-stories"),clearId:"clear-product-search",handleClearInput:U}),l.createElement(Au,{onChange:B,value:`${w}-${S}`})),!d&&p&&l.createElement(Zu,null,l.createElement(Pc.default,Ru)),d&&A?.length>0&&l.createElement(l.Fragment,null,l.createElement(_u,{isMenuFocused:T,onClick:V,products:A,onPageProducts:C}),l.createElement(Yd.default,{allDataLoadedMessage:G,allDataLoadedAriaMessage:(0,o.__)("Products are loaded","web-stories"),onLoadMore:j,canLoadMore:f,isLoading:p,loadingSpinnerProps:Ru,loadingAriaMessage:(0,o.__)("Loading more products","web-stories")})),d&&!p&&0===A?.length&&l.createElement(Pu,null,(0,o.__)("No products found.","web-stories"))))};var Du=a(8753);const Nu=function ShoppingIcon(){return l.createElement(Du.default,{title:(0,o.__)("Shopping library","web-stories")})};var Bu=a(82961);const Fu={icon:$C,tooltip:(0,o.__)("Media","web-stories"),placement:Ct.Placement.BottomStart,Pane:WC,id:Bu.PANE_IDS.Media},zu={icon:fi,tooltip:(0,o.__)("Third-party media","web-stories"),Pane:di,id:Bu.PANE_IDS.Media3p},Hu={icon:kc,tooltip:(0,o.__)("Text","web-stories"),Pane:xc,id:Bu.PANE_IDS.Text},Vu={icon:Ui,tooltip:(0,o.__)("Shapes & Stickers","web-stories"),Pane:Fi,id:Bu.PANE_IDS.Shapes},Uu={icon:$d,tooltip:(0,o.__)("Page Templates","web-stories"),Pane:Ud,id:Bu.PANE_IDS.PageTemplates},ju={icon:Nu,tooltip:(0,o.__)("Shopping","web-stories"),Pane:Ou,id:Bu.PANE_IDS.Shopping},Gu=new Set([Fu,zu,Uu,Vu,Hu,ju].map((e=>e.id)));const Wu=function LibraryProvider(e){let{children:t}=e;const{showMedia3p:a,shoppingProvider:n,canViewDefaultTemplates:r}=(0,W.useConfig)(),{actions:{getMedia:o,getCustomPageTemplates:C}}=(0,W.useAPI)(),{hasProducts:i}=(0,W.useStory)((e=>{let{state:{currentPage:t}}=e;return{hasProducts:t?.elements?.some((e=>{let{type:t}=e;return t===Ql.ELEMENT_TYPES.PRODUCT}))}})),s=n&&"none"!==n||i,c=Boolean(C),d=r||c,u=Boolean(o),[p,m]=(0,b.useState)({}),[f,g]=(0,b.useState)({}),[h,E]=(0,b.useState)(null),[y,v]=(0,b.useState)(1),[w,M]=(0,b.useState)(!1),L=(0,b.useCallback)((e=>E((t=>(0,lC.default)("function"==typeof e?e(t):e,"templateId")))),[]),S=(0,b.useCallback)((e=>{E((t=>t.map((t=>t.templateId===e.templateId?{...t,...e}:t))))}),[]),I=(0,b.useMemo)((()=>[u&&Fu,a&&zu,Hu,Vu,s&&ju,d&&Uu].filter(Boolean)),[a,u,d,s]),[T,x]=(0,b.useState)(I[0].id),A=(0,El.useInsertElement)(),{insertTextSet:k,insertTextSetByOffset:Z}=(0,El.useInsertTextSet)(w),{highlightedTab:P}=(0,_t.useHighlights)((e=>{let{section:t}=e;return{highlightedTab:t}}));(0,b.useEffect)((()=>{Gu.has(P)&&(x(P),(0,_.trackEvent)("quick_action_tab_change",{name:P}))}),[P]);const R=(0,b.useRef)(null),O=(0,b.useRef)(null),D=(0,b.useRef)(null),N=(0,b.useRef)(null),B=(0,b.useRef)(null),F=(0,b.useRef)(null),z=(0,b.useMemo)((()=>({[Fu.id]:R,[zu.id]:O,[Hu.id]:D,[Vu.id]:N,[Uu.id]:B,[ju.id]:F})),[]),H=(0,b.useMemo)((()=>({state:{areTextSetsLoading:f,tab:T,tabRefs:z,textSets:p,savedTemplates:h,nextTemplatesToFetch:y,shouldUseSmartColor:w},actions:{setTab:x,insertElement:A,insertTextSet:k,insertTextSetByOffset:Z,setSavedTemplates:L,updateSavedTemplate:S,setNextTemplatesToFetch:v,setShouldUseSmartColor:M},data:{tabs:I}})),[f,T,z,p,h,A,k,Z,I,y,v,w,L,S]);return(0,b.useEffect)((()=>{let e=!0;return T!==Hu.id||Object.keys(p).length||async function(){const t=(0,_.getTi
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Pan Left","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,panDirection:xe.AnimationDirection.LeftToRight,gridSpace:cf.QUARTER,Effect:$m,size:16}},[of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.RightToLeft)]:{value:of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.RightToLeft),label:(0,o._x)("Pan Right","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Pan Right","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,panDirection:xe.AnimationDirection.RightToLeft,gridSpace:cf.QUARTER,Effect:qm,size:16}},[of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.BottomToTop)]:{value:of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.BottomToTop),label:(0,o._x)("Pan Up","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Pan Up","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,panDirection:xe.AnimationDirection.BottomToTop,gridSpace:cf.QUARTER,Effect:Jm,size:16}},[of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.TopToBottom)]:{value:of(xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,xe.AnimationDirection.TopToBottom),label:(0,o._x)("Pan Down","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Pan Down","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN.value,panDirection:xe.AnimationDirection.TopToBottom,gridSpace:cf.QUARTER,Effect:Km,size:16}},[of(xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleIn)]:{value:of(xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleIn),label:(0,o._x)("Zoom In","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Zoom In","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,zoomDirection:xe.ScaleDirection.ScaleIn,gridSpace:cf.HALF,Effect:tf,size:14}},[of(xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleOut)]:{value:of(xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleOut),label:(0,o._x)("Zoom Out","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Zoom Out","animation effect","web-stories")),value:xe.BACKGROUND_ANIMATION_EFFECTS.ZOOM.value,zoomDirection:xe.ScaleDirection.ScaleOut,gridSpace:cf.HALF,Effect:nf,size:20}},[xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.value]:{value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.value,label:xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.name),value:xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.value,zoomDirection:sf,Effect:lf,size:26}}},pf={NO_ANIMATION:{value:Cf,label:(0,o._x)("None","animation effect","web-stories")},[xe.ANIMATION_EFFECTS.DROP.value]:{value:xe.ANIMATION_EFFECTS.DROP.value,label:xe.ANIMATION_EFFECTS.DROP.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),xe.ANIMATION_EFFECTS.DROP.name),value:xe.ANIMATION_EFFECTS.DROP.value,Effect:wm}},[xe.ANIMATION_EFFECTS.FADE_IN.value]:{value:xe.ANIMATION_EFFECTS.FADE_IN.value,label:xe.ANIMATION_EFFECTS.FADE_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),xe.ANIMATION_EFFECTS.FADE_IN.name),value:xe.ANIMATION_EFFECTS.FADE_IN.value,Effect:Lm}},[of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.LeftToRight)]:{value:of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.LeftToRight),label:xe.ANIMATION_EFFECTS.FLY_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Fly In from Left","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.FLY_IN.value,flyInDirection:xe.AnimationDirection.LeftToRight,gridSpace:cf.QUARTER,Effect:Im,size:16}},[of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.TopToBottom)]:{value:of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.TopToBottom),label:xe.ANIMATION_EFFECTS.FLY_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Fly In from Top","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.FLY_IN.value,flyInDirection:xe.AnimationDirection.TopToBottom,gridSpace:cf.QUARTER,Effect:km,size:16}},[of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.BottomToTop)]:{value:of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.BottomToTop),label:xe.ANIMATION_EFFECTS.FLY_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Fly In from Bottom","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.FLY_IN.value,flyInDirection:xe.AnimationDirection.BottomToTop,gridSpace:cf.QUARTER,Effect:Pm,size:16}},[of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.RightToLeft)]:{value:of(xe.ANIMATION_EFFECTS.FLY_IN.value,xe.AnimationDirection.RightToLeft),label:xe.ANIMATION_EFFECTS.FLY_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Fly In from Right","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.FLY_IN.value,flyInDirection:xe.AnimationDirection.RightToLeft,gridSpace:cf.QUARTER,Effect:xm,size:16}},[xe.ANIMATION_EFFECTS.PULSE.value]:{value:xe.ANIMATION_EFFECTS.PULSE.value,label:xe.ANIMATION_EFFECTS.PULSE.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),xe.ANIMATION_EFFECTS.PULSE.name),value:xe.ANIMATION_EFFECTS.PULSE.value,Effect:Om}},[of(xe.ANIMATION_EFFECTS.ROTATE_IN.value,xe.AnimationDirection.LeftToRight)]:{value:of(xe.ANIMATION_EFFECTS.ROTATE_IN.value,xe.AnimationDirection.LeftToRight),label:(0,o._x)("Rotate","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Rotate In from Left","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.ROTATE_IN.value,rotateInDirection:xe.AnimationDirection.LeftToRight,gridSpace:cf.HALF,Effect:Nm,size:18}},[of(xe.ANIMATION_EFFECTS.ROTATE_IN.value,xe.AnimationDirection.RightToLeft)]:{value:of(xe.ANIMATION_EFFECTS.ROTATE_IN.value,xe.AnimationDirection.RightToLeft),label:(0,o._x)("Rotate","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Rotate In from Right","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.ROTATE_IN.value,rotateInDirection:xe.AnimationDirection.RightToLeft,gridSpace:cf.HALF,Effect:Fm,size:18}},[xe.ANIMATION_EFFECTS.TWIRL_IN.value]:{value:xe.ANIMATION_EFFECTS.TWIRL_IN.value,label:xe.ANIMATION_EFFECTS.TWIRL_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),xe.ANIMATION_EFFECTS.TWIRL_IN.name),value:xe.ANIMATION_EFFECTS.TWIRL_IN.value,Effect:Hm,size:26}},[of(xe.ANIMATION_EFFECTS.WHOOSH_IN.value,xe.AnimationDirection.LeftToRight)]:{value:of(xe.ANIMATION_EFFECTS.WHOOSH_IN.value,xe.AnimationDirection.LeftToRight),label:xe.ANIMATION_EFFECTS.WHOOSH_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Whoosh In from Left","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.WHOOSH_IN.value,whooshInDirection:xe.AnimationDirection.LeftToRight,gridSpace:cf.HALF,Effect:Um,size:20}},[of(xe.ANIMATION_EFFECTS.WHOOSH_IN.value,xe.AnimationDirection.RightToLeft)]:{value:of(xe.ANIMATION_EFFECTS.WHOOSH_IN.value,xe.AnimationDirection.RightToLeft),label:xe.ANIMATION_EFFECTS.WHOOSH_IN.name,animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Whoosh In from Right","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.WHOOSH_IN.value,whooshInDirection:xe.AnimationDirection.RightToLeft,gridSpace:cf.HALF,Effect:Gm,size:20}},[of(xe.ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleIn)]:{value:of(xe.ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleIn),label:(0,o._x)("Scale In","animation effect","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Scale In","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.ZOOM.value,scaleDirection:xe.ScaleDirection.ScaleIn,gridSpace:cf.HALF,Effect:tf,size:14}},[of(xe.ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleOut)]:{value:of(xe.ANIMATION_EFFECTS.ZOOM.value,xe.ScaleDirection.ScaleOut),label:(0,o.__)("Scale Out","web-stories"),animation:{ariaLabel:(0,Zt.default)(/* translators: %s: animation effect. */
|
||
|
(0,o.__)('"%s" Effect',"web-stories"),(0,o._x)("Scale Out","animation effect","web-stories")),value:xe.ANIMATION_EFFECTS.ZOOM.value,scaleDirection:xe.ScaleDirection.ScaleOut,gridSpace:cf.HALF,Effect:nf,size:20}}},mf={ariaLabel:Ie().string,value:Ie().string.isRequired,Effect:Ie().any,gridSpace:Ie().oneOf(Object.values(cf)),size:Ie().number,scaleDirection:Ie().oneOf(Object.values(xe.ScaleDirection)),panDirection:Ie().oneOf(Object.values(xe.AnimationDirection)),zoomDirection:Ie().oneOf(Object.values(xe.ScaleDirection)),flyInDirection:Ie().oneOf(Object.values(xe.AnimationDirection)),rotateInDirection:Ie().oneOf(Object.values(xe.AnimationDirection)),whooshInDirection:Ie().oneOf(Object.values(xe.AnimationDirection))},ff={value:Ie().string.isRequired,label:Ie().string.isRequired,animation:Ie().shape(mf)},gf=(Ie().oneOf([...Object.values(xe.AnimationDirection),...Object.values(xe.ScaleDirection),!1]),(e,t)=>{const a=Object.entries(t).filter((e=>{let[t]=e;return-1===df.indexOf(t)})).map((e=>{let[t,a]=e;return[t,a.options]})).reduce(((e,t)=>{let[a,n]=t;return[...e,...(n||[]).map((e=>of(a,e)))]}),[]);return Object.keys(e).filter((e=>a.includes(e)))}),hf=e=>Object.values(e).includes(sf),Ef=e=>{let{animation:t,disabledOptions:a=[]}=e;const n=t.panDirection&&!a.includes(t.panDirection)?t.panDirection:Object.values(xe.AnimationDirection).filter((e=>!a.includes(e)))?.[0]||void 0;return t.value===xe.BACKGROUND_ANIMATION_EFFECTS.PAN_AND_ZOOM.value?{...t,zoomDirection:a.includes(xe.ScaleDirection.ScaleIn)?xe.ScaleDirection.ScaleOut:xe.ScaleDirection.ScaleIn,panDirection:n}:t},bf=e=>{let{animation:t,disabledTypeOptionsMap:a}=e;return hf(t)?Ef({animation:t,disabledOptions:a[t.value]?.options}):t},yf=i.default.div.withConfig({displayName:"effectChooserDropdown__ContentWrapper",componentId:"sc-1d71y2l-0"})(["display:inline-block;"]),vf=i.default.li.withConfig({displayName:"effectChooserDropdown__AnimationListItem",componentId:"sc-1d71y2l-1"})(["border:none;background:",";border-radius:",";height:","px;position:relative;grid-column-start:",";overflow:hidden;font-family:'Teko',sans-serif;font-size:","px;line-height:1;color:",";text-transform:uppercase;transition:background 0.1s linear;margin:0;& > div{height:100%;display:flex;align-items:center;justify-content:center;text-align:center;}&[aria-disabled='true']{background:",";}&:hover:not([aria-disabled='true']){cursor:pointer;}&:hover:not([aria-disabled='true']),&:focus:not([aria-disabled='true']){background:",";","{display:inline-block;}","{display:none;}}"," ",";"],(e=>{let{active:t,theme:a}=e;return t?a.colors.interactiveBg.secondaryPress:a.colors.interactiveBg.secondaryNormal}),(e=>{let{theme:t}=e;return t.borders.radius.small}),56,(e=>{let{gridSpace:t}=e;return(e=>{switch(e){case cf.HALF:return"span 2";case cf.QUARTER:return"span 1";default:return"span 4"}})(t)}),(e=>{let{size:t=28}=e;return t}),(e=>{let{theme:t}=e;return t.colors.fg.primary}),(e=>{let{theme:t}=e;return t.colors.interactiveBg.disable}),(e=>{let{active:t,theme:a}=e;return t?a.colors.interactiveBg.secondaryPress:a.colors.interactiveBg.secondaryHover}),vm,yf,(e=>{let{noEffect:t}=e;return t&&(0,i.css)(["height:36px;font-size:14px;text-transform:none;","{display:inline-block !important;}"],yf)}),Ba.focusStyle),_f=(0,i.css)(["display:inline-block;margin-top:0;padding:16px 4px 16px 16px;ul{display:grid;justify-content:center;gap:12px 4px;grid-template-columns:repeat(4,1fr);position:relative;}"]),wf=e=>{let{theme:t}=e;return(0,i.css)(["margin:-1px -1px 0 -1px;width:calc(100% + 2px);border-color:transparent transparent "," transparent;height:","px;&:hover{border-color:transparent transparent "," transparent;}",""],t.colors.border.defaultNormal,45,t.colors.border.defaultNormal,Ba.focusStyle)};function Mf(){return Mf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Mf.apply(this,arguments)}const Lf=(0,b.forwardRef)(((e,t)=>{let{option:a,...n}=e;return l.createElement(vf,Mf({ref:t,"aria-label":a.animation
|
||
|
(0,o.__)("Filter: %s","web-stories"),a)},l.createElement(p,{element:t[0],getProxiedUrl:i,currentPageBackgroundColor:c}))}))),C!==Ql.OverlayType.NONE&&l.createElement(yt.Row,null,l.createElement(yt.Color,{label:(0,o.__)("Color","web-stories"),value:n,onChange:d,allowsGradient:!0,hasEyedropper:u})))},Eg=(0,i.default)(X.Text.Paragraph).withConfig({displayName:"imageAccessibility__StyledText",componentId:"sc-147toy8-0"})(["color:",";margin-bottom:10px;"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),bg={alt:null},yg={MAX:1e3};const vg=function ImageAccessibilityPanel(e){let{selectedElements:t,pushUpdate:a}=e;const n=(0,qr.useCommonObjectValue)(t,"resource",bg),r=(0,qr.getCommonValue)(t,"alt",n.alt),{highlight:C,resetHighlight:i,cancelHighlight:s}=(0,_t.useHighlights)((e=>({highlight:e[_t.states.AssistiveText],resetHighlight:e.onFocusOut,cancelHighlight:e.cancelEffect})));return l.createElement(_g,{onAnimationEnd:()=>i(),name:"imageAccessibility",title:(0,o.__)("Accessibility","web-stories"),isPersistable:!C,$_css:C&&wt.default.FLASH},l.createElement(Eg,{size:K.TextSize.Small},(0,o.__)("Add a brief description of the image.","web-stories")),l.createElement(yt.Row,null,l.createElement(yt.TextArea,{ref:e=>{e&&C?.focus&&C?.showEffect&&(e.addEventListener("keydown",s,{once:!0}),e.focus())},placeholder:r===Ot.MULTIPLE_VALUE?Ot.MULTIPLE_DISPLAY_VALUE:"",value:r||"",onChange:e=>a({alt:e?.target?.value?.trim()||null},!0),"aria-label":(0,o.__)("Assistive text","web-stories"),maxLength:yg.MAX,rows:2,isIndeterminate:r===Ot.MULTIPLE_VALUE})))};var _g=(0,i.default)(vt.SimplePanel).withConfig({displayName:"imageAccessibility___StyledSimplePanel",componentId:"sc-147toy8-1"})(["",""],(e=>e.$_css)),wg=a(64918),Mg=a(7601);const Lg=i.default.div.withConfig({displayName:"link__IconInfo",componentId:"sc-niusn4-0"})(["display:flex;flex-direction:column;margin-left:20px;"]),Sg=(0,i.default)(X.Text.Paragraph).withConfig({displayName:"link__IconText",componentId:"sc-niusn4-1"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.secondary})),Ig=i.default.span.withConfig({displayName:"link__Error",componentId:"sc-niusn4-2"})(["font-size:12px;line-height:16px;color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.negative})),Tg=(0,i.default)(yt.Switch).withConfig({displayName:"link__StyledSwitch",componentId:"sc-niusn4-3"})(["width:100%;"]);const xg=function LinkPanel(e){let{selectedElements:t,pushUpdateForObject:a}=e;const{clearEditing:n,setDisplayLinkGuidelines:r,displayLinkGuidelines:C}=(0,W.useCanvas)((e=>({clearEditing:e.actions.clearEditing,setDisplayLinkGuidelines:e.actions.setDisplayLinkGuidelines,displayLinkGuidelines:e.state.displayLinkGuidelines}))),{highlight:i,resetHighlight:s,cancelHighlight:c}=(0,_t.useHighlights)((e=>({highlight:e[_t.states.Link],resetHighlight:e.onFocusOut,cancelHighlight:e.cancelEffect}))),d=(0,W.useStory)((e=>{let{state:t}=e;return t?.pages?.map(((e,t)=>{let{id:a}=e;return{value:a,label:(0,Zt.default)(/* translators: %s: page number. */
|
||
|
(0,o.__)("Page %s","web-stories"),t+1)}})).filter((e=>{let{value:a}=e;return a!==t.currentPage?.id}))||[]})),{hasElementsInAttachmentArea:u}=(0,wg.default)(),p=(0,b.useMemo)((()=>(0,Mg.createLink)({icon:null,desc:null})),[]),m=(0,qr.useCommonObjectValue)(t,"link",p),f=(0,Mg.createLink)(m),{url:g="",desc:h="",icon:E,rel:y=[],type:v=Ql.LinkType.Regular,pageId:_=null}=f,[w,M]=(0,b.useState)(!1),[L,S]=(0,b.useState)(!1),{actions:{getLinkMetadata:I}}=(0,W.useAPI)(),{getProxiedUrl:T,checkResourceAccess:x}=(0,on.default)(),A=(0,b.useBatchingCallback)((e=>{let{newUrl:t,newTitle:n,newIcon:r,needsProxy:l}=e;return a("link",(()=>t?(0,Mg.createLink)({url:t,needsProxy:l,desc:n||"",icon:r?(0,qa.toAbsoluteUrl)(t,r):""}):null),p,!0)}),[a,p]),[k,Z]=(0,b.useState)(!(0,qa.isValidUrl)((0,qa.withProtocol)(g))),P=(0,b.useDebouncedCallback)((0,b.useCallback)((async e=>{if(e.startsWith("http://")||e.startsWith("https://")){M(!0);try{const{title:t,image:a}=I?await I(e):{},n=!!a&&await x(a);A({newUrl:e,newTitle:t,newIcon:a,needsProxy:n})}catch(e){Z(!0)}finally{M(!1)}}}),[x,I,A]),1200),R=(0,b.useCallback)(((e,t)=>{if(n(),P.cancel(),e.url){if(Ot.MULTIPLE_VALUE===e.url)return;const t=(0,qa.withProtocol)(e.url),a=(0,qa.isValidUrl)(t);Z(!a),a&&P(t)}a("link",""!==e.url?{...e}:null,p,t)}),[n,a,p,P]),O=(0,b.useCallback)((e=>{R({icon:e?.src},!0)}),[R]),D=Boolean(g?.length),N=D&&!k||v===Ql.LinkType.Branching&&_;(0,b.useEffect)((()=>{if(L){const e=D&&g!==Ot.MULTIPLE_VALUE;r(u&&!e)}}),[t,L,u,D,r,g]);const B=E?T(f,E):null,F=Ot.MULTIPLE_VALUE===v,z=Ot.MULTIPLE_VALUE===_,H=Ot.MULTIPLE_VALUE===g,V=Ot.MULTIPLE_VALUE===h,U=Ot.MULTIPLE_VALUE===y,j=(0,b.useCallback)((e=>R({rel:e},!0)),[R]),G=(0,b.useCallback)((()=>{R({type:v===Ql.LinkType.Regular?Ql.LinkType.Branching:Ql.LinkType.Regular},!0)}),[R,v]),$=(0,b.useCallback)(((e,t)=>{R({pageId:t},!0)}),[R]);return l.createElement(Ag,{name:"link",title:(0,o.__)("Link","web-stories"),onAnimationEnd:()=>s(),isPersistable:!i,$_css:i?.showEffect&&wt.default.FLASH},l.createElement(yt.Row,null,l.createElement(Tg,{groupLabel:(0,o.__)("Link Type","web-stories"),name:"link-type-switch",value:v===Ql.LinkType.Regular,onLabel:(0,o.__)("Link to website","web-stories"),offLabel:(0,o.__)("Link to story page","web-stories"),disabled:F,onChange:G})),v===Ql.LinkType.Branching?l.createElement(yt.Row,null,l.createElement(or.default,{ariaLabel:(0,o.__)("Page","web-stories"),dropDownLabel:(0,o.__)("Page","web-stories"),placeholder:(0,o.__)("Select Page","web-stories"),options:d,placement:Ct.Placement.TopStart,onMenuItemClick:$,selectedValue:_,disabled:!d.length||z})):l.createElement(yt.LinkInput,{ref:e=>{e&&i?.focus&&i?.showEffect&&(e.addEventListener("keydown",c,{once:!0}),e.focus())},onChange:e=>!C&&R({url:e},!e),onBlur:()=>{r(!1),S(!1)},onFocus:()=>{S(!0)},value:g||"",placeholder:H?Ot.MULTIPLE_DISPLAY_VALUE:(0,o.__)("Enter an address to apply a link","web-stories"),isIndeterminate:H,"aria-label":(0,o.__)("Element link","web-stories"),hasError:C}),C&&l.createElement(yt.Row,null,l.createElement(Ig,null,(0,o.__)("Link can not reside below the dashed line when a page attachment is present","web-stories"))),N&&l.createElement(l.Fragment,null,l.createElement(yt.Row,null,l.createElement($a.default,{placeholder:V?Ot.MULTIPLE_DISPLAY_VALUE:(0,o.__)("Optional description","web-stories"),onChange:e=>{let{target:t}=e;return R({desc:t.value},!t.value)},value:h,"aria-label":(0,o.__)("Link description","web-stories"),isIndeterminate:V,disabled:w,containerStyleOverride:Ba.inputContainerStyleOverride})),l.createElement(yt.Row,{spaceBetween:!1},l.createElement(yt.LinkIcon,{handleChange:O,icon:B,isLoading:w,disabled:w}),l.createElement(Lg,null,l.createElement(Sg,{size:K.TextSize.Small},(0,o.__)("Optional brand icon","web-stories")))),!U&&v===Ql.LinkType.Regular&&l.createElement(qr.LinkRelations,{onChangeRel:j,rel:y})))};var Ag=(0,i.default)(vt.SimplePanel).withConfig({displayName:"link___StyledSimplePanel",componentId:"sc-niusn4-4"})(["",""],(e=>e.$_css));const kg=function CustomPageAdvancementPanel(){const{isOverridden:e,autoAdvance:t,pageDuration:a,update
|
||
|
(0,o.__)("Automatic (%s)","web-stories"),Ot.HEADING_LEVELS[p]||Ot.MULTIPLE_DISPLAY_VALUE):(0,o.__)("Automatic","web-stories"),value:"auto"},{label:Ot.HEADING_LEVELS.h1,value:"h1"},{label:Ot.HEADING_LEVELS.h2,value:"h2"},{label:Ot.HEADING_LEVELS.h3,value:"h3"},{label:Ot.HEADING_LEVELS.p,value:"p"}];return l.createElement(vt.SimplePanel,{name:"textAccessibility",title:(0,o.__)("Accessibility","web-stories")},l.createElement(yt.Row,null,l.createElement(or.default,{"data-testid":"text-accessibility-dropdown",title:(0,o.__)("Heading Levels","web-stories"),dropdownButtonLabel:(0,o.__)("Heading Levels","web-stories"),options:h,selectedValue:g,placeholder:f?Ot.MULTIPLE_DISPLAY_VALUE:p,onMenuItemClick:s,dropDownLabel:(0,o.__)("Heading Level","web-stories")})),l.createElement(X.Text.Paragraph,{size:K.TextSize.XSmall},l.createElement(qC.default,{mapping:{a:l.createElement(Ya.Link,{href:(0,o.__)("https://wp.stories.google/docs/seo/","web-stories"),rel:"noreferrer",target:"_blank",onClick:i,size:K.TextSize.XSmall})}},(0,o.__)("<a>Learn more</a> about using headings in stories.","web-stories"))))};var _h,wh=a(93560),Mh=a(13903);function Lh(){return Lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Lh.apply(this,arguments)}const SvgLetterAHeight=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",Lh({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,_h||(_h=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M23.5 9.5a.5.5 0 1 0 0-1h-15a.5.5 0 0 0 0 1h15Zm-8.205 2.993a.747.747 0 0 1 .7-.493c.312 0 .591.196.7.492l2.525 6.867a.475.475 0 0 1-.44.641.47.47 0 0 1-.441-.315l-.668-1.886H14.33l-.667 1.886a.47.47 0 0 1-.442.315.475.475 0 0 1-.44-.641l2.515-6.866Zm2.063 4.412-1.028-2.883-.306-.84a.03.03 0 0 0-.058 0l-.295.84-1.028 2.883h2.715ZM24 23a.5.5 0 0 1-.5.5h-15a.5.5 0 0 1 0-1h15a.5.5 0 0 1 .5.5Z",clipRule:"evenodd"})))},Sh=(0,l.memo)(SvgLetterAHeight);var Ih;function Th(){return Th=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Th.apply(this,arguments)}const SvgLetterAWidth=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",Th({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,Ih||(Ih=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.5 8.5a.5.5 0 0 0-1 0v15a.5.5 0 0 0 1 0v-15ZM23 8a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-1 0v-15A.5.5 0 0 1 23 8Zm-7.705 4.493a.747.747 0 0 1 .7-.493c.312 0 .591.196.7.492l2.525 6.867a.475.475 0 0 1-.44.641.47.47 0 0 1-.441-.315l-.668-1.886H14.33l-.667 1.886a.47.47 0 0 1-.442.315.475.475 0 0 1-.44-.641l2.515-6.866Zm2.063 4.412-1.028-2.883-.306-.84a.03.03 0 0 0-.029-.02.03.03 0 0 0-.029.02l-.295.84-1.028 2.883h2.715Z",clipRule:"evenodd"})))},xh=(0,l.memo)(SvgLetterAWidth);var Ah,kh=a(3460),Zh=a(8160),Ph=a(71539),Rh=a(78440),Oh=a(55816),Dh=a(50214),Nh=a(33881);function Bh(){return Bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Bh.apply(this,arguments)}const SvgLetterTUppercase=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",Bh({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 33 32","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,Ah||(Ah=l.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.94 10a.5.5 0 0 1 .5-.5h5v13h-2.1a.5.5 0 0 0 0 1h5.2a.5.5 0 0 0 0-1h-2.1v-13h5a.5.5 0 0 1 .5.5v1.178a.5.5 0 1 0 1 0V10a1.5 1.5 0 0 0-1.5-1.5h-11a1.5 1.5 0 0 0-1.5 1.5v1.178a.5.5 0 0 0 1 0V10Zm15.12 0a.5.5 0 0 1 .5-.5h5v13h-2.1a.5.5 0 0 0 0 1h5.2a.5.5 0 0 0 0-1h-2.1v-13h5a.5.5 0 0 1 .5.5v1.178a.5.5 0 0 0 1 0V10a1.5 1.5 0 0 0-1.5-1.5h-11a1.5 1.5 0 0 0-1.5 1.5v1.1
|
||
|
(0,o.__)("Please choose only %s as a poster.","web-stories"),(0,Pt.default)(m))),e}),[m]),{highlightInput:h,highlightMediaPicker:E,resetHighlight:y,cancelHighlight:v}=(0,_t.useHighlights)((e=>({highlightInput:e[_t.states.AssistiveText],highlightMediaPicker:e[_t.states.VideoA11yPoster],resetHighlight:e.onFocusOut,cancelHighlight:e.cancelEffect})));let _=null;return C&&C!==Ot.MULTIPLE_VALUE&&i&&i!==Ot.MULTIPLE_VALUE&&(_={height:C,width:i}),l.createElement(HE,{onAnimationEnd:()=>y(),name:"videoAccessibility",title:(0,o.__)("Accessibility","web-stories"),isPersistable:!h&&!E,$_css:(h||E)&&wt.default.FLASH},l.createElement(yt.Row,null,l.createElement(NE,{ref:e=>{e&&E?.focus&&E?.showEffect&&e.focus()},value:c,cropParams:_,onChange:f,onChangeErrorText:g,title:(0,o.__)("Select as video poster","web-stories"),hotlinkTitle:(0,o.__)("Use external image as video poster","web-stories"),hotlinkInsertText:(0,o.__)("Use image as video poster","web-stories"),hotlinkInsertingText:(0,o.__)("Using image as video poster","web-stories"),buttonInsertText:(0,o.__)("Set as video poster","web-stories"),alt:(0,o.__)("Preview poster image","web-stories"),type:d,ariaLabel:(0,o.__)("Video poster","web-stories"),menuOptions:p,imgProps:_,canUpload:0!==p.length}),l.createElement(BE,null,l.createElement(FE,{size:K.TextSize.Small},(0,o.__)("Add a brief description of the video.","web-stories")),l.createElement(yt.TextArea,{ref:e=>{e&&h?.focus&&h?.showEffect&&(e.addEventListener("keydown",v,{once:!0}),e.focus())},placeholder:r===Ot.MULTIPLE_VALUE?Ot.MULTIPLE_DISPLAY_VALUE:"",value:r||"",onChange:e=>a({alt:e?.target?.value?.trim()||null},!0),"aria-label":(0,o.__)("Assistive text","web-stories"),maxLength:DE.MAX,rows:2,isIndeterminate:r===Ot.MULTIPLE_VALUE}))))};var HE=(0,i.default)(vt.SimplePanel).withConfig({displayName:"videoAccessibility___StyledSimplePanel",componentId:"sc-1uodz5m-3"})(["",""],(e=>e.$_css)),VE=a(36594),UE=a(40918),jE=a(86716);const GE=(0,i.default)(yt.Row).withConfig({displayName:"videoOptions__Row",componentId:"sc-csxmtu-0"})(["margin-top:2px;"]),WE=(0,i.default)(w.Button).withConfig({displayName:"videoOptions__StyledButton",componentId:"sc-csxmtu-1"})(["padding:12px 8px;"]),$E=(0,i.default)(WE).withConfig({displayName:"videoOptions__TrimButton",componentId:"sc-csxmtu-2"})(["margin-left:20px;"]),YE=i.default.div.withConfig({displayName:"videoOptions__TrimWrapper",componentId:"sc-csxmtu-3"})(["position:relative;display:flex;"]),qE=i.default.div.withConfig({displayName:"videoOptions__Spinner",componentId:"sc-csxmtu-4"})(["margin-left:4px;margin-top:4px;"]),XE=(0,i.default)(VE.default).withConfig({displayName:"videoOptions__StyledSlider",componentId:"sc-csxmtu-5"})(["width:100%;"]),KE=i.default.div.withConfig({displayName:"videoOptions__VolumeWrapper",componentId:"sc-csxmtu-6"})(["margin-bottom:20px;"]),QE=(0,i.default)(X.Text.Paragraph).attrs({size:K.TextSize.XSmall}).withConfig({displayName:"videoOptions__HelperText",componentId:"sc-csxmtu-7"})(["color:",";"],(e=>{let{theme:t}=e;return t.colors.fg.tertiary}));const JE=function VideoOptionsPanel(e){let{selectedElements:t,pushUpdate:a}=e;const n=(0,qr.getCommonValue)(t,"resource"),r=(0,qr.getCommonValue)(t,"id"),C=(0,qr.getCommonValue)(t,"loop"),i=(0,qr.getCommonValue)(t,"volume",1),s=1===t.length,c=(0,m.useFeature)("videoVolume")&&s&&!n?.isMuted,{state:{canTrim:d,canMute:u,isTrimming:p,isMuting:f,isDisabled:g},actions:{handleMute:h,handleTrim:E}}=(0,jE.default)({resource:n,elementId:r,isSingleElement:s}),y=f?(0,o.__)("Removing audio…","web-stories"):(0,o.__)("Remove audio","web-stories"),v=p?(0,o.__)("Trimming…","web-stories"):(0,o.__)("Trim","web-stories"),_=(0,fn.default)();(0,b.useEffect)((()=>{f&&_(y)}),[f,y,_]),(0,b.useEffect)((()=>{p&&_(v)}),[p,v,_]);const w=(0,b.useInitializedValue)((()=>`slide-${(0,Sa.default)()}`)),Processing=()=>l.createElement(qE,null,l.createElement(UE.default,{size:24}));return l.createElement(vt.SimplePanel,{name:"videoOptions",title:(0,o.__)("Video Settings","web-stories")},l.createElement(GE,{spaceBetween:!1},l.createElement(Un.default,{loop:C,onChan
|
||
|
(0,o.__)("Would you like to include it on a new post?","web-stories")))};const Db=function PostReviewDialog(){const{isFreshlyPending:e}=(0,L.useStory)((e=>{let{state:{meta:{isFreshlyPending:t}}}=e;return{isFreshlyPending:t}})),[t,a]=(0,b.useState)(!1);(0,b.useEffect)((()=>a(e)),[e]);const n=(0,b.useCallback)((()=>a(!1)),[]);return l.createElement(C.default,{isOpen:t,onClose:n,title:(0,o.__)("Submitted for Review.","web-stories"),primaryText:(0,o.__)("Dismiss","web-stories"),onPrimary:n},l.createElement(X.Text.Paragraph,{size:K.TextSize.Small},(0,o.__)("Your Story has been successfully submitted for review.","web-stories")))},Nb=(0,b.createContext)({state:{},actions:{}});const Bb=function(e){return(0,b.useContextSelector)(Nb,e??b.identity)},Fb=i.default.nav.withConfig({displayName:"buttons__ButtonList",componentId:"sc-1h0vadn-0"})(["display:flex;justify-content:flex-end;padding:1em;height:100%;"]),zb=i.default.div.withConfig({displayName:"buttons__List",componentId:"sc-1h0vadn-1"})(["display:flex;align-items:center;gap:8px;"]),Hb=i.default.div.withConfig({displayName:"buttons__Spinner",componentId:"sc-1h0vadn-2"})(["position:absolute;top:0;"]),Vb=i.default.div.withConfig({displayName:"buttons__IconWithSpinner",componentId:"sc-1h0vadn-3"})(["position:relative;"]);function Loading(){return l.createElement(Hb,null,l.createElement(UE.default,{size:32}))}function DraftButtons(e){let{forceIsSaving:t,hasUpdates:a}=e;return l.createElement(l.Fragment,null,l.createElement(va,{hasUpdates:a,forceIsSaving:t}),l.createElement(sa,{forceIsSaving:t}))}function PendingButtons(e){let{forceIsSaving:t,hasUpdates:a,canPublish:n}=e;return l.createElement(l.Fragment,null,l.createElement(ga,{forceIsSaving:t}),n&&l.createElement(va,{hasUpdates:a,forceIsSaving:t}),l.createElement(sa,{forceIsSaving:t}))}function PublishedButtons(e){let{forceIsSaving:t,hasUpdates:a}=e;return l.createElement(l.Fragment,null,l.createElement(ga,{forceIsSaving:t}),l.createElement(va,{hasUpdates:a,forceIsSaving:t}))}const Ub=function Buttons(){const{status:e,canPublish:t,isSaving:a}=(0,L.useStory)((e=>{let{state:{story:{status:t},meta:{isSaving:a},capabilities:n}}=e;return{status:t,isSaving:a,canPublish:Boolean(n?.publish)}})),n="pending"===e,r=["draft","auto-draft"].includes(e)||!e,o=r||n,{hasMetaBoxes:C,isSavingMetaBoxes:i}=Bb((e=>{let{state:{hasMetaBoxes:t,isSavingMetaBoxes:a}}=e;return{hasMetaBoxes:t,isSavingMetaBoxes:a}}));return l.createElement(Fb,null,l.createElement(zb,null,l.createElement(Undo,null),l.createElement(Redo,null),l.createElement(Vb,null,l.createElement(Xe,{forceIsSaving:i}),a&&l.createElement(Loading,null)),r&&l.createElement(DraftButtons,{forceIsSaving:i,hasUpdates:C}),n&&l.createElement(PendingButtons,{forceIsSaving:i,hasUpdates:C,canPublish:t}),!o&&l.createElement(PublishedButtons,{forceIsSaving:i,hasUpdates:C})))},jb=i.default.header.attrs({role:"group","aria-label":(0,o.__)("Story canvas header","web-stories")}).withConfig({displayName:"header__Background",componentId:"sc-1i9ezrs-0"})(["display:flex;align-items:center;justify-content:space-between;background-color:",";"],(e=>{let{theme:t}=e;return t.colors.bg.primary})),Gb=i.default.div.withConfig({displayName:"header__Head",componentId:"sc-1i9ezrs-1"})(["flex:1 1 auto;padding:1em;"]),Wb=i.default.div.withConfig({displayName:"header__ButtonCell",componentId:"sc-1i9ezrs-2"})(["grid-area:buttons;"]);const $b=(0,b.memo)((function HeaderLayout(){return l.createElement(jb,null,l.createElement(Gb,null,l.createElement(La,null)),l.createElement(Wb,null,l.createElement(Ub,null)))}));var Yb,qb,Xb=a(85703);function Kb(){return Kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Kb.apply(this,arguments)}const SvgLetterMOutline=e=>{let{title:t,titleId:a,...n}=e;return l.createElement("svg",Kb({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32","aria-labelledby":a},n),t?l.createElement("title",{id:a},t):null,Yb||(Yb=l.createElement("path",{fill:"currentColor",s
|
||
|
(0,o.__)("Please choose only %s as publisher logo.","web-stories")),D=R(/* translators: %s: list of allowed file types. */
|
||
|
(0,o.__)("Please choose only %s as a poster.","web-stories")),N=(0,b.forwardRef)(((e,t)=>{let{option:a,...n}=e;return a.props?a:l.createElement(fy.ListElement,Sy({value:a.id,ref:t},n),l.createElement(Ry,{src:a.url,alt:"",decoding:"async",crossOrigin:"anonymous"}))})),B=e=>l.createElement(fy.ListElement,{onClick:e,"aria-label":(0,o.__)("Add new","web-stories")},l.createElement(oC.default,{height:32,width:32}),l.createElement(X.Text.Span,{size:K.TextSize.XSmall},(0,o.__)("Add new","web-stories"))),F=[...g];if(d){const e={width:96,height:96};F.unshift(l.createElement(p,{onSelect:k,onSelectErrorMessage:O,type:s,render:B,title:(0,o.__)("Select as publisher logo","web-stories"),buttonInsertText:(0,o.__)("Select as publisher logo","web-stories"),cropParams:e}))}const z=[d&&"upload","hotlink"].filter(Boolean);return l.createElement(vt.Panel,{name:t||"publishing",collapsedByDefault:!1,isPersistable:!(y||E)},l.createElement(vt.PanelTitle,null,(0,o.__)("Publishing","web-stories")),l.createElement(vt.PanelContent,null,S?.publish&&l.createElement(wy,null),S?.["assign-author"]&&a&&l.createElement(Ly,null),l.createElement(ky,{isHighlighted:E?.showEffect||y?.showEffect,onAnimationEnd:()=>v()},l.createElement(Zy,null,l.createElement(xy,null,l.createElement(Ay,{ref:e=>{e&&E?.focus&&E?.showEffect&&e.focus()},$width:72,$height:96,cropParams:{width:640,height:853},value:_?.url,onChange:A,title:(0,o.__)("Select as poster image","web-stories"),hotlinkTitle:(0,o.__)("Use external image as poster image","web-stories"),hotlinkInsertText:(0,o.__)("Use image as poster image","web-stories"),hotlinkInsertingText:(0,o.__)("Using image as poster image","web-stories"),buttonInsertText:(0,o.__)("Select as poster image","web-stories"),type:s,ariaLabel:(0,o.__)("Poster image","web-stories"),onChangeErrorText:D,imgProps:_,canUpload:!0,menuOptions:z})),l.createElement(Iy,null,l.createElement(Ty,null,(0,o.__)("Poster image","web-stories")),l.createElement(yt.Required,null))),l.createElement(Py,null,l.createElement(xy,null,l.createElement(gy.default,{options:F,primaryOptions:F,onChange:Z,title:(0,o.__)("Available publisher logos","web-stories"),dropdownButtonLabel:(0,o.__)("Publisher Logo","web-stories"),renderer:N,activeItemRenderer:()=>{const e=g.length?(0,o.__)("Select logo","web-stories"):(0,o.__)("No logo","web-stories");return w.id?l.createElement(Ry,{src:w.url,alt:"",decoding:"async",crossOrigin:"anonymous"}):l.createElement(X.Text.Span,{size:K.TextSize.Small},e)},selectedId:w.id,zIndex:10,disabled:!F.length,ref:e=>{e&&y?.focus&&y?.showEffect&&e.focus()}})),l.createElement(Iy,null,l.createElement(Ty,null,(0,o.__)("Publisher Logo","web-stories")),l.createElement(yt.Row,null,l.createElement(yt.Required,null),u&&l.createElement(Ya.Link,{rel:"noopener noreferrer",target:"_blank",href:c,size:K.TextSize.XSmall},(0,o.__)("Manage","web-stories")))))),T>1?l.createElement(Oy,null,l.createElement(Ty,null,l.createElement(Ny,null,l.createElement(Ey,{width:24,height:24,"aria-hidden":!0})),l.createElement(Dy,null,(0,Zt.default)(/* translators: %d: number of revisions. */
|
||
|
(0,o._n)("%d Revision","%d Revisions",T,"web-stories"),T)),m&&x?l.createElement(Ya.Link,{rel:"noopener noreferrer",target:"_blank",href:(0,qa.addQueryArgs)(m,{revision:x}),size:K.TextSize.XSmall},(0,o.__)("Browse","web-stories")):null)):null))},Fy={embedWebStories:{title:(0,o.__)("Embed Web Stories","web-stories"),figureSrcImg:"images/help-center/story_embed_module_1",figureAlt:(0,o.__)("Graphic showing embed functionality","web-stories"),description:[(0,o.__)("When you create a new post in WordPress, you can embed any of your Stories. <a>Learn more</a>","web-stories")],href:"https://wp.stories.google/docs/best-practices/"}},zy="public",Hy="private",Vy="protected",Uy={PUBLISH:"publish",FUTURE:"future",PRIVATE:"private",DRAFT:"draft"};function jy(){return jy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},jy.apply(this,arguments)}const Gy=i.default.li.withConfig({displayName:"status__StyledListItem",componentId:"sc-1pq370j-0"})(["position:relative;padding:6px 8px;margin:4px 8px;align-items:center;border-radius:4px;cursor:pointer;"," &:hover{background-color:",";}"],wa.focusableOutlineCSS,h.theme.colors.border.defaultNormal),Wy=(0,i.default)(X.Text.Span).withConfig({displayName:"status__LabelText",componentId:"sc-1pq370j-1"})(["font-size:14px;color:",";"],h.theme.colors.fg.primary),$y=(0,i.default)(X.Text.Span).withConfig({displayName:"status__HelperText",componentId:"sc-1pq370j-2"})(["color:",";"],h.theme.colors.fg.tertiary),Yy=(0,b.forwardRef)(((e,t)=>{let{option:a,isSelected:n,...r}=e;return l.createElement(Gy,jy({ref:t,active:n},r),l.createElement(Wy,null,a.label),l.createElement("br",null),l.createElement($y,null,a.helper))}));const qy=function StatusPanel(e){let{nameOverride:t,popupZIndex:a,canCollapse:n,isPersistable:r,...C}=e;const{status:i="",password:s,updateStory:c,saveStory:d,capabilities:u,editLink:p,title:m,storyId:f}=(0,L.useStory)((e=>{let{state:{story:{status:t,password:a,editLink:n,title:r,storyId:l},capabilities:o},actions:{updateStory:C,saveStory:i}}=e;return{status:t,password:a,updateStory:C,saveStory:i,capabilities:o,editLink:n,title:r,storyId:l}})),[g,h]=(0,b.useState)(zy),E=$();(0,b.useEffect)((()=>{if(!s)return i===Uy.PRIVATE?(h(Hy),void c({properties:{visibility:Hy}})):void 0;h(Vy)}),[s,i,c,g]);const y=[{value:zy,label:(0,o.__)("Public","web-stories"),helper:(0,o.__)("Visible to everyone","web-stories")}];u?.publish&&(y.push({value:Hy,label:(0,o.__)("Private","web-stories"),helper:(0,o.__)("Visible to site admins & editors only","web-stories"),disabled:E&&g!==Hy}),y.push({value:Vy,label:(0,o.__)("Password Protected","web-stories"),helper:(0,o.__)("Visible only to those with the password.","web-stories")}));const v=(0,b.useCallback)((e=>{c({properties:{password:e.target.value}})}),[c]),w=(0,Qe.default)(f,p),M=(0,b.useCallback)((()=>{const e={status:Uy.PRIVATE,password:""};(0,_.trackEvent)("publish_story",{status:Uy.PRIVATE,title_length:m.length}),w(),h(Hy),d(e)}),[m.length,w,d]),S=[Uy.PUBLISH,Uy.FUTURE,Uy.PRIVATE].includes(i),I=(0,b.useCallback)(((e,t)=>{const a=t;if(Hy===a&&!S&&!window.confirm((0,o.__)("Would you like to privately publish this story now?","web-stories")))return;const n={};switch(a){case zy:n.status=g===Hy?Uy.DRAFT:i,n.password="",h(zy);break;case Hy:return void M();case Vy:n.status=g===Hy?Uy.DRAFT:i,n.password=s||"",h(Vy)}c({properties:n})}),[i,g,s,c,M,S]);return l.createElement(vt.SimplePanel,jy({name:t||"status",title:(0,o.__)("Visibility","web-stories"),canCollapse:n,isPersistable:r,collapsedByDefault:!1},C),l.createElement(l.Fragment,null,l.createElement(yt.Row,null,l.createElement(or.default,{options:y,selectedValue:g,onMenuItemClick:I,popupZIndex:a,disabled:y.length<=1,renderItem:Yy,hint:y.find((e=>g===e.value))?.helper})),g===Vy&&l.createElement(yt.Row,null,l.createElement($a.default,{"aria-label":(0,o.__)("Password","web-stories"),value:s,onChange:v,placeholder:(0,o.__)("Enter a password","web-stories")}))))};function PublishModalDocumentPa
|
||
|
(0,o.__)("%s is currently working on this story, which means you cannot make changes, unless you take over.","web-stories"),n?.name))),l.createElement(Pv,{size:K.TextSize.Small},(0,Zt.default)(/* translators: %s: owner's name */(0,o.__)("If you take over, %s will lose editing control to the story, but their changes will be saved.","web-stories"),n?.name)))))};const Dv=function PostTakeOverDialog(e){let{isOpen:t,owner:a,dashboardLink:n,previewLink:r,onClose:i}=e;return l.createElement(C.default,{isOpen:t,title:(0,o.__)("Someone else has taken over this story","web-stories"),onClose:i,shouldCloseOnEsc:!1,shouldCloseOnOverlayClick:!1,actions:l.createElement(l.Fragment,null,l.createElement(w.ButtonAsLink,{type:M.ButtonType.Tertiary,size:M.ButtonSize.Small,href:r,target:"_blank",rel:"noreferrer"},(0,o.__)("Preview","web-stories")),l.createElement(w.ButtonAsLink,{type:M.ButtonType.Primary,size:M.ButtonSize.Small,variant:M.ButtonVariant.Rectangle,href:n},(0,o.__)("Back to dashboard","web-stories")))},l.createElement(Av,null,a?.avatar&&l.createElement(kv,null,l.createElement(Rv,{src:a.avatar,alt:a.name,height:48,width:48,crossOrigin:"anonymous",decoding:"async"})),l.createElement(Zv,null,l.createElement(Pv,{size:K.TextSize.Small},(0,Zt.default)(/* translators: %s: owner's name */
|
||
|
(0,o.__)("%s now has editing control of this story.","web-stories"),a?.name)),l.createElement(Pv,{size:K.TextSize.Small},(0,o.__)("Don't worry, your changes up to this moment have been saved","web-stories")))))};const Nv=function PostLock(){const{currentUser:e}=(0,F.useCurrentUser)((e=>{let{state:t}=e;return{currentUser:t.currentUser}})),{storyId:t,dashboardLink:a,nonce:n,postLock:{interval:r,showLockedDialog:o},api:{stories:C,storyLocking:i}}=(0,P.useConfig)(),{state:{hasNewChanges:s}}=(0,D.useHistory)(),{previewLink:c,lockUser:d,autoSave:u}=(0,L.useStory)((e=>{let{state:{story:{previewLink:t,extras:{lockUser:a={}}={}}},actions:{autoSave:n}}=e;return{previewLink:t,lockUser:a,autoSave:n}})),[p,m]=(0,b.useState)(null),[f,g]=(0,b.useState)(null),[h,E]=(0,b.useState)(!1),[y,v]=(0,b.useState)(n),w=(0,b.useCallback)((()=>{m(null),xv(t,C)}),[t,C]),M=(0,b.useMemo)((()=>e&&Boolean(Object.keys(e).length)),[e]),S=(0,b.useCallback)((()=>{(async()=>{if(o&&M)try{const{locked:a,nonce:n,user:r}=await function(e,t){return Cy({path:`${t}${e}/lock/`})}(t,C),l={...r,avatar:r?.avatar?.[96]||""};a&&null===f&&g(l),a&&l?.id&&l?.id!==e.id?m(l):xv(t,C),v(n)}catch(e){(0,_.trackError)("post_lock",e.message)}})()}),[m,t,C,e,f,g,o,M]),I=(0,b.useRef)(S);return(0,b.useEffect)((()=>{I.current=S}),[S,M]),(0,b.useEffect)((()=>{o&&M&&d?.id&&d?.id!==e.id&&m(d)}),[d,e,M,o]),(0,b.useEffect)((()=>{function e(){o&&p?.id&&y&&function(e,t,a){const n=new window.FormData;n.append("_wpnonce",t);const r=(0,qa.addQueryArgs)(a,{_method:"DELETE"});window.navigator.sendBeacon?.(r,n)}(0,y,i)}return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t,o,p,y,i]),(0,b.useEffect)((()=>{const e=setInterval((()=>{r&&M&&I.current()}),1e3*r);return()=>clearInterval(e)}),[r,M]),(0,b.useEffect)((()=>{o&&s&&e?.id===f?.id&&p&&p?.id!==e?.id&&!h&&(u(),E(!0))}),[s,o,p,f,e,u,h,E]),o&&p?f?.id!==e?.id?l.createElement(Ov,{isOpen:Boolean(p?.id),owner:p,onClose:w,previewLink:c,dashboardLink:a}):e?.id===f?.id&&p?.id!==e?.id?l.createElement(Dv,{isOpen:Boolean(p?.id),owner:p,dashboardLink:a,previewLink:c,onClose:w}):null:null},Bv=(e,t,a)=>{if("object"==typeof a)for(const n in a)Object.prototype.hasOwnProperty.call(a,n)&&Bv(e,`${t}[${n}]`,a[n]);else e.append(t,a)},Fv=Bv;const zv=function(e){return"__WEB_STORIES_ENCODED__"+btoa(encodeURIComponent(e))};var Hv=a(4301);const utils_normalizeResourceSizes=function(e){const t={};if(!e)return t;for(const a of Object.keys(e)){const n=e[a];if(!n.width||!n.height||!n.sourceUrl)continue;const r=Number(n.width),l=Number(n.height);Number.isNaN(r)||Number.isNaN(l)||(t[a]={...n,width:r,height:l})}return t};const Vv=function(e){const{mime_type:t,web_stories_media_source:a,meta:{web_stories_is_gif:n=!1}={}}=e;return"gif-conversion"===a||n?function(e){const{id:t,date_gmt:a,media_details:{width:n,height:r},mime_type:l,featured_media:o,featured_media_src:{src:C,width:i,height:s,generated:c},alt_text:d,source_url:u,meta:{web_stories_base_color:p,web_stories_blurhash:m}}=e;return(0,bv.default)({baseColor:p,blurHash:m,type:"gif",mimeType:"image/gif",creationDate:a,src:u,...(0,yv.default)({width:n,height:r,posterGenerated:c,posterWidth:i,posterHeight:s}),posterId:o,poster:C,id:t,alt:d,local:!1,isOptimized:!0,isExternal:!1,output:{mimeType:l,src:u}})}(e):"image"===(0,Hv.default)(t)?function(e){const{id:t,date_gmt:a,media_details:{width:n,height:r,sizes:l={}}={},mime_type:o,alt_text:C,source_url:i,meta:{web_stories_base_color:s,web_stories_blurhash:c}}=e,d=Object.entries(l).reduce(((e,t)=>{let[a,n]=t;return e[a]=(0,Pb.snakeToCamelCaseObjectKeys)(n),e}),{});return(0,bv.default)({baseColor:s,blurHash:c,mimeType:o,creationDate:a,src:i,width:n,height:r,id:t,alt:C,sizes:utils_normalizeResourceSizes(d),local:!1,isExternal:!1})}(e):function(e){const{id:t,date_gmt:a,media_details:{width:n,height:r,length:l,length_formatted:o},mime_type:C,featured_media:i,featured_media_src:{src:s,width:c,height:d,generated:u},web_stories_is_muted:p,alt_text:m,source_url:f,web_stories_media_source:g,meta:{web_stories_trim_data:h,web_stories_base_color:
|