=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,i=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw i}}}}(t.querySelectorAll(".nav-tab"));try{var n=function(){var r=e.value;r.addEventListener("click",(function(e){e.preventDefault();var n=r.getAttribute("data-section");n&&(function(t,e,r){var n,o;null===(n=t.querySelector(".nav-tab-active"))||void 0===n||n.classList.remove("nav-tab-active"),e.classList.add("nav-tab-active"),null===(o=t.closest(".wrap"))||void 0===o||o.setAttribute("data-active-tab",r)}(t,r,n),function(t){var e;"editor"===t&&(null===(e=window.code_snippets_editor_preview)||void 0===e||e.codemirror.refresh())}(n),function(t){var e=document.querySelector("input[name=_wp_http_referer]");if(e){var r=e.value.replace(c(/([&?]section=)[^&]+/,{base:1}),"$1".concat(t));e.value=r+(r===e.value?"§ion=".concat(t):"")}else console.error("could not find http referer")}(n))}))};for(r.s();!(e=r.n()).done;)n()}catch(t){r.e(t)}finally{r.f()}}else console.error("Could not find snippets tabs")}(),function(){var t,e=function(){var t=window.wp.codeEditor,e=document.getElementById("code_snippets_editor_preview");if(e)return window.code_snippets_editor_preview=t.initialize(e),window.code_snippets_editor_preview.codemirror;console.error("Could not initialise CodeMirror on textarea.",e)}(),r=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(window.code_snippets_editor_settings);try{var n=function(){var r=t.value,n=document.querySelector('[name="code_snippets_settings[editor]['.concat(r.name,']"]'));null==n||n.addEventListener("change",(function(){var t=r.codemirror,o=function(){switch(r.type){case"select":return(t=n).options[t.selectedIndex].value;case"checkbox":return n.checked;case"number":return parseInt(n.value,10);default:return null}var t}();if(null!==o)if("font_size"===r.name){var i=document.querySelector(".CodeMirror-code");i&&i instanceof HTMLElement&&(i.style.fontSize="".concat(o,"px"))}else null==e||e.setOption(t,o)}))};for(r.s();!(t=r.n()).done;)n()}catch(t){r.e(t)}finally{r.f()}}(),p=null!==(s=window.code_snippets_version_switch)&&void 0!==s?s:{},d=(null!==(l=null===(f=document.querySelector(".current-version"))||void 0===f?void 0:f.textContent)&&void 0!==l?l:"").trim(),h=x("switch-version-btn"),v=x("target_version"),y=x("version-switch-result"),m=x("refresh-versions-btn"),v&&function(t,e,r){t.addEventListener("change",(function(){var n=t.value;if(e)if(n&&n!==r){e.disabled=!1;var o=x("version-switch-warning");o&&o.setAttribute("style","")}else{e.disabled=!0;var i=x("version-switch-warning");i&&i.setAttribute("style","display: none;")}}))}(v,h,d),h&&v&&y&&function(t,e,r,n,o){t.addEventListener("click",(function(){(0,g.A)(b().mark((function i(){var a,c,u,s,l,f,p,d,h;return b().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if((c=e.value)&&c!==o){i.next=6;break}return r.className="notice notice-warning",r.innerHTML="".concat(_("selectDifferent","Please select a different version to switch to."),"
"),r.style.display="",i.abrupt("return");case 6:return t.disabled=!0,u=null!==(a=t.textContent)&&void 0!==a?a:"",t.textContent=_("switching","Switching..."),r.className="notice notice-info",r.innerHTML="".concat(_("processing","Processing version switch. Please wait..."),"
"),r.style.display="",i.prev=12,i.next=15,L({action:"code_snippets_switch_version",target_version:c,nonce:null!==(s=n.nonce_switch)&&void 0!==s?s:""},n);case 15:if(!(p=i.sent).success){i.next=21;break}return r.className="notice notice-success",r.innerHTML="".concat(null!==(d=null===(h=p.data)||void 0===h?void 0:h.message)&&void 0!==d?d:"","
"),setTimeout((function(){return window.location.reload()}),3e3),i.abrupt("return");case 21:r.className="notice notice-error",r.innerHTML="".concat(null!==(l=null===(f=p.data)||void 0===f?void 0:f.message)&&void 0!==l?l:_("error","An error occurred."),"
"),t.disabled=!1,t.textContent=u,i.next=33;break;case 27:i.prev=27,i.t0=i.catch(12),r.className="notice notice-error",r.innerHTML="".concat(_("errorSwitch","An error occurred while switching versions. Please try again."),"
"),t.disabled=!1,t.textContent=u;case 33:case"end":return i.stop()}}),i,null,[[12,27]])})))()}))}(h,v,y,p,d),m&&function(t,e){t.addEventListener("click",(function(){(0,g.A)(b().mark((function r(){var n,o,i;return b().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=null!==(n=t.textContent)&&void 0!==n?n:"",t.disabled=!0,t.textContent=_("refreshing","Refreshing..."),r.prev=3,r.next=6,L({action:"code_snippets_refresh_versions",nonce:null!==(i=e.nonce_refresh)&&void 0!==i?i:""},e);case 6:t.textContent=_("refreshed","Refreshed!"),setTimeout((function(){t.disabled=!1,t.textContent=o,window.location.reload()}),1e3),r.next=14;break;case 10:r.prev=10,r.t0=r.catch(3),t.disabled=!1,t.textContent=o;case 14:case"end":return r.stop()}}),r,null,[[3,10]])})))()}))}(m,p)},4633:(t,e,r)=>{var n=r(3738).default;function o(){"use strict";t.exports=o=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},i=Object.prototype,a=i.hasOwnProperty,c=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,r){return t[e]=r}}function d(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),a=new M(n||[]);return c(i,"_invoke",{value:O(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=d;var v="suspendedStart",y="suspendedYield",m="executing",g="completed",w={};function b(){}function x(){}function _(){}var L={};p(L,s,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(I([])));S&&S!==i&&a.call(S,s)&&(L=S);var A=_.prototype=b.prototype=Object.create(L);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,c,u){var s=h(t[o],t,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(f).then((function(t){l.value=t,c(l)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;c(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function O(t,r,n){var o=v;return function(i,a){if(o===m)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=T(c,n);if(u){if(u===w)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var s=h(t,r,n);if("normal"===s.type){if(o=n.done?g:y,s.arg===w)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=g,n.method="throw",n.arg=s.arg)}}}function T(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),w;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,w;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,w):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,w)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),w}},r}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},3738:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},4756:(t,e,r)=>{var n=r(4633)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},467:(t,e,r)=>{"use strict";function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}r.d(e,{A:()=>o})},5501:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(3662);function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&(0,n.A)(t,e)}},3662:(t,e,r)=>{"use strict";function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}r.d(e,{A:()=>n})}},t=>{t(t.s=2065)}]);