initial
This commit is contained in:
commit
9883323161
17470 files changed
+4470592
No files matched your search
+2294
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '174f7dde97b3cbbddea5');
|
||||
+1
@@ -0,0 +1 @@
|
||||
:where(._fUXxnSp5pagKBp9gSN7) *{box-sizing:border-box}.cAbGtJDGgLubucBnz7vM{background-color:var(--jp-white)}.vMa4i_Dza2t5Zi_Bw9Nf{background:var(--jp-white-off);overflow:hidden;padding-top:1px}@media(min-resolution:192dpi){:root{--wpds-border-width-focus:1.5px}}.jetpack-footer{border-top:1px solid #f0f0f0;box-sizing:border-box;font-size:13px;padding:20px 24px;width:100%}.jetpack-footer .jetpack-footer__menu-item:any-link,.jetpack-footer .jetpack-footer__menu-item[role=button]{color:#707070;cursor:pointer;text-decoration:none}.jetpack-footer .jetpack-footer__menu-item:hover{text-decoration:underline}.jetpack-footer>ul{list-style:none;margin:0;padding:0}.jetpack-footer>ul>li{margin:0}.jetpack-footer__logo{flex-shrink:0}@media(min-width:480px){a.jetpack-footer__a8c{margin-inline-start:auto}}a.jetpack-footer__a8c svg{fill:#707070}@media(max-width:599px){.RuVLl3q4lxTQa3wbhBJB{grid-column-end:span 1}.f9LZTRG4MMK42rS89afW{grid-column-start:1}.bHe_zKxjjpUwHw_MdYE1{grid-column-end:2}.QZbNrOqE2aNSn50xVhpU{grid-column-end:span 2}.ev7W3z7zVYPeHAlYqZjf{grid-column-start:2}.NJWd1m_e7lOiPYru2ZMP{grid-column-end:3}.Xc6nt1Qc1DI0Z2A3gt1r{grid-column-end:span 3}.UIcN_GXiPRoIsin8Kohg{grid-column-start:3}.GRKCyqb5LufCSCgykKFc{grid-column-end:4}.i_qTq8gqhhC3vIUepVRB{grid-column-end:span 4}.G3qaZ3Jpbvam_1XvGxgc{grid-column-start:4}.VRCNYKZtO9zukEwmgP1y{grid-column-end:5}}@media(min-width:600px)and (max-width:959px){.tRm008K_WJL79WoNZTNL{grid-column-end:span 1}.l5T2P_bgKts4tdaRkS1d{grid-column-start:1}.zOCxfLZpF6BlgC7a_Yq1{grid-column-end:2}.F80DdgVn0m5OpvtSQWka{grid-column-end:span 2}.oI1c7JYfiJtMQHbhngtU{grid-column-start:2}.pMQtA_4jh1_1lVknqEP5{grid-column-end:3}.VenqMpdgyKQVUNNQcfqd{grid-column-end:span 3}.seNYL99uoczf9V4MxBxT{grid-column-start:3}.YKfF1HFhI9KygA5l3b2J{grid-column-end:4}.yAi0Cv1xDWkoqsaUhvhR{grid-column-end:span 4}.ubhnyZOnkgxNhh6XtVWv{grid-column-start:4}.RGOPGQbWMJ9Ei5oFxS7X{grid-column-end:5}.Sz1E2aWbX483ijdi6yge{grid-column-end:span 5}.tku6_bRYrX9tMbgYGmIl{grid-column-start:5}.b5JHttOhSEcI1WBlqAjk{grid-column-end:6}.FboSx5MoKTAWbxXyYlCw{grid-column-end:span 6}.Jhs8yEEmodG30edbJvag{grid-column-start:6}.IpzbbKVqEqPcfIGkXkwt{grid-column-end:7}.mhCPwfAZ4Kmm_empzJAq{grid-column-end:span 7}.x034ilrJF7rO9UJB2rI1{grid-column-start:7}.Wt8t2e16viRrOJ1lLA5v{grid-column-end:8}.S6pIrEy9AMLKx9bgh_Ae{grid-column-end:span 8}.kEfI4tGyuWfHTlRnvIab{grid-column-start:8}.PUzX4RRsKq1dnsz3gebS{grid-column-end:9}}@media(min-width:960px){.X_pdcLJikd8LS_YAdJlB{grid-column-end:span 1}.tl936d14Huby4khYp05X{grid-column-start:1}.hnge0LnR69d3NXEtEE1t{grid-column-end:2}.fj0NUMuyZQcPNgKcjp5Z{grid-column-end:span 2}.R2ncBX7a2NigdYCcV1OX{grid-column-start:2}.t8vMSDVYno9k9itRwnXb{grid-column-end:3}.wsDuEN2GqHx6qzo8dUdk{grid-column-end:span 3}.cIEVPUweWtLBy3xaXnMx{grid-column-start:3}.fajUWBwu1m2B479j3jmz{grid-column-end:4}.YR0c7fQTgMkDdWzwSyLp{grid-column-end:span 4}.xlwp8BmplxkKNMI7gamo{grid-column-start:4}._C4O1w9DUqx1m3gPf8aA{grid-column-end:5}.Z54F1hAErckAIrKlxnXW{grid-column-end:span 5}.ezSDWkRHmKSxDJXxuiOH{grid-column-start:5}.T0ChoeAjGJjkkNrYhD4g{grid-column-end:6}.qtMoMPF6yHvGJnWHSsde{grid-column-end:span 6}.gdoywN5VPiWERfIBqkph{grid-column-start:6}.wUev_VH5uf_pwFFlbnAU{grid-column-end:7}.egIPDFJsOpownTClq9XP{grid-column-end:span 7}.yGhp9yoAW7k0kQik9AB7{grid-column-start:7}.SJ43U9mR5wUg5V2qBeQA{grid-column-end:8}.cTuyHfMwSUJxN_HdIEgd{grid-column-end:span 8}.smCr8DaIagcumdvdldiK{grid-column-start:8}.T03NHzQJvzwL6wAfIiTL{grid-column-end:9}.pMvxM3RJGjqyNdf9qg1Y{grid-column-end:span 9}.iIVpNRwEnQ_JI5gpp9EN{grid-column-start:9}.ZbQ4u4vGSX5rJOje4uGL{grid-column-end:10}.gKb5wuIDAlKGbrjK2vxy{grid-column-end:span 10}.Z7pINdImE2WJiYnZBTqm{grid-column-start:10}.ZTxp6qpvwurMdOnLLSz1{grid-column-end:11}.NnQTlbfnxPDR6cQ7rygg{grid-column-end:span 11}.O137wZd6Yl0olSA9PsXR{grid-column-start:11}.zf2OJtQ2MPz6SDoh6CB0{grid-column-end:12}.U3H6UHW6HqRt9hdzVg3O{grid-column-end:span 12}.zynnNeS_ZBTxABcVpUQH{grid-column-start:12}.vI8tltFZtFUNAy9Iag9s{grid-column-end:13}}.SqdhUZkXCRuIpErj1B3z{--max-container-width:1040px;--vertical-gutter:24px;--horizontal-spacing:8px;column-gap:var(--vertical-gutter);display:grid;margin:0 auto;width:100%}@media(max-width:599px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(4,minmax(0,1fr));max-width:calc(var(--max-container-width) + 32px);padding:0 16px}}@media(min-width:600px)and (max-width:959px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(8,minmax(0,1fr));max-width:calc(var(--max-container-width) + 36px);padding:0 18px}}@media(min-width:960px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(12,minmax(0,1fr));max-width:calc(var(--max-container-width) + 48px);padding:0 24px}}.SqdhUZkXCRuIpErj1B3z.OZC_9a1LhpWF9dv15Gdh{max-width:none;padding:unset}.sexr0jUxC1jVixdKiDnC{margin-left:-20px}@media(max-width:782px){.sexr0jUxC1jVixdKiDnC{margin-left:-10px}}.sexr0jUxC1jVixdKiDnC.vKQ11sLeAM45M04P1ccj{background-color:var(--jp-white)}.sexr0jUxC1jVixdKiDnC.zWDcRnnZPA743KzSQdUg .jp-admin-page__page>:first-child{border-boLine truncated
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/*! For license information please see index.js.LICENSE.txt */
|
||||
(()=>{var e,t,r={6941(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let o=0,n=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(o++,"%c"===e&&(n=o))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(3212)(t);const{formatters:o}=e.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,r){e.exports=function(e){function t(e){let r,n,i,a=null;function s(...e){if(!s.enabled)return;const o=s,n=Number(new Date),i=n-(r||n);o.diff=i,o.prev=r,o.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,n)=>{if("%%"===r)return"%";a++;const i=t.formatters[n];if("function"==typeof i){const t=e[a];r=i.call(o,t),e.splice(a,1),a--}return r}),t.formatArgs.call(o,e);(o.log||t.log).apply(o,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=o,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(n!==t.namespaces&&(n=t.namespaces,i=t.enabled(e)),i),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function o(e,r){const o=t(this.namespace+(void 0===r?":":r)+e);return o.log=this.log,o}function n(e,t){let r=0,o=0,n=-1,i=0;for(;r<e.length;)if(o<t.length&&(t[o]===e[r]||"*"===t[o]))"*"===t[o]?(n=o,i=r,o++):(r++,o++);else{if(-1===n)return!1;o=n+1,i++,r=i}for(;o<t.length&&"*"===t[o];)o++;return o===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(n(e,r))return!1;for(const r of t.names)if(n(e,r))return!0;return!1},t.humanize=r(7378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},4111(e,t,r){"use strict";r.d(t,{A:()=>o});const o={wrapper:"GqFcAwJvIrg1v7f6QUfw",header:"OENx8kmm62tkWGukzP2S",title:"KnqJLKwSceJTwFJrPGHq","close-button":"PJU0_yA9jNf7ao0jhHut",footer:"rrORM3zqHfGvqiPduEXY",steps:"Q7fUcDUGhteXEr18rZPC","action-button":"S5LAeskUiEQ0JlPhr0Ze"}},969(e,t,r){"Line truncated
|
||||
__("%1$d of %2$d","jetpack-videopress-pkg"),p,h)),(0,u.jsx)(o.Popover,{...k,children:(0,u.jsx)(l.Ay,{children:(0,u.jsxs)("div",{className:d.A.wrapper,children:[(0,u.jsxs)("div",{className:d.A.header,children:[(0,u.jsx)(c.Ay,{variant:"title-small",className:d.A.title,children:t}),!e&&(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(s.A,{size:"small",variant:"tertiary","aria-label":"close",className:d.A["close-button"],icon:a.A,iconSize:16,onClick:y})})]}),r,(0,u.jsxs)("div",{className:d.A.footer,children:[j&&(0,u.jsx)(c.Ay,{variant:"body",className:d.A.steps,children:A}),(0,u.jsx)(s.A,{variant:"primary",className:d.A["action-button"],disabled:m,onClick:w,isExternalLink:v,href:g,children:f})]})]})})})}},2947(e,t,r){"use strict";r.d(t,{A:()=>f});var o=r(5932),n=r(1753),i=r(7723),a=r(3022),s=r(1609),c=r(8250),l=r(7142),d=r(8509),u=r(5918),p=r(969),h=r(790);const __=i.__,f=({children:e,className:t,showHeader:r=!0,showFooter:f=!0,showBackground:m=!0,sandboxedDomain:g="",apiRoot:v="",apiNonce:b="",optionalMenuItems:y,header:w,title:_,subTitle:x,logo:k,actions:j,breadcrumbs:A,tabs:S,showBottomBorder:C=!0,unwrapped:P=!1})=>{(0,s.useEffect)(()=>{o.Ay.setApiRoot(v),o.Ay.setApiNonce(b)},[v,b]);const E=(0,a.A)(p.A["admin-page"],"jp-admin-page",t,{[p.A.background]:m,[p.A["without-bottom-border"]]:S||!C}),N=(0,s.useCallback)(async()=>{try{const e=await o.Ay.fetchSiteConnectionTest();window.alert(e.message)}catch(e){window.alert((0,i.sprintf)(/* translators: %s: an error message. */
|
||||
__("There was an error testing Jetpack. Error: %s","jetpack-videopress-pkg"),e.message))}},[]);return r&&(_||A)?(0,h.jsx)("div",{className:E,children:(0,h.jsxs)(n.A,{className:"jp-admin-page__page",visual:k||(0,h.jsx)(l.A,{showText:!1,height:20}),breadcrumbs:A,title:_,subTitle:x,actions:j,showSidebarToggle:!1,children:[S,P?e:(0,h.jsx)(u.A,{fluid:!0,horizontalSpacing:0,children:(0,h.jsx)(d.A,{children:e})}),f&&(0,h.jsx)(c.A,{menu:y})]})}):(0,h.jsxs)("div",{className:E,children:[r&&(0,h.jsx)(u.A,{horizontalSpacing:5,children:(0,h.jsxs)(d.A,{className:(0,a.A)(p.A["admin-page-header"],"jp-admin-page-header"),children:[w||(0,h.jsx)(l.A,{}),g&&(0,h.jsx)("code",{className:p.A["sandbox-domain-badge"],onClick:N,onKeyDown:N,role:"button",tabIndex:0,title:`Sandboxing via ${g}. Click to test connection.`,children:"API Sandboxed"})]})}),(0,h.jsx)(u.A,{fluid:!0,horizontalSpacing:0,children:(0,h.jsx)(d.A,{children:e})}),f&&(0,h.jsx)(c.A,{menu:y})]})}},5640(e,t,r){"use strict";r.d(t,{A:()=>i});var o=r(9282),n=r(790);const i=({children:e})=>(0,n.jsx)("div",{className:o.A.section,children:e})},766(e,t,r){"use strict";r.d(t,{A:()=>i});var o=r(6996),n=r(790);const i=({children:e})=>(0,n.jsx)("div",{className:o.A["section-hero"],children:e})},8907(e,t,r){"use strict";r.d(t,{A:()=>a});var o=r(7723),n=r(3022),i=r(790);const __=o.__,a=({title:e=__("An Automattic Airline","jetpack-videopress-pkg"),height:t=7,className:r,...o})=>(0,i.jsxs)("svg",{role:"img",x:"0",y:"0",viewBox:"0 0 935 38.2",enableBackground:"new 0 0 935 38.2","aria-labelledby":"jp-automattic-byline-logo-title",height:t,className:(0,n.A)("jp-automattic-byline-logo",r),...o,children:[(0,i.jsx)("desc",{id:"jp-automattic-byline-logo-title",children:e}),(0,i.jsx)("path",{d:"M317.1 38.2c-12.6 0-20.7-9.1-20.7-18.5v-1.2c0-9.6 8.2-18.5 20.7-18.5 12.6 0 20.8 8.9 20.8 18.5v1.2C337.9 29.1 329.7 38.2 317.1 38.2zM331.2 18.6c0-6.9-5-13-14.1-13s-14 6.1-14 13v0.9c0 6.9 5 13.1 14 13.1s14.1-6.2 14.1-13.1V18.6zM175 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7L157 1.3h5.5L182 36.8H175zM159.7 8.2L152 23.1h15.7L159.7 8.2zM212.4 38.2c-12.7 0-18.7-6.9-18.7-16.2V1.3h6.6v20.9c0 6.6 4.3 10.5 12.5 10.5 8.4 0 11.9-3.9 11.9-10.5V1.3h6.7V22C231.4 30.8 225.8 38.2 212.4 38.2zM268.6 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H268.6zM397.3 36.8V8.7l-1.8 3.1 -14.9 25h-3.3l-14.7-25 -1.8-3.1v28.1h-6.5V1.3h9.2l14 24.4 1.7 3 1.7-3 13.9-24.4h9.1v35.5H397.3zM454.4 36.8l-4.7-8.8h-20.9l-4.5 8.8h-7l19.2-35.5h5.5l19.5 35.5H454.4zM439.1 8.2l-7.7 14.9h15.7L439.1 8.2zM488.4 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H488.4zM537.3 6.8v30h-6.7v-30h-15.5V1.3h37.7v5.5H537.3zM569.3 36.8V4.6c2.7 0 3.7-1.4 3.7-3.4h2.8v35.5L569.3 36.8 569.3 36.8zM628 11.3c-3.2-2.9-7.9-5.7-14.2-5.7 -9.5 0-14.8 6.5-14.8 13.3v0.7c0 6.7 5.4 13 15.3 13 5.9 0 10.8-2.8 13.9-5.7l4 4.2c-3.9 3.8-10.5 7.1-18.3 7.1 -13.4 0-21.6-8.7-21.6-18.3v-1.2c0-9.6 8.9-18.7 21.9-18.7 7.5 0 14.3 3.1 18 7.1L628 11.3zM321.5 12.4c1.2 0.8 1.5 2.4 0.8 3.6l-6.1 9.4c-0.8 1.2-2.4 1.6-3.6 0.8l0 0c-1.2-0.8-1.5-2.4-0.8-3.6l6.1-9.4C318.7 11.9 320.3 11.6 321.5 12.4L321.5 12.4z"}),(0,i.jsx)("path",{d:"M37.5 36.7l-4.7-8.9H11.7l-4.6 8.9H0L19.4 0.8H25l19.7 35.9H37.5zM22 7.8l-7.8 15.1h15.9L22 7.8zM82.8 36.7l-23.3-24 -2.3-2.5v26.6h-6.7v-36H57l22.6 24 2.3 2.6V0.8h6.7v35.9H82.8z"}),(0,i.jsx)("path",{d:"M719.9 37l-4.8-8.9H694l-4.6 8.9h-7.1l19.5-36h5.6l19.8 36H719.9zM704.4 8l-7.8 15.1h15.9L704.4 8zM733 37V1h6.8v36H733zM781 37c-1.8 0-2.6-2.5-2.9-5.8l-0.2-3.7c-0.2-3.6-1.7-5.1-8.4-5.1h-12.8V37H750V1h19.6c10.8 0 15.7 4.3 15.7 9.9 0 3.9-2 7.7-9 9 7 0.5 8.5 3.7 8.6 7.9l0.1 3c0.1 2.5 0.5 4.3 2.2 6.1V37H781zM778.5 11.8c0-2.6-2.1-5.1-7.9-5.1h-13.8v10.8h14.4c5 0 7.3-2.4 7.3-5.2V11.8zM794.8 37V1h6.8v30.4h28.2V37H794.8zM836.7 37V1h6.8v36H836.7zM886.2 37l-23.4-24.1 -2.3-2.5V37h-6.8V1h6.5l22.7 24.1 2.3 2.6V1h6.8v36H886.2zM902.3 37V1H935v5.6h-26v9.2h20v5.5h-20v10.1h26V37H902.3z"})]})},1112(e,t,r){"use strict";r.d(t,{A:()=>p});var o=r(6427),n=r(7723),i=r(3109),a=r(1866),s=r(3022),c=r(1609),l=r(7934),d=r(790);const __=n.__,u=(0,c.forwardRef)((e,t)=>{const{children:r,variant:n="primary",size:c="normal",weight:u="bold",icon:p,iconSize:h,disabled:f,isDestructive:m,isLoading:g,isExternalLink:v,className:b,text:y,fullWidth:w,..._}=e,x=(0,s.A)(l.A.button,b,{[l.A.normal]:"normal"===c,[l.A.small]:"small"===c,[l.A.icon]:Boolean(p),[l.A.loading]:g,[l.A.regular]:"regular"===u,[l.A["full-width"]]:w,[l.A["is-icon-button"]]:Boolean(p)&&!r}),k="normal"===c?20:16,j=v&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{size:k,icon:a.A,className:l.A["external-icon"]}),(0,d.jsx)(o.VisuallyHidden,{as:"span",children:/* translators: accessibility text */
|
||||
__("(opens in a new tab)","jetpack-videopress-pkg")})]}),A=v?"_blank":void 0,S=r?.[0]&&null!==r[0]&&"components-tooltip"!==r?.[0]?.props?.className,C={ref:t,target:A,variant:n,className:(0,s.A)(x,{"has-text":!!p&&S}),icon:v?void 0:p,iconSize:h,disabled:f,"aria-disabled":f,isDestructive:m,text:y,..._};return(0,d.jsxs)(o.Button,{...C,children:[g&&(0,d.jsx)(o.Spinner,{}),(0,d.jsx)("span",{children:r}),j]})});u.displayName="Button";const p=u},597(e,t,r){"use strict";r.d(t,{A:()=>u});var o=r(6427),n=r(3109),i=r(8847),a=r(3022),s=r(1609),c=r(1112),l=(r(7191),r(790));const d=e=>({"top-end":"top left",top:"top center","top-start":"top right","bottom-end":"bottom left",bottom:"bottom center","bottom-start":"bottom right"}[e]),u=({className:e="",iconClassName:t="",placement:r="bottom-end",animate:u=!0,iconCode:p=i.A,iconSize:h=18,offset:f=10,title:m,children:g,popoverAnchorStyle:v="icon",forceShow:b=!1,hoverShow:y=!1,wide:w=!1,inline:_=!0,shift:x=!1})=>{const[k,j]=(0,s.useState)(!1),[A,S]=(0,s.useState)(null),C=(0,s.useCallback)(()=>j(!1),[j]),P=(0,s.useCallback)(e=>{e.preventDefault(),j(!k)},[k,j]),E={position:d(r),placement:r,animate:u,noArrow:!1,resize:!1,flip:!1,offset:f,focusOnMount:"firstElement",onClose:C,className:"icon-tooltip-container",inline:_,shift:x},N="wrapper"===v,T=(0,a.A)("icon-tooltip-wrapper",e),F={left:N?0:-(62-h/2)+"px"},R=N&&b,O=(0,s.useCallback)(()=>{y&&(A&&(clearTimeout(A),S(null)),j(!0))},[y,A]),U=(0,s.useCallback)(()=>{if(y){const e=setTimeout(()=>{j(!1),S(null)},100);S(e)}},[y]);return(0,l.jsxs)("div",{className:T,"data-testid":"icon-tooltip_wrapper",onMouseEnter:O,onMouseLeave:U,children:[!N&&(0,l.jsx)(c.A,{variant:"link",onMouseDown:P,children:(0,l.jsx)(n.A,{className:t,icon:p,size:h})}),(0,l.jsx)("div",{className:(0,a.A)("icon-tooltip-helper",{"is-wide":w}),style:F,children:(R||k)&&(0,l.jsx)(o.Popover,{...E,children:(0,l.jsxs)("div",{children:[m&&(0,l.jsx)("div",{className:"icon-tooltip-title",children:m}),(0,l.jsx)("div",{className:"icon-tooltip-content",children:g})]})})})]})}},8250(e,t,r){"use strict";r.d(t,{A:()=>h});var o=r(7999),n=r(7723),i=r(1220),a=r(9968),s=r(9654),c=r(3022),l=r(3924),d=r(8907),u=(r(5250),r(7142)),p=r(790);const __=n.__,h=({className:e,menu:t,...r})=>{let n=[];return(0,o.isWpcomPlatformSite)()||window?.JetpackNetworkAdminData||(n=[{label:__("Products","jetpack-videopress-pkg"),href:(0,o.getAdminUrl)("admin.php?page=my-jetpack#/products")},{label:__("Help","jetpack-videopress-pkg"),href:(0,o.getAdminUrl)("admin.php?page=my-jetpack#/help")},...n]),t&&(n=[...n,...t]),(0,p.jsxs)(i.B,{render:(0,p.jsx)("footer",{}),className:(0,c.A)("jetpack-footer",e),"aria-label":__("Jetpack","jetpack-videopress-pkg"),role:"contentinfo",direction:"row",justify:"flex-start",align:"center",wrap:"wrap",gap:"xl",...r,children:[(0,p.jsxs)(i.B,{className:"jetpack-footer__logo",direction:"row",gap:"sm",align:"center",children:[(0,p.jsx)(u.A,{showText:!1,height:16,"aria-hidden":"true"}),(0,p.jsx)(a.E,{variant:"body-md",children:"Jetpack"})]}),(0,p.jsx)(i.B,{render:(0,p.jsx)("ul",{}),direction:"row",gap:"lg",wrap:"wrap",children:n.map(e=>(0,p.jsx)("li",{children:(0,p.jsx)(a.E,{variant:"body-md",className:"jetpack-footer__menu-item",render:e.href?(0,p.jsx)(s.N,{href:e.href,title:e.title||"",onClick:e.onClick||void 0,onKeyDown:e.onKeyDown||void 0}):(0,p.jsx)(s.N,{render:(0,p.jsx)("span",{}),tabIndex:0,title:e.title||"",onClick:e.onClick||void 0,onKeyDown:e.onKeyDown||void 0,role:"button"}),children:e.label})},e.label))}),(0,p.jsx)("a",{className:"jetpack-footer__a8c",href:(0,l.A)("a8c-about"),rel:"noopener noreferrer",target:"_blank",children:(0,p.jsx)(d.A,{height:8})})]})}},7142(e,t,r){"use strict";r.d(t,{A:()=>a});var o=r(7723),n=r(3022),i=r(790);const __=o.__,a=({logoColor:e="#069e08",showText:t=!0,className:r,height:o=32,title:a,...s})=>{const c=t?"0 0 118 32":"0 0 32 32",l=a??__("Jetpack Logo","jetpack-videopress-pkg");return(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:c,className:(0,n.A)("jetpack-logo",r),"aria-labelledby":"jetpack-logo-title",height:o,...s,role:"img",children:[(0,i.jsx)("title",{id:"jetpack-logo-title",children:l}),(0,i.jsx)("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),(0,i.jsx)("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),(0,i.jsx)("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),(0,i.jsx)("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.Line truncated
|
||||
// translators: %s: Name of the current feature
|
||||
default:(0,n.sprintf)(__("%s coming soon","jetpack-videopress-pkg"),r)}:{lg:t?m:g,default:t?r:(0,n.sprintf)(/* translators: %s: Name of the current feature */
|
||||
__("%s not included","jetpack-videopress-pkg"),r)})(t,e,S),T=x?N.lg:N.default;return j?(0,f.jsx)("div",{className:(0,c.A)(h.A.item,h.A.value,h.A.empty)}):(0,f.jsxs)("div",{className:(0,c.A)(h.A.item,h.A.value),children:[(0,f.jsx)(i.A,{className:(0,c.A)(h.A.icon,A?h.A["icon-check"]:h.A["icon-cross"]),size:32,icon:A?a.A:s.A}),(0,f.jsx)(p.Ay,{variant:"body-small",children:u||T}),E&&(0,f.jsx)(d.A,{title:w||P,iconClassName:h.A["popover-icon"],className:(0,c.A)(h.A.popover,_),placement:"bottom-end",iconSize:14,offset:4,wide:Boolean(w&&y),inline:!1,shift:!0,children:(0,f.jsx)(p.Ay,{variant:"body-small",component:"div",children:y||C})})]})},w=({title:e,children:t})=>(0,f.jsxs)("div",{className:h.A.headerContainer,children:[e&&(0,f.jsx)(p.Ay,{variant:"headline-small",className:h.A.title,children:e}),(0,f.jsx)("div",{className:h.A.header,children:t})]}),_=({primary:e=!1,children:t,className:r})=>{let o=0;return(0,f.jsx)("div",{className:(0,c.A)(h.A.card,{[h.A["is-primary"]]:e},r),children:l.Children.map(t,e=>{const t=e;return t.type===y?(o++,(0,l.cloneElement)(t,{index:o-1})):t})})},x=({title:e,headerLogo:t,items:r,children:n,showIntroOfferDisclaimer:i=!1})=>{const a=(0,o.useViewportMatch)("large");return(0,f.jsxs)(b.Provider,{value:r,children:[(0,f.jsx)("div",{className:(0,c.A)(h.A.container,{[h.A["is-viewport-large"]]:a}),style:{"--rows":r.length+1,"--columns":l.Children.toArray(n).length+1},children:(0,f.jsxs)("div",{className:h.A.table,children:[(0,f.jsxs)("div",{children:[t&&(0,f.jsx)("div",{className:h.A["header-logo"],children:t}),(0,f.jsx)(p.Ay,{variant:"headline-small",className:h.A.tableTitle,children:e})]}),a&&r.map((e,t)=>e.name?(0,f.jsxs)("div",{className:(0,c.A)(h.A.item,h.A.feature,{[h.A["last-feature"]]:t===r.length-1}),children:[(0,f.jsx)(p.Ay,{variant:"body-small",children:(0,f.jsx)("strong",{children:e.name})}),e.tooltipInfo&&(0,f.jsx)(d.A,{title:e.tooltipTitle,iconClassName:h.A["popover-icon"],className:h.A.popover,placement:e.tooltipPlacement?e.tooltipPlacement:"bottom-end",iconSize:14,offset:4,wide:Boolean(e.tooltipTitle&&e.tooltipInfo),inline:!1,shift:!0,children:(0,f.jsx)(p.Ay,{variant:"body-small",children:e.tooltipInfo})})]},t):(0,f.jsx)("div",{className:(0,c.A)(h.A.item,h.A.feature,h.A.empty)},t)),n]})}),(0,f.jsx)("div",{className:h.A["tos-container"],children:(0,f.jsxs)("div",{className:h.A.tos,children:[i&&(0,f.jsx)(p.Ay,{variant:"body-small",children:__("Reduced pricing is a limited offer for the first year and renews at regular price.","jetpack-videopress-pkg")}),(0,f.jsx)(u.A,{multipleButtons:!0})]})})]})}},489(e,t,r){"use strict";r.d(t,{A:()=>l});var o=r(7723),n=r(3022),i=r(7425),a=r(2746),s=r(3211),c=r(790);const __=o.__,l=({price:e,offPrice:t,currency:r="",showNotOffPrice:o=!0,hideDiscountLabel:l=!0,promoLabel:d="",legend:u=__("/month, paid yearly","jetpack-videopress-pkg"),isNotConvenientPrice:p=!1,hidePriceFraction:h=!1,children:f,variant:m="default"})=>{if(null==e&&null==t||!r)return null;o=o&&null!=t;const g="number"==typeof e&&"number"==typeof t?Math.floor((e-t)/e*100):0,v=!l&&g&&g>0?g+__("% off","jetpack-videopress-pkg"):null;return"simple"===m?(0,c.jsxs)("div",{className:s.A.simple,children:[(0,c.jsxs)("div",{className:s.A.currentPrice,children:[(0,c.jsx)(a.g,{value:t??e,currency:r,isOff:!p,hidePriceFraction:h,inline:!0}),(0,c.jsx)("div",{children:u})]}),o&&(0,c.jsxs)("div",{className:s.A.originalPrice,children:[(0,c.jsx)(a.g,{value:e,currency:r,isOff:!1,hidePriceFraction:h,inline:!0}),(0,c.jsx)("div",{children:g&&g>0&&g+__("% off the first year","jetpack-videopress-pkg")})]})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:s.A.container,children:(0,c.jsxs)("div",{className:(0,n.A)(s.A["price-container"],"product-price_container"),children:[(0,c.jsx)(a.g,{value:t??e,currency:r,isOff:!p,hidePriceFraction:h}),o&&(0,c.jsx)(a.g,{value:e,currency:r,isOff:!1,hidePriceFraction:h}),v&&(0,c.jsx)(i.Ay,{className:(0,n.A)(s.A["promo-label"],"product-price_promo_label"),children:v})]})}),(0,c.jsxs)("div",{className:s.A.footer,children:[f||(0,c.jsx)(i.Ay,{className:(0,n.A)(s.A.legend,"product-price_legend"),children:u}),d&&(0,c.jsx)(i.Ay,{className:(0,n.A)(s.A["promo-label"],"product-price_promo_label"),children:d})]})]})}},2746(e,t,r){"use strict";r.d(t,{g:()=>c});var o=r(4268),n=r(3022),i=r(7425),a=r(3211),s=r(790);const c=({value:e,currency:t,isOff:r,hidePriceFraction:c,inline:l=!1})=>{const d=(0,n.A)(a.A.price,"product-price_price",{[a.A["is-not-off-price"]]:!r,[a.A["price-inline"]]:l}),{symbol:u,integer:p,fraction:h}=(0,o.vA)(e,t),f=!c||!h.endsWith("00");return(0,s.jsxs)(i.Ay,{className:d,variant:"headline-medium",component:"p",children:[l?(0,s.jsxs)(s.Fragment,{children:[u,p]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Ay,{className:a.A.symbol,component:"sup",variant:"title-medium",children:u}),p]}),f&&(0,s.jsx)(i.Ay,{component:"sup",variant:"body-small","data-testid":"PriceFraction",children:(0,s.jsx)("strong",{children:h})})]})}},5879(e,t,r){"use strict";r.d(t,{ALine truncated
|
||||
__("By clicking <strong>%1$s</strong> or <strong>%2$s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.","jetpack-videopress-pkg"),e[0],e[1]),{strong:(0,l.jsx)("strong",{}),tosLink:(0,l.jsx)(h,{slug:"wpcom-tos"}),shareDetailsLink:(0,l.jsx)(h,{slug:"jetpack-support-what-data-does-jetpack-sync"})}):(0,o.createInterpolateElement)(__("By clicking the buttons above, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.","jetpack-videopress-pkg"),{tosLink:(0,l.jsx)(h,{slug:"wpcom-tos"}),shareDetailsLink:(0,l.jsx)(h,{slug:"jetpack-support-what-data-does-jetpack-sync"})}),u=({agreeButtonLabel:e})=>(0,o.createInterpolateElement)((0,n.sprintf)(/* translators: %s is a button label */
|
||||
__("By clicking <strong>%s</strong>, you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site‘s data</shareDetailsLink> with us.","jetpack-videopress-pkg"),e),{strong:(0,l.jsx)("strong",{}),tosLink:(0,l.jsx)(h,{slug:"wpcom-tos"}),shareDetailsLink:(0,l.jsx)(h,{slug:"jetpack-support-what-data-does-jetpack-sync"})}),p=()=>(0,o.createInterpolateElement)(__("By continuing you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site’s data</shareDetailsLink> with us. We’ll check if that email is linked to an existing WordPress.com account or create a new one instantly.","jetpack-videopress-pkg"),{tosLink:(0,l.jsx)(h,{slug:"wpcom-tos"}),shareDetailsLink:(0,l.jsx)(h,{slug:"jetpack-support-what-data-does-jetpack-sync"})}),h=({slug:e,children:t})=>(0,l.jsx)(i.N,{openInNewTab:!0,className:"terms-of-service__link",href:(0,s.A)(e),children:t}),f=({className:e,multipleButtons:t,agreeButtonLabel:r,isTextOnly:o,...n})=>(0,l.jsx)(c.Ay,{className:(0,a.A)(e,"terms-of-service"),...n,children:o?(0,l.jsx)(p,{}):t?(0,l.jsx)(d,{multipleButtonsLabels:t}):(0,l.jsx)(u,{agreeButtonLabel:r})})},110(e,t,r){"use strict";r.d(t,{Q:()=>o,Z:()=>n});const o={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},n=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},7425(e,t,r){"use strict";r.d(t,{Ay:()=>l,hE:()=>d});var o=r(3022),n=r(1609),i=r(110),a=r(8763),s=r(790);const c=(0,n.forwardRef)(({variant:e="body",children:t,component:r,className:c,...l},d)=>{const u=r||i.Q[e]||"span",p=(0,n.useMemo)(()=>i.Z.reduce((e,t)=>(void 0!==l[t]&&(e+=a.A[`${t}-${l[t]}`]+" ",delete l[t]),e),""),[l]);return(0,s.jsx)(u,{className:(0,o.A)(a.A.reset,a.A[e],c,p),...l,ref:d,children:t})});c.displayName="Text";const l=c,d=({children:e,size:t="medium",...r})=>(0,s.jsx)(c,{variant:`title-${t}`,mb:1,...r,children:e})},723(e,t,r){"use strict";r.d(t,{Ay:()=>p});var o=r(1609),n=r(8706),i=r(790);const a={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},s={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},c={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},l={"--spacing-base":"8px"},d={},u=(e,t,r)=>{const o={...a,...s,...c,...l};for(const t in o)e.style.setProperty(t,o[t]);r&&e.classList.add(n.A.global),t&&(d[t]={provided:!0,root:e})},p=({children:e=null,targetDom:t,id:r,withGlobalStyles:n=!0})=>{const a=(0,o.useRef)(),s=d?.[r]?.provided;return(0,o.useLayoutEffect)(()=>{if(!s)return t?u(t,r,n):void(a?.current&&u(a.current,r,n))},[t,a,s,r,n]),t?(0,i.jsx)(i.Fragment,{children:e}):(0,i.jsx)("div",{ref:a,children:e})}},3924(e,t,r){"use strict";function o(e,t={}){const r={};let o;if("undefined"!=typeof window&&(o=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,r.url=encodeURIComponent(e)}else r.source=encodeURIComponent(e);for(const e in t)r[e]=encodeURIComponent(t[e]);!Object.keys(r).includes("site")&&"undefined"!=typeof jetpack_redirects&&Object.hasOwn(jetpack_redirects,"currentSiteRawUrl")&&(r.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),o&&(r.calypso_env=o);return"https://jetpack.com/redirect/?"+Object.keys(r).map(e=>e+"="+r[e]).join("&")}r.d(t,{A:()=>o})},6439(e,t,r){let o={};try{o=r(3018)}catch{console.errorLine truncated
|
||||
__("%s Videos","jetpack-videopress-pkg"),t),R=1===t?T:F;return(0,_.jsxs)("div",{className:w.A["library-wrapper"],children:[(0,_.jsx)(o.Ay,{variant:"headline-small",mb:1,children:g}),!P&&(0,_.jsx)(o.Ay,{className:w.A["total-sm"],children:R}),(0,_.jsxs)("div",{className:w.A["total-filter-wrapper"],children:[P&&(0,_.jsx)(o.Ay,{children:R}),p?null:(0,_.jsxs)("div",{className:w.A["filter-wrapper"],children:[(0,_.jsx)(m.DO,{className:(0,d.A)(w.A["search-input"],{[w.A.small]:!P}),onSearch:A,value:S,loading:y,onChange:C,disabled:b}),(0,_.jsx)(v.Fr,{onClick:()=>N(e=>!e),isActive:E,disabled:b}),(0,_.jsx)(n.A,{variant:"tertiary",size:"small",icon:r===k?l.A:c.A,onClick:a})]})]}),E&&(0,_.jsx)(v.M2,{className:w.A["filter-section"]}),e]})},S=({videos:e,totalVideos:t,loading:r})=>{const n=(0,p.Zp)(),{search:i}=(0,f.Ay)(),c=[...e.filter(e=>e.error),...e.filter(e=>e.uploading),...e.filter(e=>!e.uploading&&!e.error).slice(0,6)],l=localStorage.getItem(x),[d,h]=(0,u.useState)(l??j),m=e?.some?.(e=>e.uploading),v=e=>{n(`/video/${e?.id}/edit`)},S=d===j?(0,_.jsx)(b.A,{videos:c,onVideoDetailsClick:v,loading:r,count:m?c.length:6}):(0,_.jsx)(y.A,{videos:c,onVideoDetailsClick:v,hidePlays:!0,loading:r});return(0,_.jsxs)(A,{totalVideos:t,onChangeType:()=>{h(e=>{const t=e===j?k:j;return localStorage.setItem(x,t),t})},libraryType:d,title:__("Your VideoPress library","jetpack-videopress-pkg"),children:[c.length>0||r?S:(0,_.jsx)(o.Ay,{children:i.trim()?(0,a.createInterpolateElement)((0,s.sprintf)(/* translators: %s: the search term */
|
||||
__("No videos match your search for <em>%s</em>.","jetpack-videopress-pkg"),i),{em:(0,_.jsx)("em",{className:w.A["query-no-results"]})}):__("No videos match your filtering criteria.","jetpack-videopress-pkg")}),(0,_.jsx)(g.XL,{className:w.A.pagination})]})},C=({videos:e,totalVideos:t,loading:r,uploading:o,onUploadClick:n})=>(0,_.jsxs)(A,{totalVideos:t,hideFilter:!0,title:__("Local videos","jetpack-videopress-pkg"),children:[(0,_.jsx)(y.R,{videos:e,loading:r,onActionClick:n,uploading:o}),(0,_.jsx)(g.O6,{className:w.A.pagination})]})},6955(e,t,r){"use strict";r.d(t,{A:()=>l});var o=r(1112),n=r(9491),i=r(7723),a=r(1609),s=r(1757),c=r(790);const __=i.__,l=({text:e,value:t,onCopy:r,resetTime:i=3e3})=>{const l=__("Copied!","jetpack-videopress-pkg"),d=__("Copy","jetpack-videopress-pkg"),[u,p]=(0,a.useState)(!1),h=t||e,f=(0,n.useCopyToClipboard)(h,()=>{const e=setTimeout(()=>{p(!1),clearTimeout(e)},i);p(!0),r?.()});return(0,c.jsxs)("div",{className:s.A.wrapper,children:[(0,c.jsx)("input",{type:"text",value:e||t,onClick:e=>{e.currentTarget.select()},readOnly:!0}),(0,c.jsx)(o.A,{weight:"regular",variant:"secondary",size:"small",ref:f,children:u?l:d})]})}},3378(e,t,r){"use strict";r.d(t,{A:()=>d});var o=r(723),n=r(7425),i=r(1112),a=r(6427),s=r(7723),c=r(6936),l=r(790);const __=s.__,d=({onClose:e,onDelete:t})=>(0,l.jsx)(a.Modal,{title:__("Delete video","jetpack-videopress-pkg"),onRequestClose:e,className:c.A["delete-video-modal"],children:(0,l.jsx)(o.Ay,{children:(0,l.jsxs)("div",{children:[(0,l.jsx)(n.Ay,{children:__("This action cannot be undone.","jetpack-videopress-pkg")}),(0,l.jsxs)("div",{className:c.A["modal-actions"],children:[(0,l.jsx)(i.A,{className:c.A["modal-action-button"],variant:"secondary",weight:"bold",onClick:e,children:__("Cancel","jetpack-videopress-pkg")}),(0,l.jsx)(i.A,{className:c.A["modal-action-button"],isDestructive:!0,variant:"primary",weight:"bold",onClick:t,children:__("Delete","jetpack-videopress-pkg")})]})]})})})},2784(e,t,r){"use strict";r.d(t,{A:()=>V});var o=r(5640),n=r(2947),i=r(8509),a=r(5918),s=r(7425),c=r(1876),l=r(6427),d=r(7723),u=r(3109),p=r(1490),h=r(3022),f=r(1609),m=r(6212),g=r(6151),v=r(7726),b=r(7121),y=r(2843),w=r(6720),_=r(2439),x=r(8962),k=r(9072),j=r(4951),A=r(957),S=r(5333),C=r(4565),P=r(3287),E=r(5419),N=r(4231),T=r(90),F=r(2267),R=r(790);const __=d.__,O=()=>{},U=({title:e,onChangeTitle:t,description:r,onChangeDescription:o,loading:n=!1,disabled:i=!1,actions:a})=>{const{hasIncompleteChapters:s}=(0,_.A)(r);return(0,R.jsxs)(R.Fragment,{children:[n?(0,R.jsx)(c.A,{height:88}):(0,R.jsx)(S.Ay,{value:e,label:__("Title","jetpack-videopress-pkg"),name:"title",onChange:t,onEnter:O,disabled:i,size:"large"}),n?(0,R.jsx)(c.A,{height:133,className:T.A.input}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(S.Ay,{value:r,className:T.A.input,label:__("Description","jetpack-videopress-pkg"),name:"description",onChange:o,onEnter:O,disabled:i,type:"textarea",size:"large",rows:8}),(0,R.jsx)("div",{className:T.A["chapters-help-container"],children:s?(0,R.jsx)(y.A,{className:T.A["incomplete-chapters-notice"]}):(0,R.jsx)("div",{className:T.A["learn-more"],children:(0,R.jsx)(g.A,{})})})]}),!n&&a&&(0,R.jsx)("div",{className:T.A.actions,children:a})]})},V=()=>{const{guid:e,id:t,duration:r,posterImage:d,filename:g,uploadDate:y,url:_,width:S,height:O,title:V,description:D,rating:L,privacySetting:z,allowDownload:I,displayEmbed:M,isPrivate:B,isFetchingPlaybackToken:$,hasChanges:H,updating:G,updated:q,deleted:W,isFetching:J,isDeleting:K,handleSaveChanges:Z,handleDelete:Q,setTitle:X,setDescription:Y,setRating:ee,setPrivacySetting:te,setAllowDownload:re,setDisplayEmbed:oe,processing:ne,useVideoAsThumbnail:ie,selectedTime:ae,handleConfirmFrame:se,handleCloseSelectFrame:ce,handleOpenSelectFrame:le,handleVideoFrameSelected:de,frameSelectorIsOpen:ue,selectPosterImageFromLibrary:pe,posterImageSource:he,libraryAttachment:fe,isUpdatingPoster:me}=(0,F.A)(),{canPerformAction:ge}=(0,k.J)(),ve=__("There are unsaved changes. Are you sure you want to exit?","jetpack-videopress-pkg"),be=H&&!q&&!W&&ge,ye=ne||me;(0,j.A)({shouldPrevent:be||ye,message:ve});const we=(0,m.Zp)(),{page:_e}=(0,A.mo)();(0,f.useEffect)(()=>{if(!0===W){we(_e>1?`/?page=${_e}`:"/")}},[W]),ge||we("/");let xe=d;"video"===he&&ie?xe=(0,R.jsx)(w.L,{src:_,currentTime:ae}):"upload"===he&&(xe=fe.url);const ke=J||$,je=K||G,Ae=`[videopress ${e}${S?` w=${S}`:""}${O?` h=${O}`:""}]`,Se=_e>1?`#/?page=${_e}`:"#/",Ce=(0,R.jsx)("nav",{"aria-label":__("Breadcrumbs","jetpack-videopress-pkg"),className:T.A.breadcrumbs,children:(0,R.jsxs)(l.__experimentalHStack,{as:"ul",className:"admin-ui-breadcrumbs__list",spacing:0,justify:"flex-start",alignment:"center",children:[(0,R.jsx)("li",{children:(0,R.jsx)("a",{href:Se,className:T.A["breadcrumb-link"],children:"VideoPress"})}),(0,R.jsx)("li",{children:(0,R.jsx)("h1",{className:T.A["breadcrumb-current"],children:__("Edit","jetpack-videopress-pkg")})})]})}),Pe=[(0,R.jsx)(P.A,{videoId:t,disabled:je||ke,onDelete:Q},"video-detaiLine truncated
|
||||
__("%1$s%% off","jetpack-videopress-pkg"),f.discount):null,legend:__("/month, billed yearly","jetpack-videopress-pkg"),currency:f.currency}),(0,d.jsx)(o.A,{onClick:()=>{e?.(),y()},isLoading:w,fullWidth:!0,disabled:v||w||g,children:__("Get VideoPress","jetpack-videopress-pkg")})]}),(0,d.jsx)(n.eY,{isIncluded:!0}),(0,d.jsx)(n.eY,{isIncluded:!0}),(0,d.jsx)(n.eY,{isIncluded:!0}),(0,d.jsx)(n.eY,{isIncluded:!0})]}),(0,d.jsxs)(n.N0,{children:[(0,d.jsxs)(n.i7,{children:[(0,d.jsx)(i.A,{price:0,legend:"",currency:f.currency,hidePriceFraction:!0}),(0,d.jsx)(o.A,{fullWidth:!0,variant:"secondary",onClick:()=>{b(!0),m(),e?.()},isLoading:g||v,disabled:g||v||w,children:__("Start for free","jetpack-videopress-pkg")})]}),(0,d.jsx)(n.eY,{isIncluded:!1,label:(0,d.jsx)("strong",{children:__("Upload one video","jetpack-videopress-pkg")})}),(0,d.jsx)(n.eY,{isIncluded:!0}),(0,d.jsx)(n.eY,{isIncluded:!1}),(0,d.jsx)(n.eY,{isIncluded:!1})]})]})}},7663(e,t,r){"use strict";r.d(t,{A:()=>h});var o=r(7425),n=r(1330),i=r(7143),a=r(7723),s=r(3832),c=r(6287),l=r(7882),d=r(957),u=r(3908),p=r(790);const __=a.__,h=({id:e,position:t=null,anchor:r=null})=>{const a=(0,i.useDispatch)(c.ax),{data:h}=(0,l.A)(Number(e)),{firstUploadedVideoId:f,firstVideoProcessed:m,dismissedFirstVideoPopover:g}=(0,d.Ay)(),v=Number(f)===Number(e)&&m&&!g,b=()=>a.dismissFirstVideoPopover(),y=window.jetpackVideoPressInitialState?.contentNonce??"",w=(0,s.addQueryArgs)("post-new.php",{videopress_guid:h.guid,_wpnonce:y});return v&&(0,p.jsx)(n.A,{title:__("Publish your new video","jetpack-videopress-pkg"),buttonContent:__("Add video to post","jetpack-videopress-pkg"),buttonHref:w,buttonExternalLink:!0,anchor:r,onClose:b,onClick:b,noArrow:!1,className:u.A["action-popover"],position:t,children:(0,p.jsx)(o.Ay,{children:__("Now that your video has been uploaded to VideoPress, it's time to show it to the world.","jetpack-videopress-pkg")})})}},8031(e,t,r){"use strict";r.d(t,{Aq:()=>n,Xb:()=>o});const o="atomic",n="jetpack"},3322(e,t,r){"use strict";r.d(t,{M:()=>f});var o=r(8509),n=r(5918),i=r(7425),a=r(6427),s=r(7723),c=r(9072),l=r(9177),d=r(8031),u=r(3068),p=r(790);const __=s.__,h=({videoPressVideosPrivateForSite:e,siteIsPrivate:t,siteType:r,onPrivacyChange:s})=>{const{canPerformAction:l}=(0,c.J)(),h=t&&r===d.Xb,f=!l||h,m=h?__("You cannot change this setting because your site is private. You can only choose the video privacy default on public sites.","jetpack-videopress-pkg"):null;return(0,p.jsxs)(n.A,{horizontalSpacing:6,horizontalGap:0,children:[(0,p.jsx)(o.A,{children:(0,p.jsx)(i.Ay,{variant:"headline-small",mb:1,children:__("Settings","jetpack-videopress-pkg")})}),(0,p.jsx)(o.A,{sm:12,md:12,lg:12,children:(0,p.jsx)(a.CheckboxControl,{label:__("Video Privacy: Restrict views to members of this site","jetpack-videopress-pkg"),className:u.A["privacy-toggle"],onChange:s,checked:e,disabled:f,help:m||void 0})})]})},f=()=>{const{settings:e,onUpdate:t}=(0,l.T)(),{videoPressVideosPrivateForSite:r,siteIsPrivate:o,siteType:n}=e;return(0,p.jsx)(h,{videoPressVideosPrivateForSite:r,siteIsPrivate:o,siteType:n,onPrivacyChange:e=>{t({videoPressVideosPrivateForSite:e})}})}},1497(e,t,r){"use strict";r.d(t,{A:()=>w});var o=r(3924),n=r(7425),i=r(1112),a=r(1330),s=r(9491),c=r(7143),l=r(7723),d=r(3109),u=r(5673),p=r(5462),h=r(7839),f=r(3022),m=r(1609),g=r(6287),v=r(5419),b=r(5493),y=r(790);const __=l.__,w=({title:e,id:t})=>{const{dismissErroredVideo:r}=(0,c.useDispatch)(g.ax),l=!e,[w,_]=(0,m.useState)(null),x=(0,s.useViewportMatch)("small","<"),[k,j]=(0,m.useState)(!1),[A,S]=(0,m.useState)(!1),C=()=>r(t),P=()=>S(!0),E=(0,o.A)("jetpack-videopress-dashboard-troubleshoot"),N=()=>S(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("div",{className:(0,f.A)(b.A["video-card__wrapper"],{[b.A["is-blank"]]:l,[b.A.disabled]:x}),...x&&{onClick:()=>j(e=>!e)},children:[!x&&(0,y.jsx)("div",{className:b.A["video-card__background"]}),(0,y.jsx)(v.Ay,{className:b.A["video-card__thumbnail"],ref:_,hasError:!0}),(0,y.jsxs)("div",{className:b.A["video-card__title-section"],children:[x&&(0,y.jsxs)("div",{className:b.A.chevron,children:[k&&(0,y.jsx)(d.A,{icon:p.A}),!k&&(0,y.jsx)(d.A,{icon:u.A})]}),(0,y.jsx)(n.hE,{className:b.A["video-card__title"],mb:0,size:"small",children:e})]}),A&&(0,y.jsx)(a.A,{title:__("Error","jetpack-videopress-pkg"),buttonContent:__("Visit the docs","jetpack-videopress-pkg"),buttonHref:E,buttonExternalLink:!0,anchor:w,onClose:N,onClick:N,noArrow:!1,className:b.A["action-popover"],children:(0,y.jsx)(n.Ay,{children:__("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")})}),!x&&(0,y.jsxs)("div",{className:(0,f.A)(b.A["video-card__quick-actions-section"],b.A["is-blank"]),children:[(0,y.jsx)(i.A,{variant:"primary",size:"small",onClick:P,children:__("Upload Error!","jetpack-videopress-pkg")}),(0,y.jsx)(i.A,{size:"small",variant:"tertiary",icon:h.A,onClick:C})Line truncated
|
||||
__("%s plays","jetpack-videopress-pkg"),(0,a.ZV)(n)):"",[F,R]=(0,f.useState)(null),O=(0,s.useViewportMatch)("small","<"),[U,V]=(0,f.useState)(!1),D=k||A;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:(0,h.A)(w.A["video-card__wrapper"],{[w.A["is-blank"]]:E,[w.A.disabled]:O||D}),...O&&!D&&{onClick:()=>V(e=>!e)},children:[!O&&(0,_.jsx)("div",{className:w.A["video-card__background"]}),(0,_.jsx)(y.Ay,{className:w.A["video-card__thumbnail"],thumbnail:m,loading:k||j,uploading:A,processing:S,duration:k?null:r,editable:!k&&g,uploadProgress:C,ref:R}),(0,_.jsxs)("div",{className:w.A["video-card__title-section"],children:[O&&!D&&(0,_.jsxs)("div",{className:w.A.chevron,children:[U&&(0,_.jsx)(l.A,{icon:p.A}),!U&&(0,_.jsx)(l.A,{icon:u.A})]}),k?(0,_.jsx)(i.A,{width:"60%",height:30}):(0,_.jsx)(o.hE,{className:w.A["video-card__title"],mb:0,size:"small",children:e}),k?(0,_.jsx)(i.A,{width:96,height:24}):(0,_.jsx)(_.Fragment,{children:N&&(0,_.jsxs)(o.Ay,{weight:"regular",size:"small",component:"div",className:w.A["video-card__video-plays-counter"],children:[(0,_.jsx)(l.A,{icon:d.A}),T]})})]}),(0,_.jsx)(v.A,{id:t,anchor:F}),b&&!O&&(0,_.jsx)(x,{id:t,onVideoDetailsClick:P,className:(0,h.A)({[w.A["is-blank"]]:k})})]}),b&&O&&U&&(0,_.jsx)(x,{id:t,onVideoDetailsClick:P,className:w.A.small})]})},j=({id:e,...t})=>{const{isDeleting:r,uploading:o,processing:n,isUpdatingPoster:i,data:a,uploadProgress:s}=(0,g.A)(e),c=(r||t?.loading)&&!o&&!n,l=t?.editable&&!r&&!o&&!n;return(0,_.jsx)(k,{id:e,...t,loading:c,uploading:o,isUpdatingPoster:i,processing:n,editable:l,privacySetting:a.privacySetting,uploadProgress:s})}},3287(e,t,r){"use strict";r.d(t,{A:()=>g});var o=r(723),n=r(6427),i=r(7723),a=r(7823),s=r(6501),c=r(7855),l=r(7839),d=r(3832),u=r(1609),p=r(7882),h=r(3378),f=r(153),m=r(790);const __=i.__,g=({disabled:e=!1,videoId:t,onDelete:r})=>{const[i,g]=(0,u.useState)(!1),{data:{guid:v,url:b},deleteVideo:y}=(0,p.A)(t),w=window.jetpackVideoPressInitialState?.contentNonce??"",_=(0,d.addQueryArgs)("post-new.php",{videopress_guid:v,_wpnonce:w}),x=(0,u.useCallback)(async()=>{g(!1),await y(),r()},[y,r]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(n.Dropdown,{placement:"bottom center",renderToggle:({isOpen:t,onToggle:r})=>(0,m.jsx)(n.Button,{size:"compact",variant:"tertiary",disabled:e,icon:c.A,onClick:r,"aria-expanded":t}),renderContent:({onClose:t})=>(0,m.jsx)(o.Ay,{children:(0,m.jsxs)("div",{className:f.A.dropdown,children:[(0,m.jsx)(n.Button,{variant:"tertiary",icon:s.A,href:_,target:"_blank",disabled:e,onClick:t,children:__("Add to new post","jetpack-videopress-pkg")}),(0,m.jsx)(n.Button,{variant:"tertiary",icon:a.A,href:b,target:"_blank",disabled:e,onClick:t,children:__("Download file","jetpack-videopress-pkg")}),(0,m.jsx)("hr",{className:f.A.separator}),(0,m.jsx)(n.Button,{variant:"tertiary",icon:l.A,className:f.A.delete,disabled:e,onClick:()=>{g(!0),t()},children:__("Delete video","jetpack-videopress-pkg")})]})})}),i&&(0,m.jsx)(h.A,{onClose:()=>g(!1),onDelete:x})]})}},4565(e,t,r){"use strict";r.d(t,{A:()=>u});var o=r(7425),n=r(1876),i=r(8443),a=r(7723),s=r(9689),c=r(6955),l=r(971),d=r(790);const __=a.__,u=({filename:e,uploadDate:t,shortcode:r,loading:a=!1,guid:u,isPrivate:p})=>{const h=!!t?.length&&(0,i.gmdateI18n)("F j, Y",t),f=(0,s.rB)(u,p);return(0,d.jsxs)("div",{className:l.A.details,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(o.Ay,{variant:"body-small",children:__("Link to video","jetpack-videopress-pkg")}),a?(0,d.jsx)(n.A,{height:36}):(0,d.jsx)(c.A,{value:f})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(o.Ay,{variant:"body-small",children:__("WordPress shortcode","jetpack-videopress-pkg")}),a?(0,d.jsx)(n.A,{height:36}):(0,d.jsx)(c.A,{value:r})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(o.Ay,{variant:"body-small",children:__("File name","jetpack-videopress-pkg")}),a?(0,d.jsx)(n.A,{height:24}):(0,d.jsx)(o.Ay,{className:l.A.filename,children:e})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(o.Ay,{variant:"body-small",children:__("Upload date","jetpack-videopress-pkg")}),a?(0,d.jsx)(n.A,{height:24}):(0,d.jsx)(o.Ay,{children:h})]})]})}},1755(e,t,r){"use strict";r.d(t,{Fr:()=>b,M2:()=>_});var o=r(8509),n=r(5918),i=r(7425),a=r(1112),s=r(6427),c=r(9491),l=r(7723),d=r(3022),u=r(6639),p=r(8962),h=r(8728),f=r(2807),m=r(957),g=r(2309),v=r(790);const __=l.__,b=e=>{const{isActive:t,...r}=e;return(0,v.jsx)(a.A,{variant:t?"primary":"secondary",className:(0,d.A)(g.A["filter-button"],{[g.A["is-active"]]:t}),icon:u.A,weight:"regular",...r,children:__("Filters","jetpack-videopress-pkg")})},y=e=>(0,v.jsx)(s.CheckboxControl,{className:g.A["filter-checkbox"],label:e.label,checked:e.checked,disabled:e.disabled,onChange:e.onChange}),w=e=>{const t=(0,c.useViewportMatch)("small","<"),r=(t,r)=>!0===e?.filter?.[t]?.[r];return(0,v.jsx)("div",{className:(0,d.A)(g.A["filters-section"],e.className),children:(0,v.jsxs)(n.A,{horizontalSpacing:t?2:4,horizontalGap:2,children:[(0,v.jsxs)(o.A,{sm:4,md:4,lg:4,children:[(0,v.jsx)(i.Ay,{variant:"body-extra-smallLine truncated
|
||||
__("Video Upload Error: Video upload, titled %1$s, failed. Please try again or visit the troubleshooting docs at %2$s.","jetpack-videopress-pkg"),r,(0,o.A)("jetpack-videopress-dashboard-troubleshoot")),D=(0,o.A)("jetpack-videopress-dashboard-troubleshoot"),L=e=>"Space"===e||"Enter"===e,z=()=>{T(!0)},I=()=>{T(!1)},M=e=>t=>{t.stopPropagation(),e?.(t)},B=e=>{e.target!==x.current&&x?.current?.click()},$=()=>F(e);return(0,w.jsxs)("div",{role:"button",tabIndex:0,onKeyDown:k?null:e=>{L(e?.code)&&A(!0)},onKeyUp:k?null:e=>{L(e?.code)&&(A(!1),B(e))},onClick:k?null:B,"aria-label":V,className:(0,m.A)(y.A["video-row"],{[y.A.pressed]:j,[y.A["hover-disabled"]]:k},t),ref:E,children:[(0,w.jsxs)("div",{className:(0,m.A)(y.A["video-data-wrapper"],{[y.A.small]:k}),children:[(0,w.jsxs)("div",{className:(0,m.A)(y.A["info-wrapper"],{[y.A.small]:k}),onClick:k?e=>{k?C(e=>!e):B(e)}:null,role:"presentation",children:[(0,w.jsx)("div",{className:y.A.poster,children:(0,w.jsx)(b.Ay,{isRow:!0,hasError:!0})}),(0,w.jsxs)("div",{className:y.A["title-wrapper"],children:[O&&(0,w.jsx)(n.Ay,{variant:"body-extra-small",className:y.A.label,component:"span",children:r}),(0,w.jsx)(n.Ay,{variant:"title-small",className:(0,m.A)(y.A.title),ref:_,children:r}),k&&(0,w.jsx)(n.Ay,{component:"div",children:R})]}),k&&(0,w.jsx)(u.A,{icon:S?h.A:p.A,size:45})]}),U&&(0,w.jsxs)("div",{className:(0,m.A)(y.A["meta-wrapper"],{[y.A.small]:k}),children:[!k&&(0,w.jsxs)("div",{className:y.A.actions,children:[(0,w.jsx)(i.A,{size:"small",onClick:M(z),children:__("Upload Error!","jetpack-videopress-pkg")}),(0,w.jsx)(i.A,{size:"small",variant:"tertiary",icon:f.A,onClick:$})]}),k&&(0,w.jsxs)("div",{className:y.A["mobile-actions"],children:[(0,w.jsx)(i.A,{size:"small",onClick:M(z),children:__("Upload Error!","jetpack-videopress-pkg")}),(0,w.jsx)(i.A,{size:"small",variant:"tertiary",icon:f.A,onClick:$})]})]})]}),N&&(0,w.jsx)(a.A,{title:__("Error","jetpack-videopress-pkg"),buttonContent:__("Visit the docs","jetpack-videopress-pkg"),buttonHref:D,buttonExternalLink:!0,anchor:P,onClose:I,onClick:I,noArrow:!1,className:y.A["action-popover"],position:"top center",children:(0,w.jsx)(n.Ay,{children:__("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")})})]})}},9983(e,t,r){"use strict";r.d(t,{Ay:()=>S,TX:()=>A,Uz:()=>w.A});var o=r(7425),n=r(1112),i=r(1876),a=r(9491),s=r(8443),c=r(7723),l=r(3109),d=r(5673),u=r(5462),p=r(3022),h=r(1609),f=r(7726),m=r(9072),g=r(7882),v=r(7663),b=r(8596),y=r(5419),w=r(822),_=r(6577),x=r(790);const __=c.__,k=({duration:e,uploadDate:t,plays:r,isPrivate:o,loading:n=!1})=>{const i=(0,a.useViewportMatch)("small","<"),s=__("Duration","jetpack-videopress-pkg"),c=__("Plays","jetpack-videopress-pkg"),d=__("Privacy","jetpack-videopress-pkg"),u=__("Private","jetpack-videopress-pkg"),h=__("Public","jetpack-videopress-pkg"),m=i?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("span",{children:d}),(0,x.jsx)("span",{children:o?u:h})]}):o&&(0,x.jsx)(l.A,{icon:f.A}),g=i&&e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("span",{children:s}),(0,x.jsx)("span",{children:e})]}):e,v=i&&Number.isFinite(r)?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("span",{children:c}),(0,x.jsx)("span",{children:r})]}):r,b=i?null:t;return(0,x.jsx)(w.A,{privacy:"boolean"==typeof o?m:null,duration:g,plays:v,upload:b,loading:n,className:(0,p.A)({[_.A["mobile-stats"]]:i})})},j=({id:e,className:t="",title:r,titleAdornment:c=null,thumbnail:f,showThumbnail:g=!1,duration:w,uploadDate:j,plays:A,isPrivate:S,onActionClick:C,showActionButton:P=!0,showQuickActions:E=!0,loading:N=!1,uploading:T=!1,processing:F=!1,isUpdatingPoster:R=!1,actionButtonLabel:O=__("Edit video details","jetpack-videopress-pkg"),disableActionButton:U=!1,disabled:V=!1,uploadProgress:D,isLocalVideo:L=!1})=>{const z=(0,h.useRef)(null),{canPerformAction:I}=(0,m.J)(),M=(0,a.useViewportMatch)("small","<"),[B,$]=(0,h.useState)(!1),[H,G]=(0,h.useState)(null),q=(e=>{if(e){const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}:${r<10?"0":""}${r}`}})(w),W=(0,s.dateI18n)("M j, Y",j),J=!M&&z?.current?.offsetWidth<z?.current?.scrollWidth,K=(P||E)&&!N&&!V,Z=!N&&(!M||M&&B),Q=M&&K&&!N&&(P||Boolean(w)||Number.isFinite(A)||"boolean"==typeof S),X=M||N||V,Y=(0,x.jsx)(n.A,{size:"small",onClick:(ee=C,e=>{e.stopPropagation(),ee?.(e)}),disabled:!I||U,children:O});var ee;return(0,h.useEffect)(()=>{V&&$(!1)},[V]),(0,x.jsxs)("div",{className:(0,p.A)(_.A["video-row"],{[_.A.disabled]:V,[_.A["hover-disabled"]]:X},t),ref:G,children:[(0,x.jsxs)("div",{className:(0,p.A)(_.A["video-data-wrapper"],{[_.A.small]:M}),children:[(0,x.jsxs)("div",{className:(0,p.A)(_.A["info-wrapper"],{[_.A.small]:M}),onClick:M&&!N?()=>{Q&&$(e=>!e)}:null,role:"presentation",children:[g&&(0,x.jsx)("div",{className:_.A.poster,children:(0,x.jsx)(y.Ay,{thumbnail:f,loading:N||R,uploading:T,processing:F,blankIconSize:28,uploadProgress:D,isRow:!0})}),(0,x.jsxs)Line truncated
|
||||
__("%1$s of %2$s of cloud video storage","jetpack-videopress-pkg"),l,d)}),(0,h.jsx)(n.ProgressBar,{value:Math.min(100*c,100)})]})},m=e=>{const{storageUsed:t,uploadedVideoCount:r}=(0,d.Ay)(),{features:o}=(0,c.j)(),{settings:n}=(0,l.T)(),{siteType:i}=n;return i===u.Xb||o?.isVideoPressUnlimitedSupported?null:r?t?(0,h.jsx)(f,{...e,used:t,total:1e12}):(0,h.jsx)(f,{...e,used:0,total:1}):null}},4231(e,t,r){"use strict";r.d(t,{A:()=>h});var o=r(723),n=r(1112),i=r(6427),a=r(9491),s=r(7723),c=r(3022),l=r(1609),d=r(6720),u=r(6325),p=r(790);const __=s.__,h=({url:e,selectedTime:t,handleCloseSelectFrame:r,handleVideoFrameSelected:s,handleConfirmFrame:h})=>{const[f,m]=(0,l.useState)(null),g=(0,a.useViewportMatch)("small","<");return(0,p.jsx)(i.Modal,{title:__("Select thumbnail from video","jetpack-videopress-pkg"),onRequestClose:r,isDismissible:!1,children:(0,p.jsx)(o.Ay,{targetDom:f,children:(0,p.jsxs)("div",{ref:m,className:(0,c.A)(u.A.selector,{[u.A["is-small"]]:g}),children:[(0,p.jsx)(d.A,{src:e,onVideoFrameSelected:s,initialCurrentTime:t}),(0,p.jsxs)("div",{className:u.A.actions,children:[(0,p.jsx)(n.A,{variant:"secondary",onClick:r,children:__("Close","jetpack-videopress-pkg")}),(0,p.jsx)(n.A,{variant:"primary",onClick:h,children:__("Select this frame","jetpack-videopress-pkg")})]})]})})})}},5419(e,t,r){"use strict";r.d(t,{Ay:()=>P,sy:()=>x});var o=r(723),n=r(7425),i=r(1112),a=r(1876),s=r(6427),c=r(9491),l=r(8443),d=r(7723),u=r(3109),p=r(4699),h=r(8546),f=r(1034),m=r(6501),g=r(815),v=r(976),b=r(3022),y=r(1609),w=r(3817),_=r(790);const __=d.__,x=({onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:r,onClose:o,isUpdatingPoster:n=!1})=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(i.A,{className:w.A.disabled,weight:"regular",fullWidth:!0,variant:"tertiary",icon:f.A,onClick:()=>{o(),e?.()},children:__("Use default thumbnail","jetpack-videopress-pkg")}),(0,_.jsx)(i.A,{weight:"regular",fullWidth:!0,variant:"tertiary",icon:m.A,onClick:()=>{o(),t?.()},children:__("Select from video","jetpack-videopress-pkg")}),(0,_.jsx)(i.A,{weight:"regular",fullWidth:!0,variant:"tertiary",icon:h.A,disabled:n,onClick:()=>{o(),r?.()},children:__("Upload image","jetpack-videopress-pkg")})]}),k=({onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:r,busy:n=!1})=>(0,_.jsx)("div",{className:w.A["video-thumbnail-edit"],children:(0,_.jsx)(s.Dropdown,{placement:"bottom left",renderToggle:({isOpen:e,onToggle:t})=>(0,_.jsx)(i.A,{variant:"secondary",className:w.A["thumbnail__edit-button"],icon:g.A,disabled:n,onClick:t,"aria-expanded":e}),renderContent:({onClose:n})=>(0,_.jsx)(o.Ay,{children:(0,_.jsx)(x,{onClose:n,onUseDefaultThumbnail:e,onSelectFromVideo:t,onUploadImage:r})})})}),j=({uploadProgress:e=0,isRow:t=!1})=>{const r=__("Completing upload","jetpack-videopress-pkg"),o=__("Completing","jetpack-videopress-pkg"),i=t?o:r,a=`${Math.floor(100*e)}%`,c=(0,d.sprintf)(/* translators: %s: the upload percentage */
|
||||
__("Uploading %s","jetpack-videopress-pkg"),a),l=1===e?i:c;return(0,_.jsxs)("div",{className:(0,b.A)(w.A["custom-thumbnail"],{[w.A["is-row"]]:t}),children:[(0,_.jsx)(s.ProgressBar,{value:Math.min(100*e,100)}),(0,_.jsx)(n.Ay,{variant:t?"body-extra-small":"body",className:w.A["upload-text"],children:l})]})},A=({isRow:e=!1})=>(0,_.jsx)("div",{className:w.A["custom-thumbnail"],children:(0,_.jsx)(n.Ay,{variant:e?"body-extra-small":"body",className:w.A.pulse,children:__("Processing","jetpack-videopress-pkg")})}),S=({isRow:e})=>(0,_.jsx)("div",{className:(0,b.A)(w.A["thumbnail-blank"],w.A["thumbnail-error"]),children:(0,_.jsx)(u.A,{icon:p.A,size:e?48:96})}),C=(0,y.forwardRef)(({className:e,thumbnail:t,duration:r,editable:o,blankIconSize:i=96,loading:s=!1,uploading:d=!1,processing:p=!1,deleting:h=!1,updating:f=!1,onUseDefaultThumbnail:m,onSelectFromVideo:g,onUploadImage:y,uploadProgress:x,isRow:C=!1,hasError:P=!1},E)=>{const N=(0,c.useViewportMatch)("small","<"),T=s||d||h||f;let F=t;return F=s?(0,_.jsx)(a.A,{}):F,F=d?(0,_.jsx)(j,{isRow:C,uploadProgress:x}):F,F=p?(0,_.jsx)(A,{isRow:C}):F,F=P?(0,_.jsx)(S,{isRow:C}):F,F="string"==typeof F&&""!==F?(0,_.jsx)("img",{src:F,alt:__("Video thumbnail","jetpack-videopress-pkg")}):F,F=F||(0,_.jsx)("div",{className:w.A["thumbnail-blank"],children:(0,_.jsx)(u.A,{icon:v.A,size:i})}),(0,_.jsxs)("div",{className:(0,b.A)(e,w.A.thumbnail,{[w.A["is-small"]]:N}),ref:E,children:[Boolean(F)&&o&&(0,_.jsx)(k,{onUseDefaultThumbnail:m,onSelectFromVideo:g,onUploadImage:y,busy:T}),Number.isFinite(r)&&(0,_.jsx)("div",{className:w.A["video-thumbnail-duration"],children:(0,_.jsx)(n.Ay,{variant:"body-small",component:"div",children:r>=36e5?(0,l.gmdateI18n)("H:i:s",new Date(r)):(0,l.gmdateI18n)("i:s",new Date(r))})}),(0,_.jsx)("div",{className:w.A["thumbnail-placeholder"],children:F})]})});C.displayName="VideoThumbnail";const P=C},9668(e,t,r){"use strict";r.d(t,{A:()=>m});var o=r(7425),n=r(1112),i=r(9491),a=r(7723),s=r(3109),c=r(3705),l=r(3022),d=r(7770),u=r(7520),p=r(3463),h=r(1510),f=r(790);const __=a.__,m=({className:e,onSelectFiles:t})=>{const r=(0,i.useViewportMatch)("small","<"),{inputRef:a,handleFileInputChangeEvent:m}=(0,p.A)({onSelectFiles:t}),{hasVideoPressPurchase:g}=(0,u.j)();return(0,f.jsxs)("div",{className:(0,l.A)(h.A.wrapper,e,{[h.A.small]:r}),children:[(0,f.jsx)("input",{ref:a,type:"file",accept:d.Zd,className:(0,l.A)(h.A["file-input"]),onChange:m,multiple:g}),(0,f.jsx)(s.A,{icon:c.A,size:32,className:(0,l.A)(h.A.icon)}),(0,f.jsx)(o.Ay,{variant:"title-small",children:__("Drag and drop your video here","jetpack-videopress-pkg")}),(0,f.jsx)(n.A,{size:"small",variant:"secondary",className:(0,l.A)(h.A.button),onClick:()=>{a.current.click()},children:__("Select file to upload","jetpack-videopress-pkg")})]})}},6791(e,t,r){"use strict";r.d(t,{V:()=>n});var o=r(1609);const n=()=>{const[e,t]=(0,o.useState)(null),[r,n]=(0,o.useState)(!1),[i,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{n(!(!i&&!s))},[i,s]),{setAnchor:t,setIsFocused:c,setIsHovering:a,setShowPopover:n,anchor:e,isFocused:s,isHovering:i,showPopover:r}}},6764(e,t,r){"use strict";r.d(t,{A:()=>a});var o=r(372),n=r(9384),i=r(1609);const a=({pageViewEventName:e,pageViewEventProperties:t={}})=>{const{isUserConnected:r,isRegistered:a,userConnectionData:s}=(0,n.useConnection)(),{blogId:c}=s?.currentUser||{},{login:l,ID:d}=s?.currentUser?.wpcomUser||{},{tracks:u}=o.A,{recordEvent:p}=u,h=(0,i.useCallback)(async(e,t)=>{p(e,t)},[p]),f=(0,i.useCallback)((e,t,r=()=>({}))=>(r="function"==typeof t?t:r,t="function"==typeof t?{}:t,c&&(t.blog_id=c),()=>h(e,t).then(r)),[h,c]);return(0,i.useEffect)(()=>{r&&d&&l&&o.A.initialize(d,l)},[r,d,l]),(0,i.useEffect)(()=>{a&&e&&(c&&(t.blog_id=c),p(e,t))},[c]),{recordEvent:h,recordEventHandler:f}}},5036(e,t,r){"use strict";r.d(t,{c:()=>l});var o=r(7143),n=r(1609),i=r(6287),a=r(7520),s=r(8728),c=r(957);const l=()=>{const{uploadVideo:e,uploadVideoFromLibrary:t,setVideosQuery:r}=(0,o.useDispatch)(i.ax),{items:l,uploadErrors:d,uploading:u,uploadedVideoCount:p,isFetching:h,search:f,page:m,itemsPerPage:g,total:v}=(0,c.Ay)(),{items:b,uploadedLocalVideoCount:y}=(0,c.Ds)(),{hasVideoPressPurchase:w}=(0,a.j)(),_=(0,n.useRef)(m),x=(0,s.o)(),k=parseInt(x.getParam("page","1"),10),j=Number.isNaN(k)?1:k,A=x.getParam("q",""),S=Math.ceil(v/g);(0,n.useEffect)(()=>0===v&&1!==j||v>0&&(j<1||j>S)?(x.deleteParam("page"),void x.update()):void(m===j?f!==A&&r({search:A}):m!==_.current?(_.current=m,x.setParam("page",m),x.update()):(_.current=j,r({page:j}))),[S,m,j,f,A]);return{videos:(0,n.useMemo)(()=>{if(!h)return null;const e=Math.max(1,Math.min(g,p-g*(m-1)));return Array.from({length:e},(e,t)=>({id:`placeholder-${t}`}))},[h,g,p,m])??(m>1||Boolean(f)?l:[...d,...u,...l]),localVideos:b,uploadedVideoCount:p,uploadedLocalVideoCount:y,hasVideos:p>0||h||u?.length>0||d?.length>0,hasLocalVideos:y>0,handleFilesUpload:t=>{w?t.forEach(t=>{e(t)}):t.length>0&&e(t[0])},handleLocalVideoUpload:e=>{t(e)},loading:h,uploading:Line truncated
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
/**
|
||||
* filesize
|
||||
*
|
||||
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
||||
* @license BSD-3-Clause
|
||||
* @version 10.1.6
|
||||
*/
|
||||
|
||||
/**
|
||||
* react-router v7.15.1
|
||||
*
|
||||
* Copyright (c) Remix Software Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE.md file in the root directory of this source tree.
|
||||
*
|
||||
* @license MIT
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
:where(._fUXxnSp5pagKBp9gSN7) *{box-sizing:border-box}.cAbGtJDGgLubucBnz7vM{background-color:var(--jp-white)}.vMa4i_Dza2t5Zi_Bw9Nf{background:var(--jp-white-off);overflow:hidden;padding-top:1px}@media(min-resolution:192dpi){:root{--wpds-border-width-focus:1.5px}}.jetpack-footer{border-top:1px solid #f0f0f0;box-sizing:border-box;font-size:13px;padding:20px 24px;width:100%}.jetpack-footer .jetpack-footer__menu-item:any-link,.jetpack-footer .jetpack-footer__menu-item[role=button]{color:#707070;cursor:pointer;text-decoration:none}.jetpack-footer .jetpack-footer__menu-item:hover{text-decoration:underline}.jetpack-footer>ul{list-style:none;margin:0;padding:0}.jetpack-footer>ul>li{margin:0}.jetpack-footer__logo{flex-shrink:0}@media(min-width:480px){a.jetpack-footer__a8c{margin-inline-start:auto}}a.jetpack-footer__a8c svg{fill:#707070}@media(max-width:599px){.RuVLl3q4lxTQa3wbhBJB{grid-column-end:span 1}.f9LZTRG4MMK42rS89afW{grid-column-start:1}.bHe_zKxjjpUwHw_MdYE1{grid-column-end:2}.QZbNrOqE2aNSn50xVhpU{grid-column-end:span 2}.ev7W3z7zVYPeHAlYqZjf{grid-column-start:2}.NJWd1m_e7lOiPYru2ZMP{grid-column-end:3}.Xc6nt1Qc1DI0Z2A3gt1r{grid-column-end:span 3}.UIcN_GXiPRoIsin8Kohg{grid-column-start:3}.GRKCyqb5LufCSCgykKFc{grid-column-end:4}.i_qTq8gqhhC3vIUepVRB{grid-column-end:span 4}.G3qaZ3Jpbvam_1XvGxgc{grid-column-start:4}.VRCNYKZtO9zukEwmgP1y{grid-column-end:5}}@media(min-width:600px)and (max-width:959px){.tRm008K_WJL79WoNZTNL{grid-column-end:span 1}.l5T2P_bgKts4tdaRkS1d{grid-column-start:1}.zOCxfLZpF6BlgC7a_Yq1{grid-column-end:2}.F80DdgVn0m5OpvtSQWka{grid-column-end:span 2}.oI1c7JYfiJtMQHbhngtU{grid-column-start:2}.pMQtA_4jh1_1lVknqEP5{grid-column-end:3}.VenqMpdgyKQVUNNQcfqd{grid-column-end:span 3}.seNYL99uoczf9V4MxBxT{grid-column-start:3}.YKfF1HFhI9KygA5l3b2J{grid-column-end:4}.yAi0Cv1xDWkoqsaUhvhR{grid-column-end:span 4}.ubhnyZOnkgxNhh6XtVWv{grid-column-start:4}.RGOPGQbWMJ9Ei5oFxS7X{grid-column-end:5}.Sz1E2aWbX483ijdi6yge{grid-column-end:span 5}.tku6_bRYrX9tMbgYGmIl{grid-column-start:5}.b5JHttOhSEcI1WBlqAjk{grid-column-end:6}.FboSx5MoKTAWbxXyYlCw{grid-column-end:span 6}.Jhs8yEEmodG30edbJvag{grid-column-start:6}.IpzbbKVqEqPcfIGkXkwt{grid-column-end:7}.mhCPwfAZ4Kmm_empzJAq{grid-column-end:span 7}.x034ilrJF7rO9UJB2rI1{grid-column-start:7}.Wt8t2e16viRrOJ1lLA5v{grid-column-end:8}.S6pIrEy9AMLKx9bgh_Ae{grid-column-end:span 8}.kEfI4tGyuWfHTlRnvIab{grid-column-start:8}.PUzX4RRsKq1dnsz3gebS{grid-column-end:9}}@media(min-width:960px){.X_pdcLJikd8LS_YAdJlB{grid-column-end:span 1}.tl936d14Huby4khYp05X{grid-column-start:1}.hnge0LnR69d3NXEtEE1t{grid-column-end:2}.fj0NUMuyZQcPNgKcjp5Z{grid-column-end:span 2}.R2ncBX7a2NigdYCcV1OX{grid-column-start:2}.t8vMSDVYno9k9itRwnXb{grid-column-end:3}.wsDuEN2GqHx6qzo8dUdk{grid-column-end:span 3}.cIEVPUweWtLBy3xaXnMx{grid-column-start:3}.fajUWBwu1m2B479j3jmz{grid-column-end:4}.YR0c7fQTgMkDdWzwSyLp{grid-column-end:span 4}.xlwp8BmplxkKNMI7gamo{grid-column-start:4}._C4O1w9DUqx1m3gPf8aA{grid-column-end:5}.Z54F1hAErckAIrKlxnXW{grid-column-end:span 5}.ezSDWkRHmKSxDJXxuiOH{grid-column-start:5}.T0ChoeAjGJjkkNrYhD4g{grid-column-end:6}.qtMoMPF6yHvGJnWHSsde{grid-column-end:span 6}.gdoywN5VPiWERfIBqkph{grid-column-start:6}.wUev_VH5uf_pwFFlbnAU{grid-column-end:7}.egIPDFJsOpownTClq9XP{grid-column-end:span 7}.yGhp9yoAW7k0kQik9AB7{grid-column-start:7}.SJ43U9mR5wUg5V2qBeQA{grid-column-end:8}.cTuyHfMwSUJxN_HdIEgd{grid-column-end:span 8}.smCr8DaIagcumdvdldiK{grid-column-start:8}.T03NHzQJvzwL6wAfIiTL{grid-column-end:9}.pMvxM3RJGjqyNdf9qg1Y{grid-column-end:span 9}.iIVpNRwEnQ_JI5gpp9EN{grid-column-start:9}.ZbQ4u4vGSX5rJOje4uGL{grid-column-end:10}.gKb5wuIDAlKGbrjK2vxy{grid-column-end:span 10}.Z7pINdImE2WJiYnZBTqm{grid-column-start:10}.ZTxp6qpvwurMdOnLLSz1{grid-column-end:11}.NnQTlbfnxPDR6cQ7rygg{grid-column-end:span 11}.O137wZd6Yl0olSA9PsXR{grid-column-start:11}.zf2OJtQ2MPz6SDoh6CB0{grid-column-end:12}.U3H6UHW6HqRt9hdzVg3O{grid-column-end:span 12}.zynnNeS_ZBTxABcVpUQH{grid-column-start:12}.vI8tltFZtFUNAy9Iag9s{grid-column-end:13}}.SqdhUZkXCRuIpErj1B3z{--max-container-width:1040px;--vertical-gutter:24px;--horizontal-spacing:8px;column-gap:var(--vertical-gutter);display:grid;margin:0 auto;width:100%}@media(max-width:599px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(4,minmax(0,1fr));max-width:calc(var(--max-container-width) + 32px);padding:0 16px}}@media(min-width:600px)and (max-width:959px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(8,minmax(0,1fr));max-width:calc(var(--max-container-width) + 36px);padding:0 18px}}@media(min-width:960px){.SqdhUZkXCRuIpErj1B3z{grid-template-columns:repeat(12,minmax(0,1fr));max-width:calc(var(--max-container-width) + 48px);padding:0 24px}}.SqdhUZkXCRuIpErj1B3z.OZC_9a1LhpWF9dv15Gdh{max-width:none;padding:unset}.sexr0jUxC1jVixdKiDnC{margin-right:-20px}@media(max-width:782px){.sexr0jUxC1jVixdKiDnC{margin-right:-10px}}.sexr0jUxC1jVixdKiDnC.vKQ11sLeAM45M04P1ccj{background-color:var(--jp-white)}.sexr0jUxC1jVixdKiDnC.zWDcRnnZPA743KzSQdUg .jp-admin-page__page>:first-child{border-Line truncated
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "videopress/video",
|
||||
"version": "0.1.0",
|
||||
"title": "VideoPress",
|
||||
"category": "media",
|
||||
"icon": "<svg viewBox='0 0 29 21' width='24' height='24' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2.79037 0.59375C4.0363 0.59375 5.13102 1.41658 5.47215 2.60947L8.8452 14.4044C8.8486 14.4164 8.85411 14.4273 8.86124 14.4368L12.8572 0.59375H15.0927H21.2721C25.6033 0.59375 28.5066 3.39892 28.5066 7.64565C28.5066 11.9411 25.5272 14.6196 21.0818 14.6196H18.1499H14.3719L13.6379 16.8813C12.9796 18.9095 11.0827 20.2839 8.94152 20.2839C6.80035 20.2839 4.90341 18.9095 4.24517 16.8813L0.137069 4.22276C-0.444671 2.43022 0.898038 0.59375 2.79037 0.59375ZM15.7374 10.4119H20.0156C21.8718 10.4119 22.9856 9.35018 22.9856 7.64565C22.9856 5.93137 21.8718 4.91839 20.0156 4.91839H17.5202L15.7374 10.4119Z'></path></svg>",
|
||||
"description": "Embed a video from your media library or upload a new one with VideoPress.",
|
||||
"supports": {
|
||||
"html": false,
|
||||
"align": true,
|
||||
"anchor": true,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"autoplay": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"anchor": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"caption": {
|
||||
"type": "string"
|
||||
},
|
||||
"controls": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"loop": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"maxWidth": {
|
||||
"type": "string",
|
||||
"default": "100%"
|
||||
},
|
||||
"muted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"playsinline": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"preload": {
|
||||
"type": "string",
|
||||
"default": "metadata"
|
||||
},
|
||||
"seekbarPlayedColor": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"seekbarLoadingColor": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"seekbarColor": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"useAverageColor": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"guid": {
|
||||
"type": "string"
|
||||
},
|
||||
"src": {
|
||||
"type": "string"
|
||||
},
|
||||
"cacheHtml": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"poster": {
|
||||
"type": "string"
|
||||
},
|
||||
"posterData": {
|
||||
"type": "object",
|
||||
"default": {}
|
||||
},
|
||||
"videoRatio": {
|
||||
"type": "number"
|
||||
},
|
||||
"tracks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object"
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"privacySetting": {
|
||||
"type": "number",
|
||||
"default": 1
|
||||
},
|
||||
"allowDownload": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"displayEmbed": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"rating": {
|
||||
"type": "string"
|
||||
},
|
||||
"isPrivate": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isExample": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"duration": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"textdomain": "jetpack-videopress-pkg",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style.css",
|
||||
"viewScript": "file:./view.js",
|
||||
"viewStyle": "file:./view.css"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'jetpack-shared-stores', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'a10c36b6c517fb483735');
|
||||
+1
@@ -0,0 +1 @@
|
||||
.rcGUZgpe4CGD8uYmerUD{--input-width:24px;align-items:center;display:flex;gap:8px}.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child{flex-grow:2;margin-bottom:0}.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y .components-base-control__field,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y .components-range-control__wrapper,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child .components-base-control__field,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child .components-range-control__wrapper{margin-bottom:0}.rcGUZgpe4CGD8uYmerUD .components-range-control__marks{top:13px}.dx9xZVwTj45XWtgjLwf2{align-items:center;background-color:#fff;border:1px solid #949494;display:flex;justify-content:space-around;padding:0}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo{margin-bottom:0;padding:0 1px}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo input{max-width:var(--input-width)}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo .components-base-control__field,.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo:last-child{margin-bottom:0}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo .components-base-control__field .components-text-control__input{border:none;padding:0;text-align:center}.dx9xZVwTj45XWtgjLwf2 .components-input-control:last-child{margin-bottom:0}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input{padding-left:0!important;padding-right:0!important;text-align:center}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input::-webkit-inner-spin-button,.dx9xZVwTj45XWtgjLwf2 .components-input-control__input::-webkit-outer-spin-button{-webkit-appearance:none}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.dx9xZVwTj45XWtgjLwf2 .components-input-control__backdrop{border-style:none!important}.dx9xZVwTj45XWtgjLwf2.AmMha5bHq6c3gHoP7k28{background-color:#f0f0f0}.dx9xZVwTj45XWtgjLwf2.AmMha5bHq6c3gHoP7k28 .aN3nKQFl5a3qMbO8CaVg{color:#949494}.aN3nKQFl5a3qMbO8CaVg{font-weight:900}.modal-open .dropdown-content{display:none}.current-media{border-top:1px solid #1e1e1e;margin-left:-8px;margin-right:-8px;margin-top:8px;padding:16px 16px 0}.poster-image-block-control__wrapper .poster-panel-control__help{margin-bottom:0}.poster-image-block-control__remove-button.poster-image-block-control__remove-button{padding-left:12px;padding-right:12px}body.modal-open .poster-panel__dropdown{display:none}.poster-panel .components-dropdown{display:flex;width:100%}.poster-panel .components-dropdown .poster-panel__button{background-color:#fafafa;background-position:50%;background-size:cover;border-radius:2px;display:block;max-height:512px;min-height:140px;text-align:center;width:100%}.poster-panel .components-dropdown .poster-panel__button.has-poster span{display:none}.poster-panel .components-dropdown .poster-panel__button:hover{background-image:none!important}.poster-panel .components-dropdown .poster-panel__button:hover span{display:inline}.poster-panel__notice{margin-bottom:16px;margin-left:0;margin-right:0}.poster-panel-control__help{color:#757575;font-size:12px;font-style:normal}.poster-panel-card{margin-left:-8px;margin-right:-8px;margin-top:24px;padding-left:16px;padding-right:16px}.poster-panel__frame-picker__sandbox-wrapper{background-color:#fafafa;margin-bottom:8px;position:relative}.poster-panel__frame-picker__sandbox-wrapper .components-spinner{height:32px;left:50%;margin:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:32px;z-index:100}.poster-panel__frame-picker__sandbox-wrapper .components-sandbox{opacity:.1;transition:opacity .3s ease-in-out;transition-delay:50ms}.poster-panel__frame-picker__sandbox-wrapper:not(.is-player-ready){aspect-ratio:16/9}.poster-panel__frame-picker__sandbox-wrapper.is-player-ready .components-sandbox{opacity:1}.poster-panel__frame-picker__sandbox-wrapper.is-generating-poster .components-sandbox{opacity:.5}.poster-panel__frame-wrapper,.poster-panel__image-wrapper{display:none;opacity:0}.poster-panel__frame-wrapper.is-selected,.poster-panel__image-wrapper.is-selected{display:block;opacity:1}.poster-panel__preview-toggle{margin-top:24px}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-interactive>*{pointer-events:auto;-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-interactive:after{content:none}.block-banner{align-items:center;align-self:center;background:#000;border-radius:2px;box-shadow:inset 0 0 1px #fff;display:flex;font-size:14px;justify-content:space-between;padding:0 20px}.block-banner .block-banner__content{color:#fff;margin:10px 10px 10px 0}.block-banner .block-banner__action{padding:0}.block-banner .block-banner__action .components-button.is-primary{background:#fff;color:#000;font-size:14px;font-weight:600;height:28px;margin:8px 0 8px auto;padding:4px 8px}.block-banner .block-banner__action .components-button.is-primary:hover:not(:disabled){baLine truncated
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*! For license information please see index.js.LICENSE.txt */
|
||||
(()=>{var e={6941(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(3212)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,r){e.exports=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function o(e,t){let r=0,n=0,o=-1,i=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,i=r,n++):(r++,n++);else{if(-1===o)return!1;n=o+1,i++,r=i}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(o(e,r))return!1;for(const r of t.names)if(o(e,r))return!0;return!1},t.humanize=r(7378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},7934(e,t,r){"use strict";r.d(t,{A:()=>n});const n={button:"zI5tJ_qhWE6Oe6Lk75GY","is-icon-button":"tuBt2DLqimiImoqVzPqo",small:"Na39I683LAaSA99REg14",normal:"ipS7tKy9GntCS4R3vekF",icon:"paGLQwtPEaJmtArCcmyK",regular:"lZAo6_oGfclXOO9CC6Rd","full-width":"xJDOiJxTt0R_wSl8Ipz_",loading:"q_tVWqMjl39Line truncated
|
||||
__("(opens in a new tab)","jetpack-videopress-pkg")})]}),S=m?"_blank":void 0,C=r?.[0]&&null!==r[0]&&"components-tooltip"!==r?.[0]?.props?.className,A={ref:t,target:S,variant:o,className:(0,a.A)(_,{"has-text":!!p&&C}),icon:m?void 0:p,iconSize:f,disabled:h,"aria-disabled":h,isDestructive:g,text:b,...w};return(0,u.jsxs)(n.Button,{...A,children:[v&&(0,u.jsx)(n.Spinner,{}),(0,u.jsx)("span",{children:r}),x]})});d.displayName="Button";const p=d},3924(e,t,r){"use strict";function n(e,t={}){const r={};let n;if("undefined"!=typeof window&&(n=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,r.url=encodeURIComponent(e)}else r.source=encodeURIComponent(e);for(const e in t)r[e]=encodeURIComponent(t[e]);!Object.keys(r).includes("site")&&"undefined"!=typeof jetpack_redirects&&Object.hasOwn(jetpack_redirects,"currentSiteRawUrl")&&(r.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),n&&(r.calypso_env=n);return"https://jetpack.com/redirect/?"+Object.keys(r).map(e=>e+"="+r[e]).join("&")}r.d(t,{A:()=>n})},6439(e,t,r){let n={};try{n=r(3018)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),n={missingConfig:!0}}const o=e=>Object.hasOwn(n,e);e.exports={jetpackConfigHas:o,jetpackConfigGet:e=>{if(!o(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return n[e]}}},4882(e,t,r){"use strict";r.d(t,{A:()=>l});var n=r(5932),o=r(7999),i=r(7143),s=r(1609),a=r(4293);const c=window?.JP_CONNECTION_INITIAL_STATE||(0,o.getScriptData)()?.connection||{};function l({registrationNonce:e=c.registrationNonce,apiRoot:t=c.apiRoot,apiNonce:r=c.apiNonce,redirectUri:o,autoTrigger:l,from:u,skipUserConnection:d,skipPricingPage:p}={}){const{registerSite:f,connectUser:h,refreshConnectedPlugins:g}=(0,i.useDispatch)(a.a),v=(0,i.useSelect)(e=>e(a.a).getRegistrationError(),[]),{siteIsRegistering:m,userIsConnecting:y,userConnectionData:b,connectedPlugins:k,connectionErrors:w,isRegistered:_,isUserConnected:j,hasConnectedOwner:x,isOfflineMode:S}=(0,i.useSelect)(e=>{const t=e(a.a).getConnectionStatus();return{siteIsRegistering:e(a.a).getSiteIsRegistering(),userIsConnecting:e(a.a).getUserIsConnecting(),userConnectionData:e(a.a).getUserConnectionData()||{},connectedPlugins:e(a.a).getConnectedPlugins(),connectionErrors:e(a.a).getConnectionErrors(),isOfflineMode:e(a.a).getIsOfflineMode(),isRegistered:t.isRegistered??!1,isUserConnected:t.isUserConnected??!1,hasConnectedOwner:t.hasConnectedOwner??!1}},[]),C=()=>d?o?(window.location.href=o,Promise.resolve(o)):Promise.resolve():h({from:u,redirectUri:o,skipPricingPage:p}),A=t=>(t&&t.preventDefault(),_?C():f({registrationNonce:e,redirectUri:o,from:u}).then(()=>C()));return(0,s.useEffect)(()=>{n.Ay.setApiRoot(t),n.Ay.setApiNonce(r)},[t,r]),(0,s.useEffect)(()=>{!l||m||y||A()},[]),{handleRegisterSite:A,handleConnectUser:C,refreshConnectedPlugins:g,isRegistered:_,isUserConnected:j,siteIsRegistering:m,userIsConnecting:y,registrationError:v,userConnectionData:b,hasConnectedOwner:x,connectedPlugins:k,connectionErrors:w,isOfflineMode:S}}},3935(e,t,r){"use strict";r.d(t,{A1:()=>c,Ay:()=>_,DO:()=>a,Ij:()=>s,Kl:()=>f,LW:()=>l,MU:()=>h,XY:()=>u,ZO:()=>i,dz:()=>d,gH:()=>p,v_:()=>o});var n=r(5932);const o="SET_CONNECTION_STATUS",i="SET_CONNECTION_STATUS_IS_FETCHING",s="SET_SITE_IS_REGISTERING",a="SET_USER_IS_CONNECTING",c="SET_REGISTRATION_ERROR",l="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",d="DISCONNECT_USER_SUCCESS",p="SET_CONNECTED_PLUGINS",f="SET_CONNECTION_ERRORS",h="SET_IS_OFFLINE_MODE",g=e=>({type:o,connectionStatus:e}),v=e=>({type:s,isRegistering:e}),m=e=>({type:a,isConnecting:e}),y=e=>({type:c,registrationError:e}),b=()=>({type:l}),k=e=>({type:u,authorizationUrl:e}),w=e=>({type:p,connectedPlugins:e});const _={setConnectionStatus:g,setConnectionStatusIsFetching:e=>({type:i,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:v,setUserIsConnecting:m,setRegistrationError:y,clearRegistrationError:b,setAuthorizationUrl:k,registerSite:function*({registrationNonce:e,redirectUri:t,from:r=""}){yield b(),yield v(!0);try{const n=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:r};return yield g({isRegistered:!0}),yield k(n.authorizeUrl),yield v(!1),Promise.resolve(n)}catch(e){return yield y(e),yield v(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:r,skipPricingPage:n}={}){yield m(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:r,skipPricingPage:n}},disconnectUserSuccess:()=>({type:d}),setConnectedPlugins:w,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise(t=>n.Ay.fetchConnectedPlugins().then(r=>{e(w(r)),t(r)})),setConnectionErrors:e=>({type:f,connectionErrors:e}),seLine truncated
|
||||
__("The current poster image url is %s","jetpack-videopress-pkg"),i):__("There is no poster image currently selected","jetpack-videopress-pkg")})]})})}),(0,u.jsx)(d,{poster:i,className:"current-media"}),!!i&&(0,u.jsx)(o.MenuItem,{className:"poster-image-block-control__remove-button",variant:"tertiary",isDestructive:!0,onClick:()=>{t({poster:""}),e()},icon:c.A,children:__("Remove and use default","jetpack-videopress-pkg")})]})})}})}},8864(e,t,r){"use strict";r.d(t,{Ay:()=>S,ZC:()=>b});var n=r(4715),o=r(6427),i=r(6087),s=r(7723),a=r(1034),c=r(8339),l=r(3022),u=r(3685),d=r(9689),p=r(6302),f=r(4967),h=r(4954),g=r(9069),v=r(4749),m=(r(9192),r(790));const __=s.__,y=3e3,b=()=>!!window?.Jetpack_Editor_Initial_State?.available_blocks?.["v6-video-frame-poster"],k=[];if(window.videopressAjax){const e=new Blob([`var videopressAjax = ${JSON.stringify({...window.videopressAjax,context:"sandbox"})};`],{type:"text/javascript"});k.push(URL.createObjectURL(e),window.videopressAjax.bridgeUrl)}function w({clientId:e,attributes:t,setAttributes:r}){const c=`video-block__poster-image-description-${e}`,{poster:l}=t,u=(0,i.useCallback)(e=>{r({poster:e.url,posterData:{...t.posterData,type:"media-library",id:e.id,url:e.url}})},[t]),d=__("Select Poster Image","jetpack-videopress-pkg"),p=__("Replace Poster Image","jetpack-videopress-pkg"),f=(0,i.useRef)(null),h=Number(t?.videoRatio)/100||9/16,[v,y]=(0,i.useState)(140);return(0,i.useEffect)(()=>{if(!l||!f?.current)return;const{current:e}=f,t=e?.offsetWidth;t&&y(t*h)},[l,f,h]),(0,m.jsx)(o.Dropdown,{contentClassName:"poster-panel__dropdown",placement:"top left",renderToggle:({isOpen:e,onToggle:t})=>(0,m.jsx)(o.Button,{ref:f,style:{backgroundImage:l?`url(${l})`:void 0,height:v,minHeight:v},className:"poster-panel__button "+(l?"has-poster":""),variant:"secondary",onClick:t,"aria-expanded":e,children:(0,m.jsx)("span",{children:l?p:d})}),renderContent:({onClose:e})=>(0,m.jsx)(o.NavigableMenu,{className:"block-editor-media-replace-flow__media-upload-menu",children:(0,m.jsx)(n.MediaUploadCheck,{children:(0,m.jsx)(n.MediaUpload,{title:__("Select Poster Image","jetpack-videopress-pkg"),onSelect:t=>{u(t),e()},allowedTypes:g.o,render:({open:e})=>(0,m.jsxs)(o.MenuItem,{icon:a.A,onClick:e,"aria-describedby":c,children:[__("Open Media Library","jetpack-videopress-pkg"),(0,m.jsx)("p",{id:c,hidden:!0,children:l?(0,s.sprintf)(/* translators: %s: an image URL. */
|
||||
__("The current poster image url is %s","jetpack-videopress-pkg"),l):__("There is no poster image currently selected","jetpack-videopress-pkg")})]})})})})})}window?.videoPressEditorState?.playerBridgeUrl&&k.push(window.videoPressEditorState.playerBridgeUrl);const _=e=>{const t=e?.current?.querySelector("iframe.components-sandbox");return t?.contentWindow};function j({guid:e,isGeneratingPoster:t,atTime:r=.1,onVideoFrameSelect:n,duration:s}){const[a,c]=(0,i.useState)(r),p=(0,i.useRef)(null),g=(0,d.ep)(e,{autoplay:!0,muted:!0,controls:!1,loop:!1}),{preview:v={html:null},isRequestingEmbedPreview:y}=(0,f.g)(g),{html:b}=v,{playerIsReady:w,pause:j}=(0,h.A)(p,y,{initialTimePosition:r});(0,i.useEffect)(()=>{w&&j()},[w,j]);const x=(0,i.useCallback)(e=>{const t=_(p);t?.postMessage({event:"videopress_action_set_currenttime",currentTime:e/1e3},"*"),n(e)},[_,n]);return(0,m.jsxs)("div",{className:"poster-panel__frame-picker",children:[(0,m.jsxs)("div",{ref:p,className:(0,l.A)("poster-panel__frame-picker__sandbox-wrapper",{"is-player-ready":w,"is-generating-poster":t}),children:[(!w||t)&&(0,m.jsx)(o.Spinner,{}),(0,m.jsx)(o.SandBox,{html:b,scripts:k,allowSameOrigin:!0})]}),t&&(0,m.jsx)(o.Notice,{status:"info",className:"poster-panel__notice",isDismissible:!1,children:__("Generating video poster image. It may take a few seconds.","jetpack-videopress-pkg")}),(0,m.jsx)(u.Ay,{label:__("Video frame","jetpack-videopress-pkg"),help:__("Select the frame you want to use as poster image","jetpack-videopress-pkg"),disabled:y||t,max:s,value:a,wait:250,fineAdjustment:50,onChange:c,onDebounceChange:x})]})}function x({previewOnHover:e=!1,previewAtTime:t=0,loopDuration:r=5e3,videoDuration:n,onPreviewOnHoverChange:a,onPreviewAtTimeChange:c,onLoopDurationChange:l}){const d=!n,f=Math.max(n-y,0),[h,g]=(0,i.useState)(Math.min(1e4,n-t)),v=Math.floor(h/10)/100,b=(0,i.createInterpolateElement)((0,s.sprintf)(/* translators: %s: the formatted video duration */
|
||||
__("Video duration: <em>%s</em>.","jetpack-videopress-pkg"),(0,p.ZO)(n)),{em:(0,m.jsx)("em",{})}),k=(0,i.createInterpolateElement)((0,s.sprintf)(/* translators: %1$s, %2$s: the minimum and maximum lapse duration for the previewOnHover, in seconds */
|
||||
__("Minimum: <em>%1$ss</em>. Maximum: <em>%2$ss</em>.","jetpack-videopress-pkg"),Math.min(3,v),v),{em:(0,m.jsx)("em",{})}),w=0===f,_=h<=y,j=(0,i.useCallback)(e=>{c(e);const t=Math.min(1e4,n-e);g(t),r>t&&l(t)},[c,n,r,l]);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(o.ToggleControl,{className:"poster-panel__preview-toggle",label:__("Video preview on hover","jetpack-videopress-pkg"),checked:e,onChange:a,disabled:!e&&d,__nextHasNoMarginBottom:!0}),e&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.Ay,{label:__("Starting point","jetpack-videopress-pkg"),max:f,fineAdjustment:50,value:t,onDebounceChange:j,wait:300,disabled:d||w,help:b}),(0,m.jsx)(u.Ay,{max:h,min:y,fineAdjustment:50,label:__("Loop duration","jetpack-videopress-pkg"),value:r,onDebounceChange:l,wait:300,help:k,disabled:d||_,marksEvery:1e3})]})]})}function S({attributes:e,setAttributes:t,isGeneratingPoster:r,videoBelongToSite:n}){const{poster:s,posterData:a}=e,u=e?.duration,d="video-frame"===a?.type,p=a?.previewOnHover||!1,f=a?.previewAtTime??a?.atTime??0;let h=a?.previewLoopDuration??5e3;h>u-f&&(h=u-f);const g=(0,i.useCallback)(r=>{t({posterData:{...e.posterData,type:r?"video-frame":"media-library"},poster:r?"":e.posterData.url||""})},[e]),y=(0,i.useCallback)(r=>{let n={...e.posterData,previewOnHover:r};r&&(n={previewAtTime:f,previewLoopDuration:h,...n}),t({posterData:n,controls:!r&&e.controls})},[e]),k=(0,i.useCallback)(r=>{t({posterData:{...e.posterData,previewAtTime:r}})},[e]),_=(0,i.useCallback)(r=>{let n=f;f+r>u&&(n=u-r),t({posterData:{...e.posterData,previewLoopDuration:r,previewAtTime:n}})},[e]),S=b()?__("Poster and preview","jetpack-videopress-pkg"):__("Poster","jetpack-videopress-pkg");return(0,m.jsxs)(o.PanelBody,{title:S,className:"poster-panel",initialOpen:!1,children:[(0,m.jsx)(o.ToggleControl,{label:__("Pick from video frame","jetpack-videopress-pkg"),checked:d&&n,onChange:g,disabled:!n,__nextHasNoMarginBottom:!0}),(0,m.jsx)("div",{className:(0,l.A)("poster-panel__frame-wrapper",{"is-selected":d}),children:(0,m.jsx)(j,{isGeneratingPoster:r,guid:e?.guid,atTime:a?.atTime,duration:u,onVideoFrameSelect:r=>{t({posterData:{...e.posterData,type:"video-frame",atTime:r},poster:""})}})}),(0,m.jsxs)("div",{className:(0,l.A)("poster-panel__image-wrapper",{"is-selected":!d}),children:[(0,m.jsx)(w,{attributes:e,setAttributes:t}),(0,m.jsx)(v.z,{poster:s,className:"poster-panel-card"}),s&&(0,m.jsx)(o.MenuItem,{onClick:()=>{t({poster:"",posterData:{...e.posterData,url:""}})},icon:c.A,isDestructive:!0,variant:"tertiary",children:__("Remove and use default","jetpack-videopress-pkg")})]}),b()&&(0,m.jsx)(x,{previewOnHover:p,previewAtTime:f,loopDuration:h,videoDuration:u,onPreviewOnHoverChange:y,onPreviewAtTimeChange:k,onLoopDurationChange:_})]})}},9573(e,t,r){"use strict";r.d(t,{A:()=>i});var n=r(3829),o=r(790);function i({attributes:e,setAttributes:t,privateEnabledForSite:r,videoBelongToSite:i}){return(0,o.jsx)(n.A,{attributes:e,setAttributes:t,privateEnabledForSite:r,videoBelongToSite:i})}},3829(e,t,r){"use strict";r.d(t,{A:()=>a});var n=r(6427),o=r(7723),i=r(8962),s=r(790);const __=o.__,_x=o._x;function a({attributes:e,setAttributes:t,privateEnabledForSite:r,videoBelongToSite:o}){const{privacySetting:a,rating:c,allowDownload:l,displayEmbed:u}=e,d={private:_x("Site Default (Private)","VideoPress privacy setting","jetpack-videopress-pkg"),public:_x("Site Default (Public)","VideoPress privacy setting","jetpack-videopress-pkg")},p={value:String(i.zG.indexOf(i.CR)),label:r?d.private:d.public},f={value:String(i.zG.indexOf(i.az)),label:_x("Public","VideoPress privacy setting","jetpack-videopress-pkg")},h={value:String(i.zG.indexOf(i.o0)),label:_x("Private","VideoPress privacy setting","jetpack-videopress-pkg")};return(0,s.jsxs)(n.PanelBody,{title:__("Privacy and rating","jetpack-videopress-pkg"),initialOpen:!1,children:[(0,s.jsx)(n.SelectControl,{label:_x("Rating","The age rating for this video.","jetpack-videopress-pkg"),value:c??"",options:[{label:_x("G",'Video rating for "General Audiences".',"jetpack-videopress-pkg"),value:i.ko},{label:_x("PG-13",'Video rating for "Parental Guidance", unsuitable for children under 13.',"jetpack-videopress-pkg"),value:i.z7},{label:_x("R",'Video rating for "Restricted", not recommended for children under 17.',"jetpack-videopress-pkg"),value:i.iL}],onChange:e=>{t({rating:e})},disabled:!o,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,s.jsx)(n.SelectControl,{label:__("Privacy","jetpack-videopress-pkg"),onChange:e=>{const n={};n.isPrivate=e!==p.value?e===h.value:r,n.privacySetting=Number(e),t(n)},value:String(a),options:[p,f,h],disabled:!o,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,s.jsx)(n.ToggleControl,{label:__("Allow download","jetpack-videopress-pkg"),checked:l,onChange:e=>{t({allowDownload:e})},disabled:!o,__nextHasNoMarginBottom:!0}),(0,s.jsx)(n.ToggleControl,{label:__("Show video sharing menu","jetpack-videopress-pkg"),checked:u,onChange:e=>{t({displayEmbed:e})},help:__("Gives viewers the optionLine truncated
|
||||
__("Add a new text track to the video. Allowed formats: %s","jetpack-videopress-pkg"),Object.keys(d).join(", "))})]}),(0,u.jsxs)("div",{className:"video-tracks-control__track-form-label-language",children:[(0,u.jsx)(o.TextControl,{onChange:e=>j("label",e),label:__("Label","jetpack-videopress-pkg"),value:w.label,help:__("Title of track","jetpack-videopress-pkg"),disabled:l,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,u.jsx)(o.TextControl,{className:"video-tracks-control__track-form-language-tag",label:__("Source language","jetpack-videopress-pkg"),value:w.srcLang,onChange:A,help:__("Language (en, fr, etc.)","jetpack-videopress-pkg"),disabled:l,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0})]}),(0,u.jsx)(o.SelectControl,{options:p,value:w.kind,label:/* translators: %s: The kind of video text track e.g: "Subtitles, Captions" */
|
||||
__("Kind","jetpack-videopress-pkg"),onChange:e=>j("kind",e),disabled:l,__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),m&&(0,u.jsx)(o.Notice,{status:"error",isDismissible:!1,children:m}),(0,u.jsxs)("div",{className:"video-tracks-control__track-form-buttons-container "+(g?" track-exists":""),children:[g&&(0,u.jsx)(o.ToggleControl,{className:"video-tracks-control__track-form-toggle",label:__("Track exists. Replace?","jetpack-videopress-pkg"),checked:b,onChange:k,__nextHasNoMarginBottom:!0}),(0,u.jsx)(o.Button,{isBusy:l,variant:"secondary",disabled:!w.tmpFile||l||g&&!b||!!m,onClick:C,children:__("Save","jetpack-videopress-pkg")}),(0,u.jsx)(o.Button,{variant:"link",onClick:e,children:__("Cancel","jetpack-videopress-pkg")})]})]})})):null}},3339(e,t,r){"use strict";r.d(t,{A:()=>w});var n=r(3924),o=r(1455),i=r.n(o),s=r(4715),a=r(6427),c=r(6087),l=r(7723),u=r(9654),d=r(7430),p=r(560),f=r(9448),h=r(9689),g=r(9069),v=r(3898),m=r(3534),y=r(6466),b=r(4217),k=(r(1653),r(790));const __=l.__,w=(0,a.withNotices)(({attributes:e,setAttributes:t,noticeUI:r,noticeOperations:o,handleDoneUpload:l,fileToUpload:w,isReplacing:_,onReplaceCancel:j,isActive:x})=>{const[S,C]=(0,c.useState)(!1),[A,P]=(0,c.useState)(!1),[E,N]=(0,c.useState)(!1),[U,O]=(0,c.useState)(!1),R=(0,f.lY)();(0,c.useEffect)(()=>{w&&G(w)},[w]);const[T,I]=(0,c.useState)(null),[D,L]=(0,c.useState)([]),F=(0,c.useCallback)(function(...e){L(e)},[]),[B,M]=(0,c.useState)(null),z=(0,c.useCallback)(function(e){if(e?.originalResponse)try{const t=e?.originalResponse?.getBody?.(),r=JSON.parse(t);return void M(r)}catch{}M(e)},[]),{uploadHandler:$,resumeHandler:H,error:V}=(0,d.A)({onError:z,onProgress:F,onSuccess:P});function q(e,t){const{guid:r,url:n}=(0,h.kK)(e),o=__("Invalid VideoPress URL","jetpack-videopress-pkg");if(r){const e=(0,h.qh)(n);l({...e,guid:r,id:t})}else{const r=(0,h.up)(e);r?(0,h.i2)(r).then(e=>{e?l({...e,id:t}):M({data:{message:o}})}):M({data:{message:o}})}}const G=e=>{B&&z(null),I(e),F(0,e.size),N(!0),$(e)},J=()=>{if(!H)return;H[S?"start":"abort"](),C(!S)},Z=function(){H.abort(),j()};if("owner_not_connected"===V?.code){const e=(0,c.createInterpolateElement)(__("<connectLink>Connect</connectLink> your site to use the <moreAboutVideoPressLink>VideoPress</moreAboutVideoPressLink> video block.","jetpack-videopress-pkg"),{connectLink:(0,k.jsx)("a",{href:V?.data?.connect_url,rel:"noreferrer noopener"}),moreAboutVideoPressLink:(0,k.jsx)(u.N,{openInNewTab:!0,href:(0,n.A)("jetpack-videopress")})});return(0,k.jsx)(v.P,{errorMessage:e,children:(0,k.jsx)(a.Button,{variant:"primary",href:V?.data?.connect_url,children:__("Connect","jetpack-videopress-pkg")},"videopress-connect-user")})}if(B){const e=()=>{G(T)},t=()=>{I(null),F([]),z(null),N(!1)};return(0,k.jsx)(y.A,{onRetry:e,onCancel:t,errorData:B})}if(E){const r=D[0]/D[1]*100;return(0,k.jsx)(b.A,{attributes:e,setAttributes:t,file:T,progress:r,paused:S,uploadedVideoData:A,onPauseOrResume:J,onReplaceCancel:Z,isReplacing:_,onDone:l,supportPauseOrResume:!!H})}if(U)return(0,k.jsx)(v.P,{disableInstructions:!0,children:(0,k.jsxs)("div",{className:"loading-wrapper",children:[(0,k.jsx)(a.Spinner,{}),(0,k.jsx)("span",{children:__("Loading…","jetpack-videopress-pkg")})]})});if(!x){const e=__("Connect your WordPress.com account to enable high-quality, ad-free video.","jetpack-videopress-pkg"),t=__("Activate the VideoPress module to enable high-quality, ad-free video.","jetpack-videopress-pkg");return(0,k.jsx)(v.P,{disableInstructions:!0,className:"disabled",children:(0,k.jsx)("span",{children:R?t:e})})}return(0,k.jsx)(s.MediaPlaceholder,{handleUpload:!1,className:"is-videopress-placeholder",icon:(0,k.jsx)(s.BlockIcon,{icon:m.K}),labels:{title:__("VideoPress","jetpack-videopress-pkg"),instructions:__("Embed a video from your media library or upload a new one with VideoPress.","jetpack-videopress-pkg")},onSelect:function(e){if(e=e?.[0]?e[0]:e,e?.name&&e?.size&&e?.type)G(e);else{if(e.videopress_guid){return void q(Array.isArray(e.videopress_guid)?e.videopress_guid[0]:e.videopress_guid,e?.id)}if(e.id){const t=`videopress/v1/upload/${e.id}`;return O(!0),void i()({path:t,method:"GET"}).then(t=>{var r;O(!1),"new"===t.status||"resume"===t.status?(I(e),F(t.file_size,t.file_size),N(!0),r=e.id,(0,p.NP)(r).then(e=>{P(e)}).catch(e=>{M(e)})):"uploaded"===t.status?q(t.uploaded_video_guid):M({data:{message:t.message?t.message:__("Error selecting video. Please try again.","jetpack-videopress-pkg")}})}).catch(e=>{O(!1),M({data:{message:e.message}})})}M({data:{message:__("Please select a video from Library or upload a new one","jetpack-videopress-pkg")}})}},onSelectURL:q,accept:"video/*",allowedTypes:g.N,value:e,notices:r,onError:function(e){o.removeAllNotices(),o.createErrorNotice(e)}})})},9863(e,t,r){"use strict";r.d(t,{A:()=>v});var n=r(4715),o=r(6427),i=r(6087),s=r(7723),a=r(3109),c=r(3022),l=r(7975),u=r(6720),d=r(790);const __=s.__,p=["image"],f=({videoPosterImageUrl:e})=>(0,d.jsx)("div",{className:"uploading-editor__poster-image",childrLine truncated
|
||||
__("Uploading (%1$s%%)","jetpack-videopress-pkg"),O)}),(0,b.jsx)("div",{className:"videopress-uploader-progress__file-size",children:D})]}),h&&(0,b.jsx)("div",{className:"videopress-uploader-progress__actions",children:(0,b.jsx)(i.Button,{onClick:g,variant:"tertiary",isDestructive:!0,children:__("Cancel","jetpack-videopress-pkg")})}),(0,b.jsx)("div",{className:"videopress-uploader-progress__actions",children:O<100&&(0,b.jsx)(i.Button,{variant:"tertiary",onClick:u,disabled:!f,children:o?T:I})})]}):(0,b.jsx)(b.Fragment,{children:N&&s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("span",{children:[__("Upload Complete!","jetpack-videopress-pkg")," 🎉"]}),(0,b.jsx)(i.Button,{variant:"primary",onClick:S,disabled:A,isBusy:A,children:__("Done","jetpack-videopress-pkg")})]}):(0,b.jsxs)("span",{children:[__("Finishing up …","jetpack-videopress-pkg")," 🎬"]})})})]})}},9069(e,t,r){"use strict";r.d(t,{N:()=>n,o:()=>o});const n=["video"],o=["image"]},5980(e,t,r){"use strict";r.d(t,{A:()=>c});var n=r(4715),o=r(3022),i=r(9689),s=r(8864),a=r(790);const c=[{attributes:{autoplay:{type:"boolean"},title:{type:"string"},description:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"},controls:{type:"boolean",default:!0},loop:{type:"boolean"},maxWidth:{type:"string",default:"100%"},muted:{type:"boolean"},playsinline:{type:"boolean"},preload:{type:"string",default:"metadata"},seekbarPlayedColor:{type:"string",default:""},seekbarLoadingColor:{type:"string",default:""},seekbarColor:{type:"string",default:""},useAverageColor:{type:"boolean",default:!0},id:{type:"number"},guid:{type:"string"},src:{type:"string"},cacheHtml:{type:"string",default:""},poster:{type:"string"},posterData:{type:"object",default:{}},videoRatio:{type:"number"},tracks:{type:"array",items:{type:"object"},default:[]},privacySetting:{type:"number",default:1},allowDownload:{type:"boolean",default:!0},displayEmbed:{type:"boolean",default:!0},rating:{type:"string"},isPrivate:{type:"boolean"},isExample:{type:"boolean",default:!1},duration:{type:"number"}},supports:{align:!0,anchor:!0},save:function({attributes:e}){const{align:t,autoplay:r,caption:c,loop:l,muted:u,controls:d,playsinline:p,preload:f,useAverageColor:h,seekbarColor:g,seekbarLoadingColor:v,seekbarPlayedColor:m,guid:y,maxWidth:b,poster:k,posterData:w}=e,_=n.useBlockProps.save({className:(0,o.A)("wp-block-jetpack-videopress","jetpack-videopress-player",{[`align${t}`]:t})}),j=(0,s.ZC)(),x=j?r||w.previewOnHover:r,S=j?u||w.previewOnHover:u,C=(0,i.ep)(y,{autoplay:x,controls:d,loop:l,muted:S,playsinline:p,preload:f,seekbarColor:g,seekbarLoadingColor:v,seekbarPlayedColor:m,useAverageColor:h,poster:k}),A={};return b&&b.length>0&&"100%"!==b&&(A.maxWidth=b,A.margin="auto"),(0,a.jsxs)("figure",{..._,style:A,children:[C&&(0,a.jsx)("div",{className:"jetpack-videopress-player__wrapper",children:`\n${C}\n`}),!n.RichText.isEmpty(c)&&(0,a.jsx)(n.RichText.Content,{tagName:"figcaption",value:c})]})}}]},3898(e,t,r){"use strict";r.d(t,{A:()=>H,P:()=>$});var n=r(9384),o=r(5985),i=r(3162),s=r(4715),a=r(4997),c=r(6427),l=r(3582),u=r(7143),d=r(6087),p=r(7723),f=r(3147),h=r(3022),g=r(6941),v=r.n(g),m=r(9448),y=r(9689),b=r(4967),k=r(5007),w=r(8228),_=r(9079),j=r(8226),x=r(917),S=r(3534),C=r(396),A=r(7137),P=r(4749),E=r(8864),N=r(9573),U=r(9454),O=r(4554),R=r(3339),T=r(1200),I=(r(662),r(790));const __=p.__,D=R.A,L=v()("videopress:video:edit"),{jetpackVideoPressSettingUrl:F}=window?.videoPressEditorState||{},B=(0,m.ie)(),M=(0,m.b5)(),z=(0,m.Lv)(),$=(0,c.withNotices)(function({children:e,errorMessage:t,noticeUI:r,noticeOperations:n,instructions:o=T.h_,disableInstructions:i,className:a}){return(0,d.useEffect)(()=>{t&&(n.removeAllNotices(),n.createErrorNotice(t))},[t,n]),(0,I.jsx)(c.Placeholder,{icon:(0,I.jsx)(s.BlockIcon,{icon:S.K}),label:T.DD,instructions:i?null:o,notices:r,className:a,children:e})});function H({attributes:e,setAttributes:t,isSelected:r,clientId:p}){const{autoplay:g,loop:v,muted:S,controls:R,playsinline:T,preload:H,useAverageColor:V,seekbarColor:q,seekbarLoadingColor:G,seekbarPlayedColor:J,guid:Z,cacheHtml:W,poster:K,posterData:Y,align:X,videoRatio:Q,tracks:ee,src:te,caption:re,isExample:ne}=e,oe=(0,y.ep)(Z,{autoplay:g||Y.previewOnHover,controls:R,loop:v,muted:S||Y.previewOnHover,playsinline:T,preload:H,seekbarColor:q,seekbarLoadingColor:G,seekbarPlayedColor:J,useAverageColor:V,poster:K}),[ie,se]=(0,d.useState)(!1),ae=(0,m.lY)(),{tracks:ce}=(0,o.st)(),le=ee?.filter(e=>"chapters"===e.kind)?.[0],[ue,de]=(0,d.useState)(!!re),{replaceBlock:pe,__unstableMarkNextChangeAsNotPersistent:fe}=(0,u.useDispatch)(s.store),{videoData:he,isRequestingVideoData:ge,error:ve,isOverwriteChapterAllowed:me,isGeneratingPoster:ye,videoBelongToSite:be}=(0,k.n)(e,t),{filename:ke,private_enabled_for_site:we}=he,{preview:_e,isRequestingEmbedPreview:je}=(0,b.g)(oe),{html:xe,width:Se,height:Ce}=_e;(0,d.useEffect)(()=>{xe&&xe!==W&&(fe(),t({cacheHtml:xe}))},[xe,W,t]);const Ae=xe||W;(0,d.useEffect)(()=>{if(!Se||!Ce)return;conLine truncated
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
||||
/**
|
||||
* filesize
|
||||
*
|
||||
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
||||
* @license BSD-3-Clause
|
||||
* @version 10.1.6
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
.rcGUZgpe4CGD8uYmerUD{--input-width:24px;align-items:center;display:flex;gap:8px}.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child{flex-grow:2;margin-bottom:0}.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y .components-base-control__field,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y .components-range-control__wrapper,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child .components-base-control__field,.rcGUZgpe4CGD8uYmerUD .iZjYt7tDXuSRYGSpgL1y:last-child .components-range-control__wrapper{margin-bottom:0}.rcGUZgpe4CGD8uYmerUD .components-range-control__marks{top:13px}.dx9xZVwTj45XWtgjLwf2{align-items:center;background-color:#fff;border:1px solid #949494;display:flex;justify-content:space-around;padding:0}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo{margin-bottom:0;padding:0 1px}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo input{max-width:var(--input-width)}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo .components-base-control__field,.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo:last-child{margin-bottom:0}.dx9xZVwTj45XWtgjLwf2 .Uge3H06ePl7rnHIbnUgo .components-base-control__field .components-text-control__input{border:none;padding:0;text-align:center}.dx9xZVwTj45XWtgjLwf2 .components-input-control:last-child{margin-bottom:0}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input{padding-left:0!important;padding-right:0!important;text-align:center}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input::-webkit-inner-spin-button,.dx9xZVwTj45XWtgjLwf2 .components-input-control__input::-webkit-outer-spin-button{-webkit-appearance:none}.dx9xZVwTj45XWtgjLwf2 .components-input-control__input[type=number]{-webkit-appearance:textfield;appearance:textfield;-moz-appearance:textfield}.dx9xZVwTj45XWtgjLwf2 .components-input-control__backdrop{border-style:none!important}.dx9xZVwTj45XWtgjLwf2.AmMha5bHq6c3gHoP7k28{background-color:#f0f0f0}.dx9xZVwTj45XWtgjLwf2.AmMha5bHq6c3gHoP7k28 .aN3nKQFl5a3qMbO8CaVg{color:#949494}.aN3nKQFl5a3qMbO8CaVg{font-weight:900}.modal-open .dropdown-content{display:none}.current-media{border-top:1px solid #1e1e1e;margin-left:-8px;margin-right:-8px;margin-top:8px;padding:16px 16px 0}.poster-image-block-control__wrapper .poster-panel-control__help{margin-bottom:0}.poster-image-block-control__remove-button.poster-image-block-control__remove-button{padding-left:12px;padding-right:12px}body.modal-open .poster-panel__dropdown{display:none}.poster-panel .components-dropdown{display:flex;width:100%}.poster-panel .components-dropdown .poster-panel__button{background-color:#fafafa;background-position:50%;background-size:cover;border-radius:2px;display:block;max-height:512px;min-height:140px;text-align:center;width:100%}.poster-panel .components-dropdown .poster-panel__button.has-poster span{display:none}.poster-panel .components-dropdown .poster-panel__button:hover{background-image:none!important}.poster-panel .components-dropdown .poster-panel__button:hover span{display:inline}.poster-panel__notice{margin-bottom:16px;margin-left:0;margin-right:0}.poster-panel-control__help{color:#757575;font-size:12px;font-style:normal}.poster-panel-card{margin-left:-8px;margin-right:-8px;margin-top:24px;padding-left:16px;padding-right:16px}.poster-panel__frame-picker__sandbox-wrapper{background-color:#fafafa;margin-bottom:8px;position:relative}.poster-panel__frame-picker__sandbox-wrapper .components-spinner{height:32px;margin:0;position:absolute;right:50%;top:50%;transform:translate(50%,-50%);width:32px;z-index:100}.poster-panel__frame-picker__sandbox-wrapper .components-sandbox{opacity:.1;transition:opacity .3s ease-in-out;transition-delay:50ms}.poster-panel__frame-picker__sandbox-wrapper:not(.is-player-ready){aspect-ratio:16/9}.poster-panel__frame-picker__sandbox-wrapper.is-player-ready .components-sandbox{opacity:1}.poster-panel__frame-picker__sandbox-wrapper.is-generating-poster .components-sandbox{opacity:.5}.poster-panel__frame-wrapper,.poster-panel__image-wrapper{display:none;opacity:0}.poster-panel__frame-wrapper.is-selected,.poster-panel__image-wrapper.is-selected{display:block;opacity:1}.poster-panel__preview-toggle{margin-top:24px}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-interactive>*{pointer-events:auto;-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}.block-editor-block-list__layout .block-editor-block-list__block.has-warning.is-interactive:after{content:none}.block-banner{align-items:center;align-self:center;background:#000;border-radius:2px;box-shadow:inset 0 0 1px #fff;display:flex;font-size:14px;justify-content:space-between;padding:0 20px}.block-banner .block-banner__content{color:#fff;margin:10px 0 10px 10px}.block-banner .block-banner__action{padding:0}.block-banner .block-banner__action .components-button.is-primary{background:#fff;color:#000;font-size:14px;font-weight:600;height:28px;margin:8px auto 8px 0;padding:4px 8px}.block-banner .block-banner__action .components-button.is-primary:hover:not(:disabled){baLine truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-dom-ready', 'wp-polyfill'), 'version' => 'd00d9230ef0a6910ff95');
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-jetpack-videopress{position:relative}.wp-block-jetpack-videopress.jetpack-videopress-player.alignleft~.wp-block-jetpack-videopress.jetpack-videopress-player,.wp-block-jetpack-videopress.jetpack-videopress-player.alignright~.wp-block-jetpack-videopress.jetpack-videopress-player{clear:both}.wp-block-jetpack-videopress figcaption{color:#555;font-size:13px;margin-bottom:1em;margin-top:.5em;text-align:center}.is-dark-theme .wp-block-jetpack-videopress figcaption{color:hsla(0,0%,100%,.65)}.wp-block-jetpack-videopress .jetpack-videopress-player__wrapper{line-height:0;position:relative}.wp-block-jetpack-videopress .jetpack-videopress-player__overlay{cursor:pointer;height:100%;left:0;opacity:1;position:absolute;top:0;transition:opacity .3s ease-in-out;width:100%}.wp-block-jetpack-videopress .jetpack-videopress-player__overlay:hover{opacity:0}.wp-block-jetpack-videopress.wp-block-jetpack-videopress--has-max-width{margin:auto}.is-layout-flex .wp-block-jetpack-videopress.wp-block-jetpack-videopress--has-max-width{margin:0}
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={7966(){},8490(e){e.exports=window.wp.domReady}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,o),s.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r=o(8490),n=o.n(r);o(7966);n()(function(){!function(){const e=document.querySelectorAll(".wp-block-jetpack-videopress");0!==e.length&&e.forEach(function(e){const t=e.querySelector("iframe");if(!t)return;if(!window?.VideoPressIframeApi)return;const o=e.querySelector('script[type="application/json"]');if(!o)return;let r;try{r=JSON.parse(o.innerHTML)}catch(e){return void console.error(e)}o.remove();let n=!1;const s=window.VideoPressIframeApi(t,()=>{s.status.onPlayerStatusChanged((e,t)=>{"ready"===e&&"playing"===t&&(s.controls.pause(),s.controls.seek(r.previewAtTime),s.customize?.set({bigPlayButton:!0,playPauseAnimation:!1,controlBar:!1,shareButton:!1,posterImage:!0}))}),s.status.onTimeUpdate(e=>{if(n)return;const t=1e3*e,o=r.previewAtTime,a=o+r.previewLoopDuration;(t<o||t>a)&&s.controls.seek(o)})}),a=e.querySelector(".jetpack-videopress-player__overlay");a&&(r.showControls&&a.addEventListener("click",()=>{n=!0,a.remove(),s.customize?.set({bigPlayButton:!1,playPauseAnimation:!0,controlBar:!0,shareButton:!0}),s.controls.seek(0)}),a.addEventListener("mouseenter",()=>{s.customize?.set({playPauseAnimation:!1,posterImage:!1}),s.controls.play()}),a.addEventListener("mouseleave",()=>{s.customize?.set({playPauseAnimation:!1,posterImage:!0}),s.controls.pause()}))})}()})})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
.wp-block-jetpack-videopress{position:relative}.wp-block-jetpack-videopress.jetpack-videopress-player.alignleft~.wp-block-jetpack-videopress.jetpack-videopress-player,.wp-block-jetpack-videopress.jetpack-videopress-player.alignright~.wp-block-jetpack-videopress.jetpack-videopress-player{clear:both}.wp-block-jetpack-videopress figcaption{color:#555;font-size:13px;margin-bottom:1em;margin-top:.5em;text-align:center}.is-dark-theme .wp-block-jetpack-videopress figcaption{color:hsla(0,0%,100%,.65)}.wp-block-jetpack-videopress .jetpack-videopress-player__wrapper{line-height:0;position:relative}.wp-block-jetpack-videopress .jetpack-videopress-player__overlay{cursor:pointer;height:100%;opacity:1;position:absolute;right:0;top:0;transition:opacity .3s ease-in-out;width:100%}.wp-block-jetpack-videopress .jetpack-videopress-player__overlay:hover{opacity:0}.wp-block-jetpack-videopress.wp-block-jetpack-videopress--has-max-width{margin:auto}.is-layout-flex .wp-block-jetpack-videopress.wp-block-jetpack-videopress--has-max-width{margin:0}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"beta": [ "videopress-video-chapters-plugin", "videopress/video-chapters" ]
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '8bbbb4cb229ca3eae260');
|
||||
+1
@@ -0,0 +1 @@
|
||||
.extended-block-warning{margin-bottom:8px}.extended-block-warning .block-editor-warning__message{width:100%}.extended-block-warning .block-editor-warning__actions{flex-wrap:wrap}.wp-extended-block-wrapper{position:relative}.wp-extended-block-wrapper.is-disabled{opacity:.5}.wp-extended-block-wrapper .videoplayer-play{background-color:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgZmlsbD0ibm9uZSIgdmlld0JveD0iMCAwIDIyIDIyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNi4yNTcgMS4wNzVhLjQ4LjQ4IDAgMCAwLS41MDMtLjAwNy41My41MyAwIDAgMC0uMjU0LjQ1OHYxOC45NDhjMCAuMTkuMDk3LjM2NC4yNTQuNDU4LjE1Ni4wOTMuMzQ5LjA5LjUwMy0uMDA3bDE1LTkuNDc0QS41My41MyAwIDAgMCAyMS41IDExYS41My41MyAwIDAgMC0uMjQzLS40NTF6Ii8+PC9zdmc+);background-size:cover;border:none;display:block;height:72px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:none;width:72px}.wp-extended-block-wrapper img{display:block;margin:0 auto;max-width:650px;-o-object-fit:cover;object-fit:cover;width:100%}.wp-extended-block-wrapper .extended-block-player__overlay{background-color:transparent;height:100%;left:0;position:absolute;top:0;width:100%;z-index:2}
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{var e={6941(e,t,r){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))}),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(3212)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,r){e.exports=function(e){function t(e){let r,o,i,s=null;function c(...e){if(!c.enabled)return;const n=c,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return c.namespace=e,c.useColors=t.useColors(),c.color=t.selectColor(e),c.extend=n,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(c),c}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function o(e,t){let r=0,n=0,o=-1,i=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,i=r,n++):(r++,n++);else{if(-1===o)return!1;n=o+1,i++,r=i}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(o(e,r))return!1;for(const r of t.names)if(o(e,r))return!0;return!1},t.humanize=r(7378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},7368(){},7378(e){var t=1e3,r=60*t,n=60*r,o=24*n,i=7*o,s=365.25*o;function c(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}e.exports=function(e,a){a=a||{};var d=typeof e;if("string"===d&&e.length>0)return function(e){if((e=String(e)).length>100)return;var c=/^(-?(?:\d+)?\.?\d+)Line truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
.extended-block-warning{margin-bottom:8px}.extended-block-warning .block-editor-warning__message{width:100%}.extended-block-warning .block-editor-warning__actions{flex-wrap:wrap}.wp-extended-block-wrapper{position:relative}.wp-extended-block-wrapper.is-disabled{opacity:.5}.wp-extended-block-wrapper .videoplayer-play{background-color:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiIgZmlsbD0ibm9uZSIgdmlld0JveD0iMCAwIDIyIDIyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNi4yNTcgMS4wNzVhLjQ4LjQ4IDAgMCAwLS41MDMtLjAwNy41My41MyAwIDAgMC0uMjU0LjQ1OHYxOC45NDhjMCAuMTkuMDk3LjM2NC4yNTQuNDU4LjE1Ni4wOTMuMzQ5LjA5LjUwMy0uMDA3bDE1LTkuNDc0QS41My41MyAwIDAgMCAyMS41IDExYS41My41MyAwIDAgMC0uMjQzLS40NTF6Ii8+PC9zdmc+);background-size:cover;border:none;display:block;height:72px;position:absolute;right:50%;top:50%;transform:translate(50%,-50%);transition:none;width:72px}.wp-extended-block-wrapper img{display:block;margin:0 auto;max-width:650px;-o-object-fit:cover;object-fit:cover;width:100%}.wp-extended-block-wrapper .extended-block-player__overlay{background-color:transparent;height:100%;position:absolute;right:0;top:0;width:100%;z-index:2}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Main entry point for auto-generated asset registration.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
// Load script module registration.
|
||||
$modules_file = __DIR__ . '/modules.php';
|
||||
if ( file_exists( $modules_file ) ) {
|
||||
require_once $modules_file;
|
||||
}
|
||||
|
||||
// Load script registration.
|
||||
$scripts_file = __DIR__ . '/scripts.php';
|
||||
if ( file_exists( $scripts_file ) ) {
|
||||
require_once $scripts_file;
|
||||
}
|
||||
|
||||
// Load style registration.
|
||||
$styles_file = __DIR__ . '/styles.php';
|
||||
if ( file_exists( $styles_file ) ) {
|
||||
require_once $styles_file;
|
||||
}
|
||||
|
||||
// Load routes registration.
|
||||
$routes_file = __DIR__ . '/routes.php';
|
||||
if ( file_exists( $routes_file ) ) {
|
||||
require_once $routes_file;
|
||||
}
|
||||
|
||||
// Load widgets registration.
|
||||
$widgets_file = __DIR__ . '/widgets.php';
|
||||
if ( file_exists( $widgets_file ) ) {
|
||||
require_once $widgets_file;
|
||||
}
|
||||
|
||||
// Load pages registration.
|
||||
$pages_file = __DIR__ . '/pages.php';
|
||||
if ( file_exists( $pages_file ) ) {
|
||||
require_once $pages_file;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin constants - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* Returns an array of constants for use in other templates.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
return array(
|
||||
'version' => '0.38.2',
|
||||
'build_url' => plugin_dir_url( __FILE__ ),
|
||||
);
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '282f1be8e4fc8d45ff1b');
|
||||
+1
@@ -0,0 +1 @@
|
||||
body.jetpack_page_jetpack-videopress{--vp-page-bg-canvas:#fcfcfc;--font-headline-medium:48px;--font-headline-small:36px;--font-title-medium:24px;--font-body-small:14px;--font-body-extra-small:14px;--spacing-base:8px}body.jetpack_page_jetpack-videopress #wpcontent{padding-left:0}body.jetpack_page_jetpack-videopress #screen-meta-links,body.jetpack_page_jetpack-videopress #wpfooter{display:none}body.jetpack_page_jetpack-videopress #wpbody-content{bottom:0;box-sizing:border-box;display:flex;flex-direction:column;left:160px;overflow:hidden;padding-bottom:0;position:fixed;right:0;top:32px;width:auto}body.jetpack_page_jetpack-videopress.folded #wpbody-content{left:36px}@media(max-width:960px){body.jetpack_page_jetpack-videopress.auto-fold #wpbody-content{left:36px}}@media(min-width:961px){body.jetpack_page_jetpack-videopress.is-nav-unification:not(.folded) #wpbody-content{left:272px}}body.jetpack_page_jetpack-videopress #wpbody-content :has(.jp-admin-page):not(:has(.boot-layout__stage)){display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jp-admin-page{display:flex;flex:1 1 auto;flex-direction:column;margin-left:0;min-height:0;min-width:0;overflow:visible}body.jetpack_page_jetpack-videopress .jp-admin-page__page{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:first-child{flex-shrink:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page:has(.jp-admin-page-tabs)>:first-child{border-bottom:none;padding-bottom:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:not(:first-child):not(.jetpack-footer){display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0;overflow:auto}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:not(:first-child):not(.jetpack-footer)>*{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jetpack-footer{flex-shrink:0}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs{background:var(--wpds-color-bg-surface-neutral-strong);border-bottom:var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral-weak);padding-inline:8px;position:sticky;top:0;z-index:10}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs--minimal{padding-inline:24px}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs [role=tab]{font-size:13px}@media(max-width:782px){body.jetpack_page_jetpack-videopress #wpbody-content,body.jetpack_page_jetpack-videopress.auto-fold #wpbody-content,body.jetpack_page_jetpack-videopress.folded #wpbody-content{left:0;top:46px}body.jetpack_page_jetpack-videopress .jp-admin-page{margin-left:0}}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] li{margin:0}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a{text-decoration:none}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a:focus-visible,body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a:hover{text-decoration:underline}body.jetpack_page_jetpack-videopress,body.jetpack_page_jetpack-videopress .jp-admin-page,body.jetpack_page_jetpack-videopress .jp-admin-page__page{background-color:var(--vp-page-bg-canvas)}
|
||||
Whitespace-only changes.
+1
@@ -0,0 +1 @@
|
||||
body.jetpack_page_jetpack-videopress{--vp-page-bg-canvas:#fcfcfc;--font-headline-medium:48px;--font-headline-small:36px;--font-title-medium:24px;--font-body-small:14px;--font-body-extra-small:14px;--spacing-base:8px}body.jetpack_page_jetpack-videopress #wpcontent{padding-right:0}body.jetpack_page_jetpack-videopress #screen-meta-links,body.jetpack_page_jetpack-videopress #wpfooter{display:none}body.jetpack_page_jetpack-videopress #wpbody-content{bottom:0;box-sizing:border-box;display:flex;flex-direction:column;left:0;overflow:hidden;padding-bottom:0;position:fixed;right:160px;top:32px;width:auto}body.jetpack_page_jetpack-videopress.folded #wpbody-content{right:36px}@media(max-width:960px){body.jetpack_page_jetpack-videopress.auto-fold #wpbody-content{right:36px}}@media(min-width:961px){body.jetpack_page_jetpack-videopress.is-nav-unification:not(.folded) #wpbody-content{right:272px}}body.jetpack_page_jetpack-videopress #wpbody-content :has(.jp-admin-page):not(:has(.boot-layout__stage)){display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jp-admin-page{display:flex;flex:1 1 auto;flex-direction:column;margin-right:0;min-height:0;min-width:0;overflow:visible}body.jetpack_page_jetpack-videopress .jp-admin-page__page{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:first-child{flex-shrink:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page:has(.jp-admin-page-tabs)>:first-child{border-bottom:none;padding-bottom:0}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:not(:first-child):not(.jetpack-footer){display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0;overflow:auto}body.jetpack_page_jetpack-videopress .jp-admin-page__page>:not(:first-child):not(.jetpack-footer)>*{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;min-width:0}body.jetpack_page_jetpack-videopress .jetpack-footer{flex-shrink:0}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs{background:var(--wpds-color-bg-surface-neutral-strong);border-bottom:var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral-weak);padding-inline:8px;position:sticky;top:0;z-index:10}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs--minimal{padding-inline:24px}body.jetpack_page_jetpack-videopress .jp-admin-page-tabs [role=tab]{font-size:13px}@media(max-width:782px){body.jetpack_page_jetpack-videopress #wpbody-content,body.jetpack_page_jetpack-videopress.auto-fold #wpbody-content,body.jetpack_page_jetpack-videopress.folded #wpbody-content{right:0;top:46px}body.jetpack_page_jetpack-videopress .jp-admin-page{margin-right:0}}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] li{margin:0}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a{text-decoration:none}body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a:focus-visible,body.jetpack_page_jetpack-videopress nav[aria-label=Breadcrumbs] a:hover{text-decoration:underline}body.jetpack_page_jetpack-videopress,body.jetpack_page_jetpack-videopress .jp-admin-page,body.jetpack_page_jetpack-videopress .jp-admin-page__page{background-color:var(--vp-page-bg-canvas)}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('divi-vendor-wp-hooks', 'divi-vendor-wp-i18n', 'react', 'react-jsx-runtime'), 'version' => 'fe8c340990d821843340');
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
(()=>{"use strict";var e={239(e,t,o){var i=o(967),r=o(526);(0,i.addFilter)("divi.iconLibrary.icon.map","jetpack-videopress",e=>({...e,[r.name]:r}))},526(e,t,o){o.r(t),o.d(t,{component:()=>s,name:()=>r,viewBox:()=>n});var i=o(790);const r="jetpack/videopress-logo",n="0 0 16 16",s=()=>(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",transform:"translate(2 3.655) scale(0.41379)",d:"M2.79037 0.59375C4.0363 0.59375 5.13102 1.41658 5.47215 2.60947L8.8452 14.4044C8.8486 14.4164 8.85411 14.4273 8.86124 14.4368L12.8572 0.59375H15.0927H21.2721C25.6033 0.59375 28.5066 3.39892 28.5066 7.64565C28.5066 11.9411 25.5272 14.6196 21.0818 14.6196H18.1499H14.3719L13.6379 16.8813C12.9796 18.9095 11.0827 20.2839 8.94152 20.2839C6.80035 20.2839 4.90341 18.9095 4.24517 16.8813L0.137069 4.22276C-0.444671 2.43022 0.898038 0.59375 2.79037 0.59375ZM15.7374 10.4119H20.0156C21.8718 10.4119 22.9856 9.35018 22.9856 7.64565C22.9856 5.93137 21.8718 4.91839 20.0156 4.91839H17.5202L15.7374 10.4119Z"})},76(e,t,o){var i=o(967),r=o(331);const n="divi.moduleLibrary.registerModuleLibraryStore.after";let s;function a(){clearTimeout(s);const{registerModule:e}=window?.divi?.moduleLibrary??{};"function"==typeof e&&window?.divi?.module&&window?.divi?.fieldLibrary?e(r.U,r.D):console.error("Jetpack VideoPress: the Divi 5 builder runtime (window.divi.module / fieldLibrary / moduleLibrary) is unavailable; the VideoPress module was not registered.")}(0,i.didAction)(n)?a():((0,i.addAction)(n,"jetpack-videopress",a),s=setTimeout(()=>{(0,i.didAction)(n)||console.error(`Jetpack VideoPress: Divi never fired "${n}"; the VideoPress module was not registered.`)},1e4))},170(e,t,o){o.d(t,{r:()=>n});var i=o(767),r=o(93);const __=i.__,n={videoPlayer:{...r.customCssFields.videoPlayer,label:__("Video Player","jetpack-videopress-pkg")}}},497(e,t,o){o.d(t,{x:()=>p});var i=o(767),r=o(152),n=o(484),s=o(310),a=o(110),d=o(790);const __=i.__,{ModuleContainer:l}=window?.divi?.module??{},p=({attrs:e,elements:t,id:o,name:p})=>{const u=(0,a.iq)(e?.guid?.innerContent?.desktop?.value),m=(0,a.sz)(e);return(0,d.jsxs)(l,{attrs:e,elements:t,id:o,name:p,scriptDataComponent:n.C,stylesComponent:s.F,classnamesFunction:r.T,children:[t.styleComponents({attrName:"module"}),u?(0,d.jsx)("div",{className:"vidi-videopress-wrapper",style:{position:"relative",width:"100%",height:0,paddingBottom:"56.25%"},children:(0,d.jsx)("iframe",{title:(0,i.sprintf)(/* translators: %s: Video GUID. */
|
||||
__("Video player for %s","jetpack-videopress-pkg"),u),src:(0,a.$f)(u,m),style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:0},allowFullScreen:!0})}):(0,d.jsx)("p",{children:__("Enter a VideoPress URL or Video ID to preview the video.","jetpack-videopress-pkg")})]})}},331(e,t,o){o.d(t,{D:()=>a,U:()=>s});var i=o(902),r=o(497),n=o(130);const s=o(93),a={renderers:{edit:r.x},defaultAttrs:n,conversionOutline:i}},152(e,t,o){o.d(t,{T:()=>r});const{elementClassnames:i}=window?.divi?.module??{},r=({classnamesInstance:e,attrs:t})=>{e.add(i({attrs:t?.module?.decoration??{}}))}},484(e,t,o){o.d(t,{C:()=>n});var i=o(609),r=o(790);const n=({elements:e})=>(0,r.jsx)(i.Fragment,{children:e.scriptData({attrName:"module"})})},310(e,t,o){o.d(t,{F:()=>a});var i=o(170),r=o(790);const{CssStyle:n,StyleContainer:s}=window?.divi?.module??{},a=({attrs:e,baseOrderClass:t,elements:o,isCustomPostType:a,mode:d,noStyleTag:l,orderClass:p,settings:u,state:m})=>(0,r.jsxs)(s,{mode:d,state:m,noStyleTag:l,children:[o.style({attrName:"module",styleProps:{disabledOn:{disabledModuleVisibility:u?.disabledModuleVisibility}}}),(0,r.jsx)(n,{attr:e.css,baseOrderClass:t,cssFields:i.r,isCustomPostType:a,orderClass:p,selector:p})]})},110(e,t,o){o.d(t,{$f:()=>n,iq:()=>r,sz:()=>s});const i=/^(?:(?:http(?:s)?:\/\/)?(?:www\.)?video(?:\.word)?press\.com\/(?:v|embed)\/)?([a-zA-Z\d]+)(?:.*)?/i,r=e=>e?e.match(i)?.[1]??"":"",n=(e,t={})=>{const{autoplay:o,loop:i,muted:r,controls:n=!0,playsinline:s}=t,a=new URLSearchParams;return o&&a.set("autoPlay","1"),i&&a.set("loop","1"),r&&(a.set("muted","1"),a.set("persistVolume","0")),n||a.set("controls","0"),s&&a.set("playsinline","1"),a.set("embedder","divi-builder"),`https://videopress.com/embed/${e}?${a.toString()}`},s=e=>{const t=(t,o)=>"on"===(e?.[t]?.innerContent?.desktop?.value??(o?"on":"off"));return{autoplay:t("autoplay",!1),loop:t("loop",!1),muted:t("muted",!1),controls:t("controls",!0),playsinline:t("playsinline",!1)}}},609(e){e.exports=window.React},790(e){e.exports=window.ReactJSXRuntime},967(e){e.exports=window.vendor.wp.hooks},767(e){e.exports=window.vendor.wp.i18n},902(e){e.exports=JSON.parse('{"advanced":{"admin_label":"module.meta.adminLabel","animation":"module.decoration.animation","background":"module.decoration.background","disabled_on":"module.decoration.disabledOn","module":"module.advanced.htmlAttributes","overflow":"module.decoration.overflow","position_fields":"module.decoration.position","scroll":"module.decoration.scroll","sticky":"module.decoration.sticky","transform":"module.decoration.transform","transition":"module.decoration.transition","z_index":"module.decoration.zIndex","margin_padding":"module.decoration.spacing","max_width":"module.decoration.sizing","height":"module.decoration.sizing","box_shadow":{"default":"module.decoration.boxShadow"},"borders":{"default":"module.decoration.border"},"filters":{"default":"module.decoration.filters"}},"css":{"after":"css.*.after","before":"css.*.before","main_element":"css.*.mainElement"},"module":{"guid":"guid.innerContent.*"}}')},130(e){e.exports=JSON.parse('{"controls":{"innerContent":{"desktop":{"value":"on"}}}}')},93(e){e.exports=JSON.parse('{"name":"jetpack/videopress","d4Shortcode":"divi_videopress","title":"VideoPress","titles":"VideoPress","moduleIcon":"jetpack/videopress-logo","moduleClassName":"et_pb_videopress","moduleOrderClassName":"et_pb_videopress","category":"module","attributes":{"module":{"type":"object","selector":"{{selector}}","styleProps":{"sizing":{"propertySelectors":{"desktop":{"value":{"margin-left":"{{selector}}.et_pb_module","margin-right":"{{selector}}.et_pb_module"}}},"important":{"desktop":{"value":{"margin-left":true,"margin-right":true}}}}},"settings":{"meta":{"adminLabel":{}},"advanced":{"htmlAttributes":{}},"decoration":{"background":{},"sizing":{},"spacing":{},"border":{},"boxShadow":{},"filters":{},"transform":{},"animation":{},"overflow":{},"disabledOn":{},"transition":{},"position":{},"zIndex":{},"scroll":{},"sticky":{}}}},"guid":{"type":"object","selector":"{{selector}} .vidi-videopress-wrapper","settings":{"innerContent":{"groupType":"group-item","item":{"groupName":"mainContent","attrName":"guid.innerContent","priority":10,"render":true,"label":"URL or Video ID","description":"Paste a VideoPress URL or Video ID.","features":{"sticky":false,"dynamicContent":false,"responsive":false},"component":{"name":"divi/text","type":"field"}}}}},"autoplay":{"type":"object","settings":{"innerContent":{"groupType":"group-item","item":{"groupSlug":"playerOptions","attrName":"autoplay.innerContent","priority":10,"render":true,"label":"Autoplay","description":"Start playing the video automatically.","features":{"sticky":false,"responsive":false},"component":{"name":"divi/toggle","type":"field"}}}}},"loop":{"type":"object","settings":{"innerContent":{"groupType":"group-item","item":{"groupSlug":"playerOptions","attrName":"loop.innerContent","priority":20,"render":true,"label":"Loop","description":"RestartLine truncated
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"advanced": {
|
||||
"admin_label": "module.meta.adminLabel",
|
||||
"animation": "module.decoration.animation",
|
||||
"background": "module.decoration.background",
|
||||
"disabled_on": "module.decoration.disabledOn",
|
||||
"module": "module.advanced.htmlAttributes",
|
||||
"overflow": "module.decoration.overflow",
|
||||
"position_fields": "module.decoration.position",
|
||||
"scroll": "module.decoration.scroll",
|
||||
"sticky": "module.decoration.sticky",
|
||||
"transform": "module.decoration.transform",
|
||||
"transition": "module.decoration.transition",
|
||||
"z_index": "module.decoration.zIndex",
|
||||
"margin_padding": "module.decoration.spacing",
|
||||
"max_width": "module.decoration.sizing",
|
||||
"height": "module.decoration.sizing",
|
||||
"box_shadow": { "default": "module.decoration.boxShadow" },
|
||||
"borders": { "default": "module.decoration.border" },
|
||||
"filters": { "default": "module.decoration.filters" }
|
||||
},
|
||||
"css": {
|
||||
"after": "css.*.after",
|
||||
"before": "css.*.before",
|
||||
"main_element": "css.*.mainElement"
|
||||
},
|
||||
"module": {
|
||||
"guid": "guid.innerContent.*"
|
||||
}
|
||||
}
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
{
|
||||
"name": "jetpack/videopress",
|
||||
"d4Shortcode": "divi_videopress",
|
||||
"title": "VideoPress",
|
||||
"titles": "VideoPress",
|
||||
"moduleIcon": "jetpack/videopress-logo",
|
||||
"moduleClassName": "et_pb_videopress",
|
||||
"moduleOrderClassName": "et_pb_videopress",
|
||||
"category": "module",
|
||||
"attributes": {
|
||||
"module": {
|
||||
"type": "object",
|
||||
"selector": "{{selector}}",
|
||||
"styleProps": {
|
||||
"sizing": {
|
||||
"propertySelectors": {
|
||||
"desktop": {
|
||||
"value": {
|
||||
"margin-left": "{{selector}}.et_pb_module",
|
||||
"margin-right": "{{selector}}.et_pb_module"
|
||||
}
|
||||
}
|
||||
},
|
||||
"important": {
|
||||
"desktop": {
|
||||
"value": {
|
||||
"margin-left": true,
|
||||
"margin-right": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"meta": {
|
||||
"adminLabel": {}
|
||||
},
|
||||
"advanced": {
|
||||
"htmlAttributes": {}
|
||||
},
|
||||
"decoration": {
|
||||
"background": {},
|
||||
"sizing": {},
|
||||
"spacing": {},
|
||||
"border": {},
|
||||
"boxShadow": {},
|
||||
"filters": {},
|
||||
"transform": {},
|
||||
"animation": {},
|
||||
"overflow": {},
|
||||
"disabledOn": {},
|
||||
"transition": {},
|
||||
"position": {},
|
||||
"zIndex": {},
|
||||
"scroll": {},
|
||||
"sticky": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"guid": {
|
||||
"type": "object",
|
||||
"selector": "{{selector}} .vidi-videopress-wrapper",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupName": "mainContent",
|
||||
"attrName": "guid.innerContent",
|
||||
"priority": 10,
|
||||
"render": true,
|
||||
"label": "URL or Video ID",
|
||||
"description": "Paste a VideoPress URL or Video ID.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"dynamicContent": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/text",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoplay": {
|
||||
"type": "object",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupSlug": "playerOptions",
|
||||
"attrName": "autoplay.innerContent",
|
||||
"priority": 10,
|
||||
"render": true,
|
||||
"label": "Autoplay",
|
||||
"description": "Start playing the video automatically.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/toggle",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"loop": {
|
||||
"type": "object",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupSlug": "playerOptions",
|
||||
"attrName": "loop.innerContent",
|
||||
"priority": 20,
|
||||
"render": true,
|
||||
"label": "Loop",
|
||||
"description": "Restart the video when it reaches the end.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/toggle",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"muted": {
|
||||
"type": "object",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupSlug": "playerOptions",
|
||||
"attrName": "muted.innerContent",
|
||||
"priority": 30,
|
||||
"render": true,
|
||||
"label": "Muted",
|
||||
"description": "Start the video without sound.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/toggle",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"controls": {
|
||||
"type": "object",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupSlug": "playerOptions",
|
||||
"attrName": "controls.innerContent",
|
||||
"priority": 40,
|
||||
"render": true,
|
||||
"label": "Player Controls",
|
||||
"description": "Show the playback controls.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/toggle",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"playsinline": {
|
||||
"type": "object",
|
||||
"settings": {
|
||||
"innerContent": {
|
||||
"groupType": "group-item",
|
||||
"item": {
|
||||
"groupSlug": "playerOptions",
|
||||
"attrName": "playsinline.innerContent",
|
||||
"priority": 50,
|
||||
"render": true,
|
||||
"label": "Play Inline",
|
||||
"description": "Play the video inline on mobile instead of fullscreen.",
|
||||
"features": {
|
||||
"sticky": false,
|
||||
"responsive": false
|
||||
},
|
||||
"component": {
|
||||
"name": "divi/toggle",
|
||||
"type": "field"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"customCssFields": {
|
||||
"videoPlayer": {
|
||||
"subName": "videoPlayer",
|
||||
"selectorSuffix": " .vidi-videopress-wrapper"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"content": "auto",
|
||||
"design": "auto",
|
||||
"advanced": "auto",
|
||||
"groups": {
|
||||
"playerOptions": {
|
||||
"panel": "content",
|
||||
"priority": 20,
|
||||
"groupName": "playerOptions",
|
||||
"component": {
|
||||
"name": "divi/composite",
|
||||
"props": {
|
||||
"groupLabel": "Player"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('jquery', 'react', 'react-jsx-runtime'), 'version' => '2527ba26443b669a5a21');
|
||||
+1
@@ -0,0 +1 @@
|
||||
.vidi-videopress-wrapper{height:0;padding-bottom:56.25%;position:relative;width:100%}.vidi-videopress-wrapper iframe{height:100%;left:0;position:absolute;top:0;width:100%}
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={6110(){},2312(e,r,s){s.d(r,{A:()=>t});const t=[s(8933).A]},8933(e,r,s){s.d(r,{A:()=>n});var t=s(1609),o=(s(6110),s(790));const i=/^(?:(?:http(?:s)?:\/\/)?(?:www\.)?video(?:\.word)?press\.com\/(?:v|embed)\/)?([a-zA-Z\d]+)(?:.*)?/i;class d extends t.Component{static slug="divi_videopress";render(){let e=this.props.guid;if(!e)return null;const r=e.match(i);if(!r||!r[1])return null;e=r[1];const s="https://videopress.com/embed/"+e+"?autoPlay=0&permalink=0&loop=0&embedder=divi-builder",t=`VideoPress video ${e}`;return(0,o.jsxs)("div",{className:"vidi-videopress-wrapper",children:[(0,o.jsx)("iframe",{title:t,src:s,width:"100%",height:"100%"}),(0,o.jsx)("script",{src:"https://en.wordpress.com/wp-content/plugins/video/assets/js/next/videopress-iframe.js?m=1658739239"})]})}}const n=d},1609(e){e.exports=window.React},790(e){e.exports=window.ReactJSXRuntime},428(e){e.exports=window.jQuery}},r={};function s(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,s),i.exports}s.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return s.d(r,{a:r}),r},s.d=(e,r)=>{for(var t in r)s.o(r,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},s.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var t=s(428),o=s.n(t),i=s(2312);o()(window).on("et_builder_api_ready",(e,r)=>{r.registerModules(i.A)})})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
.vidi-videopress-wrapper{height:0;padding-bottom:56.25%;position:relative;width:100%}.vidi-videopress-wrapper iframe{height:100%;position:absolute;right:0;top:0;width:100%}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
+17
@@ -0,0 +1,17 @@
|
||||
<svg width="380" height="183" viewBox="0 0 380 183" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g opacity="0.75" filter="url(#filter0_f_5953_11924)">
|
||||
<path d="M360 -60C360 7.93102 304.931 63 237 63C169.069 63 114 7.93102 114 -60C114 -127.931 169.069 -183 237 -183C304.931 -183 360 -127.931 360 -60Z" fill="url(#paint0_linear_5953_11924)"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_f_5953_11924" x="-6" y="-303" width="486" height="486" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||
<feGaussianBlur stdDeviation="60" result="effect1_foregroundBlur_5953_11924"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_5953_11924" x1="360" y1="-60" x2="114" y2="-60" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#48FF50"/>
|
||||
<stop offset="0.471846" stop-color="#108642"/>
|
||||
<stop offset="1" stop-color="#2E38FA"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 990 B |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '687ee611e76167057815');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{var e={6941(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))}),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(3212)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,n){e.exports=function(e){function t(e){let n,s,o,a=null;function i(...e){if(!i.enabled)return;const r=i,s=Number(new Date),o=s-(n||s);r.diff=o,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,s)=>{if("%%"===n)return"%";a++;const o=t.formatters[s];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n}),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return i.namespace=e,i.useColors=t.useColors(),i.color=t.selectColor(e),i.extend=r,i.destroy=t.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(i),i}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function s(e,t){let n=0,r=0,s=-1,o=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(s=r,o=n,r++):(n++,r++);else{if(-1===s)return!1;r=s+1,o++,n=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(s(e,n))return!1;for(const n of t.names)if(s(e,n))return!0;return!1},t.humanize=n(7378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},7378(e){var t=1e3,n=60*t,r=60*n,s=24*r,o=7*s,a=365.25*s;function i(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var i=/^(-?(?:\d+)?\.?\d+) *(millisLine truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'd641d321fde6d46173aa');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{var e={6941(e,t,n){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let o=0,r=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(o++,"%c"===e&&(r=o))}),t.splice(r,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(3212)(t);const{formatters:o}=e.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3212(e,t,n){e.exports=function(e){function t(e){let n,r,s,a=null;function i(...e){if(!i.enabled)return;const o=i,r=Number(new Date),s=r-(n||r);o.diff=s,o.prev=n,o.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";a++;const s=t.formatters[r];if("function"==typeof s){const t=e[a];n=s.call(o,t),e.splice(a,1),a--}return n}),t.formatArgs.call(o,e);(o.log||t.log).apply(o,e)}return i.namespace=e,i.useColors=t.useColors(),i.color=t.selectColor(e),i.extend=o,i.destroy=t.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(r!==t.namespaces&&(r=t.namespaces,s=t.enabled(e)),s),set:e=>{a=e}}),"function"==typeof t.init&&t.init(i),i}function o(e,n){const o=t(this.namespace+(void 0===n?":":n)+e);return o.log=this.log,o}function r(e,t){let n=0,o=0,r=-1,s=0;for(;n<e.length;)if(o<t.length&&(t[o]===e[n]||"*"===t[o]))"*"===t[o]?(r=o,s=n,o++):(n++,o++);else{if(-1===r)return!1;o=r+1,s++,n=s}for(;o<t.length&&"*"===t[o];)o++;return o===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=n(7378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},7378(e){var t=1e3,n=60*t,o=60*n,r=24*o,s=7*r,a=365.25*r;function i(e,t,n,o){var r=t>=1.5*n;return Math.round(e/n)+" "+o+(r?"s":"")}e.exports=function(e,c){c=c||{};var d=typeof e;if("string"===d&&e.length>0)return function(e){if((e=String(e)).length>100)return;var i=/^(-?(?:\d+)?\.?\d+) *(millisLine truncated
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Script module registration - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register all script modules.
|
||||
*/
|
||||
function jetpack_videopress_register_script_modules() {
|
||||
// Ensure this only runs once. wp_default_scripts can fire multiple times,
|
||||
// and each wp_deregister_script_module() call also dequeues the module.
|
||||
// If a module was enqueued between calls, repeated deregister/register
|
||||
// cycles would lose the enqueue state.
|
||||
static $already_registered = false;
|
||||
if ( $already_registered ) {
|
||||
return;
|
||||
}
|
||||
$already_registered = true;
|
||||
|
||||
// Load build constants
|
||||
$constants_file = __DIR__ . '/constants.php';
|
||||
if ( ! file_exists( $constants_file ) ) {
|
||||
return;
|
||||
}
|
||||
$build_constants = require $constants_file;
|
||||
$modules_dir = __DIR__ . '/modules';
|
||||
$modules_file = $modules_dir . '/registry.php';
|
||||
|
||||
if ( ! file_exists( $modules_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$modules = require $modules_file;
|
||||
$base_url = $build_constants['build_url'] . 'modules/';
|
||||
|
||||
foreach ( $modules as $module ) {
|
||||
// WASM-only modules (e.g., vips worker) only have .min.js; use it even when SCRIPT_DEBUG is `true`.
|
||||
$extension = '.min.js';
|
||||
|
||||
$asset_path = $modules_dir . '/' . $module['asset'];
|
||||
$asset = file_exists( $asset_path ) ? require $asset_path : array();
|
||||
|
||||
// Deregister first to override any previously registered version
|
||||
// (e.g., Core's default modules when running as a plugin).
|
||||
wp_deregister_script_module( $module['id'] );
|
||||
|
||||
wp_register_script_module(
|
||||
$module['id'],
|
||||
$base_url . $module['path'] . $extension,
|
||||
$asset['module_dependencies'] ?? array(),
|
||||
$asset['version'] ?? false,
|
||||
array(
|
||||
'fetchpriority' => 'low',
|
||||
'in_footer' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_default_scripts', 'jetpack_videopress_register_script_modules' );
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/lazy-editor', 'import' => 'dynamic'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '188faf6c64fdd1b4');
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Script module registry - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Pages loader - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
foreach ( [
|
||||
__DIR__ . '/pages/jetpack-videopress-dashboard/page.php',
|
||||
__DIR__ . '/pages/jetpack-videopress-dashboard/page-wp-admin.php',
|
||||
] as $file ) {
|
||||
if ( file_exists( $file ) ) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
// Empty module loader for page dependencies
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
<?php
|
||||
/**
|
||||
* Page: jetpack-videopress-dashboard (wp-admin integrated)
|
||||
* Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* This version integrates with the standard WordPress admin interface,
|
||||
* keeping the wp-admin sidebar and scripts/styles intact.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
// Global storage for jetpack-videopress-dashboard routes and menu items
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes, $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items;
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes = array();
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items = array();
|
||||
|
||||
/**
|
||||
* Register a route for the jetpack-videopress-dashboard-wp-admin page.
|
||||
*
|
||||
* @param string $path Route path (e.g., '/types/$type/edit/$id').
|
||||
* @param string|null $content_module Script module ID for content (stage/inspector).
|
||||
* @param string|null $route_module Script module ID for route lifecycle hooks.
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_wp_admin_route( $path, $content_module = null, $route_module = null ) {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes;
|
||||
|
||||
$route = array( 'path' => $path );
|
||||
if ( ! empty( $content_module ) ) {
|
||||
$route['content_module'] = $content_module;
|
||||
}
|
||||
if ( ! empty( $route_module ) ) {
|
||||
$route['route_module'] = $route_module;
|
||||
}
|
||||
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes[] = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a menu item for the jetpack-videopress-dashboard-wp-admin page.
|
||||
* Note: Menu items are registered but not displayed in single-page mode.
|
||||
*
|
||||
* @param string $id Menu item ID.
|
||||
* @param string $label Display label.
|
||||
* @param string $to Route path to navigate to.
|
||||
* @param string $parent_id Optional. Parent menu item ID.
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_wp_admin_menu_item( $id, $label, $to, $parent_id = '' ) {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items;
|
||||
|
||||
$menu_item = array(
|
||||
'id' => $id,
|
||||
'label' => $label,
|
||||
'to' => $to,
|
||||
);
|
||||
|
||||
if ( ! empty( $parent_id ) ) {
|
||||
$menu_item['parent'] = $parent_id;
|
||||
}
|
||||
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items[] = $menu_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered routes for the jetpack-videopress-dashboard-wp-admin page.
|
||||
*
|
||||
* @return array Array of route objects.
|
||||
*/
|
||||
function jetpack_videopress_get_jetpack_videopress_dashboard_wp_admin_routes() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes;
|
||||
return $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_routes ?? array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered menu items for the jetpack-videopress-dashboard-wp-admin page.
|
||||
*
|
||||
* @return array Array of menu item objects.
|
||||
*/
|
||||
function jetpack_videopress_get_jetpack_videopress_dashboard_wp_admin_menu_items() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items;
|
||||
return $jetpack_videopress_jetpack_videopress_dashboard_wp_admin_menu_items ?? array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload REST API data for the jetpack-videopress-dashboard-wp-admin page.
|
||||
* Automatically called during page rendering.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_wp_admin_preload_data() {
|
||||
// Define paths to preload - same for all pages
|
||||
// Please also change packages/core-data/src/entities.js when changing this.
|
||||
$preload_paths = array(
|
||||
'/?_fields=description,gmt_offset,home,image_sizes,image_size_threshold,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front',
|
||||
array( '/wp/v2/settings', 'OPTIONS' ),
|
||||
);
|
||||
|
||||
// Use rest_preload_api_request to gather the preloaded data
|
||||
$preload_data = array_reduce(
|
||||
$preload_paths,
|
||||
'rest_preload_api_request',
|
||||
array()
|
||||
);
|
||||
|
||||
// Register the preloading middleware with wp-api-fetch
|
||||
wp_add_inline_script(
|
||||
'wp-api-fetch',
|
||||
sprintf(
|
||||
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
|
||||
wp_json_encode( $preload_data )
|
||||
),
|
||||
'after'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles for the jetpack-videopress-dashboard-wp-admin page.
|
||||
* Hooked to admin_enqueue_scripts.
|
||||
*
|
||||
* @param string $hook_suffix The current admin page.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_wp_admin_enqueue_scripts( $hook_suffix ) {
|
||||
// Check all possible ways this page can be accessed:
|
||||
// 1. Menu page via admin.php?page=jetpack-videopress-dashboard-wp-admin (plugin)
|
||||
// 2. Direct file via jetpack-videopress-dashboard.php (Core) - screen ID will be 'jetpack-videopress-dashboard'
|
||||
$current_screen = get_current_screen();
|
||||
$is_our_page = (
|
||||
( isset( $_GET['page'] ) && 'jetpack-videopress-dashboard-wp-admin' === $_GET['page'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
( $current_screen && 'jetpack-videopress-dashboard' === $current_screen->id )
|
||||
);
|
||||
|
||||
if ( ! $is_our_page ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load build constants
|
||||
$build_constants = require __DIR__ . '/../../constants.php';
|
||||
|
||||
/**
|
||||
* Fires when the jetpack-videopress-dashboard admin page is initialized so extensions can register routes and menu items.
|
||||
*/
|
||||
do_action( 'jetpack-videopress-dashboard-wp-admin_init' );
|
||||
|
||||
// Preload REST API data
|
||||
jetpack_videopress_jetpack_videopress_dashboard_wp_admin_preload_data();
|
||||
|
||||
// Get all registered routes
|
||||
$routes = jetpack_videopress_get_jetpack_videopress_dashboard_wp_admin_routes();
|
||||
|
||||
// Get boot module asset file for dependencies
|
||||
$asset_file = __DIR__ . '/../../modules/boot/index.min.asset.php';
|
||||
if ( file_exists( $asset_file ) ) {
|
||||
$asset = require $asset_file;
|
||||
|
||||
// This script serves two purposes:
|
||||
// 1. It ensures all the globals that are made available to the modules are loaded.
|
||||
// 2. It initializes the boot module as an inline script.
|
||||
wp_register_script( 'jetpack-videopress-dashboard-wp-admin-prerequisites', '', $asset['dependencies'], $asset['version'], true );
|
||||
|
||||
/*
|
||||
* Add inline script to initialize the app using initSinglePage (no menuItems).
|
||||
* The dynamic import is deferred until DOMContentLoaded so that all classic
|
||||
* script dependencies of @wordpress/boot (wp-private-apis, wp-components,
|
||||
* wp-theme, etc.) have finished parsing and executing before the boot module
|
||||
* evaluates. Otherwise, a modulepreloaded @wordpress/boot can win the race
|
||||
* against the classic-script-printing pass on fast CDN-fronted hosts in
|
||||
* Chrome, evaluating before wp.theme.privateApis is defined and throwing
|
||||
* "Cannot unlock an undefined object". See <https://core.trac.wordpress.org/ticket/65103>.
|
||||
*/
|
||||
$init_js_function = <<<'JS'
|
||||
( mountId, routes ) => {
|
||||
const run = async () => {
|
||||
const mod = await import( "@wordpress/boot" );
|
||||
mod.initSinglePage( { mountId, routes } );
|
||||
};
|
||||
if ( document.readyState === "loading" ) {
|
||||
document.addEventListener( "DOMContentLoaded", run );
|
||||
} else {
|
||||
run();
|
||||
}
|
||||
}
|
||||
JS;
|
||||
wp_add_inline_script(
|
||||
'jetpack-videopress-dashboard-wp-admin-prerequisites',
|
||||
sprintf(
|
||||
'( %s )( %s, %s );',
|
||||
$init_js_function,
|
||||
wp_json_encode( 'jetpack-videopress-dashboard-wp-admin-app', JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
|
||||
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
|
||||
)
|
||||
);
|
||||
|
||||
// Register prerequisites style by filtering script dependencies to find registered styles
|
||||
$style_dependencies = array_filter(
|
||||
$asset['dependencies'],
|
||||
function ( $handle ) {
|
||||
return wp_style_is( $handle, 'registered' );
|
||||
}
|
||||
);
|
||||
wp_register_style( 'jetpack-videopress-dashboard-wp-admin-prerequisites', false, $style_dependencies, $asset['version'] );
|
||||
|
||||
// Build dependencies for jetpack-videopress-dashboard-wp-admin module
|
||||
$boot_dependencies = array(
|
||||
array(
|
||||
'import' => 'static',
|
||||
'id' => '@wordpress/boot',
|
||||
),
|
||||
);
|
||||
|
||||
// Add all registered routes as dependencies
|
||||
foreach ( $routes as $route ) {
|
||||
if ( isset( $route['route_module'] ) ) {
|
||||
$boot_dependencies[] = array(
|
||||
'import' => 'static',
|
||||
'id' => $route['route_module'],
|
||||
);
|
||||
}
|
||||
if ( isset( $route['content_module'] ) ) {
|
||||
$boot_dependencies[] = array(
|
||||
'import' => 'dynamic',
|
||||
'id' => $route['content_module'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the boot script-module dependencies for the
|
||||
* jetpack-videopress-dashboard-wp-admin page.
|
||||
*
|
||||
* Surfaces extending this page can append entries to the boot
|
||||
* dependency list. Each entry is an array with 'import' (string
|
||||
* 'static' or 'dynamic') and 'id' (script-module handle) keys.
|
||||
*
|
||||
* @param array $boot_dependencies Boot dependencies for the page.
|
||||
*/
|
||||
$boot_dependencies = apply_filters(
|
||||
'jetpack-videopress-dashboard-wp-admin_boot_dependencies',
|
||||
$boot_dependencies
|
||||
);
|
||||
|
||||
// Dummy script module to ensure dependencies are loaded
|
||||
wp_register_script_module(
|
||||
'jetpack-videopress-dashboard-wp-admin',
|
||||
$build_constants['build_url'] . 'pages/jetpack-videopress-dashboard/loader.js',
|
||||
$boot_dependencies
|
||||
);
|
||||
|
||||
// Enqueue the boot scripts and styles
|
||||
wp_enqueue_script( 'jetpack-videopress-dashboard-wp-admin-prerequisites' );
|
||||
wp_enqueue_script_module( 'jetpack-videopress-dashboard-wp-admin' );
|
||||
wp_enqueue_style( 'jetpack-videopress-dashboard-wp-admin-prerequisites' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the jetpack-videopress-dashboard-wp-admin page.
|
||||
* Call this function from add_menu_page or add_submenu_page.
|
||||
* This renders within the normal WordPress admin interface.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_wp_admin_render_page() {
|
||||
?>
|
||||
<style>
|
||||
/* Critical styles to prevent layout shifts - inlined for immediate application */
|
||||
|
||||
#wpwrap {
|
||||
overflow-y: auto;
|
||||
}
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* Reset wp-admin padding */
|
||||
#wpcontent {
|
||||
padding-inline-start: 0;
|
||||
}
|
||||
#wpbody-content {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* Hide legacy admin elements */
|
||||
#wpbody-content > div:not(.boot-layout-container):not(#screen-meta) {
|
||||
display: none;
|
||||
}
|
||||
#wpfooter {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Accessibility regions */
|
||||
.a11y-speak-region {
|
||||
inset-inline-start: -1px;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
/* Admin menu indicators */
|
||||
ul#adminmenu a.wp-has-current-submenu::after,
|
||||
ul#adminmenu > li.current > a.current::after {
|
||||
border-inline-end-color: #fff;
|
||||
}
|
||||
|
||||
/* Media frame fix */
|
||||
.media-frame select.attachment-filters:last-of-type {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Responsive overflow fix for #wpwrap */
|
||||
@media (min-width: 782px) {
|
||||
#wpwrap {
|
||||
overflow-y: initial;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div id="jetpack-videopress-dashboard-wp-admin-app" class="boot-layout-container"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Hook the enqueue function to admin_enqueue_scripts
|
||||
add_action( 'admin_enqueue_scripts', 'jetpack_videopress_jetpack_videopress_dashboard_wp_admin_enqueue_scripts' );
|
||||
|
||||
+318
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
/**
|
||||
* Page: jetpack-videopress-dashboard
|
||||
* Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
// Global storage for jetpack-videopress-dashboard routes and menu items
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_routes, $jetpack_videopress_jetpack_videopress_dashboard_menu_items;
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_routes = array();
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_menu_items = array();
|
||||
|
||||
/**
|
||||
* Register a route for the jetpack-videopress-dashboard page.
|
||||
*
|
||||
* @param string $path Route path (e.g., '/types/$type/edit/$id').
|
||||
* @param string|null $content_module Script module ID for content (stage/inspector).
|
||||
* @param string|null $route_module Script module ID for route lifecycle hooks.
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_route( $path, $content_module = null, $route_module = null ) {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_routes;
|
||||
|
||||
$route = array( 'path' => $path );
|
||||
if ( ! empty( $content_module ) ) {
|
||||
$route['content_module'] = $content_module;
|
||||
}
|
||||
if ( ! empty( $route_module ) ) {
|
||||
$route['route_module'] = $route_module;
|
||||
}
|
||||
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_routes[] = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a menu item for the jetpack-videopress-dashboard page.
|
||||
*
|
||||
* @param string $id Menu item ID.
|
||||
* @param string $label Display label.
|
||||
* @param string $to Route path to navigate to.
|
||||
* @param string $parent_id Optional. Parent menu item ID.
|
||||
* @param string $parent_type Optional. Parent type: 'drilldown' or 'dropdown'.
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_menu_item( $id, $label, $to, $parent_id = '', $parent_type = '' ) {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_menu_items;
|
||||
|
||||
$menu_item = array(
|
||||
'id' => $id,
|
||||
'label' => $label,
|
||||
'to' => $to,
|
||||
);
|
||||
|
||||
if ( ! empty( $parent_id ) ) {
|
||||
$menu_item['parent'] = $parent_id;
|
||||
}
|
||||
|
||||
if ( ! empty( $parent_type ) && in_array( $parent_type, array( 'drilldown', 'dropdown' ), true ) ) {
|
||||
$menu_item['parent_type'] = $parent_type;
|
||||
}
|
||||
|
||||
$jetpack_videopress_jetpack_videopress_dashboard_menu_items[] = $menu_item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered routes for the jetpack-videopress-dashboard page.
|
||||
*
|
||||
* @return array Array of route objects.
|
||||
*/
|
||||
function jetpack_videopress_get_jetpack_videopress_dashboard_routes() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_routes;
|
||||
return $jetpack_videopress_jetpack_videopress_dashboard_routes ?? array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered menu items for the jetpack-videopress-dashboard page.
|
||||
*
|
||||
* @return array Array of menu item objects.
|
||||
*/
|
||||
function jetpack_videopress_get_jetpack_videopress_dashboard_menu_items() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_menu_items;
|
||||
return $jetpack_videopress_jetpack_videopress_dashboard_menu_items ?? array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload REST API data for the jetpack-videopress-dashboard page.
|
||||
* Automatically called during page rendering.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_preload_data() {
|
||||
// Define paths to preload - same for all pages
|
||||
// Please also change packages/core-data/src/entities.js when changing this.
|
||||
$preload_paths = array(
|
||||
'/?_fields=description,gmt_offset,home,image_sizes,image_size_threshold,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front',
|
||||
array( '/wp/v2/settings', 'OPTIONS' ),
|
||||
);
|
||||
|
||||
// Use rest_preload_api_request to gather the preloaded data
|
||||
$preload_data = array_reduce(
|
||||
$preload_paths,
|
||||
'rest_preload_api_request',
|
||||
array()
|
||||
);
|
||||
|
||||
// Register the preloading middleware with wp-api-fetch
|
||||
wp_add_inline_script(
|
||||
'wp-api-fetch',
|
||||
sprintf(
|
||||
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
|
||||
wp_json_encode( $preload_data )
|
||||
),
|
||||
'after'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the jetpack-videopress-dashboard page.
|
||||
* Call this function from add_menu_page or add_submenu_page.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_render_page() {
|
||||
// Load build constants
|
||||
$build_constants = require __DIR__ . '/../../constants.php';
|
||||
|
||||
// Set current screen
|
||||
set_current_screen();
|
||||
|
||||
// Remove unwanted deprecated handler
|
||||
remove_action( 'admin_head', 'wp_admin_bar_header' );
|
||||
|
||||
// Remove unwanted scripts and styles that were enqueued during `admin_init`
|
||||
foreach ( wp_scripts()->queue as $script ) {
|
||||
wp_dequeue_script( $script );
|
||||
}
|
||||
foreach ( wp_styles()->queue as $style ) {
|
||||
wp_dequeue_style( $style );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires when the jetpack-videopress-dashboard page is initialized so extensions can register routes and menu items.
|
||||
*/
|
||||
do_action( 'jetpack-videopress-dashboard_init' );
|
||||
|
||||
// Enqueue command palette assets for boot-based pages
|
||||
if ( function_exists( 'wp_enqueue_command_palette_assets' ) ) {
|
||||
wp_enqueue_command_palette_assets();
|
||||
}
|
||||
|
||||
// Preload REST API data
|
||||
jetpack_videopress_jetpack_videopress_dashboard_preload_data();
|
||||
|
||||
// Get all registered routes and menu items
|
||||
$menu_items = jetpack_videopress_get_jetpack_videopress_dashboard_menu_items();
|
||||
$routes = jetpack_videopress_get_jetpack_videopress_dashboard_routes();
|
||||
|
||||
// Get boot module asset file for dependencies
|
||||
$asset_file = __DIR__ . '/../../modules/boot/index.min.asset.php';
|
||||
if ( file_exists( $asset_file ) ) {
|
||||
$asset = require $asset_file;
|
||||
|
||||
// This script serves two purposes:
|
||||
// 1. It ensures all the globals that are made available to the modules are loaded.
|
||||
// 2. It initializes the boot module as an inline script.
|
||||
wp_register_script( 'jetpack-videopress-dashboard-prerequisites', '', $asset['dependencies'], $asset['version'], true );
|
||||
|
||||
// Add inline script to initialize the app
|
||||
$init_modules = [];
|
||||
wp_add_inline_script(
|
||||
'jetpack-videopress-dashboard-prerequisites',
|
||||
sprintf(
|
||||
'import("@wordpress/boot").then(mod => mod.init({mountId: "%s", menuItems: %s, routes: %s, initModules: %s, dashboardLink: "%s"}));',
|
||||
'jetpack-videopress-dashboard-app',
|
||||
wp_json_encode( $menu_items, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
|
||||
wp_json_encode( $routes, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
|
||||
wp_json_encode( $init_modules, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
|
||||
esc_url( admin_url( '/' ) )
|
||||
)
|
||||
);
|
||||
|
||||
// Register prerequisites style by filtering script dependencies to find registered styles
|
||||
$style_dependencies = array_filter(
|
||||
$asset['dependencies'],
|
||||
function ( $handle ) {
|
||||
return wp_style_is( $handle, 'registered' );
|
||||
}
|
||||
);
|
||||
wp_register_style( 'jetpack-videopress-dashboard-prerequisites', false, $style_dependencies, $asset['version'] );
|
||||
|
||||
// Build dependencies for jetpack-videopress-dashboard module
|
||||
$boot_dependencies = array(
|
||||
array(
|
||||
'import' => 'static',
|
||||
'id' => '@wordpress/boot',
|
||||
),
|
||||
);
|
||||
|
||||
// Add init modules as static dependencies
|
||||
// No init modules configured
|
||||
|
||||
// Add all registered routes as dependencies
|
||||
foreach ( $routes as $route ) {
|
||||
if ( isset( $route['route_module'] ) ) {
|
||||
$boot_dependencies[] = array(
|
||||
'import' => 'static',
|
||||
'id' => $route['route_module'],
|
||||
);
|
||||
}
|
||||
if ( isset( $route['content_module'] ) ) {
|
||||
$boot_dependencies[] = array(
|
||||
'import' => 'dynamic',
|
||||
'id' => $route['content_module'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the boot script-module dependencies for the
|
||||
* jetpack-videopress-dashboard page.
|
||||
*
|
||||
* Surfaces extending this page can append entries to the boot
|
||||
* dependency list. Each entry is an array with 'import' (string
|
||||
* 'static' or 'dynamic') and 'id' (script-module handle) keys.
|
||||
*
|
||||
* @param array $boot_dependencies Boot dependencies for the page.
|
||||
*/
|
||||
$boot_dependencies = apply_filters(
|
||||
'jetpack-videopress-dashboard_boot_dependencies',
|
||||
$boot_dependencies
|
||||
);
|
||||
|
||||
// Dummy script module to ensure dependencies are loaded
|
||||
wp_register_script_module(
|
||||
'jetpack-videopress-dashboard',
|
||||
$build_constants['build_url'] . 'pages/jetpack-videopress-dashboard/loader.js',
|
||||
$boot_dependencies
|
||||
);
|
||||
|
||||
// Enqueue the boot scripts and styles
|
||||
wp_enqueue_script( 'jetpack-videopress-dashboard-prerequisites' );
|
||||
wp_enqueue_script_module( 'jetpack-videopress-dashboard' );
|
||||
wp_enqueue_style( 'jetpack-videopress-dashboard-prerequisites' );
|
||||
}
|
||||
|
||||
// Output the HTML
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?php echo esc_html( get_admin_page_title() ); ?></title>
|
||||
<style>
|
||||
html {
|
||||
background: #f1f1f1;
|
||||
color: #444;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
#wpadminbar { display: none; }
|
||||
</style>
|
||||
<?php
|
||||
global $hook_suffix;
|
||||
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$hook_suffix = 'jetpack-videopress-dashboard';
|
||||
|
||||
// BEGIN see wp-admin/admin-header.php
|
||||
print_admin_styles();
|
||||
print_head_scripts();
|
||||
|
||||
/** This action is documented in wp-admin/admin-header.php */
|
||||
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
|
||||
/** This action is documented in wp-admin/admin-header.php */
|
||||
do_action( 'admin_head' );
|
||||
// END see wp-admin/admin-header.php
|
||||
?>
|
||||
</head>
|
||||
<body class="jetpack-videopress-dashboard">
|
||||
<div id="jetpack-videopress-dashboard-app" style="height: 100vh; box-sizing: border-box;"></div>
|
||||
<?php
|
||||
// BEGIN see wp-admin/admin-footer.php
|
||||
|
||||
/** This action is documented in wp-admin/admin-footer.php */
|
||||
do_action( 'admin_footer', '' );
|
||||
|
||||
// Print import map first so it's available for inline scripts
|
||||
wp_script_modules()->print_import_map();
|
||||
print_footer_scripts();
|
||||
wp_script_modules()->print_enqueued_script_modules();
|
||||
wp_script_modules()->print_script_module_preloads();
|
||||
wp_script_modules()->print_script_module_data();
|
||||
|
||||
/** This action is documented in wp-admin/admin-footer.php */
|
||||
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||
// END see wp-admin/admin-footer.php
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercept admin_init to render the page early.
|
||||
* This bypasses the default WordPress admin template.
|
||||
*/
|
||||
function jetpack_videopress_jetpack_videopress_dashboard_intercept_render() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['page'] ) && 'jetpack-videopress-dashboard' === $_GET['page'] ) {
|
||||
jetpack_videopress_jetpack_videopress_dashboard_render_page();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Hook the interceptor to admin_init
|
||||
add_action( 'admin_init', 'jetpack_videopress_jetpack_videopress_dashboard_intercept_render' );
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* Routes registration - Auto-generated by build process.
|
||||
* Registers all routes on their respective page init hooks.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
// Load routes registry
|
||||
$routes_file = __DIR__ . '/routes/registry.php';
|
||||
if ( ! file_exists( $routes_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$routes = require $routes_file;
|
||||
|
||||
// Group routes by page and store in globals for page-specific functions
|
||||
$routes_by_page = array();
|
||||
foreach ( $routes as $route ) {
|
||||
$page_slug = $route['page'];
|
||||
if ( ! isset( $routes_by_page[ $page_slug ] ) ) {
|
||||
$routes_by_page[ $page_slug ] = array();
|
||||
}
|
||||
$routes_by_page[ $page_slug ][] = $route;
|
||||
}
|
||||
|
||||
// Store routes data in globals for each page
|
||||
foreach ( $routes_by_page as $page_slug => $page_routes ) {
|
||||
$page_slug_underscore = str_replace( '-', '_', $page_slug );
|
||||
$global_name = 'jetpack_videopress_' . $page_slug_underscore . '_routes_data';
|
||||
$GLOBALS[ $global_name ] = $page_routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic helper function to register routes for a page.
|
||||
*
|
||||
* @param array $page_routes Array of route data for the page.
|
||||
* @param string $register_function_name Name of the function to call for registering each route.
|
||||
*/
|
||||
function jetpack_videopress_register_page_routes( $page_routes, $register_function_name ) {
|
||||
// Load build constants
|
||||
$build_constants = require __DIR__ . '/constants.php';
|
||||
|
||||
foreach ( $page_routes as $route ) {
|
||||
$content_handle = null;
|
||||
$route_handle = null;
|
||||
|
||||
// Register content module if exists
|
||||
if ( $route['has_content'] ) {
|
||||
$content_asset_path = __DIR__ . "/routes/{$route['name']}/content.min.asset.php";
|
||||
if ( file_exists( $content_asset_path ) ) {
|
||||
$content_asset = require $content_asset_path;
|
||||
$content_handle = 'jetpack-videopress/routes/' . $route['name'] . '/content';
|
||||
$extension = '.min.js';
|
||||
// Deregister first to override any previously registered version
|
||||
// (e.g., Core's default modules when running as a plugin).
|
||||
wp_deregister_script_module( $content_handle );
|
||||
wp_register_script_module(
|
||||
$content_handle,
|
||||
$build_constants['build_url'] . 'routes/' . $route['name'] . '/content' . $extension,
|
||||
$content_asset['module_dependencies'] ?? array(),
|
||||
$content_asset['version'] ?? false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Register route module if exists
|
||||
if ( $route['has_route'] ) {
|
||||
$route_asset_path = __DIR__ . "/routes/{$route['name']}/route.min.asset.php";
|
||||
if ( file_exists( $route_asset_path ) ) {
|
||||
$route_asset = require $route_asset_path;
|
||||
$route_handle = 'jetpack-videopress/routes/' . $route['name'] . '/route';
|
||||
$extension = '.min.js';
|
||||
// Deregister first to override any previously registered version
|
||||
// (e.g., Core's default modules when running as a plugin).
|
||||
wp_deregister_script_module( $route_handle );
|
||||
wp_register_script_module(
|
||||
$route_handle,
|
||||
$build_constants['build_url'] . 'routes/' . $route['name'] . '/route' . $extension,
|
||||
$route_asset['module_dependencies'] ?? array(),
|
||||
$route_asset['version'] ?? false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Register route with page
|
||||
if ( function_exists( $register_function_name ) ) {
|
||||
call_user_func( $register_function_name, $route['path'], $content_handle, $route_handle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Page-specific route registration functions
|
||||
// Page-specific route registration functions for jetpack-videopress-dashboard
|
||||
/**
|
||||
* Register routes for jetpack-videopress-dashboard page (full-page mode).
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_page_routes() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_routes_data;
|
||||
jetpack_videopress_register_page_routes( $jetpack_videopress_jetpack_videopress_dashboard_routes_data, 'jetpack_videopress_register_jetpack_videopress_dashboard_route' );
|
||||
}
|
||||
add_action( 'jetpack-videopress-dashboard_init', 'jetpack_videopress_register_jetpack_videopress_dashboard_page_routes' );
|
||||
|
||||
/**
|
||||
* Register routes for jetpack-videopress-dashboard page (wp-admin mode).
|
||||
*/
|
||||
function jetpack_videopress_register_jetpack_videopress_dashboard_wp_admin_page_routes() {
|
||||
global $jetpack_videopress_jetpack_videopress_dashboard_routes_data;
|
||||
jetpack_videopress_register_page_routes( $jetpack_videopress_jetpack_videopress_dashboard_routes_data, 'jetpack_videopress_register_jetpack_videopress_dashboard_wp_admin_route' );
|
||||
}
|
||||
add_action( 'jetpack-videopress-dashboard-wp-admin_init', 'jetpack_videopress_register_jetpack_videopress_dashboard_wp_admin_page_routes' );
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => 'c71428f3744206db4e66');
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
var O3=Object.create;var Uf=Object.defineProperty;var I3=Object.getOwnPropertyDescriptor;var A3=Object.getOwnPropertyNames;var N3=Object.getPrototypeOf,D3=Object.prototype.hasOwnProperty;var M3=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ee=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Dl=(e,t)=>{for(var r in t)Uf(e,r,{get:t[r],enumerable:!0})},jf=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A3(t))!D3.call(e,o)&&o!==r&&Uf(e,o,{get:()=>t[o],enumerable:!(i=I3(t,o))||i.enumerable});return e},Ml=(e,t,r)=>(jf(e,t,"default"),r&&jf(r,t,"default")),f=(e,t,r)=>(r=e!=null?O3(N3(e)):{},jf(t||!e||!e.__esModule?Uf(r,"default",{value:e,enumerable:!0}):r,e));var F=Ee((A7,Hv)=>{Hv.exports=window.ReactJSXRuntime});var oe=Ee((N7,$v)=>{$v.exports=window.wp.components});var sr=Ee((M7,qv)=>{qv.exports=window.wp.data});var Kv=Ee((L7,Gv)=>{Gv.exports=window.wp.notices});var $=Ee((j7,Jv)=>{Jv.exports=window.wp.element});var Wt=Ee((U7,Zv)=>{Zv.exports=window.wp.compose});var Z=Ee((z7,Xv)=>{Xv.exports=window.React});var ep=Ee((PN,Rb)=>{Rb.exports=window.ReactDOM});var Pb=Ee(Tb=>{"use strict";var $n=Z();function n5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var a5=typeof Object.is=="function"?Object.is:n5,s5=$n.useState,l5=$n.useEffect,c5=$n.useLayoutEffect,d5=$n.useDebugValue;function u5(e,t){var r=t(),i=s5({inst:{value:r,getSnapshot:t}}),o=i[0].inst,n=i[1];return c5(function(){o.value=r,o.getSnapshot=t,tp(o)&&n({inst:o})},[e,r,t]),l5(function(){return tp(o)&&n({inst:o}),e(function(){tp(o)&&n({inst:o})})},[e]),d5(r),r}function tp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!a5(e,r)}catch{return!0}}function f5(e,t){return t()}var p5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f5:u5;Tb.useSyncExternalStore=$n.useSyncExternalStore!==void 0?$n.useSyncExternalStore:p5});var rp=Ee((IN,Ob)=>{"use strict";Ob.exports=Pb()});var ee=Ee((VN,Nb)=>{Nb.exports=window.wp.i18n});var Re=Ee((FN,Db)=>{Db.exports=window.wp.primitives});var Lb=Ee((BD,Mb)=>{Mb.exports=window.wp.privateApis});var Jp=Ee((tM,Kb)=>{Kb.exports=window.wp.keycodes});var Py=Ee((fz,xd)=>{var Ey={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u1EA4:"A",\u1EAE:"A",\u1EB2:"A",\u1EB4:"A",\u1EB6:"A",\u00C6:"AE",\u1EA6:"A",\u1EB0:"A",\u0202:"A",\u1EA2:"A",\u1EA0:"A",\u1EA8:"A",\u1EAA:"A",\u1EAC:"A",\u00C7:"C",\u1E08:"C",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u1EBE:"E",\u1E16:"E",\u1EC0:"E",\u1E14:"E",\u1E1C:"E",\u0206:"E",\u1EBA:"E",\u1EBC:"E",\u1EB8:"E",\u1EC2:"E",\u1EC4:"E",\u1EC6:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u1E2E:"I",\u020A:"I",\u1EC8:"I",\u1ECA:"I",\u00D0:"D",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u1ED0:"O",\u1E4C:"O",\u1E52:"O",\u020E:"O",\u1ECE:"O",\u1ECC:"O",\u1ED4:"O",\u1ED6:"O",\u1ED8:"O",\u1EDC:"O",\u1EDE:"O",\u1EE0:"O",\u1EDA:"O",\u1EE2:"O",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u1EE6:"U",\u1EE4:"U",\u1EEC:"U",\u1EEE:"U",\u1EF0:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u1EA5:"a",\u1EAF:"a",\u1EB3:"a",\u1EB5:"a",\u1EB7:"a",\u00E6:"ae",\u1EA7:"a",\u1EB1:"a",\u0203:"a",\u1EA3:"a",\u1EA1:"a",\u1EA9:"a",\u1EAB:"a",\u1EAD:"a",\u00E7:"c",\u1E09:"c",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u1EBF:"e",\u1E17:"e",\u1EC1:"e",\u1E15:"e",\u1E1D:"e",\u0207:"e",\u1EBB:"e",\u1EBD:"e",\u1EB9:"e",\u1EC3:"e",\u1EC5:"e",\u1EC7:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u1E2F:"i",\u020B:"i",\u1EC9:"i",\u1ECB:"i",\u00F0:"d",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u1ED1:"o",\u1E4D:"o",\u1E53:"o",\u020F:"o",\u1ECF:"o",\u1ECD:"o",\u1ED5:"o",\u1ED7:"o",\u1ED9:"o",\u1EDD:"o",\u1EDF:"o",\u1EE1:"o",\u1EDB:"o",\u1EE3:"o",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u1EE7:"u",\u1EE5:"u",\u1EED:"u",\u1EEF:"u",\u1EF1:"u",\u00FD:"y",\u00FF:"y",\u0100:"A",\u0101:"a",\u0102:"A",\u0103:"a",\u0104:"A",\u0105:"a",\u0106:"C",\u0107:"c",\u0108:"C",\u0109:"c",\u010A:"C",\u010B:"c",\u010C:"C",\u010D:"c",C\u0306:"C",c\u0306:"c",\u010E:"D",\u010F:"d",\u0110:"D",\u0111:"d",\u0112:"E",\u0113:"e",\u0114:"E",\u0115:"e",\u0116:"E",\u0117:"e",\u0118:"E",\u0119:"e",\u011A:"E",\u011B:"e",\u011C:"G",\u01F4:"G",\u011D:"g",\u01F5:"g",\u011E:"G",\u011F:"g",\u0120:"G",\u0121:"g",\u0122:"G",\u0123:"g",\u0124:"H",\u0125:"h",\u0126:"H",\u0127:"h",\u1E2A:"H",\u1E2B:"h",\u0128:"I",\u0129:"i",\u012A:"I",\u012B:"i",\u012C:"I",\u012D:"i",\u012E:"I",\u012F:"i",\u0130:"I",\u0131:"i",\u0132:"IJ",\u0133:"ij",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u1E30:"K",\u1E31:"k",K\u0306:"K",k\u0306:"k",\u0139:"L",\u013A:"l",\u013B:"L",\u013C:"l",\u013D:"L",\u013E:"l",\u013F:"L",\u0140:"l",\u0141:"l",\u0142:"l",\u1E3E:"M",\u1E3F:"m",M\u0306:"M",mLine truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var ol={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},X2=1,rS=(0,Pn.forwardRef)(function({children:t,variant:r="default",className:i,activateOnFocus:o,...n},a){let[s,l]=(0,Pn.useState)(null),[c,d]=(0,Pn.useState)({first:!1,last:!1,isScrolling:!1});(0,Pn.useEffect)(()=>{if(!s)return;let m=()=>{let{scrollWidth:_,clientWidth:x,scrollLeft:w}=s,k=Math.max(_-x,0),P=(s.dir||(typeof window<"u"?window.getComputedStyle(s).direction:"ltr"))==="rtl"&&w<0?-w:w;d({first:P>X2,last:P<k-X2,isScrolling:_>x})},h=new ResizeObserver(m);h.observe(s);let p=!1,v=()=>{p||(requestAnimationFrame(()=>{m(),p=!1}),p=!0)};return s.addEventListener("scroll",v,{passive:!0}),m(),()=>{s.removeEventListener("scroll",v),h.disconnect()}},[s]);let u=(0,eS.useMergeRefs)([a,m=>l(m)]);return(0,ju.jsxs)(Gr.List,{ref:u,activateOnFocus:o,"data-select-on-move":o?"true":"false",className:U(ol.tablist,c.first&&ol["is-overflowing-first"],c.last&&ol["is-overflowing-last"],ol[`is-${r}-variant`],i),...n,tabIndex:n.tabIndex??(c.isScrolling?-1:void 0),children:[t,(0,ju.jsx)(Gr.Indicator,{className:ol.indicator})]})});var aS=f($(),1);var zt=f($(),1);var nl=f(F(),1),Uu=!1,ig=Uu?(0,zt.createContext)(null):null;function q8(){let e=(0,zt.useContext)(ig);(0,zt.useEffect)(()=>{if(e)return e.registerTab()},[e])}function G8(){}var iS=Uu?q8:G8;function K8(){let e=(0,zt.useContext)(ig);(0,zt.useEffect)(()=>{if(e)return e.registerPanel()},[e])}function Y8(){}var oS=Uu?K8:Y8;function Q8({children:e}){let t=(0,zt.useRef)(0),r=(0,zt.useRef)(0),i=Y2(()=>{let s=t.current,l=r.current;if(s!==l)throw new Error(`Tabs: Tab/Panel count mismatch (${s} Tabs, ${l} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`)}),o=(0,zt.useCallback)(()=>(t.current+=1,i(),()=>{t.current-=1,i()}),[i]),n=(0,zt.useCallback)(()=>(r.current+=1,i(),()=>{r.current-=1,i()}),[i]),a=(0,zt.useMemo)(()=>({registerTab:o,registerPanel:n}),[o,n]);return(0,nl.jsx)(ig.Provider,{value:a,children:e})}function J8({children:e}){return(0,nl.jsx)(nl.Fragment,{children:e})}var nS=Uu?Q8:J8;var cS=f(F(),1),og="data-wp-hash";function ng(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={documents:new Map,styles:new Map,injectedStyles:new WeakMap},typeof document<"u"&&X8(document)),e.__wpStyleRuntime}function Z8(e,t){if(!e.head)return!1;for(let r of e.head.querySelectorAll(`style[${og}]`))if(r.getAttribute(og)===t)return!0;return!1}function sS(e,t,r){if(!e.head)return;let i=ng(),o=i.injectedStyles.get(e);if(o||(o=new Set,i.injectedStyles.set(e,o)),o.has(t))return;if(Z8(e,t)){o.add(t);return}let n=e.createElement("style");n.setAttribute(og,t),n.appendChild(e.createTextNode(r)),e.head.appendChild(n),o.add(t)}function X8(e){let t=ng();t.documents.set(e,(t.documents.get(e)??0)+1);for(let[r,i]of t.styles)sS(e,r,i);return()=>{let r=t.documents.get(e);if(r!==void 0){if(r<=1){t.documents.delete(e);return}t.documents.set(e,r-1)}}}function lS(e,t){let r=ng();r.styles.set(e,t);for(let i of r.documents.keys())sS(i,e,t)}typeof process>"u",lS("1fb29d3a3c","._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-inpu
Line truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var sg={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},hS=(0,pS.forwardRef)(function({className:t,children:r,...i},o){return iS(),(0,al.jsxs)(Gr.Tab,{ref:o,className:U(sg.tab,t),...i,children:[(0,al.jsx)("span",{className:sg["tab-children"],children:r}),(0,al.jsx)(il,{icon:hp,className:sg["tab-chevron"]})]})});var $t=f(F(),1);var Bu=f(bS(),1),wS=f(dg(),1);function sl(e){class t extends Error{constructor(...i){super(...i),this.name=e}}return t}var aO=sl("JsonParseError"),sO=sl("JsonParseAfterRedirectError"),lO=sl("Api404Error"),cO=sl("Api404AfterRedirectError"),dO=sl("FetchNetworkError");function uO(e,t){let r=e,i=e,o={"X-WP-Nonce":t},n={credentials:"same-origin",headers:o},a={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},s=c,l={setApiRoot(p){r=p},setWpcomOriginApiUrl(p){i=p},setApiNonce(p){o={"X-WP-Nonce":p},n={credentials:"same-origin",headers:o},a={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:p=>{s=p},registerSite:(p,v,_)=>{let x={};return(0,Bu.jetpackConfigHas)("consumer_slug")&&(x.plugin_slug=(0,Bu.jetpackConfigGet)("consumer_slug")),v!==null&&(x.redirect_uri=v),_&&(x.from=_),u(`${r}jetpack/v4/connection/register`,a,{body:JSON.stringify(x)}).then(K).then(J)},fetchAuthorizationUrl:p=>d((0,wS.addQueryArgs)(`${r}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:p}),n).then(K).then(J),fetchSiteConnectionData:()=>d(`${r}jetpack/v4/connection/data`,n).then(J),fetchSiteConnectionStatus:()=>d(`${r}jetpack/v4/connection`,n).then(J),fetchSiteConnectionTest:()=>d(`${r}jetpack/v4/connection/test`,n).then(K).then(J),fetchUserConnectionData:()=>d(`${r}jetpack/v4/connection/data`,n).then(J),fetchUserTrackingSettings:()=>d(`${r}jetpack/v4/tracking/settings`,n).then(K).then(J),updateUserTrackingSettings:p=>u(`${r}jetpack/v4/tracking/settings`,a,{body:JSON.stringify(p)}).then(K).then(J),disconnectSite:()=>u(`${r}jetpack/v4/connection`,a,{body:JSON.stringify({isActive:!1})}).then(K).then(J),fetchConnectUrl:()=>d(`${r}jetpack/v4/connection/url`,n).then(K).then(J),unlinkUser:(p=!1,v={})=>{let _={linked:!1,force:!!p};return v.disconnectAllUsers&&(_["disconnect-all-users"]=!0),u(`${r}jetpack/v4/connection/user`,a,{body:JSON.stringify(_)}).then(K).then(J)},reconnect:()=>u(`${r}jetpack/v4/connection/reconnect`,a).then(K).then(J),fetchConnectedPlugins:()=>d(`${r}jetpack/v4/connection/plugins`,n).then(K).then(J),setHasSeenWCConnectionModal:()=>u(`${r}jetpack/v4/seen-wc-connection-modal`,a).then(K).then(J),fetchModules:()=>d(`${r}jetpack/v4/module/all`,n).then(K).then(J),fetchModule:p=>d(`${r}jetpack/v4/module/${p}`,n).then(K).then(J),activateModule:p=>u(`${r}jetpack/v4/module/${p}/active`,a,{body:JSON.stringify({active:!0})}).then(K).then(J),deactivateModule:p=>u(`${r}jetpack/v4/module/${p}/active`,a,{body:JSON.stringify({active:!1})}),updateModuleOptions:(p,v)=>u(`${r}jetpack/v4/module/${p}`,a,{body:JSON.stringify(v)}).then(K).then(J),updateSettings:p=>u(`${r}jetpack/v4/settings`,a,{body:JSON.stringify(p)}).then(K).then(J),getProtectCount:()=>d(`${r}jetpack/v4/module/protect/data`,n).then(K).then(J),resetOptions:p=>u(`${r}jetpack/v4/options/${p}`,a,{body:JSON.stringify({reset:!0})}).then(K).then(J),activateVaultPress:()=>u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(K).then(J),getVaultPressData:()=>d(`${r}jetpack/v4/module/vaultpress/data`,n).then(K).then(J),installPlugin:(p,v)=>{let _={slug:p,status:"active"};return v&&(_.source=v),u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify(_)}).then(K).then(J)},activateAkismet:()=>u(`${r}jetpack/v4/plugins`,a,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(K).then(J),getAkismetData:()=>d(`${r}jetpack/v4/module/akismet/data`,n).then(K).then(J),checkAkismetKey:()=>d(`${r}jetpack/v4/module/akismet/key/check`,n).then(K).then(J),checkAkismetKeyTyped:p=>u(`${r}jetpack/v4/module/akismet/key/check`,a,{body:JSON.stringify({api_key:p})}).then(K).then(J),getFeatureTypeStatus:p=>d(`${r}jetpack/v4/feature/${p}`,n).then(K).then(J),fetchStatsData:p=>d(m(p),n).then(K).then(J).then(h),getPluginUpdates:()=>d(`${r}jetpack/v4/updates/plugins`,n).then(K).then(J),getPlans:()=>d(`${r}jetpack/v4/plans`,n).then(K).then(J),fetchSettings:()=>d(`${r}jetpack/v4/settings`,n).then(K).then(J),updateSetting:p=>u(`${r}jetpack/v4/settings`,a,{body:JSON.stringify(p)}).then(K).then(J),fetchSiteData:()=>d(`${r}jetpack/v4/site`,n).then(K).then(J).then(p=>JSON.parse(p.data)),fetchSiteFeatures:()=>d(`Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cA(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,o,n,a,s=[],l=!0,c=!1;try{if(n=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=n.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(d){c=!0,o=d}finally{try{if(!l&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function dA(e){if(Array.isArray(e))return e}function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function uA(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=EE(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var c=r.next();return n=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!n&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function EE(e,t){if(e){if(typeof e=="string")return vE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vE(e,t)}}function vE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function bE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function ts(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bE(Object(r),!0).forEach(function(i){fA(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bE(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function fA(e,t,r){return t=RE(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pA(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _E(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,RE(i.key),i)}}function mA(e,t,r){return t&&_E(e.prototype,t),r&&_E(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function RE(e){var t=hA(e,"string");return Un(t)=="symbol"?t:t+""}function hA(e,t){if(Un(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(Un(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tv="tus-v1",Rf="ietf-draft-03",gA={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:OE,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:Tv},PE=(function(){function e(t,r){pA(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return mA(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(i){return r._urlStorage.findUploadsByFingerprint(i)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,i=this.file;if(!i){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Tv,Rf].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var n=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];n<a.length;n++){var s=a[n];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(i,this.options).then(function(l){r
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
tus-js-client/lib.esm/upload.js:
|
||||
tus-js-client/lib.esm/browser/fileReader.js:
|
||||
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'bdca920315a6e5637299');
|
||||
+1
@@ -0,0 +1 @@
|
||||
var o={};export{o as route};
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '718cbf8b33cd48bfe1fe');
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
var ZF=Object.create;var Dv=Object.defineProperty;var JF=Object.getOwnPropertyDescriptor;var ej=Object.getOwnPropertyNames;var tj=Object.getPrototypeOf,rj=Object.prototype.hasOwnProperty;var nj=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Be=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},As=(e,t)=>{for(var r in t)Dv(e,r,{get:t[r],enumerable:!0})},Iv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ej(t))!rj.call(e,o)&&o!==r&&Dv(e,o,{get:()=>t[o],enumerable:!(n=JF(t,o))||n.enumerable});return e},Qm=(e,t,r)=>(Iv(e,t,"default"),r&&Iv(r,t,"default")),_=(e,t,r)=>(r=e!=null?ZF(tj(e)):{},Iv(t||!e||!e.__esModule?Dv(r,"default",{value:e,enumerable:!0}):r,e));var U=Be((jse,lR)=>{lR.exports=window.ReactJSXRuntime});var fR=Be((zse,dR)=>{var Zm={};try{Zm=nj("jetpackConfig")}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),Zm={missingConfig:!0}}var uR=e=>Object.hasOwn(Zm,e),oj=e=>{if(!uR(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return Zm[e]};dR.exports={jetpackConfigHas:uR,jetpackConfigGet:oj}});var Jm=Be((Use,pR)=>{pR.exports=window.wp.url});var Ct=Be((Hse,gR)=>{gR.exports=window.wp.i18n});var Me=Be(($se,bR)=>{bR.exports=window.wp.element});var $=Be((Wse,vR)=>{vR.exports=window.React});var $o=Be((zle,gE)=>{gE.exports=window.ReactDOM});var uk=Be(lk=>{"use strict";var vl=$();function vU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _U=typeof Object.is=="function"?Object.is:vU,xU=vl.useState,wU=vl.useEffect,SU=vl.useLayoutEffect,TU=vl.useDebugValue;function CU(e,t){var r=t(),n=xU({inst:{value:r,getSnapshot:t}}),o=n[0].inst,i=n[1];return SU(function(){o.value=r,o.getSnapshot=t,C_(o)&&i({inst:o})},[e,r,t]),wU(function(){return C_(o)&&i({inst:o}),e(function(){C_(o)&&i({inst:o})})},[e]),TU(r),r}function C_(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!_U(e,r)}catch{return!0}}function RU(e,t){return t()}var EU=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?RU:CU;lk.useSyncExternalStore=vl.useSyncExternalStore!==void 0?vl.useSyncExternalStore:EU});var Oh=Be((lde,dk)=>{"use strict";dk.exports=uk()});var pk=Be(fk=>{"use strict";var Nh=$(),kU=Oh();function PU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var AU=typeof Object.is=="function"?Object.is:PU,OU=kU.useSyncExternalStore,NU=Nh.useRef,MU=Nh.useEffect,IU=Nh.useMemo,DU=Nh.useDebugValue;fk.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var i=NU(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=IU(function(){function c(m){if(!l){if(l=!0,u=m,m=n(m),o!==void 0&&a.hasValue){var p=a.value;if(o(p,m))return d=p}return d=m}if(p=d,AU(u,m))return p;var h=n(m);return o!==void 0&&o(p,h)?(u=m,p):(u=m,d=h)}var l=!1,u,d,f=r===void 0?null:r;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,r,n,o]);var s=OU(e,i[0],i[1]);return MU(function(){a.hasValue=!0,a.value=s},[s]),DU(s),s}});var hk=Be((dde,mk)=>{"use strict";mk.exports=pk()});var En=Be((bbe,eP)=>{eP.exports=window.wp.primitives});var Nx=Be((g0e,xP)=>{xP.exports=window.wp.compose});var SP=Be((y0e,wP)=>{wP.exports=window.wp.theme});var RP=Be((v0e,CP)=>{CP.exports=window.wp.privateApis});var Gs=Be((b_e,Y5)=>{Y5.exports=window.wp.components});var f4=Be((Q_e,d4)=>{d4.exports=window.wp.date});var m4=Be((J_e,p4)=>{var Ll=1e3,Fl=Ll*60,jl=Fl*60,Xs=jl*24,yV=Xs*7,bV=Xs*365.25;p4.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return vV(e);if(r==="number"&&isFinite(e))return t.long?xV(e):_V(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function vV(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*bV;case"weeks":case"week":case"w":return r*yV;case"days":case"day":case"d":return r*Xs;case"hours":case"hour":case"hrs":case"hr":case"h":return r*jl;case"minutes":case"minute":case"mins":case"min":case"m":return r*Fl;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ll;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function _V(e){var t=Math.abs(e);return t>=Xs?Math.round(e/Xs)+"d":t>=jl?Math.round(e/jl)+"h":t>=Fl?Math.round(e/Fl)+"m":t>=Ll?Math.round(e/Ll)+"s":e+"ms"}function xV(e){var t=Math.abs(e);return t>=Xs?Cg(e,t,Xs,"day"):t>=jl?Cg(e,t,jl,"hour"):t>=Fl?Cg(e,t,Fl,"minute"):t>=Ll?Cg(e,t,Ll,"Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var P=!0,z=!1,N;return{s:function(){E=w[Symbol.iterator]()},n:function(){var I=E.next();return P=I.done,I},e:function(I){z=!0,N=I},f:function(){try{!P&&E.return!=null&&E.return()}finally{if(z)throw N}}}}function c(w,S){var E=[],R=[];function O(P,z){if(P.length===1)E.push(P[0]),R.push(P[0]);else{for(var N=Array(P.length-1),I=0;I<N.length;I++)I===0&&E.push(P[0]),I===N.length-1&&R.push(P[I+1]),N[I]=[(1-z)*P[I][0]+z*P[I+1][0],(1-z)*P[I][1]+z*P[I+1][1]];O(N,z)}}return w.length&&O(w,S),{left:E,right:R.reverse()}}function l(w){var S={};return w.length===4&&(S.x2=w[2][0],S.y2=w[2][1]),w.length>=3&&(S.x1=w[1][0],S.y1=w[1][1]),S.x=w[w.length-1][0],S.y=w[w.length-1][1],w.length===4?S.type="C":w.length===3?S.type="Q":S.type="L",S}function u(w,S){S=S||2;for(var E=[],R=w,O=1/S,P=0;P<S-1;P++){var z=O/(1-O*P),N=c(R,z);E.push(N.left),R=N.right}return E.push(R),E}function d(w,S,E){var R=[[w.x,w.y]];return S.x1!=null&&R.push([S.x1,S.y1]),S.x2!=null&&R.push([S.x2,S.y2]),R.push([S.x,S.y]),u(R,E).map(l)}var f=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,m={M:["x","y"],L:["x","y"],H:["x"],V:["y"],C:["x1","y1","x2","y2","x","y"],S:["x2","y2","x","y"],Q:["x1","y1","x","y"],T:["x","y"],A:["rx","ry","xAxisRotation","largeArcFlag","sweepFlag","x","y"],Z:[]};Object.keys(m).forEach(function(w){m[w.toLowerCase()]=m[w]});function p(w,S){for(var E=Array(w),R=0;R<w;R++)E[R]=S;return E}function h(w){return"".concat(w.type).concat(m[w.type].map(function(S){return w[S]}).join(","))}function b(w,S){var E={x1:"x",y1:"y",x2:"x",y2:"y"},R=["xAxisRotation","largeArcFlag","sweepFlag"];if(w.type!==S.type&&S.type.toUpperCase()!=="M"){var O={};Object.keys(S).forEach(function(P){var z=S[P],N=w[P];N===void 0&&(R.includes(P)?N=z:(N===void 0&&E[P]&&(N=w[E[P]]),N===void 0&&(N=0))),O[P]=N}),O.type=S.type,w=O}return w}function g(w,S,E){var R=[];if(S.type==="L"||S.type==="Q"||S.type==="C")R=R.concat(d(w,S,E));else{var O=r({},w);O.type==="M"&&(O.type="L"),R=R.concat(p(E-1).map(function(){return O})),R.push(S)}return R}function y(w,S,E){var R=w.length-1,O=S.length-1,P=R/O,z=p(O).reduce(function(I,j,k){var C=Math.floor(P*k);if(E&&C<w.length-1&&E(w[C],w[C+1])){var A=P*k%1<.5;I[C]&&(A?C>0?C-=1:C<w.length-1&&(C+=1):C<w.length-1?C+=1:C>0&&(C-=1))}return I[C]=(I[C]||0)+1,I},[]),N=z.reduce(function(I,j,k){if(k===w.length-1){var C=p(j,r({},w[w.length-1]));return C[0].type==="M"&&C.forEach(function(A){A.type="L"}),I.concat(C)}return I.concat(g(w[k],w[k+1],j))},[]);return N.unshift(w[0]),N}function v(w){for(var S=(w||"").match(f)||[],E=[],R,O,P=0;P<S.length;++P)if(R=m[S[P]],R){O={type:S[P]};for(var z=0;z<R.length;++z)O[R[z]]=+S[P+z+1];P+=R.length,E.push(O)}return E}function x(w,S,E){var R=w==null?[]:w.slice(),O=S==null?[]:S.slice();if(!R.length&&!O.length)return function(){return[]};var P=(R.length===0||R[R.length-1].type==="Z")&&(O.length===0||O[O.length-1].type==="Z");R.length>0&&R[R.length-1].type==="Z"&&R.pop(),O.length>0&&O[O.length-1].type==="Z"&&O.pop(),R.length?O.length||O.push(R[0]):R.push(O[0]);var z=Math.abs(O.length-R.length);z!==0&&(O.length>R.length?R=y(R,O,E):O.length<R.length&&(O=y(O,R,E))),R=R.map(function(I,j){return b(I,O[j])});var N=R.map(function(I){return o({},I)});return P&&N.push({type:"Z"}),function(j){if(j===1)return S??[];if(j>0)for(var k=0;k<N.length;++k){var C=R[k],A=O[k],D=N[k],B=s(m[D.type]),H;try{for(B.s();!(H=B.n()).done;){var W=H.value;D[W]=(1-j)*C[W]+j*A[W],(W==="largeArcFlag"||W==="sweepFlag")&&(D[W]=Math.round(D[W]))}}catch(Y){B.e(Y)}finally{B.f()}}return N}}function T(w,S,E){var R=v(w),O=v(S);if(!R.length&&!O.length)return function(){return""};var P=x(R,O,E);return function(N){if(N===1)return S??"";var I=P(N),j="",k=s(I),C;try{for(k.s();!(C=k.n()).done;){var A=C.value;j+=h(A)}}catch(D){k.e(D)}finally{k.f()}return j}}e.interpolatePath=T,e.interpolatePathCommands=x,e.pathCommandsFromString=v,Object.defineProperty(e,"__esModule",{value:!0})}))});var m7=Be((yYe,p7)=>{"use strict";var CJ=function(t){return RJ(t)&&!EJ(t)};function RJ(e){return!!e&&typeof e=="object"}function EJ(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||AJ(e)}var kJ=typeof Symbol=="function"&&Symbol.for,PJ=kJ?Symbol.for("react.element"):60103;function AJ(e){return e.$$typeof===PJ}function OJ(e){return Array.isArray(e)?[]:{}}function fm(e,t){return t.clone!==!1&&t.isMergeableObject(e)?od(OJ(e),e,t):e}function NJ(e,t,r){return e.concat(t).map(function(n){return fm(n,r)})}function MJ(e,t){if(!t.customMerge)return od;var r=t.customMerge(e);return typeof r=="function"?r:od}function IJ(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function d7(e){return Object.keys(e).concat(IJ(e))}function f7(e,t){try{return t in e}catch{return!1}}function DJ(e,t){return f7(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function LJ(e,t,r){var n=
Line truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var pf={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},R5=1,P5=(0,Ws.forwardRef)(function({children:t,variant:r="default",className:n,activateOnFocus:o,...i},a){let[s,c]=(0,Ws.useState)(null),[l,u]=(0,Ws.useState)({first:!1,last:!1,isScrolling:!1});(0,Ws.useEffect)(()=>{if(!s)return;let f=()=>{let{scrollWidth:b,clientWidth:g,scrollLeft:y}=s,v=Math.max(b-g,0),T=(s.dir||(typeof window<"u"?window.getComputedStyle(s).direction:"ltr"))==="rtl"&&y<0?-y:y;u({first:T>R5,last:T<v-R5,isScrolling:b>g})},m=new ResizeObserver(f);m.observe(s);let p=!1,h=()=>{p||(requestAnimationFrame(()=>{f(),p=!1}),p=!0)};return s.addEventListener("scroll",h,{passive:!0}),f(),()=>{s.removeEventListener("scroll",h),m.disconnect()}},[s]);let d=(0,E5.useMergeRefs)([a,f=>c(f)]);return(0,wg.jsxs)(wo.List,{ref:d,activateOnFocus:o,"data-select-on-move":o?"true":"false",className:ne(pf.tablist,l.first&&pf["is-overflowing-first"],l.last&&pf["is-overflowing-last"],pf[`is-${r}-variant`],n),...i,tabIndex:i.tabIndex??(l.isScrolling?-1:void 0),children:[t,(0,wg.jsx)(wo.Indicator,{className:pf.indicator})]})});var M5=_(Me(),1);var Or=_(Me(),1);var mf=_(U(),1),Sg=!1,pw=Sg?(0,Or.createContext)(null):null;function GH(){let e=(0,Or.useContext)(pw);(0,Or.useEffect)(()=>{if(e)return e.registerTab()},[e])}function YH(){}var A5=Sg?GH:YH;function qH(){let e=(0,Or.useContext)(pw);(0,Or.useEffect)(()=>{if(e)return e.registerPanel()},[e])}function XH(){}var O5=Sg?qH:XH;function KH({children:e}){let t=(0,Or.useRef)(0),r=(0,Or.useRef)(0),n=XP(()=>{let s=t.current,c=r.current;if(s!==c)throw new Error(`Tabs: Tab/Panel count mismatch (${s} Tabs, ${c} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`)}),o=(0,Or.useCallback)(()=>(t.current+=1,n(),()=>{t.current-=1,n()}),[n]),i=(0,Or.useCallback)(()=>(r.current+=1,n(),()=>{r.current-=1,n()}),[n]),a=(0,Or.useMemo)(()=>({registerTab:o,registerPanel:i}),[o,i]);return(0,mf.jsx)(pw.Provider,{value:a,children:e})}function QH({children:e}){return(0,mf.jsx)(mf.Fragment,{children:e})}var N5=Sg?KH:QH;var L5=_(U(),1),mw="data-wp-hash";function hw(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={documents:new Map,styles:new Map,injectedStyles:new WeakMap},typeof document<"u"&&JH(document)),e.__wpStyleRuntime}function ZH(e,t){if(!e.head)return!1;for(let r of e.head.querySelectorAll(`style[${mw}]`))if(r.getAttribute(mw)===t)return!0;return!1}function I5(e,t,r){if(!e.head)return;let n=hw(),o=n.injectedStyles.get(e);if(o||(o=new Set,n.injectedStyles.set(e,o)),o.has(t))return;if(ZH(e,t)){o.add(t);return}let i=e.createElement("style");i.setAttribute(mw,t),i.appendChild(e.createTextNode(r)),e.head.appendChild(i),o.add(t)}function JH(e){let t=hw();t.documents.set(e,(t.documents.get(e)??0)+1);for(let[r,n]of t.styles)I5(e,r,n);return()=>{let r=t.documents.get(e);if(r!==void 0){if(r<=1){t.documents.delete(e);return}t.documents.set(e,r-1)}}}function D5(e,t){let r=hw();r.styles.set(e,t);for(let n of r.documents.keys())I5(n,e,t)}typeof process>"u",D5("1fb29d3a3c","._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-i
Line truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var yw={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},H5=(0,U5.forwardRef)(function({className:t,children:r,...n},o){return A5(),(0,hf.jsxs)(wo.Tab,{ref:o,className:ne(yw.tab,t),...n,children:[(0,hf.jsx)("span",{className:yw["tab-children"],children:r}),(0,hf.jsx)(Gi,{icon:lf,className:yw["tab-chevron"]})]})});var V5=_(Me(),1),$5=_(U(),1),W5=(0,V5.forwardRef)(({children:e,className:t,ariaLabel:r,as:n="div",...o},i)=>(0,$5.jsx)(n,{ref:i,className:ne("admin-ui-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...o,children:e}));W5.displayName="NavigableRegion";var G5=W5;var q5=_(Gs(),1),{Fill:X5,Slot:K5}=(0,q5.createSlotFill)("SidebarToggle");var $n=_(U(),1),_w="data-wp-hash";function xw(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={documents:new Map,styles:new Map,injectedStyles:new WeakMap},typeof document<"u"&&aV(document)),e.__wpStyleRuntime}function iV(e,t){if(!e.head)return!1;for(let r of e.head.querySelectorAll(`style[${_w}]`))if(r.getAttribute(_w)===t)return!0;return!1}function Q5(e,t,r){if(!e.head)return;let n=xw(),o=n.injectedStyles.get(e);if(o||(o=new Set,n.injectedStyles.set(e,o)),o.has(t))return;if(iV(e,t)){o.add(t);return}let i=e.createElement("style");i.setAttribute(_w,t),i.appendChild(e.createTextNode(r)),e.head.appendChild(i),o.add(t)}function aV(e){let t=xw();t.documents.set(e,(t.documents.get(e)??0)+1);for(let[r,n]of t.styles)Q5(e,r,n);return()=>{let r=t.documents.get(e);if(r!==void 0){if(r<=1){t.documents.delete(e);return}t.documents.set(e,r-1)}}}function sV(e,t){let r=xw();r.styles.set(e,t);for(let n of r.documents.keys())Q5(n,e,t)}typeof process>"u",sV("aa9c241ccc","._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");var Ys={page:"_956b6df0898efed0__page",header:"_0625b55e82a0d93d__header","header-content":"a43c44d5ae28b2e8__header-content","header-actions":"b7cb5b9daf3a3b25__header-actions","header-title":"_8113be94e7caf73c__header-title","header-visual":"_9a776c7f70996f61__header-visual","sidebar-toggle-slot":"d5e0920cd15d35bc__sidebar-toggle-slot","header-subtitle":"_60fea2f6bf5319cd__header-subtitle",content:"be5e57d029ec4036__content","has-padding":"_128806d0b26e3a50__has-padding"};function Z5({headingLevel:e=1,breadcrumbs:t,badges:r,visual:n,title:o,subTitle:i,actions:a,showSidebarToggle:s=!0}){let c=`h${e}`;return(0,$n.jsxs)(Lt,{direction:"column",className:Ys.header,children:[(0,$n.jsxs)(Lt,{className:Ys["header-content"],direction:"row",gap:"sm",justify:"space-between",children:[(0,$n.jsxs)(Lt,{direction:"row",gap:"sm",align:"center",justify:"start",children:[s&&(0,$n.jsx)(K5,{bubblesVirtually:!0,className:Ys["sidebar-toggle-slot"]}),n&&(0,$n.jsx)("div",{className:Ys["header-visual"],"aria-hidden":"true",children:n}),o&&(0,$n.jsx)(Mt,{className:Ys["header-title"],render:(0,$n.jsx)(c,{}),variant:"heading-lg",children:o}),t,r]}),a&&(0,$n.jsx)(Lt,{align:"center",className:Ys["header-actions"],direction:"row",gap:"sm",children:a})]}),i&&(0,$n.jsx)(Mt,{render:(0,$n.jsx)("p",{}),variant:"body-md",className:Ys["header-subtitle"],children:i})]})}var gf=_(U(),1),Sw="data-wp-hash";function Tw(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={docu
Line truncated
|
||||
${d?`a${s},${s} 0 0 1 ${s},${s}`:`h${s}v${s}`}
|
||||
v${i-h}
|
||||
${o?`a${s},${s} 0 0 1 ${-s},${s}`:`v${s}h${-s}`}
|
||||
h${h-f}
|
||||
${n?`a${s},${s} 0 0 1 ${-s},${-s}`:`h${-s}v${-s}`}
|
||||
v${h-i}
|
||||
${u?`a${s},${s} 0 0 1 ${s},${-s}`:`v${-s}h${s}`}
|
||||
z`.split(`
|
||||
`).join("")}function $p(e){let{children:t,className:r,innerRef:n,x:o,y:i,width:a,height:s,radius:c,all:l=!1,top:u=!1,bottom:d=!1,left:f=!1,right:m=!1,topLeft:p=!1,topRight:h=!1,bottomLeft:b=!1,bottomRight:g=!1,...y}=e,v=TK({x:o,y:i,width:a,height:s,radius:c,all:l,top:u,bottom:d,left:f,right:m,topLeft:p,topRight:h,bottomLeft:b,bottomRight:g});return t?(0,Vp.jsx)(Vp.Fragment,{children:t({path:v})}):(0,Vp.jsx)("path",{ref:n,className:(0,uM.default)("visx-bar-rounded",r),d:v,...y})}var CK=_(Te(),1);var dM=_(U(),1);var RK=_(Te(),1);var fM=_(U(),1);var EK=_(Te(),1);function Jn(e){return e?.[0]}function gn(e){return e?.[1]}var pM=_(U(),1);var kK=_(Te(),1);var mM=_(U(),1);var PK=_(Te(),1);var hM=_(U(),1);var AK=_(Te(),1);var gM=_(U(),1);var OK=_(Te(),1);var yM=_(U(),1);var NK=_(Te(),1);var bM=_(U(),1);var MK=_(Te(),1);var vM=_(U(),1);var IK=_(Te(),1);var _M=_(U(),1);var DK=_(Te(),1);var xM=_(U(),1);var LK=_(Te(),1);var wM=_(U(),1);var FK=_(Te(),1);var SM=_(U(),1);var jK=_(Te(),1);var TM=_(U(),1);var zK=_(Te(),1);var CM=_(U(),1);var UK=_(Te(),1);var RM=_(U(),1);var HK=_(Te(),1);var EM=_(U(),1);var VK=_(Te(),1),$K=_(U(),1);var kM=_($(),1);var WK=_(U(),1);var YK={top:"top",left:"left",right:"right",bottom:"bottom"},Ht=YK;function j2(e){let{labelOffset:t,labelProps:r,orientation:n,range:o,tickLabelFontSize:i,tickLength:a}=e,s=n===Ht.left||n===Ht.top?-1:1,c,l,u;if(n===Ht.top||n===Ht.bottom){let d=n===Ht.bottom&&typeof r.fontSize=="number"?r.fontSize:0;c=(Number(o[0])+Number(o[o.length-1]))/2,l=s*(a+t+i+d)}else c=s*((Number(o[0])+Number(o[o.length-1]))/2),l=-(a+t),u=`rotate(${s*90})`;return{x:c,y:l,transform:u}}var PM=_(Te(),1);var Gp=_(U(),1);function z2(e){let{hideTicks:t,horizontal:r,orientation:n,tickClassName:o,tickComponent:i,tickLabelProps:a,tickStroke:s="#222",tickTransform:c,ticks:l,strokeWidth:u,tickLineProps:d}=e;return l.map(f=>{let{value:m,index:p,from:h,to:b,formattedValue:g}=f,y=a[p]??{},v=Math.max(10,typeof y.fontSize=="number"&&y.fontSize||0),x=b.y+(r&&n!==Ht.top?v:0);return(0,Gp.jsxs)(Ye,{className:(0,PM.default)("visx-axis-tick",o),transform:c,children:[!t&&(0,Gp.jsx)(Do,{from:h,to:b,stroke:s,strokeWidth:u,strokeLinecap:"square",...d}),i?i({...y,x:b.x,y:x,formattedValue:g}):(0,Gp.jsx)(Dr,{x:b.x,y:x,...y,children:g})]},`visx-tick-${m}-${p}`)})}var Fc=_(U(),1),AM={textAnchor:"middle",fontFamily:"Arial",fontSize:10,fill:"#222"};function B2(e){let{axisFromPoint:t,axisLineClassName:r,axisToPoint:n,hideAxisLine:o,hideTicks:i,horizontal:a,label:s="",labelClassName:c,labelOffset:l=14,labelProps:u,orientation:d=Ht.bottom,scale:f,stroke:m="#222",strokeDasharray:p,strokeWidth:h=1,tickClassName:b,tickComponent:g,tickLineProps:y,tickLabelProps:v,tickLength:x=8,tickStroke:T="#222",tickTransform:w,ticks:S,ticksComponent:E=z2}=e,R={...AM,...u},O={...AM,...typeof v=="object"?v:null},P=S.map(N=>{let{value:I,index:j}=N;return typeof v=="function"?v(I,j,S):O}),z=Math.max(10,...P.map(N=>typeof N.fontSize=="number"?N.fontSize:0));return(0,Fc.jsxs)(Fc.Fragment,{children:[E({hideTicks:i,horizontal:a,orientation:d,scale:f,tickClassName:b,tickComponent:g,tickLabelProps:P,tickStroke:T,tickTransform:w,ticks:S,strokeWidth:h,tickLineProps:y}),!o&&(0,Fc.jsx)(Do,{className:(0,U2.default)("visx-axis-line",r),from:t,to:n,stroke:m,strokeWidth:h,strokeDasharray:p}),s&&(0,Fc.jsx)(Dr,{className:(0,U2.default)("visx-axis-label",c),...j2({labelOffset:l,labelProps:R,orientation:d,range:f.range(),tickLabelFontSize:z,tickLength:x}),...R,children:s})]})}function H2(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"center",r=e;if(t!=="start"&&"bandwidth"in r){let n=r.bandwidth();return t==="center"&&(n/=2),r.round()&&(n=Math.round(n)),o=>{let i=r(o);return typeof i=="number"?i+n:i}}return e}function V2(e){let t=e;return"tickFormat"in t?t.tickFormat():Wy}function ju(e,t){let{x:r,y:n}=e;return new ir(t?{x:r,y:n}:{x:n,y:r})}function $2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return typeof e=="number"?{start:e,end:e}:{start:0,end:0,...e}}var NM=_(U(),1);function la(e){let{children:t=B2,axisClassName:r,hideAxisLine:n=!1,hideTicks:o=!1,hideZero:i=!1,innerRef:a,left:s=0,numTicks:c=10,orientation:l=Ht.bottom,rangePadding:u=0,scale:d,tickFormat:f,tickLength:m=8,tickValues:p,top:h=0,...b}=e,g=f??V2(d),y=l===Ht.left,v=l===Ht.top,x=v||l===Ht.bottom,T=H2(d),w=y||v?-1:1,S=d.range(),E=$2(u),R=ju({x:Number(S[0])+.5-E.start,y:0},x),O=ju({x:Number(S[S.length-1])+.5+E.end,y:0},x),P=(p??qn(d,c)).filter(N=>!i||N!==0&&N!=="0").map((N,I)=>({value:N,index:I})),z=P.map(N=>{let{value:I,index:j}=N,k=Zt(T(I));return{value:I,index:j,from:ju({x:k,y:0},x),to:ju({x:k,y:m*w},x),formattedValue:g(I,j,P)}});return(0,NM.jsx)(Ye,{className:(0,OM.default)("visx-axis",r),innerRef:a,top:h,left:s,children:t({...b,axisFromPoint:R,axisToPoint:O,hideAxisLine:n,hideTicks:o,hideZero:i,horizontal:x,numTicks:c,orientation:l,rangePadding:u,scale:d,tickFormat:g,tickLength:m,tickPosition:T,tickSign:w,ticks:z})})}var qK=_(Te(),1);var XK=_(U(),1);var KK=_(Te(
Line truncated
|
||||
${v?.htmlLabel?.color?`${v?.htmlLabel?.color}55`:"#22222255"}`,...v?.htmlLabel},...g,children:k})]})]})}function Rb(e){return(0,oo.useContext)(Dn)?.tooltipOpen?(0,Jt.jsx)(NQ,{...e}):null}var im=_($(),1);var Lo=_($(),1);function _i(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:n=!1}=r,o,i=null,a;function s(){for(var c=arguments.length,l=new Array(c),u=0;u<c;u++)l[u]=arguments[u];n&&o===void 0?(e.apply(this,l),i=null):(i=l,a=this),clearTimeout(o),o=setTimeout(()=>{o=void 0,i!==null&&(e.apply(a,i),i=null,a=void 0)},t)}return s.cancel=function(){clearTimeout(o),o=void 0,i=null,a=void 0},s}var MQ=[],JM={width:0,height:0,top:0,left:0};function Wu(){let{initialSize:e=JM,debounceTime:t=300,ignoreDimensions:r=MQ,enableDebounceLeadingCall:n=!0,resizeObserverPolyfill:o,externalRef:i}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[a,s]=(0,Lo.useState)(null),c=(0,Lo.useCallback)(m=>{s(m),typeof i=="function"?i(m):i!=null&&(i.current=m)},[i]),l=(0,Lo.useRef)(0),[u,d]=(0,Lo.useState)({...JM,...e}),f=(0,Lo.useMemo)(()=>{let m=Array.isArray(r)?r:[r];return _i(p=>{d(h=>Object.keys(h).filter(v=>h[v]!==p[v]).every(v=>m.includes(v))?h:p)},t,{leading:n})},[t,n,r]);return(0,Lo.useEffect)(()=>{if(!a){f.cancel();return}let m=o||window.ResizeObserver,p=new m(h=>{h.forEach(b=>{let{left:g,top:y,width:v,height:x}=b?.contentRect??{};l.current=window.requestAnimationFrame(()=>{f({width:v,height:x,top:y,left:g})})})});return p.observe(a),()=>{window.cancelAnimationFrame(l.current),p.disconnect(),f.cancel()}},[a,f,o]),{parentRef:c,node:a,resize:f,...u}}var eT=_(U(),1),IQ={width:"100%",height:"100%",position:"relative"},DQ={position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"};function Eb(e){let{className:t,children:r,debounceTime:n,ignoreDimensions:o,initialSize:i,parentSizeStyles:a,enableDebounceLeadingCall:s=!0,resizeObserverPolyfill:c,style:l,...u}=e,{parentRef:d,node:f,resize:m,...p}=Wu({initialSize:i,debounceTime:n,ignoreDimensions:o,enableDebounceLeadingCall:s,resizeObserverPolyfill:c}),h=a?{position:"relative",...a,...l}:{...IQ,...l};return(0,eT.jsx)("div",{style:h,className:t,...u,children:(0,eT.jsx)("div",{style:DQ,ref:d,children:r({...p,ref:f,resize:m})})})}var LQ=_(U(),1);var FQ=_($(),1);var jQ=_(U(),1);var zQ=_($(),1);var UQ=_(U(),1);var tT=_($(),1);var ps=_($(),1);var e6=_($(),1),BQ=(0,e6.createContext)(null),Qp=BQ;function Ln(e,t,r){let n=(0,ps.useContext)(Qp),o=(0,ps.useRef)(void 0);o.current=r;let i=(0,ps.useCallback)((a,s,c)=>{n&&n.emit(a,{event:s,svgPoint:Qf(s),source:c})},[n]);return(0,ps.useEffect)(()=>{if(n&&e&&t){let a=s=>{(!o.current||s?.source&&o.current?.includes(s.source))&&t(s)};return n.on(e,a),()=>n?.off(e,a)}},[n,e,t]),n?i:null}var r6=_($(),1);function t6(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n&&n.push(r)||e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&n.splice(n.indexOf(r)>>>0,1)},emit:function(t,r){(e.get(t)||[]).slice().map(function(n){n(r)}),(e.get("*")||[]).slice().map(function(n){n(t,r)})}}}var n6=_(U(),1);function kb(e){let{children:t}=e,r=(0,r6.useMemo)(()=>t6(),[]);return(0,n6.jsx)(Qp.Provider,{value:r,children:t})}var fa=_($(),1);var o6=_(U(),1);function Pb(e){let{hideTooltipDebounceMs:t=400,children:r}=e,{tooltipOpen:n,tooltipLeft:o,tooltipTop:i,tooltipData:a,updateTooltip:s,hideTooltip:c}=da(void 0),l=(0,fa.useRef)(null);function u(){l.current&&(l.current.cancel(),l.current=null)}(0,fa.useEffect)(()=>u,[]);let d=(0,fa.useRef)(p=>{let{svgPoint:h,index:b,key:g,datum:y,distanceX:v,distanceY:x}=p;u();let T=ze(v)?v:1/0,w=ze(x)?x:1/0,S=Math.sqrt(T**2+w**2);s(E=>{let{tooltipData:R}=E,O=R?.nearestDatum&&ze(R.nearestDatum.distance)?R.nearestDatum.distance:1/0;return{tooltipOpen:!0,tooltipLeft:h?.x,tooltipTop:h?.y,tooltipData:{nearestDatum:(R?.nearestDatum?.key??"")!==g&&O<S?R?.nearestDatum:{key:g,index:b,datum:y,distance:S},datumByKey:{...R?.datumByKey,[g]:{datum:y,index:b,key:g}}}}})}),f=(0,fa.useCallback)(()=>{l.current=_i(c,t),l.current()},[c,t]),m=(0,fa.useMemo)(()=>({tooltipOpen:n,tooltipLeft:o,tooltipTop:i,tooltipData:a,updateTooltip:s,showTooltip:d.current,hideTooltip:f}),[f,a,o,n,i,s]);return(0,o6.jsx)(Dn.Provider,{value:m,children:r})}var em=_($(),1);var i6=_($(),1);var wr={red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e8f7ff","#ccedff","#a3daff","#72c3fc","#4dadf7","#329af0","#228ae6","#1c7cd6","#1b6ec2","#1862ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599
Line truncated
|
||||
M ${3/4*t},${5/4*t} l ${t/2},${-t/2}`;case ud.diagonalRightToLeft:return`M 0,0 l ${t},${t}
|
||||
M ${-t/4},${3/4*t} l ${t/2},${t/2}
|
||||
M ${3/4*t},${-t/4} l ${t/2},${t/2}`;case ud.vertical:default:return`M ${t/2}, 0 l 0, ${t}`}}function V0(e){let{id:t,width:r,height:n,stroke:o,strokeWidth:i,strokeDasharray:a,strokeLinecap:s="square",shapeRendering:c="auto",orientation:l=["vertical"],background:u,className:d}=e,f=Array.isArray(l)?l:[l];return(0,pm.jsxs)(bs,{id:t,width:r,height:n,children:[!!u&&(0,pm.jsx)("rect",{className:(0,kT.default)("visx-pattern-line-background"),width:r,height:n,fill:u}),f.map((m,p)=>(0,pm.jsx)("path",{className:(0,kT.default)("visx-pattern-line",d),d:eee({orientation:m,height:n}),stroke:o,strokeWidth:i,strokeDasharray:a,strokeLinecap:s,shapeRendering:c},`visx-${t}-line-${m}-${p}`))]})}var PT=_(Te(),1);var dd=_(U(),1);function $0(e){let{id:t,width:r,height:n,radius:o=2,fill:i,stroke:a,strokeWidth:s,strokeDasharray:c,background:l,complement:u=!1,className:d}=e,f;return u&&(f=[[0,0],[0,n],[r,0],[r,n]]),(0,dd.jsxs)(bs,{id:t,width:r,height:n,children:[!!l&&(0,dd.jsx)("rect",{width:r,height:n,fill:l}),(0,dd.jsx)("circle",{className:(0,PT.default)("visx-pattern-circle",d),cx:r/2,cy:n/2,r:o,fill:i,stroke:a,strokeWidth:s,strokeDasharray:c}),f?.map(m=>{let[p,h]=m;return(0,dd.jsx)("circle",{className:(0,PT.default)("visx-pattern-circle visx-pattern-circle-complement",d),cx:p,cy:h,r:o,fill:i,stroke:a,strokeWidth:s,strokeDasharray:c},`${t}-complement-${p}-${h}`)})]})}var T7=_(Te(),1);var S7=_(Te(),1);var mm=_(U(),1);function fd(e){let{id:t,width:r,height:n,path:o,fill:i="transparent",stroke:a,strokeWidth:s,strokeDasharray:c,strokeLinecap:l="square",shapeRendering:u="auto",background:d,className:f}=e;return(0,mm.jsxs)(bs,{id:t,width:r,height:n,children:[!!d&&(0,mm.jsx)("rect",{width:r,height:n,fill:d}),(0,mm.jsx)("path",{className:(0,S7.default)("visx-pattern-path",f),d:o,fill:i,stroke:a,strokeWidth:s,strokeDasharray:c,strokeLinecap:l,shapeRendering:u})]})}var C7=_(U(),1);function W0(e){let{id:t,width:r,height:n,fill:o,stroke:i,strokeWidth:a,strokeDasharray:s,strokeLinecap:c,shapeRendering:l,background:u,className:d}=e;return(0,C7.jsx)(fd,{className:(0,T7.default)("visx-pattern-wave",d),path:`M 0 ${n/2} c ${n/8} ${-n/4} , ${n*3/8} ${-n/4} , ${n/2} 0
|
||||
c ${n/8} ${n/4} , ${n*3/8} ${n/4} , ${n/2} 0 M ${-n/2} ${n/2}
|
||||
c ${n/8} ${n/4} , ${n*3/8} ${n/4} , ${n/2} 0 M ${n} ${n/2}
|
||||
c ${n/8} ${-n/4} , ${n*3/8} ${-n/4} , ${n/2} 0`,id:t,width:r,height:n,fill:o,stroke:i,strokeWidth:a,strokeDasharray:s,strokeLinecap:c,shapeRendering:l,background:u})}var R7=_(Te(),1);var E7=_(U(),1);function G0(e){let{id:t,height:r,fill:n,stroke:o,strokeWidth:i,strokeDasharray:a,strokeLinecap:s,shapeRendering:c,background:l,className:u,size:d=3}=e,f=Math.sqrt(d);return(0,E7.jsx)(fd,{className:(0,R7.default)("visx-pattern-hexagon",u),path:`M ${r},0 l ${r},0 l ${r/2},${r*f/2} l ${-r/2},${r*f/2} l ${-r},0 l ${-r/2},${-r*f/2} Z M 0,${r*f/2} l ${r/2},0 M ${3*r},${r*f/2} l ${-r/2},0`,id:t,width:d,height:f,fill:n,stroke:o,strokeWidth:i,strokeDasharray:a,strokeLinecap:s,shapeRendering:c,background:l})}var xt=_($(),1),gr=_($(),1);function tee(e){let[t,r]=(0,gr.useState)(!0),[n,o]=(0,gr.useState)(null),[i,a]=(0,gr.useState)(!1),s=()=>{r(!1),a(!0)};return(0,gr.useEffect)(()=>{if(!document){let d=new Error(`[ScriptLoadingError] document not defined when attempting to load ${e}`);o(d);return}let c=document.querySelector(`script[src="${e}"]`);if(c?.dataset.loaded){s();return}let l=c||document.createElement("script");c||(l.src=e);let u=()=>{l.dataset.loaded="1",s()};l.addEventListener("load",u),l.addEventListener("error",d=>{console.error("Failed to load script:",e,d);let f=new Error(`[ScriptLoadingError] Failed to load script: ${e}`);o(f)}),c||document.head.append(l)},[]),{isLoading:t,error:n,isSuccess:i}}var ree=e=>e&&e.charts,k7=(e,t)=>{let{controls:r,toolbarItems:n,getChartEditor:o}=e;return t&&t.charts&&t.visualization&&t.visualization.ChartWrapper&&t.visualization.Dashboard&&(!r||t.visualization.ChartWrapper)&&(!o||t.visualization.ChartEditor)&&(!n||t.visualization.drawToolbar)},nee=e=>window.google;function oee(e){let{chartVersion:t="current",chartPackages:r=["corechart","controls"],chartLanguage:n="en",mapsApiKey:o}=e,[i,a]=(0,gr.useState)(null),[s,c]=(0,gr.useState)(null),[l,u]=(0,gr.useState)(null),{isLoading:d,error:f,isSuccess:m}=tee(e.chartLoaderScriptUrl||"https://www.gstatic.com/charts/loader.js");return(0,gr.useEffect)(()=>{if(!m)return;let p=nee();if(!ree(p)){let h=new Error("[ScriptInitializationError] Script loaded but Google not attached to window.");c(h);return}if(k7(e,p)){a(p);return}p.charts.load(t,{packages:r,language:n,mapsApiKey:o}),p.charts.setOnLoadCallback(()=>{if(!k7(e,p)){let h=new Error("[GoogleChartsInitializationError] Google Charts not ready after load callback.");console.error(h),u(h);return}a(p)})},[m]),{error:f||s||l,isLoading:d,google:i}}var O7={legend_toggle:!1,options:{},legendToggle:!1,getChartWrapper:()=>{},spreadSheetQueryParameters:{headers:1,gid:1},rootProps:{},chartWrapperParams:{},chartLoaderScriptUrl:"https://www.gstatic.com/charts/loader.js"},iee=e=>{let{isReady:t,chartControls:r,filter:n}=e;return!t||!r||!r?.length?null:gr.default.createElement(gr.default.Fragment,null,r.filter(o=>{let{controlProp:i,control:a}=o;return n?n({control:a,controlProp:i}):!0}).map(o=>{let{control:i}=o;return gr.default.createElement("div",{key:i.getContainerId(),id:i.getContainerId()})}))},P7=0,N7=()=>(P7+=1,`reactgooglegraph-${P7}`),Y0=class{static initializeControls=t=>{for(let r=0;r<t.length;r+=1){let{controlType:n,options:o,controlWrapperParams:i}=t[r].controlProp;i&&"state"in i&&t[r].control.setState(i.state),t[r].control.setOptions(o),t[r].control.setControlType(n)}};static listenToControlEvents=(t,r)=>{let{google:n}=r;return t.flatMap(o=>{let{control:i,controlProp:a}=o,{controlEvents:s=[]}=a;return s.map(c=>{let{callback:l,eventName:u}=c;return n.visualization.events.addListener(i,u,function(){for(var d=arguments.length,f=new Array(d),m=0;m<d;m++)f[m]=arguments[m];l({chartWrapper:null,controlWrapper:i,props:r,google:n,eventArgs:f})})})})};static createControlId=t=>{let r;return typeof t>"u"?r=`googlechart-control-${N7()}`:r=t,r};static createChartControls=t=>{let{controls:r,google:n}=t;return r?r.map((o,i)=>{let{controlID:a,controlType:s,options:c,controlWrapperParams:l}=o,u=this.createControlId(a);return{controlProp:o,control:new n.visualization.ControlWrapper({containerId:u,controlType:s,options:c,...l})}}):null};static addControls=t=>{let{chartWrapper:r,chartDashboard:n}=t,o=this.createChartControls(t);return!o||!n||!r?null:(n.bind(o.map(i=>{let{control:a}=i;return a}),r),this.initializeControls(o),o)}},aee=e=>{let[t,r]=xt.useState(null);return[xt.useMemo(()=>!t||!e?null:e.map((o,i)=>{let a=t[i];return a?{controlProp:o,control:a}:void 0}).flatMap(o=>o?[o]:[]),[t,e]),r]},see=(e,t)=>{xt.useEffect(()=>{let r=Y0.listenToControlEvents(e??[],t);return()=>{r.forEach(n=>{t.google.visualization.events.removeListener(n)})}},[e,t])},cee=e=>{let[t,r]=aee(e.controls);return see(t??[],e),{addControls:o=>{let i=Y0.addControls(o);r(i?.map(a=>a.control)??null)},renderControl:o=>{let{chartWrapper:i,chartDashboard:a}=e;return xt.createElement(iee,{...e,isReady:!!(i&&a),chartControls:t,filter:o})}}},lee=e=>{let t=xt.useRef(null);return{chartId:(()=>{let{graphID:o,graph_id:i}=e,a=o||i,s;retu
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function See(e,t){return _ee(e)||xee(e,t)||Tee(e,t)||wee()}function Tee(e,t){if(e){if(typeof e=="string")return I7(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I7(e,t):void 0}}var q7=Object.entries,D7=Object.setPrototypeOf,Cee=Object.isFrozen,Ree=Object.getPrototypeOf,Eee=Object.getOwnPropertyDescriptor,Tr=Object.freeze,Cr=Object.seal,md=Object.create,X7=typeof Reflect<"u"&&Reflect,DT=X7.apply,LT=X7.construct;Tr||(Tr=function(t){return t});Cr||(Cr=function(t){return t});DT||(DT=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return t.apply(r,o)});LT||(LT=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new t(...n)});var gm=er(Array.prototype.forEach),kee=er(Array.prototype.lastIndexOf),L7=er(Array.prototype.pop),pd=er(Array.prototype.push),Pee=er(Array.prototype.splice),_s=Array.isArray,vm=er(String.prototype.toLowerCase),AT=er(String.prototype.toString),F7=er(String.prototype.match),ym=er(String.prototype.replace),j7=er(String.prototype.indexOf),Aee=er(String.prototype.trim),Oee=er(Number.prototype.toString),Nee=er(Boolean.prototype.toString),z7=typeof BigInt>"u"?null:er(BigInt.prototype.toString),U7=typeof Symbol>"u"?null:er(Symbol.prototype.toString),yr=er(Object.prototype.hasOwnProperty),bm=er(Object.prototype.toString),Sr=er(RegExp.prototype.test),$c=Mee(TypeError);function er(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return DT(e,t,n)}}function Mee(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return LT(e,r)}}function Je(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vm;if(D7&&D7(e,null),!_s(t))return e;let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){let i=r(o);i!==o&&(Cee(t)||(t[n]=i),o=i)}e[o]=!0}return e}function Iee(e){for(let t=0;t<e.length;t++)yr(e,t)||(e[t]=null);return e}function rn(e){let t=md(null);for(let n of q7(e)){var r=See(n,2);let o=r[0],i=r[1];yr(e,o)&&(_s(i)?t[o]=Iee(i):i&&typeof i=="object"&&i.constructor===Object?t[o]=rn(i):t[o]=i)}return t}function Dee(e){switch(typeof e){case"string":return e;case"number":return Oee(e);case"boolean":return Nee(e);case"bigint":return z7?z7(e):"0";case"symbol":return U7?U7(e):"Symbol()";case"undefined":return bm(e);case"function":case"object":{if(e===null)return bm(e);let t=e,r=Ei(t,"toString");if(typeof r=="function"){let n=r(t);return typeof n=="string"?n:bm(n)}return bm(e)}default:return bm(e)}}function Ei(e,t){for(;e!==null;){let n=Eee(e,t);if(n){if(n.get)return er(n.get);if(typeof n.value=="function")return er(n.value)}e=Ree(e)}function r(){return null}return r}function Lee(e){try{return Sr(e,""),!0}catch{return!1}}var B7=Tr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),OT=Tr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),NT=Tr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Fee=Tr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph"
Line truncated
|
||||
`+Wt),Fe&&(Wt=qm(Wt)),w&&_e?z(Wt):Wt},t.setConfig=function(){let le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Av(le),fe=!0,rt=Q,ft=ie},t.clearConfig=function(){tl=null,fe=!1,rt=null,ft=null,w=E,S=""},t.isValidAttribute=function(le,L,G){tl||Av({});let ce=Dt(le),Se=Dt(L);return aR(ce,Se,G)},t.addHook=function(le,L){typeof L=="function"&&yr(H,le)&&pd(H[le],L)},t.removeHook=function(le,L){if(yr(H,le)){if(L!==void 0){let G=kee(H[le],L);return G===-1?void 0:Pee(H[le],G,1)[0]}return L7(H[le])}},t.removeHooks=function(le){yr(H,le)&&(H[le]=[])},t.removeAllHooks=function(){H=Y7()},t}var FT=K7();var _m=function(){return _m=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},_m.apply(this,arguments)};function X0(){return X0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},X0.apply(null,arguments)}var Jee=Object.create,BI=Object.defineProperty,ete=Object.getOwnPropertyDescriptor,tte=Object.getOwnPropertyNames,rte=Object.getPrototypeOf,nte=Object.prototype.hasOwnProperty,Om=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ote=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=tte(t),i=0,a=o.length,s;i<a;i++)s=o[i],!nte.call(e,s)&&s!==r&&BI(e,s,{get:(c=>t[c]).bind(null,s),enumerable:!(n=ete(t,s))||n.enumerable});return e},HI=(e,t,r)=>(r=e!=null?Jee(rte(e)):{},ote(t||!e||!e.__esModule?BI(r,"default",{value:e,enumerable:!0}):r,e)),VI=(0,F.createContext)(null),ws=VI,ite=()=>{let e=(0,F.useContext)(VI);if(!e)throw new Error("useChartInstanceContext must be used within a Chart component");return e},ate=ite;function uo(e,t){return Object.assign(e,t)}var ste=e=>{let t=e.indexOf("T");return t===-1?!1:e.endsWith("Z")?!0:/[+-]\d{2}:?\d{2}$/.test(e.slice(t+1))},cte=e=>{let t=e.trim();if(ste(t)){let r=l7(t);return vT(r)?r:new Date(NaN)}for(let r of["yyyy-MM-dd","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","yyyy-MM-dd'T'HH:mm:ss","yyyy-MM-dd'T'HH:mm:ss.SSS","yyyy-MM-dd'T'HH:mm"]){let n=c7(t,r,new Date);if(vT(n))return n}return new Date(NaN)},$I=(e,t="number",{decimals:r,useMultipliers:n=!1,signDisplay:o}={})=>{if(e==null)return"";let i=Number(e);if(isNaN(i))return"";switch(t){case"currency":return`$${n?Ks(i,{decimals:r??2,numberFormatOptions:{maximumFractionDigits:r??2,signDisplay:o}}):Pn(i,{decimals:r??2,numberFormatOptions:{signDisplay:o}})}`;case"average":return Number.isFinite(i)?Pn(i,{decimals:r??0,numberFormatOptions:{style:"percent",signDisplay:o??"exceptZero"}}):"\u2014";default:return n?Ks(i,{decimals:r??0,numberFormatOptions:{maximumFractionDigits:r??0,signDisplay:o}}):Pn(i,{decimals:r??0,numberFormatOptions:{signDisplay:o}})}},J0=e=>Pn(e/100,{numberFormatOptions:{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}}),lte=(e,t,r)=>{let n=e.map(o=>t(o,0,[]));return Xi(n.reduce((o,i)=>o.length>=i.length?o:i,n[0]),r)};function WI(e,t,r){let n=r?.lineChart?.lineStyles?.[e.options?.type],o=r?.seriesLineStyles?.[t%r.seriesLineStyles.length];return e.options?.seriesLineStyle??n??o??{}}function GI(e,t,r){let n=e.options?.type;return(n&&r?.barChart?.barStyles?.[n])??{}}function ute(e,t,r,n){let o=e.options?.legendShapeStyle??{},i=n==="line"?WI(e,t,r):{},a=n!=="line"?GI(e,t,r).opacity:void 0,s=a!==void 0?{opacity:a}:{},c=r.legend?.shapeStyles?.[t],l={...o,...i};return{...Object.values(l).some(u=>u!=null&&u!=="")?l:c??{},...s}}var ZT=()=>typeof navigator<"u"&&navigator.userAgent?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1;function dte(e,t){return(0,cv.default)(e,t,{arrayMerge:(r,n)=>n})}var fte=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),YI=e=>{if(!fte(e))throw typeof e!="string"?new Error("Hex color must be a string"):e.startsWith("#")?e.length!==7?new Error("Hex color must be 7 characters long (e.g., #ff0000)"):new Error("Hex color contains invalid characters. Only 0-9, a-f, A-F are allowed"):new Error("Hex color must start with #")},pte=(e,t)=>{if(YI(e),typeof t!="number"||isNaN(t))throw new Error("Alpha must be a number");return Yn(e).copy({opacity:t}).formatRgb()},mte=(e,t)=>{let[r,n,o]=e,[i,a,s]=t,c=Math.abs(r-i);return c=Math.min(c,360-c),Math.sqrt(Math.pow(c*2,2)+Math.pow((o-s)*1,2)+Math.pow((n-a)*.5,2))};var Em=(e,t,r,n=0)=>{if(!e||typeof e!="string")return"";if(/^#[0-9a-fA-F]{6}$/.test(e))return e;let o=e.trim().toLowerCase();if(/^#[0-9a-f]{3}$/i.test(o)){let a=o[1],s=o[2],c=o[3];return`#${a}${a}${s}${s}${c}${c}`}if(o.startsWith("--")||o.startsWith("var(")){if(r){let a=r(e,t);if(a&&a!==e&&n<10)return Em(a,t,r,n+1)}return e}if(o.startsWith("hsl(")||o.startsWith("hsla(")||o.startsWith("rgb(")||o.startsWith("rgba(")){let a=Yn(o);return a?a.formatHex():e}let i=Yn(o);return i?i.formatHex():e},hte=(e,t)=>{YI(e);let r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16),i=Math.round(r+(255-r)*
Line truncated
|
||||
.visx-bar[fill="url(#${_e})"],
|
||||
.bar-chart__comparison-bars rect[fill="url(#${_e})"] {
|
||||
stroke: ${he};
|
||||
stroke-width: 1;
|
||||
}
|
||||
`},[x]),Fe=(0,F.useCallback)(()=>{if(C===void 0)return"";let se=te.length,he=Math.max(...te.map(mt=>mt.series.data.length)),_e=Math.floor(C/se),Pe=C%se;if(_e>=he||Pe>=se)return"";let $e=te[Pe]?.series;return!$e||_e>=$e.data.length?"":`
|
||||
.bar-chart[data-chart-id="bar-chart-${x}"] .visx-bar-group .visx-bar:nth-child(${Pe*he+_e+1}) {
|
||||
stroke: #005fcc;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
`},[C,te,x]),St=une(w);qc({chartId:x,legendItems:E,chartType:"bar",isDataValid:!St,metadata:(0,F.useMemo)(()=>({orientation:f,withPatterns:m}),[f,m])});let ue=Yc();if(St)return(0,M.jsx)("div",{className:ne("bar-chart",Pi["bar-chart"]),children:St});let fe=l??R.gridVisibility,rt=Fe(),ft=c.position??"bottom",Ne=s&&(0,M.jsx)(ar,{orientation:c.orientation??"horizontal",position:ft,alignment:c.alignment??"center",labelStyles:c.labelStyles,itemClassName:c.itemClassName,itemStyles:c.itemStyles,shapeStyles:c.shapeStyles,className:Pi["bar-chart__legend"],shape:c.shape??"rect",chartId:x,interactive:y});return(0,M.jsx)(ws.Provider,{value:{chartId:x,chartWidth:r,chartHeight:I||0},children:(0,M.jsx)(Wc,{legendPosition:ft,legendElement:Ne,legendChildren:z,gap:g,className:ne("bar-chart",Pi["bar-chart"],{[Pi[`bar-chart--animated${v?"-horizontal":""}`]]:h&&!ue},o),style:{width:r,height:n},"data-chart-id":`bar-chart-${x}`,trailingContent:N,onContentHeightChange:k,children:({contentHeight:se})=>{let he=se>0?se:n;return(0,M.jsx)("div",{role:"grid","aria-label":(0,At.__)("Bar chart","jetpack-charts"),tabIndex:0,onKeyDown:ee,onFocus:Y,onBlur:K,children:he>0&&(0,M.jsx)("div",{ref:P,children:(0,M.jsxs)(wi,{theme:T,width:r,height:he,margin:{...O,...i},xScale:de,yScale:ge,horizontal:v,pointerEventsDataKey:"nearest",children:[(0,M.jsx)(Bu,{columns:fe.includes("y"),rows:fe.includes("x"),numTicks:4}),m&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("defs",{children:w.map((_e,Pe)=>Ve(Pe,X({data:_e,index:Pe}).color))}),(0,M.jsx)("style",{children:w.map((_e,Pe)=>wt(Pe,X({data:_e,index:Pe}).color))})]}),rt&&(0,M.jsx)("style",{children:rt}),q?(0,M.jsx)(Dm,{x:r/2,y:he/2,width:r,height:he,children:(0,At.__)("All series are hidden. Click legend items to show data.","jetpack-charts")}):null,(0,M.jsx)(lne,{comparisonEntries:ie,primaryKeys:Q,groupPadding:J,horizontal:v,xAccessor:R.accessors.xAccessor,yAccessor:R.accessors.yAccessor,getElementStyles:X,resolveFill:Oe}),(0,M.jsx)(Bb,{padding:J,children:te.map(({series:_e,index:Pe})=>(0,M.jsx)(mT,{dataKey:_e?.label,data:_e.data,yAccessor:R.accessors.yAccessor,xAccessor:R.accessors.xAccessor,colorAccessor:we(Pe)},_e?.label))}),(0,M.jsx)(ua,{...R.axis.x}),(0,M.jsx)(ua,{...R.axis.y}),a&&(0,M.jsx)(aC,{detectBounds:!0,snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,renderTooltip:u||Tt,selectedIndex:C,tooltipRef:W,keyboardFocusedClassName:Pi["bar-chart__tooltip--keyboard-focused"],series:V,mode:"individual"})]})})})}})})},uC=e=>(0,F.useContext)(xn)?(0,M.jsx)(yI,{...e}):(0,M.jsx)(ga,{children:(0,M.jsx)(yI,{...e})});uC.displayName="BarChart";var dne=uo(uC,{Legend:ar}),TKe=uo(ya(uC),{Legend:ar}),bI=e=>{let t=e;return t&&"bandwidth"in t?t?.bandwidth()??0:0},fne=({textProps:e,x:t,y:r,label:n,formatter:o})=>(0,M.jsx)(Dr,{...e,textAnchor:"start",x:t,y:r,children:o(n)}),pne=({textProps:e,x:t,y:r,value:n,formatter:o})=>(0,M.jsx)(Dr,{...e,textAnchor:"end",x:t,y:r,fontWeight:500,children:o(n)}),mne=({ticks:e,tickLabelProps:t,yOffset:r,labelPosition:n,valuePosition:o,data:i,labelFormatter:a,valueFormatter:s,LabelComponent:c=fne,ValueComponent:l=pne})=>{if(e.length===0)return null;let u=e.map(({value:d,index:f})=>typeof t=="function"?t(d,f,e):{});return e.map(({from:d,formattedValue:f},m)=>{let p=u[m]??{};delete p.textAnchor,delete p.dx;let h=i.reduce((g,{data:y})=>g+(y[m]?.value??0),0),b=d.y+r;return(0,M.jsxs)(Ye,{children:[(0,M.jsx)(c,{textProps:p,x:n,y:b,label:f,formatter:a}),(0,M.jsx)(l,{textProps:p,x:o,y:b,value:h,formatter:s,data:i,index:m})]},m)})},hne=(e,t,r,n)=>{if(!n)return 0;let o=e.map(({label:i})=>i);return-(bI(oa({domain:o,range:[0,bI(ia({type:"band",range:[0,r],domain:o,...t}))],padding:t.paddingInner}))+6)},vI=({data:e,width:t,height:r,options:n={},margin:o={left:0,right:20,bottom:0,top:0},...i})=>{let a=(0,F.useMemo)(()=>{let s=e.length>1,c={paddingInner:s?.3:.1,padding:s?.3:.1},l={zero:!0},u={...c,...n.yScale??{}};return{yScale:u,xScale:{...l,...n.xScale??{}},labelPosition:n.labelPosition??(s?0:10),valueFormatter:n.valueFormatter??(d=>Ks(d)),labelFormatter:n.labelFormatter??(d=>String(d)),valuePosition:n.valuePosition??t,yOffset:n.yOffset??hne(e,u,r,s)}},[n,t,e,r]);return(0,M.jsx)(dne,{orientation:"horizontal",gridVisibility:"none",data:e,width:t,height:r,margin:o,options:{axis:{y:{children:s=>(0,M.jsx)(mne,{...s,data:e,yOffset:a.yOffset,labelPosition:a.labelPosition,valuePosition:a.valuePosition,labelFormatter:a.labelFormatter,valueFormatter:a.valueFormatter,LabelComponent:n.labelComponent,ValueComponent:n.valueComponent})},x:{children:()=>null}},xScale:a.xScale,yScale:a.yScale},...i})},ED=e=>(0,F.useContext)(xn)?(0,M.jsx)(vI,{...e}):(0,M.jsx)(ga,{children:(0,M.jsx)(vI,{...e})});ED.displayName="BarListChart";var CKe=ya(ED),Pt={"bar-container":"a8ccharts-mGEVca-bar-container","change-indicator":"a8ccharts-mGEVca-change-indicator","conversion-funnel-chart--loading":"a8ccharts-mGEVca-conversion-funnel-chart--loading","empty-state":"a8ccharts-mGEVca-empty-state","funnel-bar":"a8ccharts-mGEVca-funnel-bar","
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tae(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,a,s=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(u){l=!0,o=u}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}function Cae(e){if(Array.isArray(e))return e}function Qc(e){"@babel/helpers - typeof";return Qc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qc(e)}function Rae(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=JL(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return i=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function JL(e,t){if(e){if(typeof e=="string")return $L(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $L(e,t)}}function $L(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function WL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function kd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WL(Object(r),!0).forEach(function(n){Eae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Eae(e,t,r){return t=eF(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GL(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,eF(n.key),n)}}function Pae(e,t,r){return t&&GL(e.prototype,t),r&&GL(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function eF(e){var t=Aae(e,"string");return Qc(t)=="symbol"?t:t+""}function Aae(e,t){if(Qc(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Qc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jC="tus-v1",vv="ietf-draft-03",Oae={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:nF,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:jC},rF=(function(){function e(t,r){kae(this,e),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return Pae(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![jC,vv].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(func
Line truncated
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v16.13.1
|
||||
* react-is.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
classnames/index.js:
|
||||
(*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*)
|
||||
|
||||
filesize/dist/filesize.esm.js:
|
||||
(**
|
||||
* filesize
|
||||
*
|
||||
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
||||
* @license BSD-3-Clause
|
||||
* @version 10.1.6
|
||||
*)
|
||||
|
||||
dompurify/dist/purify.es.mjs:
|
||||
(*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
|
||||
|
||||
tus-js-client/lib.esm/upload.js:
|
||||
tus-js-client/lib.esm/browser/fileReader.js:
|
||||
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'bdca920315a6e5637299');
|
||||
+1
@@ -0,0 +1 @@
|
||||
var o={};export{o as route};
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Route registry - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
return array(
|
||||
array(
|
||||
'name' => 'library',
|
||||
'path' => '/library',
|
||||
'page' => 'jetpack-videopress-dashboard',
|
||||
'has_route' => true,
|
||||
'has_content' => true,
|
||||
),
|
||||
array(
|
||||
'name' => 'overview',
|
||||
'path' => '/',
|
||||
'page' => 'jetpack-videopress-dashboard',
|
||||
'has_route' => true,
|
||||
'has_content' => true,
|
||||
),
|
||||
array(
|
||||
'name' => 'settings',
|
||||
'path' => '/settings',
|
||||
'page' => 'jetpack-videopress-dashboard',
|
||||
'has_route' => true,
|
||||
'has_content' => true,
|
||||
),
|
||||
array(
|
||||
'name' => 'video',
|
||||
'path' => '/video/$id',
|
||||
'page' => 'jetpack-videopress-dashboard',
|
||||
'has_route' => true,
|
||||
'has_content' => true,
|
||||
)
|
||||
);
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '91115a6bfcd6cf13775a');
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
var vu=Object.create;var ga=Object.defineProperty;var wu=Object.getOwnPropertyDescriptor;var xu=Object.getOwnPropertyNames;var Su=Object.getPrototypeOf,Cu=Object.prototype.hasOwnProperty;var Ru=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var oe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},fr=(e,t)=>{for(var r in t)ga(e,r,{get:t[r],enumerable:!0})},ma=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of xu(t))!Cu.call(e,a)&&a!==r&&ga(e,a,{get:()=>t[a],enumerable:!(o=wu(t,a))||o.enumerable});return e},Gr=(e,t,r)=>(ma(e,t,"default"),r&&ma(r,t,"default")),m=(e,t,r)=>(r=e!=null?vu(Su(e)):{},ma(t||!e||!e.__esModule?ga(r,"default",{value:e,enumerable:!0}):r,e));var pr=oe((uh,Wi)=>{Wi.exports=window.wp.components});var ie=oe((fh,qi)=>{qi.exports=window.wp.i18n});var K=oe((mh,Qi)=>{Qi.exports=window.wp.element});var A=oe((gh,Gi)=>{Gi.exports=window.React});var I=oe((Ch,ts)=>{ts.exports=window.ReactJSXRuntime});var zs=oe((Gb,Fs)=>{Fs.exports=window.ReactDOM});var Ws=oe($s=>{"use strict";var Bt=A();function $f(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wf=typeof Object.is=="function"?Object.is:$f,qf=Bt.useState,Kf=Bt.useEffect,Qf=Bt.useLayoutEffect,Gf=Bt.useDebugValue;function Jf(e,t){var r=t(),o=qf({inst:{value:r,getSnapshot:t}}),a=o[0].inst,n=o[1];return Qf(function(){a.value=r,a.getSnapshot=t,$a(a)&&n({inst:a})},[e,r,t]),Kf(function(){return $a(a)&&n({inst:a}),e(function(){$a(a)&&n({inst:a})})},[e]),Gf(r),r}function $a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Wf(e,r)}catch{return!0}}function Yf(e,t){return t()}var Zf=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Yf:Jf;$s.useSyncExternalStore=Bt.useSyncExternalStore!==void 0?Bt.useSyncExternalStore:Zf});var Ks=oe((i_,qs)=>{"use strict";qs.exports=Ws()});var kt=oe((gy,xc)=>{xc.exports=window.wp.primitives});var Sn=oe((tv,$c)=>{$c.exports=window.wp.compose});var hd=oe(($v,gd)=>{var Lo={};try{Lo=Ru("jetpackConfig")}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),Lo={missingConfig:!0}}var md=e=>Object.hasOwn(Lo,e),nm=e=>{if(!md(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return Lo[e]};gd.exports={jetpackConfigHas:md,jetpackConfigGet:nm}});var _d=oe((Wv,bd)=>{bd.exports=window.wp.url});var Vd=oe((E1,Bd)=>{Bd.exports=window.wp.date});var $d=oe((N1,Hd)=>{var Qt=1e3,Gt=Qt*60,Jt=Gt*60,It=Jt*24,km=It*7,Em=It*365.25;Hd.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Tm(e);if(r==="number"&&isFinite(e))return t.long?Om(e):Nm(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Tm(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return r*Em;case"weeks":case"week":case"w":return r*km;case"days":case"day":case"d":return r*It;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Jt;case"minutes":case"minute":case"mins":case"min":case"m":return r*Gt;case"seconds":case"second":case"secs":case"sec":case"s":return r*Qt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Nm(e){var t=Math.abs(e);return t>=It?Math.round(e/It)+"d":t>=Jt?Math.round(e/Jt)+"h":t>=Gt?Math.round(e/Gt)+"m":t>=Qt?Math.round(e/Qt)+"s":e+"ms"}function Om(e){var t=Math.abs(e);return t>=It?Do(e,t,It,"day"):t>=Jt?Do(e,t,Jt,"hour"):t>=Gt?Do(e,t,Gt,"minute"):t>=Qt?Do(e,t,Qt,"second"):e+" ms"}function Do(e,t,r,o){var a=t>=r*1.5;return Math.round(e/r)+" "+o+(a?"s":"")}});var qd=oe((O1,Wd)=>{function Pm(e){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=a,r.enabled=c,r.humanize=$d(),r.destroy=p,Object.keys(e).forEach(s=>{r[s]=e[s]}),r.names=[],r.skips=[],r.formatters={};function t(s){let l=0;for(let f=0;f<s.length;f++)l=(l<<5)-l+s.charCodeAt(f),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=t;function r(s){let l,f=null,h,d;function g(..._){if(!g.enabled)return;let y=g,v=Number(new Date),S=v-(l||v);y.diff=S,y.prev=l,y.curr=v,l=v,_[0]=r.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let b=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(N,R)=>{if(N==="%%")return"%";b++;let T=r.formatters[R];if(typeof T=="function"){let O=_[b];N=T.call(y,O),_.splice(b,1),b--}return N}),r.formatArgs.call(y,_),(y.log||r.log).apply(y,_)}return g.namespace=s,g.useColors=r.useColors(),g.color=r.selectColor(s),g.extend=o,g.destroy=r.destroy,Object.definLine truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var Tr={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},Yc=1,ed=(0,Nt.forwardRef)(function({children:t,variant:r="default",className:o,activateOnFocus:a,...n},i){let[c,u]=(0,Nt.useState)(null),[p,s]=(0,Nt.useState)({first:!1,last:!1,isScrolling:!1});(0,Nt.useEffect)(()=>{if(!c)return;let f=()=>{let{scrollWidth:_,clientWidth:y,scrollLeft:v}=c,S=Math.max(_-y,0),x=(c.dir||(typeof window<"u"?window.getComputedStyle(c).direction:"ltr"))==="rtl"&&v<0?-v:v;s({first:x>Yc,last:x<S-Yc,isScrolling:_>y})},h=new ResizeObserver(f);h.observe(c);let d=!1,g=()=>{d||(requestAnimationFrame(()=>{f(),d=!1}),d=!0)};return c.addEventListener("scroll",g,{passive:!0}),f(),()=>{c.removeEventListener("scroll",g),h.disconnect()}},[c]);let l=(0,Zc.useMergeRefs)([i,f=>u(f)]);return(0,jo.jsxs)(Fe.List,{ref:l,activateOnFocus:a,"data-select-on-move":a?"true":"false",className:E(Tr.tablist,p.first&&Tr["is-overflowing-first"],p.last&&Tr["is-overflowing-last"],Tr[`is-${r}-variant`],o),...n,tabIndex:n.tabIndex??(p.isScrolling?-1:void 0),children:[t,(0,jo.jsx)(Fe.Indicator,{className:Tr.indicator})]})});var ad=m(K(),1);var se=m(K(),1);var Nr=m(I(),1),Mo=!1,On=Mo?(0,se.createContext)(null):null;function qp(){let e=(0,se.useContext)(On);(0,se.useEffect)(()=>{if(e)return e.registerTab()},[e])}function Kp(){}var td=Mo?qp:Kp;function Qp(){let e=(0,se.useContext)(On);(0,se.useEffect)(()=>{if(e)return e.registerPanel()},[e])}function Gp(){}var rd=Mo?Qp:Gp;function Jp({children:e}){let t=(0,se.useRef)(0),r=(0,se.useRef)(0),o=Kc(()=>{let c=t.current,u=r.current;if(c!==u)throw new Error(`Tabs: Tab/Panel count mismatch (${c} Tabs, ${u} Panels). Each Tab must be associated with exactly one Panel. Mismatched or missing associations can break screen reader navigation and violate WAI-ARIA Tabs pattern requirements.`)}),a=(0,se.useCallback)(()=>(t.current+=1,o(),()=>{t.current-=1,o()}),[o]),n=(0,se.useCallback)(()=>(r.current+=1,o(),()=>{r.current-=1,o()}),[o]),i=(0,se.useMemo)(()=>({registerTab:a,registerPanel:n}),[a,n]);return(0,Nr.jsx)(On.Provider,{value:i,children:e})}function Yp({children:e}){return(0,Nr.jsx)(Nr.Fragment,{children:e})}var od=Mo?Jp:Yp;var sd=m(I(),1),Pn="data-wp-hash";function In(){let e=globalThis;return e.__wpStyleRuntime||(e.__wpStyleRuntime={documents:new Map,styles:new Map,injectedStyles:new WeakMap},typeof document<"u"&&Xp(document)),e.__wpStyleRuntime}function Zp(e,t){if(!e.head)return!1;for(let r of e.head.querySelectorAll(`style[${Pn}]`))if(r.getAttribute(Pn)===t)return!0;return!1}function nd(e,t,r){if(!e.head)return;let o=In(),a=o.injectedStyles.get(e);if(a||(a=new Set,o.injectedStyles.set(e,a)),a.has(t))return;if(Zp(e,t)){a.add(t);return}let n=e.createElement("style");n.setAttribute(Pn,t),n.appendChild(e.createTextNode(r)),e.head.appendChild(n),a.add(t)}function Xp(e){let t=In();t.documents.set(e,(t.documents.get(e)??0)+1);for(let[r,o]of t.styles)nd(e,r,o);return()=>{let r=t.documents.get(e);if(r!==void 0){if(r<=1){t.documents.delete(e);return}t.documents.set(e,r-1)}}}function id(e,t){let r=In();r.styles.set(e,t);for(let o of r.documents.keys())nd(o,e,t)}typeof process>"u",id("1fb29d3a3c","._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-inpu
Line truncated
|
||||
&[data-orientation=vertical]{border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));box-sizing:border-box}}.a5fd8814f195aa5e__tab{align-items:center;background:#0000;border:none;border-radius:0;box-shadow:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);cursor:var(--wpds-cursor-control,pointer);display:flex;flex:1 0 auto;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:400;line-height:1.2;outline:none;padding:0;position:relative;white-space:nowrap;z-index:1;&[data-disabled]{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d);cursor:default;@media (forced-colors:active){color:GrayText}}&:not([data-disabled]):is(:hover,:focus-visible){color:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e)}&:after{border-radius:var(--wpds-border-radius-sm,2px);opacity:0;outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));pointer-events:none;position:absolute;z-index:-1;@media not (prefers-reduced-motion){transition:opacity .1s linear}}&:focus-visible:after{opacity:1}[data-orientation=horizontal] &{height:48px;padding-inline:var(--wpds-dimension-padding-lg,16px);scroll-margin:24px;&:after{content:"";inset:var(--wpds-dimension-padding-md,12px)}}._59228b5227f38a99__is-minimal-variant[data-orientation=horizontal] &{padding-inline:0;&:after{inset-inline:round(up,var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)),1px)}}[data-orientation=vertical] &{min-height:40px;padding:var(--wpds-dimension-padding-sm,8px) var(--wpds-dimension-padding-md,12px)}[data-orientation=vertical][data-select-on-move=false] &:after{content:"";inset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}._5dfc77e6edd345d4__tab-children{align-items:center;display:flex;flex-grow:1;[data-orientation=horizontal] &{justify-content:center}[data-orientation=vertical] &{justify-content:start}}._4a20e969d15e5ac1__tab-chevron{flex-shrink:0;margin-inline-end:calc(var(--wpds-dimension-gap-xs, 4px)*-1);opacity:0;[data-orientation=horizontal] &{display:none}[role=tab]:is([aria-selected=true],:focus-visible,:hover) &{opacity:1}@media not (prefers-reduced-motion){[data-select-on-move=true]
|
||||
[role=tab]:is([aria-selected=true])
|
||||
&{transition:opacity .15s linear .15s}}&:dir(rtl){rotate:180deg}}}`);var jn={tablist:"_7313adbc8a112e90__tablist","is-overflowing-first":"_9f2ac729c68a735a__is-overflowing-first","is-overflowing-last":"_81c799c1f3cdd261__is-overflowing-last","is-minimal-variant":"_59228b5227f38a99__is-minimal-variant",indicator:"_1c37dcfaa1ad8cda__indicator",tab:"a5fd8814f195aa5e__tab","tab-children":"_5dfc77e6edd345d4__tab-children","tab-chevron":"_4a20e969d15e5ac1__tab-chevron"},pd=(0,ud.forwardRef)(function({className:t,children:r,...o},a){return td(),(0,Or.jsxs)(Fe.Tab,{ref:a,className:E(jn.tab,t),...o,children:[(0,Or.jsx)("span",{className:jn["tab-children"],children:r}),(0,Or.jsx)(Er,{icon:hn,className:jn["tab-chevron"]})]})});var le=m(I(),1);var Fo=m(hd(),1),yd=m(_d(),1);function Pr(e){class t extends Error{constructor(...o){super(...o),this.name=e}}return t}var im=Pr("JsonParseError"),sm=Pr("JsonParseAfterRedirectError"),cm=Pr("Api404Error"),dm=Pr("Api404AfterRedirectError"),lm=Pr("FetchNetworkError");function um(e,t){let r=e,o=e,a={"X-WP-Nonce":t},n={credentials:"same-origin",headers:a},i={method:"post",credentials:"same-origin",headers:Object.assign({},a,{"Content-type":"application/json"})},c=p,u={setApiRoot(d){r=d},setWpcomOriginApiUrl(d){o=d},setApiNonce(d){a={"X-WP-Nonce":d},n={credentials:"same-origin",headers:a},i={method:"post",credentials:"same-origin",headers:Object.assign({},a,{"Content-type":"application/json"})}},setCacheBusterCallback:d=>{c=d},registerSite:(d,g,_)=>{let y={};return(0,Fo.jetpackConfigHas)("consumer_slug")&&(y.plugin_slug=(0,Fo.jetpackConfigGet)("consumer_slug")),g!==null&&(y.redirect_uri=g),_&&(y.from=_),l(`${r}jetpack/v4/connection/register`,i,{body:JSON.stringify(y)}).then(C).then(k)},fetchAuthorizationUrl:d=>s((0,yd.addQueryArgs)(`${r}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:d}),n).then(C).then(k),fetchSiteConnectionData:()=>s(`${r}jetpack/v4/connection/data`,n).then(k),fetchSiteConnectionStatus:()=>s(`${r}jetpack/v4/connection`,n).then(k),fetchSiteConnectionTest:()=>s(`${r}jetpack/v4/connection/test`,n).then(C).then(k),fetchUserConnectionData:()=>s(`${r}jetpack/v4/connection/data`,n).then(k),fetchUserTrackingSettings:()=>s(`${r}jetpack/v4/tracking/settings`,n).then(C).then(k),updateUserTrackingSettings:d=>l(`${r}jetpack/v4/tracking/settings`,i,{body:JSON.stringify(d)}).then(C).then(k),disconnectSite:()=>l(`${r}jetpack/v4/connection`,i,{body:JSON.stringify({isActive:!1})}).then(C).then(k),fetchConnectUrl:()=>s(`${r}jetpack/v4/connection/url`,n).then(C).then(k),unlinkUser:(d=!1,g={})=>{let _={linked:!1,force:!!d};return g.disconnectAllUsers&&(_["disconnect-all-users"]=!0),l(`${r}jetpack/v4/connection/user`,i,{body:JSON.stringify(_)}).then(C).then(k)},reconnect:()=>l(`${r}jetpack/v4/connection/reconnect`,i).then(C).then(k),fetchConnectedPlugins:()=>s(`${r}jetpack/v4/connection/plugins`,n).then(C).then(k),setHasSeenWCConnectionModal:()=>l(`${r}jetpack/v4/seen-wc-connection-modal`,i).then(C).then(k),fetchModules:()=>s(`${r}jetpack/v4/module/all`,n).then(C).then(k),fetchModule:d=>s(`${r}jetpack/v4/module/${d}`,n).then(C).then(k),activateModule:d=>l(`${r}jetpack/v4/module/${d}/active`,i,{body:JSON.stringify({active:!0})}).then(C).then(k),deactivateModule:d=>l(`${r}jetpack/v4/module/${d}/active`,i,{body:JSON.stringify({active:!1})}),updateModuleOptions:(d,g)=>l(`${r}jetpack/v4/module/${d}`,i,{body:JSON.stringify(g)}).then(C).then(k),updateSettings:d=>l(`${r}jetpack/v4/settings`,i,{body:JSON.stringify(d)}).then(C).then(k),getProtectCount:()=>s(`${r}jetpack/v4/module/protect/data`,n).then(C).then(k),resetOptions:d=>l(`${r}jetpack/v4/options/${d}`,i,{body:JSON.stringify({reset:!0})}).then(C).then(k),activateVaultPress:()=>l(`${r}jetpack/v4/plugins`,i,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(C).then(k),getVaultPressData:()=>s(`${r}jetpack/v4/module/vaultpress/data`,n).then(C).then(k),installPlugin:(d,g)=>{let _={slug:d,status:"active"};return g&&(_.source=g),l(`${r}jetpack/v4/plugins`,i,{body:JSON.stringify(_)}).then(C).then(k)},activateAkismet:()=>l(`${r}jetpack/v4/plugins`,i,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(C).then(k),getAkismetData:()=>s(`${r}jetpack/v4/module/akismet/data`,n).then(C).then(k),checkAkismetKey:()=>s(`${r}jetpack/v4/module/akismet/key/check`,n).then(C).then(k),checkAkismetKeyTyped:d=>l(`${r}jetpack/v4/module/akismet/key/check`,i,{body:JSON.stringify({api_key:d})}).then(C).then(k),getFeatureTypeStatus:d=>s(`${r}jetpack/v4/feature/${d}`,n).then(C).then(k),fetchStatsData:d=>s(f(d),n).then(C).then(k).then(h),getPluginUpdates:()=>s(`${r}jetpack/v4/updates/plugins`,n).then(C).then(k),getPlans:()=>s(`${r}jetpack/v4/plans`,n).then(C).then(k),fetchSettings:()=>s(`${r}jetpack/v4/settings`,n).then(C).then(k),updateSetting:d=>l(`${r}jetpack/v4/settings`,i,{body:JSON.stringify(d)}).then(C).then(k),fetchSiteData:()=>s(`${r}jetpack/v4/site`,n).then(C).then(k).then(d=>JSON.parse(d.data)),fetchSiteFeatures:()=>s(`Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'bdca920315a6e5637299');
|
||||
+1
@@ -0,0 +1 @@
|
||||
var o={};export{o as route};
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '27215135658c663447b6');
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
var Ox=Object.create;var pl=Object.defineProperty;var Ix=Object.getOwnPropertyDescriptor;var Nx=Object.getOwnPropertyNames;var Ax=Object.getPrototypeOf,Mx=Object.prototype.hasOwnProperty;var Fx=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ze=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}},ir=(e,t)=>{for(var o in t)pl(e,o,{get:t[o],enumerable:!0})},fl=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Nx(t))!Mx.call(e,n)&&n!==o&&pl(e,n,{get:()=>t[n],enumerable:!(r=Ix(t,n))||r.enumerable});return e},Ta=(e,t,o)=>(fl(e,t,"default"),o&&fl(o,t,"default")),m=(e,t,o)=>(o=e!=null?Ox(Ax(e)):{},fl(t||!e||!e.__esModule?pl(o,"default",{value:e,enumerable:!0}):o,e));var O=ze((t7,Jp)=>{Jp.exports=window.ReactJSXRuntime});var em=ze((o7,Zp)=>{var ka={};try{ka=Fx("jetpackConfig")}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),ka={missingConfig:!0}}var Xp=e=>Object.hasOwn(ka,e),jx=e=>{if(!Xp(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return ka[e]};Zp.exports={jetpackConfigHas:Xp,jetpackConfigGet:jx}});var Pa=ze((r7,tm)=>{tm.exports=window.wp.url});var Fe=ze((i7,nm)=>{nm.exports=window.wp.i18n});var X=ze((s7,am)=>{am.exports=window.wp.element});var k=ze((c7,sm)=>{sm.exports=window.React});var fr=ze((W9,ng)=>{ng.exports=window.ReactDOM});var lh=ze(ch=>{"use strict";var Cn=k();function d6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var u6=typeof Object.is=="function"?Object.is:d6,f6=Cn.useState,p6=Cn.useEffect,m6=Cn.useLayoutEffect,g6=Cn.useDebugValue;function h6(e,t){var o=t(),r=f6({inst:{value:o,getSnapshot:t}}),n=r[0].inst,i=r[1];return m6(function(){n.value=o,n.getSnapshot=t,sd(n)&&i({inst:n})},[e,o,t]),p6(function(){return sd(n)&&i({inst:n}),e(function(){sd(n)&&i({inst:n})})},[e]),g6(o),o}function sd(e){var t=e.getSnapshot;e=e.value;try{var o=t();return!u6(e,o)}catch{return!0}}function b6(e,t){return t()}var _6=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?b6:h6;ch.useSyncExternalStore=Cn.useSyncExternalStore!==void 0?Cn.useSyncExternalStore:_6});var cd=ze((RC,dh)=>{"use strict";dh.exports=lh()});var fh=ze(uh=>{"use strict";var fs=k(),y6=cd();function v6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var w6=typeof Object.is=="function"?Object.is:v6,x6=y6.useSyncExternalStore,R6=fs.useRef,S6=fs.useEffect,E6=fs.useMemo,C6=fs.useDebugValue;uh.useSyncExternalStoreWithSelector=function(e,t,o,r,n){var i=R6(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=E6(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),n!==void 0&&a.hasValue){var d=a.value;if(n(d,h))return f=d}return f=h}if(d=f,w6(c,h))return d;var g=r(h);return n!==void 0&&n(d,g)?(c=h,d):(c=h,f=g)}var u=!1,c,f,p=o===void 0?null:o;return[function(){return l(t())},p===null?void 0:function(){return l(p())}]},[t,o,r,n]);var s=x6(e,i[0],i[1]);return S6(function(){a.hasValue=!0,a.value=s},[s]),C6(s),s}});var mh=ze((EC,ph)=>{"use strict";ph.exports=fh()});var zt=ze((pj,E_)=>{E_.exports=window.wp.primitives});var jn=ze((pD,G_)=>{G_.exports=window.wp.compose});var Eu=ze((mD,q_)=>{q_.exports=window.wp.theme});var f0=ze((vD,u0)=>{u0.exports=window.wp.privateApis});var Lo=ze((yz,pv)=>{pv.exports=window.wp.components});var Hf=ze((Zz,Ov)=>{Ov.exports=window.wp.date});var Nv=ze((tU,Iv)=>{var Hn=1e3,$n=Hn*60,Wn=$n*60,on=Wn*24,$4=on*7,W4=on*365.25;Iv.exports=function(e,t){t=t||{};var o=typeof e;if(o==="string"&&e.length>0)return G4(e);if(o==="number"&&isFinite(e))return t.long?Y4(e):q4(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function G4(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var o=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return o*W4;case"weeks":case"week":case"w":return o*$4;case"days":case"day":case"d":return o*on;case"hours":case"hour":case"hrs":case"hr":case"h":return o*Wn;case"minutes":case"minute":case"mins":case"min":case"m":return o*$n;case"seconds":case"second":case"secs":case"sec":case"s":return o*Hn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}function q4(e){var t=Math.abs(e);return t>=on?Math.round(e/on)+"d":t>=Wn?Math.round(e/Wn)+"h":t>=$n?Math.round(e/$n)+"m":t>=Hn?Math.round(e/Hn)+"s":e+"ms"}function Y4(e){var t=Math.abs(e);return t>=on?Pc(e,t,on,"day"):t>=Wn?Pc(e,t,Wn,"hour"):t>=$n?Pc(e,t,$n,"minute"):t>=Hn?Pc(e,t,Hn,"second"):e+" ms"}Line truncated
|
||||
`))):I&&(P=[I],S.setCustomValidity(I))):T&&(S.setCustomValidity(""),j.customError=!1,S.validationMessage?(A=S.validationMessage,P=[S.validationMessage]):S.validity.valid&&!j.valid&&(j.valid=!0))}let L={value:v,state:j,error:A??(Array.isArray(I)?I[0]:I??""),errors:P,initialValue:i.initialValue};R(L),r(L)}),y=Yr.useCallback((v={})=>pe(d,u.valid===!1?{"aria-invalid":!0}:_e,v),[d,u.valid]),w=Yr.useCallback((v={})=>pe({onChange(x){if(x.nativeEvent.defaultPrevented)return;if(o(c),!f()){_(x.currentTarget.value,!0);return}let S=x.currentTarget;if(S.value===""){_(S.value);return}g.clear(),a?g.start(a,()=>{_(S.value)}):_(S.value)}},y(v)),[y,o,c,g,_,a,f]);return Yr.useMemo(()=>({getValidationProps:y,getInputValidationProps:w,inputRef:b,commit:_}),[y,w,_])}var Gs=m(k(),1);function Ab(e){let{commit:t,invalid:o,markedDirtyRef:r,name:n,setRegisteredFieldId:i,setValidityData:a,validityData:s}=e,{formRef:l}=br(),u=Gs.useRef(null),c=Gs.useRef(null),f=Gs.useRef(null),p=$(()=>{let _=c.current;if(_)return _.getValue?_.getValue():_.value}),h=$(()=>{let _=c.current;if(!_)return;let y=_.value;y===void 0&&(y=p()),r.current=!0,t(y)});function d(){let _=c.current;!_||!_.id||l.current.fields.set(_.id,{getValue:p,name:n,controlRef:_.controlRef??f,validityData:qr(s,o),validate:h})}function g(_=c.current?.id){_&&l.current.fields.delete(_)}function b(){let _=c.current;if(!_)return;let y=_.value;y===void 0&&(y=p()),s.initialValue===null&&y!==null&&a(w=>({...w,initialValue:y}))}return V(()=>{let _=c.current;!_||!_.id||l.current.fields.set(_.id,{getValue:p,name:n,controlRef:_.controlRef??f,validityData:qr(s,o),validate:h})},[l,p,o,n,h,s]),V(()=>{let _=l.current.fields;return()=>{let y=c.current?.id;y&&_.delete(y)}},[l]),$((_,y)=>{if(!y){u.current===_&&(u.current=null,g(),c.current=null,i(void 0));return}let w=c.current?.id;u.current=_,c.current=y,i(y.id),w&&w!==y.id&&g(w),b(),d()})}var qs=m(O(),1),iR=Ge.forwardRef(function(t,o){let{errors:r,validationMode:n,submitAttemptedRef:i}=br(),{render:a,className:s,validate:l,validationDebounceTime:u=0,validationMode:c=n,name:f,disabled:p=!1,invalid:h,dirty:d,touched:g,actionsRef:b,style:_,...y}=t,{disabled:w}=Ob(),v=$(l||(()=>null)),x=w||p,[S,R]=Ge.useState(!1),[E,I]=Ge.useState(!1),[P,j]=Ge.useState(!1),[A,T]=Ge.useState(!1),L=d??E,C=g??S,M=Ge.useRef(!1),U=Ge.useRef(void 0),N=Ge.useCallback(()=>U.current,[]),F=Ge.useCallback(ye=>{U.current=ye},[]),W=$(ye=>{d===void 0&&(ye&&(M.current=!0),I(ye))}),se=$(ye=>{g===void 0&&R(ye)}),Te=$(()=>c==="onChange"||c==="onSubmit"&&i.current),Z=!!f&&Object.hasOwn(r,f)&&r[f]!==void 0,ie=h===!0||Z,[fe,ee]=Ge.useState({state:Wr,error:"",errors:[],value:null,initialValue:null}),ke=!ie&&fe.state.valid,K=Ge.useMemo(()=>({disabled:x,touched:C,dirty:L,valid:ke,filled:P,focused:A}),[x,C,L,ke,P,A]),ce=Nb({setValidityData:ee,validate:v,validityData:fe,validationDebounceTime:u,invalid:ie,markedDirtyRef:M,state:K,name:f,shouldValidateOnChange:Te,getRegisteredFieldId:N}),Me=fe.value,$e=Ge.useCallback(()=>{M.current=!0,ce.commit(Me)},[ce,Me]),z=Ab({commit:ce.commit,invalid:ie,markedDirtyRef:M,name:f,setRegisteredFieldId:F,setValidityData:ee,validityData:fe});Ge.useImperativeHandle(b,()=>({validate:$e}),[$e]);let de=Ge.useMemo(()=>({invalid:ie,name:f,validityData:fe,setValidityData:ee,disabled:x,touched:C,setTouched:se,dirty:L,setDirty:W,filled:P,setFilled:j,focused:A,setFocused:T,validate:v,validationMode:c,validationDebounceTime:u,shouldValidateOnChange:Te,state:K,markedDirtyRef:M,registerFieldControl:z,validation:ce}),[ie,f,fe,x,C,se,L,W,P,j,A,T,v,c,u,Te,K,z,ce]),me=le("div",t,{ref:o,state:K,props:y,stateAttributesMapping:eo});return(0,qs.jsx)(Td.Provider,{value:de,children:me})}),Mb=Ge.forwardRef(function(t,o){return(0,qs.jsx)($s,{children:(0,qs.jsx)(iR,{...t,ref:o})})});var Li=m(k(),1);var Fb=Li.forwardRef(function(t,o){let{render:r,className:n,style:i,id:a,nativeLabel:s=!0,...l}=t,u=Lt(!1),{labelId:c}=bt(),f=Li.useRef(null),p=vb({id:c??a,native:s});return le("label",t,{ref:[o,f],state:u.state,props:[p,l],stateAttributesMapping:eo})});var Kr=m(k(),1);var Nd=m(O(),1),aR={...eo,...Po},jb=Kr.forwardRef(function(t,o){let{render:r,id:n,className:i,match:a,style:s,...l}=t,u=nt(n),{validityData:c,state:f,name:p}=Lt(!1),{setMessageIds:h}=bt(),{errors:d}=br(),g=p?d[p]:null,b=typeof a=="string",_=!1;a===!0?_=!0:b?_=!!c.state[a]:_=!!g||c.state.valid===!1;let{mounted:y,transitionStatus:w,setMounted:v}=yn(_);V(()=>{if(!(!_||!u))return h(C=>C.concat(u)),()=>{h(C=>C.filter(M=>M!==u))}},[_,u,h]);let x=Kr.useRef(null),[S,R]=Kr.useState(null),[E,I]=Kr.useState(null),P=c.errors.length>1?(0,Nd.jsx)("ul",{children:c.errors.map(C=>(0,Nd.jsx)("li",{children:C},C))}):c.error,j=b?P:g||P,A=c.error;g!=null?A=Array.isArray(g)?JSON.stringify(g):g:c.errors.length>1&&(A=JSON.stringify(c.errors)),_&&A!==E&&(I(A),R(j)),pr({open:_,ref:x,onComplete(){_||v(!1)}});let T={...f,transitionStatus:w},L=le("div",t,{ref:[o,x],state:T,props:[{id:u,children:_?j:S},l],stateAttributesMapping:aR,enabled:y});return y?L:null
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
|
||||
(**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
tabbable/dist/index.esm.js:
|
||||
(*!
|
||||
* tabbable 6.4.0
|
||||
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
||||
*)
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => 'bdca920315a6e5637299');
|
||||
+1
@@ -0,0 +1 @@
|
||||
var o={};export{o as route};
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* Script registration - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers a script according to `wp_register_script`. Honors this request by
|
||||
* reassigning internal dependency properties of any script handle already
|
||||
* registered by that name. It does not deregister the original script, to
|
||||
* avoid losing inline scripts which may have been attached.
|
||||
*
|
||||
* @param WP_Scripts $scripts WP_Scripts instance.
|
||||
* @param string $handle Name of the script. Should be unique.
|
||||
* @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
|
||||
* @param array $deps Optional. An array of registered script handles this script depends on. Default empty array.
|
||||
* @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
|
||||
* as a query string for cache busting purposes. If version is set to false, a version
|
||||
* number is automatically added equal to current installed WordPress version.
|
||||
* If set to null, no version is added.
|
||||
* @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>.
|
||||
* Default 'false'.
|
||||
*/
|
||||
function jetpack_videopress_override_script( $scripts, $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
|
||||
$script = $scripts->query( $handle, 'registered' );
|
||||
if ( $script ) {
|
||||
/*
|
||||
* In many ways, this is a reimplementation of `wp_register_script` but
|
||||
* bypassing consideration of whether a script by the given handle had
|
||||
* already been registered.
|
||||
*/
|
||||
|
||||
// See: `_WP_Dependency::__construct` .
|
||||
$script->src = $src;
|
||||
$script->deps = $deps;
|
||||
$script->ver = $ver;
|
||||
$script->args = $in_footer ? 1 : null;
|
||||
} else {
|
||||
$scripts->add( $handle, $src, $deps, $ver, ( $in_footer ? 1 : null ) );
|
||||
}
|
||||
|
||||
if ( in_array( 'wp-i18n', $deps, true ) ) {
|
||||
$scripts->set_translations( $handle );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all package scripts.
|
||||
*/
|
||||
function jetpack_videopress_register_package_scripts( $scripts ) {
|
||||
// Load build constants
|
||||
$build_constants = require __DIR__ . '/constants.php';
|
||||
$default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
|
||||
$extension = '.min.js';
|
||||
|
||||
$scripts_dir = __DIR__ . '/scripts';
|
||||
$scripts_file = $scripts_dir . '/registry.php';
|
||||
|
||||
if ( ! file_exists( $scripts_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scripts_data = require $scripts_file;
|
||||
$plugin_dir = dirname( __FILE__ );
|
||||
|
||||
foreach ( $scripts_data as $script_data ) {
|
||||
$asset_file = $scripts_dir . '/' . $script_data['asset'];
|
||||
$asset = file_exists( $asset_file ) ? require $asset_file : array();
|
||||
$dependencies = $asset['dependencies'] ?? array();
|
||||
$version = $asset['version'] ?? $default_version;
|
||||
|
||||
jetpack_videopress_override_script(
|
||||
$scripts,
|
||||
$script_data['handle'],
|
||||
$build_constants['build_url'] . 'scripts/' . $script_data['path'] . $extension,
|
||||
$dependencies,
|
||||
$version,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_default_scripts', 'jetpack_videopress_register_package_scripts' );
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Script registry - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Style registration - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* Note: These styles can be overridden by calling jetpack_videopress_override_style()
|
||||
* in lib/client-assets.php for complex cases (multiple files, conditional deps, etc.)
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers a style according to `wp_register_style`. Honors this request by
|
||||
* deregistering any style by the same handler before registration.
|
||||
*
|
||||
* @param WP_Styles $styles WP_Styles instance.
|
||||
* @param string $handle Name of the stylesheet. Should be unique.
|
||||
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
|
||||
* @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
|
||||
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
|
||||
* as a query string for cache busting purposes. If version is set to false, a version
|
||||
* number is automatically added equal to current installed WordPress version.
|
||||
* If set to null, no version is added.
|
||||
* @param string $media Optional. The media for which this stylesheet has been defined.
|
||||
* Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
|
||||
* '(orientation: portrait)' and '(max-width: 640px)'.
|
||||
*/
|
||||
function jetpack_videopress_override_style( $styles, $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
|
||||
$style = $styles->query( $handle, 'registered' );
|
||||
if ( $style ) {
|
||||
$styles->remove( $handle );
|
||||
}
|
||||
$styles->add( $handle, $src, $deps, $ver, $media );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all package styles (simple cases only).
|
||||
* Complex cases should be manually registered in lib/client-assets.php.
|
||||
*
|
||||
* @param WP_Styles $styles WP_Styles instance.
|
||||
*/
|
||||
function jetpack_videopress_register_package_styles( $styles ) {
|
||||
// Load build constants
|
||||
$build_constants = require __DIR__ . '/constants.php';
|
||||
$default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
|
||||
$suffix = '.min';
|
||||
|
||||
$styles_dir = __DIR__ . '/styles';
|
||||
$styles_file = $styles_dir . '/registry.php';
|
||||
|
||||
if ( ! file_exists( $styles_file ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$styles_data = require $styles_file;
|
||||
$plugin_dir = dirname( __FILE__ );
|
||||
|
||||
foreach ( $styles_data as $style_data ) {
|
||||
jetpack_videopress_override_style(
|
||||
$styles,
|
||||
$style_data['handle'],
|
||||
$build_constants['build_url'] . 'styles/' . $style_data['path'] . $suffix . '.css',
|
||||
$style_data['dependencies'],
|
||||
$default_version
|
||||
);
|
||||
|
||||
// Enable RTL support (WordPress automatically loads -rtl.css variant)
|
||||
$styles->add_data( $style_data['handle'], 'rtl', 'replace' );
|
||||
$styles->add_data( $style_data['handle'], 'suffix', $suffix );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_default_styles', 'jetpack_videopress_register_package_styles' );
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Style registry - Auto-generated by build process.
|
||||
* Do not edit this file manually.
|
||||
*
|
||||
* @package jetpack_videopress
|
||||
*/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
+522
@@ -0,0 +1,522 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Access Control.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Extensions\Premium_Content\Subscription_Service\Abstract_Token_Subscription_Service;
|
||||
use Automattic\Jetpack\Modules;
|
||||
use VIDEOPRESS_PRIVACY;
|
||||
use WP_Post;
|
||||
|
||||
/**
|
||||
* VideoPress video access control utilities.
|
||||
*
|
||||
* Note: this is also being used on WordPress.com.
|
||||
* Use IS_WPCOM checks for functionality that is specific to WPCOM/Jetpack.
|
||||
*/
|
||||
class Access_Control {
|
||||
|
||||
/**
|
||||
* Singleton Access_Control instance.
|
||||
*
|
||||
* @var Access_Control
|
||||
**/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Guid to subscription plan, store, for when used inline on a page.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $guids_to_subscriptions = array();
|
||||
|
||||
/**
|
||||
* Set that this guid is controlled by a subscription.
|
||||
*
|
||||
* @param string $guid The guid to set.
|
||||
* @param string|int $subscription_id The subscription to set.
|
||||
*
|
||||
* @return Access_Control
|
||||
*/
|
||||
public function set_guid_subscription( $guid, $subscription_id ) {
|
||||
$this->guids_to_subscriptions[ $guid ] = $subscription_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription for a guid.
|
||||
*
|
||||
* @param string $guid The guid to get.
|
||||
*
|
||||
* @return string|int|false
|
||||
*/
|
||||
public function get_subscription_plan_id( $guid ) {
|
||||
return $this->guids_to_subscriptions[ $guid ] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singleton instance.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Jetpack Memberships are available.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function jetpack_memberships_available() {
|
||||
return class_exists( '\Jetpack_Memberships' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if Jetpack Subscriptions are available.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function jetpack_subscriptions_available() {
|
||||
$is_module_active = ( new Modules() )->is_active( 'subscriptions' );
|
||||
if ( ! $is_module_active ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( function_exists( '\Automattic\Jetpack\Extensions\Premium_Content\subscription_service' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! defined( 'JETPACK__PLUGIN_DIR' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$subscription_service_file_path = JETPACK__PLUGIN_DIR . 'extensions/blocks/premium-content/_inc/subscription-service/include.php';
|
||||
if ( ! file_exists( $subscription_service_file_path ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once $subscription_service_file_path;
|
||||
|
||||
return function_exists( '\Automattic\Jetpack\Extensions\Premium_Content\subscription_service' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check default user access. By default, subscribers or higher can view videos.
|
||||
*
|
||||
* @param WP_Post $post_to_check The post to check.
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
private function get_default_user_capability_for_post( $post_to_check ) {
|
||||
if ( ! isset( $post_to_check->ID ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$default_auth = current_user_can( 'read_post', $post_to_check->ID );
|
||||
|
||||
return $default_auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user can access restricted content and builds the restriction_details array.
|
||||
*
|
||||
* @param string $guid the video guid.
|
||||
* @param int $embedded_post_id the post id.
|
||||
* @param int $selected_plan_id the selected plan id if applicable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function build_restriction_details( $guid, $embedded_post_id, $selected_plan_id ) {
|
||||
$post_to_check = get_post( $embedded_post_id );
|
||||
|
||||
if ( empty( $post_to_check ) ) {
|
||||
$restriction_details = $this->default_video_restriction_details( false );
|
||||
return $this->filter_video_restriction_details( $restriction_details, $guid, $embedded_post_id, $selected_plan_id );
|
||||
}
|
||||
|
||||
$default_auth = $this->get_default_user_capability_for_post( $post_to_check );
|
||||
$restriction_details = $this->default_video_restriction_details( $default_auth );
|
||||
|
||||
if ( $this->jetpack_memberships_available() ) {
|
||||
$post_access_level = \Jetpack_Memberships::get_post_access_level( $embedded_post_id );
|
||||
if ( 'everybody' !== $post_access_level ) {
|
||||
$memberships_can_view_post = \Jetpack_Memberships::user_can_view_post( $embedded_post_id );
|
||||
$restriction_details = $this->get_subscriber_only_restriction_details( $default_auth );
|
||||
$restriction_details['can_access'] = $memberships_can_view_post;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->check_block_level_access(
|
||||
$restriction_details,
|
||||
$guid,
|
||||
$embedded_post_id,
|
||||
$selected_plan_id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user can access restricted block content and updates the restriction_details array.
|
||||
*
|
||||
* @param array $restriction_details the restriction details array.
|
||||
* @param string $guid the video guid.
|
||||
* @param int $embedded_post_id the post id.
|
||||
* @param int $selected_plan_id the selected plan id if applicable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function check_block_level_access( $restriction_details, $guid, $embedded_post_id, $selected_plan_id ) {
|
||||
if ( $this->jetpack_subscriptions_available() && $selected_plan_id > 0 ) {
|
||||
$restriction_details = $this->get_subscriber_only_restriction_details( $restriction_details['can_access'] );
|
||||
$paywall = \Automattic\Jetpack\Extensions\Premium_Content\subscription_service();
|
||||
|
||||
// Only paid subscribers should be granted access to the premium content.
|
||||
$access_level = '';
|
||||
if ( class_exists( Abstract_Token_Subscription_Service::class ) ) {
|
||||
$access_level = Abstract_Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS;
|
||||
}
|
||||
|
||||
$can_view = $paywall->visitor_can_view_content( array( $selected_plan_id ), $access_level );
|
||||
$restriction_details['can_access'] = $can_view || current_user_can( 'edit_post', $embedded_post_id ); // Editors can always view the content.
|
||||
}
|
||||
|
||||
return $this->filter_video_restriction_details(
|
||||
$restriction_details,
|
||||
$guid,
|
||||
$embedded_post_id,
|
||||
$selected_plan_id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default restriction_details for a video.
|
||||
*
|
||||
* @param bool $default_can_access The default auth.
|
||||
*
|
||||
* @return array
|
||||
**/
|
||||
private function get_subscriber_only_restriction_details( $default_can_access = false ) {
|
||||
return array(
|
||||
'provider' => 'jetpack_memberships',
|
||||
'title' => __( 'This video is subscriber-only', 'jetpack-videopress-pkg' ),
|
||||
'unauthorized_message' => __( 'You need to be subscribed to view this video', 'jetpack-videopress-pkg' ),
|
||||
'can_access' => $default_can_access,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters restriction details.
|
||||
*
|
||||
* @param array $video_restriction_details The restriction details.
|
||||
* @param string $guid The video guid.
|
||||
* @param int $embedded_post_id The post id.
|
||||
* @param int $selected_plan_id The selected plan id if applicable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function filter_video_restriction_details( $video_restriction_details, $guid, $embedded_post_id, $selected_plan_id ) {
|
||||
/**
|
||||
* Filters the video restriction details.
|
||||
*
|
||||
* @param array $video_restriction_details The restriction details.
|
||||
* @param string $guid The video guid.
|
||||
* @param int $embedded_post_id The post id.
|
||||
* @param int $selected_plan_id The selected plan id if applicable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
return (array) apply_filters( 'videopress_video_restriction_details', $video_restriction_details, $guid, $embedded_post_id, $selected_plan_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default restriction_details for a video.
|
||||
*
|
||||
* @param bool $default_can_access The default auth.
|
||||
*
|
||||
* @return array
|
||||
**/
|
||||
private function default_video_restriction_details( $default_can_access = false ) {
|
||||
$restriction_details = array(
|
||||
'version' => '1',
|
||||
'provider' => 'auth',
|
||||
'title' => __( 'Unauthorized', 'jetpack-videopress-pkg' ),
|
||||
'unauthorized_message' => __( 'Unauthorized', 'jetpack-videopress-pkg' ),
|
||||
'can_access' => $default_can_access,
|
||||
);
|
||||
|
||||
return $restriction_details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a given post actually embeds a given VideoPress GUID.
|
||||
*
|
||||
* Used to prevent the embedded post id — which arrives from request input — from being
|
||||
* treated as an authorization context when it has no relationship to the requested video.
|
||||
* Matching the attachment id itself is not treated as proof of embedding: attachment ids
|
||||
* are enumerable via the media REST route and would otherwise provide a second path around
|
||||
* this check whenever the attachment has no parent and falls back to the `read` capability.
|
||||
*
|
||||
* @param int $embedded_post_id The post id claimed as the embedding context.
|
||||
* @param string $guid The video guid.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function post_embeds_videopress_guid( $embedded_post_id, $guid ) {
|
||||
$post = get_post( $embedded_post_id );
|
||||
if ( ! $post instanceof WP_Post || empty( $post->post_content ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the guid is nowhere in the content, neither the block nor the shortcode scan can match.
|
||||
if ( false === strpos( $post->post_content, $guid ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $this->post_content_has_videopress_block( $post->post_content, $guid ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $this->post_content_has_videopress_shortcode( $post->post_content, $guid ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->post_content_has_videopress_url( $post->post_content, $guid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Walk parsed blocks (including inner blocks) looking for a videopress/video block
|
||||
* whose guid attribute matches.
|
||||
*
|
||||
* @param string $post_content The post content to scan.
|
||||
* @param string $guid The video guid to match.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function post_content_has_videopress_block( $post_content, $guid ) {
|
||||
if ( false === strpos( $post_content, 'wp:videopress/video' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->blocks_contain_videopress_guid( parse_blocks( $post_content ), $guid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively scans a parsed block tree for a videopress/video block whose guid attribute matches.
|
||||
*
|
||||
* @param array $blocks Parsed blocks (as returned by parse_blocks() or an innerBlocks array).
|
||||
* @param string $guid The video guid to match.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function blocks_contain_videopress_guid( $blocks, $guid ) {
|
||||
foreach ( $blocks as $block ) {
|
||||
if (
|
||||
isset( $block['blockName'] ) && 'videopress/video' === $block['blockName']
|
||||
&& isset( $block['attrs']['guid'] ) && $block['attrs']['guid'] === $guid
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! empty( $block['innerBlocks'] ) && is_array( $block['innerBlocks'] )
|
||||
&& $this->blocks_contain_videopress_guid( $block['innerBlocks'], $guid )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect a [videopress GUID] or [wpvideo GUID] shortcode whose first positional
|
||||
* argument matches the given guid.
|
||||
*
|
||||
* @param string $post_content The post content to scan.
|
||||
* @param string $guid The video guid to match.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function post_content_has_videopress_shortcode( $post_content, $guid ) {
|
||||
if ( false === stripos( $post_content, '[videopress' ) && false === stripos( $post_content, '[wpvideo' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pattern = get_shortcode_regex( array( 'videopress', 'wpvideo' ) );
|
||||
$count = preg_match_all( '/' . $pattern . '/', $post_content, $matches, PREG_SET_ORDER );
|
||||
if ( false === $count || 0 === $count ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $matches as $match ) {
|
||||
$atts = shortcode_parse_atts( $match[3] );
|
||||
if ( ! is_array( $atts ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only the positional argument identifies the video; named attributes must not satisfy the binding check.
|
||||
if ( isset( $atts[0] ) && is_string( $atts[0] ) && $atts[0] === $guid ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect a canonical VideoPress URL referencing the given guid. Covers oEmbed
|
||||
* inserts, core/embed blocks, core/video blocks, and core [video] shortcodes
|
||||
* whose src/mp4 attributes resolve to a VideoPress URL.
|
||||
*
|
||||
* @param string $post_content The post content to scan.
|
||||
* @param string $guid The video guid to match.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function post_content_has_videopress_url( $post_content, $guid ) {
|
||||
if ( ! preg_match_all( '#https?://[^\s"\'<>)]+#i', $post_content, $matches ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $matches[0] as $url ) {
|
||||
if ( $guid === Utils::extract_videopress_guid_from_url( $url ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user can view the provided video. Only ever gets fired if site-wide private videos are enabled.
|
||||
*
|
||||
* Filterable for 3rd party plugins.
|
||||
*
|
||||
* @param string $guid The video id being checked.
|
||||
* @param int $embedded_post_id The post id the video is embedded in or 0.
|
||||
* @param int $selected_plan_id The plan id the earn block this video is embedded in has.
|
||||
*/
|
||||
public function is_current_user_authed_for_video( $guid, $embedded_post_id, $selected_plan_id = 0 ) {
|
||||
if ( current_user_can( 'upload_files' ) ) {
|
||||
return $this->filter_is_current_user_authed_for_video( true, $guid, $embedded_post_id );
|
||||
}
|
||||
|
||||
$attachment = false;
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
$video_info = video_get_info_by_guid( $guid );
|
||||
if ( ! empty( $video_info ) ) {
|
||||
$attachment = get_blog_post( $video_info->blog_id, $video_info->post_id );
|
||||
}
|
||||
} else {
|
||||
$attachment = videopress_get_post_by_guid( $guid );
|
||||
}
|
||||
|
||||
if ( ! $attachment ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$video_info = video_get_info_by_blogpostid( get_current_blog_id(), $attachment->ID );
|
||||
if ( null === $video_info->guid ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Default missing privacy_setting to SITE_DEFAULT to avoid an
|
||||
* undefined-property warning and make the site-level fallback explicit.
|
||||
*/
|
||||
$privacy_setting = $video_info->privacy_setting ?? VIDEOPRESS_PRIVACY::SITE_DEFAULT;
|
||||
|
||||
$embedded_post_id = (int) $embedded_post_id;
|
||||
if (
|
||||
$embedded_post_id
|
||||
&& VIDEOPRESS_PRIVACY::IS_PUBLIC !== $privacy_setting
|
||||
&& ! $this->post_embeds_videopress_guid( $embedded_post_id, $guid )
|
||||
) {
|
||||
$embedded_post_id = 0;
|
||||
}
|
||||
|
||||
$is_user_authed = false;
|
||||
|
||||
// Determine if video is public, private or use site default.
|
||||
switch ( $privacy_setting ) {
|
||||
case VIDEOPRESS_PRIVACY::IS_PUBLIC:
|
||||
$is_user_authed = true;
|
||||
break;
|
||||
case VIDEOPRESS_PRIVACY::IS_PRIVATE:
|
||||
$restriction_details = $this->build_restriction_details( $guid, $embedded_post_id, $selected_plan_id );
|
||||
$is_user_authed = $restriction_details['can_access'];
|
||||
break;
|
||||
case VIDEOPRESS_PRIVACY::SITE_DEFAULT:
|
||||
default:
|
||||
$is_videopress_private_for_site = Data::get_videopress_videos_private_for_site();
|
||||
$is_user_authed = true;
|
||||
if ( $is_videopress_private_for_site ) {
|
||||
$restriction_details = $this->build_restriction_details( $guid, $embedded_post_id, $selected_plan_id );
|
||||
$is_user_authed = $restriction_details['can_access'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides video view authorization for current user.
|
||||
*
|
||||
* Example of making all videos public:
|
||||
*
|
||||
* function jp_example_override_video_auth( $is_user_authed, $guid ) {
|
||||
* return true
|
||||
* };
|
||||
* add_filter( 'videopress_is_current_user_authed_for_video', 'jp_example_override_video_auth', 10, 2 );
|
||||
*
|
||||
* @param bool $is_user_authed The current user authorization state.
|
||||
* @param string $guid The video's unique identifier.
|
||||
* @param int|null $embedded_post_id The post the video is embedded..
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
return $this->filter_is_current_user_authed_for_video( $is_user_authed, $guid, $embedded_post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides video view authorization for current user.
|
||||
*
|
||||
* @param bool $is_user_authed The current user authorization state.
|
||||
* @param string $guid The video's unique identifier.
|
||||
* @param int|null $embedded_post_id The post the video is embedded..
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function filter_is_current_user_authed_for_video( $is_user_authed, $guid, $embedded_post_id ) {
|
||||
/**
|
||||
* Overrides video view authorization for current user.
|
||||
*
|
||||
* Example of making all videos public:
|
||||
*
|
||||
* function jp_example_override_video_auth( $is_user_authed, $guid ) {
|
||||
* return true
|
||||
* };
|
||||
* add_filter( 'videopress_is_current_user_authed_for_video', 'jp_example_override_video_auth', 10, 2 );
|
||||
*
|
||||
* @param bool $is_user_authed The current user authorization state.
|
||||
* @param string $guid The video's unique identifier.
|
||||
* @param int|null $embedded_post_id The post the video is embedded..
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
return (bool) apply_filters( 'videopress_is_current_user_authed_for_video', $is_user_authed, $guid, $embedded_post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proper blog id depending on Jetpack or WP.com
|
||||
*
|
||||
* @return int the blog id
|
||||
*/
|
||||
public function get_videopress_blog_id() {
|
||||
return \Jetpack_Options::get_option( 'id' );
|
||||
}
|
||||
}
|
||||
+544
@@ -0,0 +1,544 @@
|
||||
<?php
|
||||
/**
|
||||
* The initializer class for Admin UI elements
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Admin_UI\Admin_Menu;
|
||||
use Automattic\Jetpack\Assets;
|
||||
use Automattic\Jetpack\Connection\Initial_State as Connection_Initial_State;
|
||||
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
|
||||
use Automattic\Jetpack\Current_Plan;
|
||||
use Automattic\Jetpack\My_Jetpack\Products as My_Jetpack_Products;
|
||||
use Automattic\Jetpack\Status;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
use Automattic\Jetpack\Terms_Of_Service;
|
||||
use Automattic\Jetpack\Tracking;
|
||||
|
||||
/**
|
||||
* Initialized the VideoPress package
|
||||
*/
|
||||
class Admin_UI {
|
||||
|
||||
const JETPACK_VIDEOPRESS_PKG_NAMESPACE = 'jetpack-videopress-pkg';
|
||||
|
||||
const ADMIN_PAGE_SLUG = 'jetpack-videopress';
|
||||
|
||||
/**
|
||||
* Filter name that gates the wp-build–based dashboard.
|
||||
*
|
||||
* When this filter returns true, "Jetpack > VideoPress" renders the new
|
||||
* wp-build dashboard instead of the legacy React app.
|
||||
*/
|
||||
const MODERNIZATION_FILTER = 'rsm_jetpack_ui_modernization_videopress';
|
||||
|
||||
/**
|
||||
* Initializes the Admin UI of VideoPress
|
||||
*
|
||||
* This method is called only once by the Initializer class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
add_action( 'admin_menu', array( __CLASS__, 'enable_menu' ), 1 ); // Akismet uses 4, so we use 1 to ensure both menus are added when only they exist.
|
||||
|
||||
add_action( 'admin_footer-upload.php', array( __CLASS__, 'attachment_details_two_column_template' ) );
|
||||
add_action( 'admin_footer-post.php', array( __CLASS__, 'attachment_details_template' ), 20 );
|
||||
|
||||
add_filter( 'get_edit_post_link', array( __CLASS__, 'edit_video_link' ), 10, 3 );
|
||||
|
||||
add_action( 'admin_init', array( __CLASS__, 'remove_jetpack_hooks' ) );
|
||||
|
||||
if ( self::is_modernized() && self::is_videopress_admin_request() ) {
|
||||
self::load_wp_build();
|
||||
add_action( 'current_screen', array( __CLASS__, 'alias_screen_id_for_wp_build' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the menu, separately to init due to translations needing to run early for the page suffix.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function enable_menu() {
|
||||
$callback = self::is_modernized() && function_exists( 'jetpack_videopress_jetpack_videopress_dashboard_wp_admin_render_page' )
|
||||
? 'jetpack_videopress_jetpack_videopress_dashboard_wp_admin_render_page'
|
||||
: array( __CLASS__, 'plugin_settings_page' );
|
||||
|
||||
$page_suffix = Admin_Menu::add_menu(
|
||||
// "VideoPress" is a product name, do not translate.
|
||||
'Jetpack VideoPress',
|
||||
'VideoPress',
|
||||
'manage_options',
|
||||
self::ADMIN_PAGE_SLUG,
|
||||
$callback,
|
||||
3
|
||||
);
|
||||
add_action( 'load-' . $page_suffix, array( __CLASS__, 'admin_init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL for the VideoPress admin page
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_admin_page_url() {
|
||||
return admin_url( 'admin.php?page=' . self::ADMIN_PAGE_SLUG );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of allowed video extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_allowed_video_extensions() {
|
||||
return array(
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => 'video/3gpp',
|
||||
'3gp2' => 'video/3gpp2',
|
||||
'3gpp' => 'video/3gpp',
|
||||
'avi' => 'video/avi',
|
||||
'm4v' => 'video/mp4',
|
||||
'mov' => 'video/quicktime',
|
||||
'mp4' => 'video/mp4',
|
||||
'mpe' => 'video/mpeg',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'ogv' => 'video/ogg',
|
||||
'wmv' => 'video/x-ms-wmv',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the admin resources.
|
||||
*/
|
||||
public static function admin_init() {
|
||||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_scripts' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Main plugin settings page.
|
||||
*/
|
||||
public static function plugin_settings_page() {
|
||||
?>
|
||||
<div id="jetpack-videopress-root"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove extra fields from Attachment details modal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function remove_jetpack_hooks() {
|
||||
if ( class_exists( '\VideoPress_Edit_Attachment' ) ) {
|
||||
$edit_attachment = \VideoPress_Edit_Attachment::init();
|
||||
remove_filter( 'attachment_fields_to_edit', array( $edit_attachment, 'fields_to_edit' ) );
|
||||
remove_filter( 'attachment_fields_to_save', array( $edit_attachment, 'save_fields' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether we are in condition to track to use
|
||||
* Analytics functionality like Tracks, MC, or GA.
|
||||
*/
|
||||
public static function can_use_analytics() {
|
||||
$status = new Status();
|
||||
$connection = new Connection_Manager();
|
||||
$tracking = new Tracking( 'jetpack', $connection );
|
||||
|
||||
return $tracking->should_enable_tracking( new Terms_Of_Service(), $status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue plugin admin scripts and styles.
|
||||
*/
|
||||
public static function enqueue_admin_scripts() {
|
||||
// This callback is registered via `load-{$page_suffix}` in `enable_menu()`,
|
||||
// so it only fires on the VideoPress admin page — no need to re-check the page here.
|
||||
if ( self::is_modernized() ) {
|
||||
// Page-level shell stylesheet: scopes the shared `jetpack-admin-page-layout`
|
||||
// mixin to the dashboard body so every route inherits the proper
|
||||
// scrollable chrome (fixed `#wpbody-content`, scrollable middle, pinned
|
||||
// footer) regardless of whether it uses DashboardLayout. Without this,
|
||||
// non-tabbed routes (e.g. Video details) would only get the layout
|
||||
// after a sibling route's chunk happened to inject the same CSS.
|
||||
$shell_css = dirname( __DIR__ ) . '/build/dashboard-shell/index.css';
|
||||
if ( file_exists( $shell_css ) ) {
|
||||
wp_register_style(
|
||||
'jetpack-videopress-dashboard-shell',
|
||||
plugins_url( 'build/dashboard-shell/index.css', __DIR__ ),
|
||||
array(),
|
||||
(string) filemtime( $shell_css )
|
||||
);
|
||||
wp_style_add_data( 'jetpack-videopress-dashboard-shell', 'rtl', 'replace' );
|
||||
wp_enqueue_style( 'jetpack-videopress-dashboard-shell' );
|
||||
}
|
||||
|
||||
// The Video details screen's thumbnail editor opens the WordPress
|
||||
// media library (via window.wp.media) for the "Upload image"
|
||||
// action, so the media scripts must be present here too.
|
||||
wp_enqueue_media();
|
||||
|
||||
// Beyond the shell stylesheet and the media library, wp-build
|
||||
// manages its own enqueue pipeline. The legacy script, initial
|
||||
// state, and tracking are all intentionally skipped for the
|
||||
// wp-build dashboard.
|
||||
return;
|
||||
}
|
||||
|
||||
Assets::register_script(
|
||||
self::JETPACK_VIDEOPRESS_PKG_NAMESPACE,
|
||||
'../build/admin/index.js',
|
||||
__FILE__,
|
||||
array(
|
||||
'in_footer' => true,
|
||||
'textdomain' => 'jetpack-videopress-pkg',
|
||||
)
|
||||
);
|
||||
Assets::enqueue_script( self::JETPACK_VIDEOPRESS_PKG_NAMESPACE );
|
||||
|
||||
// Required for Media Library access
|
||||
wp_enqueue_media();
|
||||
|
||||
// Required for Analytics.
|
||||
if ( self::can_use_analytics() ) {
|
||||
Tracking::register_tracks_functions_scripts( true );
|
||||
}
|
||||
|
||||
// Initial JS state including JP Connection data.
|
||||
Connection_Initial_State::render_script( self::JETPACK_VIDEOPRESS_PKG_NAMESPACE );
|
||||
wp_add_inline_script( self::JETPACK_VIDEOPRESS_PKG_NAMESPACE, self::render_initial_state(), 'before' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the initial state into a JavaScript variable.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function render_initial_state() {
|
||||
return 'var jetpackVideoPressInitialState=' . wp_json_encode( self::initial_state(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the initial state data for hydrating the React UI.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function initial_state() {
|
||||
return array(
|
||||
'apiRoot' => esc_url_raw( rest_url() ),
|
||||
'apiNonce' => wp_create_nonce( 'wp_rest' ),
|
||||
'registrationNonce' => wp_create_nonce( 'jetpack-registration-nonce' ),
|
||||
'adminUrl' => self::get_admin_page_url(),
|
||||
'adminUri' => 'admin.php?page=' . self::ADMIN_PAGE_SLUG,
|
||||
'paidFeatures' => array(
|
||||
'isVideoPressSupported' => Current_Plan::supports( 'videopress' ),
|
||||
// Check videopress-1tb-storage (Jetpack) or videopress (WordPress.com).
|
||||
'isVideoPress1TBSupported' => Current_Plan::supports( 'videopress-1tb-storage' )
|
||||
|| ( ( new Host() )->is_wpcom_platform() && wpcom_site_has_feature( 'videopress' ) ),
|
||||
'isVideoPressUnlimitedSupported' => Current_Plan::supports( 'videopress-unlimited-storage' ),
|
||||
),
|
||||
'siteSuffix' => ( new Status() )->get_site_suffix(),
|
||||
'productData' => Plan::get_product(),
|
||||
'productPrice' => Plan::get_product_price(),
|
||||
'siteProductData' => My_Jetpack_Products::get_product( 'videopress' ),
|
||||
'allowedVideoExtensions' => self::get_allowed_video_extensions(),
|
||||
'initialState' => Data::get_initial_state(),
|
||||
'contentNonce' => wp_create_nonce( 'videopress-content-nonce' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the edit link for videopress videos
|
||||
*
|
||||
* @param string $link - the post link.
|
||||
* @param int $post_id - the post ID.
|
||||
* @param string $context - the context.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function edit_video_link( $link, $post_id, $context ) {
|
||||
$post_id = (int) $post_id;
|
||||
if ( ! $post_id ) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post ) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
if ( 'attachment' !== $post->post_type || 'video/videopress' !== $post->post_mime_type ) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
$route = sprintf( '#/video/%d/edit', $post_id );
|
||||
$url = self::get_admin_page_url() . $route;
|
||||
|
||||
if ( 'display' === $context ) {
|
||||
return esc_url( $url );
|
||||
}
|
||||
|
||||
return esc_url_raw( $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SVG for the sub brand Jetpack VideoPress logo
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function get_logo_svg() {
|
||||
return '<svg width="212" height="27" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M110.441 16.294c.479-1.458.995-2.93 1.547-4.414l2.545-6.87h1.687l-5.09 13.361h-1.427l-5.09-13.361h1.687l2.545 6.87a109.628 109.628 0 0 1 1.556 4.414h.04ZM117.919 18.371V8.884h1.547v9.487h-1.547Zm-.04-11.694V4.95h1.627v1.727h-1.627ZM123.331 13.728c0 .546.06 1.042.179 1.488.127.439.306.815.539 1.128.233.306.519.543.858.71.34.166.729.249 1.168.249.326 0 .622-.044.888-.13.266-.087.503-.196.709-.33a3.045 3.045 0 0 0 .898-.838V11.04a3.706 3.706 0 0 0-1.108-.779c-.419-.2-.871-.3-1.357-.3a2.83 2.83 0 0 0-.928.17 2.26 2.26 0 0 0-.898.59c-.273.286-.499.672-.679 1.158-.179.48-.269 1.095-.269 1.848Zm-1.617.02c0-.66.063-1.242.19-1.748.133-.513.306-.959.519-1.338.212-.38.462-.696.748-.949.286-.26.582-.47.888-.629.306-.16.616-.273.928-.34.32-.073.619-.11.898-.11.579 0 1.082.097 1.507.29.426.193.809.476 1.148.85h.03V3.91h1.547v14.46h-1.168l-.319-1.058h-.04c-.12.153-.26.31-.419.47-.16.152-.349.292-.569.419a2.83 2.83 0 0 1-.749.3 3.57 3.57 0 0 1-.978.119 4.63 4.63 0 0 1-1.526-.26 3.666 3.666 0 0 1-1.338-.849c-.386-.392-.698-.895-.938-1.507-.239-.62-.359-1.372-.359-2.257ZM136.626 9.963c-.352 0-.682.07-.988.21a2.57 2.57 0 0 0-.788.569c-.226.24-.409.522-.549.849-.14.32-.226.662-.259 1.028h4.79c0-.373-.05-.719-.15-1.038a2.474 2.474 0 0 0-.419-.85 1.935 1.935 0 0 0-.689-.559 2.046 2.046 0 0 0-.948-.21Zm.849 7.31c.512 0 .978-.04 1.397-.12a8.775 8.775 0 0 0 1.267-.36v1.289c-.339.166-.758.296-1.257.39-.499.1-1.035.149-1.607.149a6.871 6.871 0 0 1-1.916-.26 4.108 4.108 0 0 1-1.557-.838c-.446-.387-.798-.89-1.058-1.508-.253-.626-.379-1.379-.379-2.257 0-.866.12-1.615.359-2.247.24-.64.559-1.172.958-1.598.4-.426.859-.746 1.378-.959a4.238 4.238 0 0 1 1.626-.32c.532 0 1.028.09 1.487.27.466.173.868.45 1.208.83.339.379.605.868.798 1.467.2.6.299 1.318.299 2.157v.21c0 .053-.003.18-.009.38h-6.507c0 .605.09 1.121.269 1.547.187.42.436.763.749 1.029.319.26.692.45 1.117.57.426.119.885.179 1.378.179ZM149.623 13.638c0-.586-.074-1.105-.22-1.558a3.288 3.288 0 0 0-.599-1.159 2.421 2.421 0 0 0-.908-.718 2.674 2.674 0 0 0-1.157-.25c-.42 0-.806.083-1.158.25a2.5 2.5 0 0 0-.918.719c-.253.312-.453.699-.599 1.158-.14.453-.21.972-.21 1.558 0 .579.07 1.098.21 1.558.146.452.349.835.609 1.148.259.313.565.553.918.72.352.159.738.239 1.157.239.42 0 .802-.08 1.148-.24a2.56 2.56 0 0 0 .908-.719c.26-.313.459-.696.599-1.148.146-.46.22-.979.22-1.558Zm1.616 0a6.17 6.17 0 0 1-.319 2.037 4.617 4.617 0 0 1-.908 1.578 3.987 3.987 0 0 1-1.407 1.009c-.552.24-1.171.359-1.857.359-.705 0-1.337-.12-1.896-.36a4.09 4.09 0 0 1-1.417-1.008 4.562 4.562 0 0 1-.888-1.578 6.361 6.361 0 0 1-.309-2.037c0-.752.106-1.435.319-2.047a4.697 4.697 0 0 1 .898-1.578c.393-.44.865-.78 1.417-1.019a4.69 4.69 0 0 1 1.867-.36c.698 0 1.327.12 1.886.36.559.24 1.031.58 1.417 1.019.386.44.682.965.888 1.578.206.612.309 1.295.309 2.047ZM155.204 18.371h-1.627V5.01h3.703c.552 0 1.061.033 1.527.1.472.066.905.17 1.297.309.798.286 1.404.716 1.816 1.288.413.566.619 1.265.619 2.097 0 .68-.136 1.279-.409 1.798a3.473 3.473 0 0 1-1.168 1.288c-.512.346-1.137.61-1.876.79-.732.172-1.563.259-2.495.259-.446 0-.908-.02-1.387-.06v5.492Zm0-6.98a12.234 12.234 0 0 0 1.367.08c.765 0 1.417-.06 1.956-.18.539-.12.978-.293 1.318-.52.339-.232.585-.512.738-.838.153-.333.23-.71.23-1.129 0-.519-.127-.945-.38-1.278-.246-.333-.598-.586-1.057-.759a4.097 4.097 0 0 0-.988-.22 10.59 10.59 0 0 0-1.298-.07h-1.886v4.914ZM169.62 10.143h-.12c-.365 0-.725.033-1.077.1a4.45 4.45 0 0 0-.998.309c-.306.133-.586.3-.839.5a2.74 2.74 0 0 0-.618.708v6.611h-1.547V8.884h1.197l.3 1.508h.03c.153-.246.339-.476.559-.689.226-.213.479-.4.758-.56a3.72 3.72 0 0 1 .918-.369c.333-.093.682-.14 1.048-.14.067 0 .133.004.2.01.073 0 .136.004.189.01v1.489ZM174.673 9.963c-.353 0-.682.07-.988.21-.3.14-.562.33-.789.569-.226.24-.409.522-.549.849-.139.32-.226.662-.259 1.028h4.79c0-.373-.05-.719-.149-1.038a2.476 2.476 0 0 0-.42-.85 1.931 1.931 0 0 0-.688-.559 2.052 2.052 0 0 0-.948-.21Zm.848 7.31c.512 0 .978-.04 1.397-.12a8.824 8.824 0 0 0 1.268-.36v1.289c-.34.166-.759.296-1.258.39-.499.1-1.034.149-1.607.149a6.876 6.876 0 0 1-1.916-.26 4.108 4.108 0 0 1-1.557-.838c-.445-.387-.798-.89-1.057-1.508-.253-.626-.38-1.379-.38-2.257 0-.866.12-1.615.36-2.247.239-.64.559-1.172.958-1.598a3.9 3.9 0 0 1 1.377-.959 4.243 4.243 0 0 1 1.627-.32c.532 0 1.027.09 1.487.27.465.173.868.45 1.207.83.339.379.606.868.798 1.467.2.6.3 1.318.3 2.157v.21c0 .053-.003.18-.01.38h-6.507c0 .605.09 1.121.27 1.547.186.42.435.763.748 1.029.319.26.692.45 1.118.57.426.119.885.179 1.377.179ZM181.831 11.41c0 .26.056.473.17.64.113.166.262.303.449.41.193.1.412.182.658.25.253.066.513.126.779.179.366.08.712.17 1.038.27.326.093.625.236.898.429.279.193.502.456.668.789.173.326.26.752.26 1.278 0 .48-.093.906-.28 1.278a2.64 2.64 0 0 1-.788.929 3.66 3.66 0 0 1-1.217.56c-.473.132-.992.199-1.557.199-.346 0-.662-.02-.948-.06a5.2 5.2 0 0 1-.749-.14 4.56 4.56 0 0 1-.549-.17 3.646 3.646 0 0 1-.379-.17v-1.297c.399.16.795.286 1.188.379.392.093.825.14 1
Line truncated
|
||||
}
|
||||
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.UnsafePrintingFunction
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Overwrites the backbone template for the attachment details modal
|
||||
*
|
||||
* This template is originally added in WP core in wp-includes/media-templates.php
|
||||
*
|
||||
* We override the initialize method of the TwoColumn view class (located at core's js/media/view/attachment/detail-two-column.js)
|
||||
* and use the custom template only for VideoPress videos.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function attachment_details_two_column_template() {
|
||||
|
||||
?>
|
||||
<script type="text/html" id="tmpl-videopress_iframe_vnext">
|
||||
<iframe class="videopress-iframe" style="display: block; max-width: 100%; max-height: 100%;" width="{{ data.width }}" height="{{ data.height }}" src="https://videopress.com/embed/{{ data.guid }}?{{ data.urlargs }}" frameborder='0' allowfullscreen></iframe>
|
||||
</script>
|
||||
<script type="text/html" id="tmpl-attachment-details-two-column-videopress">
|
||||
<div class="attachment-media-view {{ data.orientation }}">
|
||||
<h2 class="screen-reader-text"><?php _e( 'Attachment Preview', 'jetpack-videopress-pkg' ); ?></h2>
|
||||
<div class="thumbnail thumbnail-{{ data.type }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="attachment-info">
|
||||
<h2>
|
||||
<?php echo self::get_logo_svg(); ?>
|
||||
</h2>
|
||||
<?php self::attachment_info_template_part(); ?>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
jQuery(document).ready( function($) {
|
||||
if( typeof wp.media.view.Attachment.Details.TwoColumn != 'undefined' ){
|
||||
var TwoColumn = wp.media.view.Attachment.Details.TwoColumn,
|
||||
old_render = TwoColumn.prototype.render,
|
||||
vp_template = wp.template('videopress_iframe_vnext');
|
||||
|
||||
TwoColumn.prototype.initialize = function() {
|
||||
if ( 'video' === this.model.attributes.type && 'videopress' === this.model.attributes.subtype ) {
|
||||
this.template = wp.template( 'attachment-details-two-column-videopress' );
|
||||
} else {
|
||||
this.template = wp.template( 'attachment-details-two-column' );
|
||||
}
|
||||
// From this point on, we are just copying the function from core.
|
||||
this.controller.on( 'content:activate:edit-details', _.bind( this.editAttachment, this ) );
|
||||
wp.media.view.Attachment.Details.prototype.initialize.apply( this, arguments );
|
||||
}
|
||||
|
||||
// Add the VideoPress player
|
||||
TwoColumn.prototype.render = function() {
|
||||
// Have the original renderer run first.
|
||||
old_render.apply( this, arguments );
|
||||
|
||||
// Now our stuff!
|
||||
if ( 'video' === this.model.get('type') ) {
|
||||
if ( this.model.get('videopress_guid') ) {
|
||||
this.$('.attachment-media-view .thumbnail-video').html( vp_template( {
|
||||
guid : this.model.get('videopress_guid'),
|
||||
width : this.model.get('width') > 0 ? this.model.get('width') : '100%',
|
||||
height : this.model.get('height') > 0 ? this.model.get('height') : '100%'
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the backbone template for the attachment details modal
|
||||
*
|
||||
* This template is originally added in WP core in wp-includes/media-templates.php
|
||||
*
|
||||
* We override the initialize method of the TwoColumn view class (located at core's js/media/view/attachment/detail-two-column.js)
|
||||
* and use the custom template only for VideoPress videos.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function attachment_details_template() {
|
||||
?>
|
||||
<script type="text/html" id="tmpl-videopress_iframe_vnext">
|
||||
<iframe class="videopress-iframe" style="display: block; max-width: 100%; max-height: 180px;" width="{{ data.width }}" height="{{ data.height }}" src="https://videopress.com/embed/{{ data.guid }}?{{ data.urlargs }}" frameborder='0' allowfullscreen></iframe>
|
||||
</script>
|
||||
<script type="text/html" id="tmpl-attachment-details-videopress">
|
||||
<h2>
|
||||
<?php echo self::get_logo_svg(); ?>
|
||||
</h2>
|
||||
<div class="attachment-info">
|
||||
<div class="wp-media-wrapper wp-video">
|
||||
</div>
|
||||
<?php self::attachment_info_template_part(); ?>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
jQuery(document).ready( function($) {
|
||||
if( typeof wp.media.view.Attachment.Details != 'undefined' ){
|
||||
var DetailsTemplate = wp.media.view.Attachment.Details,
|
||||
old_render = DetailsTemplate.prototype.render,
|
||||
vp_template = wp.template('videopress_iframe_vnext');
|
||||
|
||||
DetailsTemplate.prototype.initialize = function() {
|
||||
if ( 'video' === this.model.attributes.type && 'videopress' === this.model.attributes.subtype ) {
|
||||
this.template = wp.template( 'attachment-details-videopress' );
|
||||
} else {
|
||||
this.template = wp.template( 'attachment-details' );
|
||||
}
|
||||
// From this point on, we are just copying the function from core.
|
||||
this.options = _.defaults( this.options, {
|
||||
rerenderOnModelChange: false
|
||||
});
|
||||
|
||||
// Call 'initialize' directly on the parent class.
|
||||
wp.media.view.Attachment.prototype.initialize.apply( this, arguments );
|
||||
|
||||
this.copyAttachmentDetailsURLClipboard();
|
||||
}
|
||||
|
||||
// Add the VideoPress player
|
||||
DetailsTemplate.prototype.render = function() {
|
||||
// Have the original renderer run first.
|
||||
old_render.apply( this, arguments );
|
||||
|
||||
// Now our stuff!
|
||||
if ( 'video' === this.model.get('type') ) {
|
||||
if ( this.model.get('videopress_guid') ) {
|
||||
this.$('.attachment-info .wp-video').html( vp_template( {
|
||||
guid : this.model.get('videopress_guid'),
|
||||
// width : this.model.get('width') > 0 ? this.model.get('width') : '100%',
|
||||
// height : this.model.get('height') > 0 ? this.model.get('height') : '100%'
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Echoes the piece of the custom template that is shared between the two templates above
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function attachment_info_template_part() {
|
||||
?>
|
||||
<span class="setting" data-setting="title">
|
||||
<label for="attachment-details-title" class="name"><?php _e( 'Title', 'jetpack-videopress-pkg' ); ?></label>
|
||||
<input type="text" id="attachment-details-title" value="{{ data.title }}" readonly />
|
||||
</span>
|
||||
<span class="setting" data-setting="filename">
|
||||
<label for="attachment-details-filename" class="name"><?php _e( 'File name', 'jetpack-videopress-pkg' ); ?></label>
|
||||
<input type="text" id="attachment-details-filename" value="{{ data.filename }}" readonly />
|
||||
</span>
|
||||
<span class="setting" data-setting="fileurl">
|
||||
<label for="attachment-details-copy-link" class="name"><?php _e( 'File URL:', 'jetpack-videopress-pkg' ); ?></label>
|
||||
<input type="text" class="attachment-details-copy-link" id="attachment-details-copy-link" value="{{ data.url }}" readonly />
|
||||
<div class="copy-to-clipboard-container">
|
||||
<button type="button" class="button button-small copy-attachment-url" data-clipboard-target="#attachment-details-copy-link"><?php _e( 'Copy URL to clipboard', 'jetpack-videopress-pkg' ); ?></button>
|
||||
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!', 'jetpack-videopress-pkg' ); ?></span>
|
||||
</div>
|
||||
</span>
|
||||
<p><a href="{{ data.editLink }}" class="button button-medium" target="_blank"><?php _e( 'Edit video details', 'jetpack-videopress-pkg' ); ?></a></p>
|
||||
<?php
|
||||
}
|
||||
// phpcs:enable WordPress.Security.EscapeOutput.UnsafePrintingFunction
|
||||
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Load the wp-build entry file and register its polyfills.
|
||||
*
|
||||
* Only called on `?page=jetpack-videopress` admin requests when the
|
||||
* modernization filter is enabled. Keeps wp-build off every other request.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function load_wp_build() {
|
||||
$build_index = dirname( __DIR__ ) . '/build/build.php';
|
||||
|
||||
if ( ! file_exists( $build_index ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $build_index;
|
||||
|
||||
\Automattic\Jetpack\WP_Build_Polyfills\WP_Build_Polyfills::register(
|
||||
'jetpack-videopress',
|
||||
array_merge(
|
||||
\Automattic\Jetpack\WP_Build_Polyfills\WP_Build_Polyfills::SCRIPT_HANDLES,
|
||||
\Automattic\Jetpack\WP_Build_Polyfills\WP_Build_Polyfills::MODULE_IDS
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias the current screen ID to satisfy wp-build's auto-generated enqueue check.
|
||||
*
|
||||
* Wp-build's `<page>-wp-admin` enqueue callback enqueues only when the screen ID
|
||||
* matches the wp-build page slug (`jetpack-videopress-dashboard`). Our WP-admin
|
||||
* menu slug stays `jetpack-videopress`, so we mutate the screen object in place
|
||||
* to make the check pass without changing the user-facing URL.
|
||||
*
|
||||
* Hooked only when modernization is on AND we're on the VideoPress admin page,
|
||||
* so this never affects any other request.
|
||||
*
|
||||
* @param \WP_Screen|null $screen The current screen object (passed by WP).
|
||||
* @return void
|
||||
*/
|
||||
public static function alias_screen_id_for_wp_build( $screen ) {
|
||||
if ( ! is_object( $screen ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$screen->id = 'jetpack-videopress-dashboard';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when the wp-build modernization filter is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_modernized() {
|
||||
return (bool) apply_filters( self::MODERNIZATION_FILTER, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when the current request targets the VideoPress admin page.
|
||||
*
|
||||
* Used to scope wp-build loading to the one page that needs it. The
|
||||
* `$_GET['page']` value is populated by wp-admin/admin.php before any of
|
||||
* our hooks fire, so this check is reliable from `init()` onwards.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function is_videopress_admin_request() {
|
||||
if ( ! is_admin() || ! isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return false;
|
||||
}
|
||||
|
||||
return sanitize_text_field( wp_unslash( $_GET['page'] ) ) === self::ADMIN_PAGE_SLUG; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
}
|
||||
}
|
||||
+293
@@ -0,0 +1,293 @@
|
||||
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
|
||||
/**
|
||||
* VideoPress AJAX action handlers and utilities.
|
||||
*
|
||||
* Note: this is also being used on WordPress.com.
|
||||
* Use IS_WPCOM checks for functionality that is specific to WPCOM/Jetpack.
|
||||
*/
|
||||
class AJAX {
|
||||
|
||||
/**
|
||||
* Singleton AJAX instance.
|
||||
*
|
||||
* @var AJAX
|
||||
**/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Private AJAX constructor.
|
||||
*
|
||||
* Use the AJAX::init() method to get an instance.
|
||||
*/
|
||||
private function __construct() {
|
||||
add_action( 'wp_ajax_videopress-get-upload-token', array( $this, 'wp_ajax_videopress_get_upload_token' ) );
|
||||
add_action( 'wp_ajax_videopress-get-upload-jwt', array( $this, 'wp_ajax_videopress_get_upload_jwt' ) );
|
||||
add_action( 'wp_ajax_nopriv_videopress-get-playback-jwt', array( $this, 'wp_ajax_videopress_get_playback_jwt' ) );
|
||||
add_action( 'wp_ajax_videopress-get-playback-jwt', array( $this, 'wp_ajax_videopress_get_playback_jwt' ) );
|
||||
|
||||
add_action(
|
||||
'wp_ajax_videopress-update-transcoding-status',
|
||||
array(
|
||||
$this,
|
||||
'wp_ajax_update_transcoding_status',
|
||||
),
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the AJAX and get back a singleton instance.
|
||||
*
|
||||
* @return AJAX
|
||||
*/
|
||||
public static function init() {
|
||||
if ( self::$instance === null ) {
|
||||
self::$instance = new AJAX();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a guid.
|
||||
*
|
||||
* @param string $guid The guid to validate.
|
||||
*
|
||||
* @return bool
|
||||
**/
|
||||
private function is_valid_guid( $guid ) {
|
||||
if ( empty( $guid ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
preg_match( '/^[a-z0-9]{8}$/i', $guid, $matches );
|
||||
|
||||
if ( empty( $matches ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax method that is used by the VideoPress player to get a token to play a video.
|
||||
*
|
||||
* This is used for both logged in and logged out users.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wp_ajax_videopress_get_playback_jwt() {
|
||||
$guid = filter_input( INPUT_POST, 'guid' );
|
||||
$embedded_post_id = filter_input( INPUT_POST, 'post_id', FILTER_VALIDATE_INT );
|
||||
$selected_plan_id = filter_input( INPUT_POST, 'subscription_plan_id' );
|
||||
|
||||
if ( empty( $embedded_post_id ) ) {
|
||||
$embedded_post_id = 0;
|
||||
}
|
||||
|
||||
if ( empty( $guid ) || ! $this->is_valid_guid( $guid ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'need a guid', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->is_current_user_authed_for_video( $guid, $embedded_post_id, $selected_plan_id ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'You cannot view this video.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$token = $this->request_jwt_from_wpcom( $guid );
|
||||
|
||||
if ( empty( $token ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress playback JWT. Please try again later. (empty upload token)', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_wp_error( $token ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload JWT. Please try again later.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_success( array( 'jwt' => $token ), null, JSON_UNESCAPED_SLASHES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user can view the provided video. Only ever gets fired if site-wide private videos are enabled.
|
||||
*
|
||||
* Filterable for 3rd party plugins.
|
||||
*
|
||||
* @param string $guid The video id being checked.
|
||||
* @param int $embedded_post_id The post id the video is embedded in or 0.
|
||||
* @param int $selected_plan_id The plan id the earn block this video is embedded in has.
|
||||
*/
|
||||
private function is_current_user_authed_for_video( $guid, $embedded_post_id, $selected_plan_id = 0 ) {
|
||||
return Access_Control::instance()->is_current_user_authed_for_video( $guid, $embedded_post_id, $selected_plan_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests JWT from wpcom.
|
||||
*
|
||||
* @param string $guid The video id being checked.
|
||||
*/
|
||||
private function request_jwt_from_wpcom( $guid ) {
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM && function_exists( 'video_wpcom_get_playback_jwt_for_guid' ) ) {
|
||||
$jwt_data = video_wpcom_get_playback_jwt_for_guid( $guid );
|
||||
if ( is_wp_error( $jwt_data ) ) {
|
||||
return false;
|
||||
}
|
||||
return $jwt_data->metadata_token;
|
||||
}
|
||||
|
||||
$video_blog_id = $this->get_videopress_blog_id();
|
||||
$args = array(
|
||||
'method' => 'POST',
|
||||
);
|
||||
|
||||
$endpoint = "sites/{$video_blog_id}/media/videopress-playback-jwt/{$guid}";
|
||||
$result = Client::wpcom_json_api_request_as_blog( $endpoint, 'v2', $args, null, 'wpcom' );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$response = json_decode( $result['body'], true );
|
||||
|
||||
if ( empty( $response['metadata_token'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response['metadata_token'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax method that is used by the VideoPress uploader to get a token to upload a file to the wpcom api.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wp_ajax_videopress_get_upload_jwt() {
|
||||
if ( ! current_user_can( 'upload_files' ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'You do not have permission to upload files.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$video_blog_id = $this->get_videopress_blog_id();
|
||||
$args = array(
|
||||
'method' => 'POST',
|
||||
);
|
||||
|
||||
$endpoint = "sites/{$video_blog_id}/media/videopress-upload-jwt";
|
||||
$result = Client::wpcom_json_api_request_as_blog( $endpoint, 'v2', $args, null, 'wpcom' );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload JWT. Please try again later.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$response = json_decode( $result['body'], true );
|
||||
|
||||
if ( empty( $response['upload_token'] ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload JWT. Please try again later. (empty upload token)', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$response['upload_action_url'] = videopress_make_resumable_upload_path( $video_blog_id );
|
||||
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_success( $response, null, JSON_UNESCAPED_SLASHES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax method that is used by the VideoPress uploader to get a token to upload a file to the wpcom api.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wp_ajax_videopress_get_upload_token() {
|
||||
if ( ! current_user_can( 'upload_files' ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'You do not have permission to upload files.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$video_blog_id = $this->get_videopress_blog_id();
|
||||
|
||||
$args = array(
|
||||
'method' => 'POST',
|
||||
);
|
||||
|
||||
$endpoint = "sites/{$video_blog_id}/media/token";
|
||||
$result = Client::wpcom_json_api_request_as_blog( $endpoint, Client::WPCOM_JSON_API_VERSION, $args );
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload token. Please try again later.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$response = json_decode( $result['body'], true );
|
||||
|
||||
if ( empty( $response['upload_token'] ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload token. Please try again later.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$response['upload_action_url'] = videopress_make_media_upload_path( $video_blog_id );
|
||||
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_success( $response, null, JSON_UNESCAPED_SLASHES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax action to update the video transcoding status from the WPCOM API.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wp_ajax_update_transcoding_status() {
|
||||
if ( ! isset( $_POST['post_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Informational AJAX response.
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'A valid post_id is required.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
$post_id = (int) $_POST['post_id']; // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
|
||||
if ( ! videopress_update_meta_data( $post_id ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
wp_send_json_error( array( 'message' => __( 'That post does not have a VideoPress video associated to it.', 'jetpack-videopress-pkg' ) ), null, JSON_UNESCAPED_SLASHES );
|
||||
return;
|
||||
}
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'message' => __( 'Status updated', 'jetpack-videopress-pkg' ),
|
||||
'status' => videopress_get_transcoding_status( $post_id ),
|
||||
),
|
||||
null, // @phan-suppress-current-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int.
|
||||
JSON_UNESCAPED_SLASHES
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the proper blog id depending on Jetpack or WP.com
|
||||
*
|
||||
* @return int the blog id
|
||||
*/
|
||||
public function get_videopress_blog_id() {
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
return get_current_blog_id();
|
||||
}
|
||||
|
||||
$options = Options::get_options();
|
||||
return $options['shadow_blog_id'];
|
||||
}
|
||||
}
|
||||
+389
@@ -0,0 +1,389 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Attachment_Handler
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
use Automattic\Jetpack\Current_Plan;
|
||||
use WP_Error;
|
||||
use WP_Post;
|
||||
|
||||
/**
|
||||
* VideoPress Attachment_Handler class.
|
||||
*/
|
||||
class Attachment_Handler {
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
* This method should be called only once by the Initializer class. Do not call this method again.
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
if ( ! Status::is_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'wp_get_attachment_url', array( __CLASS__, 'maybe_get_attached_url_for_videopress' ), 10, 2 );
|
||||
add_filter( 'get_attached_file', array( __CLASS__, 'maybe_get_attached_url_for_videopress' ), 10, 2 );
|
||||
|
||||
if ( Current_Plan::supports( 'videopress' ) ) {
|
||||
add_filter( 'upload_mimes', array( __CLASS__, 'add_video_upload_mimes' ), 999 );
|
||||
}
|
||||
|
||||
add_filter( 'pre_delete_attachment', array( __CLASS__, 'delete_video_wpcom' ), 10, 2 );
|
||||
add_filter( 'wp_mime_type_icon', array( __CLASS__, 'wp_mime_type_icon' ), 10, 3 );
|
||||
add_filter( 'wp_video_extensions', array( __CLASS__, 'add_videopress_extenstion' ) );
|
||||
|
||||
add_filter( 'wp_prepare_attachment_for_js', array( __CLASS__, 'prepare_attachment_for_js' ) );
|
||||
add_filter( 'ajax_query_attachments_args', array( __CLASS__, 'ajax_query_attachments_args' ) );
|
||||
add_action( 'pre_get_posts', array( __CLASS__, 'media_list_table_query' ) );
|
||||
|
||||
add_filter( 'user_has_cap', array( __CLASS__, 'disable_delete_if_disconnected' ), 10, 3 );
|
||||
|
||||
add_action( 'admin_print_scripts-upload.php', array( __CLASS__, 'enqueue_media_library_poll' ) );
|
||||
add_action( 'admin_print_styles-upload.php', array( __CLASS__, 'enqueue_media_library_styles' ) );
|
||||
add_filter( 'heartbeat_received', array( __CLASS__, 'heartbeat_received' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the VideoPress URL for the give post id, otherwise returns the provided default.
|
||||
*
|
||||
* This is an attachment-based filter handler.
|
||||
*
|
||||
* @param string $default The default return value if post id is not a VideoPress video.
|
||||
* @param int $post_id The post id for the current attachment.
|
||||
*/
|
||||
public static function maybe_get_attached_url_for_videopress( $default, $post_id ) {
|
||||
$videopress_url = videopress_get_attachment_url( $post_id );
|
||||
|
||||
if ( null !== $videopress_url ) {
|
||||
return $videopress_url;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that all video mimes are added in, as multi site installs can remove them.
|
||||
*
|
||||
* @param array $existing_mimes Mime types to extend/filter.
|
||||
* @return array
|
||||
*/
|
||||
public static function add_video_upload_mimes( $existing_mimes = array() ) {
|
||||
$mime_types = wp_get_mime_types();
|
||||
$video_types = array_filter( $mime_types, array( __CLASS__, 'filter_video_mimes' ) );
|
||||
|
||||
foreach ( $video_types as $key => $value ) {
|
||||
$existing_mimes[ $key ] = $value;
|
||||
}
|
||||
|
||||
// Make sure that videopress mimes are considered videos.
|
||||
$existing_mimes['videopress'] = 'video/videopress';
|
||||
|
||||
return $existing_mimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter designed to get rid of non video mime types.
|
||||
*
|
||||
* @param string $value Mime type to filter.
|
||||
* @return int
|
||||
*/
|
||||
public static function filter_video_mimes( $value ) {
|
||||
return preg_match( '@^video/@', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to delete a VideoPress video from wp.com.
|
||||
* Will block the deletion from continuing if certain errors return from the wp.com API.
|
||||
*
|
||||
* @param Boolean $delete if the deletion should occur or not (unused).
|
||||
* @param WP_Post $post the post object.
|
||||
*
|
||||
* @return null|WP_Error|Boolean null if deletion should continue.
|
||||
*/
|
||||
public static function delete_video_wpcom( $delete, $post ) {
|
||||
if ( ! is_videopress_attachment( $post->ID ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$guid = get_post_meta( $post->ID, 'videopress_guid', true );
|
||||
if ( empty( $guid ) ) {
|
||||
self::delete_video_poster_attachment( $post->ID );
|
||||
return null;
|
||||
}
|
||||
|
||||
// Phone home and have wp.com delete the VideoPress entry and files.
|
||||
$wpcom_response = Client::wpcom_json_api_request_as_blog(
|
||||
sprintf( '/videos/%s/delete', $guid ),
|
||||
'1.1',
|
||||
array( 'method' => 'POST' ),
|
||||
array( 'user_id' => get_current_user_id() )
|
||||
);
|
||||
|
||||
if ( is_wp_error( $wpcom_response ) ) {
|
||||
return $wpcom_response;
|
||||
}
|
||||
|
||||
// Upon success or a 404 (video already deleted on wp.com), return null to allow the deletion to continue.
|
||||
if ( 200 === $wpcom_response['response']['code'] || 404 === $wpcom_response['response']['code'] ) {
|
||||
self::delete_video_poster_attachment( $post->ID );
|
||||
return null;
|
||||
}
|
||||
|
||||
// Otherwise we stop the deletion from proceeding.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a video poster attachment if it exists.
|
||||
*
|
||||
* @param int $attachment_id the WP attachment id.
|
||||
*/
|
||||
private static function delete_video_poster_attachment( $attachment_id ) {
|
||||
$thumbnail_id = get_post_meta( $attachment_id, '_thumbnail_id', true );
|
||||
if ( ! empty( $thumbnail_id ) ) {
|
||||
// Let's ensure this is a VP poster image before we delete it.
|
||||
if ( '1' === get_post_meta( $thumbnail_id, 'videopress_poster_image', true ) ) {
|
||||
// This call triggers the `delete_video_wpcom` filter again but it bails early at the is_videopress_attachment() check.
|
||||
wp_delete_attachment( $thumbnail_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the mime type icon.
|
||||
*
|
||||
* @param string $icon Icon path.
|
||||
* @param string $mime Mime type.
|
||||
* @param int $post_id Post ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function wp_mime_type_icon( $icon, $mime, $post_id ) {
|
||||
|
||||
if ( $mime !== 'video/videopress' ) {
|
||||
return $icon;
|
||||
}
|
||||
|
||||
$status = get_post_meta( $post_id, 'videopress_status', true );
|
||||
|
||||
if ( $status === 'complete' ) {
|
||||
return $icon;
|
||||
}
|
||||
|
||||
return 'https://wordpress.com/wp-content/mu-plugins/videopress/images/media-video-processing-icon.png';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the list of supported video formats.
|
||||
*
|
||||
* @param array $extensions Supported video formats.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function add_videopress_extenstion( $extensions ) {
|
||||
$extensions[] = 'videopress';
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that any Video that has a VideoPress GUID passes that data back.
|
||||
*
|
||||
* @param array $post Attachment data array.
|
||||
* @return array
|
||||
*/
|
||||
public static function prepare_attachment_for_js( $post ) {
|
||||
if ( 'video' === $post['type'] ) {
|
||||
$guid = get_post_meta( $post['id'], 'videopress_guid', true );
|
||||
if ( $guid ) {
|
||||
$post['videopress_guid'] = $guid;
|
||||
}
|
||||
$status = get_post_meta( $post['id'], 'videopress_status', true );
|
||||
if ( $status ) {
|
||||
$post['videopress_status'] = $status;
|
||||
}
|
||||
}
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Media Grid:
|
||||
* Filter out any videopress video posters that we've downloaded,
|
||||
* so that they don't seem to display twice.
|
||||
*
|
||||
* @param array $args Query variables.
|
||||
*/
|
||||
public static function ajax_query_attachments_args( $args ) {
|
||||
$meta_query = array(
|
||||
array(
|
||||
'key' => 'videopress_poster_image',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
);
|
||||
|
||||
// If there was already a meta query, let's AND it via
|
||||
// nesting it with our new one. No need to specify the
|
||||
// relation, as it defaults to AND.
|
||||
if ( ! empty( $args['meta_query'] ) ) {
|
||||
$meta_query[] = $args['meta_query'];
|
||||
}
|
||||
$args['meta_query'] = $meta_query;
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Media List:
|
||||
* Do the same as `videopress_ajax_query_attachments_args()` but for the list view.
|
||||
*
|
||||
* @param array $query WP_Query instance.
|
||||
*/
|
||||
public static function media_list_table_query( $query ) {
|
||||
|
||||
if (
|
||||
! function_exists( 'get_current_screen' )
|
||||
|| get_current_screen() === null
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_admin() && $query->is_main_query() && ( 'upload' === get_current_screen()->id ) ) {
|
||||
$meta_query = array(
|
||||
array(
|
||||
'key' => 'videopress_poster_image',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
);
|
||||
|
||||
$old_meta_query = $query->get( 'meta_query' );
|
||||
if ( $old_meta_query ) {
|
||||
$meta_query[] = $old_meta_query;
|
||||
}
|
||||
|
||||
$query->set( 'meta_query', $meta_query );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to disable the `delete_post` capability
|
||||
* for VideoPress attachments if the current user is
|
||||
* not connected.
|
||||
*
|
||||
* @param array $allcaps All the capabilities of the user.
|
||||
* @param array $cap [0] Required capability.
|
||||
* @param array $args [0] Requested capability.
|
||||
* [1] User ID.
|
||||
* [2] Associated object ID.
|
||||
* @return array the filtered array of capabilities.
|
||||
*/
|
||||
public static function disable_delete_if_disconnected( $allcaps, $cap, $args ) {
|
||||
|
||||
// Only apply this filter to `delete_post` checks
|
||||
if ( ! isset( $args[0] ) || 'delete_post' !== $args[0] ) {
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
// Only apply this filter to VideoPress attachments
|
||||
if ( ! isset( $args[2] ) || ! is_videopress_attachment( $args[2] ) ) {
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
// Set the capability to false if the user can't perform the actions
|
||||
if ( ! Data::can_perform_action() ) {
|
||||
$allcaps[ $cap[0] ] = false;
|
||||
}
|
||||
|
||||
return $allcaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the script that hooks into WP Heartbeat to refresh
|
||||
* processing VideoPress video data in the media library grid.
|
||||
*
|
||||
* @since 0.35.4
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function enqueue_media_library_poll() {
|
||||
wp_enqueue_script(
|
||||
'videopress-media-library-poll',
|
||||
plugins_url( 'js/media-library-poll.js', __FILE__ ),
|
||||
array( 'jquery', 'heartbeat', 'media-grid' ),
|
||||
Package_Version::PACKAGE_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
add_filter( 'heartbeat_settings', array( __CLASS__, 'heartbeat_settings' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds inline styles for the media library grid on the upload page.
|
||||
*
|
||||
* @since 0.35.4
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function enqueue_media_library_styles() {
|
||||
// Constrain poster images so they fit within the media library grid cell.
|
||||
wp_add_inline_style(
|
||||
'media-views',
|
||||
'.attachment-preview.type-video .thumbnail .centered img.thumbnail { max-width: 100%; max-height: 100%; }'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lowers the Heartbeat minimum interval on the media library page
|
||||
* so the polling script can request a faster tick rate.
|
||||
*
|
||||
* @since 0.35.4
|
||||
*
|
||||
* @param array $settings Heartbeat settings.
|
||||
* @return array
|
||||
*/
|
||||
public static function heartbeat_settings( $settings ) {
|
||||
$settings['minimalInterval'] = 5;
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Heartbeat API handler that checks the processing status of VideoPress videos.
|
||||
*
|
||||
* @since 0.35.4
|
||||
*
|
||||
* @param array $response The Heartbeat response.
|
||||
* @param array $data The data sent with the Heartbeat request.
|
||||
* @return array
|
||||
*/
|
||||
public static function heartbeat_received( $response, $data ) {
|
||||
if ( empty( $data['videopress_processing_ids'] ) || ! is_array( $data['videopress_processing_ids'] ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$statuses = array();
|
||||
foreach ( $data['videopress_processing_ids'] as $id ) {
|
||||
$id = (int) $id;
|
||||
|
||||
if ( ! current_user_can( 'edit_post', $id ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$status = get_post_meta( $id, 'videopress_status', true );
|
||||
if ( $status ) {
|
||||
$statuses[ $id ] = $status;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $statuses ) ) {
|
||||
$response['videopress_processing_status'] = $statuses;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Block Editor Content
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use WP_Post;
|
||||
|
||||
/**
|
||||
* VideoPress block editor class for content generation
|
||||
*/
|
||||
class Block_Editor_Content {
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
* This method should be called only once by the Initializer class. Do not call this method again.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( ! Status::is_standalone_plugin_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the videopress shortcodes added by the Jetpack plugin.
|
||||
if ( shortcode_exists( 'videopress' ) ) {
|
||||
remove_shortcode( 'videopress' );
|
||||
}
|
||||
if ( shortcode_exists( 'wpvideo' ) ) {
|
||||
remove_shortcode( 'wpvideo' );
|
||||
}
|
||||
|
||||
add_shortcode( 'videopress', array( static::class, 'videopress_embed_shortcode' ) );
|
||||
add_shortcode( 'wpvideo', array( static::class, 'videopress_embed_shortcode' ) );
|
||||
|
||||
add_filter( 'wp_video_shortcode_override', array( static::class, 'video_shortcode_override' ), 10, 4 );
|
||||
|
||||
add_filter( 'default_content', array( static::class, 'videopress_video_block_by_guid' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* VideoPress embed shortcode
|
||||
*
|
||||
* Expected input format:
|
||||
* [videopress tLvEwHYZ]
|
||||
*
|
||||
* @param array $atts Shortcode attributes.
|
||||
*
|
||||
* @return string html
|
||||
*/
|
||||
public static function videopress_embed_shortcode( $atts ) {
|
||||
/**
|
||||
* We only accept GUIDs as a first unnamed argument.
|
||||
*/
|
||||
$guid = $atts[0] ?? null;
|
||||
|
||||
/**
|
||||
* Make sure the GUID passed in matches how actual GUIDs are formatted.
|
||||
*/
|
||||
if ( ! videopress_is_valid_guid( $guid ) ) {
|
||||
return '<!-- error: missing or invalid VideoPress video ID -->';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the defaults
|
||||
*/
|
||||
$defaults = array(
|
||||
'w' => 640, // Width of the video player, in pixels
|
||||
'h' => 0, // Height of the video player, in pixels
|
||||
'at' => 0, // How many seconds in to initially seek to
|
||||
'loop' => false, // Whether to loop the video repeatedly
|
||||
'autoplay' => false, // Whether to autoplay the video on load
|
||||
'cover' => true, // Whether to scale the video to its container
|
||||
'muted' => false, // Whether the video should start without sound
|
||||
'controls' => true, // Whether the video should display controls
|
||||
'playsinline' => false, // Whether the video should be allowed to play inline (for browsers that support this)
|
||||
'useaveragecolor' => false, // Whether the video should use the seekbar automatic average color
|
||||
'preloadcontent' => 'metadata',
|
||||
);
|
||||
|
||||
// Make sure "false" will be actually false.
|
||||
foreach ( $atts as $key => $value ) {
|
||||
if ( is_string( $value ) && 'false' === strtolower( $value ) ) {
|
||||
$atts[ $key ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $atts['preload'] ) && videopress_is_valid_preload( $atts['preload'] ) ) {
|
||||
$atts['preloadcontent'] = $atts['preload'];
|
||||
}
|
||||
|
||||
if ( isset( $atts['preloadcontent'] ) && ! videopress_is_valid_preload( $atts['preloadcontent'] ) ) {
|
||||
unset( $atts['preloadcontent'] );
|
||||
}
|
||||
|
||||
$atts = shortcode_atts( $defaults, $atts, 'videopress' );
|
||||
|
||||
$base_url = 'https://videopress.com/embed/' . $guid;
|
||||
$query_params = array(
|
||||
'at' => $atts['at'],
|
||||
'loop' => $atts['loop'],
|
||||
'autoplay' => $atts['autoplay'],
|
||||
'muted' => $atts['muted'],
|
||||
'controls' => $atts['controls'],
|
||||
'playsinline' => $atts['playsinline'],
|
||||
'useAverageColor' => $atts['useaveragecolor'], // The casing is intentional, shortcode params are lowercase, but player expects useAverageColor
|
||||
'preloadContent' => $atts['preloadcontent'], // The casing is intentional, shortcode params are lowercase, but player expects preloadContent
|
||||
);
|
||||
$src = esc_url( add_query_arg( $query_params, $base_url ) );
|
||||
|
||||
$width = absint( $atts['w'] );
|
||||
if ( ! $atts['h'] ) {
|
||||
$aspect_ratio = 16 / 9; // TODO: Get the correct aspect ratio for the video.
|
||||
$height = $width / $aspect_ratio;
|
||||
} else {
|
||||
$height = absint( $atts['h'] );
|
||||
}
|
||||
|
||||
$cover = $atts['cover'] ? ' data-resize-to-parent="true"' : '';
|
||||
|
||||
$block_template =
|
||||
'<figure class="wp-block-videopress-video wp-block-jetpack-videopress jetpack-videopress-player">' .
|
||||
'<div class="jetpack-videopress-player__wrapper">' .
|
||||
'<iframe ' .
|
||||
'title="' . __( 'VideoPress Video Player', 'jetpack-videopress-pkg' ) . '" ' .
|
||||
'aria-label="' . __( 'VideoPress Video Player', 'jetpack-videopress-pkg' ) . '" ' .
|
||||
'src="%s" ' .
|
||||
'width="%s"' .
|
||||
'height="%s" ' .
|
||||
'frameborder="0" ' .
|
||||
'allowfullscreen%s allow="clipboard-write">' .
|
||||
'</iframe>' .
|
||||
'</div>' .
|
||||
'</figure>';
|
||||
|
||||
$version = Package_Version::PACKAGE_VERSION;
|
||||
Jwt_Token_Bridge::enqueue_jwt_token_bridge();
|
||||
wp_enqueue_script( 'videopress-iframe', 'https://videopress.com/videopress-iframe.js', array(), $version, true );
|
||||
|
||||
return sprintf( $block_template, $src, $width, $height, $cover );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a VideoPress video block content with the given guid
|
||||
*
|
||||
* @param string $content Post content.
|
||||
* @param WP_Post $post Post.
|
||||
* @return string
|
||||
*/
|
||||
public static function videopress_video_block_by_guid( $content, $post ) {
|
||||
if ( isset( $_GET['videopress_guid'] ) && isset( $_GET['_wpnonce'] )
|
||||
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'videopress-content-nonce' )
|
||||
&& current_user_can( 'edit_post', $post->ID )
|
||||
&& '' === $content
|
||||
) {
|
||||
$guid = sanitize_text_field( wp_unslash( $_GET['videopress_guid'] ) );
|
||||
|
||||
$base_url = 'https://videopress.com/v/' . $guid;
|
||||
$query_params = array(
|
||||
'resizeToParent' => 'true',
|
||||
'cover' => 'true',
|
||||
'preloadContent' => 'metadata',
|
||||
'useAverageColor' => 'true',
|
||||
);
|
||||
$url = esc_url( add_query_arg( $query_params, $base_url ) );
|
||||
|
||||
if ( ! empty( $guid ) ) {
|
||||
// ref /client/lib/url/index.ts
|
||||
$content = '<!-- wp:videopress/video {"guid":"' . $guid . '"} -->
|
||||
<figure class="wp-block-videopress-video wp-block-jetpack-videopress jetpack-videopress-player">
|
||||
<div class="jetpack-videopress-player__wrapper">' . $url . '</div>
|
||||
</figure>
|
||||
<!-- /wp:videopress/video -->';
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the standard video short tag to also process videopress files as well.
|
||||
*
|
||||
* This will parse the given src and, if it is a videopress file, parse as the
|
||||
* VideoPress shortcode instead.
|
||||
*
|
||||
* @param string $html Empty variable to be replaced with shortcode markup.
|
||||
* @param array $attr Attributes of the video shortcode.
|
||||
* @param string $content Video shortcode content.
|
||||
* @param int $instance Unique numeric ID of this video shortcode instance.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function video_shortcode_override( $html, $attr, $content, $instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
$videopress_guid = null;
|
||||
|
||||
if ( isset( $attr['videopress_guid'] ) ) {
|
||||
$videopress_guid = $attr['videopress_guid'];
|
||||
} else {
|
||||
// Handle the different possible url attributes
|
||||
$url_keys = array( 'src', 'mp4' );
|
||||
|
||||
foreach ( $url_keys as $key ) {
|
||||
if ( isset( $attr[ $key ] ) ) {
|
||||
$url = $attr[ $key ];
|
||||
// phpcs:ignore WordPress.WP.CapitalPDangit
|
||||
if ( preg_match( '@videos.(videopress\.com|files\.wordpress\.com)/([a-z0-9]{8})/@i', $url, $matches ) ) {
|
||||
$videopress_guid = $matches[2];
|
||||
}
|
||||
|
||||
// Also test for videopress oembed url, which is used by the Video Media Widget.
|
||||
if ( ! $videopress_guid && preg_match( '@https://videopress.com/v/([a-z0-9]{8})@i', $url, $matches ) ) {
|
||||
$videopress_guid = $matches[1];
|
||||
}
|
||||
|
||||
// Also test for old v.wordpress.com oembed URL.
|
||||
if ( ! $videopress_guid && preg_match( '|^https?://v\.wordpress\.com/([a-zA-Z\d]{8})(.+)?$|i', $url, $matches ) ) { // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
|
||||
$videopress_guid = $matches[1];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $videopress_guid ) {
|
||||
$videopress_atts = array( $videopress_guid );
|
||||
|
||||
// height is ignored on jetpack video block, so we don't pass it for consistency.
|
||||
if ( isset( $attr['width'] ) ) {
|
||||
$videopress_atts['w'] = (int) $attr['width'];
|
||||
}
|
||||
if ( isset( $attr['muted'] ) ) {
|
||||
$videopress_atts['muted'] = $attr['muted'];
|
||||
}
|
||||
if ( isset( $attr['autoplay'] ) ) {
|
||||
$videopress_atts['autoplay'] = $attr['autoplay'];
|
||||
}
|
||||
if ( isset( $attr['loop'] ) ) {
|
||||
$videopress_atts['loop'] = $attr['loop'];
|
||||
}
|
||||
// The core video block doesn't support the cover attribute, setting it to false for consistency.
|
||||
$videopress_atts['cover'] = false;
|
||||
|
||||
// Then display the VideoPress version of the stored GUID!
|
||||
return self::videopress_embed_shortcode( $videopress_atts );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Extensions
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Initial_State as Connection_Initial_State;
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
|
||||
/**
|
||||
* VideoPress Extensions class.
|
||||
*/
|
||||
class Block_Editor_Extensions {
|
||||
/**
|
||||
* What version of the blocks we are loading.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $blocks_variation = 'production';
|
||||
|
||||
/**
|
||||
* Script handle
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $script_handle = '';
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
* This method should be called only once by the Block registrar.
|
||||
* Do not call this method again.
|
||||
*
|
||||
* @param string $script_handle - The script handle.
|
||||
*/
|
||||
public static function init( $script_handle ) {
|
||||
if ( ! Status::is_registrant_plugin_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the videopress/video editor script handle to localize enqueue scripts.
|
||||
* @see https://developer.wordpress.org/reference/functions/generate_block_asset_handle
|
||||
*/
|
||||
self::$script_handle = $script_handle;
|
||||
|
||||
/**
|
||||
* Alternative to `JETPACK_BETA_BLOCKS`, set to `true` to load Beta Blocks.
|
||||
*
|
||||
* @since 6.9.0
|
||||
* @deprecated Jetpack 11.8.0 Use jetpack_blocks_variation filter instead.
|
||||
*
|
||||
* @param boolean
|
||||
*/
|
||||
if (
|
||||
apply_filters_deprecated(
|
||||
'jetpack_load_beta_blocks',
|
||||
array( false ),
|
||||
'jetpack-11.8.0',
|
||||
'jetpack_blocks_variation'
|
||||
)
|
||||
) {
|
||||
self::$blocks_variation = 'beta';
|
||||
}
|
||||
|
||||
/*
|
||||
* Get block variation, from the new constant or the old one.
|
||||
*/
|
||||
if ( Constants::is_true( 'JETPACK_BETA_BLOCKS' ) ) {
|
||||
self::$blocks_variation = 'beta';
|
||||
}
|
||||
|
||||
$blocks_variation = Constants::get_constant( 'JETPACK_BLOCKS_VARIATION' );
|
||||
if ( ! empty( $blocks_variation ) ) {
|
||||
/**
|
||||
* Allow customizing the variation of blocks in use on a site.
|
||||
* Overwrites any previously set values, whether by constant or filter.
|
||||
*
|
||||
* @since Jetpack 8.1.0
|
||||
*
|
||||
* @param string $block_variation Can be beta, experimental, and production. Defaults to production.
|
||||
*/
|
||||
self::$blocks_variation = apply_filters( 'jetpack_blocks_variation', $blocks_variation );
|
||||
}
|
||||
|
||||
// Register the script.
|
||||
add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'enqueue_extensions' ), 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extensions list
|
||||
*
|
||||
* @return array The extensions list.
|
||||
*/
|
||||
public static function get_list() {
|
||||
$videopress_extensions_file = __DIR__ . '/../build/block-editor/extensions/index.json';
|
||||
$videopress_extensions_file_exists = file_exists( $videopress_extensions_file );
|
||||
if ( ! $videopress_extensions_file_exists ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$videopress_extensions_data = (array) json_decode(
|
||||
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
file_get_contents( $videopress_extensions_file )
|
||||
);
|
||||
|
||||
$extensions_list = array_map(
|
||||
function ( $extension ) {
|
||||
return array(
|
||||
'name' => $extension,
|
||||
'isBeta' => true,
|
||||
'isEnabled' => 'beta' === self::$blocks_variation,
|
||||
);
|
||||
},
|
||||
$videopress_extensions_data['beta']
|
||||
);
|
||||
|
||||
return $extensions_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the extension is available
|
||||
*
|
||||
* @param string $slug The extension slug.
|
||||
* @return boolean True if the extension is available, false otherwise.
|
||||
*/
|
||||
public static function is_extension_available( $slug ) {
|
||||
$extensions_list = self::get_list();
|
||||
foreach ( $extensions_list as $extension ) {
|
||||
if ( $extension['name'] === $slug ) {
|
||||
return $extension['isEnabled'];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the extensions script.
|
||||
*/
|
||||
public static function enqueue_extensions() {
|
||||
$extensions_list = self::get_list();
|
||||
|
||||
$site_type = 'jetpack';
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
$site_type = 'simple';
|
||||
} elseif ( ( new Host() )->is_woa_site() ) {
|
||||
$site_type = 'atomic';
|
||||
}
|
||||
|
||||
$videopress_editor_state = array(
|
||||
'extensions' => $extensions_list,
|
||||
'siteType' => $site_type,
|
||||
'myJetpackConnectUrl' => admin_url( 'admin.php?page=my-jetpack#/connection' ),
|
||||
'jetpackVideoPressSettingUrl' => admin_url( 'admin.php?page=jetpack#/settings?term=videopress' ),
|
||||
'isVideoPressModuleActive' => Status::is_jetpack_plugin_and_videopress_module_active(),
|
||||
'isStandaloneActive' => Status::is_standalone_plugin_active(),
|
||||
'imagesURLBase' => plugin_dir_url( __DIR__ ) . 'build/images/',
|
||||
'playerBridgeUrl' => plugins_url( '../build/lib/player-bridge.js', __FILE__ ),
|
||||
);
|
||||
|
||||
// Expose initial state of site connection
|
||||
Connection_Initial_State::render_script( self::$script_handle );
|
||||
|
||||
// Expose initial state of videoPress editor
|
||||
wp_localize_script( self::$script_handle, 'videoPressEditorState', $videopress_editor_state );
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Media block replacement class.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
**/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* Class Block_Replacement
|
||||
**/
|
||||
class Block_Replacement {
|
||||
/**
|
||||
* Whether the class has been initiated.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private static $initiated = false;
|
||||
|
||||
/**
|
||||
* Initialize replacement.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( self::$initiated ) {
|
||||
return;
|
||||
}
|
||||
add_filter( 'render_block', array( self::class, 'replace_media_text_with_videopress' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace video in Media & Text block with Videopress shortcode.
|
||||
*
|
||||
* @param string $block_content The block content.
|
||||
* @param array $block The block.
|
||||
* @return string
|
||||
*/
|
||||
public static function replace_media_text_with_videopress( $block_content, $block ) {
|
||||
if ( isset( $block['blockName'] ) && $block['blockName'] === 'core/media-text' ) {
|
||||
|
||||
// Make sure we have a $post_id that could be valid; if we don't, then video_get_info_by_blogpostid()
|
||||
// will fail, so there's no point in calling it.
|
||||
$post_id = isset( $block['attrs']['mediaId'] ) ? (int) $block['attrs']['mediaId'] : 0;
|
||||
if ( $post_id <= 0 ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$video_info = video_get_info_by_blogpostid( get_current_blog_id(), $post_id );
|
||||
if ( $video_info && $video_info->guid ) {
|
||||
$videopress_shortcode = sprintf( '[videopress %s]', esc_attr( $video_info->guid ) );
|
||||
$block_content = preg_replace( '/<video.*?<\/video>/is', do_shortcode( $videopress_shortcode ), $block_content );
|
||||
}
|
||||
}
|
||||
return $block_content;
|
||||
}
|
||||
}
|
||||
+443
@@ -0,0 +1,443 @@
|
||||
<?php
|
||||
/**
|
||||
* The Data class.
|
||||
* This class provides methods for data VideoPress access and manipulation.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
use WP_REST_Request;
|
||||
/**
|
||||
* The Data class.
|
||||
*/
|
||||
class Data {
|
||||
|
||||
/**
|
||||
* Gets the Jetpack blog ID
|
||||
*
|
||||
* @return int The blog ID
|
||||
*/
|
||||
public static function get_blog_id() {
|
||||
return VideoPressToken::blog_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the VideoPress site privacy configuration.
|
||||
*
|
||||
* @return boolean If all the videos are private on the site
|
||||
*/
|
||||
public static function get_videopress_videos_private_for_site() {
|
||||
/**
|
||||
* If it's a Simple site, returns the site privacy setting.
|
||||
*/
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
return video_is_private_wpcom_blog( get_current_blog_id() );
|
||||
}
|
||||
/**
|
||||
* If it's a private Atomic site, the default setting is private as well.
|
||||
*/
|
||||
if ( ( new Host() )->is_woa_site() ) {
|
||||
if ( ( intval( get_option( 'blog_public', '' ) ) === -1 ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* If it's a Jetpack site or a public Atomic site, check the settings */
|
||||
return boolval( get_option( 'videopress_private_enabled_for_site', false ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the VideoPress Settings.
|
||||
*
|
||||
* @return array The settings as an associative array.
|
||||
*/
|
||||
public static function get_videopress_settings() {
|
||||
$site_type = 'jetpack';
|
||||
$site_is_private = false;
|
||||
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
$site_type = 'simple';
|
||||
$site_is_private = video_is_private_wpcom_blog( get_current_blog_id() );
|
||||
} elseif ( ( new Host() )->is_woa_site() ) {
|
||||
$site_type = 'atomic';
|
||||
$site_is_private = intval( get_option( 'blog_public', '' ) ) === -1;
|
||||
}
|
||||
|
||||
return array(
|
||||
'videopress_videos_private_for_site' => self::get_videopress_videos_private_for_site(),
|
||||
'site_is_private' => $site_is_private,
|
||||
'site_type' => $site_type,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the video data
|
||||
*
|
||||
* @param boolean $is_videopress - True when getting VideoPress data.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_video_data( $is_videopress = true ) {
|
||||
$video_data = array(
|
||||
'videos' => array(),
|
||||
'total' => 0,
|
||||
'totalPages' => 0,
|
||||
'query' => array(
|
||||
'order' => 'desc',
|
||||
'orderBy' => 'date',
|
||||
'itemsPerPage' => 6,
|
||||
'page' => 1,
|
||||
),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'order' => $video_data['query']['order'],
|
||||
'orderby' => $video_data['query']['orderBy'],
|
||||
'per_page' => $video_data['query']['itemsPerPage'],
|
||||
'page' => $video_data['query']['page'],
|
||||
);
|
||||
|
||||
if ( $is_videopress ) {
|
||||
$args['mime_type'] = 'video/videopress';
|
||||
} else {
|
||||
$args['media_type'] = 'video';
|
||||
$args['no_videopress'] = true;
|
||||
}
|
||||
|
||||
// Do an internal request for the media list
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
|
||||
$request->set_query_params( $args );
|
||||
$response = rest_do_request( $request );
|
||||
|
||||
if ( $response->is_error() ) {
|
||||
// @todo: error handling
|
||||
return $video_data;
|
||||
}
|
||||
|
||||
// load the real values
|
||||
$video_data['videos'] = $response->get_data();
|
||||
$headers = $response->get_headers();
|
||||
|
||||
if ( isset( $headers['X-WP-Total'] ) ) {
|
||||
$video_data['total'] = $headers['X-WP-Total'];
|
||||
}
|
||||
|
||||
if ( isset( $headers['X-WP-TotalPages'] ) ) {
|
||||
$video_data['totalPages'] = $headers['X-WP-TotalPages'];
|
||||
}
|
||||
|
||||
return $video_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_user_data() {
|
||||
$user_data = array(
|
||||
'items' => array(),
|
||||
'pagination' => array(
|
||||
'total' => 0,
|
||||
'totalPages' => 1,
|
||||
),
|
||||
'query' => array(
|
||||
'order' => 'asc',
|
||||
'orderBy' => 'name',
|
||||
),
|
||||
'_meta' => array(
|
||||
'relyOnInitialState' => true,
|
||||
),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'order' => $user_data['query']['order'],
|
||||
'orderby' => $user_data['query']['orderBy'],
|
||||
);
|
||||
|
||||
// Do an internal request for the user list
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/users' );
|
||||
$request->set_query_params( $args );
|
||||
$response = rest_do_request( $request );
|
||||
|
||||
if ( $response->is_error() ) {
|
||||
// @todo: error handling
|
||||
return $user_data;
|
||||
}
|
||||
|
||||
// load the real values
|
||||
$user_data['items'] = $response->get_data();
|
||||
$headers = $response->get_headers();
|
||||
|
||||
if ( isset( $headers['X-WP-Total'] ) ) {
|
||||
$user_data['pagination']['total'] = $headers['X-WP-Total'];
|
||||
}
|
||||
|
||||
if ( isset( $headers['X-WP-TotalPages'] ) ) {
|
||||
$user_data['pagination']['totalPages'] = $headers['X-WP-TotalPages'];
|
||||
}
|
||||
|
||||
return $user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the VideoPress used storage space in bytes
|
||||
*
|
||||
* @return int the used storage space
|
||||
*/
|
||||
public static function get_storage_used() {
|
||||
$site_data = Site::get_site_info();
|
||||
if ( is_wp_error( $site_data ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( isset( $site_data['options'] ) && isset( $site_data['options']['videopress_storage_used'] ) ) {
|
||||
return intval( round( $site_data['options']['videopress_storage_used'] * 1024 * 1024 ) );
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the initial state that depends on a valid site connection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_connected_initial_state() {
|
||||
return array(
|
||||
'videos' => array(
|
||||
'storageUsed' => self::get_storage_used(),
|
||||
),
|
||||
'purchases' => array(
|
||||
'items' => Site::get_purchases(),
|
||||
'isFetching' => false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the site has as connected owner
|
||||
*/
|
||||
public static function has_connected_owner() {
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ( new Connection_Manager() )->has_connected_owner() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is able to perform actions that modify data
|
||||
*/
|
||||
public static function can_perform_action() {
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$connection = new Connection_Manager();
|
||||
|
||||
return (
|
||||
$connection->is_connected() &&
|
||||
self::has_connected_owner() &&
|
||||
$connection->is_user_connected()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initial state of the VideoPress app,
|
||||
* used to render initially the app in the frontend.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_initial_state() {
|
||||
$videopress_data = self::get_video_data();
|
||||
$local_videos_data = self::get_video_data( false );
|
||||
|
||||
// Tweak local videos data.
|
||||
$local_videos = array_map(
|
||||
function ( $video ) {
|
||||
$video = (array) $video;
|
||||
$id = $video['id'];
|
||||
$media_details = $video['media_details'];
|
||||
$jetpack_videopress = $video['jetpack_videopress'];
|
||||
$read_error = null;
|
||||
|
||||
// In malformed files, the media_details or jetpack_videopress properties are not arrays.
|
||||
if ( ! is_array( $media_details ) || ! is_array( $jetpack_videopress ) ) {
|
||||
$media_details = (array) $media_details;
|
||||
$jetpack_videopress = (array) $jetpack_videopress;
|
||||
$read_error = Upload_Exception::ERROR_MALFORMED_FILE;
|
||||
}
|
||||
|
||||
// Check if video is already uploaded to VideoPress or has some error.
|
||||
try {
|
||||
$uploader = new Uploader( $id );
|
||||
$is_uploaded_to_videopress = $uploader->is_uploaded();
|
||||
} catch ( Upload_Exception $e ) {
|
||||
$is_uploaded_to_videopress = false;
|
||||
$read_error = $e->getCode();
|
||||
}
|
||||
|
||||
$upload_date = $video['date'];
|
||||
$url = $video['source_url'];
|
||||
|
||||
$title = $jetpack_videopress['title'];
|
||||
$description = $jetpack_videopress['description'];
|
||||
$caption = $jetpack_videopress['caption'];
|
||||
|
||||
$width = $media_details['width'] ?? null;
|
||||
$height = $media_details['height'] ?? null;
|
||||
$duration = $media_details['length'] ?? null;
|
||||
|
||||
return array(
|
||||
'id' => $id,
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'caption' => $caption,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'url' => $url,
|
||||
'uploadDate' => $upload_date,
|
||||
'duration' => $duration,
|
||||
'isUploadedToVideoPress' => $is_uploaded_to_videopress,
|
||||
'readError' => $read_error,
|
||||
);
|
||||
},
|
||||
$local_videos_data['videos']
|
||||
);
|
||||
|
||||
// Tweak VideoPress videos data.
|
||||
$videos = array_map(
|
||||
array( __CLASS__, 'prepare_videopress_video_data' ),
|
||||
$videopress_data['videos']
|
||||
);
|
||||
|
||||
$site_settings = self::get_videopress_settings();
|
||||
|
||||
$initial_state = array(
|
||||
'users' => self::get_user_data(),
|
||||
'siteSettings' => array(
|
||||
'videoPressVideosPrivateForSite' => $site_settings['videopress_videos_private_for_site'],
|
||||
'siteIsPrivate' => $site_settings['site_is_private'],
|
||||
'siteType' => $site_settings['site_type'],
|
||||
),
|
||||
'videos' => array(
|
||||
'uploadedVideoCount' => $videopress_data['total'],
|
||||
'items' => $videos,
|
||||
'isFetching' => false,
|
||||
'isFetchingUploadedVideoCount' => false,
|
||||
'pagination' => array(
|
||||
'totalPages' => $videopress_data['totalPages'],
|
||||
'total' => $videopress_data['total'],
|
||||
),
|
||||
'query' => $videopress_data['query'],
|
||||
'_meta' => array(
|
||||
'processedAllVideosBeingRemoved' => true,
|
||||
'relyOnInitialState' => true,
|
||||
),
|
||||
),
|
||||
'localVideos' => array(
|
||||
'uploadedVideoCount' => $local_videos_data['total'],
|
||||
'items' => $local_videos,
|
||||
'isFetching' => false,
|
||||
'isFetchingUploadedVideoCount' => false,
|
||||
'pagination' => array(
|
||||
'totalPages' => $local_videos_data['totalPages'],
|
||||
'total' => $local_videos_data['total'],
|
||||
),
|
||||
'query' => $local_videos_data['query'],
|
||||
'_meta' => array(
|
||||
'relyOnInitialState' => true,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if ( self::has_connected_owner() ) {
|
||||
return array_merge_recursive( $initial_state, self::get_connected_initial_state() );
|
||||
}
|
||||
|
||||
return $initial_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a single VideoPress video, as returned by the media REST endpoint, to
|
||||
* the shape consumed by the VideoPress dashboard app.
|
||||
*
|
||||
* Videos that are still processing (or otherwise have partial metadata) come
|
||||
* back without `videopress`, `width` or `height` in their media_details, so
|
||||
* every nested access is coalesced to avoid undefined-key and offset-on-null
|
||||
* warnings.
|
||||
*
|
||||
* @param array|object $video A single video entry from the media REST endpoint.
|
||||
* @return array The video data formatted for the dashboard app.
|
||||
*/
|
||||
private static function prepare_videopress_video_data( $video ) {
|
||||
$video = (array) $video;
|
||||
$id = $video['id'];
|
||||
$guid = $video['jetpack_videopress_guid'];
|
||||
$media_details = (array) $video['media_details'];
|
||||
$jetpack_videopress = (array) $video['jetpack_videopress'];
|
||||
|
||||
$videopress_media_details = $media_details['videopress'] ?? array();
|
||||
$width = $media_details['width'] ?? null;
|
||||
$height = $media_details['height'] ?? null;
|
||||
|
||||
$title = $jetpack_videopress['title'];
|
||||
$description = $jetpack_videopress['description'];
|
||||
$caption = $jetpack_videopress['caption'];
|
||||
$rating = $jetpack_videopress['rating'];
|
||||
$allow_download = $jetpack_videopress['allow_download'];
|
||||
$display_embed = $jetpack_videopress['display_embed'];
|
||||
$privacy_setting = $jetpack_videopress['privacy_setting'];
|
||||
$needs_playback_token = $jetpack_videopress['needs_playback_token'];
|
||||
$is_private = $jetpack_videopress['is_private'];
|
||||
|
||||
$original = $videopress_media_details['original'] ?? null;
|
||||
$poster = ( ! $needs_playback_token ) ? ( $videopress_media_details['poster'] ?? null ) : null;
|
||||
$upload_date = $videopress_media_details['upload_date'] ?? null;
|
||||
$duration = $videopress_media_details['duration'] ?? null;
|
||||
$file_url_base = $videopress_media_details['file_url_base'] ?? null;
|
||||
$finished = $videopress_media_details['finished'] ?? null;
|
||||
$files = $videopress_media_details['files'] ?? null;
|
||||
$filename = $original !== null ? basename( $original ) : null;
|
||||
|
||||
if ( isset( $files['dvd']['original_img'] ) && isset( $file_url_base['https'] ) && $privacy_setting !== 1 ) {
|
||||
$thumbnail = $file_url_base['https'] . $files['dvd']['original_img'];
|
||||
} else {
|
||||
$thumbnail = null;
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => $id,
|
||||
'guid' => $guid,
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'caption' => $caption,
|
||||
'url' => $original,
|
||||
'uploadDate' => $upload_date,
|
||||
'duration' => $duration,
|
||||
'isPrivate' => $is_private,
|
||||
'posterImage' => $poster,
|
||||
'allowDownload' => $allow_download,
|
||||
'displayEmbed' => $display_embed,
|
||||
'rating' => $rating,
|
||||
'privacySetting' => $privacy_setting,
|
||||
'needsPlaybackToken' => $needs_playback_token,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'poster' => array(
|
||||
'src' => $poster,
|
||||
),
|
||||
'thumbnail' => $thumbnail,
|
||||
'finished' => $finished,
|
||||
'filename' => $filename,
|
||||
);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Divi integration for Videopress.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
**/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\VideoPress\Divi5\Divi_5;
|
||||
|
||||
/**
|
||||
* Class Divi
|
||||
**/
|
||||
class Divi {
|
||||
/**
|
||||
* The instance.
|
||||
*
|
||||
* @var Divi
|
||||
**/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Running or not.
|
||||
*
|
||||
* @var bool
|
||||
**/
|
||||
private $running = false;
|
||||
|
||||
/**
|
||||
* VideoPress Divi Extension object.
|
||||
*
|
||||
* @var ?\VideoPress_Divi_Extension
|
||||
**/
|
||||
private $vidi_extension;
|
||||
|
||||
/**
|
||||
* Initializes VideoPress/Divi integration.
|
||||
*
|
||||
* Called only once by the Initializer class
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function init() {
|
||||
return self::get_instance()->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the extension.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function run() {
|
||||
if ( $this->running ) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->running = true;
|
||||
add_action( 'divi_extensions_init', array( $this, 'initialize_extension' ) );
|
||||
add_action( 'et_fb_framework_loaded', array( $this, 'on_fb_framework_loaded' ) );
|
||||
|
||||
// Divi 5 integration. These hooks only fire under Divi 5; the legacy
|
||||
// extension above continues to serve Divi 4.
|
||||
Divi_5::init();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires when the Frontend Builder is loaded.
|
||||
*/
|
||||
public function on_fb_framework_loaded() {
|
||||
Jwt_Token_Bridge::enqueue_jwt_token_bridge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the extension's main class instance.
|
||||
*/
|
||||
public function initialize_extension() {
|
||||
require_once plugin_dir_path( __FILE__ ) . 'videopress-divi/class-videopress-divi-extension.php';
|
||||
$this->vidi_extension = new \VideoPress_Divi_Extension();
|
||||
}
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* The modernized VideoPress dashboard React initial state.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Initial_State as Connection_Initial_State;
|
||||
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
|
||||
use Automattic\Jetpack\My_Jetpack\Product;
|
||||
use Automattic\Jetpack\My_Jetpack\Products as My_Jetpack_Products;
|
||||
use Automattic\Jetpack\Status;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
use Jetpack_Options;
|
||||
use function admin_url;
|
||||
use function esc_url_raw;
|
||||
use function get_bloginfo;
|
||||
use function get_locale;
|
||||
use function get_option;
|
||||
use function get_site_url;
|
||||
use function plugins_url;
|
||||
use function rest_url;
|
||||
use function wp_add_inline_script;
|
||||
use function wp_create_nonce;
|
||||
use function wp_json_encode;
|
||||
use function wp_parse_url;
|
||||
use function wp_script_is;
|
||||
|
||||
/**
|
||||
* The modernized VideoPress dashboard React initial state.
|
||||
*
|
||||
* Mirrors the Activity Log dashboard pattern: a small structured payload
|
||||
* inlined as `var JPVIDEOPRESS_INITIAL_STATE=...` before the wp-build boot
|
||||
* script runs. Phases 6 and 8 will consume the payload via per-file
|
||||
* `declare const` ambient types.
|
||||
*/
|
||||
class Initial_State {
|
||||
|
||||
const SCRIPT_HANDLE = 'jetpack-videopress-dashboard-wp-admin-prerequisites';
|
||||
|
||||
/**
|
||||
* WPCOM product slug purchased by the dashboard's upgrade CTA.
|
||||
*
|
||||
* Mirrors the product `Plan::get_product()` resolves to
|
||||
* (`$products->jetpack_videopress`). Kept as a constant rather than read
|
||||
* from `Plan::get_product()` because that helper issues a synchronous
|
||||
* WPCOM request, which we don't want to incur on every page render.
|
||||
*/
|
||||
const VIDEOPRESS_PRODUCT_SLUG = 'jetpack_videopress';
|
||||
|
||||
/**
|
||||
* Register the inline-state enqueue hook.
|
||||
*
|
||||
* Hooks `admin_enqueue_scripts` at priority 11 so the wp-build page
|
||||
* (`build/pages/jetpack-videopress-dashboard/page-wp-admin.php`) has
|
||||
* already registered the prerequisites handle at its default priority 10.
|
||||
* The `wp_script_is( ..., 'registered' )` check inside the callback
|
||||
* doubles as the page guard.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ), 11 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline the initial-state payload before the wp-build boot script.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function enqueue() {
|
||||
if ( ! Admin_UI::is_modernized() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! wp_script_is( self::SCRIPT_HANDLE, 'registered' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_add_inline_script( self::SCRIPT_HANDLE, ( new self() )->render(), 'before' );
|
||||
|
||||
// Hydrate the JP connection store (`window.JP_CONNECTION_INITIAL_STATE`)
|
||||
// so shared connection-aware hooks — notably
|
||||
// `useProductCheckoutWorkflow`, which powers the upgrade CTA — work on
|
||||
// the modernized dashboard exactly as they do on the legacy one. This
|
||||
// also sets `window.jpTracksContext.blog_id` for `@automattic/jetpack-analytics`.
|
||||
Connection_Initial_State::render_script( self::SCRIPT_HANDLE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the initial state data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_data() {
|
||||
$gmt_offset = get_option( 'gmt_offset' );
|
||||
$timezone_string = get_option( 'timezone_string' );
|
||||
$home_host = wp_parse_url( get_site_url(), PHP_URL_HOST );
|
||||
|
||||
return array(
|
||||
'API' => array(
|
||||
'WP_API_root' => esc_url_raw( rest_url() ),
|
||||
'WP_API_nonce' => wp_create_nonce( 'wp_rest' ),
|
||||
'contentNonce' => wp_create_nonce( 'videopress-content-nonce' ),
|
||||
),
|
||||
'jetpackStatus' => array(
|
||||
'calypsoSlug' => ( new Status() )->get_site_suffix(),
|
||||
),
|
||||
'product' => array(
|
||||
// Fed to `useProductCheckoutWorkflow` as the product to purchase.
|
||||
'slug' => self::VIDEOPRESS_PRODUCT_SLUG,
|
||||
),
|
||||
'siteData' => array(
|
||||
'id' => Jetpack_Options::get_option( 'id' ),
|
||||
'title' => get_bloginfo( 'name' ) ? get_bloginfo( 'name' ) : get_site_url(),
|
||||
'adminUrl' => esc_url_raw( admin_url() ),
|
||||
'slug' => is_string( $home_host ) ? $home_host : '',
|
||||
'gmtOffset' => is_numeric( $gmt_offset ) ? (float) $gmt_offset : 0.0,
|
||||
'timezoneString' => is_string( $timezone_string ) ? $timezone_string : '',
|
||||
'locale' => str_replace( '_', '-', (string) get_locale() ),
|
||||
// Paid-tier capability check. Drives the free-tier UX (callout /
|
||||
// DataViews configuration) once designer input lands. Backed by
|
||||
// `Product::get_site_features_from_wpcom()`, which caches the WPCOM
|
||||
// `/sites/%d/features` response in a 15-second site transient. On a
|
||||
// cache miss this issues a synchronous WPCOM request that blocks
|
||||
// page rendering until it returns.
|
||||
'hasVideoPressAccess' => self::has_videopress_access(),
|
||||
'isVideoPress1TB' => self::has_videopress_feature( 'videopress-1tb-storage' ),
|
||||
'isVideoPressUnlimited' => self::has_videopress_feature( 'videopress-unlimited-storage' ),
|
||||
),
|
||||
'assets' => array(
|
||||
'buildUrl' => plugins_url( '../build/', __FILE__ ),
|
||||
),
|
||||
// Authoritative map of accepted upload types (extension => mimetype),
|
||||
// so the dashboard's drag-and-drop filter accepts exactly what the
|
||||
// VideoPress backend supports rather than guessing client-side.
|
||||
'allowedVideoExtensions' => Admin_UI::get_allowed_video_extensions(),
|
||||
// Product/pricing payload for the pre-connection upsell. Only
|
||||
// populated when the site isn't connected — the only time the
|
||||
// connection gate renders the upsell — so connected dashboards never
|
||||
// incur the synchronous WPCOM pricing request `get_pricing_data()`
|
||||
// makes.
|
||||
'pricing' => ( new Connection_Manager() )->is_connected() ? null : $this->get_pricing_data(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Product description, feature list, and yearly price for the
|
||||
* pre-connection upsell (a port of the legacy dashboard's pricing table).
|
||||
*
|
||||
* Backed by `Plan::get_product_price()`, which issues a synchronous WPCOM
|
||||
* request, so this only runs for disconnected sites. Returns null when the
|
||||
* product or price data isn't available (e.g. the WPCOM request fails), in
|
||||
* which case the gate falls back to the plain connect screen.
|
||||
*
|
||||
* @return array|null The upsell payload, or null when it can't be built.
|
||||
*/
|
||||
private function get_pricing_data() {
|
||||
$site_product = My_Jetpack_Products::get_product( 'videopress' );
|
||||
$product_price = Plan::get_product_price();
|
||||
|
||||
if ( ! is_array( $site_product ) || ! isset( $product_price['yearly'] ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return array(
|
||||
'title' => isset( $site_product['description'] ) ? (string) $site_product['description'] : '',
|
||||
'features' => isset( $site_product['features'] ) ? array_values( (array) $site_product['features'] ) : array(),
|
||||
'yearly' => $product_price['yearly'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the site has any paid VideoPress feature flag active.
|
||||
*
|
||||
* Matches the active-features check used by the existing
|
||||
* `videopress/v1/features` REST endpoint: any of the storage tiers
|
||||
* counts as paid access. On WPCOM the legacy `videopress` slug also
|
||||
* grants access.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function has_videopress_access() {
|
||||
return self::has_videopress_feature( 'videopress-1tb-storage' )
|
||||
|| self::has_videopress_feature( 'videopress-unlimited-storage' )
|
||||
|| ( ( new Host() )->is_wpcom_platform() && self::has_videopress_feature( 'videopress' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the named feature appears in the WPCOM active-features list.
|
||||
*
|
||||
* @param string $feature_slug Feature slug as returned by WPCOM (e.g. `videopress-1tb-storage`).
|
||||
* @return bool
|
||||
*/
|
||||
private static function has_videopress_feature( $feature_slug ) {
|
||||
$features = Product::get_site_features_from_wpcom();
|
||||
|
||||
if ( is_wp_error( $features ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$active = $features['active'] ?? array();
|
||||
|
||||
return in_array( $feature_slug, $active, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the initial state into a JavaScript variable.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render() {
|
||||
return 'var JPVIDEOPRESS_INITIAL_STATE=' . wp_json_encode( $this->get_data(), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';';
|
||||
}
|
||||
}
|
||||
+514
@@ -0,0 +1,514 @@
|
||||
<?php
|
||||
/**
|
||||
* The initializer class for the videopress package
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* Initialized the VideoPress package
|
||||
*/
|
||||
class Initializer {
|
||||
|
||||
const JETPACK_VIDEOPRESS_IFRAME_API_HANDLER = 'jetpack-videopress-iframe-api';
|
||||
|
||||
/**
|
||||
* Initialization optinos
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $init_options = array();
|
||||
|
||||
/**
|
||||
* Initializes the VideoPress package
|
||||
*
|
||||
* This method is called by Config::ensure.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
if ( ! did_action( 'videopress_init' ) ) {
|
||||
|
||||
self::unconditional_initialization();
|
||||
|
||||
if ( Status::is_active() ) {
|
||||
self::active_initialization();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires after the VideoPress package is initialized
|
||||
*
|
||||
* @since 0.1.1
|
||||
*/
|
||||
do_action( 'videopress_init' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the initialization options
|
||||
*
|
||||
* This method is called by the Config class
|
||||
*
|
||||
* @param array $options The initialization options.
|
||||
* @return void
|
||||
*/
|
||||
public static function update_init_options( array $options ) {
|
||||
if ( empty( $options['admin_ui'] ) || self::should_initialize_admin_ui() ) { // do not overwrite if already set to true.
|
||||
return;
|
||||
}
|
||||
|
||||
self::$init_options['admin_ui'] = $options['admin_ui'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the initialization options and returns whether the admin_ui should be initialized or not
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function should_initialize_admin_ui() {
|
||||
return isset( self::$init_options['admin_ui'] ) && true === self::$init_options['admin_ui'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize VideoPress features that should be initialized whenever VideoPress is present, even if the module is not active
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function unconditional_initialization() {
|
||||
if ( self::should_include_utilities() ) {
|
||||
require_once __DIR__ . '/utility-functions.php';
|
||||
}
|
||||
|
||||
// Set up package version hook.
|
||||
add_filter( 'jetpack_package_versions', __NAMESPACE__ . '\Package_Version::send_package_version_to_tracker' );
|
||||
|
||||
Module_Control::init();
|
||||
|
||||
/*
|
||||
* The WPCOM REST API v2 endpoints only register routes/fields on REST
|
||||
* init, so defer constructing them (and autoloading their classes) until
|
||||
* a REST request is actually served. Registered on both REST init hooks
|
||||
* so the routes remain available in every context they were before, and
|
||||
* guarded so the endpoints are instantiated only once per request.
|
||||
*/
|
||||
$register_rest_api_v2_endpoints = static function () {
|
||||
static $registered = false;
|
||||
if ( $registered ) {
|
||||
return;
|
||||
}
|
||||
$registered = true;
|
||||
new WPCOM_REST_API_V2_Endpoint_VideoPress();
|
||||
new WPCOM_REST_API_V2_Attachment_VideoPress_Field();
|
||||
new WPCOM_REST_API_V2_Attachment_VideoPress_Data();
|
||||
};
|
||||
add_action( 'rest_api_init', $register_rest_api_v2_endpoints, 0 );
|
||||
add_action( 'restapi_theme_init', $register_rest_api_v2_endpoints, 0 );
|
||||
|
||||
if ( is_admin() ) {
|
||||
AJAX::init();
|
||||
} else {
|
||||
require_once __DIR__ . '/class-block-replacement.php';
|
||||
Block_Replacement::init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This avoids conflicts when running VideoPress plugin with older versions of the Jetpack plugin
|
||||
*
|
||||
* On version 11.3-a.7 utility functions include were removed from the plugin and it is safe to include it from the package
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private static function should_include_utilities() {
|
||||
if ( ! class_exists( 'Jetpack' ) || ! defined( 'JETPACK__VERSION' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return version_compare( JETPACK__VERSION, '11.3-a.7', '>=' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize VideoPress features that should be initialized only when the module is active
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function active_initialization() {
|
||||
Attachment_Handler::init();
|
||||
Jwt_Token_Bridge::init();
|
||||
Initial_State::init();
|
||||
XMLRPC::init();
|
||||
Block_Editor_Content::init();
|
||||
|
||||
/*
|
||||
* These endpoints only add their routes on REST init, so defer calling
|
||||
* init() (and autoloading the endpoint classes) until a REST request is
|
||||
* served. Priority 0 ensures the routes still register before the
|
||||
* default-priority rest_api_init handlers run. Class-name strings are
|
||||
* used so the classes are not autoloaded on non-REST requests.
|
||||
*/
|
||||
foreach (
|
||||
array(
|
||||
Uploader_Rest_Endpoints::class,
|
||||
Rest_Controller::class,
|
||||
VideoPress_Rest_Api_V1_Stats::class,
|
||||
VideoPress_Rest_Api_V1_Site::class,
|
||||
VideoPress_Rest_Api_V1_Settings::class,
|
||||
VideoPress_Rest_Api_V1_Features::class,
|
||||
) as $rest_endpoint
|
||||
) {
|
||||
add_action( 'rest_api_init', array( $rest_endpoint, 'init' ), 0 );
|
||||
}
|
||||
self::register_oembed_providers();
|
||||
|
||||
// Enqueuethe VideoPress Iframe API script in the front-end.
|
||||
add_filter( 'embed_oembed_html', array( __CLASS__, 'enqueue_videopress_iframe_api_script' ), 10, 4 );
|
||||
|
||||
if ( self::should_initialize_admin_ui() ) {
|
||||
Admin_UI::init();
|
||||
}
|
||||
|
||||
Divi::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicitly register VideoPress oembed provider for patterns not supported by core
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_oembed_providers() {
|
||||
$host = rawurlencode( home_url() );
|
||||
// videopress.com/v is already registered in core.
|
||||
// By explicitly declaring the provider here, we can speed things up by not relying on oEmbed discovery.
|
||||
wp_oembed_add_provider( '#^https?://video.wordpress.com/v/.*#', 'https://public-api.wordpress.com/oembed/?for=' . $host, true );
|
||||
// This is needed as it's not supported in oEmbed discovery
|
||||
wp_oembed_add_provider( '|^https?://v\.wordpress\.com/([a-zA-Z\d]{8})(.+)?$|i', 'https://public-api.wordpress.com/oembed/?for=' . $host, true ); // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
|
||||
|
||||
add_filter( 'embed_oembed_html', array( __CLASS__, 'video_enqueue_bridge_when_oembed_present' ), 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues VideoPress token bridge when a VideoPress oembed is present on the current page.
|
||||
*
|
||||
* @param string|false $cache The cached HTML result, stored in post meta.
|
||||
* @param string $url The attempted embed URL.
|
||||
* @param array $attr An array of shortcode attributes.
|
||||
* @param int $post_ID Post ID.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public static function video_enqueue_bridge_when_oembed_present( $cache, $url, $attr, $post_ID = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
if ( Utils::is_videopress_url( $url ) ) {
|
||||
Jwt_Token_Bridge::enqueue_jwt_token_bridge();
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all VideoPress blocks
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_videopress_blocks() {
|
||||
// Register VideoPress Video block.
|
||||
self::register_videopress_video_block();
|
||||
}
|
||||
|
||||
/**
|
||||
* VideoPress video block render method
|
||||
*
|
||||
* @global \WP_Embed $wp_embed WordPress embed handler.
|
||||
*
|
||||
* @param array $block_attributes Block attributes.
|
||||
* @param string $content Current block markup.
|
||||
* @param \WP_Block $block Current block.
|
||||
*
|
||||
* @return string Block markup.
|
||||
*/
|
||||
public static function render_videopress_video_block( $block_attributes, $content, $block ) {
|
||||
global $wp_embed;
|
||||
|
||||
// CSS classes.
|
||||
$align = $block_attributes['align'] ?? null;
|
||||
$align_class = $align ? ' align' . $align : '';
|
||||
$custom_class = isset( $block_attributes['className'] ) ? ' ' . $block_attributes['className'] : '';
|
||||
$classes = 'wp-block-jetpack-videopress jetpack-videopress-player' . $custom_class . $align_class;
|
||||
|
||||
// Inline style.
|
||||
$style = '';
|
||||
$max_width = $block_attributes['maxWidth'] ?? null;
|
||||
|
||||
if ( $max_width && $max_width !== '100%' ) {
|
||||
$style = sprintf( 'max-width: %s;', $max_width );
|
||||
$classes .= ' wp-block-jetpack-videopress--has-max-width';
|
||||
}
|
||||
|
||||
/*
|
||||
* <figcaption /> element
|
||||
* Caption is stored into the block attributes,
|
||||
* but also it was stored into the <figcaption /> element,
|
||||
* meaning that it could be stored in two different places.
|
||||
*/
|
||||
$figcaption = '';
|
||||
|
||||
// Caption from block attributes.
|
||||
$caption = $block_attributes['caption'] ?? null;
|
||||
|
||||
/*
|
||||
* If the caption is not stored into the block attributes,
|
||||
* try to get it from the <figcaption /> element.
|
||||
*/
|
||||
if ( $caption === null ) {
|
||||
preg_match( '/<figcaption>(.*?)<\/figcaption>/', $content, $matches );
|
||||
$caption = $matches[1] ?? null;
|
||||
}
|
||||
|
||||
// If we have a caption, create the <figcaption /> element.
|
||||
if ( $caption !== null ) {
|
||||
$figcaption = sprintf( '<figcaption>%s</figcaption>', wp_kses_post( $caption ) );
|
||||
}
|
||||
|
||||
// Custom anchor from block content.
|
||||
$id_attribute = '';
|
||||
|
||||
// Try to get the custom anchor from the block attributes.
|
||||
if ( isset( $block_attributes['anchor'] ) && $block_attributes['anchor'] ) {
|
||||
$id_attribute = sprintf( 'id="%s"', esc_attr( $block_attributes['anchor'] ) );
|
||||
} elseif ( preg_match( '/<figure[^>]*id="([^"]+)"/', $content, $matches ) ) {
|
||||
// Otherwise, try to get the custom anchor from the <figure /> element.
|
||||
$id_attribute = sprintf( 'id="%s"', esc_attr( $matches[1] ) );
|
||||
}
|
||||
|
||||
// Preview On Hover data.
|
||||
$is_poh_enabled =
|
||||
isset( $block_attributes['posterData']['previewOnHover'] ) &&
|
||||
$block_attributes['posterData']['previewOnHover'];
|
||||
|
||||
$autoplay = $block_attributes['autoplay'] ?? false;
|
||||
$controls = $block_attributes['controls'] ?? false;
|
||||
$poster = $block_attributes['posterData']['url'] ?? null;
|
||||
|
||||
$preview_on_hover = '';
|
||||
|
||||
if ( $is_poh_enabled ) {
|
||||
$preview_on_hover = array(
|
||||
'previewAtTime' => $block_attributes['posterData']['previewAtTime'],
|
||||
'previewLoopDuration' => $block_attributes['posterData']['previewLoopDuration'],
|
||||
'autoplay' => $autoplay,
|
||||
'showControls' => $controls,
|
||||
);
|
||||
|
||||
// Create inline style in case video has a custom poster.
|
||||
$inline_style = '';
|
||||
if ( $poster ) {
|
||||
$inline_style = sprintf(
|
||||
'style="background-image: url(%s); background-size: cover; background-position: center center;"',
|
||||
esc_attr( $poster )
|
||||
);
|
||||
}
|
||||
|
||||
// Expose the preview on hover data to the client.
|
||||
$preview_on_hover = sprintf(
|
||||
'<div class="jetpack-videopress-player__overlay" %s></div><script type="application/json">%s</script>',
|
||||
$inline_style,
|
||||
wp_json_encode( $preview_on_hover, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP )
|
||||
);
|
||||
|
||||
// Set `autoplay` and `muted` attributes to the video element.
|
||||
$block_attributes['autoplay'] = true;
|
||||
$block_attributes['muted'] = true;
|
||||
}
|
||||
|
||||
$figure_template = '
|
||||
<figure class="%1$s" style="%2$s" %3$s>
|
||||
%4$s
|
||||
%5$s
|
||||
%6$s
|
||||
</figure>
|
||||
';
|
||||
|
||||
// VideoPress URL.
|
||||
$guid = $block_attributes['guid'] ?? null;
|
||||
$videopress_url = Utils::get_video_press_url( $guid, $block_attributes );
|
||||
|
||||
$video_wrapper = '';
|
||||
$video_wrapper_classes = 'jetpack-videopress-player__wrapper';
|
||||
|
||||
if ( $videopress_url ) {
|
||||
$videopress_url = wp_kses_post( $videopress_url );
|
||||
|
||||
/*
|
||||
* Provide a fallback iframe for when the oEmbed endpoint fails, e.g.
|
||||
* when the VideoPress backend isn't ready for a freshly uploaded video.
|
||||
* This prevents the published page from showing a bare link.
|
||||
*/
|
||||
$fallback = function ( $output, $url ) use ( $videopress_url ) {
|
||||
if ( $url !== html_entity_decode( $videopress_url, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<iframe title="%1$s" aria-label="%1$s" src="%2$s" width="640" height="360" allowfullscreen data-resize-to-parent="true" allow="clipboard-write"></iframe>',
|
||||
esc_attr__( 'VideoPress Video Player', 'jetpack-videopress-pkg' ),
|
||||
esc_url( preg_replace( '#/v/#', '/embed/', $url, 1 ) )
|
||||
);
|
||||
};
|
||||
|
||||
add_filter( 'embed_maybe_make_link', $fallback, 10, 2 );
|
||||
$oembed_html = apply_filters( 'video_embed_html', $wp_embed->shortcode( array(), $videopress_url ) );
|
||||
remove_filter( 'embed_maybe_make_link', $fallback );
|
||||
|
||||
$video_wrapper = sprintf(
|
||||
'<div class="%s">%s %s</div>',
|
||||
$video_wrapper_classes,
|
||||
$preview_on_hover,
|
||||
$oembed_html
|
||||
);
|
||||
|
||||
/*
|
||||
* Self-heal failed oEmbed cache for VideoPress URLs.
|
||||
*
|
||||
* When the VideoPress backend isn't ready for a freshly uploaded video,
|
||||
* WordPress caches '{{unknown}}' in post meta with a TTL that is too long
|
||||
* for this use case. Clear recent failures so the next page render retries
|
||||
* oEmbed discovery, keeping the fallback iframe above temporary.
|
||||
*/
|
||||
$post_id = $block->context['postId'] ?? get_the_ID();
|
||||
|
||||
if ( $post_id ) {
|
||||
$key_suffix = md5( $videopress_url . serialize( wp_embed_defaults( $videopress_url ) ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- Matching WP_Embed cache key format.
|
||||
$oembed_value = get_post_meta( $post_id, '_oembed_' . $key_suffix, true );
|
||||
$oembed_time = (int) get_post_meta( $post_id, '_oembed_time_' . $key_suffix, true );
|
||||
|
||||
/*
|
||||
* Only clear the '{{unknown}}' cache entry when it is recent, to avoid
|
||||
* disabling WordPress's oEmbed backoff for persistent provider failures.
|
||||
*/
|
||||
if (
|
||||
'{{unknown}}' === $oembed_value
|
||||
&& ( ! $oembed_time || ( time() - $oembed_time ) < MINUTE_IN_SECONDS )
|
||||
) {
|
||||
delete_post_meta( $post_id, '_oembed_' . $key_suffix );
|
||||
delete_post_meta( $post_id, '_oembed_time_' . $key_suffix );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get premium content from block context.
|
||||
$premium_block_plan_id = isset( $block->context['premium-content/planId'] ) ? intval( $block->context['premium-content/planId'] ) : 0;
|
||||
$is_premium_content_child = isset( $block->context['isPremiumContentChild'] ) ? (bool) $block->context['isPremiumContentChild'] : false;
|
||||
$maybe_premium_script = '';
|
||||
if ( $is_premium_content_child ) {
|
||||
Access_Control::instance()->set_guid_subscription( $guid, $premium_block_plan_id );
|
||||
$escaped_guid = wp_json_encode( $guid, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP );
|
||||
$script_content = "if ( ! window.__guidsToPlanIds ) { window.__guidsToPlanIds = {}; }; window.__guidsToPlanIds[$escaped_guid] = $premium_block_plan_id;";
|
||||
$maybe_premium_script = '<script>' . $script_content . '</script>';
|
||||
}
|
||||
|
||||
// $id_attribute, $video_wrapper, $figcaption properly escaped earlier in the code.
|
||||
return sprintf(
|
||||
$figure_template,
|
||||
esc_attr( $classes ),
|
||||
esc_attr( $style ),
|
||||
$id_attribute,
|
||||
$video_wrapper,
|
||||
$figcaption,
|
||||
$maybe_premium_script
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the VideoPress block editor block,
|
||||
* AKA "VideoPress Block v6".
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_videopress_video_block() {
|
||||
/*
|
||||
* If only Jetpack is active, and if the VideoPress module is not active,
|
||||
* we can register the block just to display a placeholder to turn on the module.
|
||||
* That invitation is only useful for admins though.
|
||||
*/
|
||||
if (
|
||||
Status::is_jetpack_plugin_without_videopress_module_active()
|
||||
&& ! Status::is_standalone_plugin_active()
|
||||
&& ! current_user_can( 'jetpack_activate_modules' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$videopress_video_metadata_file = __DIR__ . '/../build/block-editor/blocks/video/block.json';
|
||||
$videopress_video_metadata_file_exists = file_exists( $videopress_video_metadata_file );
|
||||
if ( ! $videopress_video_metadata_file_exists ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$videopress_video_metadata = json_decode(
|
||||
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
file_get_contents( $videopress_video_metadata_file )
|
||||
);
|
||||
|
||||
// Pick the block name straight from the block metadata .json file.
|
||||
$videopress_video_block_name = $videopress_video_metadata->name;
|
||||
|
||||
// Is the block already registered?
|
||||
$is_block_registered = \WP_Block_Type_Registry::get_instance()->is_registered( $videopress_video_block_name );
|
||||
|
||||
// Do not register if the block is already registered.
|
||||
if ( $is_block_registered ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$registration = register_block_type(
|
||||
$videopress_video_metadata_file,
|
||||
array(
|
||||
'render_callback' => array( __CLASS__, 'render_videopress_video_block' ),
|
||||
'render_email_callback' => array( Video_Block_Email_Renderer::class, 'render' ),
|
||||
'uses_context' => array( 'premium-content/planId', 'isPremiumContentChild', 'selectedPlanId' ),
|
||||
)
|
||||
);
|
||||
|
||||
// Do not enqueue scripts if the block could not be registered.
|
||||
if ( empty( $registration ) || empty( $registration->editor_script_handles ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Extensions use Connection_Initial_State::render_script with script handle as parameter.
|
||||
if ( is_array( $registration->editor_script_handles ) ) {
|
||||
$script_handle = $registration->editor_script_handles[0];
|
||||
} else {
|
||||
$script_handle = $registration->editor_script_handles;
|
||||
}
|
||||
|
||||
// Register and enqueue scripts used by the VideoPress video block.
|
||||
Block_Editor_Extensions::init( $script_handle );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the VideoPress Iframe API script
|
||||
* when the URL of oEmbed HTML is a VideoPress URL.
|
||||
*
|
||||
* @param string|false $cache The cached HTML result, stored in post meta.
|
||||
* @param string $url The attempted embed URL.
|
||||
* @param array $attr An array of shortcode attributes.
|
||||
* @param int $post_ID Post ID.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public static function enqueue_videopress_iframe_api_script( $cache, $url, $attr, $post_ID ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
if ( Utils::is_videopress_url( $url ) ) {
|
||||
// Enqueue the VideoPress IFrame API in the front-end.
|
||||
wp_enqueue_script(
|
||||
self::JETPACK_VIDEOPRESS_IFRAME_API_HANDLER,
|
||||
'https://s0.wp.com/wp-content/plugins/video/assets/js/videojs/videopress-iframe-api.js',
|
||||
array(),
|
||||
gmdate( 'YW' ),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Jwt_Token_Bridge
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* VideoPress Jwt_Token_Bridge class.
|
||||
*/
|
||||
class Jwt_Token_Bridge {
|
||||
|
||||
/**
|
||||
* The handle used to enqueue the script
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const SCRIPT_HANDLE = 'media-video-jwt-bridge';
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
* This method should be called only once by the Initializer class. Do not call this method again.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( ! Status::is_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Expose the VideoPress token to the Block Editor context.
|
||||
add_action( 'enqueue_block_editor_assets', array( __CLASS__, 'enqueue_jwt_token_bridge' ), 1 );
|
||||
|
||||
// Expose the VideoPress token to the WPAdmin context.
|
||||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_jwt_token_bridge' ), 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bridge script URL depending on the environment we are in
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_bridge_url() {
|
||||
return plugins_url( '../build/lib/token-bridge.js', __FILE__ );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues the jwt bridge script.
|
||||
*/
|
||||
public static function enqueue_jwt_token_bridge() {
|
||||
global $post;
|
||||
$post_id = isset( $post->ID ) ? absint( $post->ID ) : 0;
|
||||
|
||||
$bridge_url = self::get_bridge_url();
|
||||
|
||||
self::enqueue_script();
|
||||
|
||||
wp_localize_script(
|
||||
self::SCRIPT_HANDLE,
|
||||
'videopressAjax',
|
||||
array(
|
||||
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
|
||||
'bridgeUrl' => $bridge_url,
|
||||
'post_id' => $post_id,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues only the JS script
|
||||
*
|
||||
* @param string $handle The script handle to identify the script.
|
||||
* @return bool True if the script was successfully localized, false otherwise.
|
||||
*/
|
||||
public static function enqueue_script( $handle = self::SCRIPT_HANDLE ) {
|
||||
return wp_enqueue_script(
|
||||
$handle,
|
||||
self::get_bridge_url(),
|
||||
array(),
|
||||
Package_Version::PACKAGE_VERSION,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Jetpack VideoPress: Module_Control class
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* To handle VideoPress module statuses
|
||||
*/
|
||||
class Module_Control {
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*
|
||||
* This method should onlybe called once by the Initializer class. Do not call this method again.
|
||||
*/
|
||||
public static function init() {
|
||||
add_filter( 'jetpack_get_available_standalone_modules', array( __CLASS__, 'add_videopress_to_array' ), 10, 1 );
|
||||
if ( Status::is_standalone_plugin_active() ) {
|
||||
// If the stand-alone plugin is active, videopress module will always be considered active
|
||||
add_filter( 'jetpack_active_modules', array( __CLASS__, 'add_videopress_to_array' ), 10, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds videopress to the list of available/active modules
|
||||
*
|
||||
* @param array $modules Array with modules slugs.
|
||||
* @return array
|
||||
*/
|
||||
public static function add_videopress_to_array( $modules ) {
|
||||
return array_merge( array( 'videopress' ), $modules );
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Options
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Current_Plan;
|
||||
use Jetpack_Options;
|
||||
|
||||
/**
|
||||
* VideoPress Options class.
|
||||
*/
|
||||
class Options {
|
||||
|
||||
/**
|
||||
* Option name.
|
||||
*
|
||||
* @var string $option_name The 'videopress' option name
|
||||
*/
|
||||
public static $option_name = 'videopress';
|
||||
|
||||
/**
|
||||
* VideoPress Options.
|
||||
*
|
||||
* @var array $options An array of associated VideoPress options (default empty)
|
||||
*/
|
||||
protected static $options = array();
|
||||
|
||||
/**
|
||||
* Get VideoPress options
|
||||
*
|
||||
* @return array An array of VideoPress options.
|
||||
*/
|
||||
public static function get_options() {
|
||||
// Make sure we only get options from the database and services once per connection.
|
||||
if ( array() !== self::$options ) {
|
||||
return self::$options;
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'meta' => array(
|
||||
'max_upload_size' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
self::$options = Jetpack_Options::get_option( self::$option_name, array() );
|
||||
self::$options = array_merge( $defaults, self::$options );
|
||||
|
||||
// Make sure that the shadow blog id never comes from the options, but instead uses the
|
||||
// associated shadow blog id, if videopress is enabled.
|
||||
self::$options['shadow_blog_id'] = 0;
|
||||
|
||||
// Use the Jetpack ID for the shadow blog ID if we have a plan that supports VideoPress.
|
||||
if ( Current_Plan::supports( 'videopress' ) ) {
|
||||
self::$options['shadow_blog_id'] = Jetpack_Options::get_option( 'id' );
|
||||
}
|
||||
|
||||
return self::$options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update VideoPress options
|
||||
*
|
||||
* @param mixed $options VideoPress options.
|
||||
*/
|
||||
public static function update_options( $options ) {
|
||||
Jetpack_Options::update_option( self::$option_name, $options );
|
||||
|
||||
self::$options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs when the VideoPress module is deactivated.
|
||||
*/
|
||||
public static function delete_options() {
|
||||
Jetpack_Options::delete_option( self::$option_name );
|
||||
|
||||
self::$options = array();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* The Package_Version class.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* The Package_Version class.
|
||||
*/
|
||||
class Package_Version {
|
||||
const PACKAGE_VERSION = '0.38.2';
|
||||
|
||||
const PACKAGE_SLUG = 'videopress';
|
||||
|
||||
/**
|
||||
* Adds the package slug and version to the package version tracker's data.
|
||||
*
|
||||
* @param array $package_versions The package version array.
|
||||
*
|
||||
* @return array The packge version array.
|
||||
*/
|
||||
public static function send_package_version_to_tracker( $package_versions ) {
|
||||
$package_versions[ self::PACKAGE_SLUG ] = self::PACKAGE_VERSION;
|
||||
return $package_versions;
|
||||
}
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/**
|
||||
* The Plan class.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* The Plan class.
|
||||
*/
|
||||
class Plan {
|
||||
/**
|
||||
* The meta name used to store the cache date
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CACHE_DATE_META_NAME = 'videopress-cache-date';
|
||||
|
||||
/**
|
||||
* Valid pediord for the cache: One week.
|
||||
*/
|
||||
const CACHE_VALIDITY_PERIOD = 7 * DAY_IN_SECONDS;
|
||||
|
||||
/**
|
||||
* The meta name used to store the cache
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CACHE_META_NAME = 'videopress-cache';
|
||||
|
||||
/**
|
||||
* Checks if the cache is old, meaning we need to fetch new data from WPCOM
|
||||
*/
|
||||
private static function is_cache_old() {
|
||||
if ( empty( self::get_product_from_cache() ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$cache_date = get_user_meta( get_current_user_id(), self::CACHE_DATE_META_NAME, true );
|
||||
return time() - (int) $cache_date > ( self::CACHE_VALIDITY_PERIOD );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product list from the user cache
|
||||
*/
|
||||
private static function get_product_from_cache() {
|
||||
return get_user_meta( get_current_user_id(), self::CACHE_META_NAME, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_product() {
|
||||
$request_url = 'https://public-api.wordpress.com/rest/v1.1/products?locale=' . get_user_locale() . '&type=jetpack';
|
||||
$wpcom_request = wp_remote_get( esc_url_raw( $request_url ) );
|
||||
$response_code = wp_remote_retrieve_response_code( $wpcom_request );
|
||||
|
||||
if ( 200 === $response_code ) {
|
||||
$products = json_decode( wp_remote_retrieve_body( $wpcom_request ) );
|
||||
if ( ! isset( $products->jetpack_videopress ) || ! isset( $products->jetpack_videopress_monthly ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Pick the desired product...
|
||||
$product = $products->jetpack_videopress;
|
||||
|
||||
// ... and store it into the cache.
|
||||
update_user_meta( get_current_user_id(), self::CACHE_DATE_META_NAME, time() );
|
||||
update_user_meta( get_current_user_id(), self::CACHE_META_NAME, $product );
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
return new \WP_Error(
|
||||
'failed_to_fetch_data',
|
||||
esc_html__( 'Unable to fetch the requested data.', 'jetpack-videopress-pkg' ),
|
||||
array(
|
||||
'status' => $response_code,
|
||||
'request' => $wpcom_request,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the pricing array with the discount information.
|
||||
*
|
||||
* @param object $product - The product object.
|
||||
* @return int|false Discount percentage.
|
||||
*/
|
||||
public static function get_coupon_discount( $product ) {
|
||||
// Check whether the product has a coupon.
|
||||
if ( ! isset( $product->sale_coupon ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$product_id = $product->product_id;
|
||||
$coupon = $product->sale_coupon;
|
||||
|
||||
// Check product is covered by the coupon.
|
||||
if ( ! in_array( $product_id, $coupon->product_ids, true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether it is still valid.
|
||||
$coupon_start_date = strtotime( $coupon->start_date );
|
||||
$coupon_expires = strtotime( $coupon->expires );
|
||||
if ( $coupon_start_date > time() || $coupon_expires < time() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isset( $coupon->discount ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return intval( $coupon->discount );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return details about the VideoPress product price
|
||||
*
|
||||
* @return array Produce price details
|
||||
*/
|
||||
public static function get_product_price() {
|
||||
$request_url = 'https://public-api.wordpress.com/rest/v1.1/products?locale=' . get_user_locale() . '&type=jetpack';
|
||||
$wpcom_request = wp_remote_get( esc_url_raw( $request_url ) );
|
||||
$response_code = wp_remote_retrieve_response_code( $wpcom_request );
|
||||
|
||||
if ( 200 === $response_code ) {
|
||||
$products = json_decode( wp_remote_retrieve_body( $wpcom_request ) );
|
||||
|
||||
$products_list = array();
|
||||
|
||||
if ( isset( $products->jetpack_videopress ) ) {
|
||||
$videopress_yearly = $products->jetpack_videopress;
|
||||
// get_coupon_discount
|
||||
$products_list['yearly'] = array(
|
||||
'name' => $videopress_yearly->product_name,
|
||||
'slug' => $videopress_yearly->product_slug,
|
||||
'price' => $videopress_yearly->cost,
|
||||
'priceByMonth' => round( $videopress_yearly->cost / 12, 2 ),
|
||||
'currency' => $videopress_yearly->currency_code,
|
||||
);
|
||||
|
||||
$discount = self::get_coupon_discount( $videopress_yearly );
|
||||
|
||||
if ( $discount ) {
|
||||
$products_list['yearly']['discount'] = $discount;
|
||||
$products_list['yearly']['salePrice'] = round( $videopress_yearly->cost * ( 1 - $discount / 100 ), 2 );
|
||||
$products_list['yearly']['salePriceByMonth'] = round( ( $videopress_yearly->cost * ( 1 - $discount / 100 ) / 12 ), 2 );
|
||||
} else {
|
||||
$products_list['yearly']['salePrice'] = $videopress_yearly->cost;
|
||||
$products_list['yearly']['salePriceByMonth'] = round( $videopress_yearly->cost / 12, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $products->jetpack_videopress_monthly ) ) {
|
||||
$videopress_monthly = $products->jetpack_videopress_monthly;
|
||||
|
||||
$products_list['monthly'] = array(
|
||||
'name' => $videopress_monthly->product_name,
|
||||
'slug' => $videopress_monthly->product_slug,
|
||||
'price' => $videopress_monthly->cost,
|
||||
'currency' => $videopress_monthly->currency_code,
|
||||
);
|
||||
}
|
||||
|
||||
return $products_list;
|
||||
}
|
||||
|
||||
return new \WP_Error(
|
||||
'failed_to_fetch_data',
|
||||
esc_html__( 'Unable to fetch the requested data.', 'jetpack-videopress-pkg' ),
|
||||
array(
|
||||
'status' => $response_code,
|
||||
'request' => $wpcom_request,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* The VideoPress REST Controller.
|
||||
*
|
||||
* Registers the `/jetpack/v4/videopress/*` routes backing the
|
||||
* modernized wp-build dashboard. Currently exposes one route — a
|
||||
* user-signed proxy to the WPCOM `sites/{id}/stats/video-plays`
|
||||
* endpoint — needed by the Overview screen's KPI / trends / top-N
|
||||
* cards.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
use Jetpack_Options;
|
||||
use WP_Error;
|
||||
use WP_REST_Request;
|
||||
use WP_REST_Server;
|
||||
|
||||
/**
|
||||
* REST routes for the modernized VideoPress admin UI.
|
||||
*/
|
||||
class Rest_Controller {
|
||||
|
||||
/**
|
||||
* REST namespace used by this package's modernization routes.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const REST_NAMESPACE = 'jetpack/v4/videopress';
|
||||
|
||||
/**
|
||||
* Hook the route registration on `rest_api_init`.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the VideoPress REST routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_routes() {
|
||||
register_rest_route(
|
||||
self::REST_NAMESPACE,
|
||||
'/stats/video-plays',
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( __CLASS__, 'get_stats_video_plays' ),
|
||||
'permission_callback' => array( __CLASS__, 'permissions_callback' ),
|
||||
'args' => self::stats_video_plays_args(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query params accepted by the video-plays proxy. Forwarded verbatim
|
||||
* to WPCOM after permission and shape validation; `complete_stats` is
|
||||
* always forced to `true` (the only mode the Overview cares about)
|
||||
* and is therefore not exposed as an incoming param.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function stats_video_plays_args() {
|
||||
return array(
|
||||
'period' => array(
|
||||
'description' => __( 'Period unit: day, week, month, or year.', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'string',
|
||||
'enum' => array( 'day', 'week', 'month', 'year' ),
|
||||
),
|
||||
'num' => array(
|
||||
'description' => __( 'Number of periods to include.', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'integer',
|
||||
'minimum' => 1,
|
||||
'maximum' => 365,
|
||||
),
|
||||
'date' => array(
|
||||
'description' => __( 'Most recent day to include in results (YYYY-MM-DD).', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date',
|
||||
),
|
||||
'start_date' => array(
|
||||
'description' => __( 'Starting date for range queries (YYYY-MM-DD).', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission callback. Admin-gated. The upstream call is blog-signed,
|
||||
* matching the existing `Stats::fetch_video_plays` path; no user-level
|
||||
* WPCOM connection is required.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function permissions_callback() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy the video-plays stats endpoint.
|
||||
*
|
||||
* Forwards the whitelisted query params to WPCOM (REST v1.1, blog-signed
|
||||
* — matching the existing `Stats::fetch_video_plays` path) and forces
|
||||
* `complete_stats=true`. In complete-stats mode, each day entry carries
|
||||
* `total.views`, `total.impressions`, and `total.watch_time` (in hours)
|
||||
* plus a per-video `data[]` array whose entries have `post_id`, `title`,
|
||||
* `views`, `impressions`, `watch_time` (hours), and `retention_rate`.
|
||||
* The `plays` field is NOT returned in complete-stats mode.
|
||||
*
|
||||
* @param WP_REST_Request $request Incoming request.
|
||||
* @return mixed Decoded JSON response from WPCOM, or WP_Error on failure.
|
||||
*/
|
||||
public static function get_stats_video_plays( WP_REST_Request $request ) {
|
||||
$blog_id = (int) Jetpack_Options::get_option( 'id' );
|
||||
if ( ! $blog_id ) {
|
||||
return new WP_Error(
|
||||
'videopress_stats_not_connected',
|
||||
esc_html__( 'This site is not connected to WordPress.com.', 'jetpack-videopress-pkg' ),
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
|
||||
$params = array( 'complete_stats' => 'true' );
|
||||
foreach ( array_keys( self::stats_video_plays_args() ) as $key ) {
|
||||
$value = $request->get_param( $key );
|
||||
if ( $value !== null && $value !== '' ) {
|
||||
$params[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$path = sprintf(
|
||||
'sites/%d/stats/video-plays?%s',
|
||||
$blog_id,
|
||||
http_build_query( $params )
|
||||
);
|
||||
$response = Client::wpcom_json_api_request_as_blog( $path );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return new WP_Error(
|
||||
'videopress_stats_request_failed',
|
||||
$response->get_error_message(),
|
||||
array( 'status' => 500 )
|
||||
);
|
||||
}
|
||||
|
||||
$status = (int) wp_remote_retrieve_response_code( $response );
|
||||
$body = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
if ( 200 !== $status ) {
|
||||
$message = is_array( $body ) && isset( $body['message'] )
|
||||
? (string) $body['message']
|
||||
: esc_html__( 'Unable to fetch VideoPress stats.', 'jetpack-videopress-pkg' );
|
||||
return new WP_Error(
|
||||
'videopress_stats_request_failed',
|
||||
$message,
|
||||
array( 'status' => $status ? $status : 500 )
|
||||
);
|
||||
}
|
||||
|
||||
return rest_ensure_response( $body );
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Provides site data sourced from WPCOM
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
* Provides site data sourced from WPCOM
|
||||
*/
|
||||
class Site {
|
||||
|
||||
/**
|
||||
* Returns all the data provided by WPCOM for the site.
|
||||
*
|
||||
* @return int|WP_Error the total of plays for today, or WP_Error on failure.
|
||||
*/
|
||||
public static function get_site_info() {
|
||||
$error = new WP_Error(
|
||||
'videopress_site_error',
|
||||
__( 'Could not fetch site information from the service', 'jetpack-videopress-pkg' )
|
||||
);
|
||||
|
||||
$request_path = sprintf( 'sites/%d?force=wpcom', Data::get_blog_id() );
|
||||
$response = Client::wpcom_json_api_request_as_blog( $request_path, '1.1', array(), null, 'rest' );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return $error;
|
||||
}
|
||||
|
||||
$response_code = wp_remote_retrieve_response_code( $response );
|
||||
if ( 200 !== $response_code ) {
|
||||
return $error;
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
|
||||
return json_decode( $body, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the purchases provided by WPCOM for the site.
|
||||
*
|
||||
* @return array the list of purchases, or an empty list on failure.
|
||||
*/
|
||||
public static function get_purchases() {
|
||||
$request_path = sprintf( 'sites/%1$d/purchases?locale=%2$s', Data::get_blog_id(), get_user_locale() );
|
||||
$response = Client::wpcom_json_api_request_as_blog( $request_path, '1.1', array(), null, 'rest' );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$response_code = wp_remote_retrieve_response_code( $response );
|
||||
if ( 200 !== $response_code ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
|
||||
return json_decode( $body, true );
|
||||
}
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
/**
|
||||
* Provides data stats about videos inside VideoPress
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Connection\Client;
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
* Provides data stats about videos inside VideoPress
|
||||
*/
|
||||
class Stats {
|
||||
/**
|
||||
* Hit WPCOM video-plays stats endpoint.
|
||||
*
|
||||
* @param array $args Request args.
|
||||
* @return array|WP_Error WP HTTP response on success
|
||||
*/
|
||||
public static function fetch_video_plays( $args = array() ) {
|
||||
$blog_id = VideoPressToken::blog_id();
|
||||
|
||||
$endpoint = sprintf(
|
||||
'sites/%d/stats/video-plays?check_stats_module=false',
|
||||
$blog_id
|
||||
);
|
||||
|
||||
if ( is_array( $args ) && ! empty( $args ) ) {
|
||||
$endpoint .= '&' . http_build_query( $args );
|
||||
}
|
||||
|
||||
$result = Client::wpcom_json_api_request_as_blog( $endpoint );
|
||||
|
||||
if ( is_wp_error( $result ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$response = $result['http_response'];
|
||||
$response_code = $response->get_status();
|
||||
$response_body = json_decode( $response->get_data(), true );
|
||||
|
||||
if ( 200 !== $response_code ) {
|
||||
return new WP_Error(
|
||||
'videopress_stats_error',
|
||||
$response_body
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'code' => $response_code,
|
||||
'data' => $response_body,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the counter of today's plays for all videos.
|
||||
*
|
||||
* @return int|WP_Error the total of plays for today, or WP_Error on failure.
|
||||
*/
|
||||
public static function get_today_plays() {
|
||||
$response = self::fetch_video_plays();
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $response['data'];
|
||||
|
||||
if ( ! $data || ! isset( $data['days'] ) || ! is_countable( $data['days'] ) || count( $data['days'] ) === 0 ) {
|
||||
return new WP_Error(
|
||||
'videopress_stats_error',
|
||||
__( 'Could not find any stats from the service', 'jetpack-videopress-pkg' )
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* The only result here is today's stats
|
||||
*/
|
||||
$today_stats = array_pop( $data['days'] );
|
||||
|
||||
return $today_stats['total_plays'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the featured stats for VideoPress.
|
||||
*
|
||||
* @param int $period_count (optional) The number of days to consider.
|
||||
* @param string $period (optional) The period to consider.
|
||||
*
|
||||
* @return array|WP_Error a list of stats, or WP_Error on failure.
|
||||
*/
|
||||
public static function get_featured_stats( $period_count = 14, $period = 'day' ) {
|
||||
$response = self::fetch_video_plays(
|
||||
array(
|
||||
'period' => $period,
|
||||
'num' => $period_count,
|
||||
'complete_stats' => true,
|
||||
)
|
||||
);
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $response['data'];
|
||||
|
||||
if ( ! $data ) {
|
||||
return new WP_Error(
|
||||
'videopress_stats_error',
|
||||
__( 'Could not find any stats from the service', 'jetpack-videopress-pkg' )
|
||||
);
|
||||
}
|
||||
|
||||
// Get only the list of dates
|
||||
$dates = $data['days'];
|
||||
|
||||
// Organize the data into the planned stats
|
||||
return self::prepare_featured_stats( $dates, $period_count, $period );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the featured stats for VideoPress.
|
||||
*
|
||||
* @param array $dates The list of dates returned by the API.
|
||||
* @param int $period_count The total number of days to consider.
|
||||
* @param string $period The period to consider.
|
||||
* @return array a list of stats.
|
||||
*/
|
||||
public static function prepare_featured_stats( $dates, $period_count, $period = 'day' ) {
|
||||
/**
|
||||
* Ensure the sorting of the dates, recent ones first.
|
||||
* This way, the first 7 positions are from the last 7 days,
|
||||
* and the next 7 positions are from the 7 days before it.
|
||||
*/
|
||||
krsort( $dates );
|
||||
$period_of_data = floor( $period_count / 2 );
|
||||
$period = $period === 'day' ? __( 'day', 'jetpack-videopress-pkg' ) : __( 'year', 'jetpack-videopress-pkg' );
|
||||
|
||||
// template for the response
|
||||
$featured_stats = array(
|
||||
// translators: %1$d is the number of units of time, %2$s is the period in which the units of time are measured ex. 'day' or 'year'.
|
||||
'label' => sprintf( _n( 'last %1$d %2$s', 'last %1$d %2$ss', (int) $period_of_data, 'jetpack-videopress-pkg' ), $period_of_data, $period ),
|
||||
'period' => $period,
|
||||
'data' => array(
|
||||
'views' => array(
|
||||
'current' => 0,
|
||||
'previous' => 0,
|
||||
),
|
||||
'impressions' => array(
|
||||
'current' => 0,
|
||||
'previous' => 0,
|
||||
),
|
||||
'watch_time' => array(
|
||||
'current' => 0,
|
||||
'previous' => 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Go through the dates to compute the stats
|
||||
$counter = 0;
|
||||
foreach ( $dates as $date_info ) {
|
||||
$date_totals = $date_info['total'];
|
||||
|
||||
if ( $counter < floor( $period_count / 2 ) ) {
|
||||
|
||||
// the first 7 elements are for the current period
|
||||
$featured_stats['data']['views']['current'] += $date_totals['views'];
|
||||
$featured_stats['data']['impressions']['current'] += $date_totals['impressions'];
|
||||
$featured_stats['data']['watch_time']['current'] += $date_totals['watch_time'];
|
||||
|
||||
} else {
|
||||
|
||||
// the next 7 elements are for the previous period
|
||||
$featured_stats['data']['views']['previous'] += $date_totals['views'];
|
||||
$featured_stats['data']['impressions']['previous'] += $date_totals['impressions'];
|
||||
$featured_stats['data']['watch_time']['previous'] += $date_totals['watch_time'];
|
||||
|
||||
}
|
||||
|
||||
++$counter;
|
||||
}
|
||||
|
||||
return $featured_stats;
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* The class that provides information about VideoPress Status
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\Modules;
|
||||
|
||||
/**
|
||||
* The class that provides information about VideoPress Status
|
||||
*/
|
||||
class Status {
|
||||
|
||||
/**
|
||||
* Returns whether VideoPress is active
|
||||
* either as a Jetpack module or as a stand alone plugin
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_active() {
|
||||
return self::is_jetpack_plugin_and_videopress_module_active() || self::is_standalone_plugin_active();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the Jetpack plugin is active
|
||||
*/
|
||||
public static function is_jetpack_plugin_active() {
|
||||
return class_exists( 'Jetpack' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the Jetpack plugin
|
||||
* and its VideoPress module are active.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_jetpack_plugin_and_videopress_module_active() {
|
||||
return class_exists( 'Jetpack' ) && ( new Modules() )->is_active( 'videopress' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the Jetpack plugin is active
|
||||
* but the VideoPress module is not active.
|
||||
*
|
||||
* @since 0.28.2
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_jetpack_plugin_without_videopress_module_active() {
|
||||
return class_exists( 'Jetpack' ) && ! ( new Modules() )->is_active( 'videopress' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the VideoPress stand alone plugin is active
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_standalone_plugin_active() {
|
||||
return class_exists( 'Jetpack_VideoPress_Plugin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the registrant plugin is active
|
||||
* either as a Jetpack module (via Jetpack plugin)
|
||||
* or as a stand-alone plugin.
|
||||
*
|
||||
* @return boolean True if the register plugin is active.
|
||||
*/
|
||||
public static function is_registrant_plugin_active() {
|
||||
return self::is_jetpack_plugin_active() || self::is_standalone_plugin_active();
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Uploader Exception
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* VideoPress Uploader Exception class
|
||||
*/
|
||||
class Upload_Exception extends \Exception {
|
||||
const ERROR_INVALID_ATTACHMENT_ID = 0;
|
||||
const ERROR_FILE_NOT_FOUND = 1;
|
||||
const ERROR_MIME_TYPE_NOT_SUPPORTED = 2;
|
||||
const ERROR_MALFORMED_FILE = 3;
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Uploader
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use WP_Error;
|
||||
|
||||
/**
|
||||
* VideoPress Uploader class
|
||||
*
|
||||
* Handles the upload from the Media Library to VideoPress servers
|
||||
*/
|
||||
class Uploader_Rest_Endpoints {
|
||||
|
||||
/**
|
||||
* Initializes the endpoints
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_endpoints' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_endpoints() {
|
||||
$id_arg = array(
|
||||
'description' => __( 'The ID of the attachment you want to upload to VideoPress', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'integer',
|
||||
'required' => true,
|
||||
'validate_callback' => __CLASS__ . '::validate_attachment_id',
|
||||
);
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'upload/(?P<attachment_id>\d+)',
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => __CLASS__ . '::check_status',
|
||||
'permission_callback' => __CLASS__ . '::permissions_callback',
|
||||
'args' => array(
|
||||
'attachment_id' => $id_arg,
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => __CLASS__ . '::do_upload',
|
||||
'permission_callback' => __CLASS__ . '::permissions_callback',
|
||||
'args' => array(
|
||||
'attachment_id' => $id_arg,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the user have permission to perform the upload
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function permissions_callback() {
|
||||
return current_user_can( 'upload_files' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the attachment ID argument
|
||||
*
|
||||
* @param integer|string $value The attachment ID passed as an argument to the endpoint.
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public static function validate_attachment_id( $value ) {
|
||||
return Uploader::is_valid_attachment_id( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint callback for the GET method. Checks the upload status
|
||||
*
|
||||
* @param \WP_REST_Request $request The request object.
|
||||
* @return array|WP_Error
|
||||
*/
|
||||
public static function check_status( $request ) {
|
||||
$attachment_id = $request->get_param( 'attachment_id' );
|
||||
try {
|
||||
$uploader = new Uploader( $attachment_id );
|
||||
$status = $uploader->check_status();
|
||||
return rest_ensure_response( $status );
|
||||
} catch ( Upload_Exception $e ) {
|
||||
return new WP_Error(
|
||||
'rest_invalid_param',
|
||||
$e->getMessage(),
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint callback for the POST method. Uploads the video
|
||||
*
|
||||
* @param \WP_REST_Request $request The request object.
|
||||
* @return array|WP_Error
|
||||
*/
|
||||
public static function do_upload( $request ) {
|
||||
$attachment_id = $request->get_param( 'attachment_id' );
|
||||
try {
|
||||
$uploader = new Uploader( $attachment_id );
|
||||
$status = $uploader->upload();
|
||||
return rest_ensure_response( $status );
|
||||
} catch ( Upload_Exception $e ) {
|
||||
return new WP_Error(
|
||||
'rest_invalid_param',
|
||||
$e->getMessage(),
|
||||
array( 'status' => 400 )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+300
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Uploader
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Jetpack_Options;
|
||||
use VideoPressUploader\File_Exception;
|
||||
use VideoPressUploader\Tus_Client;
|
||||
|
||||
/**
|
||||
* VideoPress Uploader class
|
||||
*
|
||||
* Handles the upload from the Media Library to VideoPress servers
|
||||
*/
|
||||
class Uploader {
|
||||
|
||||
/**
|
||||
* The key of the post meta that holds the ID of the attachment that holds the VideoPress video, in case this attachment was uploaded before.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const UPLOADED_KEY = '_videopress_uploaded_id';
|
||||
|
||||
/**
|
||||
* The chunk size of each upload step
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CHUNK_SIZE = 5000000;
|
||||
|
||||
/**
|
||||
* The Tus Client instance
|
||||
*
|
||||
* @var Tus_Client
|
||||
*/
|
||||
protected $client = null;
|
||||
|
||||
/**
|
||||
* The attachment ID
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $attachment_id;
|
||||
|
||||
/**
|
||||
* Checks whether this feature is supported by the server
|
||||
*
|
||||
* @param int $attachment_id The ID of the video attachment we want to upload to VideoPress.
|
||||
* @return boolean
|
||||
*/
|
||||
public static function is_valid_attachment_id( $attachment_id ) {
|
||||
$file_path = get_attached_file( $attachment_id );
|
||||
if ( ! $file_path || ! is_readable( $file_path ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! str_starts_with( get_post_mime_type( $attachment_id ), 'video/' ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the object
|
||||
*
|
||||
* @throws Upload_Exception If attachment is invalid or server does not support it.
|
||||
* @param int $attachment_id The ID of the video attachment we want to upload to VideoPress.
|
||||
*/
|
||||
public function __construct( $attachment_id ) {
|
||||
$this->attachment_id = $attachment_id;
|
||||
if ( ! $this->get_file_path() ) {
|
||||
throw new Upload_Exception( __( 'Invalid attachment ID', 'jetpack-videopress-pkg' ), Upload_Exception::ERROR_INVALID_ATTACHMENT_ID );
|
||||
}
|
||||
if ( ! is_readable( $this->get_file_path() ) ) {
|
||||
throw new Upload_Exception( __( 'File not found', 'jetpack-videopress-pkg' ), Upload_Exception::ERROR_FILE_NOT_FOUND );
|
||||
}
|
||||
if ( ! $this->file_has_supported_mime_type() ) {
|
||||
throw new Upload_Exception( __( 'Mime type not supported', 'jetpack-videopress-pkg' ), Upload_Exception::ERROR_MIME_TYPE_NOT_SUPPORTED );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path of the video file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_file_path() {
|
||||
return get_attached_file( $this->attachment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mime type of the attachment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_file_mime_type() {
|
||||
return get_post_mime_type( $this->attachment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the video file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_file_name() {
|
||||
return basename( $this->get_file_path() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size of the video file
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_file_size() {
|
||||
return filesize( $this->get_file_path() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the mime type of the attachment is supported to be uploaded
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function file_has_supported_mime_type() {
|
||||
return str_starts_with( $this->get_file_mime_type(), 'video/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the VideoPress upload token
|
||||
*
|
||||
* @throws Upload_Exception If it fails to fetch the token.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_upload_token() {
|
||||
return VideoPressToken::videopress_upload_jwt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a unique upload key for this attachment
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_key() {
|
||||
return sprintf( 's-%d-v-%d', Jetpack_Options::get_option( 'id' ), $this->attachment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current attachment as uploaded and stores the ID of the VideoPress video attachment ID
|
||||
*
|
||||
* @param int $new_attachment_id The ID of the new attachment created to hold the VideoPress video.
|
||||
* @return void
|
||||
*/
|
||||
protected function mark_as_uploaded( $new_attachment_id ) {
|
||||
update_post_meta( $this->attachment_id, self::UPLOADED_KEY, $new_attachment_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current attachment as not being uploaded before. Deletes the reference to the videopress attachment
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function unmark_as_uploaded() {
|
||||
delete_post_meta( $this->attachment_id, self::UPLOADED_KEY );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this attachment was uploaded before
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_uploaded() {
|
||||
return ! empty( $this->get_uploaded_attachment_id() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of the VideoPress video attachment in case this attachment was uploaded before
|
||||
*
|
||||
* @return boolean|string False if value is absent. Post ID on success.
|
||||
*/
|
||||
public function get_uploaded_attachment_id() {
|
||||
return get_post_meta( $this->attachment_id, self::UPLOADED_KEY, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the instance of the Tus_Client
|
||||
*
|
||||
* @return Tus_Client
|
||||
*/
|
||||
public function get_client() {
|
||||
if ( $this->client !== null ) {
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
$this->client = new Tus_Client( $this->get_key(), $this->get_upload_token(), Jetpack_Options::get_option( 'id' ) );
|
||||
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a chunk of the file
|
||||
*
|
||||
* @return array With the status of the upload
|
||||
*/
|
||||
public function upload() {
|
||||
if ( $this->is_uploaded() ) {
|
||||
return $this->check_status();
|
||||
}
|
||||
try {
|
||||
$this->get_client()->file( $this->get_file_path(), $this->get_file_name() );
|
||||
|
||||
$bytes_uploaded = $this->get_client()->upload( self::CHUNK_SIZE );
|
||||
|
||||
if ( $bytes_uploaded === $this->get_file_size() ) {
|
||||
$this->mark_as_uploaded( $this->get_client()->get_uploaded_video_details()['media_id'] );
|
||||
return array(
|
||||
'status' => 'complete',
|
||||
'bytes_uploaded' => $bytes_uploaded,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'upload_key' => $this->get_key(),
|
||||
'uploaded_details' => $this->get_client()->get_uploaded_video_details(),
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status' => 'uploading',
|
||||
'bytes_uploaded' => $bytes_uploaded,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'upload_key' => $this->get_key(),
|
||||
);
|
||||
} catch ( \Exception $e ) {
|
||||
return array(
|
||||
'status' => 'error',
|
||||
'bytes_uploaded' => -1,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'upload_key' => $this->get_key(),
|
||||
'error' => $e->getCode() . ': ' . $e->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the status of the upload of this attachment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check_status() {
|
||||
|
||||
if ( $this->is_uploaded() ) {
|
||||
$uploaded_attachment_id = $this->get_uploaded_attachment_id();
|
||||
$uploaded_video_guid = get_post_meta( $uploaded_attachment_id, 'videopress_guid', true );
|
||||
if ( $uploaded_video_guid ) {
|
||||
return array(
|
||||
'status' => 'uploaded',
|
||||
'upload_key' => $this->get_key(),
|
||||
'uploaded_post_id' => $uploaded_attachment_id,
|
||||
'uploaded_video_guid' => $uploaded_video_guid,
|
||||
);
|
||||
} else {
|
||||
// VideoPress attachment is gone, allow user to upload it again.
|
||||
$this->unmark_as_uploaded();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$offset = $this->get_client()->get_offset();
|
||||
$status = false !== $offset ? 'resume' : 'new';
|
||||
$offset = false === $offset ? 0 : $offset;
|
||||
|
||||
return array(
|
||||
'status' => $status,
|
||||
'bytes_uploaded' => $offset,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'upload_key' => $this->get_key(),
|
||||
);
|
||||
} catch ( File_Exception $e ) {
|
||||
return array(
|
||||
'status' => 'resume',
|
||||
'bytes_uploaded' => 0,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'upload_key' => $this->get_key(),
|
||||
);
|
||||
} catch ( \Exception $e ) {
|
||||
return array(
|
||||
'status' => 'error',
|
||||
'bytes_uploaded' => -1,
|
||||
'file_size' => $this->get_file_size(),
|
||||
'file_name' => $this->get_file_name(),
|
||||
'message' => $e->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* The Utils class.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* The Utils class.
|
||||
*/
|
||||
class Utils {
|
||||
/**
|
||||
* Build a VideoPress video URL based on the guid and block attributes.
|
||||
*
|
||||
* @param string $guid - Video GUID.
|
||||
* @param array $attributes - Video block attributes. Default is an empty array.
|
||||
*
|
||||
* @return string VideoPress video URL with the specified attributes.
|
||||
*/
|
||||
public static function get_video_press_url( $guid, $attributes = array() ) {
|
||||
if ( ! $guid ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$video_press_url_options = wp_parse_args(
|
||||
$attributes,
|
||||
array(
|
||||
'autoplay' => false,
|
||||
'controls' => true,
|
||||
'loop' => false,
|
||||
'muted' => false,
|
||||
'playsinline' => false,
|
||||
'poster' => '',
|
||||
'preload' => 'metadata',
|
||||
'seekbarColor' => '',
|
||||
'seekbarPlayedColor' => '',
|
||||
'seekbarLoadingColor' => '',
|
||||
'useAverageColor' => true,
|
||||
)
|
||||
);
|
||||
|
||||
$query_args = array(
|
||||
'resizeToParent' => 1,
|
||||
'cover' => 1,
|
||||
'autoPlay' => (int) $video_press_url_options['autoplay'],
|
||||
'controls' => (int) $video_press_url_options['controls'],
|
||||
'loop' => (int) $video_press_url_options['loop'],
|
||||
'muted' => (int) $video_press_url_options['muted'],
|
||||
'persistVolume' => $video_press_url_options['muted'] ? 0 : 1,
|
||||
'playsinline' => (int) $video_press_url_options['playsinline'],
|
||||
'preloadContent' => $video_press_url_options['preload'],
|
||||
'sbc' => $video_press_url_options['seekbarColor'],
|
||||
'sbpc' => $video_press_url_options['seekbarPlayedColor'],
|
||||
'sblc' => $video_press_url_options['seekbarLoadingColor'],
|
||||
'useAverageColor' => (int) $video_press_url_options['useAverageColor'],
|
||||
);
|
||||
|
||||
if ( ! empty( $video_press_url_options['poster'] ) ) {
|
||||
$query_args['posterUrl'] = rawurlencode( $video_press_url_options['poster'] );
|
||||
}
|
||||
|
||||
$url = 'https://videopress.com/v/' . $guid;
|
||||
return add_query_arg( $query_args, $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given URL is a VideoPress URL.
|
||||
*
|
||||
* @since x.x.x
|
||||
*
|
||||
* @param mixed $url The URL to check. Non-strings return false.
|
||||
* @return bool True if the URL is a VideoPress URL, false otherwise.
|
||||
*/
|
||||
public static function is_videopress_url( $url ) {
|
||||
return null !== self::extract_videopress_guid_from_url( $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the VideoPress guid from a recognised VideoPress URL.
|
||||
*
|
||||
* @param mixed $url The URL to inspect. Non-strings return null.
|
||||
* @return string|null The 8-character guid, or null if the URL is not a recognised VideoPress URL.
|
||||
*/
|
||||
public static function extract_videopress_guid_from_url( $url ) {
|
||||
if ( ! is_string( $url ) ) {
|
||||
return null;
|
||||
}
|
||||
$pattern = '/^https?:\/\/(?:(?:v(?:ideo)?\.wordpress\.com|videopress\.com)\/(?:v|embed)|v\.wordpress\.com|videos\.(?:videopress\.com|files\.wordpress\.com))\/([a-z\d]{8})(\/|\b)/i'; // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText
|
||||
if ( preg_match( $pattern, $url, $matches ) ) {
|
||||
return $matches[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress video block email renderer class.
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
/**
|
||||
* Handles rendering VideoPress video blocks for email contexts.
|
||||
*/
|
||||
class Video_Block_Email_Renderer {
|
||||
|
||||
/**
|
||||
* Render VideoPress video block for email.
|
||||
*
|
||||
* @param string $block_content The original block HTML content.
|
||||
* @param array $parsed_block The parsed block data including attributes.
|
||||
* @param object $rendering_context Email rendering context.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function render( $block_content, $parsed_block, $rendering_context ) {
|
||||
// Validate input parameters and required dependencies.
|
||||
if ( ! isset( $parsed_block['attrs'] ) || ! is_array( $parsed_block['attrs'] ) ||
|
||||
! class_exists( '\Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks\Embed' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$attributes = $parsed_block['attrs'];
|
||||
|
||||
// Get the VideoPress URL from the guid attribute.
|
||||
$videopress_url = self::get_videopress_url( $attributes );
|
||||
|
||||
if ( empty( $videopress_url ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// For private videos, render a simple link to the post since the video isn't accessible on VideoPress.
|
||||
// The isPrivate attribute is pre-computed by the block editor based on video and site settings.
|
||||
if ( isset( $attributes['isPrivate'] ) && true === $attributes['isPrivate'] ) {
|
||||
return self::render_link( $parsed_block );
|
||||
}
|
||||
|
||||
// Create a mock embed block structure that WooCommerce's embed renderer can handle.
|
||||
// The embed renderer will detect VideoPress from the URL and render it appropriately.
|
||||
$mock_embed_block = array(
|
||||
'blockName' => 'core/embed',
|
||||
'attrs' => array(
|
||||
'url' => $videopress_url,
|
||||
'providerNameSlug' => 'videopress',
|
||||
),
|
||||
'innerHTML' => sprintf(
|
||||
'<figure class="wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">%s</div></figure>',
|
||||
esc_url( $videopress_url )
|
||||
),
|
||||
);
|
||||
|
||||
// Preserve email_attrs if present (used for spacing/width calculations).
|
||||
if ( ! empty( $parsed_block['email_attrs'] ) ) {
|
||||
$mock_embed_block['email_attrs'] = $parsed_block['email_attrs'];
|
||||
}
|
||||
|
||||
// Use WooCommerce's core embed renderer.
|
||||
// @phan-suppress-next-line PhanUndeclaredClassMethod -- Optional WooCommerce dependency, checked with class_exists() above.
|
||||
$woo_embed_renderer = new \Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks\Embed();
|
||||
|
||||
// @phan-suppress-next-line PhanUndeclaredClassMethod -- Optional WooCommerce dependency, checked with class_exists() above.
|
||||
return $woo_embed_renderer->render( $mock_embed_block['innerHTML'], $mock_embed_block, $rendering_context );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a simple link for private VideoPress videos in emails.
|
||||
* Links to the post containing the video since private videos aren't accessible on VideoPress.
|
||||
*
|
||||
* @param array $parsed_block The parsed block data.
|
||||
*
|
||||
* @return string The rendered link HTML.
|
||||
*/
|
||||
private static function render_link( $parsed_block ) {
|
||||
$post_url = get_the_permalink();
|
||||
|
||||
if ( empty( $post_url ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$link_text = __( 'Visit the post to watch the video', 'jetpack-videopress-pkg' );
|
||||
|
||||
$link_html = sprintf(
|
||||
'<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>',
|
||||
esc_url( $post_url ),
|
||||
esc_html( $link_text )
|
||||
);
|
||||
|
||||
// Wrap with spacing if email_attrs are present.
|
||||
$email_attrs = $parsed_block['email_attrs'] ?? array();
|
||||
if ( ! empty( $email_attrs['padding'] ) ) {
|
||||
$link_html = sprintf(
|
||||
'<p style="padding: %s;">%s</p>',
|
||||
esc_attr( $email_attrs['padding'] ),
|
||||
$link_html
|
||||
);
|
||||
}
|
||||
|
||||
return $link_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VideoPress URL from block attributes for email rendering.
|
||||
*
|
||||
* @param array $attributes Block attributes.
|
||||
*
|
||||
* @return string VideoPress URL or empty string.
|
||||
*/
|
||||
private static function get_videopress_url( $attributes ) {
|
||||
// Construct URL from guid attribute.
|
||||
if ( ! empty( $attributes['guid'] ) ) {
|
||||
$guid = $attributes['guid'];
|
||||
|
||||
// VideoPress guids are alphanumeric only (e.g., "nfbj0J36").
|
||||
// Validate format to prevent any injection issues.
|
||||
if ( preg_match( '/^[a-zA-Z0-9]+$/', $guid ) ) {
|
||||
return 'https://videopress.com/v/' . $guid;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Features Endpoint
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use Automattic\Jetpack\My_Jetpack\Product;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
|
||||
/**
|
||||
* VideoPress REST API class for fetching site features from WPCOM.
|
||||
*/
|
||||
class VideoPress_Rest_Api_V1_Features {
|
||||
/**
|
||||
* Initializes the endpoints
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( static::class, 'register_rest_endpoints' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_endpoints() {
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'features',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => static::class . '::get_features',
|
||||
'permission_callback' => static::class . '::permissions_callback',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the user has permissions to see the features.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function permissions_callback() {
|
||||
return current_user_can( 'read' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns VideoPress feature flags fetched fresh from WPCOM.
|
||||
*
|
||||
* Uses My Jetpack's Product::get_site_features_from_wpcom() which calls
|
||||
* WPCOM /sites/%d/features API with a 15-second transient cache.
|
||||
*
|
||||
* @return \WP_REST_Response The response object.
|
||||
*/
|
||||
public static function get_features() {
|
||||
$features = Product::get_site_features_from_wpcom();
|
||||
|
||||
if ( is_wp_error( $features ) ) {
|
||||
return rest_ensure_response( $features );
|
||||
}
|
||||
|
||||
$active = $features['active'] ?? array();
|
||||
|
||||
return rest_ensure_response(
|
||||
array(
|
||||
'isVideoPressSupported' => true, // Always true due to free tier.
|
||||
// Check videopress-1tb-storage (Jetpack) or videopress (WordPress.com).
|
||||
'isVideoPress1TBSupported' => in_array( 'videopress-1tb-storage', $active, true )
|
||||
|| ( ( new Host() )->is_wpcom_platform() && in_array( 'videopress', $active, true ) ),
|
||||
'isVideoPressUnlimitedSupported' => in_array( 'videopress-unlimited-storage', $active, true ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Settings Endpoint
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use WP_Error;
|
||||
use WP_REST_Request;
|
||||
use WP_REST_Response;
|
||||
use WP_REST_Server;
|
||||
|
||||
/**
|
||||
* Rest API class for fetching and setting site settings related to VideoPress.
|
||||
*/
|
||||
class VideoPress_Rest_Api_V1_Settings {
|
||||
/**
|
||||
* Initializes the endpoints
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( static::class, 'register_rest_endpoints' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_endpoints() {
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'settings',
|
||||
array(
|
||||
array(
|
||||
'methods' => WP_REST_Server::READABLE,
|
||||
'callback' => array( static::class, 'get_settings' ),
|
||||
'permission_callback' => function () {
|
||||
return current_user_can( 'manage_options' );
|
||||
},
|
||||
),
|
||||
array(
|
||||
'methods' => WP_REST_Server::EDITABLE,
|
||||
'callback' => array( static::class, 'update_settings' ),
|
||||
'permission_callback' => function () {
|
||||
return Data::can_perform_action() && current_user_can( 'manage_options' );
|
||||
},
|
||||
'args' => array(
|
||||
'videopress_videos_private_for_site' => array(
|
||||
'description' => __( 'If the VideoPress videos should be private by default', 'jetpack-videopress-pkg' ),
|
||||
'type' => 'boolean',
|
||||
'required' => true,
|
||||
'sanitize_callback' => 'rest_sanitize_boolean',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the VideoPress settings.
|
||||
*
|
||||
* @return WP_Rest_Response - The response object.
|
||||
*/
|
||||
public static function get_settings() {
|
||||
$has_connected_owner = Data::has_connected_owner();
|
||||
if ( ! $has_connected_owner ) {
|
||||
return rest_ensure_response(
|
||||
new WP_Error(
|
||||
'owner_not_connected',
|
||||
'User not connected.',
|
||||
array(
|
||||
'code' => 503,
|
||||
'connect_url' => Admin_UI::get_admin_page_url(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$blog_id = Data::get_blog_id();
|
||||
if ( ! $blog_id ) {
|
||||
return rest_ensure_response(
|
||||
new WP_Error( 'site_not_registered', 'Site not registered.', 503 )
|
||||
);
|
||||
}
|
||||
|
||||
$status = 200;
|
||||
$data = Data::get_videopress_settings();
|
||||
|
||||
return rest_ensure_response(
|
||||
new WP_REST_Response( $data, $status )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the value of the VideoPress settings when a new value
|
||||
* is present on the request body.
|
||||
*
|
||||
* @param WP_REST_Request $request the request object.
|
||||
* @return WP_Rest_Response - The response object.
|
||||
*/
|
||||
public static function update_settings( $request ) {
|
||||
$has_connected_owner = Data::has_connected_owner();
|
||||
if ( ! $has_connected_owner ) {
|
||||
return rest_ensure_response(
|
||||
new WP_Error(
|
||||
'owner_not_connected',
|
||||
'User not connected.',
|
||||
array(
|
||||
'code' => 503,
|
||||
'connect_url' => Admin_UI::get_admin_page_url(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$blog_id = Data::get_blog_id();
|
||||
if ( ! $blog_id ) {
|
||||
return rest_ensure_response(
|
||||
new WP_Error( 'site_not_registered', 'Site not registered.', 503 )
|
||||
);
|
||||
}
|
||||
|
||||
$json_params = $request->get_json_params();
|
||||
|
||||
// We are sure that the param is set because it's required by the request
|
||||
update_option( 'videopress_private_enabled_for_site', boolval( $json_params['videopress_videos_private_for_site'] ) );
|
||||
|
||||
return rest_ensure_response(
|
||||
array(
|
||||
'code' => 'success',
|
||||
'message' => __( 'VideoPress settings updated successfully.', 'jetpack-videopress-pkg' ),
|
||||
'data' => 200,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Site Info Endpoint
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use WP_REST_Response;
|
||||
|
||||
/**
|
||||
* VideoPress rest api class for fetching site information
|
||||
*/
|
||||
class VideoPress_Rest_Api_V1_Site {
|
||||
/**
|
||||
* Initializes the endpoints
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( static::class, 'register_rest_endpoints' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_endpoints() {
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'site',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => static::class . '::get_site_info',
|
||||
'permission_callback' => static::class . '::permissions_callback',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the user have permissions to see the site info
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function permissions_callback() {
|
||||
return current_user_can( 'read' ); // TODO: confirm this
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the site information usually provided by Jetpack, without relying on Jetpack
|
||||
*
|
||||
* @return WP_Rest_Response The response object.
|
||||
*/
|
||||
public static function get_site_info() {
|
||||
$data = Site::get_site_info();
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* VideoPress Stats Endpoints
|
||||
*
|
||||
* @package automattic/jetpack-videopress
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\VideoPress;
|
||||
|
||||
use WP_REST_Response;
|
||||
|
||||
/**
|
||||
* VideoPress stats rest api class
|
||||
*/
|
||||
class VideoPress_Rest_Api_V1_Stats {
|
||||
/**
|
||||
* Initializes the endpoints
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'rest_api_init', array( static::class, 'register_rest_endpoints' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the REST API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register_rest_endpoints() {
|
||||
/**
|
||||
* Basic stats.
|
||||
*/
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'stats',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => static::class . '::get_stats',
|
||||
'permission_callback' => static::class . '::permissions_callback',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Stats to be featured by My Jetpack.
|
||||
*/
|
||||
register_rest_route(
|
||||
'videopress/v1',
|
||||
'stats/featured',
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => static::class . '::get_featured_stats',
|
||||
'permission_callback' => static::class . '::permissions_callback',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether the user have permissions to see stats
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function permissions_callback() {
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint for getting the general VideoPress stats for the site.
|
||||
*
|
||||
* Returns the plays for all the videos, for today and since the beggining of times.
|
||||
*
|
||||
* @return WP_Rest_Response - The response object.
|
||||
*/
|
||||
public static function get_stats() {
|
||||
$today_plays = Stats::get_today_plays();
|
||||
|
||||
if ( is_wp_error( $today_plays ) ) {
|
||||
// TODO: Improve status code.
|
||||
return rest_ensure_response( $today_plays );
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'plays' => array(
|
||||
'today' => $today_plays,
|
||||
),
|
||||
);
|
||||
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the stats that will be featured by My Jetpack.
|
||||
*
|
||||
* @return WP_Rest_Response - The response object.
|
||||
*/
|
||||
public static function get_featured_stats() {
|
||||
$featured_stats = Stats::get_featured_stats();
|
||||
return rest_ensure_response( $featured_stats );
|
||||
}
|
||||
}
|
||||
Loaded 100 of 17470 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user