Your IP : 216.73.216.215


Current Path : /home/flapst5/ekmtoronto.com/wp-content/plugins/code-snippets/dist/
Upload File :
Current File : /home/flapst5/ekmtoronto.com/wp-content/plugins/code-snippets/dist/manage.js

/*! For license information please see manage.js.LICENSE.txt */
(()=>{var e={5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function s(){var t,n,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function c(e,s,o,i){var a=s&&s.prototype instanceof u?s:u,c=Object.create(a.prototype);return r(c,"_invoke",function(e,r,s){var o,i,a,c=0,u=s||[],d=!1,p={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,n){return o=e,i=0,a=t,p.n=n,l}};function f(e,r){for(i=e,a=r,n=0;!d&&c&&!s&&n<u.length;n++){var s,o=u[n],f=p.p,h=o[2];e>3?(s=h===r)&&(a=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=t):o[0]<=f&&((s=e<2&&f<o[1])?(i=0,p.v=r,p.n=o[1]):f<h&&(s=e<3||o[0]>r||r>h)&&(o[4]=e,o[5]=r,p.n=h,i=0))}if(s||e>1)return l;throw d=!0,r}return function(s,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),i=u,a=h;(n=i<2?t:a)||!d;){o||(i?i<3?(i>1&&(p.n=-1),f(i,a)):p.n=a:p.v=a);try{if(c=2,o){if(i||(s="next"),n=o[s]){if(!(n=n.call(o,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,i<2&&(i=0)}else 1===i&&(n=o.return)&&n.call(o),i<2&&(a=TypeError("The iterator does not provide a '"+s+"' method"),i=1);o=t}else if((n=(d=p.n<0)?a:e.call(r,p))!==l)break}catch(e){o=t,i=1,a=e}finally{c=1}}return{value:n,done:d}}}(e,o,i),!0),c}var l={};function u(){}function d(){}function p(){}n=Object.getPrototypeOf;var f=[][i]?n(n([][i]())):(r(n={},i,function(){return this}),n),h=p.prototype=u.prototype=Object.create(f);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,r(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return d.prototype=p,r(h,"constructor",p),r(p,"constructor",d),d.displayName="GeneratorFunction",r(p,a,"GeneratorFunction"),r(h),r(h,a,"Generator"),r(h,i,function(){return this}),r(h,"toString",function(){return"[object Generator]"}),(e.exports=s=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,s,o){var i=r(e,t,n,s,o);return i.next().then(function(e){return e.done?e.value:i.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),s=n(1791);e.exports=function(e,t,n,o,i){return new s(r().w(e,t,n,o),i||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),s=n(5546);e.exports=function e(t,n){function o(e,s,i,a){try{var c=t[e](s),l=c.value;return l instanceof r?n.resolve(l.v).then(function(e){o("next",e,i,a)},function(e){o("throw",e,i,a)}):n.resolve(l).then(function(e){c.value=e,i(c)},function(e){return o("throw",e,i,a)})}catch(e){a(e)}}var i;this.next||(s(e.prototype),s(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),s(this,"_invoke",function(e,t,r){function s(){return new n(function(t,n){o(e,r,t,n)})}return i=i?i.then(s,s):s()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,s,o){var i=Object.defineProperty;try{i({},"",{})}catch(n){i=0}e.exports=t=function(e,n,r,s){function o(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?i?i(e,n,{value:r,enumerable:!s,configurable:!s,writable:!s}):e[n]=r:(o("next",0),o("throw",1),o("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,s,o)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),s=n(6993),o=n(5869),i=n(887),a=n(1791),c=n(4373),l=n(579);function u(){"use strict";var t=s(),n=t.m(u),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var f={throw:1,return:2,break:3,continue:3};function h(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,f[e],t)},delegateYield:function(e,s,o){return t.resultName=s,n(r.d,l(e),o)},finish:function(e){return n(r.f,e)}},n=function(e,n,s){r.p=t.prev,r.n=t.next;try{return e(n,s)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=u=function(){return{wrap:function(e,n,r,s){return t.w(h(e),n,r,s&&s.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:a,async:function(e,t,n,r,s){return(p(t)?i:o)(h(e),t,n,r,s)},keys:c,values:l}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=u,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},6942(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,o(n)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=i(t,n));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(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 r(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}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,s,o,i,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw s}}return a}}(e,t)||r(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.")}()}n.r(e),n.d(e,{hasBrowserEnv:()=>vt,hasStandardBrowserEnv:()=>yt,hasStandardBrowserWebWorkerEnv:()=>jt,navigator:()=>gt,origin:()=>wt});const o=window.React,i=window.wp.i18n,a=window.wp.element;function c(e){return c="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},c(e)}const l=window.wp.url;var u=function(e){var t;return null!==(t=new URLSearchParams(window.location.search).get(e))&&void 0!==t?t:void 0},d=function(e){if("URLSearchParams"in window){for(var t=new URLSearchParams(window.location.search),n=0,r=Object.entries(e);n<r.length;n++){var o=s(r[n],2),i=o[0],a=o[1];a?t.set(i,String(a)):t.delete(i)}var c=window.location.toString().replace(window.location.search,"?".concat(t.toString()));window.history.replaceState({},document.title,c)}},p=function(e){switch(!0){case null==e:return;case"boolean"==typeof e:return e?"1":"0";case"number"==typeof e:case"string"==typeof e:return String(e);default:throw new Error("Unsupported query arg type: ".concat(c(e)))}},f=function(e,t){for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=s(o[r],2),a=i[0],c=i[1],u=p(c);void 0!==u&&(n[a]=u)}return(0,l.addQueryArgs)(e,n)};function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var b=n(6942),v=n.n(b);const g=window.ReactJSXRuntime;var y=["className","type","children"],j=["className","onDismiss","children"];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 x(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){h(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}var O=function(e){return"error"===e||"warning"===e},_=function(e){var t=e.className,n=e.type,r=e.children,s=m(e,y);return(0,g.jsx)("div",x(x({className:v()("notice","code-snippets-notice",h({},"notice-".concat(n),n),t),role:O(n)?"alert":"status","aria-live":O(n)?"assertive":"polite"},s),{},{children:r}))},S=function(e){var t=e.className,n=e.onDismiss,r=e.children,s=m(e,j);return(0,g.jsxs)(_,x(x({className:v()("is-dismissible",t)},s),{},{children:[r,(0,g.jsx)("button",{type:"button",className:"notice-dismiss",onClick:function(e){e.preventDefault(),n()},children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Dismiss notice.","code-snippets")})})]}))},P=function(){var e;return!0===(null===(e=window.pagenow)||void 0===e?void 0:e.endsWith("-network"))},N=function(){var e;return!(null===(e=window.CODE_SNIPPETS)||void 0===e||!e.isLicensed)},E=function(){var e;return!(N()||null!==(e=window.CODE_SNIPPETS)&&void 0!==e&&e.hideUpsell)};function C(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?C(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D=function(e){return(0,g.jsx)("svg",k(k({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",d:"M19.499 17.334a2.167 2.167 0 1 1-2.167 2.167m2.167-2.167a2.167 2.167 0 0 0-2.167 2.167m2.167-2.167V8.667m-2.167 10.834H8.665m0 0A2.167 2.167 0 0 0 6.5 17.334m2.166 2.167A2.167 2.167 0 1 1 6.5 17.334m0 0V8.667m2.166-2.166A2.167 2.167 0 1 0 6.5 8.667m2.166-2.166A2.167 2.167 0 0 1 6.5 8.667m2.166-2.166h8.667m0 0a2.167 2.167 0 1 1 2.167 2.166m-2.167-2.166a2.167 2.167 0 0 0 2.167 2.166M8.124 8.126l9.75 9.75m-9.75 0 9.75-9.75"})}))};function A(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 R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var T=function(e){return(0,g.jsx)("svg",R(R({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M20.0417 20.0417L22.75 22.75M4.33333 6.5H21.6667M4.33333 13H8.66666M4.33333 19.5H8.66666M11.9167 16.25C11.9167 17.3993 12.3732 18.5015 13.1859 19.3141C13.9985 20.1268 15.1007 20.5833 16.25 20.5833C17.3993 20.5833 18.5015 20.1268 19.3141 19.3141C20.1268 18.5015 20.5833 17.3993 20.5833 16.25C20.5833 15.1007 20.1268 13.9985 19.3141 13.1859C18.5015 12.3732 17.3993 11.9167 16.25 11.9167C15.1007 11.9167 13.9985 12.3732 13.1859 13.1859C12.3732 13.9985 11.9167 15.1007 11.9167 16.25Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};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 L(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){h(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}var F=function(e){return(0,g.jsx)("svg",L(L({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M11.9167 19.5045H7.21175C4.42541 19.5002 2.16666 17.326 2.16666 14.6436C2.16666 11.9624 4.42541 9.78812 7.21175 9.78812C7.6375 7.87928 9.15525 6.32145 11.193 5.7007C13.2297 5.08103 15.4787 5.49162 17.0907 6.78403C18.7027 8.0732 19.4328 10.0416 19.0082 11.9505H20.0807C20.8821 11.9519 21.6621 12.2097 22.3067 12.686C22.9513 13.1624 23.4266 13.8324 23.6632 14.5981M21.6667 22.7502L23.8333 20.5835L21.6667 18.4169M18.4167 18.4169L16.25 20.5835L18.4167 22.7502",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function M(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 U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var B=function(e){return(0,g.jsxs)("svg",U(U({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("path",{d:"M11.1854 4.67675C11.6469 2.77442 14.3531 2.77442 14.8146 4.67675C14.8838 4.96253 15.0196 5.22793 15.2108 5.45133C15.402 5.67474 15.6432 5.84984 15.9149 5.96239C16.1865 6.07494 16.4809 6.12176 16.7741 6.09902C17.0673 6.07629 17.3509 5.98466 17.602 5.83158C19.2736 4.81325 21.1878 6.72642 20.1695 8.39908C20.0166 8.65004 19.9252 8.93353 19.9025 9.2265C19.8798 9.51948 19.9266 9.81367 20.039 10.0852C20.1514 10.3567 20.3263 10.5978 20.5495 10.789C20.7726 10.9802 21.0377 11.116 21.3233 11.1854C23.2256 11.6469 23.2256 14.3531 21.3233 14.8146C21.0375 14.8838 20.7721 15.0196 20.5487 15.2108C20.3253 15.402 20.1502 15.6432 20.0376 15.9149C19.9251 16.1865 19.8782 16.4809 19.901 16.7741C19.9237 17.0673 20.0153 17.3509 20.1684 17.602C21.1868 19.2736 19.2736 21.1878 17.6009 20.1695C17.35 20.0166 17.0665 19.9252 16.7735 19.9025C16.4805 19.8798 16.1863 19.9266 15.9148 20.039C15.6433 20.1514 15.4022 20.3263 15.211 20.5495C15.0198 20.7726 14.884 21.0377 14.8146 21.3233C14.3531 23.2256 11.6469 23.2256 11.1854 21.3233C11.1162 21.0375 10.9804 20.7721 10.7892 20.5487C10.598 20.3253 10.3568 20.1502 10.0851 20.0376C9.81347 19.9251 9.51907 19.8782 9.2259 19.901C8.93273 19.9237 8.64907 20.0153 8.398 20.1684C6.72642 21.1868 4.81217 19.2736 5.8305 17.6009C5.98336 17.35 6.07485 17.0665 6.09752 16.7735C6.1202 16.4805 6.07343 16.1863 5.96101 15.9148C5.84859 15.6433 5.6737 15.4022 5.45055 15.211C5.22739 15.0198 4.96228 14.884 4.67675 14.8146C2.77442 14.3531 2.77442 11.6469 4.67675 11.1854C4.96253 11.1162 5.22793 10.9804 5.45133 10.7892C5.67474 10.598 5.84984 10.3568 5.96239 10.0851C6.07494 9.81347 6.12176 9.51907 6.09902 9.2259C6.07629 8.93273 5.98466 8.64907 5.83158 8.398C4.81325 6.72642 6.72642 4.81217 8.39908 5.8305C9.48242 6.48917 10.8864 5.90633 11.1854 4.67675Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,g.jsx)("path",{d:"M9.75 13C9.75 13.862 10.0924 14.6886 10.7019 15.2981C11.3114 15.9076 12.138 16.25 13 16.25C13.862 16.25 14.6886 15.9076 15.2981 15.2981C15.9076 14.6886 16.25 13.862 16.25 13C16.25 12.138 15.9076 11.3114 15.2981 10.7019C14.6886 10.0924 13.862 9.75 13 9.75C12.138 9.75 11.3114 10.0924 10.7019 10.7019C10.0924 11.3114 9.75 12.138 9.75 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))};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 q(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){h(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}var W=function(e){return(0,g.jsx)("svg",q(q({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M7.58333 8.66634L3.25 12.9997L7.58333 17.333M18.4167 8.66634L22.75 12.9997L18.4167 17.333M15.1667 4.33301L10.8333 21.6663",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};const H=window.wp.components;var K=function(e){var t,n=e.isOpen,r=e.setIsOpen;return n?(0,g.jsxs)(H.Modal,{"aria-labelledby":"code-snippets-upsell-dialog-title",className:"code-snippets-upsell code-snippets-upsell-dialog",onRequestClose:function(){r(!1)},children:[(0,g.jsx)("img",{src:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.plugin,"/assets/icon.svg"),alt:(0,i.__)("Code Snippets logo","code-snippets")}),(0,g.jsx)(z,{})]}):null},z=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("h1",{id:"code-snippets-upsell-dialog-title",children:(0,a.createInterpolateElement)((0,i.__)("Unlock all cloud sync features and many more, with <span>Code Snippets Pro</span>","code-snippets"),{span:(0,g.jsx)("span",{})})}),(0,g.jsx)("p",{children:(0,a.createInterpolateElement)((0,i.__)("With Code Snippets Pro you can connect your WordPress sites to the code snippets cloud platform and be able to <strong>backup, synchronise, collaborate, and deploy</strong> your snippets from one central location.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("a",{href:"https://codesnippets.pro/pricing/",className:"button button-primary button-large",rel:"noreferrer",target:"_blank",children:(0,i.__)("Explore Code Snippets Pro","code-snippets")}),(0,g.jsx)("p",{children:(0,i.__)("Here's what else you get with Pro:","code-snippets")}),(0,g.jsxs)("ul",{children:[(0,g.jsx)("li",{children:(0,i.__)("Create, explain and verify snippets with AI","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Control when snippets run with Conditions","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("CSS stylesheet snippets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Minified JavaScript snippets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Editor blocks and Elementor widgets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud sync and backup","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud share and deploy","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud bundles and teams","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("WP-CLI commands","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("And much more!","code-snippets")})]})]})},G=function(){return(0,g.jsx)("div",{className:"code-snippets-upsell code-snippets-upsell-page",children:(0,g.jsx)(z,{})})};function $(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 J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Q=["snippets","blueprints","cloud-community","cloud-library"],X=new URLSearchParams(window.location.search),Y=function(e){var t=e.name,n=e.url,r=e.label,s=(0,o.useMemo)(function(){return new URL(n).searchParams.get("page")},[n]),i=!X.get("subpage")&&X.get("page")===s;return(0,g.jsx)("li",{children:(0,g.jsx)("a",J(J({href:n,className:v()("".concat(t,"-link"),{"active-link":i})},!s&&{target:"_blank",rel:"noopener noreferrer"}),{},{children:r}))})},Z=function(){var e,t;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Y,{name:"docs",url:"https://codesnippets.pro/docs",label:(0,i.__)("Docs","code-snippets")}),(0,g.jsx)(Y,{name:"cloud",url:"https://codesnippets.cloud/",label:(0,i.__)("Cloud Dashboard","code-snippets")}),(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.welcome)&&(0,g.jsx)(Y,{name:"welcome",url:window.CODE_SNIPPETS.urls.welcome,label:(0,i.__)("What's New","code-snippets")}),(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.import)&&(0,g.jsx)(Y,{name:"import-snippets",url:window.CODE_SNIPPETS.urls.import,label:(0,i._x)("Import","snippets","code-snippets")})]})},ee=function(){return(0,g.jsx)("li",{className:"toolbar-more-item",children:(0,g.jsxs)("details",{className:"toolbar-more-menu",children:[(0,g.jsxs)("summary",{children:[(0,i.__)("More","code-snippets"),(0,g.jsx)("span",{className:"dashicons dashicons-arrow-down-alt2","aria-hidden":"true"})]}),(0,g.jsx)("ul",{children:(0,g.jsx)(Z,{})})]})})},te=function(){var e,t=s((0,o.useState)(!1),2),n=t[0],r=t[1];return(0,g.jsxs)("div",{className:"code-snippets-toolbar-upper",children:[(0,g.jsxs)("div",{className:"logo",children:[(0,g.jsx)("img",{src:"".concat(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.plugin,"/assets/icon.svg"),alt:(0,i.__)("Code Snippets logo","code-snippets"),"aria-hidden":"true"}),(0,g.jsx)("div",{children:(0,i.__)("Code Snippets","code-snippets")})]}),(0,g.jsx)("nav",{"aria-label":(0,i.__)("Main links","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(Z,{}),(0,g.jsx)(ee,{}),E()&&(0,g.jsx)("li",{className:"toolbar-upgrade-item",children:(0,g.jsx)("a",{className:"button button-large button-secondary",href:"https://codesnippets.pro/pricing/",target:"_blank",rel:"noopener noreferrer",onClick:function(e){e.preventDefault(),r(!0)},children:(0,i.__)("Upgrade to Pro","code-snippets")})})]})}),(0,g.jsx)(K,{isOpen:n,setIsOpen:r})]})},ne=function(e){var t,n=e.subpage,r=e.label,s=e.Icon,o=e.isPro;return(0,g.jsx)("li",{children:(0,g.jsxs)("a",{href:f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.manage,{subpage:n}),className:v()("".concat(n,"-link"),{"active-link":n===X.get("subpage")}),children:[(0,g.jsx)(s,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"toolbar-nav-label",children:r}),o&&!N()&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})})},re=function(){var e;return(0,g.jsx)("div",{className:"code-snippets-toolbar-lower",children:(0,g.jsx)("nav",{"aria-label":(0,i.__)("Main features","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(ne,{subpage:"snippets",label:(0,i.__)("Snippets","code-snippets"),Icon:W}),N()&&(0,g.jsx)(ne,{subpage:"blueprints",label:(0,i.__)("Blueprints","code-snippets"),Icon:D}),(0,g.jsx)(ne,{subpage:"cloud-community",label:(0,i.__)("Cloud Community","code-snippets"),Icon:T}),(0,g.jsx)(ne,{subpage:"cloud-library",label:(0,i.__)("Cloud Library","code-snippets"),Icon:F,isPro:!0}),!N()&&(0,g.jsx)(ne,{subpage:"blueprints",label:(0,i.__)("Blueprints","code-snippets"),Icon:D,isPro:!0}),(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.settings)&&(0,g.jsx)("li",{className:"toolbar-end-item",children:(0,g.jsxs)("a",{href:window.CODE_SNIPPETS.urls.settings,className:"settings-link",children:[(0,g.jsx)(B,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"toolbar-nav-label",children:(0,i.__)("Settings","code-snippets")})]})})]})})})},se=function(){return(0,g.jsxs)("div",{className:"code-snippets-toolbar",children:[(0,g.jsx)(te,{}),(0,g.jsx)(re,{})]})};function oe(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ie(e,t,n,r,s,o,i){try{var a=e[o](i),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function ae(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var o=e.apply(t,n);function i(e){ie(o,r,s,i,a,"next",e)}function a(e){ie(o,r,s,i,a,"throw",e)}i(void 0)})}}var ce=n(4756),le=n.n(ce);function ue(e,t){return function(){return e.apply(t,arguments)}}const{toString:de}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:he}=Symbol,me=(be=Object.create(null),e=>{const t=de.call(e);return be[t]||(be[t]=t.slice(8,-1).toLowerCase())});var be;const ve=e=>(e=e.toLowerCase(),t=>me(t)===e),ge=e=>t=>typeof t===e,{isArray:ye}=Array,je=ge("undefined");function we(e){return null!==e&&!je(e)&&null!==e.constructor&&!je(e.constructor)&&_e(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const xe=ve("ArrayBuffer"),Oe=ge("string"),_e=ge("function"),Se=ge("number"),Pe=e=>null!==e&&"object"==typeof e,Ne=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||he in e||fe in e)},Ee=ve("Date"),Ce=ve("File"),ke=ve("Blob"),De=ve("FileList"),Ae=ve("URLSearchParams"),[Re,Te,Ie,Le]=["ReadableStream","Request","Response","Headers"].map(ve);function Fe(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),ye(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(we(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function Me(e,t){if(we(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Be=e=>!je(e)&&e!==Ue,Ve=(qe="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>qe&&e instanceof qe);var qe;const We=ve("HTMLFormElement"),He=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ke=ve("RegExp"),ze=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Fe(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)},Ge=ve("AsyncFunction"),$e=(Je="function"==typeof setImmediate,Qe=_e(Ue.postMessage),Je?setImmediate:Qe?(Xe=`axios@${Math.random()}`,Ye=[],Ue.addEventListener("message",({source:e,data:t})=>{e===Ue&&t===Xe&&Ye.length&&Ye.shift()()},!1),e=>{Ye.push(e),Ue.postMessage(Xe,"*")}):e=>setTimeout(e));var Je,Qe,Xe,Ye;const Ze="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ue):"undefined"!=typeof process&&process.nextTick||$e,et={isArray:ye,isArrayBuffer:xe,isBuffer:we,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||_e(e.append)&&("formdata"===(t=me(e))||"object"===t&&_e(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&xe(e.buffer),t},isString:Oe,isNumber:Se,isBoolean:e=>!0===e||!1===e,isObject:Pe,isPlainObject:Ne,isEmptyObject:e=>{if(!Pe(e)||we(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Re,isRequest:Te,isResponse:Ie,isHeaders:Le,isUndefined:je,isDate:Ee,isFile:Ce,isBlob:ke,isRegExp:Ke,isFunction:_e,isStream:e=>Pe(e)&&_e(e.pipe),isURLSearchParams:Ae,isTypedArray:Ve,isFileList:De,forEach:Fe,merge:function e(){const{caseless:t,skipUndefined:n}=Be(this)&&this||{},r={},s=(s,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&Me(r,o)||o;Ne(r[i])&&Ne(s)?r[i]=e(r[i],s):Ne(s)?r[i]=e({},s):ye(s)?r[i]=s.slice():n&&je(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Fe(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(Fe(t,(t,r)=>{n&&_e(t)?Object.defineProperty(e,r,{value:ue(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&pe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:ve,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!Se(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[fe]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:We,hasOwnProperty:He,hasOwnProp:He,reduceDescriptors:ze,freezeMethods:e=>{ze(e,(t,n)=>{if(_e(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];_e(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return ye(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Me,global:Ue,isContextDefined:Be,isSpecCompliantForm:function(e){return!!(e&&_e(e.append)&&"FormData"===e[he]&&e[fe])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Pe(e)){if(t.indexOf(e)>=0)return;if(we(e))return e;if(!("toJSON"in e)){t[r]=e;const s=ye(e)?[]:{};return Fe(e,(e,t)=>{const o=n(e,r+1);!je(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:Ge,isThenable:e=>e&&(Pe(e)||_e(e))&&_e(e.then)&&_e(e.catch),setImmediate:$e,asap:Ze,isIterable:e=>null!=e&&_e(e[fe])};class tt extends Error{static from(e,t,n,r,s,o){const i=new tt(e.message,t||e.code,n,r,s);return i.cause=e,i.name=e.name,o&&Object.assign(i,o),i}constructor(e,t,n,r,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:et.toJSONObject(this.config),code:this.code,status:this.status}}}tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",tt.ERR_BAD_OPTION="ERR_BAD_OPTION",tt.ECONNABORTED="ECONNABORTED",tt.ETIMEDOUT="ETIMEDOUT",tt.ERR_NETWORK="ERR_NETWORK",tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",tt.ERR_DEPRECATED="ERR_DEPRECATED",tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",tt.ERR_CANCELED="ERR_CANCELED",tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",tt.ERR_INVALID_URL="ERR_INVALID_URL";const nt=tt;function rt(e){return et.isPlainObject(e)||et.isArray(e)}function st(e){return et.endsWith(e,"[]")?e.slice(0,-2):e}function ot(e,t,n){return e?e.concat(t).map(function(e,t){return e=st(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const it=et.toFlatObject(et,{},null,function(e){return/^is[A-Z]/.test(e)}),at=function(e,t,n){if(!et.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=et.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!et.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&et.isSpecCompliantForm(t);if(!et.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(et.isDate(e))return e.toISOString();if(et.isBoolean(e))return e.toString();if(!a&&et.isBlob(e))throw new nt("Blob is not supported. Use a Buffer instead.");return et.isArrayBuffer(e)||et.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(et.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(et.isArray(e)&&function(e){return et.isArray(e)&&!e.some(rt)}(e)||(et.isFileList(e)||et.endsWith(n,"[]"))&&(a=et.toArray(e)))return n=st(n),a.forEach(function(e,r){!et.isUndefined(e)&&null!==e&&t.append(!0===i?ot([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!rt(e)||(t.append(ot(s,n,o),c(e)),!1)}const u=[],d=Object.assign(it,{defaultVisitor:l,convertValue:c,isVisitable:rt});if(!et.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!et.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),et.forEach(n,function(n,o){!0===(!(et.isUndefined(n)||null===n)&&s.call(t,n,et.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t};function ct(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function lt(e,t){this._pairs=[],e&&at(e,this,t)}const ut=lt.prototype;ut.append=function(e,t){this._pairs.push([e,t])},ut.toString=function(e){const t=e?function(t){return e.call(this,t,ct)}:ct;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const dt=lt;function pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(e,t,n){if(!t)return e;const r=n&&n.encode||pt,s=et.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(i=o?o(t,s):et.isURLSearchParams(t)?t.toString():new dt(t,s).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const ht=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){et.forEach(this.handlers,function(t){null!==t&&e(t)})}},mt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},bt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:dt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},vt="undefined"!=typeof window&&"undefined"!=typeof document,gt="object"==typeof navigator&&navigator||void 0,yt=vt&&(!gt||["ReactNative","NativeScript","NS"].indexOf(gt.product)<0),jt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,wt=vt&&window.location.href||"http://localhost",xt={...e,...bt},Ot=function(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&et.isArray(r)?r.length:o,a?(et.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i):(r[o]&&et.isObject(r[o])||(r[o]=[]),t(e,n,r[o],s)&&et.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i)}if(et.isFormData(e)&&et.isFunction(e.entries)){const n={};return et.forEachEntry(e,(e,r)=>{t(function(e){return et.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},_t={transitional:mt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=et.isObject(e);if(s&&et.isHTMLForm(e)&&(e=new FormData(e)),et.isFormData(e))return r?JSON.stringify(Ot(e)):e;if(et.isArrayBuffer(e)||et.isBuffer(e)||et.isStream(e)||et.isFile(e)||et.isBlob(e)||et.isReadableStream(e))return e;if(et.isArrayBufferView(e))return e.buffer;if(et.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return at(e,new xt.classes.URLSearchParams,{visitor:function(e,t,n,r){return xt.isNode&&et.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=et.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return at(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e){if(et.isString(e))try{return(0,JSON.parse)(e),et.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||_t.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(et.isResponse(e)||et.isReadableStream(e))return e;if(e&&et.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw nt.from(e,nt.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xt.classes.FormData,Blob:xt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};et.forEach(["delete","get","head","post","put","patch"],e=>{_t.headers[e]={}});const St=_t,Pt=et.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Nt=Symbol("internals");function Et(e){return e&&String(e).trim().toLowerCase()}function Ct(e){return!1===e||null==e?e:et.isArray(e)?e.map(Ct):String(e)}function kt(e,t,n,r,s){return et.isFunction(r)?r.call(this,t,n):(s&&(t=n),et.isString(t)?et.isString(r)?-1!==t.indexOf(r):et.isRegExp(r)?r.test(t):void 0:void 0)}class Dt{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Et(t);if(!s)throw new Error("header name must be a non-empty string");const o=et.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Ct(e))}const o=(e,t)=>et.forEach(e,(e,n)=>s(e,n,t));if(et.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(et.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Pt[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(et.isObject(e)&&et.isIterable(e)){let n,r,s={};for(const t of e){if(!et.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?et.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=Et(e)){const n=et.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(et.isFunction(t))return t.call(this,e,n);if(et.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Et(e)){const n=et.findKey(this,e);return!(!n||void 0===this[n]||t&&!kt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Et(e)){const s=et.findKey(n,e);!s||t&&!kt(0,n[s],s,t)||(delete n[s],r=!0)}}return et.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!kt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return et.forEach(this,(r,s)=>{const o=et.findKey(n,s);if(o)return t[o]=Ct(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=Ct(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return et.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&et.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Nt]=this[Nt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Et(e);t[r]||(function(e,t){const n=et.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return et.isArray(e)?e.forEach(r):r(e),this}}Dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),et.reduceDescriptors(Dt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),et.freezeMethods(Dt);const At=Dt;function Rt(e,t){const n=this||St,r=t||n,s=At.from(r.headers);let o=r.data;return et.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Tt(e){return!(!e||!e.__CANCEL__)}const It=class extends nt{constructor(e,t,n){super(null==e?"canceled":e,nt.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Lt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new nt("Request failed with status code "+n.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const Ft=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Mt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ut=e=>(...t)=>et.asap(()=>e(...t)),Bt=xt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,xt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(xt.origin),xt.navigator&&/(msie|trident)/i.test(xt.navigator.userAgent)):()=>!0,Vt=xt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];et.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),et.isString(r)&&a.push(`path=${r}`),et.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),et.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function qt(e,t,n){let r=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Wt=e=>e instanceof At?{...e}:e;function Ht(e,t){t=t||{};const n={};function r(e,t,n,r){return et.isPlainObject(e)&&et.isPlainObject(t)?et.merge.call({caseless:r},e,t):et.isPlainObject(t)?et.merge({},t):et.isArray(t)?t.slice():t}function s(e,t,n,s){return et.isUndefined(t)?et.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!et.isUndefined(t))return r(void 0,t)}function i(e,t){return et.isUndefined(t)?et.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(Wt(e),Wt(t),0,!0)};return et.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const o=et.hasOwnProp(c,r)?c[r]:s,i=o(e[r],t[r],r);et.isUndefined(i)&&o!==a||(n[r]=i)}),n}const Kt=e=>{const t=Ht({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=At.from(i),t.url=ft(qt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),et.isFormData(n))if(xt.hasStandardBrowserEnv||xt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(et.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(xt.hasStandardBrowserEnv&&(r&&et.isFunction(r)&&(r=r(t)),r||!1!==r&&Bt(t.url))){const e=s&&o&&Vt.read(o);e&&i.set(s,e)}return t},zt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Kt(e);let s=r.data;const o=At.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function b(){if(!m)return;const r=At.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Lt(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(n(new nt("Request aborted",nt.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",s=new nt(r,nt.ERR_NETWORK,e,m);s.event=t||null,n(s),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||mt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new nt(t,s.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&et.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),et.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,u]=Ft(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=Ft(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new It(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===xt.protocols.indexOf(v)?n(new nt("Unsupported protocol "+v+":",nt.ERR_BAD_REQUEST,e)):m.send(s||null)})},Gt=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof nt?t:new It(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new nt(`timeout of ${t}ms exceeded`,nt.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>et.asap(i),a}},$t=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Jt=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*$t(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Qt}=et,Xt=(({Request:e,Response:t})=>({Request:e,Response:t}))(et.global),{ReadableStream:Yt,TextEncoder:Zt}=et.global,en=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tn=e=>{e=et.merge.call({skipUndefined:!0},Xt,e);const{fetch:t,Request:n,Response:r}=e,s=t?Qt(t):"function"==typeof fetch,o=Qt(n),i=Qt(r);if(!s)return!1;const a=s&&Qt(Yt),c=s&&("function"==typeof Zt?(l=new Zt,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&en(()=>{let e=!1;const t=new n(xt.origin,{body:new Yt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&en(()=>et.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new nt(`Response type '${e}' is not supported`,nt.ERR_NOT_SUPPORT,n)})});return async e=>{let{url:s,method:i,data:a,signal:l,cancelToken:f,timeout:h,onDownloadProgress:m,onUploadProgress:b,responseType:v,headers:g,withCredentials:y="same-origin",fetchOptions:j}=Kt(e),w=t||fetch;v=v?(v+"").toLowerCase():"text";let x=Gt([l,f&&f.toAbortSignal()],h),O=null;const _=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let S;try{if(b&&u&&"get"!==i&&"head"!==i&&0!==(S=await(async(e,t)=>{const r=et.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(et.isBlob(e))return e.size;if(et.isSpecCompliantForm(e)){const t=new n(xt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return et.isArrayBufferView(e)||et.isArrayBuffer(e)?e.byteLength:(et.isURLSearchParams(e)&&(e+=""),et.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(g,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(et.isFormData(a)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=Mt(S,Ft(Ut(b)));a=Jt(t.body,65536,e,n)}}et.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in n.prototype,l={...j,signal:x,method:i.toUpperCase(),headers:g.normalize().toJSON(),body:a,duplex:"half",credentials:t?y:void 0};O=o&&new n(s,l);let f=await(o?w(O,j):w(s,l));const h=d&&("stream"===v||"response"===v);if(d&&(m||h&&_)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=f[t]});const t=et.toFiniteNumber(f.headers.get("content-length")),[n,s]=m&&Mt(t,Ft(Ut(m),!0))||[];f=new r(Jt(f.body,65536,n,()=>{s&&s(),_&&_()}),e)}v=v||"text";let P=await p[et.findKey(p,v)||"text"](f,e);return!h&&_&&_(),await new Promise((t,n)=>{Lt(t,n,{data:P,headers:At.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:O})})}catch(t){if(_&&_(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new nt("Network Error",nt.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t});throw nt.from(t,t&&t.code,e,O,t&&t.response)}}},nn=new Map,rn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=nn;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:tn(t)),l=a;return a},sn=(rn(),{http:null,xhr:zt,fetch:{get:rn}});et.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const on=e=>`- ${e}`,an=e=>et.isFunction(e)||null===e||!1===e,cn=function(e,t){e=et.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!an(r)&&(s=sn[(n=String(r)).toLowerCase()],void 0===s))throw new nt(`Unknown adapter '${n}'`);if(s&&(et.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(on).join("\n"):" "+on(e[0]):"as no adapter specified";throw new nt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return s};function ln(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new It(null,e)}function un(e){return ln(e),e.headers=At.from(e.headers),e.data=Rt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),cn(e.adapter||St.adapter,e)(e).then(function(t){return ln(e),t.data=Rt.call(e,e.transformResponse,t),t.headers=At.from(t.headers),t},function(t){return Tt(t)||(ln(e),t&&t.response&&(t.response.data=Rt.call(e,e.transformResponse,t.response),t.response.headers=At.from(t.response.headers))),Promise.reject(t)})}const dn="1.13.5",pn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const fn={};pn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+dn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new nt(r(s," has been removed"+(t?" in "+t:"")),nt.ERR_DEPRECATED);return t&&!fn[s]&&(fn[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},pn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const hn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new nt("option "+o+" must be "+n,nt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new nt("Unknown option "+o,nt.ERR_BAD_OPTION)}},validators:pn},mn=hn.validators;class bn{constructor(e){this.defaults=e||{},this.interceptors={request:new ht,response:new ht}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ht(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&hn.assertOptions(n,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean)},!1),null!=r&&(et.isFunction(r)?t.paramsSerializer={serialize:r}:hn.assertOptions(r,{encode:mn.function,serialize:mn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),hn.assertOptions(t,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&et.merge(s.common,s[t.method]);s&&et.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=At.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||mt;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[un.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let p=t;for(;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=un.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ft(qt((e=Ht(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}et.forEach(["delete","get","head","options"],function(e){bn.prototype[e]=function(t,n){return this.request(Ht(n||{},{method:e,url:t,data:(n||{}).data}))}}),et.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ht(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}bn.prototype[e]=t(),bn.prototype[e+"Form"]=t(!0)});const vn=bn;class gn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new It(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gn(function(t){e=t}),cancel:e}}}const yn=gn,jn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(jn).forEach(([e,t])=>{jn[t]=e});const wn=jn,xn=function e(t){const n=new vn(t),r=ue(vn.prototype.request,n);return et.extend(r,vn.prototype,n,{allOwnKeys:!0}),et.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Ht(t,n))},r}(St);xn.Axios=vn,xn.CanceledError=It,xn.CancelToken=yn,xn.isCancel=Tt,xn.VERSION=dn,xn.toFormData=at,xn.AxiosError=nt,xn.Cancel=xn.CanceledError,xn.all=function(e){return Promise.all(e)},xn.spread=function(e){return function(t){return e.apply(null,t)}},xn.isAxiosError=function(e){return et.isObject(e)&&!0===e.isAxiosError},xn.mergeConfig=Ht,xn.AxiosHeaders=At,xn.formToJSON=e=>Ot(et.isHTMLForm(e)?new FormData(e):e),xn.getAdapter=cn,xn.HttpStatusCode=wn,xn.default=xn;const On=xn,_n=window.ReactDOM;var Sn,Pn,Nn,En,Cn,kn,Dn,An,Rn=function(e){var t=(0,o.createContext)(void 0);return[t,function(){var n=(0,o.useContext)(t);if(void 0===n)throw Error("".concat(e," can only be used within a corresponding context provider."));return n}]},Tn=function(e,t){return t.includes(e.charAt(e.length-1))?e.slice(0,-1):e},In=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return e.length>t?"".concat(e.slice(0,t)).concat((0,i._x)("…","truncated text","code-snippets")):e},Ln=function(e){var t,n=(new DOMParser).parseFromString(e,"text/html");return n.body.querySelectorAll("script,style").forEach(function(e){return e.remove()}),n.body.querySelectorAll("p,div,li,br,h1,h2,h3,h4,h5,h6,tr,td,th,ul,ol,blockquote,table,pre,hr,dl,dt,dd,section,article,header,footer,figure,figcaption,address,aside,nav,main,fieldset,form,details,summary,dialog,hgroup,caption").forEach(function(e){return e.after(n.createTextNode(" "))}),(null!==(t=n.body.textContent)&&void 0!==t?t:"").replace(/\s+/g," ").trim()},Fn=function(e){return Tn(null!=e?e:"","/")},Mn={snippets:Fn(null===(Sn=window.CODE_SNIPPETS)||void 0===Sn?void 0:Sn.restAPI.snippets),recentlyActive:Fn(null===(Pn=window.CODE_SNIPPETS)||void 0===Pn?void 0:Pn.restAPI.recentlyActive),preferences:Fn(null===(Nn=window.CODE_SNIPPETS)||void 0===Nn?void 0:Nn.restAPI.preferences),importPlugins:Fn(null===(En=window.CODE_SNIPPETS)||void 0===En?void 0:En.restAPI.importPlugins),importFiles:Fn(null===(Cn=window.CODE_SNIPPETS)||void 0===Cn?void 0:Cn.restAPI.importFiles),cloud:{snippets:Fn(null===(kn=window.CODE_SNIPPETS)||void 0===kn?void 0:kn.restAPI.cloud.snippets)}},Un=["delete","put","patch"],Bn=function(e){var t,n=null===(t=e.method)||void 0===t?void 0:t.toLowerCase();return n&&Un.includes(n)?(e.headers.set("X-HTTP-Method-Override",n.toUpperCase()),e.method="post",e):e},Vn={headers:{"X-WP-Nonce":null===(Dn=window.CODE_SNIPPETS)||void 0===Dn?void 0:Dn.restAPI.nonce,"Access-Control":null===(An=window.CODE_SNIPPETS)||void 0===An?void 0:An.restAPI.cloud.token}},qn=function(){var e=ae(le().mark(function e(t,n,r,s){var o,i,a;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(o=window.CODE_SNIPPETS)||void 0===o||!o.debug){e.next=9;break}return(i=console).debug.apply(i,["".concat(t," ").concat(n)].concat(oe(s?[s]:[]))),e.next=4,r;case 4:return a=e.sent,console.debug("Response",a),e.abrupt("return",a);case 9:return e.next=11,r;case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}));return function(t,n,r,s){return e.apply(this,arguments)}}(),Wn=s(Rn("useRestAPI"),2),Hn=Wn[0],Kn=Wn[1],zn=function(e){var t=e.children,n=(0,o.useMemo)(function(){var e=On.create(Vn);return e.interceptors.request.use(Bn),e},[]),r=(0,o.useMemo)(function(){return function(e){return{getResponse:function(t){return qn("GET",t,e.get(t))},get:function(t){return qn("GET",t,e.get(t)).then(function(e){return e.data})},post:function(t,n,r){return qn("POST",t,e.post(t,n,r),n).then(function(e){return e.data})},del:function(t){return qn("DELETE",t,e.delete(t)).then(function(e){return e.data})},put:function(t,n){return qn("PUT",t,e.put(t,n),n).then(function(e){return e.data})}}}(n)},[n]),s={api:r,axiosInstance:n};return(0,g.jsx)(Hn.Provider,{value:s,children:t})},Gn=function(e){console.error(e)},$n=function(){var e=Kn().api,t=(0,o.useState)(function(){var e,t;return null!==(e=null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.snippetView)&&void 0!==e?e:"table"}),n=s(t,2),r=n[0],i=n[1];return{snippetView:r,setSnippetView:(0,o.useCallback)(function(t){i(t),e.post("".concat(Mn.preferences,"/snippet-view"),{view:t}).catch(Gn)},[e])}},Jn="snippets-screen-meta-slot",Qn=function(e){var t=e.hidden,n=void 0!==t&&t;return(0,o.useEffect)(function(){var e=document.getElementById(Jn),t=document.getElementById("screen-meta"),n=document.getElementById("screen-meta-links");if(e&&t&&n){var r=t.parentElement;return e.append(t,n),function(){null==r||r.prepend(t,n)}}},[]),(0,g.jsx)("div",{id:Jn,className:"snippets-screen-meta-slot",hidden:n})};function Xn(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 Yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xn(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Zn=function(){var e=(0,o.useRef)(null),t=s((0,o.useState)({atStart:!0,atEnd:!0}),2),n=t[0],r=t[1],i=(0,o.useCallback)(function(){var t=e.current;if(t){var n=t.scrollWidth-t.clientWidth>1,s=!n||t.scrollLeft<=1,o=!n||t.scrollLeft+t.clientWidth>=t.scrollWidth-1;r(function(e){return e.atStart===s&&e.atEnd===o?e:{atStart:s,atEnd:o}})}},[]);return(0,o.useEffect)(function(){var t,n=e.current;if(n){i(),n.addEventListener("scroll",i,{passive:!0});var r=new ResizeObserver(i);return r.observe(n),r.observe(null!==(t=n.firstElementChild)&&void 0!==t?t:n),function(){n.removeEventListener("scroll",i),r.disconnect()}}},[i]),Yn(Yn({},n),{},{scrollRef:e})};function er(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 tr=function(e){var t=e.tabs,n=e.ariaLabel,r=e.className,s=e.currentTab,o=e.getTabCount,a=e.setCurrentTab,c=e.queryParamName,l=Zn(),u=l.atStart,p=l.atEnd,f=l.scrollRef;return(0,g.jsx)("div",{className:v()("snippet-type-nav-wrapper",{"has-scroll-start":!u,"has-scroll-end":!p}),children:(0,g.jsx)("nav",{ref:f,className:v()("snippet-type-nav",r),"aria-label":n,children:(0,g.jsx)("ul",{children:t.map(function(e){var t=null==o?void 0:o(e);return(0,g.jsx)("li",{children:(0,g.jsxs)("button",{type:"button",className:v()("snippet-type-link","".concat(e.name,"-subnav-link"),{"active-type":e.name===s.name}),"aria-current":e.name===s.name?"page":void 0,onClick:function(){a(e),c&&d(h({},c,e.name))},children:[(0,g.jsx)("span",{children:e.label}),t&&(0,g.jsx)("span",{className:"subnav-count",children:t}),e.pro&&!N()&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})},e.name)})})})})};function nr(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 rr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var sr,or,ir,ar,cr=s(Rn("useCloudSnippetDownloads"),2),lr=cr[0],ur=cr[1],dr=function(e){var t=e.children,n=s((0,o.useState)({}),2),r=n[0],i=n[1],a=(0,o.useCallback)(function(e,t){return i(function(n){return rr(rr({},n),{},h({},e,rr(rr({isDownloading:!1},n[e]),t)))})},[]);return(0,g.jsx)(lr.Provider,{value:{downloadRecords:r,updateDownloadRecord:a},children:t})};function pr(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 fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var hr=Math.min(null!==(sr=null!==(or=null===(ir=window.CODE_SNIPPETS_MANAGE)||void 0===ir?void 0:ir.cloudSearchPerPage)&&void 0!==or?or:null===(ar=window.CODE_SNIPPETS_MANAGE)||void 0===ar?void 0:ar.snippetsPerPage)&&void 0!==sr?sr:10,100),mr={SEARCH_QUERY:Mn.cloud.snippets,FEATURED:"".concat(Mn.cloud.snippets,"/featured")},br="paged",vr="type",gr="status",yr="category",jr=function(){var e,t,n,r,s,o=Number(null!==(e=u(br))&&void 0!==e?e:1),i=null!==(t=u("s"))&&void 0!==t?t:"",a=null!==(n=u(vr))&&void 0!==n?n:"",c=null!==(r=u(gr))&&void 0!==r?r:0,l=u("by"),d=null!==(s=u(yr))&&void 0!==s?s:"";return{page:isNaN(o)?1:o,type:a,query:i,status:Number(c),method:"codevault"===l?"codevault":"term",category:d}},wr=function(e){return"object"===c(e)&&null!==e&&"id"in e&&"number"==typeof e.id&&"name"in e&&"string"==typeof e.name},xr=function(e){return Array.isArray(e)?e.filter(wr):void 0},Or=s(Rn("useCloudSearch"),2),_r=Or[0],Sr=Or[1],Pr=function(e){var t=e.children,n=function(){var e=Kn().api,t=function(){var e=(0,o.useRef)(0),t=(0,o.useCallback)(function(){return e.current+=1,e.current},[]);return{isCurrentRequest:(0,o.useCallback)(function(t){return t===e.current},[]),nextRequestId:t}}(),n=t.isCurrentRequest,r=t.nextRequestId,i=s((0,o.useState)(!1),2),a=i[0],l=i[1],u=s((0,o.useState)(!1),2),d=u[0],p=u[1],h=s((0,o.useState)(),2),m=h[0],b=h[1],v=s((0,o.useState)({}),2),g=v[0],y=v[1];return{isLoading:d,isSearching:a,searchResults:m,availableFilters:g,makeSearchRequest:(0,o.useCallback)(function(t){var s=r(),o=""===t.query.trim();p(!0),l(!o);var i=o?mr.FEATURED:mr.SEARCH_QUERY;e.getResponse(function(e,t){var n=t.query,r=t.type,s=t.method,o=t.status,i=t.category,a=t.page;return f(e,{query:n,searchByCodevault:"codevault"===s||void 0,per_page:hr,type:r||void 0,category:i||void 0,status:o||void 0,page:a})}(i,t)).then(function(e){n(s)&&(b(function(e,t){var n=e.data;return{page:n.page,isFeatured:t===mr.FEATURED,snippets:n.snippets,totalItems:n.total_snippets,totalPages:n.total_pages}}(e,i)),y(function(t){var n,r;return null!==(n="object"===c(r=e.data.available_filters)&&r?fr(fr(fr({},"types"in r&&{types:xr(r.types)}),"statuses"in r&&{statuses:xr(r.statuses)}),"categories"in r&&{categories:xr(r.categories)}):void 0)&&void 0!==n?n:t}))}).catch(function(){n(s)&&b(!1)}).finally(function(){n(s)&&(l(!1),p(!1))})},[e,r,n])}}(),r=n.isLoading,i=n.isSearching,a=n.makeSearchRequest,l=n.availableFilters,u=n.searchResults,p=s((0,o.useState)(jr),2),m=p[0],b=p[1],v=s((0,o.useState)(!1),2),y=v[0],j=v[1],w=(0,o.useCallback)(function(e){return b(function(t){return fr(fr({},t),e)})},[]),x=(0,o.useCallback)(function(e){var t=function(e,t){var n=e.query.trim()!==t.query.trim(),r=e.method!==t.method,s=e.type!==t.type,o=e.status!==t.status,i=e.category!==t.category,a=s||o||i;return n||r?fr(fr({},e),{},{page:1,type:"",status:0,category:""}):a?fr(fr({},e),{},{page:1}):e}(fr(fr({},m),e),m);!function(e){d(h(h(h(h(h(h({},br,e.page),vr,e.type||void 0),"s",e.query||void 0),gr,e.status||void 0),"by","codevault"===e.method?"codevault":void 0),yr,e.category||void 0))}(t),b(t),a(t)},[a,m]);(0,o.useEffect)(function(){y||(j(!0),a(m))},[a,m,y]);var O=fr({doSearch:x,isLoading:r,isSearching:i,searchParams:m,availableFilters:l,updateSearchParams:w},!1===u?{isErrored:!0,searchResults:void 0}:{isErrored:!1,searchResults:u});return(0,g.jsx)(_r.Provider,{value:O,children:t})},Nr=["php","html","css","js","cond"],Er={php:["global","admin","front-end","single-use"],html:["content","head-content","body-content","footer-content"],css:["admin-css","site-css"],js:["site-head-js","site-footer-js"],cond:["condition"]};function Cr(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 kr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Dr={id:0,name:"",code:"",desc:"",scope:"global",modified:"",active:!1,locked:!1,trashed:!1,network:P(),shared_network:null,priority:10,conditionId:0,code_error:null,code_error_trace:null},Ar=function(e){return"number"==typeof e&&0<e},Rr=function(e){var t,n,r,s=kr(kr({},Dr),{},{tags:[]});return"object"!==c(e)||null===e?s:kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr(kr({},s),"id"in e&&Ar(e.id)&&{id:e.id}),"name"in e&&"string"==typeof e.name&&{name:e.name}),"desc"in e&&"string"==typeof e.desc&&{desc:e.desc}),"code"in e&&"string"==typeof e.code&&{code:e.code}),"tags"in e&&{tags:null!==(r=e.tags,t=Array.isArray(r)?r.filter(function(e){return"string"==typeof e}):void 0)&&void 0!==t?t:s.tags}),"scope"in e&&"string"==typeof(n=e.scope)&&Object.values(Er).some(function(e){return e.some(function(e){return e===n})})&&{scope:e.scope}),"modified"in e&&"string"==typeof e.modified&&{modified:e.modified}),"active"in e&&"boolean"==typeof e.active&&{active:e.active}),"locked"in e&&"boolean"==typeof e.locked&&{locked:e.locked}),"trashed"in e&&"boolean"==typeof e.trashed&&{trashed:e.trashed}),"network"in e&&"boolean"==typeof e.network&&{network:e.network}),"shared_network"in e&&"boolean"==typeof e.shared_network&&{shared_network:e.shared_network}),"priority"in e&&"number"==typeof e.priority&&{priority:e.priority}),"conditionId"in e&&Ar(e.conditionId)&&{conditionId:e.conditionId}),"condition_id"in e&&Ar(e.condition_id)&&{conditionId:e.condition_id}),"code_error"in e&&function(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"number"==typeof e[1]}(e.code_error)&&{code_error:e.code_error}),"code_error_trace"in e&&("string"==typeof e.code_error_trace||null===e.code_error_trace)&&{code_error_trace:e.code_error_trace}),"last_active"in e&&{lastActive:Number(e.last_active)})};function Tr(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 Ir(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Lr=new Set(["css","js","cond"]),Fr={php:(0,i.__)("Functions","code-snippets"),html:(0,i.__)("Content","code-snippets"),css:(0,i.__)("Styles","code-snippets"),js:(0,i.__)("Scripts","code-snippets"),cond:(0,i.__)("Conditions","code-snippets")},Mr=function(e){return Rr(e)},Ur=function(e){return Mr(Ir(Ir({},e),{},{id:0,active:!1,name:(0,i.sprintf)((0,i.__)("%s [CLONE]","code-snippets"),e.name)}))},Br=function(e){var t=e.scope;switch(!0){case t.endsWith("-css"):return"css";case t.endsWith("-js"):return"js";case t.endsWith("content"):return"html";case"condition"===t:return"cond";default:return"php"}},Vr=function(e){var t,n;return null!=e&&e.id?f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.edit,{id:e.id}):null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew},qr=function(e){var t,n;return!e||!N()&&zr(e)?null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew:f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.addNew,{type:e})},Wr=function(e){return""===e.name.trim()?(0,i.sprintf)(Hr(e)?(0,i.__)("Condition #%d","code-snippets"):(0,i.__)("Snippet #%d","code-snippets"),e.id):e.name},Hr=function(e){return"condition"===e.scope},Kr=function(e){return Lr.has(Br(e))},zr=function(e){return Lr.has(e)},Gr=function(e,t){var n,r;return"cond"===Br(e)?0<(null!==(n=null===(r=t.get(e.id))||void 0===r?void 0:r.length)&&void 0!==n?n:0):e.active},$r=function(e){return!P()&&e.network&&!e.shared_network},Jr=function(e){var t;return!($r(e)||e.shared_network&&(null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||!t.hasNetworkCap))},Qr=function(e){return!e.local_id&&(!Kr(e)||N())},Xr=["id","text","name","primary","secondary","small","large","wrap","className"];function Yr(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}var Zr=function(e){var t=e.id,n=e.text,r=e.name,s=void 0===r?"submit":r,o=e.primary,a=e.secondary,c=e.small,l=e.large,u=e.wrap,d=e.className,p=m(e,Xr),f=(0,g.jsx)("input",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:null!=t?t:s,type:"submit",name:s,value:null!=n?n:(0,i.__)("Save Changes","code-snippets"),className:v()("button",{"button-primary":o,"button-secondary":a,"button-small":c,"button-large":l},d)},p));return u?(0,g.jsx)("p",{className:"submit",children:f}):f},es=["id","children","className","name","primary","secondary","small","large","link","type","onClick"];function ts(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 ns(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ts(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ts(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var rs=function(e){var t=e.id,n=e.children,r=e.className,s=e.name,o=e.primary,i=void 0!==o&&o,a=e.secondary,c=void 0!==a&&a,l=e.small,u=void 0!==l&&l,d=e.large,p=void 0!==d&&d,f=e.link,h=void 0!==f&&f,b=e.type,y=void 0===b?"button":b,j=e.onClick,w=m(e,es);return(0,g.jsx)("button",ns(ns({id:null!=t?t:s,name:s,type:y},w),{},{onClick:function(e){j&&(e.preventDefault(),j(e))},className:v()("button",r,{"button-primary":i,"button-secondary":c,"button-large":p,"button-small":u,"button-link":h}),children:n}))},ss=["currentPage"],os=["currentPage","totalPages"],is=["which","totalPages","currentPage"];function as(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 cs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?as(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):as(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ls=function(e){var t=e.icon,n=e.newPage,r=e.disabled,s=e.className,o=e.helperText,i=e.setCurrentPage,a=e.pageSearchParam;return a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("a",{className:"".concat(s," button"),href:f(window.location.href,h({},a,1===n?void 0:n)),onClick:function(e){e.preventDefault(),i(n)},children:[(0,g.jsx)("span",{className:"screen-reader-text",children:o}),(0,g.jsx)("span",{"aria-hidden":!0,children:t})]}),"\n"]}):(0,g.jsxs)(rs,{className:s,onClick:function(){return i(n)},disabled:r,children:[(0,g.jsx)("span",{className:"screen-reader-text",children:o}),(0,g.jsx)("span",{"aria-hidden":!0,children:t})]})},us=function(e){var t=e.currentPage,n=m(e,ss);return 1===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"«"}),"\n",(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"‹"}),"\n"]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ls,cs({icon:(0,g.jsx)(g.Fragment,{children:"«"}),newPage:1,className:"first-page",helperText:(0,i.__)("First page","code-snippets")},n)),"\n",(0,g.jsx)(ls,cs({icon:(0,g.jsx)(g.Fragment,{children:"‹"}),newPage:Math.max(1,t-1),className:"prev-page",helperText:(0,i.__)("Previous page","code-snippets")},n)),"\n"]})},ds=function(e){var t=e.currentPage,n=e.totalPages,r=m(e,os);return n===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"›"}),"\n",(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"»"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ls,cs({icon:(0,g.jsx)(g.Fragment,{children:"›"}),newPage:Math.min(n,t+1),className:"next-page",helperText:(0,i.__)("Next page","code-snippets")},r)),"\n",(0,g.jsx)(ls,cs({icon:(0,g.jsx)(g.Fragment,{children:"»"}),newPage:n,className:"last-page",helperText:(0,i.__)("Last page","code-snippets")},r)),"\n"]})},ps=function(e){var t=e.which,n=e.disabled,r=e.inputName,s=e.inputValue,o=e.totalPages,a=e.setInputValue,c=e.confirmInputValue;return(0,g.jsx)("input",{className:"current-page",id:"current-page-selector-".concat(t),"aria-label":(0,i.__)("Current Page","code-snippets"),type:"text",name:r,value:s,size:o.toString().length,disabled:n,"aria-describedby":"table-paging-".concat(t),onBlur:c,onChange:function(e){var t=Number(e.target.value);t&&a(t)}})},fs=function(e){var t=e.which,n=e.totalPages,r=e.currentPage,s=m(e,is);return"bottom"===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Current Page","code-snippets")}),(0,g.jsx)("span",{className:"paging-input",children:(0,g.jsx)("span",{className:"tablenav-paging-text",children:(0,i.sprintf)((0,i._x)("%1$s of %2$s","paging","code-snippets"),r,n)})})]}):(0,g.jsxs)("span",{className:"paging-input",id:"table-paging-".concat(t),children:[(0,g.jsx)(ps,cs({which:t,totalPages:n},s)),(0,g.jsxs)("span",{className:"tablenav-paging-text",children:[" ".concat((0,i.__)("of","code-snippets")," "),(0,g.jsx)("span",{className:"total-pages",children:n})]})]})},hs=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.inputValue,o=e.currentPage,i=e.setCurrentPage,a=e.setInputValue,c=e.pageSearchParam;return(0,g.jsxs)("span",{className:"pagination-links",children:[(0,g.jsx)(us,{disabled:n,currentPage:o,setCurrentPage:i,pageSearchParam:c}),(0,g.jsx)(fs,{which:t,disabled:n,totalPages:r,currentPage:o,inputName:c,inputValue:s,setInputValue:a,confirmInputValue:function(){return i(s)}}),"\n",(0,g.jsx)(ds,{disabled:n,totalPages:r,currentPage:o,setCurrentPage:i,pageSearchParam:c})]})},ms=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.totalItems,o=e.inputValue,a=e.currentPage,c=e.pageSearchParam,l=e.setCurrentPage,u=e.setInputValue,d="top"===t?(0,i.__)("Pagination, before the table","code-snippets"):(0,i.__)("Pagination, after the table","code-snippets");return(0,g.jsx)("nav",{className:"tablenav-pages-nav","aria-label":d,children:(0,g.jsxs)("form",{className:v()("tablenav-pages",{"one-page":r&&1===r,"no-pages":!r}),onSubmit:function(e){e.preventDefault(),l(o)},children:[(0,g.jsx)("span",{className:"displaying-num",children:(0,i.sprintf)((0,i._n)("%s item","%s items",s,"code-snippets"),s)}),"\n",(0,g.jsx)(hs,{which:t,disabled:n,totalPages:r,inputValue:o,currentPage:a,pageSearchParam:c,setCurrentPage:l,setInputValue:u})]})})},bs=function(e){var t=e.which,n=e.disabled,r=e.totalItems,i=e.totalPages,a=e.currentPage,c=e.setCurrentPage,l=e.pageSearchParam,u=s((0,o.useState)(a),2),p=u[0],f=u[1];return(0,g.jsx)(ms,{which:t,inputValue:p,currentPage:a,totalItems:r,totalPages:i,disabled:n,setInputValue:f,setCurrentPage:function(e){if(e){var t=Math.max(1,Math.min(e,i));f(t),c(t),l&&d(h({},l,1===t?void 0:t))}}})},vs=["which","actions","doAction","selected","setSelected","totalItems","totalPages","extraTableNav","endTableNav","selectAllKeys"],gs=["children"];function ys(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 js(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ys(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ws(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 xs=function(e){var t=e.actions,n=s((0,o.useMemo)(function(){var e,n=[],r=new Map,s=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ws(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)?ws(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(s.s();!(e=s.n()).done;){var o,i=e.value;void 0===i.group?n.push(i):r.set(i.group,[].concat(oe(null!==(o=r.get(i.group))&&void 0!==o?o:[]),[i]))}}catch(e){s.e(e)}finally{s.f()}return[n,Array.from(r.entries())]},[t]),2),r=n[0],i=n[1];return(0,g.jsxs)(g.Fragment,{children:[r.map(function(e){return(0,g.jsx)("option",{value:e.key,children:e.label},e.key)}),i.map(function(e){var t=s(e,2),n=t[0],r=t[1];return(0,g.jsx)("optgroup",{label:n,children:r.map(function(e){return(0,g.jsx)("option",{value:e.label,children:e.label},e.label)})},n)})]})},Os=function(e){var t=e.which,n=e.actions,r=e.selectedAction,s=e.setSelectedAction,o=e.label;return(0,g.jsxs)("select",{name:"action".concat("bottom"===t?"-2":""),id:"bulk-action-selector-".concat(t),value:r,onChange:function(e){var t=e.target.value;t&&"-1"!==t?function(e,t){return t.some(function(t){return t.key===e})}(t,n)&&s(t):s(void 0)},children:[(0,g.jsx)("option",{value:"-1",children:o}),(0,g.jsx)(xs,{actions:n})]})},_s=function(e){var t=e.which,n=e.actions,r=e.selected,a=e.doAction,c=e.onActionSuccess,l=e.disabled,u=e.selectLabel,d=s((0,o.useState)(),2),p=d[0],f=d[1],h=s((0,o.useState)(!1),2),m=h[0],b=h[1];return(0,g.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,g.jsx)("label",{htmlFor:"bulk-action-selector-".concat(t),className:"screen-reader-text",children:(0,i.__)("Select bulk action","code-snippets")}),(0,g.jsx)(Os,{which:t,actions:n,selectedAction:p,setSelectedAction:f,label:null!=u?u:(0,i.__)("Bulk actions","code-snippets")}),(0,g.jsx)(Zr,{id:"doaction".concat("bottom"===t?"-2":""),name:"bulk_action",text:(0,i.__)("Apply","code-snippets"),className:"action",disabled:!!l||m||!p,onClick:function(e){e.preventDefault(),p&&(b(!0),a(p,r).then(function(){null==c||c()}).catch(Gn).finally(function(){return b(!1)}))}}),m?(0,g.jsx)(H.Spinner,{}):null]})},Ss=function(e){var t=e.keys,n=e.selected,r=e.setSelected;return(0,g.jsxs)("label",{className:"tablenav-select-all",children:[(0,g.jsx)("input",{type:"checkbox",checked:0<t.length&&t.every(function(e){return n.has(e)}),disabled:0===t.length,"aria-label":(0,i.__)("Select all items","code-snippets"),onChange:function(e){var n=e.target.checked;r(function(e){var r=new Set(e);return t.forEach(function(e){return n?r.add(e):r.delete(e)}),r})}}),(0,i.__)("Select all","code-snippets")]})},Ps=function(e){var t=e.which,n=e.actions,r=e.doAction,s=e.selected,o=e.setSelected,i=e.totalItems,a=e.totalPages,c=void 0===a?0:a,l=e.extraTableNav,u=e.endTableNav,d=e.selectAllKeys,p=m(e,vs),f="top"===t,h=0<i&&Boolean(n);return f&&Boolean(null!=l?l:u)||h||0<c?(0,g.jsxs)("div",{className:"tablenav ".concat(t),children:[0<i&&n&&r&&(0,g.jsx)(_s,{which:t,actions:n,doAction:r,disabled:p.disabled,selected:s,onActionSuccess:function(){return o(new Set)}}),f&&d?(0,g.jsx)(Ss,{keys:d,selected:s,setSelected:o}):null,f?null==l?void 0:l(t):null,0<c||f&&u?(0,g.jsxs)("div",{className:"tablenav-end-group",children:[0<c&&(0,g.jsx)(bs,js({},js({totalPages:c,totalItems:i,which:t},p))),f?null==u?void 0:u(t):null]}):null,(0,g.jsx)("br",{className:"clear"})]}):null},Ns=function(e){var t=e.children,n=m(e,gs);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Ps,js({which:"top"},n)),t,(0,g.jsx)(Ps,js({which:"bottom"},n))]})},Es=function(e){var t=e.isLoading,n=e.errorMessage,r=e.loadingNotice,s=e.noticeLabel;switch(!0){case t:return(0,g.jsx)(_,{"aria-label":s,className:"inline",children:(0,g.jsx)("p",{children:r})});case void 0!==n:return(0,g.jsx)(_,{"aria-label":s,className:"inline",type:"error",children:(0,g.jsx)("p",{children:n})});default:return(0,g.jsx)(_,{"aria-label":s,className:"inline",type:"warning",children:(0,g.jsx)("p",{children:(0,i.__)("An unknown error occurred. Please try again.","code-snippets")})})}};function Cs(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 ks(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cs(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ds=function(e){return(0,g.jsxs)("svg",ks(ks({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("rect",{x:"2",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"10.5",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"2",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"10.5",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"})]}))};function As(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 Rs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?As(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):As(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ts=function(e){return(0,g.jsx)("svg",Rs(Rs({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M2.5 4.5H15.5M2.5 9H15.5M2.5 13.5H15.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})}))},Is=function(e){var t=e.snippetView,n=e.setSnippetView,r=e.className;return(0,g.jsxs)("div",{className:v()("snippet-view-toggle",r),role:"group","aria-label":(0,i.__)("Snippet view","code-snippets"),children:[(0,g.jsxs)("button",{type:"button",className:v()("snippet-view-toggle-option",{"active-view":"card"===t}),"aria-pressed":"card"===t,title:(0,i.__)("Switch to card view","code-snippets"),onClick:function(){return n("card")},children:[(0,g.jsx)(Ds,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Card view","code-snippets")})]}),(0,g.jsxs)("button",{type:"button",className:v()("snippet-view-toggle-option",{"active-view":"table"===t}),"aria-pressed":"table"===t,title:(0,i.__)("Switch to table view","code-snippets"),onClick:function(){return n("table")},children:[(0,g.jsx)(Ts,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Table view","code-snippets")})]})]})},Ls={cond:"randomize",cloud:"cloud",bundles:"screenoptions",cloud_search:"search"},Fs=function(e){var t=e.name,n=e.small,r=e.inverted,s=e.children;return(0,g.jsx)("span",{className:v()("badge","".concat(t,"-badge"),{"small-badge":n,"inverted-badge":r}),children:Ls[t]?(0,g.jsx)("span",{className:"dashicons dashicons-".concat(Ls[t]),"aria-hidden":"true"}):null!=s?s:t})},Ms=function(e){var t=e.block,n=e.inline,r=e.start,s=e.end,a=e.icon,c=e.className,l=e.children,u=e.label,d=(0,o.useId)();return(0,g.jsxs)("div",{className:v()("tooltip help-tooltip",{"tooltip-block":t,"tooltip-inline":n,"tooltip-start":r,"tooltip-end":s},c),children:[(0,g.jsx)("button",{type:"button",className:"tooltip-trigger","aria-label":null!=u?u:(0,i.__)("More information","code-snippets"),"aria-describedby":d,children:null!=a?a:(0,g.jsx)("span",{className:"dashicons dashicons-editor-help","aria-hidden":"true"})}),(0,g.jsx)("div",{role:"tooltip",className:"tooltip-content",id:d,children:l})]})},Us=function(e){var t=e.message;return(0,g.jsx)(Ms,{block:!0,end:!0,label:(0,i.__)("Error","code-snippets"),icon:(0,g.jsx)("span",{className:"dashicons dashicons-warning","aria-hidden":"true"}),children:"".concat(Tn(t,".!?"),". ").concat((0,i.__)("Please try again.","code-snippets"))})},Bs=function(e){var t,n,r=e.snippet,a=e.onDownloaded,c=Kn().api,l=ur(),u=l.downloadRecords,d=l.updateDownloadRecord,p=s((0,o.useState)(),2),f=p[0],h=p[1],m=s((0,o.useState)(!1),2),b=m[0],v=m[1],y=null!==(t=u[r.id])&&void 0!==t?t:{},j=y.isDownloading,w=void 0!==j&&j,x=y.localId,O=null!==(n=r.local_id)&&void 0!==n?n:x;return O?(0,g.jsx)("a",{className:"button button-primary",href:Vr({id:O}),target:"_blank",rel:"noopener noreferrer",children:(0,i.__)("Edit","code-snippets")}):Kr(r)&&!N()?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(rs,{className:"cloud-pro-button",onClick:function(){return v(!0)},children:(0,i.__)("Pro Only","code-snippets")}),(0,g.jsx)(K,{isOpen:b,setIsOpen:v})]}):(0,g.jsxs)(g.Fragment,{children:[w&&(0,g.jsx)(H.Spinner,{}),f&&(0,g.jsx)(Us,{message:f}),(0,g.jsx)(rs,{primary:!0,onClick:function(){d(r.id,{isDownloading:!0}),h(void 0),c.post("".concat(Mn.cloud.snippets,"/").concat(r.id,"/download")).then(function(e){d(r.id,{localId:e.snippet_id}),a()}).catch(function(e){h("string"==typeof e?e:(0,i.__)("An error occurred while trying to download the snippet.","code-snippets"))}).finally(function(){return d(r.id,{isDownloading:!1})})},disabled:w,children:(0,i.__)("Download","code-snippets")})]})},Vs=function(e){return e[e.Private=3]="Private",e[e.Public=4]="Public",e[e.Unverified=5]="Unverified",e[e.AI_Verified=6]="AI_Verified",e[e.Pro_Verified=8]="Pro_Verified",e}({}),qs=function(e){switch(e){case Vs.Public:return(0,i.__)("Public","code-snippets");case Vs.Private:return(0,i.__)("Private","code-snippets");case Vs.Unverified:return(0,i.__)("Unverified","code-snippets");case Vs.AI_Verified:return(0,i.__)("AI Verified","code-snippets");case Vs.Pro_Verified:return(0,i.__)("Pro Verified","code-snippets");default:return(0,i.__)("Unknown","code-snippets")}},Ws=h(h(h(h(h({},Vs.Public,"public"),Vs.Private,"private"),Vs.Unverified,"failure"),Vs.AI_Verified,"info"),Vs.Pro_Verified,"success"),Hs=function(e){var t;return null===(t=Vs[e])||void 0===t?void 0:t.toLowerCase().replace("_","-")},Ks=function(e){var t,n=e.status;return(0,g.jsx)("span",{className:"cloud-snippet-status cloud-snippet-status-".concat(null!==(t=Hs(n))&&void 0!==t?t:"unknown"),children:qs(n)})},zs=function(e){var t,n=e.status;return(0,g.jsx)("span",{className:"badge ".concat(null!==(t=Ws[n])&&void 0!==t?t:"neutral","-badge"),children:qs(n)})},Gs=function(e,t){var n=e.id,r=e.network;return f([Mn.snippets,n,t].filter(Boolean).join("/"),{network:r})},$s=function(e){return{name:e.name,desc:e.desc,code:e.code,tags:e.tags,scope:e.scope,priority:e.priority,active:e.active,network:e.network,locked:e.locked,trashed:e.trashed,shared_network:e.shared_network,condition_id:e.conditionId}},Js=s(Rn("useSnippetsAPI"),2),Qs=Js[0],Xs=Js[1],Ys=function(e){var t=e.children,n=Kn().api,r=(0,o.useMemo)(function(){return t=(e=n).get,r=e.post,s=e.del,o=e.put,{fetchAll:function(e){return t(f(Mn.snippets,{network:e})).then(function(e){return e.map(Mr)})},fetch:function(e,n){return t(f("".concat(Mn.snippets,"/").concat(e),{network:n})).then(Mr)},create:function(e){return r(Mn.snippets,$s(e)).then(Mr)},update:function(e){return r(e.id?Gs(e):Mn.snippets,$s(e)).then(Mr)},delete:function(e){return s(Gs(e))},restore:function(e){return r(Gs(e,"restore"))},activate:function(e){return r(Gs(e,"activate")).then(Mr)},deactivate:function(e){return r(Gs(e,"deactivate")).then(Mr)},export:function(e){return t(Gs(e,"export"))},exportCode:function(e){return t(Gs(e,"export-code"))},attach:function(e){return o(Gs(e,"attach"),{condition_id:e.conditionId})},detach:function(e){return o(Gs(e,"detach"))}};var e,t,r,s,o},[n]);return(0,g.jsx)(Qs.Provider,{value:r,children:t})},Zs=s(Rn("useSnippetsList"),2),eo=Zs[0],to=Zs[1],no=function(e){var t=e.children,n=Xs().fetchAll,r=(0,o.useState)(function(){var e;return null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e||null===(e=e.snippetsList)||void 0===e?void 0:e.map(Rr)}),i=s(r,2),a=i[0],c=i[1],l=(0,o.useCallback)(ae(le().mark(function e(){var t;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.info("Fetching snippets list"),e.next=4,n(P());case 4:t=e.sent,c(t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.error("Error fetching snippets list",e.t0);case 11:case"end":return e.stop()}},e,null,[[0,8]])})),[n]);(0,o.useEffect)(function(){l().catch(function(){})},[l]);var u={snippetsList:a,refreshSnippetsList:l};return(0,g.jsx)(eo.Provider,{value:u,children:t})},ro={php:["php","text/php"],html:["php","text/php"],css:["css","text/css"],js:["js","text/javascript"],cond:["json","application/json"],json:["json","application/json"]},so=function(e,t,n){var r=document.createElement("a");r.download=t,r.href=URL.createObjectURL(new Blob([e],{type:n})),setTimeout(function(){return URL.revokeObjectURL(r.href)},4e4),r.style.display="none",document.body.appendChild(r),setTimeout(function(){r.click(),r.remove()},0)},oo=function(e,t,n){var r=t.id,o=t.name,i=t.scope,a=o.toLowerCase().replace(/[^\w-]+/g,"-").trim(),c=""===a?"snippet-".concat(r):a;if("string"==typeof e){var l=s(ro[null!=n?n:Br({scope:i})],2),u=l[0],d=l[1],p="".concat(c,".code-snippets.").concat(u);so(e,p,d)}else{var f="".concat(c,".code-snippets.json");so(JSON.stringify(e,void 0,2),f,"application/json")}},io=function(e){return null==e},ao={id:function(e){return 0===e},desc:function(e){return""===e},name:function(e){return""===e},code:function(e){return""===e},tags:function(e){return Array.isArray(e)&&0===e.length},scope:function(e){return"global"===e},condition_id:function(e){return 0===e},active:function(e){return!1===e},locked:function(e){return!1===e},trashed:function(e){return!1===e},priority:function(e){return 10===e},modified:function(e){return""===e||io(e)},last_active:function(e){return 0===e||io(e)},network:function(e){return null===e||!1===e},shared_network:function(e){return null===e||!1===e},code_error:function(e){return null===e||!1===e},code_error_trace:function(e){return null===e||!1===e}},co=function(e){var t=e.id,n=e.name,r=e.desc,o=e.code,i=e.tags,a=e.scope,c=e.active,l=e.locked,u=e.trashed,d=e.network,p=e.shared_network,f=e.modified,h=e.priority,m=e.conditionId,b=e.lastActive,v=e.code_error,g=e.code_error_trace;return Object.fromEntries(Object.entries({id:t,name:n,desc:r,code:o,tags:i,scope:a,active:c,locked:l,trashed:u,network:d,shared_network:p,modified:f,priority:h,condition_id:m,last_active:b,code_error:v,code_error_trace:g}).filter(function(e){var t,n,r,o=s(e,2);return t=o[0],n=o[1],!(null!==(r=ao[t])&&void 0!==r?r:io)(n)}))},lo=function(e){if(0!==e.length){var t={generator:"Code Snippets",date_created:(new Date).toISOString().slice(0,16).replace("T"," "),snippets:e.map(co)};so(JSON.stringify(t,void 0,2),"".concat("snippets",".code-snippets.json"),"application/json")}},uo=function(e){var t=e.open,n=e.title,r=e.onConfirm,s=e.onCancel,o=e.children,a=e.confirmLabel,c=void 0===a?(0,i.__)("OK","code-snippets"):a,l=e.cancelLabel,u=void 0===l?(0,i.__)("Cancel","code-snippets"):l,d=e.confirmButtonClassName;return t?(0,g.jsxs)(H.Modal,{title:n,onRequestClose:s,closeButtonLabel:(0,i.__)("Close dialog","code-snippets"),isDismissible:!0,children:[o,(0,g.jsxs)(H.Flex,{direction:"row",justify:"flex-end",children:[(0,g.jsx)(H.Button,{variant:"tertiary",onClick:s,children:u}),(0,g.jsx)(H.Button,{variant:"primary",onClick:r,className:d,children:c})]})]}):null},po=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{style:{marginBlockStart:0},children:(0,a.createInterpolateElement)((0,i.__)("This snippet is currently <strong>active</strong>.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("p",{children:(0,i.__)("Moving it to the trash will also deactivate it.","code-snippets")})]})},fo=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{style:{marginBlockStart:0},children:(0,a.createInterpolateElement)((0,i.__)("The snippet will be <strong>permanently deleted</strong>.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("p",{children:(0,i.__)("This action cannot be undone.","code-snippets")})]})},ho=function(e){var t=e.snippet,n=e.isDialogOpen,r=e.setIsDialogOpen,s=e.makeDeleteRequest;return(0,g.jsx)(uo,{open:n,title:(0,i.__)("Are you sure?","code-snippets"),confirmLabel:t.trashed?(0,i.__)("Delete","code-snippets"):(0,i.__)("Trash","code-snippets"),confirmButtonClassName:"is-destructive",onCancel:function(){return r(!1)},onConfirm:function(){r(!1),s()},children:t.trashed?(0,g.jsx)(fo,{}):(0,g.jsx)(po,{})})},mo=function(e){var t=e.snippet,n=e.setIsWorking,r=e.onSuccess,i=e.onError,a=Xs(),c=s((0,o.useState)(!1),2),l=c[0],u=c[1],d=function(){var e=ae(le().mark(function e(){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null==n||n(!0),e.prev=1,e.next=4,a.delete(t);case 4:return e.next=6,null==r?void 0:r();case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),null==i||i(e.t0);case 11:return e.prev=11,null==n||n(!1),e.finish(11);case 14:case"end":return e.stop()}},e,null,[[1,8,11,14]])}));return function(){return e.apply(this,arguments)}}(),p=function(){var e=ae(le().mark(function e(){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.active&&!t.trashed){e.next=4;break}u(!0),e.next=6;break;case 4:return e.next=6,d();case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();return{requestDelete:p,deleteDialogProps:{snippet:t,isDialogOpen:l,setIsDialogOpen:u,makeDeleteRequest:d}}};function bo(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 vo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bo(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var go={css:"text/css",js:"javascript",php:"text/x-php",html:"application/x-httpd-php"},yo=function(){return window.isSecureContext?navigator.clipboard:void 0},jo=function(e){var t,n,r;return{extraKeys:{Tab:!1,"Shift-Tab":!1},readOnly:!0,lineNumbers:!0,theme:null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.editorTheme)&&void 0!==t?t:"default",mode:null!==(r=go[e])&&void 0!==r?r:go.php,screenReaderLabel:(0,i.__)("Snippet code preview","code-snippets")}},wo=function(e){return e[e.Ready=0]="Ready",e[e.Copied=1]="Copied",e[e.Failed=2]="Failed",e}(wo||{}),xo=function(e){var t=e.code,n=s((0,o.useState)(wo.Ready),2),r=n[0],a=n[1];return(0,g.jsx)(rs,{secondary:!0,onClick:function(){var e=yo();e?e.writeText(t).then(function(){return a(wo.Copied)}).catch(function(){return a(wo.Failed)}):a(wo.Failed)},children:function(){switch(r){case wo.Copied:return(0,i.__)("Copied","code-snippets");case wo.Failed:return(0,i.__)("Copy unavailable","code-snippets");case wo.Ready:return(0,i.__)("Copy code","code-snippets")}}()})},Oo=function(e){var t=e.onRequestClose,n=e.title,r=e.type,s=e.code,a=e.children,c=(0,o.useRef)(null);return(0,o.useEffect)(function(){if(c.current&&window.wp.codeEditor){var e=window.wp.codeEditor.initialize(c.current,{codemirror:jo(r)});return e.codemirror.getInputField().setAttribute("aria-label",(0,i.__)("Snippet code preview","code-snippets")),function(){e.codemirror.toTextArea()}}},[r]),(0,g.jsxs)(H.Modal,{className:"code-snippets-preview-modal",onRequestClose:t,title:n,headerActions:(0,g.jsx)("div",{className:"code-snippets-preview-modal__badge",children:(0,g.jsx)(Fs,{name:r})}),children:[(0,g.jsx)("div",{className:"code-snippets-preview-modal__editor",children:(0,g.jsx)("textarea",{ref:c,readOnly:!0,"aria-label":(0,i.__)("Snippet code preview","code-snippets"),defaultValue:"".concat("php"===r?"<?php\n\n":"").concat(s)})}),a]})},_o=function(e){var t=e.snippet,n=e.setIsOpen,r=e.onDownloaded;return(0,g.jsx)(Oo,{code:t.code,type:Br(t),title:t.name,onRequestClose:function(){return n(!1)},children:(0,g.jsx)("div",{className:"code-snippets-preview-modal__footer",children:(0,g.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,g.jsx)(Bs,{snippet:t,onDownloaded:r}),yo()&&(0,g.jsx)(xo,{code:t.code})]})})})},So=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=e.setIsOpen,o=Xs(),a=to().refreshSnippetsList;return(0,g.jsx)(rs,{secondary:!0,disabled:n,onClick:function(){r(!0),o.create(Ur(t)).then(a).then(function(){return s(!1)}).catch(Gn).finally(function(){return r(!1)})},children:(0,i.__)("Clone","code-snippets")})},Po=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=Xs();return(0,g.jsx)(rs,{secondary:!0,disabled:n,onClick:function(){r(!0),s.export(t).then(function(e){return oo(e,t)}).catch(Gn).finally(function(){return r(!1)})},children:(0,i.__)("Export","code-snippets")})},No=function(e){var t=e.snippet,n=e.setIsOpen,r=to().refreshSnippetsList,a=function(){var e=s((0,o.useState)(!1),2),t=e[0],n=e[1],r=(0,o.useRef)(!1);return{isWorking:t,setIsWorking:function(e){r.current=e,n(e)}}}(),c=a.isWorking,l=a.setIsWorking,u=mo({snippet:t,setIsWorking:l,onSuccess:function(){return n(!1),r()},onError:Gn}),d=u.requestDelete,p=u.deleteDialogProps,f=Jr(t);return(0,g.jsx)(Oo,{code:t.code,type:Br(t),title:Wr(t),onRequestClose:function(){return n(!1)},children:(0,g.jsxs)("div",{className:"code-snippets-preview-modal__footer",children:[(0,g.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,g.jsx)("a",{className:"button button-primary",href:Vr(t),children:t.locked||!f?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}),f&&(0,g.jsx)(So,{snippet:t,isWorking:c,setIsWorking:l,setIsOpen:n}),(0,g.jsx)(Po,{snippet:t,isWorking:c,setIsWorking:l}),(0,g.jsx)(xo,{code:t.code}),!t.locked&&f&&(0,g.jsx)(rs,{link:!0,className:"code-snippets-preview-modal__trash",disabled:c,onClick:function(){d()},children:(0,i.__)("Trash","code-snippets")})]}),(0,g.jsxs)("div",{className:"code-snippets-preview-modal__priority",children:[(0,g.jsx)("span",{children:(0,i.__)("Priority","code-snippets")}),(0,g.jsx)("span",{className:"code-snippets-preview-modal__priority-value",children:t.priority})]}),(0,g.jsx)(ho,vo({},p))]})})},Eo=function(e){var t=e.snippet,n=Sr().doSearch,r=s((0,o.useState)(!1),2),a=r[0],c=r[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("td",{className:"column-name column-primary",children:(0,g.jsx)("strong",{children:(0,g.jsx)("button",{type:"button",className:"cloud-table-name-button",title:(0,i.__)("Preview this snippet","code-snippets"),onClick:function(){return c(!0)},children:t.name})})}),(0,g.jsx)("td",{className:"column-type",children:(0,g.jsx)(Fs,{name:Br(t)})}),(0,g.jsx)("td",{className:"column-status",children:(0,g.jsx)(zs,{status:t.status})}),(0,g.jsx)("td",{className:"column-desc",children:(0,g.jsx)("div",{className:"cloud-table-description",children:In(Ln(t.description))})}),(0,g.jsxs)("td",{className:"column-actions",children:[(0,g.jsxs)("div",{className:"cloud-snippet-action-buttons",children:[(0,g.jsx)(rs,{secondary:!0,onClick:function(){return c(!0)},children:(0,i.__)("Preview","code-snippets")}),(0,g.jsx)(Bs,{snippet:t,onDownloaded:n})]}),a&&(0,g.jsx)(_o,{snippet:t,setIsOpen:c,onDownloaded:n})]})]})},Co=function(e){var t=e.availableIds,n=e.selectedIds,r=e.setSelectedIds;return(0,g.jsx)("td",{className:"column-cb check-column",children:(0,g.jsx)("input",{id:"cb-select-all-cloud-snippets",type:"checkbox",checked:t.every(function(e){return n.has(e)}),onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(oe(n),oe(t)):oe(n).filter(function(e){return!t.includes(e)}))})},"aria-label":(0,i.__)("Select all snippets","code-snippets")})})},ko=function(e){var t=e.snippet,n=e.selected,r=e.setSelected;return(0,g.jsx)("th",{scope:"row",className:"check-column",children:Qr(t)&&(0,g.jsx)("input",{id:"cb-select-".concat(t.id),type:"checkbox",name:"checked[]",checked:n.has(t.id),"aria-label":(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),t.name),onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(oe(n),[t.id]):oe(n).filter(function(e){return e!==t.id}))})}})})},Do=function(e){var t=e.snippets,n=e.selected,r=e.setSelected;return(0,g.jsxs)("table",{className:"wp-list-table widefat fixed striped cloud-snippets-table",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{children:[n&&r&&(0,g.jsx)(Co,{selectedIds:n,setSelectedIds:r,availableIds:t.filter(function(e){return Qr(e)}).map(function(e){return e.id})}),(0,g.jsx)("th",{scope:"col",className:"column-name column-primary",children:(0,i.__)("Name","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-type",children:(0,i.__)("Type","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-status",children:(0,i.__)("Status","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-desc",children:(0,i.__)("Description","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-actions",children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Actions","code-snippets")})})]})}),(0,g.jsx)("tbody",{children:t.map(function(e){return(0,g.jsxs)("tr",{children:[n&&r&&(0,g.jsx)(ko,{snippet:e,selected:n,setSelected:r}),(0,g.jsx)(Eo,{snippet:e})]},e.id)})})]})};const Ao=window.wp.date;function Ro(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 To(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ro(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ro(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Io=function(e){return(0,g.jsx)("svg",To(To({width:"19",height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M9.17636 13.7674H5.09053C3.12371 13.7643 1.5293 12.2296 1.5293 10.3362C1.5293 8.44351 3.12371 6.90874 5.09053 6.90874C5.39106 5.56133 6.46242 4.46168 7.90083 4.02351C9.33848 3.58609 10.926 3.87592 12.0639 4.78821C13.2018 5.69821 13.7172 7.08768 13.4174 8.4351H14.1745C15.2298 8.4351 16.1421 9.0568 16.568 9.95686M14.5293 12.2349V16.8232M12.2352 14.529L14.5293 16.8232L16.8234 14.529",stroke:"#FF9800",strokeWidth:"1.41177",strokeLinecap:"round",strokeLinejoin:"round"})}))},Lo=function(e){var t=e.className,n=e.isSelected,r=void 0!==n&&n,s=e.onSelectedChange,o=e.selectionLabel,i=e.footer,a=e.footerStatus,c=e.children;return(0,g.jsxs)("li",{className:v()("code-snippets-card",t,{"is-selectable":void 0!==s,"is-selected":void 0!==s&&r}),children:[void 0!==s?(0,g.jsx)("div",{className:"snippet-card-corner",children:(0,g.jsx)("input",{type:"checkbox",className:"snippet-card-select",checked:r,"aria-label":o,onChange:function(e){return s(e.target.checked)}})}):null,c,void 0!==i||void 0!==a?(0,g.jsxs)("footer",{children:[(0,g.jsx)("div",{className:"snippet-card-footer-status",children:a}),(0,g.jsx)("div",{className:"snippet-card-footer-actions",children:i})]}):null]})},Fo=function(e){var t,n=e.codevaultSlug;return(0,g.jsx)("p",{className:"cloud-snippet-author",children:(0,g.jsx)("a",{href:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.cloud,"/codevault/").concat(n),target:"_blank",rel:"noopener noreferrer",children:(0,i.sprintf)((0,i.__)("By %s","code-snippets"),n)})})},Mo=function(e){var t=e.snippet,n=e.author,r=e.setIsPreviewOpen;return(0,g.jsxs)("div",{className:"cloud-snippet card-inner",children:[(0,g.jsxs)("div",{className:"snippet-card-header",children:[(0,g.jsx)(Fs,{name:Br(t)}),(0,g.jsx)("h3",{children:(0,g.jsx)("button",{type:"button",className:"cloud-snippet-title-button",title:(0,i.__)("Preview this snippet","code-snippets"),onClick:function(){r(!0)},children:t.name})})]}),0<t.tags.length||t.updated?(0,g.jsxs)("div",{className:"snippet-card-meta",children:[0<t.tags.length?(0,g.jsxs)("span",{className:"cloud-snippet-tags",children:[(0,g.jsx)("span",{className:"snippet-card-tags-label",children:(0,i.__)("Tags:","code-snippets")})," ",t.tags.join(", ")]}):null,t.updated?(0,g.jsx)("time",{className:"snippet-card-modified",dateTime:t.updated,title:t.updated,children:(0,i.sprintf)((0,i.__)("Modified %s","code-snippets"),(0,Ao.humanTimeDiff)(t.updated,void 0))}):null]}):null,t.description?(0,g.jsx)("p",{className:"snippet-description-content",children:In(Ln(t.description))}):null,n]})},Uo=function(e){var t=e.snippet,n=e.author,r=e.isSelected,a=void 0!==r&&r,c=e.onSelectedChange,l=Sr().doSearch,u=s((0,o.useState)(!1),2),d=u[0],p=u[1];return(0,g.jsxs)(Lo,{className:"cloud-search-result",isSelected:a,onSelectedChange:c,selectionLabel:(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),t.name),footerStatus:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Ks,{status:t.status}),t.update_available?(0,g.jsx)("span",{className:"cloud-snippet-update",title:(0,i.__)("Update available","code-snippets"),children:(0,g.jsx)(Io,{"aria-label":(0,i.__)("Update available","code-snippets")})}):null]}),footer:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(rs,{secondary:!0,onClick:function(){return p(!0)},children:(0,i.__)("Preview","code-snippets")}),(0,g.jsx)(Bs,{snippet:t,onDownloaded:l})]}),children:[(0,g.jsx)(Mo,{snippet:t,author:n,setIsPreviewOpen:p}),d&&(0,g.jsx)(_o,{snippet:t,setIsOpen:p,onDownloaded:l})]})},Bo=[{paramName:"category",filterName:"categories",label:(0,i.__)("Snippet Category","code-snippets"),allOptionLabel:(0,i.__)("All Categories","code-snippets")},{paramName:"type",filterName:"types",label:(0,i.__)("Snippet Type","code-snippets"),allOptionLabel:(0,i.__)("All Types","code-snippets")},{paramName:"status",filterName:"statuses",label:(0,i.__)("Snippet Status","code-snippets"),allOptionLabel:(0,i.__)("All Statuses","code-snippets")}],Vo=function(){var e=Sr(),t=e.availableFilters,n=e.searchParams,r=e.doSearch,s=Bo.filter(function(e){var n=e.filterName;return t[n]&&0<t[n].length});return 0<s.length?(0,g.jsx)("div",{className:"alignleft actions",children:s.map(function(e){var s,i=e.label,a=e.allOptionLabel,c=e.filterName,l=e.paramName;return(0,g.jsxs)(o.Fragment,{children:[(0,g.jsx)("label",{htmlFor:"cloud-search-".concat(c),className:"screen-reader-text",children:i}),(0,g.jsxs)("select",{id:"cloud-search-".concat(c),className:"cloud-search-category-filter",value:n[l],onChange:function(e){return r(h({},l,function(e,t,n){if(""!==n){if("number"==typeof t[e]){var r=Number(n);return isNaN(r)?void 0:r}return n}}(l,n,e.target.value)))},children:[(0,g.jsx)("option",{value:"",children:a}),null===(s=t[c])||void 0===s?void 0:s.map(function(e){return(0,g.jsx)("option",{value:e.id,children:e.name},e.id)})]})]},c)})}):null},qo=["snippetView"],Wo=["which","doSearch","isSearching","searchResults"];function Ho(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 Ko(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ho(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ho(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zo=function(){var e=Sr(),t=e.searchParams,n=e.updateSearchParams,r=e.isSearching,a=e.doSearch,c=(0,o.useId)(),l=s((0,o.useState)(t.query),2),u=l[0],d=l[1];return(0,g.jsxs)("form",{className:"cloud-search-form",onSubmit:function(e){e.preventDefault(),a({query:u})},children:[(0,g.jsx)("label",{htmlFor:c,className:"screen-reader-text",children:(0,i.__)("Search method","code-snippets")}),(0,g.jsxs)("select",{id:c,value:t.method,onChange:function(e){return n({method:"codevault"===e.target.value?"codevault":"term"})},children:[(0,g.jsx)("option",{value:"term",children:(0,i.__)("Search by keyword","code-snippets")}),(0,g.jsx)("option",{value:"codevault",children:(0,i.__)("Name of library","code-snippets")})]}),(0,g.jsxs)("div",{className:"cloud-search-query",children:[(0,g.jsx)("input",{id:"cloud-search-query",type:"search",value:u,"aria-label":(0,i.__)("Search query","code-snippets"),onChange:function(e){return d(e.target.value)},placeholder:(0,i.__)("e.g. Remove unused JavaScript…","code-snippets")}),r&&(0,g.jsx)("span",{role:"status","aria-live":"polite",children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Searching…","code-snippets")})})]}),(0,g.jsx)("button",{type:"submit",className:"button button-primary cloud-search-submit",disabled:r,children:r?(0,g.jsx)(H.Spinner,{}):(0,i.__)("Search Cloud Library","code-snippets")})]})},Go=function(e){var t=e.snippets,n=e.selected,r=e.setSelected;return(0,g.jsx)("ul",{className:v()("cloud-search-results","code-snippets-cards",{"has-selection":t.some(function(e){return n.has(e.id)})}),children:t.map(function(e){return(0,g.jsx)(Uo,{snippet:e,author:(0,g.jsx)(Fo,{codevaultSlug:e.codevault}),isSelected:n.has(e.id),onSelectedChange:Qr(e)?function(t){r(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}:void 0},e.id)})})},$o=[{key:"download",label:(0,i.__)("Download","code-snippets")}],Jo=function(e){var t=e.snippetView,n=m(e,qo);return"card"===t?(0,g.jsx)(Go,Ko({},n)):(0,g.jsx)(Do,Ko({},n))},Qo=function(e){var t=e.which,n=e.doSearch,r=e.isSearching,s=e.searchResults,o=m(e,Wo);return(0,g.jsx)(Ps,Ko({which:t,disabled:r,totalItems:s.totalItems,totalPages:s.totalPages,currentPage:s.page,setCurrentPage:function(e){return n({page:e})}},o))},Xo=function(e){var t=e.snippetView,n=e.setSnippetView,r=Kn().api,i=Sr(),a=i.searchResults,c=i.isSearching,l=i.doSearch,u=s((0,o.useState)(new Set),2),d=u[0],p=u[1];if(!a)return null;var f=function(){var e=ae(le().mark(function e(t,n){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("download"!==t){e.next=4;break}return e.next=3,Promise.all(a.snippets.filter(function(e){return n.has(e.id)&&Qr(e)}).map(function(e){var t=e.id;return r.post("".concat(Mn.cloud.snippets,"/").concat(t,"/download"))}));case 3:l();case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();return(0,g.jsxs)("div",{className:"snippets-list-view",children:[(0,g.jsx)(Qo,{which:"top",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l,actions:$o,doAction:f,selectAllKeys:"card"===t?a.snippets.filter(function(e){return Qr(e)}).map(function(e){return e.id}):void 0,extraTableNav:function(){return(0,g.jsx)(Vo,{})},endTableNav:function(e){return"top"===e?(0,g.jsx)(Is,{snippetView:t,setSnippetView:n}):null}}),(0,g.jsx)(Jo,{snippets:a.snippets,snippetView:t,selected:d,setSelected:p}),(0,g.jsx)(Qo,{which:"bottom",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l})]})},Yo=function(e){var t=e.snippetView,n=e.setSnippetView,r=Sr(),s=r.searchResults,o=r.searchParams;return s?0<s.page&&0===s.snippets.length?(0,g.jsx)("div",{className:"banner banner-neutral no-results",children:(0,g.jsx)("p",{children:"codevault"===o.method?(0,i.__)("Could not find a codevault with that name. Please try again.","code-snippets"):(0,i.__)("No snippets could be found with that search term. Please try again.","code-snippets")})}):s.snippets.length?(0,g.jsxs)(g.Fragment,{children:[s.isFeatured?(0,g.jsx)("h2",{className:"cloud-featured-heading",children:(0,i.__)("Featured Snippets","code-snippets")}):(0,g.jsx)("h2",{className:"cloud-snippets-heading",children:(0,i.__)("Search Results","code-snippets")}),(0,g.jsx)(Xo,{snippetView:t,setSnippetView:n})]}):null:null},Zo=function(){var e=Sr(),t=e.isErrored,n=e.isLoading;return t||n?(0,g.jsx)(Es,{isLoading:n,errorMessage:t?(0,i.__)("An error occurred while fetching search results. Please try again.","code-snippets"):void 0,loadingNotice:(0,i.__)("Loading snippets from cloud…","code-snippets"),noticeLabel:(0,i.__)("Community snippets status","code-snippets")}):null},ei=function(e){var t=e.snippetView,n=e.setSnippetView;return(0,g.jsxs)("div",{className:"cloud-search",children:[(0,g.jsx)(zo,{}),(0,g.jsx)(Zo,{}),(0,g.jsx)(Yo,{snippetView:t,setSnippetView:n})]})},ti=[{name:"snippets",label:(0,i.__)("Snippets","code-snippets")},{name:"bundles",label:(0,i.__)("Bundles","code-snippets"),pro:!0}],ni=function(){var e=s((0,o.useState)(function(){return function(e){var t,n=u("tab"),r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return er(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)?er(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;if(s.name===n)return s}}catch(e){r.e(e)}finally{r.f()}return e[0]}(ti)}),2),t=e[0],n=e[1],r=$n(),a=r.snippetView,c=r.setSnippetView,l=Sr().searchResults;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(tr,{className:"community-cloud-nav",ariaLabel:(0,i.__)("Community Cloud types","code-snippets"),tabs:ti,getTabCount:function(e){return"snippets"===e.name?null==l?void 0:l.totalItems:void 0},currentTab:t,setCurrentTab:function(e){d(h({},"tab",e.name)),n(e)}}),(0,g.jsx)(Qn,{hidden:"bundles"===t.name}),(!t.pro||N())&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"snippets-page-header",children:(0,g.jsx)("h1",{children:(0,i.sprintf)((0,i.__)("Community Cloud: %s","code-snippets"),t.label)})}),(0,g.jsx)("hr",{className:"wp-header-end"}),(0,g.jsx)("p",{className:"snippets-page-description",children:(0,i.__)("Search the community cloud and download user-shared snippets directly to your site.","code-snippets")})]}),function(){switch(t.name){case"snippets":return(0,g.jsx)(ei,{snippetView:a,setSnippetView:c});case"bundles":return(0,g.jsx)(G,{})}}()]})},ri=function(){return(0,g.jsx)(zn,{children:(0,g.jsx)(dr,{children:(0,g.jsx)(Pr,{children:(0,g.jsx)(ni,{})})})})};function si(e,t){return si=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},si(e,t)}function oi(){oi=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,s){var o=RegExp(e,r);return t.set(o,s||t.get(e)),si(o,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var s=r[n];if("number"==typeof s)t[n]=e[s];else{for(var o=0;void 0===e[s[o]]&&o+1<s.length;)o++;t[n]=e[s[o]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&si(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var s=n.indices;s&&(s.groups=r(s,this))}return n},n.prototype[Symbol.replace]=function(n,s){if("string"==typeof s){var o=t.get(this);return e[Symbol.replace].call(this,n,s.replace(/\$<([^>]+)(>|$)/g,function(e,t,n){if(""===n)return e;var r=o[t];return Array.isArray(r)?"$"+r.join("$"):"number"==typeof r?"$"+r:""}))}if("function"==typeof s){var i=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=c(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,i)),s.apply(this,e)})}return e[Symbol.replace].call(this,n,s)},oi.apply(this,arguments)}var ii=["all","active","inactive","recently_active","locked","unlocked","trashed"],ai="all",ci=s(Rn("useSnippetsFilters"),2),li=ci[0],ui=ci[1],di=function(e){var t=e.children,n=s((0,o.useState)(function(){return u("tag")}),2),r=n[0],i=n[1],a=s((0,o.useState)(function(){return u("s")}),2),c=a[0],l=a[1],p=s((0,o.useState)(function(){var e=u("type");return function(e){return Nr.includes(e)}(e)?e:void 0}),2),f=p[0],h=p[1],m=s((0,o.useState)(function(){var e=u("status");return function(e){return ii.includes(e)}(e)?e:ai}),2),b=m[0],v=m[1],y=s((0,o.useMemo)(function(){return r=null!=(n=null==(e=c)?void 0:e.trim().match(oi(/@line:(\d+)/,{line:1})))&&null!==(t=n.groups)&&void 0!==t&&t.line?parseInt(n.groups.line,10):void 0,n&&r?[null==e?void 0:e.replace(n[0],"").trim(),r]:[e,void 0];var e,t,n,r},[c]),2),j=y[0],w=y[1],x={currentTag:r,currentType:f,searchQuery:c,currentStatus:b,searchQueryText:j,searchLineNumber:w,setCurrentType:(0,o.useCallback)(function(e){h(e),d({type:e})},[]),setCurrentStatus:(0,o.useCallback)(function(e){v(e),d({status:ai===e?"":e})},[]),setCurrentTag:(0,o.useCallback)(function(e){i(e),d({tag:e})},[]),setSearchQuery:(0,o.useCallback)(function(e){l(e),d({s:e})},[])};return(0,g.jsx)(li.Provider,{value:x,children:t})},pi=function(e,t,n){var r;null!==(r=e.get(t))&&void 0!==r&&r.push(n)||e.set(t,[n])},fi=s(Rn("useFilteredSnippets"),2),hi=fi[0],mi=fi[1],bi=function(e){var t=e.children,n=to().snippetsList,r=ui(),s=r.currentType,i=r.currentTag,a=r.searchLineNumber,c=r.searchQueryText,l=(0,o.useMemo)(function(){var e,t;return null!==(e=null!=n?n:null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||null===(t=t.snippetsList)||void 0===t?void 0:t.map(Rr))&&void 0!==e?e:[]},[n]),u=(0,o.useMemo)(function(){var e=["name","desc","code","tags"],t=null==c?void 0:c.toLowerCase().trim();return l.filter(function(n){return(!s||Br(n)===s)&&!(i&&!n.tags.includes(i))&&(!t||(void 0!==a?null===(r=n.code.split("\n")[a])||void 0===r?void 0:r.includes(t):e.some(function(e){return("tags"===e?n.tags.join(" "):n[e]).toLowerCase().includes(t)})));var r})},[l,i,s,c,a]),d=(0,o.useMemo)(function(){return function(e){return e.reduce(function(e,t){return t.active&&pi(e,t.conditionId,t),e},new Map)}(l)},[l]),p=(0,o.useMemo)(function(){return function(e,t){return e.reduce(function(e,n){return n.trashed?pi(e,"trashed",n):(pi(e,"all",n),pi(e,Gr(n,t)?"active":"inactive",n),pi(e,n.locked?"locked":"unlocked",n),n.lastActive&&pi(e,"recently_active",n)),e},new Map)}(u,d)},[u,d]),f={snippetsByStatus:p,activeByCondition:d};return(0,g.jsx)(hi.Provider,{value:f,children:t})};function vi(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 gi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var yi=function(e){var t,n=e.column,r=e.cellProps,s=e.sortColumn,o=e.sortDirection,a=e.setSortColumn,c=e.setSortDirection,l=n.id===(null==s?void 0:s.id),u=l?"asc"===o?"desc":"asc":null!==(t=n.defaultSortDirection)&&void 0!==t?t:"asc",d=l?o:"asc"===u?"desc":"asc",p=l?"asc"===o?"ascending":"descending":void 0;return(0,g.jsx)("th",gi(gi({},r),{},{"aria-sort":p,className:v()(r.className,l?"sorted":"sortable",d),children:(0,g.jsxs)("button",{type:"button",className:"list-table-sort-button",onClick:function(){a(n),c(u)},children:[(0,g.jsx)("span",{className:"sortable-column-title",children:n.title}),(0,g.jsxs)("span",{className:"sorting-indicators",children:[(0,g.jsx)("span",{className:"sorting-indicator asc","aria-hidden":"true"}),(0,g.jsx)("span",{className:"sorting-indicator desc","aria-hidden":"true"})]}),l?null:(0,g.jsx)("span",{className:"screen-reader-text",children:"asc"===u?(0,i.__)("Sort ascending.","code-snippets"):(0,i.__)("Sort descending.","code-snippets")})]})}))},ji=function(e){var t=e.items,n=e.which,r=e.getKey,s=e.columns,o=e.sortColumn,a=e.selected,c=e.setSelected,l=e.setSortColumn,u=e.sortDirection,d=e.setSortDirection;return(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{className:"column-cb check-column",children:(0,g.jsx)("input",{id:"cb-select-all-".concat(n),type:"checkbox",name:"checked[]",checked:0<t.length&&t.every(function(e){return a.has(r(e))}),"aria-label":(0,i.__)("Select All","code-snippets"),onChange:function(e){c(new Set(e.target.checked?t.map(r):[]))}})}),s.map(function(e){var t={id:"head"===n?e.id.toString():void 0,scope:"col",className:v()("manage-column","column-".concat(e.id),"".concat(e.id,"-column"),{hidden:e.isHidden,"column-primary":e.isPrimary})};return e.sortedValue?(0,g.jsx)(yi,{column:e,cellProps:t,sortColumn:o,sortDirection:u,setSortColumn:l,setSortDirection:d},e.id):(0,g.jsx)("th",gi(gi({},t),{},{children:e.title}),e.id)})]})},wi=function(e){var t=e.item,n=e.selected,r=e.setSelected,s=e.getKey;return(0,g.jsx)("th",{scope:"row",className:"check-column",children:(0,g.jsx)("input",{id:"cb-select-".concat(s(t)),type:"checkbox",name:"checked[]","aria-label":(0,i.__)("Select snippet","code-snippets"),checked:n.has(s(t)),onChange:function(e){r(function(n){var r=new Set(n);return e.target.checked?r.add(s(t)):r.delete(s(t)),r})}})})},xi=function(e){var t=e.item,n=e.column,r=v()("".concat(n.id,"-column"),"column-".concat(n.id),{hidden:n.isHidden});return n.isHeading?(0,g.jsx)("th",{className:r,children:n.render(t)}):(0,g.jsx)("td",{className:r,children:n.render(t)})},Oi=function(e){var t=e.items,n=e.getKey,r=e.columns,s=e.noItems,o=e.selected,i=e.setSelected,a=e.rowClassName;return 0<t.length?t.map(function(e){return(0,g.jsxs)("tr",{className:null==a?void 0:a(e),children:[(0,g.jsx)(wi,{item:e,selected:o,setSelected:i,getKey:n}),r.map(function(t){return(0,g.jsx)(xi,{item:e,column:t},t.id)})]},n(e))}):(0,g.jsx)("tr",{className:"no-items",children:(0,g.jsx)("td",{className:"colspanchange",colSpan:r.length,children:s})})},_i=["fixed","striped","children","className"],Si=["items","getKey","totalPages","pageSearchParam","initialSort"],Pi=["getKey","actions","columns","noItems","doAction","disabled","totalItems","totalPages","currentPage","beforeTable","endTableNav","rowClassName","visibleItems","sortDirection","extraTableNav","selectAllControl","setCurrentPage","pageSearchParam"];function Ni(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 Ei(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ci=function(e,t,n){return new Set(e.map(t).filter(function(e){return n.has(e)}))},ki=function(e){var t=e.fixed,n=e.striped,r=e.children,s=e.className,o=m(e,_i);return(0,g.jsxs)("table",{className:v()("wp-list-table widefat",{striped:n,fixed:t},s),children:[(0,g.jsx)("thead",{children:(0,g.jsx)(ji,Ei({which:"head"},o))}),(0,g.jsx)("tbody",{children:r}),(0,g.jsx)("tfoot",{children:(0,g.jsx)(ji,Ei({which:"foot"},o))})]})},Di=function(e){var t=e.items,n=e.getKey,r=e.totalPages,i=e.pageSearchParam,a=void 0===i?"paged":i,c=e.initialSort,l=m(e,Si),d=s((0,o.useState)(function(){return c?l.columns.find(function(e){return e.id===c.columnId&&e.sortedValue}):void 0}),2),p=d[0],f=d[1],h=s((0,o.useState)(function(){return a&&Number(u(a))||1}),2),b=h[0],v=h[1],y=s((0,o.useState)(function(){var e;return null!==(e=null==c?void 0:c.direction)&&void 0!==e?e:"asc"}),2),j=y[0],w=y[1],x=(0,o.useMemo)(function(){return function(e,t){var n=t.currentPage,r=t.totalPages;if(r){var s=Math.ceil(e.length/r),o=(n-1)*s,i=o+s;return e.slice(o,i)}return e}(function(e,t,n){return e.toSorted(function(e,r){var s,o,i=null==t||null===(s=t.sortedValue)||void 0===s?void 0:s.call(t,e),a=null==t||null===(o=t.sortedValue)||void 0===o?void 0:o.call(t,r);return void 0===i||void 0===a?0:i<a?"asc"===n?-1:1:i>a?"asc"===n?1:-1:0})}(t,p,j),{currentPage:b,totalPages:r})},[t,p,j,b,r]);return(0,g.jsx)(Ai,Ei({getKey:n,totalItems:t.length,totalPages:r,visibleItems:x,pageSearchParam:a,sortColumn:p,sortDirection:j,currentPage:b,setSortColumn:f,setSortDirection:w,setCurrentPage:v},l))},Ai=function(e){var t=e.getKey,n=e.actions,r=e.columns,i=e.noItems,a=e.doAction,c=e.disabled,l=void 0!==c&&c,u=e.totalItems,d=e.totalPages,p=e.currentPage,f=e.beforeTable,h=e.endTableNav,b=e.rowClassName,v=e.visibleItems,y=e.sortDirection,j=void 0===y?"asc":y,w=e.extraTableNav,x=e.selectAllControl,O=e.setCurrentPage,_=e.pageSearchParam,S=m(e,Pi),P=s((0,o.useState)(function(){return new Set}),2),N=P[0],E=P[1];return(0,g.jsxs)(Ns,{totalItems:u,selected:Ci(v,t,N),selectAllKeys:x?v.map(t):void 0,actions:n,doAction:a,extraTableNav:w,endTableNav:h,disabled:l,currentPage:p,totalPages:d,pageSearchParam:_,setSelected:E,setCurrentPage:O,children:[f,(0,g.jsx)(ki,Ei(Ei({items:v},S),{},{getKey:t,columns:r,selected:N,setSelected:E,sortDirection:j,children:(0,g.jsx)(Oi,{items:v,getKey:t,columns:r,noItems:i,rowClassName:b,selected:N,setSelected:E})}))]})};function Ri(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 Ti(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ri(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ri(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ii=function(e){return(0,g.jsxs)("svg",Ti(Ti({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("circle",{cx:"9",cy:"3.5",r:"1.6",fill:"currentColor"}),(0,g.jsx)("circle",{cx:"9",cy:"9",r:"1.6",fill:"currentColor"}),(0,g.jsx)("circle",{cx:"9",cy:"14.5",r:"1.6",fill:"currentColor"})]}))},Li=["button:not(:disabled)","[href]","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", "),Fi=(0,o.createContext)({closeMenu:function(){}}),Mi=function(e){var t=e.onSelect,n=e.destructive,r=e.disabled,s=e.className,i=e.children,a=(0,o.useContext)(Fi).closeMenu;return(0,g.jsx)("li",{children:(0,g.jsx)("button",{type:"button",className:v()("kebab-menu-item",{"kebab-menu-item-destructive":n},s),disabled:r,onClick:function(){null==t||t(),a()},children:i})})},Ui=function(){return(0,g.jsx)("li",{"aria-hidden":"true",className:"kebab-menu-divider"})},Bi=function(e){var t=e.className,n=e.children;return(0,g.jsx)("li",{className:v()("kebab-menu-row",t),children:n})},Vi=function(e){var t=e.label,n=e.className,r=e.children,i=s((0,o.useState)(!1),2),a=i[0],c=i[1],l=(0,o.useRef)(null),u=(0,o.useRef)(null),d=(0,o.useRef)(null),p=(0,o.useId)(),f=(0,o.useCallback)(function(){var e;c(!1),null===(e=u.current)||void 0===e||e.focus()},[]),h={isOpen:a,setIsOpen:c,closeMenu:f,containerRef:l,triggerRef:u,popoverRef:d},m=function(e){var t=e.isOpen,n=e.triggerRef,r=e.popoverRef,i=s((0,o.useState)(!1),2),a=i[0],c=i[1];return(0,o.useLayoutEffect)(function(){if(t&&r.current){var e,s,o=r.current.getBoundingClientRect(),i=null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect();c(o.bottom>window.innerHeight&&(null!==(s=null==i?void 0:i.top)&&void 0!==s?s:0)>o.height);var a=r.current.querySelector("button:not(:disabled)");(null!=a?a:r.current).focus()}else c(!1)},[t,n,r]),a}(h);return function(e){var t=e.isOpen,n=e.setIsOpen,r=e.closeMenu,s=e.containerRef,i=e.popoverRef;(0,o.useEffect)(function(){if(t){var e=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},o=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},a=function(e){return function(e,t){var n=t.closeMenu,r=t.popoverRef;if("Escape"===e.key)return e.preventDefault(),void n();if(r.current){var s=document.activeElement;if(!(s instanceof HTMLElement&&(s.isContentEditable||s.matches("input, select, textarea")))){var o=Array.from(r.current.querySelectorAll(Li)),i=s instanceof HTMLElement?o.indexOf(s):-1;0<o.length&&["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),o[function(){switch(e.key){case"Home":return 0;case"End":return o.length-1;default:return(i+("ArrowDown"===e.key?1:-1)+o.length)%o.length}}()].focus())}}}(e,{closeMenu:r,popoverRef:i})};return document.addEventListener("mousedown",e),document.addEventListener("focusin",o),document.addEventListener("keydown",a),function(){document.removeEventListener("mousedown",e),document.removeEventListener("focusin",o),document.removeEventListener("keydown",a)}}},[t,n,r,s,i])}(h),(0,g.jsxs)("div",{ref:l,className:v()("kebab-menu",n),children:[(0,g.jsx)("button",{ref:u,type:"button",className:"kebab-menu-trigger","aria-label":t,"aria-expanded":a,"aria-controls":p,onClick:function(){return c(function(e){return!e})},children:(0,g.jsx)(Ii,{})}),a?(0,g.jsx)(Fi.Provider,{value:{closeMenu:f},children:(0,g.jsx)("ul",{ref:d,id:p,tabIndex:-1,"aria-label":t,className:v()("kebab-menu-popover",{"kebab-menu-popover-top":m}),children:r})}):null]})};function qi(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 Wi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Hi=function(e){var t=e.snippet,n=s((0,o.useState)(t.priority),2),r=n[0],a=n[1],c=Xs(),l=to().refreshSnippetsList,u=function(){Number.isNaN(r)||r===t.priority?a(t.priority):c.update(Wi(Wi({},t),{},{priority:r})).then(function(e){e.id===t.id&&a(e.priority)}).then(l).catch(Gn)};return(0,g.jsx)("form",{onSubmit:function(e){e.preventDefault(),u()},children:(0,g.jsx)("input",{id:"snippet-".concat(t.id,"-priority"),type:"number",className:"snippet-priority",value:r,step:"1",onBlur:u,"aria-label":(0,i.__)("Snippet priority","code-snippets"),onChange:function(e){return a(Number(e.target.value))},disabled:t.locked||t.trashed})})};function Ki(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 zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ki(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ki(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Gi=function(e){var t=e.snippet,n=s((0,o.useState)(!1),2),r=n[0],a=n[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(rs,{link:!0,onClick:function(){return a(!0)},children:(0,i.__)("Preview","code-snippets")}),r&&(0,g.jsx)(No,{snippet:t,setIsOpen:a})]})},$i=function(e){return e[e.Ready=0]="Ready",e[e.Working=1]="Working",e[e.Errored=2]="Errored",e}($i||{}),Ji=function(e){var t=e.action,n=e.label,r=e.workingLabel,a=e.failedLabel,c=e.className,l=s((0,o.useState)($i.Ready),2),u=l[0],d=l[1];return(0,g.jsx)(rs,{link:!0,className:v()(c,{"is-busy":u===$i.Working}),disabled:u===$i.Working,onClick:function(){switch(u){case $i.Errored:d($i.Ready);break;case $i.Working:break;case $i.Ready:d($i.Working),t().then(function(){return d($i.Ready)}).catch(function(){d($i.Errored)})}},children:function(){switch(u){case $i.Working:return(0,g.jsxs)("span",{className:"snippet-row-action-feedback",children:[(0,g.jsx)(H.Spinner,{})," ",null!=r?r:(0,i.__)("Loading…","code-snippets")]});case $i.Errored:return(0,g.jsxs)("span",{className:"snippet-row-action-error",children:[(0,g.jsx)("span",{className:"dashicons dashicons-warning"}),null!=a?a:(0,i.__)("Failed","code-snippets")]});default:return n}}()})},Qi=function(e){var t=e.snippet,n=to().refreshSnippetsList,r=mo({snippet:t,onSuccess:n}),s=r.requestDelete,o=r.deleteDialogProps;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Ji,{action:s,className:"delete",label:t.trashed?(0,i.__)("Delete Permanently","code-snippets"):(0,i.__)("Trash","code-snippets"),workingLabel:t.trashed?(0,i.__)("Deleting…","code-snippets"):(0,i.__)("Trashing…","code-snippets"),failedLabel:(0,i.__)("Failed to delete","code-snippets")}),(0,g.jsx)(ho,zi({},o))]})},Xi=function(e){var t=e.snippet,n=Xs(),r=to().refreshSnippetsList,s=t.trashed?null:(0,g.jsx)(Gi,{snippet:t}),o=t.trashed?null:(0,g.jsx)("a",{href:Vr(t),children:t.locked?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}),a=t.trashed?null:(0,g.jsx)(Ji,{label:(0,i.__)("Clone","code-snippets"),workingLabel:(0,i.__)("Cloning…","code-snippets"),action:function(){return n.create(Ur(t)).then(r)}}),c=t.trashed?null:(0,g.jsx)(Ji,{label:(0,i.__)("Export","code-snippets"),workingLabel:(0,i.__)("Exporting…","code-snippets"),action:function(){return n.export(t).then(function(e){return oo(e,t)})}}),l=t.trashed?(0,g.jsx)(Ji,{label:(0,i.__)("Restore","code-snippets"),workingLabel:(0,i.__)("Restoring…","code-snippets"),action:function(){return n.restore(t).then(r)}}):null,u=!t.locked||t.trashed?(0,g.jsx)(Qi,{snippet:t}):null;return(0,g.jsx)(g.Fragment,{children:[s,o,a,l,c,u].filter(function(e){return e}).reduce(function(e,t){return null===e?(0,g.jsx)(g.Fragment,{children:t}):(0,g.jsxs)(g.Fragment,{children:[e," | ",t]})},null)})},Yi=function(e){var t,n=e.snippet;return P()||!n.network||n.shared_network?!n.shared_network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap?(0,g.jsx)("div",{className:v()("row-actions",{visible:!n.trashed}),children:(0,g.jsx)(Xi,{snippet:n})}):null:(0,g.jsx)("div",{className:"row-actions visible",children:n.active?(0,g.jsx)("span",{className:"network-active",children:(0,i.__)("Network Active","code-snippets")}):(0,g.jsx)("span",{className:"network-only",children:(0,i.__)("Network Only","code-snippets")})})};function Zi(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 ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ta=function(e){var t=e.snippet;return(0,g.jsxs)("a",{className:"snippet-execution-button",title:(0,i.__)("Run Once","code-snippets"),href:f(window.location.href,{action:"run-once",snippet:t.id}),children:[(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Run Once","code-snippets")}),(0,g.jsx)("span",{"aria-hidden":"true",children:" "})]})},na=function(e){var t=e.snippet,n=Xs(),r=n.activate,s=n.deactivate,o=to().refreshSnippetsList,a=t.network&&!t.shared_network?t.active?(0,i.__)("Network Deactivate","code-snippets"):(0,i.__)("Network Activate","code-snippets"):t.active?(0,i.__)("Deactivate","code-snippets"):(0,i.__)("Activate","code-snippets");return(0,g.jsx)("input",{id:"snippet-".concat(t.id,"-switch"),type:"checkbox",role:"switch",checked:t.active,"aria-checked":t.active,className:"switch",title:a,"aria-label":a,onChange:function(){(t.active?s(t):r(t)).then(o).catch(Gn)}})},ra=function(e){var t,n,r=e.snippet,s=mi().activeByCondition;if(r.trashed)return"";switch(r.scope){case"single-use":return(0,g.jsx)(ta,{snippet:r});case"condition":return(0,g.jsx)("a",{className:"snippet-condition-count",href:Vr(r),children:null!==(t=null===(n=s.get(r.id))||void 0===n?void 0:n.length)&&void 0!==t?t:0});default:return(0,g.jsx)(na,{snippet:r})}},sa=function(e){var t=e.snippet;return(0,g.jsx)("div",{className:"extra-icons",children:t.locked&&(0,g.jsx)(Ms,{inline:!0,end:!0,label:(0,i.__)("About snippet lock","code-snippets"),icon:(0,g.jsx)("span",{className:"dashicons dashicons-lock","aria-hidden":"true"}),children:(0,i.__)("This snippet is locked and cannot be modified.","code-snippets")})})},oa=function(e){var t,n=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[!n.trashed&&(P()||!n.network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap)?(0,g.jsx)("a",{href:Vr(n),className:"snippet-name",title:Wr(n),children:Wr(n)}):(0,g.jsx)("span",{className:"snippet-name",title:Wr(n),children:Wr(n)}),n.shared_network&&(0,g.jsx)("span",{className:"badge",children:(0,i.__)("Shared on Network","code-snippets")})]})},ia=function(e){var t=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(sa,{snippet:t}),(0,g.jsx)(oa,{snippet:t}),(0,g.jsx)(Yi,{snippet:t})]})},aa=function(e){var t=e.snippet,n=ui().setCurrentType,r=Br(t);return(0,g.jsx)("a",{href:f(window.location.href,{type:r}),onClick:function(e){e.preventDefault(),n(r)},children:(0,g.jsx)(Fs,{name:r})})},ca=function(e){var t=e.snippet;return t.tags.map(function(e,n){return(0,g.jsxs)(o.Fragment,{children:[(0,g.jsx)("a",{href:f(window.location.href,{tag:e}),children:e},e),n<t.tags.length-1?", ":""]},e)})},la=function(e){var t=e.snippet;return t.modified?(0,g.jsx)("span",{className:"modified-column-content",title:t.modified,children:(0,g.jsx)("time",{dateTime:t.modified,children:(0,Ao.humanTimeDiff)(t.modified,void 0)})}):(0,g.jsx)(g.Fragment,{children:"—"})},ua=[{id:"activate",title:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Activate","code-snippets")}),render:function(e){return(0,g.jsx)(ra,{snippet:e})}},{id:"name",title:(0,i.__)("Name","code-snippets"),isPrimary:!0,sortedValue:function(e){return Wr(e).toLowerCase()},render:function(e){return(0,g.jsx)(ia,{snippet:e})}},{id:"type",title:(0,i.__)("Type","code-snippets"),sortedValue:function(e){return Br(e)},render:function(e){return(0,g.jsx)(aa,{snippet:e})}},{id:"desc",title:(0,i.__)("Description","code-snippets"),render:function(e){return(0,g.jsx)("div",{className:"snippet-description-content",children:(0,g.jsx)(a.RawHTML,{children:e.desc})})}},{id:"tags",title:(0,i.__)("Tags","code-snippets"),render:function(e){return(0,g.jsx)(ca,{snippet:e})}},{id:"date",title:(0,i.__)("Modified","code-snippets"),sortedValue:function(e){return e.modified?new Date(e.modified).toISOString():""},render:function(e){return(0,g.jsx)(la,{snippet:e})}},{id:"priority",title:(0,i.__)("Priority","code-snippets"),sortedValue:function(e){return e.priority},render:function(e){return(0,g.jsx)(Hi,{snippet:e})}}];function da(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 pa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?da(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):da(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var fa=function(e){var t=e.snippet,n=s((0,o.useState)(!1),2),r=n[0],a=n[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(rs,{secondary:!0,onClick:function(){return a(!0)},children:(0,i.__)("Preview","code-snippets")}),r&&(0,g.jsx)(No,{snippet:t,setIsOpen:a})]})},ha=function(e){var t=e.snippet,n=Xs(),r=to().refreshSnippetsList;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Mi,{onSelect:function(){n.create(Ur(t)).then(r).catch(Gn)},children:(0,i.__)("Clone","code-snippets")}),(0,g.jsx)(Mi,{onSelect:function(){n.export(t).then(function(e){return oo(e,t)}).catch(Gn)},children:(0,i.__)("Export","code-snippets")}),(0,g.jsx)(Ui,{})]})},ma=function(e){var t=e.snippet,n=e.requestDelete,r=Xs(),s=to().refreshSnippetsList;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Ui,{}),t.trashed?(0,g.jsx)(Mi,{onSelect:function(){r.restore(t).then(s).catch(Gn)},children:(0,i.__)("Restore","code-snippets")}):null,(0,g.jsx)(Mi,{destructive:!0,onSelect:n,children:t.trashed?(0,i.__)("Delete Permanently","code-snippets"):(0,i.__)("Trash","code-snippets")})]})},ba=function(e){var t=e.snippet,n=to().refreshSnippetsList,r=Jr(t),s=mo({snippet:t,onSuccess:n,onError:Gn}),o=s.requestDelete,a=s.deleteDialogProps;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(Vi,{label:(0,i.sprintf)((0,i.__)("Actions for %s","code-snippets"),Wr(t)),children:[r&&!t.trashed?(0,g.jsx)(ha,{snippet:t}):null,(0,g.jsxs)(Bi,{className:"kebab-menu-priority",children:[(0,g.jsx)("label",{htmlFor:"snippet-".concat(t.id,"-priority"),children:(0,i.__)("Priority","code-snippets")}),(0,g.jsx)(Hi,{snippet:t})]}),r&&(t.trashed||!t.locked)&&(0,g.jsx)(ma,{snippet:t,requestDelete:function(){o()}})]}),(0,g.jsx)(ho,pa({},a))]})},va=function(e){var t=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[$r(t)?t.active?(0,g.jsx)("span",{className:"network-active",children:(0,i.__)("Network Active","code-snippets")}):(0,g.jsx)("span",{className:"network-only",children:(0,i.__)("Network Only","code-snippets")}):null,t.trashed?null:(0,g.jsx)(fa,{snippet:t}),!t.trashed&&Jr(t)?(0,g.jsx)("a",{className:"button button-primary",href:Vr(t),children:t.locked?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}):null,(0,g.jsx)(ba,{snippet:t})]})},ga=function(e){var t=e.snippet;return t.modified?(0,g.jsx)("time",{className:"snippet-card-modified",dateTime:t.modified,title:t.modified,children:(0,i.sprintf)((0,i.__)("Modified %s","code-snippets"),(0,Ao.humanTimeDiff)(t.modified,void 0))}):null},ya=function(e){var t=e.snippet,n=e.isSelected,r=e.onSelectedChange,s=mi().activeByCondition;return(0,g.jsx)(Lo,{className:v()("snippet","".concat(Gr(t,s)?"active":"inactive","-snippet"),"".concat(Br(t),"-snippet"),"".concat(t.scope,"-snippet")),isSelected:n,onSelectedChange:r,selectionLabel:(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),Wr(t)),footer:(0,g.jsx)(va,{snippet:t}),children:(0,g.jsxs)("div",{className:"card-inner",children:[(0,g.jsxs)("div",{className:"snippet-card-header",children:[(0,g.jsx)(ra,{snippet:t}),(0,g.jsx)(aa,{snippet:t}),(0,g.jsx)("h3",{children:(0,g.jsx)(oa,{snippet:t})}),(0,g.jsx)(sa,{snippet:t})]}),(0<t.tags.length||!!t.modified)&&(0,g.jsxs)("div",{className:v()("snippet-card-meta",{"has-tags":0<t.tags.length}),children:[0<t.tags.length&&(0,g.jsxs)("span",{className:"snippet-card-tags",children:[(0,g.jsx)("span",{className:"snippet-card-tags-label",children:(0,i.__)("Tags:","code-snippets")})," ",(0,g.jsx)(ca,{snippet:t})]}),(0,g.jsx)(ga,{snippet:t})]}),t.desc&&(0,g.jsx)("div",{className:"snippet-description-content",children:(0,g.jsx)(a.RawHTML,{children:t.desc})})]})})},ja="paged",wa=function(e){var t=e.snippets,n=e.noItems,r=e.selected,s=e.setSelected;return 0<t.length?(0,g.jsx)("ul",{className:v()("code-snippets-cards","snippets-card-grid",{"has-selection":t.some(function(e){return r.has(e.id)})}),children:t.map(function(e){return(0,g.jsx)(ya,{snippet:e,isSelected:r.has(e.id),onSelectedChange:function(t){s(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}},e.id)})}):(0,g.jsx)("p",{className:"no-items",children:n})},xa=function(e,t){return new Set(oe(e).filter(function(e){return t.some(function(t){return t.id===e})}))},Oa=function(e){var t=e.snippets,n=e.actions,r=e.doAction,i=e.extraTableNav,a=e.endTableNav,c=e.itemsPerPage,l=e.noItems,d=e.beforeGrid,p=s((0,o.useState)(function(){return new Set}),2),f=p[0],h=p[1],m=s((0,o.useState)(function(){return Number(u(ja))||1}),2),b=m[0],v=m[1],y=function(e){var t=e.snippets,n=e.itemsPerPage,r=e.currentPage,s=n?Math.ceil(t.length/n):0,i=s?Math.min(r,s):1,a=(0,o.useMemo)(function(){return n?t.slice((i-1)*n,i*n):t},[t,n,i]);return{totalPages:s,safePage:i,visibleSnippets:a}}({snippets:t,itemsPerPage:c,currentPage:b}),j=y.totalPages,w=y.safePage,x=y.visibleSnippets;return(0,g.jsx)("div",{className:"snippets-card-grid-container",children:(0,g.jsxs)(Ns,{totalItems:t.length,totalPages:0<j?j:void 0,currentPage:w,setCurrentPage:v,pageSearchParam:ja,selected:xa(f,x),setSelected:h,selectAllKeys:x.map(function(e){return e.id}),actions:n,doAction:r,extraTableNav:i,endTableNav:a,children:[d,(0,g.jsx)(wa,{snippets:x,noItems:l,selected:f,setSelected:h})]})})},_a=function(){var e=ui(),t=e.searchQuery,n=e.setSearchQuery;return(0,g.jsx)("search",{className:"snippets-search-area",children:(0,g.jsx)("form",{className:"search-box","aria-label":(0,i.__)("Search Snippets","code-snippets"),onSubmit:function(e){e.preventDefault()},children:(0,g.jsx)("input",{type:"search",id:"snippets_search",name:"s",value:null!=t?t:"","aria-label":(0,i.__)("Search Snippets:","code-snippets"),onChange:function(e){return n(e.target.value)},placeholder:(0,i.__)("Search snippets","code-snippets")})})})},Sa=function(){var e=ui(),t=e.searchQueryText,n=e.searchLineNumber,r=e.currentTag,s=e.setSearchQuery,o=e.setCurrentTag;return t||r?(0,g.jsxs)("p",{className:"snippets-search-subtitle",children:[(0,i.__)("Search results","code-snippets"),t&&(0,i.sprintf)((0,i.__)(" for “%s”","code-snippets"),t),n&&(0,i.sprintf)((0,i.__)(" on line “%d”","code-snippets"),n),r&&(0,i.sprintf)((0,i.__)(" in tag “%s”","code-snippets"),r)," ",(0,g.jsx)(rs,{small:!0,className:"clear-filters",onClick:function(){s(),o()},children:(0,i.__)("Clear Filters","code-snippets")})]}):null},Pa=[["all",(0,i.__)("All","code-snippets")],["active",(0,i.__)("Active","code-snippets")],["inactive",(0,i.__)("Inactive","code-snippets")],["recently_active",(0,i.__)("Recently Active","code-snippets")],["locked",(0,i.__)("Locked","code-snippets")],["unlocked",(0,i.__)("Unlocked","code-snippets")],["trashed",(0,i.__)("Trashed","code-snippets")]],Na=function(){var e=ui(),t=e.currentStatus,n=e.setCurrentStatus,r=mi().snippetsByStatus,a=Pa.filter(function(e){var t=s(e,1)[0];return r.has(t)&&("unlocked"!==t||r.has("locked"))});return(0,g.jsx)("ul",{className:"subsubsub",children:a.map(function(e){var a,c,l=s(e,2),u=l[0],d=l[1];return(0,g.jsx)(o.Fragment,{children:(0,g.jsx)("li",{className:u,children:(0,g.jsxs)("a",{href:f(window.location.href,{status:ai===u?void 0:u}),className:t===u?"current":void 0,"aria-current":t===u?"page":void 0,onClick:function(e){e.preventDefault(),n(u)},children:[d," ",(0,g.jsx)("span",{className:"count",children:(0,i.sprintf)((0,i._x)("(%d)","table view count","code-snippets"),null!==(a=null===(c=r.get(u))||void 0===c?void 0:c.length)&&void 0!==a?a:0)})]})})},u)})})},Ea=function(){var e=Kn().api,t=to().refreshSnippetsList;return"recently_active"===ui().currentStatus?(0,g.jsx)("div",{className:"alignleft actions",children:(0,g.jsx)(Zr,{secondary:!0,name:"clear-recent-list",text:(0,i.__)("Clear List","code-snippets"),onClick:function(n){n.preventDefault(),e.del(Mn.recentlyActive).then(t).catch(Gn)}})}):null},Ca=function(e){var t=e.visibleSnippets,n=ui(),r=n.currentTag,s=n.setCurrentTag,a=(0,o.useId)(),c=(0,o.useMemo)(function(){return t.reduce(function(e,t){return t.tags.forEach(function(t){return e.add(t)}),e},new Set)},[t]);return 0<c.size?(0,g.jsxs)("div",{className:"alignleft actions",children:[(0,g.jsx)("label",{htmlFor:a,className:"screen-reader-text",children:(0,i.__)("Filter snippets by tag","code-snippets")}),(0,g.jsxs)("select",{id:a,name:"tag",value:r,"aria-label":(0,i.__)("Filter snippets by tag","code-snippets"),onChange:function(e){return s(e.target.value)},children:[(0,g.jsx)("option",{value:"",children:(0,i.__)("All Tags","code-snippets")}),oe(c).map(function(e){return(0,g.jsx)("option",{value:e,children:e},e)})]})]}):null},ka=function(e){var t=e.which,n=e.visibleSnippets;return(0,g.jsxs)(g.Fragment,{children:["top"===t&&(0,g.jsx)(Ca,{visibleSnippets:n}),(0,g.jsx)(Ea,{}),"top"===t&&(0,g.jsx)(_a,{})]})},Da=function(){return(0,g.jsx)("div",{className:"snippets-table-toolbar",children:(0,g.jsx)(Na,{})})};function Aa(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ra(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)?Ra(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Ra(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 Ta,Ia,La,Fa=[{key:"activate",label:(0,i.__)("Activate","code-snippets")},{key:"deactivate",label:(0,i.__)("Deactivate","code-snippets")},{key:"clone",label:(0,i.__)("Clone","code-snippets")},{key:"export",label:(0,i.__)("Export","code-snippets")},{key:"download",label:(0,i.__)("Download","code-snippets")},{key:"trash",label:(0,i.__)("Trash","code-snippets")}],Ma=[{key:"restore",label:(0,i.__)("Restore","code-snippets")},{key:"delete",label:(0,i.__)("Delete Permanently","code-snippets")}],Ua=function(e){var t,n;if(0===e.length)return Promise.resolve();var r=document.createElement("form"),s=function(e,t){var n=document.createElement("input");n.type="hidden",n.name=e,n.value=t,r.appendChild(n)};return r.method="post",r.action=window.location.href,r.hidden=!0,s("code_snippets_action","bulk-download"),s("code_snippets_bulk_download_nonce",null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.bulkDownloadNonce)&&void 0!==t?t:""),s("snippets",JSON.stringify(e.map(function(e){return{id:e.id,network:e.network}}))),document.body.appendChild(r),r.submit(),window.setTimeout(function(){r.remove()},0),Promise.resolve()},Ba=function(e){return e.reduce(function(e,t){return e.then(function(){return new Promise(function(e){Ua([t]),window.setTimeout(e,200)})})},Promise.resolve())},Va=function(){var e=ae(le().mark(function e(t,n,r){var s,o,i;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(0<t.length)){e.next=20;break}s=Aa(t),e.prev=2,s.s();case 4:if((o=s.n()).done){e.next=10;break}return i=o.value,e.next=8,n(i).catch(Gn);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),s.e(e.t0);case 15:return e.prev=15,s.f(),e.finish(15);case 18:return e.next=20,r();case 20:case"end":return e.stop()}},e,null,[[2,12,15,18]])}));return function(t,n,r){return e.apply(this,arguments)}}(),qa=function(){var e,t=ui(),n=t.currentType,r=t.currentTag,s=t.searchQuery,o=n?(0,i.__)("You don't have snippets of this type yet.","code-snippets"):(0,i.__)("You don't have any snippets yet.","code-snippets");return s||r?(0,g.jsxs)(g.Fragment,{children:[(0,i.__)("No snippets were found matching the current search query.","code-snippets"),(0,i.__)(' Please enter a new query or use the "Clear Filters" button above.',"code-snippets")]}):(0,g.jsxs)(g.Fragment,{children:[o," ",(0,g.jsx)("a",{href:f(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.addNew,{type:n}),children:(0,i.__)("Add a new snippet.","code-snippets")})]})},Wa=function(e){var t,n=e.snippetView,r=e.setSnippetView,s=e.snippets,i=e.actions,a=e.doAction,c=e.extraTableNav,l=e.hiddenColumns,u=e.truncateRowValues,d=mi().activeByCondition,p=(0,o.useMemo)(function(){return function(e){return ua.map(function(t){return ea(ea({},t),{},{isHidden:e.has(t.id)})})}(l)},[l]),f=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.snippetsPerPage,h=f&&Math.ceil(s.length/f),m=function(e){return"top"===e?(0,g.jsx)(Is,{snippetView:n,setSnippetView:r}):null};return"card"===n?(0,g.jsx)(Oa,{snippets:s,actions:i,doAction:a,itemsPerPage:f,extraTableNav:c,endTableNav:m,noItems:(0,g.jsx)(qa,{}),beforeGrid:(0,g.jsx)(Sa,{})}):(0,g.jsx)(Di,{items:s,getKey:function(e){return e.id},initialSort:Ka(),className:v()({"truncate-row-values":u}),columns:p,actions:i,doAction:a,totalPages:h,extraTableNav:c,selectAllControl:!0,endTableNav:m,rowClassName:function(e){return function(e,t){return v()("snippet","snippet ".concat(Gr(e,t)?"active":"inactive","-snippet"),"".concat(Br(e),"-snippet"),"".concat(e.scope,"-snippet"),{"trashed-snippet":e.trashed})}(e,d)},noItems:(0,g.jsx)(qa,{}),beforeTable:(0,g.jsx)(Sa,{})})},Ha={"priority-asc":{columnId:"priority",direction:"asc"},"name-asc":{columnId:"name",direction:"asc"},"name-desc":{columnId:"name",direction:"desc"},"modified-desc":{columnId:"date",direction:"desc"},"modified-asc":{columnId:"date",direction:"asc"}},Ka=function(){var e,t,n;return null!==(e=Ha[null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.listOrder)&&void 0!==t?t:""])&&void 0!==e?e:void 0},za=function(e){var t,n,r,i=e.snippetView,a=e.setSnippetView,c=mi().snippetsByStatus,l=ui(),u=l.currentStatus,d=l.setCurrentStatus,p=function(){var e=(0,o.useState)(function(){var e,t;return new Set(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.hiddenColumns)&&void 0!==e?e:[])}),t=s(e,2),n=t[0],r=t[1],i=(0,o.useState)(function(){var e,t;return 0!==Number(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.truncateRowValues)&&void 0!==e?e:1)}),a=s(i,2),c=a[0],l=a[1];return(0,o.useEffect)(function(){var e=document.getElementById("adv-settings");if(e){var t=function(){var t,n;r(new Set(Array.from(e.querySelectorAll(".hide-column-tog:not(:checked)")).map(function(e){return e.value}))),l(null===(t=null===(n=e.querySelector("#snippets-table-truncate-row-values"))||void 0===n?void 0:n.checked)||void 0===t||t)};return t(),e.addEventListener("change",t),function(){e.removeEventListener("change",t)}}},[]),{hiddenColumns:n,truncateRowValues:c}}(),f=p.hiddenColumns,h=p.truncateRowValues,m=(0,o.useMemo)(function(){var e;return null!==(e=c.get(u))&&void 0!==e?e:[]},[c,u]),b=(t=m,n=Xs(),r=to().refreshSnippetsList,function(){var e=ae(le().mark(function e(s,o){var i,a;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=s,e.next="activate"===e.t0?3:"deactivate"===e.t0?6:"clone"===e.t0?9:"export"===e.t0?12:"download"===e.t0?14:"trash"===e.t0||"delete"===e.t0?16:void 0===e.t0?19:20;break;case 3:return e.next=5,Va(t.filter(function(e){return o.has(e.id)&&!e.active}),function(e){return n.activate({id:e.id,network:e.network})},r);case 5:case 8:case 11:case 18:case 19:return e.abrupt("break",20);case 6:return e.next=8,Va(t.filter(function(e){return o.has(e.id)&&e.active}),function(e){return n.deactivate({id:e.id,network:e.network})},r);case 9:return e.next=11,Va(t.filter(function(e){return o.has(e.id)&&!e.trashed}),function(e){return n.create(Ur(e))},r);case 12:return lo(t.filter(function(e){return o.has(e.id)})),e.abrupt("break",20);case 14:return a=t.filter(function(e){return o.has(e.id)}),e.abrupt("return",1<a.length&&(null===(i=window.CODE_SNIPPETS_MANAGE)||void 0===i||!i.supportsZipDownloads)?Ba(a):Ua(a));case 16:return e.next=18,Va(t.filter(function(e){return o.has(e.id)}),function(e){return n.delete({id:e.id,network:e.network})},r);case 20:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}());return(0,o.useEffect)(function(){ai===u||c.has(u)||d(ai)},[u,d,c]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Da,{}),(0,g.jsx)("div",{className:"snippets-list-view",children:(0,g.jsx)(Wa,{snippetView:i,setSnippetView:a,snippets:m,actions:"trashed"===u?Ma:Fa,doAction:b,extraTableNav:function(e){var t;return(0,g.jsx)(ka,{which:e,visibleSnippets:null!==(t=c.get("all"))&&void 0!==t?t:[]})},hiddenColumns:f,truncateRowValues:h})})]})},Ga=function(e){var t=e.type,n=e.count,r=ui(),s=r.currentType,o=r.setCurrentType,a=null!=t?t:"all",c=t===s,l=t&&zr(t)&&!N();return(0,g.jsx)("li",{children:(0,g.jsxs)("a",{href:f(window.location.href,{type:a}),className:v()("snippet-type-link","".concat(a,"-type-link"),{"active-type":c,"pro-locked-type":l&&!c}),"aria-current":c?"page":void 0,onClick:function(e){e.preventDefault(),o(t)},children:[t&&(0,g.jsx)(Fs,{name:t}),(0,g.jsx)("span",{className:v()("".concat(a,"-label"),"snippet-type-name"),children:t?Fr[t]:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"snippet-type-name-full",children:(0,i.__)("All Snippets","code-snippets")}),(0,g.jsx)("span",{className:"snippet-type-name-short",children:(0,i.__)("All","code-snippets")})]})}),n&&!l&&(0,g.jsx)("span",{className:"subnav-count",children:n}),l&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})})},$a=function(){var e;return null!==(e=window.CODE_SNIPPETS_MANAGE)&&void 0!==e&&e.isSafeModeActive?(0,g.jsx)(_,{type:"error",children:(0,g.jsxs)("p",{children:[(0,g.jsx)("strong",{children:(0,i.__)("Warning:","code-snippets")}),"\n",(0,i.__)("Safe mode is active and snippets will not execute!","code-snippets"),"\n",(0,a.createInterpolateElement)((0,i.__)("Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-config.php</code> file to turn off safe mode.","code-snippets"),{code:(0,g.jsx)("code",{})}),"\n",(0,g.jsx)("a",{href:"https://codesnippets.pro/doc/safe-mode",target:"_blank",rel:"noreferrer",children:(0,i.__)("Read more","code-snippets")})]})}):null},Ja=function(){var e=$n(),t=e.snippetView,n=e.setSnippetView,r=ui().currentType,s=function(){var e,t=to().snippetsList,n=(0,o.useMemo)(function(){return null==t?void 0:t.filter(function(e){return!e.trashed})},[t]),r=(0,o.useMemo)(function(){return null==n?void 0:n.reduce(function(e,t){var n,r=Br(t);return e.set(r,(null!==(n=e.get(r))&&void 0!==n?n:0)+1)},new Map)},[n]),s=null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e?void 0:e.typeCounts;return{getCount:(0,o.useCallback)(function(e){var t;return n?e?null!==(t=null==r?void 0:r.get(e))&&void 0!==t?t:0:n.length:null==s?void 0:s[null!=e?e:"all"]},[n,r,s])}}(),a=s.getCount,c=Zn(),l=c.atStart,u=c.atEnd,d=c.scrollRef;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:v()("snippet-type-nav-wrapper",{"has-scroll-start":!l,"has-scroll-end":!u}),children:(0,g.jsx)("nav",{ref:d,className:"snippet-type-nav","aria-label":(0,i.__)("Snippet types","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(Ga,{count:a()}),Nr.map(function(e){return(0,g.jsx)(Ga,{type:e,count:a(e)},e)})]})})}),(0,g.jsx)(Qn,{}),(0,g.jsxs)("div",{className:"snippets-page-header",children:[(0,g.jsx)("h1",{children:(0,i.sprintf)((0,i.__)("Local Snippets: %s","code-snippets"),r?Fr[r]:(0,i.__)("All Snippets","code-snippets"))}),(0,g.jsx)("a",{href:qr(r),className:"button button-primary",children:(0,i.__)("Add Snippet","code-snippets")})]}),(0,g.jsx)("hr",{className:"wp-header-end"}),(0,g.jsx)($a,{}),r&&!N()&&zr(r)?(0,g.jsx)(G,{}):(0,g.jsx)(bi,{children:(0,g.jsx)(za,{snippetView:t,setSnippetView:n})})]})},Qa=function(){return(0,g.jsx)(zn,{children:(0,g.jsx)(Ys,{children:(0,g.jsx)(no,{children:(0,g.jsx)(di,{children:(0,g.jsx)(Ja,{})})})})})},Xa=function(){var e=s((0,o.useState)(function(){var e=u("result");return d({result:void 0}),e&&function(e){if("deleted"===e)return(0,i.__)("Snippet <strong>deleted</strong>.","code-snippets")}(e)}),2),t=e[0],n=e[1];return t?(0,g.jsx)(S,{className:"code-snippets-notice",onDismiss:function(){n(void 0)},type:"success",children:(0,g.jsx)("p",{children:(0,a.createInterpolateElement)(t,{strong:(0,g.jsx)("strong",{})})})}):null},Ya=function(e){switch(e.subpage){case"snippets":return(0,g.jsx)(Qa,{});case"cloud-community":return(0,g.jsx)(ri,{});case"blueprints":case"cloud-library":return(0,g.jsx)(G,{})}};Ta="manage-snippets-container",Ia=function(){var e=(0,o.useMemo)(function(){var e,t,n;return null!==(t=Q,e=(n=u("subpage"))&&function(e){return t.includes(e)}(n)?n:void 0)&&void 0!==e?e:Q[0]},[]);return(0,o.useEffect)(function(){var t,n,r,s;"snippets"===e&&(r=null==(n=document.getElementById("adv-settings"))?void 0:n.querySelector("fieldset.table-options-prefs"),s=Array.from(null!==(t=null==n?void 0:n.querySelectorAll("fieldset.metabox-prefs"))&&void 0!==t?t:[]).find(function(e){return!e.classList.contains("table-options-prefs")}),n&&r&&s&&n.insertBefore(r,s))},[e]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(se,{}),(0,g.jsx)(Xa,{}),(0,g.jsx)(Ya,{subpage:e})]})},(La=document.getElementById(Ta))?(0,_n.createRoot)(La).render((0,g.jsx)(Ia,{})):console.error("Could not find element #".concat(Ta,"."))})()})();