Version Description
(2021/02/12) = * Fix: References for moved files were not updated. * Add: Sanitize filename after they have been through the mfrh_new_filename filter.
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media File Renamer |
Version | 5.1.6 |
Comparing to | |
See all releases |
Code changes from version 5.1.5 to 5.1.6
- media-file-renamer.php +2 -2
- readme.txt +5 -3
- trunk/app/index.js +0 -2
- trunk/app/vendor.js +0 -27
- trunk/classes/admin.php +0 -95
- trunk/classes/api.php +0 -131
- trunk/classes/core.php +0 -1122
- trunk/classes/init.php +0 -44
- trunk/classes/plugins/beaverbuilder.php +0 -37
- trunk/classes/plugins/custom.php +0 -73
- trunk/classes/plugins/unused_woocommerce.php +0 -18
- trunk/classes/plugins/wpml.php +0 -21
- trunk/classes/rest.php +0 -564
- trunk/classes/ui.php +0 -59
- trunk/classes/updates.php +0 -177
- trunk/common/admin.php +0 -174
- trunk/common/classes/issues.php +0 -29
- trunk/common/classes/ratings.php +0 -114
- trunk/common/classes/rest.php +0 -98
- trunk/common/classes/rest_license.php +0 -40
- trunk/common/classes/updater.php +0 -591
- trunk/common/helpers.php +0 -179
- trunk/common/img/default.png +0 -0
- trunk/common/img/kinsta.png +0 -0
- trunk/common/img/media-cleaner.jpg +0 -0
- trunk/common/img/media-file-renamer.jpg +0 -0
- trunk/common/img/meow-gallery.jpg +0 -0
- trunk/common/img/meow-lightbox.jpg +0 -0
- trunk/common/img/meowapps.png +0 -0
- trunk/common/img/stackpath.png +0 -0
- trunk/common/img/wp-retina-2x.jpg +0 -0
- trunk/common/img/wplr-sync.jpg +0 -0
- trunk/common/licenser.php +0 -126
- trunk/common/releases.txt +0 -6
- trunk/languages/media-file-renamer-fr_FR.mo +0 -0
- trunk/media-file-renamer.php +0 -26
- trunk/readme.txt +0 -435
media-file-renamer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Media File Renamer
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
6 |
-
Version: 5.1.
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: media-file-renamer
|
@@ -14,7 +14,7 @@ Originally developed for two of my websites:
|
|
14 |
- Haikyo (https://haikyo.org)
|
15 |
*/
|
16 |
|
17 |
-
define( 'MFRH_VERSION', '5.1.
|
18 |
define( 'MFRH_PREFIX', 'mfrh' );
|
19 |
define( 'MFRH_DOMAIN', 'media-file-renamer' );
|
20 |
define( 'MFRH_ENTRY', __FILE__ );
|
3 |
Plugin Name: Media File Renamer
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
6 |
+
Version: 5.1.6
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: media-file-renamer
|
14 |
- Haikyo (https://haikyo.org)
|
15 |
*/
|
16 |
|
17 |
+
define( 'MFRH_VERSION', '5.1.6' );
|
18 |
define( 'MFRH_PREFIX', 'mfrh' );
|
19 |
define( 'MFRH_DOMAIN', 'media-file-renamer' );
|
20 |
define( 'MFRH_ENTRY', __FILE__ );
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Media File Renamer - Auto & Manual Rename ===
|
2 |
Contributors: TigrouMeow
|
3 |
-
Tags: rename, file, media, seo, files, renamer, optimize, library
|
4 |
Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 5.1.
|
9 |
|
10 |
Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
11 |
|
@@ -29,6 +29,7 @@ More features are added in the [Pro Version](https://meowapps.com/plugin/media-f
|
|
29 |
- Transliteration (replace various accents, emoticons, umlauts, cyrillic, diacritics, by their ASCII equivalent)
|
30 |
- Automatic renaming based on the attached posts, products (and other post types), or ALT text
|
31 |
- Anonymizer (rename the files with anonymous files)
|
|
|
32 |
- Metadata syncing (ALT text, title, etc)
|
33 |
- Numbered files (to allow similar filenames to be renamed)
|
34 |
- Force Rename (if your install is broken, this will help you to re-link your media entries to your files)
|
@@ -66,7 +67,8 @@ The plugin can be tweaked in many ways, there are many actions and filters avail
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
-
= 5.1.
|
|
|
70 |
* Add: Sanitize filename after they have been through the mfrh_new_filename filter.
|
71 |
|
72 |
= 5.1.3 =
|
1 |
=== Media File Renamer - Auto & Manual Rename ===
|
2 |
Contributors: TigrouMeow
|
3 |
+
Tags: rename, file, media, move, seo, files, renamer, optimize, library
|
4 |
Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
|
5 |
Requires at least: 5.0
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 5.1.6
|
9 |
|
10 |
Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
11 |
|
29 |
- Transliteration (replace various accents, emoticons, umlauts, cyrillic, diacritics, by their ASCII equivalent)
|
30 |
- Automatic renaming based on the attached posts, products (and other post types), or ALT text
|
31 |
- Anonymizer (rename the files with anonymous files)
|
32 |
+
- Move files to another directory
|
33 |
- Metadata syncing (ALT text, title, etc)
|
34 |
- Numbered files (to allow similar filenames to be renamed)
|
35 |
- Force Rename (if your install is broken, this will help you to re-link your media entries to your files)
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 5.1.6 (2021/02/12) =
|
71 |
+
* Fix: References for moved files were not updated.
|
72 |
* Add: Sanitize filename after they have been through the mfrh_new_filename filter.
|
73 |
|
74 |
= 5.1.3 =
|
trunk/app/index.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
!function(e){function n(n){for(var r,i,l=n[0],c=n[1],u=n[2],f=0,d=[];f<l.length;f++)i=l[f],Object.prototype.hasOwnProperty.call(a,i)&&a[i]&&d.push(a[i][0]),a[i]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(s&&s(n);d.length;)d.shift()();return o.push.apply(o,u||[]),t()}function t(){for(var e,n=0;n<o.length;n++){for(var t=o[n],r=!0,l=1;l<t.length;l++){var c=t[l];0!==a[c]&&(r=!1)}r&&(o.splice(n--,1),e=i(i.s=t[0]))}return e}var r={},a={0:0},o=[];function i(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=r,i.d=function(e,n,t){i.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,n){if(1&n&&(e=i(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)i.d(t,r,function(n){return e[n]}.bind(null,r));return t},i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,"a",n),n},i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},i.p="";var l=window.wpJsonMfrh=window.wpJsonMfrh||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var u=0;u<l.length;u++)n(l[u]);var s=c;o.push([84,1]),t()}({0:function(e,n){e.exports=React},75:function(e,n){e.exports=ReactDOM},84:function(e,n,t){"use strict";t.r(n);var r=t(6),a=t(0),o=t.n(a),i=t(1),l=t.n(i);function c(){return(c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){f(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function d(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return m(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var p=function(e){var n=e.spinner,t=void 0===n||n,r=e.busy,i=void 0!==r&&r,l=e.overlayStyle,u=d(Object(a.useState)(!0),2),f=u[0],m=u[1];Object(a.useEffect)((function(){var e;return i?m(!0):e=setTimeout((function(){m(!1),e=null}),250),function(){e&&clearTimeout(e)}}),[i]);var p=f?o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"overlay "+(i?"":"overlayHidden"),style:l},Boolean(t)&&o.a.createElement("div",{className:"lds-ellipsis "+(i?"":"spinnerHidden")},o.a.createElement("div",null),o.a.createElement("div",null),o.a.createElement("div",null),o.a.createElement("div",null))),o.a.createElement("style",{jsx:!0},"\n .overlay {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background: rgb(30 124 186 / 85%);\n transition: opacity 1s ease-out;\n z-index: 10;\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n overflow: hidden;\n }\n\n .overlayHidden {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n .spinnerHidden {\n opacity: 0;\n transition: opacity 0.25s ease-out;\n }\n .lds-ellipsis {\n position: relative;\n width: 80px;\n height: 80px;\n display: flex;\n justify-items: center;\n align-items: center;\n }\n .lds-ellipsis div {\n position: absolute;\n width: 13px;\n height: 13px;\n border-radius: 50%;\n background: white;\n animation-timing-function: cubic-bezier(0, 1, 1, 0);\n }\n .lds-ellipsis div:nth-child(1) {\n left: 8px;\n animation: lds-ellipsis1 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(2) {\n left: 8px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(3) {\n left: 32px;\n animation: lds-ellipsis2 0.6s infinite;\n }\n .lds-ellipsis div:nth-child(4) {\n left: 56px;\n animation: lds-ellipsis3 0.6s infinite;\n }\n @keyframes lds-ellipsis1 {\n 0% {\n transform: scale(0);\n }\n 100% {\n transform: scale(1);\n }\n }\n @keyframes lds-ellipsis3 {\n 0% {\n transform: scale(1);\n }\n 100% {\n transform: scale(0);\n }\n }\n @keyframes lds-ellipsis2 {\n 0% {\n transform: translate(0, 0);\n }\n 100% {\n transform: translate(24px, 0);\n }\n } \n ")):null,h=s(s({},e),{},{busy:void 0,spinner:void 0});return o.a.createElement("div",c({style:{position:"relative"}},h),p,e.children)};p.propTypes={busy:l.a.bool.isRequired,spinner:l.a.bool,children:l.a.oneOfType([l.a.arrayOf(l.a.node),l.a.node]).isRequired};var h=p,b=t(2),g=t(4),y={black:"black",blackRGB:"0, 0, 0",blue:"#007cba",blueRGB:"0, 124, 186",deepBlue:"#134575",finderBorder:"#DEDEDE",lightBlue:"#EBF3FF",lightGray:"#F1F1F1",lightPurple:"#D8B1FF",gray:"#E8E8E8",green:"#0EA480",darkGray:"#A0A0A0",disabledForm:"#828282",orange:"#daa827",overlay:"rgba(16, 16, 16, 0.92)",red:"#ba4300",redHighlight:"#de5307",header:"#134675",proGray:"#7F8EA0",progress:"#8414a8",purple:"#956DBE",tableGray:"#FAFAFA",yellow:"#e4b42b",yellowRGB:"224, 156, 54",white:"white",fontFamily:"Lato",fontSizeH1:"24px",fontSizeH2:"18px",fontSizeText:"13px",fontSizeSmall:"12px",fontSizeSmallButton:"10px",lightShadow:"0px 0px 10px rgba(0,0,0,0.1)"},v=t(3),E=t(31),w=t.n(E),k=t(32),R=t.n(k),O=t(33),j=t.n(O),S=t(10),P=t.n(S),C=t(11),_=t.n(C),A=t(12),T=t.n(A),I=t(7),N=t.n(I),z=t(5),M=t.n(z),F=t(8),D=t.n(F),L=t(13),B=t.n(L),U=t(14),q=t.n(U),G=t(34),H=t.n(G),W=t(35),$=t.n(W),Y=t(15),J=t.n(Y),V=t(36),K=t.n(V),Z=t(37),X=t.n(Z),Q=t(38),ee=t.n(Q),ne=t(39),te=t.n(ne),re=(t(66),t(40)),ae=t.n(re),oe=t(41),ie=t.n(oe),le=t(42),ce=t.n(le),ue=t(43),se=t.n(ue),fe=t(44),de=t.n(fe),me=t(45),pe=t.n(me),he=t(46),be=t.n(he),ge=t(47),ye=t.n(ge),ve=t(48),Ee=t.n(ve),we=t(9),xe=t.n(we),ke=t(16),Re=t.n(ke),Oe=t(17),je=t.n(Oe),Se=t(49),Pe=t.n(Se),Ce=t(50),_e=t.n(Ce),Ae=t(51),Te=t.n(Ae),Ie=t(52),Ne=t.n(Ie),ze=t(53),Me=t.n(ze),Fe={lock:w.a,"lock-open":R.a,"file-undo":j.a,"chevron-double-left":P.a,"chevron-double-right":_.a,"chevron-left":T.a,"chevron-right":N.a,"chevron-down":M.a,"chevron-up":D.a,pause:B.a,play:q.a,replay:H.a,check:$.a,stop:J.a,delete:K.a,undo:X.a,alert:ee.a,database:te.a,tools:ae.a,cog:ie.a,close:ce.a,cat:se.a,upload:de.a,trash:pe.a,pencil:be.a,dashboard:ye.a,search:Ee.a,folder:xe.a,"folder-open":Re.a,"image-multiple-outline":je.a,plus:Pe.a,"folder-plus":_e.a,"image-plus":Te.a,"view-grid":Ne.a,"format-list-bulleted":Me.a};function De(){return(De=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Le(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Be(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: inline-block;\n box-sizing: border-box;\n height: 30px;\n min-width: 6em;\n border: none;\n border-radius: 4px;\n text-align: center;\n font-family: ",";\n font-size: ",";\n padding: 0 15px;\n\n background-color: ",";\n color: white;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n &.has-icon {\n align-items: center;\n display: inline-flex;\n padding: 2.5px 6px 2.5px 4px;\n }\n\n &.secondary {\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:hover {\n background-color: ",";\n }\n }\n\n &.danger {\n background-color: ",";\n border-color: ",";\n\n\t &:hover {\n\t\t background-color: ",";\n\t }\n }\n\n &.success {\n background-color: ",";\n border-color: ",";\n\n\t &:hover {\n\t\t background-color: ",";\n\t }\n }\n\n & + button {\n margin-left: .25rem;\n }\n\n &.small {\n font-size: ",";\n height: 24px;\n }\n\n ","\n"]);return Be=function(){return e},e}var Ue=Object(b.a)((function(e){var n=e.className,t=e.icon,r=void 0===t?null:t,a=e.onClick,i=e.disabled,l=void 0!==i&&i,c=e.color,u=void 0===c?null:c,s=e.small,f=e.children,d=Le(e,["className","icon","onClick","disabled","color","small","children"]),m=!!r,p="nui-button ".concat(n||"").concat(m?" has-icon":"").concat(u?" custom-color":"").concat(s?" small":"");return o.a.createElement("button",De({type:"button",className:p,onClick:a,disabled:l},d),m&&o.a.createElement(v.Icon,{icon:"string"==typeof r?Fe[r]||null:r,width:"24",height:"24",style:{marginRight:"4px"}}),o.a.createElement("span",null,f))}))(Be(),y.fontFamily,y.fontSizeText,y.blue,Object(g.a)(.1,y.blue),y.lightBlue,y.blue,y.blue,Object(g.a)(.1,y.lightBlue),y.red,y.red,Object(g.a)(.1,y.red),y.green,y.green,Object(g.a)(.1,y.green),y.fontSizeSmallButton,(function(e){return qe(e.color)})),qe=function(e){if(e)return"\n &.custom-color {\n background-color: ".concat(e,";\n border: 1px solid ").concat(e,";\n\n &:hover {\n background-color: ").concat(Object(g.a)(.1,e),";\n }\n }\n ")},Ge=function(e){return o.a.createElement(Ue,e)};function He(){return(He=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function We(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function $e(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n background-color: ",";\n position: relative;\n border-radius: 10px;\n color: ",";\n font-family: ",";\n font-size: 9px;\n line-height: 10px;\n padding: 5px 8px;\n text-transform: uppercase;\n text-decoration: none;\n\n &:hover {\n color: ",";\n background-color: #f78c1f;\n }\n\n &.inline {\n display: inline;\n margin-left: 5px;\n vertical-align: middle;\n }\n"]);return $e=function(){return e},e}Ge.propTypes={className:l.a.oneOf(["primary","secondary","danger","success"]),disabled:l.a.bool,icon:l.a.oneOfType([l.a.instanceOf(v.IconifyIcon),l.a.oneOf(["setting","edit","trash"])]),color:l.a.string,onClick:l.a.func.isRequired},Ge.defaultProps={className:"primary",disabled:!1,icon:null,color:null,onClick:function(){}};var Ye=b.a.a($e(),y.yellow,y.white,y.fontFamily,y.white),Je=function(e){var n=e.show,t=void 0===n||n,r=e.className,a=We(e,["show","className"]);return t?o.a.createElement(Ye,He({href:"https://store.meowapps.com",target:"_blank",className:"".concat(r||"")},a),"Pro Only"):null},Ve=function(e){return o.a.createElement(Je,e)};Ve.propTypes={show:l.a.bool,className:l.a.string},Ve.defaultProps={show:!0,className:void 0};var Ke=t(23),Ze=t.n(Ke);function Xe(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=tn(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function Qe(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function en(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Qe(o,r,a,i,l,"next",e)}function l(e){Qe(o,r,a,i,l,"throw",e)}i(void 0)}))}}function nn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||tn(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(e,n){if(e){if("string"==typeof e)return rn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rn(e,n):void 0}}function rn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var an=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Object(a.useState)(n),o=nn(r,2),i=o[0],l=o[1],c=Object(a.useState)(null),u=nn(c,2),s=u[0],f=u[1],d=Object(a.useState)(t),m=nn(d,2),p=m[0],h=m[1],b=Object(a.useState)(0),g=nn(b,2),y=g[0],v=g[1];return Object(a.useEffect)((function(){void 0!==e&&(e.success?(f(null),l(e.data),v(e.total?e.total:0)):f(e.error)),h(void 0===e)}),[e]),{busy:p,data:i,total:y,error:s}},on=function(){var e=Object(a.useRef)(),n=nn(Object(a.useState)({}),2),t=n[0],r=n[1];return Object(a.useEffect)((function(){if(e&&e.current){var n=new ResizeObserver((function(e){var n=e[0];n.contentRect&&r({width:n.contentRect.left+n.contentRect.right,height:n.contentRect.top+n.contentRect.bottom})}));return n.observe(e.current),function(){n.unobserve(e.current)}}}),[]),{ref:e,width:t.width?t.width:0,height:t.height?t.height:0}},ln=function(e){var n=Object(a.useRef)(),t=function(t){e&&!n.current.contains(t.target)&&e()};return Object(a.useEffect)((function(){return document.addEventListener("mousedown",t),function(){document.removeEventListener("mousedown",t)}})),n},cn=null,un=new Ze.a({concurrency:1,autoStart:!1});function sn(){var e=bn(["\n align-items: center;\n background-color: ",";\n border: none;\n box-sizing: border-box;\n color: white;\n display: flex;\n font-family: ",";\n font-size: ",";\n width: 100%;\n padding: 8px 15px 8px 15px;\n text-align: center;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled:not(.is-pro) {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n &.is-pro {\n background-color: ",";\n justify-content: space-between;\n }\n"]);return sn=function(){return e},e}function fn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return dn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return dn(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function mn(){var e=bn(["\n position: relative;\n display: block;\n margin-top: 18px;\n background-color: ",";\n position: absolute;\n z-index: 10;\n box-shadow: ",';\n\n &:before {\n content: "";\n position: absolute;\n top: -18px;\n left: 50%;\n margin-left: -8px;\n border: 8px solid transparent;\n border-bottom: 10px solid ',";\n }\n"]);return mn=function(){return e},e}function pn(){var e=bn(["\n align-items: center;\n background-color: ",";\n border: none;\n border-radius: 4px;\n box-sizing: border-box;\n color: white;\n display: inline-flex;\n justify-content: space-between;\n font-family: ",";\n font-size: ",";\n height: 30px;\n min-width: 6em;\n padding: 0px 10px;\n text-align: center;\n transition: background-color .10s, opacity .25s;\n\n :not([disabled]):hover {\n cursor: pointer;\n background-color: ",";\n }\n\n :disabled {\n opacity: 0.35;\n }\n\n :focus {\n outline: none;\n }\n\n & + button {\n margin-left: .25rem;\n }\n"]);return pn=function(){return e},e}function hn(){var e=bn(["\n display: inline-block;\n"]);return hn=function(){return e},e}function bn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var gn=b.a.div(hn()),yn=b.a.button(pn(),y.blue,y.fontFamily,y.fontSizeText,Object(g.a)(.1,y.blue)),vn=b.a.div(mn(),y.blue,y.lightShadow,y.blue),En=function(e){var n=e.title,t=e.disabled,r=void 0!==t&&t,a=e.isPro,i=void 0!==a&&a,l=e.style,c=void 0===l?{}:l,u=fn(o.a.useState(!1),2),s=u[0],f=u[1],d=ln((function(){f(!1)})),m=on(),p=m.ref,h=m.width,b=function(){f(!s)},g=o.a.Children.map(e.children,(function(e){return o.a.cloneElement(e,{isPro:i,disabled:e.props.disabled||r,onClick:function(){e.props.onClick&&e.props.onClick(),b()}})}));return o.a.createElement(gn,{ref:d},o.a.createElement(yn,{ref:p,type:"button",disabled:r,onClick:b,style:c},o.a.createElement("span",null,n),o.a.createElement(v.Icon,{icon:M.a,width:"24",height:"24",style:{marginLeft:"4px"}})),s&&o.a.createElement(vn,{style:{transform:"translateX(calc(-50% + ".concat(h/2,"px))")}},g))},wn=b.a.button(sn(),y.blue,y.fontFamily,y.fontSizeText,Object(g.a)(.1,y.blue),y.proGray),xn=function(e){var n=e.onClick,t=e.children,r=e.isPro,a=e.requirePro,i=void 0!==a&&a,l=e.disabled,c=i&&!r;return o.a.createElement(wn,{type:"button",className:c?"is-pro":"",onClick:n,disabled:l||c},o.a.createElement("span",null,t),c&&!r&&o.a.createElement(Ve,null))},kn=function(e){return o.a.createElement(En,e)},Rn=function(e){return o.a.createElement(xn,e)};function On(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||jn(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jn(e,n){if(e){if("string"==typeof e)return Sn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Sn(e,n):void 0}}function Sn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Pn(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n position: relative;\n background: #f1f1f1;\n margin-left: -20px;\n background-color: rgb(30 124 186 / 10%);\n padding-bottom: 50px;\n margin-bottom: -26px;\n\n .neko-rest-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: #1e232deb;\n z-index: 100;\n\n .container {\n color: white;\n padding: 5px 20px 15px 20px;\n min-width: 480px;\n max-width: 600px;\n border-radius: 20px;\n background: #883131;\n margin-left: 50%;\n transform: translateX(-50%);\n margin-top: 100px;\n\n h3 {\n color: white;\n }\n\n .neko-debug {\n padding: 5px 10px;\n background: #692426;\n border-radius: 10px;\n\n * {\n margin: 0px;\n padding: 0px;\n } \n }\n }\n }\n"]);return Pn=function(){return e},e}kn.propTypes={title:l.a.string,disabled:l.a.bool,isPro:l.a.bool},kn.defaultProps={title:void 0,disabled:!1,isPro:!1},Rn.propTypes={onClick:l.a.func.isRequired,requirePro:l.a.bool},Rn.defaultProps={onClick:function(){},requirePro:!1};var Cn=b.a.div(Pn()),_n=function(e){var n=e.className,t=e.children,r=e.nekoErrors,i=void 0===r?[]:r,l=e.style,c=void 0===l?{}:l,u=On(Object(a.useState)(!1),2),s=u[0],f=u[1],d=On(Object(a.useState)(!1),2),m=d[0],p=d[1];if(i&&!s){var h,b=function(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=jn(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}(i);try{for(b.s();!(h=b.n()).done;){var g=h.value;if(g){f(g);break}}}catch(e){b.e(e)}finally{b.f()}}return o.a.createElement(Cn,{className:n||"",style:c},s&&o.a.createElement("div",{className:"neko-rest-error"},o.a.createElement("div",{className:"container"},!m&&o.a.createElement(o.a.Fragment,null,o.a.createElement("h3",null,"The Rest API is disabled or broken 😢"),o.a.createElement("p",null,"The Rest API is required for this plugin to work. It is enabled in WordPress by default since December 2016 and used by the Gutenberg Editor since 2019. In short, it allows more robustness and a much cleaner infrastructure. Soon, Wordpress will entirely depends on it, so it is important to keep it enabled."),o.a.createElement("p",null,o.a.createElement("i",null,"Last but not least: check your PHP Error Logs and your Debugging Console.")),o.a.createElement("p",{className:"neko-debug"},o.a.createElement("small",null,"URL: ",s.url,o.a.createElement("br",null),"CODE: ",s.code,o.a.createElement("br",null),"MESSAGE: ",s.message,o.a.createElement("br",null)))),s.body&&m&&o.a.createElement("p",{className:"neko-debug"},o.a.createElement("div",{dangerouslySetInnerHTML:{__html:s.body}})),s.body&&o.a.createElement(Ge,{color:"#a94242",onClick:function(){return p(!m)}},m?"Hide":"Display"," response from server"),o.a.createElement(Ge,{color:"#a94242",onClick:function(){window.open("https://meowapps.com/debugging-wordpress/","_blank")}},"Learn about WordPress Debugging"))),t)},An=function(e){return o.a.createElement(_n,e)};function Tn(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function In(){var e=Fn(["\n font-family: ",";\n font-size: ",";\n line-height: normal;\n margin: 0;\n padding: 0;\n"]);return In=function(){return e},e}function Nn(){var e=Fn(["\n font-family: ",";\n font-size: ",";\n line-height: normal;\n margin: 16px 0 24px;\n padding: 0;\n"]);return Nn=function(){return e},e}function zn(){var e=Fn(["\n font-family: ",";\n font-size: ",";\n font-weight: normal;\n line-height: normal;\n margin-top: 0;\n margin-bottom: 16px;\n padding: 0;\n"]);return zn=function(){return e},e}function Mn(){var e=Fn(["\n font-family: ",";\n font-weight: normal;\n font-size: ",";\n line-height: normal;\n margin-top: 0;\n margin-bottom: 16px;\n padding: 0;\n"]);return Mn=function(){return e},e}function Fn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}An.propTypes={className:l.a.string,style:l.a.object,nekoErrors:l.a.bool},An.defaultProps={className:void 0,style:{},nekoErrors:!1};var Dn=b.a.h1(Mn(),y.fontFamily,y.fontSizeH1),Ln=b.a.h2(zn(),y.fontFamily,y.fontSizeH2),Bn=b.a.p(Nn(),y.fontFamily,y.fontSizeText),Un=b.a.span(In(),y.fontFamily,y.fontSizeText),qn=function(e){var n=e.children,t=Tn(e,["children"]);return e.h1?o.a.createElement(Dn,t,n):e.h2?o.a.createElement(Ln,t,n):e.p?o.a.createElement(Bn,t,n):o.a.createElement(Un,t,n)},Gn=function(e){return o.a.createElement(qn,e)};function Hn(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n font-size: ",";\n margin-bottom: 15px;\n \n .nui-block-title {\n color: ",";\n padding: 5px 10px;\n margin-bottom: 5px;\n }\n\n .nui-block-content {\n background-color: #f1f1f1;\n padding: 26px;\n box-shadow: 0px 2px 5px 0px #0000004a;\n border-radius: 10px;\n\n p:first-child {\n margin-top: 0;\n }\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n\n &.primary {\n padding: 8px;\n background-color: ",";\n\n .nui-block-title {\n color: ",";\n }\n\n .nui-block-content {\n background-color: ",";\n }\n }\n"]);return Hn=function(){return e},e}Gn.propTypes={h1:l.a.any,h2:l.a.any,p:l.a.any},Gn.defaultProps={h1:void 0,h2:void 0,p:void 0};var Wn=b.a.div(Hn(),y.fontSizeText,y.blue,y.blue,y.white,y.white),$n=function(e){var n=e.title,t=e.children,r=e.className,a=e.busy,i=void 0!==a&&a,l=e.style,c=void 0===l?{}:l;return o.a.createElement(Wn,{className:"nui-block "+(r||""),style:c},o.a.createElement(h,{busy:i},o.a.createElement(Gn,{h2:!0,className:"nui-block-title"},n),o.a.createElement("div",{className:"nui-block-content"},t)))},Yn=function(e){return o.a.createElement($n,e)};function Jn(){var e=Kn(["\n justify-content: flex-start;\n background-color: ",";\n display: flex;\n align-items: center;\n padding: 8px 10px;\n\n &.align-right {\n justify-content: flex-end;\n }\n"]);return Jn=function(){return e},e}function Vn(){var e=Kn(["\n font-size: ",";\n font-family: ",";\n background-color: ",";\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);\n margin-bottom: 25px;\n\n &.primary {\n background-color: ",";\n }\n\n p:first-child {\n margin-top: 0px;\n }\n\n p:last-child {\n margin-bottom: 0px;\n }\n\n .content {\n padding: 20px 20px;\n }\n"]);return Vn=function(){return e},e}function Kn(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Yn.propTypes={title:l.a.string,className:l.a.oneOf(["","primary"]),style:l.a.object},Yn.defaultProps={title:void 0,className:"",style:{}};var Zn=b.a.div(Vn(),y.fontSizeText,y.fontFamily,y.white,y.blue),Xn=b.a.div(Jn(),y.lightGray),Qn=function(e){var n=e.children,t=e.header,r=e.headerAlign,a=void 0===r?"left":r,i=e.footer,l=e.footerAlign,c=void 0===l?"right":l,u=e.className,s=e.style,f=void 0===s?{}:s;return o.a.createElement(Zn,{className:u||"",style:f},t&&o.a.createElement(Xn,{className:"align-".concat(a)},t),o.a.createElement("div",{className:"content"},n),i&&o.a.createElement(Xn,{className:"align-".concat(c)},i))},et=function(e){return o.a.createElement(Qn,e)};function nt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: flex;\n font-family: ",";\n\n > .nui-settings-head {\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n width: 120px;\n margin-right: 16px;\n }\n\n /* Select, Checkbox, Input need to be a bit higher to be in front of the settings title */\n\n .nui-settings-content > .nui-select:first-child {\n position: relative;\n margin-top: -5px;\n }\n \n .nui-settings-content > .nui-checkbox:first-child {\n position: relative;\n margin-top: -5px;\n }\n\n .nui-settings-content > .nui-checkbox:first-child {\n position: relative;\n margin-top: -5px;\n }\n\n .nui-settings-content > .nui-button:first-child {\n position: relative;\n margin-top: -5px;\n }\n\n .nui-settings-content > div:first-child > .neko-input {\n position: relative;\n margin-top: -5px;\n }\n\n > .nui-settings-content {\n flex: 1;\n\n &.nui-settings-content-align-right {\n flex: none;\n margin-left: auto;\n }\n\n input[type=text] {\n width: 100%;\n }\n\n\n }\n\n & + div {\n margin-top: 15px;\n }\n"]);return nt=function(){return e},e}et.propTypes={header:l.a.element,headerAlign:l.a.oneOf(["left","right"]),footer:l.a.element,footerAlign:l.a.oneOf(["left","right"]),className:l.a.string,style:l.a.object},et.defaultProps={header:void 0,headerAlign:"left",footer:void 0,footerAlign:"right",className:void 0,style:{}};var tt=Object(b.a)((function(e){var n=e.title,t=void 0===n?"":n,r=e.contentAlign,a=void 0===r?"left":r;return o.a.createElement("div",{className:e.className||""},t?o.a.createElement("div",{className:"nui-settings-head"},t):null,o.a.createElement("div",{className:"nui-settings-content nui-settings-content-align-".concat(a)},e.children))}))(nt(),y.fontFamily,y.fontFamily),rt=function(e){return o.a.createElement(tt,e)};function at(){var e=it(["\n background-color: ",";\n color: white;\n"]);return at=function(){return e},e}function ot(){var e=it(["\n margin: 20px;\n padding: 14px;\n background-color: white;\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n\n > * + * {\n /* Base margin between child elements */\n margin-top: 14px;\n }\n"]);return ot=function(){return e},e}function it(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}rt.propTypes={title:l.a.string,className:l.a.string,contentAlign:l.a.string},rt.defaultProps={title:"",className:void 0,contentAlign:"left"};var lt=b.a.div(ot()),ct=Object(b.a)((function(e){return e.children?o.a.createElement("div",{className:e.className},e.children):null}))(at(),y.blue),ut=function(e){return o.a.createElement(lt,{className:"window"},o.a.createElement(ct,null,e.title),e.children)},st=function(e){return o.a.createElement(ut,e)};function ft(){return(ft=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function dt(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function mt(){var e=ht(["\n flex: 1;\n padding: 32px 30px;\n\n .nui-block:not(:first-child) {\n margin-top: -20px;\n }\n\n .nui-block:last-child {\n margin-bottom: 0px;\n }\n\n &.minimal {\n padding: 0;\n }\n\n &.full {\n flex-basis: 100%;\n padding-bottom: 0;\n }\n\n & + .full {\n padding-bottom: 32px;\n padding-top: 0;\n }\n\n &:not(.full) + div:not(.full) {\n padding-left: 0;\n }\n"]);return mt=function(){return e},e}function pt(){var e=ht(["\n display: flex;\n flex-wrap: wrap;\n"]);return pt=function(){return e},e}function ht(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}st.propTypes={title:l.a.string},st.defaultProps={title:void 0};var bt=b.a.div(pt()),gt=b.a.div(mt()),yt=function(e){return o.a.createElement(bt,null,e.children)},vt=function(e){var n=e.full,t=e.minimal,r=dt(e,["full","minimal"]),a=n?"full":"";return a+=t?" minimal":"",o.a.createElement(gt,ft({className:a},r),e.children)},Et=function(e){return o.a.createElement(yt,e)},wt=function(e){return o.a.createElement(vt,e)};Et.propTypes={},Et.defaultProps={},wt.propTypes={full:l.a.any},wt.defaultProps={full:void 0};var xt=t(19),kt=t.n(xt),Rt=t(20),Ot=t.n(Rt);function jt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n font-family: ",";\n\n &.disabled {\n color: ",";\n\n label {\n cursor: default;\n }\n }\n\n input {\n display: none;\n }\n\n label {\n cursor: pointer;\n display: flex;\n }\n .nui-checkbox-check-container {\n flex-basis: 30px;\n }\n .nui-checkbox-inner-container {\n margin-top: 1.5px;\n margin-left: 4px;\n\n .label {\n display: block;\n font-size: 14px;\n line-height: 17px;\n padding-top: 4.5px;\n padding-bottom: 4px;\n }\n \n .description {\n display: block;\n font-size: 13px;\n line-height: 14px;\n color: #8a8a8a;\n\n * {\n font-size: 13px;\n line-height: inherit;\n margin: 0;\n }\n }\n }\n"]);return jt=function(){return e},e}var St=Object(b.a)((function(e){var n=e.id,t=e.name,r=e.checked,a=void 0!==r&&r,i=e.onChange,l=e.label,c=e.description,u=e.isPro,s=e.disabled,f=e.requirePro,d=void 0!==f&&f&&!u,m=s||d,p=m?"disabled":"";return o.a.createElement("div",{className:["nui-checkbox",e.className,p].join(" ")},o.a.createElement("input",{id:n,name:t,type:"checkbox",defaultChecked:!1,onClick:function(){i?i(!a,n):console.log("The onChange handler it not set for this checkbox.",e)},disabled:m}),o.a.createElement("label",{htmlFor:n},o.a.createElement("div",{className:"nui-checkbox-check-container"},o.a.createElement(v.Icon,{icon:a?Ot.a:kt.a,width:"30px",height:"30px",color:m?y.disabledForm:y.blue})),o.a.createElement("div",{className:"nui-checkbox-inner-container"},o.a.createElement("span",{className:"label"},l,o.a.createElement(Ve,{className:"inline",show:d})),c?o.a.createElement("small",{className:"description"},c):null)))}))(jt(),y.fontFamily,y.disabledForm),Pt=function(e){return o.a.createElement(St,e)};function Ct(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n"]);return Ct=function(){return e},e}Pt.propTypes={id:l.a.string,name:l.a.string,checked:l.a.bool,label:l.a.string,description:l.a.string,isPro:l.a.bool,requirePro:l.a.bool},Pt.defaultProps={id:void 0,name:void 0,checked:!1,label:void 0,description:void 0,isPro:!1,requirePro:!1};var _t=Object(b.a)((function(e){var n=e.name,t=(e.max,e.isPro),r=void 0!==t&&t;return o.a.Children.map(e.children,(function(e){return e.props.name?e:o.a.cloneElement(e,{name:n,isPro:r})}))}))(Ct()),At=function(e){return o.a.createElement(_t,e)};function Tt(){return(Tt=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function It(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Nt(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Nt(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function zt(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Mt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n .neko-input {\n font-family: ",";\n font-size: ",";\n border: 2px solid ",";\n box-sizing: border-box;\n height: 30px;\n background: rgb(0 124 186 / 10%);\n padding: 0 10px;\n width: 100%;\n\n &.natural {\n border-color: gray;\n border-width: 1px;\n }\n\n &::placeholder {\n color: rgba(0, 0, 0, 0.25);\n }\n\n :focus {\n background-color: white;\n }\n\n :read-only {\n background-color: ",";\n }\n }\n\n .neko-input-description {\n font-family: ",";\n font-size: ",";\n line-height: 14px;\n margin-top: 8px;\n margin-bottom: 0;\n }\n"]);return Mt=function(){return e},e}At.propTypes={name:l.a.string,mas:l.a.number,isPro:l.a.bool},At.defaultProps={name:void 0,mas:-1,isPro:!1};var Ft=Object(b.a)((function(e){var n=e.id,t=e.name,r=e.value,i=void 0===r?"":r,l=e.description,c=e.placeholder,u=void 0===c?"":c,s=e.onEnter,f=void 0===s?null:s,d=e.readOnly,m=void 0!==d&&d,p=e.type,h=void 0===p?"text":p,b=e.step,g=void 0===b?1:b,y=e.min,v=void 0===y?1:y,E=e.max,w=void 0===E?999:E,x=e.maxLength,k=void 0===x?3:x,R=e.className,O=e.style,j=e.natural,S=void 0!==j&&j,P=zt(e,["id","name","value","description","placeholder","onEnter","readOnly","type","step","min","max","maxLength","className","style","natural"]),C=It(Object(a.useState)(i),2),_=C[0],A=C[1],T=!!e.onChange;Object(a.useEffect)((function(){T||A(i)}),[i]);var I=function(t){T?e.onChange(t.target.value,n):A(t.target.value,n)},N=function(t){f&&"Enter"===event.key&&(t.preventDefault(),e.onEnter(t.target.value,n))},z=function(t){e.onBlur&&i!==t.target.value&&e.onBlur(t.target.value,n)},M="neko-input ".concat(S?" natural":"");return o.a.createElement("div",{className:[R].join(" "),style:O},"number"===h?o.a.createElement("input",Tt({className:[M].join(" ")},P,{id:n,name:t,value:T?i:_,type:h,step:g,min:v,max:w,maxlength:k,autocomplete:"off",placeholder:u,onChange:I,onKeyPress:N,onBlur:z,readOnly:m})):o.a.createElement("input",Tt({className:[M].join(" ")},P,{id:n,name:t,value:T?i:_,type:h,spellcheck:"false",autocomplete:"off",placeholder:u,onChange:I,onKeyPress:N,onBlur:z,readOnly:m})),l&&o.a.createElement("p",{className:"neko-input-description"},l))}))(Mt(),y.fontFamily,y.fontSizeText,y.blue,y.gray,y.fontFamily,y.fontSizeSmall),Dt=function(e){return o.a.createElement(Ft,e)};function Lt(){return(Lt=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Bt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Ut(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ut(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ut(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function qt(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function Gt(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n .neko-textarea {\n font-family: ",";\n font-size: ",";\n border: 2px solid ",";\n box-sizing: border-box;\n height: 160px;\n background: rgb(0 124 186 / 10%);\n padding: 0 10px;\n width: 100%;\n\n &::placeholder {\n color: rgba(0, 0, 0, 0.25);\n }\n\n :focus {\n background-color: white;\n }\n\n :read-only {\n background-color: ",";\n }\n }\n\n .neko-input-description {\n font-family: ",";\n font-size: ",";\n line-height: 14px;\n margin-top: 8px;\n margin-bottom: 0;\n }\n"]);return Gt=function(){return e},e}Dt.propTypes={id:l.a.string,type:l.a.oneOf(["number","text"]),name:l.a.string,value:l.a.string,description:l.a.string,placeholder:l.a.string,onChange:l.a.func,onEnter:l.a.func,onBlur:l.a.func,readOnly:l.a.bool,step:l.a.number,min:l.a.number,max:l.a.number,maxLength:l.a.number,natural:l.a.bool},Dt.defaultProps={id:void 0,type:"text",name:void 0,value:"",description:void 0,placeholder:"",onChange:void 0,onEnter:void 0,onBlur:void 0,readOnly:!1,step:1,min:1,max:999,maxLength:3,natural:!1};var Ht=Object(b.a)((function(e){var n=e.id,t=e.name,r=e.value,i=void 0===r?"":r,l=e.description,c=e.placeholder,u=void 0===c?"":c,s=e.onEnter,f=void 0===s?null:s,d=e.readOnly,m=void 0!==d&&d,p=(e.maxLength,e.className),h=e.style,b=e.textAreaStyle,g=void 0===b?{}:b,y=qt(e,["id","name","value","description","placeholder","onEnter","readOnly","maxLength","className","style","textAreaStyle"]),v=Bt(Object(a.useState)(i),2),E=v[0],w=v[1],x=!!e.onChange;Object(a.useEffect)((function(){x||w(i)}),[i]);return o.a.createElement("div",{className:[p].join(" "),style:h},o.a.createElement("textarea",Lt({className:"neko-textarea"},y,{id:n,name:t,spellCheck:"false",placeholder:u,onChange:function(t){x?e.onChange(t.target.value,n):w(t.target.value,n)},onKeyPress:function(t){f&&"Enter"===event.key&&(t.preventDefault(),e.onEnter(t.target.value,n))},onBlur:function(t){e.onBlur&&i!==t.target.value&&e.onBlur(t.target.value,n)},readOnly:m,style:g}),x?i:E),l&&o.a.createElement("p",{className:"neko-input-description"},l))}))(Gt(),y.fontFamily,y.fontSizeText,y.blue,y.gray,y.fontFamily,y.fontSizeSmall),Wt=function(e){return o.a.createElement(Ht,e)};Wt.propTypes={id:l.a.string,name:l.a.string,value:l.a.string,description:l.a.string,placeholder:l.a.string,onChange:l.a.func,onEnter:l.a.func,onBlur:l.a.func,readOnly:l.a.bool},Wt.defaultProps={id:void 0,name:void 0,value:"",description:void 0,placeholder:"",onChange:void 0,onEnter:void 0,onBlur:void 0,readOnly:!1};var $t=t(57),Yt=t.n($t),Jt=t(58),Vt=t.n(Jt);function Kt(){var e=lr(["\n background-color: ",";\n cursor: pointer;\n font-family: ",";\n padding: 8px 12px;\n\n &:hover {\n filter: brightness(80%);\n }\n\n input {\n display: none;\n }\n\n .option {\n align-items: center;\n color: ",";\n display: flex;\n justify-content: space-between;\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n }\n\n &.disabled {\n background-color: rgb(224 156 54);\n pointer-events: none;\n\n .option {\n color: rgb(255 255 255 / 35%);\n }\n }\n"]);return Kt=function(){return e},e}function Zt(){var e=lr(["\n font-family: ",";\n margin-bottom: 6px;\n\n input {\n display: none;\n }\n\n label {\n cursor: pointer;\n display: flex;\n }\n\n .inner-container {\n margin-left: 4px;\n\n .label {\n display: block;\n font-size: 14px;\n line-height: 17px;\n padding-top: 4.5px;\n padding-bottom: 4px;\n }\n .description {\n display: block;\n font-size: 12px;\n }\n }\n\n &.disabled {\n color: ",";\n\n label {\n cursor: default;\n }\n }\n"]);return Zt=function(){return e},e}function Xt(){return(Xt=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function Qt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return er(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return er(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function er(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function nr(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function tr(){var e=lr(["\n background-color: ",";\n"]);return tr=function(){return e},e}function rr(){var e=lr(["\n border-radius: 8px;\n overflow: hidden;\n padding-top: 28px;\n position: absolute;\n top: 0;\n z-index: 10;\n width: 100%;\n transition: all 0.2s ease-in;\n\n &.hidden {\n opacity: 0;\n }\n"]);return rr=function(){return e},e}function ar(){var e=lr(["\n display: block;\n margin-top: 5px;\n font-size: 13px;\n line-height: 14px;\n color: #8a8a8a;\n\n * {\n font-size: 13px;\n line-height: inherit;\n margin: 0;\n }\n"]);return ar=function(){return e},e}function or(){var e=lr(["\n align-items: center;\n background-color: ",";\n border: 2px solid ",";\n border-radius: 8px;\n display: flex;\n font-family: ",";\n font-size: 14px;\n padding: 0 5px 0 10px;\n box-sizing: border-box;\n height: 30px;\n\n .rightContent {\n align-items: center;\n display: flex;\n margin-left: auto;\n }\n"]);return or=function(){return e},e}function ir(){var e=lr(["\n border-radius: 8px;\n position: relative;\n user-select: none;\n cursor: pointer;\n\n &.show-options {\n background-color: ",";\n border-radius: 8px 8px 0 0;\n }\n"]);return ir=function(){return e},e}function lr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var cr=b.a.div(ir(),y.blue),ur=b.a.div(or(),y.white,y.blue,y.fontFamily),sr=b.a.div(ar()),fr=b.a.div(rr()),dr=b.a.div(tr(),y.white),mr=function(e){var n,t=e.id,r=e.name,i=e.value,l=e.scrolldown,c=void 0!==l&&l,u=e.isPro,s=void 0!==u&&u,f=e.onChange,d=nr(e,["id","name","value","scrolldown","isPro","onChange"]),m=null===(n=o.a.Children.toArray(e.children).find((function(e){return e.props.value===i||e.props.checked})))||void 0===n?void 0:n.props,p=(null==m?void 0:m.label)||"Select",h=(null==m?void 0:m.description)||e.description,b=(null==m?void 0:m.requirePro)||!1,g=Qt(Object(a.useState)(!1),2),y=g[0],E=g[1],w=c?ln((function(){E(!1)})):null,x=b&&!s,k=function(n){if(n!==i){if(!f)return void console.log("The onChange handler it not set for this checkbox.",e);f(n,t)}c&&E(!1)},R=o.a.Children.map(e.children,(function(e){return o.a.cloneElement(e,{name:e.props.name||r,checked:e.props.value===i||e.props.checked,onClick:k,scrolldown:c,isPro:s})}));return c?o.a.createElement(cr,Xt({id:t,ref:w},d,{onClick:function(){return E(!y)},className:["nui-select",y?"show-options":""],childrenLength:R.length}),o.a.createElement(ur,null,p,o.a.createElement("div",{className:"rightContent"},x&&o.a.createElement(Ve,null),o.a.createElement(v.Icon,{icon:y?D.a:M.a,width:"24"}))),h&&o.a.createElement(sr,null,h),y&&o.a.createElement(fr,{className:y?"":"hidden"},o.a.createElement(dr,null,[R]))):R},pr=b.a.div(Zt(),y.fontFamily,y.disabledForm),hr=b.a.div(Kt(),y.blue,y.fontFamily,y.white,y.fontFamily),br=function(e){var n=e.id,t=e.name,r=e.value,a=e.checked,i=e.label,l=e.description,c=e.onClick,u=e.scrolldown,s=e.isPro,f=void 0!==s&&s,d=e.requirePro,m=void 0!==d&&d&&!f,p=m?"disabled":"",h=o.a.createElement(pr,{className:"nui-select ".concat(e.className||""," ").concat(p)},o.a.createElement("input",{id:n,name:t,type:"radio",value:r,defaultChecked:a,onClick:function(e){return c(e.target.value)},disabled:m}),o.a.createElement("label",{htmlFor:n},o.a.createElement(v.Icon,{icon:a?Vt.a:Yt.a,width:"24px",color:m?y.disabledForm:y.blue}),o.a.createElement("div",{className:"inner-container"},o.a.createElement("span",{className:"label"},i,o.a.createElement(Ve,{className:"inline",style:{top:-1},show:m})),l?o.a.createElement("small",{className:"description"},l):null))),b=o.a.createElement(hr,{className:"nui-select ".concat(e.className||""," ").concat(p)},o.a.createElement("input",{id:n,name:t,type:"radio",value:r,defaultChecked:a,disabled:m}),o.a.createElement("div",{className:"option",onClick:function(){return c(r)}},i,o.a.createElement(Ve,{show:m})));return u?b:h},gr=function(e){return o.a.createElement(mr,e)};gr.propTypes={id:l.a.string,name:l.a.string,description:l.a.string,scrolldown:l.a.bool,isPro:l.a.bool,onChange:l.a.func},gr.propTypes={id:void 0,name:void 0,description:void 0,scrolldown:!1,isPro:!1,onChange:void 0};var yr=function(e){return o.a.createElement(br,e)};yr.propTypes={id:l.a.string,name:l.a.string,value:l.a.string,checked:l.a.bool,label:l.a.string,description:l.a.string,onClick:l.a.func,scrolldown:l.a.bool,isPro:l.a.bool,requirePro:l.a.bool},yr.defaultProps={id:void 0,name:void 0,value:void 0,checked:!1,label:void 0,description:void 0,onClick:void 0,scrolldown:!1,isPro:!1,requirePro:!1};var vr=t(59),Er=t.n(vr);function wr(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return xr(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xr(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xr(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function kr(){var e=Sr(["\n border-left: 1px solid ",";\n margin-left: 12px;\n padding-left: 6px;\n\n &.no-line {\n border-left: 0;\n padding-left: 12px;\n }\n\n &.no-chevron {\n border-left: 0;\n margin-left: 0;\n padding-left: 0;\n }\n"]);return kr=function(){return e},e}function Rr(){var e=Sr(["\n height: 24px;\n width: 24px;\n"]);return Rr=function(){return e},e}function Or(){var e=Sr(["\n align-items: center;\n display: flex;\n\n &.can-expand {\n cursor: pointer;\n }\n\n &.selected {\n color: #956DBE;\n }\n\n p {\n margin: 0 0 0 8px;\n }\n"]);return Or=function(){return e},e}function jr(){var e=Sr(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin-bottom: 5px;\n font-family: Lato;\n"]);return jr=function(){return e},e}function Sr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var Pr=function(e){var n=e.chevron,t=void 0===n||n;return o.a.Children.map(e.children,(function(e){return o.a.cloneElement(e,{chevron:t})}))},Cr=b.a.div(jr()),_r=b.a.div(Or()),Ar=b.a.div(Rr()),Tr=b.a.div(kr(),y.finderBorder),Ir=function(e){var n={gallery:je.a,tag:Er.a},t=e.title,r=e.chevron,a=e.rightElement,i=void 0===a?null:a,l=e.rightElementStyle,c=void 0===l?{marginLeft:"5px"}:l,u=e.showRightElement,s=void 0!==u&&u,f=e.selected,d=void 0!==f&&f,m=e.draggable,p=void 0!==m&&m,h=e.onDragStart,b=e.onDragOver,g=e.onDragEnd,E=e.onDrop,w=e.isExpanded,x=void 0!==w&&w,k=e.dragging,R=void 0!==k&&k,O=e.rightAction,j=void 0===O?null:O,S=e.rightActionOnHover,P=void 0===S?null:S,C=e.onDragLeave,_=!!e.icon,A=!!e.children,T=wr(o.a.useState(x),2),I=T[0],z=T[1],F=wr(o.a.useState((function(){return"string"==typeof e.icon&&Object.keys(n).includes(e.icon)?n[e.icon]:e.icon?e.icon:xe.a})),2),D=F[0],L=F[1],B=Boolean(D),U=wr(o.a.useState(!1),2),q=U[0],G=U[1],H=o.a.Children.map(e.children,(function(e){return o.a.cloneElement(e,{chevron:r})})),W=R||d?y.purple:d?y.black:y.blue;return o.a.createElement("div",null,o.a.createElement(Cr,{onMouseEnter:function(){return G(!0)},onMouseLeave:function(){return G(!1)}},o.a.createElement(_r,{onClick:function(){e.onClick&&e.onClick(),(B||A)&&(_||L(I?xe.a:Re.a),z(!I))},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,draggable:p,onDragStart:h,onDragOver:b,onDrop:E,className:"".concat(B||H||e.onClick?"can-expand":""," ").concat(d?"selected":""),onDragLeave:C,onDragEnd:g},r?B&&A?o.a.createElement(v.Icon,{icon:I?M.a:N.a,width:"24",height:"24"}):o.a.createElement(Ar,null):null,o.a.createElement(v.Icon,{icon:D,color:W,width:"24",height:"24"}),o.a.createElement("p",null,t),s&&o.a.createElement("div",{style:c},i)),q&&P||j),I&&o.a.createElement(Tr,{className:"".concat(B?"":"no-line"," ").concat(r?"":"no-chevron")},H))},Nr=function(e){return o.a.createElement(Pr,e)};Nr.propTypes={chevron:l.a.bool},Nr.defaultProps={chevron:!0};var zr=function(e){return o.a.createElement(Ir,e)};function Mr(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n display: flex;\n width: 100%;\n height: 100%;\n max-width: 128px;\n max-height: 128px;\n\n & > * {\n width: 100%;\n height: auto;\n object-fit: contain;\n }\n"]);return Mr=function(){return e},e}zr.propTypes={icon:l.a.oneOfType([l.a.instanceOf(v.IconifyIcon),l.a.oneOf(["gallery"])]),title:l.a.string,isExpanded:l.a.bool},zr.defaultProps={icon:xe.a,title:void 0,isExpanded:!1};var Fr=b.a.div(Mr()),Dr=function(){return o.a.createElement(Fr,null,o.a.createElement("svg",{width:"54",height:"38",viewBox:"0 0 54 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.a.createElement("path",{d:"M11.3663 9.40518C9.2981 -3.25522 -0.310763 2.76769 2.5163 9.40518C2.5163 9.40518 8.29338 29.9322 22.3059 26.3677C36.3184 22.8031 23.9038 19.1156 23.9038 19.1156C23.9038 19.1156 13.4345 22.0656 11.3663 9.40518Z",fill:"#724024",stroke:"black",strokeWidth:"2.1869"}),o.a.createElement("path",{d:"M10.7517 8.0531C10.0142 10.7573 6.32673 12.1093 3.99131 11.2489C1.65589 10.3885 2.63923 13.8302 5.09756 14.9364C7.55589 16.0427 11.2434 14.1989 12.1038 12.4781C12.9642 10.7573 11.4892 5.34893 10.7517 8.0531Z",fill:"#B7782E"}),o.a.createElement("path",{d:"M14.0705 17.2718C13.8246 19.2385 9.64547 19.976 7.55589 19.8531C5.46631 19.7302 9.76839 23.5406 11.3663 23.5406C12.9642 23.5406 17.3892 21.2052 17.1434 19.2385C16.8976 17.2718 14.3163 15.3052 14.0705 17.2718Z",fill:"#B7782E"}),o.a.createElement("path",{d:"M17.5121 26.2448C18.6184 25.3843 20.9538 21.8198 19.8476 19.8531C18.7413 17.8864 22.4288 20.9593 22.4288 20.9593L21.6913 26.2448C21.6913 26.2448 16.4059 27.1052 17.5121 26.2448Z",fill:"#B7782E"}),o.a.createElement("path",{d:"M10.7517 8.0531C10.0142 10.7573 6.32673 12.1093 3.99131 11.2489C1.65589 10.3885 2.63923 13.8302 5.09756 14.9364C7.55589 16.0427 11.2434 14.1989 12.1038 12.4781C12.9642 10.7573 11.4892 5.34893 10.7517 8.0531Z",stroke:"black"}),o.a.createElement("path",{d:"M14.0705 17.2718C13.8246 19.2385 9.64547 19.976 7.55589 19.8531C5.46631 19.7302 9.76839 23.5406 11.3663 23.5406C12.9642 23.5406 17.3892 21.2052 17.1434 19.2385C16.8976 17.2718 14.3163 15.3052 14.0705 17.2718Z",stroke:"black"}),o.a.createElement("path",{d:"M17.5121 26.2448C18.6184 25.3843 20.9538 21.8198 19.8476 19.8531C18.7413 17.8864 22.4288 20.9593 22.4288 20.9593L21.6913 26.2448C21.6913 26.2448 16.4059 27.1052 17.5121 26.2448Z",stroke:"black"}),o.a.createElement("path",{d:"M11.3663 9.40518C9.2981 -3.25522 -0.310763 2.76769 2.5163 9.40518C2.5163 9.40518 8.29338 29.9322 22.3059 26.3677C36.3184 22.8031 23.658 19.4843 23.658 19.4843C23.658 19.4843 13.4345 22.0656 11.3663 9.40518Z",stroke:"black",strokeWidth:"2.1869"}),o.a.createElement("path",{d:"M25.3788 9.89685C25.3788 9.89685 21.3225 35.0947 21.9371 35.7093C22.5517 36.3239 27.4684 36.3239 28.083 35.7093C28.6975 35.0947 29.6523 22.5858 30.2955 21.9427C30.9386 21.2995 35.7226 33.1281 36.81 33.1281C37.8975 33.1281 43.2303 21.3567 43.8163 21.9427C44.4023 22.5287 45.2913 35.0947 45.9059 35.7093C46.5204 36.3239 51.3142 36.3239 51.9288 35.7093C52.5434 35.0947 48.9788 9.89685 48.9788 9.89685H42.9559C42.9559 9.89685 37.7934 21.9427 36.81 21.9427C35.8267 21.9427 31.4017 9.89685 31.4017 9.89685H25.3788Z",fill:"white",stroke:"black",strokeWidth:"2.1869"})))},Lr=function(e){return o.a.createElement(Dr,e)};function Br(e){return(Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ur(){var e=Gr(["\n position: absolute;\n overflow: hidden;\n top: 0; left: 0;\n height: 100%;\n background-color: ",";\n border-radius: 12px;\n text-align: center;\n padding: 0 10px;\n vertical-align: middle;\n color: white;\n font-family: ",";\n font-size: 13px;\n display: flex;\n justify-content: center;\n align-items: center;\n transition: min-width .2s ease-out;\n\n background-size: 30px 30px;\n background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%,\n transparent 25%,\n transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,\n transparent 75%, transparent);\n animation: ",";\n\n @keyframes animate-stripes {\n 0% { background-position: 0 0; }\n 100% { background-position: 60px 0; }\n }\n"]);return Ur=function(){return e},e}function qr(){var e=Gr(["\n position: relative;\n box-sizing: border-box;\n height: 30px;\n background: linear-gradient(\n 180deg,\n rgba(0, 0, 0, 0.06) 0%,\n rgba(0, 0, 0, 0.02) 50%,\n rgba(0, 0, 0, 0.10) 100%\n );\n border-radius: 12px;\n\n .nui-progress-buttons {\n position: absolute;\n height: 100%;\n right: 0px;\n display: flex;\n align-items: center;\n padding-right: 5px;\n\n .nui-progress-button {\n border: none;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-left: 2px;\n border-radius: 100%;\n color: white;\n padding: 2px;\n width: 18px;\n height: 18px;\n background-color: ",";\n\n &:hover {\n background-color: ",";\n }\n\n &.stop {\n background: ",";\n\n &:hover {\n background-color: ",";\n }\n }\n }\n }\n"]);return qr=function(){return e},e}function Gr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Lr.propTypes={},Lr.defaultProps={};var Hr=Object(b.a)((function(e){var n=e.value,t=void 0===n?0:n,r=e.max,a=void 0===r?100:r,i=e.busy,l=void 0!==i&&i,c=e.status;t=Math.min(t,a);var u=parseFloat(t)/parseFloat(a);return o.a.createElement("div",{className:e.className},o.a.createElement(Wr,{ratio:u,busy:e.busy,status:c}),o.a.createElement("div",{className:"nui-progress-buttons"},l&&e.onPauseClick&&o.a.createElement("div",{className:"nui-progress-button pause",onClick:e.onPauseClick},e.paused?o.a.createElement(v.InlineIcon,{icon:q.a}):o.a.createElement(v.InlineIcon,{icon:B.a})),l&&e.onStopClick&&o.a.createElement("div",{className:"nui-progress-button stop",onClick:e.onStopClick},o.a.createElement(v.InlineIcon,{icon:J.a}))))}))(qr(),y.blue,Object(g.a)(.1,y.blue),y.red,Object(g.a)(.1,y.red)),Wr=Object(b.a)((function(e){var n,t,r,a=isNaN(e.ratio)?0:parseInt(Math.round(100*e.ratio)),i=Br(e.status),l="undefined"!==i?"string"===i?e.status:e.status(a):"".concat(a,"%");return o.a.createElement("div",{className:e.className,style:(n={minWidth:28},t="minWidth",r=a+"%",t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n)},o.a.createElement("div",null,l))}))(Ur(),y.progress,y.fontFamily,(function(e){return e.busy?"animate-stripes 1.6s linear infinite":"none"})),$r=function(e){return o.a.createElement(Hr,e)};function Yr(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Jr(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Jr(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jr(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Vr(){var e=Zr(["\n\tbackground-color: rgba(",", 0.8);\n\tborder-radius: 4px;\n\tcolor: ",";\n\tfont-family: ",";\n\tfont-weight: normal;\n\tmin-width: 180px;\n\tmax-width: 280px;\n\tfont-size: ",";\n\tpadding: 8px 12px;\n\tposition: absolute;\n \tmax-width: 280px;\n\tdisplay: ",';\n\tz-index: 100;\n\n\t&:before {\n\t\tcontent: "";\n\t\tposition: absolute;\n\t\tborder: 4px solid transparent;\n\t}\n\n\t&.top {\n\t\t&:before {\n\t\t\tmargin-left: -4px;\n\t\t\ttop: 100%;\n\t\t\tleft: 50%;\n\t\t\tborder-top: 4px solid rgba(',", 0.8);\n\t\t}\n\t}\n\n\t&.left {\n\t\t&:before {\n\t\t\tmargin-top: -4px;\n\t\t\ttop: 50%;\n\t\t\tright: -8px;\n\t\t\tborder-left: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t&.right {\n\t\t&:before {\n\t\t\tmargin-top: -4px;\n\t\t\ttop: 50%;\n\t\t\tleft: -8px;\n\t\t\tborder-right: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t&.bottom {\n\t\t&:before {\n\t\t\tmargin-left: -4px;\n\t\t\ttop: -8px;\n\t\t\tleft: 50%;\n\t\t\tborder-bottom: 4px solid rgba(",", 0.8);\n\t\t}\n\t}\n\n\t","\n"]);return Vr=function(){return e},e}function Kr(){var e=Zr(["\n\tdisplay: flex;\n"]);return Kr=function(){return e},e}function Zr(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}$r.propTypes={value:l.a.number,max:l.a.number,busy:l.a.bool,paused:l.a.bool,onPauseClick:l.a.func,onStopClick:l.a.func,status:l.a.oneOf([l.a.string,l.a.func])},$r.defaultProps={value:0,max:100,busy:!1,paused:!1,onPauseClick:void 0,onStopClick:void 0,status:void 0};var Xr=b.a.div(Kr()),Qr=b.a.div(Vr(),y.blackRGB,y.white,y.fontFamily,y.fontSizeText,(function(e){return e.visible?"inline-block":"none"}),y.blackRGB,y.blackRGB,y.blackRGB,y.blackRGB,(function(e){return e.style})),ea=function(e){var n=e.text,t=void 0===n?"Hello world!":n,r=e.position,i=void 0===r?"top":r,l=Yr(Object(a.useState)(!1),2),c=l[0],u=l[1],s=on(),f=s.ref,d=s.width,m=s.height,p=on(),h=p.ref,b=p.width,g=p.height,y=Object(a.useMemo)((function(){var e=0,n=0;if("top"===i)e=-1*m-5,n=d/2*-1+b/2;else if("bottom"===i)e=g+5,n=d/2*-1+b/2;else if("left"===i){e=(m-g)/2*-1,n=-1*d-5}else if("right"===i){e=(m-g)/2*-1,n=b+5}return{transform:"translateX(".concat(n,"px) translateY(").concat(e,"px)")}}),[i,d,m,b,g]);return o.a.createElement(Xr,null,o.a.createElement(Qr,{ref:f,visible:c,className:i,style:y},t),o.a.createElement("div",{ref:h,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)}},e.children))},na=function(e){return o.a.createElement(ea,e)};function ta(){return(ta=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function ra(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function aa(){var e=ia(["\n\n path {\n fill: ",";\n }\n\n ","\n\n &.nui-clickable {\n cursor: pointer;\n }\n\n &.spin {\n animation-name: spin;\n animation-duration: 700ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n\n @keyframes spin {\n 0% {\n transform: rotate(360deg);\n }\n 100% {\n transform: rotate(0deg);\n }\n }\n }\n\n &.disabled {\n pointer-events: none;\n opacity: 0.35;\n cursor: default;\n }\n"]);return aa=function(){return e},e}function oa(){var e=ia(["\n display: flex;\n align-items: center;\n"]);return oa=function(){return e},e}function ia(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}na.propTypes={text:l.a.string,position:l.a.oneOf(["top","right","bottom","left"])},na.defaultProps={text:"Hello world!",position:"top"};var la=b.a.div(oa()),ca=Object(b.a)(v.Icon)(aa(),(function(e){return e.color}),(function(e){return n=e.color,(t=e.hoverColor)?"\n &:hover {\n path {\n fill: ".concat(t,";\n }\n }\n "):n?"\n &:hover {\n path {\n fill: ".concat(Object(g.a)(.1,n),";\n }\n }\n "):void 0;var n,t})),ua=function(e){var n=e.icon,t=e.spinning,r=void 0!==t&&t,a=e.className,i=void 0===a?"":a,l=e.title,c=e.tooltip,u=e.containerStyle,s=e.color,f=e.hoverColor,d=e.disabled,m=void 0!==d&&d,p=ra(e,["icon","spinning","className","title","tooltip","containerStyle","color","hoverColor","disabled"]);p.width||p.height||(p.width=p.height=30);var h=function(){return"string"==typeof n?Fe[n]||null:n},b="nui-icon ".concat(i).concat(p.onClick?" nui-clickable":"").concat(r?" spin":"").concat(m?" disabled":"");return c?o.a.createElement(na,{text:c.text,position:c.position||"top"},o.a.createElement(la,{style:u},o.a.createElement(ca,ta({icon:h(),className:b,color:s,hoverColor:f},p)))):o.a.createElement(la,{style:u,title:l},o.a.createElement(ca,ta({icon:h(),className:b,color:s,hoverColor:f},p)),c?o.a.createElement(na,null,c):null)},sa=function(e){return o.a.createElement(ua,e)};sa.propTypes={icon:l.a.oneOfType([l.a.instanceOf(v.IconifyIcon),l.a.oneOf(["lock","lock-open","file-undo","chevron-double-left","chevron-double-right","chevron-left","chevron-right","chevron-down","chevron-up","pause","play","replay","check","stop","delete","undo","alert","database","pencil","tools","cog","close","cat","upload"])]),color:l.a.string,spinning:l.a.bool,className:l.a.string,tooltip:l.a.string},sa.defaultProps={icon:void 0,color:void 0,spinning:!1,className:"",tooltip:void 0};var fa=t(60),da=t.n(fa);function ma(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n position: relative;\n color: white;\n font-family: ",";\n font-size: ",";\n display: flex;\n align-items: center;\n padding: 15px 20px;\n background-color: ",";\n border-bottom: 5px #2981b5 solid;\n display: flex;\n\n .nui-header-logo-container {\n width: 55px;\n height: 55px;\n padding: 10px;\n margin-right: 20px;\n background: #3D5D8D;\n border-radius: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .nui-header-title-container {\n flex-direction: column;\n display: flex;\n\n .nui-header-title {\n color: white;\n font-family: ",";\n font-size: 23px;\n line-height: normal;\n margin: 0;\n }\n\n .nui-header-subtitle {\n color: white;\n font-family: ",";\n line-height: normal;\n font-size: ",";\n }\n }\n\n .nui-header-extra-content {\n flex: 1;\n margin: 0 20px;\n }\n"]);return ma=function(){return e},e}var pa=b.a.div(ma(),y.fontFamily,y.fontSizeText,y.header,y.fontFamily,y.fontFamily,y.fontSizeText),ha=function(e){var n=e.title,t=void 0===n?"NekoUI":n,r=e.subtitle,a=void 0===r?"By Jordy Meow":r,i=e.children,l=e.saving,c=void 0!==l&&l;return o.a.createElement(pa,null,o.a.createElement("div",{className:"nui-header-logo-container"},o.a.createElement(Lr,null)),o.a.createElement("div",{className:"nui-header-title-container"},o.a.createElement("h1",{className:"nui-header-title"},t),o.a.createElement("small",{className:"nui-header-subtitle"},o.a.createElement("a",{target:"_blank",href:"https://meowapps.com",style:{color:"white",textDecoration:"none"}},a))),o.a.createElement("div",{className:"nui-header-extra-content"},i),c&&o.a.createElement(sa,{icon:da.a,width:"36",height:"36"}))},ba=function(e){return o.a.createElement(ha,e)};function ga(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return ya(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ya(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ya(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function va(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n align-items: center;\n display: flex;\n\n .neko-paging-text {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 15px;\n line-height: 14px;\n }\n\n .neko-paging-controller {\n box-sizing: border-box;\n height: 30px;\n align-items: center;\n background-color: rgba(",", 0.8);\n border-radius: 15px;\n display: flex;\n margin-left: 15px;\n padding: 3px 5px;\n\n .nako-paging-controller-icon {\n background-color: ",";\n border-radius: 100%;\n cursor: pointer;\n margin-right: 2px;\n height: 22px;\n width: 22px;\n box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);\n transition: transform 0.1s ease-in;\n box-sizing: border-box;\n\n :last-child {\n margin-right: 0;\n }\n\n &.disabled {\n color: ",";\n cursor: default;\n pointer-events: none;\n }\n\n &:hover {\n transform: scale(1.2) !important;\n z-index: 10;\n position: relative;\n }\n }\n\n .nako-paging-controller-text {\n color: ",";\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n margin: 0 40px;\n user-select: none;\n }\n\n span.neko-paging-current-page {\n cursor: pointer;\n text-decoration: underline;\n }\n input.neko-paging-current-page {\n width: 1.5rem;\n }\n }\n\n &.neko-paging-full {\n flex-grow: 1;\n\n .neko-paging-controller {\n flex-grow: 1;\n }\n .nako-paging-controller-text {\n margin: 0 auto;\n }\n }\n"]);return va=function(){return e},e}ba.propTypes={title:l.a.string,subtitle:l.a.string,saving:l.a.bool},ba.defaultProps={title:"NekoUI",subtitle:"By Jordy Meow",saving:!1};var Ea=b.a.div(va(),y.fontFamily,y.blueRGB,y.white,y.darkGray,y.white,y.fontFamily),wa=function(e){var n=e.currentPage,t=e.limit,r=e.onClick,i=e.total,l=e.onCurrentPageChanged,c=e.full,u=!!l,s=Math.ceil(0===i?1:t>0?i/t:1),f="nako-paging-controller-icon ".concat(1===n?"disabled":""),d="nako-paging-controller-icon ".concat(n===s?"disabled":""),m=ga(Object(a.useState)(!1),2),p=m[0],h=m[1],b=c?"neko-paging-full":"",g=function(e){h(!1),r(e)},y=function(e){var n=Number(e);return n>s?s:n<1?1:n},E=function(e){var n=e.target.value;isNaN(n)||l(y(n)),h(!1)},w=function(e){if("Enter"===event.key){e.preventDefault();var n=e.target.value;isNaN(n)||l(y(n)),h(!1)}},x=Object(a.useMemo)((function(){if(!p){return o.a.createElement("span",{className:u?"neko-paging-current-page":"",onClick:function(){u&&h(!0)}},n)}return o.a.createElement("input",{autoFocus:!0,type:"text",className:u?"neko-paging-current-page":"",defaultValue:n,onBlur:E,onKeyPress:w})}),[n,p,l]),k=function(e){p&&e.target===e.currentTarget&&h(!1)};return o.a.createElement(Ea,{className:b},o.a.createElement("span",{className:"neko-paging-text"},i," result",i>0?"s":""),o.a.createElement("div",{className:"neko-paging-controller",onClick:k},o.a.createElement(v.Icon,{icon:P.a,className:f,onClick:function(){return g(1)}}),o.a.createElement(v.Icon,{icon:T.a,className:f,onClick:function(){return g(n-1)}}),o.a.createElement("p",{className:"nako-paging-controller-text",onClick:k},"Page ",x," of ",s),o.a.createElement(v.Icon,{icon:N.a,className:d,onClick:function(){return g(n+1)}}),o.a.createElement(v.Icon,{icon:_.a,className:d,onClick:function(){return g(s)}})))},xa=function(e){return o.a.createElement(wa,e)};function ka(){var e=Oa(["\n color: ",";\n cursor: pointer;\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n line-height: 17px;\n\n &.is-active {\n cursor: default;\n color: ",';\n font-weight: bold;\n }\n\n &::after {\n content: "|";\n color: ',";\n padding: 0 4px;\n }\n\n &:last-child::after {\n content: none;\n }\n\n span {\n color: ",";\n font-weight: normal;\n margin-left: 4px;\n }\n"]);return ka=function(){return e},e}function Ra(){var e=Oa(["\n display: flex;\n align-items: center;\n"]);return Ra=function(){return e},e}function Oa(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}xa.propTypes={currentPage:l.a.number,limit:l.a.number,total:l.a.number,onClick:l.a.func},xa.defaultProps={currentPage:void 0,limit:void 0,total:void 0,onClick:void 0};var ja=b.a.div(Ra()),Sa=b.a.span(ka(),y.blue,y.fontFamily,y.black,y.darkGray,y.darkGray),Pa=function(e){var n=e.id,t=e.value,r=e.onChange,a=e.busy,i=void 0!==a&&a,l=o.a.Children.map(e.children,(function(e,a){return o.a.cloneElement(e,{busy:i,isActive:e.props.value===t,onClick:function(e){e!==t&&r(e,n)}})}));return o.a.createElement(ja,null,l)},Ca=function(e){var n=e.title,t=e.value,r=void 0===t?0:t,a=e.count,i=e.onClick,l=e.busy,c=e.isActive;return o.a.createElement(Sa,{onClick:function(){return i(r)},className:"".concat(c?"is-active":"")},n,null===a?null:o.a.createElement("span",null,"(",l?o.a.createElement(sa,{icon:"replay",spinning:!0,width:12,containerStyle:{display:"inline"}}):a,")"))},_a=function(e){return o.a.createElement(Pa,e)};_a.propTypes={id:l.a.string,value:l.a.string,onChange:l.a.func},_a.defaultProps={id:void 0,value:void 0,onChange:void 0};var Aa=function(e){return o.a.createElement(Ca,e)};function Ta(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n .mask {\n position: absolute;\n overflow: hidden;\n display: block;\n width: ","px;\n height: ","px;\n }\n\n .semi-circle {\n position: relative;\n display: block;\n width: ","px;\n height: ",'px;\n background: linear-gradient(to right, #27b775 0%, #f3f32c 50%, #f71b1b 100%);\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n\n &::before {\n content: "";\n position: absolute;\n bottom: 0;\n left: 50%;\n z-index: 2;\n display: block;\n width: 140px;\n height: 70px;\n margin-left: -70px;\n background: ',";\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n } \n }\n\n .semi-circle--mask {\n position: absolute;\n top: 0;\n left: 0;\n width: ","px;\n height: ",'px;\n background: transparent;\n transform-origin: center center;\n backface-visibility: hidden;\n transition: all .3s ease-in-out;\n\n &::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0%;\n z-index: 2;\n display: block;\n width: ',"px;\n height: ","px;\n margin-top: -1px;\n margin-left: -1px;\n background: #5396c1d6;\n border-radius: 50% 50% 50% 50% / 100% 100% 0% 0% ;\n } \n }\n\n .gauge { \n width: ","px;\n height: ","px;\n \n .semi-circle--mask {\n transform: rotate(","deg) translate3d(0,0,0);\n }\n }\n\n .child-container {\n position: absolute;\n font-size: 16px;\n display: flex;\n width: ","px;\n height: ","px;\n z-index: 10;\n\n .spacing {\n flex: auto;\n }\n\n .child {\n color: white;\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n }\n"]);return Ta=function(){return e},e}Aa.propTypes={title:l.a.string,value:l.a.string,count:l.a.number,onClick:l.a.func,isActive:l.a.bool},Aa.defaultProps={title:void 0,value:"default",count:0,onClick:void 0,isActive:!1};var Ia=b.a.section(Ta(),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.backgroundColor}),(function(e){return e.width}),(function(e){return e.width}),(function(e){return e.width+2}),(function(e){return e.width/2+2}),(function(e){return e.width}),(function(e){return e.width/2}),(function(e){return e.degrees}),(function(e){return e.width+2}),(function(e){return e.width/2})),Na=function(e){var n=e.value,t=void 0===n?1e3:n,r=(e.min,e.max),a=void 0===r?2500:r,i=e.width,l=void 0===i?200:i,c=e.background,u=void 0===c?"#007cba":c,s=e.children,f=180*(t<=a?t:a)/a;return o.a.createElement(Ia,{backgroundColor:u,degrees:f,width:l},o.a.createElement("div",{class:"gauge"},o.a.createElement("div",{class:"mask"},o.a.createElement("div",{class:"semi-circle"}),o.a.createElement("div",{class:"semi-circle--mask"})),o.a.createElement("div",{class:"child-container"},o.a.createElement("div",{class:"child"},o.a.createElement("div",{class:"spacing"}),s))))};function za(){var e=Fa(["\n background: #1eba96;\n padding: 20px;\n color: white;\n border-radius: 10px;\n font-size: 15px;\n text-align: center;\n\n a {\n color: white;\n font-weight: bold;\n }\n"]);return za=function(){return e},e}function Ma(){var e=Fa(["\n background: #ba341e;\n padding: 20px;\n color: white;\n border-radius: 10px;\n font-size: 15px;\n\n a {\n color: white;\n font-weight: bold;\n }\n"]);return Ma=function(){return e},e}function Fa(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Na.propTypes={value:l.a.number,min:l.a.number,max:l.a.number,width:l.a.number,background:l.a.string},Na.defaultProps={value:1e3,min:0,max:2500,width:200,background:"#007cba"};var Da=b.a.p(Ma()),La=b.a.p(za());function Ba(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Ua(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Ba(Object(t),!0).forEach((function(n){qa(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function qa(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ga(e){return function(e){if(Array.isArray(e))return Ya(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||$a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ha(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function Wa(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||$a(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $a(e,n){if(e){if("string"==typeof e)return Ya(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ya(e,n):void 0}}function Ya(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ja(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n box-sizing: border-box;\n background: #f1f1f1;\n border: 2px dashed rgb(0 0 0 / 30%);\n color: rgb(0 0 0 / 60%);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n transition: all 0.25s ease;\n\n div {\n transition: all 0.5s ease;\n transform: scale(1.5);\n pointer-events: none;\n }\n\n &:hover {\n cursor: pointer;\n }\n\n &.dropping {\n background: #a4d5ff;\n\n div {\n transform: scale(2);\n }\n }\n"]);return Ja=function(){return e},e}var Va=b.a.div(Ja()),Ka=function(e){var n=e.width,t=void 0===n?"100%":n,r=e.height,i=void 0===r?"100%":r,l=e.iconSize,c=void 0===l?48:l,u=e.onSuccess,s=void 0===u?function(){}:u,f=e.onFailure,d=void 0===f?function(){}:f,m=e.style,p=void 0===m?{}:m,b=e.apiUrl,g=e.apiConfig,y=Wa(Object(a.useState)(!1),2),v=y[0],E=y[1],w=Wa(Object(a.useState)(Math.floor(1e8*Math.random())),2),x=w[0],k=(w[1],Object(a.useRef)(null)),R=Wa(Object(a.useState)(!1),2),O=R[0],j=R[1],S=function(){var e,n=(e=regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return j(!0),g.file=n[0],e.next=4,ii(b,g);case 4:(t=e.sent).success?s(t):d(t),j(!1);case 7:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ha(o,r,a,i,l,"next",e)}function l(e){Ha(o,r,a,i,l,"throw",e)}i(void 0)}))});return function(e){return n.apply(this,arguments)}}(),P=function(e){e.preventDefault(),e.stopPropagation()},C=function(e){e.preventDefault(),e.stopPropagation(),E(!0)},_=function(e,n){n.preventDefault(),n.stopPropagation(),E(!1),console.log(e),S(e)};return o.a.createElement(h,{busy:O},o.a.createElement("input",{type:"file",id:x,accept:"image/*",ref:k,onChange:function(e){var n=[e.target.files[0]];_(n,e)},style:{display:"none"}}),o.a.createElement(Va,{onClick:function(){k.current.click()},style:Ua(Ua({},p),{},{width:t,height:i}),className:v?"dropping":"",onDragOver:P,onDragEnter:C,onDragLeave:function(e){e.preventDefault(),e.stopPropagation(),E(!1)},onDrop:function(e){var n=Ga(e.dataTransfer.files);_(n,e)}},o.a.createElement(sa,{width:c,height:c,icon:"upload",spinning:O,onDragOver:P,onDragEnter:C})))};Ka.propTypes={width:l.a.string,height:l.a.string,onSuccess:l.a.func,onFailure:l.a.func,style:l.a.object,apiUrl:l.a.string,apiConfig:l.a.object},Ka.defaultProps={width:"100%",height:"100%",onSuccess:function(){},onFailure:function(){},style:{}};var Za=t(61),Xa=t.n(Za);function Qa(){return(Qa=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function eo(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function no(){var e=ro(["\n width: 518px;\n\n p {\n margin: 0;\n }\n .title {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n }\n .content {\n font-family: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 14px;\n margin-top: 15px;\n margin-bottom: 30px;\n }\n .button-group {\n align-items: center;\n display: flex;\n justify-content: flex-end;\n margin-top: 15px;\n }\n"]);return no=function(){return e},e}function to(){var e=ro(["\n\n .ReactModal__Overlay {\n z-index: 100;\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n background: "," !important;\n }\n .ReactModal__Overlay {\n opacity: 0;\n transition: opacity 200ms ease-in-out;\n }\n .ReactModal__Overlay--after-open {\n opacity: 1;\n }\n .ReactModal__Overlay--before-close {\n opacity: 0;\n }\n .ReactModal__Overlay .neko-modal {\n opacity: 0;\n transform: scale(0.85);\n transition: all 200ms ease-in-out;\n }\n .ReactModal__Overlay--after-open .neko-modal {\n transform: scale(1);\n opacity: 1;\n }\n .ReactModal__Overlay--before-close .neko-modal {\n transform: scale(0.85);\n opacity: 0;\n }\n .neko-modal {\n background: ",";\n position: relative;\n box-shadow: 2px 2px 15px 2px rgba(0, 0, 0, 0.8);\n outline: none;\n padding: 15px;\n max-width: 820px;\n }\n"]);return to=function(){return e},e}function ro(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var ao=b.a.div(to(),y.overlay,y.white),oo=b.a.div(no(),y.fontFamily,y.fontFamily),io=function(e){var n=e.children,t=e.className,r=e.style,a=e.ok,i=void 0===a?"OK":a,l=e.cancel,c=void 0===l?"Cancel":l,u=e.customButtons,s=void 0===u?null:u,f=e.customButtonsPosition,d=void 0===f?"right":f,m=e.title,p=void 0===m?"":m,h=e.content,b=void 0===h?"":h,g=e.onOkClick,y=e.onCancelClick,v=eo(e,["children","className","style","ok","cancel","customButtons","customButtonsPosition","title","content","onOkClick","onCancelClick"]),E=r?"custom-modal":"",w=null!==s,x=n||o.a.createElement(oo,null,p&&o.a.createElement("p",{className:"title"},p),b&&o.a.createElement("p",{className:"content"},b),o.a.createElement("div",{className:"button-group"},w&&"left"===d&&s,y&&o.a.createElement(Ge,{className:"danger",onClick:y},c),g&&o.a.createElement(Ge,{onClick:g},i),w&&"right"===d&&s));return o.a.createElement(o.a.Fragment,null,o.a.createElement(ao,{id:"neko-modal-parent"}),o.a.createElement(Xa.a,Qa({ariaHideApp:!1,parentSelector:function(){return document.getElementById("neko-modal-parent")},closeTimeoutMS:200,className:"neko-modal ".concat(t||""," ").concat(E)},v),x))},lo=function(e){return o.a.createElement(io,e)};lo.propTypes={className:l.a.string,style:l.a.object,ok:l.a.string,cancel:l.a.string,title:l.a.string,content:l.a.string,onOkClick:l.a.func,onCancelClick:l.a.func,customButtons:l.a.object},lo.defaultProps={className:void 0,style:void 0,ok:"OK",cancel:"Cancel",title:"",content:"",onOkClick:void 0,onCancelClick:void 0,customButtons:null};var co=t(62),uo=t.n(co);function so(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function fo(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n background-color: ",";\n font-family: ",";\n border-spacing: 0;\n width: 100%;\n\n th, td {\n margin: 0;\n padding: 5px;\n border-bottom: 1px solid rgba(",", 0.1);\n border-right: 1px solid rgba(",", 0.1);\n\n a {\n text-decoration: none;\n }\n\n :last-child {\n border-right: 0;\n }\n }\n\n th, tfoot td {\n height: 30px;\n background-color: ",";\n color: ",";\n font-style: normal;\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n text-align: left;\n\n div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n &.sortable {\n cursor: pointer;\n }\n }\n }\n\n tbody {\n tr {\n :nth-child(even) {\n background-color: ",";\n }\n &.selected {\n background-color: rgba(",", 0.8);\n color: ",";\n\n a {\n color: #81e8ff;\n }\n }\n }\n img {\n vertical-align: bottom;\n }\n }\n\n tfoot tr:last-child {\n td {\n border-bottom: 0;\n }\n }\n\n .table-checkbox-cell {\n width: 35px;\n text-align: center;\n\n svg {\n padding: 5px;\n cursor: pointer;\n }\n }\n"]);return fo=function(){return e},e}var mo=b.a.table(fo(),y.white,y.fontFamily,y.blackRGB,y.blackRGB,y.blue,y.white,y.tableGray,y.blueRGB,y.white),po=function(e){var n=e.checked,t=e.intermediate,r=void 0!==t&&t,a=e.onSelect,i=void 0===a?function(){}:a,l=e.onUnselect,c=void 0===l?function(){}:l;so(e,["checked","intermediate","onSelect","onUnselect"]);return o.a.createElement(v.Icon,{icon:r?uo.a:n?Ot.a:kt.a,width:"24px",height:"24px",onClick:function(e){n?c(e):i(e)}})},ho=function(e){var n=e.columns,t=e.data,r=e.busy,a=void 0!==r&&r,i=e.onSelect,l=e.onUnselect,c=e.selectedItems,u=e.sort,s=e.onSortChange,f=n.length+(i?1:0),d=t.map((function(e){var t=n.map((function(n){return{value:e[n.accessor],style:n.style||{}}}));return{id:e.id,cells:t}})),m=d.map((function(e){return e.id})),p=m.filter((function(e){return c.includes(e)})).length===m.length,b=!p&&c.length>0,g=n.reduce((function(e,n,t){return!1===n.visible&&e.push(t),e}),[]),E=o.a.createElement("tr",null,i&&o.a.createElement("th",{className:"table-checkbox-cell"},o.a.createElement(po,{checked:p,intermediate:b,onSelect:function(e){return i(m,e)},onUnselect:function(e){l(b?c:m,e)}})),n.filter((function(e,n){return!g.includes(n)})).map((function(e){var n=u&&u.accessor===e.accessor,t=u&&"asc"===u.by,r=e.style||{};return o.a.createElement("th",{style:r,key:e.accessor},o.a.createElement("div",{className:e.sortable?"sortable":"",onClick:e.sortable?function(r){s(e.accessor,n&&t?"desc":"asc",r)}:void 0},o.a.createElement("div",null,e.title),o.a.createElement("div",null,e.sortable&&o.a.createElement(v.Icon,{icon:n?t?M.a:D.a:M.a,color:n?y.white:"rgba(".concat(y.blackRGB,", 0.1)"),width:"1.6rem",height:"1.6rem"}))))})));return o.a.createElement(h,{busy:a,overlayStyle:{top:"36px",height:"calc(100% - 76px)"}},o.a.createElement(mo,null,o.a.createElement("thead",null,E),o.a.createElement("tbody",null,!d.length&&o.a.createElement("tr",null,o.a.createElement("td",{colspan:f,style:{textAlign:"center",height:40,color:"gray"}},"Empty.")),d.map((function(e){return o.a.createElement("tr",{className:c.includes(e.id)?"selected":""},i&&o.a.createElement("td",{className:"table-checkbox-cell"},o.a.createElement(po,{checked:c.includes(e.id),onSelect:function(n){return i([e.id],n)},onUnselect:function(n){return l([e.id],n)}})),e.cells.filter((function(e,n){return!g.includes(n)})).map((function(e){return o.a.createElement("td",{style:e.style},e.value)})))}))),o.a.createElement("tfoot",null,E)))},bo=function(e){return o.a.createElement(ho,e)};function go(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return yo(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return yo(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yo(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function vo(){var e=ko(["\n background-color: ",";\n display: none;\n padding: 10px;\n\n &.active {\n display: block;\n }\n"]);return vo=function(){return e},e}function Eo(){var e=ko(["\n font-family: ",";\n font-size: ",";\n border-radius: 8px 8px 0px 0px;\n border: 0;\n background-color: #459ad2;\n color: rgb(255 255 255 / 65%);\n\n cursor: pointer;\n line-height: 17px;\n margin-right: 5px;\n text-align: left;\n padding: 10px 15px 10px 15px;\n\n &:focus {\n outline: none;\n }\n\n &.active {\n background-color: ",";\n color: ",";\n }\n\n &.disabled {\n background-color: rgb(224 156 54);\n cursor: default;\n display: inline-flex;\n padding-bottom: 7px;\n }\n"]);return Eo=function(){return e},e}function wo(){var e=ko(["\n"]);return wo=function(){return e},e}function xo(){var e=ko(["\n"]);return xo=function(){return e},e}function ko(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}bo.propTypes={columns:l.a.arrayOf(l.a.any),data:l.a.arrayOf(l.a.any),busy:l.a.arrayOf(l.a.bool),onSelect:l.a.func,onUnselect:l.a.func,selectedItems:l.a.arrayOf(l.a.object),onSortChange:l.a.func},bo.defaultProps={columns:void 0,data:void 0,busy:!1,onSelect:void 0,onUnselect:void 0,selectedItems:void 0,onSortChange:void 0};var Ro=b.a.div(xo()),Oo=b.a.div(wo()),jo=b.a.button(Eo(),y.fontFamily,y.fontSizeText,y.blue,y.white),So=b.a.div(vo(),y.blue),Po=function(e){var n=go(o.a.useState(0),2),t=n[0],r=n[1];o.a.useEffect((function(){if(e.keepTabOnReload){var n=new URL(window.location.href).searchParams.get("nekoTab");if(!n)return void r(0);var t=decodeURIComponent(n),a=o.a.Children.toArray(e.children).map((function(e){return e.props.title.replace(" ","")})).indexOf(t);return-1===a?void r(0):void r(a)}r(0)}),[]);var a=o.a.Children.map(e.children,(function(n,t){var r=n.props.title||"Untitled Tab "+(t+1);return{key:n.props.key||"neko-tab-"+r.toLowerCase(),title:r,onClick:n.props.onClick?n.props.onClick:null,requirePro:!e.isPro&&(n.props.requirePro||!1)}})),i=o.a.Children.map(e.children,(function(e,n){return o.a.cloneElement(e,{isActive:n===t})})),l=function(n,t,a){t.requirePro||(r(n),e.onChange&&e.onChange(n,t,a),e.keepTabOnReload&&function(e){if(history.pushState&&e){var n=new URLSearchParams(window.location.search),t=encodeURIComponent(e.replace(" ",""));n.set("nekoTab",t);var r=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+n.toString();window.history.replaceState({path:r},"",r)}}(t.title))};return o.a.createElement(Ro,null,o.a.createElement(Oo,null,a.map((function(e,n){return o.a.createElement(jo,{key:e.key,className:"neko-tab-title ".concat(n===t?"active":""," ").concat(e.requirePro?"disabled":""),onClick:function(t){l(n,e,t)}},e.title,o.a.createElement(Ve,{className:"inline",style:{marginLeft:10,marginRight:-5,top:-1},show:e.requirePro}))}))),i)},Co=function(e){var n=e.children,t=e.isActive;return o.a.createElement(So,{className:"".concat(t?"active":"")},n)},_o=function(e){return o.a.createElement(Po,e)};_o.propTypes={isPro:l.a.bool,onChange:l.a.func},_o.defaultProps={isPro:!1,onChange:void 0};var Ao=function(e){return o.a.createElement(Co,e)};function To(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Io(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Io(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Io(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function No(){var e=Fo(["\n background-color: ",";\n display: none;\n\n &.active {\n display: block;\n }\n"]);return No=function(){return e},e}function zo(){var e=Fo(["\n align-items: center;\n background-color: ",";\n border: 0;\n cursor: pointer;\n display: flex;\n padding: 2px 3px 2px 19px;\n\n &.disabled {\n background-color: rgba(",", 0.25);\n cursor: default;\n }\n\n p {\n color: ",";\n font-family: ",";\n font-size: 14px;\n line-height: 17px;\n margin: 0;\n }\n\n .neko-side-tab-icon {\n color: ",";\n margin-left: auto;\n height: 36px;\n width: 36px;\n }\n"]);return zo=function(){return e},e}function Mo(){var e=Fo(["\n"]);return Mo=function(){return e},e}function Fo(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}Ao.propTypes={isActive:l.a.bool,requirePro:l.a.bool,title:l.a.string},Ao.defaultProps={isActive:!1,requirePro:!1,title:void 0};var Do=b.a.div(Mo()),Lo=b.a.div(zo(),y.blue,y.yellowRGB,y.white,y.fontFamily,y.white),Bo=b.a.div(No(),y.white),Uo=function(e){var n=To(o.a.useState(e.activeTabIndex),2),t=n[0],r=n[1],a=o.a.Children.map(e.children,(function(n,t){var r=n.props.title||"Untitled Tab "+(t+1);return{key:n.props.key||"neko-tab-"+r.toLowerCase(),title:r,onClick:n.props.onClick?n.props.onClick:null,requirePro:!e.isPro&&(n.props.requirePro||!1),onDragOver:n.props.onDragOver,onDrop:n.props.onDrop,rightActions:n.props.rightActions||null}})),i=o.a.Children.map(e.children,(function(e,n){return o.a.cloneElement(e,{isActive:n===t})}));return o.a.createElement(Do,null,a.map((function(n,a){return o.a.createElement(o.a.Fragment,null,o.a.createElement(Lo,{key:n.key,className:"".concat(a===t?"active":""," ").concat(n.requirePro?"disabled":""),onClick:function(o){!function(n,a,o){if(!a.requirePro){var i=n===t?null:n;r(i),e.onChange&&e.onChange(i,a,o)}}(a,n,o)},onDragOver:n.onDragOver,onDrop:n.onDrop},o.a.createElement("p",null,o.a.createElement("span",{style:{fontSize:15}},n.title),o.a.createElement(Ve,{className:"inline",show:n.requirePro})),null===n.rightActions?o.a.createElement(v.Icon,{icon:a===t?M.a:N.a,className:"neko-side-tab-icon"}):a===t?o.a.createElement("div",{style:{marginLeft:"auto"}},n.rightActions):o.a.createElement(v.Icon,{icon:N.a,className:"neko-side-tab-icon"})),i[a])})))},qo=function(e){var n=e.children,t=e.isActive;return o.a.createElement(Bo,{className:"".concat(t?"active":"")},n)},Go=function(e){return o.a.createElement(Uo,e)};Go.propTypes={isPro:l.a.bool,onChange:l.a.func,activeTabIndex:l.a.number},Go.defaultProps={isPro:!1,onChange:void 0,activeTabIndex:null};var Ho=function(e){return o.a.createElement(qo,e)};function Wo(){var e=function(e,n){n||(n=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}(["\n box-sizing: border-box;\n display: flex;\n width: 100%;\n padding: 10px 10px;\n background: ",";\n border-radius: 10px;\n box-shadow: 0px 0px 10px rgba(",", 0.1);\n\n &.neko-align-left {\n justify-content: flex-start;\n }\n\n &.neko-align-right {\n justify-content: flex-end;\n }\n\n > *:not(:last-child) {\n margin-right: 5px;\n }\n"]);return Wo=function(){return e},e}Ho.propTypes={isActive:l.a.bool,requirePro:l.a.bool,title:l.a.string,onDragOver:l.a.func,onDrop:l.a.func,rightActions:l.a.element},Ho.defaultProps={isActive:!1,requirePro:!1,title:void 0,onDragOver:void 0,onDrop:void 0,rightActions:void 0};var $o=b.a.div(Wo(),y.white,y.blackRGB),Yo=function(e){var n=e.align,t=void 0===n?"left":n;return o.a.createElement($o,{className:"neko-align-".concat(t)},e.children)},Jo=function(e){return o.a.createElement(Yo,e)};Jo.propTypes={align:l.a.oneOf(["left","right"])},Jo.defaultProps={align:"left"};t(24);function Vo(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var Ko=function e(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Vo(this,e),this.url=r,this.message=n,this.code=t,this.body=a,this.debug=o};function Zo(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||ni(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xo(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function Qo(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Xo(o,r,a,i,l,"next",e)}function l(e){Xo(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ei(e,n){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=ni(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function ni(e,n){if(e){if("string"==typeof e)return ti(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ti(e,n):void 0}}function ti(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ri(e,n){for(var t=[],r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}var ai=function(e){if(!e.data)return e;if(e.data.length>0&&e.data[0].meta){var n,t=ei(e.data);try{for(t.s();!(n=t.n()).done;){var r=n.value;try{r.meta=JSON.parse(r.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",r.meta)}}}catch(e){t.e(e)}finally{t.f()}}else if(e.data.meta)try{e.data.meta=JSON.parse(e.data.meta)}catch(e){console.error("[JsonFetcher]","Could not decode meta.",x.meta)}return e},oi=function(){var e=Qo(regeneratorRuntime.mark((function e(n){var t,r,a,o,i,l,c,u,s,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.length>1&&void 0!==f[1]?f[1]:{},r=null,a={},o=null,i=null,e.prev=5,(t=t||{}).headers=t.headers?t.headers:{},t.headers.Pragma="no-cache",t.headers["Cache-Control"]="no-cache",e.next=12,fetch("".concat(n),t);case 12:return i=e.sent,e.next=15,i.text();case 15:r=e.sent,(a=JSON.parse(r)).success||(l=!1===a.success?"NOT-SUCCESS":"N/A",c=a.message?a.message:"Unknown error. Check your Console Logs.","rest_no_route"===a.code?(c="The API can't be accessed. Is Rest API enabled?",l="NO-ROUTE"):"internal_server_error"===a.code&&(c="Server error. Please check your PHP Error Logs.",l="SERVER-ERROR"),o=new Ko(c,l,n,r||i)),e.next=26;break;case 20:e.prev=20,e.t0=e.catch(5),u="BROKEN-REPLY",s="The reply sent by the server is broken.",i&&i.status&&408===i.status&&(u="REQUEST-TIMEOUT",s="The request generated a timeout."),o=new Ko(s,u,n,r||i,e.t0);case 26:return o&&(console.error("[NekoError] JsonFetcher",o.url,{code:o.code,error:o.error,body:o.body}),a.success=!1,a.error=o),e.abrupt("return",ai(a));case 28:case"end":return e.stop()}}),e,null,[[5,20]])})));return function(n){return e.apply(this,arguments)}}(),ii=function(){var e=Qo(regeneratorRuntime.mark((function e(n){var t,r,a,o,i,l,c,u,s,f,d,m,p,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.length>1&&void 0!==h[1]?h[1]:{},r=t.json,a=void 0===r?{}:r,o=t.signal,i=t.file,l=t.nonce,c=i?new FormData:null,i)for(c.append("file",i),u=0,s=Object.entries(a);u<s.length;u++)f=Zo(s[u],2),d=f[0],m=f[1],c.append(d,m);return p=l?{"X-WP-Nonce":l}:{},c||(p["Content-Type"]="application/json"),e.abrupt("return",oi(n,{method:"POST",headers:p,body:c||JSON.stringify(a),signal:o}));case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),li=wp.i18n.__,ci={};ci.RENAME=li("Rename","media-file-renamer"),ci.MOVE=li("Move","media-file-renamer"),ci.DASHBOARD=li("Dashboard","media-file-renamer"),ci.PENDING=li("Pending","media-file-renamer"),ci.RENAMED=li("Renamed","media-file-renamer"),ci.ALL=li("All","media-file-renamer"),ci.THUMB=li("Thumb","media-file-renamer"),ci.TITLE=li("Title","media-file-renamer"),ci.ATTACHED_TO=li("Attached To","media-file-renamer"),ci.FILENAME=li("Filename","media-file-renamer");var ui=ci,si=mfrh_media_file_renamer.prefix,fi=mfrh_media_file_renamer.domain,di=mfrh_media_file_renamer.rest_url.replace(/\/+$/,""),mi=mfrh_media_file_renamer.api_url.replace(/\/+$/,""),pi=mfrh_media_file_renamer.plugin_url.replace(/\/+$/,""),hi="1"===mfrh_media_file_renamer.is_pro,bi=hi&&"1"===mfrh_media_file_renamer.is_registered,gi=mfrh_media_file_renamer.rest_nonce,yi="1"===mfrh_media_file_renamer.mfrh_undo,vi="1"===mfrh_media_file_renamer.mfrh_move,Ei="1"===mfrh_media_file_renamer.mfrh_manual_rename;function wi(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function xi(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){wi(o,r,a,i,l,"next",e)}function l(e){wi(o,r,a,i,l,"throw",e)}i(void 0)}))}}function ki(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Ri(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ri(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ri(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Oi=wp.element,ji=Oi.useState,Si=Oi.useEffect,Pi=function(e){var n=e.mutate,t=ki(ji(e.entry),2),r=t[0],a=t[1],o=ki(ji(!1),2),i=o[0],l=o[1],c=ki(ji(""),2),u=c[0],s=c[1],f=ki(ji(null),2),d=f[0],m=f[1],p=e.natural,b=void 0!==p&&p,g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!cn){var n=e.concurrency,t=void 0===n?2:n;cn=new Ze.a({concurrency:t,autoStart:!0})}var r=function(){var e=en(regeneratorRuntime.mark((function e(n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,cn.add(n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return{runTask:r}}({concurrency:2}).runTask;Si((function(){s(""),e.entry?a(e.entry):e.mediaId&&v(e.mediaId)}),[e.entry]);var v=function(){var e=xi(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return e+1})),e.next=3,g(xi(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ii("".concat(mi,"/analyze"),{nonce:gi,json:{mediaId:n}}));case 1:case"end":return e.stop()}}),e)}))));case 3:t=e.sent,a(t.data),l((function(e){return e-1}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),E=function(){var e=xi(regeneratorRuntime.mark((function e(n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(n);case 1:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),w=function(){var e=xi(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a(t),n&&n();case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),x=function(){var e=xi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return e+1})),e.next=3,ii("".concat(mi,"/rename"),{nonce:gi,json:{mediaId:r.ID}});case 3:n=e.sent,w(n.data),m(null),l((function(e){return e-1}));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k=function(){var e=xi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return e+1})),e.next=3,ii("".concat(mi,"/rename"),{nonce:gi,json:{mediaId:r.ID,filename:u}});case 3:n=e.sent,w(n.data),m(null),s(""),l((function(e){return e-1}));case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),R=function(){var e=xi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return e+1})),e.next=3,ii("".concat(mi,"/undo"),{nonce:gi,json:{mediaId:r.ID}});case 3:n=e.sent,w(n.data,r.current_filename),l((function(e){return e-1}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=xi(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return e+1})),e.next=3,ii("".concat(mi,"/set_lock"),{nonce:gi,json:{mediaId:r.ID,lock:!r.locked}});case 3:n=e.sent,w(n.data),l((function(e){return e-1}));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),j=function(){var e=xi(regeneratorRuntime.mark((function e(){var n,t,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log({entry:r}),n=r.metadata.file||"",t="/"+n.substring(0,n.lastIndexOf("/")),!(a=(a=(a=prompt("Where would you like to move this file (in the /uploads directory)?",t)).replace(/\/+$/,""))||"/")){e.next=13;break}return l((function(e){return e+1})),e.next=10,ii("".concat(mi,"/move"),{nonce:gi,json:{mediaId:r.ID,newPath:a}});case 10:o=e.sent,w(o.data),l((function(e){return e-1}));case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=!!u,P=S?u:d||(null==r?void 0:r.current_filename);return React.createElement(h,{busy:i},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(Dt,{natural:b,readOnly:!Ei||i,value:P,onChange:E,onEnter:k,style:{marginRight:0,flex:"auto"}}),!S&&React.createElement(sa,{icon:(null==r?void 0:r.locked)?"lock":"lock-open",width:24,title:(null==r?void 0:r.locked)?"Unlock, to allow future actions":"Lock, to avoid future actions",style:{position:"relative",left:-26,marginRight:-22},color:(null==r?void 0:r.locked)?y.blue:"#5a5a5a82",onClick:O}),S&&React.createElement(sa,{icon:"close",width:24,style:{position:"relative",left:-26,marginRight:-22},color:(null==r?void 0:r.locked)?y.blue:"#5a5a5a82",onClick:function(){s("")}}),(null==r?void 0:r.proposed_filename_exists)&&React.createElement(sa,{icon:"alert",color:"orange",tooltip:{text:"The ideal filename (".concat(r.proposed_filename,") already exists."),position:"left"}}),yi&&!S&&(null==r?void 0:r.original_filename)&&React.createElement(sa,{icon:"file-undo",title:"Rollback to original",color:y.red,onClick:R,onMouseEnter:function(){return m(null==r?void 0:r.original_filename)},onMouseLeave:function(){return m(null)}}),!S&&(null==r?void 0:r.proposed_filename)&&!(null==r?void 0:r.proposed_filename_exists)&&React.createElement(Ge,{style:{marginLeft:5},title:"Rename automatically",onMouseEnter:function(){return m(null==r?void 0:r.proposed_filename)},onMouseLeave:function(){return m(null)},onClick:x},"Auto Rename"),Ei&&S&&React.createElement(Ge,{style:{marginLeft:5},title:"Rename manually",onClick:k},ui.RENAME),vi&&React.createElement(Ge,{style:{marginLeft:5},title:"Move",onClick:j},ui.MOVE)))};function Ci(){var e=Ni(["\n margin-top: 10px;\n background: rgb(0, 72, 88);\n padding: 10px;\n color: rgb(58, 212, 58);\n max-height: 600px;\n min-height: 200px;\n display: block;\n font-family: monospace;\n font-size: 12px;\n white-space: pre;\n overflow-x: auto;\n width: calc(100vw - 276px);\n\n .log-date {\n color: white;\n margin-left: 8px;\n }\n\n .log-type {\n background: #0000004d;\n padding: 2px 5px;\n border-radius: 8px;\n text-transform: uppercase;\n }\n\n .log-content {\n display: block;\n }\n\n .log-warning .log-type {\n background: #ccb028;\n color: white;\n }\n\n .log-fatal .log-type {\n background: #cc2828;\n color: white;\n }\n"]);return Ci=function(){return e},e}function _i(){var e=Ni(["\n\n margin: 15px;\n\n .center {\n background: white;\n border-radius: 10px;\n padding: 10px;\n font-family: Lato;\n max-width: 100%\n overflow: none;\n\n h2 {\n font-size: 26px;\n }\n\n table {\n width: 100%;\n\n tr td:first-child {\n width: 220px;\n font-weight: bold;\n color: #1e7cba;\n }\n\n * {\n overflow-wrap: anywhere;\n }\n }\n }\n\n hr {\n border-color: #1e7cba;\n }\n"]);return _i=function(){return e},e}function Ai(){var e=Ni(["\n width: 85px;\n height: 85px;\n padding-right: 10px;\n"]);return Ai=function(){return e},e}function Ti(){var e=Ni(["\n\n .nui-block-title {\n display: none;\n }\n\n .nui-block-content {\n display: flex;\n padding: 10px;\n\n h2 {\n color: #055082;\n font-size: 16px;\n margin: 5px 0 5px 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n line-height: 18px;\n }\n }\n"]);return Ti=function(){return e},e}function Ii(){var e=Ni(["\n color: white;\n padding: 15px;\n margin-bottom: -15px;\n\n a {\n color: #7dedff;\n text-decoration: none;\n }\n\n p {\n font-size: 15px;\n }\n"]);return Ii=function(){return e},e}function Ni(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var zi=b.a.div(Ii()),Mi=Object(b.a)(Yn)(Ti()),Fi=b.a.img(Ai()),Di=b.a.div(_i()),Li=b.a.ul(Ci());function Bi(e){return function(e){if(Array.isArray(e))return Wi(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Hi(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ui(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function qi(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ui(o,r,a,i,l,"next",e)}function l(e){Ui(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Gi(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||Hi(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hi(e,n){if(e){if("string"==typeof e)return Wi(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Wi(e,n):void 0}}function Wi(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var $i=wp.element,Yi=$i.useState,Ji=$i.useEffect,Vi="".concat(di,"/meow-common/v1"),Ki=function(e){var n=e.request,t=e.title,r=e.max,a=Gi(Yi(!1),2),o=a[0],i=a[1],l=Gi(Yi([]),2),c=l[0],u=l[1],s=c.length>0?c.reduce((function(e,n){return e+n})):0,f=c.length>0?Math.ceil(s/c.length):0,d=!c.length&&o;Ji((function(){o&&setTimeout(qi(regeneratorRuntime.mark((function e(){var t,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new Date).getTime(),e.next=3,ii("".concat(Vi,"/").concat(n));case 3:r=(new Date).getTime(),a=r-t,u((function(e){return[].concat(Bi(e),[a])}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[c]);return React.createElement(zi,{style:{width:200,textAlign:"center"}},React.createElement(Gn,{h2:!0,style:{color:"white"}},t),React.createElement(Na,{size:200,value:d?r:f,max:r},React.createElement("span",{style:{fontSize:20}},d?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},d?"YOUR ENGINE":c.length+" requests")),React.createElement(Ge,{style:{width:"100%",marginTop:10},color:o?"#cc3627":"#ccb027",onClick:function(){o||u([]),i(!o)}},o?"Stop":"Start"))};function Zi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function Xi(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Zi(Object(t),!0).forEach((function(n){Qi(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Zi(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Qi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function el(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function nl(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){el(o,r,a,i,l,"next",e)}function l(e){el(o,r,a,i,l,"throw",e)}i(void 0)}))}}function tl(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return rl(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rl(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rl(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var al=wp.element,ol=al.useState,il=al.useEffect;mi&&di&&pi||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var ll="".concat(di,"/meow-common/v1"),cl=React.createElement(zi,null,React.createElement(Gn,{p:!0},"Meow Apps is run by Jordy Meow, a photographer and software developer living in Japan (and taking ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"a lot of photos"),"). Meow Apps proposes a suite of plugins focusing on photography, imaging, optimization and SEO. The ultimate goal is to make your website better, faster, while making it easy. Meow Apps also teams up with the best players in the community. For more information, please check ",React.createElement("a",{href:"http://meowapps.com",target:"_blank"},"Meow Apps"),".")),ul=React.createElement(zi,null,React.createElement(Gn,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then Start this again to see how it influences the results. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms! For more information, ",React.createElement("a",{href:"https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time",target:"_blank"},"click here"),"."),React.createElement(Gn,{p:!0},React.createElement("b",null,"File Operation Time")," creates a temporary size of 10MB every time. ",React.createElement("b",null,"SQL Request Time")," counts the number of posts. Those two should be very fast, and almost the same as the ",React.createElement("b",null,"Empty Request Time"),".")),sl=React.createElement(zi,null,React.createElement(Gn,{p:!0},"Too many WordPress installs are blown-up with useless and/or heavy plugins, and not aware of best practices. That's not the fault of the users; WordPress pretends to be simple but it is in fact very complex, and the immensity and diversity of the community around it makes it a real jungle where everything is possible."),React.createElement(Gn,{p:!0},"A rule of thumb is to keep your WordPress install as simple as possible, with the least number of plugins installed (run away from the heavy ones) and an excellent hosting service. Avoid VPS or self-hosted solutions; you must be a professional to actually set them up so that they are actually performant."),React.createElement(Gn,{p:!0},"On the Meow Apps website, you will find articles which are always updated with the latest recommendations.",React.createElement("ul",null,React.createElement("li",null,"☘️ ",React.createElement("a",{href:"https://meowapps.com/debugging-wordpress/",target:"_blank"},"How To Debug")),React.createElement("li",null,"☘️ ",React.createElement("a",{href:"https://meowapps.com/seo-optimization/",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"☘️ ",React.createElement("a",{href:"https://meowapps.com/clean-optimize-wordpress/",target:"_blank"},"Clean Up and Optimize")),React.createElement("li",null,"☘️ ",React.createElement("a",{href:"https://meowapps.com/optimize-images-cdn/",target:"_blank"},"Optimize Images")),React.createElement("li",null,"☘️ ",React.createElement("a",{href:"https://meowapps.com/best-hosting-services-wordpress/",target:"_blank"},"Best Hosting Services"))))),fl=function(){var e=tl(ol(!1),2),n=e[0],t=e[1],a=Object(r.b)("".concat(ll,"/all_settings/"),oi),o=a.data,i=a.mutate,l=a.error,c=null==o?void 0:o.data,u=null==c?void 0:c.meowapps_hide_meowapps,s=null==c?void 0:c.force_sslverify,f=tl(ol(!1),2),d=f[0],m=f[1],p=tl(ol([]),2),h=p[0],b=p[1],g=tl(ol(""),2),y=g[0],v=g[1];il((function(){l&&!n&&(t(!0),console.error("Error from UseSWR",l.message))}),[l]),il((function(){var e=document.getElementById("meow-common-phpinfo");v(e.innerHTML)}),[]);var E=function(){var e=nl(regeneratorRuntime.mark((function e(n,t){var r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=Xi({},o.data))[t]=n,i(Xi(Xi({},o),{},{data:r}),!1),m(!0),e.next=6,ii("".concat(ll,"/update_option"),{json:{name:t,value:n},nonce:gi});case 6:a=e.sent,m(!1),a.success||alert(a.message),i();case 10:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),w=function(){var e=nl(regeneratorRuntime.mark((function e(){var n,t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,ii("".concat(ll,"/error_logs"),{nonce:gi});case 3:n=e.sent,t=n&&n.data?n.data:[],b(t.reverse()),m(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=React.createElement(rt,{title:"Main Menu"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(Gn,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:d,checked:u,onChange:E}))),k=React.createElement(rt,{title:"SSL Verify"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(Gn,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:d,checked:s,onChange:E})));return React.createElement(An,{showRestError:n},React.createElement(ba,{title:"The Dashboard"}),React.createElement(Et,null,React.createElement(wt,{full:!0},React.createElement(_o,null,React.createElement(Ao,{title:"Meow Apps"},cl,React.createElement(Et,null,React.createElement(wt,{minimal:!0},React.createElement(Mi,{title:"Media Cleaner",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/media-cleaner.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/"},"Media Cleaner")),React.createElement("p",null,"The Cleaner analyzes your WordPress entirely to find out which files are not used. You can trash them, before deleting them permanently. Your WordPress will breath again :)"))),React.createElement(Mi,{title:"Media File Renamer",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/media-file-renamer.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/"},"Media File Renamer")),React.createElement("p",null,"The Renamer will help you in getting nicer filenames for an improved SEO and a tidier filesystem. It's mostly automatic and very fun to use."))),React.createElement(Mi,{title:"Contact Form Block",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/default.png")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",null,"A simple, pretty and superlight contact form. If you simply want your visitors to get in touch with you, this contact form will be perfect for you and your WordPress."))),React.createElement(Mi,{title:"Meow Analytics",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/default.png")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",null,"Are you tired of those heavy plugins, accessing your Google Analytics deliberately? Switch to Meow Analytics!")))),React.createElement(wt,{minimal:!0},React.createElement(Mi,{title:"Meow Gallery",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/meow-gallery.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",null,"This is the fastest gallery system... and it is pretty as well! It is 100% compatible with the native WordPress galleries and therefore, works right away."))),React.createElement(Mi,{title:"Meow Lightbox",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/meow-lightbox.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",null,"A very sleek and performant Lightbox which will also display your EXIF data (camera, lens, aperture...). Photographers love it."))),React.createElement(Mi,{title:"WP/LR Sync",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/wplr-sync.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WP/LR Sync")),React.createElement("p",null,"Are you using Lightroom? So you know WP/LR Sync already. Wait, you don't? You must try it! This plugin will be your favorite very soon."))),React.createElement(Mi,{title:"Perfect Images + Retina",className:"primary"},React.createElement(Fi,{src:"".concat(pi,"/common/img/wp-retina-2x.jpg")}),React.createElement("div",null,React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"Perfect Images + Retina")),React.createElement("p",null,"It handles Retina, help you managing the Image Sizes registered in your WP, and much more.")))))),React.createElement(Ao,{title:"Performance"},ul,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(Ki,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(Ki,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(Ki,{title:"SQL Request Time",request:"sql_request",max:2800}))),React.createElement(Ao,{title:"Recommendations"},sl),React.createElement(Ao,{title:"PHP Info"},React.createElement(Di,{dangerouslySetInnerHTML:{__html:y}})),React.createElement(Ao,{title:"PHP Error Logs"},React.createElement(zi,null,React.createElement(Ge,{style:{marginBottom:10},color:"#ccb027",onClick:w},"Load PHP Error Logs"),React.createElement(Li,null,h.map((function(e){return React.createElement("li",{class:"log-".concat(e.type)},React.createElement("span",{class:"log-type"},e.type),React.createElement("span",{class:"log-date"},e.date),React.createElement("span",{class:"log-content"},e.content))}))))),React.createElement(Ao,{title:"Settings"},React.createElement(Yn,{title:"Settings",className:"primary"},x,k))))))};function dl(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function ml(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){dl(o,r,a,i,l,"next",e)}function l(e){dl(o,r,a,i,l,"throw",e)}i(void 0)}))}}function pl(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return hl(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hl(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hl(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var bl=wp.element,gl=bl.useState,yl=bl.useEffect,vl="".concat(di,"/meow-licenser/").concat(si,"/v1"),El=function(){var e=pl(gl(!1),2),n=e[0],t=e[1],r=pl(gl(null),2),a=r[0],o=r[1],i=pl(gl(null),2),l=i[0],c=i[1],u=pl(gl(""),2),s=u[0],f=u[1],d=bi&&(!l||"valid"!==l.license),m=function(){var e=ml(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hi){e.next=2;break}return e.abrupt("return");case 2:return t(!0),e.next=5,ii("".concat(vl,"/get_license"),{nonce:gi});case 5:n=e.sent,c(n.data),n.data.key&&f(n.data.key),t(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=ml(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t(!0),e.next=3,ii("".concat(vl,"/set_license"),{nonce:gi,json:{serialKey:null}});case 3:e.sent.success&&(f(""),c(null),o("licenseRemoved")),t(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=ml(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t(!0),e.next=3,ii("".concat(vl,"/set_license"),{nonce:gi,json:{serialKey:s}});case 3:(n=e.sent).success&&(c(n.data),n.data&&!n.data.issue&&o("licenseAdded")),t(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();yl((function(){m()}),[]);var b=d?"Forced License":bi?"Enabled":"Disabled",g=l&&"valid"===l.license,y="Your license is active. Thanks a lot for your support :)";g||(l?"no_activations_left"===l.issue?y=React.createElement("span",null,"There are no activations left for this license. You can visit your account at the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://store.meowapps.com"},"Meow Apps Store"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===l.issue?y=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://store.meowapps.com"},"Meow Apps Store"),"."):"missing"===l.issue?y="This license does not exist.":"disabled"===l.issue?y="This license has been disabled.":"item_name_mismatch"===l.issue?y="This license seems to be for a different plugin... isn't it? :)":(y=React.createElement("span",null,"There is an unknown error related to this serial key. Really sorry about this! Please ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us"),"."),console.error({license:l})):y="Unknown error :(");var v=React.createElement(Yn,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/plugin/".concat(fi,"/")},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://store.meowapps.com/"},"Meow Apps Store"),"."),E=React.createElement(Yn,{title:"Pro Version (".concat(b,")"),busy:n,className:"primary"},React.createElement(rt,{title:"Serial Key",style:{fontWeight:"bold"}},React.createElement(Dt,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:n,value:s,onChange:function(e){return f(e)},placeholder:""})),l&&!g&&React.createElement(Da,null,y),l&&g&&React.createElement(La,null,y),!l&&React.createElement(Gn,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"/plugin/media-file-renamer/"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button."),React.createElement(rt,{contentAlign:"right"},l&&!g&&React.createElement(Ge,{className:"secondary",disabled:n||!s,onClick:h},"Retry to validate"),l&&l.key===s&&React.createElement(Ge,{className:"secondary",disabled:n||!s,onClick:p},"Remove License"),React.createElement(Ge,{disabled:n||!s||l&&l.key===s,onClick:h},"Validate License")),React.createElement(lo,{isOpen:"licenseAdded"===a,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}),React.createElement(lo,{isOpen:"licenseRemoved"===a,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}));return hi?E:v},wl=wp.element.render;function xl(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function kl(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xl(Object(t),!0).forEach((function(n){Rl(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xl(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function Rl(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ol(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function jl(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){Ol(o,r,a,i,l,"next",e)}function l(e){Ol(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Sl(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return Pl(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Pl(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pl(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}document.meowDashboardLoaded||(document.meowDashboardLoaded=!0,document.addEventListener("DOMContentLoaded",(function(e){var n=document.getElementById("meow-common-dashboard");n&&wl(React.createElement(fl,null),n)})));var Cl=wp.element,_l=Cl.useState,Al=Cl.useMemo,Tl={marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:600,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,whiteSpace:"pre",overflowX:"auto",width:"calc(100vw - 276px)"},Il=function(){var e=Object(r.b)("".concat(mi,"/all_settings/")),n=e.data,t=e.mutate,a=an(n,{},!0),o=a.busy,i=a.data,l=a.error,c=Sl(_l(""),2),u=c[0],s=c[1],f=Sl(_l(!1),2),d=f[0],m=f[1],p=o||d,h=null==i?void 0:i.mfrh_auto_rename,b=null==i?void 0:i.mfrh_on_upload,g=null==i?void 0:i.mfrh_rename_slug,y=null==i?void 0:i.mfrh_convert_to_ascii,v=null==i?void 0:i.mfrh_update_posts,E=null==i?void 0:i.mfrh_update_postmeta,w=null==i?void 0:i.mfrh_undo,x=null==i?void 0:i.mfrh_move,k=null==i?void 0:i.mfrh_manual_rename,R=null==i?void 0:i.mfrh_numbered_files,O=null==i?void 0:i.mfrh_sync_alt,j=null==i?void 0:i.mfrh_sync_media_title,S=null==i?void 0:i.mfrh_force_rename,P=null==i?void 0:i.mfrh_log,C=null==i?void 0:i.mfrh_logsql,_=null==i?void 0:i.mfrh_rename_guid,A=null==i?void 0:i.mfrh_case_insensitive_check,T=null==i?void 0:i.mfrh_rename_on_save,I=null==i?void 0:i.mfrh_acf_field_name,N=[{id:"media_title",value:"media_title",label:React.createElement("span",null,"Based on Media Title"),requirePro:!1},{id:"post_acf_field",value:"post_acf_field",label:React.createElement("span",null,"Based on Attached Post (ACF Field)"),requirePro:!1},{id:"post_title",value:"post_title",label:React.createElement("span",null,"Based on Attached Post Title"),requirePro:!bi},{id:"alt_text",value:"alt_text",label:React.createElement("span",null,"Based on Alternative Text"),requirePro:!bi},{id:"anonymize_md5",value:"anonymize_md5",label:React.createElement("span",null,"Anonymize with MD5"),requirePro:!bi},{id:"none",value:"none",label:React.createElement("span",null,"Disable Automatic Rename"),requirePro:!1}],z=function(){var e=jl(regeneratorRuntime.mark((function e(r,a){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=kl({},n.data))[a]=r,t(kl(kl({},n),{},{data:o}),!1),m(!0),e.prev=4,e.next=7,ii("".concat(mi,"/update_option"),{nonce:gi,json:{name:a,value:r}});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),alert(e.t0.message);case 12:return e.prev=12,m(!1),t(),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[4,9,12,16]])})));return function(n,t){return e.apply(this,arguments)}}(),M=function(){var e=jl(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,ii("".concat(mi,"/refresh_logs"));case 3:(n=e.sent).success&&s(n.data),m(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F=function(){var e=jl(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,ii("".concat(mi,"/clear_logs"));case 3:(n=e.sent).success&&s(n.data),m(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),D=React.createElement(Yn,{busy:p,title:"Side Updates",className:"primary"},React.createElement(Gn,{p:!0,style:{marginTop:0}},"When the files are renamed, many links to them on your WordPress might be broken. Those options are updating the references to those files. ",React.createElement("strong",null,"Give it a try, every install is different and it might not work for certain kind of references.")),React.createElement(rt,{title:"Posts"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_update_posts",disabled:p,label:"Enable",description:React.createElement(Gn,{p:!0},"Update the references to the renamed files in the ",React.createElement("strong",null,"content")," content and ",React.createElement("strong",null,"excerpt")," of the posts (pages and custom types included)."),value:"1",checked:v,onChange:z}))),React.createElement(rt,{title:"Post Meta"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_update_postmeta",disabled:p,label:"Enable",description:React.createElement(Gn,{p:!0},"Update the references in the ",React.createElement("strong",null,"custom fields")," of the posts (including pages and custom types metadata)."),value:"1",checked:E,onChange:z})))),L=React.createElement(rt,{title:"Method"},React.createElement(gr,{id:"mfrh_auto_rename",disabled:p,value:h,scrolldown:!0,name:"mfrh_auto_rename",description:"Attached Post includes all kinds of Post Types: Posts, Pages, Products, etc.",onChange:z},N.map((function(e){return React.createElement(yr,{key:e.id,id:e.id,value:e.value,label:e.label,requirePro:e.requirePro})})))),B=Al((function(){return"post_acf_field"!==h?null:React.createElement(rt,{title:"ACF Field Name"},React.createElement(Dt,{id:"mfrh_acf_field_name",name:"mfrh_acf_field_name",value:I,onBlur:z}))}),[h]),U=React.createElement(rt,{title:"On Upload"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_on_upload",disabled:p,label:"Enable",description:React.createElement(React.Fragment,null,React.createElement("span",null,"If your image has an EXIF title, it will be used to decide the filename. "),"post_title"===h&&React.createElement("span",null,"Note: The Attached Post Title ",React.createElement("u",null,"will not be used")," at the time of the upload due to WordPress API constraints.")),value:"1",checked:b,onChange:z}))),q=React.createElement(rt,{title:"Slug/Permalink"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_rename_slug",disabled:p,label:"Sync with filename",description:"Better to keep this un-checked as the link might have been referenced somewhere else.",value:"1",checked:g,onChange:z}))),G=React.createElement(rt,{title:"Transliteration"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_convert_to_ascii",disabled:p,label:"Enable (Recommended)",description:React.createElement(Gn,{p:!0},"Replace accents, emoticons, diacritics, umlauts, cyrillic and any kind of tricky characters by their ASCII equivalent.",React.createElement("br",null)," ",React.createElement("i",null,"Examples: tête → tete, schön → schon, Добро → dobro, etc.")),value:"1",requirePro:!bi,checked:y,onChange:z}))),H=React.createElement(rt,{title:"Undo"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_undo",disabled:p,label:"Enable",description:"An undo icon will be added to the UI. This allows to rollback to the original filename.",value:"1",checked:w,onChange:z}))),W=React.createElement(rt,{title:"Move"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_move",disabled:p,label:"Enable",description:"A move button will be added, and will allow you to move a file to another directory.",value:"1",checked:x,onChange:z,requirePro:!bi}))),$=React.createElement(rt,{title:"Manual Rename"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_manual_rename",disabled:p,label:"Enable",description:"An editable field will be added everywhere your files appear in the UI.",value:"1",checked:k,onChange:z}))),Y=React.createElement(rt,{title:"Force Rename"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_force_rename",disabled:p,label:"Enable",description:"Update the references to the file even if the file renaming itself was not successful. You might want to use that option if your install is broken and you are trying to link your Media to files for which the filenames has been altered (after a migration for exemple)",value:"1",requirePro:!bi,checked:S,onChange:z}))),J=React.createElement(rt,{title:"Numbered Files"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_numbered_files",disabled:p,label:"Enable Numbering",description:"Identical filenames will be allowed by the plugin and a number will be appended automatically (myfile.jpg, myfile-2.jpg, myfile-3.jpg, etc).",requirePro:!bi,value:"1",checked:R,onChange:z}))),V=React.createElement(rt,{title:"ALT Text"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_sync_alt",disabled:p||!("media_title"===h||"post_title"===h),label:React.createElement(Gn,null,"Synchronize"),description:"The ALT Text will be synchronized with the same source used for the filename.",requirePro:!bi,value:"1",checked:O,onChange:z}))),K=React.createElement(rt,{title:"Media Title"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_sync_media_title",disabled:p||"post_title"!==h,label:React.createElement(Gn,null,"Synchronize"),description:"The Media Title will be synchronized with the same source used for the filename.",requirePro:!bi,value:"1",checked:j,onChange:z}))),Z=React.createElement(rt,{title:"Logs"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_log",label:"Enable",description:React.createElement(Gn,{p:!0},"Simple logging that explains which actions has been run."),value:"1",checked:P,onChange:z}),React.createElement("div",{style:{marginTop:20}},React.createElement(Ge,{onClick:M},"Refresh Logs"),React.createElement(Ge,{className:"danger",onClick:F},"Clear Logs")))),X=React.createElement(rt,{title:"SQL Logs"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_logsql",disabled:p,label:"Enable",description:React.createElement(Gn,{p:!0},"The files mfrh_sql.log and mfrh_sql_revert.log will be created in the /logs directory and will include the raw SQL queries which were run by the plugin. If there is an issue, the revert SQL file can help you."),requirePro:!bi,value:"1",checked:C,onChange:z}))),Q=React.createElement(rt,{title:"GUID"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_rename_guid",disabled:p,label:"Sync with filename",description:"The GUID will be renamed like the new filename. Better to keep this un-checked.",value:"1",checked:_,onChange:z}))),ee=React.createElement(rt,{title:"Case Insensitive"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_case_insensitive_check",label:"Enable",value:"1",checked:A,onChange:z,description:React.createElement(React.Fragment,null,'This will consider the file such as "abc.jpg" and "ABC.JPG" as the same file. More information ',React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer-faq-issues/"},"here"),". You should check this if you are on a Windows-based server.")}))),ne=React.createElement(rt,{title:"Rename on Post Save"},React.createElement(At,{max:"1"},React.createElement(Pt,{id:"mfrh_rename_on_save",disabled:p,label:"Enable (Unsafe)",description:"You can modify the titles of your media while editing a post but, of course, the plugin can't update the HTML at this stage. With this option, the plugin will update the filenames and HTML after that you saved the post.",value:"1",checked:T,onChange:z})));return React.createElement(An,{nekoErrors:[l]},React.createElement(ba,{title:"Media File Renamer | Settings",subtitle:"By Jordy Meow"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(Ge,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-file-renamer-tutorial/","_blank")}},"Tutorial"),React.createElement(Ge,{className:"primary",icon:"dashboard",color:"#8554bb",onClick:function(){return location.href="upload.php?page=mfrh_dashboard"}},"Dashboard"))),React.createElement(Et,null,React.createElement(wt,{full:!0},React.createElement(et,null,React.createElement(Gn,{p:!0},"It works out of the box, the default settings are good for most installs. However, you should really have a look at the ",React.createElement("a",{href:"https://meowapps.com/plugin/media-file-renamer/"},"tutorial"),".")),React.createElement(_o,null,React.createElement(Ao,{title:"Basic"},React.createElement(Et,null,React.createElement(wt,{minimal:!0},React.createElement(Yn,{busy:p,title:"Settings",className:"primary"},React.createElement(Gn,{h2:!0},"Automatic"),React.createElement(Gn,{p:!0},"This plugin's main goal is to make the process of optimizing your filenames entirely automatic. By default, your files will be named after the title of your media entry."),L,B,U,React.createElement(Gn,{h2:!0},"Manual"),$,React.createElement(Gn,{p:!0},"If you are a SEO guru or someone who loves having a perfectly neat filesystem, it is recommended to use automatic renaming first, then to tweak specific files with manual renaming. The ",React.createElement("a",{href:"/wp-admin/upload.php?page=mfrh_dashboard"},"Renamer Dashboard")," makes it very easy."))),React.createElement(wt,{minimal:!0},D,React.createElement(Yn,{busy:p,title:"UI (Extra Features)",className:"primary"},H,W)))),React.createElement(Ao,{title:"Advanced"},React.createElement(Et,null,React.createElement(wt,{minimal:!0},React.createElement(Yn,{busy:p,title:"Advanced Settings",className:"primary"},G,J),React.createElement(Yn,{busy:p,title:"Fields Syncing",className:"primary"},q,Q,V,K,React.createElement(Gn,{p:!0},"The fields in the database will be synchronized, but the data already written in your HTML will not be overwritten."))),React.createElement(wt,{minimal:!0},React.createElement(Yn,{busy:p,title:"Developer Settings",className:"primary"},ee,Y,X,ne)))),React.createElement(Ao,{title:"License (Pro)"},React.createElement(El,{domain:fi,prefix:si,isPro:hi,isRegistered:bi})),React.createElement(Ao,{title:"Logs & Debug"},React.createElement(Yn,{busy:p,className:"primary"},Z),React.createElement("div",{style:Tl},u))))))};function Nl(e){return function(e){if(Array.isArray(e))return Ll(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Dl(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zl(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function Ml(e){return function(){var n=this,t=arguments;return new Promise((function(r,a){var o=e.apply(n,t);function i(e){zl(o,r,a,i,l,"next",e)}function l(e){zl(o,r,a,i,l,"throw",e)}i(void 0)}))}}function Fl(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],r=!0,a=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){a=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw o}}return t}(e,n)||Dl(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dl(e,n){if(e){if("string"==typeof e)return Ll(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ll(e,n):void 0}}function Ll(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var Bl=wp.element,Ul=Bl.useState,ql=Bl.useEffect,Gl=Bl.useMemo,Hl={width:40,height:40,objectFit:"cover"},Wl=[{accessor:"thumbnail_url",title:ui.THUMB,style:{width:16}},{accessor:"post_title",title:ui.TITLE,sortable:!0,style:{width:"25%"}},{accessor:"post_parent",title:ui.ATTACHED_TO,sortable:!0,style:{width:"25%"}},{accessor:"current_filename",title:ui.FILENAME,sortable:!0}],$l={accessor:"id",by:"asc"},Yl=function(){var e,n,t,o=Fl(Ul("pending"),2),i=o[0],l=o[1],c=Fl(Ul(),2),u=c[0],s=c[1],f=Fl(Ul([]),2),d=f[0],m=f[1],p=Fl(Ul(!1),2),h=p[0],b=p[1],g=Fl(Ul(""),2),y=g[0],v=g[1],E=Fl(Ul(""),2),w=E[0],x=E[1],k=Fl(Ul($l),2),R=k[0],O=k[1],j=Fl(Ul(1),2),S=j[0],P=j[1],C=Fl(Ul(10),2),_=C[0],A=C[1],T=function(){var e=nn(Object(a.useState)(new AbortController),2),n=e[0],t=e[1],r=Object(a.useRef)(!1),o=Object(a.useRef)(0),i=nn(Object(a.useState)(null),2),l=i[0],c=i[1],u=nn(Object(a.useState)(!1),2),s=u[0],f=u[1],d=nn(Object(a.useState)(0),2),m=d[0],p=d[1],h=nn(Object(a.useState)(!1),2),b=h[0],g=h[1],y=nn(Object(a.useState)(!1),2),v=y[0],E=y[1],w=nn(Object(a.useState)(0),2),x=w[0],k=w[1],R=function(){var e=en(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=new AbortController,t(n),g(!1),o.current=0,r.current=!1,f(!1),E(!1),k(0),p(0);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=en(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Promise((function(e,t){g(!1),o.current=0,r.current=!1,f(!1),E(!1),A(n),c(!0),un.start(),un.onIdle().then((function(){C(),e()}))})),e.abrupt("return",t);case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),j=function(){var e=en(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,un.pause(),f(!0);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=en(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,g(!1),f(!1),un.start();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),P=function(){var e=en(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,un.pause(),n.abort(),c(!1),g(!1),E(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=en(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0,E(!0),c(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_=function(){var e=en(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:un.add(en(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(n.signal);case 3:(a=e.sent)&&a.success||console.error("[useNekoTasks] Task returned nothing.",a),a.success||(o.current++,r.current||(g(a.error),j())),e.next=17;break;case 8:if(e.prev=8,e.t0=e.catch(0),"AbortError"!==e.t0.name){e.next=15;break}return console.log("Aborted"),e.abrupt("return");case 15:o.current++,r.current||(g("An error was caught (more information in the console)."),j());case 17:return e.prev=17,k((function(e){return e+1})),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[0,8,17,20]])})))),p((function(e){return e+1}));case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),A=function(){var e=en(regeneratorRuntime.mark((function e(n){var t,r,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:un.clear(),t=Xe(n);try{for(t.s();!(r=t.n()).done;)a=r.value,_(a)}catch(e){t.e(e)}finally{t.f()}k(0);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),T=Object(a.useCallback)((function(){r.current=!0}),[]),I=Object(a.useCallback)((function(){return o.current}),[]);return{start:O,stop:P,pause:j,resume:S,reset:R,addTask:_,setAlwaysSkip:T,getErrorCount:I,error:b,success:v,busy:l,paused:s,value:x,max:m}}(),I=(S-1)*_,N=R.accessor,z=R.by,M=Object(r.b)("".concat(mi,"/stats")),F=M.data,D=M.mutate,L=Object(r.b)((e="".concat(mi,"/media"),n={limit:_,skip:I,filterBy:i,orderBy:N,order:z},t=e.includes("index.php?rest_route"),e+(t?"&":"?")+new URLSearchParams(n).toString())),B=L.data,U=L.mutate,q=an(F,{pending:"-",renamed:"-",all:"-"},!0),G=q.busy,H=q.data,W=q.error,$=an(B,[],!0),Y=$.busy,J=$.data,V=$.total,K=$.error,Z=Y||G||h,X=Gl((function(){return J.map((function(e){return{id:e.ID,thumbnail_url:React.createElement("img",{src:e.thumbnail_url,style:Hl}),post_title:React.createElement("a",{href:"post.php?post=".concat(e.ID,"&action=edit")},e.post_title),post_parent:React.createElement("div",{style:{maxHeight:35,overflow:"hidden"}},e.post_parent_title?e.post_parent_title:React.createElement("i",{style:{color:"#c1c1c1"}},"None")),current_filename:React.createElement(Pi,{entry:e,mutate:function(){U(),D()}})}}))}),[J]);ql((function(){m([]),O($l),P(1)}),[i]),ql((function(){if(null!==T.busy&&(b(T.busy),!T.busy)){var e=T.getErrorCount();e>0&&x("The process has finished, but ".concat(e," error(s) occurred (check your console).")),T.reset(),m([]),U(),D()}}),[T.busy]);var Q=function(){var e=Ml(regeneratorRuntime.mark((function e(n){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ii("".concat(mi,"/get_all_ids"),{nonce:gi,json:{unlockedOnly:n}});case 2:if((t=e.sent).success){e.next=6;break}return alert(t.message),e.abrupt("return",[]);case 6:return e.abrupt("return",t.data);case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ee=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ii("".concat(mi,"/get_all_post_ids"),{nonce:gi});case 2:if((n=e.sent).success){e.next=6;break}return alert(n.message),e.abrupt("return",[]);case 6:return e.abrupt("return",n.data);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ne=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n,t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v("Preparing..."),b(!0),e.next=4,ee();case 4:if(!(n=e.sent)){e.next=11;break}return v("Auto attaching..."),t=ri(n,20),r=t.map((function(e){return function(){var n=Ml(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,ii("".concat(mi,"/auto_attach"),{nonce:gi,json:{postIds:e},signal:t});case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),T.start(r),e.abrupt("return");case 11:b(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n,t,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>0&&void 0!==a[0]?a[0]:null,v("Preparing..."),b(!0),!n){e.next=7;break}e.t0=n,e.next=10;break;case 7:return e.next=9,Q(!0);case 9:e.t0=e.sent;case 10:if(!(t=e.t0)){e.next=16;break}return v("Undoing..."),r=t.map((function(e){return function(){var n=Ml(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return v("Undo Media ".concat(e)),n.next=3,ii("".concat(mi,"/undo"),{nonce:gi,json:{mediaId:e},signal:t});case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),T.start(r),e.abrupt("return");case 16:b(!1);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),re=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n,t,r,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>0&&void 0!==o[0]?o[0]:null,v("Preparing..."),b(!0),!n){e.next=7;break}e.t0=n,e.next=10;break;case 7:return e.next=9,Q(!0);case 9:e.t0=e.sent;case 10:if(!(t=e.t0)){e.next=17;break}return v("Analyzing..."),r=ri(t,20),a=r.map((function(e){return function(){var n=Ml(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,ii("".concat(mi,"/analyze"),{nonce:gi,json:{mediaIds:e},signal:t});case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),T.start(a),e.abrupt("return");case 17:b(!1);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ae=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n,t,r,a,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(i.length>0&&void 0!==i[0])||i[0],t=i.length>1&&void 0!==i[1]?i[1]:null,v("Preparing..."),b(!0),!t){e.next=8;break}e.t0=t,e.next=11;break;case 8:return e.next=10,Q(n);case 10:e.t0=e.sent;case 11:if(!(r=e.t0)){e.next=18;break}return v("".concat(n?"Locking..":"Unlocking...")),a=ri(r,50),o=a.map((function(e){return function(){var e=Ml(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ii("".concat(mi,"/set_lock"),{nonce:gi,json:{mediaIds:r,lock:n},signal:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()})),T.start(o),e.abrupt("return");case 18:b(!1);case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=Ml(regeneratorRuntime.mark((function e(){var n,t,r,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>0&&void 0!==a[0]?a[0]:null,v("Preparing..."),b(!0),!n){e.next=7;break}e.t0=n,e.next=10;break;case 7:return e.next=9,Q(!0);case 9:e.t0=e.sent;case 10:if(!(t=e.t0)){e.next=15;break}return r=t.map((function(e){return function(){var n=Ml(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return v("Renaming #".concat(e)),n.next=3,ii("".concat(mi,"/rename"),{nonce:gi,json:{mediaId:e},signal:t});case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()})),T.start(r),e.abrupt("return");case 15:b(!1);case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ie=React.createElement(React.Fragment,null,React.createElement("div",null,"All your posts, pages, products (and other post types) will be scanned, and if images are used in them, they will be attached. Currently, Featured Images and Product Galleries are supported. Should we start?"),!bi&&React.createElement("div",{style:{marginTop:20}},React.createElement("b",null,"This feature is only available in the Pro version."))),le=React.createElement(React.Fragment,null,React.createElement(Ge,{className:"secondary",onClick:function(){return window.open("https://meowapps.com/plugin/media-file-renamer/","_blank")}},"Get the Pro Version"),React.createElement(Ge,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-file-renamer-tutorial/","_blank")}},"Read the tutorial"));return React.createElement(An,{nekoErrors:[W,K]},React.createElement(ba,{title:"Media File Renamer | Dashboard",subtitle:"By Jordy Meow"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(Ge,{className:"primary",onClick:function(){return window.open("https://meowapps.com/media-file-renamer-tutorial/","_blank")}},"Tutorial"),React.createElement(Ge,{icon:"cog",color:"#8554bb",onClick:function(){return location.href="admin.php?page=mfrh_settings"}},"Settings"))),React.createElement(Et,null,React.createElement(wt,{full:!0},!bi&&React.createElement(et,{footer:le},React.createElement(Gn,{p:!0},"You must ",React.createElement("b",null,"backup the uploads folder and DB")," before using the Renamer. If you don't know how, give a try to ",React.createElement("a",{target:"_blank",href:"https://meow.click/blogvault"},"BlogVault"),". It is also highly recommanded to read the tutorial. Last but not least, check the ",React.createElement("b",null,"Pro Version"),", as it adds many features and also supports the development. This message is only displayed in the free version. Thank you!")),React.createElement(Jo,null,React.createElement(Ge,{onClick:function(){return re()}},"Analyze Library"),React.createElement(Ge,{onClick:function(){return s("autoAttach")}},"Auto Attach"),"pending"===i&&d.length>0&&React.createElement(React.Fragment,null,React.createElement(Ge,{className:"secondary",onClick:function(){return oe(d)}},"Rename ",React.createElement("strong",null,d.length)," entries"),React.createElement(Ge,{className:"secondary",onClick:function(){return ae(!0,d)}},"Lock ",React.createElement("strong",null,d.length)," entries")),yi&&"renamed"===i&&d.length>0&&React.createElement(React.Fragment,null,React.createElement(Ge,{className:"secondary",onClick:function(){return te(d)}},"Undo ",React.createElement("strong",null,d.length)," entries")),React.createElement("div",{style:{flex:1}},h&&React.createElement($r,{status:function(e){return"".concat(y," (").concat(e,"%)")},busy:h,value:T.value,max:T.max,onStopClick:T.stop})),"all"===i&&React.createElement(React.Fragment,null,React.createElement(Ge,{className:"secondary",onClick:function(){return ae(!0)}},"Lock ",React.createElement("strong",null,"All")),React.createElement(Ge,{className:"secondary",onClick:function(){return ae(!1)}},"Unlock ",React.createElement("strong",null,"All"))),("all"===i||"pending"===i)&&React.createElement(React.Fragment,null,React.createElement(Ge,{className:"primary",onClick:function(){return s("renameAll")}},"Rename ",React.createElement("strong",null,"All"))),yi&&("all"===i||"renamed"===i)&&React.createElement(React.Fragment,null,React.createElement(Ge,{className:"danger",onClick:function(){return s("undoAll")}},"Undo ",React.createElement("strong",null,"All")))),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10,marginBottom:10}},React.createElement(_a,{value:i,busy:G,onChange:function(e){l(e),P(1)}},React.createElement(Aa,{title:ui.PENDING,value:"pending",count:H.pending}),React.createElement(Aa,{title:"Renamed",value:"renamed",count:H.renamed}),React.createElement(Aa,{title:"Locked",value:"locked",count:H.locked}),React.createElement(Aa,{title:"All",value:"all",count:H.all})),React.createElement(xa,{currentPage:S,limit:_,total:V,onClick:function(e){return P(e)}})),React.createElement(bo,{busy:Z,data:X,columns:Wl,sort:R,onSortChange:function(e,n){O({accessor:e,by:n})},onSelect:function(e){m([].concat(Nl(d),Nl(e)))},onUnselect:function(e){m(Nl(d.filter((function(n){return!e.includes(n)}))))},selectedItems:d}),React.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginTop:10}},React.createElement(gr,{scrolldown:!0,value:_,onChange:function(e){A(e),P(1)}},React.createElement(yr,{value:5,label:"5 items per page"}),React.createElement(yr,{value:10,label:"10 items per page"}),React.createElement(yr,{value:25,label:"25 items per page"}),React.createElement(yr,{value:50,label:"50 items per page"}),React.createElement(yr,{value:100,label:"100 items per page"}),React.createElement(yr,{value:200,label:"200 items per page"})),React.createElement(xa,{currentPage:S,limit:_,total:V,onClick:function(e){return P(e)}}))),React.createElement(lo,{isOpen:"autoAttach"===u,onRequestClose:function(){return s(null)},title:"Automatically attach your images to your posts",content:ie,ok:bi?"Run":"OK",onOkClick:function(){s(null),bi&&ne()},onCancelClick:function(){s(null)}}),React.createElement(lo,{isOpen:"renameAll"===u,onRequestClose:function(){return s(null)},title:"You are about to rename all your (unlocked) files",content:"Renaming files is a dangerous operation. Please make sure you made a backup or your entire WordPress install. Should we start?",onOkClick:function(){s(null),oe()},onCancelClick:function(){s(null)}}),React.createElement(lo,{isOpen:"undoAll"===u,onRequestClose:function(){return s(null)},title:"You are about to undo the renaming for all your files",content:"Are you sure you would like to proceed?",onOkClick:function(){s(null),te()},onCancelClick:function(){s(null)}}),React.createElement(lo,{isOpen:w,title:"Success",ok:"Close",content:w,onOkClick:function(){x(""),T.reset()}})))},Jl=wp.element.render,Vl={fetcher:oi,revalidateOnFocus:!1};function Kl(){Array.from(document.getElementsByClassName("mfrh-renamer-field")).forEach((function(e){var n=e.getAttribute("data-id");Jl(React.createElement(Pi,{natural:!0,mediaId:n}),e)}))}document.addEventListener("DOMContentLoaded",(function(e){var n,t;new MutationObserver((function(){Kl()})).observe(document.documentElement,{childList:!0,subtree:!0}),(n=document.getElementById("mfrh-admin-settings"))&&Jl(React.createElement(r.a,{value:Vl},React.createElement(Il,null)),n),(t=document.getElementById("mfrh-media-rename"))&&Jl(React.createElement(r.a,{value:Vl},React.createElement(Yl,null)),t),Kl()}))}});
|
2 |
-
//# sourceMappingURL=index.js.map
|
|
|
|
trunk/app/vendor.js
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
(window.wpJsonMfrh=window.wpJsonMfrh||[]).push([[1],[,function(e,t,n){e.exports=n(64)()},function(e,t,n){"use strict";(function(e){var r=n(18),o=n(0),i=n.n(o),a=(n(54),n(55)),u=n(56),s=n(25),l=n(22),c=n.n(l);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var d=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},p=function(e){return null!==e&&"object"==typeof e&&"[object Object]"===(e.toString?e.toString():Object.prototype.toString.call(e))&&!Object(r.typeOf)(e)},h=Object.freeze([]),v=Object.freeze({});function y(e){return"function"==typeof e}function b(e){return e.displayName||e.name||"Component"}function m(e){return e&&"string"==typeof e.styledComponentId}var g=void 0!==e&&(e.env.REACT_APP_SC_ATTR||e.env.SC_ATTR)||"data-styled",w="undefined"!=typeof window&&"HTMLElement"in window,_="boolean"==typeof SC_DISABLE_SPEEDY&&SC_DISABLE_SPEEDY||void 0!==e&&(e.env.REACT_APP_SC_DISABLE_SPEEDY||e.env.SC_DISABLE_SPEEDY)||!1,C=function(){return n.nc};function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/master/packages/styled-components/src/utils/errors.md#"+e+" for more information."+(n.length>0?" Additional arguments: "+n.join(", "):""))}var k=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(g))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(g,"active"),r.setAttribute("data-styled-version","5.1.1");var a=C();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},S=function(){function e(e){var t=this.element=k(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}O(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),x=function(){function e(e){var t=this.element=k(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),A=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),M=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&O(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),u=0,s=t.length;u<s;u++)this.tag.insertRule(a,t[u])&&(this.groupSizes[e]++,a++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+=this.tag.getRule(i)+"/*!sc*/\n";return t},e}(),j=new Map,E=new Map,P=1,I=function(e){if(j.has(e))return j.get(e);var t=P++;return j.set(e,t),E.set(t,e),t},R=function(e){return E.get(e)},T=function(e,t){t>=P&&(P=t+1),j.set(e,t),E.set(t,e)},L="style["+g+'][data-styled-version="5.1.1"]',F=new RegExp("^"+g+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),z=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},N=function(e,t){for(var n=t.innerHTML.split("/*!sc*/\n"),r=[],o=0,i=n.length;o<i;o++){var a=n[o].trim();if(a){var u=a.match(F);if(u){var s=0|parseInt(u[1],10),l=u[2];0!==s&&(T(l,s),z(e,l,u[3]),e.getTag().insertRules(s,r)),r.length=0}else r.push(a)}}},D=w,H={isServer:!w,useCSSOMInjection:!_},V=function(){function e(e,t,n){void 0===e&&(e=H),void 0===t&&(t={}),this.options=f({},H,{},e),this.gs=t,this.names=new Map(n),!this.options.isServer&&w&&D&&(D=!1,function(e){for(var t=document.querySelectorAll(L),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(g)&&(N(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return I(e)};var t=e.prototype;return t.reconstructWithOptions=function(t){return new e(f({},this.options,{},t),this.gs,this.names)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(t=this.options,n=t.isServer,r=t.useCSSOMInjection,o=t.target,e=n?new A(o):r?new S(o):new x(o),new M(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(I(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(I(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(I(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var i=R(o);if(void 0!==i){var a=e.names.get(i),u=t.getGroup(o);if(void 0!==a&&0!==u.length){var s=g+".g"+o+'[id="'+i+'"]',l="";void 0!==a&&a.forEach((function(e){e.length>0&&(l+=e+",")})),r+=""+u+s+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),q=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},$=function(e){return q(5381,e)};var U=/^\s*\/\/.*$/gm;function W(e){var t,n,r,o=void 0===e?v:e,i=o.options,u=void 0===i?v:i,s=o.plugins,l=void 0===s?h:s,c=new a.a(u),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,u,s,l,c,f){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),p=function(e,r,o){return r>0&&-1!==o.slice(0,r).indexOf(n)&&o.slice(r-n.length,r)!==n?"."+t:e};function y(e,o,i,a){void 0===a&&(a="&");var u=e.replace(U,""),s=o&&i?i+" "+o+" { "+u+" }":u;return t=a,n=o,r=new RegExp("\\"+n+"\\b","g"),c(i||!o?"":o,s)}return c.use([].concat(l,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,p))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),y.hash=l.length?l.reduce((function(e,t){return t.name||O(15),q(e,t.name)}),5381).toString():"",y}var B=i.a.createContext(),G=(B.Consumer,i.a.createContext()),K=(G.Consumer,new V),Y=W();function X(){return Object(o.useContext)(B)||K}function Q(){return Object(o.useContext)(G)||Y}var J=function(){function e(e,t){var n=this;this.inject=function(e){e.hasNameForId(n.id,n.name)||e.insertRules(n.id,n.name,Y.apply(void 0,n.stringifyArgs))},this.toString=function(){return O(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.stringifyArgs=t}return e.prototype.getName=function(){return this.name},e}(),Z=/([A-Z])/g,ee=/^ms-/;function te(e){return e.replace(Z,"-$1").toLowerCase().replace(ee,"-ms-")}var ne=function(e){return null==e||!1===e||""===e},re=function e(t,n){var r=[];return Object.keys(t).forEach((function(n){if(!ne(t[n])){if(p(t[n]))return r.push.apply(r,e(t[n],n)),r;if(y(t[n]))return r.push(te(n)+":",t[n],";"),r;r.push(te(n)+": "+(o=n,(null==(i=t[n])||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||o in u.a?String(i).trim():i+"px")+";"))}var o,i;return r})),n?[n+" {"].concat(r,["}"]):r};function oe(e,t,n){if(Array.isArray(e)){for(var r,o=[],i=0,a=e.length;i<a;i+=1)""!==(r=oe(e[i],t,n))&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));return o}return ne(e)?"":m(e)?"."+e.styledComponentId:y(e)?"function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t?e:oe(e(t),t,n):e instanceof J?n?(e.inject(n),e.getName()):e:p(e)?re(e):e.toString();var u}function ie(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return y(e)||p(e)?oe(d(h,[e].concat(n))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:oe(d(e,n))}var ae=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},ue=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function se(e,t,n){var r=e[n];ae(t)&&ae(r)?le(r,t):e[n]=t}function le(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];if(ae(a))for(var u in a)ue(u)&&se(e,a[u],u)}return e}var ce=/(a)(d)/gi,fe=function(e){return String.fromCharCode(e+(e>25?39:97))};function de(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=fe(t%52)+n;return(fe(t%52)+n).replace(ce,"$1-$2")}function pe(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(y(n)&&!m(n))return!1}return!0}var he=function(){function e(e,t){this.rules=e,this.staticRulesId="",this.isStatic=pe(e),this.componentId=t,this.baseHash=$(t),V.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId;if(this.isStatic&&!n.hash){if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))return this.staticRulesId;var o=oe(this.rules,e,t).join(""),i=de(q(this.baseHash,o.length)>>>0);if(!t.hasNameForId(r,i)){var a=n(o,"."+i,void 0,r);t.insertRules(r,i,a)}return this.staticRulesId=i,i}for(var u=this.rules.length,s=q(this.baseHash,n.hash),l="",c=0;c<u;c++){var f=this.rules[c];if("string"==typeof f)l+=f;else{var d=oe(f,e,t),p=Array.isArray(d)?d.join(""):d;s=q(s,p+c),l+=p}}var h=de(s>>>0);if(!t.hasNameForId(r,h)){var v=n(l,"."+h,void 0,r);t.insertRules(r,h,v)}return h},e}(),ve=(new Set,function(e,t,n){return void 0===n&&(n=v),e.theme!==n.theme&&e.theme||t||n.theme}),ye=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,be=/(^-|-$)/g;function me(e){return e.replace(ye,"-").replace(be,"")}function ge(e){return"string"==typeof e&&!0}var we=function(e){return de($(e)>>>0)};var _e=i.a.createContext();_e.Consumer;var Ce={};function Oe(e,t,n){var r=e.attrs,i=e.componentStyle,a=e.defaultProps,u=e.foldedComponentIds,l=e.shouldForwardProp,c=e.styledComponentId,d=e.target;Object(o.useDebugValue)(c);var p=function(e,t,n){void 0===e&&(e=v);var r=f({},t,{theme:e}),o={};return n.forEach((function(e){var t,n,i,a=e;for(t in y(a)&&(a=a(r)),a)r[t]=o[t]="className"===t?(n=o[t],i=a[t],n&&i?n+" "+i:n||i):a[t]})),[r,o]}(ve(t,Object(o.useContext)(_e),a)||v,t,r),h=p[0],b=p[1],m=function(e,t,n,r){var i=X(),a=Q(),u=e.isStatic&&!t?e.generateAndInjectStyles(v,i,a):e.generateAndInjectStyles(n,i,a);return Object(o.useDebugValue)(u),u}(i,r.length>0,h),g=n,w=b.$as||t.$as||b.as||t.as||d,_=ge(w),C=b!==t?f({},t,{},b):t,O=l||_&&s.a,k={};for(var S in C)"$"!==S[0]&&"as"!==S&&("forwardedAs"===S?k.as=C[S]:O&&!O(S,s.a)||(k[S]=C[S]));return t.style&&b.style!==t.style&&(k.style=f({},t.style,{},b.style)),k.className=Array.prototype.concat(u,c,m!==c?m:null,t.className,b.className).filter(Boolean).join(" "),k.ref=g,Object(o.createElement)(w,k)}function ke(e,t,n){var r=m(e),o=!ge(e),a=t.displayName,u=void 0===a?function(e){return ge(e)?"styled."+e:"Styled("+b(e)+")"}(e):a,s=t.componentId,l=void 0===s?function(e,t){var n="string"!=typeof e?"sc":me(e);Ce[n]=(Ce[n]||0)+1;var r=n+"-"+we(n+Ce[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):s,d=t.attrs,p=void 0===d?h:d,v=t.displayName&&t.componentId?me(t.displayName)+"-"+t.componentId:t.componentId||l,y=r&&e.attrs?Array.prototype.concat(e.attrs,p).filter(Boolean):p,g=t.shouldForwardProp;r&&e.shouldForwardProp&&(g=g?function(n,r){return e.shouldForwardProp(n,r)&&t.shouldForwardProp(n,r)}:e.shouldForwardProp);var w,_=new he(r?e.componentStyle.rules.concat(n):n,v),C=function(e,t){return Oe(w,e,t)};return C.displayName=u,(w=i.a.forwardRef(C)).attrs=y,w.componentStyle=_,w.displayName=u,w.shouldForwardProp=g,w.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,w.styledComponentId=v,w.target=r?e.target:e,w.withComponent=function(e){var r=t.componentId,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(ge(e)?e:me(b(e)));return ke(e,f({},o,{attrs:y,componentId:i}),n)},Object.defineProperty(w,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?le({},e.defaultProps,t):t}}),w.toString=function(){return"."+w.styledComponentId},o&&c()(w,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,self:!0,styledComponentId:!0,target:!0,withComponent:!0}),w}var Se=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return O(1,String(n));var i=function(){return t(n,o,ie.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,f({},o,{},r))},i.attrs=function(r){return e(t,n,f({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(ke,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Se[e]=Se(e)}));t.a=Se}).call(this,n(67))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.InlineIcon=t.Icon=void 0;var r,o=(r=n(0))&&r.__esModule?r:{default:r};function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var u=0,s=/(-?[0-9.]*[0-9]+[0-9.]*)/g,l=/^-?[0-9.]*[0-9]+[0-9.]*$/g,c=["width","height","inline","hFlip","vFlip","flip","rotate","align","color","box"],f={left:0,top:0,width:16,height:16,rotate:0,hFlip:!1,vFlip:!1};var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._item=t}var t,n,r;return t=e,r=[{key:"splitAttributes",value:function(e){var t={icon:Object.create(null),node:Object.create(null)};return Object.keys(e).forEach((function(n){t[-1===c.indexOf(n)?"node":"icon"][n]=e[n]})),t}},{key:"calculateDimension",value:function(e,t,n){if(1===t)return e;if(n=void 0===n?100:n,"number"==typeof e)return Math.ceil(e*t*n)/n;var r=e.split(s);if(null===r||!r.length)return null;for(var o,i=[],a=r.shift(),u=l.test(a);;){if(u?(o=parseFloat(a),isNaN(o)?i.push(a):i.push(Math.ceil(o*t*n)/n)):i.push(a),void 0===(a=r.shift()))return i.join("");u=!u}}},{key:"replaceIDs",value:function(e){var t,n,r=/\sid="(\S+)"/g,o=[];function i(e,t,n){for(var r=0;-1!==(r=n.indexOf(e,r));)n=n.slice(0,r)+t+n.slice(r+e.length),r+=t.length;return n}for(;t=r.exec(e);)o.push(t[1]);return o.length?(n="IconifyId-"+Date.now().toString(16)+"-"+(16777216*Math.random()|0).toString(16)+"-",o.forEach((function(t){var r=n+u;u++,e=i('="'+t+'"','="'+r+'"',e),e=i('="#'+t+'"','="#'+r+'"',e),e=i("(#"+t+")","(#"+r+")",e)})),e):e}}],(n=[{key:"getAttributes",value:function(t){var n=this._item;"object"!==i(t)&&(t=Object.create(null));var r={horizontal:"center",vertical:"middle",slice:!1},o={rotate:n.rotate,hFlip:n.hFlip,vFlip:n.vFlip},a=Object.create(null),u=Object.create(null),s=!0===t.inline||"true"===t.inline||"1"===t.inline,l={left:n.left,top:s?n.inlineTop:n.top,width:n.width,height:s?n.inlineHeight:n.height};if(["hFlip","vFlip"].forEach((function(e){void 0===t[e]||!0!==t[e]&&"true"!==t[e]&&"1"!==t[e]||(o[e]=!o[e])})),void 0!==t.flip&&t.flip.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"horizontal":o.hFlip=!o.hFlip;break;case"vertical":o.vFlip=!o.vFlip}})),void 0!==t.rotate){var c=t.rotate;if("number"==typeof c)o.rotate+=c;else if("string"==typeof c){var f=c.replace(/^-?[0-9.]*/,"");if(""===f)c=parseInt(c),isNaN(c)||(o.rotate+=c);else if(f!==c){var d=!1;switch(f){case"%":d=25;break;case"deg":d=90}d&&(c=parseInt(c.slice(0,c.length-f.length)),isNaN(c)||(o.rotate+=Math.round(c/d)))}}}var p,h=[];switch(o.hFlip?o.vFlip?o.rotate+=2:(h.push("translate("+(l.width+l.left)+" "+(0-l.top)+")"),h.push("scale(-1 1)"),l.top=l.left=0):o.vFlip&&(h.push("translate("+(0-l.left)+" "+(l.height+l.top)+")"),h.push("scale(1 -1)"),l.top=l.left=0),o.rotate%4){case 1:p=l.height/2+l.top,h.unshift("rotate(90 "+p+" "+p+")"),0===l.left&&0===l.top||(p=l.left,l.left=l.top,l.top=p),l.width!==l.height&&(p=l.width,l.width=l.height,l.height=p);break;case 2:h.unshift("rotate(180 "+(l.width/2+l.left)+" "+(l.height/2+l.top)+")");break;case 3:p=l.width/2+l.left,h.unshift("rotate(-90 "+p+" "+p+")"),0===l.left&&0===l.top||(p=l.left,l.left=l.top,l.top=p),l.width!==l.height&&(p=l.width,l.width=l.height,l.height=p)}var v,y,b=t.width?t.width:null,m=t.height?t.height:null;null===b&&null===m&&(m="1em"),null!==b&&null!==m?(v=b,y=m):null!==b?(v=b,y=e.calculateDimension(v,l.height/l.width)):(y=m,v=e.calculateDimension(y,l.width/l.height)),!1!==v&&(u.width="auto"===v?l.width:v),!1!==y&&(u.height="auto"===y?l.height:y),s&&0!==n.verticalAlign&&(a["vertical-align"]=n.verticalAlign+"em"),void 0!==t.align&&t.align.toLowerCase().split(/[\s,]+/).forEach((function(e){switch(e){case"left":case"right":case"center":r.horizontal=e;break;case"top":case"bottom":case"middle":r.vertical=e;break;case"crop":r.slice=!0;break;case"meet":r.slice=!1}})),u.preserveAspectRatio=function(e){var t;switch(e.horizontal){case"left":t="xMin";break;case"right":t="xMax";break;default:t="xMid"}switch(e.vertical){case"top":t+="YMin";break;case"bottom":t+="YMax";break;default:t+="YMid"}return t+=e.slice?" slice":" meet"}(r),u.viewBox=l.left+" "+l.top+" "+l.width+" "+l.height;var g=e.replaceIDs(n.body);return void 0!==t.color&&(g=g.replace(/currentColor/g,t.color)),h.length&&(g='<g transform="'+h.join(" ")+'">'+g+"</g>"),!0!==t.box&&"true"!==t.box&&"1"!==t.box||(g+='<rect x="'+l.left+'" y="'+l.top+'" width="'+l.width+'" height="'+l.height+'" fill="rgba(0, 0, 0, 0)" />'),{attributes:u,body:g,style:a}}},{key:"getSVG",value:function(t,n){var r=e.splitAttributes(t),o=this.getAttributes(r.icon),i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"';return n&&Object.keys(r.node).forEach((function(e){i+=" "+e+'="'+r.node[e]+'"'})),Object.keys(o.attributes).forEach((function(e){i+=" "+e+'="'+o.attributes[e]+'"'})),i+=' style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);',Object.keys(o.style).forEach((function(e){i+=" "+e+": "+o.style[e]+";"})),t&&void 0!==t.style&&(i+=t.style),i+='">',i+=o.body+"</svg>"}}])&&a(t.prototype,n),r&&a(t,r),e}();function p(e,t){if("object"!==i(e.icon))return null;var n=d.splitAttributes(e),r=n.icon,a=n.node;delete a.icon,void 0===r.inline&&(r.inline=t);var u=new d(function(e){var t,n=Object.create(null);for(t in f)n[t]=f[t];for(t in e)n[t]=e[t];return void 0===n.inlineTop&&(n.inlineTop=n.top),void 0===n.inlineHeight&&(n.inlineHeight=n.height),void 0===n.verticalAlign&&(n.verticalAlign=n.height%7==0&&n.height%8!=0?-.143:-.125),n}(e.icon)).getAttributes(r),s={transform:"rotate(360deg)"};if(void 0!==u.style["vertical-align"]&&(s.verticalAlign=u.style["vertical-align"]),void 0!==e.style)for(var l in e.style)s[l]=e.style[l];var c,p={xmlns:"http://www.w3.org/2000/svg",focusable:!1,style:s};for(c in a)p[c]=a[c];for(c in u.attributes)p[c]=u.attributes[c];return p.dangerouslySetInnerHTML={__html:u.body},o.default.createElement("svg",p,null)}var h=function(e){return p(e,!1)};t.Icon=h;t.InlineIcon=function(e){return p(e,!0)};var v=h;t.default=v},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return(u=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return N}));var c=function(e){var t,n;function r(t){return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/master/src/internalHelpers/errors.md#"+t+" for more information.")||this)}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r}(s(Error));function f(e){return Math.round(255*e)}function d(e,t,n){return f(e)+","+f(t)+","+f(n)}function p(e,t,n,r){if(void 0===r&&(r=d),0===t)return r(n,n,n);var o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(o%2-1)),u=0,s=0,l=0;o>=0&&o<1?(u=i,s=a):o>=1&&o<2?(u=a,s=i):o>=2&&o<3?(s=i,l=a):o>=3&&o<4?(s=a,l=i):o>=4&&o<5?(u=a,l=i):o>=5&&o<6&&(u=i,l=a);var c=n-i/2;return r(u+c,s+c,l+c)}var h={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var v=/^#[a-fA-F0-9]{6}$/,y=/^#[a-fA-F0-9]{8}$/,b=/^#[a-fA-F0-9]{3}$/,m=/^#[a-fA-F0-9]{4}$/,g=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,w=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,_=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,C=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function O(e){if("string"!=typeof e)throw new c(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return h[t]?"#"+h[t]:e}(e);if(t.match(v))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(y)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(b))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(m)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=g.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=w.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])};var a=_.exec(t);if(a){var u="rgb("+p(parseInt(""+a[1],10),parseInt(""+a[2],10)/100,parseInt(""+a[3],10)/100)+")",s=g.exec(u);if(!s)throw new c(4,t,u);return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10)}}var l=C.exec(t);if(l){var f="rgb("+p(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",d=g.exec(f);if(!d)throw new c(4,t,f);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+l[4])}}throw new c(5)}function k(e){return function(e){var t,n=e.red/255,r=e.green/255,o=e.blue/255,i=Math.max(n,r,o),a=Math.min(n,r,o),u=(i+a)/2;if(i===a)return void 0!==e.alpha?{hue:0,saturation:0,lightness:u,alpha:e.alpha}:{hue:0,saturation:0,lightness:u};var s=i-a,l=u>.5?s/(2-i-a):s/(i+a);switch(i){case n:t=(r-o)/s+(r<o?6:0);break;case r:t=(o-n)/s+2;break;default:t=(n-r)/s+4}return t*=60,void 0!==e.alpha?{hue:t,saturation:l,lightness:u,alpha:e.alpha}:{hue:t,saturation:l,lightness:u}}(O(e))}var S=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function x(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function A(e){return x(Math.round(255*e))}function M(e,t,n){return S("#"+A(e)+A(t)+A(n))}function j(e,t,n){return p(e,t,n,M)}function E(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return j(e,t,n);if("object"===l(e)&&void 0===t&&void 0===n)return j(e.hue,e.saturation,e.lightness);throw new c(1)}function P(e,t,n,r){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return r>=1?j(e,t,n):"rgba("+p(e,t,n)+","+r+")";if("object"===l(e)&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?j(e.hue,e.saturation,e.lightness):"rgba("+p(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new c(2)}function I(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return S("#"+x(e)+x(t)+x(n));if("object"===l(e)&&void 0===t&&void 0===n)return S("#"+x(e.red)+x(e.green)+x(e.blue));throw new c(6)}function R(e,t,n,r){if("string"==typeof e&&"number"==typeof t){var o=O(e);return"rgba("+o.red+","+o.green+","+o.blue+","+t+")"}if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return r>=1?I(e,t,n):"rgba("+e+","+t+","+n+","+r+")";if("object"===l(e)&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?I(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new c(7)}function T(e){if("object"!==l(e))throw new c(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return R(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return I(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return P(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return E(e);throw new c(8)}function L(e){return function e(t,n,r){return function(){var o=r.concat(Array.prototype.slice.call(arguments));return o.length>=n?t.apply(this,o):e(t,n,o)}}(e,e.length,[])}function F(e,t,n){return Math.max(e,Math.min(t,n))}function z(e,t){if("transparent"===t)return t;var n=k(t);return T(r({},n,{lightness:F(0,1,n.lightness+parseFloat(e))}))}var N=L(z)},function(e,t){t.__esModule=!0,t.default={body:'<path d="M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";n.d(t,"a",(function(){return P}));var r=n(0),o=n(30),i=n.n(o);function a(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}function u(){return void 0===navigator.onLine||navigator.onLine}var s=new WeakMap,l=0;var c=new(function(){function e(e){void 0===e&&(e={}),this.__cache=new Map(Object.entries(e)),this.__listeners=[]}return e.prototype.get=function(e){var t=this.serializeKey(e)[0];return this.__cache.get(t)},e.prototype.set=function(e,t,n){void 0===n&&(n=!0);var r=this.serializeKey(e)[0];this.__cache.set(r,t),n&&E(e,t,!1),this.notify()},e.prototype.keys=function(){return Array.from(this.__cache.keys())},e.prototype.has=function(e){var t=this.serializeKey(e)[0];return this.__cache.has(t)},e.prototype.clear=function(e){void 0===e&&(e=!0),e&&this.__cache.forEach((function(e){return E(e,null,!1)})),this.__cache.clear(),this.notify()},e.prototype.delete=function(e,t){void 0===t&&(t=!0);var n=this.serializeKey(e)[0];t&&E(e,null,!1),this.__cache.delete(n),this.notify()},e.prototype.serializeKey=function(e){var t=null;if("function"==typeof e)try{e=e()}catch(t){e=""}return Array.isArray(e)?(t=e,e=function(e){if(!e.length)return"";for(var t="arg",n=0;n<e.length;++n){var r=void 0;null===e[n]||"object"!=typeof e[n]?r="string"==typeof e[n]?'"'+e[n]+'"':String(e[n]):s.has(e[n])?r=s.get(e[n]):(r=l,s.set(e[n],l++)),t+="@"+r}return t}(e)):e=String(e||""),[e,t,e?"err@"+e:""]},e.prototype.subscribe=function(e){var t=this;if("function"!=typeof e)throw new Error("Expected the listener to be a function.");var n=!0;return this.__listeners.push(e),function(){if(n){n=!1;var r=t.__listeners.indexOf(e);r>-1&&(t.__listeners[r]=t.__listeners[t.__listeners.length-1],t.__listeners.length--)}}},e.prototype.notify=function(){for(var e=0,t=this.__listeners;e<t.length;e++){(0,t[e])()}},e}()),f={},d={},p={},h={},v={};var y="undefined"!=typeof window&&navigator.connection&&-1!==["slow-2g","2g"].indexOf(navigator.connection.effectiveType),b={onLoadingSlow:function(){},onSuccess:function(){},onError:function(){},onErrorRetry:function(e,t,n,r,o){if(a()&&!(n.errorRetryCount&&o.retryCount>n.errorRetryCount)){var i=Math.min(o.retryCount||0,8),u=~~((Math.random()+.5)*(1<<i))*n.errorRetryInterval;setTimeout(r,u,o)}},errorRetryInterval:1e3*(y?10:5),focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:1e3*(y?5:3),refreshInterval:0,revalidateOnFocus:!0,revalidateOnReconnect:!0,refreshWhenHidden:!1,refreshWhenOffline:!1,shouldRetryOnError:!0,suspense:!1,compare:i.a},m=!1;if("undefined"!=typeof window&&window.addEventListener&&!m){var g=function(){if(a()&&u())for(var e in p)p[e][0]&&p[e][0]()};window.addEventListener("visibilitychange",g,!1),window.addEventListener("focus",g,!1),m=!0}var w=b;function _(e,t){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=!0,e.apply(void 0,r),setTimeout((function(){return n=!1}),t))}}var C=Object(r.createContext)({});C.displayName="SWRConfigContext";var O=C,k=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))},S=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},x="undefined"==typeof window,A=x?r.useEffect:r.useLayoutEffect,M=function(e,t){void 0===t&&(t=!0);var n=c.serializeKey(e),r=n[0],o=n[2];if(!r)return Promise.resolve();var i=h[r];if(r&&i){for(var a=c.get(r),u=c.get(o),s=[],l=0;l<i.length;++l)s.push(i[l](t,a,u,l>0));return Promise.all(s).then((function(){return c.get(r)}))}return Promise.resolve(c.get(r))},j=function(e,t,n){var r=h[e];if(e&&r)for(var o=0;o<r.length;++o)r[o](!1,t,n)},E=function(e,t,n){return void 0===n&&(n=!0),k(void 0,void 0,void 0,(function(){var r,o,i,a,u,s,l,f,p,y;return S(this,(function(b){switch(b.label){case 0:if(!(r=c.serializeKey(e)[0]))return[2];if(void 0===t)return[2,M(e,n)];if(v[r]=Date.now()-1,a=v[r],u=d[r],!t||"function"!=typeof t)return[3,5];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,t(c.get(r))];case 2:return o=b.sent(),[3,4];case 3:return s=b.sent(),i=s,[3,4];case 4:return[3,11];case 5:if(!t||"function"!=typeof t.then)return[3,10];b.label=6;case 6:return b.trys.push([6,8,,9]),[4,t];case 7:return o=b.sent(),[3,9];case 8:return l=b.sent(),i=l,[3,9];case 9:return[3,11];case 10:o=t,b.label=11;case 11:if(a!==v[r]||u!==d[r]){if(i)throw i;return[2,o]}if(void 0!==o&&c.set(r,o,!1),f=h[r]){for(p=[],y=0;y<f.length;++y)p.push(f[y](!!n,o,i,y>0));return[2,Promise.all(p).then((function(){return c.get(r)}))]}if(i)throw i;return[2,o]}}))}))};var P=O.Provider,I=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o,i,s={};t.length>=1&&(o=t[0]),t.length>2?(i=t[1],s=t[2]):"function"==typeof t[1]?i=t[1]:"object"==typeof t[1]&&(s=t[1]);var l=c.serializeKey(o),y=l[0],b=l[1],m=l[2];s=Object.assign({},w,Object(r.useContext)(O),s),void 0===i&&(i=s.fetcher);var g=c.get(y)||s.initialData,C=c.get(m),M=Object(r.useRef)({data:!1,error:!1,isValidating:!1}),P=Object(r.useRef)({data:g,error:C,isValidating:!1}),I=Object(r.useState)(null)[1],R=Object(r.useCallback)((function(e){var t=!1;for(var n in e)P.current[n]=e[n],M.current[n]&&(t=!0);(t||s.suspense)&&I({})}),[]),T=Object(r.useRef)(!1),L=Object(r.useRef)(y),F=Object(r.useRef)({emit:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];T.current||s[e].apply(s,t)}}),z=Object(r.useCallback)((function(e,t){return E(y,e,t)}),[y]),N=Object(r.useCallback)((function(t){return void 0===t&&(t={}),k(e,void 0,void 0,(function(){var e,n,r,o,a,u,l;return S(this,(function(p){switch(p.label){case 0:if(!y||!i)return[2,!1];if(T.current)return[2,!1];t=Object.assign({dedupe:!1},t),e=!0,n=void 0!==f[y]&&t.dedupe,p.label=1;case 1:return p.trys.push([1,6,,7]),R({isValidating:!0}),r=void 0,o=void 0,n?(o=d[y],[4,f[y]]):[3,3];case 2:return r=p.sent(),[3,5];case 3:return f[y]&&(v[y]=Date.now()-1),s.loadingTimeout&&!c.get(y)&&setTimeout((function(){e&&F.current.emit("onLoadingSlow",y,s)}),s.loadingTimeout),f[y]=null!==b?i.apply(void 0,b):i(y),d[y]=o=Date.now(),[4,f[y]];case 4:r=p.sent(),setTimeout((function(){delete f[y],delete d[y]}),s.dedupingInterval),F.current.emit("onSuccess",r,y,s),p.label=5;case 5:return v[y]&&o<=v[y]?(R({isValidating:!1}),[2,!1]):(c.set(y,r,!1),c.set(m,void 0,!1),a={isValidating:!1},void 0!==P.current.error&&(a.error=void 0),s.compare(P.current.data,r)||(a.data=r),R(a),n||j(y,r,void 0),[3,7]);case 6:return u=p.sent(),delete f[y],delete d[y],c.set(m,u,!1),P.current.error!==u&&(R({isValidating:!1,error:u}),n||j(y,void 0,u)),F.current.emit("onError",u,y,s),s.shouldRetryOnError&&(l=(t.retryCount||0)+1,F.current.emit("onErrorRetry",u,y,s,N,Object.assign({dedupe:!0},t,{retryCount:l}))),[3,7];case 7:return e=!1,[2,!0]}}))}))}),[y]);if(A((function(){if(y){T.current=!1;var e=P.current.data,t=c.get(y)||s.initialData;L.current===y&&s.compare(e,t)||(R({data:t}),L.current=y);var n,r=function(){return N({dedupe:!0})};(s.revalidateOnMount||!s.initialData&&void 0===s.revalidateOnMount)&&(void 0!==t&&!x&&window.requestIdleCallback?window.requestIdleCallback(r):r()),s.revalidateOnFocus&&(n=_(r,s.focusThrottleInterval),p[y]?p[y].push(n):p[y]=[n]);var o=function(e,t,n,o){void 0===e&&(e=!0),void 0===o&&(o=!0);var i={},a=!1;return void 0===t||s.compare(P.current.data,t)||(i.data=t,a=!0),P.current.error!==n&&(i.error=n,a=!0),a&&R(i),!!e&&(o?r():N())};h[y]?h[y].push(o):h[y]=[o];var i=null;return!x&&window.addEventListener&&s.revalidateOnReconnect&&window.addEventListener("online",i=r),function(){var e,t;(R=function(){return null},T.current=!0,n&&p[y])&&((t=(e=p[y]).indexOf(n))>=0&&(e[t]=e[e.length-1],e.pop()));h[y]&&((t=(e=h[y]).indexOf(o))>=0&&(e[t]=e[e.length-1],e.pop()));!x&&window.removeEventListener&&null!==i&&window.removeEventListener("online",i)}}}),[y,N]),A((function(){var t=null,n=function(){return k(e,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return P.current.error||!s.refreshWhenHidden&&!a()||!s.refreshWhenOffline&&!u()?[3,2]:[4,N({dedupe:!0})];case 1:e.sent(),e.label=2;case 2:return s.refreshInterval&&(t=setTimeout(n,s.refreshInterval)),[2]}}))}))};return s.refreshInterval&&(t=setTimeout(n,s.refreshInterval)),function(){t&&clearTimeout(t)}}),[s.refreshInterval,s.refreshWhenHidden,s.refreshWhenOffline,N]),s.suspense){var D=c.get(y)||g,H=c.get(m)||C;if(void 0===D&&void 0===H){if(f[y]||N(),f[y]&&"function"==typeof f[y].then)throw f[y];D=f[y]}if(void 0===D&&H)throw H;return{error:H,data:D,revalidate:N,mutate:z,isValidating:P.current.isValidating}}return Object(r.useMemo)((function(){var e={revalidate:N,mutate:z};return Object.defineProperties(e,{error:{get:function(){return M.current.error=!0,L.current===y?P.current.error:C},enumerable:!0},data:{get:function(){return M.current.data=!0,L.current===y?P.current.data:g},enumerable:!0},isValidating:{get:function(){return M.current.isValidating=!0,P.current.isValidating},enumerable:!0}}),e}),[N])};new Map;t.b=I},function(e,t){t.__esModule=!0,t.default={body:'<path d="M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-8l-2-2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18.41 7.41L17 6l-6 6l6 6l1.41-1.41L13.83 12l4.58-4.59m-6 0L11 6l-6 6l6 6l1.41-1.41L7.83 12l4.58-4.59z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M5.59 7.41L7 6l6 6l-6 6l-1.41-1.41L10.17 12L5.59 7.41m6 0L13 6l6 6l-6 6l-1.41-1.41L16.17 12l-4.58-4.59z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6l1.41-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M14 19h4V5h-4M6 19h4V5H6v14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M8 5.14v14l11-7l-11-7z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 18H6V6h12v12z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 20H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21 17H7V3h14m0-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2M3 5H1v16a2 2 0 0 0 2 2h16v-2H3m12.96-10.71l-2.75 3.54l-1.96-2.36L8.5 15h11l-3.54-4.71z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";e.exports=n(68)},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 3H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M10 17l-5-5l1.41-1.42L10 14.17l7.59-7.59L19 8m0-5H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=void 0;var r,o=n(80);var i=((r=o)&&r.__esModule?r:{default:r}).default,a=i.canUseDOM?window.HTMLElement:{};t.canUseDOM=i.canUseDOM;t.default=a},function(e,t,n){"use strict";var r=n(18),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function s(e){return r.isMemo(e)?a:u[e.$$typeof]||o}u[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[r.Memo]=a;var l=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,r)}var a=c(n);f&&(a=a.concat(f(n)));for(var u=s(t),v=s(n),y=0;y<a.length;++y){var b=a[y];if(!(i[b]||r&&r[b]||v&&v[b]||u&&u[b])){var m=d(n,b);try{l(t,b,m)}catch(e){}}}}return t}},function(e,t,n){"use strict";function r(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function u(e){r(a,o,i,u,s,"next",e)}function s(e){r(a,o,i,u,s,"throw",e)}u(void 0)}))}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0});var d=n(69),p=n(70),h=n(72),v=function(){},y=new p.TimeoutError,b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(g,e);var t,n,r,l,f,d,b,m=s(g);function g(e){var t,n,r,o,a;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,g),t=m.call(this),Object.defineProperty(c(t),"_carryoverConcurrencyCount",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_isIntervalIgnored",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_intervalCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_intervalCap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_interval",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_intervalEnd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_intervalId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_queueClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_pendingCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(c(t),"_concurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_isPaused",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_resolveEmpty",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(c(t),"_resolveIdle",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(c(t),"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c(t),"_throwOnTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:h.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(n=e.intervalCap)||void 0===n?void 0:n.toString())&&void 0!==r?r:"","` (").concat(i(e.intervalCap),")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(a=null===(o=e.interval)||void 0===o?void 0:o.toString())&&void 0!==a?a:"","` (").concat(i(e.interval),")"));return t._carryoverConcurrencyCount=e.carryoverConcurrencyCount,t._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,t._intervalCap=e.intervalCap,t._interval=e.interval,t._queue=new e.queueClass,t._queueClass=e.queueClass,t.concurrency=e.concurrency,t._timeout=e.timeout,t._throwOnTimeout=!0===e.throwOnTimeout,t._isPaused=!1===e.autoStart,t}return t=g,(n=[{key:"_next",value:function(){this._pendingCount--,this._tryToStartAnother()}},{key:"_resolvePromises",value:function(){this._resolveEmpty(),this._resolveEmpty=v,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=v,this.emit("idle"))}},{key:"_onResumeInterval",value:function(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}},{key:"_isIntervalPaused",value:function(){var e=this,t=Date.now();if(void 0===this._intervalId){var n=this._intervalEnd-t;if(!(n<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((function(){e._onResumeInterval()}),n)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}},{key:"_tryToStartAnother",value:function(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){var e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother)return this.emit("active"),this._queue.dequeue()(),e&&this._initializeIntervalIfNeeded(),!0}return!1}},{key:"_initializeIntervalIfNeeded",value:function(){var e=this;this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((function(){e._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}},{key:"_onInterval",value:function(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}},{key:"_processQueue",value:function(){for(;this._tryToStartAnother(););}},{key:"add",value:(b=o(regeneratorRuntime.mark((function e(t){var n,r=this,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.abrupt("return",new Promise((function(e,i){var a=function(){var a=o(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return r._pendingCount++,r._intervalCount++,o.prev=2,a=void 0===r._timeout&&void 0===n.timeout?t():p.default(Promise.resolve(t()),void 0===n.timeout?r._timeout:n.timeout,(function(){(void 0===n.throwOnTimeout?r._throwOnTimeout:n.throwOnTimeout)&&i(y)})),o.t0=e,o.next=7,a;case 7:o.t1=o.sent,(0,o.t0)(o.t1),o.next=14;break;case 11:o.prev=11,o.t2=o.catch(2),i(o.t2);case 14:r._next();case 15:case"end":return o.stop()}}),o,null,[[2,11]])})));return function(){return a.apply(this,arguments)}}();r._queue.enqueue(a,n),r._tryToStartAnother()})));case 2:case"end":return e.stop()}}),e)}))),function(e){return b.apply(this,arguments)})},{key:"addAll",value:(d=o(regeneratorRuntime.mark((function e(t,n){var r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.all(t.map(function(){var e=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r.add(t,n));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"start",value:function(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}},{key:"pause",value:function(){this._isPaused=!0}},{key:"clear",value:function(){this._queue=new this._queueClass}},{key:"onEmpty",value:(f=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveEmpty;t._resolveEmpty=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"onIdle",value:(l=o(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this._pendingCount||0!==this._queue.size){e.next=2;break}return e.abrupt("return");case 2:return e.abrupt("return",new Promise((function(e){var n=t._resolveIdle;t._resolveIdle=function(){n(),e()}})));case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"sizeBy",value:function(e){return this._queue.filter(e).length}},{key:"_doesIntervalAllowAnother",get:function(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}},{key:"_doesConcurrentAllowAnother",get:function(){return this._pendingCount<this._concurrency}},{key:"concurrency",get:function(){return this._concurrency},set:function(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(i(e),")"));this._concurrency=e,this._processQueue()}},{key:"size",get:function(){return this._queue.size}},{key:"pending",get:function(){return this._pendingCount}},{key:"isPaused",get:function(){return this._isPaused}},{key:"timeout",get:function(){return this._timeout},set:function(e){this._timeout=e}}])&&a(t.prototype,n),r&&a(t,r),g}(d);t.default=b},function(e,t,n){"use strict";n.d(t,"b",(function(){return S})),n.d(t,"a",(function(){return f}));var r=n(0),o=n(63),i=n.n(o);function a(){return"undefined"==typeof document||void 0===document.visibilityState||"hidden"!==document.visibilityState}function u(){return void 0===navigator.onLine||navigator.onLine}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l=new WeakMap,c=0;var f=new(function(){function e(e){void 0===e&&(e={}),this.__cache=new Map(Object.entries(e)),this.__listeners=[]}return e.prototype.get=function(e){var t=this.serializeKey(e)[0];return this.__cache.get(t)},e.prototype.set=function(e,t,n){void 0===n&&(n=!0);var r=this.serializeKey(e)[0];this.__cache.set(r,t),n&&S(e,t,!1),this.notify()},e.prototype.keys=function(){return Array.from(this.__cache.keys())},e.prototype.has=function(e){var t=this.serializeKey(e)[0];return this.__cache.has(t)},e.prototype.clear=function(e){void 0===e&&(e=!0),e&&this.__cache.forEach((function(e){return S(e,null,!1)})),this.__cache.clear(),this.notify()},e.prototype.delete=function(e,t){void 0===t&&(t=!0);var n=this.serializeKey(e)[0];t&&S(e,null,!1),this.__cache.delete(n),this.notify()},e.prototype.serializeKey=function(e){var t=null;if("function"==typeof e)try{e=e()}catch(t){e=""}return Array.isArray(e)?(t=e,e=function(e){if(!e.length)return"";for(var t="arg",n=0;n<e.length;++n){var r=void 0;null===e[n]||"object"!==s(e[n])?r="string"==typeof e[n]?'"'+e[n]+'"':String(e[n]):l.has(e[n])?r=l.get(e[n]):(r=c,l.set(e[n],c++)),t+="@"+r}return t}(e)):e=String(e||""),[e,t,e?"err@"+e:""]},e.prototype.subscribe=function(e){var t=this;if("function"!=typeof e)throw new Error("Expected the listener to be a function.");var n=!0;return this.__listeners.push(e),function(){if(n){n=!1;var r=t.__listeners.indexOf(e);r>-1&&(t.__listeners[r]=t.__listeners[t.__listeners.length-1],t.__listeners.length--)}}},e.prototype.notify=function(){for(var e=0,t=this.__listeners;e<t.length;e++){(0,t[e])()}},e}()),d={},p={},h={},v={};var y="undefined"!=typeof window&&navigator.connection&&-1!==["slow-2g","2g"].indexOf(navigator.connection.effectiveType),b=(i.a,!1);if("undefined"!=typeof window&&window.addEventListener&&!b){var m=function(){if(a()&&u())for(var e in p)p[e][0]&&p[e][0]()};window.addEventListener("visibilitychange",m,!1),window.addEventListener("focus",m,!1),b=!0}var g=Object(r.createContext)({});g.displayName="SWRConfigContext";var w=g;var _=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))},C=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},O="undefined"==typeof window,k=(O?r.useEffect:r.useLayoutEffect,function(e,t){void 0===t&&(t=!0);var n=f.serializeKey(e),r=n[0],o=n[2];if(!r)return Promise.resolve();var i=h[r];if(r&&i){for(var a=f.get(r),u=f.get(o),s=[],l=0;l<i.length;++l)s.push(i[l](t,a,u,l>0));return Promise.all(s).then((function(){return f.get(r)}))}return Promise.resolve(f.get(r))}),S=function(e,t,n){return void 0===n&&(n=!0),_(void 0,void 0,void 0,(function(){var r,o,i,a,u,s,l,c,p,y;return C(this,(function(b){switch(b.label){case 0:if(!(r=f.serializeKey(e)[0]))return[2];if(void 0===t)return[2,k(e,n)];if(v[r]=Date.now()-1,a=v[r],u=d[r],!t||"function"!=typeof t)return[3,5];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,t(f.get(r))];case 2:return o=b.sent(),[3,4];case 3:return s=b.sent(),i=s,[3,4];case 4:return[3,11];case 5:if(!t||"function"!=typeof t.then)return[3,10];b.label=6;case 6:return b.trys.push([6,8,,9]),[4,t];case 7:return o=b.sent(),[3,9];case 8:return l=b.sent(),i=l,[3,9];case 9:return[3,11];case 10:o=t,b.label=11;case 11:if(a!==v[r]||u!==d[r]){if(i)throw i;return[2,o]}if(void 0!==o&&f.set(r,o,!1),c=h[r]){for(p=[],y=0;y<c.length;++y)p.push(c[y](!!n,o,i,y>0));return[2,Promise.all(p).then((function(){return f.get(r)}))]}if(i)throw i;return[2,o]}}))}))};w.Provider,new Map},function(e,t,n){"use strict";var r=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,o=function(e){var t={};return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return r.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));t.a=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return[].slice.call(e.querySelectorAll("*"),0).filter(a)};
|
2 |
-
/*!
|
3 |
-
* Adapted from jQuery UI core
|
4 |
-
*
|
5 |
-
* http://jqueryui.com
|
6 |
-
*
|
7 |
-
* Copyright 2014 jQuery Foundation and other contributors
|
8 |
-
* Released under the MIT license.
|
9 |
-
* http://jquery.org/license
|
10 |
-
*
|
11 |
-
* http://api.jqueryui.com/category/ui-core/
|
12 |
-
*/
|
13 |
-
var r=/input|select|textarea|button|object/;function o(e){var t=e.offsetWidth<=0&&e.offsetHeight<=0;if(t&&!e.innerHTML)return!0;var n=window.getComputedStyle(e);return t?"visible"!==n.getPropertyValue("overflow")||e.scrollWidth<=0&&e.scrollHeight<=0:"none"==n.getPropertyValue("display")}function i(e,t){var n=e.nodeName.toLowerCase();return(r.test(n)&&!e.disabled||"a"===n&&e.href||t)&&function(e){for(var t=e;t&&t!==document.body;){if(o(t))return!1;t=t.parentNode}return!0}(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&i(e,!n)}e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=s,t.setElement=function(e){var t=e;if("string"==typeof t&&a.canUseDOM){var n=document.querySelectorAll(t);s(n,t),t="length"in n?n[0]:n}return u=t||u},t.validateElement=l,t.hide=function(e){l(e)&&(e||u).setAttribute("aria-hidden","true")},t.show=function(e){l(e)&&(e||u).removeAttribute("aria-hidden")},t.documentNotReadyOrSSRTesting=function(){u=null},t.resetForTesting=function(){u=null};var r,o=n(79),i=(r=o)&&r.__esModule?r:{default:r},a=n(21);var u=null;function s(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function l(e){return!(!e&&!u)||((0,i.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),!1)}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=new function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.register=function(e){-1===t.openInstances.indexOf(e)&&(t.openInstances.push(e),t.emit("register"))},this.deregister=function(e){var n=t.openInstances.indexOf(e);-1!==n&&(t.openInstances.splice(n,1),t.emit("deregister"))},this.subscribe=function(e){t.subscribers.push(e)},this.emit=function(e){t.subscribers.forEach((function(n){return n(e,t.openInstances.slice())}))},this.openInstances=[],this.subscribers=[]};t.default=r,e.exports=t.default},function(e,t,n){"use strict";var r=Array.isArray,o=Object.keys,i=Object.prototype.hasOwnProperty;e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var a,u,s,l=r(t),c=r(n);if(l&&c){if((u=t.length)!=n.length)return!1;for(a=u;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if(l!=c)return!1;var f=t instanceof Date,d=n instanceof Date;if(f!=d)return!1;if(f&&d)return t.getTime()==n.getTime();var p=t instanceof RegExp,h=n instanceof RegExp;if(p!=h)return!1;if(p&&h)return t.toString()==n.toString();var v=o(t);if((u=v.length)!==o(n).length)return!1;for(a=u;0!=a--;)if(!i.call(n,v[a]))return!1;for(a=u;0!=a--;)if(!e(t[s=v[a]],n[s]))return!1;return!0}return t!=t&&n!=n}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 8a2 2 0 0 1 2 2v10c0 1.1-.9 2-2 2H6a2 2 0 0 1-2-2V10c0-1.11.89-2 2-2h1V6C7 3.24 9.24.998 12 .998S17 3.24 17 6v2h1m-6-5c-1.66 0-3 1.34-3 3v2h6V6c0-1.66-1.34-3-3-3m-1 16l6.25-6.24l-1.41-1.41L11 16.18L8.41 13.6L7 15l4 4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18 1c-2.76 0-5 2.24-5 5v2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12c1.11 0 2-.89 2-2V10a2 2 0 0 0-2-2h-1V6c0-1.66 1.34-3 3-3s3 1.34 3 3v2h2V6c0-2.76-2.24-5-5-5m-8 12a2 2 0 0 1 2 2c0 1.11-.89 2-2 2a2 2 0 1 1 0-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m6.16 12.31c-1.56 0-2.97.58-4.05 1.52L6 13.72V19h5.28l-2.13-2.12c.82-.68 1.85-1.1 3.01-1.1c2.07 0 3.84 1.35 4.45 3.22l1.39-.46c-.81-2.45-3.12-4.23-5.84-4.23z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 5V1L7 6l5 5V7a6 6 0 0 1 6 6a6 6 0 0 1-6 6a6 6 0 0 1-6-6H4a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 3C7.58 3 4 4.79 4 7s3.58 4 8 4s8-1.79 8-4s-3.58-4-8-4M4 9v3c0 2.21 3.58 4 8 4s8-1.79 8-4V9c0 2.21-3.58 4-8 4s-8-1.79-8-4m0 5v3c0 2.21 3.58 4 8 4s8-1.79 8-4v-3c0 2.21-3.58 4-8 4s-8-1.79-8-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M21.71 20.29l-1.42 1.42a1 1 0 0 1-1.41 0L7 9.85A3.81 3.81 0 0 1 6 10a4 4 0 0 1-3.78-5.3l2.54 2.54l.53-.53l1.42-1.42l.53-.53L4.7 2.22A4 4 0 0 1 10 6a3.81 3.81 0 0 1-.15 1l11.86 11.88a1 1 0 0 1 0 1.41M2.29 18.88a1 1 0 0 0 0 1.41l1.42 1.42a1 1 0 0 0 1.41 0l5.47-5.46l-2.83-2.83M20 2l-4 2v2l-2.17 2.17l2 2L18 8h2l2-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97c0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1c0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 8l-1.33.09C9.81 7.07 7.4 4.5 5 4.5c0 0-1.97 2.96-.04 6.91c-.55.83-.89 1.26-.96 2.25l-1.93.29l.21.98l1.76-.26l.14.71l-1.57.94l.47.89l1.45-.89C5.68 18.76 8.59 20 12 20s6.32-1.24 7.47-3.68l1.45.89l.47-.89l-1.57-.94l.14-.71l1.76.26l.21-.98l-1.93-.29c-.07-.99-.41-1.42-.96-2.25C20.97 7.46 19 4.5 19 4.5c-2.4 0-4.81 2.57-5.67 3.59L12 8m-3 3a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m6 0a1 1 0 0 1 1 1a1 1 0 0 1-1 1a1 1 0 0 1-1-1a1 1 0 0 1 1-1m-4 3h2l-.7 1.39c.2.64.76 1.11 1.45 1.11a1.5 1.5 0 0 0 1.5-1.5h.5a2 2 0 0 1-2 2c-.75 0-1.4-.41-1.75-1c-.35.59-1 1-1.75 1a2 2 0 0 1-2-2h.5a1.5 1.5 0 0 0 1.5 1.5c.69 0 1.25-.47 1.45-1.11L11 14z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M9 16v-6H5l7-7l7 7h-4v6H9m-4 4v-2h14v2H5z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9m0 5h2v9H9V8m4 0h2v9h-2V8z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M16.84 2.73c-.39 0-.77.15-1.07.44l-2.12 2.12l5.3 5.31l2.12-2.1c.6-.61.6-1.56 0-2.14L17.9 3.17c-.3-.29-.68-.44-1.06-.44M12.94 6l-8.1 8.11l2.56.28l.18 2.29l2.28.17l.29 2.56l8.1-8.11m-14 3.74L2.5 21.73l6.7-1.79l-.24-2.16l-2.31-.17l-.18-2.32" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M13 3v6h8V3m-8 18h8V11h-8M3 21h8v-6H3m0-2h8V3H3v10z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M18.68 12.32a4.49 4.49 0 0 0-6.36.01a4.49 4.49 0 0 0 0 6.36a4.508 4.508 0 0 0 5.57.63L21 22.39L22.39 21l-3.09-3.11c1.13-1.77.87-4.09-.62-5.57m-1.41 4.95c-.98.98-2.56.97-3.54 0c-.97-.98-.97-2.56.01-3.54c.97-.97 2.55-.97 3.53 0c.97.98.97 2.56 0 3.54M10.9 20.1a6.527 6.527 0 0 1-1.48-2.32C6.27 17.25 4 15.76 4 14v3c0 2.21 3.58 4 8 4c-.4-.26-.77-.56-1.1-.9M4 9v3c0 1.68 2.07 3.12 5 3.7v-.2c0-.93.2-1.85.58-2.69C6.34 12.3 4 10.79 4 9m8-6C7.58 3 4 4.79 4 7c0 2 3 3.68 6.85 4h.05c1.2-1.26 2.86-2 4.6-2c.91 0 1.81.19 2.64.56A3.215 3.215 0 0 0 20 7c0-2.21-3.58-4-8-4z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M10 4l2 2h8a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6c0-1.11.89-2 2-2h6m5 5v3h-3v2h3v3h2v-3h3v-2h-3V9h-2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M5 3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9.09c-.06-.33-.09-.66-.09-1c0-.68.12-1.36.35-2H5l3.5-4.5l2.5 3l3.5-4.5l2.23 2.97c.97-.63 2.11-.97 3.27-.97c.34 0 .67.03 1 .09V5a2 2 0 0 0-2-2H5m14 13v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M3 11h8V3H3m0 18h8v-8H3m10 8h8v-8h-8m0-10v8h8V3" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M7 5h14v2H7V5m0 8v-2h14v2H7M4 4.5A1.5 1.5 0 0 1 5.5 6A1.5 1.5 0 0 1 4 7.5A1.5 1.5 0 0 1 2.5 6A1.5 1.5 0 0 1 4 4.5m0 6A1.5 1.5 0 0 1 5.5 12A1.5 1.5 0 0 1 4 13.5A1.5 1.5 0 0 1 2.5 12A1.5 1.5 0 0 1 4 10.5M7 19v-2h14v2H7m-3-2.5A1.5 1.5 0 0 1 5.5 18A1.5 1.5 0 0 1 4 19.5A1.5 1.5 0 0 1 2.5 18A1.5 1.5 0 0 1 4 16.5z" fill="currentColor"/>',width:24,height:24}},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),s=0;s<i.length;s++){var l=i[s];if(!u(l))return!1;var c=e[l],f=t[l];if(!1===(o=n?n.call(r,c,f,l):void 0)||void 0===o&&c!==f)return!1}return!0}},function(e,t,n){"use strict";t.a=function(e){function t(e,t,r){var o=t.trim().split(h);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var u=0;for(e=0===a?"":e[0]+" ";u<i;++u)t[u]=n(e,t[u],r).trim();break;default:var s=u=0;for(t=[];u<i;++u)for(var l=0;l<a;++l)t[s++]=n(e[l]+" ",o[u],r).trim()}return t}function n(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(v,"$1"+e.trim());case 58:return e.trim()+t.replace(v,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(v,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function r(e,t,n,i){var a=e+";",u=2*t+3*n+4*i;if(944===u){e=a.indexOf(":",9)+1;var s=a.substring(e,a.length-1).trim();return s=a.substring(0,e).trim()+s+";",1===j||2===j&&o(s,1)?"-webkit-"+s+s:s}if(0===j||2===j&&!o(a,1))return a;switch(u){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(S,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(s=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+s+a;case 1005:return d.test(a)?a.replace(f,":-webkit-")+a.replace(f,":-moz-")+a:a;case 1e3:switch(t=(s=a.substring(13).trim()).indexOf("-")+1,s.charCodeAt(0)+s.charCodeAt(t)){case 226:s=a.replace(g,"tb");break;case 232:s=a.replace(g,"tb-rl");break;case 220:s=a.replace(g,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+s+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,u=(s=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|s.charCodeAt(7))){case 203:if(111>s.charCodeAt(8))break;case 115:a=a.replace(s,"-webkit-"+s)+";"+a;break;case 207:case 102:a=a.replace(s,"-webkit-"+(102<u?"inline-":"")+"box")+";"+a.replace(s,"-webkit-"+s)+";"+a.replace(s,"-ms-"+s+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return s=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+s+"-ms-flex-"+s+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(C,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(C,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===k.test(e))return 115===(s=e.substring(e.indexOf(":")+1)).charCodeAt(0)?r(e.replace("stretch","fill-available"),t,n,i).replace(":fill-available",":stretch"):a.replace(s,"-webkit-"+s)+a.replace(s,"-moz-"+s.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+i&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(p,"$1-webkit-$2")+a}return a}function o(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),R(2!==t?r:r.replace(O,"$1"),n,t)}function i(e,t){var n=r(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(_," or ($1)").substring(4):"("+t+")"}function a(e,t,n,r,o,i,a,u,l,c){for(var f,d=0,p=t;d<I;++d)switch(f=P[d].call(s,e,p,n,r,o,i,a,u,l,c)){case void 0:case!1:case!0:case null:break;default:p=f}if(p!==t)return p}function u(e){return void 0!==(e=e.prefix)&&(R=null,e?"function"!=typeof e?j=1:(j=2,R=e):j=0),u}function s(e,n){var u=e;if(33>u.charCodeAt(0)&&(u=u.trim()),u=[u],0<I){var s=a(-1,n,u,u,A,x,0,0,0,0);void 0!==s&&"string"==typeof s&&(n=s)}var f=function e(n,u,s,f,d){for(var p,h,v,g,_,C=0,O=0,k=0,S=0,P=0,R=0,L=v=p=0,F=0,z=0,N=0,D=0,H=s.length,V=H-1,q="",$="",U="",W="";F<H;){if(h=s.charCodeAt(F),F===V&&0!==O+S+k+C&&(0!==O&&(h=47===O?10:47),S=k=C=0,H++,V++),0===O+S+k+C){if(F===V&&(0<z&&(q=q.replace(c,"")),0<q.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:q+=s.charAt(F)}h=59}switch(h){case 123:for(p=(q=q.trim()).charCodeAt(0),v=1,D=++F;F<H;){switch(h=s.charCodeAt(F)){case 123:v++;break;case 125:v--;break;case 47:switch(h=s.charCodeAt(F+1)){case 42:case 47:e:{for(L=F+1;L<V;++L)switch(s.charCodeAt(L)){case 47:if(42===h&&42===s.charCodeAt(L-1)&&F+2!==L){F=L+1;break e}break;case 10:if(47===h){F=L+1;break e}}F=L}}break;case 91:h++;case 40:h++;case 34:case 39:for(;F++<V&&s.charCodeAt(F)!==h;);}if(0===v)break;F++}switch(v=s.substring(D,F),0===p&&(p=(q=q.replace(l,"").trim()).charCodeAt(0)),p){case 64:switch(0<z&&(q=q.replace(c,"")),h=q.charCodeAt(1)){case 100:case 109:case 115:case 45:z=u;break;default:z=E}if(D=(v=e(u,z,v,h,d+1)).length,0<I&&(_=a(3,v,z=t(E,q,N),u,A,x,D,h,d,f),q=z.join(""),void 0!==_&&0===(D=(v=_.trim()).length)&&(h=0,v="")),0<D)switch(h){case 115:q=q.replace(w,i);case 100:case 109:case 45:v=q+"{"+v+"}";break;case 107:v=(q=q.replace(y,"$1 $2"))+"{"+v+"}",v=1===j||2===j&&o("@"+v,3)?"@-webkit-"+v+"@"+v:"@"+v;break;default:v=q+v,112===f&&($+=v,v="")}else v="";break;default:v=e(u,t(u,q,N),v,f,d+1)}U+=v,v=N=z=L=p=0,q="",h=s.charCodeAt(++F);break;case 125:case 59:if(1<(D=(q=(0<z?q.replace(c,""):q).trim()).length))switch(0===L&&(p=q.charCodeAt(0),45===p||96<p&&123>p)&&(D=(q=q.replace(" ",":")).length),0<I&&void 0!==(_=a(1,q,u,n,A,x,$.length,f,d,f))&&0===(D=(q=_.trim()).length)&&(q="\0\0"),p=q.charCodeAt(0),h=q.charCodeAt(1),p){case 0:break;case 64:if(105===h||99===h){W+=q+s.charAt(F);break}default:58!==q.charCodeAt(D-1)&&($+=r(q,p,h,q.charCodeAt(2)))}N=z=L=p=0,q="",h=s.charCodeAt(++F)}}switch(h){case 13:case 10:47===O?O=0:0===1+p&&107!==f&&0<q.length&&(z=1,q+="\0"),0<I*T&&a(0,q,u,n,A,x,$.length,f,d,f),x=1,A++;break;case 59:case 125:if(0===O+S+k+C){x++;break}default:switch(x++,g=s.charAt(F),h){case 9:case 32:if(0===S+C+O)switch(P){case 44:case 58:case 9:case 32:g="";break;default:32!==h&&(g=" ")}break;case 0:g="\\0";break;case 12:g="\\f";break;case 11:g="\\v";break;case 38:0===S+O+C&&(z=N=1,g="\f"+g);break;case 108:if(0===S+O+C+M&&0<L)switch(F-L){case 2:112===P&&58===s.charCodeAt(F-3)&&(M=P);case 8:111===R&&(M=R)}break;case 58:0===S+O+C&&(L=F);break;case 44:0===O+k+S+C&&(z=1,g+="\r");break;case 34:case 39:0===O&&(S=S===h?0:0===S?h:S);break;case 91:0===S+O+k&&C++;break;case 93:0===S+O+k&&C--;break;case 41:0===S+O+C&&k--;break;case 40:if(0===S+O+C){if(0===p)switch(2*P+3*R){case 533:break;default:p=1}k++}break;case 64:0===O+k+S+C+L+v&&(v=1);break;case 42:case 47:if(!(0<S+C+k))switch(O){case 0:switch(2*h+3*s.charCodeAt(F+1)){case 235:O=47;break;case 220:D=F,O=42}break;case 42:47===h&&42===P&&D+2!==F&&(33===s.charCodeAt(D+2)&&($+=s.substring(D,F+1)),g="",O=0)}}0===O&&(q+=g)}R=P,P=h,F++}if(0<(D=$.length)){if(z=u,0<I&&(void 0!==(_=a(2,$,z,n,A,x,D,f,d,f))&&0===($=_).length))return W+$+U;if($=z.join(",")+"{"+$+"}",0!=j*M){switch(2!==j||o($,2)||(M=0),M){case 111:$=$.replace(m,":-moz-$1")+$;break;case 112:$=$.replace(b,"::-webkit-input-$1")+$.replace(b,"::-moz-$1")+$.replace(b,":-ms-input-$1")+$}M=0}}return W+$+U}(E,u,n,0,0);return 0<I&&(void 0!==(s=a(-2,f,u,u,A,x,f.length,0,0,0))&&(f=s)),"",M=0,x=A=1,f}var l=/^\0+/g,c=/[\0\r\f]/g,f=/: */g,d=/zoo|gra/,p=/([,: ])(transform)/g,h=/,\r+?/g,v=/([\t\r\n ])*\f?&/g,y=/@(k\w+)\s*(\S*)\s*/,b=/::(place)/g,m=/:(read-only)/g,g=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,_=/([\s\S]*?);/g,C=/-self|flex-/g,O=/[^]*?(:[rp][el]a[\w-]+)[^]*/,k=/stretch|:\s*\w+\-(?:conte|avail)/,S=/([^-])(image-set\()/,x=1,A=1,M=0,j=1,E=[],P=[],I=0,R=null,T=0;return s.use=function e(t){switch(t){case void 0:case null:I=P.length=0;break;default:if("function"==typeof t)P[I++]=t;else if("object"==typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else T=0|!!t}return e},s.set=u,void 0!==e&&u(e),s}},function(e,t,n){"use strict";t.a={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 20a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 7a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M5.5 7A1.5 1.5 0 0 1 4 5.5A1.5 1.5 0 0 1 5.5 4A1.5 1.5 0 0 1 7 5.5A1.5 1.5 0 0 1 5.5 7m15.91 4.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.11 0-2 .89-2 2v7c0 .55.22 1.05.59 1.41l8.99 9c.37.36.87.59 1.42.59c.55 0 1.05-.23 1.41-.59l7-7c.37-.36.59-.86.59-1.41c0-.56-.23-1.06-.59-1.42z" fill="currentColor"/>',width:24,height:24}},function(e,t){t.__esModule=!0,t.default={body:'<path d="M15 9H5V5h10m-3 14a3 3 0 0 1-3-3a3 3 0 0 1 3-3a3 3 0 0 1 3 3a3 3 0 0 1-3 3m5-16H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(74),i=(r=o)&&r.__esModule?r:{default:r};t.default=i.default,e.exports=t.default},function(e,t){t.__esModule=!0,t.default={body:'<path d="M22 16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2h12a2 2 0 0 1 2 2v12m-6 4v2H4a2 2 0 0 1-2-2V7h2v13h12m-3-6l7-7l-1.41-1.41L13 11.17L9.91 8.09L8.5 9.5L13 14z" fill="currentColor"/>',width:24,height:24}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=Array.isArray,i=Object.keys,a=Object.prototype.hasOwnProperty;e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==r(t)&&"object"==r(n)){var u,s,l,c=o(t),f=o(n);if(c&&f){if((s=t.length)!=n.length)return!1;for(u=s;0!=u--;)if(!e(t[u],n[u]))return!1;return!0}if(c!=f)return!1;var d=t instanceof Date,p=n instanceof Date;if(d!=p)return!1;if(d&&p)return t.getTime()==n.getTime();var h=t instanceof RegExp,v=n instanceof RegExp;if(h!=v)return!1;if(h&&v)return t.toString()==n.toString();var y=i(t);if((s=y.length)!==i(n).length)return!1;for(u=s;0!=u--;)if(!a.call(n,y[u]))return!1;for(u=s;0!=u--;)if(!e(t[l=y[u]],n[l]))return!1;return!0}return t!=t&&n!=n}},function(e,t,n){"use strict";var r=n(65);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){t.__esModule=!0,t.default={body:'<path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83l3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z" fill="currentColor"/>',width:24,height:24}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function d(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&p())}function p(){if(!c){var e=u(d);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f<t;)s&&s[f].run();f=-1,t=l.length}s=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||c||u(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";
|
14 |
-
/** @license React v16.13.1
|
15 |
-
* react-is.production.min.js
|
16 |
-
*
|
17 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
18 |
-
*
|
19 |
-
* This source code is licensed under the MIT license found in the
|
20 |
-
* LICENSE file in the root directory of this source tree.
|
21 |
-
*/var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,l=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,v=r?Symbol.for("react.suspense_list"):60120,y=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,m=r?Symbol.for("react.block"):60121,g=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,_=r?Symbol.for("react.scope"):60119;function C(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case f:case d:case a:case s:case u:case h:return e;default:switch(e=e&&e.$$typeof){case c:case p:case b:case y:case l:return e;default:return t}}case i:return t}}}function O(e){return C(e)===d}t.AsyncMode=f,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=l,t.Element=o,t.ForwardRef=p,t.Fragment=a,t.Lazy=b,t.Memo=y,t.Portal=i,t.Profiler=s,t.StrictMode=u,t.Suspense=h,t.isAsyncMode=function(e){return O(e)||C(e)===f},t.isConcurrentMode=O,t.isContextConsumer=function(e){return C(e)===c},t.isContextProvider=function(e){return C(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return C(e)===p},t.isFragment=function(e){return C(e)===a},t.isLazy=function(e){return C(e)===b},t.isMemo=function(e){return C(e)===y},t.isPortal=function(e){return C(e)===i},t.isProfiler=function(e){return C(e)===s},t.isStrictMode=function(e){return C(e)===u},t.isSuspense=function(e){return C(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===s||e===u||e===h||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===l||e.$$typeof===c||e.$$typeof===p||e.$$typeof===g||e.$$typeof===w||e.$$typeof===_||e.$$typeof===m)},t.typeOf=C},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function u(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var u=new a(n,r||e,i),s=o?o+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],u]:e._events[s].push(u):(e._events[s]=u,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function l(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),l.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(o?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},l.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,a=new Array(i);r<i;r++)a[r]=n[r].fn;return a},l.prototype.listenerCount=function(e){var t=o?o+e:e,n=this._events[t];return n?n.fn?1:n.length:0},l.prototype.emit=function(e,t,n,r,i,a){var u=o?o+e:e;if(!this._events[u])return!1;var s,l,c=this._events[u],f=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,a),!0}for(l=1,s=new Array(f-1);l<f;l++)s[l-1]=arguments[l];c.fn.apply(c.context,s)}else{var d,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!s)for(d=1,s=new Array(f-1);d<f;d++)s[d-1]=arguments[d];c[l].fn.apply(c[l].context,s)}}return!0},l.prototype.on=function(e,t,n){return u(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return u(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||s(this,i);else{for(var u=0,l=[],c=a.length;u<c;u++)(a[u].fn!==t||r&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[i]=1===l.length?l[0]:l:s(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=o,l.EventEmitter=l,e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function a(e,t,n){return(a=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=n(71),f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r=(t=i,n=u(),function(){var e,r=l(t);if(n){var i=l(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=r.call(this,e)).name="TimeoutError",t}return i}(i(Error)),d=function(e,t,n){return new Promise((function(r,o){if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t!==1/0){var i=setTimeout((function(){if("function"!=typeof n){var i="string"==typeof n?n:"Promise timed out after ".concat(t," milliseconds"),a=n instanceof Error?n:new f(i);"function"==typeof e.cancel&&e.cancel(),o(a)}else try{r(n())}catch(e){o(e)}}),t);c(e.then(r,o),(function(){clearTimeout(i)}))}else r(e)}))};e.exports=d,e.exports.default=d,e.exports.TimeoutError=f},function(e,t,n){"use strict";e.exports=function(e,t){return t=t||function(){},e.then((function(e){return new Promise((function(e){e(t())})).then((function(){return e}))}),(function(e){return new Promise((function(e){e(t())})).then((function(){throw e}))}))}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(73),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]})}var t,n,i;return t=e,(n=[{key:"enqueue",value:function(e,t){var n={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)this._queue.push(n);else{var r=o.default(this._queue,n,(function(e,t){return t.priority-e.priority}));this._queue.splice(r,0,n)}}},{key:"dequeue",value:function(){var e=this._queue.shift();return null==e?void 0:e.run}},{key:"filter",value:function(e){return this._queue.filter((function(t){return t.priority===e.priority})).map((function(e){return e.run}))}},{key:"size",get:function(){return this._queue.length}}])&&r(t.prototype,n),i&&r(t,i),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=0,o=e.length;o>0;){var i=o/2|0,a=r+i;n(e[a],t)<=0?(r=++a,o-=i+1):o=i}return r}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=v(a),s=v(n(75)),l=v(n(1)),c=v(n(76)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(27)),d=n(21),p=v(d),h=n(83);function v(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}var m=t.portalClassName="ReactModalPortal",g=t.bodyOpenClassName="ReactModal__Body--open",w=void 0!==s.default.createPortal,_=function(){return w?s.default.createPortal:s.default.unstable_renderSubtreeIntoContainer};function C(e){return e()}var O=function(e){function t(){var e,n,r;y(this,t);for(var i=arguments.length,a=Array(i),l=0;l<i;l++)a[l]=arguments[l];return n=r=b(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.removePortal=function(){!w&&s.default.unmountComponentAtNode(r.node);var e=C(r.props.parentSelector);e?e.removeChild(r.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},r.portalRef=function(e){r.portal=e},r.renderPortal=function(e){var n=_()(r,u.default.createElement(c.default,o({defaultStyles:t.defaultStyles},e)),r.node);r.portalRef(n)},b(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){d.canUseDOM&&(w||(this.node=document.createElement("div")),this.node.className=this.props.portalClassName,C(this.props.parentSelector).appendChild(this.node),!w&&this.renderPortal(this.props))}},{key:"getSnapshotBeforeUpdate",value:function(e){return{prevParent:C(e.parentSelector),nextParent:C(this.props.parentSelector)}}},{key:"componentDidUpdate",value:function(e,t,n){if(d.canUseDOM){var r=this.props,o=r.isOpen,i=r.portalClassName;e.portalClassName!==i&&(this.node.className=i);var a=n.prevParent,u=n.nextParent;u!==a&&(a.removeChild(this.node),u.appendChild(this.node)),(e.isOpen||o)&&!w&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(d.canUseDOM&&this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return d.canUseDOM&&w?(!this.node&&w&&(this.node=document.createElement("div")),_()(u.default.createElement(c.default,o({ref:this.portalRef,defaultStyles:t.defaultStyles},this.props)),this.node)):null}}],[{key:"setAppElement",value:function(e){f.setElement(e)}}]),t}(a.Component);O.propTypes={isOpen:l.default.bool.isRequired,style:l.default.shape({content:l.default.object,overlay:l.default.object}),portalClassName:l.default.string,bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,className:l.default.oneOfType([l.default.string,l.default.shape({base:l.default.string.isRequired,afterOpen:l.default.string.isRequired,beforeClose:l.default.string.isRequired})]),overlayClassName:l.default.oneOfType([l.default.string,l.default.shape({base:l.default.string.isRequired,afterOpen:l.default.string.isRequired,beforeClose:l.default.string.isRequired})]),appElement:l.default.instanceOf(p.default),onAfterOpen:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,ariaHideApp:l.default.bool,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,parentSelector:l.default.func,aria:l.default.object,data:l.default.object,role:l.default.string,contentLabel:l.default.string,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func},O.defaultProps={isOpen:!1,portalClassName:m,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,parentSelector:function(){return document.body}},O.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(O),t.default=O},,function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),s=b(u),l=b(n(1)),c=y(n(77)),f=b(n(78)),d=y(n(27)),p=y(n(81)),h=b(n(21)),v=b(n(29));function y(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function b(e){return e&&e.__esModule?e:{default:e}}n(82);var m={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},g=0,w=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setOverlayRef=function(e){n.overlay=e,n.props.overlayRef&&n.props.overlayRef(e)},n.setContentRef=function(e){n.content=e,n.props.contentRef&&n.props.contentRef(e)},n.afterClose=function(){var e=n.props,t=e.appElement,r=e.ariaHideApp,o=e.htmlOpenClassName,i=e.bodyOpenClassName;i&&p.remove(document.body,i),o&&p.remove(document.getElementsByTagName("html")[0],o),r&&g>0&&0===(g-=1)&&d.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(c.returnFocus(),c.teardownScopedFocus()):c.popWithoutFocus()),n.props.onAfterClose&&n.props.onAfterClose(),v.default.deregister(n)},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(c.setupScopedFocus(n.node),c.markForFocusLater()),n.setState({isOpen:!0},(function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen({overlayEl:n.overlay,contentEl:n.content})})))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},(function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())}))},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){9===e.keyCode&&(0,f.default)(n.content,e),n.props.shouldCloseOnEsc&&27===e.keyCode&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault()},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var r="object"===(void 0===t?"undefined":i(t))?t:{base:m[e],afterOpen:m[e]+"--after-open",beforeClose:m[e]+"--before-close"},o=r.base;return n.state.afterOpen&&(o=o+" "+r.afterOpen),n.state.beforeClose&&(o=o+" "+r.beforeClose),"string"==typeof t&&t?o+" "+t:o},n.attributesFromObject=function(e,t){return Object.keys(t).reduce((function(n,r){return n[e+"-"+r]=t[r],n}),{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(e,t){this.props.isOpen&&!e.isOpen?this.open():!this.props.isOpen&&e.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!t.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,r=e.htmlOpenClassName,o=e.bodyOpenClassName;o&&p.add(document.body,o),r&&p.add(document.getElementsByTagName("html")[0],r),n&&(g+=1,d.hide(t)),v.default.register(this)}},{key:"render",value:function(){var e=this.props,t=e.id,n=e.className,r=e.overlayClassName,i=e.defaultStyles,a=n?{}:i.content,u=r?{}:i.overlay;return this.shouldBeClosed()?null:s.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",r),style:o({},u,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},s.default.createElement("div",o({id:t,ref:this.setContentRef,style:o({},a,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",this.props.aria||{}),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),this.props.children))}}]),t}(u.Component);w.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},w.propTypes={isOpen:l.default.bool.isRequired,defaultStyles:l.default.shape({content:l.default.object,overlay:l.default.object}),style:l.default.shape({content:l.default.object,overlay:l.default.object}),className:l.default.oneOfType([l.default.string,l.default.object]),overlayClassName:l.default.oneOfType([l.default.string,l.default.object]),bodyOpenClassName:l.default.string,htmlOpenClassName:l.default.string,ariaHideApp:l.default.bool,appElement:l.default.instanceOf(h.default),onAfterOpen:l.default.func,onAfterClose:l.default.func,onRequestClose:l.default.func,closeTimeoutMS:l.default.number,shouldFocusAfterRender:l.default.bool,shouldCloseOnOverlayClick:l.default.bool,shouldReturnFocusAfterClose:l.default.bool,role:l.default.string,contentLabel:l.default.string,aria:l.default.object,data:l.default.object,children:l.default.node,shouldCloseOnEsc:l.default.bool,overlayRef:l.default.func,contentRef:l.default.func,id:l.default.string,testId:l.default.string},t.default=w,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=l,t.handleFocus=c,t.markForFocusLater=function(){a.push(document.activeElement)},t.returnFocus=function(){var e=null;try{return void(0!==a.length&&(e=a.pop()).focus())}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}},t.popWithoutFocus=function(){a.length>0&&a.pop()},t.setupScopedFocus=function(e){u=e,window.addEventListener?(window.addEventListener("blur",l,!1),document.addEventListener("focus",c,!0)):(window.attachEvent("onBlur",l),document.attachEvent("onFocus",c))},t.teardownScopedFocus=function(){u=null,window.addEventListener?(window.removeEventListener("blur",l),document.removeEventListener("focus",c)):(window.detachEvent("onBlur",l),document.detachEvent("onFocus",c))};var r,o=n(26),i=(r=o)&&r.__esModule?r:{default:r};var a=[],u=null,s=!1;function l(){s=!0}function c(){if(s){if(s=!1,!u)return;setTimeout((function(){u.contains(document.activeElement)||((0,i.default)(u)[0]||u).focus()}),0)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var r=void 0,o=t.shiftKey,a=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;r=u}u!==document.activeElement||o||(r=a);a===document.activeElement&&o&&(r=u);if(r)return t.preventDefault(),void r.focus();var s=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null==s||"Chrome"==s[1]||null!=/\biPod\b|\biPad\b/g.exec(navigator.userAgent))return;var l=n.indexOf(document.activeElement);l>-1&&(l+=o?-1:1);if(void 0===(r=n[l]))return t.preventDefault(),void(r=o?u:a).focus();t.preventDefault(),r.focus()};var r,o=n(26),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){var r;function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
|
22 |
-
/*!
|
23 |
-
Copyright (c) 2015 Jed Watson.
|
24 |
-
Based on code that is Copyright 2013-2015, Facebook, Inc.
|
25 |
-
All rights reserved.
|
26 |
-
*/!function(){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen};"object"===o(n(28))&&n(28)?void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r):e.exports?e.exports=a:window.ExecutionEnvironment=a}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpClassLists=function(){0};var r={},o={};t.add=function(e,t){return n=e.classList,i="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]||(e[t]=0),e[t]+=1}(i,e),n.add(e)}));var n,i},t.remove=function(e,t){return n=e.classList,i="html"==e.nodeName.toLowerCase()?r:o,void t.split(" ").forEach((function(e){!function(e,t){e[t]&&(e[t]-=1)}(i,e),0===i[e]&&n.remove(e)}));var n,i}},function(e,t,n){"use strict";var r,o=n(29),i=(r=o)&&r.__esModule?r:{default:r};var a=void 0,u=void 0,s=[];function l(){0!==s.length&&s[s.length-1].focusContent()}i.default.subscribe((function(e,t){a&&u||((a=document.createElement("div")).setAttribute("data-react-modal-body-trap",""),a.style.position="absolute",a.style.opacity="0",a.setAttribute("tabindex","0"),a.addEventListener("focus",l),(u=a.cloneNode()).addEventListener("focus",l)),(s=t).length>0?(document.body.firstChild!==a&&document.body.insertBefore(a,document.body.firstChild),document.body.lastChild!==u&&document.body.appendChild(u)):(a.parentElement&&a.parentElement.removeChild(a),u.parentElement&&u.parentElement.removeChild(u))}))},function(e,t,n){"use strict";function r(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function o(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function i(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,a=null,u=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?a="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?u="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(u="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==u){var s=e.displayName||e.name,l="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+s+" uses "+l+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==a?"\n "+a:"")+(null!==u?"\n "+u:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=r,t.componentWillReceiveProps=o),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=i;var c=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,e,t,r)}}return e}n.r(t),n.d(t,"polyfill",(function(){return a})),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0}]]);
|
27 |
-
//# sourceMappingURL=vendor.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/admin.php
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Meow_MFRH_Admin extends MeowCommon_Admin {
|
4 |
-
|
5 |
-
public function __construct( $allow_setup ) {
|
6 |
-
parent::__construct( MFRH_PREFIX, MFRH_ENTRY, MFRH_DOMAIN, class_exists( 'MeowPro_MFRH_Core' ) );
|
7 |
-
if ( is_admin() ) {
|
8 |
-
if ( $allow_setup ) {
|
9 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
10 |
-
}
|
11 |
-
|
12 |
-
// Load the scripts only if they are needed by the current screen
|
13 |
-
$uri = $_SERVER['REQUEST_URI'];
|
14 |
-
$page = isset( $_GET["page"] ) ? $_GET["page"] : null;
|
15 |
-
$is_media_library = preg_match( '/wp\-admin\/upload\.php/', $uri );
|
16 |
-
$is_post_edit = preg_match( '/wp\-admin\/post\.php/', $uri );
|
17 |
-
$is_mfrh_screen = in_array( $page, [ 'mfrh_dashboard', 'mfrh_settings' ] );
|
18 |
-
$is_meowapps_dashboard = $page === 'meowapps-main-menu';
|
19 |
-
if ( $is_meowapps_dashboard || $is_media_library || $is_mfrh_screen || $is_post_edit ) {
|
20 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
function admin_enqueue_scripts() {
|
26 |
-
|
27 |
-
// Load the scripts
|
28 |
-
$physical_file = MFRH_PATH . '/app/index.js';
|
29 |
-
$cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MFRH_VERSION;
|
30 |
-
wp_register_script( 'mfrh_media_file_renamer-vendor', MFRH_URL . 'app/vendor.js',
|
31 |
-
['wp-element', 'wp-i18n'], $cache_buster
|
32 |
-
);
|
33 |
-
wp_register_script( 'mfrh_media_file_renamer', MFRH_URL . 'app/index.js',
|
34 |
-
['mfrh_media_file_renamer-vendor', 'wp-i18n'], $cache_buster
|
35 |
-
);
|
36 |
-
if ( function_exists( 'wp_set_script_translations' ) ) {
|
37 |
-
wp_set_script_translations( 'mfrh_media_file_renamer', 'media-file-renamer' );
|
38 |
-
}
|
39 |
-
wp_enqueue_script('mfrh_media_file_renamer' );
|
40 |
-
|
41 |
-
// Load the fonts
|
42 |
-
wp_register_style( 'meow-neko-ui-lato-font',
|
43 |
-
'//fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&display=swap');
|
44 |
-
wp_enqueue_style( 'meow-neko-ui-lato-font' );
|
45 |
-
|
46 |
-
// Localize and options
|
47 |
-
wp_localize_script( 'mfrh_media_file_renamer', 'mfrh_media_file_renamer', array_merge( [
|
48 |
-
//'api_nonce' => wp_create_nonce( 'mfrh_media_file_renamer' ),
|
49 |
-
'api_url' => get_rest_url(null, '/media-file-renamer/v1/'),
|
50 |
-
'rest_url' => get_rest_url(),
|
51 |
-
'plugin_url' => MFRH_URL,
|
52 |
-
'prefix' => MFRH_PREFIX,
|
53 |
-
'domain' => MFRH_DOMAIN,
|
54 |
-
'is_pro' => class_exists( 'MeowPro_MFRH_Core' ),
|
55 |
-
'is_registered' => !!$this->is_registered(),
|
56 |
-
'rest_nonce' => wp_create_nonce( 'wp_rest' ),
|
57 |
-
], $this->get_all_options() ) );
|
58 |
-
}
|
59 |
-
|
60 |
-
function admin_menu() {
|
61 |
-
add_submenu_page( 'meowapps-main-menu', __( 'Renamer', MFRH_DOMAIN ), __( 'Renamer', MFRH_DOMAIN ),
|
62 |
-
'read', 'mfrh_settings', array( $this, 'admin_settings' )
|
63 |
-
);
|
64 |
-
}
|
65 |
-
|
66 |
-
public function admin_settings() {
|
67 |
-
echo '<div id="mfrh-admin-settings"></div>';
|
68 |
-
}
|
69 |
-
|
70 |
-
function get_all_options() {
|
71 |
-
return array(
|
72 |
-
'mfrh_auto_rename' => get_option( 'mfrh_auto_rename', false ),
|
73 |
-
'mfrh_on_upload' => get_option( 'mfrh_on_upload', false ),
|
74 |
-
'mfrh_rename_slug' => get_option( 'mfrh_rename_slug', false ),
|
75 |
-
'mfrh_convert_to_ascii' => $this->is_registered() && get_option( 'mfrh_convert_to_ascii', false ),
|
76 |
-
'mfrh_update_posts' => get_option( 'mfrh_update_posts', true ),
|
77 |
-
'mfrh_update_postmeta' => get_option( 'mfrh_update_postmeta', true ),
|
78 |
-
'mfrh_undo' => get_option( 'mfrh_undo', false ),
|
79 |
-
'mfrh_move' => get_option( 'mfrh_move', false ),
|
80 |
-
'mfrh_manual_rename' => get_option( 'mfrh_manual_rename', false ),
|
81 |
-
'mfrh_numbered_files' => $this->is_registered() && get_option( 'mfrh_numbered_files', false ),
|
82 |
-
'mfrh_sync_alt' => $this->is_registered() && get_option( 'mfrh_sync_alt', false ),
|
83 |
-
'mfrh_sync_media_title' => $this->is_registered() && get_option( 'mfrh_sync_media_title', false ),
|
84 |
-
'mfrh_force_rename' => $this->is_registered() && get_option( 'mfrh_force_rename', false ),
|
85 |
-
'mfrh_log' => get_option( 'mfrh_log', false ),
|
86 |
-
'mfrh_logsql' => $this->is_registered() && get_option( 'mfrh_logsql', false ),
|
87 |
-
'mfrh_rename_guid' => get_option( 'mfrh_rename_guid', false ),
|
88 |
-
'mfrh_case_insensitive_check' => get_option( 'mfrh_case_insensitive_check', false ),
|
89 |
-
'mfrh_rename_on_save' => get_option( 'mfrh_rename_on_save', false ),
|
90 |
-
'mfrh_acf_field_name' => get_option( 'mfrh_acf_field_name' ),
|
91 |
-
);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/api.php
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
*
|
5 |
-
* GLOBAL FUNCTIONS
|
6 |
-
*
|
7 |
-
*/
|
8 |
-
|
9 |
-
function mfrh_get_instance() {
|
10 |
-
global $mfrh_core;
|
11 |
-
if ( empty( $mfrh_core ) ) {
|
12 |
-
$mfrh_core = new Meow_MFRH_Core();
|
13 |
-
}
|
14 |
-
return $mfrh_core;
|
15 |
-
}
|
16 |
-
|
17 |
-
// Rename the media automatically based on the settings
|
18 |
-
function mfrh_rename( $mediaId, $manual = null ) {
|
19 |
-
$mfrh_core = mfrh_get_instance();
|
20 |
-
return $mfrh_core->rename( $mediaId, $manual );
|
21 |
-
}
|
22 |
-
|
23 |
-
// Move the media to another folder (relative to /uploads/)
|
24 |
-
function mfrh_move( $mediaId, $newPath ) {
|
25 |
-
$mfrh_core = mfrh_get_instance();
|
26 |
-
return $mfrh_core->move( $mediaId, $newPath );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Calls the specified mb_*** function if it is available.
|
31 |
-
* If it isn't, calls the regular function instead
|
32 |
-
* @param string $fn The function name to call
|
33 |
-
* @return mixed
|
34 |
-
*/
|
35 |
-
function mfrh_mb($fn) {
|
36 |
-
static $available = null;
|
37 |
-
if ( is_null($available) ) $available = extension_loaded( 'mbstring' );
|
38 |
-
|
39 |
-
if ( func_num_args() > 1 ) {
|
40 |
-
$args = func_get_args();
|
41 |
-
array_shift( $args ); // Remove 1st arg
|
42 |
-
return $available ?
|
43 |
-
call_user_func_array( "mb_{$fn}", $args ) :
|
44 |
-
call_user_func_array( $fn, $args );
|
45 |
-
}
|
46 |
-
return $available ?
|
47 |
-
call_user_func( "mb_{$fn}" ) :
|
48 |
-
call_user_func( $fn );
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* A multibyte compatible implementation of pathinfo()
|
53 |
-
* @param string $path
|
54 |
-
* @param int $options
|
55 |
-
* @return string|array
|
56 |
-
*/
|
57 |
-
function mfrh_pathinfo( $path, $options = null ) {
|
58 |
-
if ( is_null( $options ) ) {
|
59 |
-
$r = array ();
|
60 |
-
if ( $x = mfrh_pathinfo( $path, PATHINFO_DIRNAME ) ) $r['dirname'] = $x;
|
61 |
-
$r['basename'] = mfrh_pathinfo( $path, PATHINFO_BASENAME );
|
62 |
-
if ( $x = mfrh_pathinfo( $path, PATHINFO_EXTENSION ) ) $r['extension'] = $x;
|
63 |
-
$r['filename'] = mfrh_pathinfo( $path, PATHINFO_FILENAME );
|
64 |
-
return $r;
|
65 |
-
}
|
66 |
-
if ( !$path ) return '';
|
67 |
-
$path = rtrim( $path, DIRECTORY_SEPARATOR );
|
68 |
-
switch ( $options ) {
|
69 |
-
case PATHINFO_DIRNAME:
|
70 |
-
$x = mfrh_mb( 'strrpos', $path, DIRECTORY_SEPARATOR ); // The last occurrence of slash
|
71 |
-
return is_int($x) ? mfrh_mb( 'substr', $path, 0, $x ) : '.';
|
72 |
-
|
73 |
-
case PATHINFO_BASENAME:
|
74 |
-
$x = mfrh_mb( 'strrpos', $path, DIRECTORY_SEPARATOR ); // The last occurrence of slash
|
75 |
-
return is_int($x) ? mfrh_mb( 'substr', $path, $x + 1 ) : $path;
|
76 |
-
|
77 |
-
case PATHINFO_EXTENSION:
|
78 |
-
$x = mfrh_mb( 'strrpos', $path, '.' ); // The last occurrence of dot
|
79 |
-
return is_int($x) ? mfrh_mb( 'substr', $path, $x + 1 ) : '';
|
80 |
-
|
81 |
-
case PATHINFO_FILENAME:
|
82 |
-
$basename = mfrh_pathinfo( $path, PATHINFO_BASENAME );
|
83 |
-
$x = mfrh_mb( 'strrpos', $basename, '.' ); // The last occurrence of dot
|
84 |
-
return is_int($x) ? mfrh_mb( 'substr', $basename, 0, $x ) : $basename;
|
85 |
-
}
|
86 |
-
return pathinfo( $path, $options );
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* A multibyte compatible implementation of dirname()
|
91 |
-
* @param string $path
|
92 |
-
* @return string
|
93 |
-
*/
|
94 |
-
function mfrh_dirname( $path ) {
|
95 |
-
return mfrh_pathinfo( $path, PATHINFO_DIRNAME );
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* A multibyte compatible implementation of basename()
|
100 |
-
* @param string $path
|
101 |
-
* @return string
|
102 |
-
*/
|
103 |
-
function mfrh_basename( $path ) {
|
104 |
-
return mfrh_pathinfo( $path, PATHINFO_BASENAME );
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
*
|
109 |
-
* TESTS
|
110 |
-
*
|
111 |
-
*/
|
112 |
-
|
113 |
-
// add_action( 'wp_loaded', 'mfrh_test_move' );
|
114 |
-
// function mfrh_test_move() {
|
115 |
-
// mfrh_move( 1620, '/2020/01' );
|
116 |
-
// }
|
117 |
-
|
118 |
-
/**
|
119 |
-
*
|
120 |
-
* ACTIONS AND FILTERS
|
121 |
-
*
|
122 |
-
* Available actions are:
|
123 |
-
* mfrh_path_renamed
|
124 |
-
* mfrh_url_renamed
|
125 |
-
* mfrh_media_renamed
|
126 |
-
*
|
127 |
-
* Please have a look at the custom.php file for examples.
|
128 |
-
*
|
129 |
-
*/
|
130 |
-
|
131 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/core.php
DELETED
@@ -1,1122 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Meow_MFRH_Core {
|
4 |
-
|
5 |
-
public $admin = null;
|
6 |
-
public $pro = false;
|
7 |
-
public $is_rest = false;
|
8 |
-
public $is_cli = false;
|
9 |
-
public $method = 'media_title';
|
10 |
-
public $upload_folder = null;
|
11 |
-
public $site_url = null;
|
12 |
-
public $contentDir = null; // becomes 'wp-content/uploads'
|
13 |
-
private $allow_usage = null;
|
14 |
-
private $allow_setup = null;
|
15 |
-
|
16 |
-
public function __construct() {
|
17 |
-
$this->site_url = get_site_url();
|
18 |
-
$this->upload_folder = wp_upload_dir();
|
19 |
-
$this->contentDir = substr( $this->upload_folder['baseurl'], 1 + strlen( $this->site_url ) );
|
20 |
-
add_action( 'plugins_loaded', array( $this, 'init' ) );
|
21 |
-
}
|
22 |
-
|
23 |
-
function init() {
|
24 |
-
|
25 |
-
// This should be checked after the init (is_rest checks the capacities)
|
26 |
-
$this->is_rest = MeowCommon_Helpers::is_rest();
|
27 |
-
$this->is_cli = defined( 'WP_CLI' ) && WP_CLI;
|
28 |
-
|
29 |
-
// Check the roles
|
30 |
-
$this->allow_usage = apply_filters( 'mfrh_allow_usage', current_user_can( 'administrator' ) );
|
31 |
-
$this->allow_setup = apply_filters( 'mfrh_allow_setup', current_user_can( 'manage_options' ) );
|
32 |
-
if ( !$this->is_cli && !$this->allow_usage ) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
// Languages
|
37 |
-
load_plugin_textdomain( MFRH_DOMAIN, false, basename( MFRH_PATH ) . '/languages' );
|
38 |
-
|
39 |
-
// Part of the core, settings and stuff
|
40 |
-
$this->admin = new Meow_MFRH_Admin( $this->allow_setup );
|
41 |
-
if ( class_exists( 'MeowPro_MFRH_Core' ) ) {
|
42 |
-
new MeowPro_MFRH_Core( $this, $this->admin );
|
43 |
-
$this->pro = true;
|
44 |
-
}
|
45 |
-
|
46 |
-
// Initialize
|
47 |
-
$this->method = apply_filters( 'mfrh_method', get_option( 'mfrh_auto_rename', 'media_title' ) );
|
48 |
-
|
49 |
-
// Only for REST
|
50 |
-
if ( $this->is_rest ) {
|
51 |
-
new Meow_MFRH_Rest( $this );
|
52 |
-
}
|
53 |
-
|
54 |
-
// Side-updates should be ran for CLI and REST
|
55 |
-
if ( is_admin() || $this->is_rest || $this->is_cli ) {
|
56 |
-
new Meow_MFRH_Updates( $this );
|
57 |
-
}
|
58 |
-
|
59 |
-
// Admin screens
|
60 |
-
if ( is_admin() ) {
|
61 |
-
new Meow_MFRH_UI( $this );
|
62 |
-
add_filter( 'attachment_fields_to_save', array( $this, 'attachment_fields_to_save' ), 20, 2 );
|
63 |
-
if ( get_option( 'mfrh_rename_on_save', false ) ) {
|
64 |
-
add_action( 'save_post', array( $this, 'save_post' ) );
|
65 |
-
}
|
66 |
-
if ( get_option( 'mfrh_on_upload', false ) ) {
|
67 |
-
add_filter( 'wp_handle_upload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 10, 2 );
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
*
|
74 |
-
* TOOLS / HELPERS
|
75 |
-
*
|
76 |
-
*/
|
77 |
-
|
78 |
-
// Check if the file exists, if it is, return the real path for it
|
79 |
-
// https://stackoverflow.com/questions/3964793/php-case-insensitive-version-of-file-exists
|
80 |
-
static function sensitive_file_exists( $filename ) {
|
81 |
-
|
82 |
-
$original_filename = $filename;
|
83 |
-
$caseInsensitive = get_option( 'mfrh_case_insensitive_check', false );
|
84 |
-
// if ( !$sensitive_check ) {
|
85 |
-
// $exists = file_exists( $filename );
|
86 |
-
// return $exists ? $filename : null;
|
87 |
-
// }
|
88 |
-
|
89 |
-
$output = false;
|
90 |
-
$directoryName = mfrh_dirname( $filename );
|
91 |
-
$fileArray = glob( $directoryName . '/*', GLOB_NOSORT );
|
92 |
-
$i = ( $caseInsensitive ) ? "i" : "";
|
93 |
-
|
94 |
-
// Check if \ is in the string
|
95 |
-
if ( preg_match( "/\\\|\//", $filename) ) {
|
96 |
-
$array = preg_split("/\\\|\//", $filename);
|
97 |
-
$filename = $array[count( $array ) -1];
|
98 |
-
}
|
99 |
-
// Compare filenames
|
100 |
-
foreach ( $fileArray as $file ) {
|
101 |
-
if ( preg_match( "/\/" . preg_quote( $filename ) . "$/{$i}", $file ) ) {
|
102 |
-
$output = $file;
|
103 |
-
break;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
return $output;
|
107 |
-
}
|
108 |
-
|
109 |
-
static function rmdir_recursive( $directory ) {
|
110 |
-
foreach ( glob( "{$directory}/*" ) as $file ) {
|
111 |
-
if ( is_dir( $file ) )
|
112 |
-
Meow_MFRH_Core::rmdir_recursive( $file );
|
113 |
-
else
|
114 |
-
unlink( $file );
|
115 |
-
}
|
116 |
-
rmdir( $directory );
|
117 |
-
}
|
118 |
-
|
119 |
-
function wpml_media_is_installed() {
|
120 |
-
return defined( 'WPML_MEDIA_VERSION' );
|
121 |
-
}
|
122 |
-
|
123 |
-
// To avoid issue with WPML Media for instance
|
124 |
-
function is_real_media( $id ) {
|
125 |
-
if ( $this->wpml_media_is_installed() ) {
|
126 |
-
global $sitepress;
|
127 |
-
$language = $sitepress->get_default_language( $id );
|
128 |
-
return icl_object_id( $id, 'attachment', true, $language ) == $id;
|
129 |
-
}
|
130 |
-
return true;
|
131 |
-
}
|
132 |
-
|
133 |
-
function is_header_image( $id ) {
|
134 |
-
static $headers = false;
|
135 |
-
if ( $headers == false ) {
|
136 |
-
global $wpdb;
|
137 |
-
$headers = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_is_custom_header'" );
|
138 |
-
}
|
139 |
-
return in_array( $id, $headers );
|
140 |
-
}
|
141 |
-
|
142 |
-
function generate_unique_filename( $actual, $dirname, $filename, $counter = null ) {
|
143 |
-
$new_filename = $filename;
|
144 |
-
if ( !is_null( $counter ) ) {
|
145 |
-
$whereisdot = strrpos( $new_filename, '.' );
|
146 |
-
$new_filename = substr( $new_filename, 0, $whereisdot ) . '-' . $counter
|
147 |
-
. '.' . substr( $new_filename, $whereisdot + 1 );
|
148 |
-
}
|
149 |
-
if ( $actual == $new_filename )
|
150 |
-
return false;
|
151 |
-
if ( file_exists( $dirname . "/" . $new_filename ) )
|
152 |
-
return $this->generate_unique_filename( $actual, $dirname, $filename,
|
153 |
-
is_null( $counter ) ? 2 : $counter + 1 );
|
154 |
-
return $new_filename;
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Returns all the media sharing the same file
|
159 |
-
* @param string $file The attached file path
|
160 |
-
* @param int|array $excludes The post ID(s) to exclude from the results
|
161 |
-
* @return array An array of IDs
|
162 |
-
*/
|
163 |
-
function get_posts_by_attached_file( $file, $excludes = null ) {
|
164 |
-
global $wpdb;
|
165 |
-
$r = array ();
|
166 |
-
$q = <<< SQL
|
167 |
-
SELECT post_id
|
168 |
-
FROM {$wpdb->postmeta}
|
169 |
-
WHERE meta_key = '%s'
|
170 |
-
AND meta_value = '%s'
|
171 |
-
SQL;
|
172 |
-
$rows = $wpdb->get_results( $wpdb->prepare( $q, '_wp_attached_file', _wp_relative_upload_path( $file ) ), OBJECT );
|
173 |
-
if ( $rows && is_array( $rows ) ) {
|
174 |
-
if ( !is_array( $excludes ) )
|
175 |
-
$excludes = $excludes ? array ( (int) $excludes ) : array ();
|
176 |
-
|
177 |
-
foreach ( $rows as $item ) {
|
178 |
-
$id = (int) $item->post_id;
|
179 |
-
if ( in_array( $id, $excludes ) ) continue;
|
180 |
-
$r[] = $id;
|
181 |
-
}
|
182 |
-
$r = array_unique( $r );
|
183 |
-
}
|
184 |
-
return $r;
|
185 |
-
}
|
186 |
-
|
187 |
-
/*****************************************************************************
|
188 |
-
RENAME ON UPLOAD
|
189 |
-
*****************************************************************************/
|
190 |
-
|
191 |
-
function wp_handle_upload_prefilter( $file ) {
|
192 |
-
|
193 |
-
$this->log( "⏰ Event: New Upload (" . $file['name'] . ")" );
|
194 |
-
$pp = mfrh_pathinfo( $file['name'] );
|
195 |
-
|
196 |
-
// If everything's fine, renames in based on the Title in the EXIF
|
197 |
-
switch ( $this->method ) {
|
198 |
-
case 'media_title':
|
199 |
-
$exif = wp_read_image_metadata( $file['tmp_name'] );
|
200 |
-
if ( !empty( $exif ) && isset( $exif[ 'title' ] ) && !empty( $exif[ 'title' ] ) ) {
|
201 |
-
$new_filename = $this->new_filename( $exif[ 'title' ], $file['name'] );
|
202 |
-
if ( !is_null( $new_filename ) ) {
|
203 |
-
$file['name'] = $new_filename;
|
204 |
-
$this->log( "New file should be: " . $file['name'] );
|
205 |
-
}
|
206 |
-
return $file;
|
207 |
-
}
|
208 |
-
break;
|
209 |
-
case 'post_title':
|
210 |
-
if ( !isset( $_POST['post_id'] ) || $_POST['post_id'] < 1 ) break;
|
211 |
-
$post = get_post( $_POST['post_id'] );
|
212 |
-
if ( !empty( $post ) && !empty( $post->post_title ) ) {
|
213 |
-
$new_filename = $this->new_filename( $post->post_title, $file['name'] );
|
214 |
-
if ( !is_null( $new_filename ) ) {
|
215 |
-
$file['name'] = $new_filename;
|
216 |
-
$this->log( "New file should be: " . $file['name'] );
|
217 |
-
}
|
218 |
-
return $file;
|
219 |
-
}
|
220 |
-
break;
|
221 |
-
case 'post_acf_field':
|
222 |
-
if ( !isset( $_POST['post_id'] ) || $_POST['post_id'] < 1 ) break;
|
223 |
-
$acf_field_name = get_option('mfrh_acf_field_name', false);
|
224 |
-
if ($acf_field_name) {
|
225 |
-
$new_filename = $this->new_filename( get_field($acf_field_name, $_POST['post_id']), $file['name'] );
|
226 |
-
if ( !is_null( $new_filename ) ) {
|
227 |
-
$file['name'] = $new_filename;
|
228 |
-
$this->log( "New file should be: " . $file['name'] );
|
229 |
-
}
|
230 |
-
return $file;
|
231 |
-
}
|
232 |
-
break;
|
233 |
-
}
|
234 |
-
// Otherwise, let's do the basics based on the filename
|
235 |
-
|
236 |
-
// The name will be modified at this point so let's keep it in a global
|
237 |
-
// and re-inject it later
|
238 |
-
global $mfrh_title_override;
|
239 |
-
$mfrh_title_override = $pp['filename'];
|
240 |
-
add_filter( 'wp_read_image_metadata', array( $this, 'wp_read_image_metadata' ), 10, 2 );
|
241 |
-
|
242 |
-
// Modify the filename
|
243 |
-
$pp = mfrh_pathinfo( $file['name'] );
|
244 |
-
$new_filename = $this->new_filename( $pp['filename'], $file['name'] );
|
245 |
-
if ( !is_null( $new_filename ) ) {
|
246 |
-
$file['name'] = $new_filename;
|
247 |
-
}
|
248 |
-
return $file;
|
249 |
-
}
|
250 |
-
|
251 |
-
function wp_read_image_metadata( $meta, $file ) {
|
252 |
-
// Override the title, without this it is using the new filename
|
253 |
-
global $mfrh_title_override;
|
254 |
-
$meta['title'] = $mfrh_title_override;
|
255 |
-
return $meta;
|
256 |
-
}
|
257 |
-
|
258 |
-
/****************************************************************************/
|
259 |
-
|
260 |
-
// Return false if everything is fine, otherwise return true with an output
|
261 |
-
// which details the conditions and results about the renaming.
|
262 |
-
function check_attachment( $post, &$output = array(), $manual_filename = null ) {
|
263 |
-
$id = $post['ID'];
|
264 |
-
$old_filepath = get_attached_file( $id );
|
265 |
-
$old_filepath = Meow_MFRH_Core::sensitive_file_exists( $old_filepath );
|
266 |
-
$path_parts = mfrh_pathinfo( $old_filepath );
|
267 |
-
|
268 |
-
// If the file doesn't exist, let's not go further.
|
269 |
-
if ( !isset( $path_parts['dirname'] ) || !isset( $path_parts['basename'] ) )
|
270 |
-
return false;
|
271 |
-
|
272 |
-
//print_r( $path_parts );
|
273 |
-
$directory = $path_parts['dirname'];
|
274 |
-
$old_filename = $path_parts['basename'];
|
275 |
-
|
276 |
-
// Check if media/file is dead
|
277 |
-
if ( !$old_filepath || !file_exists( $old_filepath ) ) {
|
278 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
279 |
-
return false;
|
280 |
-
}
|
281 |
-
|
282 |
-
// Is it forced/manual
|
283 |
-
// Check mfrh_new_filename (coming from manual input) if it is different than previous filename
|
284 |
-
if ( empty( $manual_filename ) && isset( $post['mfrh_new_filename'] ) ) {
|
285 |
-
if ( strtolower( $post['mfrh_new_filename'] ) != strtolower( $old_filename ) )
|
286 |
-
$manual_filename = $post['mfrh_new_filename'];
|
287 |
-
}
|
288 |
-
|
289 |
-
if ( !empty( $manual_filename ) ) {
|
290 |
-
$new_filename = $manual_filename;
|
291 |
-
$output['manual'] = true;
|
292 |
-
}
|
293 |
-
else {
|
294 |
-
if ( $this->method === 'none') {
|
295 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
296 |
-
return false;
|
297 |
-
}
|
298 |
-
if ( get_post_meta( $id, '_manual_file_renaming', true ) ) {
|
299 |
-
return false;
|
300 |
-
}
|
301 |
-
|
302 |
-
// Skip header images
|
303 |
-
if ( $this->is_header_image( $id ) ) {
|
304 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
305 |
-
return false;
|
306 |
-
}
|
307 |
-
|
308 |
-
$base_for_rename = apply_filters( 'mfrh_base_for_rename', $post['post_title'], $id );
|
309 |
-
$new_filename = $this->new_filename( $base_for_rename, $old_filename, null, $post );
|
310 |
-
if ( is_null( $new_filename ) ) {
|
311 |
-
return false; // Leave it as it is
|
312 |
-
}
|
313 |
-
}
|
314 |
-
|
315 |
-
// If a filename has a counter, and the ideal is without the counter, let's ignore it
|
316 |
-
$ideal = preg_replace( '/-[1-9]{1,10}\./', '$1.', $old_filename );
|
317 |
-
if ( !$manual_filename ) {
|
318 |
-
if ( $ideal == $new_filename ) {
|
319 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
320 |
-
return false;
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
// Filename is equal to sanitized title
|
325 |
-
if ( $new_filename == $old_filename ) {
|
326 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
327 |
-
return false;
|
328 |
-
}
|
329 |
-
|
330 |
-
// Check for case issue, numbering
|
331 |
-
$ideal_filename = $new_filename;
|
332 |
-
$new_filepath = trailingslashit( $directory ) . $new_filename;
|
333 |
-
$existing_file = Meow_MFRH_Core::sensitive_file_exists( $new_filepath );
|
334 |
-
$case_issue = strtolower( $old_filename ) == strtolower( $new_filename );
|
335 |
-
if ( $existing_file && !$case_issue ) {
|
336 |
-
$is_numbered = apply_filters( 'mfrh_numbered', false );
|
337 |
-
if ( $is_numbered ) {
|
338 |
-
$new_filename = $this->generate_unique_filename( $ideal, $directory, $new_filename );
|
339 |
-
if ( !$new_filename ) {
|
340 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
341 |
-
return false;
|
342 |
-
}
|
343 |
-
$new_filepath = trailingslashit( $directory ) . $new_filename;
|
344 |
-
$existing_file = Meow_MFRH_Core::sensitive_file_exists( $new_filepath );
|
345 |
-
}
|
346 |
-
}
|
347 |
-
|
348 |
-
// Send info to the requester function
|
349 |
-
$output['post_id'] = $id;
|
350 |
-
$output['post_name'] = $post['post_name'];
|
351 |
-
$output['post_title'] = $post['post_title'];
|
352 |
-
$output['current_filename'] = $old_filename;
|
353 |
-
$output['current_filepath'] = $old_filepath;
|
354 |
-
$output['ideal_filename'] = $ideal_filename;
|
355 |
-
$output['proposed_filename'] = $new_filename;
|
356 |
-
$output['desired_filepath'] = $new_filepath;
|
357 |
-
$output['case_issue'] = $case_issue;
|
358 |
-
$output['manual'] = !empty( $manual_filename );
|
359 |
-
$output['locked'] = get_post_meta( $id, '_manual_file_renaming', true );
|
360 |
-
$output['proposed_filename_exists'] = !!$existing_file;
|
361 |
-
$output['original_image'] = null;
|
362 |
-
|
363 |
-
// If the ideal filename already exists
|
364 |
-
// Maybe that's the original_image! If yes, we should let it go through
|
365 |
-
// as the original_rename will be renamed into another filename anyway.
|
366 |
-
if ( !!$existing_file ) {
|
367 |
-
$meta = wp_get_attachment_metadata( $id );
|
368 |
-
if ( isset( $meta['original_image'] ) && $new_filename === $meta['original_image'] ) {
|
369 |
-
$output['original_image'] = $meta['original_image'];
|
370 |
-
$output['proposed_filename_exists'] = false;
|
371 |
-
}
|
372 |
-
}
|
373 |
-
|
374 |
-
// Set the '_require_file_renaming', even though it's not really used at this point (but will be,
|
375 |
-
// with the new UI).
|
376 |
-
if ( !get_post_meta( $post['ID'], '_require_file_renaming', true ) && !$output['locked']) {
|
377 |
-
add_post_meta( $post['ID'], '_require_file_renaming', true, true );
|
378 |
-
}
|
379 |
-
return true;
|
380 |
-
}
|
381 |
-
|
382 |
-
function check_text() {
|
383 |
-
$issues = array();
|
384 |
-
global $wpdb;
|
385 |
-
$ids = $wpdb->get_col( "
|
386 |
-
SELECT p.ID
|
387 |
-
FROM $wpdb->posts p
|
388 |
-
WHERE post_status = 'inherit'
|
389 |
-
AND post_type = 'attachment'
|
390 |
-
" );
|
391 |
-
foreach ( $ids as $id )
|
392 |
-
if ( $this->check_attachment( get_post( $id, ARRAY_A ), $output ) )
|
393 |
-
array_push( $issues, $output );
|
394 |
-
return $issues;
|
395 |
-
}
|
396 |
-
|
397 |
-
/**
|
398 |
-
*
|
399 |
-
* RENAME ON SAVE / PUBLISH
|
400 |
-
* Originally proposed by Ben Heller
|
401 |
-
* Added and modified by Jordy Meow
|
402 |
-
*/
|
403 |
-
|
404 |
-
function save_post( $post_id ) {
|
405 |
-
$status = get_post_status( $post_id );
|
406 |
-
if ( !in_array( $status, array( 'publish', 'draft', 'future', 'private' ) ) )
|
407 |
-
return;
|
408 |
-
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' =>'any', 'post_parent' => $post_id );
|
409 |
-
$medias = get_posts( $args );
|
410 |
-
if ( $medias ) {
|
411 |
-
$this->log( '⏰ Event: Save Post' );
|
412 |
-
foreach ( $medias as $attach ) {
|
413 |
-
// In the past, I used this to detect if the Media Library is NOT used:
|
414 |
-
// isset( $attachment['image-size'] );
|
415 |
-
$this->rename( $attach->ID );
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
*
|
422 |
-
* EDITOR
|
423 |
-
*
|
424 |
-
*/
|
425 |
-
|
426 |
-
function attachment_fields_to_save( $post, $attachment ) {
|
427 |
-
$this->log( '⏰ Event: Save Attachment' );
|
428 |
-
$post = $this->rename( $post );
|
429 |
-
return $post;
|
430 |
-
}
|
431 |
-
|
432 |
-
function logs_directory_check() {
|
433 |
-
if ( !file_exists( MFRH_PATH . '/logs/' ) ) {
|
434 |
-
mkdir( MFRH_PATH . '/logs/', 0777 );
|
435 |
-
}
|
436 |
-
}
|
437 |
-
|
438 |
-
function log_sql( $data, $antidata ) {
|
439 |
-
if ( !get_option( 'mfrh_logsql' ) || !$this->admin->is_registered() )
|
440 |
-
return;
|
441 |
-
$this->logs_directory_check();
|
442 |
-
$fh = fopen( MFRH_PATH . '/logs/mfrh_sql.log', 'a' );
|
443 |
-
$fh_anti = fopen( MFRH_PATH . '/logs/mfrh_sql_revert.log', 'a' );
|
444 |
-
fwrite( $fh, "{$data}\n" );
|
445 |
-
fwrite( $fh_anti, "{$antidata}\n" );
|
446 |
-
fclose( $fh );
|
447 |
-
fclose( $fh_anti );
|
448 |
-
}
|
449 |
-
|
450 |
-
function log( $data, $inErrorLog = false ) {
|
451 |
-
if ( $inErrorLog )
|
452 |
-
error_log( $data );
|
453 |
-
if ( !get_option( 'mfrh_log' ) ) {
|
454 |
-
return;
|
455 |
-
}
|
456 |
-
$this->logs_directory_check();
|
457 |
-
$fh = fopen( MFRH_PATH . '/logs/media-file-renamer.log', 'a' );
|
458 |
-
$date = date( "Y-m-d H:i:s" );
|
459 |
-
fwrite( $fh, "$date: {$data}\n" );
|
460 |
-
fclose( $fh );
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
*
|
465 |
-
* GENERATE A NEW FILENAME
|
466 |
-
*
|
467 |
-
*/
|
468 |
-
|
469 |
-
function replace_chars( $str ) {
|
470 |
-
$special_chars = array();
|
471 |
-
$special_chars = apply_filters( 'mfrh_replace_rules', $special_chars );
|
472 |
-
if ( !empty( $special_chars ) )
|
473 |
-
foreach ( $special_chars as $key => $value )
|
474 |
-
$str = str_replace( $key, $value, $str );
|
475 |
-
return $str;
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Transform full width hyphens and other variety hyphens in half size into simple hyphen,
|
480 |
-
* and avoid consecutive hyphens and also at the beginning and end as well.
|
481 |
-
*/
|
482 |
-
function format_hyphens( $str ) {
|
483 |
-
$hyphen = '-';
|
484 |
-
$hyphens = [
|
485 |
-
'﹣', '-', '−', '⁻', '₋',
|
486 |
-
'‐', '‑', '‒', '–', '—',
|
487 |
-
'―', '﹘', 'ー','ー',
|
488 |
-
];
|
489 |
-
$str = str_replace( $hyphens, $hyphen, $str );
|
490 |
-
// remove at the beginning and end.
|
491 |
-
$beginning = mb_substr( $str, 0, 1 );
|
492 |
-
if ( $beginning === $hyphen ) {
|
493 |
-
$str = mb_substr( $str, 1 );
|
494 |
-
}
|
495 |
-
$end = mb_substr( $str, -1 );
|
496 |
-
if ( $end === $hyphen ) {
|
497 |
-
$str = mb_strcut( $str, 0, mb_strlen( $str ) - 1 );
|
498 |
-
}
|
499 |
-
$str = preg_replace( '/-{2,}/u', '-', $str );
|
500 |
-
$str = trim( $str, implode( '', $hyphens ) );
|
501 |
-
return $str;
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Computes the ideal filename based on a text
|
506 |
-
* @param array $media
|
507 |
-
* @param string $text
|
508 |
-
* @param string $manual_filename
|
509 |
-
* @return string|NULL If the resulting filename had no any valid characters, NULL is returned
|
510 |
-
*/
|
511 |
-
function new_filename( $text, $current_filename, $manual_filename = null, $media = null ) {
|
512 |
-
|
513 |
-
// Gather the base values.
|
514 |
-
|
515 |
-
if ( empty( $current_filename ) && !empty( $media ) ) {
|
516 |
-
$current_filename = get_attached_file( $media['ID'] );
|
517 |
-
}
|
518 |
-
|
519 |
-
$pp = mfrh_pathinfo( $current_filename );
|
520 |
-
$new_ext = empty( $pp['extension'] ) ? '' : $pp['extension'];
|
521 |
-
$old_filename_no_ext = $pp['filename'];
|
522 |
-
$text = empty( $text ) ? $old_filename_no_ext : $text;
|
523 |
-
|
524 |
-
// Generate the new filename.
|
525 |
-
|
526 |
-
if ( !empty( $manual_filename ) ) {
|
527 |
-
// Forced filename (manual or undo, basically). Keep this extension in $new_ext.
|
528 |
-
$manual_pp = mfrh_pathinfo( $manual_filename );
|
529 |
-
$manual_filename = $manual_pp['filename'];
|
530 |
-
$new_ext = empty( $manual_pp['extension'] ) ? $new_ext : $manual_pp['extension'];
|
531 |
-
$new_filename = $manual_filename;
|
532 |
-
}
|
533 |
-
else {
|
534 |
-
// Filename is generated from $text, without an extension.
|
535 |
-
|
536 |
-
// Those are basically errors, when titles are generated from filename
|
537 |
-
$text = str_replace( ".jpg", "", $text );
|
538 |
-
$text = str_replace( ".png", "", $text );
|
539 |
-
|
540 |
-
// Related to English
|
541 |
-
$text = str_replace( "'s", "", $text );
|
542 |
-
$text = str_replace( "n\'t", "nt", $text );
|
543 |
-
$text = preg_replace( "/\'m/i", "-am", $text );
|
544 |
-
|
545 |
-
// We probably do not want those neither
|
546 |
-
$text = str_replace( "'", "-", $text );
|
547 |
-
$text = preg_replace( "/\//s", "-", $text );
|
548 |
-
$text = str_replace( ['.','…'], "", $text );
|
549 |
-
|
550 |
-
$text = $this->replace_chars( $text );
|
551 |
-
// Changed strolower to mb_strtolower...
|
552 |
-
if ( function_exists( 'mb_strtolower' ) ) {
|
553 |
-
$text = mb_strtolower( $text );
|
554 |
-
}
|
555 |
-
else {
|
556 |
-
$text = strtolower( $text );
|
557 |
-
}
|
558 |
-
$text = sanitize_file_name( $text );
|
559 |
-
$new_filename = $this->format_hyphens( $text );
|
560 |
-
$new_filename = trim( $new_filename, '-.' );
|
561 |
-
}
|
562 |
-
|
563 |
-
if ( empty( $manual_filename ) ) {
|
564 |
-
$new_filename = $this->format_hyphens( $new_filename );
|
565 |
-
}
|
566 |
-
|
567 |
-
if ( !$manual_filename ) {
|
568 |
-
$new_filename = apply_filters( 'mfrh_new_filename', $new_filename, $old_filename_no_ext, $media );
|
569 |
-
$new_filename = sanitize_file_name( $new_filename );
|
570 |
-
}
|
571 |
-
|
572 |
-
// If the resulting filename had no any valid character, return NULL
|
573 |
-
if ( empty( $new_filename ) ) {
|
574 |
-
return null;
|
575 |
-
}
|
576 |
-
|
577 |
-
// We know have a new filename, let's add an extension.
|
578 |
-
$new_filename = !empty( $new_ext ) ? ( $new_filename . '.' . $new_ext ) : $new_filename;
|
579 |
-
|
580 |
-
return $new_filename;
|
581 |
-
}
|
582 |
-
|
583 |
-
// Only replace the first occurence
|
584 |
-
function str_replace( $needle, $replace, $haystack ) {
|
585 |
-
$pos = strpos( $haystack, $needle );
|
586 |
-
if ( $pos !== false )
|
587 |
-
$haystack = substr_replace( $haystack, $replace, $pos, strlen( $needle ) );
|
588 |
-
return $haystack;
|
589 |
-
}
|
590 |
-
|
591 |
-
/**
|
592 |
-
*
|
593 |
-
* RENAME FILES + COFFEE TIME
|
594 |
-
*/
|
595 |
-
|
596 |
-
// From a url to the shortened and cleaned url (for example '2025/02/file.png')
|
597 |
-
function clean_url( $url ) {
|
598 |
-
$dirIndex = strpos( $url, $this->contentDir );
|
599 |
-
if ( empty( $url ) || $dirIndex === false ) {
|
600 |
-
$finalUrl = null;
|
601 |
-
}
|
602 |
-
else {
|
603 |
-
$finalUrl = urldecode( substr( $url, 1 + strlen( $this->contentDir ) + $dirIndex ) );
|
604 |
-
}
|
605 |
-
return $finalUrl;
|
606 |
-
}
|
607 |
-
|
608 |
-
function call_hooks_rename_url( $post, $orig_image_url, $new_image_url ) {
|
609 |
-
// With the full URLs
|
610 |
-
do_action( 'mfrh_url_renamed', $post, $orig_image_url, $new_image_url );
|
611 |
-
// With clean URLs relative to /uploads
|
612 |
-
do_action( 'mfrh_url_renamed', $post, $this->clean_url( $orig_image_url ), $this->clean_url( $new_image_url ) );
|
613 |
-
// With DB URLs (honestly, not sure about this...)
|
614 |
-
// $upload_dir = wp_upload_dir();
|
615 |
-
// do_action( 'mfrh_url_renamed', $post, str_replace( $upload_dir, "", $orig_image_url ),
|
616 |
-
// str_replace( $upload_dir, "", $new_image_url ) );
|
617 |
-
}
|
618 |
-
|
619 |
-
function rename_file( $old, $new, $case_issue = false ) {
|
620 |
-
// Some plugins can create custom thumbnail folders instead in the same folder, so make sure
|
621 |
-
// the thumbnail folders are available.
|
622 |
-
wp_mkdir_p( dirname($new) );
|
623 |
-
|
624 |
-
// If there is a case issue, that means the system doesn't make the difference between AA.jpg and aa.jpg even though WordPress does.
|
625 |
-
// In that case it is important to rename the file to a temporary filename in between like: AA.jpg ➡️ TMP.jpg ➡️ aa.jpg.
|
626 |
-
if ( $case_issue ) {
|
627 |
-
if ( !rename( $old, $old . md5( $old ) ) ) {
|
628 |
-
$this->log( "🚫 The file couldn't be renamed (case issue) from $old to " . $old . md5( $old ) . "." );
|
629 |
-
return false;
|
630 |
-
}
|
631 |
-
if ( !rename( $old . md5( $old ), $new ) ) {
|
632 |
-
$this->log( "🚫 The file couldn't be renamed (case issue) from " . $old . md5( $old ) . " to $new." );
|
633 |
-
return false;
|
634 |
-
}
|
635 |
-
}
|
636 |
-
else if ( ( !rename( $old, $new ) ) ) {
|
637 |
-
$this->log( "🚫 The file couldn't be renamed from $old to $new." );
|
638 |
-
return false;
|
639 |
-
}
|
640 |
-
return true;
|
641 |
-
}
|
642 |
-
|
643 |
-
function move( $media, $newPath ) {
|
644 |
-
$id = null;
|
645 |
-
$post = null;
|
646 |
-
|
647 |
-
// Check the arguments
|
648 |
-
if ( is_numeric( $media ) ) {
|
649 |
-
$id = $media;
|
650 |
-
$post = get_post( $media, ARRAY_A );
|
651 |
-
}
|
652 |
-
else if ( is_array( $media ) ) {
|
653 |
-
$id = $media['ID'];
|
654 |
-
$post = $media;
|
655 |
-
}
|
656 |
-
else {
|
657 |
-
die( 'Media File Renamer: move() requires the ID or the array for the media.' );
|
658 |
-
}
|
659 |
-
|
660 |
-
// Prepare the variables
|
661 |
-
$orig_attachment_url = null;
|
662 |
-
$old_filepath = get_attached_file( $id );
|
663 |
-
$path_parts = mfrh_pathinfo( $old_filepath );
|
664 |
-
$old_ext = $path_parts['extension'];
|
665 |
-
$upload_dir = wp_upload_dir();
|
666 |
-
$old_directory = trim( str_replace( $upload_dir['basedir'], '', $path_parts['dirname'] ), '/' ); // '2011/01'
|
667 |
-
$new_directory = trim( $newPath, '/' );
|
668 |
-
$filename = $path_parts['basename']; // 'whatever.jpeg'
|
669 |
-
$new_filepath = trailingslashit( trailingslashit( $upload_dir['basedir'] ) . $new_directory ) . $filename;
|
670 |
-
|
671 |
-
$this->log( "🏁 Move Media: " . $filename );
|
672 |
-
$this->log( "The new directory will be: " . mfrh_dirname( $new_filepath ) );
|
673 |
-
|
674 |
-
// Create the directory if it does not exist
|
675 |
-
if ( !file_exists( mfrh_dirname( $new_filepath ) ) ) {
|
676 |
-
mkdir( mfrh_dirname( $new_filepath ), 0777, true );
|
677 |
-
}
|
678 |
-
|
679 |
-
// There is no support for UNDO (as the current process of Media File Renamer doesn't keep the path for the undo, only the filename... so the move breaks this - let's deal with this later).
|
680 |
-
|
681 |
-
// Move the main media file
|
682 |
-
if ( !$this->rename_file( $old_filepath, $new_filepath ) ) {
|
683 |
-
$this->log( "🚫 File $old_filepath ➡️ $new_filepath" );
|
684 |
-
return false;
|
685 |
-
}
|
686 |
-
$this->log( "✅ File $old_filepath ➡️ $new_filepath" );
|
687 |
-
do_action( 'mfrh_path_renamed', $post, $old_filepath, $new_filepath );
|
688 |
-
|
689 |
-
// Update the attachment meta
|
690 |
-
$meta = wp_get_attachment_metadata( $id );
|
691 |
-
|
692 |
-
if ( $meta ) {
|
693 |
-
if ( isset( $meta['file'] ) && !empty( $meta['file'] ) )
|
694 |
-
$meta['file'] = $this->str_replace( $old_directory, $new_directory, $meta['file'] );
|
695 |
-
if ( isset( $meta['url'] ) && !empty( $meta['url'] ) && strlen( $meta['url'] ) > 4 )
|
696 |
-
$meta['url'] = $this->str_replace( $old_directory, $new_directory, $meta['url'] );
|
697 |
-
//wp_update_attachment_metadata( $id, $meta );
|
698 |
-
}
|
699 |
-
|
700 |
-
// Better to check like this rather than with wp_attachment_is_image
|
701 |
-
// PDFs also have thumbnails now, since WP 4.7
|
702 |
-
$has_thumbnails = isset( $meta['sizes'] );
|
703 |
-
|
704 |
-
if ( $has_thumbnails ) {
|
705 |
-
$orig_image_urls = array();
|
706 |
-
$orig_image_data = wp_get_attachment_image_src( $id, 'full' );
|
707 |
-
$orig_image_urls['full'] = $orig_image_data[0];
|
708 |
-
foreach ( $meta['sizes'] as $size => $meta_size ) {
|
709 |
-
if ( !isset($meta['sizes'][$size]['file'] ) )
|
710 |
-
continue;
|
711 |
-
$meta_old_filename = $meta['sizes'][$size]['file'];
|
712 |
-
$meta_old_filepath = trailingslashit( $upload_dir['basedir'] ) . trailingslashit( $old_directory ) . $meta_old_filename;
|
713 |
-
$meta_new_filepath = trailingslashit( $upload_dir['basedir'] ) . trailingslashit( $new_directory ) . $meta_old_filename;
|
714 |
-
$orig_image_data = wp_get_attachment_image_src( $id, $size );
|
715 |
-
$orig_image_urls[$size] = $orig_image_data[0];
|
716 |
-
|
717 |
-
// Double check files exist before trying to rename.
|
718 |
-
if ( file_exists( $meta_old_filepath )
|
719 |
-
&& ( ( !file_exists( $meta_new_filepath ) ) || is_writable( $meta_new_filepath ) ) ) {
|
720 |
-
// WP Retina 2x is detected, let's rename those files as well
|
721 |
-
if ( function_exists( 'wr2x_get_retina' ) ) {
|
722 |
-
$wr2x_old_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_old_filepath );
|
723 |
-
$wr2x_new_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_new_filepath );
|
724 |
-
if ( file_exists( $wr2x_old_filepath )
|
725 |
-
&& ( ( !file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
|
726 |
-
|
727 |
-
// Rename retina file
|
728 |
-
if ( !$this->rename_file( $wr2x_old_filepath, $wr2x_new_filepath ) ) {
|
729 |
-
$this->log( "🚫 Retina $wr2x_old_filepath ➡️ $wr2x_new_filepath" );
|
730 |
-
return $post;
|
731 |
-
}
|
732 |
-
$this->log( "✅ Retina $wr2x_old_filepath ➡️ $wr2x_new_filepath" );
|
733 |
-
do_action( 'mfrh_path_renamed', $post, $wr2x_old_filepath, $wr2x_new_filepath );
|
734 |
-
}
|
735 |
-
}
|
736 |
-
|
737 |
-
// Rename meta file
|
738 |
-
if ( !$this->rename_file( $meta_old_filepath, $meta_new_filepath ) ) {
|
739 |
-
$this->log( "🚫 File $meta_old_filepath ➡️ $meta_new_filepath" );
|
740 |
-
return false;
|
741 |
-
}
|
742 |
-
|
743 |
-
// Success, call other plugins
|
744 |
-
$this->log( "✅ File $meta_old_filepath ➡️ $meta_new_filepath" );
|
745 |
-
do_action( 'mfrh_path_renamed', $post, $meta_old_filepath, $meta_new_filepath );
|
746 |
-
|
747 |
-
}
|
748 |
-
}
|
749 |
-
}
|
750 |
-
else {
|
751 |
-
$orig_attachment_url = wp_get_attachment_url( $id );
|
752 |
-
}
|
753 |
-
|
754 |
-
// Update DB: Media and Metadata
|
755 |
-
update_attached_file( $id, $new_filepath );
|
756 |
-
if ( $meta ) {
|
757 |
-
wp_update_attachment_metadata( $id, $meta );
|
758 |
-
}
|
759 |
-
clean_post_cache( $id ); // TODO: Would be good to know what this WP function actually does (might be useless)
|
760 |
-
|
761 |
-
// Post actions
|
762 |
-
$this->call_post_actions( $id, $post, $meta, $has_thumbnails, $orig_image_urls, $orig_attachment_url );
|
763 |
-
do_action( 'mfrh_media_renamed', $post, $old_filepath, $new_filepath, false );
|
764 |
-
return true;
|
765 |
-
}
|
766 |
-
|
767 |
-
// Call the actions so that the plugin's plugins can update everything else (than the files)
|
768 |
-
// Called by rename() and move()
|
769 |
-
function call_post_actions( $id, $post, $meta, $has_thumbnails, $orig_image_urls, $orig_attachment_url ) {
|
770 |
-
if ( $has_thumbnails ) {
|
771 |
-
$orig_image_url = $orig_image_urls['full'];
|
772 |
-
$new_image_data = wp_get_attachment_image_src( $id, 'full' );
|
773 |
-
$new_image_url = $new_image_data[0];
|
774 |
-
$this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url );
|
775 |
-
if ( !empty( $meta['sizes'] ) ) {
|
776 |
-
foreach ( $meta['sizes'] as $size => $meta_size ) {
|
777 |
-
$orig_image_url = $orig_image_urls[$size];
|
778 |
-
$new_image_data = wp_get_attachment_image_src( $id, $size );
|
779 |
-
$new_image_url = $new_image_data[0];
|
780 |
-
$this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url );
|
781 |
-
}
|
782 |
-
}
|
783 |
-
}
|
784 |
-
else {
|
785 |
-
$new_attachment_url = wp_get_attachment_url( $id );
|
786 |
-
$this->call_hooks_rename_url( $post, $orig_attachment_url, $new_attachment_url );
|
787 |
-
}
|
788 |
-
// HTTP REFERER set to the new media link
|
789 |
-
if ( isset( $_REQUEST['_wp_original_http_referer'] ) &&
|
790 |
-
strpos( $_REQUEST['_wp_original_http_referer'], '/wp-admin/' ) === false ) {
|
791 |
-
$_REQUEST['_wp_original_http_referer'] = get_permalink( $id );
|
792 |
-
}
|
793 |
-
}
|
794 |
-
|
795 |
-
function undo( $mediaId ) {
|
796 |
-
$original_filename = get_post_meta( $mediaId, '_original_filename', true );
|
797 |
-
if ( empty( $original_filename ) ) {
|
798 |
-
return true;
|
799 |
-
}
|
800 |
-
$res = $this->rename( $mediaId, $original_filename, true );
|
801 |
-
if (!!$res) {
|
802 |
-
delete_post_meta( $mediaId, '_original_filename' );
|
803 |
-
}
|
804 |
-
return $res;
|
805 |
-
}
|
806 |
-
|
807 |
-
function rename( $media, $manual_filename = null, $undo = false ) {
|
808 |
-
$id = null;
|
809 |
-
$post = null;
|
810 |
-
|
811 |
-
// This filter permits developers to allow or not the renaming of certain files.
|
812 |
-
$allowed = apply_filters( 'mfrh_allow_rename', true, $media, $manual_filename );
|
813 |
-
if ( !$allowed ) {
|
814 |
-
return $post;
|
815 |
-
}
|
816 |
-
|
817 |
-
// Check the arguments
|
818 |
-
if ( is_numeric( $media ) ) {
|
819 |
-
$id = $media;
|
820 |
-
$post = get_post( $media, ARRAY_A );
|
821 |
-
}
|
822 |
-
else if ( is_array( $media ) ) {
|
823 |
-
$id = $media['ID'];
|
824 |
-
$post = $media;
|
825 |
-
}
|
826 |
-
else {
|
827 |
-
die( 'Media File Renamer: rename() requires the ID or the array for the media.' );
|
828 |
-
}
|
829 |
-
|
830 |
-
$force_rename = apply_filters( 'mfrh_force_rename', false );
|
831 |
-
|
832 |
-
// Check attachment
|
833 |
-
$need_rename = $this->check_attachment( $post, $output, $manual_filename );
|
834 |
-
if ( !$need_rename ) {
|
835 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
836 |
-
return $post;
|
837 |
-
}
|
838 |
-
|
839 |
-
// Prepare the variables
|
840 |
-
$orig_attachment_url = null;
|
841 |
-
$old_filepath = $output['current_filepath'];
|
842 |
-
$case_issue = $output['case_issue'];
|
843 |
-
$new_filepath = $output['desired_filepath'];
|
844 |
-
$new_filename = $output['proposed_filename'];
|
845 |
-
$manual = $output['manual'] || !empty( $manual_filename );
|
846 |
-
$path_parts = mfrh_pathinfo( $old_filepath );
|
847 |
-
$directory = $path_parts['dirname']; // Directory where the files are, under 'uploads', such as '2011/01'
|
848 |
-
$old_filename = $path_parts['basename']; // 'whatever.jpeg'
|
849 |
-
// Get old extension and new extension
|
850 |
-
$old_ext = $path_parts['extension'];
|
851 |
-
$new_ext = $old_ext;
|
852 |
-
if ( $manual_filename ) {
|
853 |
-
$pp = mfrh_pathinfo( $manual_filename );
|
854 |
-
$new_ext = $pp['extension'];
|
855 |
-
}
|
856 |
-
$noext_old_filename = $this->str_replace( '.' . $old_ext, '', $old_filename ); // Old filename without extension
|
857 |
-
$noext_new_filename = $this->str_replace( '.' . $old_ext, '', $new_filename ); // New filename without extension
|
858 |
-
|
859 |
-
|
860 |
-
$this->log( "🏁 Rename Media: " . $old_filename );
|
861 |
-
$this->log( "New file will be: " . $new_filename );
|
862 |
-
|
863 |
-
// Check for issues with the files
|
864 |
-
if ( !file_exists( $old_filepath ) ) {
|
865 |
-
$this->log( "The original file ($old_filepath) cannot be found." );
|
866 |
-
return $post;
|
867 |
-
}
|
868 |
-
|
869 |
-
// Get the attachment meta
|
870 |
-
$meta = wp_get_attachment_metadata( $id );
|
871 |
-
|
872 |
-
// Get the information about the original image
|
873 |
-
// (which means the current file is a rescaled version of it)
|
874 |
-
$is_scaled_image = isset( $meta['original_image'] ) && !empty( $meta['original_image'] );
|
875 |
-
$original_is_ideal = $is_scaled_image ? $new_filename === $meta['original_image'] : false;
|
876 |
-
|
877 |
-
if ( !$original_is_ideal && !$case_issue && !$force_rename && file_exists( $new_filepath ) ) {
|
878 |
-
$this->log( "The new file already exists ($new_filepath). It is not a case issue. Renaming cancelled." );
|
879 |
-
return $post;
|
880 |
-
}
|
881 |
-
|
882 |
-
// Keep the original filename (that's for the "Undo" feature)
|
883 |
-
$original_filename = get_post_meta( $id, '_original_filename', true );
|
884 |
-
if ( empty( $original_filename ) )
|
885 |
-
add_post_meta( $id, '_original_filename', $old_filename, true );
|
886 |
-
|
887 |
-
// Support for the original image if it was "-rescaled".
|
888 |
-
// We should rename the -rescaled image first, as it could cause an issue
|
889 |
-
// if renamed after the main file. In fact, the original file might have already
|
890 |
-
// the best filename and evidently, the "-rescaled" one not.
|
891 |
-
if ( $is_scaled_image ) {
|
892 |
-
$meta_old_filename = $meta['original_image'];
|
893 |
-
$meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
|
894 |
-
// In case of the undo, since we do not have the actual real original filename for that un-scaled image,
|
895 |
-
// we make sure the -scaled part of the original filename is not used (that could bring some confusion otherwise).
|
896 |
-
$meta_new_filename = preg_replace( '/\-scaled$/', '', $noext_new_filename ) . '-mfrh-original.' . $new_ext;
|
897 |
-
$meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
|
898 |
-
if ( !$this->rename_file( $meta_old_filepath, $meta_new_filepath, $case_issue ) && !$force_rename ) {
|
899 |
-
$this->log( "🚫 File $meta_old_filepath ➡️ $meta_new_filepath" );
|
900 |
-
return $post;
|
901 |
-
}
|
902 |
-
// Manual Rename also uses the new extension (if it was not stripped to avoid user mistake)
|
903 |
-
if ( $force_rename && !empty( $new_ext ) ) {
|
904 |
-
$meta_new_filename = $this->str_replace( $old_ext, $new_ext, $meta_new_filename );
|
905 |
-
}
|
906 |
-
$this->log( "✅ File $old_filepath ➡️ $new_filepath" );
|
907 |
-
do_action( 'mfrh_path_renamed', $post, $old_filepath, $new_filepath );
|
908 |
-
$meta['original_image'] = $meta_new_filename;
|
909 |
-
}
|
910 |
-
|
911 |
-
// Rename the main media file.
|
912 |
-
if ( !$this->rename_file( $old_filepath, $new_filepath, $case_issue ) && !$force_rename ) {
|
913 |
-
$this->log( "🚫 File $old_filepath ➡️ $new_filepath" );
|
914 |
-
return $post;
|
915 |
-
}
|
916 |
-
$this->log( "✅ File $old_filepath ➡️ $new_filepath" );
|
917 |
-
do_action( 'mfrh_path_renamed', $post, $old_filepath, $new_filepath );
|
918 |
-
|
919 |
-
// Rename the main media file in WebP if it exists.
|
920 |
-
$this->rename_webp_file_if_exist( $old_filepath, $old_ext, $new_filepath,
|
921 |
-
$new_ext, $case_issue, $force_rename, $post );
|
922 |
-
|
923 |
-
if ( $meta ) {
|
924 |
-
if ( isset( $meta['file'] ) && !empty( $meta['file'] ) )
|
925 |
-
$meta['file'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['file'] );
|
926 |
-
if ( isset( $meta['url'] ) && !empty( $meta['url'] ) && strlen( $meta['url'] ) > 4 )
|
927 |
-
$meta['url'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['url'] );
|
928 |
-
else
|
929 |
-
$meta['url'] = $noext_new_filename . '.' . $old_ext;
|
930 |
-
}
|
931 |
-
|
932 |
-
// Better to check like this rather than with wp_attachment_is_image
|
933 |
-
// PDFs also have thumbnails now, since WP 4.7
|
934 |
-
$has_thumbnails = isset( $meta['sizes'] );
|
935 |
-
|
936 |
-
// Loop through the different sizes in the case of an image, and rename them.
|
937 |
-
if ( $has_thumbnails ) {
|
938 |
-
|
939 |
-
// In the case of a -scaled image, we need to update the next_old_filename.
|
940 |
-
// next_old_filename is based on the filename of the main file, but since
|
941 |
-
// it contains '-scaled' but not its thumbnails, we need to modify it here.
|
942 |
-
// $noext_new_filename is to support this in case of undo.
|
943 |
-
if ( $is_scaled_image ) {
|
944 |
-
$noext_new_filename = preg_replace( '/\-scaled$/', '', $noext_new_filename );
|
945 |
-
$noext_old_filename = preg_replace( '/\-scaled$/', '', $noext_old_filename );
|
946 |
-
}
|
947 |
-
|
948 |
-
$orig_image_urls = array();
|
949 |
-
$orig_image_data = wp_get_attachment_image_src( $id, 'full' );
|
950 |
-
$orig_image_urls['full'] = $orig_image_data[0];
|
951 |
-
foreach ( $meta['sizes'] as $size => $meta_size ) {
|
952 |
-
if ( !isset($meta['sizes'][$size]['file'] ) )
|
953 |
-
continue;
|
954 |
-
$meta_old_filename = $meta['sizes'][$size]['file'];
|
955 |
-
$meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
|
956 |
-
$meta_new_filename = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta_old_filename );
|
957 |
-
|
958 |
-
// Manual Rename also uses the new extension (if it was not stripped to avoid user mistake)
|
959 |
-
if ( $force_rename && !empty( $new_ext ) ) {
|
960 |
-
$meta_new_filename = $this->str_replace( $old_ext, $new_ext, $meta_new_filename );
|
961 |
-
}
|
962 |
-
|
963 |
-
$meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
|
964 |
-
$orig_image_data = wp_get_attachment_image_src( $id, $size );
|
965 |
-
$orig_image_urls[$size] = $orig_image_data[0];
|
966 |
-
|
967 |
-
// Double check files exist before trying to rename.
|
968 |
-
if ( $force_rename || ( file_exists( $meta_old_filepath ) &&
|
969 |
-
( ( !file_exists( $meta_new_filepath ) ) || is_writable( $meta_new_filepath ) ) ) ) {
|
970 |
-
// WP Retina 2x is detected, let's rename those files as well
|
971 |
-
if ( function_exists( 'wr2x_get_retina' ) ) {
|
972 |
-
$wr2x_old_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_old_filepath );
|
973 |
-
$wr2x_new_filepath = $this->str_replace( '.' . $new_ext, '@2x.' . $new_ext, $meta_new_filepath );
|
974 |
-
if ( file_exists( $wr2x_old_filepath )
|
975 |
-
&& ( ( !file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
|
976 |
-
|
977 |
-
// Rename retina file
|
978 |
-
if ( !$this->rename_file( $wr2x_old_filepath, $wr2x_new_filepath, $case_issue ) && !$force_rename ) {
|
979 |
-
$this->log( "🚫 Retina $wr2x_old_filepath ➡️ $wr2x_new_filepath" );
|
980 |
-
return $post;
|
981 |
-
}
|
982 |
-
$this->log( "✅ Retina $wr2x_old_filepath ➡️ $wr2x_new_filepath" );
|
983 |
-
do_action( 'mfrh_path_renamed', $post, $wr2x_old_filepath, $wr2x_new_filepath );
|
984 |
-
}
|
985 |
-
}
|
986 |
-
// If webp file existed, that one as well.
|
987 |
-
$this->rename_webp_file_if_exist( $meta_old_filepath, $old_ext, $meta_new_filepath,
|
988 |
-
$new_ext, $case_issue, $force_rename, $post );
|
989 |
-
|
990 |
-
// Rename meta file
|
991 |
-
if ( !$this->rename_file( $meta_old_filepath, $meta_new_filepath, $case_issue ) && !$force_rename ) {
|
992 |
-
$this->log( "🚫 File $meta_old_filepath ➡️ $meta_new_filepath" );
|
993 |
-
return $post;
|
994 |
-
}
|
995 |
-
|
996 |
-
$meta['sizes'][$size]['file'] = $meta_new_filename;
|
997 |
-
foreach ( $meta['sizes'] as $s => $m ) {
|
998 |
-
// Detect if another size has exactly the same filename
|
999 |
-
if ( !isset( $meta['sizes'][$s]['file'] ) )
|
1000 |
-
continue;
|
1001 |
-
if ( $meta['sizes'][$s]['file'] == $meta_old_filename ) {
|
1002 |
-
$this->log( "✅ Updated $s based on $size, as they use the same file (probably same size)." );
|
1003 |
-
$meta['sizes'][$s]['file'] = $meta_new_filename;
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
// Success, call other plugins
|
1008 |
-
$this->log( "✅ File $meta_old_filepath ➡️ $meta_new_filepath" );
|
1009 |
-
do_action( 'mfrh_path_renamed', $post, $meta_old_filepath, $meta_new_filepath );
|
1010 |
-
|
1011 |
-
}
|
1012 |
-
}
|
1013 |
-
}
|
1014 |
-
else {
|
1015 |
-
$orig_attachment_url = wp_get_attachment_url( $id );
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
// Update Renamer Meta
|
1019 |
-
delete_post_meta( $id, '_require_file_renaming' ); // This media doesn't require renaming anymore
|
1020 |
-
if ( $manual ) // If it was renamed manually (including undo), lock the file
|
1021 |
-
add_post_meta( $id, '_manual_file_renaming', true, true );
|
1022 |
-
|
1023 |
-
// Update DB: Media and Metadata
|
1024 |
-
if ( $meta )
|
1025 |
-
wp_update_attachment_metadata( $id, $meta );
|
1026 |
-
update_attached_file( $id, $new_filepath );
|
1027 |
-
clean_post_cache( $id ); // TODO: Would be good to know what this WP function actually does (might be useless)
|
1028 |
-
|
1029 |
-
// Rename slug/permalink
|
1030 |
-
if ( get_option( "mfrh_rename_slug" ) ) {
|
1031 |
-
$oldslug = $post['post_name'];
|
1032 |
-
$info = mfrh_pathinfo( $new_filepath );
|
1033 |
-
$newslug = preg_replace( '/\\.[^.\\s]{3,4}$/', '', $info['basename'] );
|
1034 |
-
$post['post_name'] = $newslug;
|
1035 |
-
if ( wp_update_post( $post ) )
|
1036 |
-
$this->log( "🚀 Slug $oldslug ➡️ $newslug" );
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
// Post actions
|
1040 |
-
$this->call_post_actions( $id, $post, $meta, $has_thumbnails, $orig_image_urls, $orig_attachment_url );
|
1041 |
-
do_action( 'mfrh_media_renamed', $post, $old_filepath, $new_filepath, $undo );
|
1042 |
-
return $post;
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
/**
|
1046 |
-
* Rename webp file only if existed.
|
1047 |
-
*/
|
1048 |
-
function rename_webp_file_if_exist( $old_filepath, $old_ext, $new_finepath,
|
1049 |
-
$new_ext, $case_issue, $force_rename, $post ) {
|
1050 |
-
|
1051 |
-
// Two WebP patterns exist: filename.webp and filename.ext.webp
|
1052 |
-
|
1053 |
-
if ( $old_ext === 'pdf' & $new_ext === 'pdf' ) {
|
1054 |
-
$old_ext = 'jpg';
|
1055 |
-
$new_ext = 'jpg';
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
$webps = [
|
1059 |
-
[
|
1060 |
-
'old' => $this->str_replace( '.' . $old_ext, '.webp', $old_filepath ),
|
1061 |
-
'new' => $this->str_replace( '.' . $new_ext, '.webp', $new_finepath ),
|
1062 |
-
],
|
1063 |
-
[
|
1064 |
-
'old' => $this->str_replace( '.' . $old_ext, '.' . $old_ext . '.webp', $old_filepath ),
|
1065 |
-
'new' => $this->str_replace( '.' . $new_ext, '.' . $new_ext . '.webp', $new_finepath ),
|
1066 |
-
],
|
1067 |
-
];
|
1068 |
-
|
1069 |
-
// // TODO: Without this check, the code following actually doesn't work with PDF Thumbnails (because the old_ext and new_ext doesn't correspond to jpg, which is used for the thumbnails in the PDF case, and not .pdf). In fact, the code after that should be rewritten.
|
1070 |
-
// if ( !preg_match( '/\.webp$/', $old_filepath ) ) {
|
1071 |
-
// return;
|
1072 |
-
// }
|
1073 |
-
|
1074 |
-
foreach ( $webps as $webp ) {
|
1075 |
-
$is_webp = preg_match( '/\.webp$/', $webp['old'] );
|
1076 |
-
$old_file_ok = $is_webp && file_exists( $webp['old'] );
|
1077 |
-
$new_file_ok = ( ( !file_exists( $webp['new'] ) ) || is_writable( $webp['new'] ) );
|
1078 |
-
|
1079 |
-
if ( $old_file_ok && $new_file_ok ) {
|
1080 |
-
// Rename webp file
|
1081 |
-
if ( !$this->rename_file( $webp['old'], $webp['new'], $case_issue ) && !$force_rename ) {
|
1082 |
-
$this->log( "🚫 WebP $webp[old] ➡️ $webp[new]" );
|
1083 |
-
return $post;
|
1084 |
-
}
|
1085 |
-
$this->log( "✅ WebP $webp[old] ➡️ $webp[new]" );
|
1086 |
-
do_action( 'mfrh_path_renamed', $post, $webp['old'], $webp['new'] );
|
1087 |
-
}
|
1088 |
-
}
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
/**
|
1092 |
-
* Locks a post to be manual-rename only
|
1093 |
-
* @param int|WP_Post $post The post to lock
|
1094 |
-
* @return True on success, false on failure
|
1095 |
-
*/
|
1096 |
-
function lock( $post ) {
|
1097 |
-
//TODO: We should probably only take an ID as the argument
|
1098 |
-
$id = $post instanceof WP_Post ? $post->ID : $post;
|
1099 |
-
delete_post_meta( $id, '_require_file_renaming' );
|
1100 |
-
update_post_meta( $id, '_manual_file_renaming', true, true );
|
1101 |
-
return true;
|
1102 |
-
}
|
1103 |
-
|
1104 |
-
/**
|
1105 |
-
* Unlocks a locked post
|
1106 |
-
* @param int|WP_Post $post The post to unlock
|
1107 |
-
* @return True on success, false on failure
|
1108 |
-
*/
|
1109 |
-
function unlock( $post ) {
|
1110 |
-
delete_post_meta( $post instanceof WP_Post ? $post->ID : $post, '_manual_file_renaming' );
|
1111 |
-
return true;
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
/**
|
1115 |
-
* Determines whether a post is locked
|
1116 |
-
* @param int|WP_Post $post The post to check
|
1117 |
-
* @return Boolean
|
1118 |
-
*/
|
1119 |
-
function is_locked( $post ) {
|
1120 |
-
return get_post_meta( $post instanceof WP_Post ? $post->ID : $post, '_manual_file_renaming', true ) === true;
|
1121 |
-
}
|
1122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/init.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( class_exists( 'MeowPro_MFRH_Core' ) && class_exists( 'Meow_MFRH_Core' ) ) {
|
4 |
-
function mfrh_admin_notices() {
|
5 |
-
echo '<div class="error"><p>Thanks for installing the Pro version of Media File Renamer :) However, the free version is still enabled. Please disable or uninstall it.</p></div>';
|
6 |
-
}
|
7 |
-
add_action( 'admin_notices', 'mfrh_admin_notices' );
|
8 |
-
return;
|
9 |
-
}
|
10 |
-
|
11 |
-
spl_autoload_register(function ( $class ) {
|
12 |
-
$necessary = true;
|
13 |
-
$file = null;
|
14 |
-
if ( strpos( $class, 'Meow_MFRH' ) !== false ) {
|
15 |
-
$file = MFRH_PATH . '/classes/' . str_replace( 'meow_mfrh_', '', strtolower( $class ) ) . '.php';
|
16 |
-
}
|
17 |
-
else if ( strpos( $class, 'MeowCommon_Classes_' ) !== false ) {
|
18 |
-
$file = MFRH_PATH . '/common/classes/' . str_replace( 'meowcommon_classes_', '', strtolower( $class ) ) . '.php';
|
19 |
-
}
|
20 |
-
else if ( strpos( $class, 'MeowCommon_' ) !== false ) {
|
21 |
-
$file = MFRH_PATH . '/common/' . str_replace( 'meowcommon_', '', strtolower( $class ) ) . '.php';
|
22 |
-
}
|
23 |
-
else if ( strpos( $class, 'MeowPro_MFRH' ) !== false ) {
|
24 |
-
$necessary = false;
|
25 |
-
$file = MFRH_PATH . '/premium/' . str_replace( 'meowpro_mfrh_', '', strtolower( $class ) ) . '.php';
|
26 |
-
}
|
27 |
-
if ( $file ) {
|
28 |
-
if ( !$necessary && !file_exists( $file ) ) {
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
require( $file );
|
32 |
-
}
|
33 |
-
});
|
34 |
-
|
35 |
-
require_once( MFRH_PATH . '/classes/api.php');
|
36 |
-
require_once( MFRH_PATH . '/common/helpers.php');
|
37 |
-
|
38 |
-
// In admin or Rest API request (REQUEST URI begins with '/wp-json/')
|
39 |
-
if ( is_admin() || MeowCommon_Helpers::is_rest() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
40 |
-
global $mfrh_core;
|
41 |
-
$mfrh_core = new Meow_MFRH_Core();
|
42 |
-
}
|
43 |
-
|
44 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/plugins/beaverbuilder.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Beaver Builder: Update the Metadata, clear the cache
|
4 |
-
// https://www.wpbeaverbuilder.com/frequently-asked-questions/
|
5 |
-
|
6 |
-
add_action( 'mfrh_url_renamed', 'mfrh_beaver_builder', 10, 3 );
|
7 |
-
|
8 |
-
function mfrh_beaver_builder( $post, $orig_image_url, $new_image_url ) {
|
9 |
-
global $wpdb;
|
10 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->postmeta
|
11 |
-
SET meta_value = REPLACE(meta_value, 's:%d:\"$orig_image_url', 's:%d:\"$new_image_url')
|
12 |
-
WHERE meta_key = '_fl_builder_data'
|
13 |
-
OR meta_key = '_fl_builder_draft'",
|
14 |
-
strlen( $orig_image_url ), strlen( $new_image_url ) );
|
15 |
-
$query_revert = $wpdb->prepare( "UPDATE $wpdb->postmeta
|
16 |
-
SET meta_value = REPLACE(meta_value, 's:%d:\"$new_image_url', 's:%d:\"$orig_image_url')
|
17 |
-
WHERE meta_key = '_fl_builder_data'
|
18 |
-
OR meta_key = '_fl_builder_draft'",
|
19 |
-
strlen( $new_image_url ), strlen( $orig_image_url ) );
|
20 |
-
$wpdb->query( $query );
|
21 |
-
global $mfrh_core;
|
22 |
-
$mfrh_core->log_sql( $query, $query_revert );
|
23 |
-
$mfrh_core->log( "Beaver Metadata like $orig_image_url was replaced by $new_image_url." );
|
24 |
-
|
25 |
-
// Clear cache
|
26 |
-
$uploads = wp_upload_dir();
|
27 |
-
$cache = trailingslashit( $uploads['basedir'] ) . 'bb-plugin';
|
28 |
-
if ( file_exists( $cache ) )
|
29 |
-
Meow_MFRH_Core::rmdir_recursive( $cache );
|
30 |
-
else {
|
31 |
-
$cache = trailingslashit( $uploads['basedir'] ) . 'fl-builder';
|
32 |
-
if ( file_exists( $cache ) )
|
33 |
-
Meow_MFRH_Core::rmdir_recursive( $cache );
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/plugins/custom.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// EXAMPLES TO USE ACTIONS AND FILTERS
|
4 |
-
// For help about this file, check:
|
5 |
-
// https://meowapps.com/media-file-renamer/faq/
|
6 |
-
|
7 |
-
// HANDLE THE RENAMING
|
8 |
-
// $new is the proposed filename by Media File Renamer (without extension)
|
9 |
-
// $old is the current filename (without extension)
|
10 |
-
// $post is the attachment/media
|
11 |
-
// return: your ideal filename
|
12 |
-
// =============================================================================
|
13 |
-
// add_filter( 'mfrh_new_filename', 'add_hello_in_front_of_filenames', 10, 3 );
|
14 |
-
// function add_hello_in_front_of_filenames( $new, $old, $post ) {
|
15 |
-
// return $new . "-offbeat";
|
16 |
-
// }
|
17 |
-
|
18 |
-
// REPLACE CHARACTER/STRING IN THE FILENAMES
|
19 |
-
// =============================================================================
|
20 |
-
// add_filter( 'mfrh_replace_rules', 'replace_s_by_z', 10, 1 );
|
21 |
-
//
|
22 |
-
// function replace_s_by_z( $rules ) {
|
23 |
-
// $rules['s'] = 'z';
|
24 |
-
// return $rules;
|
25 |
-
// }
|
26 |
-
|
27 |
-
// DO SOMETHING (UPDATES FOR INSTANCE) WHEN THE NEW URL IS READY
|
28 |
-
// =============================================================================
|
29 |
-
// add_action( 'mfrh_url_renamed', 'url_of_media_was_modified', 10, 3 );
|
30 |
-
//
|
31 |
-
// function url_of_media_was_modified( $post, $orig_image_url, $new_image_url ) {
|
32 |
-
// global $wpdb;
|
33 |
-
// $query = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = REPLACE(meta_value, '%s', '%s');", $orig_image_url, $new_image_url );
|
34 |
-
// $query_revert = $wpdb->prepare( "UPDATE $wpdb->postmeta
|
35 |
-
// SET meta_value = REPLACE(meta_value, '%s', '%s');", $new_image_url, $orig_image_url );
|
36 |
-
// $wpdb->query( $query );
|
37 |
-
// $this->log_sql( $query, $query_revert );
|
38 |
-
// $this->log( "Metadata like $orig_image_url were replaced by $new_image_url." );
|
39 |
-
// }
|
40 |
-
|
41 |
-
// DO SOMETHING (UPDATES FOR INSTANCE) WHEN THE FILE IS READY
|
42 |
-
// =============================================================================
|
43 |
-
// add_action( 'mfrh_media_renamed', 'filepath_of_media_was_modified', 10, 3 );
|
44 |
-
//
|
45 |
-
// function filepath_of_media_was_modified( $post, $orig_image_url, $new_image_url ) {
|
46 |
-
// $original_filename = get_post_meta( $post['ID'], '_original_filename', true );
|
47 |
-
// }
|
48 |
-
// =============================================================================
|
49 |
-
|
50 |
-
// RENAME THE IMAGES IN A WOOCOMMERCE PRODUCT GALLERY EVERY TIME THE PRODUCT IS MODIFIED
|
51 |
-
// =============================================================================
|
52 |
-
// add_action( 'woocommerce_update_product', 'woocommerce_product_was_modified', 10, 1 );
|
53 |
-
|
54 |
-
// function woocommerce_product_was_modified( $productId ) {
|
55 |
-
// $wcProduct = new WC_Product( $productId );
|
56 |
-
// $images = array();
|
57 |
-
// if ( ( $mainImageId = intval( $wcProduct->get_image_id() ) ) !== 0 ) {
|
58 |
-
// $images[] = $mainImageId;
|
59 |
-
// }
|
60 |
-
// $galleryImages = $wcProduct->get_gallery_image_ids();
|
61 |
-
// foreach ( $galleryImages as $imageId ) {
|
62 |
-
// $images[] = intval( $imageId );
|
63 |
-
// }
|
64 |
-
// foreach ( $images as $imageId ) {
|
65 |
-
// if ( $imageId != 0 ) {
|
66 |
-
// mfrh_rename( $imageId );
|
67 |
-
// }
|
68 |
-
// }
|
69 |
-
// return true;
|
70 |
-
// }
|
71 |
-
// =============================================================================
|
72 |
-
|
73 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/plugins/unused_woocommerce.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
add_action( 'added_post_meta', 'mfrh_wc_update_meta', 10, 4 );
|
4 |
-
add_action( 'updated_post_meta', 'mfrh_wc_update_meta', 10, 4 );
|
5 |
-
|
6 |
-
function mfrh_wc_update_meta( $meta_id, $post_id, $meta_key, $meta_value )
|
7 |
-
{
|
8 |
-
if ( '_product_image_gallery' == $meta_key ) {
|
9 |
-
$ids = explode( ',', $meta_value );
|
10 |
-
foreach ( $ids as $id ) {
|
11 |
-
wp_update_post( array( 'ID' => $id, 'post_parent' => $post_id ) );
|
12 |
-
global $mfrh_core;
|
13 |
-
$mfrh_core->rename( $id );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/plugins/wpml.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Thanks to David García from WPML
|
4 |
-
|
5 |
-
add_action( 'mfrh_media_renamed', 'mfrh_wpml_update_translations', 10, 4 );
|
6 |
-
|
7 |
-
function mfrh_wpml_update_translations( $post, $old_filepath, $new_filepath, $undo ) {
|
8 |
-
$args = array('element_id' => $post['ID'], 'element_type' => 'attachment' );
|
9 |
-
$info = apply_filters( 'wpml_element_language_details', null, $args );
|
10 |
-
if ( ! empty( $info->trid ) ) {
|
11 |
-
$translations = apply_filters( 'wpml_get_element_translations', NULL, $info->trid, 'post_attachment' );
|
12 |
-
foreach ( $translations as $translation ) {
|
13 |
-
if ( $post['ID'] != $translation->element_id ) {
|
14 |
-
update_post_meta( $translation->element_id, '_wp_attached_file', get_post_meta( $post['ID'],
|
15 |
-
'_wp_attached_file', true ) );
|
16 |
-
update_post_meta( $translation->element_id, '_wp_attachment_metadata', get_post_meta( $post['ID'],
|
17 |
-
'_wp_attachment_metadata', true ) );
|
18 |
-
}
|
19 |
-
}
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/rest.php
DELETED
@@ -1,564 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Meow_MFRH_Rest
|
4 |
-
{
|
5 |
-
private $core = null;
|
6 |
-
private $admin = null;
|
7 |
-
private $namespace = 'media-file-renamer/v1';
|
8 |
-
|
9 |
-
public function __construct( $core ) {
|
10 |
-
$this->core = $core;
|
11 |
-
$this->admin = $core->admin;
|
12 |
-
|
13 |
-
// FOR DEBUG
|
14 |
-
// For experiencing the UI behavior on a slower install.
|
15 |
-
// sleep(1);
|
16 |
-
// For experiencing the UI behavior on a buggy install.
|
17 |
-
// trigger_error( "Error", E_USER_ERROR);
|
18 |
-
// trigger_error( "Warning", E_USER_WARNING);
|
19 |
-
// trigger_error( "Notice", E_USER_NOTICE);
|
20 |
-
// trigger_error( "Deprecated", E_USER_DEPRECATED);
|
21 |
-
|
22 |
-
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
23 |
-
}
|
24 |
-
|
25 |
-
function rest_api_init() {
|
26 |
-
// SETTINGS
|
27 |
-
register_rest_route( $this->namespace, '/update_option', array(
|
28 |
-
'methods' => 'POST',
|
29 |
-
'permission_callback' => '__return_true',
|
30 |
-
'callback' => array( $this, 'rest_update_option' )
|
31 |
-
) );
|
32 |
-
register_rest_route( $this->namespace, '/all_settings', array(
|
33 |
-
'methods' => 'GET',
|
34 |
-
'permission_callback' => '__return_true',
|
35 |
-
'callback' => array( $this, 'rest_all_settings' )
|
36 |
-
) );
|
37 |
-
|
38 |
-
// STATS & LISTING
|
39 |
-
register_rest_route( $this->namespace, '/stats', array(
|
40 |
-
'methods' => 'GET',
|
41 |
-
'permission_callback' => '__return_true',
|
42 |
-
'callback' => array( $this, 'rest_get_stats' )
|
43 |
-
) );
|
44 |
-
register_rest_route( $this->namespace, '/media', array(
|
45 |
-
'methods' => 'GET',
|
46 |
-
'permission_callback' => '__return_true',
|
47 |
-
'callback' => array( $this, 'rest_media' ),
|
48 |
-
'args' => array(
|
49 |
-
'limit' => array( 'required' => false, 'default' => 10 ),
|
50 |
-
'skip' => array( 'required' => false, 'default' => 20 ),
|
51 |
-
'filterBy' => array( 'required' => false, 'default' => 'all' ),
|
52 |
-
'orderBy' => array( 'required' => false, 'default' => 'id' ),
|
53 |
-
'order' => array( 'required' => false, 'default' => 'desc' ),
|
54 |
-
'search' => array( 'required' => false ),
|
55 |
-
'offset' => array( 'required' => false ),
|
56 |
-
'order' => array( 'required' => false ),
|
57 |
-
)
|
58 |
-
) );
|
59 |
-
register_rest_route( $this->namespace, '/analyze', array(
|
60 |
-
'methods' => 'POST',
|
61 |
-
'permission_callback' => '__return_true',
|
62 |
-
'callback' => array( $this, 'rest_analyze' )
|
63 |
-
) );
|
64 |
-
register_rest_route( $this->namespace, '/auto_attach', array(
|
65 |
-
'methods' => 'POST',
|
66 |
-
'permission_callback' => '__return_true',
|
67 |
-
'callback' => array( $this, 'rest_auto_attach' )
|
68 |
-
) );
|
69 |
-
register_rest_route( $this->namespace, '/get_all_ids', array(
|
70 |
-
'methods' => 'POST',
|
71 |
-
'permission_callback' => '__return_true',
|
72 |
-
'callback' => array( $this, 'rest_get_all_ids' )
|
73 |
-
) );
|
74 |
-
register_rest_route( $this->namespace, '/get_all_post_ids', array(
|
75 |
-
'methods' => 'POST',
|
76 |
-
'permission_callback' => '__return_true',
|
77 |
-
'callback' => array( $this, 'rest_get_all_post_ids' )
|
78 |
-
) );
|
79 |
-
|
80 |
-
// ACTIONS
|
81 |
-
register_rest_route( $this->namespace, '/set_lock', array(
|
82 |
-
'methods' => 'POST',
|
83 |
-
'permission_callback' => '__return_true',
|
84 |
-
'callback' => array( $this, 'rest_set_lock' )
|
85 |
-
) );
|
86 |
-
register_rest_route( $this->namespace, '/rename', array(
|
87 |
-
'methods' => 'POST',
|
88 |
-
'permission_callback' => '__return_true',
|
89 |
-
'callback' => array( $this, 'rest_rename' )
|
90 |
-
) );
|
91 |
-
register_rest_route( $this->namespace, '/move', array(
|
92 |
-
'methods' => 'POST',
|
93 |
-
'permission_callback' => '__return_true',
|
94 |
-
'callback' => array( $this, 'rest_move' )
|
95 |
-
) );
|
96 |
-
register_rest_route( $this->namespace, '/undo', array(
|
97 |
-
'methods' => 'POST',
|
98 |
-
'permission_callback' => '__return_true',
|
99 |
-
'callback' => array( $this, 'rest_undo' )
|
100 |
-
) );
|
101 |
-
register_rest_route( $this->namespace, '/status', array(
|
102 |
-
'methods' => 'POST',
|
103 |
-
'permission_callback' => '__return_true',
|
104 |
-
'callback' => array( $this, 'rest_status' )
|
105 |
-
) );
|
106 |
-
|
107 |
-
// LOGS
|
108 |
-
register_rest_route( $this->namespace, '/refresh_logs', array(
|
109 |
-
'methods' => 'POST',
|
110 |
-
'permission_callback' => '__return_true',
|
111 |
-
'callback' => array( $this, 'refresh_logs' )
|
112 |
-
) );
|
113 |
-
register_rest_route( $this->namespace, '/clear_logs', array(
|
114 |
-
'methods' => 'POST',
|
115 |
-
'permission_callback' => '__return_true',
|
116 |
-
'callback' => array( $this, 'clear_logs' )
|
117 |
-
) );
|
118 |
-
}
|
119 |
-
|
120 |
-
function refresh_logs() {
|
121 |
-
$data = "No data.";
|
122 |
-
if ( file_exists( MFRH_PATH . '/logs/media-file-renamer.log' ) ) {
|
123 |
-
$data = file_get_contents( MFRH_PATH . '/logs/media-file-renamer.log' );
|
124 |
-
}
|
125 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
|
126 |
-
}
|
127 |
-
|
128 |
-
function clear_logs() {
|
129 |
-
unlink( MFRH_PATH . '/logs/media-file-renamer.log' );
|
130 |
-
return new WP_REST_Response( [ 'success' => true ], 200 );
|
131 |
-
}
|
132 |
-
|
133 |
-
function rest_analyze( $request ) {
|
134 |
-
$params = $request->get_json_params();
|
135 |
-
$mediaIds = isset( $params['mediaIds'] ) ? (array)$params['mediaIds'] : null;
|
136 |
-
$mediaId = isset( $params['mediaId'] ) ? (int)$params['mediaId'] : null;
|
137 |
-
$data = array();
|
138 |
-
if ( !empty( $mediaIds ) ) {
|
139 |
-
foreach ( $mediaIds as $mediaId ) {
|
140 |
-
$entry = $this->get_media_status_one( $mediaId );
|
141 |
-
array_push( $data, $entry );
|
142 |
-
}
|
143 |
-
}
|
144 |
-
else if ( !empty( $mediaId ) ) {
|
145 |
-
$data = $this->get_media_status_one( $mediaId );
|
146 |
-
}
|
147 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
|
148 |
-
}
|
149 |
-
|
150 |
-
function rest_auto_attach( $request ) {
|
151 |
-
$params = $request->get_json_params();
|
152 |
-
$postIds = isset( $params['postIds'] ) ? (array)$params['postIds'] : null;
|
153 |
-
$postId = isset( $params['postId'] ) ? (int)$params['postId'] : null;
|
154 |
-
if ( !empty( $postIds ) ) {
|
155 |
-
foreach ( $postIds as $postId ) {
|
156 |
-
$this->do_auto_attach( $postId );
|
157 |
-
}
|
158 |
-
}
|
159 |
-
else if ( !empty( $postId ) ) {
|
160 |
-
$this->do_auto_attach( $postId );
|
161 |
-
}
|
162 |
-
return new WP_REST_Response( [ 'success' => true ], 200 );
|
163 |
-
}
|
164 |
-
|
165 |
-
function rest_get_all_ids( $request ) {
|
166 |
-
global $wpdb;
|
167 |
-
$params = $request->get_json_params();
|
168 |
-
$unlockedOnly = isset( $params['unlockedOnly'] ) ? (bool)$params['unlockedOnly'] : false;
|
169 |
-
if ( $unlockedOnly ) {
|
170 |
-
$ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts p
|
171 |
-
LEFT JOIN $wpdb->postmeta pm ON p.ID = pm.post_id
|
172 |
-
AND pm.meta_key='_manual_file_renaming'
|
173 |
-
WHERE post_type='attachment'
|
174 |
-
AND post_status='inherit'
|
175 |
-
AND pm.meta_value IS NULL"
|
176 |
-
);
|
177 |
-
}
|
178 |
-
else {
|
179 |
-
$ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts p
|
180 |
-
WHERE post_type='attachment'
|
181 |
-
AND post_status='inherit'"
|
182 |
-
);
|
183 |
-
}
|
184 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $ids ], 200 );
|
185 |
-
}
|
186 |
-
|
187 |
-
function rest_get_all_post_ids() {
|
188 |
-
global $wpdb;
|
189 |
-
$ids = $wpdb->get_col( "SELECT p.ID FROM $wpdb->posts p
|
190 |
-
WHERE p.post_status NOT IN ('inherit', 'trash', 'auto-draft')
|
191 |
-
AND p.post_type NOT IN ('attachment', 'shop_order', 'shop_order_refund', 'nav_menu_item', 'revision', 'auto-draft', 'wphb_minify_group', 'customize_changeset', 'oembed_cache', 'nf_sub')
|
192 |
-
AND p.post_type NOT LIKE 'dlssus%'
|
193 |
-
AND p.post_type NOT LIKE 'ml-slide%'
|
194 |
-
AND p.post_type NOT LIKE '%acf-%'
|
195 |
-
AND p.post_type NOT LIKE '%edd%'"
|
196 |
-
);
|
197 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $ids ], 200 );
|
198 |
-
}
|
199 |
-
|
200 |
-
function rest_status( $request ) {
|
201 |
-
$params = $request->get_json_params();
|
202 |
-
$mediaId = (int)$params['mediaId'];
|
203 |
-
$entry = $this->get_media_status_one( $mediaId );
|
204 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $entry ], 200 );
|
205 |
-
}
|
206 |
-
|
207 |
-
function rest_rename( $request ) {
|
208 |
-
$params = $request->get_json_params();
|
209 |
-
$mediaId = (int)$params['mediaId'];
|
210 |
-
$filename = isset( $params['filename'] ) ? (string)$params['filename'] : null;
|
211 |
-
$res = $this->core->rename( $mediaId, $filename );
|
212 |
-
$entry = $this->get_media_status_one( $mediaId );
|
213 |
-
return new WP_REST_Response( [ 'success' => !!$res, 'data' => $entry ], 200 );
|
214 |
-
}
|
215 |
-
|
216 |
-
function rest_move( $request ) {
|
217 |
-
$params = $request->get_json_params();
|
218 |
-
$mediaId = (int)$params['mediaId'];
|
219 |
-
$newPath = isset( $params['newPath'] ) ? (string)$params['newPath'] : null;
|
220 |
-
$res = $this->core->move( $mediaId, $newPath );
|
221 |
-
$entry = $this->get_media_status_one( $mediaId );
|
222 |
-
return new WP_REST_Response( [ 'success' => !!$res, 'data' => $entry ], 200 );
|
223 |
-
}
|
224 |
-
|
225 |
-
function rest_undo( $request ) {
|
226 |
-
$params = $request->get_json_params();
|
227 |
-
$mediaId = (int)$params['mediaId'];
|
228 |
-
$res = $this->core->undo( $mediaId );
|
229 |
-
$entry = $this->get_media_status_one( $mediaId );
|
230 |
-
return new WP_REST_Response( [ 'success' => !!$res, 'data' => $entry ], 200 );
|
231 |
-
}
|
232 |
-
|
233 |
-
function rest_set_lock( $request ) {
|
234 |
-
$params = $request->get_json_params();
|
235 |
-
$lock = (boolean)$params['lock'];
|
236 |
-
$mediaIds = isset( $params['mediaIds'] ) ? (array)$params['mediaIds'] : null;
|
237 |
-
$mediaId = isset( $params['mediaId'] ) ? (int)$params['mediaId'] : null;
|
238 |
-
$data = null;
|
239 |
-
if ( !empty( $mediaIds ) ) {
|
240 |
-
foreach ( $mediaIds as $mediaId ) {
|
241 |
-
$lock ? $this->core->lock( $mediaId ) : $this->core->unlock( $mediaId );
|
242 |
-
}
|
243 |
-
$data = 'N/A';
|
244 |
-
}
|
245 |
-
else if ( !empty( $mediaId ) ) {
|
246 |
-
$lock ? $this->core->lock( $mediaId ) : $this->core->unlock( $mediaId );
|
247 |
-
$data = $this->get_media_status_one( $mediaId );
|
248 |
-
}
|
249 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $data ], 200 );
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Organize the data of the entry.
|
254 |
-
* It is used by get_media_status and get_media_status_one.
|
255 |
-
*
|
256 |
-
* @param [type] $entry
|
257 |
-
* @return void
|
258 |
-
*/
|
259 |
-
function consolidate_media_status( &$entry ) {
|
260 |
-
$entry->ID = (int)$entry->ID;
|
261 |
-
$entry->post_parent = !empty( $entry->post_parent ) ? (int)$entry->post_parent : null;
|
262 |
-
$entry->post_parent_title = !empty( $entry->post_parent ) ? get_the_title( $entry->post_parent ) : null;
|
263 |
-
$entry->metadata = unserialize( $entry->metadata );
|
264 |
-
$entry->thumbnail_url = wp_get_attachment_thumb_url( $entry->ID );
|
265 |
-
$entry->current_filename = pathinfo( $entry->current_filename, PATHINFO_BASENAME );
|
266 |
-
$entry->locked = $entry->locked === '1';
|
267 |
-
$entry->pending = $entry->pending === '1';
|
268 |
-
|
269 |
-
$entry->proposed_filename = null;
|
270 |
-
if ( !$entry->locked ) {
|
271 |
-
$output = null;
|
272 |
-
// TODO: We should optimize this check_attachment function one day.
|
273 |
-
$this->core->check_attachment( get_post( $entry->ID, ARRAY_A ), $output );
|
274 |
-
if ( isset( $output['ideal_filename'] ) ) {
|
275 |
-
$entry->ideal_filename = $output['ideal_filename'];
|
276 |
-
}
|
277 |
-
if ( isset( $output['proposed_filename'] ) ) {
|
278 |
-
$entry->proposed_filename = $output['proposed_filename'];
|
279 |
-
$entry->proposed_filename_exists = $output['proposed_filename_exists'];
|
280 |
-
}
|
281 |
-
//error_log( print_r( $output, 1 ) );
|
282 |
-
}
|
283 |
-
return $entry;
|
284 |
-
}
|
285 |
-
|
286 |
-
function count_locked() {
|
287 |
-
global $wpdb;
|
288 |
-
return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts p
|
289 |
-
INNER JOIN $wpdb->postmeta pm ON pm.post_id = p.ID
|
290 |
-
WHERE pm.meta_key = '_manual_file_renaming'"
|
291 |
-
);
|
292 |
-
}
|
293 |
-
|
294 |
-
function count_pending() {
|
295 |
-
global $wpdb;
|
296 |
-
return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts p
|
297 |
-
INNER JOIN $wpdb->postmeta pm ON pm.post_id = p.ID
|
298 |
-
WHERE pm.meta_key = '_require_file_renaming'"
|
299 |
-
);
|
300 |
-
}
|
301 |
-
|
302 |
-
function count_renamed() {
|
303 |
-
global $wpdb;
|
304 |
-
return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts p
|
305 |
-
INNER JOIN $wpdb->postmeta pm ON pm.post_id = p.ID
|
306 |
-
WHERE pm.meta_key = '_original_filename'"
|
307 |
-
);
|
308 |
-
}
|
309 |
-
|
310 |
-
function count_all() {
|
311 |
-
global $wpdb;
|
312 |
-
return (int)$wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts p
|
313 |
-
WHERE post_type='attachment'
|
314 |
-
AND post_status='inherit'"
|
315 |
-
);
|
316 |
-
}
|
317 |
-
|
318 |
-
function rest_get_stats() {
|
319 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => array(
|
320 |
-
'pending' => $this->count_pending(),
|
321 |
-
'renamed' => $this->count_renamed(),
|
322 |
-
'locked' => $this->count_locked(),
|
323 |
-
'all' => $this->count_all()
|
324 |
-
) ], 200 );
|
325 |
-
}
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Get the status for many Media IDs.
|
329 |
-
*
|
330 |
-
* @param integer $skip
|
331 |
-
* @param integer $limit
|
332 |
-
* @return void
|
333 |
-
*/
|
334 |
-
function get_media_status( $skip = 0, $limit = 10, $filterBy, $orderBy, $order ) {
|
335 |
-
global $wpdb;
|
336 |
-
// I used this before to gather the metadata in a json object
|
337 |
-
// JSON_OBJECTAGG(pm.meta_key, pm.meta_value) as meta
|
338 |
-
// That was cool, but I prefer the MAX technique in order to apply filters
|
339 |
-
$havingSql = '';
|
340 |
-
if ( $filterBy === 'pending' ) {
|
341 |
-
$havingSql = 'HAVING pending IS NOT NULL';
|
342 |
-
}
|
343 |
-
else if ( $filterBy === 'renamed' ) {
|
344 |
-
$havingSql = 'HAVING original_filename IS NOT NULL';
|
345 |
-
}
|
346 |
-
else if ( $filterBy === 'locked' ) {
|
347 |
-
$havingSql = 'HAVING locked IS NOT NULL';
|
348 |
-
}
|
349 |
-
$orderSql = 'ORDER BY p.ID DESC';
|
350 |
-
if ($orderBy === 'post_title') {
|
351 |
-
$orderSql = 'ORDER BY post_title ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
|
352 |
-
}
|
353 |
-
else if ($orderBy === 'post_parent') {
|
354 |
-
$orderSql = 'ORDER BY post_parent ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
|
355 |
-
}
|
356 |
-
else if ($orderBy === 'current_filename') {
|
357 |
-
$orderSql = 'ORDER BY current_filename ' . ( $order === 'asc' ? 'ASC' : 'DESC' );
|
358 |
-
}
|
359 |
-
$entries = $wpdb->get_results(
|
360 |
-
$wpdb->prepare( "SELECT p.ID, p.post_title, p.post_parent,
|
361 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attached_file' THEN pm.meta_value END) AS current_filename,
|
362 |
-
MAX(CASE WHEN pm.meta_key = '_original_filename' THEN pm.meta_value END) AS original_filename,
|
363 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attachment_metadata' THEN pm.meta_value END) AS metadata,
|
364 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attachment_image_alt' THEN pm.meta_value END) AS image_alt,
|
365 |
-
MAX(CASE WHEN pm.meta_key = '_require_file_renaming' THEN pm.meta_value END) AS pending,
|
366 |
-
MAX(CASE WHEN pm.meta_key = '_manual_file_renaming' THEN pm.meta_value END) AS locked
|
367 |
-
FROM $wpdb->posts p
|
368 |
-
INNER JOIN $wpdb->postmeta pm ON pm.post_id = p.ID
|
369 |
-
WHERE post_type='attachment'
|
370 |
-
AND post_status='inherit'
|
371 |
-
AND (pm.meta_key = '_wp_attached_file'
|
372 |
-
OR pm.meta_key = '_original_filename'
|
373 |
-
OR pm.meta_key = '_wp_attachment_metadata'
|
374 |
-
OR pm.meta_key = '_wp_attachment_image_alt'
|
375 |
-
OR pm.meta_key = '_require_file_renaming'
|
376 |
-
OR pm.meta_key = '_manual_file_renaming'
|
377 |
-
)
|
378 |
-
GROUP BY p.ID
|
379 |
-
$havingSql
|
380 |
-
$orderSql
|
381 |
-
LIMIT %d, %d", $skip, $limit
|
382 |
-
)
|
383 |
-
);
|
384 |
-
foreach ( $entries as $entry ) {
|
385 |
-
$this->consolidate_media_status( $entry );
|
386 |
-
}
|
387 |
-
return $entries;
|
388 |
-
}
|
389 |
-
|
390 |
-
/**
|
391 |
-
* Get the status for many Media IDs.
|
392 |
-
*
|
393 |
-
* @param integer $mediaId
|
394 |
-
* @return void
|
395 |
-
*/
|
396 |
-
function get_media_status_one( $mediaId ) {
|
397 |
-
global $wpdb;
|
398 |
-
$entry = $wpdb->get_row(
|
399 |
-
$wpdb->prepare( "SELECT p.ID, p.post_title, p.post_parent,
|
400 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attached_file' THEN pm.meta_value END) AS current_filename,
|
401 |
-
MAX(CASE WHEN pm.meta_key = '_original_filename' THEN pm.meta_value END) AS original_filename,
|
402 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attachment_metadata' THEN pm.meta_value END) AS metadata,
|
403 |
-
MAX(CASE WHEN pm.meta_key = '_wp_attachment_image_alt' THEN pm.meta_value END) AS image_alt,
|
404 |
-
MAX(CASE WHEN pm.meta_key = '_require_file_renaming' THEN pm.meta_value END) AS pending,
|
405 |
-
MAX(CASE WHEN pm.meta_key = '_manual_file_renaming' THEN pm.meta_value END) AS locked
|
406 |
-
FROM $wpdb->posts p
|
407 |
-
INNER JOIN $wpdb->postmeta pm ON pm.post_id = p.ID
|
408 |
-
WHERE p.ID = %d
|
409 |
-
AND post_type='attachment'
|
410 |
-
AND (pm.meta_key = '_wp_attached_file'
|
411 |
-
OR pm.meta_key = '_original_filename'
|
412 |
-
OR pm.meta_key = '_wp_attachment_metadata'
|
413 |
-
OR pm.meta_key = '_wp_attachment_image_alt'
|
414 |
-
OR pm.meta_key = '_require_file_renaming'
|
415 |
-
OR pm.meta_key = '_manual_file_renaming'
|
416 |
-
)
|
417 |
-
GROUP BY p.ID", $mediaId
|
418 |
-
)
|
419 |
-
);
|
420 |
-
return $this->consolidate_media_status( $entry );
|
421 |
-
}
|
422 |
-
|
423 |
-
function rest_media( $request ) {
|
424 |
-
$limit = trim( $request->get_param('limit') );
|
425 |
-
$skip = trim( $request->get_param('skip') );
|
426 |
-
$filterBy = trim( $request->get_param('filterBy') );
|
427 |
-
$orderBy = trim( $request->get_param('orderBy') );
|
428 |
-
$order = trim( $request->get_param('order') );
|
429 |
-
$entries = $this->get_media_status( $skip, $limit, $filterBy, $orderBy, $order );
|
430 |
-
$total = 0;
|
431 |
-
if ( $filterBy == 'pending' ) {
|
432 |
-
$total = $this->count_pending();
|
433 |
-
}
|
434 |
-
else if ( $filterBy == 'renamed' ) {
|
435 |
-
$total = $this->count_renamed();
|
436 |
-
}
|
437 |
-
else if ( $filterBy == 'all' ) {
|
438 |
-
$total = $this->count_all();
|
439 |
-
}
|
440 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $entries, 'total' => $total ], 200 );
|
441 |
-
}
|
442 |
-
|
443 |
-
function rest_all_settings() {
|
444 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $this->admin->get_all_options() ], 200 );
|
445 |
-
}
|
446 |
-
|
447 |
-
function rest_update_option( $request ) {
|
448 |
-
$params = $request->get_json_params();
|
449 |
-
try {
|
450 |
-
$name = $params['name'];
|
451 |
-
$value = is_bool( $params['value'] ) ? ( $params['value'] ? '1' : '' ) : $params['value'];
|
452 |
-
$success = update_option( $name, $value );
|
453 |
-
if ( !$success ) {
|
454 |
-
return new WP_REST_Response([ 'success' => false, 'message' => 'Could not update option.' ], 200 );
|
455 |
-
}
|
456 |
-
$res = $this->validate_updated_option( $name );
|
457 |
-
return new WP_REST_Response([ 'success' => $res['result'], 'message' => $res['message'], 'data' => $value ], 200 );
|
458 |
-
}
|
459 |
-
catch (Exception $e) {
|
460 |
-
return new WP_REST_Response([ 'success' => false, 'message' => $e->getMessage() ], 500 );
|
461 |
-
}
|
462 |
-
}
|
463 |
-
|
464 |
-
function validate_updated_option( $option_name ) {
|
465 |
-
$needsCheckingOptions = [
|
466 |
-
'mfrh_auto_rename',
|
467 |
-
'mfrh_sync_alt',
|
468 |
-
'mfrh_sync_media_title',
|
469 |
-
'mfrh_force_rename',
|
470 |
-
'mfrh_numbered_files'
|
471 |
-
];
|
472 |
-
if ( !in_array( $option_name, $needsCheckingOptions ) ) {
|
473 |
-
return $this->createValidationResult();
|
474 |
-
}
|
475 |
-
|
476 |
-
if ( $option_name === 'mfrh_force_rename' || $option_name === 'mfrh_numbered_files' ) {
|
477 |
-
$force_rename = get_option( 'mfrh_force_rename', false );
|
478 |
-
$numbered_files = get_option( 'mfrh_numbered_files', false );
|
479 |
-
|
480 |
-
if ( !$force_rename || !$numbered_files ) {
|
481 |
-
return $this->createValidationResult();
|
482 |
-
}
|
483 |
-
|
484 |
-
update_option( 'mfrh_force_rename', false, false );
|
485 |
-
return $this->createValidationResult( false, __( 'Force Rename and Numbered Files cannot be used at the same time. Please use Force Rename only when you are trying to repair a broken install. For now, Force Rename has been disabled.', 'media-file-renamer' ));
|
486 |
-
|
487 |
-
}
|
488 |
-
else if ( $option_name === 'mfrh_auto_rename' || $option_name === 'mfrh_sync_alt' ||
|
489 |
-
$option_name ==='mfrh_sync_media_title' ) {
|
490 |
-
if ( $this->core->method !== 'alt_text' && $this->core->method !== 'media_title' ) {
|
491 |
-
return $this->createValidationResult();
|
492 |
-
}
|
493 |
-
|
494 |
-
$sync_alt = get_option( 'mfrh_sync_alt' );
|
495 |
-
if ( $sync_alt && $this->core->method === 'alt_text' ) {
|
496 |
-
update_option( 'mfrh_sync_alt', false, false );
|
497 |
-
return $this->createValidationResult( false, __( 'The option Sync ALT was turned off since it does not make sense to have it with this Auto-Rename mode.', 'media-file-renamer' ));
|
498 |
-
}
|
499 |
-
|
500 |
-
$sync_meta_title = get_option( 'mfrh_sync_media_title' );
|
501 |
-
if ( $sync_meta_title && $this->core->method === 'media_title' ) {
|
502 |
-
update_option( 'mfrh_sync_media_title', false, false );
|
503 |
-
return $this->createValidationResult( false, __( 'The option Sync Media Title was turned off since it does not make sense to have it with this Auto-Rename mode.', 'media-file-renamer' ));
|
504 |
-
}
|
505 |
-
}
|
506 |
-
return $this->createValidationResult();
|
507 |
-
}
|
508 |
-
|
509 |
-
function createValidationResult( $result = true, $message = null) {
|
510 |
-
$message = $message ? $message : __( 'Option updated.', 'media-file-renamer' );
|
511 |
-
return ['result' => $result, 'message' => $message];
|
512 |
-
}
|
513 |
-
|
514 |
-
function do_auto_attach( $postId ) {
|
515 |
-
$this->is_post_type_woocommerce( $postId )
|
516 |
-
? $this->attach_woocommerce( $postId )
|
517 |
-
: $this->attach_thumbnail( $postId );
|
518 |
-
}
|
519 |
-
|
520 |
-
/**
|
521 |
-
* Detect the post type is WooCommerce.
|
522 |
-
* The post types are below, but only use "product" in this plugin.
|
523 |
-
* - product
|
524 |
-
* - shop_order
|
525 |
-
* - shop_coupon
|
526 |
-
* - shop_webhook
|
527 |
-
* @see: https://docs.woocommerce.com/document/installed-taxonomies-post-types/
|
528 |
-
*
|
529 |
-
* @param int $postId
|
530 |
-
* @return bool
|
531 |
-
*/
|
532 |
-
function is_post_type_woocommerce( $postId ) {
|
533 |
-
return get_post_type( $postId ) === 'product';
|
534 |
-
}
|
535 |
-
|
536 |
-
/**
|
537 |
-
* Attach images of the WooCommerce gallery to its post.
|
538 |
-
*
|
539 |
-
* @param int $postId
|
540 |
-
* @return void
|
541 |
-
*/
|
542 |
-
function attach_woocommerce( $postId ) {
|
543 |
-
$product = new WC_product($postId);
|
544 |
-
$mediaIds = $product->get_gallery_image_ids();
|
545 |
-
foreach ( $mediaIds as $mediaId ) {
|
546 |
-
$attachment = array( 'ID' => $mediaId, 'post_parent' => $postId );
|
547 |
-
wp_update_post($attachment);
|
548 |
-
}
|
549 |
-
}
|
550 |
-
|
551 |
-
/**
|
552 |
-
* Attach the thumbnail of the post to its post.
|
553 |
-
*
|
554 |
-
* @param int $postId
|
555 |
-
* @return void
|
556 |
-
*/
|
557 |
-
function attach_thumbnail( $postId ) {
|
558 |
-
$mediaId = get_post_thumbnail_id( $postId );
|
559 |
-
$attachment = array( 'ID' => $mediaId, 'post_parent' => $postId );
|
560 |
-
wp_update_post($attachment);
|
561 |
-
}
|
562 |
-
}
|
563 |
-
|
564 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/ui.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Meow_MFRH_UI {
|
4 |
-
private $core = null;
|
5 |
-
|
6 |
-
function __construct( $core ) {
|
7 |
-
$this->core = $core;
|
8 |
-
$is_manual = get_option( 'mfrh_manual_rename', false );
|
9 |
-
|
10 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
11 |
-
add_filter( 'media_send_to_editor', array( $this, 'media_send_to_editor' ), 20, 3 );
|
12 |
-
|
13 |
-
// Add the metabox and the column if it's either manual or automatic
|
14 |
-
if ( $core->method != 'none' || $is_manual ) {
|
15 |
-
add_filter( 'manage_media_columns', array( $this, 'add_media_columns' ) );
|
16 |
-
add_action( 'manage_media_custom_column', array( $this, 'manage_media_custom_column' ), 10, 2 );
|
17 |
-
add_action( 'add_meta_boxes', array( $this, 'add_rename_metabox' ) );
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
function admin_menu() {
|
22 |
-
add_media_page( 'Media File Renamer', __( 'Renamer', 'media-file-renamer' ), 'read',
|
23 |
-
'mfrh_dashboard', array( $this, 'rename_media_files' ), 1 );
|
24 |
-
}
|
25 |
-
|
26 |
-
function media_send_to_editor( $html, $id, $attachment ) {
|
27 |
-
$output = array();
|
28 |
-
$this->core->check_attachment( get_post( $id, ARRAY_A ), $output );
|
29 |
-
return $html;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function rename_media_files() {
|
33 |
-
echo '<div id="mfrh-media-rename"></div>';
|
34 |
-
}
|
35 |
-
|
36 |
-
function add_rename_metabox() {
|
37 |
-
add_meta_box( 'mfrh_media', 'Renamer', array( $this, 'attachment_fields' ), 'attachment', 'side', 'high' );
|
38 |
-
}
|
39 |
-
|
40 |
-
function attachment_fields( $post ) {
|
41 |
-
if ( $post ) {
|
42 |
-
echo '
|
43 |
-
<div class="mfrh-renamer-field" data-id="' . $post->ID . '"></div>
|
44 |
-
<div style="line-height: 15px; font-size: 12px; margin-top: 10px;">After an update, please reload this Edit Media page.</div>
|
45 |
-
';
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
function add_media_columns( $columns ) {
|
50 |
-
$columns['mfrh_column'] = __( 'Renamer', 'media-file-renamer' );
|
51 |
-
return $columns;
|
52 |
-
}
|
53 |
-
|
54 |
-
function manage_media_custom_column( $column_name, $id ) {
|
55 |
-
if ( $column_name === 'mfrh_column' ) {
|
56 |
-
echo '<div class="mfrh-renamer-field" data-id="' . $id . '"></div>';
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/classes/updates.php
DELETED
@@ -1,177 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Meow_MFRH_Updates {
|
4 |
-
private $core = null;
|
5 |
-
|
6 |
-
public function __construct( $core ) {
|
7 |
-
$this->core = $core;
|
8 |
-
|
9 |
-
$this->init_actions();
|
10 |
-
|
11 |
-
// Support for WPML
|
12 |
-
if ( function_exists( 'icl_object_id' ) )
|
13 |
-
require( 'plugins/wpml.php' );
|
14 |
-
// Support for Beaver Builder
|
15 |
-
if ( class_exists( 'FLBuilderModel' ) )
|
16 |
-
require( 'plugins/beaverbuilder.php' );
|
17 |
-
}
|
18 |
-
|
19 |
-
function init_actions() {
|
20 |
-
add_action( 'mfrh_media_renamed', array( $this, 'action_update_media_file_references' ), 10, 3 );
|
21 |
-
|
22 |
-
if ( get_option( "mfrh_update_posts", true ) )
|
23 |
-
add_action( 'mfrh_url_renamed', array( $this, 'action_update_posts' ), 10, 3 );
|
24 |
-
if ( get_option( "mfrh_update_postmeta", true ) )
|
25 |
-
add_action( 'mfrh_url_renamed', array( $this, 'action_update_postmeta' ), 10, 3 );
|
26 |
-
if ( get_option( "mfrh_rename_guid" ) )
|
27 |
-
add_action( 'mfrh_media_renamed', array( $this, 'action_rename_guid' ), 10, 4 );
|
28 |
-
}
|
29 |
-
|
30 |
-
// Mass update of all the meta with the new filenames
|
31 |
-
function action_update_postmeta( $post, $orig_image_url, $new_image_url ) {
|
32 |
-
global $wpdb;
|
33 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->postmeta
|
34 |
-
SET meta_value = '%s'
|
35 |
-
WHERE meta_key <> '_original_filename'
|
36 |
-
AND (TRIM(meta_value) = '%s'
|
37 |
-
OR TRIM(meta_value) = '%s'
|
38 |
-
);", $new_image_url, $orig_image_url, str_replace( ' ', '%20', $orig_image_url ) );
|
39 |
-
$query_revert = $wpdb->prepare( "UPDATE $wpdb->postmeta
|
40 |
-
SET meta_value = '%s'
|
41 |
-
WHERE meta_key <> '_original_filename'
|
42 |
-
AND meta_value = '%s';
|
43 |
-
", $orig_image_url, $new_image_url );
|
44 |
-
$wpdb->query( $query );
|
45 |
-
$this->core->log_sql( $query, $query_revert );
|
46 |
-
$this->core->log( "🚀 Rewrite meta $orig_image_url ➡️ $new_image_url" );
|
47 |
-
}
|
48 |
-
|
49 |
-
// Mass update of all the articles with the new filenames
|
50 |
-
function action_update_posts( $post, $orig_image_url, $new_image_url ) {
|
51 |
-
global $wpdb;
|
52 |
-
|
53 |
-
// Content
|
54 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->posts
|
55 |
-
SET post_content = REPLACE(post_content, '%s', '%s')
|
56 |
-
WHERE post_status != 'inherit'
|
57 |
-
AND post_status != 'trash'
|
58 |
-
AND post_type != 'attachment'
|
59 |
-
AND post_type NOT LIKE '%acf-%'
|
60 |
-
AND post_type NOT LIKE '%edd_%'
|
61 |
-
AND post_type != 'shop_order'
|
62 |
-
AND post_type != 'shop_order_refund'
|
63 |
-
AND post_type != 'nav_menu_item'
|
64 |
-
AND post_type != 'revision'
|
65 |
-
AND post_type != 'auto-draft'", $orig_image_url, $new_image_url );
|
66 |
-
$query_revert = $wpdb->prepare( "UPDATE $wpdb->posts
|
67 |
-
SET post_content = REPLACE(post_content, '%s', '%s')
|
68 |
-
WHERE post_status != 'inherit'
|
69 |
-
AND post_status != 'trash'
|
70 |
-
AND post_type != 'attachment'
|
71 |
-
AND post_type NOT LIKE '%acf-%'
|
72 |
-
AND post_type NOT LIKE '%edd_%'
|
73 |
-
AND post_type != 'shop_order'
|
74 |
-
AND post_type != 'shop_order_refund'
|
75 |
-
AND post_type != 'nav_menu_item'
|
76 |
-
AND post_type != 'revision'
|
77 |
-
AND post_type != 'auto-draft'", $new_image_url, $orig_image_url );
|
78 |
-
$wpdb->query( $query );
|
79 |
-
$this->core->log_sql( $query, $query_revert );
|
80 |
-
$this->core->log( "🚀 Rewrite content $orig_image_url ➡️ $new_image_url" );
|
81 |
-
|
82 |
-
// Excerpt
|
83 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->posts
|
84 |
-
SET post_excerpt = REPLACE(post_excerpt, '%s', '%s')
|
85 |
-
WHERE post_status != 'inherit'
|
86 |
-
AND post_status != 'trash'
|
87 |
-
AND post_type != 'attachment'
|
88 |
-
AND post_type NOT LIKE '%acf-%'
|
89 |
-
AND post_type NOT LIKE '%edd_%'
|
90 |
-
AND post_type != 'shop_order'
|
91 |
-
AND post_type != 'shop_order_refund'
|
92 |
-
AND post_type != 'nav_menu_item'
|
93 |
-
AND post_type != 'revision'
|
94 |
-
AND post_type != 'auto-draft'", $orig_image_url, $new_image_url );
|
95 |
-
$query_revert = $wpdb->prepare( "UPDATE $wpdb->posts
|
96 |
-
SET post_excerpt = REPLACE(post_excerpt, '%s', '%s')
|
97 |
-
WHERE post_status != 'inherit'
|
98 |
-
AND post_status != 'trash'
|
99 |
-
AND post_type != 'attachment'
|
100 |
-
AND post_type NOT LIKE '%acf-%'
|
101 |
-
AND post_type NOT LIKE '%edd_%'
|
102 |
-
AND post_type != 'shop_order'
|
103 |
-
AND post_type != 'shop_order_refund'
|
104 |
-
AND post_type != 'nav_menu_item'
|
105 |
-
AND post_type != 'revision'
|
106 |
-
AND post_type != 'auto-draft'", $new_image_url, $orig_image_url );
|
107 |
-
$wpdb->query( $query );
|
108 |
-
$this->core->log_sql( $query, $query_revert );
|
109 |
-
$this->core->log( "🚀 Rewrite excerpts $orig_image_url ➡️ $new_image_url" );
|
110 |
-
}
|
111 |
-
|
112 |
-
// The GUID should never be updated but... this will if the option is checked.
|
113 |
-
// [TigrouMeow] It the recent version of WordPress, the GUID is not part of the $post (even though it is in database)
|
114 |
-
// Explanation: http://pods.io/2013/07/17/dont-use-the-guid-field-ever-ever-ever/
|
115 |
-
function action_rename_guid( $post, $old_filepath, $new_filepath, $undo = false ) {
|
116 |
-
$meta = wp_get_attachment_metadata( $post['ID'] );
|
117 |
-
$old_guid = get_the_guid( $post['ID'] );
|
118 |
-
if ( $meta )
|
119 |
-
$new_filepath = wp_get_attachment_url( $post['ID'] );
|
120 |
-
global $wpdb;
|
121 |
-
$query = $wpdb->prepare( "UPDATE $wpdb->posts SET guid = '%s' WHERE ID = '%d'", $new_filepath, $post['ID'] );
|
122 |
-
$query_revert = $wpdb->prepare( "UPDATE $wpdb->posts SET guid = '%s' WHERE ID = '%d'", $old_guid, $post['ID'] );
|
123 |
-
$this->core->log_sql( $query, $query_revert );
|
124 |
-
$wpdb->query( $query );
|
125 |
-
clean_post_cache( $post['ID'] );
|
126 |
-
$this->core->log( "🚀 GUID $old_guid ➡️ $new_filepath." );
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Updates renamed file references of all the duplicated media entries
|
131 |
-
* @param array $post
|
132 |
-
* @param string $old_filepath
|
133 |
-
* @param string $new_filepath
|
134 |
-
*/
|
135 |
-
function action_update_media_file_references( $post, $old_filepath, $new_filepath ) {
|
136 |
-
global $wpdb;
|
137 |
-
|
138 |
-
// Source of sync on 'posts' table
|
139 |
-
$id = $post['ID'];
|
140 |
-
$src = $wpdb->get_row( "SELECT post_mime_type FROM {$wpdb->posts} WHERE ID = {$id}" );
|
141 |
-
|
142 |
-
// Source of sync on 'postmeta' table
|
143 |
-
$meta = array ( // Meta keys to sync
|
144 |
-
'_wp_attached_file' => null,
|
145 |
-
'_wp_attachment_metadata' => null
|
146 |
-
);
|
147 |
-
foreach ( array_keys( $meta ) as $i ) {
|
148 |
-
$meta[$i] = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = {$id} AND meta_key = '{$i}'" );
|
149 |
-
}
|
150 |
-
|
151 |
-
// Sync posts sharing the same attachment file
|
152 |
-
$dest = $this->core->get_posts_by_attached_file( $old_filepath, $id );
|
153 |
-
foreach ( $dest as $item ) {
|
154 |
-
if ( get_post_type( $item ) != 'attachment' ) continue;
|
155 |
-
|
156 |
-
// Set it as manual-renamed to avoid being marked as an issue
|
157 |
-
add_post_meta( $item, '_manual_file_renaming', true, true );
|
158 |
-
|
159 |
-
// Sync on 'posts' table
|
160 |
-
$wpdb->update( $wpdb->posts, array ( // Data
|
161 |
-
'post_mime_type' => $src->post_mime_type
|
162 |
-
), array ( // WHERE
|
163 |
-
'ID' => $item
|
164 |
-
) );
|
165 |
-
|
166 |
-
// Sync on 'postmeta' table
|
167 |
-
foreach ( $meta as $j => $jtem ) {
|
168 |
-
$wpdb->update( $wpdb->postmeta, array ( // Data
|
169 |
-
'meta_value' => $jtem
|
170 |
-
), array ( // WHERE
|
171 |
-
'post_id' => $item, // AND
|
172 |
-
'meta_key' => $j
|
173 |
-
) );
|
174 |
-
}
|
175 |
-
}
|
176 |
-
}
|
177 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/admin.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'MeowCommon_Admin' ) ) {
|
4 |
-
|
5 |
-
class MeowCommon_Admin {
|
6 |
-
|
7 |
-
public static $loaded = false;
|
8 |
-
public static $version = "3.3";
|
9 |
-
public static $admin_version = "3.3";
|
10 |
-
|
11 |
-
public $prefix; // prefix used for actions, filters (mfrh)
|
12 |
-
public $mainfile; // plugin main file (media-file-renamer.php)
|
13 |
-
public $domain; // domain used for translation (media-file-renamer)
|
14 |
-
public $isPro = false;
|
15 |
-
|
16 |
-
public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
|
17 |
-
|
18 |
-
public function __construct( $prefix, $mainfile, $domain, $isPro = false, $disableReview = false, $freeOnly = false ) {
|
19 |
-
|
20 |
-
if ( !MeowCommon_Admin::$loaded ) {
|
21 |
-
if ( is_admin() ) {
|
22 |
-
|
23 |
-
// Check potential issues with this WordPress install, other plugins, etc.
|
24 |
-
new MeowCommon_Classes_Issues( $prefix, $mainfile, $domain );
|
25 |
-
|
26 |
-
// Create the Meow Apps Menu
|
27 |
-
add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
|
28 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] === 'meowapps-main-menu' ) {
|
29 |
-
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100000, 1 );
|
30 |
-
}
|
31 |
-
}
|
32 |
-
MeowCommon_Admin::$loaded = true;
|
33 |
-
}
|
34 |
-
|
35 |
-
// Variables for this plugin
|
36 |
-
$this->prefix = $prefix;
|
37 |
-
$this->mainfile = $mainfile;
|
38 |
-
$this->domain = $domain;
|
39 |
-
$this->isPro = $isPro;
|
40 |
-
|
41 |
-
// If there is no mainfile, it's either a Pro only Plugin (with no Free version available) or a Theme.
|
42 |
-
if ( is_admin() ) {
|
43 |
-
$license = get_option( $this->prefix . '_license', "" );
|
44 |
-
if ( !empty( $license ) && !$this->isPro ) {
|
45 |
-
add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
|
46 |
-
}
|
47 |
-
if ( !$disableReview ) {
|
48 |
-
new MeowCommon_Classes_Ratings( $prefix, $mainfile, $domain );
|
49 |
-
}
|
50 |
-
}
|
51 |
-
add_filter( 'plugin_row_meta', array( $this, 'custom_plugin_row_meta' ), 10, 2 );
|
52 |
-
add_filter( 'edd_sl_api_request_verify_ssl', array( $this, 'request_verify_ssl' ), 10, 0 );
|
53 |
-
}
|
54 |
-
|
55 |
-
function custom_plugin_row_meta( $links, $file ) {
|
56 |
-
$path = pathinfo( $file );
|
57 |
-
$pathName = basename( $path['dirname'] );
|
58 |
-
$thisPath = pathinfo( $this->mainfile );
|
59 |
-
$thisPathName = basename( $thisPath['dirname'] );
|
60 |
-
$isActive = is_plugin_active( $file );
|
61 |
-
if ( !$isActive ) {
|
62 |
-
return $links;
|
63 |
-
}
|
64 |
-
$isIssue = $this->isPro && !$this->is_registered();
|
65 |
-
if ( strpos( $pathName, $thisPathName ) !== false ) {
|
66 |
-
$new_links = array(
|
67 |
-
'settings' =>
|
68 |
-
sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ),
|
69 |
-
'license' =>
|
70 |
-
$this->is_registered() ?
|
71 |
-
('<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>') :
|
72 |
-
( $isIssue ? (sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>') : (sprintf( '<span>' . __( '<a target="_blank" href="https://store.meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>') ),
|
73 |
-
);
|
74 |
-
$links = array_merge( $new_links, $links );
|
75 |
-
}
|
76 |
-
return $links;
|
77 |
-
}
|
78 |
-
|
79 |
-
function request_verify_ssl() {
|
80 |
-
return get_option( 'force_sslverify', false );
|
81 |
-
}
|
82 |
-
|
83 |
-
function nice_name_from_file( $file ) {
|
84 |
-
$info = pathinfo( $file );
|
85 |
-
if ( !empty( $info ) ) {
|
86 |
-
if ( $info['filename'] == 'wplr-sync' ) {
|
87 |
-
return "WP/LR Sync";
|
88 |
-
}
|
89 |
-
$info['filename'] = str_replace( '-', ' ', $info['filename'] );
|
90 |
-
$file = ucwords( $info['filename'] );
|
91 |
-
}
|
92 |
-
return $file;
|
93 |
-
}
|
94 |
-
|
95 |
-
function admin_notices_licensed_free() {
|
96 |
-
if ( isset( $_POST[$this->prefix . '_reset_sub'] ) ) {
|
97 |
-
delete_option( $this->prefix . '_pro_serial' );
|
98 |
-
delete_option( $this->prefix . '_license' );
|
99 |
-
return;
|
100 |
-
}
|
101 |
-
echo '<div class="notice notice-error">';
|
102 |
-
printf(
|
103 |
-
__( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
|
104 |
-
$this->nice_name_from_file( $this->mainfile ) );
|
105 |
-
echo '<p>
|
106 |
-
<form method="post" action="">
|
107 |
-
<input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
|
108 |
-
<input type="submit" name="submit" id="submit" class="button" value="'
|
109 |
-
. __( 'Remove the license', $this->domain ) . '">
|
110 |
-
</form>
|
111 |
-
</p>
|
112 |
-
';
|
113 |
-
echo '</div>';
|
114 |
-
}
|
115 |
-
|
116 |
-
function admin_menu_start() {
|
117 |
-
// Hide the admin if user doesn't like Meow much
|
118 |
-
if ( get_option( 'meowapps_hide_meowapps', false ) ) {
|
119 |
-
register_setting( 'general', 'meowapps_hide_meowapps' );
|
120 |
-
add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', array( $this, 'meowapps_hide_dashboard_callback' ), 'general' );
|
121 |
-
return;
|
122 |
-
}
|
123 |
-
|
124 |
-
// Create standard menu if it does not already exist
|
125 |
-
global $submenu;
|
126 |
-
if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
|
127 |
-
add_menu_page( 'Meow Apps', '<img alt="Meow Apps" style="width: 24px; margin-left: -30px; position: absolute; margin-top: -3px;" src="' . MeowCommon_Admin::$logo . '" />Meow Apps', 'manage_options', 'meowapps-main-menu',
|
128 |
-
array( $this, 'admin_meow_apps' ), '', 82 );
|
129 |
-
add_submenu_page( 'meowapps-main-menu', __( 'Dashboard', $this->domain ),
|
130 |
-
__( 'Dashboard', $this->domain ), 'manage_options',
|
131 |
-
'meowapps-main-menu', array( $this, 'admin_meow_apps' ) );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
function meowapps_hide_dashboard_callback() {
|
136 |
-
$html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
|
137 |
-
checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
|
138 |
-
$html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a cleaner admin. This option will be reset if a new Meow Apps plugin is installed. <b>Once activated, an option will be added in your General settings to display it again.</b></small>', $this->domain );
|
139 |
-
echo $html;
|
140 |
-
}
|
141 |
-
|
142 |
-
function is_registered() {
|
143 |
-
return apply_filters( $this->prefix . '_meowapps_is_registered', false, $this->prefix );
|
144 |
-
}
|
145 |
-
|
146 |
-
function get_phpinfo() {
|
147 |
-
ob_start();
|
148 |
-
phpinfo( INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES );
|
149 |
-
$html = ob_get_contents();
|
150 |
-
ob_end_clean();
|
151 |
-
$html = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $html );
|
152 |
-
echo $html;
|
153 |
-
}
|
154 |
-
|
155 |
-
function admin_meow_apps() {
|
156 |
-
echo "<div id='meow-common-dashboard'></div>";
|
157 |
-
|
158 |
-
echo "<div style='display: none;' id='meow-common-phpinfo'>";
|
159 |
-
echo $this->get_phpinfo();
|
160 |
-
echo "</div>";
|
161 |
-
}
|
162 |
-
|
163 |
-
function admin_footer_text( $current ) {
|
164 |
-
return sprintf(
|
165 |
-
// translators: %1$s is the version of the interface; %2$s is a file path.
|
166 |
-
__( 'Thanks for using <a href="https://meowapps.com">Meow Apps</a>! This is the Meow Admin %1$s <br /><i>Loaded from %2$s </i>', $this->domain ),
|
167 |
-
MeowCommon_Admin::$version,
|
168 |
-
__FILE__
|
169 |
-
);
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/classes/issues.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'MeowCommon_Classes_Issues' ) ) {
|
4 |
-
|
5 |
-
class MeowCommon_Classes_Issues {
|
6 |
-
|
7 |
-
public function __construct( $prefix, $mainfile, $domain ) {
|
8 |
-
$this->check_plugins();
|
9 |
-
}
|
10 |
-
|
11 |
-
function check_plugins() {
|
12 |
-
if ( class_exists( 'LiteSpeed\Core' ) ) {
|
13 |
-
$this->check_litespeed();
|
14 |
-
}
|
15 |
-
}
|
16 |
-
|
17 |
-
function check_litespeed() {
|
18 |
-
// By default, the REST API is cached by Litespeed. Why is that?
|
19 |
-
// It is absolutely not a good idea, especially on the admin side.
|
20 |
-
$cache_rest = get_option( 'litespeed.conf.cache-rest' );
|
21 |
-
if ( $cache_rest ) {
|
22 |
-
update_option( 'litespeed.conf.cache-rest', 0 );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/classes/ratings.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'MeowCommon_Classes_Ratings' ) ) {
|
4 |
-
|
5 |
-
class MeowCommon_Classes_Ratings {
|
6 |
-
|
7 |
-
public $mainfile; // plugin main file (media-file-renamer.php)
|
8 |
-
public $domain; // domain used for translation (media-file-renamer)
|
9 |
-
public $prefix; // used for many things (filters, options, etc)
|
10 |
-
|
11 |
-
public function __construct( $prefix, $mainfile, $domain ) {
|
12 |
-
$this->mainfile = $mainfile;
|
13 |
-
$this->domain = $domain;
|
14 |
-
$this->prefix = $prefix;
|
15 |
-
|
16 |
-
register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
|
17 |
-
|
18 |
-
if ( is_admin() ) {
|
19 |
-
$rating_date = $this->create_rating_date();
|
20 |
-
if ( time() > $rating_date ) {
|
21 |
-
add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) );
|
22 |
-
}
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
function show_meowapps_create_rating_date() {
|
27 |
-
delete_option( 'meowapps_hide_meowapps' );
|
28 |
-
$this->create_rating_date();
|
29 |
-
}
|
30 |
-
|
31 |
-
function create_rating_date() {
|
32 |
-
$rating_date = get_option( $this->prefix . '_rating_date' );
|
33 |
-
if ( empty( $rating_date ) ) {
|
34 |
-
$two_months = strtotime( '+2 months' );
|
35 |
-
$six_months = strtotime( '+4 months' );
|
36 |
-
$rating_date = mt_rand( $two_months, $six_months );
|
37 |
-
update_option( $this->prefix . '_rating_date', $rating_date, false );
|
38 |
-
}
|
39 |
-
return $rating_date;
|
40 |
-
}
|
41 |
-
|
42 |
-
function admin_notices_rating() {
|
43 |
-
if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) {
|
44 |
-
$two_weeks = strtotime( '+2 weeks' );
|
45 |
-
$six_weeks = strtotime( '+6 weeks' );
|
46 |
-
$future_date = mt_rand( $two_weeks, $six_weeks );
|
47 |
-
update_option( $this->prefix . '_rating_date', $future_date, false );
|
48 |
-
return;
|
49 |
-
}
|
50 |
-
else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) {
|
51 |
-
$twenty_years = strtotime( '+5 years' );
|
52 |
-
update_option( $this->prefix . '_rating_date', $twenty_years, false );
|
53 |
-
return;
|
54 |
-
}
|
55 |
-
else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) {
|
56 |
-
$twenty_years = strtotime( '+10 years' );
|
57 |
-
update_option( $this->prefix . '_rating_date', $twenty_years, false );
|
58 |
-
return;
|
59 |
-
}
|
60 |
-
$rating_date = get_option( $this->prefix . '_rating_date' );
|
61 |
-
echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
|
62 |
-
echo '<p style="font-size: 100%;">';
|
63 |
-
printf(
|
64 |
-
// translators: %1$s is a plugin nicename, %2$s is a short url (slug)
|
65 |
-
__( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation! I will get back to you :)', $this->domain ),
|
66 |
-
$this->nice_name_from_file( $this->mainfile ),
|
67 |
-
$this->nice_short_url_from_file( $this->mainfile )
|
68 |
-
);
|
69 |
-
echo '<p>
|
70 |
-
<form method="post" action="" style="float: right;">
|
71 |
-
<input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
|
72 |
-
<input type="submit" name="submit" id="submit" class="button button-red" value="'
|
73 |
-
. __( 'Never remind me!', $this->domain ) . '">
|
74 |
-
</form>
|
75 |
-
<form method="post" action="" style="float: right; margin-right: 10px;">
|
76 |
-
<input type="hidden" name="' . $this->prefix . '_remind_me" value="true">
|
77 |
-
<input type="submit" name="submit" id="submit" class="button button-primary" value="'
|
78 |
-
. __( 'Remind me in a few weeks...', $this->domain ) . '">
|
79 |
-
</form>
|
80 |
-
<form method="post" action="" style="float: right; margin-right: 10px;">
|
81 |
-
<input type="hidden" name="' . $this->prefix . '_did_it" value="true">
|
82 |
-
<input type="submit" name="submit" id="submit" class="button button-primary" value="'
|
83 |
-
. __( 'Yes, I did it!', $this->domain ) . '">
|
84 |
-
</form>
|
85 |
-
<div style="clear: both;"></div>
|
86 |
-
</p>
|
87 |
-
';
|
88 |
-
echo '</div>';
|
89 |
-
}
|
90 |
-
|
91 |
-
function nice_short_url_from_file( $file ) {
|
92 |
-
$info = pathinfo( $file );
|
93 |
-
if ( !empty( $info ) ) {
|
94 |
-
$info['filename'] = str_replace( '-pro', '', $info['filename'] );
|
95 |
-
return $info['filename'];
|
96 |
-
}
|
97 |
-
return "";
|
98 |
-
}
|
99 |
-
|
100 |
-
function nice_name_from_file( $file ) {
|
101 |
-
$info = pathinfo( $file );
|
102 |
-
if ( !empty( $info ) ) {
|
103 |
-
if ( $info['filename'] == 'wplr-sync' ) {
|
104 |
-
return "WP/LR Sync";
|
105 |
-
}
|
106 |
-
$info['filename'] = str_replace( '-', ' ', $info['filename'] );
|
107 |
-
$file = ucwords( $info['filename'] );
|
108 |
-
}
|
109 |
-
return $file;
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/classes/rest.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class MeowCommon_Classes_Rest
|
4 |
-
{
|
5 |
-
private $namespace = "meow-common/v1";
|
6 |
-
static public $instance = null;
|
7 |
-
|
8 |
-
static public function init_once() {
|
9 |
-
if ( !function_exists( 'wp_get_current_user' ) ) {
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
if ( !current_user_can( 'administrator' ) ) {
|
13 |
-
return;
|
14 |
-
}
|
15 |
-
if ( !MeowCommon_Classes_Rest::$instance ) {
|
16 |
-
MeowCommon_Classes_Rest::$instance = new self();
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
private function __construct() {
|
21 |
-
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
22 |
-
}
|
23 |
-
|
24 |
-
function rest_api_init() {
|
25 |
-
register_rest_route( $this->namespace, '/empty_request/', [
|
26 |
-
'methods' => 'POST',
|
27 |
-
'callback' => [ $this, 'empty_request' ]
|
28 |
-
]);
|
29 |
-
register_rest_route( $this->namespace, '/file_operation/', [
|
30 |
-
'methods' => 'POST',
|
31 |
-
'callback' => [ $this, 'file_operation' ]
|
32 |
-
]);
|
33 |
-
register_rest_route( $this->namespace, '/sql_request/', [
|
34 |
-
'methods' => 'POST',
|
35 |
-
'callback' => [ $this, 'sql_request' ]
|
36 |
-
]);
|
37 |
-
register_rest_route( $this->namespace, '/error_logs/', [
|
38 |
-
'methods' => 'POST',
|
39 |
-
'callback' => [ $this, 'rest_error_logs' ]
|
40 |
-
]);
|
41 |
-
register_rest_route( $this->namespace, '/all_settings/', [
|
42 |
-
'methods' => 'GET',
|
43 |
-
'callback' => [ $this, 'rest_all_settings' ]
|
44 |
-
]);
|
45 |
-
register_rest_route( $this->namespace, '/update_option/', [
|
46 |
-
'methods' => 'POST',
|
47 |
-
'callback' => [ $this, 'rest_update_option' ]
|
48 |
-
]);
|
49 |
-
}
|
50 |
-
|
51 |
-
function file_rand( $filesize ) {
|
52 |
-
$tmp_file = tmpfile();
|
53 |
-
fseek( $tmp_file, $filesize - 1, SEEK_CUR );
|
54 |
-
fwrite( $tmp_file, 'a');
|
55 |
-
fclose( $tmp_file );
|
56 |
-
}
|
57 |
-
|
58 |
-
function empty_request() {
|
59 |
-
return new WP_REST_Response( [ 'success' => true ], 200 );
|
60 |
-
}
|
61 |
-
|
62 |
-
function file_operation() {
|
63 |
-
$this->file_rand( 1024 * 10 );
|
64 |
-
return new WP_REST_Response( [ 'success' => true ], 200 );
|
65 |
-
}
|
66 |
-
|
67 |
-
function sql_request() {
|
68 |
-
global $wpdb;
|
69 |
-
$count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts}" );
|
70 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $count ], 200 );
|
71 |
-
}
|
72 |
-
|
73 |
-
function rest_all_settings() {
|
74 |
-
$settings = array(
|
75 |
-
'meowapps_hide_meowapps' => get_option( 'meowapps_hide_meowapps', false ),
|
76 |
-
'force_sslverify' => get_option( 'force_sslverify', false )
|
77 |
-
);
|
78 |
-
return new WP_REST_Response([ 'success' => true, 'data' => $settings ], 200 );
|
79 |
-
}
|
80 |
-
|
81 |
-
function rest_update_option( $request ) {
|
82 |
-
$params = $request->get_json_params();
|
83 |
-
try {
|
84 |
-
$result = update_option( $params['name'], $params['value'] );
|
85 |
-
return new WP_REST_Response([ 'success' => $result ], 200 );
|
86 |
-
}
|
87 |
-
catch (Exception $e) {
|
88 |
-
return new WP_REST_Response([ 'success' => false, 'message' => $e->getMessage() ], 500 );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
function rest_error_logs( $request ) {
|
93 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => MeowCommon_Helpers::php_error_logs() ], 200 );
|
94 |
-
}
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/classes/rest_license.php
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class MeowCommon_Classes_Rest_License
|
4 |
-
{
|
5 |
-
private $licenser = null;
|
6 |
-
private $namespace = null;
|
7 |
-
|
8 |
-
public function __construct( &$licenser ) {
|
9 |
-
$this->licenser = $licenser;
|
10 |
-
$this->namespace = "meow-licenser/{$licenser->prefix}/v1";
|
11 |
-
if ( !current_user_can( 'administrator' ) ) {
|
12 |
-
return;
|
13 |
-
}
|
14 |
-
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
15 |
-
}
|
16 |
-
|
17 |
-
function rest_api_init() {
|
18 |
-
register_rest_route( $this->namespace, '/get_license/', [
|
19 |
-
'methods' => 'POST',
|
20 |
-
'callback' => [ $this, 'get_license' ]
|
21 |
-
]);
|
22 |
-
register_rest_route( $this->namespace, '/set_license/', [
|
23 |
-
'methods' => 'POST',
|
24 |
-
'callback' => [ $this, 'set_license' ]
|
25 |
-
]);
|
26 |
-
}
|
27 |
-
|
28 |
-
function get_license() {
|
29 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
|
30 |
-
}
|
31 |
-
|
32 |
-
function set_license( $request ) {
|
33 |
-
$params = $request->get_json_params();
|
34 |
-
$serialKey = $params['serialKey'];
|
35 |
-
$this->licenser->validate_pro( $serialKey );
|
36 |
-
return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/classes/updater.php
DELETED
@@ -1,591 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Exit if accessed directly
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Allows plugins to use their own update API.
|
8 |
-
*
|
9 |
-
* @author Easy Digital Downloads
|
10 |
-
* @version 1.6.18
|
11 |
-
*/
|
12 |
-
class MeowCommon_Classes_Updater {
|
13 |
-
|
14 |
-
private $api_url = '';
|
15 |
-
private $api_data = array();
|
16 |
-
private $name = '';
|
17 |
-
private $slug = '';
|
18 |
-
private $version = '';
|
19 |
-
private $wp_override = false;
|
20 |
-
private $cache_key = '';
|
21 |
-
|
22 |
-
private $health_check_timeout = 5;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Class constructor.
|
26 |
-
*
|
27 |
-
* @uses plugin_basename()
|
28 |
-
* @uses hook()
|
29 |
-
*
|
30 |
-
* @param string $_api_url The URL pointing to the custom API endpoint.
|
31 |
-
* @param string $_plugin_file Path to the plugin file.
|
32 |
-
* @param array $_api_data Optional data to send with API calls.
|
33 |
-
*/
|
34 |
-
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
35 |
-
|
36 |
-
global $edd_plugin_data;
|
37 |
-
|
38 |
-
$this->api_url = trailingslashit( $_api_url );
|
39 |
-
$this->api_data = $_api_data;
|
40 |
-
$this->name = plugin_basename( $_plugin_file );
|
41 |
-
$this->slug = basename( $_plugin_file, '.php' );
|
42 |
-
$this->version = $_api_data['version'];
|
43 |
-
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
44 |
-
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
45 |
-
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
46 |
-
|
47 |
-
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Fires after the $edd_plugin_data is setup.
|
51 |
-
*
|
52 |
-
* @since x.x.x
|
53 |
-
*
|
54 |
-
* @param array $edd_plugin_data Array of EDD SL plugin data.
|
55 |
-
*/
|
56 |
-
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
|
57 |
-
|
58 |
-
// Set up hooks.
|
59 |
-
$this->init();
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Set up WordPress filters to hook into WP's update process.
|
65 |
-
*
|
66 |
-
* @uses add_filter()
|
67 |
-
*
|
68 |
-
* @return void
|
69 |
-
*/
|
70 |
-
public function init() {
|
71 |
-
|
72 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
73 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
74 |
-
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
|
75 |
-
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
76 |
-
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Check for Updates at the defined API endpoint and modify the update array.
|
82 |
-
*
|
83 |
-
* This function dives into the update API just when WordPress creates its update array,
|
84 |
-
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
85 |
-
* It is reassembled from parts of the native WordPress plugin update code.
|
86 |
-
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
87 |
-
*
|
88 |
-
* @uses api_request()
|
89 |
-
*
|
90 |
-
* @param array $_transient_data Update array build by WordPress.
|
91 |
-
* @return array Modified update array with custom plugin data.
|
92 |
-
*/
|
93 |
-
public function check_update( $_transient_data ) {
|
94 |
-
|
95 |
-
global $pagenow;
|
96 |
-
|
97 |
-
if ( ! is_object( $_transient_data ) ) {
|
98 |
-
$_transient_data = new stdClass;
|
99 |
-
}
|
100 |
-
|
101 |
-
if ( 'plugins.php' == $pagenow && is_multisite() ) {
|
102 |
-
return $_transient_data;
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
|
106 |
-
return $_transient_data;
|
107 |
-
}
|
108 |
-
|
109 |
-
$version_info = $this->get_cached_version_info();
|
110 |
-
|
111 |
-
if ( false === $version_info ) {
|
112 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
113 |
-
|
114 |
-
$this->set_version_info_cache( $version_info );
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
119 |
-
|
120 |
-
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
121 |
-
|
122 |
-
$_transient_data->response[ $this->name ] = $version_info;
|
123 |
-
|
124 |
-
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
|
125 |
-
$_transient_data->response[ $this->name ]->plugin = $this->name;
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
$_transient_data->last_checked = time();
|
130 |
-
$_transient_data->checked[ $this->name ] = $this->version;
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
return $_transient_data;
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
139 |
-
*
|
140 |
-
* @param string $file
|
141 |
-
* @param array $plugin
|
142 |
-
*/
|
143 |
-
public function show_update_notification( $file, $plugin ) {
|
144 |
-
|
145 |
-
if ( is_network_admin() ) {
|
146 |
-
return;
|
147 |
-
}
|
148 |
-
|
149 |
-
if( ! current_user_can( 'update_plugins' ) ) {
|
150 |
-
return;
|
151 |
-
}
|
152 |
-
|
153 |
-
if( ! is_multisite() ) {
|
154 |
-
return;
|
155 |
-
}
|
156 |
-
|
157 |
-
if ( $this->name != $file ) {
|
158 |
-
return;
|
159 |
-
}
|
160 |
-
|
161 |
-
// Remove our filter on the site transient
|
162 |
-
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
163 |
-
|
164 |
-
$update_cache = get_site_transient( 'update_plugins' );
|
165 |
-
|
166 |
-
$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
|
167 |
-
|
168 |
-
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
169 |
-
|
170 |
-
$version_info = $this->get_cached_version_info();
|
171 |
-
|
172 |
-
if ( false === $version_info ) {
|
173 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
174 |
-
|
175 |
-
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
|
176 |
-
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
|
177 |
-
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
|
178 |
-
}
|
179 |
-
|
180 |
-
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
|
181 |
-
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
|
182 |
-
}
|
183 |
-
|
184 |
-
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
|
185 |
-
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
|
186 |
-
}
|
187 |
-
|
188 |
-
$this->set_version_info_cache( $version_info );
|
189 |
-
}
|
190 |
-
|
191 |
-
if ( ! is_object( $version_info ) ) {
|
192 |
-
return;
|
193 |
-
}
|
194 |
-
|
195 |
-
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
196 |
-
|
197 |
-
$update_cache->response[ $this->name ] = $version_info;
|
198 |
-
|
199 |
-
}
|
200 |
-
|
201 |
-
$update_cache->last_checked = time();
|
202 |
-
$update_cache->checked[ $this->name ] = $this->version;
|
203 |
-
|
204 |
-
set_site_transient( 'update_plugins', $update_cache );
|
205 |
-
|
206 |
-
} else {
|
207 |
-
|
208 |
-
$version_info = $update_cache->response[ $this->name ];
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
// Restore our filter
|
213 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
214 |
-
|
215 |
-
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
216 |
-
|
217 |
-
// build a plugin list row, with update notification
|
218 |
-
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
219 |
-
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
220 |
-
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
221 |
-
echo '<td colspan="3" class="plugin-update colspanchange">';
|
222 |
-
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
223 |
-
|
224 |
-
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
225 |
-
|
226 |
-
if ( empty( $version_info->download_link ) ) {
|
227 |
-
printf(
|
228 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
|
229 |
-
esc_html( $version_info->name ),
|
230 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
231 |
-
esc_html( $version_info->new_version ),
|
232 |
-
'</a>'
|
233 |
-
);
|
234 |
-
} else {
|
235 |
-
printf(
|
236 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
|
237 |
-
esc_html( $version_info->name ),
|
238 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
239 |
-
esc_html( $version_info->new_version ),
|
240 |
-
'</a>',
|
241 |
-
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
|
242 |
-
'</a>'
|
243 |
-
);
|
244 |
-
}
|
245 |
-
|
246 |
-
do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
|
247 |
-
|
248 |
-
echo '</div></td></tr>';
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Updates information on the "View version x.x details" page with custom data.
|
254 |
-
*
|
255 |
-
* @uses api_request()
|
256 |
-
*
|
257 |
-
* @param mixed $_data
|
258 |
-
* @param string $_action
|
259 |
-
* @param object $_args
|
260 |
-
* @return object $_data
|
261 |
-
*/
|
262 |
-
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
263 |
-
|
264 |
-
if ( $_action != 'plugin_information' ) {
|
265 |
-
|
266 |
-
return $_data;
|
267 |
-
|
268 |
-
}
|
269 |
-
|
270 |
-
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
271 |
-
|
272 |
-
return $_data;
|
273 |
-
|
274 |
-
}
|
275 |
-
|
276 |
-
$to_send = array(
|
277 |
-
'slug' => $this->slug,
|
278 |
-
'is_ssl' => is_ssl(),
|
279 |
-
'fields' => array(
|
280 |
-
'banners' => array(),
|
281 |
-
'reviews' => false,
|
282 |
-
'icons' => array(),
|
283 |
-
)
|
284 |
-
);
|
285 |
-
|
286 |
-
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
287 |
-
|
288 |
-
// Get the transient where we store the api request for this plugin for 24 hours
|
289 |
-
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
290 |
-
|
291 |
-
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
292 |
-
if ( empty( $edd_api_request_transient ) ) {
|
293 |
-
|
294 |
-
$api_response = $this->api_request( 'plugin_information', $to_send );
|
295 |
-
|
296 |
-
// Expires in 3 hours
|
297 |
-
$this->set_version_info_cache( $api_response, $cache_key );
|
298 |
-
|
299 |
-
if ( false !== $api_response ) {
|
300 |
-
$_data = $api_response;
|
301 |
-
}
|
302 |
-
|
303 |
-
} else {
|
304 |
-
$_data = $edd_api_request_transient;
|
305 |
-
}
|
306 |
-
|
307 |
-
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
308 |
-
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
309 |
-
$_data->sections = $this->convert_object_to_array( $_data->sections );
|
310 |
-
}
|
311 |
-
|
312 |
-
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
313 |
-
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
314 |
-
$_data->banners = $this->convert_object_to_array( $_data->banners );
|
315 |
-
}
|
316 |
-
|
317 |
-
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
318 |
-
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
|
319 |
-
$_data->icons = $this->convert_object_to_array( $_data->icons );
|
320 |
-
}
|
321 |
-
|
322 |
-
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
323 |
-
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
|
324 |
-
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
|
325 |
-
foreach ( $_data->contributors as $key => $value ) {
|
326 |
-
$_data->contributors[$key] = $this->convert_object_to_array( $value );
|
327 |
-
}
|
328 |
-
}
|
329 |
-
|
330 |
-
// FOR DEBUG
|
331 |
-
// $fordebug = clone $_data;
|
332 |
-
// foreach ( $fordebug->sections as $key => $value ) {
|
333 |
-
// if ( strlen( $fordebug->sections[$key] ) > 200 )
|
334 |
-
// $fordebug->sections[$key] = '...';
|
335 |
-
// }
|
336 |
-
// $fordebug->description = '...';
|
337 |
-
// $fordebug->changelog = '...';
|
338 |
-
// var_dump( $fordebug, 1 );
|
339 |
-
// exit;
|
340 |
-
|
341 |
-
if ( !empty( $_data ) && !isset( $_data->plugin ) ) {
|
342 |
-
$_data->plugin = $this->name;
|
343 |
-
}
|
344 |
-
|
345 |
-
return $_data;
|
346 |
-
}
|
347 |
-
|
348 |
-
/**
|
349 |
-
* Convert some objects to arrays when injecting data into the update API
|
350 |
-
*
|
351 |
-
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
|
352 |
-
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
|
353 |
-
*
|
354 |
-
* @since 3.6.5
|
355 |
-
*
|
356 |
-
* @param stdClass $data
|
357 |
-
*
|
358 |
-
* @return array
|
359 |
-
*/
|
360 |
-
private function convert_object_to_array( $data ) {
|
361 |
-
$new_data = array();
|
362 |
-
foreach ( $data as $key => $value ) {
|
363 |
-
$new_data[ $key ] = $value;
|
364 |
-
}
|
365 |
-
|
366 |
-
return $new_data;
|
367 |
-
}
|
368 |
-
|
369 |
-
/**
|
370 |
-
* Disable SSL verification in order to prevent download update failures
|
371 |
-
*
|
372 |
-
* @param array $args
|
373 |
-
* @param string $url
|
374 |
-
* @return object $array
|
375 |
-
*/
|
376 |
-
public function http_request_args( $args, $url ) {
|
377 |
-
|
378 |
-
$verify_ssl = $this->verify_ssl();
|
379 |
-
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
380 |
-
$args['sslverify'] = $verify_ssl;
|
381 |
-
}
|
382 |
-
return $args;
|
383 |
-
|
384 |
-
}
|
385 |
-
|
386 |
-
/**
|
387 |
-
* Calls the API and, if successfull, returns the object delivered by the API.
|
388 |
-
*
|
389 |
-
* @uses get_bloginfo()
|
390 |
-
* @uses wp_remote_post()
|
391 |
-
* @uses is_wp_error()
|
392 |
-
*
|
393 |
-
* @param string $_action The requested action.
|
394 |
-
* @param array $_data Parameters for the API action.
|
395 |
-
* @return false|object
|
396 |
-
*/
|
397 |
-
private function api_request( $_action, $_data ) {
|
398 |
-
|
399 |
-
global $wp_version, $edd_plugin_url_available;
|
400 |
-
|
401 |
-
$verify_ssl = $this->verify_ssl();
|
402 |
-
|
403 |
-
// Do a quick status check on this domain if we haven't already checked it.
|
404 |
-
$store_hash = md5( $this->api_url );
|
405 |
-
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
|
406 |
-
$test_url_parts = parse_url( $this->api_url );
|
407 |
-
|
408 |
-
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
|
409 |
-
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
|
410 |
-
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
|
411 |
-
|
412 |
-
if ( empty( $host ) ) {
|
413 |
-
$edd_plugin_url_available[ $store_hash ] = false;
|
414 |
-
} else {
|
415 |
-
$test_url = $scheme . '://' . $host . $port;
|
416 |
-
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
|
417 |
-
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
422 |
-
return;
|
423 |
-
}
|
424 |
-
|
425 |
-
$data = array_merge( $this->api_data, $_data );
|
426 |
-
|
427 |
-
if ( $data['slug'] != $this->slug ) {
|
428 |
-
return;
|
429 |
-
}
|
430 |
-
|
431 |
-
if( $this->api_url == trailingslashit ( home_url() ) ) {
|
432 |
-
return false; // Don't allow a plugin to ping itself
|
433 |
-
}
|
434 |
-
|
435 |
-
$api_params = array(
|
436 |
-
'edd_action' => 'get_version',
|
437 |
-
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
438 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
439 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
440 |
-
'version' => isset( $data['version'] ) ? $data['version'] : false,
|
441 |
-
'slug' => $data['slug'],
|
442 |
-
'author' => $data['author'],
|
443 |
-
'url' => home_url(),
|
444 |
-
'beta' => ! empty( $data['beta'] ),
|
445 |
-
);
|
446 |
-
|
447 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
448 |
-
|
449 |
-
if ( ! is_wp_error( $request ) ) {
|
450 |
-
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
451 |
-
}
|
452 |
-
|
453 |
-
if ( $request && isset( $request->sections ) ) {
|
454 |
-
$request->sections = maybe_unserialize( $request->sections );
|
455 |
-
} else {
|
456 |
-
$request = false;
|
457 |
-
}
|
458 |
-
|
459 |
-
if ( $request && isset( $request->banners ) ) {
|
460 |
-
$request->banners = maybe_unserialize( $request->banners );
|
461 |
-
}
|
462 |
-
|
463 |
-
if ( $request && isset( $request->icons ) ) {
|
464 |
-
$request->icons = maybe_unserialize( $request->icons );
|
465 |
-
}
|
466 |
-
|
467 |
-
if( ! empty( $request->sections ) ) {
|
468 |
-
foreach( $request->sections as $key => $section ) {
|
469 |
-
$request->$key = (array) $section;
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
return $request;
|
474 |
-
}
|
475 |
-
|
476 |
-
public function show_changelog() {
|
477 |
-
|
478 |
-
global $edd_plugin_data;
|
479 |
-
|
480 |
-
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
481 |
-
return;
|
482 |
-
}
|
483 |
-
|
484 |
-
if( empty( $_REQUEST['plugin'] ) ) {
|
485 |
-
return;
|
486 |
-
}
|
487 |
-
|
488 |
-
if( empty( $_REQUEST['slug'] ) ) {
|
489 |
-
return;
|
490 |
-
}
|
491 |
-
|
492 |
-
if( ! current_user_can( 'update_plugins' ) ) {
|
493 |
-
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
|
494 |
-
}
|
495 |
-
|
496 |
-
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
497 |
-
$beta = ! empty( $data['beta'] ) ? true : false;
|
498 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
499 |
-
$version_info = $this->get_cached_version_info( $cache_key );
|
500 |
-
|
501 |
-
if( false === $version_info ) {
|
502 |
-
|
503 |
-
$api_params = array(
|
504 |
-
'edd_action' => 'get_version',
|
505 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
506 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
507 |
-
'slug' => $_REQUEST['slug'],
|
508 |
-
'author' => $data['author'],
|
509 |
-
'url' => home_url(),
|
510 |
-
'beta' => ! empty( $data['beta'] )
|
511 |
-
);
|
512 |
-
|
513 |
-
$verify_ssl = $this->verify_ssl();
|
514 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
515 |
-
|
516 |
-
if ( ! is_wp_error( $request ) ) {
|
517 |
-
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
518 |
-
}
|
519 |
-
|
520 |
-
|
521 |
-
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
522 |
-
$version_info->sections = maybe_unserialize( $version_info->sections );
|
523 |
-
} else {
|
524 |
-
$version_info = false;
|
525 |
-
}
|
526 |
-
|
527 |
-
if( ! empty( $version_info ) ) {
|
528 |
-
foreach( $version_info->sections as $key => $section ) {
|
529 |
-
$version_info->$key = (array) $section;
|
530 |
-
}
|
531 |
-
}
|
532 |
-
|
533 |
-
$this->set_version_info_cache( $version_info, $cache_key );
|
534 |
-
|
535 |
-
}
|
536 |
-
|
537 |
-
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
|
538 |
-
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
|
539 |
-
}
|
540 |
-
|
541 |
-
exit;
|
542 |
-
}
|
543 |
-
|
544 |
-
public function get_cached_version_info( $cache_key = '' ) {
|
545 |
-
|
546 |
-
if( empty( $cache_key ) ) {
|
547 |
-
$cache_key = $this->cache_key;
|
548 |
-
}
|
549 |
-
|
550 |
-
$cache = get_option( $cache_key );
|
551 |
-
|
552 |
-
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
|
553 |
-
return false; // Cache is expired
|
554 |
-
}
|
555 |
-
|
556 |
-
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
|
557 |
-
$cache['value'] = json_decode( $cache['value'] );
|
558 |
-
if ( ! empty( $cache['value']->icons ) ) {
|
559 |
-
$cache['value']->icons = (array) $cache['value']->icons;
|
560 |
-
}
|
561 |
-
|
562 |
-
return $cache['value'];
|
563 |
-
|
564 |
-
}
|
565 |
-
|
566 |
-
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
567 |
-
|
568 |
-
if( empty( $cache_key ) ) {
|
569 |
-
$cache_key = $this->cache_key;
|
570 |
-
}
|
571 |
-
|
572 |
-
$data = array(
|
573 |
-
'timeout' => strtotime( '+3 hours', time() ),
|
574 |
-
'value' => json_encode( $value )
|
575 |
-
);
|
576 |
-
|
577 |
-
update_option( $cache_key, $data, 'no' );
|
578 |
-
|
579 |
-
}
|
580 |
-
|
581 |
-
/**
|
582 |
-
* Returns if the SSL of the store should be verified.
|
583 |
-
*
|
584 |
-
* @since 1.6.13
|
585 |
-
* @return bool
|
586 |
-
*/
|
587 |
-
private function verify_ssl() {
|
588 |
-
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
589 |
-
}
|
590 |
-
|
591 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/helpers.php
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'MeowCommon_Helpers' ) ) {
|
4 |
-
|
5 |
-
class MeowCommon_Helpers {
|
6 |
-
|
7 |
-
public static $version = MeowCommon_Admin::version;
|
8 |
-
|
9 |
-
static function is_divi_builder() {
|
10 |
-
return isset( $_GET['et_fb'] ) && $_GET['et_fb'] === '1';
|
11 |
-
}
|
12 |
-
|
13 |
-
static function is_cornerstone_builder() {
|
14 |
-
return isset( $_GET['cs-render'] ) && $_GET['cs-render'] === '1';
|
15 |
-
}
|
16 |
-
|
17 |
-
static function is_pagebuilder_request() {
|
18 |
-
return self::is_divi_builder() || self::is_cornerstone_builder();
|
19 |
-
}
|
20 |
-
|
21 |
-
static function is_asynchronous_request() {
|
22 |
-
return self::is_ajax_request() || self::is_woocommerce_ajax_request() || self::is_rest();
|
23 |
-
}
|
24 |
-
|
25 |
-
static function is_ajax_request() {
|
26 |
-
return wp_doing_ajax();
|
27 |
-
}
|
28 |
-
|
29 |
-
static function is_woocommerce_ajax_request() {
|
30 |
-
return !empty( $_GET['wc-ajax'] );
|
31 |
-
}
|
32 |
-
|
33 |
-
// Originally created by matzeeable, modified by jordymeow
|
34 |
-
static function is_rest() {
|
35 |
-
|
36 |
-
// WP_REST_Request init.
|
37 |
-
$is_rest_request = defined('REST_REQUEST') && REST_REQUEST;
|
38 |
-
if ( $is_rest_request ) {
|
39 |
-
MeowCommon_Classes_Rest::init_once();
|
40 |
-
return true;
|
41 |
-
}
|
42 |
-
|
43 |
-
// Plain permalinks.
|
44 |
-
$prefix = rest_get_url_prefix();
|
45 |
-
$request_contains_rest = isset( $_GET['rest_route'] ) && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0;
|
46 |
-
if ( $request_contains_rest) {
|
47 |
-
MeowCommon_Classes_Rest::init_once();
|
48 |
-
return true;
|
49 |
-
}
|
50 |
-
|
51 |
-
// It can happen that WP_Rewrite is not yet initialized, so better to do it.
|
52 |
-
global $wp_rewrite;
|
53 |
-
if ( $wp_rewrite === null ) {
|
54 |
-
$wp_rewrite = new WP_Rewrite();
|
55 |
-
}
|
56 |
-
$rest_url = wp_parse_url( trailingslashit( rest_url() ) );
|
57 |
-
$current_url = wp_parse_url( add_query_arg( array() ) );
|
58 |
-
if ( !$rest_url || !$current_url )
|
59 |
-
return false;
|
60 |
-
|
61 |
-
// URL Path begins with wp-json.
|
62 |
-
if ( !empty( $current_url['path'] ) && !empty( $rest_url['path'] ) ) {
|
63 |
-
$request_contains_rest = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
|
64 |
-
if ( $request_contains_rest) {
|
65 |
-
MeowCommon_Classes_Rest::init_once();
|
66 |
-
return true;
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
|
73 |
-
static function test_error( $error = 'timeout', $diceSides = 1 ) {
|
74 |
-
if ( rand( 1, $diceSides ) === 1 ) {
|
75 |
-
if ( $error === 'timeout' ) {
|
76 |
-
header("HTTP/1.0 408 Request Timeout");
|
77 |
-
die();
|
78 |
-
}
|
79 |
-
else {
|
80 |
-
trigger_error( "Error", E_USER_ERROR);
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
static function php_error_logs() {
|
86 |
-
$errorpath = ini_get( 'error_log' );
|
87 |
-
$output_lines = array();
|
88 |
-
if ( !empty( $errorpath ) && file_exists( $errorpath ) ) {
|
89 |
-
try {
|
90 |
-
$file = new SplFileObject( $errorpath, 'r' );
|
91 |
-
$file->seek( PHP_INT_MAX );
|
92 |
-
$last_line = $file->key();
|
93 |
-
$iterator = new LimitIterator( $file, $last_line > 3500 ? $last_line - 3500 : 0, $last_line );
|
94 |
-
$lines = iterator_to_array( $iterator );
|
95 |
-
$previous_line = null;
|
96 |
-
foreach ( $lines as $line ) {
|
97 |
-
|
98 |
-
// Parse the date
|
99 |
-
$date = '';
|
100 |
-
try {
|
101 |
-
$dateArr = [];
|
102 |
-
preg_match( '~^\[(.*?)\]~', $line, $dateArr );
|
103 |
-
if ( isset( $dateArr[0] ) ) {
|
104 |
-
$line = str_replace( $dateArr[0], '', $line );
|
105 |
-
$line = trim( $line );
|
106 |
-
$date = new DateTime( $dateArr[1] );
|
107 |
-
$date = get_date_from_gmt( $date->format('Y-m-d H:i:s'), 'Y-m-d H:i:s' );
|
108 |
-
}
|
109 |
-
else {
|
110 |
-
continue;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
catch ( Exception $e ) {
|
114 |
-
continue;
|
115 |
-
}
|
116 |
-
|
117 |
-
// Parse the error
|
118 |
-
$type = '';
|
119 |
-
if ( preg_match( '/PHP Fatal error/', $line ) ) {
|
120 |
-
$line = trim( str_replace( 'PHP Fatal error:', '', $line ) );
|
121 |
-
$type = 'fatal';
|
122 |
-
}
|
123 |
-
else if ( preg_match( '/PHP Warning/', $line ) ) {
|
124 |
-
$line = trim( str_replace( 'PHP Warning:', '', $line ) );
|
125 |
-
$type = 'warning';
|
126 |
-
}
|
127 |
-
else if ( preg_match( '/PHP Notice/', $line ) ) {
|
128 |
-
$line = trim( str_replace( 'PHP Notice:', '', $line ) );
|
129 |
-
$type = 'notice';
|
130 |
-
}
|
131 |
-
else if ( preg_match( '/PHP Parse error/', $line ) ) {
|
132 |
-
$line = trim( str_replace( 'PHP Parse error:', '', $line ) );
|
133 |
-
$type = 'parse';
|
134 |
-
}
|
135 |
-
else if ( preg_match( '/PHP Exception/', $line ) ) {
|
136 |
-
$line = trim( str_replace( 'PHP Exception:', '', $line ) );
|
137 |
-
$type = 'exception';
|
138 |
-
}
|
139 |
-
else {
|
140 |
-
continue;
|
141 |
-
}
|
142 |
-
|
143 |
-
// Skip the error if is the same as before.
|
144 |
-
if ( $line !== $previous_line ) {
|
145 |
-
array_push( $output_lines, array( 'date' => $date, 'type' => $type, 'content' => $line ) );
|
146 |
-
$previous_line = $line;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
catch ( OutOfBoundsException $e ) {
|
151 |
-
error_log( $e->getMessage() );
|
152 |
-
return array();
|
153 |
-
}
|
154 |
-
}
|
155 |
-
return $output_lines;
|
156 |
-
|
157 |
-
// else {
|
158 |
-
// $output_lines = array_reverse( $output_lines );
|
159 |
-
// $html = '';
|
160 |
-
// $previous = '';
|
161 |
-
// foreach ( $output_lines as $line ) {
|
162 |
-
// // Let's avoid similar errors, since it's not useful. We should also make this better
|
163 |
-
// // and not only theck this depending on tie.
|
164 |
-
// if ( preg_replace( '/\[.*\] PHP/', '', $previous ) !== preg_replace( '/\[.*\] PHP/', '', $line ) ) {
|
165 |
-
// $html .= $line;
|
166 |
-
// $previous = $line;
|
167 |
-
// }
|
168 |
-
// }
|
169 |
-
// return $html;
|
170 |
-
// }
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
if ( MeowCommon_Helpers::is_rest() ) {
|
175 |
-
ini_set( 'display_errors', 0 );
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/img/default.png
DELETED
Binary file
|
trunk/common/img/kinsta.png
DELETED
Binary file
|
trunk/common/img/media-cleaner.jpg
DELETED
Binary file
|
trunk/common/img/media-file-renamer.jpg
DELETED
Binary file
|
trunk/common/img/meow-gallery.jpg
DELETED
Binary file
|
trunk/common/img/meow-lightbox.jpg
DELETED
Binary file
|
trunk/common/img/meowapps.png
DELETED
Binary file
|
trunk/common/img/stackpath.png
DELETED
Binary file
|
trunk/common/img/wp-retina-2x.jpg
DELETED
Binary file
|
trunk/common/img/wplr-sync.jpg
DELETED
Binary file
|
trunk/common/licenser.php
DELETED
@@ -1,126 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'MeowCommon_Licenser' ) ) {
|
4 |
-
|
5 |
-
class MeowCommon_Licenser {
|
6 |
-
public $license = null;
|
7 |
-
public $prefix; // prefix used for actions, filters (mfrh)
|
8 |
-
public $mainfile; // plugin main file (media-file-renamer.php)
|
9 |
-
public $domain; // domain used for translation (media-file-renamer)
|
10 |
-
public $item; // name of the Pro plugin (Media File Renamer Pro)
|
11 |
-
public $version; // version of the plugin (Media File Renamer Pro)
|
12 |
-
|
13 |
-
public function __construct( $prefix, $mainfile, $domain, $item, $version ) {
|
14 |
-
$this->prefix = $prefix;
|
15 |
-
$this->mainfile = $mainfile;
|
16 |
-
$this->domain = $domain;
|
17 |
-
$this->item = $item;
|
18 |
-
$this->version = $version;
|
19 |
-
|
20 |
-
if ( $this->is_registered() ) {
|
21 |
-
add_filter( $this->prefix . '_meowapps_is_registered', array( $this, 'is_registered' ), 10 );
|
22 |
-
}
|
23 |
-
|
24 |
-
if ( MeowCommon_Helpers::is_rest() ) {
|
25 |
-
new MeowCommon_Classes_Rest_License( $this );
|
26 |
-
}
|
27 |
-
else if ( is_admin() ) {
|
28 |
-
$license_key = $this->license && isset( $this->license['key'] ) ? $this->license['key'] : "";
|
29 |
-
new MeowCommon_Classes_Updater(
|
30 |
-
( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) . '://store.meowapps.com', $this->mainfile,
|
31 |
-
array(
|
32 |
-
'version' => $this->version,
|
33 |
-
'license' => $license_key,
|
34 |
-
'item_name' => $this->item,
|
35 |
-
'wp_override' => true,
|
36 |
-
'author' => 'Jordy Meow',
|
37 |
-
'url' => strtolower( home_url() ),
|
38 |
-
'beta' => false
|
39 |
-
)
|
40 |
-
);
|
41 |
-
}
|
42 |
-
}
|
43 |
-
|
44 |
-
function retry_validation() {
|
45 |
-
if ( isset( $_POST[$this->prefix . '_pro_serial'] ) ) {
|
46 |
-
$serial = $_POST[$this->prefix . '_pro_serial'];
|
47 |
-
$this->validate_pro( $serial );
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
function is_registered( $force = false ) {
|
52 |
-
if ( !$force && !empty( $this->license ) )
|
53 |
-
return empty( $this->license['issue'] );
|
54 |
-
$this->license = get_option( $this->prefix . '_license', "" );
|
55 |
-
if ( empty( $this->license ) || !empty( $this->license['issue'] ) )
|
56 |
-
return false;
|
57 |
-
if ( $this->license['expires'] == "lifetime" )
|
58 |
-
return true;
|
59 |
-
$datediff = strtotime( $this->license['expires'] ) - time();
|
60 |
-
$days = floor( $datediff / ( 60 * 60 * 24 ) );
|
61 |
-
if ( $days < 0 )
|
62 |
-
$this->validate_pro( $this->license['key'] );
|
63 |
-
return true;
|
64 |
-
}
|
65 |
-
|
66 |
-
function validate_pro( $subscr_id ) {
|
67 |
-
$prefix = $this->prefix;
|
68 |
-
delete_option( $prefix . '_license', "" );
|
69 |
-
if ( empty( $subscr_id ) )
|
70 |
-
return false;
|
71 |
-
$url = ( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) .
|
72 |
-
'://store.meowapps.com/?edd_action=activate_license' .
|
73 |
-
'&item_name=' . urlencode( $this->item ) .
|
74 |
-
'&license=' . $subscr_id . '&url=' . strtolower( home_url() ) . '&cache=' . bin2hex( openssl_random_pseudo_bytes( 4 ) );
|
75 |
-
$response = wp_remote_get( $url, array(
|
76 |
-
'user-agent' => "MeowApps",
|
77 |
-
'sslverify' => get_option( 'force_sslverify', false ),
|
78 |
-
'timeout' => 45,
|
79 |
-
'method' => 'GET'
|
80 |
-
)
|
81 |
-
);
|
82 |
-
$body = is_array( $response ) ? $response['body'] : null;
|
83 |
-
$post = @json_decode( $body );
|
84 |
-
$status = null;
|
85 |
-
$license = null;
|
86 |
-
$expires = null;
|
87 |
-
$logs = null;
|
88 |
-
if ( !$post || ( property_exists( $post, 'code' ) ) ) {
|
89 |
-
$status = 'error';
|
90 |
-
// $status = __( "There was an error while validating the serial.<br />Please contact <a target='_blank' href='https://meowapps.com/contact/'>Meow Apps</a> and mention the following log: <br /><ul>", $this->domain );
|
91 |
-
$logs = "<li>Server IP: <b>" . gethostbyname( $_SERVER['SERVER_NAME'] ) . "</b></li>";
|
92 |
-
$logs .= "<li>Google GET: ";
|
93 |
-
$r = wp_remote_get( 'http://google.com' );
|
94 |
-
$logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
|
95 |
-
$logs .= "</li><li>MeowApps GET: ";
|
96 |
-
$r = wp_remote_get( 'http://meowapps.com' );
|
97 |
-
$logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
|
98 |
-
$logs .= "</li><li>MeowApps STORE:<br /><br />";
|
99 |
-
$logs .= "REQUEST: $url<br /><br />";
|
100 |
-
$logs .= "RESPONSE: ";
|
101 |
-
$logs .= print_r( $response, true );
|
102 |
-
$logs .= "</li></ul>";
|
103 |
-
error_log( print_r( $response, true ) );
|
104 |
-
}
|
105 |
-
else if ( $post->license !== "valid" ) {
|
106 |
-
$status = $post->error ;
|
107 |
-
}
|
108 |
-
else {
|
109 |
-
$license = $post->license;
|
110 |
-
$expires = $post->expires;
|
111 |
-
delete_option( '_site_transient_update_plugins' );
|
112 |
-
}
|
113 |
-
update_option( $prefix . '_license', array(
|
114 |
-
'key' => $subscr_id,
|
115 |
-
'issue' => $status,
|
116 |
-
'logs' => $logs,
|
117 |
-
'expires' => $expires,
|
118 |
-
'license' => $license ) );
|
119 |
-
return $this->is_registered( true );
|
120 |
-
}
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/common/releases.txt
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
Releases of the Meow Commmon has to be carefully made, and version_compare
|
2 |
-
should be used when big changes are made.
|
3 |
-
|
4 |
-
= 3.3 (2020/12/19) =
|
5 |
-
* is_cornerstone_builder()
|
6 |
-
* is_pagebuilder_request()
|
|
|
|
|
|
|
|
|
|
|
|
trunk/languages/media-file-renamer-fr_FR.mo
DELETED
Binary file
|
trunk/media-file-renamer.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Media File Renamer
|
4 |
-
Plugin URI: https://meowapps.com
|
5 |
-
Description: Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
6 |
-
Version: 5.1.5
|
7 |
-
Author: Jordy Meow
|
8 |
-
Author URI: https://meowapps.com
|
9 |
-
Text Domain: media-file-renamer
|
10 |
-
Domain Path: /languages
|
11 |
-
|
12 |
-
Originally developed for two of my websites:
|
13 |
-
- Jordy Meow (https://offbeatjapan.org)
|
14 |
-
- Haikyo (https://haikyo.org)
|
15 |
-
*/
|
16 |
-
|
17 |
-
define( 'MFRH_VERSION', '5.1.5' );
|
18 |
-
define( 'MFRH_PREFIX', 'mfrh' );
|
19 |
-
define( 'MFRH_DOMAIN', 'media-file-renamer' );
|
20 |
-
define( 'MFRH_ENTRY', __FILE__ );
|
21 |
-
define( 'MFRH_PATH', dirname( __FILE__ ) );
|
22 |
-
define( 'MFRH_URL', plugin_dir_url( __FILE__ ) );
|
23 |
-
|
24 |
-
require_once( 'classes/init.php');
|
25 |
-
|
26 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/readme.txt
DELETED
@@ -1,435 +0,0 @@
|
|
1 |
-
=== Media File Renamer - Auto & Manual Rename ===
|
2 |
-
Contributors: TigrouMeow
|
3 |
-
Tags: rename, file, media, move, seo, files, renamer, optimize, library
|
4 |
-
Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
|
5 |
-
Requires at least: 5.0
|
6 |
-
Tested up to: 5.6
|
7 |
-
Requires PHP: 5.6
|
8 |
-
Stable tag: 5.1.5
|
9 |
-
|
10 |
-
Renames your media files for better SEO and a nicer filesystem (automatically or manually).
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
Renames your media files for better SEO and a nicer filesystem (automatically or manually). For more information, please visit the official website: [Media File Renamer](https://meowapps.com/plugin/media-file-renamer/).
|
14 |
-
|
15 |
-
=== HOW IT WORKS ===
|
16 |
-
Media File Renamer, by default, automatically renames the filenames of your Media entries based on their titles. You can trigger this, or you can let it happen every time you modify titles. You can also rename the files manually. The references to those files will be also updated (posts, pages, custom types, metadata, etc...). You can use the Media Library, or the Media Edit screen.
|
17 |
-
|
18 |
-
However, it is highly recommended to use the pretty and very dynamic Renamer Dashboard. If you like to work fast and well, you will really love working with this modern dashboard.
|
19 |
-
|
20 |
-
[youtube https://youtu.be/XPbKE8pq0i0]
|
21 |
-
|
22 |
-
Please have a look at the [tutorial](https://meowapps.com/media-file-renamer-tutorial/).
|
23 |
-
|
24 |
-
=== COMPATIBILITY ===
|
25 |
-
It works with a lot of features of WordPress and other plugins, such as Retina files, WebP, rescaled image (since WP 5.3), PDF Thumbnails, UTF8 files, optimized images, various encodings, etc. There are too many handled and specific cases to be listed here, but we are doing our best to keep up with everything :)
|
26 |
-
|
27 |
-
=== PRO VERSION ===
|
28 |
-
More features are added in the [Pro Version](https://meowapps.com/plugin/media-file-renamer/), such as:
|
29 |
-
- Transliteration (replace various accents, emoticons, umlauts, cyrillic, diacritics, by their ASCII equivalent)
|
30 |
-
- Automatic renaming based on the attached posts, products (and other post types), or ALT text
|
31 |
-
- Anonymizer (rename the files with anonymous files)
|
32 |
-
- Move files to another directory
|
33 |
-
- Metadata syncing (ALT text, title, etc)
|
34 |
-
- Numbered files (to allow similar filenames to be renamed)
|
35 |
-
- Force Rename (if your install is broken, this will help you to re-link your media entries to your files)
|
36 |
-
|
37 |
-
=== BE CAREFUL: PREPARE A BACKUP ===
|
38 |
-
Renaming (or moving) files is a dangerous process. Before doing anything in bulk, try renaming your files on by one, then check if the references (in your pages) have been updated properly. The renaming can't cover all use cases, as some plugins are unfortunately using unconventional ways to encode the usage of the files. Therefore, **it is absolutely necessary to backup your files and database** in order to enjoy this plugin at its full extent.
|
39 |
-
|
40 |
-
=== WHEN SOMETHING BAD HAPPENS ===
|
41 |
-
If your website seems broken after a few renames, try to **clear your cache**. The cached HTML is often using the old references. You can also enable the Undo feature and try to rollback to the previous filenames. If references aren't updated properly, please write a nice post (not an angry one) in the support threads :) I am trying my best to cover more and more use cases. Please have a look here: [Questions & Issues](https://meowapps.com/media-file-renamer-faq-issues/).
|
42 |
-
|
43 |
-
=== A SIMPLER PLUGIN ===
|
44 |
-
If you only need an editable field in order to modify the filename, please try [Phoenix Media Rename](https://wordpress.org/plugins/phoenix-media-rename). It's simpler, and just does that. And yes, we are friends and we collaborate! :)
|
45 |
-
|
46 |
-
=== FOR DEVELOPERS ===
|
47 |
-
The plugin can be tweaked in many ways, there are many actions and filters available. Through them, for example, you can customize the automatic renaming to your liking. There is also a little API that you can call. More about this [here](https://meowapps.com/media-file-renamer-faq/).
|
48 |
-
|
49 |
-
== Installation ==
|
50 |
-
|
51 |
-
1. Upload the plugin to your WordPress.
|
52 |
-
2. Activate the plugin through the 'Plugins' menu.
|
53 |
-
3. Try it with one file first! :)
|
54 |
-
|
55 |
-
== Upgrade Notice ==
|
56 |
-
|
57 |
-
1. Replace the plugin with the new one.
|
58 |
-
2. Nothing else is required! :)
|
59 |
-
|
60 |
-
== Screenshots ==
|
61 |
-
|
62 |
-
1. Type in the name of your media, that is all.
|
63 |
-
2. Special screen for bulk actions.
|
64 |
-
3. This needs to be renamed.
|
65 |
-
4. The little lock and unlock icons.
|
66 |
-
5. Options for the automatic renaming (there are more options than just this).
|
67 |
-
|
68 |
-
== Changelog ==
|
69 |
-
|
70 |
-
= 5.1.5 (2021/02/12) =
|
71 |
-
* Fix: References for moved files were not updated.
|
72 |
-
|
73 |
-
= 5.1.4 =
|
74 |
-
* Add: Sanitize filename after they have been through the mfrh_new_filename filter.
|
75 |
-
|
76 |
-
= 5.1.3 =
|
77 |
-
* Add: Greek support.
|
78 |
-
* Fix: Better sensitive file check.
|
79 |
-
* Fix: Manual rename with WP CLI.
|
80 |
-
|
81 |
-
= 5.1.2 =
|
82 |
-
* Add: Auto attach feature.
|
83 |
-
* Add: Added Locked in the filters.
|
84 |
-
* Update: Icons position.
|
85 |
-
|
86 |
-
= 5.1.1 =
|
87 |
-
* Fix: Issue with roles overriding and WP-CLI.
|
88 |
-
* Fix: Issue with REST in the Common Dashboard.
|
89 |
-
|
90 |
-
= 5.1.0 =
|
91 |
-
* Add: Support overriding roles.
|
92 |
-
* Fix: The layout of the dashboard was broken by WPBakery.
|
93 |
-
|
94 |
-
= 5.0.9 =
|
95 |
-
* Fix: Rules for renaming files with slashes were imperfect.
|
96 |
-
* Fix: ArgumentCountError with action_sync_alt (too few arguments).
|
97 |
-
* Update: Avoid useless async refreshes.
|
98 |
-
|
99 |
-
= 5.0.8 (2020/09/26) =
|
100 |
-
* Fix: Two options were not working very logically.
|
101 |
-
* Fix: Avoid errors when the PHP Error Logs is too big.
|
102 |
-
* Update: Use Nonce for Rest API.
|
103 |
-
|
104 |
-
= 5.0.7 (2020/09/08) =
|
105 |
-
* Fix: Incompatibility with WordPress 4.8.
|
106 |
-
|
107 |
-
= 5.0.6 (2020/09/08) =
|
108 |
-
* Update: A check for the rename status was performed for every entry in the Media Library all at the same time, and that was causing slower performance (especially when more than 10 or 20 entries are displayed per page). It's now performed with a maximum of two concurrent requests at a time.
|
109 |
-
* Note: If you like it, please review the plugin [by clicking here](https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post). It's important for us :) Thank you!
|
110 |
-
|
111 |
-
= 5.0.5 (2020/09/04) =
|
112 |
-
* Fix: Issue with case sensitive filenames fixed.
|
113 |
-
* Update: Additional rules for auto-renaming.
|
114 |
-
|
115 |
-
= 5.0.4 (2020/08/29) =
|
116 |
-
* Fix: Undo All wasn't working on WordPress install with modified DB prefixes.
|
117 |
-
* Fix: Works with Plain Permalinks.
|
118 |
-
* Update: More natural feel for the field in the Media Library.
|
119 |
-
|
120 |
-
= 5.0.3 (2020/08/21) =
|
121 |
-
* Fix: Use MutationObserver to make sure the Renamer Field attach itself to dynamic Media Librairies.
|
122 |
-
* Fix: Fixed a notice related to WP 5.5.
|
123 |
-
* Update: Better handling of emoticons.
|
124 |
-
|
125 |
-
= 5.0.2 =
|
126 |
-
* Info: Brand new UI! Made everything much clearer.
|
127 |
-
* Fix: Method was not always taken in account.
|
128 |
-
|
129 |
-
= 5.0.1 =
|
130 |
-
* Info: Brand new UI! Made everything much clearer.
|
131 |
-
* Fix: Method was not always taken in account.
|
132 |
-
* Update: Accessibility and usability.
|
133 |
-
* Fix: Field wasn't displayed if no auto mode was selected.
|
134 |
-
|
135 |
-
= 5.0.0 =
|
136 |
-
* Info: Brand new UI! Made everything much clearer.
|
137 |
-
* Fix: Issues related to WebP and PDF thumbnails.
|
138 |
-
* Fix: Issues related to breaking characters in the Media or Attached Post Title.
|
139 |
-
|
140 |
-
= 4.7.0 =
|
141 |
-
* Fix: Issue with rare characters used in the title.
|
142 |
-
* Fix: Issue with PDF thumbnails.
|
143 |
-
|
144 |
-
= 4.6.9 =
|
145 |
-
* Add: There was an issue with Auto-Rename sometimes not appearing when the Sensitive Files Check was disabled.
|
146 |
-
|
147 |
-
= 4.6.8 =
|
148 |
-
* Add: New filter 'mfrh_allow_rename'. Developers can now allow/reject the renaming (useful for bulk).
|
149 |
-
* Fix: The file numbering wasn't working fine in a few specific cases.
|
150 |
-
|
151 |
-
= 4.6.7 =
|
152 |
-
* Add: Better handling of dots and hyphens (especially the non-standard ones).
|
153 |
-
* Add: Support for WebP.
|
154 |
-
|
155 |
-
= 4.6.5 =
|
156 |
-
* Fix: Little (i18n) fixes in the admin.
|
157 |
-
* Add: Doesn't show the button to the Dashboard if Auto is disabled.
|
158 |
-
* Update: Admin refreshed to 2.4.
|
159 |
-
|
160 |
-
= 4.5.9 =
|
161 |
-
* Fix: Column wasn't displayed when manual enabled and automatic disabled.
|
162 |
-
|
163 |
-
= 4.5.8 =
|
164 |
-
* Fix: Fixed the AJAX/REST check.
|
165 |
-
* Update: Admin refresh.
|
166 |
-
|
167 |
-
= 4.5.5 =
|
168 |
-
* Update: Dashboard and Updater... updated.
|
169 |
-
* Fix: The WooCommerce add-on file was missing.
|
170 |
-
* Fix: Search was sometimes not working properly in the Media Library.
|
171 |
-
* Info: We are working on a bunch of updates concerning the usage of dots, hyphens and other characters, so expect the renaming rules to change a bit (for the best).
|
172 |
-
|
173 |
-
= 4.5.2 =
|
174 |
-
* Update: Code cleaning, Youtube video.
|
175 |
-
* Fix: Issue with updating the ALT field.
|
176 |
-
|
177 |
-
= 4.4.0 =
|
178 |
-
* Update: Compatibility with WP 5.0.
|
179 |
-
* Update: Compatibility with Real Media Library.
|
180 |
-
|
181 |
-
= 4.2.8 =
|
182 |
-
* Fix: Better support for Real Media Library.
|
183 |
-
* Update: Improved transliteration.
|
184 |
-
|
185 |
-
= 4.2.7 =
|
186 |
-
* Fix: Removed Updraft.
|
187 |
-
* Update: UTF-8 is handled by default, no need to have an option for it.
|
188 |
-
* Add: Option for transliteration (cyrillic, accents, umlauts).
|
189 |
-
|
190 |
-
= 4.2.2 =
|
191 |
-
* Add: Polylang compatibility.
|
192 |
-
* Update: UI enhancements and attempt to make the renaming faster.
|
193 |
-
|
194 |
-
= 4.2.1 =
|
195 |
-
* Add: All the actions in the Media Library are now asynchronous. No more page reload!
|
196 |
-
* Update: Many changes and little enhancements in the code, for speed, security and code-tidiness.
|
197 |
-
|
198 |
-
= 4.0.4 =
|
199 |
-
* Fix: Renaming using filters (work in progress).
|
200 |
-
* Fix: Insensitive-case match was giving the wrong file in some cases (webp for instance).
|
201 |
-
|
202 |
-
= 4.0.2 =
|
203 |
-
* Fix: PDF thumbnails support.
|
204 |
-
* Update: Code improvement, faster SQL queries.
|
205 |
-
|
206 |
-
= 4.0.1 =
|
207 |
-
* Fix: Issue with the tolowercase feature.
|
208 |
-
* Fix: Extension issue with mfrh_new_filename filter.
|
209 |
-
* Add: Filter to rewrite Alt Text.
|
210 |
-
|
211 |
-
= 4.0.0 =
|
212 |
-
* Update: Huge code cleaning and major refactorization. The core was also rewritten.
|
213 |
-
* Add: Compatibility with Beaver Builder.
|
214 |
-
* Fix: Avoid looking for too much perfection (which is dangerous) when using numbered files.
|
215 |
-
* Fix: Works fine now with image sizes in the meta which has the... same size.
|
216 |
-
|
217 |
-
= 3.7.2 =
|
218 |
-
* Update: Now uploading Media into Post rename the filename accordingly.
|
219 |
-
|
220 |
-
= 3.7.1 =
|
221 |
-
* Fix: Rename on Upload issue in a few cases.
|
222 |
-
|
223 |
-
= 3.7.0 =
|
224 |
-
* Update: Improved Rename on Upload.
|
225 |
-
* Fix: Annoying warning (but it was not causing any error).
|
226 |
-
|
227 |
-
= 3.6.9 =
|
228 |
-
* Update: Manual Rename allows a new extension.
|
229 |
-
|
230 |
-
= 3.6.8 =
|
231 |
-
* Add: Little API.
|
232 |
-
|
233 |
-
= 3.6.7 =
|
234 |
-
* Add: Bulk rename in the Media Library.
|
235 |
-
|
236 |
-
= 3.6.6 =
|
237 |
-
* Add: Table with the filenames before and after renaming + CSV Export (works with Redirection plugin).
|
238 |
-
|
239 |
-
= 3.6.4 =
|
240 |
-
* Add: Button "Undo All" to restore all the original filenames.
|
241 |
-
* Fix: Avoid the Numbered Files and Force Renamed options to be activated at the same time.
|
242 |
-
|
243 |
-
= 3.6.0 =
|
244 |
-
* Fix: Compatibility with WPML.
|
245 |
-
* Fix: There was a compatibility issue with retina.
|
246 |
-
|
247 |
-
= 3.5.8 =
|
248 |
-
* Add: New button "Lock All"
|
249 |
-
* Fix: Button "Unlock All and Rename" was not really unlocking everything.
|
250 |
-
|
251 |
-
= 3.5.6 =
|
252 |
-
* Fix: Sometimes numbered files were renamed something like abc-2-2.jpg.
|
253 |
-
* Update: Rename with lowercase to avoid issues.
|
254 |
-
* Add: Option for Pro, Media Title is synchronized with Title of Attached Post.
|
255 |
-
|
256 |
-
= 3.5.4 =
|
257 |
-
* Add: mfrh_replace_rules filter allows you to personalize the renaming at the character level.
|
258 |
-
|
259 |
-
= 3.5.2 =
|
260 |
-
* Fix: Update system fixed and code cleaning.
|
261 |
-
|
262 |
-
= 3.4.5 =
|
263 |
-
* Fix: Better handling of umlauts.
|
264 |
-
* Info: There will be an important warning showing up during this update. It is an important announcement.
|
265 |
-
|
266 |
-
= 3.2.7 =
|
267 |
-
* Fix: Slug was not getting renamed after recent WP update.
|
268 |
-
* Fix: Tiny fixed to avoid notices.
|
269 |
-
* Add: Support for WPML Media (thanks to David García froml WPML Team).
|
270 |
-
|
271 |
-
= 3.2.4 =
|
272 |
-
* Fix: Should work with more plugins/themes, WooCommerce for example. The updates aren't done only on the full URLs of the images in the DB now but also on the relative uploads path as well.
|
273 |
-
* Info: If you have some time, please review me nicely at https://wordpress.org/support/view/plugin-reviews/media-file-renamer?rate=5#postform. Thanks to you, I get a lot of motivation to make this plugin better :)
|
274 |
-
|
275 |
-
= 3.2.3 =
|
276 |
-
* Add: Option to rename depending on the ALT. Useful if you get interesting information in your ALT.
|
277 |
-
* Update: Sync ALT also works with Attached Post Title.
|
278 |
-
* Fix: Better handling of norwegian letters (will improve this kind of things over time).
|
279 |
-
|
280 |
-
= 3.2.2 =
|
281 |
-
* Add: Rename the file during upload, based on the media title. Not by default, check the options :)
|
282 |
-
|
283 |
-
= 3.2.0 =
|
284 |
-
* Fix: Logging could not be enabled.
|
285 |
-
* Update: Code cleaning.
|
286 |
-
|
287 |
-
= 3.1.0 =
|
288 |
-
* Update: The UI was a bit modified and enhanced. I also think it is simpler and cleaner.
|
289 |
-
* Update: Removed the auto-flagging process which was causing issues on sizeable installs.
|
290 |
-
|
291 |
-
= 3.0.0 =
|
292 |
-
* Fix: The references in the excerpts are now also updated (they are used by WooCommerce).
|
293 |
-
* Add: Undo button. When the media is unlocked and has been renamed, you have a Undo button. You need to active this in the option.
|
294 |
-
* Update: Everything has been moved into the Meow Apps menu for a cleaner admin.
|
295 |
-
|
296 |
-
= 2.7.8 =
|
297 |
-
* Fix: Removed Flattr.
|
298 |
-
* Add: Additional cleaning to avoid extensions sometimes written in the title by WP.
|
299 |
-
* Add: Clean out the english apostrophe 's during the creation of the new filename.
|
300 |
-
|
301 |
-
= 2.7.6 =
|
302 |
-
* Add: New option to remove the ad, the Flattr button and the information message about the Pro.
|
303 |
-
* Fix: Renaming slug was not working well after latest WordPress updates
|
304 |
-
* Fix: Use direct links for all my images and links to follow WordPress rules.
|
305 |
-
|
306 |
-
= 2.7.1 =
|
307 |
-
* Info: A file mfrh_custom.php has been added. If you are an advanced users or a developer, please have a look at the FAQ here: https://wordpress.org/plugins/media-file-renamer/faq/. Since I am only one developer, I can't cover all the renaming cases we have (since sometimes plugins keep their own links to the filenames; such as WooCommerce). That will make it easy to advanced users to push Media File Renamer to cover more and more special cases.
|
308 |
-
|
309 |
-
= 2.6.9 =
|
310 |
-
* Change: Modified description and information about the mfrh_url_renamed and mfrh_media_renamed filters.
|
311 |
-
* Add: New option to force renaming file (even though the file failed to be renamed). That will help PRO users to fix their broken install, often after a migration for example (often related to change of hosting service using different encoding).
|
312 |
-
* Fix: Click on lock/unlock doesn't take you back to the first page anymore.
|
313 |
-
* Fix: Little naming issue when numbering + custom filter is used.
|
314 |
-
|
315 |
-
= 2.6.0 =
|
316 |
-
* Add: Lock/Unlock icons in the Media Library.
|
317 |
-
* Add: Rename depending on the title of the post the media is attached to.
|
318 |
-
|
319 |
-
= 2.5.0 =
|
320 |
-
* Update: WordPress 4.4.
|
321 |
-
* Add: Add -2, -3, etc... when filenames are similar. Pro only.
|
322 |
-
* Fix: There was a glitch when .jpeg extension were used. Now keep them as .jpeg.
|
323 |
-
|
324 |
-
= 2.4.0 =
|
325 |
-
* Fix: There was a possibility that the image sizes filenames could be overwritten wrongly.
|
326 |
-
* Update: Rename the GUID (File Name) is now the default. Too many people think it is a bug while it is not.
|
327 |
-
* Add: UTF-8 support for renaming files. Before playing with this, give it a try. Windows-based hosting service will probably not work well with this.
|
328 |
-
* Fix: Auto-Rename was renaming files even though it was disabled.
|
329 |
-
* Update: If Auto-Rename is disabled, the Media Library column is not shown anymore, neither is the dashboard (they are useless in that case).
|
330 |
-
* Add: Metadata containing '%20' instead of spaces are now considered too during the renaming.
|
331 |
-
|
332 |
-
= 2.3.0 =
|
333 |
-
* Add: Update the metadata (true by default).
|
334 |
-
* Fix: Guid was renamed wrongly in one rare case.
|
335 |
-
* Fix: Double extension issue with manual renaming.
|
336 |
-
|
337 |
-
= 2.2.4 =
|
338 |
-
* Fix: Couldn't rename automatically the files without changing the titles, now the feature is back.
|
339 |
-
* Fix: Better 'explanations' before renaming.
|
340 |
-
* Fix: Should work with WPML Media now.
|
341 |
-
* Fix: Manage empty filenames by naming them 'empty'.
|
342 |
-
|
343 |
-
= 2.2.2 =
|
344 |
-
* Add: Option to automatically sync the alternative text with the title.
|
345 |
-
* Add: Filters and Actions to allow plugins (or custom code) to customize the renaming.
|
346 |
-
* Fix: Avoid to rename file if title is not changed (annoying if you previously manually updated it).
|
347 |
-
* Change: Plugin functions are only loaded if the user is using the admin.
|
348 |
-
|
349 |
-
= 2.2.0 =
|
350 |
-
* Add: Many new options.
|
351 |
-
* Add: Pro version.
|
352 |
-
* Add: Manual file rename.
|
353 |
-
* Update: Use actions for renaming (to facilitate support for more renaming features).
|
354 |
-
|
355 |
-
= 2.0.0 =
|
356 |
-
* Fix: Texts.
|
357 |
-
* Fix: Versioning.
|
358 |
-
|
359 |
-
= 1.9.4 =
|
360 |
-
* Add: New option to avoid to modify database (no updates, only renaming).
|
361 |
-
* Add: New option to force update the GUID (aka "File name"...). Not recommended _at all_.
|
362 |
-
* Fix: Options were without effect.
|
363 |
-
* Fix: GUID issue.
|
364 |
-
|
365 |
-
= 1.3.4 =
|
366 |
-
* Fix: issue with attachments without metadata.
|
367 |
-
* Fix: UTF-8 title name (i.e. Japanese or Chinese characters).
|
368 |
-
|
369 |
-
= 1.3.0 =
|
370 |
-
* Add: option to rename the files automatically when a post is published.
|
371 |
-
|
372 |
-
= 1.2.2 =
|
373 |
-
* Fix: the 'to be renamed' flag was not removed in a few cases.
|
374 |
-
|
375 |
-
= 1.2.0 =
|
376 |
-
* Fix: issue with strong-caching with WP header images.
|
377 |
-
* Fix: now ignore missing files.
|
378 |
-
* Change: renaming is now part of the Media Library with nice buttons.
|
379 |
-
* Change: the dashboard has been moved to Tools (users should use the Media Library mostly).
|
380 |
-
* Change: no bubble counter on the dashboard menu; to avoid plugin to consume any resources.
|
381 |
-
|
382 |
-
= 1.0.4 =
|
383 |
-
* Fix: '<?' to '<?php'.
|
384 |
-
* Add: French translation.
|
385 |
-
* Change: Donation button (can be removed, check the FAQ).
|
386 |
-
|
387 |
-
= 1.0.2 =
|
388 |
-
* Fix: Ignore 'Header Image' to avoid related issues.
|
389 |
-
* Change: Updated screenshots.
|
390 |
-
* Change: 'To be renamed' filter removed (useless feature).
|
391 |
-
|
392 |
-
= 1.0.0 =
|
393 |
-
* Change: Rename Dashboard enhanced.
|
394 |
-
* Change: Scanning function now displays the results nicely.
|
395 |
-
* Change: Handle the media with 'physical' issues.
|
396 |
-
|
397 |
-
= 0.9.4 =
|
398 |
-
* Fix: Works better on Windows (file case).
|
399 |
-
* Fix: doesn't add numbering when the file exists already - was way too dangerous.
|
400 |
-
* Change: warns you if the Media title exists.
|
401 |
-
* Fix: Removed a 'warning'.
|
402 |
-
|
403 |
-
= 0.9 =
|
404 |
-
* Fix: Media were not flagged "as to be renamed" when the title was changed during editing a post.
|
405 |
-
* Change: Internal optimization.
|
406 |
-
* Add: Settings page.
|
407 |
-
* Add: Option to rename the slug or not (default: yes).
|
408 |
-
|
409 |
-
= 0.8 =
|
410 |
-
* Fix: Works with WP 3.5.
|
411 |
-
* Change: Update the links in DB directly.
|
412 |
-
* Fix: number of flagged media not updated straight after the mass rename.
|
413 |
-
* Fix: the "file name" in the media info was empty.
|
414 |
-
* Fix: SQL optimization & memory usage huge improvement.
|
415 |
-
|
416 |
-
= 0.5 =
|
417 |
-
* Add: New view "To be renamed" in the Media Library.
|
418 |
-
* Add: a nice counter to show the number of files that need to be renamed.
|
419 |
-
* Fix: the previous update (0.4) was actually not containing all the changes.
|
420 |
-
|
421 |
-
= 0.4 =
|
422 |
-
* Support for WPML
|
423 |
-
* Support for Retina plugins such as WP Retina 2x
|
424 |
-
* Adds a '-' between the filename and counter in case of similar files
|
425 |
-
* Mark the media as to be renamed when its name is changed outside the Media Library (avoid all the issues we had before)
|
426 |
-
* The GUID is now updated using the URL of the images and not the post ID + title (http://wordpress.org/support/topic/plugin-media-file-renamer-incorrect-guid-fix-serious-bug?replies=2#post-2239192).
|
427 |
-
* Double-check before physically renaming the files.
|
428 |
-
|
429 |
-
= 0.3 =
|
430 |
-
* Corrections + improvements.
|
431 |
-
* Handles well the 'special cases' now.
|
432 |
-
* Tiny corrections.
|
433 |
-
|
434 |
-
= 0.1 =
|
435 |
-
* First release.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|