Files
lcp-visualizer/blocks/bar-graph/build/index.js

1 line
136 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{"use strict";var t,e={845:(t,e,n)=>{var r={};n.r(r),n.d(r,{FILE:()=>Yt,HTML:()=>Jt,TEXT:()=>Kt,URL:()=>Wt});const i=window.wp.blocks,o=window.wp.i18n,a=window.wp.blockEditor,s=window.wp.components,l=window.wp.element;function c(t,e,...n){if("undefined"!=typeof process&&void 0===e)throw new Error("invariant requires an error message argument");if(!t){let t;if(void 0===e)t=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let r=0;t=new Error(e.replace(/%s/g,(function(){return n[r++]}))),t.name="Invariant Violation"}throw t.framesToPop=1,t}}var u=n(792);const h=window.React,d="undefined"!=typeof window?h.useLayoutEffect:h.useEffect;function f(t,e,n){return function(t,e,n){const[r,i]=function(t,e,n){const[r,i]=(0,h.useState)((()=>e(t))),o=(0,h.useCallback)((()=>{const o=e(t);u(r,o)||(i(o),n&&n())}),[r,t,n]);return d(o),[r,o]}(t,e,n);return d((function(){const e=t.getHandlerId();if(null!=e)return t.subscribeToStateChange(i,{handlerIds:[e]})}),[t,i]),r}(e,t||(()=>({})),(()=>n.reconnect()))}function p(t,e){const n=[...e||[]];return null==e&&"function"!=typeof t&&n.push(t),(0,h.useMemo)((()=>"function"==typeof t?t():t),n)}function g(t){return(0,h.useMemo)((()=>t.hooks.dragSource()),[t])}function v(t){return(0,h.useMemo)((()=>t.hooks.dragPreview()),[t])}function m(t,e,n,r){let i=n?n.call(r,t,e):void 0;if(void 0!==i)return!!i;if(t===e)return!0;if("object"!=typeof t||!t||"object"!=typeof e||!e)return!1;const o=Object.keys(t),a=Object.keys(e);if(o.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(e);for(let a=0;a<o.length;a++){const l=o[a];if(!s(l))return!1;const c=t[l],u=e[l];if(i=n?n.call(r,c,u,l):void 0,!1===i||void 0===i&&c!==u)return!1}return!0}function y(t){return null!==t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function b(t){const e={};return Object.keys(t).forEach((n=>{const r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{const t=function(t){return(e=null,n=null)=>{if(!(0,h.isValidElement)(e)){const r=e;return t(r,n),r}const r=e;return function(t){if("string"==typeof t.type)return;const e=t.type.displayName||t.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`)}(r),function(t,e){const n=t.ref;return c("string"!=typeof n,"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 <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?(0,h.cloneElement)(t,{ref:t=>{w(n,t),w(e,t)}}):(0,h.cloneElement)(t,{ref:e})}(r,n?e=>t(e,n):t)}}(r);e[n]=()=>t}})),e}function w(t,e){"function"==typeof t?t(e):t.current=e}class x{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,e=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return e&&this.disconnectDragSource(),this.handlerId?t?(e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),e):(this.lastConnectedDragSource=t,e):e}reconnectDragPreview(t=!1){const e=this.dragPreview,n=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(e?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.lastConnectedDragPreview=e)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!m(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!m(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(t){this.hooks=b({dragSource:(t,e)=>{this.clearDragSource(),this.dragSourceOptions=e||null,y(t)?this.dragSourceRef=t:this.dragSourceNode=t,this.reconnectDragSource()},dragPreview:(t,e)=>{this.clearDragPreview(),this.dragPreviewOptions=e||null,y(t)?this.dragPreviewRef=t:this.dragPreviewNode=t,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=t}}const _=(0,h.createContext)({dragDropManager:void 0});function C(){const{dragDropManager:t}=(0,h.useContext)(_);return c(null!=t,"Expected drag drop context"),t}let S=!1,D=!1;class O{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){c(!S,"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 S=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{S=!1}}isDragging(){if(!this.sourceId)return!1;c(!D,"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 D=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{D=!1}}subscribeToStateChange(t,e){return this.internalMonitor.subscribeToStateChange(t,e)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,e){return this.internalMonitor.isOverTarget(t,e)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}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(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}class T{beginDrag(){const t=this.spec,e=this.monitor;let n=null;return n="object"==typeof t.item?t.item:"function"==typeof t.item?t.item(e):{},null!=n?n:null}canDrag(){const t=this.spec,e=this.monitor;return"boolean"==typeof t.canDrag?t.canDrag:"function"!=typeof t.canDrag||t.canDrag(e)}isDragging(t,e){const n=this.spec,r=this.monitor,{isDragging:i}=n;return i?i(r):e===t.getSourceId()}endDrag(){const t=this.spec,e=this.monitor,n=this.connector,{end:r}=t;r&&r(e.getItem(),e),n.reconnect()}constructor(t,e,n){this.spec=t,this.monitor=e,this.connector=n}}function E(t,e){const n=p(t,e);c(!n.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 r=function(){const t=C();return(0,h.useMemo)((()=>new O(t)),[t])}(),i=function(t,e){const n=C(),r=(0,h.useMemo)((()=>new x(n.getBackend())),[n]);return d((()=>(r.dragSourceOptions=t||null,r.reconnect(),()=>r.disconnectDragSource())),[r,t]),d((()=>(r.dragPreviewOptions=e||null,r.reconnect(),()=>r.disconnectDragPreview())),[r,e]),r}(n.options,n.previewOptions);return function(t,e,n){const r=C(),i=function(t,e,n){const r=(0,h.useMemo)((()=>new T(t,e,n)),[e,n]);return(0,h.useEffect)((()=>{r.spec=t}),[t]),r}(t,e,n),o=function(t){return(0,h.useMemo)((()=>{const e=t.type;return c(null!=e,"spec.type must be defined"),e}),[t])}(t);d((function(){if(null!=o){const[t,a]=function(t,e,n){const r=n.getRegistry(),i=r.addSource(t,e);return[i,()=>r.removeSource(i)]}(o,i,r);return e.receiveHandlerId(t),n.receiveHandlerId(t),a}}),[r,e,n,i,o])}(n,r,i),[f(n.collect,r,i),g(i),v(i)]}function I(t){return(0,h.useMemo)((()=>t.hooks.dropTarget()),[t])}class k{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const e=this.dropTarget;this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=e,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,e,this.dropTargetOptions)):this.lastConnectedDropTarget=e)}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!m(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(t){this.hooks=b({dropTarget:(t,e)=>{this.clearDropTarget(),this.dropTargetOptions=e,y(t)?this.dropTargetRef=t:this.dropTargetNode=t,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}let M=!1;class j{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,e){return this.internalMonitor.subscribeToStateChange(t,e)}canDrop(){if(!this.targetId)return!1;c(!M,"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 M=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{M=!1}}isOver(t){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,t)}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(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}class N{canDrop(){const t=this.spec,e=this.monitor;return!t.canDrop||t.canDrop(e.getItem(),e)}hover(){const t=this.spec,e=this.monitor;t.hover&&t.hover(e.getItem(),e)}drop(){const t=this.spec,e=this.monitor;if(t.drop)return t.drop(e.getItem(),e)}constructor(t,e){this.spec=t,this.monitor=e}}function P(t,e){const n=p(t,e),r=function(){const t=C();return(0,h.useMemo)((()=>new j(t)),[t])}(),i=function(t){const e=C(),n=(0,h.useMemo)((()=>new k(e.getBackend())),[e]);return d((()=>(n.dropTargetOptions=t||null,n.reconnect(),()=>n.disconnectDropTarget())),[t]),n}(n.options);return function(t,e,n){const r=C(),i=function(t,e){const n=(0,h.useMemo)((()=>new N(t,e)),[e]);return(0,h.useEffect)((()=>{n.spec=t}),[t]),n}(t,e),o=function(t){const{accept:e}=t;return(0,h.useMemo)((()=>(c(null!=t.accept,"accept must be defined"),Array.isArray(e)?e:[e])),[e])}(t);d((function(){const[t,a]=function(t,e,n){const r=n.getRegistry(),i=r.addTarget(t,e);return[i,()=>r.removeTarget(i)]}(o,i,r);return e.receiveHandlerId(t),n.receiveHandlerId(t),a}),[r,e,i,n,o.map((t=>t.toString())).join("|")])}(n,r,i),[f(n.collect,r,i),I(i)]}const A=window.ReactJSXRuntime;function R(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var L="function"==typeof Symbol&&Symbol.observable||"@@observable",B=function(){return Math.random().toString(36).substring(7).split("").join(".")},H={INIT:"@@redux/INIT"+B(),REPLACE:"@@redux/REPLACE"+B(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+B()}};function $(t,e,n){var r;if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(R(0));if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error(R(1));return n($)(t,e)}if("function"!=typeof t)throw new Error(R(2));var i=t,o=e,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function u(){if(l)throw new Error(R(3));return o}function h(t){if("function"!=typeof t)throw new Error(R(4));if(l)throw new Error(R(5));var e=!0;return c(),s.push(t),function(){if(e){if(l)throw new Error(R(6));e=!1,c();var n=s.indexOf(t);s.splice(n,1),a=null}}}function d(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error(R(7));if(void 0===t.type)throw new Error(R(8));if(l)throw new Error(R(9));try{l=!0,o=i(o,t)}finally{l=!1}for(var e=a=s,n=0;n<e.length;n++)(0,e[n])();return t}return d({type:H.INIT}),(r={dispatch:d,subscribe:h,getState:u,replaceReducer:function(t){if("function"!=typeof t)throw new Error(R(10));i=t,d({type:H.REPLACE})}})[L]=function(){var t,e=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(R(11));function n(){t.next&&t.next(u())}return n(),{unsubscribe:e(n)}}})[L]=function(){return this},t},r}function z(t){return"object"==typeof t}const F="dnd-core/INIT_COORDS",U="dnd-core/BEGIN_DRAG",X="dnd-core/PUBLISH_DRAG_SOURCE",V="dnd-core/HOVER",G="dnd-core/DROP",q="dnd-core/END_DRAG";function Y(t,e){return{type:F,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const W={type:F,payload:{clientOffset:null,sourceClientOffset:null}};function K(t){return function(e=[],n={publishSource:!0}){const{publishSource:r=!0,clientOffset:i,getSourceClientOffset:o}=n,a=t.getMonitor(),s=t.getRegistry();t.dispatch(Y(i)),function(t,e,n){c(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach((function(t){c(n.getSource(t),"Expected sourceIds to be registered.")}))}(e,a,s);const l=function(t,e){let n=null;for(let r=t.length-1;r>=0;r--)if(e.canDragSource(t[r])){n=t[r];break}return n}(e,a);if(null==l)return void t.dispatch(W);let u=null;if(i){if(!o)throw new Error("getSourceClientOffset must be defined");!function(t){c("function"==typeof t,"When clientOffset is provided, getSourceClientOffset must be a function.")}(o),u=o(l)}t.dispatch(Y(i,u));const h=s.getSource(l).beginDrag(a,l);if(null==h)return;!function(t){c(z(t),"Item must be an object.")}(h),s.pinSource(l);const d=s.getSourceType(l);return{type:U,payload:{itemType:d,item:h,sourceId:l,clientOffset:i||null,sourceClientOffset:u||null,isSourcePublic:!!r}}}}function J(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){J(t,e,n[e])}))}return t}function Q(t){return function(e={}){const n=t.getMonitor(),r=t.getRegistry();!function(t){c(t.isDragging(),"Cannot call drop while not dragging."),c(!t.didDrop(),"Cannot call drop twice during one drag operation.")}(n);const i=function(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}(n);i.forEach(((i,o)=>{const a=function(t,e,n,r){const i=n.getTarget(t);let o=i?i.drop(r,t):void 0;return function(t){c(void 0===t||z(t),"Drop result must either be an object or undefined.")}(o),void 0===o&&(o=0===e?{}:r.getDropResult()),o}(i,o,r,n),s={type:G,payload:{dropResult:Z({},e,a)}};t.dispatch(s)}))}}function tt(t){return function(){const e=t.getMonitor(),n=t.getRegistry();!function(t){c(t.isDragging(),"Cannot call endDrag while not dragging.")}(e);const r=e.getSourceId();return null!=r&&(n.getSource(r,!0).endDrag(e,r),n.unpinSource()),{type:q}}}function et(t,e){return null===e?null===t:Array.isArray(t)?t.some((t=>t===e)):t===e}function nt(t){return function(e,{clientOffset:n}={}){!function(t){c(Array.isArray(t),"Expected targetIds to be an array.")}(e);const r=e.slice(0),i=t.getMonitor(),o=t.getRegistry();return function(t,e,n){for(let r=t.length-1;r>=0;r--){const i=t[r];et(e.getTargetType(i),n)||t.splice(r,1)}}(r,o,i.getItemType()),function(t,e,n){c(e.isDragging(),"Cannot call hover while not dragging."),c(!e.didDrop(),"Cannot call hover after drop.");for(let e=0;e<t.length;e++){const r=t[e];c(t.lastIndexOf(r)===e,"Expected targetIds to be unique in the passed array."),c(n.getTarget(r),"Expected targetIds to be registered.")}}(r,i,o),function(t,e,n){t.forEach((function(t){n.getTarget(t).hover(e,t)}))}(r,i,o),{type:V,payload:{targetIds:r,clientOffset:n||null}}}}function rt(t){return function(){if(t.getMonitor().isDragging())return{type:X}}}class it{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:e}=this.store,n=function(t){return{beginDrag:K(t),publishDragSource:rt(t),hover:nt(t),drop:Q(t),endDrag:tt(t)}}(this);return Object.keys(n).reduce(((r,i)=>{const o=n[i];var a;return r[i]=(a=o,(...n)=>{const r=a.apply(t,n);void 0!==r&&e(r)}),r}),{})}dispatch(t){this.store.dispatch(t)}constructor(t,e){this.isSetUp=!1,this.handleRefCountChange=()=>{const t=this.store.getState().refCount>0;this.backend&&(t&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!t&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=e,t.subscribe(this.handleRefCountChange)}}function ot(t,e){return{x:t.x-e.x,y:t.y-e.y}}const at=[],st=[];at.__IS_NONE__=!0,st.__IS_ALL__=!0;class lt{subscribeToStateChange(t,e={}){const{handlerIds:n}=e;c("function"==typeof t,"listener must be a function."),c(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let r=this.store.getState().stateId;return this.store.subscribe((()=>{const e=this.store.getState(),i=e.stateId;try{const o=i===r||i===r+1&&!function(t,e){return t!==at&&(t===st||void 0===e||(n=t,e.filter((t=>n.indexOf(t)>-1))).length>0);var n}(e.dirtyHandlerIds,n);o||t()}finally{r=i}}))}subscribeToOffsetChange(t){c("function"==typeof t,"listener must be a function.");let e=this.store.getState().dragOffset;return this.store.subscribe((()=>{const n=this.store.getState().dragOffset;n!==e&&(e=n,t())}))}canDragSource(t){if(!t)return!1;const e=this.registry.getSource(t);return c(e,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()&&e.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const e=this.registry.getTarget(t);return c(e,`Expected to find a valid target. targetId=${t}`),!(!this.isDragging()||this.didDrop())&&(et(this.registry.getTargetType(t),this.getItemType())&&e.canDrop(this,t))}isDragging(){return Boolean(this.getItemType())}isDraggingSource(t){if(!t)return!1;const e=this.registry.getSource(t,!0);return c(e,`Expected to find a valid source. sourceId=${t}`),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(t)===this.getItemType()&&e.isDragging(this,t))}isOverTarget(t,e={shallow:!1}){if(!t)return!1;const{shallow:n}=e;if(!this.isDragging())return!1;const r=this.registry.getTargetType(t),i=this.getItemType();if(i&&!et(r,i))return!1;const o=this.getTargetIds();if(!o.length)return!1;const a=o.indexOf(t);return n?a===o.length-1:a>-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(t){const{clientOffset:e,initialClientOffset:n,initialSourceClientOffset:r}=t;return e&&n&&r?ot((o=r,{x:(i=e).x+o.x,y:i.y+o.y}),n):null;var i,o}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(t){const{clientOffset:e,initialClientOffset:n}=t;return e&&n?ot(e,n):null}(this.store.getState().dragOffset)}constructor(t,e){this.store=t,this.registry=e}}const ct="undefined"!=typeof global?global:self,ut=ct.MutationObserver||ct.WebKitMutationObserver;function ht(t){return function(){const e=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(e),clearInterval(n),t()}}}const dt="function"==typeof ut?function(t){let e=1;const n=new ut(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}:ht;class ft{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,e){this.onError=t,this.release=e,this.task=null}}const pt=new class{enqueueTask(t){const{queue:e,requestFlush:n}=this;e.length||(n(),this.flushing=!0),e[e.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const e=this.index;if(this.index++,t[e].call(),this.index>this.capacity){for(let e=0,n=t.length-this.index;e<n;e++)t[e]=t[e+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=dt(this.flush),this.requestErrorThrow=ht((()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()}))}},gt=new class{create(t){const e=this.freeTasks,n=e.length?e.pop():new ft(this.onError,(t=>e[e.length]=t));return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}(pt.registerPendingError),vt="dnd-core/ADD_SOURCE",mt="dnd-core/ADD_TARGET",yt="dnd-core/REMOVE_SOURCE",bt="dnd-core/REMOVE_TARGET";function wt(t,e){e&&Array.isArray(t)?t.forEach((t=>wt(t,!1))):c("string"==typeof t||"symbol"==typeof t,e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var xt;!function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"}(xt||(xt={}));let _t=0;function Ct(t){switch(t[0]){case"S":return xt.SOURCE;case"T":return xt.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function St(t,e){const n=t.entries();let r=!1;do{const{done:t,value:[,i]}=n.next();if(i===e)return!0;r=!!t}while(!r);return!1}class Dt{addSource(t,e){wt(t),function(t){c("function"==typeof t.canDrag,"Expected canDrag to be a function."),c("function"==typeof t.beginDrag,"Expected beginDrag to be a function."),c("function"==typeof t.endDrag,"Expected endDrag to be a function.")}(e);const n=this.addHandler(xt.SOURCE,t,e);return this.store.dispatch(function(t){return{type:vt,payload:{sourceId:t}}}(n)),n}addTarget(t,e){wt(t,!0),function(t){c("function"==typeof t.canDrop,"Expected canDrop to be a function."),c("function"==typeof t.hover,"Expected hover to be a function."),c("function"==typeof t.drop,"Expected beginDrag to be a function.")}(e);const n=this.addHandler(xt.TARGET,t,e);return this.store.dispatch(function(t){return{type:mt,payload:{targetId:t}}}(n)),n}containsHandler(t){return St(this.dragSources,t)||St(this.dropTargets,t)}getSource(t,e=!1){return c(this.isSourceId(t),"Expected a valid source ID."),e&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return c(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return c(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return c(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return Ct(t)===xt.SOURCE}isTargetId(t){return Ct(t)===xt.TARGET}removeSource(t){var e;c(this.getSource(t),"Expected an existing source."),this.store.dispatch(function(t){return{type:yt,payload:{sourceId:t}}}(t)),e=()=>{this.dragSources.delete(t),this.types.delete(t)},pt.enqueueTask(gt.create(e))}removeTarget(t){c(this.getTarget(t),"Expected an existing target."),this.store.dispatch(function(t){return{type:bt,payload:{targetId:t}}}(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const e=this.getSource(t);c(e,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=e}unpinSource(){c(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,e,n){const r=function(t){const e=(_t++).toString();switch(t){case xt.SOURCE:return`S${e}`;case xt.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}(t);return this.types.set(r,e),t===xt.SOURCE?this.dragSources.set(r,n):t===xt.TARGET&&this.dropTargets.set(r,n),r}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const Ot=(t,e)=>t===e;function Tt(t=at,e){switch(e.type){case V:break;case vt:case mt:case bt:case yt:return at;default:return st}const{targetIds:n=[],prevTargetIds:r=[]}=e.payload,i=function(t,e){const n=new Map,r=t=>{n.set(t,n.has(t)?n.get(t)+1:1)};t.forEach(r),e.forEach(r);const i=[];return n.forEach(((t,e)=>{1===t&&i.push(e)})),i}(n,r);if(!(i.length>0)&&function(t,e,n=Ot){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!n(t[r],e[r]))return!1;return!0}(n,r))return at;const o=r[r.length-1],a=n[n.length-1];return o!==a&&(o&&i.push(o),a&&i.push(a)),i}function Et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const It={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function kt(t=It,e){const{payload:n}=e;switch(e.type){case F:case U:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case V:return r=t.clientOffset,i=n.clientOffset,!r&&!i||r&&i&&r.x===i.x&&r.y===i.y?t:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Et(t,e,n[e])}))}return t}({},t,{clientOffset:n.clientOffset});case q:case G:return It;default:return t}var r,i}function Mt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Mt(t,e,n[e])}))}return t}const Nt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Pt(t=Nt,e){const{payload:n}=e;switch(e.type){case U:return jt({},t,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case X:return jt({},t,{isSourcePublic:!0});case V:return jt({},t,{targetIds:n.targetIds});case bt:return-1===t.targetIds.indexOf(n.targetId)?t:jt({},t,{targetIds:(r=t.targetIds,i=n.targetId,r.filter((t=>t!==i)))});case G:return jt({},t,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case q:return jt({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}var r,i}function At(t=0,e){switch(e.type){case vt:case mt:return t+1;case yt:case bt:return t-1;default:return t}}function Rt(t=0){return t+1}function Lt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){Lt(t,e,n[e])}))}return t}function Ht(t={},e){return{dirtyHandlerIds:Tt(t.dirtyHandlerIds,{type:e.type,payload:Bt({},e.payload,{prevTargetIds:(n=t,r=[],"dragOperation.targetIds".split(".").reduce(((t,e)=>t&&t[e]?t[e]:r||null),n))})}),dragOffset:kt(t.dragOffset,e),refCount:At(t.refCount,e),dragOperation:Pt(t.dragOperation,e),stateId:Rt(t.stateId)};var n,r}function $t(t,e=void 0,n={},r=!1){const i=function(t){const e="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return $(Ht,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}(r),o=new lt(i,new Dt(i)),a=new it(i,o),s=t(a,e,n);return a.receiveBackend(s),a}let zt=0;const Ft=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Ut=(0,h.memo)((function(t){var{children:e}=t,n=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(t,["children"]);const[r,i]=function(t){if("manager"in t)return[{dragDropManager:t.manager},!1];return[function(t,e=Xt(),n,r){const i=e;return i[Ft]||(i[Ft]={dragDropManager:$t(t,e,n,r)}),i[Ft]}(t.backend,t.context,t.options,t.debugMode),!t.context]}(n);return(0,h.useEffect)((()=>{if(i){const t=Xt();return++zt,()=>{0==--zt&&(t[Ft]=null)}}}),[]),(0,A.jsx)(_.Provider,{value:r,children:e})}));function Xt(){return"undefined"!=typeof global?global:window}function Vt(t){let e=null;return()=>(null==e&&(e=t()),e)}class Gt{enter(t){const e=this.entered.length;return this.entered=function(t,e){const n=new Set,r=t=>n.add(t);t.forEach(r),e.forEach(r);const i=[];return n.forEach((t=>i.push(t))),i}(this.entered.filter((e=>this.isNodeInDocument(e)&&(!e.contains||e.contains(t)))),[t]),0===e&&this.entered.length>0}leave(t){const e=this.entered.length;var n,r;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=t,n.filter((t=>t!==r))),e>0&&0===this.entered.length}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class qt{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach((t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null)})}))}loadDataTransfer(t){if(t){const e={};Object.keys(this.config.exposeProperties).forEach((n=>{const r=this.config.exposeProperties[n];null!=r&&(e[n]={value:r(t,this.config.matchesTypes),configurable:!0,enumerable:!0})})),Object.defineProperties(this.item,e)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,e){return e===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const Yt="__NATIVE_FILE__",Wt="__NATIVE_URL__",Kt="__NATIVE_TEXT__",Jt="__NATIVE_HTML__";function Zt(t,e,n){const r=e.reduce(((e,n)=>e||t.getData(n)),"");return null!=r?r:n}const Qt={[Yt]:{exposeProperties:{files:t=>Array.prototype.slice.call(t.files),items:t=>t.items,dataTransfer:t=>t},matchesTypes:["Files"]},[Jt]:{exposeProperties:{html:(t,e)=>Zt(t,e,""),dataTransfer:t=>t},matchesTypes:["Html","text/html"]},[Wt]:{exposeProperties:{urls:(t,e)=>Zt(t,e,"").split("\n"),dataTransfer:t=>t},matchesTypes:["Url","text/uri-list"]},[Kt]:{exposeProperties:{text:(t,e)=>Zt(t,e,""),dataTransfer:t=>t},matchesTypes:["Text","text/plain"]}};function te(t){if(!t)return null;const e=Array.prototype.slice.call(t.types||[]);return Object.keys(Qt).filter((t=>{const n=Qt[t];return!!(null==n?void 0:n.matchesTypes)&&n.matchesTypes.some((t=>e.indexOf(t)>-1))}))[0]||null}const ee=Vt((()=>/firefox/i.test(navigator.userAgent))),ne=Vt((()=>Boolean(window.safari)));class re{interpolate(t){const{xs:e,ys:n,c1s:r,c2s:i,c3s:o}=this;let a=e.length-1;if(t===e[a])return n[a];let s,l=0,c=o.length-1;for(;l<=c;){s=Math.floor(.5*(l+c));const r=e[s];if(r<t)l=s+1;else{if(!(r>t))return n[s];c=s-1}}a=Math.max(0,c);const u=t-e[a],h=u*u;return n[a]+r[a]*u+i[a]*h+o[a]*u*h}constructor(t,e){const{length:n}=t,r=[];for(let t=0;t<n;t++)r.push(t);r.sort(((e,n)=>t[e]<t[n]?-1:1));const i=[],o=[],a=[];let s,l;for(let r=0;r<n-1;r++)s=t[r+1]-t[r],l=e[r+1]-e[r],o.push(s),i.push(l),a.push(l/s);const c=[a[0]];for(let t=0;t<o.length-1;t++){const e=a[t],n=a[t+1];if(e*n<=0)c.push(0);else{s=o[t];const r=o[t+1],i=s+r;c.push(3*i/((i+r)/e+(i+s)/n))}}c.push(a[a.length-1]);const u=[],h=[];let d;for(let t=0;t<c.length-1;t++){d=a[t];const e=c[t],n=1/o[t],r=e+c[t+1]-d-d;u.push((d-e-r)*n),h.push(r*n*n)}this.xs=t,this.ys=e,this.c1s=c,this.c2s=u,this.c3s=h}}function ie(t){const e=1===t.nodeType?t:t.parentElement;if(!e)return null;const{top:n,left:r}=e.getBoundingClientRect();return{x:r,y:n}}function oe(t){return{x:t.clientX,y:t.clientY}}class ae{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var t;return(null===(t=this.globalContext)||void 0===t?void 0:t.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return(null===(t=this.optionsArgs)||void 0===t?void 0:t.rootElement)||this.window}constructor(t,e){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=e}}function se(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function le(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){se(t,e,n[e])}))}return t}class ce{profile(){var t,e;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(t=this.dragStartSourceIds)||void 0===t?void 0:t.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(e=this.dragOverTargetIds)||void 0===e?void 0:e.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const t=this.rootElement;if(void 0!==t){if(t.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");t.__isReactDndBackendSetUp=!0,this.addEventListeners(t)}}teardown(){const t=this.rootElement;var e;void 0!==t&&(t.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(e=this.window)||void 0===e||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(t,e,n){return this.sourcePreviewNodeOptions.set(t,n),this.sourcePreviewNodes.set(t,e),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,e,n){this.sourceNodes.set(t,e),this.sourceNodeOptions.set(t,n);const r=e=>this.handleDragStart(e,t),i=t=>this.handleSelectStart(t);return e.setAttribute("draggable","true"),e.addEventListener("dragstart",r),e.addEventListener("selectstart",i),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),e.removeEventListener("dragstart",r),e.removeEventListener("selectstart",i),e.setAttribute("draggable","false")}}connectDropTarget(t,e){const n=e=>this.handleDragEnter(e,t),r=e=>this.handleDragOver(e,t),i=e=>this.handleDrop(e,t);return e.addEventListener("dragenter",n),e.addEventListener("dragover",r),e.addEventListener("drop",i),()=>{e.removeEventListener("dragenter",n),e.removeEventListener("dragover",r),e.removeEventListener("drop",i)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),e=this.sourceNodeOptions.get(t);return le({dropEffect:this.altKeyPressed?"copy":"move"},e||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId();return le({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(t)||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(r).some((e=>r[e]===t))}beginDragNativeItem(t,e){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(t,e){const n=Qt[t];if(!n)throw new Error(`native type ${t} has no configuration`);const r=new qt(n);return r.loadDataTransfer(e),r}(t,e),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t,this.mouseMoveTimeoutTimer=setTimeout((()=>{var t;return null===(t=this.rootElement)||void 0===t?void 0:t.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}clearCurrentDragSourceNode(){var t;return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.rootElement&&(null===(t=this.window)||void 0===t||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}handleDragStart(t,e){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(e))}handleDragEnter(t,e){this.dragEnterTargetIds.unshift(e)}handleDragOver(t,e){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(e)}handleDrop(t,e){this.dropTargetIds.unshift(e)}constructor(t,e,n){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=t=>{const e=this.sourceNodes.get(t);return e&&ie(e)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=t=>Boolean(t&&this.document&&this.document.body&&this.document.body.contains(t)),this.endDragIfSourceWasRemovedFromDOM=()=>{const t=this.currentDragSourceNode;null==t||this.isNodeInDocument(t)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=t=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame((()=>{this.monitor.isDragging()&&this.actions.hover(t||[],{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=t=>{if(t.defaultPrevented)return;const{dragStartSourceIds:e}=this;this.dragStartSourceIds=null;const n=oe(t);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(e||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});const{dataTransfer:r}=t,i=te(r);if(this.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){const t=this.monitor.getSourceId(),e=this.sourceNodes.get(t),i=this.sourcePreviewNodes.get(t)||e;if(i){const{anchorX:t,anchorY:o,offsetX:a,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=function(t,e,n,r,i){const o="IMG"===(m=e).nodeName&&(ee()||!(null===(y=document.documentElement)||void 0===y?void 0:y.contains(m))),a=ie(o?t:e),s={x:n.x-a.x,y:n.y-a.y},{offsetWidth:l,offsetHeight:c}=t,{anchorX:u,anchorY:h}=r,{dragPreviewWidth:d,dragPreviewHeight:f}=function(t,e,n,r){let i=t?e.width:n,o=t?e.height:r;return ne()&&t&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}(o,e,l,c),{offsetX:p,offsetY:g}=i,v=0===g||g;var m,y;return{x:0===p||p?p:new re([0,.5,1],[s.x,s.x/l*d,s.x+d-l]).interpolate(u),y:v?g:(()=>{let t=new re([0,.5,1],[s.y,s.y/c*f,s.y+f-c]).interpolate(h);return ne()&&o&&(t+=(window.devicePixelRatio-1)*f),t})()}}(e,i,n,{anchorX:t,anchorY:o},{offsetX:a,offsetY:s});r.setDragImage(i,l.x,l.y)}}try{null==r||r.setData("application/json",{})}catch(t){}this.setCurrentDragSourceNode(t.target);const{captureDraggingState:e}=this.getCurrentSourcePreviewNodeOptions();e?this.actions.publishDragSource():setTimeout((()=>this.actions.publishDragSource()),0)}else if(i)this.beginDragNativeItem(i);else{if(r&&!r.types&&(t.target&&!t.target.hasAttribute||!t.target.hasAttribute("draggable")))return;t.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=t=>{var e;if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()&&(null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer)),!this.enterLeaveCounter.enter(t.target)||this.monitor.isDragging())return;const{dataTransfer:n}=t,r=te(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=t=>{const{dragEnterTargetIds:e}=this;this.dragEnterTargetIds=[],this.monitor.isDragging()&&(this.altKeyPressed=t.altKey,e.length>0&&this.actions.hover(e,{clientOffset:oe(t)}),e.some((t=>this.monitor.canDropOnTarget(t)))&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=t=>{var e;this.dragOverTargetIds=[],this.isDraggingNativeItem()&&(null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer))},this.handleTopDragOver=t=>{const{dragOverTargetIds:e}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return t.preventDefault(),void(t.dataTransfer&&(t.dataTransfer.dropEffect="none"));this.altKeyPressed=t.altKey,this.lastClientOffset=oe(t),this.scheduleHover(e),(e||[]).some((t=>this.monitor.canDropOnTarget(t)))?(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?t.preventDefault():(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=t=>{this.isDraggingNativeItem()&&t.preventDefault(),this.enterLeaveCounter.leave(t.target)&&(this.isDraggingNativeItem()&&setTimeout((()=>this.endDragNativeItem()),0),this.cancelHover())},this.handleTopDropCapture=t=>{var e;this.dropTargetIds=[],this.isDraggingNativeItem()?(t.preventDefault(),null===(e=this.currentNativeSource)||void 0===e||e.loadDataTransfer(t.dataTransfer)):te(t.dataTransfer)&&t.preventDefault(),this.enterLeaveCounter.reset()},this.handleTopDrop=t=>{const{dropTargetIds:e}=this;this.dropTargetIds=[],this.actions.hover(e,{clientOffset:oe(t)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=t=>{const e=t.target;"function"==typeof e.dragDrop&&("INPUT"===e.tagName||"SELECT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable||(t.preventDefault(),e.dragDrop()))},this.options=new ae(e,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Gt(this.isNodeInDocument)}}const ue=function(t,e,n){return new ce(t,e,n)},he=window.wp.apiFetch;var de=n.n(he);const fe="dataset_item",pe=({item:t,datasetKey:e,moveItem:n,updateItem:r,items:i,onDelete:a})=>{const[c,u]=(0,l.useState)(!1),[h,d]=(0,l.useState)(!1),f=(0,l.useRef)(null),[{isDragging:p},g]=E({type:fe,item:{id:t.id,datasetKey:e},collect:t=>({isDragging:t.isDragging()})}),[{isOver:v},m]=P({accept:fe,hover(e,r){if(!f.current)return;if(e.id===t.id)return;const i=f.current.getBoundingClientRect(),o=(i.bottom-i.top)/2,a=(i.right-i.left)/2,s=r.getClientOffset();if(!s)return;const l=s.y-i.top,c=s.x-i.left>a&&l>o;n(e.id,t.id,c)},collect:t=>({isOver:t.isOver()})});g(m(f));const y=i.filter((e=>e.parent===t.id)),b={marginLeft:20*(t=>{let e=0,n=i.find((e=>e.id===t));for(;n&&n.parent;)e++,n=i.find((t=>t.id===n.parent));return e})(t.id)+"px",opacity:p?.5:1,cursor:"move",background:v?"#f0f0f0":"white",border:v?"2px dashed #0073aa":"1px solid #e2e4e7",marginBottom:"8px",transition:"all 0.2s ease"};return(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{ref:f,style:b,children:(0,A.jsx)(s.Card,{children:(0,A.jsx)(s.CardBody,{children:(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,A.jsx)(s.TextControl,{placeholder:(0,o.__)("Label","lcp"),value:t.label,onChange:n=>r(e,t.id,"label",n),style:{flex:2}}),(0,A.jsx)(s.TextControl,{type:"number",placeholder:(0,o.__)("Value","lcp"),value:t.value,onChange:n=>r(e,t.id,"value",parseFloat(n)),style:{flex:1}}),(0,A.jsxs)("div",{style:{position:"relative"},children:[(0,A.jsx)(s.Button,{onClick:()=>u(!0),style:{backgroundColor:t.color,width:"30px",height:"30px",borderRadius:"50%",padding:0,border:"1px solid #ddd"}}),c&&(0,A.jsx)(s.Popover,{onClose:()=>u(!1),position:"bottom center",children:(0,A.jsx)("div",{style:{padding:"10px"},children:(0,A.jsx)(s.ColorPicker,{color:t.color,onChange:n=>r(e,t.id,"color",n),enableAlpha:!1})})})]}),(0,A.jsx)(s.Button,{variant:"secondary",isSmall:!0,onClick:()=>d(!0),children:(0,o.__)("HTML","lcp-data-blocks")}),(0,A.jsx)(s.Button,{variant:"secondary",isDestructive:!0,isSmall:!0,onClick:()=>{window.confirm((0,o.__)("Are you sure you want to delete this item?","lcp"))&&a(t.id)},children:(0,o.__)("Delete","lcp")})]})})})}),h&&(0,A.jsx)(s.Modal,{title:(0,o.__)("Edit HTML Content","lcp-data-blocks"),onRequestClose:()=>d(!1),children:(0,A.jsx)("div",{style:{padding:"20px"},children:(0,A.jsx)(s.TextareaControl,{value:t.popoverHtml||"",onChange:n=>{r(e,t.id,"popoverHtml",n)},rows:10,style:{width:"100%",minHeight:"200px",fontFamily:"monospace"}})})}),y.map((t=>(0,A.jsx)(pe,{item:t,datasetKey:e,moveItem:n,updateItem:r,items:i,onDelete:a},t.id)))]})},ge=({value:t,onChange:e})=>{const[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(t||{}),[c,u]=(0,l.useState)(!1),[h,d]=(0,l.useState)(null),f=(t,n)=>{if(t===n||!n.trim()||i[n])return void d(null);const r={...i};r[n]=r[t],delete r[t],a(r),e(r),d(null)},p=(t,n,r,o)=>{const s={...i,[t]:i[t].map((t=>t.id===n?{...t,[r]:o}:t))};a(s),e(s)},g=(t,n,r)=>{const o=Object.keys(i).find((e=>i[e].some((e=>e.id===t))));if(!o)return;const s=[...i[o]],l=s.find((e=>e.id===t)),c=s.find((t=>t.id===n));if(!l||!c)return;let u=c;for(;u.parent;){if(u.parent===t)return;u=s.find((t=>t.id===u.parent))}l.parent=r?n:c.parent;const h={...i,[o]:s};a(h),e(h)};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s.Button,{variant:"primary",onClick:()=>r(!0),children:(0,o.__)("Open Dataset Builder","lcp")}),n&&(0,A.jsx)(s.Modal,{title:(0,o.__)("Dataset Builder","lcp"),onRequestClose:()=>r(!1),style:{width:"100%",maxWidth:"800px"},children:(0,A.jsx)(Ut,{backend:ue,children:(0,A.jsxs)("div",{style:{padding:"20px"},children:[Object.entries(i).map((([t,n])=>(0,A.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,A.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"10px"},children:h===t?(0,A.jsx)(s.TextControl,{value:t,onChange:e=>f(t,e),onKeyDown:e=>{"Enter"===e.key?f(t,e.target.value):"Escape"===e.key&&d(null)},autoFocus:!0}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("h3",{style:{margin:0},children:t}),(0,A.jsx)(s.Button,{variant:"secondary",isSmall:!0,onClick:()=>d(t),children:(0,o.__)("Rename","lcp")}),(0,A.jsx)(s.Button,{variant:"secondary",isDestructive:!0,isSmall:!0,onClick:()=>{window.confirm((0,o.__)("Are you sure you want to delete this dataset?","lcp"))&&(t=>{const n={...i};delete n[t],a(n),e(n)})(t)},children:(0,o.__)("Delete","lcp")})]})}),(0,A.jsx)("div",{children:n.filter((t=>!t.parent)).map((r=>(0,A.jsx)(pe,{datasetKey:t,item:r,items:n,moveItem:g,updateItem:p,onDelete:n=>((t,n)=>{const r={...i};var o,s;r[t]=(o=r[t],s=n,o.filter((t=>t.id!==s&&t.parent!==s))),a(r),e(r)})(t,n)},r.id)))}),(0,A.jsx)(s.Button,{variant:"secondary",onClick:()=>(t=>{const n={id:`item-${Date.now()}`,label:"New Item",parent:null,value:0,color:"#000000"},r={...i,[t]:[...i[t],n]};a(r),e(r)})(t),style:{marginTop:"10px"},children:(0,o.__)("Add Item","lcp")})]},t))),(0,A.jsxs)("div",{style:{display:"flex",gap:"10px",marginTop:"20px"},children:[(0,A.jsx)(s.Button,{variant:"primary",onClick:()=>{const t="New Dataset";let n=t,r=1;for(;i[n];)n=`${t} ${r}`,r++;const o={...i,[n]:[{id:`dataset-${Date.now()}`,label:"New Item",parent:null,value:0,color:"#000000"}]};a(o),e(o),d(n)},children:(0,o.__)("Add New Dataset","lcp")}),(0,A.jsx)(s.Button,{variant:"secondary",onClick:async()=>{try{u(!0),console.log("Chart data:",i);const t=Object.entries(i).map((([t,e])=>({dataset_name:t,dataset_source:"json",dataset_json:e})));console.log("Formatted datasets:",t);const e=await de()({path:"/wp/v2/lcp-data-collection",method:"POST",data:{title:Object.keys(i)[0]||"Dataset Collection",status:"publish",meta:{lcp_datasets:t}}});console.log("Post created:",e),console.log("Meta data in response:",e.meta);const n=await de()({path:`/wp/v2/lcp-data-collection/${e.id}`,method:"GET"});console.log("Saved post data:",n),console.log("Saved meta data:",n.meta?.lcp_datasets)}catch(t){console.error("Error saving dataset:",t),console.log("Error details:",{message:t.message,code:t.code,data:t.data})}finally{u(!1)}},disabled:c,children:c?(0,o.__)("Saving...","lcp"):(0,o.__)("Save to Collection","lcp")})]})]})})})]})},ve=["#FF6384","#36A2EB","#FFCE56","#4BC0C0","#9966FF","#FF9F40","#FF6384","#C9CBCF","#4BC0C0","#FF9F40"],me=({value:t,onChange:e,dataSource:n,onDataSourceChange:r})=>{const[i,c]=(0,l.useState)(""),[u,h]=(0,l.useState)(""),[d,f]=(0,l.useState)("");(0,l.useEffect)((()=>{if(t&&Object.keys(t).length>0)if("manual_json"===n)h(JSON.stringify(t,null,2));else if("csv_url"===n){const e=t[Object.keys(t)[0]]?.[0]?.sourceUrl;e&&c(e)}}),[]);const p=[{label:(0,o.__)("Manual JSON","lcp"),value:"manual_json"},{label:(0,o.__)("CSV Upload","lcp"),value:"csv_upload"},{label:(0,o.__)("CSV URL","lcp"),value:"csv_url"},{label:(0,o.__)("Dataset Builder","lcp"),value:"dataset_builder"}],g=(t,e="")=>{try{const n=t.split("\n");if(n.length<2)throw new Error("CSV must have at least a header row and one data row");const r=n[0].split(",").map((t=>t.trim()));if(!r.includes("label")||!r.includes("value"))throw new Error('CSV must have "label" and "value" columns');const i={"Dataset 1":n.slice(1).filter((t=>t.trim())).map(((t,n)=>{const i=t.split(",").map((t=>t.trim())),o={};return r.forEach(((t,e)=>{"color"!==t||i[e]?o[t]=i[e]:o[t]=ve[n%ve.length]})),e&&(o.sourceUrl=e),o}))};return f(""),i}catch(t){return f("Error parsing CSV: "+t.message),null}};return(0,A.jsxs)("div",{className:"lcp-data-selector",children:[(0,A.jsx)(s.SelectControl,{label:(0,o.__)("Data Source","lcp"),value:n,options:p,onChange:r}),"dataset_builder"===n&&(0,A.jsx)(ge,{value:t,onChange:t=>{e(t)}}),"manual_json"===n&&(0,A.jsx)(s.TextareaControl,{label:(0,o.__)("JSON Data","lcp"),help:(0,o.__)("Enter datasets with arrays containing objects with label and value properties. Color is optional.","lcp"),value:u,onChange:t=>{h(t);const n=(t=>{try{const e=JSON.parse(t);if("object"!=typeof e||Array.isArray(e))throw new Error("Data must be an object with dataset names as keys");return Object.entries(e).forEach((([t,e])=>{if(!Array.isArray(e))throw new Error(`Dataset "${t}" must be an array`);e.forEach(((e,n)=>{if(!e.label||!e.value)throw new Error(`Item at index ${n} in dataset "${t}" is missing required fields (label or value)`);e.color||(e.color=ve[n%ve.length])}))})),f(""),e}catch(t){return f(t.message),null}})(t);n&&e(n)},placeholder:'{\n "Dataset 1": [\n {\n "label": "Label 1",\n "value": 100,\n "color": "red"\n },\n {\n "label": "Label 2",\n "value": 200\n }\n ],\n "Dataset 2": [\n {\n "label": "Label 3",\n "value": 300,\n "color": "green"\n }\n ]\n}'}),"csv_upload"===n&&(0,A.jsx)(a.MediaUploadCheck,{children:(0,A.jsx)(a.MediaUpload,{onSelect:t=>{const n=t.url;fetch(t.url).then((t=>t.text())).then((t=>{const r=g(t,n);r&&e(r)})).catch((t=>{f("Error reading CSV file: "+t.message)}))},allowedTypes:["text/csv"],render:({open:e})=>(0,A.jsxs)("div",{children:[(0,A.jsx)(s.Button,{onClick:e,isPrimary:!0,children:(0,o.__)("Upload CSV File","lcp")}),t&&Object.keys(t).length>0&&t[Object.keys(t)[0]]?.[0]?.sourceUrl&&(0,A.jsxs)("div",{className:"current-file",style:{marginTop:"10px"},children:[(0,o.__)("Current file:","lcp")," ",t[Object.keys(t)[0]][0].sourceUrl.split("/").pop()]})]})})}),"csv_url"===n&&(0,A.jsx)(s.TextControl,{label:(0,o.__)("CSV URL","lcp"),value:i,onChange:t=>{c(t),t&&fetch(t).then((t=>t.text())).then((n=>{const r=g(n,t);r&&e(r)})).catch((t=>{f("Error fetching CSV file: "+t.message)}))},help:(0,o.__)("Enter URL of a CSV file with label and value columns. Color column is optional.","lcp")}),d&&(0,A.jsx)("div",{className:"lcp-data-selector-error",style:{color:"red",marginTop:"10px"},children:d}),t&&Object.keys(t).length>0&&(0,A.jsxs)("div",{className:"data-preview",style:{marginTop:"15px"},children:[(0,A.jsx)("h4",{children:(0,o.__)("Current Data Preview:","lcp")}),(0,A.jsx)("div",{style:{fontSize:"12px",color:"#666"},children:Object.entries(t).map((([t,e])=>(0,A.jsxs)("div",{children:[t,": ",e.length," ",(0,o.__)("data points","lcp")]},t)))})]})]})};function ye(t){return t}var be=1e-6;function we(t){return"translate("+t+",0)"}function xe(t){return"translate(0,"+t+")"}function _e(t){return e=>+t(e)}function Ce(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Se(){return!this.__axis}function De(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?we:xe;function d(d){var f=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,p=null==i?e.tickFormat?e.tickFormat.apply(e,n):ye:i,g=Math.max(o,0)+s,v=e.range(),m=+v[0]+l,y=+v[v.length-1]+l,b=(e.bandwidth?Ce:_e)(e.copy(),l),w=d.selection?d.selection():d,x=w.selectAll(".domain").data([null]),_=w.selectAll(".tick").data(f,e).order(),C=_.exit(),S=_.enter().append("g").attr("class","tick"),D=_.select("line"),O=_.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(S),D=D.merge(S.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),O=O.merge(S.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==w&&(x=x.transition(d),_=_.transition(d),D=D.transition(d),O=O.transition(d),C=C.transition(d).attr("opacity",be).attr("transform",(function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")})),S.attr("opacity",be).attr("transform",(function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)}))),C.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+m+"H"+l+"V"+y+"H"+c*a:"M"+l+","+m+"V"+y:a?"M"+m+","+c*a+"V"+l+"H"+y+"V"+c*a:"M"+m+","+l+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return h(b(t)+l)})),D.attr(u+"2",c*o),O.attr(u,c*g).text(p),w.filter(Se).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),w.each((function(){this.__axis=b}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),d):r&&r.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(o=a=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(s=+t,d):s},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Oe(t){return De(3,t)}function Te(t){return De(4,t)}function Ee(){}function Ie(t){return null==t?Ee:function(){return this.querySelector(t)}}function ke(){return[]}function Me(t){return null==t?ke:function(){return this.querySelectorAll(t)}}function je(t){return function(){return this.matches(t)}}function Ne(t){return function(e){return e.matches(t)}}var Pe=Array.prototype.find;function Ae(){return this.firstElementChild}var Re=Array.prototype.filter;function Le(){return Array.from(this.children)}function Be(t){return new Array(t.length)}function He(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function $e(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new He(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function ze(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,d=o.length,f=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(f[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<d;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new He(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(f[s])===l&&(i[s]=l)}function Fe(t){return t.__data__}function Ue(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Xe(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}He.prototype={constructor:He,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Ve="http://www.w3.org/1999/xhtml";const Ge={svg:"http://www.w3.org/2000/svg",xhtml:Ve,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qe(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Ge.hasOwnProperty(e)?{space:Ge[e],local:t}:t}function Ye(t){return function(){this.removeAttribute(t)}}function We(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ke(t,e){return function(){this.setAttribute(t,e)}}function Je(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ze(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Qe(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function tn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function en(t){return function(){this.style.removeProperty(t)}}function nn(t,e,n){return function(){this.style.setProperty(t,e,n)}}function rn(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function on(t,e){return t.style.getPropertyValue(e)||tn(t).getComputedStyle(t,null).getPropertyValue(e)}function an(t){return function(){delete this[t]}}function sn(t,e){return function(){this[t]=e}}function ln(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function cn(t){return t.trim().split(/^|\s+/)}function un(t){return t.classList||new hn(t)}function hn(t){this._node=t,this._names=cn(t.getAttribute("class")||"")}function dn(t,e){for(var n=un(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function fn(t,e){for(var n=un(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function pn(t){return function(){dn(this,t)}}function gn(t){return function(){fn(this,t)}}function vn(t,e){return function(){(e.apply(this,arguments)?dn:fn)(this,t)}}function mn(){this.textContent=""}function yn(t){return function(){this.textContent=t}}function bn(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function wn(){this.innerHTML=""}function xn(t){return function(){this.innerHTML=t}}function Cn(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Sn(){this.nextSibling&&this.parentNode.appendChild(this)}function Dn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function On(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ve&&e.documentElement.namespaceURI===Ve?e.createElement(t):e.createElementNS(n,t)}}function Tn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function En(t){var e=qe(t);return(e.local?Tn:On)(e)}function In(){return null}function kn(){var t=this.parentNode;t&&t.removeChild(this)}function Mn(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function jn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Nn(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Pn(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function An(t,e,n){var r=tn(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Rn(t,e){return function(){return An(this,t,e)}}function Ln(t,e){return function(){return An(this,t,e.apply(this,arguments))}}hn.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Bn=[null];function Hn(t,e){this._groups=t,this._parents=e}function $n(){return new Hn([[document.documentElement]],Bn)}Hn.prototype=$n.prototype={constructor:Hn,select:function(t){"function"!=typeof t&&(t=Ie(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new Hn(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(t):Me(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new Hn(r,i)},selectChild:function(t){return this.select(null==t?Ae:function(t){return function(){return Pe.call(this.children,t)}}("function"==typeof t?t:Ne(t)))},selectChildren:function(t){return this.selectAll(null==t?Le:function(t){return function(){return Re.call(this.children,t)}}("function"==typeof t?t:Ne(t)))},filter:function(t){"function"!=typeof t&&(t=je(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new Hn(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Fe);var n,r=e?ze:$e,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var h=i[u],d=o[u],f=d.length,p=Ue(t.call(h,h&&h.__data__,u,i)),g=p.length,v=l[u]=new Array(g),m=s[u]=new Array(g);r(h,d,v,m,c[u]=new Array(f),p,e);for(var y,b,w=0,x=0;w<g;++w)if(y=v[w]){for(w>=x&&(x=w+1);!(b=m[x])&&++x<g;);y._next=b||null}}return(s=new Hn(s,i))._enter=l,s._exit=c,s},enter:function(){return new Hn(this._enter||this._groups.map(Be),this._parents)},exit:function(){return new Hn(this._exit||this._groups.map(Be),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],d=u.length,f=s[l]=new Array(d),p=0;p<d;++p)(c=u[p]||h[p])&&(f[p]=c);for(;l<i;++l)s[l]=n[l];return new Hn(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Xe);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new Hn(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=qe(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?We:Ye:"function"==typeof e?n.local?Qe:Ze:n.local?Je:Ke)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?en:"function"==typeof e?rn:nn)(t,e,null==n?"":n)):on(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?an:"function"==typeof e?ln:sn)(t,e)):this.node()[t]},classed:function(t,e){var n=cn(t+"");if(arguments.length<2){for(var r=un(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?vn:e?pn:gn)(n,e))},text:function(t){return arguments.length?this.each(null==t?mn:("function"==typeof t?bn:yn)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?wn:("function"==typeof t?Cn:xn)(t)):this.node().innerHTML},raise:function(){return this.each(Sn)},lower:function(){return this.each(Dn)},append:function(t){var e="function"==typeof t?t:En(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:En(t),r=null==e?In:"function"==typeof e?e:Ie(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(kn)},clone:function(t){return this.select(t?jn:Mn)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Pn:Nn,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ln:Rn)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const zn=$n;var Fn={value:()=>{}};function Un(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Xn(r)}function Xn(t){this._=t}function Vn(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Gn(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Fn,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Xn.prototype=Un.prototype={constructor:Xn,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Gn(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Gn(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Vn(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Xn(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};const qn=Un;var Yn,Wn,Kn=0,Jn=0,Zn=0,Qn=0,tr=0,er=0,nr="object"==typeof performance&&performance.now?performance:Date,rr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ir(){return tr||(rr(or),tr=nr.now()+er)}function or(){tr=0}function ar(){this._call=this._time=this._next=null}function sr(t,e,n){var r=new ar;return r.restart(t,e,n),r}function lr(){tr=(Qn=nr.now())+er,Kn=Jn=0;try{!function(){ir(),++Kn;for(var t,e=Yn;e;)(t=tr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Kn}()}finally{Kn=0,function(){for(var t,e,n=Yn,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Yn=e);Wn=t,ur(r)}(),tr=0}}function cr(){var t=nr.now(),e=t-Qn;e>1e3&&(er-=e,Qn=t)}function ur(t){Kn||(Jn&&(Jn=clearTimeout(Jn)),t-tr>24?(t<1/0&&(Jn=setTimeout(lr,t-nr.now()-er)),Zn&&(Zn=clearInterval(Zn))):(Zn||(Qn=nr.now(),Zn=setInterval(cr,1e3)),Kn=1,rr(lr)))}function hr(t,e,n){var r=new ar;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}ar.prototype=sr.prototype={constructor:ar,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?ir():+n)+(null==e?0:+e),this._next||Wn===this||(Wn?Wn._next=this:Yn=this,Wn=this),this._call=t,this._time=n,ur()},stop:function(){this._call&&(this._call=null,this._time=1/0,ur())}};var dr=qn("start","end","cancel","interrupt"),fr=[];function pr(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(l){var c,u,h,d;if(1!==n.state)return s();for(c in i)if((d=i[c]).name===n.name){if(3===d.state)return hr(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(hr((function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(l))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=d);r.length=u+1}}function a(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(s),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=sr((function(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}),0,n.time)}(t,n,{name:e,index:r,group:i,on:dr,tween:fr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function gr(t,e){var n=mr(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function vr(t,e){var n=mr(t,e);if(n.state>3)throw new Error("too late; already running");return n}function mr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function yr(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function br(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var wr,xr=180/Math.PI,_r={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Cr(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*xr,skewX:Math.atan(l)*xr,scaleX:a,scaleY:s}}function Sr(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:br(t,i)},{i:l-2,x:br(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:br(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:br(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:br(t,n)},{i:s-2,x:br(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Dr=Sr((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?_r:Cr(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Or=Sr((function(t){return null==t?_r:(wr||(wr=document.createElementNS("http://www.w3.org/2000/svg","g")),wr.setAttribute("transform",t),(t=wr.transform.baseVal.consolidate())?Cr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):_r)}),", ",")",")");function Tr(t,e){var n,r;return function(){var i=vr(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function Er(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=vr(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Ir(t,e,n){var r=t._id;return t.each((function(){var t=vr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return mr(t,r).value[e]}}function kr(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Mr(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function jr(){}var Nr=.7,Pr=1/Nr,Ar="\\s*([+-]?\\d+)\\s*",Rr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Lr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Br=/^#([0-9a-f]{3,8})$/,Hr=new RegExp(`^rgb\\(${Ar},${Ar},${Ar}\\)$`),$r=new RegExp(`^rgb\\(${Lr},${Lr},${Lr}\\)$`),zr=new RegExp(`^rgba\\(${Ar},${Ar},${Ar},${Rr}\\)$`),Fr=new RegExp(`^rgba\\(${Lr},${Lr},${Lr},${Rr}\\)$`),Ur=new RegExp(`^hsl\\(${Rr},${Lr},${Lr}\\)$`),Xr=new RegExp(`^hsla\\(${Rr},${Lr},${Lr},${Rr}\\)$`),Vr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Gr(){return this.rgb().formatHex()}function qr(){return this.rgb().formatRgb()}function Yr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Br.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Wr(e):3===n?new Zr(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Kr(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Kr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Hr.exec(t))?new Zr(e[1],e[2],e[3],1):(e=$r.exec(t))?new Zr(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=zr.exec(t))?Kr(e[1],e[2],e[3],e[4]):(e=Fr.exec(t))?Kr(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ur.exec(t))?ii(e[1],e[2]/100,e[3]/100,1):(e=Xr.exec(t))?ii(e[1],e[2]/100,e[3]/100,e[4]):Vr.hasOwnProperty(t)?Wr(Vr[t]):"transparent"===t?new Zr(NaN,NaN,NaN,0):null}function Wr(t){return new Zr(t>>16&255,t>>8&255,255&t,1)}function Kr(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zr(t,e,n,r)}function Jr(t,e,n,r){return 1===arguments.length?((i=t)instanceof jr||(i=Yr(i)),i?new Zr((i=i.rgb()).r,i.g,i.b,i.opacity):new Zr):new Zr(t,e,n,null==r?1:r);var i}function Zr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Qr(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}`}function ti(){const t=ei(this.opacity);return`${1===t?"rgb(":"rgba("}${ni(this.r)}, ${ni(this.g)}, ${ni(this.b)}${1===t?")":`, ${t})`}`}function ei(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ni(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ri(t){return((t=ni(t))<16?"0":"")+t.toString(16)}function ii(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ai(t,e,n,r)}function oi(t){if(t instanceof ai)return new ai(t.h,t.s,t.l,t.opacity);if(t instanceof jr||(t=Yr(t)),!t)return new ai;if(t instanceof ai)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new ai(a,s,l,t.opacity)}function ai(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function si(t){return(t=(t||0)%360)<0?t+360:t}function li(t){return Math.max(0,Math.min(1,t||0))}function ci(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function ui(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}kr(jr,Yr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Gr,formatHex:Gr,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return oi(this).formatHsl()},formatRgb:qr,toString:qr}),kr(Zr,Jr,Mr(jr,{brighter(t){return t=null==t?Pr:Math.pow(Pr,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Nr:Math.pow(Nr,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zr(ni(this.r),ni(this.g),ni(this.b),ei(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qr,formatHex:Qr,formatHex8:function(){return`#${ri(this.r)}${ri(this.g)}${ri(this.b)}${ri(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ti,toString:ti})),kr(ai,(function(t,e,n,r){return 1===arguments.length?oi(t):new ai(t,e,n,null==r?1:r)}),Mr(jr,{brighter(t){return t=null==t?Pr:Math.pow(Pr,t),new ai(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Nr:Math.pow(Nr,t),new ai(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Zr(ci(t>=240?t-240:t+120,i,r),ci(t,i,r),ci(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ai(si(this.h),li(this.s),li(this.l),ei(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ei(this.opacity);return`${1===t?"hsl(":"hsla("}${si(this.h)}, ${100*li(this.s)}%, ${100*li(this.l)}%${1===t?")":`, ${t})`}`}}));const hi=t=>()=>t;function di(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):hi(isNaN(t)?e:t)}const fi=function t(e){var n=function(t){return 1==(t=+t)?di:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):hi(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Jr(t)).r,(e=Jr(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=di(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function pi(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=Jr(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}pi((function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return ui((n-r/e)*e,a,i,o,s)}})),pi((function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return ui((n-r/e)*e,i,o,a,s)}}));var gi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vi=new RegExp(gi.source,"g");function mi(t,e){var n,r,i,o=gi.lastIndex=vi.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=gi.exec(t))&&(r=vi.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:br(n,r)})),o=vi.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function yi(t,e){var n;return("number"==typeof e?br:e instanceof Yr?fi:(n=Yr(e))?(e=n,fi):mi)(t,e)}function bi(t){return function(){this.removeAttribute(t)}}function wi(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function _i(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Ci(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Si(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Di(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Oi(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ti(t,e){return function(){gr(this,t).delay=+e.apply(this,arguments)}}function Ei(t,e){return e=+e,function(){gr(this,t).delay=e}}function Ii(t,e){return function(){vr(this,t).duration=+e.apply(this,arguments)}}function ki(t,e){return e=+e,function(){vr(this,t).duration=e}}var Mi=zn.prototype.constructor;function ji(t){return function(){this.style.removeProperty(t)}}var Ni=0;function Pi(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Ai(){return++Ni}var Ri=zn.prototype;Pi.prototype=function(t){return zn().transition(t)}.prototype={constructor:Pi,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ie(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),d=0;d<u;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),h[d]=l,pr(h[d],e,n,d,h,mr(s,n)));return new Pi(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Me(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var d,f=t.call(l,l.__data__,h,c),p=mr(l,n),g=0,v=f.length;g<v;++g)(d=f[g])&&pr(d,e,n,g,f,p);o.push(f),a.push(l)}return new Pi(o,a,e,n)},selectChild:Ri.selectChild,selectChildren:Ri.selectChildren,filter:function(t){"function"!=typeof t&&(t=je(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new Pi(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,d=a[s]=new Array(h),f=0;f<h;++f)(l=c[f]||u[f])&&(d[f]=l);for(;s<r;++s)a[s]=e[s];return new Pi(a,this._parents,this._name,this._id)},selection:function(){return new Mi(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Ai(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=mr(a,e);pr(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Pi(r,this._parents,t,n)},call:Ri.call,nodes:Ri.nodes,node:Ri.node,size:Ri.size,empty:Ri.empty,each:Ri.each,on:function(t,e){var n=this._id;return arguments.length<2?mr(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?gr:vr;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=qe(t),r="transform"===n?Or:yi;return this.attrTween(t,"function"==typeof e?(n.local?Si:Ci)(n,r,Ir(this,"attr."+t,e)):null==e?(n.local?wi:bi)(n):(n.local?_i:xi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=qe(t);return this.tween(n,(r.local?Di:Oi)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Dr:yi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=on(this,t),a=(this.style.removeProperty(t),on(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ji(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=on(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=on(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Ir(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=vr(this,t),c=l.on,u=null==l.value[a]?o||(o=ji(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=on(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ir(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=mr(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Tr:Er)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ti:Ei)(e,t)):mr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ii:ki)(e,t)):mr(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){vr(this,t).ease=e}}(e,t)):mr(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;vr(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},l={value:function(){0==--i&&o()}};n.each((function(){var n=vr(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:Ri[Symbol.iterator]};var Li={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Bi(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}zn.prototype.interrupt=function(t){return this.each((function(){yr(this,t)}))},zn.prototype.transition=function(t){var e,n;t instanceof Pi?(e=t._id,t=t._name):(e=Ai(),(n=Li).time=ir(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&pr(a,t,e,c,s,n||Bi(a,e));return new Pi(r,this._parents,t,e)};const{abs:Hi,max:$i,min:zi}=Math;function Fi(t){return{type:t}}function Ui(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Xi(t){return(t=Ui(Math.abs(t)))?t[1]:NaN}["w","e"].map(Fi),["n","s"].map(Fi),["n","w","e","s","nw","ne","sw","se"].map(Fi);var Vi,Gi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qi(t){if(!(e=Gi.exec(t)))throw new Error("invalid format: "+t);var e;return new Yi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Yi(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Wi(t,e){var n=Ui(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}qi.prototype=Yi.prototype,Yi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ki={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Wi(100*t,e),r:Wi,s:function(t,e){var n=Ui(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Vi=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ui(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ji(t){return t}var Zi,Qi,to,eo=Array.prototype.map,no=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ro(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}Zi=function(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ji:(e=eo.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Ji:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(eo.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=qi(t)).fill,n=t.align,h=t.sign,d=t.symbol,f=t.zero,p=t.width,g=t.comma,v=t.precision,m=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Ki[y]||(void 0===v&&(v=12),m=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?l:"",x=Ki[y],_=/[defgprs%]/.test(y);function C(t){var i,o,l,d=b,C=w;if("c"===y)C=x(t)+C,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),v),m&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),S&&0==+t&&"+"!==h&&(S=!1),d=(S?"("===h?h:c:"-"===h||"("===h?"":h)+d,C=("s"===y?no[8+Vi/3]:"")+C+(S&&"("===h?")":""),_)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){C=(46===l?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}g&&!f&&(t=r(t,1/0));var D=d.length+t.length+C.length,O=D<p?new Array(p-D+1).join(e):"";switch(g&&f&&(t=r(O+t,O.length?p-C.length:1/0),O=""),n){case"<":t=d+t+C+O;break;case"=":t=d+O+t+C;break;case"^":t=O.slice(0,D=O.length>>1)+d+t+C+O.slice(D);break;default:t=O+d+t+C}return s(t)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),C.toString=function(){return t+""},C}return{format:h,formatPrefix:function(t,e){var n=h(((t=qi(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Xi(e)/3))),i=Math.pow(10,-r),o=no[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),Qi=Zi.format,to=Zi.formatPrefix;class io extends Map{constructor(t,e=ao){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(oo(this,t))}has(t){return super.has(oo(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}(this,t))}}function oo({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function ao(t){return null!==t&&"object"==typeof t?t.valueOf():t}Set;const so=Symbol("implicit");function lo(){var t=new io,e=[],n=[],r=so;function i(i){let o=t.get(i);if(void 0===o){if(r!==so)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new io;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return lo(e,n).unknown(r)},ro.apply(i,arguments),i}function co(){var t,e,n=lo().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=a<o,d=h?a:o,f=h?o:a;t=(f-d)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),d+=(f-d-t*(n-l))*u,e=t*(1-l),s&&(d=Math.round(d),e=Math.round(e));var p=function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}(n).map((function(e){return d+t*e}));return i(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return co(r(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},ro.apply(h(),arguments)}const uo=Math.sqrt(50),ho=Math.sqrt(10),fo=Math.sqrt(2);function po(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=uo?10:o>=ho?5:o>=fo?2:1;let s,l,c;return i<0?(c=Math.pow(10,-i)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?po(t,e,2*n):[s,l,c]}function go(t,e,n){return po(t=+t,e=+e,n=+n)[2]}function vo(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function mo(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function yo(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<0?i=e+1:o=e}while(i<o)}return i}return 2!==t.length?(e=vo,n=(e,n)=>vo(t(e),n),r=(e,n)=>t(e)-n):(e=t===vo||t===mo?t:bo,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<=0?i=e+1:o=e}while(i<o)}return i}}}function bo(){return 0}const wo=yo(vo),xo=wo.right,_o=(wo.left,yo((function(t){return null===t?NaN:+t})).center,xo);function Co(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=To(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function So(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Do(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=To(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}function Oo(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function To(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?hi(e):("number"===i?br:"string"===i?(n=Yr(e))?(e=n,fi):mi:e instanceof Yr?fi:e instanceof Date?So:(r=e,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(e)?Co:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Do:br:Oo))(t,e)}function Eo(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Io(t){return+t}var ko=[0,1];function Mo(t){return t}function jo(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function No(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=jo(i,r),o=n(a,o)):(r=jo(r,i),o=n(o,a)),function(t){return o(r(t))}}function Po(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=jo(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=_o(t,e,1,r)-1;return o[n](i[n](e))}}function Ao(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){if(!((n=+n)>0))return[];if((t=+t)==(e=+e))return[t];const r=e<t,[i,o,a]=r?po(e,t,n):po(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return function(t,e,n,r){var i,o=function(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?go(e,t,n):go(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}(t,e,n);switch((r=qi(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Xi(e)/3)))-Xi(Math.abs(t)))}(o,a))||(r.precision=i),to(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Xi(e)-Xi(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Xi(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return Qi(r)}(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=go(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Ro(){var t=function(){var t,e,n,r,i,o,a=ko,s=ko,l=To,c=Mo;function u(){var t,e,n,l=Math.min(a.length,s.length);return c!==Mo&&(t=a[0],e=a[l-1],t>e&&(n=t,t=e,e=n),c=function(n){return Math.max(t,Math.min(e,n))}),r=l>2?Po:No,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),br)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Io),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Eo,u()},h.clamp=function(t){return arguments.length?(c=!!t||Mo,u()):c!==Mo},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}()(Mo,Mo);return t.copy=function(){return e=t,Ro().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},ro.apply(t,arguments),Ao(t)}function Lo(t){return"string"==typeof t?new Hn([[document.querySelector(t)]],[document.documentElement]):new Hn([[t]],Bn)}const Bo={capture:!0,passive:!1};function Ho(t){t.preventDefault(),t.stopImmediatePropagation()}function $o(t){return((t=Math.exp(t))+1/t)/2}const zo=function t(e,n,r){function i(t,i){var o,a,s=t[0],l=t[1],c=t[2],u=i[0],h=i[1],d=i[2],f=u-s,p=h-l,g=f*f+p*p;if(g<1e-12)a=Math.log(d/c)/e,o=function(t){return[s+t*f,l+t*p,c*Math.exp(e*t*a)]};else{var v=Math.sqrt(g),m=(d*d-c*c+r*g)/(2*c*n*v),y=(d*d-c*c-r*g)/(2*d*n*v),b=Math.log(Math.sqrt(m*m+1)-m),w=Math.log(Math.sqrt(y*y+1)-y);a=(w-b)/e,o=function(t){var r,i=t*a,o=$o(b),u=c/(n*v)*(o*(r=e*i+b,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[s+u*f,l+u*p,c*o/$o(e*i+b)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function Fo(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const Uo=t=>()=>t;function Xo(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Vo(t,e,n){this.k=t,this.x=e,this.y=n}Vo.prototype={constructor:Vo,scale:function(t){return 1===t?this:new Vo(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Vo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Go=new Vo(1,0,0);function qo(t){t.stopImmediatePropagation()}function Yo(t){t.preventDefault(),t.stopImmediatePropagation()}function Wo(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Ko(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Jo(){return this.__zoom||Go}function Zo(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Qo(){return navigator.maxTouchPoints||"ontouchstart"in this}function ta(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Vo.prototype;const ea=({data:t,width:e="100%",height:n="400px",enableXZoom:r=!1,backgroundColor:i="#ffffff",defaultBarColor:o="#007cba",barOpacity:a=1,title:s,showBarValues:c=!1,showGridX:u=!1,showGridY:h=!1,xGridColor:d="#e0e0e0",yGridColor:f="#e0e0e0",xGridWidth:p=1,yGridWidth:g=1,xAxisLabel:v,yAxisLabel:m,colorSource:y="default",customColors:b=[],enableHierarchicalView:w,enableStackedBars:x,selectedParentId:_,enableBarPopovers:C,setAttributes:S})=>{const D=(0,l.useRef)(),O=(0,l.useRef)(),[T,E]=(0,l.useState)(null);return(0,l.useEffect)((()=>{if(!t||!D.current||!O.current)return;Lo(D.current).selectAll("*").remove();let e=[];Object.entries(t).forEach((([n,r])=>{Array.isArray(r)&&r.forEach((r=>{if(w?r.parent===_:!r.parent||null===r.parent){const i=parseFloat(r.value);isNaN(i)||e.push({dataset:n,label:r.label||"",value:i,color:r.color||o,id:r.id,popoverHtml:r.popoverHtml||"",hasChildren:Array.isArray(t[n])&&t[n].some((t=>t.parent===r.id))})}}))})),0===e.length&&(e=[{label:"No Data",value:0,color:o}]);const n=O.current.clientWidth,l=O.current.clientHeight,y=s?40:20,b=Math.max(n-60-20,0),I=Math.max(l-y-60,0),k=Lo(D.current).attr("width","100%").attr("height","100%").attr("viewBox",`0 0 ${n} ${l}`).attr("preserveAspectRatio","xMidYMid meet").style("background-color",i),M=k.append("g").attr("transform",`translate(60,${y})`),j=co().domain(e.map((t=>t.label))).range([0,b]).padding(.1),N=Math.max(function(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}(e,(t=>t.value))||0,1),P=(()=>{const t=Math.pow(10,Math.floor(Math.log10(N))),e=N/t;return Math.ceil(e)*t||100})(),A=Ro().domain([0,P]).range([I,0]),R=Te(A).tickSize(6).ticks(10).tickFormat(Qi(",d")),L=(k.append("defs").append("clipPath").attr("id","clip").append("rect").attr("x",0).attr("y",0).attr("width",b).attr("height",I),M.append("g").attr("class","zoom-group").attr("clip-path","url(#clip)"));h&&L.append("g").attr("class","grid y-grid").style("color",f).style("stroke-width",g).style("pointer-events","none").call(Te(A).tickSize(-b).ticks(R.ticks()[0]).tickFormat("")),u&&L.append("g").attr("class","grid x-grid").attr("transform",`translate(0,${I})`).style("color",d).style("stroke-width",p).style("pointer-events","none").call(Oe(j).tickSize(-I).tickFormat(""));const B=L.selectAll(".bar-group").data(e).join("g").attr("class","bar-group").attr("transform",(t=>`translate(${j(t.label)},0)`));B.append("rect").attr("class","bar").attr("x",0).attr("y",(t=>isNaN(A(t.value))?A(0):A(t.value))).attr("width",j.bandwidth()).attr("height",(t=>{const e=I-(isNaN(A(t.value))?A(0):A(t.value));return Math.max(0,e)})).attr("fill",(t=>t.color||o)).style("opacity",a).style("cursor",(t=>C||t.hasChildren&&w?"pointer":"default")).on("mouseenter",(function(t,e){C&&E({data:e,position:{x:t.clientX,y:t.clientY}})})).on("mousemove",(function(t,e){C&&T&&E({data:e,position:{x:t.clientX,y:t.clientY}})})).on("mouseleave",(()=>{E(null)})).on("click",(function(t,e){E(null),e.hasChildren&&w&&(t.stopPropagation(),S({selectedParentId:e.id}))})),x&&B.each((function(t){let e=t.value;t.children.forEach((t=>{Lo(this).append("rect").attr("class","child-bar").attr("y",(()=>A(e+t.value))).attr("width",j.bandwidth()).attr("height",(()=>I-A(t.value))).attr("fill",t.color).style("opacity",a),e+=t.value}))})),c&&B.append("text").attr("class","bar-value").attr("x",j.bandwidth()/2).attr("y",(t=>{const e=A(t.value);return isNaN(e)?A(0)-5:e-5})).attr("text-anchor","middle").style("fill","#000").style("font-size","12px").text((t=>Qi(",d")(t.value||0)));const H=M.append("g").attr("class","x-axis").attr("transform",`translate(0,${I})`).call(Oe(j));H.selectAll("text").style("text-anchor","end").attr("dx","-.8em").attr("dy",".15em").attr("transform","rotate(-45)"),M.append("g").attr("class","y-axis").call(R);const $=function(){var t,e,n,r=Wo,i=Ko,o=ta,a=Zo,s=Qo,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,h=zo,d=qn("start","zoom","end"),f=0,p=10;function g(t){t.property("__zoom",Jo).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",S).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new Vo(e,t.x,t.y)}function m(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new Vo(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,e,n,r){t.on("start.zoom",(function(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=w(t,o).event(r),s=i.apply(t,o),l=null==n?y(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,d="function"==typeof e?e.apply(t,o):e,f=h(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(t){if(1===t)t=d;else{var e=f(t),n=c/e[2];t=new Vo(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}}))}function w(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function _(t,...e){if(r.apply(this,arguments)){var n=w(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Fo(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],yr(this),n.start()}Yo(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),150),n.zoom("mouse",o(m(v(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function C(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=w(this,e,!0).event(t),s=Lo(t.view).on("mousemove.zoom",(function(t){if(Yo(t),!a.moved){var e=t.clientX-u,n=t.clientY-h;a.moved=e*e+n*n>f}a.event(t).zoom("mouse",o(m(a.that.__zoom,a.mouse[0]=Fo(t,i),a.mouse[1]),a.extent,c))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=Lo(t).on("dragstart.drag",null);e&&(r.on("click.drag",Ho,Bo),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,a.moved),Yo(t),a.event(t).end()}),!0),l=Fo(t,i),u=t.clientX,h=t.clientY;!function(t){var e=t.document.documentElement,n=Lo(t).on("dragstart.drag",Ho,Bo);"onselectstart"in e?n.on("selectstart.drag",Ho,Bo):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),qo(t),a.mouse=[l,this.__zoom.invert(l)],yr(this),a.start()}}function S(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Fo(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),h=o(m(v(n,l),a,s),i.apply(this,e),c);Yo(t),u>0?Lo(this).transition().duration(u).call(b,h,a,t):Lo(this).call(g.transform,h,a,t)}}function D(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,h=w(this,i,n.changedTouches.length===u).event(n);for(qo(n),a=0;a<u;++a)l=[l=Fo(s=c[a],this),this.__zoom.invert(l),s.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(e=l[0],t=setTimeout((function(){t=null}),500)),yr(this),h.start())}}function O(t,...e){if(this.__zooming){var n,r,i,a,s=w(this,e).event(t),l=t.changedTouches,u=l.length;for(Yo(t),n=0;n<u;++n)i=Fo(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],d=s.touch0[1],f=s.touch1[0],p=s.touch1[1],g=(g=f[0]-h[0])*g+(g=f[1]-h[1])*g,y=(y=p[0]-d[0])*y+(y=p[1]-d[1])*y;r=v(r,Math.sqrt(g/y)),i=[(h[0]+f[0])/2,(h[1]+f[1])/2],a=[(d[0]+p[0])/2,(d[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(m(r,i,a),s.extent,c))}}function T(t,...r){if(this.__zooming){var i,o,a=w(this,r).event(t),s=t.changedTouches,l=s.length;for(qo(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),i=0;i<l;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=Fo(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<p)){var c=Lo(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",Jo),t!==i?b(t,e,n,r):i.interrupt().each((function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},g.scaleBy=function(t,e,n,r){g.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,r)},g.scaleTo=function(t,e,n,r){g.transform(t,(function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==n?y(t):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return o(m(v(r,l),a,s),t,c)}),n,r)},g.translateBy=function(t,e,n,r){g.transform(t,(function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)}),null,r)},g.translateTo=function(t,e,n,r,a){g.transform(t,(function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?y(t):"function"==typeof r?r.apply(this,arguments):r;return o(Go.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),r,a)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=Lo(this.that).datum();d.call(t,this.that,new Xo(t,{sourceEvent:this.sourceEvent,target:g,type:t,transform:this.that.__zoom,dispatch:d}),e)}},g.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:Uo(+t),g):a},g.filter=function(t){return arguments.length?(r="function"==typeof t?t:Uo(!!t),g):r},g.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Uo(!!t),g):s},g.extent=function(t){return arguments.length?(i="function"==typeof t?t:Uo([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),g):i},g.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],g):[l[0],l[1]]},g.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(t){return arguments.length?(o=t,g):o},g.duration=function(t){return arguments.length?(u=+t,g):u},g.interpolate=function(t){return arguments.length?(h=t,g):h},g.on=function(){var t=d.on.apply(d,arguments);return t===d?g:t},g.clickDistance=function(t){return arguments.length?(f=(t=+t)*t,g):Math.sqrt(f)},g.tapDistance=function(t){return arguments.length?(p=+t,g):p},g}().scaleExtent([1,5]).extent([[0,0],[b,I]]).translateExtent([[0,0],[b,I]]).on("zoom",(t=>{const n=t.transform,r=j.bandwidth()*n.k,i=[n.x,n.x+b*n.k];B.attr("transform",(t=>`translate(${n.x+j(t.label)*n.k},0)`)),B.selectAll("rect").attr("width",Math.max(r,1)),c&&B.selectAll(".bar-value").attr("x",r/2).style("font-size",`${Math.min(12*n.k,24)}px`),H.call(Oe(j).scale(co().domain(e.map((t=>t.label))).range(i).padding(.1))),u&&L.select(".x-grid").attr("transform",`translate(0,${I})`).call(Oe(j).scale(co().domain(e.map((t=>t.label))).range(i).padding(.1)).tickSize(-I).tickFormat(""))}));if(r&&k.call($).call($.transform,Go),v&&M.append("text").attr("class","x-axis-label").attr("x",b/2).attr("y",I+25).attr("text-anchor","middle").style("font-size","12px").text(v),m&&M.append("text").attr("class","y-axis-label").attr("transform","rotate(-90)").attr("x",-I/2).attr("y",-45).attr("text-anchor","middle").style("font-size","12px").text(m),w&&_){const e=k.append("g").attr("class","back-button").style("cursor","pointer").on("click",(()=>{let e=null;Object.values(t).forEach((t=>{if(Array.isArray(t)){const n=t.find((t=>t.id===_));n&&(e=n.parent)}})),S({selectedParentId:e})}));e.append("rect").attr("x",10).attr("y",10).attr("width",60).attr("height",24).attr("rx",4).attr("fill","#f0f0f0").attr("stroke","#ccc"),e.append("text").attr("x",40).attr("y",26).attr("text-anchor","middle").style("font-size","12px").text("← Back")}}),[t,e,n,s,u,h,d,f,p,g,c,v,m,y,o,b,a,w,x,_,C,r]),(0,A.jsxs)("div",{ref:O,className:"bar-graph",style:{width:e,height:n,position:"relative"},children:[(0,A.jsx)("svg",{ref:D,style:{width:"100%",height:"100%"}}),T&&(0,A.jsxs)("div",{className:"bar-popover",style:{position:"fixed",left:T.position.x,top:T.position.y,transform:"translate(-50%, -100%)",backgroundColor:"white",padding:"8px",borderRadius:"4px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)",zIndex:1e3,pointerEvents:"none",marginTop:"-8px",maxWidth:"200px"},children:[(0,A.jsx)("div",{style:{marginBottom:"4px"},children:(0,A.jsx)("strong",{children:T.data.label})}),(0,A.jsxs)("div",{style:{marginBottom:"8px"},children:["Value: ",T.data.value]}),T.data.popoverHtml&&(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:T.data.popoverHtml}})]})]})},na=({label:t,value:e,onChange:n})=>{const{number:r,unit:i}=(t=>{const e=t?.match(/^(\d+)(.*)$/);return e?{number:parseInt(e[1],10),unit:e[2]||"px"}:{number:300,unit:"px"}})(e);return(0,A.jsxs)("div",{className:"lcp-dimension-control",children:[(0,A.jsx)("label",{className:"components-base-control__label",children:t}),(0,A.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[(0,A.jsx)(s.TextControl,{type:"number",value:r,onChange:t=>{n(`${t}${i}`)},min:0,style:{width:"80px"}}),(0,A.jsx)(s.SelectControl,{value:i,options:[{label:"Pixels (px)",value:"px"},{label:"Percentage (%)",value:"%"},{label:"Viewport Width (vw)",value:"vw"},{label:"Viewport Height (vh)",value:"vh"}],onChange:t=>{n(`${r}${t}`)},style:{minWidth:"100px"}})]})]})},ra=({data:t,colorSource:e,singleColor:n,customColors:r,onColorSourceChange:i,onSingleColorChange:a,onCustomColorChange:c})=>{const[u,h]=(0,l.useState)(null),d=(t,e)=>{const n=r.find((n=>n.dataset===t&&n.label===e));return n?n.color:"#FF6384"};return(0,A.jsxs)("div",{className:"lcp-color-controls",children:[(0,A.jsx)(s.SelectControl,{label:(0,o.__)("Color Source","lcp"),value:e,options:[{label:(0,o.__)("Default Colors","lcp"),value:"default"},{label:(0,o.__)("Single Color","lcp"),value:"singleColor"},{label:(0,o.__)("Custom Colors","lcp"),value:"customColors"}],onChange:i}),"singleColor"===e&&(0,A.jsxs)("div",{className:"components-base-control",children:[(0,A.jsx)("label",{className:"components-base-control__label",children:(0,o.__)("Bar Color","lcp")}),(0,A.jsx)(s.ColorPicker,{color:n,onChangeComplete:t=>a(t.hex)})]}),"customColors"===e&&(0,A.jsx)("div",{className:"custom-colors-grid",style:{marginTop:"10px"},children:(()=>{const e=[];return Object.entries(t).forEach((([t,n])=>{n.forEach((n=>{e.push({dataset:t,label:n.label,value:n.value})}))})),e})().map(((t,e)=>(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"8px",gap:"8px"},children:[(0,A.jsx)("span",{style:{flex:1},children:t.label}),(0,A.jsx)(s.Button,{onClick:()=>h(e),style:{backgroundColor:d(t.dataset,t.label),width:"24px",height:"24px",borderRadius:"50%",padding:0,border:"1px solid #ddd"}}),u===e&&(0,A.jsx)(s.Popover,{onClose:()=>h(null),children:(0,A.jsx)("div",{style:{padding:"12px"},children:(0,A.jsx)(s.ColorPicker,{color:d(t.dataset,t.label),onChangeComplete:e=>{c(t.dataset,t.label,e.hex)}})})})]},`${t.dataset}-${t.label}`)))})]})},ia=JSON.parse('{"UU":"lcp/bar-graph"}');(0,i.registerBlockType)(ia.UU,{edit:function({attributes:t,setAttributes:e}){const{chartHeight:n,chartWidth:r,barColor:i,barOpacity:c,backgroundColor:u,showGridY:h,yGridColor:d,xGridColor:f,xGridWidth:p,yGridWidth:g,chartData:v,dataSource:m,displayChartTitle:y,chartTitle:b,allowDownload:w,downloadMaxWidth:x,showSorting:_,showFiltering:C,showBarValues:S,showGridX:D,xAxisLabel:O,yAxisLabel:T,chartColorSource:E,chartCustomColors:I,enableHierarchicalView:k,enableStackedBars:M,selectedParentId:j,enableBarPopovers:N,enableXZoom:P}=t,R=(0,a.useBlockProps)(),L=t=>{console.log("New data:",t),e({chartData:t})},B=t=>{e({dataSource:t,chartData:{}})},H=(t,n,r)=>{const i=[...I],o=i.findIndex((e=>e.dataset===t&&e.label===n));o>=0?i[o].color=r:i.push({dataset:t,label:n,color:r}),e({chartCustomColors:i})},[$,z]=(0,l.useState)(!1),[F,U]=(0,l.useState)(!1),X=()=>{z(!$)},V=()=>{U(!F)},[G,q]=(0,l.useState)(!1),Y=()=>{q(!G)};return console.log("Chart data:",v),t.chartData&&"object"==typeof t.chartData||e({chartData:{}}),(0,A.jsxs)("div",{...R,children:[(0,A.jsx)(a.InspectorControls,{children:(0,A.jsx)(s.TabPanel,{className:"lcp-tab-panel",activeClass:"active-tab",tabs:[{name:"data",title:(0,o.__)("Data Settings","lcp"),className:"tab-data"},{name:"appearance",title:(0,o.__)("Appearance","lcp"),className:"tab-appearance"},{name:"tools",title:(0,o.__)("Tools Settings","lcp"),className:"tab-tools"}],children:t=>"data"===t.name?(0,A.jsxs)(s.Panel,{children:[(0,A.jsx)(s.PanelBody,{title:"Data Settings",children:(0,A.jsx)(me,{value:v,onChange:L,dataSource:m,onDataSourceChange:B})}),(0,A.jsxs)(s.PanelBody,{title:(0,o.__)("Chart Settings","lcp"),initialOpen:!0,children:[(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable Hierarchical View","lcp"),checked:k,onChange:t=>e({enableHierarchicalView:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable Stacked Bars","lcp"),checked:M,onChange:t=>e({enableStackedBars:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Display Chart Title","lcp"),checked:y,onChange:t=>e({displayChartTitle:t})}),y&&(0,A.jsx)(s.TextControl,{label:(0,o.__)("Chart Title","lcp"),value:b,onChange:t=>e({chartTitle:t})}),(0,A.jsx)(na,{label:(0,o.__)("Chart Width","lcp"),value:r,onChange:t=>e({chartWidth:t})}),(0,A.jsx)(na,{label:(0,o.__)("Chart Height","lcp"),value:n,onChange:t=>e({chartHeight:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable X-Axis Zoom","lcp-data-blocks"),checked:P,onChange:t=>e({enableXZoom:t}),help:(0,o.__)("Allow zooming and panning along the X-axis","lcp-data-blocks")})]}),(0,A.jsxs)(s.PanelBody,{title:"Appearance",children:[(0,A.jsxs)("div",{className:"background-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px"},children:[(0,A.jsx)("span",{children:"Background Color"}),(0,A.jsx)(s.Button,{className:"background-color-button",onClick:Y,style:{backgroundColor:u,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),G&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:Y,children:(0,A.jsx)(s.ColorPicker,{color:u,onChangeComplete:t=>{return n=t.hex,void e({backgroundColor:n});var n}})})]}),(0,A.jsx)(ra,{data:v,colorSource:E,singleColor:i,customColors:I,onColorSourceChange:t=>e({chartColorSource:t}),onSingleColorChange:t=>e({barColor:t}),onCustomColorChange:H}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("Bar Opacity","lcp"),value:c,onChange:t=>e({barOpacity:t}),min:0,max:1,step:.1}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Bar Values","lcp"),checked:S,onChange:t=>e({showBarValues:t})})]}),(0,A.jsxs)(s.PanelBody,{title:"Grid Settings",children:[(0,A.jsx)(s.TextControl,{label:(0,o.__)("X-Axis Label","lcp"),value:O,onChange:t=>e({xAxisLabel:t})}),(0,A.jsx)(s.TextControl,{label:(0,o.__)("Y-Axis Label","lcp"),value:T,onChange:t=>e({yAxisLabel:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show X-Axis Grid","lcp"),checked:D,onChange:t=>e({showGridX:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Y-Axis Grid","lcp"),checked:h,onChange:t=>e({showGridY:t})}),h&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"y-grid-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,A.jsx)("span",{children:"Y-Axis Grid Color"}),(0,A.jsx)(s.Button,{className:"grid-color-button",onClick:X,style:{backgroundColor:d,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),$&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:X,children:(0,A.jsx)(s.ColorPicker,{color:d,onChangeComplete:t=>{return n=t.hex,void e({yGridColor:n});var n}})})]}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("Y-Axis Grid Width","lcp"),value:g,onChange:t=>e({yGridWidth:t}),min:1,max:5,step:1})]}),D&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("div",{className:"x-grid-color-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[(0,A.jsx)("span",{children:"X-Axis Grid Color"}),(0,A.jsx)(s.Button,{className:"grid-color-button",onClick:V,style:{backgroundColor:f,width:"26px",height:"26px",borderRadius:"50%",border:"1px solid #ccc"}}),F&&(0,A.jsx)(s.Popover,{position:"bottom center",onClose:V,children:(0,A.jsx)(s.ColorPicker,{color:f,onChangeComplete:t=>{return n=t.hex,void e({xGridColor:n});var n}})})]}),(0,A.jsx)(s.RangeControl,{label:(0,o.__)("X-Axis Grid Width","lcp"),value:p,onChange:t=>e({xGridWidth:t}),min:1,max:5,step:1})]})]})]}):"appearance"===t.name?(0,A.jsx)(s.PanelBody,{children:(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Enable Bar Popovers","lcp-data-blocks"),checked:N,onChange:t=>e({enableBarPopovers:t}),help:(0,o.__)("Show HTML content when hovering over bars","lcp-data-blocks")})}):"tools"===t.name?(0,A.jsxs)(s.PanelBody,{children:[(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Allow Download","lcp"),checked:w,onChange:t=>e({allowDownload:t})}),w&&(0,A.jsx)(s.TextControl,{type:"number",label:(0,o.__)("Max Download Width (px)","lcp"),value:parseInt(x),onChange:t=>e({downloadMaxWidth:`${t}px`}),min:100,max:5e3}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Sorting Options","lcp"),checked:_,onChange:t=>e({showSorting:t})}),(0,A.jsx)(s.ToggleControl,{label:(0,o.__)("Show Filtering Options","lcp"),checked:C,onChange:t=>e({showFiltering:t})})]}):void 0})}),w&&(0,A.jsx)("div",{className:"lcp-bar-graph-toolbar",children:(0,A.jsx)(s.Button,{isPrimary:!0,onClick:()=>{const t=document.querySelector(".bar-graph svg");if(!t)return;const e=document.createElement("canvas"),n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),i=window.URL||window.webkitURL||window,o=i.createObjectURL(r),a=new Image;a.onload=()=>{e.width=t.width.baseVal.value,e.height=t.height.baseVal.value;const n=e.getContext("2d");n.fillStyle=u,n.fillRect(0,0,e.width,e.height),n.drawImage(a,0,0),e.toBlob((t=>{const e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="bar-graph.png",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e),i.revokeObjectURL(o)}),"image/png")},a.src=o},icon:"download",children:(0,o.__)("Download Graph","lcp")})}),v&&Object.keys(v).length>0?(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(ea,{data:v,width:r,height:n,enableXZoom:P,backgroundColor:u,defaultBarColor:i,barOpacity:c,showGridX:D,showGridY:h,yGridColor:d,xGridColor:f,xGridWidth:p,yGridWidth:g,title:y?b:"",showBarValues:S,xAxisLabel:O,yAxisLabel:T,colorSource:E,customColors:I,enableHierarchicalView:k,enableStackedBars:M,selectedParentId:j,enableBarPopovers:N,setAttributes:e})}):(0,A.jsx)("div",{className:"lcp-bar-graph-placeholder",style:{height:n,width:r,backgroundColor:u,display:"flex",alignItems:"center",justifyContent:"center",border:"2px dashed #ccc",borderRadius:"4px",color:"#666"},children:(0,o.__)("Please add data using the Data Settings panel","lcp")})]})},save:function({attributes:t}){const{chartHeight:e,backgroundColor:n}=t;return(0,A.jsx)("div",{...a.useBlockProps.save(),children:(0,A.jsx)("div",{className:"lcp-bar-graph",style:{height:e,backgroundColor:n}})})}})},792:t=>{t.exports=function t(e,n){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;0!=i--;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var a=o[i];if(!t(e[a],n[a]))return!1}return!0}return e!=e&&n!=n}}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var o=n[t]={exports:{}};return e[t](o,o.exports,r),o.exports}r.m=e,t=[],r.O=(e,n,i,o)=>{if(!n){var a=1/0;for(u=0;u<t.length;u++){for(var[n,i,o]=t[u],s=!0,l=0;l<n.length;l++)(!1&o||a>=o)&&Object.keys(r.O).every((t=>r.O[t](n[l])))?n.splice(l--,1):(s=!1,o<a&&(a=o));if(s){t.splice(u--,1);var c=i();void 0!==c&&(e=c)}}return e}o=o||0;for(var u=t.length;u>0&&t[u-1][2]>o;u--)t[u]=t[u-1];t[u]=[n,i,o]},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={57:0,350:0};r.O.j=e=>0===t[e];var e=(e,n)=>{var i,o,[a,s,l]=n,c=0;if(a.some((e=>0!==t[e]))){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(l)var u=l(r)}for(e&&e(n);c<a.length;c++)o=a[c],r.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return r.O(u)},n=globalThis.webpackChunklcp_bar_graph=globalThis.webpackChunklcp_bar_graph||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var i=r.O(void 0,[350],(()=>r(845)));i=r.O(i)})();