(()=>{"use strict";var e={17:e=>{e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},20:(e,t,r)=>{var n=r(609),o=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var n,c={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,n)&&!a.hasOwnProperty(n)&&(c[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===c[n]&&(c[n]=t[n]);return{$$typeof:o,type:e,key:l,ref:u,props:c,_owner:s.current}}},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{FILE:()=>Se,HTML:()=>Ee,TEXT:()=>Te,URL:()=>Oe});var o=r(609);const i=window.wp.element;var s=r(848);function a(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var c="function"==typeof Symbol&&Symbol.observable||"@@observable",l=function(){return Math.random().toString(36).substring(7).split("").join(".")},u={INIT:"@@redux/INIT"+l(),REPLACE:"@@redux/REPLACE"+l(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+l()}};function d(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(a(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(a(1));return r(d)(e,t)}if("function"!=typeof e)throw new Error(a(2));var o=e,i=t,s=[],l=s,g=!1;function h(){l===s&&(l=s.slice())}function f(){if(g)throw new Error(a(3));return i}function p(e){if("function"!=typeof e)throw new Error(a(4));if(g)throw new Error(a(5));var t=!0;return h(),l.push(e),function(){if(t){if(g)throw new Error(a(6));t=!1,h();var r=l.indexOf(e);l.splice(r,1),s=null}}}function v(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(a(7));if(void 0===e.type)throw new Error(a(8));if(g)throw new Error(a(9));try{g=!0,i=o(i,e)}finally{g=!1}for(var t=s=l,r=0;r=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,s);if(null==c)return void e.dispatch(S);let l=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){g("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),l=i(c)}e.dispatch(b(o,l));const u=a.getSource(c).beginDrag(s,c);if(null==u)return;!function(e){g(h(e),"Item must be an object.")}(u),a.pinSource(c);const d=a.getSourceType(c);return{type:p,payload:{itemType:d,item:u,sourceId:c,clientOffset:o||null,sourceClientOffset:l||null,isSourcePublic:!!n}}}}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e){for(var t=1;t{const s=function(e,t,r,n){const o=r.getTarget(e);let i=o?o.drop(n,e):void 0;return function(e){g(void 0===e||h(e),"Drop result must either be an object or undefined.")}(i),void 0===i&&(i=0===t?{}:n.getDropResult()),i}(o,i,n,r),a={type:y,payload:{dropResult:E({},t,s)}};e.dispatch(a)}))}}function w(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){g(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();return null!=n&&(r.getSource(n,!0).endDrag(t,n),r.unpinSource()),{type:D}}}function C(e,t){return null===t?null===e:Array.isArray(e)?e.some((e=>e===t)):e===t}function P(e){return function(t,{clientOffset:r}={}){!function(e){g(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const o=e[n];C(t.getTargetType(o),r)||e.splice(n,1)}}(n,i,o.getItemType()),function(e,t,r){g(t.isDragging(),"Cannot call hover while not dragging."),g(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t{const i=r[o];var s;return n[o]=(s=i,(...r)=>{const n=s.apply(e,r);void 0!==n&&t(n)}),n}),{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function R(e,t){return{x:e.x-t.x,y:e.y-t.y}}const _=[],M=[];_.__IS_NONE__=!0,M.__IS_ALL__=!0;class j{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;g("function"==typeof e,"listener must be a function."),g(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe((()=>{const t=this.store.getState(),o=t.stateId;try{const i=o===n||o===n+1&&!function(e,t){return e!==_&&(e===M||void 0===t||(r=e,t.filter((e=>r.indexOf(e)>-1))).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=o}}))}subscribeToOffsetChange(e){g("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe((()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())}))}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return g(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);return g(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&(C(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);return g(t,`Expected to find a valid source. sourceId=${e}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),o=this.getItemType();if(o&&!C(n,o))return!1;const i=this.getTargetIds();if(!i.length)return!1;const s=i.indexOf(e);return r?s===i.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?R((i=n,{x:(o=t).x+i.x,y:o.y+i.y}),r):null;var o,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?R(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const k="undefined"!=typeof global?global:self,L=k.MutationObserver||k.WebKitMutationObserver;function A(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const H="function"==typeof L?function(e){let t=1;const r=new L(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:A;class U{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const F=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.indexthis.capacity){for(let t=0,r=e.length-this.index;t{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=H(this.flush),this.requestErrorThrow=A((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},B=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new U(this.onError,(e=>t[t.length]=e));return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(F.registerPendingError),G="dnd-core/ADD_SOURCE",W="dnd-core/ADD_TARGET",X="dnd-core/REMOVE_SOURCE",$="dnd-core/REMOVE_TARGET";function q(e,t){t&&Array.isArray(e)?e.forEach((e=>q(e,!1))):g("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var V;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(V||(V={}));let Y=0;function K(e){switch(e[0]){case"S":return V.SOURCE;case"T":return V.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function z(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,o]}=r.next();if(o===t)return!0;n=!!e}while(!n);return!1}class J{addSource(e,t){q(e),function(e){g("function"==typeof e.canDrag,"Expected canDrag to be a function."),g("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),g("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(V.SOURCE,e,t);return this.store.dispatch(function(e){return{type:G,payload:{sourceId:e}}}(r)),r}addTarget(e,t){q(e,!0),function(e){g("function"==typeof e.canDrop,"Expected canDrop to be a function."),g("function"==typeof e.hover,"Expected hover to be a function."),g("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(V.TARGET,e,t);return this.store.dispatch(function(e){return{type:W,payload:{targetId:e}}}(r)),r}containsHandler(e){return z(this.dragSources,e)||z(this.dropTargets,e)}getSource(e,t=!1){return g(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return g(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return g(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return g(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return K(e)===V.SOURCE}isTargetId(e){return K(e)===V.TARGET}removeSource(e){var t;g(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:X,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},F.enqueueTask(B.create(t))}removeTarget(e){g(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:$,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);g(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){g(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=function(e){const t=(Y++).toString();switch(e){case V.SOURCE:return`S${t}`;case V.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(n,t),e===V.SOURCE?this.dragSources.set(n,r):e===V.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const Q=(e,t)=>e===t;function Z(e=_,t){switch(t.type){case m:break;case G:case W:case $:case X:return _;default:return M}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,o=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const o=[];return r.forEach(((e,t)=>{1===e&&o.push(t)})),o}(r,n);if(!(o.length>0)&&function(e,t,r=Q){if(e.length!==t.length)return!1;for(let n=0;ne!==o)))});case y:return oe({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case D:return oe({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,o}function ae(e=0,t){switch(t.type){case G:case W:return e+1;case X:case $:return e-1;default:return e}}function ce(e=0){return e+1}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e){for(var t=1;te&&e[t]?e[t]:n||null),r))})}),dragOffset:re(e.dragOffset,t),refCount:ae(e.refCount,t),dragOperation:se(e.dragOperation,t),stateId:ce(e.stateId)};var r,n}function ge(e,t=void 0,r={},n=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return d(de,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new j(o,new J(o)),s=new x(o,i),a=e(s,t,r);return s.receiveBackend(a),s}const he=(0,o.createContext)({dragDropManager:void 0});let fe=0;const pe=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var ve=(0,o.memo)((function(e){var{children:t}=e,r=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["children"]);const[n,i]=function(e){if("manager"in e)return[{dragDropManager:e.manager},!1];return[function(e,t=me(),r,n){const o=t;return o[pe]||(o[pe]={dragDropManager:ge(e,t,r,n)}),o[pe]}(e.backend,e.context,e.options,e.debugMode),!e.context]}(r);return(0,o.useEffect)((()=>{if(i){const e=me();return++fe,()=>{0==--fe&&(e[pe]=null)}}}),[]),(0,s.jsx)(he.Provider,{value:n,children:t})}));function me(){return"undefined"!=typeof global?global:window}function ye(e){let t=null;return()=>(null==t&&(t=e()),t)}class De{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const o=[];return r.forEach((e=>o.push(e))),o}(this.entered.filter((t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e)))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter((e=>e!==n))),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class be{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})}))}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach((r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Se="__NATIVE_FILE__",Oe="__NATIVE_URL__",Te="__NATIVE_TEXT__",Ee="__NATIVE_HTML__";function Ie(e,t,r){const n=t.reduce(((t,r)=>t||e.getData(r)),"");return null!=n?n:r}const we={[Se]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Ee]:{exposeProperties:{html:(e,t)=>Ie(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Oe]:{exposeProperties:{urls:(e,t)=>Ie(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[Te]:{exposeProperties:{text:(e,t)=>Ie(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Ce(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(we).filter((e=>{const r=we[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some((e=>t.indexOf(e)>-1))}))[0]||null}const Pe=ye((()=>/firefox/i.test(navigator.userAgent))),Ne=ye((()=>Boolean(window.safari)));class xe{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:o,c3s:i}=this;let s=t.length-1;if(e===t[s])return r[s];let a,c=0,l=i.length-1;for(;c<=l;){a=Math.floor(.5*(c+l));const n=t[a];if(ne))return r[a];l=a-1}}s=Math.max(0,l);const u=e-t[s],d=u*u;return r[s]+n[s]*u+o[s]*d+i[s]*u*d}constructor(e,t){const{length:r}=e,n=[];for(let e=0;ee[t]{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return ke({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return ke({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(n).some((t=>n[t]===e))}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=we[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new be(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var e;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Re(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null})))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=_e(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,o=Ce(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){const{anchorX:e,anchorY:i,offsetX:s,offsetY:a}=this.getCurrentSourcePreviewNodeOptions(),c=function(e,t,r,n,o){const i="IMG"===(s=t).nodeName&&(Pe()||!(null===(a=document.documentElement)||void 0===a?void 0:a.contains(s)));var s,a;const c=Re(i?e:t),l={x:r.x-c.x,y:r.y-c.y},{offsetWidth:u,offsetHeight:d}=e,{anchorX:g,anchorY:h}=n,{dragPreviewWidth:f,dragPreviewHeight:p}=function(e,t,r,n){let o=e?t.width:r,i=e?t.height:n;return Ne()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(i,t,u,d),{offsetX:v,offsetY:m}=o,y=0===m||m;return{x:0===v||v?v:new xe([0,.5,1],[l.x,l.x/u*f,l.x+f-u]).interpolate(g),y:y?m:(()=>{let e=new xe([0,.5,1],[l.y,l.y/d*p,l.y+p-d]).interpolate(h);return Ne()&&i&&(e+=(window.devicePixelRatio-1)*p),e})()}}(t,o,r,{anchorX:e,anchorY:i},{offsetX:s,offsetY:a});n.setDragImage(o,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(o)this.beginDragNativeItem(o);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)),!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=Ce(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:_e(e)}),t.some((e=>this.monitor.canDropOnTarget(e)))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{var t;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=_e(e),this.scheduleHover(t),(t||[]).some((e=>this.monitor.canDropOnTarget(e)))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;this.dropTargetIds=[],this.isDraggingNativeItem()?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):Ce(e.dataTransfer)&&e.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:_e(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Me(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new De(this.isNodeInDocument)}}const Ae=function(e,t,r){return new Le(e,t,r)};var He=r(17);const Ue="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;function Fe(e,t,r){return function(e,t,r){const[n,i]=function(e,t,r){const[n,i]=(0,o.useState)((()=>t(e))),s=(0,o.useCallback)((()=>{const o=t(e);He(n,o)||(i(o),r&&r())}),[n,e,r]);return Ue(s),[n,s]}(e,t,r);return Ue((function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})}),[e,i]),n}(t,e||(()=>({})),(()=>r.reconnect()))}function Be(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,o.useMemo)((()=>"function"==typeof e?e():e),r)}function Ge(e){return(0,o.useMemo)((()=>e.hooks.dropTarget()),[e])}function We(e,t,r,n){let o=r?r.call(n,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;const a=Object.prototype.hasOwnProperty.bind(t);for(let s=0;s{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=function(e){return(t=null,r=null)=>{if(!(0,o.isValidElement)(t)){const n=t;return e(n,r),n}const n=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a
, or turn it into a drag source or a drop target itself.`)}(n),function(e,t){const r=e.ref;return g("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,o.cloneElement)(e,{ref:e=>{qe(r,e),qe(t,e)}}):(0,o.cloneElement)(e,{ref:t})}(n,r?t=>e(t,r):e)}}(n);t[r]=()=>e}})),t}function qe(e,t){"function"==typeof e?e(t):e.current=t}class Ve{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!We(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=$e({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Xe(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function Ye(){const{dragDropManager:e}=(0,o.useContext)(he);return g(null!=e,"Expected drag drop context"),e}let Ke=!1;class ze{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;g(!Ke,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Ke=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Ke=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class Je{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function Qe(e,t){const r=Be(e,t),n=function(){const e=Ye();return(0,o.useMemo)((()=>new ze(e)),[e])}(),i=function(e){const t=Ye(),r=(0,o.useMemo)((()=>new Ve(t.getBackend())),[t]);return Ue((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const n=Ye(),i=function(e,t){const r=(0,o.useMemo)((()=>new Je(e,t)),[t]);return(0,o.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),s=function(e){const{accept:t}=e;return(0,o.useMemo)((()=>(g(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);Ue((function(){const[e,o]=function(e,t,r){const n=r.getRegistry(),o=n.addTarget(e,t);return[o,()=>n.removeTarget(o)]}(s,i,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),o}),[n,t,i,r,s.map((e=>e.toString())).join("|")])}(r,n,i),[Fe(r.collect,n,i),Ge(i)]}const Ze=window.wp.components;function et(e){return(0,o.useMemo)((()=>e.hooks.dragSource()),[e])}function tt(e){return(0,o.useMemo)((()=>e.hooks.dragPreview()),[e])}class rt{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!We(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!We(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=$e({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Xe(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Xe(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}let nt=!1,ot=!1;class it{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){g(!nt,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return nt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{nt=!1}}isDragging(){if(!this.sourceId)return!1;g(!ot,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ot=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ot=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class st{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:o}=r;return o?o(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function at(e,t){const r=Be(e,t);g(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=Ye();return(0,o.useMemo)((()=>new it(e)),[e])}(),i=function(e,t){const r=Ye(),n=(0,o.useMemo)((()=>new rt(r.getBackend())),[r]);return Ue((()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource())),[n,e]),Ue((()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview())),[n,t]),n}(r.options,r.previewOptions);return function(e,t,r){const n=Ye(),i=function(e,t,r){const n=(0,o.useMemo)((()=>new st(e,t,r)),[t,r]);return(0,o.useEffect)((()=>{n.spec=e}),[e]),n}(e,t,r),s=function(e){return(0,o.useMemo)((()=>{const t=e.type;return g(null!=t,"spec.type must be defined"),t}),[e])}(e);Ue((function(){if(null!=s){const[e,o]=function(e,t,r){const n=r.getRegistry(),o=n.addSource(e,t);return[o,()=>n.removeSource(o)]}(s,i,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),o}}),[n,t,r,i,s])}(r,n,i),[Fe(r.collect,n,i),et(i),tt(i)]}const ct=({id:e,index:t,moveItem:r,postType:n,children:s})=>{const[{isDragging:a},c]=at((0,i.useCallback)((()=>({type:"rule",item:{id:e,index:t},collect:e=>({isDragging:!!e.isDragging()})})),[e,t])),[,l]=Qe((0,i.useCallback)((()=>({accept:"rule",hover:e=>{e.index!==t&&(r(e.index,t),e.index=t)}})),[t,r])),[u,d]=(0,i.useState)("post"),[g,h]=(0,i.useState)("has_subscription"),[f,p]=(0,i.useState)(""),[v,m]=(0,i.useState)(""),[y,D]=(0,i.useState)([]),[b,S]=(0,i.useState)([]),[O,T]=(0,i.useState)([]),[E,I]=(0,i.useState)(0),[w,C]=(0,i.useState)("characters"),[P,N]=(0,i.useState)("="),[x,R]=(0,i.useState)(""),[_,M]=(0,i.useState)("="),[j,k]=(0,i.useState)("="),[L,A]=(0,i.useState)(""),[H,U]=(0,i.useState)(""),[F,B]=(0,i.useState)("=");(0,i.useEffect)((()=>{"role"===g&&fetch("/localcontentpro/wp-json/lcp-paywall/v1/user-roles").then((e=>e.json())).then((e=>{D(e.map((e=>({label:e.name,value:e.key}))))})).catch((e=>console.error("Error fetching roles:",e)))}),[g]),(0,i.useEffect)((()=>{"post_term"===g&&n&&fetch(`/localcontentpro/wp-json/lcp-paywall/v1/taxonomies?post_type=${n}`).then((e=>e.json())).then((e=>{const t=Object.keys(e).map((t=>({label:e[t].name,value:t})));S(t)})).catch((e=>console.error("Error fetching taxonomies:",e)))}),[g,n]),(0,i.useEffect)((()=>{"post_term"===g&&v&&fetch(`/localcontentpro/wp-json/lcp-paywall/v1/terms?taxonomy=${v}`).then((e=>e.json())).then((e=>{const t=e.map((e=>({label:e.name,value:e.id})));T(t)})).catch((e=>console.error("Error fetching terms:",e)))}),[g,v]);const G=[{label:"=",value:"="},{label:"!=",value:"!="},{label:">",value:">"},{label:"<",value:"<"},{label:">=",value:">="},{label:"<=",value:"<="}],W=[{label:"Before",value:"before"},{label:"After",value:"after"},{label:"Between",value:"between"}],X=[{label:"In",value:"in"},{label:"Not In",value:"not in"}];return(0,o.createElement)("div",{ref:e=>c(l(e)),className:"lcp-paywall-draggable-item "+(a?"is-dragging":""),style:{opacity:a?.5:1}},(0,o.createElement)("div",{className:"lcp-paywall-rule-controls"},(0,o.createElement)(Ze.SelectControl,{value:u,options:[{label:"Current Post",value:"post"},{label:"Current User",value:"user"},{label:"Current User Device",value:"user_device"}],onChange:d}),(0,o.createElement)(Ze.SelectControl,{value:g,options:"post"===u?[{value:"post_content_length",label:"Post Content Length"},{value:"post",label:"Post"},{value:"meta_value",label:"Meta Value"},{value:"post_term",label:"Term"},{value:"author",label:"Author"},{value:"post_date",label:"Post Date"}]:"user"===u?[{label:"Has Subscription",value:"has_subscription"},{label:"Is Logged In",value:"is_logged_in"},{label:"Role In",value:"role"},{label:"Meta Value",value:"meta_value"},{label:"Registration Date",value:"registration_date"}]:[{label:"Browser",value:"browser"},{label:"Operating System",value:"os"}],onChange:h}),"meta_value"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.TextControl,{value:v,onChange:m,placeholder:"Meta Key"}),(0,o.createElement)(Ze.SelectControl,{value:j,options:G,onChange:k}),(0,o.createElement)(Ze.TextControl,{value:L,onChange:A,placeholder:"Meta Value"})),"role"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:f,options:X,onChange:p}),(0,o.createElement)(Ze.SelectControl,{value:v,options:y,onChange:m})),"term"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:f,options:X,onChange:p}),(0,o.createElement)(Ze.SelectControl,{value:v,options:b,onChange:m}),(0,o.createElement)(Ze.SelectControl,{value:v,options:O,onChange:m})),"post_content_length"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:P,options:G,onChange:N}),(0,o.createElement)(Ze.__experimentalNumberControl,{value:E,onChange:I}),(0,o.createElement)(Ze.SelectControl,{value:w,options:[{label:"Characters",value:"characters"},{label:"Words",value:"words"}],onChange:C})),"post_date"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:_,options:W,onChange:M}),(0,o.createElement)(Ze.DateTimePicker,{value:x,onChange:R})),"registration_date"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:F,options:W,onChange:B}),(0,o.createElement)(Ze.DateTimePicker,{value:H,onChange:U})),"author"===g&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.SelectControl,{value:f,options:X,onChange:p}))),s)},lt=({postType:e})=>{const[t,r]=(0,i.useState)([{id:Date.now()}]),[n,s]=(0,i.useState)(!1),[a,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(0),[d,g]=(0,i.useState)(1),[h,f]=(0,i.useState)("hour"),[p,v]=(0,i.useState)(3600),[{isOver:m},y]=Qe((()=>({accept:"rule",drop:()=>({postType:e.name}),collect:e=>({isOver:!!e.isOver()})}))),D=(0,i.useCallback)(((e,t)=>{r((r=>{const n=[...r],o=n[e];return n.splice(e,1),n.splice(t,0,o),n}))}),[]);return(0,i.useEffect)((()=>{v(d*({second:1,minute:60,hour:3600,day:86400,week:604800}[h]||0))}),[d,h]),(0,o.createElement)("div",{className:"lcp-paywall-post-type "+(m?"is-over":""),ref:y},(0,o.createElement)("h3",null,e.label),(0,o.createElement)(Ze.ToggleControl,{label:"Lock Posts By Default",checked:n,onChange:s}),(0,o.createElement)(Ze.ToggleControl,{label:"Enable Meter",checked:a,onChange:c}),a&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(Ze.__experimentalNumberControl,{label:"Meter Amount",value:l,onChange:u}),(0,o.createElement)(Ze.__experimentalNumberControl,{label:"Meter Cookie Duration",value:d,onChange:g}),(0,o.createElement)(Ze.SelectControl,{label:"Meter Cookie Units",value:h,options:[{label:"Minutes",value:"minute"},{label:"Hours",value:"hour"},{label:"Days",value:"day"},{label:"Weeks",value:"week"}],onChange:f}),(0,o.createElement)("p",null,(0,o.createElement)("strong",null,"Total Seconds:")," ",p)),(0,o.createElement)("div",{className:"lcp-paywall-rules-container"},t.map(((t,r)=>(0,o.createElement)(ct,{key:t.id,id:t.id,index:r,moveItem:D,postType:e.name})))),(0,o.createElement)("div",{className:"lcp-paywall-add-rule"},(0,o.createElement)(Ze.Button,{variant:"secondary",onClick:()=>{r([...t,{id:Date.now()}])},className:"lcp-paywall-add-rule-button"},"Add Rule")))},ut=()=>(0,o.createElement)(ve,{backend:Ae},(0,o.createElement)("div",{id:"lcp-paywall-app"},window.lcpPaywallData.postTypes.map((e=>(0,o.createElement)(lt,{key:e.name,postType:e})))));document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("lcp-paywall-app-container");e&&(0,i.render)((0,o.createElement)(ut,null),e)}))})();