From c57609a023a1ab688fcd470fd68b97c4c6b3de57 Mon Sep 17 00:00:00 2001 From: anomiex Date: Thu, 15 Aug 2024 20:36:40 +0000 Subject: [PATCH] Lock file maintenance (#38822) * Lock file maintenance * Phan: Suppress PhanDeprecatedImplicitNullableParam when supporting PHP 7.0 * Fix new Phan issues * PhanDeprecatedImplicitNullableParam in plugins/crm * Calls passing string to `update_option()` `$autoload`, which in WP 6.6 was changed to bool (but silently still accepting string for back compat). * Update phan baselines * Phan: WP 6.6 fixed a phpdoc which removes something from the baseline, but we still need a suppression for the WP 6.5 compat run. --------- Co-authored-by: Renovate Bot Co-authored-by: Brad Jorsch Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/10410008930 Upstream-Ref: Automattic/jetpack@cf8996c291630bd8f0feef8ecce6c6f8e7976e16 --- build/admin/index.asset.php | 2 +- build/admin/index.js | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/admin/index.asset.php b/build/admin/index.asset.php index 1dc9b7ac..26d53a27 100644 --- a/build/admin/index.asset.php +++ b/build/admin/index.asset.php @@ -1 +1 @@ - array('jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'cd830e71a303b72bb1fb'); + array('jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '7fd204528ccdf9d93cc0'); diff --git a/build/admin/index.js b/build/admin/index.js index 4873a181..f3335052 100644 --- a/build/admin/index.js +++ b/build/admin/index.js @@ -16,4 +16,4 @@ __("%s plays","jetpack-videopress-pkg"),(0,i.Z)(r)):"",[T,U]=(0,f.useState)(null __("Video Upload Error: Video upload, titled %1$s, failed. Please try again or visit the troubleshooting docs at %2$s.","jetpack-videopress-pkg"),n,(0,o.Z)("jetpack-videopress-dashboard-troubleshoot")),F=(0,o.Z)("jetpack-videopress-dashboard-troubleshoot"),I=e=>"Space"===e||"Enter"===e,L=()=>{x(!0)},D=()=>{x(!1)},A=e=>t=>{t.stopPropagation(),e?.(t)},z=e=>{e.target!==w.current&&w?.current?.click()},M=()=>N(e);return React.createElement("div",{role:"button",tabIndex:0,onKeyDown:k?null:e=>{I(e?.code)&&Z(!0)},onKeyUp:k?null:e=>{I(e?.code)&&(Z(!1),z(e))},onClick:k?null:z,"aria-label":O,className:(0,g.Z)(b.Z["video-row"],{[b.Z.pressed]:C,[b.Z["hover-disabled"]]:k},t),ref:_},React.createElement("div",{className:(0,g.Z)(b.Z["video-data-wrapper"],{[b.Z.small]:k})},React.createElement("div",{className:(0,g.Z)(b.Z["info-wrapper"],{[b.Z.small]:k}),onClick:k?e=>{k?P((e=>!e)):z(e)}:null,role:"presentation"},React.createElement("div",{className:b.Z.poster},React.createElement(y.ZP,{isRow:!0,hasError:!0})),React.createElement("div",{className:b.Z["title-wrapper"]},U&&React.createElement(a.ZP,{variant:"body-extra-small",className:b.Z.label,component:"span"},n),React.createElement(a.ZP,{variant:"title-small",className:(0,g.Z)(b.Z.title),ref:E},n),k&&React.createElement(a.ZP,{component:"div"},T)),k&&React.createElement(u.Z,{icon:R?p.Z:m.Z,size:45})),V&&React.createElement("div",{className:(0,g.Z)(b.Z["meta-wrapper"],{[b.Z.small]:k})},!k&&React.createElement("div",{className:b.Z.actions},React.createElement(i.Z,{size:"small",onClick:A(L)},__("Upload Error!","jetpack-videopress-pkg")),React.createElement(i.Z,{size:"small",variant:"tertiary",icon:h.Z,onClick:M})),k&&React.createElement("div",{className:b.Z["mobile-actions"]},React.createElement(i.Z,{size:"small",onClick:A(L)},__("Upload Error!","jetpack-videopress-pkg")),React.createElement(i.Z,{size:"small",variant:"tertiary",icon:h.Z,onClick:M})))),j&&React.createElement(s.Z,{title:__("Error","jetpack-videopress-pkg"),buttonContent:__("Visit the docs","jetpack-videopress-pkg"),buttonHref:F,buttonExternalLink:!0,anchor:S,onClose:D,onClick:D,noArrow:!1,className:b.Z["action-popover"],position:"top center"},React.createElement(a.ZP,null,__("There's been an error uploading your video. Try uploading the video again, if the error persists, visit our documentation to troubleshoot the issue or contact support.","jetpack-videopress-pkg"))))}},854:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>_,jk:()=>C.Z,nr:()=>S});var r=n(2674),o=n.n(r),a=n(2054),i=n(526),s=n(5106),c=n(2636),l=n(9771),d=n(5736),u=n(1074),p=n(7489),m=n(2229),h=n(3228),g=n(9196),f=n(6171),v=n(2458),y=n(7647),b=n(4365),E=n(602),w=n(8943),k=n(8970),C=n(3118),Z=n(7093);const __=d.__,R=({duration:e,uploadDate:t,plays:n,isPrivate:r,loading:o=!1})=>{const[i]=(0,a.Z)("sm"),s=__("Duration","jetpack-videopress-pkg"),c=__("Plays","jetpack-videopress-pkg"),l=__("Privacy","jetpack-videopress-pkg"),d=__("Private","jetpack-videopress-pkg"),p=__("Public","jetpack-videopress-pkg"),m=i?React.createElement(React.Fragment,null,React.createElement("span",null,l),React.createElement("span",null,r?d:p)):r&&React.createElement(u.Z,{icon:f.Z}),g=i&&e?React.createElement(React.Fragment,null,React.createElement("span",null,s),React.createElement("span",null,e)):e,v=i&&Number.isFinite(n)?React.createElement(React.Fragment,null,React.createElement("span",null,c),React.createElement("span",null,n)):n,y=i?null:t;return React.createElement(C.Z,{privacy:"boolean"==typeof r?m:null,duration:g,plays:v,upload:y,loading:o,className:(0,h.Z)({[Z.Z["mobile-stats"]]:i})})},P=({id:e,className:t="",checked:n=!1,title:r,titleAdornment:o=null,thumbnail:f,showThumbnail:y=!1,duration:C,uploadDate:P,plays:S,isPrivate:_,onActionClick:j,onSelect:x,showActionButton:N=!0,showQuickActions:T=!0,showCheckbox:U=!0,loading:V=!1,uploading:O=!1,processing:F=!1,isUpdatingPoster:I=!1,actionButtonLabel:L=__("Edit video details","jetpack-videopress-pkg"),disableActionButton:D=!1,disabled:A=!1,uploadProgress:z,isLocalVideo:M=!1})=>{const H=(0,g.useRef)(null),B=(0,g.useRef)(null),{canPerformAction:$}=(0,v.g)(),[G]=(0,a.Z)("sm"),[q,J]=(0,g.useState)(!1),[K,W]=(0,g.useState)(!1),[Q,X]=(0,g.useState)(null),Y=(e=>{if(e){const t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${t}:${n<10?"0":""}${n}`}})(C),ee=(0,l.dateI18n)("M j, Y",P,null),te=!G&&H?.current?.offsetWidth"Space"===e||"Enter"===e,se=(0,d.sprintf)(/* translators: 1 Video title, 2 Video duration, 3 Video upload date */ __("Video: %1$s, Duration: %2$s, Upload Date: %3$s. Click to edit details.","jetpack-videopress-pkg"),r,Y,ee),ce=React.createElement(i.Z,{size:"small",onClick:(le=j,e=>{e.stopPropagation(),le?.(e)}),disabled:!$||D},L);var le;const de=e=>{e.target!==B.current&&B?.current?.click()};return(0,g.useEffect)((()=>{A&&W(!1)}),[A]),React.createElement("div",{role:"button",tabIndex:0,onKeyDown:G?null:e=>{ie(e?.code)&&J(!0)},onKeyUp:G?null:e=>{ie(e?.code)&&(J(!1),de(e))},onClick:G?null:de,"aria-label":se,className:(0,h.Z)(Z.Z["video-row"],{[Z.Z.pressed]:q,[Z.Z.disabled]:A,[Z.Z["hover-disabled"]]:ae},t),ref:X},U&&React.createElement("div",{className:(0,h.Z)({[Z.Z["checkbox-wrapper-small"]]:G})},React.createElement(b.Z,{ref:B,checked:n&&!V,tabIndex:-1,onChange:x,disabled:V})),React.createElement("div",{className:(0,h.Z)(Z.Z["video-data-wrapper"],{[Z.Z.small]:G})},React.createElement("div",{className:(0,h.Z)(Z.Z["info-wrapper"],{[Z.Z.small]:G}),onClick:G&&!V?e=>{oe?W((e=>!e)):de(e)}:null,role:"presentation"},y&&React.createElement("div",{className:Z.Z.poster},React.createElement(k.ZP,{thumbnail:f,loading:V||I,uploading:O,processing:F,blankIconSize:28,uploadProgress:z,isRow:!0})),React.createElement("div",{className:Z.Z["title-wrapper"]},te&&React.createElement(s.ZP,{variant:"body-extra-small",className:Z.Z.label,component:"span"},r),V?React.createElement(c.Z,{height:30}):React.createElement(s.ZP,{variant:"title-small",className:(0,h.Z)(Z.Z.title,{[Z.Z.disabled]:A}),ref:H},r,o),G&&React.createElement(React.Fragment,null,V?React.createElement(c.Z,{height:20,width:"80%"}):React.createElement(s.ZP,{component:"div"},ee))),oe&&React.createElement(u.Z,{icon:K?p.Z:m.Z,size:45})),re&&React.createElement("div",{className:(0,h.Z)(Z.Z["meta-wrapper"],{[Z.Z.small]:G})},!G&&ne&&React.createElement("div",{className:Z.Z.actions},N&&ce,T&&e&&React.createElement(w.K,{videoId:e})),React.createElement(R,{duration:Y,uploadDate:ee,plays:S,isPrivate:_,loading:V}),G&&ne&&React.createElement("div",{className:Z.Z["mobile-actions"]},N&&ce,T&&e&&React.createElement(w.K,{videoId:e})))),!M&&React.createElement(E.Z,{id:e,anchor:Q,position:"top center"}))},S=e=>React.createElement(P,o()({isLocalVideo:!0},e)),_=({id:e,...t})=>{const{isDeleting:n,uploading:r,processing:a,isUpdatingPoster:i,data:s,uploadProgress:c}=(0,y.Z)(e),l=(n||t?.loading)&&!r&&!a;return React.createElement(P,o()({id:e},t,{loading:l,uploading:r,isUpdatingPoster:i,processing:a,showThumbnail:!0,privacySetting:s.privacySetting,uploadProgress:c}))}},3118:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(2054),o=n(2636),a=n(5106),i=n(3228),s=n(7093);const c=({privacy:e,duration:t,plays:n,upload:c,loading:l=!1,className:d})=>{const[u]=(0,r.Z)("sm");return React.createElement("div",{className:(0,i.Z)(d,s.Z.stats,{[s.Z.small]:u})},l?React.createElement(React.Fragment,null,React.createElement(o.Z,{height:24}),React.createElement(o.Z,{height:24}),React.createElement(o.Z,{height:24}),React.createElement(o.Z,{height:24,className:s.Z.upload})):React.createElement(React.Fragment,null,Boolean(e)&&React.createElement(a.ZP,{"aria-disabled":u?"false":"true",component:"div"},e),null!=t&&React.createElement(a.ZP,{component:"div"},t),null!=n&&React.createElement(a.ZP,{component:"div"},n),Boolean(c)&&React.createElement(a.ZP,{className:s.Z.upload,component:"div"},c)))}},3134:(e,t,n)=>{"use strict";n.d(t,{e:()=>v});var r=n(2674),o=n.n(r),a=n(5106),i=n(4343),s=n(5736),c=n(3228),l=n(861),d=n.n(l),u=n(7498),p=n(8063),m=n(671),h=n(3036),g=n(3741);const __=s.__,f=({className:e,progressBarClassName:t,total:n,used:r})=>{if(!n||null==r)return null;const o=r/n,l=`${(100*o).toFixed()}%`,u=d()(n,{base:10});return React.createElement("div",{className:(0,c.Z)(e)},React.createElement(a.ZP,{className:(0,c.Z)(g.Z["percentage-description"])},(0,s.sprintf)(/* translators: %1$s is the storage percentage, from 0% to 100%, %2$s is the total storage. */ __("%1$s of %2$s of cloud video storage","jetpack-videopress-pkg"),l,u)),React.createElement(i.Z,{className:(0,c.Z)(g.Z["progress-bar"],t),progress:o}))},v=e=>{const{storageUsed:t,uploadedVideoCount:n}=(0,m.ZP)(),{features:r}=(0,u.g)(),{settings:a}=(0,p.C)(),{siteType:i}=a;return i===h.mP||r?.isVideoPressUnlimitedSupported?null:n?t?React.createElement(f,o()({},e,{used:t,total:1e12})):React.createElement(f,o()({},e,{used:0,total:1})):null}},2101:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(2054),o=n(8275),a=n(526),i=n(5609),s=n(5736),c=n(3228),l=n(9196),d=n(7535),u=n(5954);const __=s.__,p=({url:e,selectedTime:t,handleCloseSelectFrame:n,handleVideoFrameSelected:s,handleConfirmFrame:p})=>{const[m,h]=(0,l.useState)(null),[g]=(0,r.Z)("sm");return React.createElement(i.Modal,{title:__("Select thumbnail from video","jetpack-videopress-pkg"),onRequestClose:n,isDismissible:!1},React.createElement(o.ZP,{targetDom:m},React.createElement("div",{ref:h,className:(0,c.Z)(u.Z.selector,{[u.Z["is-small"]]:g})},React.createElement(d.Z,{src:e,onVideoFrameSelected:s,initialCurrentTime:t}),React.createElement("div",{className:u.Z.actions},React.createElement(a.Z,{variant:"secondary",onClick:n},__("Close","jetpack-videopress-pkg")),React.createElement(a.Z,{variant:"primary",onClick:p},__("Select this frame","jetpack-videopress-pkg"))))))}},8970:(e,t,n)=>{"use strict";n.d(t,{Y4:()=>k,ZP:()=>_});var r=n(526),o=n(8275),a=n(4343),i=n(5106),s=n(2054),c=n(2636),l=n(5609),d=n(9771),u=n(5736),p=n(5022),m=n(843),h=n(598),g=n(1063),f=n(1074),v=n(797),y=n(2859),b=n(3228),E=n(9196),w=n(5715);const __=u.__,k=({onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:n,onClose:o,isUpdatingPoster:a=!1})=>React.createElement(React.Fragment,null,React.createElement(r.Z,{className:w.Z.disabled,weight:"regular",fullWidth:!0,variant:"tertiary",icon:p.Z,onClick:()=>{o(),e?.()}},__("Use default thumbnail","jetpack-videopress-pkg")),React.createElement(r.Z,{weight:"regular",fullWidth:!0,variant:"tertiary",icon:m.Z,onClick:()=>{o(),t?.()}},__("Select from video","jetpack-videopress-pkg")),React.createElement(r.Z,{weight:"regular",fullWidth:!0,variant:"tertiary",icon:h.Z,disabled:a,onClick:()=>{o(),n?.()}},__("Upload image","jetpack-videopress-pkg"))),C=({onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:n,busy:a=!1})=>React.createElement("div",{className:w.Z["video-thumbnail-edit"]},React.createElement(l.Dropdown,{placement:"bottom left",renderToggle:({isOpen:e,onToggle:t})=>React.createElement(r.Z,{variant:"secondary",className:w.Z["thumbnail__edit-button"],icon:g.Z,disabled:a,onClick:t,"aria-expanded":e}),renderContent:({onClose:r})=>React.createElement(o.ZP,null,React.createElement(k,{onClose:r,onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:n}))})),Z=({uploadProgress:e=0,isRow:t=!1})=>{const n=__("Completing upload","jetpack-videopress-pkg"),r=__("Completing","jetpack-videopress-pkg"),o=t?r:n,s=`${Math.floor(100*e)}%`,c=(0,u.sprintf)(/* translators: placeholder is the upload percentage */ -__("Uploading %s","jetpack-videopress-pkg"),s),l=1===e?o:c;return React.createElement("div",{className:(0,b.Z)(w.Z["custom-thumbnail"],{[w.Z["is-row"]]:t})},React.createElement(a.Z,{className:w.Z["progress-bar"],size:"small",progress:e}),React.createElement(i.ZP,{variant:t?"body-extra-small":"body",className:w.Z["upload-text"]},l))},R=({isRow:e=!1})=>React.createElement("div",{className:w.Z["custom-thumbnail"]},React.createElement(i.ZP,{variant:e?"body-extra-small":"body",className:w.Z.pulse},__("Processing","jetpack-videopress-pkg"))),P=({isRow:e})=>React.createElement("div",{className:(0,b.Z)(w.Z["thumbnail-blank"],w.Z["thumbnail-error"])},React.createElement(f.Z,{icon:v.Z,size:e?48:96})),S=(0,E.forwardRef)((({className:e,thumbnail:t,duration:n,editable:r,blankIconSize:o=96,loading:a=!1,uploading:l=!1,processing:u=!1,deleting:p=!1,updating:m=!1,onUseDefaultThumbnail:h,onSelectFromVideo:g,onUploadImage:v,uploadProgress:E,isRow:k=!1,hasError:S=!1},_)=>{const[j]=(0,s.Z)("sm"),x=a||l||p||m;let N=t;return N=a?React.createElement(c.Z,null):N,N=l?React.createElement(Z,{isRow:k,uploadProgress:E}):N,N=u?React.createElement(R,{isRow:k}):N,N=S?React.createElement(P,{isRow:k}):N,N="string"==typeof N&&""!==N?React.createElement("img",{src:N,alt:__("Video thumbnail","jetpack-videopress-pkg")}):N,N=N||React.createElement("div",{className:w.Z["thumbnail-blank"]},React.createElement(f.Z,{icon:y.Z,size:o})),React.createElement("div",{className:(0,b.Z)(e,w.Z.thumbnail,{[w.Z["is-small"]]:j}),ref:_},Boolean(N)&&r&&React.createElement(C,{onUseDefaultThumbnail:h,onSelectFromVideo:g,onUploadImage:v,busy:x}),Number.isFinite(n)&&React.createElement("div",{className:w.Z["video-thumbnail-duration"]},React.createElement(i.ZP,{variant:"body-small",component:"div"},n>=36e5?(0,d.gmdateI18n)("H:i:s",new Date(n)):(0,d.gmdateI18n)("i:s",new Date(n)))),React.createElement("div",{className:w.Z["thumbnail-placeholder"]},N))}));S.displayName="VideoThumbnail";const _=S},8213:(e,t,n)=>{"use strict";n.d(t,{Z:()=>h});var r=n(2054),o=n(5106),a=n(526),i=n(5736),s=n(1074),c=n(9989),l=n(3228),d=n(7778),u=n(7498),p=n(6282),m=n(7495);const __=i.__,h=({className:e,onSelectFiles:t})=>{const[n]=(0,r.Z)("sm"),{inputRef:i,handleFileInputChangeEvent:h}=(0,p.Z)({onSelectFiles:t}),{hasVideoPressPurchase:g}=(0,u.g)();return React.createElement("div",{className:(0,l.Z)(m.Z.wrapper,e,{[m.Z.small]:n})},React.createElement("input",{ref:i,type:"file",accept:d.EW,className:(0,l.Z)(m.Z["file-input"]),onChange:h,multiple:g}),React.createElement(s.Z,{icon:c.Z,size:32,className:(0,l.Z)(m.Z.icon)}),React.createElement(o.ZP,{variant:"title-small"},__("Drag and drop your video here","jetpack-videopress-pkg")),React.createElement(a.Z,{size:"small",variant:"secondary",className:(0,l.Z)(m.Z.button),onClick:()=>{i.current.click()}},__("Select file to upload","jetpack-videopress-pkg")))}},4024:(e,t,n)=>{"use strict";n.d(t,{a:()=>o});var r=n(9196);const o=()=>{const[e,t]=(0,r.useState)(null),[n,o]=(0,r.useState)(!1),[a,i]=(0,r.useState)(!1),[s,c]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{o(!(!a&&!s))}),[a,s]),{setAnchor:t,setIsFocused:c,setIsHovering:i,setShowPopover:o,anchor:e,isFocused:s,isHovering:a,showPopover:n}}},1173:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(6975),o=n(3892),a=n(9196);const i=({pageViewEventName:e,pageViewEventProperties:t={}})=>{const{isUserConnected:n,isRegistered:i,userConnectionData:s}=(0,o.Z)(),{blogId:c}=s?.currentUser||{},{login:l,ID:d}=s?.currentUser?.wpcomUser||{},{tracks:u}=r.Z,{recordEvent:p}=u,m=(0,a.useCallback)((async(e,t)=>{p(e,t)}),[p]),h=(0,a.useCallback)(((e,t,n=(()=>({})))=>(n="function"==typeof t?t:n,t="function"==typeof t?{}:t,c&&(t.blog_id=c),()=>m(e,t).then(n))),[m,c]);return(0,a.useEffect)((()=>{n&&d&&l&&r.Z.initialize(d,l)}),[n,d,l]),(0,a.useEffect)((()=>{i&&e&&(c&&(t.blog_id=c),p(e,t))}),[c]),{recordEvent:m,recordEventHandler:h}}},2458:(e,t,n)=>{"use strict";n.d(t,{g:()=>o});var r=n(3892);const o=()=>{const{isRegistered:e,hasConnectedOwner:t,isUserConnected:n}=(0,r.Z)();return{isRegistered:e,hasConnectedOwner:t,isUserConnected:n,canPerformAction:e&&t&&n}}},7498:(e,t,n)=>{"use strict";n.d(t,{g:()=>d});var r=n(9818),o=n(4817),a=n(5178);const{paidFeatures:i={},siteProductData:s={},productData:c={},productPrice:l={}}=window&&window.jetpackVideoPressInitialState?window.jetpackVideoPressInitialState:{},d=()=>{const e=(0,a.N)(s.pricing_for_ui,!0),t=(0,a.N)(c.introductory_offer,!0),n={...(0,a.N)(c,!0),introductoryOffer:t},{purchases:d,isFetchingPurchases:u}=(0,r.useSelect)((e=>({purchases:e(o.tT).getPurchases(),isFetchingPurchases:e(o.tT).isFetchingPurchases()})),[]),p=d.map((e=>(0,a.N)(e,!0)));const m=["jetpack_videopress_bi_yearly","jetpack_videopress","jetpack_videopress_monthly","jetpack_complete_bi_yearly","jetpack_complete","jetpack_complete_monthly","jetpack_business","jetpack_business_monthly","jetpack_personal","jetpack_personal_monthly","jetpack_premium","jetpack_premium_monthly","videopress","videopress-pro","wp_p2_plus_monthly","bundle_pro","value_bundle","value_bundle_monthly","value_bundle-2y","value_bundle-3y","pro-plan","pro-plan-monthly","pro-plan-2y","business-bundle","business-bundle-monthly","business-bundle-2y","business-bundle-3y","wp_com_hundred_year_bundle_centennially","wp_bundle_migration_trial_monthly","wp_bundle_hosting_trial_monthly","ecommerce-bundle","ecommerce-bundle-monthly","ecommerce-bundle-2y","ecommerce-bundle-3y","ecommerce-trial-bundle-monthly","wooexpress-small-bundle-yearly","wooexpress-small-bundle-monthly","wooexpress-medium-bundle-yearly","wooexpress-medium-bundle-monthly"].some((e=>{return t=e,p.some((e=>e.productSlug===t));var t}));return{features:i,siteProduct:{...(0,a.N)({...s},!0),pricingForUi:e},product:n,productPrice:l,purchases:p,hasVideoPressPurchase:m,isFetchingPurchases:u}}},2630:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(9818),o=n(4391);function a(e){const t=e.needsPlaybackToken,n=(0,r.useSelect)((n=>t?n(o.tT).getPlaybackToken(e.guid):null),[e.guid]),a=(0,r.useSelect)((e=>!!t&&e(o.tT).isFetchingPlaybackToken()),[e.guid]);return{playbackToken:n?.token,isFetchingPlaybackToken:a}}},7698:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),o=n(5736),a=n(9196),i=n(4817);const __=o.__,s=({video:e})=>{const[t,n]=(0,a.useState)(null),[o,s]=(0,a.useState)(null),[c,l]=(0,a.useState)(!1),d=(0,r.useDispatch)(i.tT),u=()=>new Promise((e=>{const t=window.wp.media({title:__("Select Thumbnail","jetpack-videopress-pkg"),multiple:!1,library:{type:"image"},button:{text:__("Use this image as thumbnail","jetpack-videopress-pkg")}});t.on("select",(function(){const n=t?.state()?.get("selection")?.first()?.toJSON();e({id:n?.id,url:n?.url})})),t.on("close",(function(){setTimeout((()=>{e(null)}),0)})),t.open()})),p=async t=>{if(null!=t)return d?.updateVideoPoster(e.id,e.guid,{poster_attachment_id:t})};return{handleConfirmFrame:()=>{n(o),l(!1)},handleCloseSelectFrame:()=>l(!1),handleOpenSelectFrame:()=>l(!0),handleVideoFrameSelected:e=>{s(e)},useVideoAsThumbnail:null!==t,selectedTime:Number.isFinite(t)?t/1e3:null,frameSelectorIsOpen:c,updatePosterImageFromFrame:()=>{if(Number.isFinite(t))return d?.updateVideoPoster(e.id,e.guid,{at_time:t,is_millisec:!0})},selectAttachmentFromLibrary:u,updatePosterImageFromLibrary:p,selectAndUpdatePosterImageFromLibrary:async()=>{const e=await u();if(e)return p(e.id)},setVideoFrameMs:n}}},4486:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var r=n(4498);const o=()=>{const e=(0,r.TH)(),t=(0,r.k6)(),n=new URLSearchParams(e.search);return{getParam:(e,t=null)=>n.has(e)?n.get(e):t,setParam:(e,t=null)=>{n.set(e,t)},deleteParam:e=>{n.delete(e)},update:()=>{const e="?"+n.toString();e!==t.location.search&&t.push({search:e})},reset:()=>{""!==t.location.search&&t.replace({pathname:t.location.pathname,search:""})}}}},6282:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(9196),o=n(7778);const a=({canDrop:e=!1,dropElement:t,onSelectFiles:n}={})=>{const[a,i]=(0,r.useState)(!1),s=(0,r.useRef)(null);let c=[];const l=e=>Array.from(e).filter((e=>o.Xn.some((t=>e.name.toLocaleLowerCase().endsWith(t))))),d=(0,r.useCallback)((e=>{const t=l(e.currentTarget.files);n(t)}),[n]),u=e=>{e.preventDefault(),e.stopPropagation(),c.length>0&&(c.forEach((e=>clearTimeout(e))),c=[]),i(!0)},p=()=>{const e=setTimeout((()=>{i(!1);const t=c.findIndex((t=>t===e));t>-1&&c.splice(t,1)}),100);c.push(e)},m=(0,r.useCallback)((t=>{if(i(!1),t.preventDefault(),t.stopPropagation(),c.forEach((e=>clearTimeout(e))),c=[],!e)return;const r=l(t.dataTransfer.files);n(r)}),[e,n]);return(0,r.useEffect)((()=>{e||i(!1)}),[e]),t&&(0,r.useEffect)((()=>(t.addEventListener("drop",m),t.addEventListener("dragover",u),t.addEventListener("dragleave",p),()=>{t.removeEventListener("drop",m),t.removeEventListener("dragover",u),t.removeEventListener("dragleave",p)})),[m,u,p]),{isDraggingOver:a,inputRef:s,setIsDraggingOver:i,handleFileInputChangeEvent:d,handleDragOverEvent:u,handleDragLeaveEvent:p,handleDropEvent:m,filterVideoFiles:l}}},2472:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9196);const o=({shouldPrevent:e=!1,message:t})=>{(0,r.useEffect)((()=>{if(!e)return;const n=e=>{e.preventDefault(),e.returnValue=t};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}}),[e])}},4321:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(9818),o=n(4391);function a(){return{items:(0,r.useSelect)((e=>e(o.tT).getUsers())),...(0,r.useSelect)((e=>e(o.tT).getUsersPagination()))}}},7647:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(9818),o=n(4817),a=n(4391);function i(e,t=!1){const n=(0,r.useDispatch)(o.tT),i=(0,r.useSelect)((n=>n(o.tT).getVideo(e,t)),[e]),s=(0,r.useSelect)((t=>t(o.tT).getVideoStateMetadata(e)),[e]),c=(0,r.useSelect)((e=>e(o.tT).getIsFetching()),[e]),l=null===i?.posterImage&&!i?.finished;return{data:{privacySetting:a.Vz.indexOf(a.$A),...i},...s,processing:l,isFetching:c,setVideo:e=>n.setVideo(e),deleteVideo:()=>n.deleteVideo(e),updateVideoPrivacy:t=>n.updateVideoPrivacy(e,a.Vz.findIndex((e=>e===t)))}}},8063:(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var r=n(9818),o=n(4817),a=n(3036);const i=()=>{const e=(0,r.useDispatch)(o.tT),t=(0,r.useSelect)((e=>e(o.tT).getVideoPressSettings()),[]);return{settings:{videoPressVideosPrivateForSite:t?.videoPressVideosPrivateForSite??!1,siteIsPrivate:t?.siteIsPrivate??!1,siteType:t?.siteType??a.RB},onUpdate:t=>e.updateVideoPressSettings(t)}}},671:(e,t,n)=>{"use strict";n.d(t,{Eo:()=>s,ZP:()=>a,_4:()=>i});var r=n(9818),o=n(4391);function a(){const e=(0,r.useSelect)((e=>e(o.tT).getVideos())),t=(0,r.useSelect)((e=>e(o.tT).getUploadingVideos())),n=t.length>0,a=(0,r.useSelect)((e=>e(o.tT).getUploadedVideoCount())),i=(0,r.useSelect)((e=>e(o.tT).getIsFetching())),s=(0,r.useSelect)((e=>e(o.tT).getIsFetchingUploadedVideoCount())),c=(0,r.useSelect)((e=>e(o.tT).getFirstUploadedVideoId())),l=(0,r.useSelect)((e=>e(o.tT).getFirstVideoProcessed())),d=(0,r.useSelect)((e=>e(o.tT).getDismissedFirstVideoPopover())),u=(0,r.useSelect)((e=>e(o.tT).getVideosQuery()||{})),p=(0,r.useSelect)((e=>e(o.tT).getPagination())),m=(0,r.useSelect)((e=>e(o.tT).getStorageUsed()),[]);return{items:e,uploading:t,isUploading:n,search:"",filter:(0,r.useSelect)((e=>e(o.tT).getVideosFilter())),uploadedVideoCount:a,isFetching:i,isFetchingUploadedVideoCount:s,firstUploadedVideoId:c,firstVideoProcessed:l,dismissedFirstVideoPopover:d,...u,...p,...m,uploadErrors:(0,r.useSelect)((e=>e(o.tT).getUploadErrorVideos())),setPage:e=>(0,r.dispatch)(o.tT).setVideosQuery({page:e}),setSearch:e=>(0,r.dispatch)(o.tT).setVideosQuery({search:e}),setFilter:(0,r.dispatch)(o.tT).setVideosFilter}}const i=()=>({items:(0,r.useSelect)((e=>e(o.tT).getLocalVideos())),uploadedLocalVideoCount:(0,r.useSelect)((e=>e(o.tT).getUploadedLocalVideoCount())),isFetching:(0,r.useSelect)((e=>e(o.tT).getIsFetchingLocalVideos())),...(0,r.useSelect)((e=>e(o.tT).getLocalVideosQuery()||{})),...(0,r.useSelect)((e=>e(o.tT).getLocalPagination())),setPage:e=>(0,r.dispatch)(o.tT).setLocalVideosQuery({page:e})}),s=()=>(0,r.useSelect)((e=>e(o.tT).getVideosQuery()||{}))},6152:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(5609),o=n(5736);const __=o.__;function a({isOpen:e,onClose:t}){return e?React.createElement(r.Modal,{title:__("Chapters in VideoPress","jetpack-videopress-pkg"),isDismissible:!1,className:"learn-how-modal",onRequestClose:t},React.createElement("p",null,__("Chapters are a great way to split up longer videos and organize them into different sections.","jetpack-videopress-pkg")),React.createElement("p",null,__("They allow your visitors to see what each section is about and skip to their favorite parts.","jetpack-videopress-pkg")),React.createElement("p",{className:"learn-how-modal__heading"},__("How to add Chapters to your VideoPress videos","jetpack-videopress-pkg")),React.createElement("ol",null,React.createElement("li",null,__("In the Description, add a list of timestamps and titles.","jetpack-videopress-pkg")),React.createElement("li",null,__("Make sure that the first timestamp starts with 00:00.","jetpack-videopress-pkg")),React.createElement("li",null,__("Add at least three chapters entries and as many as you need.","jetpack-videopress-pkg")),React.createElement("li",null,__("Add your chapters entries in consecutive order, with at least 10-second intervals between each.","jetpack-videopress-pkg"))),React.createElement("p",{className:"learn-how-modal__heading"},__("Example","jetpack-videopress-pkg")),React.createElement("p",null,__("00:00 Intro","jetpack-videopress-pkg")),React.createElement("p",null,__("00:24 Mountains arise","jetpack-videopress-pkg")),React.createElement("p",null,__("02:38 Coming back home","jetpack-videopress-pkg")),React.createElement("p",null,__("03:04 Credits","jetpack-videopress-pkg")),React.createElement("div",{className:"learn-how-modal__buttons"},React.createElement(r.Button,{className:"learn-how-modal__button",onClick:t,variant:"primary"},__("Got it, thanks","jetpack-videopress-pkg")))):null}},6029:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(526),o=n(9307),a=n(5736),i=n(9196),s=n(6152);const __=a.__,c=()=>{const[e,t]=(0,i.useState)(!1);return React.createElement(React.Fragment,null,(0,o.createInterpolateElement)(__("Did you know you can now add Chapters to your videos? Learn how","jetpack-videopress-pkg"),{link:React.createElement(r.Z,{variant:"link",size:"small",onClick:()=>t(!0)})}),React.createElement(s.Z,{onClose:()=>t(!1),isOpen:e}))}},6171:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5609);const o=React.createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{d:"M8.45414 21.2068L16.4541 3.70678L15.5446 3.29102L13.6676 7.39695C13.1429 7.3024 12.587 7.24988 11.9996 7.24988C9.00203 7.24988 6.82613 8.61747 5.41986 9.95678C4.71735 10.6259 4.19984 11.2937 3.85693 11.7955C3.6851 12.047 3.55604 12.2583 3.46859 12.4095C3.42483 12.4851 3.39141 12.5458 3.36817 12.5891C3.35655 12.6107 3.34747 12.6281 3.34091 12.6407L3.33296 12.6562L3.3304 12.6613L3.3291 12.6639C3.3291 12.6639 3.32878 12.6645 3.9996 12.9999C4.67042 13.3353 4.67016 13.3358 4.67016 13.3358L4.67297 13.3304C4.67621 13.3241 4.68183 13.3134 4.68987 13.2984C4.70594 13.2685 4.73159 13.2217 4.76694 13.1607C4.83769 13.0384 4.94691 12.8591 5.0954 12.6418C5.39312 12.2061 5.84435 11.6239 6.45434 11.043C7.67307 9.88229 9.49718 8.74988 11.9996 8.74988C12.353 8.74988 12.693 8.77247 13.0196 8.81455L12.8834 9.11243C12.6011 9.03897 12.3049 8.99988 11.9996 8.99988C10.0666 8.99988 8.49962 10.5669 8.49962 12.4999C8.49962 13.6966 9.1002 14.753 10.0163 15.3842L7.54467 20.791L8.45414 21.2068Z"}),React.createElement(r.Path,{d:"M15.7168 9.69537C16.4332 10.0877 17.041 10.563 17.5451 11.0431C18.1551 11.624 18.6064 12.2062 18.9041 12.6419C19.0526 12.8592 19.1618 13.0385 19.2325 13.1608C19.2679 13.2218 19.2935 13.2686 19.3096 13.2985L19.3211 13.3202L19.3265 13.3305L19.3293 13.3359C19.3293 13.3359 19.329 13.3354 19.9999 13C20.6707 12.6646 20.67 12.6632 20.67 12.6632L20.6691 12.6614L20.6665 12.6563L20.6586 12.6408C20.652 12.6282 20.6429 12.6108 20.6313 12.5892C20.6081 12.5459 20.5746 12.4852 20.5309 12.4096C20.4434 12.2584 20.3144 12.0471 20.1425 11.7956C19.7996 11.2938 19.2821 10.626 18.5796 9.95691C17.9765 9.38256 17.2319 8.803 16.3417 8.32834L15.7168 9.69537Z"}),React.createElement(r.Path,{d:"M12.8867 15.8868C14.3904 15.4942 15.5002 14.1267 15.5002 12.5C15.5002 11.9453 15.3711 11.4207 15.1414 10.9546L12.8867 15.8868Z"}))},3209:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5609);const o=React.createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Rect,{x:"5",y:"7",width:"14",height:"1.5"}),React.createElement(r.Rect,{x:"7",y:"11.25",width:"10",height:"1.5"}),React.createElement(r.Rect,{x:"9",y:"15.5",width:"6",height:"1.5"}))},2346:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5609);const o=React.createElement(r.SVG,{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{d:"M4.75725 2.075C4.60279 1.97745 4.41041 1.97489 4.25365 2.06832C4.09689 2.16174 4 2.3367 4 2.52632V21.4737C4 21.6633 4.09689 21.8383 4.25365 21.9317C4.41041 22.0251 4.60279 22.0226 4.75725 21.925L19.7573 12.4513C19.9079 12.3562 20 12.1849 20 12C20 11.8151 19.9079 11.6438 19.7573 11.5487L4.75725 2.075Z",fill:"white"}))},6600:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(5609);const o=React.createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{d:"m3.999 13 .67.336.003-.005a2.42 2.42 0 0 1 .094-.17c.07-.122.18-.302.328-.52a10.1 10.1 0 0 1 1.36-1.598c1.218-1.16 3.042-2.293 5.545-2.293 2.502 0 4.326 1.132 5.545 2.293.61.581 1.061 1.163 1.359 1.599a8.29 8.29 0 0 1 .405.657l.017.032.003.005.67-.336.671-.336-.001-.003-.003-.005-.008-.015a9.752 9.752 0 0 0-.516-.845c-.343-.502-.86-1.17-1.563-1.84-1.406-1.338-3.582-2.706-6.58-2.706-2.997 0-5.173 1.368-6.58 2.707-.702.669-1.22 1.337-1.562 1.839a9.77 9.77 0 0 0-.516.845l-.008.015-.003.005v.003l.67.336Zm8 3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z"}))},1875:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(526),o=n(5609),a=n(9307),i=n(5736),s=n(9196),c=n(6152);const __=i.__,l=({className:e})=>{const[t,n]=(0,s.useState)(!1);return React.createElement(React.Fragment,null,React.createElement(o.Notice,{status:"warning",className:e,isDismissible:!1},(0,a.createInterpolateElement)(__("It seems there are some chapters, but they are incomplete. Check out the format and try again.","jetpack-videopress-pkg"),{link:React.createElement(r.Z,{variant:"link",size:"small",onClick:()=>n(!0)})})),React.createElement(c.Z,{onClose:()=>n(!1),isOpen:t}))}},7535:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>d});var r=n(5609),o=n(9307),a=n(1074),i=n(3228),s=n(2346),c=n(4641);const l=({src:e,setMaxDuration:t=null,currentTime:n})=>{const a=(0,o.useRef)(null),[i,s]=(0,o.useState)(!0);(0,o.useEffect)((()=>{a.current.src=e}),[e]),(0,o.useEffect)((()=>{a.current&&Number.isFinite(n)&&(a.current.currentTime=n)}),[n]);return React.createElement("div",{className:c.Z["video-player-wrapper"]},i&&React.createElement("div",{className:c.Z["video-player-spinner-wrapper"]},React.createElement(r.Spinner,{className:c.Z.spinner})),React.createElement("video",{onLoadedData:()=>s(!1),ref:a,muted:!0,className:c.Z.video,onDurationChange:e=>{const r=e.target.duration;if(t?.(r),a.current){const e=Number.isFinite(n)?n:r/2;a.current.currentTime=e}}}))},d=({src:e="",onVideoFrameSelected:t,className:n="",initialCurrentTime:d=null})=>{const[u,p]=(0,o.useState)(0),[m,h]=(0,o.useState)(Number.isFinite(d)?d:null);return React.createElement("div",{className:(0,i.Z)(c.Z.container,n)},React.createElement(a.Z,{className:c.Z["play-icon"],icon:s.Z}),React.createElement(l,{src:e,setMaxDuration:p,currentTime:m}),React.createElement(r.RangeControl,{className:c.Z.range,min:0,step:.1,initialPosition:m,max:u,showTooltip:!1,withInputField:!1,onChange:e=>{h(e),t?.(1e3*e)}}))}},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(4333),o=n(9196),a=n(172),i=n(5304);const s=e=>{const[t,n]=(0,o.useState)(!1),s=(0,o.useCallback)((()=>{const t=(0,a.ZP)(e);0===t.length?n(!1):n(!(0,i.Z)(t))}),[e]),c=(0,r.useDebounce)(s,3e3);return(0,o.useEffect)((()=>{c()}),[e]),(0,o.useEffect)(s,[]),{hasIncompleteChapters:t}}},5134:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(6989),o=n.n(r);const a=e=>{const t={allowDownload:"allow_download",displayEmbed:"display_embed"};return n=>new Promise(((r,a)=>{const i=(s=Object.assign({id:e},n),Object.keys(s).reduce(((e,n)=>(e[t[n]||n]=s[n],e)),{}));var s;o()({path:"/wpcom/v2/videopress/meta",method:"POST",data:i}).then((e=>{"success"===e?.code||a()})).catch((e=>a(e))).finally((()=>{r()}))}))}},1207:(e,t,n)=>{"use strict";n.d(t,{R2:()=>i});var r=n(6989),o=n.n(r),a=(n(9307),n(5736));n(9537);const __=a.__,i=e=>{const t=`videopress/v1/upload/${e}`;return new Promise(((n,r)=>{o()({path:t,method:"POST"}).then((t=>{"uploading"===t.status||"new"===t.status||"resume"===t.status?i(e).then(n).catch(r):"complete"===t.status?n({guid:t.uploaded_details.guid,id:t.uploaded_details.media_id,src:t.uploaded_details.upload_src}):"error"===t.status?r({data:{message:t.error}}):r({data:{message:__("Unexpected error uploading video.","jetpack-videopress-pkg")}})})).catch((e=>{r({data:{message:e?.message}})}))}))}},5955:(e,t,n)=>{"use strict";n.d(t,{B:()=>u});var r=n(6989),o=n.n(r),a=n(9307),i=n(951),s=n.n(i),c=n(6998);const l=a.Platform.isNative,d=s()("videopress:lib:fetch-video-item");async function u({guid:e,isPrivate:t,token:n=null,skipRatingControl:r=!1,retries:a=0}){try{const a=r?{}:{birth_day:"1",birth_month:"1",birth_year:"2000"};let i;t&&!n&&(i=await(0,c.Z)("playback",{guid:e})),(n||i?.token)&&(a.metadata_token=n||i.token);const s=Object.keys(a).length?`?${new URLSearchParams(a).toString()}`:"",d=l?{path:`/rest/v1.1/videos/${e}${s}`}:{url:`https://public-api.wordpress.com/rest/v1.1/videos/${e}${s}`};return await o()({...d,credentials:"omit",global:!0})}catch(t){d("updating retry from",a,"to",a+1);const n=a+1;if(n>2)throw d("Too many attempts to get video. Aborting."),new Error(t?.message??t);if("auth"===t?.error)return d("Authentication error. Reattempt %o",n+"/3"),u({guid:e,isPrivate:!0,token:null,skipRatingControl:r,retries:n});if("Please supply the birthdate parameters."===t?.message)return d("Rating error. Reattempt %o",n+"/3"),u({guid:e,isPrivate:!0,token:null,skipRatingControl:!1,retries:n});throw new Error(t?.message??t)}}},6998:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(951),o=n.n(r),a=n(5368);const i=o()("videopress:get-media-token");const s=async function(e,t={}){const{id:n=0,guid:r=0,flushToken:o}=t,s=`vpc-${e}-${n}-${r}`,c=window?.videopressAjax?.context||"main";let l;const d=localStorage.getItem(s);if(o)i("(%s) Flushing %o token",c,s),localStorage.removeItem(s);else try{if(d){if(l=await JSON.parse(d),l&&l.expire>Date.now())return i("(%s) Providing %o token from the store",c,s),l.data;i("(%s) Token %o expired. Clean.",c,s),localStorage.removeItem(s)}}catch(e){i("Invalid token in the localStore")}const u=await function(e,t={}){const{id:n=0,guid:r,subscriptionPlanId:o=0,adminAjaxAPI:i,filename:s}=t;return new Promise((function(t,c){const l=i||window.videopressAjax?.ajaxUrl||window?.ajaxurl||"/wp-admin/admin-ajax.php";if(!a.M.includes(e))return c("Invalid scope");const d={action:"videopress-get-playback-jwt"};switch(e){case"upload":d.action="videopress-get-upload-token",s&&(d.filename=s);break;case"upload-jwt":d.action="videopress-get-upload-jwt";break;case"playback":d.action="videopress-get-playback-jwt",d.guid=r,d.post_id=String(n),d.subscription_plan_id=o}fetch(l,{method:"POST",credentials:"same-origin",body:new URLSearchParams(d)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((n=>{if(!n.success)throw new Error("Token is not achievable");switch(e){case"upload":case"upload-jwt":t({token:n.data.upload_token,blogId:n.data.upload_blog_id,url:n.data.upload_action_url});break;case"playback":t({token:n.data.jwt})}})).catch((()=>{console.warn("Token is not achievable"),t({token:null})}))}))}(e,t);return"playback"===e&&u?.token&&(i("(%s) Storing %o token",c,s),localStorage.setItem(s,JSON.stringify({data:u,expire:Date.now()+864e5}))),i("(%s) Providing %o token from request/response",c,s),u}},5368:(e,t,n)=>{"use strict";n.d(t,{M:()=>r});const r=["upload","playback","upload-jwt"]},5042:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(951),o=n.n(r),a=n(9537),i=n(6998);const s=o()("videopress:resumable-file-uploader"),c={},l=({file:e,tokenData:t,onProgress:n,onSuccess:r,onError:o})=>{const l=new a.gq(e,{onError:o,onProgress:n,endpoint:t.url,removeFingerprintOnSuccess:!0,overridePatchMethod:!1,chunkSize:1e7,metadata:{filename:e.name,filetype:e.type},retryDelays:[0,1e3,3e3,5e3,1e4],onShouldRetry:function(e){return 400!==(e.originalResponse?e.originalResponse.getStatus():0)||(s("cleanup retry due to 400 error"),localStorage.removeItem(l._urlStorageKey),!1)},onBeforeRequest:async function(e){const n=e._method;if(["HEAD","OPTIONS"].indexOf(n)>=0&&(e._method="GET",e.setHeader("X-HTTP-Method-Override",n)),["DELETE","PUT","PATCH"].indexOf(n)>=0&&(e._method="POST",e.setHeader("X-HTTP-Method-Override",n)),e._xhr.open(e._method,e._url,!0),Object.keys(e._headers).forEach((function(t){e.setHeader(t,e._headers[t])})),"POST"===n){if(!!!t.token)throw"should never happen";e.setHeader("x-videopress-upload-token",t.token)}if(["OPTIONS","GET","HEAD","DELETE","PUT","PATCH"].indexOf(n)>=0){const t=(r=e._url,new URL(r).pathname.split("/").pop());if(c[t])e.setHeader("x-videopress-upload-token",c[t]);else if("HEAD"===n){const n=await(0,i.Z)("upload-jwt");n?.token&&(c[t]=n.token,e.setHeader("x-videopress-upload-token",n.token))}}var r},onAfterResponse:async function(t,n){if(n.getStatus()>=400)return void s("upload error");const o=n.getHeader("x-videopress-upload-guid"),a=n.getHeader("x-videopress-upload-media-id"),i=n.getHeader("x-videopress-upload-src-url");if(o&&a&&i)return void(r&&r({id:Number(a),guid:o,src:i},e));const l={"x-videopress-upload-key-token":"token","x-videopress-upload-key":"key"},d={};Object.keys(l).forEach((function(e){const t=n.getHeader(e);t&&(d[l[e]]=t)})),d.key&&d.token&&(c[d.key]=d.token)}});return l.findPreviousUploads().then((function(e){e.length&&l.resumeFromPreviousUpload(e[0]),l.start()})),l}},515:(e,t,n)=>{"use strict";n.d(t,{Iz:()=>r});n(6483);function r(e,t){return t?`https://video.wordpress.com/v/${e}`:`https://videopress.com/v/${e}`}},2198:(e,t,n)=>{"use strict";n.d(t,{nb:()=>p,ss:()=>u});var r=n(6989),o=n.n(r),a=n(951),i=n.n(a),s=n(6998);const{siteType:c=""}=window?.videoPressEditorState||{},l="simple"!==c,d=i()("videopress:tracks:lib:video-tracks");async function u(e,t){if(!e)return!1;let n,r="";t.isPrivate&&(n=await(0,s.Z)("playback",{guid:t.guid}),r="?"+new URLSearchParams({metadata_token:n?.token}).toString());let o=await fetch(e+r);if(!o.ok&&403===o.status&&t.guid&&(n=await(0,s.Z)("playback",{guid:t.guid}),r="?"+new URLSearchParams({metadata_token:n?.token}).toString(),o=await fetch(e+r)),!o.ok)return!1;const a=await o.text();return/videopress-chapters-auto-generated/.test(a)}const p=(e,t)=>{const{kind:n,srcLang:r,label:a,tmpFile:i}=e;return l?function(e,t){return d("using jetpack api fetch"),new Promise((function(n,r){const{kind:o,srcLang:a,label:i,tmpFile:c}=e;(0,s.Z)("upload",{filename:c.name}).then((({token:e,blogId:s})=>{const l=new FormData;l.append("kind",o),l.append("srclang",a),l.append("label",i),l.append("vtt",c),fetch(`https://public-api.wordpress.com/rest/v1.1/videos/${t}/tracks`,{headers:{Authorization:`X_UPLOAD_TOKEN token="${e}" blog_id="${s}"`},method:"POST",body:l}).then((e=>{try{const t=e.json();return d("data",e),d("json",t),n(t)}catch(e){return d("error",e),r(e)}})).catch(r)}))}))}({kind:n,srcLang:r,label:a,tmpFile:i},t):(d("using wpcom api fetch"),new Promise((function(e,s){return o()({method:"POST",path:`/videos/${t}/tracks`,apiNamespace:"rest/v1.1",global:!0,parse:!1,formData:[["kind",n],["srclang",r],["label",a],["vtt",i]]}).then((t=>{try{const n=t.json();return d("data",t),d("json",n),e(n)}catch(e){return d("error",e),s(e)}})).catch(s)})))}},1403:(e,t,n)=>{"use strict";n.d(t,{Z:()=>y});var r=n(6989),o=n.n(r),a=n(5736),i=n(6483),s=n(951),c=n.n(s),l=n(1207),d=n(6998),u=n(5042),p=n(5371),m=n(4391),h=n(6625),g=n(7735);const __=a.__,f=c()("videopress:actions"),v=async e=>{const t=await o()({path:(0,i.addQueryArgs)(`${m.u_}/${e?.id}`)}),n=(0,h.El)(t);return null!==n?.posterImage&&""!==n?.posterImage?Promise.resolve(n):new Promise(((t,n)=>{setTimeout((()=>{v(e).then(t).catch(n)}),2e3)}))},y={setIsFetchingVideos:e=>({type:m.QC,isFetching:e}),setFetchVideosError:e=>({type:m.tH,error:e}),setVideosQuery:e=>({type:m.Dj,query:e}),setVideosPagination:e=>({type:m.H,pagination:e}),setVideosFilter:(e,t,n)=>({type:m.$L,filter:e,value:t,isActive:n}),setVideos:e=>({type:m.p0,videos:e}),dismissFirstVideoPopover:()=>({type:m.pD}),setLocalVideos:e=>({type:m.FP,videos:e}),setIsFetchingLocalVideos:e=>({type:m.ZP,isFetching:e}),setLocalVideosQuery:e=>({type:m.Ps,query:e}),setLocalVideosPagination:e=>({type:m.Vc,pagination:e}),setVideosStorageUsed:e=>({type:m.vP,used:e}),setVideo:(e,t=!1)=>({type:m.Et,video:e,addAtEnd:t}),setIsFetchingUploadedVideoCount:e=>({type:m.z$,isFetchingUploadedVideoCount:e}),setUploadedVideoCount:e=>({type:m.Wi,uploadedVideoCount:e}),setVideoPrivacy:({id:e,privacySetting:t})=>({type:m.NL,id:e,privacySetting:t}),updateVideoPrivacy:(e,t)=>async({dispatch:n,select:r,resolveSelect:a})=>{const i=Number(t);if(isNaN(i))throw new Error(`Invalid privacy level: '${t}'`);if(0>i||i>=m.Vz.length)throw new Error(`Invalid privacy level: '${t}'`);if(1===t){const t=await r.getVideo(e);await a.getPlaybackToken(t?.guid)}n.setVideoPrivacy({id:e,privacySetting:i});try{const t=await o()({path:m.tb,method:"POST",data:{id:e,privacy_setting:i}});if(200!==t?.data)return;const{videoPressVideosPrivateForSite:a}=r.getVideoPressSettings();return n.updateVideoIsPrivate(e,(0,g.z)(i,a)),n({type:m.RB,id:e,privacySetting:i})}catch(e){console.error(e)}},removeVideo:e=>({type:m.Og,id:e}),deleteVideo:e=>async({dispatch:t,select:n})=>{t.removeVideo(e);let r={type:m.tw,id:e,hasBeenDeleted:!1,video:{}};try{const t=await o()({path:`${m.u_}/${e}`,method:"DELETE",data:{id:e,force:!0}});t?.deleted&&(r={...r,hasBeenDeleted:!0,video:t?.previous})}catch(e){console.error(e)}finally{t(r)}n.getProcessedAllVideosBeingRemoved()&&(t({type:m.wI}),t({type:m.Zp}))},uploadVideo:e=>async({dispatch:t})=>{const n=(0,p.Z)();f("Uploading video"),t({type:m.x_,id:n,title:e?.name});const r=await(0,d.Z)("upload-jwt");(0,u.Z)({tokenData:r,file:e,onError:e=>{f("Upload error",e);const r=e?.originalResponse?.getHeader("x-videopress-upload-error")||__("Upload error","jetpack-videopress-pkg");t({type:m.CH,id:n,error:r})},onProgress:(e,r)=>{t({type:m.dY,id:n,bytesSent:e,bytesTotal:r})},onSuccess:async e=>{f("Video uploaded",e),t({type:m.fi,id:n,data:e});const r=await v(e);t({type:m.pI,video:r})}})},uploadVideoFromLibrary:e=>async({dispatch:t})=>{const n=(0,p.Z)();t({type:m.x_,id:n,title:e?.title});const r=await(0,l.R2)(e?.id);t({type:m.W_,id:e?.id}),t({type:m.fi,id:n,data:r});const o=await v(r);t({type:m.pI,video:o})},setIsFetchingPurchases:e=>({type:m.CM,isFetching:e}),setPurchases:e=>({type:m.z8,purchases:e}),updateVideoPoster:(e,t,n)=>async({dispatch:r,select:a,resolveSelect:i})=>{const s=`${m.FY}/${t}/poster`,c=await a.getVideo(e),l=async()=>{if(!c.needsPlaybackToken)return null;const e=await i.getPlaybackToken(c.guid);return e?.token},d=(e,t)=>e&&t?`${e}?metadata_token=${t}`:e,u=()=>{setTimeout((async()=>{try{const t=await o()({path:s,method:"GET"});if(t?.data?.generating)u();else{const n=await l(),a=t?.data?.poster;r({type:m.Vm,id:e,poster:d(a,n)}),o()({path:m.tb,method:"POST",data:{id:e,poster:a}})}}catch(e){console.error(e)}}),2e3)};try{r({type:m.Db,id:e});const t=c.duration-n.at_time;t<50&&(n.at_time-=t+50);const a=await o()({method:"POST",path:s,data:n});if(a?.data?.generating)return void u();const i=await l(),p=d(a?.data?.poster,i);return r({type:m.Vm,id:e,poster:p})}catch(e){console.error(e)}},setUsers:e=>({type:m.b1,users:e}),setUsersPagination:e=>({type:m.IN,pagination:e}),setIsFetchingPlaybackToken:e=>({type:m.TD,isFetching:e}),setPlaybackToken:e=>({type:m.El,playbackToken:e}),expirePlaybackToken:e=>({type:m.o1,guid:e}),setVideoPressSettings:e=>({type:m.WJ,videoPressSettings:e}),updateVideoPressSettings:e=>async({dispatch:t})=>{if(!e)return;const n={force:!0};"boolean"==typeof e.videoPressVideosPrivateForSite&&(n.videopress_videos_private_for_site=e.videoPressVideosPrivateForSite);try{t.setVideoPressSettings(e);return await o()({path:m.uo,method:"PUT",data:n})}catch(e){console.error(e)}},updateVideoIsPrivate:(e,t)=>({type:m.jV,id:e,isPrivate:t}),dismissErroredVideo:e=>({type:m.k7,id:e})}},4391:(e,t,n)=>{"use strict";n.d(t,{$A:()=>W,$L:()=>R,CH:()=>V,CM:()=>L,Db:()=>$,Dj:()=>m,El:()=>z,Et:()=>P,FP:()=>E,FY:()=>i,Gr:()=>re,H:()=>h,IN:()=>B,JV:()=>d,Kc:()=>o,NL:()=>S,O1:()=>X,Og:()=>x,Ps:()=>k,QC:()=>u,RB:()=>_,TD:()=>A,UJ:()=>Q,Vc:()=>C,Vm:()=>G,Vz:()=>Y,WJ:()=>q,W_:()=>Z,Wi:()=>v,Z5:()=>oe,ZP:()=>w,Zp:()=>N,ah:()=>ae,b1:()=>H,dY:()=>I,fi:()=>O,jV:()=>J,jc:()=>ie,k7:()=>K,kH:()=>ee,o1:()=>M,p0:()=>g,pD:()=>b,pI:()=>F,pf:()=>ne,qP:()=>c,tH:()=>p,tT:()=>r,tb:()=>s,tw:()=>j,u_:()=>a,uo:()=>l,vP:()=>f,wI:()=>T,x4:()=>te,x_:()=>U,z$:()=>y,z8:()=>D});const r="videopress/media",o="wp/v2/users",a="wp/v2/media",i="wpcom/v2/videopress",s="wpcom/v2/videopress/meta",c="wpcom/v2/videopress/playback-jwt",l="videopress/v1/settings",d="videopress/v1/site",u="SET_IS_FETCHING_VIDEOS",p="SET_VIDEOS_FETCH_ERROR",m="SET_VIDEOS_QUERY",h="SET_VIDEOS_PAGINATION",g="SET_VIDEOS",f="SET_VIDEOS_STORAGE_USED",v="SET_UPLOADED_VIDEO_COUNT",y="SET_IS_FETCHING_UPLOADED_VIDEO_COUNT",b="DISMISS_FIRST_VIDEO_POPOVER",E="SET_LOCAL_VIDEOS",w="SET_IS_FETCHING_LOCAL_VIDEOS",k="SET_LOCAL_VIDEOS_QUERY",C="SET_LOCAL_VIDEOS_PAGINATION",Z="SET_LOCAL_VIDEO_UPLOADED",R="SET_VIDEOS_FILTER",P="SET_VIDEO",S="SET_VIDEO_PRIVACY",_="UPDATE_VIDEO_PRIVACY",j="DELETE_VIDEO",x="REMOVE_VIDEO",N="FLUSH_DELETED_VIDEOS",T="UPDATE_PAGINATION_AFTER_DELETE",U="SET_VIDEO_UPLOADING",V="SET_VIDEO_UPLOADING_ERROR",O="SET_VIDEO_PROCESSING",F="SET_VIDEO_UPLOADED",I="SET_VIDEO_UPLOAD_PROGRESS",L="SET_IS_FETCHING_PURCHASES",D="SET_PURCHASES",A="SET_IS_FETCHING_PLAYBACK_TOKEN",z="SET_PLAYBACK_TOKEN",M="EXPIRE_PLAYBACK_TOKEN",H="SET_USERS",B="SET_USERS_PAGINATION",$="SET_UPDATING_VIDEO_POSTER",G="UPDATE_VIDEO_POSTER",q="SET_VIDEOPRESS_SETTINGS",J="UPDATE_VIDEO_IS_PRIVATE",K="DISMISS_ERRORED_VIDEO",W="public",Q="private",X="site-default",Y=[W,Q,X],ee=2,te="G",ne="PG-13",re="R-17",oe="uploader",ae="rating",ie="privacy"},4817:(e,t,n)=>{"use strict";n.d(t,{N2:()=>h,tT:()=>i.tT});var r=n(951),o=n.n(r),a=n(1403),i=n(4391),s=n(2959),c=n(1834),l=n(2378),d=n(296);const u=o()("videopress/media:state"),p=window.jetpackVideoPressInitialState?.initialState||{videos:{}},m=window.location.hash.split("?");function h(){u("Initializing %o store",i.tT),d.Z.mayBeInit(i.tT,{__experimentalUseThunks:!0,reducer:s.Z,actions:a.Z,selectors:l.ZP,resolvers:c.Z,initialState:p})}"#/"===m?.[0]&&m?.[1]&&"page=1"!==m?.[1]&&(p.videos.isFetching=!0)},2959:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,t:()=>i});var r=n(9818),o=n(6483),a=n(4391);function i(){return{order:"desc",orderBy:"date",itemsPerPage:6,page:1,type:"video/videopress"}}const s=(0,r.combineReducers)({videos:(e,t)=>{switch(t.type){case a.QC:return{...e,isFetching:t.isFetching};case a.tH:{const{error:n}=t;return{...e,isFetching:!1,error:n}}case a.Dj:return{...e,query:{...e.query,...t.query},_meta:{...e._meta,relyOnInitialState:!1}};case a.H:return{...e,pagination:{...e.pagination,...t.pagination},_meta:{...e._meta,relyOnInitialState:!1}};case a.$L:{const{filter:n,value:r,isActive:o}=t;return{...e,filter:{...e.filter,[n]:{...e.filter?.[n]||{},[r]:o}},_meta:{...e._meta,relyOnInitialState:!1}}}case a.p0:{const{videos:n}=t;return{...e,items:n,isFetching:!1}}case a.Et:{const{video:n,addAtEnd:r=!1}=t,o=[...e.items??[]],a=o.findIndex((e=>e.id===n.id));return-1===a?r?o.push(n):o.unshift(n):o[a]={...o[a],...n},{...e,isFetching:!1,items:o}}case a.NL:{const{id:n,privacySetting:r}=t,o=[...e.items??[]],a=o.findIndex((e=>e.id===n));if(a<0)return e;const i=o[a].privacySetting;o[a]={...o[a],privacySetting:r};const s={...e._meta?.items??[]},c=s[n]??{};return{...e,items:o,_meta:{...e._meta,items:{...s,[n]:{...c,isUpdatingPrivacy:!0,hasBeenUpdatedPrivacy:!1,prevPrivacySetting:i}}}}}case a.RB:{const{id:n}=t,r={...e._meta?.items??[]};if(!r?.[n])return e;const o=r[n]??{};return{...e,_meta:{...e._meta,items:{...r,[n]:{...o,isUpdatingPrivacy:!1,hasBeenUpdatedPrivacy:!0,prevPrivacySetting:null}}}}}case a.jV:{const{id:n,isPrivate:r}=t,o=[...e.items??[]],a=o.findIndex((e=>e.id===n));return a<0?e:(o[a]={...o[a],isPrivate:r},{...e,items:o})}case a.Og:{const{id:n}=t,{items:r=[]}=e;if(r.findIndex((e=>e.id===n))<0)return e;const o={...e._meta?.items??[]},a=o[n]??{};return{...e,_meta:{...e._meta,videosBeingRemoved:[{id:n,processed:!1,deleted:!1},...e._meta.videosBeingRemoved??[]],items:{...o,[n]:{...a,isDeleting:!0}}}}}case a.tw:{const{id:n,hasBeenDeleted:r,video:o}=t,a=e?._meta?.items||[],i=a[n]||{},s=[...e._meta.videosBeingRemoved??[]],c=s.findIndex((e=>e.id===n));if(!i||c<0)return e;s[c].processed=!0,s[c].deleted=r;const l=0===s.filter((e=>!e.processed)).length;let d=e.uploadedVideoCount??0;if(l){d-=s.filter((e=>e.deleted)).length}return{...e,uploadedVideoCount:d,_meta:{...e._meta,videosBeingRemoved:s,processedAllVideosBeingRemoved:l,items:{...a,[n]:{...i,hasBeenDeleted:r,deletedVideo:o}}}}}case a.Zp:return{...e,_meta:{...e._meta,videosBeingRemoved:[],relyOnInitialState:!1}};case a.wI:{const{items:t=[],query:n={},pagination:r={},_meta:o={}}=e,{videosBeingRemoved:a=[]}=o,i=a.filter((e=>e.deleted)).length,s=t?.length===i,c=n?.page??1,l=r?.totalPages??1,d=r?.total,u=s&&c>1?c-1:c,p=s&&l>1?l-1:l;return{...e,query:{...n,page:u},pagination:{...r,total:d-1,totalPages:p}}}case a.vP:return{...e,storageUsed:t.used};case a.z$:return{...e,isFetchingUploadedVideoCount:t.isFetchingUploadedVideoCount};case a.Wi:return{...e,uploadedVideoCount:t.uploadedVideoCount,isFetchingUploadedVideoCount:!1};case a.x_:{const{id:n,title:r}=t,a=e?._meta||{},i=a?.items||{},s=(0,o.cleanForSlug)(r);return{...e,_meta:{...a,items:{...i,[n]:{title:s,uploading:!0}}}}}case a.CH:{const{id:n,error:r}=t,o=e?._meta||{},a=o?.items||{};return{...e,_meta:{...o,items:{...a,[n]:{...a[n],uploading:!1,error:r}}}}}case a.k7:{const{id:n}=t,r=e?._meta||{},o=r?.items||{};return delete o[n],{...e,_meta:{...r,items:{...o}}}}case a.fi:{const{id:n,data:r}=t,a=e?.query??{order:"desc",orderBy:"date",itemsPerPage:6,page:1,type:"video/videopress"},i={...e.pagination},s=[...e?.items??[]],c=e?._meta||{},l=Object.assign({},c?.items||{}),d=r?.src?.split("/")?.slice(-1)?.[0]||l[n]?.title||"",u=(0,o.cleanForSlug)(d);let p=e?.uploadedVideoCount??0,m=e?.firstUploadedVideoId??null,h=e?.firstVideoProcessed??!1,g=e?.dismissedFirstVideoPopover??!1;return 0===p&&(m=r.id,h=!1,g=!1),1!==a?.page||a?.search||(p=(e?.uploadedVideoCount??0)+1,i.total=p,i.totalPages=Math.ceil(p/a?.itemsPerPage),s.unshift({id:r.id,guid:r.guid,url:r.src,title:u,posterImage:null,finished:!1})),delete l[n],{...e,items:s,uploadedVideoCount:p,firstUploadedVideoId:m,firstVideoProcessed:h,dismissedFirstVideoPopover:g,pagination:i,_meta:{...c,items:l}}}case a.pI:{const{video:n}=t,r=[...e?.items??[]],o=r.findIndex((e=>e.id===n.id)),a=e?.firstUploadedVideoId??null;let i=e?.firstVideoProcessed??null;return n.id===a&&(i=!0),-1===o?{...e,firstVideoProcessed:i}:(r[o]=n,{...e,firstVideoProcessed:i,items:r})}case a.Db:{const{id:n}=t,r=e?._meta||{},o=r?.items||{},a=o[n]||{};return{...e,_meta:{...r,items:{...o,[n]:{...a,isUpdatingPoster:!0}}}}}case a.Vm:{const{id:n,poster:r}=t,o=[...e.items??[]],a=e?._meta||{},i=a?.items||{},s=o.findIndex((e=>e.id===n));return s>=0&&(o[s]={...o[s],posterImage:r}),{...e,items:o,_meta:{...a,items:{...i,[n]:{isUpdatingPoster:!1}}}}}case a.dY:{const{id:n,bytesSent:r,bytesTotal:o}=t,a=e?._meta||{},i=a?.items||{},s=i[n]||{},c=o>0?r/o:0;return{...e,_meta:{...a,items:{...i,[n]:{...s,uploadProgress:c}}}}}case a.pD:return{...e,dismissedFirstVideoPopover:!0,firstUploadedVideoId:null};default:return e}},localVideos:(e,t)=>{switch(t.type){case a.FP:{const{videos:n}=t;return{...e,items:n,isFetching:!1}}case a.ZP:return{...e,isFetching:t.isFetching};case a.Ps:return{...e,query:{...e.query,...t.query},_meta:{...e._meta,relyOnInitialState:!1}};case a.Vc:return{...e,pagination:{...e.pagination,...t.pagination},_meta:{...e._meta,relyOnInitialState:!1}};case a.W_:{const{id:n}=t,r=[...e?.items??[]],o=r.findIndex((e=>e.id===n));return-1===o?e:(r[o]={...r[o],isUploadedToVideoPress:!0},{...e,items:r,isFetching:!1})}}return e},purchases:(e,t)=>{switch(t.type){case a.CM:return{...e,isFetching:t.isFetching};case a.z8:return{...e,items:t.purchases,isFetching:!1};default:return e}},users:(e,t)=>{switch(t.type){case a.b1:return{...e,items:t.users};case a.IN:return{...e,pagination:{...e?.pagination||{},...t.pagination}};default:return e}},playbackTokens:(e,t)=>{switch(t.type){case a.TD:return{...e,isFetching:t.isFetching};case a.El:{const{playbackToken:n}=t,r=[...e.items??[]],o=r.findIndex((e=>e.guid===n.guid));return-1===o?r.unshift(n):r[o]={...r[o],...n},{...e,items:r,isFetching:!1}}case a.o1:{const{guid:n}=t,r=[...e.items??[]],o=r.findIndex((e=>e.guid===n));return o>-1&&r.splice(o,1),{...e,items:r,isFetching:!1}}default:return e}},siteSettings:(e,t)=>{if(t.type===a.WJ){const{videoPressSettings:n}=t;return{...e,...n}}return e}})},1834:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(6989),o=n.n(r),a=n(6483),i=n(4391),s=n(2959),c=n(6625);const{apiRoot:l}=window?.jetpackVideoPressInitialState||{};async function d(e,t,n){if(!e.needsPlaybackToken)return e;let r=await t.getPlaybackToken(e.guid);if(r){Number(r.issueTime)+864e5e?.videos?._meta?.relyOnInitialState,fulfill:()=>async({dispatch:e})=>{try{const t=await o()({path:i.JV});if(!t?.options?.videopress_storage_used)return;const n=t.options.videopress_storage_used?Math.round(1e3*Number(t.options.videopress_storage_used)*1e3):0;e.setVideosStorageUsed(n)}catch(e){console.error(e)}}},getUploadedVideoCount:{isFulfilled:e=>e?.videos?._meta?.relyOnInitialState,fulfill:()=>async({dispatch:e})=>{const t={per_page:1,media_type:"video",mime_type:"video/videopress"};e.setIsFetchingUploadedVideoCount(!0);try{const n=await fetch((0,a.addQueryArgs)(`${l}${i.u_}`,t)),r=Number(n.headers.get("X-WP-Total"));return e.setUploadedVideoCount(r),r}catch(e){console.error(e)}},shouldInvalidate:e=>e.type===i.fi||e.type===i.Zp},getVideos:{isFulfilled:e=>e?.videos?._meta?.relyOnInitialState,fulfill:()=>async({dispatch:e,select:t,resolveSelect:n})=>{e.setIsFetchingVideos(!0);let r=t.getVideosQuery();r||(r=(0,s.t)(),e.setVideosQuery(r));const o={order:r.order,orderby:r.orderBy,page:r.page,per_page:r.itemsPerPage,media_type:"video",mime_type:"video/videopress"};"string"==typeof r.search&&r.search.length>0&&(o.search=r.search);const u=t.getVideosFilter(),p=Object.keys(u?.rating||{}).filter((e=>u.rating[e])).join(",");p?.length&&(o.videopress_rating=p);const m=Object.keys(u?.privacy||{}).filter((e=>u.privacy[e])).join(",");m?.length&&(o.videopress_privacy_setting=m);const h=Object.keys(u?.uploader||{}).filter((e=>u.uploader[e])).join(",");h?.length&&(o.author=h);try{const t=await fetch((0,a.addQueryArgs)(`${l}${i.u_}`,o)),r=Number(t.headers.get("X-WP-Total")),s=Number(t.headers.get("X-WP-TotalPages"));e.setVideosPagination({total:r,totalPages:s});const u=await t.json(),p=await Promise.all((0,c.WZ)(u).map((async t=>await d(t,n,e))));return e.setVideos(p),u}catch(e){console.error(e)}},shouldInvalidate:({type:e})=>e===i.Dj||e===i.Zp||e===i.$L},getVideo:{isFulfilled:(e,t)=>{if(!t||"string"==typeof t)return!0;const n=(e.videos.items??[]).find((({id:e})=>e===t));if(n&&n.needsPlaybackToken){return!!(e?.playbackTokens?.items||[]).find((e=>e?.guid===n.guid))}return n},fulfill:(e,t=!1)=>async({dispatch:n,resolveSelect:r})=>{n.setIsFetchingVideos(!0);try{const s=await o()({path:(0,a.addQueryArgs)(`${i.u_}/${e}`)}),l=await d((0,c.El)(s),r,n);return n.setVideo(l,t),s}catch(e){console.error(e)}}},getLocalVideos:{isFulfilled:e=>e?.localVideos?._meta?.relyOnInitialState,fulfill:()=>async({dispatch:e,select:t})=>{let n=t.getLocalVideosQuery();e.setIsFetchingLocalVideos(!0),n||(n=(0,s.t)(),e.setVideosQuery(n));const r={order:n.order,orderby:n.orderBy,page:n.page,per_page:n.itemsPerPage,media_type:"video",no_videopress:!0};"string"==typeof n.search&&n.search.length>0&&(r.search=n.search);try{const t=await fetch((0,a.addQueryArgs)(`${l}${i.u_}`,r)),n=Number(t.headers.get("X-WP-Total")),o=Number(t.headers.get("X-WP-TotalPages"));e.setLocalVideosPagination({total:n,totalPages:o});const s=await t.json();return e.setLocalVideos((0,c.n1)(s)),s}catch(e){console.error(e)}},shouldInvalidate:e=>e.type===i.Ps},getUsers:{isFulfilled:e=>e?.users?._meta?.relyOnInitialState,fulfill:()=>async({dispatch:e})=>{e.setIsFetchingLocalVideos(!0);try{const t=await fetch(`${l}${i.Kc}`),n=Number(t.headers.get("X-WP-Total")),r=Number(t.headers.get("X-WP-TotalPages"));e.setUsersPagination({total:n,totalPages:r});const o=await t.json();if(!o?.length)return;return e.setUsers(o.map((e=>({id:e.id,name:e.name,slug:e.slug,description:e.description,link:e.link,avatar:e.avatar_urls})))),o}catch(e){console.error(e)}}},getPlaybackToken:{isFulfilled:(e,t)=>{const n=e?.playbackTokens?.items??[];return n?.some((e=>e?.guid===t))},fulfill:e=>async({dispatch:t})=>{t.setIsFetchingPlaybackToken(!0);try{const n=await o()({path:(0,a.addQueryArgs)(`${i.qP}/${e}`),method:"POST"}),r={guid:e,token:n.playback_token,issueTime:Date.now()};return t.setPlaybackToken(r),r}catch(e){console.error(e)}},shouldInvalidate:(e,t)=>e.type===i.o1&&e.guid===t},getVideoPressSettings:{isFulfilled:e=>void 0!==e?.siteSettings,fulfill:()=>async({dispatch:e})=>{try{const{videopress_videos_private_for_site:t}=await o()({path:(0,a.addQueryArgs)(`${i.uo}`),method:"GET"}),n={videoPressVideosPrivateForSite:t};return e.setVideoPressSettings(n),n}catch(e){console.error(e)}}}}},2378:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>o});const r=e=>e?.videos?.items||[],o={getVideos:r,getUploadingVideos:e=>{const t=e?.videos?._meta?.items||{};return Object.keys(t||{}).map((e=>({...t[e],id:e}))).filter((e=>e.uploading))},getVideosQuery:e=>e?.videos?.query,getPagination:e=>e?.videos?.pagination,getVideosFilter:e=>e?.videos?.filter,getUploadedVideoCount:e=>e?.videos?.uploadedVideoCount,getIsFetching:e=>e?.videos?.isFetching,getIsFetchingUploadedVideoCount:e=>e?.videos?.isFetchingUploadedVideoCount,getStorageUsed:e=>({storageUsed:e?.videos?.storageUsed}),getFirstUploadedVideoId:e=>e?.videos?.firstUploadedVideoId,getFirstVideoProcessed:e=>e?.videos?.firstVideoProcessed,getDismissedFirstVideoPopover:e=>e?.videos?.dismissedFirstVideoPopover,getProcessedAllVideosBeingRemoved:e=>e?.videos?._meta?.processedAllVideosBeingRemoved,getLocalVideos:e=>e?.localVideos?.items||[],getIsFetchingLocalVideos:e=>e?.localVideos?.isFetching,getLocalVideosQuery:e=>e?.localVideos?.query,getLocalPagination:e=>e?.localVideos?.pagination,getUploadedLocalVideoCount:e=>e?.localVideos?.uploadedVideoCount,getVideo:(e,t)=>r(e).find((({id:e})=>e===t)),getVideoStateMetadata:(e,t)=>(e?.videos?._meta?.items||{})[t]||{},getUsers:e=>e?.users?.items||[],getUsersPagination:e=>e?.users?.pagination,getPurchases:e=>e?.purchases?.items||[],isFetchingPurchases:e=>e?.purchases?.isFetching,getPlaybackToken:(e,t)=>(e?.playbackTokens?.items||[]).find((e=>e?.guid===t))||{},isFetchingPlaybackToken:e=>e?.playbackTokens?.isFetching,getVideoPressSettings:e=>e?.siteSettings,getUploadErrorVideos:e=>{const t=e?.videos?._meta?.items||{};return Object.keys(t||{}).map((e=>({...t[e],id:e}))).filter((e=>!!e.error))}}},296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(9818);class o{static store=null;static mayBeInit(e,t){null===o.store&&(o.store=(0,r.createReduxStore)(e,t),(0,r.register)(o.store))}}const a=o},6625:(e,t,n)=>{"use strict";n.d(t,{El:()=>r,WZ:()=>o,n1:()=>i});const r=e=>{const{media_details:t,id:n,jetpack_videopress:r,jetpack_videopress_guid:o}=e,{videopress:a,width:i,height:s}=t,{title:c,description:l,caption:d,rating:u,allow_download:p,display_embed:m,privacy_setting:h,needs_playback_token:g,is_private:f}=r,{original:v,poster:y,upload_date:b,duration:E,file_url_base:w,finished:k,files:C={dvd:{original_img:""}}}=a||{},{dvd:Z}=C,R=Z?.original_img?`${w.https}${Z.original_img}`:void 0,P=v?.split("/").slice(-1)[0];return{id:n,guid:o,title:c,description:l,caption:d,url:v,uploadDate:b,duration:E,isPrivate:f,posterImage:y,allowDownload:p,displayEmbed:m,rating:u,privacySetting:h,needsPlaybackToken:g,width:i,height:s,poster:{src:y},thumbnail:R,finished:k,filename:P}},o=e=>e?.map?.(r),a=e=>{const{media_details:t,id:n,jetpack_videopress:r,source_url:o,date:a}=e,{width:i,height:s,length:c}=t,{title:l,description:d,caption:u}=r;return{id:n,title:l,description:d,caption:u,width:i,height:s,url:o,uploadDate:a,duration:c}},i=e=>e.map(a)},7735:(e,t,n)=>{"use strict";n.d(t,{z:()=>o});var r=n(4391);const o=(e,t)=>r.Vz[e]!==r.$A&&(r.Vz[e]===r.UJ||t)},5178:(e,t,n)=>{"use strict";function r(e){return e.replace(/([-_][a-z])/gi,(e=>e.toUpperCase().replace("_","")))}function o(e,t=!1){const n=Object.assign({},e);for(const e in n)n.hasOwnProperty(e)&&-1!==e.indexOf("_")&&(n[r(e)]=n[e],t&&delete n[e]);return n}n.d(t,{N:()=>o})},5371:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=()=>{const e=new Uint32Array(10);crypto.getRandomValues(e);return`${performance.now().toString(36)}-${Array.from(e).map((e=>e.toString(36))).join("")}`}},172:(e,t,n)=>{"use strict";function r(e){if(!e)return[];return e.split("\n").map((e=>function(e){const t=/(?\(?(?