403Webshell
Server IP : 151.101.66.159  /  Your IP : 216.73.216.66
Web Server : Flywheel/5.1.0
System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64
User : root ( )
PHP Version : 7.4.33.18
Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wp-content/plugins/file-manager-advanced/application/assets/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wp-content/plugins/file-manager-advanced/application/assets/dist/895.chunk.js
/*! For license information please see 895.chunk.js.LICENSE.txt */
"use strict";(self.webpackChunkafm_react_admin=self.webpackChunkafm_react_admin||[]).push([[895],{5895(e,t,n){n.r(t),n.d(t,{default:()=>wt});var r=n(6540);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,o,a){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,o){var i,a,s,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,a=0,s=e,p.n=n,l}};function f(n,r){for(a=n,s=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(a=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,a=0))}if(o||n>1)return l;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),a=u,s=g;(t=a<2?e:s)||!d;){i||(a?a<3?(a>1&&(p.n=-1),f(a,s)):p.n=s:p.v=s);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(d=p.n<0)?s:n.call(r,p))!==l)break}catch(t){i=e,a=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,o,a),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),f=d.prototype=c.prototype=Object.create(p);function g(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=d,i(f,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(f),i(f,a,"Generator"),i(f,r,function(){return this}),i(f,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:g}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,i){var l=s((0,r.useState)(!1),2),c=l[0],u=l[1],d=s((0,r.useState)(!1),2),p=d[0],f=d[1],g=function(){var r,s=(r=o().m(function r(){var a,s,l,c,d,p;return o().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i){r.n=1;break}return r.a(2,{success:!1,message:"Pro version is required."});case 1:return f(!0),r.p=2,a="".concat(t,"file-manager-advanced/v1/integrations/").concat(e,"/install-library"),r.n=3,fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":n}});case 3:return s=r.v,r.n=4,s.json();case 4:if(l=r.v,!s.ok||!l.success){r.n=5;break}return u(!0),r.a(2,{success:!0,message:l.message||"Library installed successfully!"});case 5:return d=l.message||(null===(c=l.data)||void 0===c?void 0:c.message)||"Failed to install library",r.a(2,{success:!1,message:d});case 6:r.n=8;break;case 7:return r.p=7,p=r.v,console.error("Error installing ".concat(e," library:"),p),r.a(2,{success:!1,message:"Failed to install ".concat(e," library")});case 8:return r.p=8,f(!1),r.f(8);case 9:return r.a(2)}},r,null,[[2,7,8,9]])}),function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function s(e){a(i,n,o,s,l,"next",e)}function l(e){a(i,n,o,s,l,"throw",e)}s(void 0)})});return function(){return s.apply(this,arguments)}}();return{libraryInstalled:c,setLibraryInstalled:u,installing:p,installLibrary:g}}n(961);var u={label:{display:"block",marginBottom:"8px",fontSize:"14px",fontWeight:600,color:"#0f172a"},input:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid #ddd",borderRadius:"4px",boxSizing:"border-box"},description:{margin:"8px 0 0 0",fontSize:"13px",color:"#666",lineHeight:"1.5"},link:{color:"#3F6972",textDecoration:"none"},warningBox:{marginBottom:"20px",padding:"15px",background:"#fff3cd",border:"1px solid #ffc107",borderRadius:"4px"},warningText:{margin:"0 0 10px 0",color:"#856404",fontWeight:600},installButton:{padding:"10px 20px",background:"#3F6972",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:"pointer"}},d=n(4848);function p(e){return p="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},p(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return y(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(y(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,y(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,y(d,"constructor",c),y(c,"constructor",l),l.displayName="GeneratorFunction",y(c,o,"GeneratorFunction"),y(d),y(d,o,"Generator"),y(d,r,function(){return this}),y(d,"toString",function(){return"[object Generator]"}),(m=function(){return{w:i,m:p}})()}function y(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}y=function(e,t,n,r){function i(t,n){y(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},y(e,t,n,r)}function b(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.onLibraryInstalled,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(t,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.")}()),h=f[0],y=f[1],v=c("amazon-s3",a,s,i),j=v.libraryInstalled,w=v.setLibraryInstalled,k=v.installing,S=v.installLibrary,_=function(){var e,t=(e=m().m(function e(){var t;return m().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,S();case 1:(t=e.v).success?(w(!0),l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3),p&&p()):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){b(i,r,o,a,s,"next",e)}function s(e){b(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==o.library_installed&&w(o.library_installed)},[o.library_installed,w]);var O=!i||!j;return(0,d.jsxs)(d.Fragment,{children:[!j&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Amazon S3 library is not installed"}),(0,d.jsx)("button",{onClick:_,disabled:!i||k,style:g(g({},u.installButton),{},{background:k?"#ccc":"#3F6972",cursor:!i||k?"not-allowed":"pointer"}),children:k?"Installing Library...":"Install Amazon S3 Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Amazon S3",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"app_key",style:u.label,children:["App Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Amazon S3 (AWS) App key."," ",(0,d.jsx)("a",{href:"https://aws.amazon.com/s3/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Learn how to get your credentials"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"app_secret",style:u.label,children:["App Secret ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:h?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:O,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return y(!h)},disabled:O,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:O?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:O?.5:1},title:h?"Hide App Secret":"Show App Secret",children:h?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Amazon S3 (AWS) App secret."," ",(0,d.jsx)("a",{href:"https://aws.amazon.com/s3/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Learn how to get your credentials"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"region",style:u.label,children:["Region ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"region",name:"region",defaultValue:o.region||"",placeholder:"e.g. us-east-1",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the AWS region where your bucket is located (e.g. us-east-1)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:o.bucket||"",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your Amazon S3 bucket"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:O?"not-allowed":"pointer"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:o.user_role_access&&o.user_role_access.includes(e),disabled:O,style:{margin:0}}),(0,d.jsx)("span",{style:{textTransform:"capitalize",fontSize:"14px"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access the AWS-connected file manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",placeholder:"e.g. awsfolder",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name to restrict access to that folder only. Leave blank to use the root directory (e.g. awsfolder)"})]})]})}function j(e){return j="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},j(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function S(e,t,n){return(t=function(e){var t=function(e){if("object"!=j(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==j(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return O(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(O(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,O(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,O(d,"constructor",c),O(c,"constructor",l),l.displayName="GeneratorFunction",O(c,o,"GeneratorFunction"),O(d),O(d,o,"Generator"),O(d,r,function(){return this}),O(d,"toString",function(){return"[object Generator]"}),(_=function(){return{w:i,m:p}})()}function O(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}O=function(e,t,n,r){function i(t,n){O(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},O(e,t,n,r)}function T(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function C(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=e.setMessage,s=(e.selectedAuthKeyFile,e.setSelectedAuthKeyFile),l=e.onLibraryInstalled,p=c("google-cloud-storage",o,i,n),f=p.libraryInstalled,g=p.setLibraryInstalled,h=p.installing,m=p.installLibrary,y=function(){var e,t=(e=_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,m();case 1:(t=e.v).success?(g(!0),a({type:"success",text:t.message}),setTimeout(function(){return a(null)},3e3),l&&l()):(a({type:"error",text:t.message}),setTimeout(function(){return a(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){T(i,r,o,a,s,"next",e)}function s(e){T(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==t.library_installed&&g(t.library_installed)},[t.library_installed,g]);var b=!n||!f;return(0,d.jsxs)(d.Fragment,{children:[!f&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:k(k({},u.warningText),{},{marginBottom:"12px"}),children:"Google Cloud library is not installed. Please install the library first to configure authentication settings."}),(0,d.jsx)("button",{type:"button",onClick:y,disabled:!n||h,style:k(k({},u.installButton),{},{background:h?"#ccc":"#3F6972",cursor:!n||h?"not-allowed":"pointer"}),children:h?"Installing Library...":"Install Google Cloud Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:t.title||"Google Cloud Storage",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"auth_key",style:u.label,children:["Authentication Key File ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),t.auth_key&&""!==t.auth_key.trim()&&(0,d.jsxs)("div",{style:{marginBottom:"12px",padding:"10px",background:"#f0f0f0",borderRadius:"4px",maxWidth:"500px"},children:[(0,d.jsxs)("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#333"},children:["Current File: ",t.auth_key.split("/").pop()]}),(0,d.jsx)("p",{style:{margin:"4px 0 0 0",fontSize:"12px",color:"#666"},children:"Upload a new file to replace the current one"})]}),(0,d.jsx)("input",{type:"file",id:"auth_key",name:"auth_key",accept:".json",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"}),onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];s(n||null)}}),(0,d.jsx)("p",{style:u.description,children:"Upload your Google Cloud service account key file (.json format)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:t.bucket||"",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your Google Cloud Storage bucket"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:b?"not-allowed":"pointer"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:t.user_role_access&&t.user_role_access.includes(e),disabled:b,style:{margin:0}}),(0,d.jsx)("span",{style:{textTransform:"capitalize",fontSize:"14px"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access the Google Cloud file manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:t.private_folder_access||"",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a subfolder path within your bucket. Leave blank to use the root directory"}),(0,d.jsxs)("p",{style:k(k({},u.description),{},{color:"red",marginTop:"4px"}),children:[(0,d.jsx)("strong",{children:"Note: "}),"Folder paths and user role values are case-sensitive"]})]})]})}function P(e){return P="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},P(e)}function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return D(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(D(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,D(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,D(d,"constructor",c),D(c,"constructor",l),l.displayName="GeneratorFunction",D(c,o,"GeneratorFunction"),D(d),D(d,o,"Generator"),D(d,r,function(){return this}),D(d,"toString",function(){return"[object Generator]"}),(F=function(){return{w:i,m:p}})()}function D(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}D=function(e,t,n,r){function i(t,n){D(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},D(e,t,n,r)}function W(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.isConnected,f=e.setShowDisconnectModal,g=e.setDisconnectIntegration,h=c("dropbox",a,s,i),m=h.libraryInstalled,y=h.setLibraryInstalled,b=h.installing,x=h.installLibrary,v=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(t,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.")}()),j=v[0],w=v[1],k=function(){var e,t=(e=F().m(function e(){var t;return F().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){W(i,r,o,a,s,"next",e)}function s(e){W(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==o.library_installed&&y(o.library_installed)},[o.library_installed,y]);var S=o.redirect_uri||window.location.protocol+"//"+window.location.host+"/wp-admin/admin.php?page=file_manager_advanced_ui",_=!i||!m;return(0,d.jsxs)(d.Fragment,{children:[!m&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Dropbox library is not installed. Please install the library first to configure authentication settings."}),(0,d.jsx)("button",{type:"button",onClick:k,disabled:!i||b,style:A(A({},u.installButton),{},{background:b?"#ccc":"#3F6972",cursor:!i||b?"not-allowed":"pointer"}),children:b?"Installing Library...":"Install Dropbox Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Dropbox",disabled:!i,style:A(A({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:!i,style:A(A({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Dropbox App key, you will get your app key from"," ",(0,d.jsx)("a",{href:"https://www.dropbox.com/developers/apps",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Dropbox App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:j?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return w(!j)},style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},title:j?"Hide App Secret":"Show App Secret",children:j?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Dropbox App secret, you will get your app secret from"," ",(0,d.jsx)("a",{href:"https://www.dropbox.com/developers/apps",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Dropbox App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:S,readOnly:!0,disabled:!i,style:A(A({},u.input),{},{background:"#f5f5f5"})}),(0,d.jsx)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(S).then(function(){l&&(l({type:"success",text:"Redirect URI copied to clipboard!"}),setTimeout(function(){return l(null)},2e3))})},disabled:!i,style:{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:i?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:i?1:.5},title:"Copy to clipboard",children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Copy this URL and paste it in your Dropbox App Console under Redirect URIs"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:_,style:A(A({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name/path to restrict access to that folder only. Leave blank to use the root directory."})]}),m&&(0,d.jsx)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5",position:"relative",zIndex:1001,maxWidth:"500px"},children:p?(0,d.jsxs)("div",{style:{padding:"15px",background:"#d4edda",border:"1px solid #c3e6cb",borderRadius:"4px"},children:[(0,d.jsx)("p",{style:{margin:"0 0 10px 0",color:"#155724",fontWeight:600},children:"✓ Connected to Dropbox"}),(0,d.jsx)("button",{type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),g&&f&&(g("dropbox"),f(!0))},style:{padding:"8px 16px",background:"#dc3545",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer"},children:"Disconnect Dropbox"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{style:A(A({},u.description),{},{marginBottom:"12px",color:"#dc2626",fontWeight:600}),children:"You are not connected with Dropbox"}),o.app_key&&o.app_secret?(0,d.jsx)("a",{href:"#",onClick:function(e){if(e.preventDefault(),e.stopPropagation(),!o.app_key||!o.app_secret)return alert("Please enter App key and App secret first, then save changes before connecting."),!1;var t=window.location.hash||"#/extension/dropbox";sessionStorage.setItem("afm-dropbox-redirect-to",t);var n=t,r="https://www.dropbox.com/oauth2/authorize?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&token_access_type=offline&redirect_uri=").concat(encodeURIComponent(S),"&state=").concat(encodeURIComponent(n));return window.location.href=r,!1},style:{display:"inline-block",padding:"10px 20px",background:"#0061FF",color:"#fff",textDecoration:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none"},children:"Connect Dropbox"}):(0,d.jsx)("p",{style:A(A({},u.description),{},{color:"#dc2626"}),children:"Please enter your App key and App secret first, then save changes before connecting."})]})})]})}function M(e){return M="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},M(e)}function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t,n){return(t=function(e){var t=function(e){if("object"!=M(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==M(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function U(e){var t,n,o=e.settings,i=e.hasPro,a=e.isConnected,s=e.onConnect,l=e.setMessage,c=e.setShowDisconnectModal,p=e.setDisconnectIntegration,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return L(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(e,t):void 0}}(t,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.")}()),g=f[0],h=f[1],m=window.location.origin+window.location.pathname||o.redirect_uri||window.location.origin;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"OneDrive",disabled:!i,style:B(B({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_id",style:u.label,children:"Application (client) ID"}),(0,d.jsx)("input",{type:"text",id:"app_id",name:"app_id",defaultValue:o.app_id||"",disabled:!i,style:B(B({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OneDrive Application (client) ID from your"," ",(0,d.jsx)("a",{href:"https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Azure AD app registration."})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"Client secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:g?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:B(B({},u.input),{},{paddingRight:"40px"})}),(0,d.jsx)("button",{type:"button",onClick:function(){return h(!g)},disabled:!i,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:i?"pointer":"not-allowed",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",zIndex:10,opacity:i?1:.5},title:g?"Hide App Secret":"Show App Secret",children:g?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OneDrive Client secret from your"," ",(0,d.jsx)("a",{href:"https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Azure AD app registration."})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:m,readOnly:!0,disabled:!i,style:B(B({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed"})}),(0,d.jsx)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(m).then(function(){l&&(l({type:"success",text:"Redirect URI copied to clipboard!"}),setTimeout(function(){return l(null)},2e3))})},disabled:!i,style:{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:i?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:i?1:.5},title:"Copy to clipboard",children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Copy this URL and paste it in your Azure AD app registration under Redirect URIs"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:!i,style:B(B({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name/path to restrict access to that folder only. Leave blank to use the root directory."})]}),(0,d.jsx)("div",{style:{marginTop:"20px"},children:a?(0,d.jsxs)("div",{style:{padding:"15px",background:"#d4edda",border:"1px solid #c3e6cb",borderRadius:"4px",maxWidth:"500px"},children:[(0,d.jsx)("p",{style:{margin:"0 0 10px 0",color:"#155724",fontWeight:600},children:"✓ Connected to OneDrive"}),(0,d.jsx)("button",{type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),p&&c&&(p("onedrive"),c(!0))},style:{padding:"8px 16px",background:"#dc3545",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer"},children:"Disconnect OneDrive"})]}):(0,d.jsx)("button",{type:"button",onClick:s,disabled:!i||!o.app_id||!o.app_secret,style:B(B({},u.installButton),{},{background:i&&o.app_id&&o.app_secret?"#0078d4":"#ccc",cursor:i&&o.app_id&&o.app_secret?"pointer":"not-allowed"}),children:"Connect OneDrive"})})]})}function H(e){return H="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},H(e)}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){X(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function X(e,t,n){return(t=function(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $(e){var t,n,o=e.settings,i=e.hasPro,a=e.isConnected,s=e.setShowDisconnectModal,l=e.setDisconnectIntegration,c=e.setMessage,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(e,t):void 0}}(t,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.")}()),f=p[0],g=p[1],h=o.redirect_uri||window.location.origin+"/wp-admin/admin.php?page=file_manager_advanced_ui";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Google Drive",disabled:!i,style:K(K({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:!i,style:K(K({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Google Drive App key, you will get your app key from"," ",(0,d.jsx)("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Google Drive App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:f?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return g(!f)},style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},title:f?"Hide App Secret":"Show App Secret",children:f?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Google Drive App secret, you will get your app secret from"," ",(0,d.jsx)("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Google Drive App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"javascript_origin",style:u.label,children:"Javascript Origin"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"javascript_origin",name:"javascript_origin",value:window.location.origin,readOnly:!0,disabled:!i,style:K(K({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed",maxWidth:"500px"})}),(0,d.jsx)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(window.location.origin).then(function(){c&&(c({type:"success",text:"JavaScript Origin copied to clipboard!"}),setTimeout(function(){return c(null)},2e3))})},disabled:!i,style:{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:i?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:i?1:.5},title:"Copy to clipboard",children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Copy this URL and paste it in your Google Drive App Console under JavaScript Origins"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URL"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:h,readOnly:!0,disabled:!i,style:K(K({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed",maxWidth:"500px"})}),(0,d.jsx)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(h).then(function(){c&&(c({type:"success",text:"Redirect URL copied to clipboard!"}),setTimeout(function(){return c(null)},2e3))})},disabled:!i,style:{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:i?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:i?1:.5},title:"Copy to clipboard",children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Copy this URL and paste it in your Google Drive App Console under Redirect URIs"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:!i,style:K(K({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder path to restrict access to that folder only. Leave blank to use the root directory."})]}),(0,d.jsx)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5",position:"relative",zIndex:1001},children:a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{style:K(K({},u.description),{},{marginBottom:"12px",color:"#22c55e",fontWeight:600}),children:"✓ You are connected with Google Drive"}),(0,d.jsx)("button",{type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),l&&s&&(l("google-drive"),s(!0))},style:{display:"inline-block",padding:"10px 20px",background:"#dc2626",color:"#fff",textDecoration:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none",position:"relative",zIndex:1001},children:"Disconnect Google Drive"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{style:K(K({},u.description),{},{marginBottom:"12px",color:"#dc2626",fontWeight:600}),children:"You are not connected with Google Drive"}),o.app_key&&o.app_secret?(0,d.jsx)("a",{href:"https://accounts.google.com/o/oauth2/v2/auth?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&redirect_uri=").concat(encodeURIComponent(h),"&scope=https://www.googleapis.com/auth/drive&access_type=offline&prompt=consent&state=").concat(encodeURIComponent("afm_google_auth_"+(window.location.hash||"#/extension/google-drive"))),style:{display:"inline-block",padding:"10px 20px",background:"#4285F4",color:"#fff",textDecoration:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:"pointer",border:"none"},children:"Connect Google Drive"}):(0,d.jsx)("p",{style:K(K({},u.description),{},{color:"#dc2626"}),children:"Please enter your App key and App secret first, then save changes before connecting."})]})})]})}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function J(e){var t,n,o=e.isOpen,i=e.onClose,a=e.onConfirm,s=e.title,l=e.message,c=e.confirmText,u=void 0===c?"Confirm":c,p=e.cancelText,f=void 0===p?"Cancel":p,g=e.type,h=void 0===g?"primary":g,m=(t=(0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}(t,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.")}()),y=m[0],b=m[1];if((0,r.useEffect)(function(){return document.body.style.overflow=o?"hidden":"",function(){document.body.style.overflow=""}},[o]),(0,r.useEffect)(function(){var e=function(){b(window.innerWidth)};if(o)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[o]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&o&&i()};return o&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[o,i]),!o)return null;var x={primary:"❓",danger:"⚠️",warning:"⚠️",info:"ℹ️"};return(0,d.jsxs)("div",{className:"afmp-confirm-modal",onClick:function(e){e.target===e.currentTarget&&i()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",zIndex:999999999,display:"flex",alignItems:"center",justifyContent:"center",padding:y<=1024?"15px":"20px",overflowY:"auto"},children:[(0,d.jsxs)("div",{className:"afmp-confirm-content",onClick:function(e){return e.stopPropagation()},style:{background:"white",borderRadius:"8px",padding:y<=480?"15px":y<=768?"20px":"25px",maxWidth:"450px",width:y<=480||y<=768?"calc(100% - 40px)":y<=1024?"85%":"90%",maxHeight:y<=1024?"85vh":"calc(100vh - 40px)",overflowY:"auto",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",animation:"modalFadeIn 0.2s ease-out",margin:"auto"},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:y<=480?"16px":"18px",display:"flex",alignItems:"center",gap:"10px",wordBreak:"break-word"},children:[(0,d.jsx)("span",{children:x[h]||x.primary}),s]}),(0,d.jsx)("div",{className:"message",style:{marginBottom:"20px",lineHeight:"1.5",color:"#50575e",wordBreak:"break-word",overflowWrap:"break-word"},dangerouslySetInnerHTML:{__html:l}}),(0,d.jsxs)("div",{className:"buttons",style:{display:"flex",gap:"10px",justifyContent:"flex-end",flexWrap:y<=480?"wrap":"nowrap"},children:[(0,d.jsx)("button",{className:"button secondary cancel-btn",onClick:i,style:{padding:y<=480?"10px 16px":"8px 16px",border:"1px solid #ddd",borderRadius:"4px",cursor:"pointer",fontSize:y<=480?"13px":"14px",fontWeight:500,background:"#f6f7f7",color:"#50575e",flex:y<=480?"1 1 100%":"none",minWidth:y<=480?"100%":"auto",width:y<=480?"100%":"auto"},onMouseEnter:function(e){e.target.style.background="#e9ecef"},onMouseLeave:function(e){e.target.style.background="#f6f7f7"},children:f}),(0,d.jsx)("button",{className:"button ".concat(h," confirm-btn"),onClick:function(){a(),i()},style:{padding:y<=480?"10px 16px":"8px 16px",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:y<=480?"13px":"14px",fontWeight:500,background:"danger"===h?"#dc3545":"warning"===h?"#ffc107":"#007cba",color:"white",flex:y<=480?"1 1 100%":"none",minWidth:y<=480?"100%":"auto",width:y<=480?"100%":"auto"},onMouseEnter:function(e){e.target.style.background="danger"===h?"#c82333":"warning"===h?"#e0a800":"#005a87"},onMouseLeave:function(e){e.target.style.background="danger"===h?"#dc3545":"warning"===h?"#ffc107":"#007cba"},children:u})]})]}),(0,d.jsx)("style",{children:"\n        @keyframes modalFadeIn {\n          from {\n            opacity: 0;\n            transform: scale(0.9);\n          }\n          to {\n            opacity: 1;\n            transform: scale(1);\n          }\n        }\n      "})]})}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Q(e){var t,n,o=e.isOpen,i=e.onClose,a=e.commits,s=e.repo,l=e.branch,c=e.loading,u=(t=(0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}(t,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.")}()),p=u[0],f=u[1];if((0,r.useEffect)(function(){return document.body.style.overflow=o?"hidden":"",function(){document.body.style.overflow=""}},[o]),(0,r.useEffect)(function(){var e=function(){f(window.innerWidth)};if(o)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[o]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&o&&i()};return o&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[o,i]),!o)return null;var g=function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML};return(0,d.jsx)("div",{id:"afmp-commits-modal",onClick:function(e){e.target===e.currentTarget&&i()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:p<=1024?"15px":"20px",overflowY:"auto"},children:(0,d.jsxs)("div",{className:"afmp-status-content",onClick:function(e){return e.stopPropagation()},style:{background:"#fff",width:p<=480||p<=768?"calc(100% - 40px)":p<=1024?"85%":"90%",maxWidth:"900px",maxHeight:p<=1024?"85vh":"calc(100vh - 40px)",padding:p<=480||p<=768?"15px":p<=1024?"18px":"20px",borderRadius:"5px",overflowY:"auto",position:"relative",margin:"auto"},children:[(0,d.jsx)("span",{className:"afmp-close-modal",onClick:i,style:{position:"absolute",right:p<=480?"10px":"15px",top:p<=480?"10px":"15px",cursor:"pointer",fontSize:p<=480?"28px":"24px",color:"#666",background:"none",border:"none",padding:"5px",zIndex:10,minWidth:"30px",minHeight:"30px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:function(e){return e.target.style.color="#000"},onMouseLeave:function(e){return e.target.style.color="#666"},children:"×"}),(0,d.jsx)("h2",{style:{margin:"0 0 20px 0",color:"#1d2327",fontSize:p<=768?"18px":"20px",paddingRight:"30px"},children:"GitHub Commits"}),c?(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"Loading commits..."})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"afmp-commits-header",style:{background:"#f8f9fa",padding:p<=768?"12px":"15px",margin:p<=768?"-15px -15px 15px -15px":"-20px -20px 20px -20px",borderBottom:"1px solid #dee2e6"},children:(0,d.jsx)("p",{style:{margin:0,fontSize:p<=768?"12px":"14px",color:"#495057",lineHeight:p<=768?"1.6":"1.5"},children:p<=768?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Repository:"})," ",s||"N/A"]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Branch:"})," ",l||"N/A"]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Total Commits:"})," ",a?a.length:0]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:"Repository:"})," ",s||"N/A"," | ",(0,d.jsx)("strong",{children:"Branch:"})," ",l||"N/A"," | ",(0,d.jsx)("strong",{children:"Total Commits:"})," ",a?a.length:0]})})}),(0,d.jsx)("div",{id:"afmp-commits-list",children:a&&0!==a.length?(0,d.jsx)("div",{className:"afmp-commits-container",style:{maxHeight:p<=768?"400px":"500px",overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",background:"white"},children:a.map(function(e,t){return(0,d.jsxs)("div",{className:"afmp-commit-item",style:{padding:"15px",borderBottom:t<a.length-1?"1px solid #ddd":"none",background:"#f9f9f9",marginBottom:t<a.length-1?"10px":"0",borderRadius:"4px",position:"relative"},children:[(0,d.jsxs)("div",{className:"afmp-commit-header",style:{display:"flex",flexDirection:p<=480?"column":"row",justifyContent:"space-between",alignItems:p<=480?"flex-start":"center",marginBottom:"8px",gap:p<=480?"5px":"0"},children:[(0,d.jsx)("span",{className:"afmp-commit-sha",style:{fontFamily:"monospace",background:"#e1e1e1",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",color:"#666"},children:e.sha}),(0,d.jsx)("span",{className:"afmp-commit-date",style:{fontSize:"12px",color:"#666"},children:(n=e.date,r=new Date(n),r.toLocaleDateString()+" "+r.toLocaleTimeString())})]}),(0,d.jsx)("div",{className:"afmp-commit-message",style:{fontWeight:600,marginBottom:"5px",color:"#333",lineHeight:"1.4"},dangerouslySetInnerHTML:{__html:g(e.message)}}),(0,d.jsxs)("div",{className:"afmp-commit-author",style:{fontSize:"12px",color:"#666",marginBottom:"10px"},children:["by ",g(e.author)]}),(0,d.jsx)("div",{className:"afmp-commit-actions-view-github",style:{textAlign:"right"},children:(0,d.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"button button-small",style:{fontSize:"11px",padding:"4px 8px",height:"auto",lineHeight:"1.2",minHeight:"24px",borderRadius:"3px",textDecoration:"none",background:"#0073aa",color:"white",border:"1px solid #0073aa",display:"inline-block"},onMouseEnter:function(e){e.target.style.background="#005a87",e.target.style.borderColor="#005a87"},onMouseLeave:function(e){e.target.style.background="#0073aa",e.target.style.borderColor="#0073aa"},children:"View on GitHub"})})]},t);var n,r})}):(0,d.jsx)("p",{style:{padding:"20px",textAlign:"center",color:"#666"},children:"No commits found in this branch."})})]})]})})}function ee(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return te(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(te(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,te(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,te(d,"constructor",c),te(c,"constructor",l),l.displayName="GeneratorFunction",te(c,o,"GeneratorFunction"),te(d),te(d,o,"Generator"),te(d,r,function(){return this}),te(d,"toString",function(){return"[object Generator]"}),(ee=function(){return{w:i,m:p}})()}function te(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}te=function(e,t,n,r){function i(t,n){te(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},te(e,t,n,r)}function ne(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function re(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ne(i,r,o,a,s,"next",e)}function s(e){ne(i,r,o,a,s,"throw",e)}a(void 0)})}}function oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||ie(e,t)||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 ie(e,t){if(e){if("string"==typeof e)return ae(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ae(e,t):void 0}}function ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function se(e){var t=e.isOpen,n=e.onClose,o=e.changedFiles,i=e.repo,a=e.branch,s=e.loading,l=e.onPush,c=e.onDiscard,u=e.githubNonce,p=e.ajaxUrl,f=e.setMessage,g=oe((0,r.useState)([]),2),h=g[0],m=g[1],y=oe((0,r.useState)(!0),2),b=y[0],x=y[1],v=oe((0,r.useState)("Updated files via AFM"),2),j=v[0],w=v[1],k=oe((0,r.useState)(""),2),S=k[0],_=k[1],O=oe((0,r.useState)(!1),2),T=O[0],C=O[1],P=oe((0,r.useState)(!1),2),I=P[0],A=P[1],E=oe((0,r.useState)(!1),2),F=E[0],D=E[1],W=oe((0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),2),R=W[0],z=W[1];if((0,r.useEffect)(function(){return t?(document.body.style.overflow="hidden",o&&o.length>0&&(m(o.map(function(e){return e.path})),x(!0))):document.body.style.overflow="",function(){document.body.style.overflow=""}},[t,o]),(0,r.useEffect)(function(){var e=function(){z(window.innerWidth)};if(t)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[t]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&t&&n()};return t&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[t,n]),(0,r.useEffect)(function(){o&&o.length>0&&x(h.length===o.length)},[h,o]),!t)return null;var M=function(){var e=re(ee().m(function e(){var t,r,o,i,a,s,c,d;return ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==h.length){e.n=1;break}return f&&(f({type:"warning",text:"Please select at least one file to push"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 1:if(j.trim()){e.n=2;break}return f&&(f({type:"warning",text:"Please enter a commit message"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 2:return C(!0),e.p=3,(t=new FormData).append("action","afmp_push_files_with_summary"),t.append("nonce",u),h.forEach(function(e){t.append("selected_files[]",e)}),t.append("commit_message",j.trim()),t.append("commit_description",S.trim()),e.n=4,fetch(p,{method:"POST",body:t});case 4:return r=e.v,e.n=5,r.json();case 5:(o=e.v).success?(i=o.data,a="Successfully created commit with ".concat(i.pushed_count," file(s)!"),i.commit_url&&(a+="\n\nView Commit on GitHub: ".concat(i.commit_url)),i.commit_sha&&(a+="\nCommit SHA: ".concat(i.commit_sha.substring(0,7))),i.failed_count>0&&(a+="\n\nSome files failed:",i.failed_files.forEach(function(e){a+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"success",text:a}),setTimeout(function(){return f(null)},1e4)),n(),l&&l()):(s=o.data,c="Failed to push files to GitHub!",s&&s.message&&(c+="\n\nError: "+s.message),s&&s.failed_files&&s.failed_files.length>0&&(c+="\n\nFailed files:",s.failed_files.forEach(function(e){c+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"error",text:c}),setTimeout(function(){return f(null)},12e3))),e.n=7;break;case 6:e.p=6,d=e.v,console.error("Error pushing files:",d),f&&(f({type:"error",text:"Network error occurred while pushing to GitHub"}),setTimeout(function(){return f(null)},5e3));case 7:return e.p=7,C(!1),e.f(7);case 8:return e.a(2)}},e,null,[[3,6,7,8]])}));return function(){return e.apply(this,arguments)}}(),G=function(){var e=re(ee().m(function e(){return ee().w(function(e){for(;;)switch(e.n){case 0:if(0!==h.length){e.n=1;break}return f&&(f({type:"warning",text:"Please select at least one file to discard changes"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 1:D(!0);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),B=function(){var e=re(ee().m(function e(){var t,r,o,i,a,s,l,d;return ee().w(function(e){for(;;)switch(e.p=e.n){case 0:return D(!1),A(!0),e.p=1,(t=new FormData).append("action","afmp_discard_file_changes"),t.append("nonce",u),h.forEach(function(e){t.append("selected_files[]",e)}),e.n=2,fetch(p,{method:"POST",body:t});case 2:return r=e.v,e.n=3,r.json();case 3:(o=e.v).success?(i=o.data,a="",a=i.discarded_count>0?"Successfully discarded changes for ".concat(i.discarded_count," file(s)!"):"No changes to discard. Files are already in sync with GitHub.",i.failed_count>0&&(a+="\n\nFailed files:",i.failed_files.forEach(function(e){a+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"success",text:a}),setTimeout(function(){return f(null)},7e3)),n(),c&&c(),setTimeout(function(){window.location.reload()},2e3)):(s=o.data,l="Failed to discard changes!",s&&s.failed_files&&s.failed_files.length>0?(l+="\n\nErrors:",s.failed_files.forEach(function(e){l+="\n• ".concat(e.file,": ").concat(e.error)})):s&&0===s.discarded_count&&0===s.failed_count&&(l="No files were selected or files are already in sync."),f&&(f({type:"error",text:l}),setTimeout(function(){return f(null)},1e4))),e.n=5;break;case 4:e.p=4,d=e.v,console.error("Error discarding changes:",d),f&&(f({type:"error",text:"Network error occurred while discarding changes"}),setTimeout(function(){return f(null)},5e3));case 5:return e.p=5,A(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),N=function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},L=o?o.length:0,U=o?o.reduce(function(e,t){return e+(t.changes_count||0)},0):0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{id:"afmp-push-modal",onClick:function(e){e.target===e.currentTarget&&n()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:R<=1024?"15px":"20px",overflowY:"auto"},children:(0,d.jsxs)("div",{className:"afmp-status-content",onClick:function(e){return e.stopPropagation()},style:{background:"#fff",width:R<=480||R<=768?"calc(100% - 40px)":R<=1024?"85%":"90%",maxWidth:"1200px",maxHeight:R<=1024?"85vh":"calc(100vh - 40px)",padding:R<=480||R<=768?"15px":R<=1024?"18px":"20px",borderRadius:"5px",overflowY:"auto",position:"relative",margin:"auto"},children:[(0,d.jsx)("span",{className:"afmp-close-modal",onClick:n,style:{position:"absolute",right:R<=480?"10px":"15px",top:R<=480?"10px":"15px",cursor:"pointer",fontSize:R<=480?"28px":"24px",color:"#666",background:"none",border:"none",padding:"5px",zIndex:10,minWidth:"30px",minHeight:"30px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:function(e){return e.target.style.color="#000"},onMouseLeave:function(e){return e.target.style.color="#666"},children:"×"}),(0,d.jsx)("h2",{style:{margin:"0 0 20px 0",color:"#1d2327",fontSize:R<=768?"18px":"20px",paddingRight:"30px"},children:"Push Changes to GitHub"}),s?(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"Loading changed files..."})}):o&&0!==o.length?(0,d.jsxs)("div",{className:"afmp-push-modal-content",style:{display:"flex",flexDirection:R<=1024?"column":"row",gap:R<=768?"15px":"20px",maxHeight:R<=768?"75vh":"70vh",overflow:"hidden"},children:[(0,d.jsxs)("div",{className:"afmp-commit-section",style:{flex:R<=1024?"none":"0 0 300px",background:"#f8f9fa",padding:R<=480?"12px":R<=768?"15px":"20px",borderRadius:"6px",border:"1px solid #e1e5e9",position:R<=1024?"static":"sticky",top:0,height:"fit-content",maxHeight:R<=1024?"none":"60vh",overflowY:"auto"},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:R<=480?"14px":"16px",borderBottom:"1px solid #ddd",paddingBottom:"10px",wordBreak:"break-word"},children:[(0,d.jsx)("span",{style:{marginRight:"8px"},children:"📝"})," Commit Details"]}),(0,d.jsxs)("div",{style:{marginBottom:"15px"},children:[(0,d.jsxs)("label",{style:{display:"block",marginBottom:"5px",fontWeight:600,color:"#1d2327"},children:["Commit Message ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"afmp-commit-message",value:j,onChange:function(e){return w(e.target.value)},placeholder:"Updated files via AFM",required:!0,style:{width:"100%",padding:"8px 12px",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"}})]}),(0,d.jsxs)("div",{style:{marginBottom:"15px"},children:[(0,d.jsx)("label",{style:{display:"block",marginBottom:"5px",fontWeight:600,color:"#1d2327"},children:"Description (Optional)"}),(0,d.jsx)("textarea",{id:"afmp-commit-description",value:S,onChange:function(e){return _(e.target.value)},rows:3,placeholder:"Detailed description of changes...",style:{width:"100%",padding:"8px 12px",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",resize:"vertical",minHeight:"60px",boxSizing:"border-box"}})]}),(0,d.jsx)("div",{className:"afmp-commit-actions",style:{paddingTop:"15px",borderTop:"1px solid #ddd"},children:(0,d.jsxs)("div",{className:"afmp-bulk-actions",style:{display:"flex",flexDirection:"column",gap:R<=480?"8px":"10px"},children:[(0,d.jsx)("button",{type:"button",id:"afmp-push-selected-btn",onClick:M,disabled:0===h.length||T||!j.trim(),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",padding:R<=480?"12px 16px":"10px 16px",fontWeight:500,textAlign:"center",width:"100%",boxSizing:"border-box",background:0===h.length||T||!j.trim()?"#ccc":"#007cba",border:"none",borderRadius:"4px",color:"white",cursor:0===h.length||T||!j.trim()?"not-allowed":"pointer",fontSize:R<=480?"12px":"14px",wordBreak:"break-word",whiteSpace:R<=480?"normal":"nowrap"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#005a87")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#007cba")},children:T?"⏳ Creating commit...":h.length>0?"📤 Push ".concat(h.length," file(s) to GitHub"):"📤 Select files to push"}),(0,d.jsx)("button",{type:"button",id:"afmp-discard-selected-btn",onClick:G,disabled:0===h.length||I,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",padding:R<=480?"12px 16px":"10px 16px",fontWeight:500,textAlign:"center",width:"100%",boxSizing:"border-box",background:0===h.length||I?"#ccc":"#dc3545",border:"none",borderRadius:"4px",color:"white",cursor:0===h.length||I?"not-allowed":"pointer",fontSize:R<=480?"12px":"14px",wordBreak:"break-word",whiteSpace:R<=480?"normal":"nowrap"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#c82333")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#dc3545")},children:I?"⏳ Discarding changes...":h.length>0?"🗑️ Discard ".concat(h.length," file(s) changes"):"🗑️ Select files to discard"})]})})]}),(0,d.jsxs)("div",{className:"afmp-files-section",style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:R<=480?"14px":"16px",flexShrink:0,wordBreak:"break-word"},children:[(0,d.jsx)("span",{style:{marginRight:"8px"},children:"📄"})," Changed Files (",L,")"]}),(0,d.jsx)("div",{className:"afmp-files-selection",style:{padding:"10px",background:"#e7f3ff",borderRadius:"4px",marginBottom:"15px",flexShrink:0},children:(0,d.jsxs)("label",{style:{fontWeight:600,color:"#004085",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",id:"afmp-select-all-files",checked:b,onChange:function(e){return t=e.target.checked,x(t),void m(t?o.map(function(e){return e.path}):[]);var t},style:{margin:0}}),"Select All Files"]})}),(0,d.jsx)("div",{className:"afmp-files-container",style:{flex:1,overflowY:"auto",maxHeight:R<=768?"40vh":"50vh",paddingRight:R<=768?"5px":"10px"},children:o.map(function(e,t){var n=e.status.toLowerCase(),r="New"===e.status?"➕":"✏️",o=h.includes(e.path),i="new"===n?"#28a745":"#ffc107",a="new"===n?"#f8fff8":"#fffef8";return(0,d.jsxs)("div",{className:"afmp-file-item ".concat(n),style:{border:"1px solid #ddd",borderLeft:"4px solid ".concat(i),borderRadius:"6px",marginBottom:"12px",overflow:"hidden",background:a},children:[(0,d.jsx)("div",{className:"afmp-file-header",style:{padding:"12px 15px",background:"#fff",borderBottom:"1px solid #eee"},children:(0,d.jsxs)("label",{className:"afmp-file-checkbox",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",width:"100%"},children:[(0,d.jsx)("input",{type:"checkbox",className:"afmp-file-select",checked:o,onChange:function(t){return r=e.path,o=t.target.checked,void m(o?[].concat((n=h,function(e){if(Array.isArray(e))return ae(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||ie(n)||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.")}()),[r]):h.filter(function(e){return e!==r}));var n,r,o},style:{margin:0,flexShrink:0}}),(0,d.jsx)("span",{className:"afmp-file-status",style:{fontSize:"16px",flexShrink:0},children:r}),(0,d.jsx)("strong",{style:{flex:1,wordBreak:"break-word"},children:N(e.path)}),(0,d.jsxs)("span",{className:"afmp-file-meta",style:{color:"#666",fontSize:"13px",marginLeft:"auto",flexShrink:0},children:["(",e.status," - ",e.changes_count||0," changes)"]})]})}),"New"===e.status?(0,d.jsx)("div",{className:"afmp-file-details",style:{padding:"15px",background:"#f8f9fa"},children:(0,d.jsxs)("p",{style:{margin:0,fontStyle:"italic"},children:["New file - ",e.file_size||0," bytes"]})}):e.changes&&e.changes.length>0?(0,d.jsx)("div",{className:"afmp-file-details",style:{padding:"15px",background:"#f8f9fa"},children:(0,d.jsxs)("div",{className:"afmp-changes-preview",style:{fontSize:"13px"},children:[(0,d.jsxs)("strong",{children:["All Changes (",e.changes.length,"):"]}),(0,d.jsx)("div",{className:"afmp-changes-list afmp-scrollable-changes",style:{marginTop:"10px",maxHeight:"200px",overflowY:"auto",background:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",padding:0},children:e.changes.map(function(t,n){return(0,d.jsxs)("div",{className:"afmp-change-item change-".concat(t.type),style:{padding:"8px 12px",borderBottom:n<e.changes.length-1?"1px solid #eee":"none"},children:[(0,d.jsxs)("span",{className:"afmp-line-number",style:{color:"#666",fontWeight:600,marginRight:"10px"},children:["Line ",t.line_number,":"]}),"added"===t.type?(0,d.jsxs)("div",{className:"afmp-change-line added",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#d4edda",color:"#155724"},children:["+ ",N(t.local_line)]}):"removed"===t.type?(0,d.jsxs)("div",{className:"afmp-change-line removed",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#f8d7da",color:"#721c24"},children:["- ",N(t.github_line)]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"afmp-change-line removed",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#f8d7da",color:"#721c24"},children:["- ",N(t.github_line)]}),(0,d.jsxs)("div",{className:"afmp-change-line added",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#d4edda",color:"#155724"},children:["+ ",N(t.local_line)]})]})]},n)})})]})}):null]},t)})})]})]}):(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"No changed files found. All files are up to date."})}),!s&&o&&o.length>0&&(0,d.jsxs)("div",{className:"afmp-status-summary",style:{flexShrink:0,marginTop:"15px",padding:R<=768?"12px":"15px",background:"#f0f0f1",borderRadius:"4px",border:"1px solid #ddd",fontSize:R<=768?"13px":"14px"},children:[(0,d.jsx)("strong",{children:"Summary:"})," ",L," files with ",U," total changes",(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Repository:"})," ",i||"N/A"," (",a||"N/A"," branch)"]})]})}),F&&(0,d.jsx)(J,{isOpen:F,onClose:function(){return D(!1)},onConfirm:B,title:"Discard Changes",message:"Are you sure you want to discard changes for <strong>".concat(h.length," file(s)</strong>?<br><br>This will replace your local files with the GitHub versions and cannot be undone."),confirmText:"Yes, Discard Changes",cancelText:"Cancel",type:"danger"})]})}function le(e){return le="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},le(e)}function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){de(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function de(e,t,n){return(t=function(e){var t=function(e){if("object"!=le(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=le(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==le(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pe(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return fe(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fe(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,fe(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,fe(d,"constructor",c),fe(c,"constructor",l),l.displayName="GeneratorFunction",fe(c,o,"GeneratorFunction"),fe(d),fe(d,o,"Generator"),fe(d,r,function(){return this}),fe(d,"toString",function(){return"[object Generator]"}),(pe=function(){return{w:i,m:p}})()}function fe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fe=function(e,t,n,r){function i(t,n){fe(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},fe(e,t,n,r)}function ge(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function he(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ge(i,r,o,a,s,"next",e)}function s(e){ge(i,r,o,a,s,"throw",e)}a(void 0)})}}function me(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(e,t):void 0}}(e,t)||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 ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function be(e){var t,n=e.settings,o=e.hasPro,i=e.root,a=e.nonce,s=e.setMessage,l=e.onSettingsRefresh,c=n.ajax_nonce||a,p=n.ajax_url||(null===(t=window.afmReact)||void 0===t?void 0:t.ajaxUrl)||"/wp-admin/admin-ajax.php",f=me((0,r.useState)(!1),2),g=f[0],h=f[1],m=me((0,r.useState)(!1),2),y=m[0],b=m[1],x=me((0,r.useState)([]),2),v=x[0],j=x[1],w=me((0,r.useState)([]),2),k=w[0],S=w[1],_=me((0,r.useState)(n.repo||""),2),O=_[0],T=_[1],C=me((0,r.useState)(n.branch||""),2),P=C[0],I=C[1],A=me((0,r.useState)(!1),2),E=(A[0],A[1]),F=me((0,r.useState)(!1),2),D=F[0],W=F[1],R=me((0,r.useState)(!1),2),z=R[0],M=R[1],G=me((0,r.useState)(!1),2),B=G[0],N=G[1],L=me((0,r.useState)(!1),2),U=L[0],H=L[1],V=me((0,r.useState)(!1),2),K=V[0],X=V[1],Y=me((0,r.useState)(!1),2),$=Y[0],q=Y[1],Z=me((0,r.useState)(null),2),ee=Z[0],te=Z[1],ne=me((0,r.useState)(!1),2),re=ne[0],oe=ne[1],ie=me((0,r.useState)([]),2),ae=ie[0],le=ie[1],ce=me((0,r.useState)(!1),2),de=ce[0],fe=ce[1],ge=me((0,r.useState)(!1),2),ye=ge[0],be=ge[1],xe=me((0,r.useState)([]),2),ve=xe[0],je=xe[1],we=me((0,r.useState)(!1),2),ke=we[0],Se=we[1],_e=me((0,r.useState)(!1),2),Oe=_e[0],Te=_e[1];(0,r.useEffect)(function(){var e=function(){var e=he(pe().m(function e(){var t,r,o,s;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n.username&&n.pat){e.n=1;break}return X(!1),E(!1),e.a(2);case 1:return W(!0),e.p=2,e.n=3,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/validate-token"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({token:n.pat})});case 3:return t=e.v,e.n=4,t.json();case 4:r=e.v,o=t.ok&&r.success,E(o),X(o),e.n=6;break;case 5:e.p=5,s=e.v,console.error("Error validating token:",s),E(!1),X(!1);case 6:return e.p=6,W(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}();e()},[n.username,n.pat,i,a]),(0,r.useEffect)(function(){n.repo&&T(n.repo),n.branch&&I(n.branch)},[n.repo,n.branch]);var Ce=function(){var e=he(pe().m(function e(){var t,r,o,l,c,u,d,p,f;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=(null===(t=document.getElementById("username"))||void 0===t?void 0:t.value)||n.username||"",l=(null===(r=document.getElementById("pat"))||void 0===r?void 0:r.value)||n.pat||"",o&&l){e.n=1;break}return s&&(s({type:"error",text:"Please enter GitHub Username and PAT first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:return h(!0),e.p=2,e.n=3,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/fetch-repositories"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({username:o,token:l})});case 3:return c=e.v,e.n=4,c.json();case 4:u=e.v,c.ok&&u.success?(j(u.repositories||[]),s&&(s({type:"success",text:"Successfully fetched ".concat(u.repositories.length," repositories!")}),setTimeout(function(){return s(null)},3e3))):(p=u.message||(null===(d=u.data)||void 0===d?void 0:d.message)||"Failed to fetch repositories",s&&(s({type:"error",text:p}),setTimeout(function(){return s(null)},3e3))),e.n=6;break;case 5:e.p=5,f=e.v,console.error("Error fetching repositories:",f),s&&(s({type:"error",text:"Failed to fetch repositories. Please try again."}),setTimeout(function(){return s(null)},3e3));case 6:return e.p=6,h(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Pe=function(){var e=he(pe().m(function e(t){var r,o,u,d,f,g,h,m,y,x,v,j,w,k,_;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:if(u=t.target.value,T(u),S([]),I(""),u){e.n=1;break}return e.a(2);case 1:if(d=(null===(r=document.getElementById("username"))||void 0===r?void 0:r.value)||n.username||"",f=(null===(o=document.getElementById("pat"))||void 0===o?void 0:o.value)||n.pat||"",d&&f){e.n=2;break}return e.a(2);case 2:return b(!0),e.p=3,e.n=4,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/fetch-branches"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({username:d,token:f,repo:u})});case 4:return g=e.v,e.n=5,g.json();case 5:if(h=e.v,!g.ok||!h.success){e.n=11;break}if(S(h.branches||[]),!(m=h.branches.find(function(e){return e.default}))){e.n=10;break}return I(m.name),(y=document.getElementById("branch"))&&(y.value=m.name),e.p=6,(x=new FormData).append("action","afmp_save_github_settings"),x.append("nonce",c),x.append("repo",u),x.append("branch",m.name),e.n=7,fetch(p,{method:"POST",body:x});case 7:return v=e.v,e.n=8,v.json();case 8:e.v.success?(l&&l(),s&&(s({type:"success",text:"Repository and branch saved successfully!"}),setTimeout(function(){return s(null)},3e3))):console.error("Failed to save GitHub settings"),e.n=10;break;case 9:e.p=9,k=e.v,console.error("Error saving GitHub settings:",k);case 10:s&&!m&&(s({type:"success",text:"Successfully fetched branches for ".concat(u,"!")}),setTimeout(function(){return s(null)},3e3)),e.n=12;break;case 11:w=h.message||(null===(j=h.data)||void 0===j?void 0:j.message)||"Failed to fetch branches",s&&(s({type:"error",text:w}),setTimeout(function(){return s(null)},3e3));case 12:e.n=14;break;case 13:e.p=13,_=e.v,console.error("Error fetching branches:",_),s&&(s({type:"error",text:"Failed to fetch branches. Please try again."}),setTimeout(function(){return s(null)},3e3));case 14:return e.p=14,b(!1),e.f(14);case 15:return e.a(2)}},e,null,[[6,9],[3,13,14,15]])}));return function(t){return e.apply(this,arguments)}}(),Ie=function(){var e=he(pe().m(function e(){var t,r;return pe().w(function(e){for(;;)switch(e.n){case 0:if(O&&P){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:t=n.access_dir||"uploads/afmp-includes/github",r="Are you sure you want to pull all files from <strong>".concat(O,"</strong> (").concat(P," branch)?<br><br>This will download all files from the selected branch to <strong>").concat(t,"</strong>. This will overwrite any local changes with the GitHub versions."),te({title:"Pull Files from GitHub",message:r,confirmText:"Yes, Pull Files",cancelText:"Cancel",type:"warning",onConfirm:function(){var e=he(pe().m(function e(){var t,n,r,o,i;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:return M(!0),e.p=1,(t=new FormData).append("action","afmp_pull_files"),t.append("nonce",c),t.append("repo",O),t.append("branch",P),e.n=2,fetch(p,{method:"POST",body:t});case 2:return n=e.v,e.n=3,n.json();case 3:(r=e.v).success?s&&(s({type:"success",text:r.data||"Files pulled successfully from GitHub!"}),setTimeout(function(){return s(null)},5e3)):(o=r.data||"Failed to pull files from GitHub",s&&(s({type:"error",text:o}),setTimeout(function(){return s(null)},5e3))),e.n=5;break;case 4:e.p=4,i=e.v,console.error("Error pulling files:",i),s&&(s({type:"error",text:"Failed to pull files. Please try again."}),setTimeout(function(){return s(null)},5e3));case 5:return e.p=5,M(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}()}),q(!0);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),Ae=function(){var e=he(pe().m(function e(){var t,n,r,o,i,a,l;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:if(O&&P){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:return N(!0),fe(!0),oe(!0),e.p=2,(t=new FormData).append("action","afmp_get_commits"),t.append("nonce",c),e.n=3,fetch(p,{method:"POST",body:t});case 3:return n=e.v,e.n=4,n.json();case 4:(r=e.v).success?(i=(null===(o=r.data)||void 0===o?void 0:o.commits)||[],le(i)):(a=r.data||"Failed to fetch commits",le([]),s&&(s({type:"error",text:a}),setTimeout(function(){return s(null)},5e3))),e.n=6;break;case 5:e.p=5,l=e.v,console.error("Error checking status:",l),le([]),s&&(s({type:"error",text:"Failed to check status. Please try again."}),setTimeout(function(){return s(null)},5e3));case 6:return e.p=6,N(!1),fe(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Ee=function(){var e=he(pe().m(function e(){var t,n,r,o,i;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:if(O&&P){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:return H(!0),Se(!0),be(!0),e.p=2,(t=new FormData).append("action","afmp_get_changed_files_for_push"),t.append("nonce",c),e.n=3,fetch(p,{method:"POST",body:t});case 3:return n=e.v,e.n=4,n.json();case 4:(r=e.v).success&&r.data&&r.data.files?je(r.data.files||[]):(je([]),s&&(o=r.data||"Failed to get changed files",s({type:"error",text:o}),setTimeout(function(){return s(null)},5e3))),e.n=6;break;case 5:e.p=5,i=e.v,console.error("Error fetching changed files:",i),je([]),s&&(s({type:"error",text:"Failed to fetch changed files. Please try again."}),setTimeout(function(){return s(null)},5e3));case 6:return e.p=6,H(!1),Se(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Fe=!o||K;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:n.title||"Github",disabled:!o,style:ue(ue({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"email",style:u.label,children:"GitHub Email"}),(0,d.jsx)("input",{type:"email",id:"email",name:"email",defaultValue:n.email||"",disabled:!o,style:ue(ue({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter your email which you use for your GitHub account"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"username",style:u.label,children:["GitHub Username ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"username",name:"username",defaultValue:n.username||"",disabled:Fe,style:ue(ue({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter your GitHub username"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"pat",style:u.label,children:["GitHub PAT ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:Oe?"text":"password",id:"pat",name:"pat",defaultValue:n.pat||"",disabled:Fe,style:ue(ue({},u.input),{},{paddingRight:"40px"})}),(0,d.jsx)("button",{type:"button",onClick:function(){return Te(!Oe)},disabled:Fe,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:Fe?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",zIndex:10,opacity:Fe?.5:1},title:Oe?"Hide PAT":"Show PAT",children:Oe?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter GitHub Personal Access Token (PAT) for your account"," ",(0,d.jsx)("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Click here to get Github PAT"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"access_dir",style:u.label,children:"GitHub Access Directory"}),(0,d.jsx)("input",{type:"text",id:"access_dir",name:"access_dir",defaultValue:n.access_dir||"uploads/afmp-includes/github",disabled:!o,style:ue(ue({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"This field is not a required as a default directory is set, but this can be changed"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"master_dir",style:u.label,children:"GitHub Master Access Directory"}),(0,d.jsx)("input",{type:"text",id:"master_dir",name:"master_dir",defaultValue:n.master_dir||"",disabled:!o,style:ue(ue({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"This field is not a required, and if left empty all configuration will apply to the whole repository"})]}),K&&!D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("label",{style:u.label,children:"GitHub Actions"}),(0,d.jsxs)("div",{style:{marginTop:"10px"},children:[(0,d.jsx)("button",{type:"button",onClick:Ce,disabled:!o||g,style:ue(ue({},u.installButton),{},{background:!o||g?"#ccc":"#3F6972",cursor:!o||g?"not-allowed":"pointer",transition:"background-color 0.2s ease"}),onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#2d555e")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#3F6972")},children:g?"Fetching...":"Fetch Repositories"}),(0,d.jsx)("p",{style:u.description,children:"Click this button to fetch your GitHub repositories. Make sure you have entered your Username and PAT above."})]})]}),(0,d.jsxs)("div",{style:{marginTop:"20px"},children:[(0,d.jsx)("label",{htmlFor:"repo",style:u.label,children:"GitHub Repository"}),(0,d.jsxs)("select",{id:"repo",name:"repo",value:O,onChange:Pe,disabled:!o||y,style:ue(ue({},u.input),{},{maxWidth:"500px"}),children:[(0,d.jsx)("option",{value:"",children:"Select Repository"}),v.map(function(e){return(0,d.jsx)("option",{value:e.name,children:e.full_name},e.full_name)}),O&&!v.find(function(e){return e.name===O})&&(0,d.jsx)("option",{value:O,selected:!0,children:O})]}),(0,d.jsx)("p",{style:u.description,children:"Click the drop-down and select a repository"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"branch",style:u.label,children:"GitHub Branch"}),(0,d.jsxs)("select",{id:"branch",name:"branch",value:P,onChange:function(e){return I(e.target.value)},disabled:!o||!O||y,style:ue(ue({},u.input),{},{maxWidth:"500px"}),children:[(0,d.jsx)("option",{value:"",children:"Select Branch"}),k.map(function(e){return(0,d.jsxs)("option",{value:e.name,children:[e.name," ",e.default?"(Default)":""]},e.name)}),P&&!k.find(function(e){return e.name===P})&&(0,d.jsx)("option",{value:P,selected:!0,children:P})]}),(0,d.jsx)("p",{style:u.description,children:"Click the drop-down and select a branch (Main/Master/Dev branch is selected by default)"})]}),O&&P&&(0,d.jsxs)("div",{style:{marginTop:"30px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("label",{style:u.label,children:"GitHub Actions"}),(0,d.jsxs)("div",{style:{marginTop:"15px",display:"flex",flexWrap:"wrap",gap:"10px"},children:[(0,d.jsx)("button",{type:"button",onClick:Ie,disabled:!o||z,style:{padding:"10px 20px",background:!o||z?"#ccc":"#28a745",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:!o||z?"not-allowed":"pointer",transition:"background-color 0.2s ease",marginRight:"10px"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#218838")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#28a745")},children:z?"Pulling files...":"Pull Files from GitHub"}),(0,d.jsx)("button",{type:"button",onClick:Ae,disabled:!o||B,style:{padding:"10px 20px",background:!o||B?"#ccc":"#17a2b8",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:!o||B?"not-allowed":"pointer",transition:"background-color 0.2s ease",marginRight:"10px"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#138496")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#17a2b8")},children:B?"Checking...":"Check Status"}),(0,d.jsx)("button",{type:"button",onClick:Ee,disabled:!o||U,style:{padding:"10px 20px",background:!o||U?"#ccc":"#007cba",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:!o||U?"not-allowed":"pointer",transition:"background-color 0.2s ease",marginRight:"10px"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#005a87")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#007cba")},children:U?"Pushing...":"Push All Changes to GitHub"}),(0,d.jsx)("button",{type:"button",onClick:function(){var e;te({title:"Change GitHub Connection",message:"Are you sure you want to change the GitHub connection? This will:<br><br>• Reset your current repository settings<br>• <strong>Remove the ENTIRE GitHub folder</strong> and all its contents<br>• Clear username and token fields<br><br>This action cannot be undone!",confirmText:"Yes, Change Connection & Remove Folder",cancelText:"Cancel",type:"danger",onConfirm:(e=he(pe().m(function e(){var t,n,r,o,i,a;return pe().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,(t=new FormData).append("action","afmp_save_github_settings"),t.append("nonce",c),t.append("ref","reset"),t.append("repo",""),t.append("branch",""),e.n=1,fetch(p,{method:"POST",body:t});case 1:e.n=3;break;case 2:e.p=2,a=e.v,console.error("Error resetting connection:",a);case 3:T(""),I(""),j([]),S([]),X(!1),E(!1),n=document.getElementById("repo"),r=document.getElementById("branch"),n&&(n.value=""),r&&(r.value=""),o=document.getElementById("username"),i=document.getElementById("pat"),o&&(o.value="",o.disabled=!1),i&&(i.value="",i.disabled=!1),s&&(s({type:"success",text:"Connection cleared. Please enter new GitHub Username and PAT, then save changes."}),setTimeout(function(){return s(null)},3e3)),l&&setTimeout(function(){l()},500);case 4:return e.a(2)}},e,null,[[0,2]])})),function(){return e.apply(this,arguments)})}),q(!0)},disabled:!o,style:{padding:"10px 20px",background:o?"#f8d7da":"#ccc",color:o?"#dc3545":"#666",border:o?"1px solid #dc3545":"1px solid #ccc",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:o?"pointer":"not-allowed",transition:"background-color 0.2s ease, border-color 0.2s ease",marginRight:"10px"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#f5c6cb",e.target.style.borderColor="#c82333")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#f8d7da",e.target.style.borderColor="#dc3545")},children:"Change Connection"})]})]})]}):!D&&(0,d.jsx)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:(0,d.jsx)("div",{style:{background:"#fff3cd",border:"1px solid #ffeaa7",borderLeft:"4px solid #f39c12",padding:"12px",borderRadius:"4px"},children:(0,d.jsx)("p",{style:{margin:0,color:"#856404",fontWeight:600},children:n.username&&n.pat?"GitHub credentials validation failed. Please check your Username and PAT, then save changes again.":"Please enter your GitHub Username and PAT above, then save changes to enable GitHub Actions."})})}),$&&ee&&(0,d.jsx)(J,{isOpen:$,onClose:function(){q(!1),te(null)},onConfirm:ee.onConfirm,title:ee.title,message:ee.message,confirmText:ee.confirmText,cancelText:ee.cancelText,type:ee.type}),(0,d.jsx)(Q,{isOpen:re,onClose:function(){return oe(!1)},commits:ae,repo:O,branch:P,loading:de}),(0,d.jsx)(se,{isOpen:ye,onClose:function(){be(!1),je([])},changedFiles:ve,repo:O,branch:P,loading:ke,onPush:function(){l&&setTimeout(function(){l()},1e3)},onDiscard:function(){},githubNonce:c,ajaxUrl:p,setMessage:s})]})}function xe(e){return xe="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},xe(e)}function ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(n),!0).forEach(function(t){we(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function we(e,t,n){return(t=function(e){var t=function(e){if("object"!=xe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ke(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return Se(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Se(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Se(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,Se(d,"constructor",c),Se(c,"constructor",l),l.displayName="GeneratorFunction",Se(c,o,"GeneratorFunction"),Se(d),Se(d,o,"Generator"),Se(d,r,function(){return this}),Se(d,"toString",function(){return"[object Generator]"}),(ke=function(){return{w:i,m:p}})()}function Se(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Se=function(e,t,n,r){function i(t,n){Se(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Se(e,t,n,r)}function _e(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Te(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(e,t):void 0}}(e,t)||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 Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=(e.setMessage,e.onApiKeyValidated),s=Oe((0,r.useState)(!1),2),l=s[0],c=s[1],p=Oe((0,r.useState)(!1),2),f=p[0],g=p[1],h=Oe((0,r.useState)(null),2),m=h[0],y=h[1],b=function(){var e,n=(e=ke().m(function e(){var n,r,s,l,c,u,d;return ke().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=document.getElementById("gpt_api_key"),r=(null==n?void 0:n.value)||t.gpt_api_key||""){e.n=1;break}return y({success:!1,message:"Please enter an API key first."}),e.a(2);case 1:return g(!0),y(null),e.p=2,e.n=3,fetch("".concat(o,"file-manager-advanced/v1/test-api-key"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":i},body:JSON.stringify({api_key:r})});case 3:return s=e.v,e.n=4,s.json();case 4:l=e.v,s.ok&&l.success?(y({success:!0,message:"API key is valid!"}),null==a||a()):(u=l.message||(null===(c=l.data)||void 0===c?void 0:c.message)||"API key is invalid",y({success:!1,message:u})),e.n=6;break;case 5:e.p=5,d=e.v,console.error("Error testing API key:",d),y({success:!1,message:"Failed to test API key. Please try again."});case 6:return e.p=6,g(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){_e(i,r,o,a,s,"next",e)}function s(e){_e(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return n.apply(this,arguments)}}();return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"gpt_api_key",style:u.label,children:["GPT API Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",maxWidth:"560px"},children:[(0,d.jsxs)("div",{style:{position:"relative",flex:1,minWidth:0},children:[(0,d.jsx)("input",{type:l?"text":"password",id:"gpt_api_key",name:"gpt_api_key",defaultValue:t.gpt_api_key||"",disabled:!n,style:je(je({},u.input),{},{paddingRight:"42px",width:"100%"}),autoComplete:"off"}),(0,d.jsx)("button",{type:"button",onClick:function(){return c(!l)},disabled:!n,style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",padding:"6px",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:n?1:.5,color:"#666"},title:l?"Hide API Key":"Show API Key",children:l?(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsx)("button",{type:"button",onClick:b,disabled:!n||f,style:{flexShrink:0,background:f?"#ccc":"#3F6972",color:"#fff",border:"none",borderRadius:"4px",padding:"10px 16px",cursor:!n||f?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,opacity:!n||f?.5:1},children:f?"Testing...":"Test API Key"})]}),m&&(0,d.jsx)("p",{style:je(je({},u.description),{},{color:m.success?"#28a745":"#dc3545",marginTop:"8px",fontWeight:500}),children:m.message}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OpenAI GPT API key. This key is stored only for your user account."," ",(0,d.jsx)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Click here to get your API key"})]})]})})}function Pe(e){return Pe="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},Pe(e)}function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach(function(t){Ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ee(e,t,n){return(t=function(e){var t=function(e){if("object"!=Pe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fe(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return De(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(De(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,De(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,De(d,"constructor",c),De(c,"constructor",l),l.displayName="GeneratorFunction",De(c,o,"GeneratorFunction"),De(d),De(d,o,"Generator"),De(d,r,function(){return this}),De(d,"toString",function(){return"[object Generator]"}),(Fe=function(){return{w:i,m:p}})()}function De(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}De=function(e,t,n,r){function i(t,n){De(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},De(e,t,n,r)}function We(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ze(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.isConnected,f=e.setShowDisconnectModal,g=e.setDisconnectIntegration,h=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Re(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Re(e,t):void 0}}(t,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.")}()),m=h[0],y=h[1],b=c("pcloud",a,s,i),x=b.libraryInstalled,v=b.setLibraryInstalled,j=b.installing,w=b.installLibrary;r.useEffect(function(){void 0!==o.library_installed&&v(o.library_installed)},[o.library_installed,v]);var k=function(){var e,t=(e=Fe().m(function e(){var t;return Fe().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,w();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){We(i,r,o,a,s,"next",e)}function s(e){We(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),S=!i||!x,_=o.redirect_uri||"".concat(window.location.origin,"/wp-admin/admin.php?page=file_manager_advanced_ui"),O=!S&&!(!o.app_key||!o.app_secret);return(0,d.jsxs)(d.Fragment,{children:[!x&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"pCloud library is not installed. Please install the library first."}),(0,d.jsx)("button",{type:"button",onClick:k,disabled:!i||j,style:Ae(Ae({},u.installButton),{},{background:j?"#ccc":"#3F6972",cursor:!i||j?"not-allowed":"pointer"}),children:j?"Installing Library...":"Install pCloud Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"pCloud",disabled:S,style:Ae(Ae({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:S,style:Ae(Ae({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your pCloud App Key."," ",(0,d.jsx)("a",{href:"https://docs.pcloud.com/my_apps/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"pCloud My Apps"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:m?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:S,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return y(!m)},disabled:S,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:S?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:S?.5:1},title:m?"Hide App Secret":"Show App Secret",children:m?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private access folder"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:o.private_folder||"",disabled:S,style:Ae(Ae({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. /Documents"}),(0,d.jsx)("p",{style:u.description,children:"Optional: Enter a folder path to show only that folder. Leave empty to show full pCloud root."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:_,readOnly:!0,disabled:!i,style:Ae(Ae({},u.input),{},{background:"#f5f5f5"})}),(0,d.jsx)("button",{type:"button",onClick:function(){navigator.clipboard.writeText(_).then(function(){l({type:"success",text:"Redirect URI copied to clipboard!"}),setTimeout(function(){return l(null)},2e3)})},disabled:!i,style:{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:i?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:i?1:.5},title:"Copy to clipboard",children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})]})]}),x&&(0,d.jsx)("div",{style:{marginTop:"20px"},children:p?(0,d.jsxs)("div",{style:{padding:"15px",background:"#d4edda",border:"1px solid #c3e6cb",borderRadius:"4px",maxWidth:"500px"},children:[(0,d.jsx)("p",{style:{margin:"0 0 10px 0",color:"#155724",fontWeight:600},children:"✓ Connected to pCloud"}),(0,d.jsx)("button",{type:"button",onClick:function(){g&&f&&(g("pcloud"),f(!0))},style:{padding:"8px 16px",background:"#dc3545",color:"#fff",border:"none",borderRadius:"4px",cursor:"pointer"},children:"Disconnect pCloud"})]}):(0,d.jsx)("a",{href:"#",onClick:function(e){if(e.preventDefault(),!O)return l({type:"error",text:"Please enter App Key and App Secret, then save settings before connecting."}),void setTimeout(function(){return l(null)},4e3);var t=window.location.hash||"#/extension/pcloud";sessionStorage.setItem("afm-oauth-redirect-hash",t);var n="https://my.pcloud.com/oauth2/authorize?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&redirect_uri=").concat(encodeURIComponent(_),"&state=").concat(encodeURIComponent(t));window.location.href=n},style:{display:"inline-block",padding:"10px 20px",background:"#2D7FC4",color:"#fff",textDecoration:"none",borderRadius:"4px",fontWeight:600},children:"Connect pCloud"})})]})}function Me(e){return Me="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},Me(e)}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach(function(t){Ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ne(e,t,n){return(t=function(e){var t=function(e){if("object"!=Me(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Me(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return Ue(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ue(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ue(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,Ue(d,"constructor",c),Ue(c,"constructor",l),l.displayName="GeneratorFunction",Ue(c,o,"GeneratorFunction"),Ue(d),Ue(d,o,"Generator"),Ue(d,r,function(){return this}),Ue(d,"toString",function(){return"[object Generator]"}),(Le=function(){return{w:i,m:p}})()}function Ue(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ue=function(e,t,n,r){function i(t,n){Ue(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Ue(e,t,n,r)}function He(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ke(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(e,t):void 0}}(t,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.")}()),f=p[0],g=p[1],h=c("cloudflarer2",a,s,i),m=h.libraryInstalled,y=h.setLibraryInstalled,b=h.installing,x=h.installLibrary;r.useEffect(function(){void 0!==o.library_installed&&y(o.library_installed)},[o.library_installed,y]);var v=function(){var e,t=(e=Le().m(function e(){var t;return Le().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){He(i,r,o,a,s,"next",e)}function s(e){He(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),j=!i||!m;return(0,d.jsxs)(d.Fragment,{children:[!m&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Cloudflare R2 library is not installed. Please install the library first."}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:!i||b,style:Be(Be({},u.installButton),{},{background:b?"#ccc":"#3F6972",cursor:!i||b?"not-allowed":"pointer"}),children:b?"Installing Library...":"Install Cloudflare R2 Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||o.alias||"Cloudflare R2",disabled:j,style:Be(Be({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"access_key",style:u.label,children:["Access Key ID ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"access_key",name:"access_key",defaultValue:o.access_key||"",disabled:j,style:Be(Be({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Cloudflare R2 Access Key ID."," ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com/?to=/:account/r2/api-tokens",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Manage R2 API Tokens"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"secret_key",style:u.label,children:["Secret Access Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:f?"text":"password",id:"secret_key",name:"secret_key",defaultValue:o.secret_key||"",disabled:j,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return g(!f)},disabled:j,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:j?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:j?.5:1},title:f?"Hide Secret Access Key":"Show Secret Access Key",children:f?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Enter your Cloudflare R2 Secret Access Key."})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"endpoint",style:u.label,children:["Endpoint URL ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"endpoint",name:"endpoint",defaultValue:o.endpoint||"",disabled:j,placeholder:"https://<accountid>.r2.cloudflarestorage.com",style:Be(Be({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter your R2 Endpoint URL from Cloudflare dashboard."})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket Name ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:o.bucket||"",disabled:j,style:Be(Be({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your R2 bucket."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:Array.isArray(o.user_role_access)&&o.user_role_access.includes(e),disabled:j}),(0,d.jsx)("span",{style:{textTransform:"capitalize"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access this storage."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:o.private_folder||"",disabled:j,style:Be(Be({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a subfolder name (optional) to restrict access."})]})]})}function Xe(e){return Xe="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},Xe(e)}function Ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach(function(t){qe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Xe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Je(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return Ze(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ze(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Ze(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,Ze(d,"constructor",c),Ze(c,"constructor",l),l.displayName="GeneratorFunction",Ze(c,o,"GeneratorFunction"),Ze(d),Ze(d,o,"Generator"),Ze(d,r,function(){return this}),Ze(d,"toString",function(){return"[object Generator]"}),(Je=function(){return{w:i,m:p}})()}function Ze(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ze=function(e,t,n,r){function i(t,n){Ze(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Ze(e,t,n,r)}function Qe(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(e,t):void 0}}(e,t)||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 tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nt=[{value:"us-east-1",label:"US East 1 (N. Virginia)"},{value:"us-east-2",label:"US East 2 (N. Virginia)"},{value:"us-central-1",label:"US Central 1 (Texas)"},{value:"us-west-1",label:"US West 1 (Oregon)"},{value:"us-west-2",label:"US West 2 (San Jose)"},{value:"ca-central-1",label:"CA Central 1 (Toronto)"},{value:"eu-central-1",label:"EU Central 1 (Amsterdam)"},{value:"eu-central-2",label:"EU Central 2 (Frankfurt)"},{value:"eu-west-1",label:"EU West 1 (United Kingdom)"},{value:"eu-west-2",label:"EU West 2 (Paris)"},{value:"eu-west-3",label:"EU West 3 (United Kingdom)"},{value:"eu-south-1",label:"EU South 1 (Milan)"},{value:"ap-northeast-1",label:"AP Northeast 1 (Tokyo)"},{value:"ap-northeast-2",label:"AP Northeast 2 (Osaka)"},{value:"ap-southeast-1",label:"AP Southeast 1 (Singapore)"},{value:"ap-southeast-2",label:"AP Southeast 2 (Sydney)"}];function rt(e){var t=(e||"").trim();return t?"https://s3.".concat(t,".wasabisys.com"):""}function ot(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=e.setMessage,s=e.onLibraryInstalled,l=et((0,r.useState)(!1),2),p=l[0],f=l[1],g=et((0,r.useState)(t.region||"us-east-1"),2),h=g[0],m=g[1],y=et((0,r.useState)(t.endpoint||rt(t.region||"us-east-1")),2),b=y[0],x=y[1],v=c("wasabi",o,i,n),j=v.libraryInstalled,w=v.setLibraryInstalled,k=v.installing,S=v.installLibrary;(0,r.useEffect)(function(){void 0!==t.library_installed&&w(t.library_installed)},[t.library_installed,w]),(0,r.useEffect)(function(){var e=t.region||"us-east-1";m(e),x(t.endpoint||rt(e))},[t.region,t.endpoint]);var _=function(){var e,t=(e=Je().m(function e(){var t;return Je().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,S();case 1:(t=e.v).success?(w(!0),a({type:"success",text:t.message}),setTimeout(function(){return a(null)},3e3),s&&s()):(a({type:"error",text:t.message}),setTimeout(function(){return a(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Qe(i,r,o,a,s,"next",e)}function s(e){Qe(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),O=!n||!j;return(0,d.jsxs)(d.Fragment,{children:[!j&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Wasabi uses the same S3 SDK library as Amazon S3 / R2. Install the library to continue."}),(0,d.jsx)("button",{type:"button",onClick:_,disabled:!n||k,style:$e($e({},u.installButton),{},{background:k?"#ccc":"#3F6972",cursor:!n||k?"not-allowed":"pointer"}),children:k?"Installing Library...":"Install Wasabi Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:t.title||t.alias||"Wasabi",disabled:O,style:$e($e({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"access_key",style:u.label,children:["Access Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"access_key",name:"access_key",defaultValue:t.access_key||"",disabled:O,style:$e($e({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Wasabi access key."," ",(0,d.jsx)("a",{href:"https://console.wasabisys.com/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Wasabi console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"secret_key",style:u.label,children:["Secret Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:p?"text":"password",id:"secret_key",name:"secret_key",defaultValue:t.secret_key||"",disabled:O,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return f(!p)},disabled:O,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:O?"not-allowed":"pointer",padding:"5px",color:"#666",opacity:O?.5:1},title:p?"Hide secret":"Show secret",children:p?"Hide":"Show"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"wasabi_region_select",style:u.label,children:["Region ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("select",{id:"region",name:"region",value:h,disabled:O,onChange:function(e){var t=e.target.value;m(t),x(rt(t))},style:$e($e({},u.input),{},{maxWidth:"500px"}),children:nt.map(function(e){return(0,d.jsx)("option",{value:e.value,children:e.label},e.value)})}),(0,d.jsx)("p",{style:u.description,children:"Region where your bucket lives"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"endpoint",style:u.label,children:["Endpoint ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"url",id:"endpoint",name:"endpoint",value:b,readOnly:!0,disabled:O,style:$e($e({},u.input),{},{maxWidth:"500px",background:"#f5f5f5"})}),(0,d.jsx)("p",{style:u.description,children:"Auto-generated from region (S3 path-style)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:t.bucket||"",disabled:O,style:$e($e({},u.input),{},{maxWidth:"500px"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:Array.isArray(t.user_role_access)&&t.user_role_access.includes(e),disabled:O}),(0,d.jsx)("span",{style:{textTransform:"capitalize"},children:e})]},e)})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:t.private_folder||"",disabled:O,style:$e($e({},u.input),{},{maxWidth:"500px"}),placeholder:"Optional subfolder prefix"})]})]})}var it=n(7850),at=n(5688),st=n(7554);function lt(e){return lt="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},lt(e)}function ct(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=mt(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function ut(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return dt(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(dt(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,dt(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,dt(d,"constructor",c),dt(c,"constructor",l),l.displayName="GeneratorFunction",dt(c,o,"GeneratorFunction"),dt(d),dt(d,o,"Generator"),dt(d,r,function(){return this}),dt(d,"toString",function(){return"[object Generator]"}),(ut=function(){return{w:i,m:p}})()}function dt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}dt=function(e,t,n,r){function i(t,n){dt(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},dt(e,t,n,r)}function pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gt(e,t,n){return(t=function(e){var t=function(e){if("object"!=lt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||mt(e,t)||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 mt(e,t){if(e){if("string"==typeof e)return yt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yt(e,t):void 0}}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function xt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){bt(i,r,o,a,s,"next",e)}function s(e){bt(i,r,o,a,s,"throw",e)}a(void 0)})}}function vt(e){return jt.apply(this,arguments)}function jt(){return jt=xt(ut().m(function e(t){var n,r,o,i,a,s,l,c,u,d,p=arguments;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=p.length>1&&void 0!==p[1]?p[1]:{},r=p.length>2&&void 0!==p[2]?p[2]:12e3,o=new AbortController,i=setTimeout(function(){return o.abort()},r),e.p=1,e.n=2,fetch(t,ft(ft({},n),{},{signal:o.signal}));case 2:return a=e.v,e.n=3,a.text();case 3:s=e.v,l={};try{l=s?JSON.parse(s):{}}catch(e){l={message:s||"Invalid server response"}}if(a.ok){e.n=4;break}throw d=(null===(c=l)||void 0===c?void 0:c.message)||(null===(u=l)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.message)||"Request failed (".concat(a.status,")"),new Error(d);case 4:return e.a(2,l);case 5:return e.p=5,clearTimeout(i),e.f(5);case 6:return e.a(2)}},e,null,[[1,,5,6]])})),jt.apply(this,arguments)}function wt(){var e,t,n,o,i,a,s,l,c,u,p,f,g,h,m,y,b,x,j,w,k,S,_,O,T,P,I,A=(0,at.lA)(),E=(null===(e=window.wpApiSettings)||void 0===e?void 0:e.nonce)||(null===(t=window.afmReact)||void 0===t?void 0:t.nonce)||"",F=(null===(n=window.afmReact)||void 0===n?void 0:n.hasPro)||!1,D=(null===(o=window.afmReact)||void 0===o?void 0:o.currentPlan)||"free",W=(null===(i=window.afmReact)||void 0===i?void 0:i.pricingUrl)||"https://advancedfilemanager.com/pricing/",R=(0,it.w)("dropbox",D,F),M=(0,it.w)("googledrive",D,F),G=(0,it.w)("onedrive",D,F),B=(0,it.w)("amazons3",D,F),N=(0,it.w)("github",D,F),L=(0,it.w)("googlecloud",D,F),H=(0,it.w)("pcloud",D,F),V=(0,it.w)("cloudflarer2",D,F),K=(0,it.w)("wasabi",D,F),X=(0,it.w)("digitalocean",D,F),Y=(0,it.w)("ai_integration",D,F),q=ht((0,r.useState)({}),2),J=q[0],Z=q[1],Q=ht((0,r.useState)(!0),2),ee=Q[0],te=Q[1],ne=ht((0,r.useState)(!1),2),re=ne[0],oe=ne[1],ie=ht((0,r.useState)(!1),2),ae=ie[0],se=ie[1],le=ht((0,r.useState)(null),2),ce=le[0],ue=le[1],de=ht((0,r.useState)(null),2),pe=de[0],fe=de[1],ge=ht((0,r.useState)(!1),2),he=(ge[0],ge[1],ht((0,r.useState)(!1),2)),me=(he[0],he[1],ht((0,r.useState)(null),2)),ye=(me[0],me[1],ht((0,r.useState)(!1),2)),xe=ye[0],ve=ye[1],je=ht((0,r.useState)(!1),2),we=je[0],ke=je[1],Se=ht((0,r.useState)(!1),2),_e=Se[0],Oe=Se[1],Te=ht((0,r.useState)(!1),2),Pe=Te[0],Ie=Te[1],Ae=ht((0,r.useState)(!1),2),Ee=(Ae[0],Ae[1]),Fe=ht((0,r.useState)(!1),2),De=(Fe[0],Fe[1],ht((0,r.useState)(!1),2)),We=(De[0],De[1],ht((0,r.useState)(!1),2)),Re=We[0],Me=We[1],Ge=ht((0,r.useState)(null),2),Be=Ge[0],Ne=Ge[1],Le=ht((0,r.useState)(!1),2),Ue=Le[0],He=Le[1];(0,r.useEffect)(function(){"ai-code-assistent"!==Xe&&He(!1)},[Xe]);var Ve=ht((0,r.useState)(function(){return function(){var e=window.location.hash.match(/^#\/extension\/([^\/]+)/);if(e&&e[1]){var t=e[1];if(["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(t))return t}var n=sessionStorage.getItem("afm-extension-integration");return n&&["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n)?n:null}()}),2),Xe=Ve[0],Ye=Ve[1];(0,r.useEffect)(function(){var e=function(){var e=window.location.hash,t=e.match(/^#\/extension\/([^\/]+)/);if(t&&t[1]){var n=t[1];if(["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n))return void Ye(function(e){return e!==n?n:e})}"true"!==sessionStorage.getItem("afm-extension-hash-just-set")&&("#/extension"!==e&&"#/integrations"!==e||e.match(/^#\/extension\/([^\/]+)/)||Ye(function(e){return null!==e?null:e}))},t=setTimeout(e,100);e();var n=setTimeout(e,200);return window.addEventListener("hashchange",e),function(){clearTimeout(t),clearTimeout(n),window.removeEventListener("hashchange",e)}},[]),(0,r.useEffect)(function(){Xe?sessionStorage.setItem("afm-extension-integration",Xe):sessionStorage.removeItem("afm-extension-integration")},[Xe]),(0,r.useEffect)(function(){if("true"!==sessionStorage.getItem("afm-extension-hash-just-set")){var e=setTimeout(function(){if("true"!==sessionStorage.getItem("afm-extension-hash-just-set")){var e=window.location.hash,t=e.match(/^#\/extension\/([^\/]+)/),n=t&&t[1]?t[1]:null,r=n&&["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n);if(Xe||!r)if(Xe){var o="#/extension/".concat(Xe);if(e!==o){if(n===Xe)return;if("true"===sessionStorage.getItem("afm-extension-hash-just-set"))return;if(window.history&&window.history.replaceState){var i=window.location.href.split("#")[0]+o;window.history.replaceState({},"",i)}else window.location.hash=o}}else{if("true"===sessionStorage.getItem("afm-extension-hash-just-set"))return;if(e&&e.startsWith("#/extension/")&&!r){var a="#/extension";if(window.history&&window.history.replaceState){var s=window.location.href.split("#")[0]+a;window.history.replaceState({},"",s)}else window.location.hash=a}}}},500);return function(){return clearTimeout(e)}}},[Xe]);var $e=ht((0,r.useState)([{id:"ai-code-assistent",title:"AI -- Code Pilot",description:"Empower developers with AI-assisted coding, real-time suggestions, and automation inside Advanced File Manager.",iconBg:"#4CAF50",iconColor:"#fff",icon:"image",iconImage:((null===(a=window.afmReact)||void 0===a?void 0:a.pluginUrl)||(null===(s=window.afm_object)||void 0===s?void 0:s.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/codepilot.png",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/ai-code-assistent/"},{id:"onedrive",title:"OneDrive",description:"Seamlessly integrate OneDrive to access, organize, and manage your stored files directly through WordPress.",iconBg:"#0078D4",iconColor:"#fff",icon:"image",iconImage:((null===(l=window.afmReact)||void 0===l?void 0:l.pluginUrl)||(null===(c=window.afm_object)||void 0===c?void 0:c.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/onedrive.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/onedrive/"},{id:"google-drive",title:"Google Drive",description:"Link Google Drive to browse, upload, and manage cloud files from your WordPress file manager.",iconBg:"#4285F4",iconColor:"#fff",icon:"image",iconImage:((null===(u=window.afmReact)||void 0===u?void 0:u.pluginUrl)||(null===(p=window.afm_object)||void 0===p?void 0:p.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/googledrive.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/google-drive/"},{id:"dropbox",title:"Dropbox",description:"Connect Dropbox to securely upload, manage, and synchronize your files directly within the WordPress dashboard.",iconBg:"#0061FF",iconColor:"#fff",icon:"image",iconImage:((null===(f=window.afmReact)||void 0===f?void 0:f.pluginUrl)||(null===(g=window.afm_object)||void 0===g?void 0:g.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/dropbox.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/dropbox/"},{id:"amazon-s3",title:"Amazon S3",description:"Connect Amazon S3 for scalable file storage, secure uploads, and efficient access within WordPress.",iconBg:"#FF9900",iconColor:"#fff",icon:"image",iconImage:((null===(h=window.afmReact)||void 0===h?void 0:h.pluginUrl)||(null===(m=window.afm_object)||void 0===m?void 0:m.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/amazons3.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/amazon-s3/"},{id:"github",title:"Github",description:"Integrate GitHub to browse repositories, edit files, and sync development projects directly through WordPress.",iconBg:"#181717",iconColor:"#fff",icon:"image",iconImage:((null===(y=window.afmReact)||void 0===y?void 0:y.pluginUrl)||(null===(b=window.afm_object)||void 0===b?void 0:b.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/github.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/github/"},{id:"google-cloud-storage",title:"Google Cloud Storage",description:"Enable Google Cloud for secure storage, direct uploads, and high-performance file management in WordPress.",iconBg:"#4285F4",iconColor:"#fff",icon:"image",iconImage:((null===(x=window.afmReact)||void 0===x?void 0:x.pluginUrl)||(null===(j=window.afm_object)||void 0===j?void 0:j.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/googlecloud.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/google-cloud-storage/"},{id:"pcloud",title:"pCloud",description:"Connect and manage your pCloud files directly from the Advanced File Manager.",iconBg:"#2D7FC4",iconColor:"#fff",icon:"image",iconImage:((null===(w=window.afmReact)||void 0===w?void 0:w.pluginUrl)||(null===(k=window.afm_object)||void 0===k?void 0:k.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/pcloud.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/pricing/"},{id:"cloudflare-r2",title:"Cloudflare R2",description:"Connect and manage your Cloudflare R2 buckets/files directly from the Advanced File Manager.",iconBg:"#F38020",iconColor:"#fff",icon:"image",iconImage:((null===(S=window.afmReact)||void 0===S?void 0:S.pluginUrl)||(null===(_=window.afm_object)||void 0===_?void 0:_.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/cloudflarer2.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/pricing/"},{id:"wasabi",title:"Wasabi",description:"Connect Wasabi hot cloud storage (S3-compatible) to browse and manage buckets from the file manager.",iconBg:"#00ce3e",iconColor:"#fff",icon:"image",iconImage:((null===(O=window.afmReact)||void 0===O?void 0:O.pluginUrl)||(null===(T=window.afm_object)||void 0===T?void 0:T.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/wasabi.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://wasabi.com/"},{id:"digitalocean",title:"DigitalOcean Spaces",description:"Connect and manage your DigitalOcean Spaces buckets/files directly from the Advanced File Manager.",iconBg:"#0080FF",iconColor:"#fff",icon:"image",iconImage:((null===(P=window.afmReact)||void 0===P?void 0:P.pluginUrl)||(null===(I=window.afm_object)||void 0===I?void 0:I.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/digitalocean.svg",enabled:!1,hasSettings:!0,comingSoon:!0,learnMoreUrl:"https://advancedfilemanager.com/pricing/"}]),2),qe=$e[0],Je=$e[1],Ze=function(e){e.id;var t=e.checked,n=e.disabled,r=e.onChange;return(0,d.jsx)("label",{onClick:function(e){!n&&r&&(e.preventDefault(),e.stopPropagation(),r({target:{checked:!t}}))},style:{display:"inline-flex",alignItems:"center",cursor:n?"not-allowed":"pointer",opacity:n?.5:1,margin:0,padding:0,userSelect:"none"},children:(0,d.jsx)("div",{style:{position:"relative",width:"44px",height:"24px",background:t?"#3F6972":"#ccc",borderRadius:"12px",transition:"background 0.3s",pointerEvents:n?"none":"auto"},children:(0,d.jsx)("div",{style:{position:"absolute",top:"2px",left:t?"22px":"2px",width:"20px",height:"20px",background:"#fff",borderRadius:"50%",transition:"left 0.3s",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"}})})})},Qe=function(){var e=xt(ut().m(function e(t){var n,r,o,i,a,s,l,c,u;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:if(F){e.n=1;break}return alert("Pro version is required for integrations."),e.a(2);case 1:if(n=qe.find(function(e){return e.id===t})){e.n=2;break}return e.a(2);case 2:return r=!n.enabled,o="".concat(A,"file-manager-advanced/v1/integrations/").concat(t),e.p=3,e.n=4,fetch(o,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 4:if(i=e.v,a={},!i.ok){e.n=6;break}return e.n=5,i.json();case 5:a=e.v;case 6:return Je(function(e){return e.map(function(e){return e.id===t?ft(ft({},e),{},{enabled:r}):e})}),s=ft(ft({},a),{},{enable:r?"yes":"no"}),e.n=7,fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":E},body:JSON.stringify(s)});case 7:return l=e.v,e.n=8,l.json();case 8:c=e.v,l.ok&&c.success?(Xe===t&&Z(c.settings||s),ue({type:"success",text:c.message||"".concat(n.title," ").concat(r?"enabled":"disabled"," successfully")}),setTimeout(function(){return ue(null)},3e3),"ai-code-assistent"===t&&sessionStorage.setItem("afm_ai_settings_changed","true")):(Je(function(e){return e.map(function(e){return e.id===t?ft(ft({},e),{},{enabled:!r}):e})}),ue({type:"error",text:c.message||"Failed to save toggle state"}),setTimeout(function(){return ue(null)},3e3)),e.n=10;break;case 9:e.p=9,u=e.v,console.error("Error saving toggle state:",u),Je(function(e){return e.map(function(e){return e.id===t?ft(ft({},e),{},{enabled:!r}):e})}),ue({type:"error",text:"Failed to save toggle state"}),setTimeout(function(){return ue(null)},3e3);case 10:return e.a(2)}},e,null,[[3,9]])}));return function(t){return e.apply(this,arguments)}}();(0,r.useEffect)(function(){if(F){var e=function(){var e=xt(ut().m(function e(){var t,n,r,o,i,a;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("".concat(A,"file-manager-advanced/v1/integrations-status"),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 1:if(!(t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:return n=e.v,r=(null==n?void 0:n.connected)||{},o={"ai-code-assistent":!!r.ai,onedrive:!!r.onedrive,"google-drive":!!r.googledrive,dropbox:!!r.dropbox,"amazon-s3":!!r.amazonses,github:!!r.github,"google-cloud-storage":!!r.googlecloud,pcloud:!!r.pcloud,"cloudflare-r2":!!r["cloudflare-r2"],wasabi:!!r.wasabi},Je(function(e){return e.map(function(e){return Object.prototype.hasOwnProperty.call(o,e.id)?ft(ft({},e),{},{enabled:o[e.id]}):e})}),e.a(2);case 3:return i=qe.map(function(e){return e.id}),e.n=4,Promise.all(i.map(function(){var e=xt(ut().m(function e(t){var n,r,o;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,n="".concat(A,"file-manager-advanced/v1/integrations/").concat(t),e.n=1,fetch(n,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 1:if(!(r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:return o=e.v,e.a(2,{id:t,enabled:"yes"===o.enable||!0===o.enable});case 3:return e.a(2,{id:t,enabled:!1});case 4:return e.p=4,e.v,e.a(2,{id:t,enabled:!1})}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}()));case 4:a=e.v,Je(function(e){return e.map(function(e){var t=a.find(function(t){return t.id===e.id});return t?ft(ft({},e),{},{enabled:t.enabled}):e})}),e.n=6;break;case 5:e.p=5,e.v;case 6:return e.p=6,te(!1),e.f(6);case 7:return e.a(2)}},e,null,[[0,5,6,7]])}));return function(){return e.apply(this,arguments)}}();e()}else te(!1)},[F,A,E]);var et=r.useCallback(function(){Xe&&F&&vt("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}}).then(function(e){Z(e||{})}).catch(function(e){console.error("Error refreshing integration settings:",e)})},[Xe,F,A,E]);(0,r.useEffect)(function(){Xe&&F&&(oe(!0),vt("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}}).then(function(e){Je(function(t){return t.map(function(t){return t.id===Xe?ft(ft({},t),{},{enabled:"yes"===e.enable||!0===e.enable}):t})}),Z(e||{}),"onedrive"===Xe&&void 0!==e.is_connected&&ve(e.is_connected),"google-drive"===Xe&&void 0!==e.is_connected&&(Ie(e.is_connected),e.error_message&&(ue({type:"error",text:e.error_message}),setTimeout(function(){return ue(null)},5e3))),"dropbox"===Xe&&(void 0!==e.is_connected&&ke(e.is_connected),void 0!==e.library_installed?Ee(e.library_installed):Ee(!1),e.error_message&&(ue({type:"error",text:e.error_message}),setTimeout(function(){return ue(null)},5e3))),"pcloud"===Xe&&void 0!==e.is_connected&&Oe(e.is_connected),oe(!1)}).catch(function(e){console.error("Error fetching integration settings:",e),ue({type:"error",text:"Failed to load ".concat(Xe," settings. ").concat(e.message||"").trim()}),setTimeout(function(){return ue(null)},5e3),oe(!1)}))},[Xe,F,A,E]),(0,r.useEffect)(function(){var e=new URLSearchParams(window.location.search),t=e.get("dropbox_connected"),n=e.get("dropbox_disconnected"),r=e.get("dropbox_error"),o=e.get("onedrive_connected"),i=e.get("onedrive_disconnected"),a=e.get("onedrive_error"),s=e.get("googledrive_connected"),l=e.get("googledrive_disconnected"),c=e.get("googledrive_error"),u=e.get("error_msg"),d=e.get("redirect_hash");if(t||(t=sessionStorage.getItem("afm-dropbox-connected")),n||(n=sessionStorage.getItem("afm-dropbox-disconnected")),r||(r=sessionStorage.getItem("afm-dropbox-error")),o||(o=sessionStorage.getItem("afm-onedrive-connected")),i||(i=sessionStorage.getItem("afm-onedrive-disconnected")),a||(a=sessionStorage.getItem("afm-onedrive-error")),s||(s=sessionStorage.getItem("afm-googledrive-connected")),l||(l=sessionStorage.getItem("afm-googledrive-disconnected")),c||(c=sessionStorage.getItem("afm-googledrive-error")),u||(u=sessionStorage.getItem("afm-dropbox-error-msg")||sessionStorage.getItem("afm-onedrive-error-msg")||sessionStorage.getItem("afm-googledrive-error-msg")),d||(d=sessionStorage.getItem("afm-oauth-redirect-hash")),"1"===r){if(Ye("dropbox"),u){var p=decodeURIComponent(u);ue({type:"error",text:p}),setTimeout(function(){ue(null)},5e3)}else ue({type:"error",text:"Dropbox connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox")},200),sessionStorage.removeItem("afm-dropbox-error"),sessionStorage.removeItem("afm-dropbox-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}if("1"===t&&(console.log("Setting Dropbox connected message"),ue({type:"success",text:"Dropbox connected successfully!"}),setTimeout(function(){console.log("Clearing Dropbox connected message"),ue(null)},5e3),Ye("dropbox"),ke(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-dropbox-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===n&&(console.log("Setting Dropbox disconnected message"),ue({type:"success",text:"Dropbox disconnected successfully!"}),setTimeout(function(){console.log("Clearing Dropbox disconnected message"),ue(null)},5e3),Ye("dropbox"),ke(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-dropbox-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===a){if(console.log("Setting OneDrive error message"),Ye("onedrive"),u){var f=decodeURIComponent(u);console.log("Error message:",f),ue({type:"error",text:f}),setTimeout(function(){console.log("Clearing OneDrive error message"),ue(null)},5e3)}else ue({type:"error",text:"OneDrive connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive")},200),sessionStorage.removeItem("afm-onedrive-error"),sessionStorage.removeItem("afm-onedrive-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}if("1"===o&&(console.log("Setting OneDrive connected message"),ue({type:"success",text:"OneDrive connected successfully!"}),setTimeout(function(){console.log("Clearing OneDrive connected message"),ue(null)},5e3),Ye("onedrive"),ve(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-onedrive-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===i&&(console.log("Setting OneDrive disconnected message"),ue({type:"success",text:"OneDrive disconnected successfully!"}),setTimeout(function(){console.log("Clearing OneDrive disconnected message"),ue(null)},5e3),Ye("onedrive"),ve(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-onedrive-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===c){if(console.log("Setting Google Drive error message"),Ye("google-drive"),u){var g=decodeURIComponent(u);console.log("Error message:",g),ue({type:"error",text:g}),setTimeout(function(){console.log("Clearing Google Drive error message"),ue(null)},5e3)}else ue({type:"error",text:"Google Drive connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-error"),sessionStorage.removeItem("afm-googledrive-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}"1"===s&&(console.log("Setting Google Drive connected message"),ue({type:"success",text:"Google Drive connected successfully!"}),setTimeout(function(){console.log("Clearing Google Drive connected message"),ue(null)},5e3),Ye("google-drive"),Ie(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===l&&(console.log("Setting Google Drive disconnected message"),ue({type:"success",text:"Google Drive disconnected successfully!"}),setTimeout(function(){console.log("Clearing Google Drive disconnected message"),ue(null)},5e3),Ye("google-drive"),Ie(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash"))},[]),(0,r.useEffect)(function(){var e=new URLSearchParams(window.location.search),t=e.get("onedrive_connected"),n=e.get("onedrive_disconnected"),r=e.get("googledrive_connected"),o=e.get("googledrive_disconnected"),i=e.get("dropbox_connected"),a=e.get("dropbox_disconnected"),s=e.get("dropbox_error"),l=e.get("pcloud_connected"),c=e.get("pcloud_disconnected"),u=e.get("pcloud_error"),d=e.get("error_msg"),p=e.get("redirect_hash");if(p){var f=e.get("page")||"file_manager_advanced_ui",g=p;p.includes("onedrive")?(p.startsWith("#/extension/")||(g="#/extension/onedrive"),Ye("onedrive")):p.includes("googledrive")||p.includes("google-drive")?(p.startsWith("#/extension/")||(g="#/extension/google-drive"),Ye("google-drive")):p.includes("dropbox")&&(p.startsWith("#/extension/")||(g="#/extension/dropbox"),Ye("dropbox"));var h=window.location.pathname;h+="?page="+encodeURIComponent(f),h+=g,window.history.replaceState({},"",h)}if("1"===t){"onedrive"!==Xe&&Ye("onedrive"),ve(!0),ue({type:"success",text:"OneDrive connected successfully!"}),setTimeout(function(){return ue(null)},3e3);var m=p||"#/extension/onedrive",y=e.get("page")||"file_manager_advanced_ui",b=window.location.pathname+"?page="+encodeURIComponent(y)+m;window.history.replaceState({},"",b)}if("1"===n){"onedrive"!==Xe&&Ye("onedrive"),ve(!1),ue({type:"success",text:"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3);var x=p||"#/extension/onedrive",v=e.get("page")||"file_manager_advanced_ui",j=window.location.pathname+"?page="+encodeURIComponent(v)+x;window.history.replaceState({},"",j)}if("1"===i||"1"===a){var w=p||"#/extension/dropbox",k=e.get("page")||"file_manager_advanced_ui",S=window.location.pathname+"?page="+encodeURIComponent(k)+w;window.history.replaceState({},"",S)}if("1"===l){"pcloud"!==Xe&&Ye("pcloud"),Oe(!0),ue({type:"success",text:"pCloud connected successfully!"}),setTimeout(function(){return ue(null)},3e3);var _=p||"#/extension/pcloud",O=e.get("page")||"file_manager_advanced_ui",T=window.location.pathname+"?page="+encodeURIComponent(O)+_;window.history.replaceState({},"",T)}if("1"===c){"pcloud"!==Xe&&Ye("pcloud"),Oe(!1),ue({type:"success",text:"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3);var C=p||"#/extension/pcloud",P=e.get("page")||"file_manager_advanced_ui",I=window.location.pathname+"?page="+encodeURIComponent(P)+C;window.history.replaceState({},"",I)}if("1"===u){"pcloud"!==Xe&&Ye("pcloud"),d&&(ue({type:"error",text:decodeURIComponent(d)}),setTimeout(function(){return ue(null)},5e3));var A=p||"#/extension/pcloud",E=e.get("page")||"file_manager_advanced_ui",F=window.location.pathname+"?page="+encodeURIComponent(E)+A;window.history.replaceState({},"",F)}if("1"!==s||r||o||null!=p&&p.includes("google")){if("1"===s){var D=p||window.location.hash||"#/extension",W=e.get("page")||"file_manager_advanced_ui",R=window.location.pathname+"?page="+encodeURIComponent(W)+D;window.history.replaceState({},"",R)}}else{"dropbox"!==Xe&&Ye("dropbox"),d&&(ue({type:"error",text:decodeURIComponent(d)}),setTimeout(function(){return ue(null)},5e3));var z=p||"#/extension/dropbox",M=e.get("page")||"file_manager_advanced_ui",G=window.location.pathname+"?page="+encodeURIComponent(M)+z;window.history.replaceState({},"",G)}},[Xe]);var tt=function(e){if(F){console.log("handleSettings called with id:",e),sessionStorage.setItem("afm-extension-integration",e),console.log("Saved to sessionStorage:",e),sessionStorage.setItem("afm-extension-hash-just-set","true"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},2e3),Ye(e),Z({});var t="#/extension/".concat(e),n=window.location.href.split("#")[0]+t;console.log("Setting hash to:",t,"Full URL:",n),window.history&&window.history.replaceState?(window.history.replaceState({},"",n),console.log("Hash set via replaceState")):(window.location.hash=t,console.log("Hash set via location.hash")),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 50ms:",e),e!==t&&(console.warn("Hash mismatch! Expected:",t,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",n):window.location.hash=t)},50),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 150ms:",e),e!==t&&(console.warn("Hash mismatch! Expected:",t,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",n):window.location.hash=t)},150),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 300ms:",e),e!==t&&(console.warn("Hash mismatch! Expected:",t,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",n):window.location.hash=t)},300)}else alert("Pro version is required for integrations.")},nt=function(){var e=xt(ut().m(function e(t){var n,r,o,i,a,s,l,c,u,d,p,f,g,h,m,y,b,x,v,j,w,k,S,_,O,T,C,P,I,D,W,R,z,M,G,B,N,L,U,H,V,K,X,Y,$,q,Q,ee,te,ne,re,oe,ie,ae,le,ce,de,fe,ge,he,me,ye,be,xe,je,we,ke,Se,_e,Oe,Te,Ce,Pe,Ae,Ee,Fe,De,We,Re,ze,Me,Ge,Be,Ne,Le,Ue,He,Ve,Ke,Ye,$e,Je,Ze;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),F&&Xe){e.n=1;break}return e.a(2);case 1:if(se(!0),ue(null),n=new FormData(t.target),r={},"amazon-s3"!==Xe){e.n=12;break}if(J.library_installed){e.n=2;break}return ue({type:"error",text:"Please install Amazon S3 library first before saving settings."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 2:if(o=document.getElementById("bucket"),i=document.getElementById("app_key"),a=document.getElementById("app_secret"),s=document.getElementById("region"),o&&i&&a&&s){e.n=3;break}return ue({type:"error",text:"Required input fields not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 3:if(l=(o.value||"").trim(),c=(i.value||"").trim(),u=(a.value||"").trim(),d=(s.value||"").trim(),l&&0!==l.length){e.n=4;break}return ue({type:"error",text:"Please enter your Amazon S3 Bucket Name."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 4:if(c&&0!==c.length){e.n=5;break}return ue({type:"error",text:"Please enter your Amazon S3 App Key."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 5:if(u&&0!==u.length){e.n=6;break}return ue({type:"error",text:"Please enter your Amazon S3 App Secret."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 6:if(d&&0!==d.length){e.n=7;break}return ue({type:"error",text:"Please enter your AWS Region."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 7:if(!(l.length<3||l.length>63)){e.n=8;break}return ue({type:"error",text:"Bucket name must be between 3 and 63 characters long."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 8:if(/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(l)||/^[a-z0-9]$/.test(l)){e.n=9;break}return ue({type:"error",text:"Bucket name format is invalid. Use lowercase letters, numbers, dots, and hyphens. Must start and end with a letter or number."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 9:if(!(c.length<10)){e.n=10;break}return ue({type:"error",text:"App Key appears to be too short. Please check your AWS Access Key ID."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 10:if(!(u.length<20)){e.n=11;break}return ue({type:"error",text:"App Secret appears to be too short. Please check your AWS Secret Access Key."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 11:if(!(d.length<2)){e.n=12;break}return ue({type:"error",text:"Region appears to be invalid. Please check your AWS Region."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 12:if("wasabi"!==Xe){e.n=17;break}if(J.library_installed){e.n=13;break}return ue({type:"error",text:"Please install the Wasabi library first (same SDK as S3)."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 13:if(p=document.getElementById("bucket"),f=document.getElementById("access_key"),g=document.getElementById("secret_key"),h=document.getElementById("region"),m=document.getElementById("endpoint"),p&&f&&g&&h&&m){e.n=14;break}return ue({type:"error",text:"Required Wasabi fields not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 14:if(y=(p.value||"").trim(),b=(f.value||"").trim(),x=(g.value||"").trim(),v=(h.value||"").trim(),j=(m.value||"").trim(),y&&b&&x&&v&&j){e.n=15;break}return ue({type:"error",text:"Please fill Access Key, Secret Key, Region, Endpoint, and Bucket for Wasabi."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 15:if(!(y.length<3||y.length>63)){e.n=16;break}return ue({type:"error",text:"Bucket name must be between 3 and 63 characters long."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 16:if(/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(y)||/^[a-z0-9]$/.test(y)){e.n=17;break}return ue({type:"error",text:"Bucket name format is invalid for Wasabi (S3 rules)."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 17:if("google-cloud-storage"!==Xe){e.n=37;break}if(J.library_installed){e.n=18;break}return ue({type:"error",text:"Please install Google Cloud library first before saving settings."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 18:if(w=document.getElementById("bucket")){e.n=19;break}return ue({type:"error",text:"Bucket input field not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 19:if(k=w.value||"",(S=k.trim())&&0!==S.length){e.n=20;break}return ue({type:"error",text:"Please enter your Google Cloud Bucket Name."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 20:if(1===S.length?/^[a-z0-9]$/.test(S):2===S.length?/^[a-z0-9][a-z0-9]$/.test(S):/^[a-z0-9][a-z0-9\-_.]*[a-z0-9]$/.test(S)){e.n=21;break}return ue({type:"error",text:"Bucket name format is invalid. Use lowercase letters, numbers, hyphens, underscores, and dots. Must start and end with a letter or number."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 21:if(!(S.length>63)){e.n=22;break}return ue({type:"error",text:"Bucket name is too long. Maximum 63 characters allowed."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 22:if(_=document.getElementById("auth_key"),O=pe&&pe instanceof File||_&&_.files&&_.files.length>0,T=J.auth_key&&""!==J.auth_key.trim(),O||T){e.n=23;break}return ue({type:"error",text:"Please upload a Google Cloud authentication key file (.json format)."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 23:if(C=null,pe&&pe instanceof File?C=pe:_&&_.files&&_.files.length>0?C=_.files[0]:(P=n.get("auth_key"))instanceof File&&(C=P),!(C&&C instanceof File&&C.size>0)){e.n=36;break}return e.p=24,(W=new FormData).append("auth_key",C),e.n=25,fetch("".concat(A,"file-manager-advanced/v1/integrations/google-cloud-storage/upload-key"),{method:"POST",headers:{"X-WP-Nonce":E},body:W});case 25:return R=e.v,e.n=26,R.text();case 26:z=e.v;try{M=z?JSON.parse(z):{}}catch(e){M={success:!1,message:z||"Invalid upload response"}}if(M.success){e.n=27;break}return B=(null===(G=M.data)||void 0===G?void 0:G.message)||M.message||"Failed to upload authentication key file",ue({type:"error",text:B}),setTimeout(function(){return ue(null)},3e3),se(!1),e.a(2);case 27:if(!(N=(null===(I=M.data)||void 0===I?void 0:I.filepath)||(null===(D=M.data)||void 0===D?void 0:D.filename)||M.filepath||M.filename)){e.n=28;break}r.auth_key=N,e.n=33;break;case 28:return ue({type:"info",text:"File uploaded. Reloading settings to get filepath..."}),e.n=29,new Promise(function(e){return setTimeout(e,500)});case 29:return e.p=29,e.n=30,fetch("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{headers:{"X-WP-Nonce":E}});case 30:return L=e.v,e.n=31,L.json();case 31:(U=e.v).auth_key&&(r.auth_key=U.auth_key),e.n=33;break;case 32:e.p=32,e.v;case 33:e.n=35;break;case 34:return e.p=34,Ve=e.v,ue({type:"error",text:"Failed to upload authentication key file: "+Ve.message}),setTimeout(function(){return ue(null)},3e3),se(!1),e.a(2);case 35:e.n=37;break;case 36:J.auth_key&&(r.auth_key=J.auth_key);case 37:H=ct(n.entries()),e.p=38,H.s();case 39:if((V=H.n()).done){e.n=43;break}if(K=ht(V.value,2),X=K[0],Y=K[1],"user_role_access"!==X){e.n=40;break}r[X]||(r[X]=[]),r[X].push(Y),e.n=42;break;case 40:if("auth_key"!==X||"google-cloud-storage"!==Xe){e.n=41;break}return e.a(3,42);case 41:r[X]=Y;case 42:e.n=39;break;case 43:e.n=45;break;case 44:e.p=44,Ke=e.v,H.e(Ke);case 45:return e.p=45,H.f(),e.f(45);case 46:if($=qe.find(function(e){return e.id===Xe}),r.enable=null!=$&&$.enabled?"yes":"no",q=function(e){return"string"==typeof e?e.trim():e||""},"dropbox"!==Xe){e.n=48;break}if(q(r.app_key)){e.n=47;break}return ue({type:"error",text:"App Key is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 47:if(q(r.app_secret)){e.n=48;break}return ue({type:"error",text:"App Secret is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 48:if("onedrive"!==Xe){e.n=50;break}if(q(r.app_id)){e.n=49;break}return ue({type:"error",text:"Application (client) ID is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 49:if(q(r.app_secret)){e.n=50;break}return ue({type:"error",text:"Client secret is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 50:if("google-drive"!==Xe){e.n=52;break}if(q(r.app_key)){e.n=51;break}return ue({type:"error",text:"App Key is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 51:if(q(r.app_secret)){e.n=52;break}return ue({type:"error",text:"App Secret is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 52:if("github"!==Xe){e.n=54;break}if(q(r.username)){e.n=53;break}return ue({type:"error",text:"GitHub Username is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 53:if(q(r.pat)){e.n=54;break}return ue({type:"error",text:"GitHub PAT is required."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 54:if("ai-code-assistent"!==Xe){e.n=55;break}if("yes"!==r.enable||q(r.gpt_api_key)){e.n=55;break}return ue({type:"error",text:"GPT API Key is required when AI integration is enabled."}),setTimeout(function(){return ue(null)},5e3),se(!1),e.a(2);case 55:if("google-cloud-storage"===Xe&&!r.auth_key&&J.auth_key&&(r.auth_key=J.auth_key),"ai-code-assistent"!==Xe){e.n=56;break}if(!(Q=(r.gpt_api_key||"").trim())){e.n=56;break}if(Q.match(/^sk-[a-zA-Z0-9_-]{20,}$/)){e.n=56;break}return ue({type:"error",text:'Invalid API key format. Should start with "sk-" followed by alphanumeric characters, hyphens, or underscores.'}),setTimeout(function(){return ue(null)},3e3),se(!1),e.a(2);case 56:return ee="".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),e.p=57,e.n=58,fetch(ee,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":E},body:JSON.stringify(r)});case 58:return te=e.v,e.n=59,te.json();case 59:if(ne=e.v,!te.ok||!ne.success){e.n=94;break}if("google-cloud-storage"!==Xe){e.n=69;break}return e.n=60,fetch("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 60:return re=e.v,e.n=61,re.json();case 61:if(oe=e.v,Z(oe||{}),ie=oe.bucket||r.bucket||"",ae=oe.auth_key||r.auth_key||"",!ie||!ae){e.n=67;break}return e.p=62,e.n=63,fetch("".concat(A,"file-manager-advanced/v1/integrations/google-cloud-storage/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":E},body:JSON.stringify({bucket:ie,auth_key:ae})});case 63:return le=e.v,e.n=64,le.json();case 64:ce=e.v,le.ok?ce.valid||ce.success?(ue({type:"success",text:ne.message||"Settings saved successfully! Bucket validated."}),setTimeout(function(){return ue(null)},3e3)):(ge=ce.message||"Bucket validation failed.",ue({type:"error",text:"Settings saved, but bucket validation failed: "+ge}),setTimeout(function(){return ue(null)},8e3)):(fe=ce.message||(null===(de=ce.data)||void 0===de?void 0:de.message)||ce.code||"Bucket validation failed.",ue({type:"error",text:"Settings saved, but bucket validation failed: "+fe}),setTimeout(function(){return ue(null)},8e3)),e.n=66;break;case 65:e.p=65,Ye=e.v,console.error("Error validating bucket:",Ye),ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 66:e.n=68;break;case 67:ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 68:e.n=93;break;case 69:if("amazon-s3"!==Xe){e.n=79;break}return e.n=70,fetch("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 70:return he=e.v,e.n=71,he.json();case 71:if(me=e.v,Z(me||{}),console.log("Settings reloaded after save:",me),ye=me.bucket||r.bucket||"",be=me.app_key||r.app_key||"",xe=me.app_secret||r.app_secret||"",je=me.region||r.region||"",!(ye&&be&&xe&&je)){e.n=77;break}return console.log("Validating bucket using Amazon S3 library after save..."),e.p=72,e.n=73,fetch("".concat(A,"file-manager-advanced/v1/integrations/amazon-s3/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":E},body:JSON.stringify({bucket:ye,app_key:be,app_secret:xe,region:je})});case 73:return we=e.v,e.n=74,we.json();case 74:ke=e.v,we.ok?ke.valid||ke.success?(console.log("Bucket validation passed:",ke.message||"Bucket is valid"),ue({type:"success",text:ne.message||"Settings saved successfully! Bucket validated."}),setTimeout(function(){return ue(null)},3e3)):(Oe=ke.message||"Bucket validation failed.",console.log("Bucket validation failed:",Oe),ue({type:"error",text:"Settings saved, but bucket validation failed: "+Oe}),setTimeout(function(){return ue(null)},8e3)):(_e=ke.message||(null===(Se=ke.data)||void 0===Se?void 0:Se.message)||ke.code||"Bucket validation failed.",console.log("Bucket validation failed:",_e,ke),ue({type:"error",text:"Settings saved, but bucket validation failed: "+_e}),setTimeout(function(){return ue(null)},8e3)),e.n=76;break;case 75:e.p=75,$e=e.v,console.error("Error validating bucket:",$e),ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 76:e.n=78;break;case 77:ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 78:e.n=93;break;case 79:if("wasabi"!==Xe){e.n=89;break}return e.n=80,fetch("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 80:return Te=e.v,e.n=81,Te.json();case 81:if(Ce=e.v,Z(Ce||{}),Pe=Ce.bucket||r.bucket||"",Ae=Ce.access_key||r.access_key||"",Ee=Ce.secret_key||r.secret_key||"",Fe=Ce.region||r.region||"",De=Ce.endpoint||r.endpoint||"",!(Pe&&Ae&&Ee&&Fe&&De)){e.n=87;break}return e.p=82,e.n=83,fetch("".concat(A,"file-manager-advanced/v1/integrations/wasabi/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":E},body:JSON.stringify({bucket:Pe,access_key:Ae,secret_key:Ee,region:Fe,endpoint:De})});case 83:return We=e.v,e.n=84,We.json();case 84:Re=e.v,We.ok?Re.valid||Re.success?(ue({type:"success",text:ne.message||"Settings saved successfully! Wasabi connection OK."}),setTimeout(function(){return ue(null)},3e3)):(Ge=Re.message||"Wasabi validation failed.",ue({type:"error",text:"Settings saved, but Wasabi check failed: "+Ge}),setTimeout(function(){return ue(null)},8e3)):(Me=Re.message||(null===(ze=Re.data)||void 0===ze?void 0:ze.message)||Re.code||"Wasabi validation failed.",ue({type:"error",text:"Settings saved, but Wasabi check failed: "+Me}),setTimeout(function(){return ue(null)},8e3)),e.n=86;break;case 85:e.p=85,e.v,ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 86:e.n=88;break;case 87:ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 88:e.n=93;break;case 89:return e.p=89,e.n=90,fetch("".concat(A,"file-manager-advanced/v1/integrations/").concat(Xe),{headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 90:return Be=e.v,e.n=91,Be.json();case 91:Ne=e.v,Z(Ne||{}),console.log("Settings reloaded after save:",Ne),"onedrive"===Xe&&void 0!==Ne.is_connected&&ve(Ne.is_connected),"google-drive"===Xe&&void 0!==Ne.is_connected&&Ie(Ne.is_connected),ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=93;break;case 92:e.p=92,Je=e.v,console.error("Error reloading settings:",Je),ue({type:"success",text:ne.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 93:if("ai-code-assistent"===Xe&&sessionStorage.setItem("afm_ai_settings_changed","true"),"onedrive"===Xe){sessionStorage.setItem("afm_onedrive_settings_changed","true"),sessionStorage.setItem("afm_filemanager_redirect","true");try{for(Le=[],Ue=0;Ue<localStorage.length;Ue++)(He=localStorage.key(Ue))&&-1!==He.indexOf("elfinder")&&Le.push(He);Le.forEach(function(e){try{localStorage.removeItem(e)}catch(e){}})}catch(e){}}e.n=95;break;case 94:ue({type:"error",text:ne.message||"Failed to save settings"}),setTimeout(function(){return ue(null)},3e3);case 95:e.n=97;break;case 96:e.p=96,Ze=e.v,console.error("Error saving integration settings:",Ze),ue({type:"error",text:"Failed to save settings"}),setTimeout(function(){return ue(null)},3e3);case 97:return e.p=97,se(!1),e.f(97);case 98:return e.a(2)}},e,null,[[89,92],[82,85],[72,75],[62,65],[57,96,97,98],[38,44,45,46],[29,32],[24,34]])}));return function(t){return e.apply(this,arguments)}}(),rt=qe.find(function(e){return e.id===Xe});return window.location.origin,window.location.pathname,Xe&&rt?(0,d.jsxs)("div",{className:"afm-tab-panel",children:[(0,d.jsx)("div",{className:"wrap",style:{background:"#fff",padding:"20px",border:"1px solid #ccc",position:"relative"},children:(0,d.jsxs)(st.A,{shouldShow:!F,children:[(0,d.jsx)("a",{href:"#",onClick:function(e){e.preventDefault(),function(){Ye(null),Z({}),ue(null);var e="#/extension";if(window.history&&window.history.replaceState){var t=window.location.href.split("#")[0]+e;window.history.replaceState({},"",t)}else window.location.hash=e}()},style:{display:"inline-flex",alignItems:"center",color:"#3F6972",textDecoration:"none",fontSize:"14px",fontWeight:500,marginBottom:"20px",cursor:"pointer"},onMouseEnter:function(e){e.currentTarget.style.textDecoration="underline"},onMouseLeave:function(e){e.currentTarget.style.textDecoration="none"},children:"← Back To Integrations"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",marginBottom:"30px",paddingBottom:"15px",borderBottom:"1px solid #e5e5e5",gap:"80px"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[rt.iconImage&&(0,d.jsx)("img",{src:rt.iconImage,alt:"",style:{width:"24px",height:"24px",flexShrink:0}}),(0,d.jsxs)("h3",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"#0f172a"},children:[rt.title," Settings"]})]}),(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",margin:0,padding:0},children:(0,d.jsx)(Ze,{id:"".concat(rt.id,"_enable"),checked:rt.enabled,disabled:!F||"dropbox"===rt.id&&!R||"onedrive"===rt.id&&!G||"google-drive"===rt.id&&!M||"amazon-s3"===rt.id&&!B||"github"===rt.id&&!N||"google-cloud-storage"===rt.id&&!L||"pcloud"===rt.id&&!H||"cloudflare-r2"===rt.id&&!V||"wasabi"===rt.id&&!K||"digitalocean"===rt.id&&!X||"ai-code-assistent"===rt.id&&!Y,onChange:function(){return Qe(rt.id)}})})]}),ce&&(0,d.jsxs)("div",{className:"afm-snackbar afm-snackbar-".concat("success"===ce.type?"success":"info"===ce.type?"info":"error"),onClick:function(){return ue(null)},style:{animation:"afm-slideIn 0.3s ease-out"},children:[(0,d.jsx)("span",{style:{fontSize:"14px",lineHeight:"1.5",flex:"1"},children:ce.text}),(0,d.jsx)("button",{type:"button",className:"afm-snackbar-close",onClick:function(e){e.preventDefault(),e.stopPropagation(),ue(null)},style:{background:"none",border:"none",padding:"0",cursor:"pointer",color:"inherit",fontSize:"18px",lineHeight:"1",marginLeft:"12px",opacity:"0.7",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]}),re?(0,d.jsxs)("div",{style:{padding:"10px 0"},children:[(0,d.jsx)("style",{children:"\n                  @keyframes afm-skeleton-shimmer {\n                    0% { background-position: -200% 0; }\n                    100% { background-position: 200% 0; }\n                  }\n                  .afm-skeleton {\n                    background-color: #e2e8f0;\n                    background-image: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);\n                    background-size: 200% 100%;\n                    animation: afm-skeleton-shimmer 1.4s linear infinite;\n                  }\n                "}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"22px",width:"220px",borderRadius:"6px",marginBottom:"20px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"24px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"40px",width:"160px",borderRadius:"6px"}})]}):(0,d.jsxs)("form",{onSubmit:nt,encType:"google-cloud-storage"===Xe?"multipart/form-data":void 0,children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:function(){if(!Xe||!rt)return null;var e=J,t=window.location.origin+window.location.pathname;switch(e.redirect_uri||t||window.location.origin,Xe){case"onedrive":return(0,d.jsx)(st.A,{shouldShow:F&&!G,children:(0,d.jsx)(U,{settings:e,hasPro:F&&G,isConnected:xe,onConnect:function(){var t=window.location.origin+window.location.pathname,n=e.redirect_uri||t||window.location.origin;if(e.app_id&&e.app_secret){var r=window.location.hash||"#/extension/onedrive";window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=".concat(encodeURIComponent(e.app_id),"&response_type=code&redirect_uri=").concat(encodeURIComponent(n),"&scope=files.readwrite.all%20offline_access&state=").concat(encodeURIComponent(r))}},setMessage:ue,setShowDisconnectModal:Me,setDisconnectIntegration:Ne})});case"google-drive":return(0,d.jsx)(st.A,{shouldShow:F&&!M,children:(0,d.jsx)($,{settings:e,hasPro:F&&M,isConnected:Pe,setShowDisconnectModal:Me,setDisconnectIntegration:Ne,setMessage:ue})});case"dropbox":return(0,d.jsx)(st.A,{shouldShow:F&&!R,children:(0,d.jsx)(z,{settings:e,hasPro:F&&R,root:A,nonce:E,setMessage:ue,isConnected:we,setShowDisconnectModal:Me,setDisconnectIntegration:Ne})});case"amazon-s3":return(0,d.jsx)(st.A,{shouldShow:F&&!B,children:(0,d.jsx)(v,{settings:e,hasPro:F&&B,root:A,nonce:E,setMessage:ue,onLibraryInstalled:et})});case"github":return(0,d.jsx)(st.A,{shouldShow:F&&!N,children:(0,d.jsx)(be,{settings:e,hasPro:F&&N,root:A,nonce:E,setMessage:ue,onSettingsRefresh:et})});case"google-cloud-storage":return(0,d.jsx)(st.A,{shouldShow:F&&!L,children:(0,d.jsx)(C,{settings:e,hasPro:F&&L,root:A,nonce:E,setMessage:ue,selectedAuthKeyFile:pe,setSelectedAuthKeyFile:fe,onLibraryInstalled:et})});case"pcloud":return(0,d.jsx)(st.A,{shouldShow:F&&!H,children:(0,d.jsx)(ze,{settings:e,hasPro:F&&H,root:A,nonce:E,setMessage:ue,isConnected:_e,setShowDisconnectModal:Me,setDisconnectIntegration:Ne})});case"cloudflare-r2":return(0,d.jsx)(st.A,{shouldShow:F&&!V,children:(0,d.jsx)(Ke,{settings:e,hasPro:F&&V,root:A,nonce:E,setMessage:ue})});case"wasabi":return(0,d.jsx)(st.A,{shouldShow:F&&!K,children:(0,d.jsx)(ot,{settings:e,hasPro:F&&K,root:A,nonce:E,setMessage:ue,onLibraryInstalled:et})});case"digitalocean":return(0,d.jsxs)("div",{style:{padding:"24px",textAlign:"center",background:"#f8f9fa",borderRadius:"8px",border:"1px solid #e9ecef"},children:[(0,d.jsx)("span",{style:{display:"inline-block",padding:"3px 8px",background:"#f0b90b",color:"#fff",borderRadius:"3px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"12px"},children:"Coming Soon"}),(0,d.jsx)("p",{style:{margin:0,color:"#666",fontSize:"14px"},children:"DigitalOcean Spaces integration is under development. Connect and manage your DigitalOcean Spaces buckets directly from the Advanced File Manager."}),(0,d.jsx)("a",{href:W,target:"_blank",rel:"noopener noreferrer",style:ft(ft({},{color:"#3F6972",textDecoration:"underline"}),{},{marginTop:"12px",display:"inline-block"}),children:"Learn more"})]});case"ai-code-assistent":return(0,d.jsx)(st.A,{shouldShow:F&&!Y,children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Ce,{settings:e,hasPro:F&&Y,root:A,nonce:E,setMessage:ue,onApiKeyValidated:function(){return He(!0)}}),(0,d.jsxs)("div",{style:{marginTop:"30px",padding:"20px",background:"#f8f9fa",borderRadius:"4px",border:"1px solid #e9ecef"},children:[(0,d.jsx)("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"16px",fontWeight:600},children:"How to Use Code Pilot"}),(0,d.jsxs)("ol",{style:{margin:0,paddingLeft:"20px",fontSize:"14px",color:"#666"},children:[(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Enter your OpenAI GPT API key above"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Enable the AI Code Pilot integration using the toggle switch"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Open any code file in the File Manager"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Click the Code Pilot icon in the editor toolbar"}),(0,d.jsx)("li",{children:"Use AI-powered code suggestions and assistance"})]})]})]})});default:return(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center",color:"#666"},children:"Settings form for this integration is not yet implemented."})}}()}),(0,d.jsx)("div",{style:{marginTop:"30px"},children:(0,d.jsx)("button",{type:"submit",disabled:!F||ae||"ai-code-assistent"===Xe&&!Ue,style:{background:!F||ae||"ai-code-assistent"===Xe&&!Ue?"#ccc":"#3F6972",color:"#fff",border:"none",borderRadius:"4px",padding:"12px 24px",fontSize:"14px",fontWeight:600,cursor:!F||ae||"ai-code-assistent"===Xe&&!Ue?"not-allowed":"pointer",opacity:!F||ae||"ai-code-assistent"===Xe&&!Ue?.5:1},onMouseEnter:function(e){!F||ae||"ai-code-assistent"===Xe&&!Ue||(e.currentTarget.style.background="#2d555e")},onMouseLeave:function(e){!F||ae||"ai-code-assistent"===Xe&&!Ue||(e.currentTarget.style.background="#3F6972")},children:ae?"Saving...":"Save Changes"})})]})]})}),Re&&Be&&(0,d.jsx)("div",{id:"afm-disconnect-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,margin:0,padding:0},onClick:function(){console.log("Modal backdrop clicked"),Me(!1),Ne(null)},children:(0,d.jsxs)("div",{id:"afm-disconnect-modal-content",style:{background:"#fff",borderRadius:"8px",minWidth:"400px",maxWidth:"90%",padding:"24px",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.2)",position:"relative",zIndex:1e6,margin:"20px"},onClick:function(e){e.stopPropagation(),console.log("Modal content clicked")},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 16px 0",fontSize:"20px",fontWeight:600,color:"#1f2937"},children:["Disconnect ","dropbox"===Be?"Dropbox":"onedrive"===Be?"OneDrive":"google-drive"===Be?"Google Drive":"pcloud"===Be?"pCloud":"Integration","?"]}),(0,d.jsxs)("p",{style:{margin:"0 0 24px 0",color:"#6b7280",lineHeight:"1.6"},children:["Are you sure you want to disconnect ","dropbox"===Be?"Dropbox":"onedrive"===Be?"OneDrive":"google-drive"===Be?"Google Drive":"pcloud"===Be?"pCloud":"this integration","? You will need to reconnect to use this integration again."]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[(0,d.jsx)("button",{onClick:function(){Me(!1),Ne(null)},style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#e5e7eb"},onMouseOut:function(e){e.target.style.background="#f3f4f6"},children:"Cancel"}),(0,d.jsx)("button",{onClick:xt(ut().m(function e(){var t,n,r,o,i,a,s,l,c,u,d,p,f,g;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:if("dropbox"!==Be){e.n=5;break}return e.p=1,e.n=2,vt("".concat(A,"file-manager-advanced/v1/integrations/dropbox/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 2:t=e.v,ke(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:t.message||"Dropbox disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=4;break;case 3:e.p=3,d=e.v,console.error("Error disconnecting Dropbox:",d),Me(!1),Ne(null),ue({type:"error",text:d.message||"Failed to disconnect Dropbox"}),setTimeout(function(){return ue(null)},4e3);case 4:e.n=21;break;case 5:if("onedrive"!==Be){e.n=10;break}return e.p=6,e.n=7,vt("".concat(A,"file-manager-advanced/v1/integrations/onedrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 7:n=e.v,ve(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:n.message||"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=9;break;case 8:e.p=8,p=e.v,console.error("Error disconnecting OneDrive:",p),Me(!1),Ne(null),ue({type:"error",text:p.message||"Failed to disconnect OneDrive"}),setTimeout(function(){return ue(null)},4e3);case 9:e.n=21;break;case 10:if("google-drive"!==Be){e.n=17;break}return e.p=11,e.n=12,fetch("".concat(A,"file-manager-advanced/v1/disconnect-nonce?action=disconnect-googledrive"),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 12:if(r=e.v,o=E,!r.ok){e.n=14;break}return e.n=13,r.json();case 13:i=e.v,o=i.nonce||E;case 14:a=window.location.hash||"#/extension/google-drive",s="".concat(window.location.origin,"/wp-admin/admin.php?page=file_manager_advanced_ui&_wpnonce=").concat(o,"&action=disconnect-googledrive&redirect_to=").concat(encodeURIComponent(a)),window.location.href=s,e.n=16;break;case 15:e.p=15,f=e.v,console.error("Error getting disconnect nonce:",f),l=window.location.hash||"#/extension/google-drive",c="".concat(window.location.origin,"/wp-admin/admin.php?page=file_manager_advanced_ui&_wpnonce=").concat(E,"&action=disconnect-googledrive&redirect_to=").concat(encodeURIComponent(l)),window.location.href=c;case 16:e.n=21;break;case 17:if("pcloud"!==Be){e.n=21;break}return e.p=18,e.n=19,vt("".concat(A,"file-manager-advanced/v1/integrations/pcloud/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 19:u=e.v,Oe(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:u.message||"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=21;break;case 20:e.p=20,g=e.v,console.error("Error disconnecting pCloud:",g),Me(!1),Ne(null),ue({type:"error",text:g.message||"Failed to disconnect pCloud"}),setTimeout(function(){return ue(null)},4e3);case 21:return e.a(2)}},e,null,[[18,20],[11,15],[6,8],[1,3]])})),style:{padding:"10px 20px",background:"#dc2626",color:"#fff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#b91c1c"},onMouseOut:function(e){e.target.style.background="#dc2626"},children:"Disconnect"})]})]})})]}):(0,d.jsxs)("div",{className:"afm-tab-panel",children:[(0,d.jsxs)("div",{className:"wrap",style:{background:"#fff",padding:"20px",border:"1px solid #ccc",position:"relative"},children:[ce&&(0,d.jsxs)("div",{className:"afm-snackbar afm-snackbar-".concat("success"===ce.type?"success":"info"===ce.type?"info":"error"),onClick:function(){return ue(null)},style:{animation:"afm-slideIn 0.3s ease-out"},children:[(0,d.jsx)("span",{style:{fontSize:"14px",lineHeight:"1.5",flex:"1"},children:ce.text}),(0,d.jsx)("button",{type:"button",className:"afm-snackbar-close",onClick:function(e){e.preventDefault(),e.stopPropagation(),ue(null)},style:{background:"none",border:"none",padding:"0",cursor:"pointer",color:"inherit",fontSize:"18px",lineHeight:"1",marginLeft:"12px",opacity:"0.7",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]}),(0,d.jsx)(st.A,{shouldShow:!F,children:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:"20px",marginTop:"20px"},children:ee?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:"\n                  @keyframes afm-skeleton-shimmer {\n                    0% { background-position: -200% 0; }\n                    100% { background-position: 200% 0; }\n                  }\n                  .afm-skeleton {\n                    background-color: #e2e8f0;\n                    background-image: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);\n                    background-size: 200% 100%;\n                    animation: afm-skeleton-shimmer 1.4s linear infinite;\n                  }\n                "}),[1,2,3,4,5,6].map(function(e){return(0,d.jsxs)("div",{style:{background:"#fff",border:"1px solid #e5e5e5",borderRadius:"8px",padding:"20px",minHeight:"200px"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:[(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"48px",height:"48px",borderRadius:"8px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"80px",height:"20px",borderRadius:"4px"}})]}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"160px",height:"20px",borderRadius:"4px",marginBottom:"10px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"100%",height:"14px",borderRadius:"4px",marginBottom:"8px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"85%",height:"14px",borderRadius:"4px",marginBottom:"20px"}}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto",paddingTop:"16px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"80px",height:"14px",borderRadius:"4px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"44px",height:"24px",borderRadius:"12px"}})]})]},"integration-skeleton-".concat(e))})]}):qe.map(function(e){return(0,d.jsxs)("div",{style:{background:"#fff",border:"1px solid #e5e5e5",borderRadius:"8px",padding:"20px",position:"relative",display:"flex",flexDirection:"column",minHeight:"200px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",transition:"box-shadow 0.2s",cursor:F?e.hasSettings?"pointer":"default":"pointer"},onClick:function(t){F&&e.hasSettings&&(e.enabled||e.comingSoon)&&null===t.target.closest("button")&&null===t.target.closest(".afm-toggle-wrapper")&&tt(e.id)},onMouseEnter:function(e){F&&(e.currentTarget.style.boxShadow="0 4px 6px rgba(0,0,0,0.1)")},onMouseLeave:function(e){F&&(e.currentTarget.style.boxShadow="0 1px 3px rgba(0,0,0,0.1)")},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"12px"},children:[(0,d.jsx)("div",{style:{width:"48px",height:"48px",borderRadius:"8px",background:"image"===e.icon&&e.iconImage?"transparent":e.iconBg||"#f8f9fa",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",fontWeight:600,color:e.iconColor||"#0f172a",overflow:"hidden"},children:"image"===e.icon&&e.iconImage?(0,d.jsx)("img",{src:e.iconImage,alt:e.title,style:{width:"100%",height:"100%",objectFit:"contain"}}):e.icon}),e.hasSettings&&e.enabled&&(0,d.jsxs)("button",{onClick:function(t){t.stopPropagation(),tt(e.id)},disabled:!F,style:{background:"transparent",border:"none",color:"#3F6972",cursor:F?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"4px",opacity:F?1:.5},onMouseEnter:function(e){F&&(e.currentTarget.style.background="#f0f0f0")},onMouseLeave:function(e){e.currentTarget.style.background="transparent"},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"}),(0,d.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]})]}),(0,d.jsxs)("h3",{style:{margin:"0 0 8px 0",fontSize:"18px",fontWeight:600,color:"#0f172a",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[e.title,e.comingSoon&&(0,d.jsx)("span",{style:{display:"inline-block",padding:"3px 8px",background:"#f0b90b",color:"#fff",fontSize:"10px",fontWeight:600,textTransform:"uppercase",borderRadius:"3px",letterSpacing:"0.5px"},children:"Coming Soon"})]}),(0,d.jsx)("p",{style:{margin:"0 0 auto 0",fontSize:"14px",color:"#666",lineHeight:"1.6",flex:1},children:e.description}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"16px",paddingTop:"16px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("a",{href:e.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",onClick:function(e){F||(e.preventDefault(),window.open(W,"_blank"))},style:{fontSize:"14px",color:"#3F6972",textDecoration:"none",fontWeight:500},onMouseEnter:function(e){e.currentTarget.style.textDecoration="underline"},onMouseLeave:function(e){e.currentTarget.style.textDecoration="none"},children:"Learn More"}),(0,d.jsx)(Ze,{id:e.id,checked:e.enabled,disabled:!F||e.comingSoon,onChange:function(){return Qe(e.id)}})]})]},e.id)})})})]}),Re&&Be&&(0,d.jsx)("div",{id:"afm-disconnect-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,margin:0,padding:0},onClick:function(){console.log("Modal backdrop clicked"),Me(!1),Ne(null)},children:(0,d.jsxs)("div",{id:"afm-disconnect-modal-content",style:{background:"#fff",borderRadius:"8px",minWidth:"400px",maxWidth:"90%",padding:"24px",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.2)",position:"relative",zIndex:1e6,margin:"20px"},onClick:function(e){e.stopPropagation(),console.log("Modal content clicked")},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 16px 0",fontSize:"20px",fontWeight:600,color:"#1f2937"},children:["Disconnect ","dropbox"===Be?"Dropbox":"onedrive"===Be?"OneDrive":"pcloud"===Be?"pCloud":"Integration","?"]}),(0,d.jsxs)("p",{style:{margin:"0 0 24px 0",color:"#6b7280",lineHeight:"1.6"},children:["Are you sure you want to disconnect ","dropbox"===Be?"Dropbox":"onedrive"===Be?"OneDrive":"pcloud"===Be?"pCloud":"this integration","? You will need to reconnect to use this integration again."]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[(0,d.jsx)("button",{onClick:function(){Me(!1),Ne(null)},style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#e5e7eb"},onMouseOut:function(e){e.target.style.background="#f3f4f6"},children:"Cancel"}),(0,d.jsx)("button",{onClick:xt(ut().m(function e(){var t,n,r,o,i,a,s,l,c,u,d,p,f,g;return ut().w(function(e){for(;;)switch(e.p=e.n){case 0:if("dropbox"!==Be){e.n=5;break}return e.p=1,e.n=2,vt("".concat(A,"file-manager-advanced/v1/integrations/dropbox/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 2:t=e.v,ke(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:t.message||"Dropbox disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=4;break;case 3:e.p=3,d=e.v,console.error("Error disconnecting Dropbox:",d),Me(!1),Ne(null),ue({type:"error",text:d.message||"Failed to disconnect Dropbox"}),setTimeout(function(){return ue(null)},4e3);case 4:e.n=21;break;case 5:if("onedrive"!==Be){e.n=10;break}return e.p=6,e.n=7,vt("".concat(A,"file-manager-advanced/v1/integrations/onedrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 7:n=e.v,ve(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:n.message||"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=9;break;case 8:e.p=8,p=e.v,console.error("Error disconnecting OneDrive:",p),Me(!1),Ne(null),ue({type:"error",text:p.message||"Failed to disconnect OneDrive"}),setTimeout(function(){return ue(null)},4e3);case 9:e.n=21;break;case 10:if("google-drive"!==Be){e.n=17;break}return e.p=11,e.n=12,fetch("".concat(A,"file-manager-advanced/v1/googledrive-disconnect-nonce"),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":E}});case 12:if(r=e.v,o=E,!r.ok){e.n=14;break}return e.n=13,r.json();case 13:i=e.v,o=i.nonce||E;case 14:a=window.location.hash||"#/extension/google-drive",s="".concat(window.location.origin,"/wp-admin/admin.php?page=file_manager_advanced_ui&_wpnonce=").concat(o,"&action=disconnect-googledrive&redirect_to=").concat(encodeURIComponent(a)),window.location.href=s,e.n=16;break;case 15:e.p=15,f=e.v,console.error("Error getting disconnect nonce:",f),l=window.location.hash||"#/extension/google-drive",c="".concat(window.location.origin,"/wp-admin/admin.php?page=file_manager_advanced_ui&_wpnonce=").concat(E,"&action=disconnect-googledrive&redirect_to=").concat(encodeURIComponent(l)),window.location.href=c;case 16:e.n=21;break;case 17:if("pcloud"!==Be){e.n=21;break}return e.p=18,e.n=19,vt("".concat(A,"file-manager-advanced/v1/integrations/pcloud/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":E}});case 19:u=e.v,Oe(!1),Z(function(e){return ft(ft({},e||{}),{},{is_connected:!1})}),Me(!1),Ne(null),ue({type:"success",text:u.message||"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=21;break;case 20:e.p=20,g=e.v,console.error("Error disconnecting pCloud:",g),Me(!1),Ne(null),ue({type:"error",text:g.message||"Failed to disconnect pCloud"}),setTimeout(function(){return ue(null)},4e3);case 21:return e.a(2)}},e,null,[[18,20],[11,15],[6,8],[1,3]])})),style:{padding:"10px 20px",background:"#dc2626",color:"#fff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#b91c1c"},onMouseOut:function(e){e.target.style.background="#dc2626"},children:"Disconnect"})]})]})})]})}},5688(e,t,n){function r(){var e,t;return function(e){if(!e||"string"!=typeof e)return e;try{var t=new URL(e,window.location.origin);return t.protocol=window.location.protocol,t.host=window.location.host,t.toString()}catch(t){return e.startsWith("/")?"".concat(window.location.origin).concat(e):e}}((null===(e=window.wpApiSettings)||void 0===e?void 0:e.root)||(null===(t=window.afmReact)||void 0===t?void 0:t.jsonURL)||"/wp-json/")}n.d(t,{lA:()=>r})},7850(e,t,n){n.d(t,{w:()=>o});var r={basic:{dropbox:!1,googledrive:!1,onedrive:!1,amazons3:!1,github:!1,googlecloud:!1,pcloud:!1,cloudflarer2:!1,wasabi:!1,digitalocean:!1,email_notification:!0,slack_notification:!1,filelogs:!0,adminer:!1,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!1,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!1,gutenberg_blocks:!0,code_editor_themes:!1,ai_integration:!1},professional:{dropbox:!1,googledrive:!1,onedrive:!1,amazons3:!1,github:!1,googlecloud:!1,pcloud:!1,cloudflarer2:!1,wasabi:!1,digitalocean:!1,email_notification:!0,slack_notification:!1,filelogs:!0,adminer:!0,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!0,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!0,gutenberg_blocks:!0,code_editor_themes:!0,ai_integration:!1},business:{dropbox:!0,googledrive:!0,onedrive:!0,amazons3:!0,github:!0,googlecloud:!0,pcloud:!0,cloudflarer2:!0,wasabi:!0,digitalocean:!1,email_notification:!0,slack_notification:!0,filelogs:!0,adminer:!0,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!0,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!0,gutenberg_blocks:!0,code_editor_themes:!0,ai_integration:!0}};function o(e,t,n){return!!n&&"free"!==t&&!!r[t]&&!0===r[t][e]}}}]);
//# sourceMappingURL=895.chunk.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit