// source --> https://bbasesores.com/wp-includes/js/dist/keycodes.min.js?ver=34c8fb5e7a594a1c8037 
/*! This file is auto-generated */
(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ALT:()=>S,BACKSPACE:()=>n,COMMAND:()=>A,CTRL:()=>E,DELETE:()=>m,DOWN:()=>C,END:()=>f,ENTER:()=>l,ESCAPE:()=>a,F10:()=>w,HOME:()=>u,LEFT:()=>p,PAGEDOWN:()=>d,PAGEUP:()=>s,RIGHT:()=>h,SHIFT:()=>O,SPACE:()=>c,TAB:()=>i,UP:()=>y,ZERO:()=>P,displayShortcut:()=>j,displayShortcutList:()=>_,isAppleOS:()=>o,isKeyboardEvent:()=>v,modifiers:()=>T,rawShortcut:()=>L,shortcutAriaLabel:()=>k});const r=window.wp.i18n;function o(e){if(!e){if("undefined"==typeof window)return!1;e=window}const{platform:t}=e.navigator;return-1!==t.indexOf("Mac")||["iPad","iPhone"].includes(t)}const n=8,i=9,l=13,a=27,c=32,s=33,d=34,f=35,u=36,p=37,y=38,h=39,C=40,m=46,w=121,S="alt",E="ctrl",A="meta",O="shift",P=48;function b(e){return e.length<2?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}function g(e,t){return Object.fromEntries(Object.entries(e).map((([e,r])=>[e,t(r)])))}const T={primary:e=>e()?[A]:[E],primaryShift:e=>e()?[O,A]:[E,O],primaryAlt:e=>e()?[S,A]:[E,S],secondary:e=>e()?[O,S,A]:[E,O,S],access:e=>e()?[E,S]:[O,S],ctrl:()=>[E],alt:()=>[S],ctrlShift:()=>[E,O],shift:()=>[O],shiftAlt:()=>[O,S],undefined:()=>[]},L=g(T,(e=>(t,r=o)=>[...e(r),t.toLowerCase()].join("+"))),_=g(T,(e=>(t,r=o)=>{const n=r(),i={[S]:n?"⌥":"Alt",[E]:n?"⌃":"Ctrl",[A]:"⌘",[O]:n?"⇧":"Shift"};return[...e(r).reduce(((e,t)=>{const r=i[t]??t;return n?[...e,r]:[...e,r,"+"]}),[]),b(t)]})),j=g(_,(e=>(t,r=o)=>e(t,r).join(""))),k=g(T,(e=>(t,n=o)=>{const i=n(),l={[O]:"Shift",[A]:i?"Command":"Control",[E]:"Control",[S]:i?"Option":"Alt",",":(0,r.__)("Comma"),".":(0,r.__)("Period"),"`":(0,r.__)("Backtick"),"~":(0,r.__)("Tilde")};return[...e(n),t].map((e=>b(l[e]??e))).join(i?" ":" + ")}));const v=g(T,(e=>(t,r,n=o)=>{const i=e(n),l=function(e){return[S,E,A,O].filter((t=>e[`${t}Key`]))}(t),a={Comma:",",Backslash:"\\",IntlRo:"\\",IntlYen:"\\"},c=i.filter((e=>!l.includes(e))),s=l.filter((e=>!i.includes(e)));if(c.length>0||s.length>0)return!1;let d=t.key.toLowerCase();return r?(t.altKey&&1===r.length&&(d=String.fromCharCode(t.keyCode).toLowerCase()),t.shiftKey&&1===r.length&&a[t.code]&&(d=a[t.code]),"del"===r&&(r="delete"),d===r.toLowerCase()):i.includes(d)}));(window.wp=window.wp||{}).keycodes=t})();
// source --> https://bbasesores.com/wp-includes/js/dist/priority-queue.min.js?ver=2d59d091223ee9a33838 
/*! This file is auto-generated */
(()=>{var e={5033:(e,t,n)=>{var o,r,i;r=[],void 0===(i="function"==typeof(o=function(){"use strict";var e,t,o,r,i="undefined"!=typeof window?window:null!=typeof n.g?n.g:this||{},u=i.cancelRequestAnimationFrame&&i.requestAnimationFrame||setTimeout,a=i.cancelRequestAnimationFrame||clearTimeout,c=[],l=0,s=!1,d=7,f=35,m=125,b=0,p=0,v=0,w={get didTimeout(){return!1},timeRemaining:function(){var e=d-(Date.now()-p);return e<0?0:e}},y=g((function(){d=22,m=66,f=0}));function g(e){var t,n,o=99,r=function(){var i=Date.now()-n;i<o?t=setTimeout(r,o-i):(t=null,e())};return function(){n=Date.now(),t||(t=setTimeout(r,o))}}function h(){s&&(r&&a(r),o&&clearTimeout(o),s=!1)}function k(){125!=m&&(d=7,m=125,f=35,s&&(h(),C())),y()}function T(){r=null,o=setTimeout(D,0)}function q(){o=null,u(T)}function C(){s||(t=m-(Date.now()-p),e=Date.now(),s=!0,f&&t<f&&(t=f),t>9?o=setTimeout(q,t):(t=0,q()))}function D(){var n,r,i,u=d>9?9:1;if(p=Date.now(),s=!1,o=null,l>2||p-t-50<e)for(r=0,i=c.length;r<i&&w.timeRemaining()>u;r++)n=c.shift(),v++,n&&n(w);c.length?C():l=0}function I(e){return b++,c.push(e),C(),b}function O(e){var t=e-1-v;c[t]&&(c[t]=null)}if(i.requestIdleCallback&&i.cancelIdleCallback)try{i.requestIdleCallback((function(){}),{timeout:0})}catch(e){!function(e){var t,n;if(i.requestIdleCallback=function(t,n){return n&&"number"==typeof n.timeout?e(t,n.timeout):e(t)},i.IdleCallbackDeadline&&(t=IdleCallbackDeadline.prototype)){if(!(n=Object.getOwnPropertyDescriptor(t,"timeRemaining"))||!n.configurable||!n.get)return;Object.defineProperty(t,"timeRemaining",{value:function(){return n.get.call(this)},enumerable:!0,configurable:!0})}}(i.requestIdleCallback)}else i.requestIdleCallback=I,i.cancelIdleCallback=O,i.document&&document.addEventListener&&(i.addEventListener("scroll",k,!0),i.addEventListener("resize",k),document.addEventListener("focus",k,!0),document.addEventListener("mouseover",k,!0),["click","keypress","touchstart","mousedown"].forEach((function(e){document.addEventListener(e,k,{capture:!0,passive:!0})})),i.MutationObserver&&new MutationObserver(k).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));return{request:I,cancel:O}})?o.apply(t,r):o)||(e.exports=i)}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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})};var o={};(()=>{"use strict";n.r(o),n.d(o,{createQueue:()=>t});n(5033);var e="undefined"==typeof window?e=>{setTimeout((()=>e(Date.now())),0)}:window.requestIdleCallback;const t=()=>{const t=new Map;let n=!1;const o=r=>{for(const[e,n]of t)if(t.delete(e),n(),"number"==typeof r||r.timeRemaining()<=0)break;0!==t.size?e(o):n=!1};return{add:(r,i)=>{t.set(r,i),n||(n=!0,e(o))},flush:e=>{const n=t.get(e);return void 0!==n&&(t.delete(e),n(),!0)},cancel:e=>t.delete(e),reset:()=>{t.clear(),n=!1}}}})(),(window.wp=window.wp||{}).priorityQueue=o})();
// source --> https://bbasesores.com/wp-includes/js/dist/compose.min.js?ver=7a9b375d8c19cf9d3d9b 
/*! This file is auto-generated */
(()=>{var e={1933:(e,t,n)=>{var r;!function(o,i){if(o){for(var u,c={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},s={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},l={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},f=1;f<20;++f)c[111+f]="f"+f;for(f=0;f<=9;++f)c[f+96]=f.toString();g.prototype.bind=function(e,t,n){var r=this;return e=e instanceof Array?e:[e],r._bindMultiple.call(r,e,t,n),r},g.prototype.unbind=function(e,t){return this.bind.call(this,e,(function(){}),t)},g.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},g.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},g.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(y(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var n=e.composedPath()[0];n!==e.target&&(t=n)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},g.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},g.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(c[t]=e[t]);u=null},g.init=function(){var e=g(i);for(var t in e)"_"!==t.charAt(0)&&(g[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},g.init(),o.Mousetrap=g,e.exports&&(e.exports=g),void 0===(r=function(){return g}.call(t,n,t,e))||(e.exports=r)}function d(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function p(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return c[e.which]?c[e.which]:s[e.which]?s[e.which]:String.fromCharCode(e.which).toLowerCase()}function h(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function v(e,t,n){return n||(n=function(){if(!u)for(var e in u={},c)e>95&&e<112||c.hasOwnProperty(e)&&(u[c[e]]=e);return u}()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function m(e,t){var n,r,o,i=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),o=0;o<n.length;++o)r=n[o],l[r]&&(r=l[r]),t&&"keypress"!=t&&a[r]&&(r=a[r],i.push("shift")),h(r)&&i.push(r);return{key:r,modifiers:i,action:t=v(r,i,t)}}function y(e,t){return null!==e&&e!==i&&(e===t||y(e.parentNode,t))}function g(e){var t=this;if(e=e||i,!(t instanceof g))return new g(e);t.target=e,t._callbacks={},t._directMap={};var n,r={},o=!1,u=!1,c=!1;function s(e){e=e||{};var t,n=!1;for(t in r)e[t]?n=!0:r[t]=0;n||(c=!1)}function a(e,n,o,i,u,c){var s,a,l,f,d=[],p=o.type;if(!t._callbacks[e])return[];for("keyup"==p&&h(e)&&(n=[e]),s=0;s<t._callbacks[e].length;++s)if(a=t._callbacks[e][s],(i||!a.seq||r[a.seq]==a.level)&&p==a.action&&("keypress"==p&&!o.metaKey&&!o.ctrlKey||(l=n,f=a.modifiers,l.sort().join(",")===f.sort().join(",")))){var v=!i&&a.combo==u,m=i&&a.seq==i&&a.level==c;(v||m)&&t._callbacks[e].splice(s,1),d.push(a)}return d}function l(e,n,r,o){t.stopCallback(n,n.target||n.srcElement,r,o)||!1===e(n,r)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(n),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(n))}function f(e){"number"!=typeof e.which&&(e.which=e.keyCode);var n=p(e);n&&("keyup"!=e.type||o!==n?t.handleKey(n,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):o=!1)}function v(e,t,i,u){function a(t){return function(){c=t,++r[e],clearTimeout(n),n=setTimeout(s,1e3)}}function f(t){l(i,t,e),"keyup"!==u&&(o=p(t)),setTimeout(s,10)}r[e]=0;for(var d=0;d<t.length;++d){var h=d+1===t.length?f:a(u||m(t[d+1]).action);y(t[d],h,u,e,d)}}function y(e,n,r,o,i){t._directMap[e+":"+r]=n;var u,c=(e=e.replace(/\s+/g," ")).split(" ");c.length>1?v(e,c,n,r):(u=m(e,r),t._callbacks[u.key]=t._callbacks[u.key]||[],a(u.key,u.modifiers,{type:u.action},o,e,i),t._callbacks[u.key][o?"unshift":"push"]({callback:n,modifiers:u.modifiers,action:u.action,seq:o,level:i,combo:e}))}t._handleKey=function(e,t,n){var r,o=a(e,t,n),i={},f=0,d=!1;for(r=0;r<o.length;++r)o[r].seq&&(f=Math.max(f,o[r].level));for(r=0;r<o.length;++r)if(o[r].seq){if(o[r].level!=f)continue;d=!0,i[o[r].seq]=1,l(o[r].callback,n,o[r].combo,o[r].seq)}else d||l(o[r].callback,n,o[r].combo);var p="keypress"==n.type&&u;n.type!=c||h(e)||p||s(i),u=d&&"keydown"==n.type},t._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)y(e[r],t,n)},d(e,"keypress",f),d(e,"keydown",f),d(e,"keyup",f)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)},3758:function(e){
/*!
 * clipboard.js v2.0.11
 * https://clipboardjs.com/
 *
 * Licensed MIT © Zeno Rocha
 */
var t;t=function(){return function(){var e={686:function(e,t,n){"use strict";n.d(t,{default:function(){return S}});var r=n(279),o=n.n(r),i=n(370),u=n.n(i),c=n(817),s=n.n(c);function a(e){try{return document.execCommand(e)}catch(e){return!1}}var l=function(e){var t=s()(e);return a("cut"),t},f=function(e,t){var n=function(e){var t="rtl"===document.documentElement.getAttribute("dir"),n=document.createElement("textarea");n.style.fontSize="12pt",n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";var r=window.pageYOffset||document.documentElement.scrollTop;return n.style.top="".concat(r,"px"),n.setAttribute("readonly",""),n.value=e,n}(e);t.container.appendChild(n);var r=s()(n);return a("copy"),n.remove(),r},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof e?n=f(e,t):e instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==e?void 0:e.type)?n=f(e.value,t):(n=s()(e),a("copy")),n};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}var h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.action,n=void 0===t?"copy":t,r=e.container,o=e.target,i=e.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==o){if(!o||"object"!==p(o)||1!==o.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&o.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(o.hasAttribute("readonly")||o.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return i?d(i,{container:r}):o?"cut"===n?l(o):d(o,{container:r}):void 0};function v(e){return v="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},v(e)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r,o,i=b(e);if(t){var u=b(this).constructor;n=Reflect.construct(i,arguments,u)}else n=i.apply(this,arguments);return r=this,!(o=n)||"object"!==v(o)&&"function"!=typeof o?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r):o}}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function w(e,t){var n="data-clipboard-".concat(e);if(t.hasAttribute(n))return t.getAttribute(n)}var E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(i,e);var t,n,r,o=g(i);function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=o.call(this)).resolveOptions(t),n.listenClick(e),n}return t=i,n=[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===v(e.container)?e.container:document.body}},{key:"listenClick",value:function(e){var t=this;this.listener=u()(e,"click",(function(e){return t.onClick(e)}))}},{key:"onClick",value:function(e){var t=e.delegateTarget||e.currentTarget,n=this.action(t)||"copy",r=h({action:n,container:this.container,target:this.target(t),text:this.text(t)});this.emit(r?"success":"error",{action:n,text:r,trigger:t,clearSelection:function(){t&&t.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(e){return w("action",e)}},{key:"defaultTarget",value:function(e){var t=w("target",e);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(e){return w("text",e)}},{key:"destroy",value:function(){this.listener.destroy()}}],r=[{key:"copy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return d(e,t)}},{key:"cut",value:function(e){return l(e)}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof e?[e]:e,n=!!document.queryCommandSupported;return t.forEach((function(e){n=n&&!!document.queryCommandSupported(e)})),n}}],n&&m(t.prototype,n),r&&m(t,r),i}(o()),S=E},828:function(e){if("undefined"!=typeof Element&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}e.exports=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}}},438:function(e,t,n){var r=n(828);function o(e,t,n,r,o){var u=i.apply(this,arguments);return e.addEventListener(n,u,o),{destroy:function(){e.removeEventListener(n,u,o)}}}function i(e,t,n,o){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&o.call(e,n)}}e.exports=function(e,t,n,r,i){return"function"==typeof e.addEventListener?o.apply(null,arguments):"function"==typeof n?o.bind(null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),Array.prototype.map.call(e,(function(e){return o(e,t,n,r,i)})))}},879:function(e,t){t.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},t.nodeList=function(e){var n=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in e&&(0===e.length||t.node(e[0]))},t.string=function(e){return"string"==typeof e||e instanceof String},t.fn=function(e){return"[object Function]"===Object.prototype.toString.call(e)}},370:function(e,t,n){var r=n(879),o=n(438);e.exports=function(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!r.string(t))throw new TypeError("Second argument must be a String");if(!r.fn(n))throw new TypeError("Third argument must be a Function");if(r.node(e))return function(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}(e,t,n);if(r.nodeList(e))return function(e,t,n){return Array.prototype.forEach.call(e,(function(e){e.addEventListener(t,n)})),{destroy:function(){Array.prototype.forEach.call(e,(function(e){e.removeEventListener(t,n)}))}}}(e,t,n);if(r.string(e))return function(e,t,n){return o(document.body,e,t,n)}(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}},817:function(e){e.exports=function(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var r=window.getSelection(),o=document.createRange();o.selectNodeContents(e),r.removeAllRanges(),r.addRange(o),t=r.toString()}return t}},279:function(e){function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function o(){r.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],o=[];if(r&&t)for(var i=0,u=r.length;i<u;i++)r[i].fn!==t&&r[i].fn._!==t&&o.push(r[i]);return o.length?n[e]=o:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}return n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(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.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n(686)}().default},e.exports=t()},5760:()=>{!function(e){if(e){var t={},n=e.prototype.stopCallback;e.prototype.stopCallback=function(e,r,o,i){return!!this.paused||!t[o]&&!t[i]&&n.call(this,e,r,o)},e.prototype.bindGlobal=function(e,n,r){if(this.bind(e,n,r),e instanceof Array)for(var o=0;o<e.length;o++)t[e[o]]=!0;else t[e]=!0},e.init()}}("undefined"!=typeof Mousetrap?Mousetrap:void 0)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.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.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})};var r={};(()=>{"use strict";n.r(r),n.d(r,{__experimentalUseDialog:()=>Z,__experimentalUseDragging:()=>J,__experimentalUseDropZone:()=>Ae,__experimentalUseFixedWindowList:()=>Ie,__experimentalUseFocusOutside:()=>F,compose:()=>m,createHigherOrderComponent:()=>a,debounce:()=>f,ifCondition:()=>g,observableMap:()=>p,pipe:()=>v,pure:()=>S,throttle:()=>d,useAsyncList:()=>Ce,useConstrainedTabbing:()=>P,useCopyOnClick:()=>z,useCopyToClipboard:()=>V,useDebounce:()=>Me,useDebouncedInput:()=>Oe,useDisabled:()=>Q,useEvent:()=>X,useFocusOnMount:()=>q,useFocusReturn:()=>H,useFocusableIframe:()=>je,useInstanceId:()=>D,useIsomorphicLayoutEffect:()=>Y,useKeyboardShortcut:()=>ne,useMediaQuery:()=>oe,useMergeRefs:()=>G,useObservableValue:()=>Ne,usePrevious:()=>ie,useReducedMotion:()=>ue,useRefEffect:()=>j,useResizeObserver:()=>ke,useStateWithHistory:()=>de,useThrottle:()=>_e,useViewportMatch:()=>ge,useWarnOnChange:()=>Le,withGlobalEvents:()=>L,withInstanceId:()=>M,withSafeTimeout:()=>O,withState:()=>_});var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function t(e){return e.toLowerCase()}var o=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],i=/[^A-Z0-9]+/gi;function u(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function c(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>="0"&&n<="9"?"_"+n+r:""+n.toUpperCase()+r}function s(n,r){return void 0===r&&(r={}),function(e,n){void 0===n&&(n={});for(var r=n.splitRegexp,c=void 0===r?o:r,s=n.stripRegexp,a=void 0===s?i:s,l=n.transform,f=void 0===l?t:l,d=n.delimiter,p=void 0===d?" ":d,h=u(u(e,c,"$1\0$2"),a,"\0"),v=0,m=h.length;"\0"===h.charAt(v);)v++;for(;"\0"===h.charAt(m-1);)m--;return h.slice(v,m).split("\0").map(f).join(p)}(n,e({delimiter:"",transform:c},r))}function a(e,t){return n=>{const r=e(n);return r.displayName=l(t,n),r}}const l=(e,t)=>{const n=t.displayName||t.name||"Component";return`${s(e??"")}(${n})`},f=(e,t,n)=>{let r,o,i,u,c,s=0,a=0,l=!1,f=!1,d=!0;function p(t){const n=r,u=o;return r=void 0,o=void 0,a=t,i=e.apply(u,n),i}function h(e,t){u=setTimeout(e,t)}function v(e){return e-(c||0)}function m(e){const n=v(e);return void 0===c||n>=t||n<0||f&&e-a>=s}function y(){const e=Date.now();if(m(e))return b(e);h(y,function(e){const n=v(e),r=e-a,o=t-n;return f?Math.min(o,s-r):o}(e))}function g(){u=void 0}function b(e){return g(),d&&r?p(e):(r=o=void 0,i)}function w(){return void 0!==u}function E(...e){const n=Date.now(),u=m(n);if(r=e,o=this,c=n,u){if(!w())return function(e){return a=e,h(y,t),l?p(e):i}(c);if(f)return h(y,t),p(c)}return w()||h(y,t),i}return n&&(l=!!n.leading,f="maxWait"in n,void 0!==n.maxWait&&(s=Math.max(n.maxWait,t)),d="trailing"in n?!!n.trailing:d),E.cancel=function(){void 0!==u&&clearTimeout(u),a=0,g(),r=c=o=void 0},E.flush=function(){return w()?b(Date.now()):i},E.pending=w,E},d=(e,t,n)=>{let r=!0,o=!0;return n&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),f(e,t,{leading:r,trailing:o,maxWait:t})};function p(){const e=new Map,t=new Map;function n(e){const n=t.get(e);if(n)for(const e of n)e()}return{get:t=>e.get(t),set(t,r){e.set(t,r),n(t)},delete(t){e.delete(t),n(t)},subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),0===r.size&&t.delete(e)}}}}const h=(e=!1)=>(...t)=>(...n)=>{const r=t.flat();return e&&r.reverse(),r.reduce(((e,t)=>[t(...e)]),n)[0]};var v=h();var m=h(!0);const y=window.ReactJSXRuntime;var g=function(e){return a((t=>n=>e(n)?(0,y.jsx)(t,{...n}):null),"ifCondition")};const b=window.wp.isShallowEqual;var w=n.n(b);const E=window.wp.element;var S=a((function(e){return e.prototype instanceof E.Component?class extends e{shouldComponentUpdate(e,t){return!w()(e,this.props)||!w()(t,this.state)}}:class extends E.Component{shouldComponentUpdate(e){return!w()(e,this.props)}render(){return(0,y.jsx)(e,{...this.props})}}}),"pure");const x=window.wp.deprecated;var k=n.n(x);var T=class{constructor(){this.listeners={},this.handleEvent=this.handleEvent.bind(this)}add(e,t){this.listeners[e]||(window.addEventListener(e,this.handleEvent),this.listeners[e]=[]),this.listeners[e].push(t)}remove(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter((e=>e!==t)),this.listeners[e].length||(window.removeEventListener(e,this.handleEvent),delete this.listeners[e]))}handleEvent(e){this.listeners[e.type]?.forEach((t=>{t.handleEvent(e)}))}};const C=new T;function L(e){return k()("wp.compose.withGlobalEvents",{since:"5.7",alternative:"useEffect"}),a((t=>{class n extends E.Component{constructor(e){super(e),this.handleEvent=this.handleEvent.bind(this),this.handleRef=this.handleRef.bind(this)}componentDidMount(){Object.keys(e).forEach((e=>{C.add(e,this)}))}componentWillUnmount(){Object.keys(e).forEach((e=>{C.remove(e,this)}))}handleEvent(t){const n=e[t.type];"function"==typeof this.wrappedRef[n]&&this.wrappedRef[n](t)}handleRef(e){this.wrappedRef=e,this.props.forwardedRef&&this.props.forwardedRef(e)}render(){return(0,y.jsx)(t,{...this.props.ownProps,ref:this.handleRef})}}return(0,E.forwardRef)(((e,t)=>(0,y.jsx)(n,{ownProps:e,forwardedRef:t})))}),"withGlobalEvents")}const R=new WeakMap;var D=function(e,t,n){return(0,E.useMemo)((()=>{if(n)return n;const r=function(e){const t=R.get(e)||0;return R.set(e,t+1),t}(e);return t?`${t}-${r}`:r}),[e,n,t])};var M=a((e=>t=>{const n=D(e);return(0,y.jsx)(e,{...t,instanceId:n})}),"instanceId");var O=a((e=>class extends E.Component{timeouts;constructor(e){super(e),this.timeouts=[],this.setTimeout=this.setTimeout.bind(this),this.clearTimeout=this.clearTimeout.bind(this)}componentWillUnmount(){this.timeouts.forEach(clearTimeout)}setTimeout(e,t){const n=setTimeout((()=>{e(),this.clearTimeout(n)}),t);return this.timeouts.push(n),n}clearTimeout(e){clearTimeout(e),this.timeouts=this.timeouts.filter((t=>t!==e))}render(){return(0,y.jsx)(e,{...this.props,setTimeout:this.setTimeout,clearTimeout:this.clearTimeout})}}),"withSafeTimeout");function _(e={}){return k()("wp.compose.withState",{since:"5.8",alternative:"wp.element.useState"}),a((t=>class extends E.Component{constructor(t){super(t),this.setState=this.setState.bind(this),this.state=e}render(){return(0,y.jsx)(t,{...this.props,...this.state,setState:this.setState})}}),"withState")}const A=window.wp.dom;function j(e,t){const n=(0,E.useRef)();return(0,E.useCallback)((t=>{t?n.current=e(t):n.current&&n.current()}),t)}var P=function(){return j((e=>{function t(t){const{key:n,shiftKey:r,target:o}=t;if("Tab"!==n)return;const i=r?"findPrevious":"findNext",u=A.focus.tabbable[i](o)||null;if(o.contains(u))return t.preventDefault(),void u?.focus();if(e.contains(u))return;const c=r?"append":"prepend",{ownerDocument:s}=e,a=s.createElement("div");a.tabIndex=-1,e[c](a),a.addEventListener("blur",(()=>e.removeChild(a))),a.focus()}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[])},I=n(3758),N=n.n(I);function z(e,t,n=4e3){k()("wp.compose.useCopyOnClick",{since:"5.8",alternative:"wp.compose.useCopyToClipboard"});const r=(0,E.useRef)(),[o,i]=(0,E.useState)(!1);return(0,E.useEffect)((()=>{let o;if(e.current)return r.current=new(N())(e.current,{text:()=>"function"==typeof t?t():t}),r.current.on("success",(({clearSelection:e,trigger:t})=>{e(),t&&t.focus(),n&&(i(!0),clearTimeout(o),o=setTimeout((()=>i(!1)),n))})),()=>{r.current&&r.current.destroy(),clearTimeout(o)}}),[t,n,i]),o}function U(e){const t=(0,E.useRef)(e);return(0,E.useLayoutEffect)((()=>{t.current=e}),[e]),t}function V(e,t){const n=U(e),r=U(t);return j((e=>{const t=new(N())(e,{text:()=>"function"==typeof n.current?n.current():n.current||""});return t.on("success",(({clearSelection:e})=>{e(),r.current&&r.current()})),()=>{t.destroy()}}),[])}const W=window.wp.keycodes;function q(e="firstElement"){const t=(0,E.useRef)(e),n=e=>{e.focus({preventScroll:!0})},r=(0,E.useRef)();return(0,E.useEffect)((()=>{t.current=e}),[e]),j((e=>{if(e&&!1!==t.current&&!e.contains(e.ownerDocument?.activeElement??null)){if("firstElement"===t.current)return r.current=setTimeout((()=>{const t=A.focus.tabbable.find(e)[0];t&&n(t)}),0),()=>{r.current&&clearTimeout(r.current)};n(e)}}),[])}let K=null;var H=function(e){const t=(0,E.useRef)(null),n=(0,E.useRef)(null),r=(0,E.useRef)(e);return(0,E.useEffect)((()=>{r.current=e}),[e]),(0,E.useCallback)((e=>{if(e){if(t.current=e,n.current)return;const r=e.ownerDocument.activeElement instanceof window.HTMLIFrameElement?e.ownerDocument.activeElement.contentDocument:e.ownerDocument;n.current=r?.activeElement??null}else if(n.current){const e=t.current?.contains(t.current?.ownerDocument.activeElement);if(t.current?.isConnected&&!e)return void(K??=n.current);r.current?r.current():(n.current.isConnected?n.current:K)?.focus(),K=null}}),[])};const $=["button","submit"];function F(e){const t=(0,E.useRef)(e);(0,E.useEffect)((()=>{t.current=e}),[e]);const n=(0,E.useRef)(!1),r=(0,E.useRef)(),o=(0,E.useCallback)((()=>{clearTimeout(r.current)}),[]);(0,E.useEffect)((()=>{e||o()}),[e,o]);const i=(0,E.useCallback)((e=>{const{type:t,target:r}=e;["mouseup","touchend"].includes(t)?n.current=!1:function(e){if(!(e instanceof window.HTMLElement))return!1;switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return $.includes(e.type)}return!1}(r)&&(n.current=!0)}),[]),u=(0,E.useCallback)((e=>{if(e.persist(),n.current)return;const o=e.target.getAttribute("data-unstable-ignore-focus-outside-for-relatedtarget");o&&e.relatedTarget?.closest(o)||(r.current=setTimeout((()=>{document.hasFocus()?"function"==typeof t.current&&t.current(e):e.preventDefault()}),0))}),[]);return{onFocus:o,onMouseDown:i,onMouseUp:i,onTouchStart:i,onTouchEnd:i,onBlur:u}}function B(e,t){"function"==typeof e?e(t):e&&e.hasOwnProperty("current")&&(e.current=t)}function G(e){const t=(0,E.useRef)(),n=(0,E.useRef)(!1),r=(0,E.useRef)(!1),o=(0,E.useRef)([]),i=(0,E.useRef)(e);return i.current=e,(0,E.useLayoutEffect)((()=>{!1===r.current&&!0===n.current&&e.forEach(((e,n)=>{const r=o.current[n];e!==r&&(B(r,null),B(e,t.current))})),o.current=e}),e),(0,E.useLayoutEffect)((()=>{r.current=!1})),(0,E.useCallback)((e=>{B(t,e),r.current=!0,n.current=null!==e;const u=e?i.current:o.current;for(const t of u)B(t,e)}),[])}var Z=function(e){const t=(0,E.useRef)(),{constrainTabbing:n=!1!==e.focusOnMount}=e;(0,E.useEffect)((()=>{t.current=e}),Object.values(e));const r=P(),o=q(e.focusOnMount),i=H(),u=F((e=>{t.current?.__unstableOnClose?t.current.__unstableOnClose("focus-outside",e):t.current?.onClose&&t.current.onClose()})),c=(0,E.useCallback)((e=>{e&&e.addEventListener("keydown",(e=>{e.keyCode===W.ESCAPE&&!e.defaultPrevented&&t.current?.onClose&&(e.preventDefault(),t.current.onClose())}))}),[]);return[G([n?r:null,!1!==e.focusOnMount?i:null,!1!==e.focusOnMount?o:null,c]),{...u,tabIndex:-1}]};function Q({isDisabled:e=!1}={}){return j((t=>{if(e)return;const n=t?.ownerDocument?.defaultView;if(!n)return;const r=[],o=()=>{t.childNodes.forEach((e=>{e instanceof n.HTMLElement&&(e.getAttribute("inert")||(e.setAttribute("inert","true"),r.push((()=>{e.removeAttribute("inert")}))))}))},i=f(o,0,{leading:!0});o();const u=new window.MutationObserver(i);return u.observe(t,{childList:!0}),()=>{u&&u.disconnect(),i.cancel(),r.forEach((e=>e()))}}),[e])}function X(e){const t=(0,E.useRef)((()=>{throw new Error("Callbacks created with `useEvent` cannot be called during rendering.")}));return(0,E.useInsertionEffect)((()=>{t.current=e})),(0,E.useCallback)(((...e)=>t.current?.(...e)),[])}var Y="undefined"!=typeof window?E.useLayoutEffect:E.useEffect;function J({onDragStart:e,onDragMove:t,onDragEnd:n}){const[r,o]=(0,E.useState)(!1),i=(0,E.useRef)({onDragStart:e,onDragMove:t,onDragEnd:n});Y((()=>{i.current.onDragStart=e,i.current.onDragMove=t,i.current.onDragEnd=n}),[e,t,n]);const u=(0,E.useCallback)((e=>i.current.onDragMove&&i.current.onDragMove(e)),[]),c=(0,E.useCallback)((e=>{i.current.onDragEnd&&i.current.onDragEnd(e),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",c),o(!1)}),[]),s=(0,E.useCallback)((e=>{i.current.onDragStart&&i.current.onDragStart(e),document.addEventListener("mousemove",u),document.addEventListener("mouseup",c),o(!0)}),[]);return(0,E.useEffect)((()=>()=>{r&&(document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",c))}),[r]),{startDrag:s,endDrag:c,isDragging:r}}var ee=n(1933),te=n.n(ee);n(5760);var ne=function(e,t,{bindGlobal:n=!1,eventName:r="keydown",isDisabled:o=!1,target:i}={}){const u=(0,E.useRef)(t);(0,E.useEffect)((()=>{u.current=t}),[t]),(0,E.useEffect)((()=>{if(o)return;const t=new(te())(i&&i.current?i.current:document);return(Array.isArray(e)?e:[e]).forEach((e=>{const o=e.split("+"),i=new Set(o.filter((e=>e.length>1))),c=i.has("alt"),s=i.has("shift");if((0,W.isAppleOS)()&&(1===i.size&&c||2===i.size&&c&&s))throw new Error(`Cannot bind ${e}. Alt and Shift+Alt modifiers are reserved for character input.`);t[n?"bindGlobal":"bind"](e,((...e)=>u.current(...e)),r)})),()=>{t.reset()}}),[e,n,r,i,o])};const re=new Map;function oe(e){const t=(0,E.useMemo)((()=>{const t=function(e){if(!e)return null;let t=re.get(e);return t||("undefined"!=typeof window&&"function"==typeof window.matchMedia?(t=window.matchMedia(e),re.set(e,t),t):null)}(e);return{subscribe:e=>t?(t.addEventListener?.("change",e),()=>{t.removeEventListener?.("change",e)}):()=>{},getValue:()=>t?.matches??!1}}),[e]);return(0,E.useSyncExternalStore)(t.subscribe,t.getValue,(()=>!1))}function ie(e){const t=(0,E.useRef)();return(0,E.useEffect)((()=>{t.current=e}),[e]),t.current}var ue=()=>oe("(prefers-reduced-motion: reduce)");function ce(e,t){const n={...e};return Object.entries(t).forEach((([e,t])=>{n[e]?n[e]={...n[e],to:t.to}:n[e]=t})),n}const se=(e,t)=>{const n=e?.findIndex((({id:e})=>"string"==typeof e?e===t.id:w()(e,t.id))),r=[...e];return-1!==n?r[n]={id:t.id,changes:ce(r[n].changes,t.changes)}:r.push(t),r};function ae(){let e=[],t=[],n=0;const r=()=>{e=e.slice(0,n||void 0),n=0},o=()=>{const n=0===e.length?0:e.length-1;let r=e[n]??[];t.forEach((e=>{r=se(r,e)})),t=[],e[n]=r};return{addRecord(n,i=!1){const u=!n||(e=>!e.filter((({changes:e})=>Object.values(e).some((({from:e,to:t})=>"function"!=typeof e&&"function"!=typeof t&&!w()(e,t))))).length)(n);if(i){if(u)return;n.forEach((e=>{t=se(t,e)}))}else{if(r(),t.length&&o(),u)return;e.push(n)}},undo(){t.length&&(r(),o());const i=e[e.length-1+n];if(i)return n-=1,i},redo(){const t=e[e.length+n];if(t)return n+=1,t},hasUndo:()=>!!e[e.length-1+n],hasRedo:()=>!!e[e.length+n]}}function le(e,t){switch(t.type){case"UNDO":{const t=e.manager.undo();return t?{...e,value:t[0].changes.prop.from}:e}case"REDO":{const t=e.manager.redo();return t?{...e,value:t[0].changes.prop.to}:e}case"RECORD":return e.manager.addRecord([{id:"object",changes:{prop:{from:e.value,to:t.value}}}],t.isStaged),{...e,value:t.value}}return e}function fe(e){return{manager:ae(),value:e}}function de(e){const[t,n]=(0,E.useReducer)(le,e,fe);return{value:t.value,setValue:(0,E.useCallback)(((e,t)=>{n({type:"RECORD",value:e,isStaged:t})}),[]),hasUndo:t.manager.hasUndo(),hasRedo:t.manager.hasRedo(),undo:(0,E.useCallback)((()=>{n({type:"UNDO"})}),[]),redo:(0,E.useCallback)((()=>{n({type:"REDO"})}),[])}}const pe={xhuge:1920,huge:1440,wide:1280,xlarge:1080,large:960,medium:782,small:600,mobile:480},he={">=":"min-width","<":"max-width"},ve={">=":(e,t)=>t>=e,"<":(e,t)=>t<e},me=(0,E.createContext)(null);me.displayName="ViewportMatchWidthContext";const ye=(e,t=">=")=>{const n=(0,E.useContext)(me),r=oe(!n&&`(${he[t]}: ${pe[e]}px)`||void 0);return n?ve[t](pe[e],n):r};ye.__experimentalWidthProvider=me.Provider;var ge=ye;function be(e,t={}){const n=X(e),r=(0,E.useRef)(),o=(0,E.useRef)();return X((e=>{if(e===r.current)return;o.current??=new ResizeObserver(n);const{current:i}=o;r.current&&i.unobserve(r.current),r.current=e,e&&i.observe(e,t)}))}const we=e=>{let t;if(e.contentBoxSize)if(e.contentBoxSize[0]){const n=e.contentBoxSize[0];t=[n.inlineSize,n.blockSize]}else{const n=e.contentBoxSize;t=[n.inlineSize,n.blockSize]}else t=[e.contentRect.width,e.contentRect.height];const[n,r]=t.map((e=>Math.round(e)));return{width:n,height:r}},Ee={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",opacity:0,overflow:"hidden",zIndex:-1};function Se({onResize:e}){const t=be((t=>{const n=we(t.at(-1));e(n)}));return(0,y.jsx)("div",{ref:t,style:Ee,"aria-hidden":"true"})}const xe={width:null,height:null};function ke(e,t={}){return e?be(e,t):function(){const[e,t]=(0,E.useState)(xe),n=(0,E.useRef)(xe),r=(0,E.useCallback)((e=>{var r,o;o=e,((r=n.current).width!==o.width||r.height!==o.height)&&(n.current=e,t(e))}),[]);return[(0,y.jsx)(Se,{onResize:r}),e]}()}const Te=window.wp.priorityQueue;var Ce=function(e,t={step:1}){const{step:n=1}=t,[r,o]=(0,E.useState)([]);return(0,E.useEffect)((()=>{let t=function(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e[r];if(!t.includes(o))break;n.push(o)}return n}(e,r);t.length<n&&(t=t.concat(e.slice(t.length,n))),o(t);const i=(0,Te.createQueue)();for(let r=t.length;r<e.length;r+=n)i.add({},(()=>{(0,E.flushSync)((()=>{o((t=>[...t,...e.slice(r,r+n)]))}))}));return()=>i.reset()}),[e]),r};var Le=function(e,t="Change detection"){const n=ie(e);Object.entries(n??[]).forEach((([n,r])=>{r!==e[n]&&console.warn(`${t}: ${n} key changed:`,r,e[n])}))};const Re=window.React;function De(e,t){var n=(0,Re.useState)((function(){return{inputs:t,result:e()}}))[0],r=(0,Re.useRef)(!0),o=(0,Re.useRef)(n),i=r.current||Boolean(t&&o.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,o.current.inputs))?o.current:{inputs:t,result:e()};return(0,Re.useEffect)((function(){r.current=!1,o.current=i}),[i]),i.result}function Me(e,t,n){const r=De((()=>f(e,t??0,n)),[e,t,n?.leading,n?.trailing,n?.maxWait]);return(0,E.useEffect)((()=>()=>r.cancel()),[r]),r}function Oe(e=""){const[t,n]=(0,E.useState)(e),[r,o]=(0,E.useState)(e),i=Me(o,250);return(0,E.useEffect)((()=>{i(t)}),[t,i]),[t,n,r]}function _e(e,t,n){const r=De((()=>d(e,t??0,n)),[e,t,n]);return(0,E.useEffect)((()=>()=>r.cancel()),[r]),r}function Ae({dropZoneElement:e,isDisabled:t,onDrop:n,onDragStart:r,onDragEnter:o,onDragLeave:i,onDragEnd:u,onDragOver:c}){const s=X(n),a=X(r),l=X(o),f=X(i),d=X(u),p=X(c);return j((h=>{if(t)return;const v=e??h;let m=!1;const{ownerDocument:y}=v;function g(e){m||(m=!0,y.addEventListener("dragend",x),y.addEventListener("mousemove",x),r&&a(e))}function b(e){e.preventDefault(),v.contains(e.relatedTarget)||o&&l(e)}function w(e){!e.defaultPrevented&&c&&p(e),e.preventDefault()}function E(e){(function(e){const{defaultView:t}=y;if(!(e&&t&&e instanceof t.HTMLElement&&v.contains(e)))return!1;let n=e;do{if(n.dataset.isDropZone)return n===v}while(n=n.parentElement);return!1})(e.relatedTarget)||i&&f(e)}function S(e){e.defaultPrevented||(e.preventDefault(),e.dataTransfer&&e.dataTransfer.files.length,n&&s(e),x(e))}function x(e){m&&(m=!1,y.removeEventListener("dragend",x),y.removeEventListener("mousemove",x),u&&d(e))}return v.setAttribute("data-is-drop-zone","true"),v.addEventListener("drop",S),v.addEventListener("dragenter",b),v.addEventListener("dragover",w),v.addEventListener("dragleave",E),y.addEventListener("dragenter",g),()=>{v.removeAttribute("data-is-drop-zone"),v.removeEventListener("drop",S),v.removeEventListener("dragenter",b),v.removeEventListener("dragover",w),v.removeEventListener("dragleave",E),y.removeEventListener("dragend",x),y.removeEventListener("mousemove",x),y.removeEventListener("dragenter",g)}}),[t,e])}function je(){return j((e=>{const{ownerDocument:t}=e;if(!t)return;const{defaultView:n}=t;if(n)return n.addEventListener("blur",r),()=>{n.removeEventListener("blur",r)};function r(){t&&t.activeElement===e&&e.focus()}}),[])}const Pe=30;function Ie(e,t,n,r){const o=r?.initWindowSize??Pe,i=r?.useWindowing??!0,[u,c]=(0,E.useState)({visibleItems:o,start:0,end:o,itemInView:e=>e>=0&&e<=o});return(0,E.useLayoutEffect)((()=>{if(!i)return;const o=(0,A.getScrollContainer)(e.current),u=e=>{if(!o)return;const i=Math.ceil(o.clientHeight/t),u=e?i:r?.windowOverscan??i,s=Math.floor(o.scrollTop/t),a=Math.max(0,s-u),l=Math.min(n-1,s+i+u);c((e=>{const t={visibleItems:i,start:a,end:l,itemInView:e=>a<=e&&e<=l};return e.start!==t.start||e.end!==t.end||e.visibleItems!==t.visibleItems?t:e}))};u(!0);const s=f((()=>{u()}),16);return o?.addEventListener("scroll",s),o?.ownerDocument?.defaultView?.addEventListener("resize",s),o?.ownerDocument?.defaultView?.addEventListener("resize",s),()=>{o?.removeEventListener("scroll",s),o?.ownerDocument?.defaultView?.removeEventListener("resize",s)}}),[t,e,n,r?.expandedState,r?.windowOverscan,i]),(0,E.useLayoutEffect)((()=>{if(!i)return;const r=(0,A.getScrollContainer)(e.current),o=e=>{switch(e.keyCode){case W.HOME:return r?.scrollTo({top:0});case W.END:return r?.scrollTo({top:n*t});case W.PAGEUP:return r?.scrollTo({top:r.scrollTop-u.visibleItems*t});case W.PAGEDOWN:return r?.scrollTo({top:r.scrollTop+u.visibleItems*t})}};return r?.ownerDocument?.defaultView?.addEventListener("keydown",o),()=>{r?.ownerDocument?.defaultView?.removeEventListener("keydown",o)}}),[n,t,e,u.visibleItems,i,r?.expandedState]),[u,c]}function Ne(e,t){const[n,r]=(0,E.useMemo)((()=>[n=>e.subscribe(t,n),()=>e.get(t)]),[e,t]);return(0,E.useSyncExternalStore)(n,r,r)}})(),(window.wp=window.wp||{}).compose=r})();
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-element.js?ver=2.9.4.2 
class FLElement extends HTMLElement {

	/**
	 * Property to store a template element
	 */
	template = null

	/**
 	* Function to unbind event listeners. Meant to be replaced by returning a function from bindEvents().
 	*/
	unbindEventsCallback = () => {}

	/**
	 * A collection of defaults for localized strings to be merged with the strings attribute.
	 */
	defaultStrings = {}

	/**
	 * Array of attributes to watch for changes
	 *
	 * @return Array
	 */
	static get observedAttributes() {
		return [ 'strings' ]
	}

	/*
	 * Sets up a template element for use later.
	 *
	 * @return void
	 */
	constructor() {
		super()
		this.template = document.createElement( 'template' )
	}

	/**
	 * This is a stub to be overridden in subclasses
	 *
	 * @return Function
	 */
	bindEvents() {
		return this.unbindEventsCallback
	}

	/**
	 * Override to assign unbind callback
	 */
	connectedCallback() {

		/**
		 * To enable a cleanup callback in bindEvents()
		 * you need to assign it when the element is connected to the DOM.
		 * This allows you to return a function from bindEvents() that will
		 * be called on disconnect. Use it to remove any event listeners you added.
		 */
		this.unbindEventsCallback = this.bindEvents()
	}

	/**
	 * Fires when element is disconnected from DOM
	 *
	 * @return void
	 */
	disconnectedCallback() {
		if ( 'function' === typeof this.unbindEventsCallback ) {
			this.unbindEventsCallback()
		}
	}

	/**
	 * Getter for strings property. Merges defaults with strings attribute
	 *
	 * @return Object
	 */
	get strings() {
		return {
			...this.defaultStrings,
			...JSON.parse( this.getAttribute( 'strings' ) )
		}
	}
};
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-menu.js?ver=2.9.4.2 
class FLMenu extends FLElement {

	static observedAttributes = [ 'open' ]

	constructor() {
		super()
		this.attachShadow( { mode: 'open' } )
	}

	connectedCallback() {
		this.template.innerHTML = this.render()
		this.shadowRoot.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()
	}

	bindEvents() {

		/**
		 * Cached callback to be used on attribute change.
		 */
		this.dismissCallback = this.maybeDismissMenu.bind(this)
	}

	attributeChangedCallback( name, prevValue, value ) {
		switch( name ) {
			case 'open':
				this.isOpen() ? this.onOpen() : this.onClose()
				break
		}
	}

	open() {
		this.setAttribute( 'open', '' )
	}

	close() {
		this.removeAttribute( 'open' )
	}

	onOpen() {
		//document.addEventListener( 'click', this.dismissCallback )
	}

	onClose() {
		document.removeEventListener( 'click', this.dismissCallback )
	}

	maybeDismissMenu( e ) {

		const isClickOutside = this.isOpen() && ! e.composedPath().includes( this )
		console.log( 'maybe dismiss', isClickOutside, this )

		if ( isClickOutside ) {
			this.close()
		}
	}

	isOpen() {
		return !! this.hasAttribute( 'open' )
	}

	render() {
		return `
			<style>
				:host {
					--item-size: 30px;
					--width: 150px;
					--radius: var(--fl-builder-radius);
					background: var(--fl-builder-input-bg-color);
					min-height: 36px;
					display: none;
					grid-auto-rows: var(--fl-builder-target-size);
					gap: 1px;
					box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
								rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
								rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
					border-radius: var(--radius);
					position: absolute;
					top: calc( 100% + 1px );
					width: var(--width);
					right: 0;
					z-index: 9;
				}
				:host( [open] ) {
					display: grid;
				}
				::slotted( * ) {
					border: none;
					background: var(--fl-builder-input-bg-color);
					color: var(--fl-builder-input-color);
					outline: none;
					font-size: inherit;
					display: flex;
					place-items: center;
					place-content: start;
					padding: 0 20px;
					text-align: left;
					min-height: var(--item-size);
				}
				::slotted( *:hover ) {
					filter: brightness( 96% );
				}
				::slotted( :first-child ) {
					border-top-left-radius: var(--radius);
					border-top-right-radius: var(--radius);
				}
				::slotted( :last-child ) {
					border-bottom-left-radius: var(--radius);
					border-bottom-right-radius: var(--radius);
				}
			</style>
			<slot></slot>
		`
	}
}
customElements.define( "fl-menu", FLMenu );
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-stepper.js?ver=2.9.4.2 
class FLStepperInput extends HTMLElement {
	constructor() {
		super()
		this.attachShadow( { mode: 'open' } )
		this.template = document.createElement( 'template' )
	}

	connectedCallback() {
		this.template.innerHTML = this.render( this.props )
		this.shadowRoot.replaceChildren( this.template.content.cloneNode( true ) )
		this.bindEvents()
	}

	getHiddenInput() {
		const name = this.getAttribute( 'data-name' )
		const input = this.querySelector(`input[name="${name}"]`)
		return input
	}

	setHiddenInput( value ) {
		const input = this.getHiddenInput()
		input.value = value
		input.dispatchEvent( new Event( 'change' ) )
	}

	onHiddenChanged(e) {
		const value = e.target.value
		const numberInput = this.shadowRoot.querySelector('input')
		if ( value !== numberInput.value ) {
			numberInput.value = value
			numberInput.dispatchEvent( new Event( 'change' ) )
		}
	}

	bindEvents() {

		// Increment buttons
		const buttons = this.shadowRoot.querySelectorAll('button')
		buttons.forEach( button => {
			button.addEventListener( 'click', this.onStepClick.bind(this) )
		} )

		// Hidden Input
		this.getHiddenInput().addEventListener( 'change', this.onHiddenChanged.bind(this) )

		// Number Input
		this.shadowRoot.querySelector('input[type=number]').addEventListener( 'keyup', this.onNumberInputChanged.bind(this) )
	}

	onNumberInputChanged( e ) {
		const v = e.target.value
		this.setHiddenInput( v )
	}

	onStepClick( e ) {
		const hidden = this.getHiddenInput()
		const operation = e.target.getAttribute('data-operation')
		let value = this.step( hidden.value, operation )
		this.setHiddenInput( value )
	}

	step( v = 0, op = '+' ) {
		const step = this.hasAttribute('step') ? parseInt( this.getAttribute('step') ) : 1
		const min = this.hasAttribute('min') ? parseInt( this.getAttribute('min') ) : null
		const max = this.hasAttribute('max') ? parseInt( this.getAttribute('max') ) : null
		const value = ! v ? 0 : v
		const steppedValue = '-' === op ? parseInt( value ) - step : parseInt( value ) + step

		if ( null !== min && steppedValue < min ) {
			return min
		} else if ( null !== max && steppedValue > max ) {
			return max
		}
		return steppedValue
	}

	render() {
		const value = this.getHiddenInput().value
		const step = this.hasAttribute('step') ? parseInt( this.getAttribute('step') ) : 1
		const min = this.hasAttribute('min') ? parseInt( this.getAttribute('min') ) : null
		const max = this.hasAttribute('max') ? parseInt( this.getAttribute('max') ) : null
		return `
			<style>
				:host {
					flex-grow: 1;
					color: inherit;
					display: grid;
				}
				.wrap {
					display: flex;
					min-height: var(--fl-builder-target-size);
					justify-content: space-evenly;
					align-items: center;
					color: inherit;
				}
				.wrap:hover button,
				.wrap:focus-within button {
					opacity: 1;
				}
				input {
					min-width: 2ch;
					max-width: 4ch;
					border: none;
					outline: none;
					text-align: center;
					padding: 0;
					place-self: stretch;
					background: transparent;
					color: inherit;
				}
				/* Chrome, Safari, Edge, Opera */
				input::-webkit-outer-spin-button,
				input::-webkit-inner-spin-button {
				  -webkit-appearance: none;
				  margin: 0;
				}
				/* Firefox */
				input[type=number] {
				  -moz-appearance: textfield;
				}
				button {
					color: inherit;
					background: transparent;
					border: none;
					outline: none;
					width: 24px;
					height: 24px;
					display: flex;
					justify-content: center;
					align-items: center;
					opacity: 0;
					border-radius: 50%;
					padding: 0;
				}
				button > * {
					pointer-events: none;
				}
				button:hover {
					background: var(--fl-builder-platter-bg-color);
				}
			</style>
			<div class="wrap">
				<button data-operation="-">
					<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
						<path d="M15.6569 10.0001H4.34315" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
					</svg>
				</button>
				<input
					type="number"
					min="${min}"
					max="${max}"
					step="${step}"
					value="${value}"
				/>
				<button data-operation="+">
					<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
						<path d="M15.6569 10.0001H4.34315" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
						<path d="M10 4.34326V15.657" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
					</svg>
				</button>
			</div>
		`
	}
}
customElements.define( "fl-stepper", FLStepperInput );
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-grid-area-field.js?ver=2.9.4.2 
class FLGridAreaField extends HTMLElement {
	connectedCallback() {
		this.bindEvents()
	}

	getHiddenInput() {
		const name = this.getAttribute( 'data-name' )
		const input = this.querySelector(`input[name="${name}[css]"]`)
		return input
	}

	setHiddenInput( value ) {
		const input = this.getHiddenInput()
		if ( input ) {
			input.value = value
			input.dispatchEvent( new Event( 'change' ) )
		}
	}

	getInputs() {
		let keyed = {}
		const inputs = this.querySelectorAll('input[type="hidden"]')
		inputs.forEach( input => {
			const name = input.getAttribute('name').split('[')[1].replace(']', '').trim()
			keyed[name] = input
		} )
		return keyed
	}

	getValues() {
		const inputs = this.getInputs()
		let values = {
			css: '',
			start: null,
			span: null,
			end: null,
		}
		for( let name in inputs ) {
			values[name] = inputs[name].value
		}
		return values
	}

	bindEvents() {
		const inputs = this.getInputs()
		for( let name in inputs ) {
			if ( 'css' === name ) {
				continue
			}
			inputs[name].addEventListener( 'change', this.onNumberChanged.bind(this) )
		}
	}

	onNumberChanged() {
		const values = this.getValues()
		const css = this.formatCSSValue( values.start, values.span, values.end )
		this.setHiddenInput( css )
	}

	formatCSSValue( start = null, span = null, end = null ) {
		let string = []

		if ( '' !== start ) {
			string.push(start)
		}
		if ( '' !== span ) {
			string.push(`span ${span}`)
		}
		if ( end && ( !start || !span ) ) {
			string.push(end)
		}
		return string.join(' / ')
	}
}
customElements.define( "fl-grid-area-field", FLGridAreaField );
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-layer-group.js?ver=2.9.4.2 
/**
 * Custom element class that represents an array of layer objects.
 */
class FLLayerGroup extends FLElement {

	defaultStrings = {
		addNew: 'Add new TEST'
	}

	/**
	 * Array of element attributes to watch.
	 *
	 * @return Array
	 */
	static get observedAttributes() {
		return [ 'value', 'name', 'insert-position'  ]
	}

	/**
	 * Getter for name attribute
	 *
	 * @return String
	 */
	get name() {
		return this.getAttribute( 'name' )
	}

	/**
	 * Getter for value attribute
	 *
	 * @return String
	 */
	get value() {
		return this.getAttribute( 'value' )
	}

	get insertPosition() {
		if ( this.hasAttribute( 'insert-position' ) ) {
			return 'before' === this.getAttribute( 'insert-position' ) ? 'before' : 'after'
		}
		return 'after'
	}

	/**
	 * Setup Element shadowDOM and template
	 *
	 * @return void
	 */
	constructor() {
		super()
		this.attachShadow( { mode: 'open' } )
	}
	/**
	 * Set up element after connected to DOM
	 *
	 * @return void
	 */
	connectedCallback() {
		this.template.innerHTML = this.renderShadow()
		this.shadowRoot.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()
	}

	/**
	 * Fires in connectedCallback() after DOM renders
	 *
	 * @return void
	 */
	bindEvents() {

		// Reorder List Items
		const onReorder = this.onReorder.bind( this )
		const ul = this.shadowRoot.querySelector( 'ul' )
		jQuery( ul ).sortable( {
			items: 'li',
			cursor: 'move',
			distance: 5,
			opacity: 0.75,
			placeholder: 'fl-layer-placeholder',
			stop: onReorder,
			tolerance: 'pointer',
			axis: "y",
			helper: 'clone',
		} )

		// Header Buttons (add, clear)
		const header = this.querySelector('fl-layer-group-heading')
		header.layerGroup = this
		const addLayer = this.addLayer.bind( this )
		const clearLayers = this.clearLayers.bind( this )
		header?.addEventListener( 'add', addLayer )
		header?.addEventListener( 'reset', clearLayers )

		// Remove Buttons (Layer Menu)
		const removeLayer = this.removeLayer.bind( this )
		this.addEventListener( 'layer-remove', removeLayer )

		// Duplicate Buttons (Layer Menu)
		const cloneLayer = this.cloneLayer.bind( this )
		this.addEventListener( 'layer-clone', cloneLayer )
		//const cloneButtons = this.shadowRoot.querySelectorAll( 'button.clone' )
		//cloneButtons.forEach( button => button.addEventListener( 'click', cloneLayer ) )

		// Listen for value changes on layer items
		const onLayerChange = this.onLayerValueChange.bind( this )
		this.addEventListener( 'layer-change', onLayerChange )

		// Watch DOM mutations (like removing items)
		const observer = new MutationObserver( ( list, observer ) => {
			for ( const mutation of list ) {
				if ( 'childList' === mutation.type ) {
					if ( mutation.removedNodes.length ) {
						this.updateValueAttribute()
					}
				}
			}
		} )
		observer.observe( ul, { childList: true } )

		// Unbind Events on disconnect
		return () => {
			jQuery( ul ).sortable( 'destroy' )

			header?.removeEventListener( 'add', addLayer )
			header?.removeEventListener( 'reset', clearLayers )

			//cloneButtons.forEach( button => button.removeEventListener( 'click', cloneLayer ) )
			this.removeEventListener( 'layer-remove', removeLayer )
			this.removeEventListener( 'layer-clone', cloneLayer )
			this.removeEventListener( 'layer-change', onLayerChange )

			observer.disconnect()
		}
	}

	supportedLayerTypes() {
		return [ 'text', 'basic-track' ]
	}

	supportsMultipleLayerTypes() {
		return this.supportedLayerTypes().length > 1
	}

	/**
	 * Get all layer items
	 *
	 * @return NodeList
	 */
	getListElements() {
		const selector = 'li:not(.ui-sortable-helper, .fl-layer-placeholder) > fl-layer-group-item'
		return this.shadowRoot.querySelectorAll( selector )
	}

	/**
	 * Reset value attribute based on values of each child layer.
	 *
	 * @return void
	 */
	updateValueAttribute() {
		const newValue = JSON.stringify( this.getLayerValues() )
		this.setAttribute( 'value', newValue )
		this.dispatchEvent( new Event( 'change' ) )
	}

	/**
	 * Handle updating value after sorting the list
	 *
	 * @return void
	 */
	onReorder() {
		this.updateValueAttribute()
	}

	/**
	 * Listen for value changes on each child layer
	 *
	 * @return void
	 */
	onLayerValueChange() {
		this.updateValueAttribute()
	}

	/**
	 * Get array of all layer objects
	 *
	 * @return Array
	 */
	getLayerValues() {
		return Array.from( this.getListElements() ).map( item => {
			return JSON.parse( item.getAttribute('value') )
		} )
	}

	getDefaultLayerProps() {
		if ( this.hasAttribute( 'default' ) && '' !== this.getAttribute( 'default' ) ) {
			return JSON.parse( this.getAttribute( 'default' ) )
		} else {
			return { type: 'text', value: '' }
		}
	}

	addLayer( e ) {
		const ul = this.shadowRoot.querySelector( 'ul' )

		const template = document.createElement( 'template' )
		template.innerHTML = this.renderLayer( e.detail )
		const node = template.content.cloneNode( true )

		if ( 'before' === this.insertPosition ) {
			ul.prepend( node )
		} else {
			ul.append( node )
		}

		this.setAttribute( 'value', JSON.stringify( this.getLayerValues() ) )
		this.dispatchEvent( new Event( 'change' ) )
	}

	cloneLayer( e ) {
		const layer = e.detail
		const template = document.createElement( 'template' )
		template.innerHTML = this.renderLayer( { ...layer.value } )
		const node = template.content.cloneNode( true )
		layer.parentElement.after( node )
		layer.parentElement.nextElementSibling?.querySelector('input')?.focus()
		this.updateValueAttribute()
	}

	removeLayer( e ) {
		const item = e.detail.closest('li')

		// Locate next item before we remove the current one
		let next = null
		if ( item?.nextElementSibling ) {
			next = item?.nextElementSibling
		} else if ( item?.previousElementSibling ) {
			next = item?.previousElementSibling
		}

		item?.remove()

		// Focus next item
		next?.querySelector('input,select')?.focus()
	}

	clearLayers() {
		const ul = this.shadowRoot.querySelector( 'ul' )
		while ( ul.firstChild ) {
			ul.removeChild( ul.firstChild )
		}

		// Empty placeholder??
		// Create new layer node
		const template = document.createElement( 'template' )
		template.innerHTML = this.renderLayer( this.getDefaultLayerProps() )
		const node = template.content.cloneNode( true )
		ul.appendChild( node )
		ul.querySelector( 'input' )?.focus()

		this.setAttribute( 'value', JSON.stringify( this.getLayerValues() ) )
		this.dispatchEvent( new Event( 'change' ) )
	}

	/**
	 * Render single list item html string
	 *
	 * @return String
	 */
	renderLayer( props ) {
		const value = JSON.stringify( props )
		const strings = JSON.stringify( this.strings )
		return `
			<li>
				<fl-layer-group-item
					value='${ value }'
					strings='${ strings }'
				>
				</fl-layer-group-item>
			</li>
		`
	}

	renderDefaultLayer() {
		return this.renderLayer( this.getDefaultLayerProps() )
	}

	/**
	 * Assemble html string to be inserted into the shadow root.
	 *
	 * @return String
	 */
	renderShadow() {

		// Value should contain a serialized array of layer objects
		let layers = []
		if ( '' !== this.value ) {
			layers = JSON.parse( this.value )
		}
		return `
			<style>
				:host {
					box-sizing: border-box;
					box-shadow: var(--fl-builder-input-shadow);
				}
				:host-context(.fl-layer-group-cluster) {
					border-radius: 0;
				}
				ul {
					display: grid;
					list-style: none;
					margin: 0;
					padding: 0;
					gap: 1px;
					background: var(--fl-builder-outline-color);
				}
				li {
					display: grid;
					position: relative;
					background: var(--fl-builder-input-bg-color);
					min-height: var(--fl-builder-target-size);
				}
				li:focus-within {
					box-shadow: var(--fl-builder-focus-shadow);
				}
				.fl-layer-placeholder {
					min-height: var(--fl-builder-target-size);
				}
				button {
					border: none;
					background: transparent;
					outline: none;
					font-size: inherit;
					color: var(--fl-builder-dim-color);
				}
				.handle {
					display: flex;
					align-items: center;
					justify-content: center;
				}
				.handle, fl-layer-menu {
					opacity: 0;
				}
				li:hover .handle,
				li:focus-within .handle,
				li:hover fl-layer-menu,
				li:focus-within fl-layer-menu,
				fl-layer-menu[visible] {
					opacity: 1;
				}
			</style>
			<slot name="before"></slot>
			<ul>
				${ 0 >= layers.length ? this.renderDefaultLayer() : '' }
				${ 0 < layers.length ? layers.map( layer => this.renderLayer( layer ) ).join('') : '' }
			</ul>
			<slot name="after"></slot>
		`
	}
}
customElements.define( "fl-layer-group", FLLayerGroup )

const layerTypes = {
	default: {
		label: "Layer",

		bindEvents( layer ) {
			const input = layer.querySelector( 'input' )
			const onInput = this.onInput.bind( layer )
			input?.addEventListener( 'input', onInput )

			this.layer = layer
			const onKeyUp = this.onKeyUp.bind( this )
			input?.addEventListener( 'keyup', onKeyUp )

			// Track previous value for backspace
			const onKeyDown = e => this.lastValue = e.target.value
			input?.addEventListener( 'keydown', onKeyDown )

			// Cleanup
			return () => {
				input?.removeEventListener( 'input', onInput )
				input?.removeEventListener( 'keyup', onKeyUp )
				input?.removeEventListener( 'keydown', onKeyDown )
			}
		},

		onInput( e ) {
			const state = this.value
			this.value = { ...state, value: e.target.value }
		},

		onKeyUp( e ) {
			const layerGroup = this.layer.getRootNode().host

			switch( e.key ) {
				case 'Enter':
					const isCursorAtEnd = e.target.value.length === e.target.selectionStart
					if ( isCursorAtEnd && '' !== e.target.value ) {

						// Create new layer node
						const template = document.createElement( 'template' )
						template.innerHTML = layerGroup.renderLayer( { type: 'text', value: '' } )
						const node = template.content.cloneNode( true )
						this.layer.parentElement.after( node )
						this.layer.parentElement.nextElementSibling.querySelector('input')?.focus()
					}
					break;
				case 'Backspace':
					if ( '' === this.lastValue && 1 < layerGroup.getListElements().length ) {
						this.layer.delete()
					}
					break;
			}
		},

		render( props, type, strings ) {
			const placeholder = strings.addNew
			return `<input type="text" value='${ props.value }' placeholder='${ placeholder }' />`
		},
	},

	// Text type inherits all the default functionality
	text: {
		label: "Text",
	},

	// Grid Track - produces repeat( count, 1fr )
	'basic-track': {
		label: "Repeat",
		bindEvents( layer ) {
			this.layer = layer
			const stepperInput = layer.querySelector( 'input' )
			stepperInput?.addEventListener( 'change', this.onChange.bind( layer ) )
		},
		onChange( e ) {
			this.value = { ...this.value, value: e.target.value }
		},
		render( props, type ) {
			return `
				<div style="display: flex; align-items: center; font-size: 13px">
					<span>Number of Tracks:</span>
					<fl-stepper data-name="" min="0">
						<input type="hidden" name="" value="${ props.value }" />
					</fl-stepper>
				</div>
			`
		}
	},
}

class FLLayerGroupItem extends FLElement {

	defaultProps = {
		type: 'default',
		value: 'Untitled',
	}

	connectedCallback() {
		this.template.innerHTML = this.render()
		this.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()
	}

	bindEvents() {

		this.layerMenu = this.querySelector( 'fl-layer-menu' )

		// Bind Layer Type Object
		const layerType = this.getType( this.getProps()?.type )
		const layerTypeUnbindCallback = layerType?.bindEvents( this )

		// Duplicate Button
		const onCloneClicked = this.onCloneClicked.bind(this)
		const cloneButton = this.querySelector( 'button.clone' )
		cloneButton?.addEventListener( 'click', onCloneClicked )

		// Remove Button
		const onRemoveClicked = this.onRemoveClicked.bind(this)
		const removeButton = this.querySelector( 'button.remove' )
		removeButton?.addEventListener( 'click', onRemoveClicked )

		return () => {

			// Handle unbinding for the item's layer type object
			if ( 'function' === typeof layerTypeUnbindCallback ) {
				layerTypeUnbindCallback()
			}

			cloneButton?.removeEventListener( 'click', onCloneClicked )
			removeButton?.removeEventListener( 'click', onRemoveClicked )
		}
	}

	onRemoveClicked() {
		this.dispatchEvent( new CustomEvent( 'layer-remove', {
			detail: this,
			bubbles: true,
			composed: true,
		} ) )
	}

	onCloneClicked() {
		this.dispatchEvent( new CustomEvent( 'layer-clone', {
			detail: this,
			bubbles: true,
			composed: true,
		} ) )
		this.layerMenu?.close()
	}

	get value() {
		return JSON.parse( this.getAttribute( 'value' ) )
	}

	set value( newValue ) {
		this.setAttribute( 'value', JSON.stringify( newValue ) )
		this.dispatchEvent( new Event( 'layer-change', {
			bubbles: true,
			composed: true,
		} ) )
	}

	getType( name ) {
		const types = layerTypes
		const defaultType = layerTypes.default

		if ( name in types ) {
			return { ...defaultType, ...types[name] }
		}
		return defaultType
	}

	getProps() {
		return { ...this.defaultProps, ...this.value }
	}

	delete() {
		const previous = this.parentElement.previousElementSibling

		// Focus previous input and place cursor at the end
		const prevInput =  previous?.querySelector(':is(input)')
		const end = prevInput?.value.length

		if ( 'hidden' !== prevInput.getAttribute('type') ) {
			prevInput?.setSelectionRange(end, end)
			prevInput?.focus()
		}

		// Remove the layer
		this.parentElement.remove()
	}

	get strings() {
		return {
			...super.strings,
			...JSON.parse( this.getAttribute( 'strings' ) )
		}
	}

	render() {
		const props = this.getProps()
		const type = this.getType( props.type )
		const strings = this.strings

		return `
			<style>
				fl-layer-group-item {
					display: grid;
					grid-template-columns: 32px 1fr 32px;
					cursor: move;
				}
				:where( input, select ) {
					color: var(--fl-builder-dim-color);
					border: none;
					background: transparent;
				}
				:where(input,select):focus {
					border: none;
					outline: none;
				}
				.handle {
					pointer-events: none;
				}
			</style>
			<button class="handle">
				<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
					<path d="M11.7637 3.57913C12.0439 4.00296 11.8867 4.48147 11.374 4.48147H8.64648C8.12012 4.48147 7.95605 4.01663 8.25684 3.57913L9.54883 1.67874C9.77441 1.34378 10.2666 1.3301 10.4922 1.67874L11.7637 3.57913ZM5.67969 14.4756C4.24414 14.4756 3.5332 13.7715 3.5332 12.3565V7.64651C3.5332 6.23147 4.24414 5.52737 5.67969 5.52737H14.3203C15.7559 5.52737 16.4668 6.23831 16.4668 7.64651V12.3565C16.4668 13.7647 15.7559 14.4756 14.3203 14.4756H5.67969ZM5.69336 13.375H14.3066C14.9834 13.375 15.3662 13.0059 15.3662 12.3018V7.7012C15.3662 6.99026 14.9834 6.62796 14.3066 6.62796H5.69336C5.00977 6.62796 4.63379 6.99026 4.63379 7.7012V12.3018C4.63379 13.0059 5.00977 13.375 5.69336 13.375ZM11.7637 16.417L10.4922 18.3242C10.2666 18.666 9.77441 18.6592 9.54883 18.3242L8.25684 16.417C7.95605 15.9795 8.12012 15.5215 8.64648 15.5215H11.374C11.8867 15.5215 12.0439 16 11.7637 16.417Z" fill="currentColor"/>
				</svg>
			</button>
			${ type.render( props, type, strings ) }
			<fl-layer-menu>
				<button class="clone">${strings.clone}</button>
				<button class="remove">${strings.delete}</button>
			</fl-layer-menu>
		`
	}
}
customElements.define( "fl-layer-group-item", FLLayerGroupItem )


class FLLayerGroupToolbar extends FLElement {

	defaultStrings = {
		clear: 'Clear',
		addNew: 'Add New Layer',
	}

	constructor() {
		super()
		this.attachShadow( { mode: 'open' } )
	}

	connectedCallback() {
		this.template.innerHTML = this.renderShadowRoot()
		this.shadowRoot.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()
	}

	bindEvents() {
		this.addMenu = this.shadowRoot.querySelector( '.add-menu' )

		const addButton = this.shadowRoot.querySelector('.add')
		const addClicked = this.addClicked.bind(this)
		addButton?.addEventListener( 'click', addClicked )

		const clearButton = this.shadowRoot.querySelector('.clear')
		const clearClicked = this.resetClicked.bind(this)
		clearButton?.addEventListener( 'click', clearClicked )

		const menuButtonClicked = this.menuButtonClicked.bind(this)
		const menuButtons = this.shadowRoot.querySelectorAll('.add-menu button')
		menuButtons?.forEach( button => button.addEventListener( 'click', menuButtonClicked ) )

		return () => {
			addButton?.removeEventListener( 'click', addClicked )
			clearButton?.removeEventListener( 'click', clearClicked )
			menuButtons?.forEach( button => button.removeEventListener( 'click', menuButtonClicked ) )
		}
	}

	addClicked() {
		if ( this.layerGroup.supportsMultipleLayerTypes() ) {
			this.toggleMenu()
		} else {
			this.dispatchEvent( new CustomEvent( 'add', {
				detail: {
					type: 'text',
					value: ''
				}
			} ) )
		}
	}

	resetClicked() {
		this.dispatchEvent( new Event( 'reset' ) )
	}

	menuButtonClicked( e ) {
		const type = JSON.parse( e.target.getAttribute( 'data-type' ) )
		this.dispatchEvent( new CustomEvent( 'add', { detail: type } ) )
		this.hideMenu()
	}

	showMenu() {
		this.addMenu?.open()
		return
	}

	hideMenu() {
		this.addMenu?.close()
	}

	toggleMenu() {
		this.addMenu?.isOpen() ? this.addMenu?.close() : this.addMenu?.open()
	}

	renderAddMenu() {
		const items = [
			{
				label: 'Multiple Tracks',
				props: { type: 'basic-track', value: '3' },
			},
			{
				label: 'Freeform Text',
				props: { type: 'text', value: '' },
			},
			{
				label: 'Auto',
				props: { type: 'text', value: 'auto' },
			},
			{
				label: '1fr',
				props: { type: 'text', value: '1fr' },
			},
		]
		return `
			<fl-menu class="add-menu">
				${ items.map( item => {
					return `<button data-type='${ JSON.stringify( item.props ) }'>${ item.label }</button>`
				} ).join('') }
			</fl-menu>
		`
	}

	renderShadowRoot() {
		return `
			<style>
				:host {
					--height: 24px;
					display: flex;
					background: var(--fl-builder-heading-bg-color);
					height: var(--height);
					border-bottom: 1px solid var(--fl-builder-outline-color);
				}
				* {
					font-size: 12px;
					color: var(--fl-builder-dim-color);
				}
				div.label {

					flex-grow: 1;
					display: flex;
					align-items: center;
					padding: 0 10px;
				}
				:where( :host > button, .add-wrap > button ) {
					border: none;
					background: inherit;
					outline: none;
					font-size: inherit;
					display: flex;
					place-items: center;
					place-content: center;
				}
				button.add {
					min-width: 32px;
					display: flex;
				}

				:where( :host > button, .add-wrap > button ):hover,
				:where( :host > button, .add-wrap > button ):host > button:focus-visible {
					background: var(--fl-builder-platter-bg-color);
				}
				:where( :host > button, .add-wrap > button ):focus-visible {
					box-shadow: var(--fl-builder-focus-shadow);
					color: var(--fl-builder-accent-color);
				}
				:where( :host > button, .add-wrap > button ) * {
					pointer-events: none;
				}

				.add-wrap {
					position:relative;
					display: grid;
				}
				.add-wrap:hover {
					background: var(--fl-builder-input-bg-color);
				}
			</style>
			<div class="label"><slot></slot></div>
			<button class="clear">${ this.strings.clear }</button>
			<div class="add-wrap">
				<button class="add" title='${ this.strings.addNew }'>
					<svg width="15" height="20" viewBox="0 0 15 20" fill="none">
						<path d="M13.1569 10.0001H1.84315" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
						<path d="M7.5 4.34326V15.657" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
					</svg>
				</button>
				${ this.renderAddMenu() }
			</div>
		`
	}
}
customElements.define( "fl-layer-group-heading", FLLayerGroupToolbar )


class FLLayerMenu extends FLElement {

	// cached for adding/removeing listeners without creating new functions each time
	dismissCallback = this.maybeDismissMenu.bind(this)

	static get observedAttributes() {
		return [ 'visible' ]
	}

	constructor() {
		super()
		this.attachShadow( { mode: 'open' } )
		this.template = document.createElement( 'template' )
	}

	connectedCallback() {
		this.template.innerHTML = this.renderShadow()
		this.shadowRoot.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()

		if ( this.hasAttribute( 'visible' ) ) {
			this.showMenu()
		}
	}

	attributeChangedCallback( name, oldValue, newValue ) {
		if ( 'visible' === name ) {
			null === newValue ? this.hideMenu() : this.showMenu()
		}
	}

	bindEvents() {
		this.button = this.shadowRoot.querySelector('button')
		const toggle = this.toggleVisible.bind(this)
		this.button.addEventListener( 'click', toggle )

		return () => {
			this.button.removeEventListener( 'click', toggle )
			document.removeEventListener( 'click', this.dismissCallback )
			document.removeEventListener( 'keyup', this.dismissCallback )
		}
	}

	toggleVisible() {
		this.hasAttribute( 'visible' ) ? this.close() : this.open()
	}

	close() {
		this.removeAttribute( 'visible' )
	}

	open() {
		this.setAttribute( 'visible', '' )
	}

	/**
	 * Dismiss the menu if either clicking outside or hitting escape.
	*/
	maybeDismissMenu( e ) {
		if ( ! e.composedPath().includes( this ) || 'Escape' === e.key ) {
			this.removeAttribute( 'visible' )
		}
	}

	showMenu() {
		const menuTemplate = document.createElement( 'template' )
		menuTemplate.innerHTML = this.renderMenu()
		this.shadowRoot.appendChild( menuTemplate.content.cloneNode( true ) )

		// Add listener for click away
		document.addEventListener( 'click', this.dismissCallback )
		document.addEventListener( 'keyup', this.dismissCallback )
	}

	hideMenu() {
		const menu = this.shadowRoot.querySelector( '.menu' )
		menu?.remove()

		// Remove click away listener
		document.removeEventListener( 'click', this.dismissCallback )
		document.removeEventListener( 'keyup', this.dismissCallback )
	}

	renderMenu() {
		return `
			<div class="menu">
				<slot></slot>
			</div>
		`
	}

	renderShadow() {
		return `
			<style>
				:host {
					flex-grow: 1;
					display: flex;
				}
				.label {
					flex-grow: 1;
					display: flex;
					align-items: center;
					padding: 0 10px;
				}
				button {
					border: none;
					background: inherit;
					outline: none;
					font-size: inherit;
					color: inherit;
					display: flex;
					place-items: center;
					color: var(--fl-builder-dim-color);
				}
				.menu {
					display: grid;
					grid-auto-rows: var(--fl-builder-target-size);
					gap: 1px;
					background: var(--fl-builder-input-bg-color);
					box-shadow: var(--fl-builder-input-shadow), 0 10px 20px hsla(0deg, 0%, 0%, .25);
					position: absolute;
					top: calc( 100% + 1px );
					right: 0;
					width: calc( 100% - 32px );
					max-width: 120px;
					z-index: 9;
				}
			</style>
			<button>
				<svg width="20" height="21" viewBox="0 0 20 21" fill="none">
					<path d="M10 15.2861C8.895 15.2861 8 16.1811 8 17.2861C8 18.3911 8.895 19.2861 10 19.2861C11.105 19.2861 12 18.3911 12 17.2861C12 16.1811 11.105 15.2861 10 15.2861Z" fill="currentColor"/>
					<path d="M10 1.28613C8.895 1.28613 8 2.18113 8 3.28613C8 4.39113 8.895 5.28613 10 5.28613C11.105 5.28613 12 4.39113 12 3.28613C12 2.18113 11.105 1.28613 10 1.28613Z" fill="currentColor"/>
					<path d="M10 8.28613C8.895 8.28613 8 9.18113 8 10.2861C8 11.3911 8.895 12.2861 10 12.2861C11.105 12.2861 12 11.3911 12 10.2861C12 9.18113 11.105 8.28613 10 8.28613Z" fill="currentColor"/>
				</svg>
			</button>
		`
	}
}
customElements.define( "fl-layer-menu", FLLayerMenu );
// source --> https://bbasesores.com/wp-content/plugins/beaver-builder-lite-version/modules/box/js/custom-elements/fl-grid-tracklist.js?ver=2.9.4.2 
class FLGridTrackList extends FLElement {

	defaultStrings = {
		columns: 'Columns',
		rows: 'Rows',
		auto_columns: 'Auto Columns',
		auto_rows: 'Auto Rows',
		clear: 'Clear',
		addNew: 'Add New...',
		clone: 'Duplicate',
		delete: 'Remove',
	}

	connectedCallback() {
		this.template.innerHTML = this.render()
		this.replaceChildren( this.template.content.cloneNode( true ) )
		this.unbindEventsCallback = this.bindEvents()
	}

	bindEvents() {
		this.lists = this.querySelectorAll( 'fl-layer-group' )
		const onChange = this.onChange.bind(this)
		this.lists.forEach( list => {
			list.addEventListener( 'change', () => onChange( list ) )
		} )
	}

	onChange( list ) {

		// Update hidden input for this list
		const inputName = `${this.name}[${list.name}]`
		const input = this.querySelector(`input[name="${inputName}"]`)

		input?.setAttribute( 'value', list.value )
		input?.dispatchEvent( new Event( 'change', { bubbles: true } ) )

		const cssInputName = `${this.name}[${list.name}_css]`
		const css = this.getCSS( list.value )
		const cssInput = this.querySelector(`input[name="${cssInputName}"]`)
		cssInput?.setAttribute( 'value', css )
		cssInput?.dispatchEvent( new Event( 'change', { bubbles: true } ) )
	}

	get name() {
		return this.getAttribute( 'name' )
	}

	getCSS( value ) {
		if ( '' === value ) {
			return ''
		}

		let layers = JSON.parse( value )
		if ( 'string' === typeof layers ) {
			layers = []
		}

		const tracks = layers.map( layer => {
			switch( layer.type ) {
				case 'basic-track':
					const count = layer.value
					return `repeat(${count},1fr)`
				default:
					return layer.value
			}
		} )
		return tracks.join(' ')
	}

	render() {
		const strings = this.strings
		const values = JSON.parse( this.getAttribute( 'value' ) )

		this.removeAttribute( 'value' )
		const lists = [ 'columns', 'rows' ]
		return `
			<div class="fl-layer-group-cluster" style="display: grid; gap: 1px">
				${ lists.map( list => {
						const value = values && Array.isArray( values[list] ) ? JSON.stringify( values[list] ) : ''
						const inputName = `${ this.name }[${list}]`
						const cssInputName = `${ this.name }[${list}_css]`

						return `
							<fl-layer-group
								name='${list}'
								value='${ value }'
								strings='${ JSON.stringify( strings ) }'
							>
								<fl-layer-group-heading
									slot='before'
									strings='${ JSON.stringify( {
										...strings,
										clear: strings.clear,
									} ) }'
								>${ strings[list] }</fl-layer-group-heading>
							</fl-layer-group>
							<input type="hidden" name='${ inputName }' value='${ value }' />
							<input type="hidden" name='${ cssInputName }' value='${ this.getCSS( value ) }' />
						`
				} ).join('') }
			</div>
		`
	}
}
customElements.define( "fl-grid-tracklist", FLGridTrackList );