/*! For license information please see canvasPanel.0699b14dc04956d607e8.js.LICENSE.txt */
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3330],{38576:(t,e,n)=>{n.d(e,{f:()=>o});n(68404);var r=n(69783),i=n(45916);const o=t=>{let{onChange:e,options:n,label:o}=t;return(0,i.jsx)(r.ValuePicker,{icon:"plus",label:o,variant:"secondary",options:n,onChange:e,isFullWidth:!0})}},12641:(t,e,n)=>{n.d(e,{E:()=>f});var r=n(36636),i=n(68404),o=n(48435),a=n(90923),s=n(69783),c=n(45916);const l=t=>{let{name:e,onChange:n,verifyLayerNameUniqueness:r}=t;const o=(0,s.useStyles)(u),[a,l]=(0,i.useState)(!1),[f,d]=(0,i.useState)(null),p=t=>{l(!1),f?d(null):e!==t&&n(t)};return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)("div",{className:o.wrapper,children:[!a&&(0,c.jsxs)("button",{className:o.layerNameWrapper,title:"Edit layer name",onClick:t=>{l(!0)},"data-testid":"layer-name-div",children:[(0,c.jsx)("span",{className:o.layerName,children:e}),(0,c.jsx)(s.Icon,{name:"pen",className:o.layerEditIcon,size:"sm"})]}),a&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Input,{type:"text",defaultValue:e,onBlur:t=>{p(t.currentTarget.value.trim())},autoFocus:!0,onKeyDown:t=>{"Enter"===t.key&&p(t.target.value)},onFocus:t=>{t.target.select()},invalid:null!==f,onChange:t=>{const n=t.currentTarget.value.trim();0!==n.length?!r||r(n)||n===e?f&&d(null):d("Layer name already exists"):d("An empty layer name is not allowed")},className:o.layerNameInput,"data-testid":"layer-name-input"}),f&&(0,c.jsx)(s.FieldValidationMessage,{horizontal:!0,children:f})]})]})})},u=t=>({wrapper:r.css`
      label: Wrapper;
      display: flex;
      align-items: center;
      margin-left: ${t.spacing.xs};
    `,layerNameWrapper:r.css`
      display: flex;
      cursor: pointer;
      border: 1px solid transparent;
      border-radius: ${t.border.radius.md};
      align-items: center;
      padding: 0 0 0 ${t.spacing.xs};
      margin: 0;
      background: transparent;

      &:hover {
        background: ${t.colors.bg3};
        border: 1px dashed ${t.colors.border3};
      }

      &:focus {
        border: 2px solid ${t.colors.formInputBorderActive};
      }

      &:hover,
      &:focus {
        .query-name-edit-icon {
          visibility: visible;
        }
      }
    `,layerName:r.css`
      font-weight: ${t.typography.weight.semibold};
      color: ${t.colors.textBlue};
      cursor: pointer;
      overflow: hidden;
      margin-left: ${t.spacing.xs};
    `,layerEditIcon:(0,r.cx)(r.css`
        margin-left: ${t.spacing.md};
        visibility: hidden;
      `,"query-name-edit-icon"),layerNameInput:r.css`
      max-width: 300px;
      margin: -4px 0;
    `}),f=t=>{let{layers:e,getLayerInfo:n,onDragEnd:i,onSelect:u,onDelete:f,onDuplicate:p,showActions:h,selection:v,excludeBaseLayer:g,onNameChange:m,verifyLayerNameUniqueness:b}=t;const y=d(a.config.theme),x=t=>t?`${y.row} ${y.sel}`:y.row;return(0,c.jsx)(o.Z5,{onDragEnd:i,children:(0,c.jsx)(o.bK,{droppableId:"droppable",children:(t,i)=>(0,c.jsxs)("div",Object.assign({},t.droppableProps,{ref:t.innerRef,children:[(()=>{const t=[],i=g?1:0,a=g?2:1;for(let d=e.length-1;d>=i;d--){const i=e[d],g=i.getName(),E=Boolean(null==v?void 0:v.includes(g));t.push((0,c.jsx)(o._l,{draggableId:g,index:t.length,children:(t,o)=>(0,c.jsxs)("div",Object.assign({className:x(E),ref:t.innerRef},t.draggableProps,t.dragHandleProps,{onMouseDown:()=>u(i),children:[(0,c.jsx)(l,{name:g,onChange:t=>m(i,t),verifyLayerNameUniqueness:null!=b?b:void 0}),(0,c.jsxs)("div",{className:y.textWrapper,children:["  ",n(i)]}),h(i)&&(0,c.jsxs)(c.Fragment,{children:[p?(0,c.jsx)(s.IconButton,{name:"copy",title:"Duplicate",className:y.actionIcon,onClick:()=>p(i)}):null,(0,c.jsx)(s.IconButton,{name:"trash-alt",title:"remove",className:(0,r.cx)(y.actionIcon,y.dragIcon),onClick:()=>f(i)})]}),e.length>a&&(0,c.jsx)(s.Icon,{title:"Drag and drop to reorder",name:"draggabledots",size:"lg",className:y.dragIcon})]}))},g))}return t})(),t.placeholder]}))})})};f.defaultProps={isGroup:()=>!1};const d=(0,s.stylesFactory)((t=>({wrapper:r.css`
    margin-bottom: ${t.spacing.md};
  `,row:r.css`
    padding: ${t.spacing.xs} ${t.spacing.sm};
    border-radius: ${t.border.radius.sm};
    background: ${t.colors.bg2};
    min-height: ${t.spacing.formInputHeight}px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    cursor: pointer;

    border: 1px solid ${t.colors.formInputBorder};
    &:hover {
      border: 1px solid ${t.colors.formInputBorderHover};
    }
  `,sel:r.css`
    border: 1px solid ${t.colors.formInputBorderActive};
    &:hover {
      border: 1px solid ${t.colors.formInputBorderActive};
    }
  `,dragIcon:r.css`
    cursor: drag;
  `,actionIcon:r.css`
    color: ${t.colors.textWeak};
    &:hover {
      color: ${t.colors.text};
    }
  `,typeWrapper:r.css`
    color: ${t.colors.textBlue};
    margin-right: 5px;
  `,textWrapper:r.css`
    display: flex;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    margin-right: ${t.spacing.sm};
  `})))},39315:(t,e,n)=>{n.r(e),n.d(e,{plugin:()=>jc});var r=n(43215),i=n(82897),o=n(68404),a=n(66601),s=n(59149);let c;!function(t){t.Delete="delete",t.Duplicate="duplicate",t.MoveTop="move-top",t.MoveBottom="move-bottom"}(c||(c={}));var l,u=n(37686),f=n(32924),d=n(45916);function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}const h={id:"frame",name:"Frame",description:"Frame",getNewOptions:()=>({config:{}}),display:()=>l||(l=(0,d.jsx)("div",{children:"FRAME!"}))};class v extends f.f{constructor(t,e,n){var r;super(h,t,n),r=this,p(this,"elements",[]),p(this,"scene",void 0),p(this,"doAction",(function(t,e){var n;let o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(t){case c.Delete:r.elements=r.elements.filter((t=>t!==e)),r.scene.byName.delete(e.options.name),r.scene.save(),r.reinitializeMoveable();break;case c.Duplicate:if("frame"===e.item.id)return void console.log("Can not duplicate frames (yet)",t,e);const s=(0,i.cloneDeep)(e.options);if(a){const{constraint:t,placement:n}=e.options,{vertical:r,horizontal:i}=null!=t?t:{},o=null!=n?n:{};switch(r){case u.fJ.Top:case u.fJ.TopBottom:null==o.top?o.top=25:o.top+=10;break;case u.fJ.Bottom:null==o.bottom?o.bottom=100:o.bottom-=10}switch(i){case u._5.Left:case u._5.LeftRight:null==o.left?o.left=50:o.left+=10;break;case u._5.Right:null==o.right?o.right=50:o.right-=10}s.placement=o}const l=new f.f(e.item,s,r);l.updateData(r.scene.context),o&&(l.options.name=r.scene.getNextElementName()),r.elements.push(l),r.scene.byName.set(l.options.name,l),r.scene.save(),r.reinitializeMoveable();break;case c.MoveTop:case c.MoveBottom:null===(n=e.parent)||void 0===n||n.doMove(e,t);break;default:return void console.log("DO action",t,e)}})),this.options=t,this.parent=n,this.scene=e;let{elements:o}=this.options;o||(this.options.elements=o=[]);for(const t of o)if("frame"===t.type)this.elements.push(new v(t,e,this));else{var l;const e=null!==(l=a.Jk.getIfExists(t.type))&&void 0!==l?l:s.C;this.elements.push(new f.f(e,t,this))}}isRoot(){return!1}updateData(t){super.updateData(t);for(const e of this.elements)e.updateData(t)}reorder(t,e){const n=Array.from(this.elements),[r]=n.splice(t,1);n.splice(e,0,r),this.elements=n,this.reinitializeMoveable()}doMove(t,e){const n=this.elements.filter((e=>e!==t));e===c.MoveBottom?n.unshift(t):n.push(t),this.elements=n,this.scene.save(),this.reinitializeMoveable()}reinitializeMoveable(){this.scene.clearCurrentSelection(),setTimeout((()=>this.scene.initMoveable(!0,this.scene.isEditingEnabled)))}render(){return(0,d.jsx)("div",{ref:this.initElement,style:{overflow:"hidden"},children:this.elements.map((t=>t.render()))},this.UID)}visit(t){super.visit(t);for(const e of this.elements)t(e)}getSaveModel(){return Object.assign({},this.options,{elements:this.elements.map((t=>t.getSaveModel()))})}}var g=n(36636),m=n(61928),b=n(99918),y=n(90923),x=n(69783);function E(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function S(t,e){return function(n){n&&(t[e]=n)}}function C(t,e,n){return function(r){r&&(t[e][n]=r)}}function w(t,e){return function(n){var r=n.prototype;t.forEach((function(t){e(r,t)}))}}var D=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),o=-1===i?n.length:i;n[o]=t,r[o]=e},t}(),M=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),R="function"==typeof Map,O=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var P=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t=function(t,e){var n=[],r=[];return t.forEach((function(t){var e=t[0],i=t[1],o=new O;n[e]=o,r[i]=o})),n.forEach((function(t,e){t.connect(n[e-1])})),t.filter((function(t,n){return!e[n]})).map((function(t,e){var i=t[0],o=t[1];if(i===o)return[0,0];var a=n[i],s=r[o-1],c=a.getIndex();return a.disconnect(),s?a.connect(s,s.next):a.connect(void 0,n[0]),[c,a.getIndex()]}))}(this.changedBeforeAdded,this.fixed),e=this.changed,n=[];this.cacheOrdered=t.filter((function(t,r){var i=t[0],o=t[1],a=e[r],s=a[0],c=a[1];if(i!==o)return n.push([s,c]),!0})),this.cachePureChanged=n},t}();function _(t,e,n){var r=R?Map:n?M:D,i=n||function(t){return t},o=[],a=[],s=[],c=t.map(i),l=e.map(i),u=new r,f=new r,d=[],p=[],h={},v=[],g=0,m=0;return c.forEach((function(t,e){u.set(t,e)})),l.forEach((function(t,e){f.set(t,e)})),c.forEach((function(t,e){var n=f.get(t);void 0===n?(++m,a.push(e)):h[n]=m})),l.forEach((function(t,e){var n=u.get(t);void 0===n?(o.push(e),++g):(s.push([n,e]),m=h[e]||0,d.push([n-m,e-g]),p.push(e===n),n!==e&&v.push([n,e]))})),a.reverse(),new P(t,e,o,a,v,s,d,p)}var B=function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),n=_(this.list,e,this.findKeyCallback);return this.list=e,n},t}();const k=B;var T="undefined",z=typeof window!==T,j=(typeof document!==T&&document,[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}]),G=1e-7,I={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function N(t){return typeof t===T}function F(t){return t&&"object"==typeof t}function A(t){return Array.isArray(t)}function L(t){return"string"==typeof t}function Y(t){return"function"==typeof t}function X(t,e,n,r,i){return W(t,e,n)?n:function(t,e,n,r,i){for(var o,a=function(n){var a=e[n].trim();if(a===t.close&&!W(t,e,n))return{value:n};var s=n,c=tt(i,(function(t){return t.open===a}));if(c&&(s=X(c,e,n,r,i)),-1===s)return o=n,"break";o=n=s},s=n;s<r;++s){var c=a(s);if(s=o,"object"==typeof c)return c.value;if("break"===c)break}return-1}(t,e,n+1,r,i)}function W(t,e,n){if(!t.ignore)return null;var r=e.slice(Math.max(n-3,0),n+3).join("");return new RegExp(t.ignore).exec(r)}function q(t,e){var n=L(e)?{separator:e}:e,r=n.separator,i=void 0===r?",":r,o=n.isSeparateFirst,a=n.isSeparateOnlyOpenClose,s=n.isSeparateOpenClose,c=void 0===s?a:s,l=n.openCloseCharacters,u=void 0===l?j:l,f=u.map((function(t){var e=t.open,n=t.close;return e===n?e:e+"|"+n})).join("|"),d=new RegExp("(\\s*"+i+"\\s*|"+f+"|\\s+)","g"),p=t.split(d).filter(Boolean),h=p.length,v=[],g=[];function m(){return!!g.length&&(v.push(g.join("")),g=[],!0)}for(var b,y=function(t){var e=p[t].trim(),n=t,r=tt(u,(function(t){return t.open===e})),s=tt(u,(function(t){return t.close===e}));if(r){if(-1!==(n=X(r,p,t,h,u))&&c)return m()&&o?(b=t,"break"):(v.push(p.slice(t,n+1).join("")),t=n,o?(b=t,"break"):(b=t,"continue"))}else{if(s&&!W(s,p,t))throw new Error("invalid format: "+s.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,i)&&!a)return m(),o?(b=t,"break"):(b=t,"continue")}-1===n&&(n=h-1),g.push(p.slice(t,n+1).join("")),b=t=n},x=0;x<h;++x){var E=y(x);if(x=b,"break"===E)break}return g.length&&v.push(g.join("")),v}function H(t){return q(t,"")}function V(t){return q(t,",")}function $(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function K(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var n=e[1],r=e[2];return{prefix:n,unit:e[3],value:parseFloat(r)}}function U(t){return t.replace(/[\s-_]([a-z])/g,(function(t,e){return e.toUpperCase()}))}function J(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,n,r){return""+n+e+r.toLowerCase()}))}function Z(){return Date.now?Date.now():(new Date).getTime()}function Q(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function tt(t,e,n){var r=Q(t,e);return r>-1?t[r]:n}var et=function(){var t=Z(),e=z&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var n=Z();return window.setTimeout((function(){e(n-t)}),1e3/60)}}(),nt=function(){var t=z&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function rt(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in e)e.push(n);return e}function it(t,e){var n=K(t),r=n.value,i=n.unit;if(F(e)){var o=e[i];if(o){if(Y(o))return o(r);if(I[i])return I[i](r,o)}}else if("%"===i)return r*e/100;return I[i]?I[i](r):r}function ot(t,e,n){return Math.max(e,Math.min(t,n))}function at(t,e,n){return[[dt(e[0],G),dt(e[0]*t[1]/t[0],G)],[dt(e[1]*t[0]/t[1],G),dt(e[1],G)]].filter((function(t){return t.every((function(t,r){return n?t<=e[r]:t>=e[r]}))}))[0]||t}function st(t,e,n,r){if(!r)return t.map((function(t,r){return ot(t,e[r],n[r])}));var i=t[0],o=t[1],a=at(t,e,!1),s=a[0],c=a[1],l=at(t,n,!0),u=l[0],f=l[1];return i<s||o<c?(i=s,o=c):(i>u||o>f)&&(i=u,o=f),[i,o]}function ct(t){for(var e=t.length,n=0,r=e-1;r>=0;--r)n+=t[r];return e?n/e:0}function lt(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=Math.atan2(r,n);return i>=0?i:i+2*Math.PI}function ut(t){var e=function(t){return[0,1].map((function(e){return ct(t.map((function(t){return t[e]})))}))}(t),n=lt(e,t[0]),r=lt(e,t[1]);return n<r&&r-n<Math.PI||n>r&&r-n<-Math.PI?1:-1}function ft(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function dt(t,e){return e?Math.round(t/e)*e:t}function pt(t,e){return t.forEach((function(n,r){t[r]=dt(t[r],e)})),t}function ht(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function vt(t,e){t.classList?t.classList.add(e):t.className+=" "+e}function gt(t,e,n,r){t.addEventListener(e,n,r)}function mt(t,e,n,r){t.removeEventListener(e,n,r)}var bt=function(t,e){return bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},bt(t,e)};function yt(t,e){function n(){this.constructor=t}bt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var xt=function(){return xt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},xt.apply(this,arguments)};function Et(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function St(t,e){if(t===e)return!1;for(var n in t)if(!(n in e))return!0;for(var n in e)if(t[n]!==e[n])return!0;return!1}function Ct(t,e){var n=Object.keys(t),r=Object.keys(e),i=_(n,r,(function(t){return t})),o={},a={},s={};return i.added.forEach((function(t){var n=r[t];o[n]=e[n]})),i.removed.forEach((function(e){var r=n[e];a[r]=t[r]})),i.maintained.forEach((function(r){var i=r[0],o=n[i],a=[t[o],e[o]];t[o]!==e[o]&&(s[o]=a)})),{added:o,removed:a,changed:s}}function wt(t){t.forEach((function(t){t()}))}function Dt(t){var e=0;return t.map((function(t){return null==t?"$compat"+ ++e:""+t}))}function Mt(t,e,n,r){return L(t)||"number"==typeof t?new Tt("text_"+t,e,n,r,null,{}):new("string"==typeof t.type?zt:t.type.prototype.render?Ft:It)(t.type,e,n,r,t.ref,t.props)}function Rt(t){var e=[];return t.forEach((function(t){e=e.concat(A(t)?Rt(t):t)})),e}function Ot(t){var e=t.className,n=Et(t,["className"]);return null!=e&&(n.class=e),delete n.style,delete n.children,n}function Pt(t,e){if(!e)return t;for(var n in e)N(t[n])&&(t[n]=e[n]);return t}function _t(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.key,a=i.ref,s=Et(i,["key","ref"]);return{type:t,key:o,ref:a,props:xt(xt({},s),{children:Rt(n).filter((function(t){return null!=t&&!1!==t}))})}}var Bt=function(){function t(t,e,n,r,i,o){void 0===o&&(o={}),this.type=t,this.key=e,this.index=n,this.container=r,this.ref=i,this.props=o,this._providers=[]}var e=t.prototype;return e._should=function(t,e){return!0},e._update=function(t,e,n,r){if(this.base&&!L(e)&&!r&&!this._should(e.props,n))return!1;this.original=e,this._setState(n);var i=this.props;return L(e)||(this.props=e.props,this.ref=e.ref),this._render(t,this.base?i:{},n),!0},e._mounted=function(){var t=this.ref;t&&t(this.base)},e._setState=function(t){},e._updated=function(){var t=this.ref;t&&t(this.base)},e._destroy=function(){var t=this.ref;t&&t(null)},t}();function kt(t){var e={},n={};for(var r in t)0===r.indexOf("on")?n[r.replace("on","").toLowerCase()]=t[r]:e[r]=t[r];return{attributes:e,events:n}}var Tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}yt(e,t);var n=e.prototype;return n._render=function(t){var e=this,n=!this.base;return n&&(this.base=document.createTextNode(this.type.replace("text_",""))),t.push((function(){n?e._mounted():e._updated()})),!0},n._unmount=function(){this.base.parentNode.removeChild(this.base)},e}(Bt),zt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.events={},e._isSVG=!1,e}yt(e,t);var n=e.prototype;return n.addEventListener=function(t,e){var n=this.events;n[t]=function(t){t.nativeEvent=t,e(t)},this.base.addEventListener(t,n[t])},n.removeEventListener=function(t){var e=this.events;this.base.removeEventListener(t,e[t]),delete e[t]},n._should=function(t){return St(this.props,t)},n._render=function(t,e){var n=this,r=!this.base;if(r){var i=this._hasSVG();this._isSVG=i;var o=this.props.portalContainer;if(!o){var a=this.type;o=i?document.createElementNS("http://www.w3.org/2000/svg",a):document.createElement(a)}this.base=o}Wt(this,this._providers,this.props.children,t,null);var s=this.base,c=kt(e),l=c.attributes,u=c.events,f=kt(this.props),d=f.attributes,p=f.events;return function(t,e,n){var r=Ct(t,e),i=r.added,o=r.removed,a=r.changed;for(var s in i)n.setAttribute(s,i[s]);for(var s in a)n.setAttribute(s,a[s][1]);for(var s in o)n.removeAttribute(s)}(Ot(l),Ot(d),s),function(t,e,n){var r=Ct(t,e),i=r.added,o=r.removed,a=r.changed;for(var s in o)n.removeEventListener(s);for(var s in i)n.addEventListener(s,i[s]);for(var s in a)n.removeEventListener(s),n.addEventListener(s,a[s][1]);for(var s in o)n.removeEventListener(s)}(u,p,this),function(t,e,n){var r=n.style,i=Ct(t,e),o=i.added,a=i.removed,s=i.changed;for(var c in o){var l=J(c,"-");r.setProperty?r.setProperty(l,o[c]):r[l]=o[c]}for(var c in s)l=J(c,"-"),r.setProperty?r.setProperty(l,s[c][1]):r[l]=s[c][1];for(var c in a)l=J(c,"-"),r.removeProperty?r.removeProperty(l):r[l]=""}(e.style||{},this.props.style||{},s),t.push((function(){r?n._mounted():n._updated()})),!0},n._unmount=function(){var t=this.events,e=this.base;for(var n in t)e.removeEventListener(n,t[n]);this._providers.forEach((function(t){t._unmount()})),this.events={},this.props.portalContainer||e.parentNode.removeChild(e)},n._hasSVG=function(){if(this._isSVG||"svg"===this.type)return!0;var t=jt(this.container);return t&&"ownerSVGElement"in t},e}(Bt);function jt(t){if(!t)return null;var e=t.base;return e instanceof Node?e:jt(t.container)}function Gt(t){if(!t)return null;if(t instanceof Node)return t;var e=t.$_provider._providers;return e.length?Gt(e[0].base):null}var It=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}yt(e,t);var n=e.prototype;return n._render=function(t){var e=this.type(this.props);return Wt(this,this._providers,e?[e]:[],t),!0},n._unmount=function(){this._providers.forEach((function(t){t._unmount()}))},e}(Bt),Nt=function(t){function e(e){var n=t.call(this,"container","container",0,null)||this;return n.base=e,n}yt(e,t);var n=e.prototype;return n._render=function(){return!0},n._unmount=function(){},e}(Bt),Ft=function(t){function e(e,n,r,i,o,a){return void 0===a&&(a={}),t.call(this,e,n,r,i,o,Pt(a,e.defaultProps))||this}yt(e,t);var n=e.prototype;return n._should=function(t,e){return this.base.shouldComponentUpdate(Pt(t,this.type.defaultProps),e||this.base.state)},n._render=function(t,e,n){var r=this;this.props=Pt(this.props,this.type.defaultProps);var i=!this.base;i?(this.base=new this.type(this.props),this.base.$_provider=this):this.base.props=this.props;var o=this.base,a=o.state,s=o.render();s&&s.props&&!s.props.children.length&&(s.props.children=this.props.children),Wt(this,this._providers,s?[s]:[],t,n,null),t.push((function(){i?(r._mounted(),o.componentDidMount()):(r._updated(),o.componentDidUpdate(e,a))}))},n._setState=function(t){t&&(this.base.state=t)},n._unmount=function(){this._providers.forEach((function(t){t._unmount()})),clearTimeout(this.base.$_timer),this.base.componentWillUnmount()},e}(Bt),At=function(){function t(t){void 0===t&&(t={}),this.props=t,this.state={},this.$_timer=0,this.$_state={}}var e=t.prototype;return e.shouldComponentUpdate=function(t,e){return!0},e.render=function(){return null},e.setState=function(t,e,n){var r=this;this.$_timer||(this.$_state={}),clearTimeout(this.$_timer),this.$_timer=0,this.$_state=xt(xt({},this.$_state),t),n?this.$_setState(e,n):this.$_timer=setTimeout((function(){r.$_timer=0,r.$_setState(e,n)}))},e.forceUpdate=function(t){this.setState({},t,!0)},e.componentDidMount=function(){},e.componentDidUpdate=function(t,e){},e.componentWillUnmount=function(){},e.$_setState=function(t,e){var n=[],r=this.$_provider;Wt(r.container,[r],[r.original],n,xt(xt({},this.state),this.$_state),e)&&(t&&n.push(t),wt(n))},t}(),Lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return yt(e,t),e.prototype.shouldComponentUpdate=function(t,e){return St(this.props,t)||St(this.state,e)},e}(At),Yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}yt(e,t);var n=e.prototype;return n.componentDidMount=function(){var t=this.props,e=t.element,n=t.container;this._portalProvider=new Nt(n),qt(e,n,this._portalProvider)},n.componentDidUpdate=function(){var t=this.props;qt(t.element,t.container,this._portalProvider)},n.componentWillUnmount=function(){qt(null,this.props.container,this._portalProvider),this._portalProvider=null},e}(Lt);function Xt(t,e,n){var r=n.map((function(t){return L(t)?null:t.key})),i=_(Dt(e.map((function(t){return t.key}))),Dt(r),(function(t){return t}));i.removed.forEach((function(t){e.splice(t,1)[0]._unmount()})),i.ordered.forEach((function(t){var n=t[0],r=t[1],i=e.splice(n,1)[0];e.splice(r,0,i);var o=Gt(i.base),a=Gt(e[r+1]&&e[r+1].base);o&&o.parentNode.insertBefore(o,a)})),i.added.forEach((function(i){e.splice(i,0,Mt(n[i],r[i],i,t))}));var o=i.maintained.filter((function(i){i[0];var o=i[1],a=n[o],s=e[o];return(L(a)?"text_"+a:a.type)!==s.type?(s._unmount(),e.splice(o,1,Mt(a,r[o],o,t)),!0):(s.index=o,!1)}));return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(i.added,o.map((function(t){t[0];return t[1]})))}function Wt(t,e,n,r,i,o){var a=Xt(t,e,n),s=e.filter((function(t,e){return t._update(r,n[e],i,o)})),c=jt(t);return c&&a.reverse().forEach((function(n){var r=e[n],i=Gt(r.base);if(i&&c!==i&&!i.parentNode){var o=function(t,e){for(var n=t._providers,r=n.length,i=e.index+1;i<r;++i){var o=Gt(n[i].base);if(o)return o}return null}(t,r);c.insertBefore(i,o)}})),s.length>0}function qt(t,e,n){void 0===n&&(n=e.__REACT_COMPAT__);var r=!!n;return n||(n=new Nt(e)),function(t,e,n){var r=[];Wt(t,t._providers,e,r,n),wt(r)}(n,t?[t]:[]),r||(e.__REACT_COMPAT__=n),n}function Ht(t,e,n){var r=e.__REACT_COMPAT__;t&&!r&&(e.innerHTML=""),qt(t,e,r),n&&n()}function Vt(t,e){for(var n=t.length,r=0;r<n;++r)if(e(t[r],r))return!0;return!1}function $t(t,e){for(var n=t.length,r=0;r<n;++r)if(e(t[r],r))return t[r];return null}function Kt(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function Ut(){if("undefined"==typeof navigator||!navigator||!navigator.userAgentData)return!1;var t=navigator.userAgentData,e=t.brands||t.uaList;return!(!e||!e.length)}function Jt(t){return t.replace(/_/g,".")}function Zt(t,e){var n=null,r="-1";return Vt(t,(function(t){var i=Kt("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",e);return!(!i||t.brand)&&(n=t,r=i[3]||"-1",t.versionAlias?r=t.versionAlias:t.versionTest&&(r=function(t,e){var n=Kt("("+t+")((?:\\/|\\s|:)([0-9|\\.|_]+))",e);return n?n[3]:""}(t.versionTest.toLowerCase(),e)||r),r=Jt(r),!0)})),{preset:n,version:r}}function Qt(t,e){var n={brand:"",version:"-1"};return Vt(t,(function(t){var r=te(e,t);return!!r&&(n.brand=t.id,n.version=t.versionAlias||r.version,"-1"!==n.version)})),n}function te(t,e){return $t(t,(function(t){var n=t.brand;return Kt(""+e.test,n.toLowerCase())}))}var ee=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],ne=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome",versionTest:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",versionAlias:"-1",brand:!0}],re=[{test:"applewebkit",id:"webkit",versionTest:"applewebkit|safari"}],ie=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],oe=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function ae(t){var e=navigator.userAgentData,n=(e.uaList||e.brands).slice(),r=e.mobile||!1,i=n[0],o={name:i.brand,version:i.version,majorVersion:-1,webkit:!1,webkitVersion:"-1",chromium:!1,chromiumVersion:"-1",webview:!!Qt(ie,n).brand},a={name:"unknown",version:"-1",majorVersion:-1};o.webkit=!o.chromium&&Vt(re,(function(t){return te(n,t)}));var s=Qt(ne,n);if(o.chromium=!!s.brand,o.chromiumVersion=s.version,!o.chromium){var c=Qt(re,n);o.webkit=!!c.brand,o.webkitVersion=c.version}if(t){var l=t.platform.toLowerCase(),u=$t(oe,(function(t){return new RegExp(""+t.test,"g").exec(l)}));a.name=u?u.id:l,a.version=t.platformVersion}var f=Qt(ee,n);return f.brand&&(o.name=f.brand,o.version=t?t.uaFullVersion:f.version),"Linux armv8l"===navigator.platform?a.name="android":o.webkit&&(a.name=r?"ios":"mac"),"ios"===a.name&&o.webview&&(o.version="-1"),a.version=Jt(a.version),o.version=Jt(o.version),a.majorVersion=parseInt(a.version,10),o.majorVersion=parseInt(o.version,10),{browser:o,os:a,isMobile:r,isHints:!0}}function se(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),r={name:"unknown",version:"-1",majorVersion:-1,webview:!!Zt(ie,e).preset,chromium:!1,chromiumVersion:"-1",webkit:!1,webkitVersion:"-1"},i={name:"unknown",version:"-1",majorVersion:-1},o=Zt(ee,e),a=o.preset,s=o.version,c=Zt(oe,e),l=c.preset,u=c.version,f=Zt(ne,e);if(r.chromium=!!f.preset,r.chromiumVersion=f.version,!r.chromium){var d=Zt(re,e);r.webkit=!!d.preset,r.webkitVersion=d.version}return l&&(i.name=l.id,i.version=u,i.majorVersion=parseInt(u,10)),a&&(r.name=a.id,r.version=s,r.webview&&"ios"===i.name&&"safari"!==r.name&&(r.webview=!1)),r.majorVersion=parseInt(r.version,10),{browser:r,os:i,isMobile:n,isHints:!1}}function ce(t){return void 0===t&&Ut()?ae():se(t)}const le=ce;function ue(t,e,n,r,i,o){for(var a=0;a<i;++a){var s=n+a*i,c=r+a*i;t[s]+=t[c]*o,e[s]+=e[c]*o}}function fe(t,e,n,r,i){for(var o=0;o<i;++o){var a=n+o*i,s=r+o*i,c=t[a],l=e[a];t[a]=t[s],t[s]=c,e[a]=e[s],e[s]=l}}function de(t,e,n,r,i){for(var o=0;o<r;++o){var a=n+o*r;t[a]/=i,e[a]/=i}}function pe(t,e,n){void 0===n&&(n=Math.sqrt(t.length));for(var r=t.slice(),i=0;i<n;++i)r[i*n+e-1]=0,r[(e-1)*n+i]=0;return r[(e-1)*(n+1)]=1,r}function he(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=Be(e),i=0;i<e;++i){var o=e*i+i;if(!dt(n[o],G))for(var a=i+1;a<e;++a)if(n[e*i+a]){fe(n,r,i,a,e);break}if(!dt(n[o],G))return[];de(n,r,i,e,n[o]);for(a=0;a<e;++a){var s=a,c=n[a+i*e];dt(c,G)&&i!==a&&ue(n,r,s,i,e,-c)}}return r}function ve(t,e){for(var n=t.slice(),r=t.length;r<e-1;++r)n[r]=0;return n[e-1]=1,n}function ge(t,e,n){if(void 0===e&&(e=Math.sqrt(t.length)),e===n)return t;for(var r=Be(n),i=Math.min(e,n),o=0;o<i-1;++o){for(var a=0;a<i-1;++a)r[o*n+a]=t[o*e+a];r[(o+1)*n-1]=t[(o+1)*e-1],r[(n-1)*n+o]=t[(e-1)*e+o]}return r[n*n-1]=t[e*e-1],r}function me(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=Be(t);return e.forEach((function(e){r=be(r,e,t)})),r}function be(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s){r[s*n+a]=0;for(var c=0;c<i;++c)r[s*n+a]+=t[c*n+a]*e[s*i+c]}return r}function ye(t,e){for(var n=Math.min(t.length,e.length),r=t.slice(),i=0;i<n;++i)r[i]=r[i]+e[i];return r}function xe(t,e){for(var n=Math.min(t.length,e.length),r=t.slice(),i=0;i<n;++i)r[i]=r[i]-e[i];return r}function Ee(t,e){return void 0===e&&(e=9===t.length),e?[t[0],t[1],t[3],t[4],t[6],t[7]]:t}function Se(t,e,n){void 0===n&&(n=e.length);var r=be(t,e,n),i=r[n-1];return r.map((function(t){return t/i}))}function Ce(t,e){return be(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function we(t,e){return be(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function De(t,e){return be(t,_e(e,4))}function Me(t,e){var n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?1:i,a=e[2];return be(t,[r,0,0,0,0,o,0,0,0,0,void 0===a?1:a,0,0,0,0,1],4)}function Re(t,e){return Se(_e(e,3),ve(t,3))}function Oe(t,e){var n=e[0],r=void 0===n?0:n,i=e[1],o=void 0===i?0:i,a=e[2];return be(t,[1,0,0,0,0,1,0,0,0,0,1,0,r,o,void 0===a?0:a,1],4)}function Pe(t,e){return be(t,e,4)}function _e(t,e){var n=Math.cos(t),r=Math.sin(t),i=Be(e);return i[0]=n,i[1]=r,i[e]=-r,i[e+1]=n,i}function Be(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function ke(t,e){for(var n=Be(e),r=Math.min(t.length,e-1),i=0;i<r;++i)n[(e+1)*i]=t[i];return n}function Te(t,e){for(var n=Be(e),r=Math.min(t.length,e-1),i=0;i<r;++i)n[e*(e-1)+i]=t[i];return n}function ze(t,e,n,r,i,o,a,s){var c=t[0],l=t[1],u=e[0],f=e[1],d=n[0],p=n[1],h=r[0],v=r[1],g=i[0],m=i[1],b=o[0],y=o[1],x=a[0],E=a[1],S=s[0],C=s[1],w=he([c,0,u,0,d,0,h,0,l,0,f,0,p,0,v,0,1,0,1,0,1,0,1,0,0,c,0,u,0,d,0,h,0,l,0,f,0,p,0,v,0,1,0,1,0,1,0,1,-g*c,-m*c,-b*u,-y*u,-x*d,-E*d,-S*h,-C*h,-g*l,-m*l,-b*f,-y*f,-x*p,-E*p,-S*v,-C*v],8);if(!w.length)return[];var D=be(w,[g,m,b,y,x,E,S,C],8);return D[8]=1,ge(function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=[],r=0;r<e;++r)for(var i=0;i<e;++i)n[i*e+r]=t[e*r+i];return n}(D),3,4)}function je(t){return Ie(Ne(t))}function Ge(t,e){var n=Se(t,[e[0],e[1]||0,e[2]||0,1],4),r=n[3]||1;return[n[0]/r,n[1]/r,n[2]/r]}function Ie(t){var e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return t.forEach((function(t){var n=t.matrixFunction,r=t.functionValue;n&&(e=n(e,r))})),e}function Ne(t){return(A(t)?t:H(t)).map((function(t){var e=$(t),n=e.prefix,r=e.value,i=null,o=n,a="";if("translate"===n||"translateX"===n||"translate3d"===n){var s=V(r).map((function(t){return parseFloat(t)})),c=s[0],l=s[1],u=void 0===l?0:l,f=s[2];i=Oe,a=[c,u,void 0===f?0:f]}else if("translateY"===n){i=Oe,a=[0,u=parseFloat(r),0]}else if("translateZ"===n){i=Oe,a=[0,0,parseFloat(r)]}else if("scale"===n||"scale3d"===n){var d=V(r).map((function(t){return parseFloat(t)})),p=d[0],h=d[1],v=void 0===h?p:h,g=d[2];i=Me,a=[p,v,void 0===g?1:g]}else if("scaleX"===n){i=Me,a=[p=parseFloat(r),1,1]}else if("scaleY"===n){i=Me,a=[1,v=parseFloat(r),1]}else if("scaleZ"===n){i=Me,a=[1,1,parseFloat(r)]}else if("rotate"===n||"rotateZ"===n||"rotateX"===n||"rotateY"===n){var m=K(r),b=m.unit,y=m.value;"rotate"===n||"rotateZ"===n?(o="rotateZ",i=De):"rotateX"===n?i=Ce:"rotateY"===n&&(i=we),a="rad"===b?y:y*Math.PI/180}else if("matrix3d"===n)i=Pe,a=V(r).map((function(t){return parseFloat(t)}));else if("matrix"===n){var x=V(r).map((function(t){return parseFloat(t)}));i=Pe,a=[x[0],x[1],0,0,x[2],x[3],0,0,0,0,1,0,x[4],x[5],0,1]}else o="";return{name:n,functionName:o,value:r,matrixFunction:i,functionValue:a}}))}var Fe=function(t,e){return Fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Fe(t,e)};var Ae,Le="function"==typeof Map?void 0:(Ae=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++Ae)});function Ye(t,e){return _(t,e,Le)}const Xe=function(t){function e(e){return void 0===e&&(e=[]),t.call(this,e,Le)||this}return function(t,e){function n(){this.constructor=t}Fe(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e}(k);function We(t){return t.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;n>=0;--n)e+=t[n];return e}(t.map((function(e,n){var r=t[n+1]||t[0];return e[0]*r[1]-r[0]*e[1]}))))/2}function qe(t,e){var n=e.width,r=e.height,i=e.left,o=e.top,a=He(t),s=a.minX,c=a.minY,l=a.maxX,u=a.maxY,f=n/(l-s),d=r/(u-c);return t.map((function(t){return[i+(t[0]-s)*f,o+(t[1]-c)*d]}))}function He(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]}));return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,n),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,n)}}function Ve(t,e,n){var r=t[0],i=t[1],o=He(e),a=o.minX,s=o.minY,c=o.maxX,l=o.maxY,u=[[a,i],[c,i]],f=[[r,s],[r,l]],d=$e(u[0],u[1]),p=$e(f[0],f[1]),h=Je(e),v=[],g=[];return h.forEach((function(t){var e=$e(t[0],t[1]),n=Ue(Ke(d,e),[u,t]),o=Ue(Ke(p,e),[f,t]);1===n.length&&t[0][1]===i||v.push.apply(v,n),1===o.length&&t[0][0]===r||g.push.apply(g,o),e[0]||v.push.apply(v,n),e[1]||g.push.apply(g,o)})),!n&&(Q(v,(function(t){return t[0]===r}))>-1||Q(g,(function(t){return t[1]===i}))>-1)||!!(v.filter((function(t){return t[0]>r})).length%2&&g.filter((function(t){return t[1]>i})).length%2)}function $e(t,e){var n=t[0],r=t[1],i=e[0],o=e[1];if(n===i&&r===o)return[0,0,0];if(n===i)return[1,0,-n];if(r===o)return[0,1,-r];var a=(i-n)/(r-o);return[1,a,-n-a*r]}function Ke(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],c=e[1],l=e[2],u=0===i&&0===s,f=0===o&&0===c;if(u&&f)return[];if(u){var d=-a/o;return d!==-l/c?[]:[[-1/0,d],[1/0,d]]}if(f){var p=-a/i;return p!==-l/s?[]:[[p,-1/0],[p,1/0]]}return 0===i?[[n=-(c*(r=-a/o)+l)/s,r]]:0===s?[[n=-(o*(r=-l/c)+a)/i,r]]:0===o?[[n=-a/i,r=-(s*n+l)/c]]:0===c?[[n=-l/s,r=-(i*n+a)/o]]:[[n=(o*l-c*a)/(c*i-o*s),r=-(i*n+a)/o]]}function Ue(t,e){var n=e.map((function(t){return[0,1].map((function(e){return[Math.min(t[0][e],t[1][e]),Math.max(t[0][e],t[1][e])]}))}));if(2===t.length){var r=t[0],i=r[0],o=r[1];if(i===t[1][0]){var a=Math.max.apply(Math,n.map((function(t){return t[1][0]}))),s=Math.min.apply(Math,n.map((function(t){return t[1][1]})));return a>s?[]:[[i,a],[i,s]]}if(o===t[1][1]){var c=Math.max.apply(Math,n.map((function(t){return t[0][0]}))),l=Math.min.apply(Math,n.map((function(t){return t[0][1]})));return c>l?[]:[[c,o],[l,o]]}}return t.filter((function(t){return n.every((function(e){return e[0][0]<=t[0]&&t[0]<=e[0][1]&&e[1][0]<=t[1]&&t[1]<=e[1][1]}))}))}function Je(t){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t.slice(1),[t[0]]).map((function(e,n){return[t[n],e]}))}function Ze(t,e){var n=t.slice(),r=e.slice();-1===ut(n)&&n.reverse(),-1===ut(r)&&r.reverse();var i=Je(n),o=Je(r),a=i.map((function(t){return $e(t[0],t[1])})),s=o.map((function(t){return $e(t[0],t[1])})),c=[];a.forEach((function(t,e){var n=i[e],a=[];s.forEach((function(r,i){var s=Ue(Ke(t,r),[n,o[i]]);a.push.apply(a,s.map((function(t){return{index1:e,index2:i,pos:t}})))})),a.sort((function(t,e){return ft(n[0],t.pos)-ft(n[0],e.pos)})),c.push.apply(c,a),Ve(n[1],r)&&c.push({index1:e,index2:-1,pos:n[1]})})),o.forEach((function(t,e){if(Ve(t[1],n)){var r=!1,i=Q(c,(function(t){return t.index2===e?(r=!0,!1):!!r}));-1===i&&(r=!1,i=Q(c,(function(t){var n=t.index1,i=t.index2;return-1===n&&i+1===e?(r=!0,!1):!!r}))),-1===i?c.push({index1:-1,index2:e,pos:t[1]}):c.splice(i,0,{index1:-1,index2:e,pos:t[1]})}}));var l=c.map((function(t){return t.pos})),u={};return l.filter((function(t){var e=t[0]+"x"+t[1];return!u[e]&&(u[e]=!0,!0)}))}var Qe=function(){return Qe=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Qe.apply(this,arguments)};var tn=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(F(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(F(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=Q(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Qe({listener:e},n))},t}();const en=tn;var nn=function(t,e){return nn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},nn(t,e)};var rn=function(){return rn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},rn.apply(this,arguments)};function on(t){var e=t.container;return e===document.body?[e.scrollLeft||document.documentElement.scrollLeft,e.scrollTop||document.documentElement.scrollTop]:[e.scrollLeft,e.scrollTop]}const an=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._startRect=null,e._startPos=[],e._prevTime=0,e._timer=0,e._prevScrollPos=[0,0],e._isWait=!1,e}!function(t,e){function n(){this.constructor=t}nn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return n.dragStart=function(t,e){var n=e.container,r=0,i=0,o=0,a=0;if(n===document.body)o=window.innerWidth,a=window.innerHeight;else{var s=n.getBoundingClientRect();r=s.top,i=s.left,o=s.width,a=s.height}this._startPos=[t.clientX,t.clientY],this._startRect={top:r,left:i,width:o,height:a},this._prevScrollPos=this._getScrollPosition([0,0],e)},n.drag=function(t,e){var n=t.clientX,r=t.clientY,i=e.threshold,o=void 0===i?0:i,a=this._startRect,s=this._startPos,c=[0,0];return a.top>r-o?(s[1]>a.top||r<s[1])&&(c[1]=-1):a.top+a.height<r+o&&(s[1]<a.top+a.height||r>s[1])&&(c[1]=1),a.left>n-o?(s[0]>a.left||n<s[0])&&(c[0]=-1):a.left+a.width<n+o&&(s[0]<a.left+a.width||n>s[0])&&(c[0]=1),clearTimeout(this._timer),!(!c[0]&&!c[1])&&this._continueDrag(rn(rn({},e),{direction:c,inputEvent:t,isDrag:!0}))},n.checkScroll=function(t){var e=this;if(this._isWait)return!1;var n=t.prevScrollPos,r=void 0===n?this._prevScrollPos:n,i=t.direction,o=t.throttleTime,a=void 0===o?0:o,s=t.inputEvent,c=t.isDrag,l=this._getScrollPosition(i||[0,0],t),u=l[0]-r[0],f=l[1]-r[1],d=i||[u?Math.abs(u)/u:0,f?Math.abs(f)/f:0];return this._prevScrollPos=l,!(!u&&!f)&&(this.trigger("move",{offsetX:d[0]?u:0,offsetY:d[1]?f:0,inputEvent:s}),a&&c&&(this._timer=window.setTimeout((function(){e._continueDrag(t)}),a)),!0)},n.dragEnd=function(){clearTimeout(this._timer)},n._getScrollPosition=function(t,e){var n=e.container,r=e.getScrollPosition;return(void 0===r?on:r)({container:n,direction:t})},n._continueDrag=function(t){var e=this,n=t.container,r=t.direction,i=t.throttleTime,o=t.useScroll,a=t.isDrag,s=t.inputEvent;if(!a||!this._isWait){var c=Z(),l=Math.max(i+this._prevTime-c,0);if(l>0)return this._timer=window.setTimeout((function(){e._continueDrag(t)}),l),!1;this._prevTime=c;var u=this._getScrollPosition(r,t);return this._prevScrollPos=u,a&&(this._isWait=!0),this.trigger("scroll",{container:n,direction:r,inputEvent:s}),this._isWait=!1,o||this.checkScroll(rn(rn({},t),{prevScrollPos:u,direction:r,inputEvent:s}))}},e}(en);var sn=function(t,e){return sn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},sn(t,e)};var cn=function(){return cn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},cn.apply(this,arguments)};function ln(t){return 180*(e=[t[0].clientX,t[0].clientY],n=[t[1].clientX,t[1].clientY],r=n[0]-e[0],i=n[1]-e[1],((o=Math.atan2(i,r))>=0?o:o+2*Math.PI)/Math.PI);var e,n,r,i,o}function un(t){return t.touches?function(t){for(var e=Math.min(t.length,2),n=[],r=0;r<e;++r)n.push(pn(t[r]));return n}(t.touches):[pn(t)]}function fn(t,e,n){var r=n.length,i=hn(t,r),o=i.clientX,a=i.clientY,s=i.originalClientX,c=i.originalClientY,l=hn(e,r),u=l.clientX,f=l.clientY,d=hn(n,r);return{clientX:s,clientY:c,deltaX:o-u,deltaY:a-f,distX:o-d.clientX,distY:a-d.clientY}}function dn(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function pn(t){return{clientX:t.clientX,clientY:t.clientY}}function hn(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var vn=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var e=t.prototype;return e.getAngle=function(t){return void 0===t&&(t=this.prevClients),ln(t)},e.getRotation=function(t){return void 0===t&&(t=this.prevClients),ln(t)-ln(this.startClients)},e.getPosition=function(t,e){void 0===t&&(t=this.prevClients);var n=fn(t||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=t,n},e.getPositions=function(t){void 0===t&&(t=this.prevClients);var e=this.prevClients;return this.startClients.map((function(n,r){return fn([t[r]],[e[r]],[n])}))},e.getMovement=function(t){var e=this.movement;if(!t)return e;var n=hn(t,this.length),r=hn(this.prevClients,this.length),i=n.clientX-r.clientX,o=n.clientY-r.clientY;return Math.sqrt(i*i+o*o)+e},e.getDistance=function(t){return void 0===t&&(t=this.prevClients),dn(t)},e.getScale=function(t){return void 0===t&&(t=this.prevClients),dn(t)/dn(this.startClients)},e.move=function(t,e){this.startClients.forEach((function(n){n.clientX-=t,n.clientY-=e}))},t}(),gn=["textarea","input"],mn=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;r.options={},r.flag=!1,r.pinchFlag=!1,r.datas={},r.isDrag=!1,r.isPinch=!1,r.isMouse=!1,r.isTouch=!1,r.clientStores=[],r.targets=[],r.prevTime=0,r.doubleFlag=!1,r._dragFlag=!1,r.onDragStart=function(t,e){if(void 0===e&&(e=!0),r.flag||!1!==t.cancelable){var n=r.options,i=n.container,o=n.pinchOutside,a=n.preventRightClick,s=n.preventDefault,c=n.checkInput,l=r.isTouch,u=!r.flag;if(u){var f=document.activeElement,d=t.target,p=d.tagName.toLowerCase(),h=gn.indexOf(p)>-1,v=d.isContentEditable;if(h||v){if(c||f===d)return!1;if(f&&v&&f.isContentEditable&&f.contains(d))return!1}else if((s||"touchstart"===t.type)&&f){var g=f.tagName;(f.isContentEditable||gn.indexOf(g)>-1)&&f.blur()}if(r.clientStores=[new vn(un(t))],r.flag=!0,r.isDrag=!1,r._dragFlag=!0,r.datas={},a&&(3===t.which||2===t.button))return r.initDrag(),!1;r.doubleFlag=Z()-r.prevTime<200,!1===r.emit("dragStart",cn({datas:r.datas,inputEvent:t,isTrusted:e,isDouble:r.doubleFlag},r.getCurrentStore().getPosition(),{preventDefault:function(){t.preventDefault()},preventDrag:function(){r._dragFlag=!1}}))&&r.initDrag(),r.flag&&s&&t.preventDefault()}if(!r.flag)return!1;var m=0;if(u&&l&&o&&(m=setTimeout((function(){gt(i,"touchstart",r.onDragStart,{passive:!1})}))),!u&&l&&o&&mt(i,"touchstart",r.onDragStart),r.flag&&function(t){return t.touches&&t.touches.length>=2}(t)){if(clearTimeout(m),u&&t.touches.length!==t.changedTouches.length)return;r.pinchFlag||r.onPinchStart(t)}}},r.onDrag=function(t,e){if(r.flag){var n=un(t),i=r.moveClients(n,t,!1);if(r._dragFlag){if(r.pinchFlag||i.deltaX||i.deltaY)if(!1===r.emit("drag",cn({},i,{isScroll:!!e,inputEvent:t})))return void r.stop();r.pinchFlag&&r.onPinch(t,n)}r.getCurrentStore().getPosition(n,!0)}},r.onDragEnd=function(t){if(r.flag){var e=r.options,n=e.pinchOutside,i=e.container;r.isTouch&&n&&mt(i,"touchstart",r.onDragStart),r.flag=!1;var o=r._getPosition(),a=Z(),s=!r.isDrag&&r.doubleFlag;r.prevTime=r.isDrag||s?0:a,r.emit("dragEnd",cn({datas:r.datas,isDouble:s,isDrag:r.isDrag,isClick:!r.isDrag,inputEvent:t},o)),r.pinchFlag&&r.onPinchEnd(t),r.clientStores=[]}},r.onBlur=function(){r.onDragEnd()};var i=[].concat(e);r.options=cn({checkInput:!1,container:i.length>1?window:i[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},n);var o=r.options,a=o.container,s=o.events,c=o.checkWindowBlur;if(r.isTouch=s.indexOf("touch")>-1,r.isMouse=s.indexOf("mouse")>-1,r.targets=i,r.isMouse&&(i.forEach((function(t){gt(t,"mousedown",r.onDragStart)})),gt(a,"mousemove",r.onDrag),gt(a,"mouseup",r.onDragEnd),gt(a,"contextmenu",r.onDragEnd)),c&&gt(window,"blur",r.onBlur),r.isTouch){var l={passive:!1};i.forEach((function(t){gt(t,"touchstart",r.onDragStart,l)})),gt(a,"touchmove",r.onDrag,l),gt(a,"touchend",r.onDragEnd,l),gt(a,"touchcancel",r.onDragEnd,l)}return r}!function(t,e){function n(){this.constructor=t}sn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return n.stop=function(){this.isDrag=!1,this.flag=!1,this.clientStores=[],this.datas={}},n.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce((function(t,e){return t+e.movement}),0)},n.isDragging=function(){return this.isDrag},n.isFlag=function(){return this.flag},n.isPinchFlag=function(){return this.pinchFlag},n.isDoubleFlag=function(){return this.doubleFlag},n.isPinching=function(){return this.isPinch},n.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},n.move=function(t,e){var n=t[0],r=t[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map((function(t){var e=t.clientX,i=t.clientY;return{clientX:e+n,clientY:i+r,originalClientX:e,originalClientY:i}})),e,!0)},n.triggerDragStart=function(t){this.onDragStart(t,!1)},n.setEventDatas=function(t){var e=this.datas;for(var n in t)e[n]=t[n];return this},n.getCurrentEvent=function(t){return cn({datas:this.datas},this._getPosition(),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:t})},n.getEventDatas=function(){return this.datas},n.unset=function(){var t=this,e=this.targets,n=this.options.container;this.off(),mt(window,"blur",this.onBlur),this.isMouse&&(e.forEach((function(e){mt(e,"mousedown",t.onDragStart)})),mt(n,"mousemove",this.onDrag),mt(n,"mouseup",this.onDragEnd),mt(n,"contextmenu",this.onDragEnd)),this.isTouch&&(e.forEach((function(e){mt(e,"touchstart",t.onDragStart)})),mt(n,"touchstart",this.onDragStart),mt(n,"touchmove",this.onDrag),mt(n,"touchend",this.onDragEnd),mt(n,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var e=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>e)){var n=new vn(un(t));this.pinchFlag=!0,this.clientStores.splice(0,0,n),!1===this.emit("pinchStart",cn({datas:this.datas,angle:n.getAngle(),touches:this.getCurrentStore().getPositions()},n.getPosition(),{inputEvent:t}))&&(this.pinchFlag=!1)}},n.onPinch=function(t,e){if(this.flag&&this.pinchFlag&&!(e.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",cn({datas:this.datas,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e),{inputEvent:t}))}},n.onPinchEnd=function(t){if(this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit("pinchEnd",cn({datas:this.datas,isPinch:e,touches:n.getPositions()},n.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},n.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1},n.getCurrentStore=function(){return this.clientStores[0]},n.moveClients=function(t,e,n){var r=this._getPosition(t,n);return(r.deltaX||r.deltaY)&&(this.isDrag=!0),cn({datas:this.datas},r,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},n._getPosition=function(t,e){var n=this.getCurrentStore().getPosition(t,e),r=this.clientStores.slice(1).reduce((function(t,e){var n=e.getPosition();return t.distX+=n.distX,t.distY+=n.distY,t}),n),i=r.distX,o=r.distY;return cn({},n,{distX:i,distY:o})},e}(en);const bn=mn;var yn=function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0};function xn(t,e,n,r){var i=document.createElement("style");return i.setAttribute("type","text/css"),i.setAttribute("data-styled-id",t),n.nonce&&i.setAttribute("nonce",n.nonce),i.innerHTML=function(t,e,n){return n.original?e:e.replace(/([^};{\s}][^};{]*|^\s*){/gm,(function(e,n){var r=n.trim();return(r?V(r):[""]).map((function(e){var n=e.trim();return 0===n.indexOf("@")?n:n.indexOf(":global")>-1?n.replace(/\:global/g,""):n.indexOf(":host")>-1?""+n.replace(/\:host/g,"."+t):n?"."+t+" "+n:"."+t})).join(", ")+" {"}))}(t,e,n),(r||document.head||document.body).appendChild(i),i}const En=function(t){var e,n="rCS"+yn(t).toString(36),r=0;return{className:n,inject:function(i,o){void 0===o&&(o={});var a,s=function(t){if(t&&t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(i),c=0===r;return(s||c)&&(a=xn(n,t,o,s)),c&&(e=a),s||++r,{destroy:function(){s?(i.removeChild(a),a=null):(r>0&&--r,0===r&&e&&(e.parentNode.removeChild(e),e=null))}}}}};var Sn=function(t,e){return Sn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Sn(t,e)};function Cn(t,e){function n(){this.constructor=t}Sn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var wn=function(){return wn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},wn.apply(this,arguments)};var Dn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.injectResult=null,e.tag="div",e}Cn(e,t);var n=e.prototype;return n.render=function(){var t=this.props,e=t.className,n=void 0===e?"":e,r=(t.cspNonce,t.portalContainer),i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["className","cspNonce","portalContainer"]),o=this.injector.className,a=this.tag,s={};return"simple-1.1.0".indexOf("simple")>-1&&r&&(s={portalContainer:r}),_t(a,wn({ref:S(this,"element"),"data-styled-id":o,className:n+" "+o},s,i))},n.componentDidMount=function(){this.injectResult=this.injector.inject(this.element,{nonce:this.props.cspNonce})},n.componentWillUnmount=function(){this.injectResult.destroy(),this.injectResult=null},n.getElement=function(){return this.element},e}(At);const Mn=function(t,e){var n=En(e);return function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.injector=n,r.tag=t,r}return Cn(r,e),r}(Dn)};var Rn=function(){return Rn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Rn.apply(this,arguments)};var On=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(F(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(F(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=Q(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Rn({listener:e},n))},t}(),Pn=function(t,e){return Pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Pn(t,e)};function _n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Pn(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Bn=function(){return Bn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Bn.apply(this,arguments)};function kn(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function Tn(t,e){var n;return Bn({events:{},props:(n={},n[t]=Boolean,n),name:t},e)}var zn,jn,Gn=le().browser.webkit,In=Gn&&(zn="undefined"==typeof window?{userAgent:""}:window.navigator,!!(jn=/applewebkit\/([^\s]+)/g.exec(zn.userAgent.toLowerCase()))&&parseFloat(jn[1])<605),Nn="moveable-",Fn="\n{\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tleft: 0;\n\ttop: 0;\n    z-index: 3000;\n    --moveable-color: #4af;\n    --zoom: 1;\n    --zoompx: 1px;\n    will-change: transform;\n}\n.control-box {\n    z-index: 0;\n}\n.line, .control {\n    position: absolute;\n\tleft: 0;\n    top: 0;\n    will-change: transform;\n}\n.control {\n\twidth: 14px;\n\theight: 14px;\n\tborder-radius: 50%;\n\tborder: 2px solid #fff;\n\tbox-sizing: border-box;\n    background: #4af;\n    background: var(--moveable-color);\n\tmargin-top: -7px;\n    margin-left: -7px;\n    border: 2px solid #fff;\n    z-index: 10;\n}\n.padding {\n    position: absolute;\n    top: 0px;\n    left: 0px;\n    width: 100px;\n    height: 100px;\n    transform-origin: 0 0;\n}\n.line {\n\twidth: 1px;\n    height: 1px;\n    background: #4af;\n    background: var(--moveable-color);\n\ttransform-origin: 0px 50%;\n}\n.line.dashed {\n    box-sizing: border-box;\n    background: transparent;\n}\n.line.dashed.horizontal {\n    border-top: 1px dashed #4af;\n    border-top-color: #4af;\n    border-top-color: var(--moveable-color);\n}\n.line.dashed.vertical {\n    border-left: 1px dashed #4af;\n    border-left-color: #4af;\n    border-left-color: var(--moveable-color);\n}\n.line.vertical {\n    transform: translateX(-50%);\n}\n.line.horizontal {\n    transform: translateY(-50%);\n}\n.line.vertical.bold {\n    width: 2px;\n}\n.line.horizontal.bold {\n    height: 2px;\n}\n\n.control.origin {\n\tborder-color: #f55;\n\tbackground: #fff;\n\twidth: 12px;\n\theight: 12px;\n\tmargin-top: -6px;\n    margin-left: -6px;\n\tpointer-events: none;\n}\n".concat([0,15,30,45,60,75,90,105,120,135,150,165].map((function(t){return'\n.direction[data-rotation="'.concat(t,'"] {\n\t').concat(function(t){var e=function(t,e){return'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(32*t,'px" height="').concat(32*t,'px" viewBox="0 0 32 32" ><path d="M 16,5 L 12,10 L 14.5,10 L 14.5,22 L 12,22 L 16,27 L 20,22 L 17.5,22 L 17.5,10 L 20, 10 L 16,5 Z" stroke-linejoin="round" stroke-width="1.2" fill="black" stroke="white" style="transform:rotate(').concat(e,'deg);transform-origin: 16px 16px"></path></svg>')}(1,t),n=45*Math.round(t/45)%180,r="ns-resize";return 135===n?r="nwse-resize":45===n?r="nesw-resize":90===n&&(r="ew-resize"),"cursor:".concat(r,";cursor: url('").concat(e,"') 16 16, ").concat(r,";")}(t),"\n}\n")})).join("\n"),"\n.group {\n    z-index: -1;\n}\n.area {\n    position: absolute;\n}\n.area-pieces {\n    position: absolute;\n    top: 0;\n    left: 0;\n    display: none;\n}\n.area.avoid, .area.pass {\n    pointer-events: none;\n}\n.area.avoid+.area-pieces {\n    display: block;\n}\n.area-piece {\n    position: absolute;\n}\n\n").concat(In?':global svg *:before {\n\tcontent:"";\n\ttransform-origin: inherit;\n}':"","\n"),An=[[0,1,2],[1,0,3],[2,0,3],[3,1,2]],Ln=1e-7,Yn=1e-9,Xn=Math.pow(10,10),Wn=-Xn,qn=["n","w","s","e","nw","ne","sw","se"],Hn={n:[0,1],s:[2,3],w:[2,0],e:[1,3],nw:[0],ne:[1],sw:[2],se:[3]},Vn={n:0,s:180,w:270,e:90,nw:315,ne:45,sw:225,se:135},$n=["isMoveableElement","updateRect","updateTarget","destroy","dragStart","isInside","hitTest","setState","getRect","request","isDragging","getManager","forceUpdate"];function Kn(t,e,n,r,i){var o=e.gesto.move(n,t.inputEvent),a=o.originalDatas||o.datas,s=a.draggable||(a.draggable={});return Bn(Bn({},i?bo(e,o):o),{isDrag:!0,isPinch:!!r,parentEvent:!0,datas:s,originalDatas:t.originalDatas})}var Un=function(){function t(){this.prevX=0,this.prevY=0,this.startX=0,this.startY=0,this.isDrag=!1,this.isFlag=!1,this.datas={draggable:{}}}var e=t.prototype;return e.dragStart=function(t,e){this.isDrag=!1,this.isFlag=!1;var n=e.originalDatas;return this.datas=n,n.draggable||(n.draggable={}),Bn(Bn({},this.move(t,e.inputEvent)),{type:"dragstart"})},e.drag=function(t,e){return this.move([t[0]-this.prevX,t[1]-this.prevY],e)},e.move=function(t,e){var n,r;return this.isFlag?(n=this.prevX+t[0],r=this.prevY+t[1],this.isDrag=!0):(this.prevX=t[0],this.prevY=t[1],this.startX=t[0],this.startY=t[1],n=t[0],r=t[1],this.isFlag=!0),this.prevX=n,this.prevY=r,{type:"drag",clientX:n,clientY:r,inputEvent:e,isDrag:this.isDrag,distX:n-this.startX,distY:r-this.startY,deltaX:t[0],deltaY:t[1],datas:this.datas.draggable,originalDatas:this.datas,parentEvent:!0,parentGesto:this}},t}();function Jn(t,e,n){var r=n.originalDatas;r.groupable=r.groupable||{};var i=r.groupable;i.childDatas=i.childDatas||[];var o=i.childDatas;return t.moveables.map((function(t,r){return o[r]=o[r]||{},o[r][e]=o[r][e]||{},Bn(Bn({},n),{datas:o[r][e],originalDatas:o[r]})}))}function Zn(t,e,n,r,i,o){var a=!!n.match(/Start$/g),s=!!n.match(/End$/g),c=i.isPinch,l=i.datas,u=Jn(t,e.name,i),f=t.moveables,d=u.map((function(t,i){var u=f[i],d=t;a?d=(new Un).dragStart(r,t):(u.state.gesto||(u.state.gesto=l.childGestos[i]),d=Kn(t,u.state,r,c,o));var p=e[n](u,Bn(Bn({},d),{parentFlag:!0}));return s&&(u.state.gesto=null),p}));return a&&(l.childGestos=f.map((function(t){return t.state.gesto}))),d}function Qn(t,e,n,r,i,o){void 0===i&&(i=function(t,e){return e});var a=!!n.match(/End$/g),s=Jn(t,e.name,r),c=t.moveables;return s.map((function(t,r){var s,l=c[r];s=i(l,t);var u=e[n](l,Bn(Bn({},s),{parentFlag:!0}));return u&&o&&o(l,t,u,r),a&&(l.state.gesto=null),u}))}function tr(t,e,n,r){void 0===r&&(r="");var i=t.state,o=i.renderPoses,a=i.rotation,s=i.direction,c=t.props,l=c.renderDirections,u=void 0===l?e:l,f=c.zoom,d={};if(!u)return[];var p=s>0?1:-1,h=!0===u?qn:u,v=a/Math.PI*180;return h.forEach((function(t){d[t]=!0})),h.map((function(t){var e=Hn[t];if(!e||!d[t])return null;var i=(dt(v,15)+p*Vn[t]+720)%180;return n.createElement("div",{className:Pi("control","direction",t,r),"data-rotation":i,"data-direction":t,key:"direction-".concat(t),style:Qi.apply(void 0,kn([a,f],e.map((function(t){return o[t]})),!1))})}))}function er(t,e,n,r,i,o){for(var a=[],s=6;s<arguments.length;s++)a[s-6]=arguments[s];var c=lt(n,r),l=e?dt(c/Math.PI*180,15)%180:-1;return t.createElement("div",{key:"line".concat(o),className:Pi.apply(void 0,kn(["line","direction",e],a,!1)),"data-rotation":l,"data-line-index":o,"data-direction":e,style:Zi(n,r,i,c)})}function nr(t,e){return tr(t,qn,e)}function rr(t,e){return tr(t,["nw","ne","sw","se"],e)}function ir(t,e,n,r,i,o){var a=t.state.is3d?4:3,s=qi(t.state.rootMatrix,i,a),c=ye([o.left,o.top],s);e.startAbsoluteOrigin=c,e.prevDeg=lt(c,[n,r])/Math.PI*180,e.defaultDeg=e.prevDeg,e.prevSnapDeg=0,e.loop=0}function or(t,e,n){var r=n.defaultDeg,i=n.prevDeg,o=i%360,a=Math.floor(i/360);o<0&&(o+=360),o>t&&o>270&&t<90?++a:o<t&&o<90&&t>270&&--a;var s=e*(360*a+t-r);return n.prevDeg=r+s,s}function ar(t,e,n,r){return or(lt(r.startAbsoluteOrigin,[t,e])/Math.PI*180,n,r)}function sr(t,e,n,r,i,o){var a=t.props.throttleRotate,s=void 0===a?0:a,c=r,l=n.prevSnapDeg;o&&(c=function(t,e,n,r){if(!hr(t,"rotatable"))return r;var i=e.pos1,o=e.pos2,a=e.pos3,s=e.pos4,c=r*Math.PI/180,l=[i,o,a,s].map((function(t){return xe(t,n)})),u=l.map((function(t){return Re(t,c)})),f=kn(kn([],function(t,e,n,r,i){if(!t.props.bounds)return[];var o=i*Math.PI/180,a=Ir(t),s=a.left,c=a.top,l=a.right,u=a.bottom,f=s-r[0],d=l-r[0],p=c-r[1],h=u-r[1],v={left:f,top:p,right:d,bottom:h};if(!Fr(n,v,0))return[];var g=[];return[[f,0],[d,0],[p,1],[h,1]].forEach((function(t){var r=t[0],i=t[1];n.forEach((function(t){var n=lt([0,0],t);g.push.apply(g,function(t,e,n){var r=Ui(t),i=Math.sqrt(r*r-e*e)||0;return[i,-i].sort((function(e,r){return Math.abs(e-t[n?0:1])-Math.abs(r-t[n?0:1])})).map((function(t){return lt([0,0],n?[t,e]:[e,t])}))}(t,r,i).map((function(t){return o+t-n})).filter((function(t){return!Fr(e,v,t)})).map((function(t){return dt(180*t/Math.PI,Ln)})))}))})),g}(t,l,u,n,r),!0),function(t,e,n,r,i){var o=t.props.innerBounds,a=i*Math.PI/180;if(!o)return[];var s=o.left,c=o.top,l=o.width,u=o.height,f=s-r[0],d=s+l-r[0],p=c-r[1],h=c+u-r[1],v=[[f,p],[d,p],[f,h],[d,h]],g=gi(n,[0,0]);if(!jr(n,v,g,0))return[];var m=[],b=v.map((function(t){return[Ui(t),lt([0,0],t)]}));return[[n[0],n[1]],[n[1],n[3]],[n[3],n[2]],[n[2],n[0]]].forEach((function(t){var n=lt([0,0],function(t){var e=t[0],n=t[1],r=n[0]-e[0],i=n[1]-e[1];if(!r)return[e[0],0];if(!i)return[0,e[1]];var o=i/r,a=-o*e[0]+e[1];return[-a/(o+1/o),a/(o*o+1)]}(t)),r=function(t){var e=t[0],n=t[1],r=n[0]-e[0],i=n[1]-e[1];if(!r)return Math.abs(e[0]);if(!i)return Math.abs(e[1]);var o=i/r;return Math.abs((-o*e[0]+e[1])/Math.sqrt(Math.pow(o,2)+1))}(t);m.push.apply(m,b.filter((function(t){var e=t[0];return e&&r<=e})).map((function(t){var e=t[0],i=t[1],o=Math.acos(e?r/e:0);return[a+(i+o)-n,a+(i-o)-n]})).reduce((function(t,e){return t.push.apply(t,e),t}),[]).filter((function(t){return!jr(e,v,g,t)})).map((function(t){return dt(180*t/Math.PI,Ln)})))})),m}(t,l,u,n,r),!0);return f.sort((function(t,e){return Math.abs(t-r)-Math.abs(e-r)})),f.length?f[0]:r}(t,e,n.origin,c));var u=dt(i+c,s),f=u-i;return n.prevSnapDeg=f,[f-l,c,u]}function cr(t,e){if(e.isRequest)return"rotatable"===e.requestAble;var n=e.inputEvent.target;if(ht(n,Pi("rotation-control")))return!0;var r=t.props.rotationTarget;return!!r&&Do(r,!0).some((function(t){return!!t&&(n===t||n.contains(t))}))}var lr={name:"rotatable",canPinch:!0,props:{rotatable:Boolean,rotationPosition:String,throttleRotate:Number,renderDirections:Object,rotationTarget:Object},events:{onRotateStart:"rotateStart",onBeforeRotate:"beforeRotate",onRotate:"rotate",onRotateEnd:"rotateEnd",onRotateGroupStart:"rotateGroupStart",onBeforeRotateGroup:"beforeRotateGroup",onRotateGroup:"rotateGroup",onRotateGroupEnd:"rotateGroupEnd"},css:[".rotation {\n            position: absolute;\n            height: 40px;\n            width: 1px;\n            transform-origin: 50% 100%;\n            height: calc(40px * var(--zoom));\n            top: auto;\n            left: 0;\n            bottom: 100%;\n            will-change: transform;\n        }\n        .rotation .rotation-line {\n            display: block;\n            width: 100%;\n            height: 100%;\n            transform-origin: 50% 50%;\n        }\n        .rotation .rotation-control {\n            border-color: #4af;\n            border-color: var(--moveable-color);\n            background:#fff;\n            cursor: alias;\n        }"],render:function(t,e){var n=t.props,r=n.rotatable,i=n.rotationPosition,o=n.zoom,a=n.renderDirections,s=t.state,c=s.renderPoses,l=s.direction;if(!r)return null;var u=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];if("none"!==t){var s=(t||"top").split("-"),c=s[0],l=s[1],u=[r,i];"left"===c?u=[o,r]:"right"===c?u=[i,a]:"bottom"===c&&(u=[a,o]);var f=[(u[0][0]+u[1][0])/2,(u[0][1]+u[1][1])/2],d=eo(u,n);if(l){var p="top"===l||"left"===l,h="bottom"===c||"left"===c;f=u[p&&!h||!p&&h?0:1]}return[f,d]}}(i,c,l),f=[];if(u){var d=u[0],p=u[1];f.push(e.createElement("div",{key:"rotation",className:Pi("rotation"),style:{transform:"translate(-50%) translate(".concat(d[0],"px, ").concat(d[1],"px) rotate(").concat(p,"rad)")}},e.createElement("div",{className:Pi("line rotation-line"),style:{transform:"scaleX(".concat(o,")")}}),e.createElement("div",{className:Pi("control rotation-control"),style:{transform:"translate(0.5px) scale(".concat(o,")")}})))}return a&&f.push.apply(f,tr(t,[],e)),f},dragControlCondition:cr,dragControlStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY,o=e.parentRotate,a=e.parentFlag,s=e.isPinch,c=e.isRequest,l=t.state,u=l.target,f=l.left,d=l.top,p=l.origin,h=l.beforeOrigin,v=l.direction,g=l.beforeDirection,m=l.targetTransform,b=l.moveableClientRect;if(!c&&!u)return!1;var y=t.getRect();if(n.rect=y,n.transform=m,n.left=f,n.top=d,n.fixedPosition=Mi(t,Di(t)),c||s||a){var x=o||0;n.beforeInfo={origin:y.beforeOrigin,prevDeg:x,defaultDeg:x,prevSnapDeg:0},n.afterInfo=Bn(Bn({},n.beforeInfo),{origin:y.origin}),n.absoluteInfo=Bn(Bn({},n.beforeInfo),{origin:y.origin,startValue:x})}else n.beforeInfo={origin:y.beforeOrigin},n.afterInfo={origin:y.origin},n.absoluteInfo={origin:y.origin,startValue:y.rotation},ir(t,n.beforeInfo,r,i,h,b),ir(t,n.afterInfo,r,i,p,b),ir(t,n.absoluteInfo,r,i,p,b);n.direction=v,n.beforeDirection=g,n.startValue=0,n.datas={},yi(e,"rotate");var E=co(t,e,Bn(Bn({set:function(t){n.startValue=t*Math.PI/180}},bi(e)),{dragStart:ai.dragStart(t,(new Un).dragStart([0,0],e))})),S=fo(t,"onRotateStart",E);return n.isRotate=!1!==S,t.state.snapRenderInfo={request:e.isRequest},!!n.isRotate&&E},dragControl:function(t,e){var n,r,i,o=e.datas,a=e.clientX,s=e.clientY,c=e.parentRotate,l=e.parentFlag,u=e.isPinch,f=e.groupDelta,d=o.beforeDirection,p=o.beforeInfo,h=o.afterInfo,v=o.absoluteInfo,g=o.isRotate,m=o.startValue,b=o.rect;if(g){li(e,"rotate");var y,x,E,S,C,w,D,M,R,O=function(t){return Ki(t.datas.beforeTransform,[50,50],100,100).direction}(e),P=d*O,_=t.props.parentMoveable,B=180/Math.PI*m,k=v.startValue,T=!1;if(!l&&"parentDist"in e){var z=e.parentDist;x=z,C=z,M=z}else u||l?(x=or(c,d,p),C=or(c,P,h),M=or(c,P,v)):(x=ar(a,s,d,p),C=ar(a,s,P,h),M=ar(a,s,P,v),T=!0);if(fo(t,"onBeforeRotate",co(t,e,{beforeRotation:E=B+x,rotation:w=B+C,absoluteRotation:R=k+M,setRotation:function(t){x=C=t-B,M=C}},!0)),y=(n=sr(t,b,p,x,B,T))[0],x=n[1],E=n[2],S=(r=sr(t,b,h,C,B,T))[0],C=r[1],w=r[2],D=(i=sr(t,b,v,M,k,T))[0],M=i[1],R=i[2],D||S||y||_){var j=ui(o,"rotate(".concat(w,"deg)"),"rotate(".concat(C,"deg)")),G=function(t,e,n,r){var i=Di(t);return wi(t,"rotate(".concat(e,"deg)"),i,n,r)}(t,C,o.fixedPosition,o),I=xe(ye(f||[0,0],G),o.prevInverseDist||[0,0]);o.prevInverseDist=G,o.requestValue=null;var N=co(t,e,Bn({delta:S,dist:C,rotate:w,rotation:w,beforeDist:x,beforeDelta:y,beforeRotate:E,beforeRotation:E,absoluteDist:M,absoluteDelta:D,absoluteRotate:R,absoluteRotation:R,isPinch:!!u},Ci(t,j,I,u,e)));return fo(t,"onRotate",N),N}}},dragControlAfter:function(t,e){e.datas.requestValue},dragControlEnd:function(t,e){var n=e.datas;if(n.isRotate){n.isRotate=!1;var r=lo(t,e,{});return fo(t,"onRotateEnd",r),r}},dragGroupControlCondition:cr,dragGroupControlStart:function(t,e){var n=e.datas,r=t.state,i=r.left,o=r.top,a=r.beforeOrigin,s=this.dragControlStart(t,e);if(!s)return!1;s.set(n.beforeDirection*t.rotation);var c=Qn(t,this,"dragControlStart",e,(function(t,e){var n=t.state,r=n.left,s=n.top,c=n.beforeOrigin,l=ye(xe([r,s],[i,o]),xe(c,a));return e.datas.groupClient=l,Bn(Bn({},e),{parentRotate:0})})),l=fo(t,"onRotateGroupStart",Bn(Bn({},s),{targets:t.props.targets,events:c}));return n.isRotate=!1!==l,!!n.isRotate&&s},dragGroupControl:function(t,e){var n=e.datas;if(n.isRotate){uo(t,"onBeforeRotate",(function(n){fo(t,"onBeforeRotateGroup",co(t,e,Bn(Bn({},n),{targets:t.props.targets}),!0))}));var r=this.dragControl(t,e);if(r){var i=n.beforeDirection,o=r.beforeDist,a=r.beforeDelta/180*Math.PI,s=Qn(t,this,"dragControl",e,(function(t,e){var n=e.datas.groupClient,r=n[0],s=n[1],c=Re([r,s],a*i),l=c[0],u=c[1],f=[l-r,u-s];return e.datas.groupClient=[l,u],Bn(Bn({},e),{parentRotate:o,groupDelta:f})}));t.rotation=i*r.beforeRotation;var c=Bn({targets:t.props.targets,events:s,set:function(e){t.rotation=e},setGroupRotation:function(e){t.rotation=e}},r);return fo(t,"onRotateGroup",c),c}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isRotate){this.dragControlEnd(t,e);var r=Qn(t,this,"dragControlEnd",e);return fo(t,"onRotateGroupEnd",lo(t,e,{targets:t.props.targets,events:r})),n}},request:function(t){var e={},n=0,r=t.getRotation();return{isControl:!0,requestStart:function(){return{datas:e}},request:function(t){return"deltaRotate"in t?n+=t.deltaRotate:"rotate"in t&&(n=t.rotate-r),{datas:e,parentDist:n}},requestEnd:function(){return{datas:e,isDrag:!0}}}}},ur=["left","right","center"],fr=["top","bottom","middle"],dr={start:"left",end:"right",center:"center"},pr={start:"top",end:"bottom",center:"middle"};function hr(t,e){var n=t.props,r=n.snappable,i=n.bounds,o=n.innerBounds,a=n.verticalGuidelines,s=n.horizontalGuidelines,c=n.snapGridWidth,l=n.snapGridHeight,u=t.state,f=u.guidelines,d=u.enableSnap;return!(!r||!d||e&&!0!==r&&r.indexOf(e)<0)&&!!(c||l||i||o||f&&f.length||a&&a.length||s&&s.length)}function vr(t){return!1===t?{}:!0!==t&&t?t:{left:!0,right:!0,top:!0,bottom:!0}}function gr(t,e){var n=function(t,e){var n=vr(t),r={};for(var i in n)i in e&&n[i]&&(r[i]=e[i]);return r}(t,e),r=fr.filter((function(t){return t in n})),i=ur.filter((function(t){return t in n}));return{horizontal:r.map((function(t){return n[t]})),vertical:i.map((function(t){return n[t]}))}}function mr(t,e,n,r,i,o,a){void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a={left:0,top:0,right:0,bottom:0});var s=[],c=a.left,l=a.top,u=a.bottom,f=n+a.right-c,d=r+u-l;return t&&t.forEach((function(t){s.push({type:"horizontal",pos:[c,dt(t-o+l,.1)],size:f})})),e&&e.forEach((function(t){s.push({type:"vertical",pos:[dt(t-i+c,.1),l],size:d})})),s}function br(t,e){if(!e.length)return[];var n=t.state,r=n.containerClientRect,i=n.targetClientRect,o=i.top,a=i.left,s=n.rootMatrix,c=n.is3d?4:3,l=function(t,e,n){var r=qi(t,[e.clientLeft,e.clientTop],n);return[e.left+r[0],e.top+r[1]]}(s,r,c),u=l[0],f=l[1],d=He(ao(n)),p=xe([d.minX,d.minY],mo(s,[a-u,o-f],c)).map((function(t){return e=t,Math.round(e%1==-.5?e-1:e);var e})),h=p[0],v=p[1];return e.map((function(t){var e=t.element.getBoundingClientRect(),n=e.left-u,r=e.top-f,i=r+e.height,o=n+e.width,a=mo(s,[n,r],c),l=a[0],d=a[1],p=mo(s,[o,i],c),g=p[0],m=p[1];return Bn(Bn({},t),{rect:{left:l+h,right:g+h,top:d+v,bottom:m+v,center:(l+g)/2+h,middle:(d+m)/2+v}})}))}function yr(t){var e=t.state,n=e.snapOffset,r=e.containerClientRect,i=r.overflow,o=r.scrollHeight,a=r.scrollWidth,s=r.clientHeight,c=r.clientWidth,l=r.clientLeft,u=r.clientTop,f=t.props,d=f.snapGap,p=void 0===d||d,h=f.verticalGuidelines,v=f.horizontalGuidelines,g=f.snapThreshold,m=void 0===g?5:g,b=f.snapGridWidth,y=void 0===b?0:b,x=f.snapGridHeight,E=void 0===x?0:x,S=function(t){var e=t.state,n=t.props.elementGuidelines,r=void 0===n?[]:n;if(!r.length)return e.elementRects=[],[];var i=(e.elementRects||[]).filter((function(t){return!t.refresh})),o=r.map((function(t){return F(t)&&"element"in t?t:{element:wo(t,!0)}})).filter((function(t){return t.element})),a=Ye(i.map((function(t){return t.element})),o.map((function(t){return t.element}))),s=a.maintained,c=a.added,l=[];s.forEach((function(t){var e=t[0],n=t[1];l[n]=i[e]})),br(t,c.map((function(t){return o[t]}))).map((function(t,e){l[c[e]]=t})),e.elementRects=l;var u=vr(t.props.elementSnapDirections),f=[];return l.forEach((function(t){var e=t.element,n=t.top,r=void 0===n?u.top:n,i=t.left,o=void 0===i?u.left:i,a=t.right,s=void 0===a?u.right:a,c=t.bottom,l=void 0===c?u.bottom:c,d=t.center,p=void 0===d?u.center:d,h=t.middle,v=void 0===h?u.middle:h,g=t.className,m=t.rect,b=gr({top:r,right:s,left:o,bottom:l,center:p,middle:v},m),y=b.horizontal,x=b.vertical,E=m.top,S=m.left,C=m.right-S,w=m.bottom-E,D=[C,w];x.forEach((function(n){f.push({type:"vertical",element:e,pos:[dt(n,.1),E],size:w,sizes:D,className:g,elementRect:t})})),y.forEach((function(n){f.push({type:"horizontal",element:e,pos:[S,dt(n,.1)],size:C,sizes:D,className:g,elementRect:t})}))})),f}(t),C=kn([],S,!0);if(p){var w=Vi(ao(t.state)),D=w.top,M=w.left,R=w.bottom,O=w.right;C.push.apply(C,function(t,e,n){var r=t.state.elementRects,i=[];return[["vertical",dr,pr],["horizontal",pr,dr]].forEach((function(t){var o=t[0],a=t[1],s=t[2],c=e[a.start],l=e[a.end],u=e[a.center],f=e[s.start],d=e[s.end];function p(t){var e=t.rect;return e[a.end]<c+n?c-e[a.end]:l-n<e[a.start]?e[a.start]-l:-1}var h=r.filter((function(t){var e=t.rect;return!(e[s.start]>d||e[s.end]<f)&&p(t)>0})).sort((function(t,e){return p(t)-p(e)})),v=[];h.forEach((function(t){h.forEach((function(e){if(t!==e){var n=t.rect,r=e.rect,i=n[s.start],o=n[s.end],a=r[s.start];i>r[s.end]||a>o||v.push([t,e])}}))})),v.forEach((function(t){var e=t[0],r=t[1],s=e.rect,f=r.rect,d=s[a.start],p=s[a.end],h=f[a.start],v=f[a.end],g=0,m=0,b=!1,y=!1,x=!1;if(p<=c&&l<=h){if(y=!0,m=p+(g=(h-p-(l-c))/2)+(l-c)/2,Math.abs(m-u)>n)return}else if(p<h&&v<c+n){if(b=!0,m=v+(g=h-p),Math.abs(m-c)>n)return}else{if(!(p<h&&l-n<d))return;if(x=!0,m=d-(g=h-p),Math.abs(m-l)>n)return}g&&i.push({type:o,pos:"vertical"===o?[m,0]:[0,m],element:r.element,size:0,className:r.className,isStart:b,isCenter:y,isEnd:x,gap:g,hide:!0,gapRects:[e,r]})}))})),i}(t,{top:D,left:M,bottom:R,right:O,center:(M+O)/2,middle:(D+R)/2},m))}return C.push.apply(C,function(t,e,n,r,i,o){void 0===i&&(i=0);void 0===o&&(o=0);var a=[];if(e)for(var s=0;s<=r;s+=e)a.push({type:"horizontal",pos:[0,dt(s-o,.1)],size:n,hide:!0});if(t)for(s=0;s<=n;s+=t)a.push({type:"vertical",pos:[dt(s-i,.1),0],size:r,hide:!0});return a}(y,E,i?a:c,i?o:s,l,u)),C.push.apply(C,mr(v||!1,h||!1,i?a:c,i?o:s,l,u,n)),C}function xr(t,e,n,r){var i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t.length-1,r=0;r<n;++r){var i=t[r];if(!N(i))return i}return t[n]}(r,t.props.snapThreshold,5);return Er(t.state.guidelines,e,n,i)}function Er(t,e,n,r){return{vertical:wr(t,"vertical",e,r),horizontal:wr(t,"horizontal",n,r)}}function Sr(t,e,n){var r=gr(t.props.snapDirections,e);return xr(t,r.vertical,r.horizontal,n)}function Cr(t){var e=t.isSnap;if(!e)return{isSnap:!1,offset:0,dist:-1,pos:0,guideline:null};var n=t.posInfos[0],r=n.guidelineInfos[0],i=r.offset,o=r.dist,a=r.guideline;return{isSnap:e,offset:i,dist:o,pos:n.pos,guideline:a}}function wr(t,e,n,r){if(!t||!t.length)return{isSnap:!1,index:-1,posInfos:[]};var i="vertical"===e?0:1,o=n.map((function(n,o){var a=t.map((function(t){var e=t.pos,r=n-e[i];return{offset:r,dist:Math.abs(r),guideline:t}})).filter((function(t){var n=t.guideline,i=t.dist;return!(n.type!==e||i>r)})).sort((function(t,e){return t.dist-e.dist}));return{pos:n,index:o,guidelineInfos:a}})).filter((function(t){return t.guidelineInfos.length>0})).sort((function(t,e){return t.guidelineInfos[0].dist-e.guidelineInfos[0].dist})),a=o.length>0;return{isSnap:a,index:a?o[0].index:-1,posInfos:o}}function Dr(t,e){var n=Math.abs(t.offset),r=Math.abs(e.offset);return t.isBound&&e.isBound?r-n:t.isBound?-1:e.isBound?1:t.isSnap&&e.isSnap?r-n:t.isSnap?-1:e.isSnap||n<Ln?1:r<Ln?-1:n-r}function Mr(t,e){return t.slice().sort((function(t,n){var r=t.sign[e],i=n.sign[e],o=t.offset[e],a=n.offset[e];return r?i?Dr({isBound:t.isBound,isSnap:t.isSnap,offset:o},{isBound:n.isBound,isSnap:n.isSnap,offset:a}):-1:1}))[0]}function Rr(t,e){var n=ct([e[0][0],e[1][0]]),r=ct([e[0][1],e[1][1]]);return{vertical:n<=t[0],horizontal:r<=t[1]}}function Or(t,e){var n,r,i=e[0],o=e[1],a=o[0]-i[0],s=o[1]-i[1];if(Math.abs(a)<Ln&&(a=0),Math.abs(s)<Ln&&(s=0),a)if(s){n=s/a*(t[0]-i[0])+i[1],r=t[1]}else n=i[1],r=t[1];else n=i[0],r=t[0];return n-r}function Pr(t,e,n){void 0===n&&(n=Ln);var r=Or(t[0],e)<=0;return t.slice(1).every((function(t){var i=Or(t,e);return i<=0===r||Math.abs(i)<=n}))}function _r(t,e,n,r,i){return void 0===i&&(i=0),r&&e-i<=t||!r&&t<=n+i?{isBound:!0,offset:r?e-t:n-t}:{isBound:!1,offset:0}}function Br(t,e,n,r,i){var o=t[0],a=t[1],s=e[0],c=e[1],l=Eo(a[1]-o[1]),u=Eo(a[0]-o[0]),f=Eo(c[1]-s[1]);if(!Eo(c[0]-s[0])){if(i&&!l)return{isBound:!1,offset:0};if(u)return _r(l/u*(s[0]-o[0])+o[1],s[1],c[1],n,r);var d=s[0]-o[0];return{isBound:p=Math.abs(d)<=(r||0),offset:p?d:0}}if(!f){if(i&&!u)return{isBound:!1,offset:0};if(l)return _r((s[1]-o[1])/(l/u)+o[0],s[0],c[0],n,r);var p;d=s[1]-o[1];return{isBound:p=Math.abs(d)<=(r||0),offset:p?d:0}}return{isBound:!1,offset:0}}function kr(t,e,n,r){return e.map((function(e){var i=e[0],o=e[1],a=e[2],s=function(t,e,n){var r=t.props.innerBounds;if(!r)return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var i=r.left,o=r.top,a=r.width,s=r.height,c=[[i,o],[i,o+s]],l=[[i,o],[i+a,o]],u=[[i+a,o],[i+a,o+s]],f=[[i,o+s],[i+a,o+s]],d=Rr(n,e),p=d.horizontal,h=d.vertical;if(Pr([n,[i,o],[i+a,o],[i,o+s],[i+a,o+s]],e))return{isAllBound:!1,isBound:!1,isVerticalBound:!1,isHorizontalBound:!1,offset:[0,0]};var v=Br(e,l,h),g=Br(e,f,h),m=Br(e,c,p),b=Br(e,u,p),y=v.isBound&&g.isBound,x=v.isBound||g.isBound,E=m.isBound&&b.isBound,S=m.isBound||b.isBound,C=go(v.offset,g.offset),w=go(m.offset,b.offset),D=[0,0],M=!1,R=!1;return Math.abs(w)<Math.abs(C)?(D=[C,0],M=x,R=y):(D=[0,w],M=S,R=E),{isAllBound:R,isVerticalBound:x,isHorizontalBound:S,isBound:M,offset:D}}(t,[o,a],n),c=s.isBound,l=s.offset,u=s.isVerticalBound,f=s.isHorizontalBound,d=pi({datas:r,distX:l[0],distY:l[1]}).map((function(t,e){return t*(i[e]?2/i[e]:0)}));return{sign:i,isBound:c,isVerticalBound:u,isHorizontalBound:f,isSnap:!1,offset:d}}))}function Tr(t,e,n){var r,i=zr(e,[0,0],!1).map((function(t){var e=t[0],n=t[1],r=t[2];return[e.map((function(t){return 2*Math.abs(t)})),n,r]})),o=kr(t,i,gi(e,[0,0]),n),a=Mr(o,0),s=Mr(o,1),c=0,l=0,u=a.isVerticalBound||s.isVerticalBound,f=a.isHorizontalBound||s.isHorizontalBound;return(u||f)&&(r=function(t,e){var n=t.datas,r=t.distX,i=t.distY,o=n.beforeMatrix,a=n.matrix,s=n.is3d,c=n.startDragBeforeDist,l=n.startDragDist,u=n.absoluteOrigin,f=s?4:3;return xe(Se(e?o:a,ye(e?c:l,[r,i]),f),u)}({datas:n,distX:-a.offset[0],distY:-s.offset[1]}),c=r[0],l=r[1]),{vertical:{isBound:u,offset:c},horizontal:{isBound:f,offset:l}}}function zr(t,e,n){return function(t,e){var n=[],r=t[0],i=t[1];return r&&i?n.push([[0,2*i],t,[-r,i]],[[2*r,0],t,[r,-i]]):r?(n.push([[2*r,0],[r,1],[r,-1]]),e&&n.push([[0,-1],[r,-1],[-r,-1]],[[0,1],[r,1],[-r,1]])):i?(n.push([[0,2*i],[1,i],[-1,i]]),e&&n.push([[-1,0],[-1,i],[-1,-i]],[[1,0],[1,i],[1,-i]])):n.push([[-1,0],[-1,-1],[-1,1]],[[1,0],[1,-1],[1,1]],[[0,-1],[-1,-1],[1,-1]],[[0,1],[-1,1],[1,1]]),n}(e,n).map((function(e){var n=e[0],r=e[1],i=e[2];return[n,gi(t,r),gi(t,i)]}))}function jr(t,e,n,r){var i=r?t.map((function(t){return Re(t,r)})):t,o=kn([n],e,!0);return[[i[0],i[1]],[i[1],i[3]],[i[3],i[2]],[i[2],i[0]]].some((function(t){return!Pr(o,t)}))}function Gr(t,e,n){var r=t||{},i=r.position,o=void 0===i?"client":i,a=r.left,s=void 0===a?-1/0:a,c=r.top,l=void 0===c?-1/0:c,u=r.right,f=void 0===u?1/0:u,d=r.bottom,p={position:o,left:s,top:l,right:f,bottom:void 0===d?1/0:d};return{vertical:Nr(p,e,!0),horizontal:Nr(p,n,!1)}}function Ir(t,e){var n=t.state,r=n.containerClientRect,i=r.clientHeight,o=r.clientWidth,a=r.clientLeft,s=r.clientTop,c=n.snapOffset,l=c.left,u=c.top,f=c.right,d=c.bottom,p=e||t.props.bounds||{},h="css"===(p.position||"client"),v=p.left,g=void 0===v?-1/0:v,m=p.top,b=void 0===m?-1/0:m,y=p.right,x=void 0===y?h?-1/0:1/0:y,E=p.bottom,S=void 0===E?h?-1/0:1/0:E;return h&&(x=o+f-l-x,S=i+d-u-S),{left:g+l-a,right:x+l-a,top:b+u-s,bottom:S+u-s}}function Nr(t,e,n){var r=t[n?"left":"top"],i=t[n?"right":"bottom"],o=Math.min.apply(Math,e),a=Math.max.apply(Math,e),s=[];return r+1>o&&s.push({isBound:!0,offset:o-r,pos:r}),i-1<a&&s.push({isBound:!0,offset:a-i,pos:i}),s.length||s.push({isBound:!1,offset:0,pos:0}),s.sort((function(t,e){return Math.abs(e.offset)-Math.abs(t.offset)}))}function Fr(t,e,n){return(n?t.map((function(t){return Re(t,n)})):t).some((function(t){return t[0]<e.left&&Math.abs(t[0]-e.left)>.1||t[0]>e.right&&Math.abs(t[0]-e.right)>.1||t[1]<e.top&&Math.abs(t[1]-e.top)>.1||t[1]>e.bottom&&Math.abs(t[1]-e.bottom)>.1}))}function Ar(t,e){return function(t,e){var n,r=t.direction,i=t.classNames,o=t.size,a=t.pos,s=t.zoom,c=t.key,l="horizontal"===r,u=l?"Y":"X";return e.createElement("div",{key:c,className:i.join(" "),style:(n={},n[l?"width":"height"]="".concat(o),n.transform="translate(".concat(a[0],", ").concat(a[1],") translate").concat(u,"(-50%) scale").concat(u,"(").concat(s,")"),n)})}(Bn(Bn({},t),{classNames:kn([Pi("line","guideline",t.direction)],t.classNames,!0).filter((function(t){return t})),size:t.size||"".concat(t.sizeValue,"px"),pos:t.pos||t.posValue.map((function(t){return"".concat(dt(t,.1),"px")}))}),e)}function Lr(t,e,n,r,i,o,a,s){var c=t.props.zoom;return n.map((function(t,n){var l=t.type,u=t.pos,f=[0,0];return f[a]=r,f[a?0:1]=-i+u,Ar({key:"".concat(e,"TargetGuideline").concat(n),classNames:[Pi("target","bold",l)],posValue:f,sizeValue:o,zoom:c,direction:e},s)}))}function Yr(t,e,n,r,i,o){var a=t.props,s=a.zoom,c=a.isDisplayInnerSnapDigit,l="horizontal"===e?dr:pr,u=i[l.start],f=i[l.end];return n.filter((function(t){var e=t.hide,n=t.elementRect;if(e)return!1;if(c&&n){var r=n.rect;if(r[l.start]<=u&&f<=r[l.end])return!1}return!0})).map((function(t,n){var i=t.pos,a=t.size,c=t.element,l=[-r[0]+i[0],-r[1]+i[1]];return Ar({key:"".concat(e,"-default-guideline-").concat(n),classNames:c?[Pi("bold")]:[],direction:e,posValue:l,sizeValue:a,zoom:s},o)}))}function Xr(t,e,n,r,i,o,a,s){var c,l=t.props,u=l.snapDigit,f=void 0===u?0:u,d=l.isDisplaySnapDigit,p=void 0===d||d,h=l.snapDistFormat,v=void 0===h?function(t){return t}:h,g=l.zoom,m="horizontal"===e?"X":"Y",b="vertical"===e?"height":"width",y=Math.abs(i),x=p?parseFloat(y.toFixed(f)):0;return s.createElement("div",{key:"".concat(e,"-").concat(n,"-guideline-").concat(r),className:Pi("guideline-group",e),style:(c={left:"".concat(o[0],"px"),top:"".concat(o[1],"px")},c[b]="".concat(y,"px"),c)},Ar({direction:e,classNames:[Pi(n),a],size:"100%",posValue:[0,0],sizeValue:y,zoom:g},s),s.createElement("div",{className:Pi("size-value","gap"),style:{transform:"translate".concat(m,"(-50%) scale(").concat(g,")")}},x>0?v(x):""))}function Wr(t,e,n,r,i){var o=t.props.isDisplayInnerSnapDigit,a=[];return["vertical","horizontal"].forEach((function(s){var c=e.filter((function(t){return t.type===s})),l="vertical"===s?1:0,u=l?0:1,f=function(t,e,n,r){var i,o,a,s,c="vertical"===t?0:1,l="vertical"===t?1:0,u=c?dr:pr,f=n[u.start],d=n[u.end];return(i=e,o=function(t){return t.pos[c]},a=[],s=[],i.forEach((function(t,e){var n=o(t,e,i),r=s.indexOf(n),c=a[r]||[];-1===r&&(s.push(n),a.push(c)),c.push(t)})),a).map((function(e){var n=[],i=[];return e.forEach((function(e){var o,a,s=e.element,p=e.elementRect.rect;if(p[u.end]<f)n.push(e);else if(d<p[u.start])i.push(e);else if(p[u.start]<=f&&d<=p[u.end]&&r){var h=e.pos,v={element:s,rect:Bn(Bn({},p),(o={},o[u.end]=p[u.start],o))},g={element:s,rect:Bn(Bn({},p),(a={},a[u.start]=p[u.end],a))},m=[0,0],b=[0,0];m[c]=h[c],m[l]=h[l],b[c]=h[c],b[l]=h[l]+e.size,n.push({type:t,pos:m,size:0,elementRect:v}),i.push({type:t,pos:b,size:0,elementRect:g})}})),n.sort((function(t,e){return e.pos[l]-t.pos[l]})),i.sort((function(t,e){return t.pos[l]-e.pos[l]})),{total:e,start:n,end:i,inner:[]}}))}(s,c,r,o),d=l?pr:dr,p=l?dr:pr,h=r[d.start],v=r[d.end];f.forEach((function(e){var o=e.total,c=e.start,f=e.end,g=e.inner,m=n[u]+o[0].pos[u]-r[p.start],b=r;c.forEach((function(e){var r=e.elementRect.rect,o=b[d.start]-r[d.end];if(o>0){var c=[0,0];c[l]=n[l]+b[d.start]-h-o,c[u]=m,a.push(Xr(t,s,"dashed",a.length,o,c,e.className,i))}b=r})),b=r,f.forEach((function(e){var r=e.elementRect.rect,o=r[d.start]-b[d.end];if(o>0){var c=[0,0];c[l]=n[l]+b[d.end]-h,c[u]=m,a.push(Xr(t,s,"dashed",a.length,o,c,e.className,i))}b=r})),g.forEach((function(e){var r=e.elementRect.rect,o=h-r[d.start],c=r[d.end]-v,f=[0,0],p=[0,0];f[l]=n[l]-o,f[u]=m,p[l]=n[l]+v-h,p[u]=m,a.push(Xr(t,s,"dashed",a.length,o,f,e.className,i)),a.push(Xr(t,s,"dashed",a.length,c,p,e.className,i))}))}))})),a}function qr(t,e,n,r,i){var o=function(t,e,n,r){var i=e[0]-t[0],o=e[1]-t[1];if(Math.abs(i)<G&&(i=0),Math.abs(o)<G&&(o=0),!i)return r?[0,0]:[0,n];if(!o)return r?[n,0]:[0,0];var a=o/i,s=t[1]-a*t[0];return r?[n,a*(e[0]+n)+s-e[1]]:[(e[1]+n-s)/a-e[0],n]}(t,e,n,r);if(!o)return{isOutside:!1,offset:[0,0]};var a=ft(t,e),s=ft(o,t),c=ft(o,e),l=s>a||c>a,u=pi({datas:i,distX:o[0],distY:o[1]});return{offset:[u[0],u[1]],isOutside:l}}function Hr(t,e){return t.isBound?t.offset:e.isSnap?Cr(e).offset:0}function Vr(t,e,n,r,i,o){if(!hr(t,"draggable"))return[{isSnap:!1,isBound:!1,offset:0},{isSnap:!1,isBound:!1,offset:0}];var a=oo(o.absolutePoses,[e,n]),s=Vi(a),c=s.left,l=s.right,u=s.top,f=s.bottom,d={horizontal:a.map((function(t){return t[1]})),vertical:a.map((function(t){return t[0]}))},p=$r(t,i,gr(vr(t.props.snapDirections),{left:c,right:l,top:u,bottom:f,center:(c+l)/2,middle:(u+f)/2}),d),h=p.vertical,v=p.horizontal,g=Tr(t,a,o),m=g.vertical,b=g.horizontal,y=h.isSnap,x=v.isSnap,E=h.isBound||m.isBound,S=v.isBound||b.isBound,C=function(t,e,n,r,i){var o=e[0],a=e[1],s=n[0],c=n[1],l=r[0],u=r[1],f=i[0],d=i[1],p=-f,h=-d;if(t&&o&&a){p=0,h=0;var v=[];if(s&&c?v.push([0,d],[f,0]):s?v.push([f,0]):c?v.push([0,d]):l&&u?v.push([0,d],[f,0]):l?v.push([f,0]):u&&v.push([0,d]),v.length){v.sort((function(t,e){return Ui(xe([o,a],t))-Ui(xe([o,a],e))}));var g=v[0];if(g[0]&&Math.abs(o)>G)p=-g[0],h=a*Math.abs(o+p)/Math.abs(o)-a;else if(g[1]&&Math.abs(a)>G){var m=a;h=-g[1],p=o*Math.abs(a+h)/Math.abs(m)-o}if(t&&c&&s)if(Math.abs(p)>G&&Math.abs(p)<Math.abs(f))p*=b=Math.abs(f)/Math.abs(p),h*=b;else if(Math.abs(h)>G&&Math.abs(h)<Math.abs(d)){var b;p*=b=Math.abs(d)/Math.abs(h),h*=b}else p=go(-f,p),h=go(-d,h)}}else p=o||s?-f:0,h=a||c?-d:0;return[p,h]}(r,[e,n],[E,S],[y,x],[go(h.offset,m.offset),go(v.offset,b.offset)]);return[{isBound:E,isSnap:y,offset:C[0]},{isBound:S,isSnap:x,offset:C[1]}]}function $r(t,e,n,r){void 0===r&&(r=n);var i=Gr(Ir(t),r.vertical,r.horizontal),o=i.horizontal,a=i.vertical,s=e?{horizontal:{isSnap:!1,index:-1},vertical:{isSnap:!1,index:-1}}:xr(t,n.vertical,n.horizontal),c=s.horizontal,l=s.vertical,u=Hr(o[0],c),f=Hr(a[0],l),d=Math.abs(u),p=Math.abs(f);return{horizontal:{isBound:o[0].isBound,isSnap:c.isSnap,snapIndex:c.index,offset:u,dist:d,bounds:o,snap:c},vertical:{isBound:a[0].isBound,isSnap:l.isSnap,snapIndex:l.index,offset:f,dist:p,bounds:a,snap:l}}}function Kr(t,e,n,r,i){var o=Gr(e,n,r),a=o.horizontal,s=o.vertical,c=Er(t,n,r,i),l=c.horizontal,u=c.vertical,f=Hr(a[0],l),d=Hr(s[0],u),p=Math.abs(f),h=Math.abs(d);return{horizontal:{isBound:a[0].isBound,isSnap:l.isSnap,snapIndex:l.index,offset:f,dist:p,bounds:a,snap:l},vertical:{isBound:s[0].isBound,isSnap:u.isSnap,snapIndex:u.index,offset:d,dist:h,bounds:s,snap:u}}}function Ur(t,e,n,r,i,o){return n.map((function(n){var a=n[0],s=n[1],c=gi(e,a),l=gi(e,s),u=r?function(t,e,n,r){var i=function(t,e,n){var r=Ir(t),i=r.left,o=r.top,a=r.right,s=r.bottom,c=n[0],l=n[1],u=xe(n,e),f=u[0],d=u[1];Math.abs(f)<Ln&&(f=0),Math.abs(d)<Ln&&(d=0);var p=d>0,h=f>0,v={isBound:!1,offset:0,pos:0},g={isBound:!1,offset:0,pos:0};if(0===f&&0===d)return{vertical:v,horizontal:g};if(0===f)p?s<l&&(g.pos=s,g.offset=l-s):o>l&&(g.pos=o,g.offset=l-o);else if(0===d)h?a<c&&(v.pos=a,v.offset=c-a):i>c&&(v.pos=i,v.offset=c-i);else{var m=d/f,b=n[1]-m*c,y=0,x=0,E=!1;h&&a<=c?(y=m*a+b,x=a,E=!0):!h&&c<=i&&(y=m*i+b,x=i,E=!0),E&&(y<o||y>s)&&(E=!1),E||(p&&s<=l?(x=((y=s)-b)/m,E=!0):!p&&l<=o&&(x=((y=o)-b)/m,E=!0)),E&&(v.isBound=!0,v.pos=x,v.offset=c-x,g.isBound=!0,g.pos=y,g.offset=l-y)}return{vertical:v,horizontal:g}}(t,e,n),o=i.horizontal,a=i.vertical,s=r?{horizontal:{isSnap:!1},vertical:{isSnap:!1}}:function(t,e,n){var r=n[0],i=n[1],o=e[0],a=e[1],s=xe(n,e),c=s[0],l=s[1],u=l>0,f=c>0;c=Eo(c),l=Eo(l);var d={isSnap:!1,offset:0,pos:0},p={isSnap:!1,offset:0,pos:0};if(0===c&&0===l)return{vertical:d,horizontal:p};var h=xr(t,c?[r]:[],l?[i]:[]),v=h.vertical,g=h.horizontal;v.posInfos.filter((function(t){var e=t.pos;return f?e>=o:e<=o})),g.posInfos.filter((function(t){var e=t.pos;return u?e>=a:e<=a})),v.isSnap=v.posInfos.length>0,g.isSnap=g.posInfos.length>0;var m=Cr(v),b=m.isSnap,y=m.guideline,x=Cr(g),E=x.isSnap,S=x.guideline,C=E?S.pos[1]:0,w=b?y.pos[0]:0;if(0===c)E&&(p.isSnap=!0,p.pos=S.pos[1],p.offset=i-p.pos);else if(0===l)b&&(d.isSnap=!0,d.pos=w,d.offset=r-w);else{var D=l/c,M=n[1]-D*r,R=0,O=0,P=!1;b?(R=D*(O=w)+M,P=!0):E&&(O=((R=C)-M)/D,P=!0),P&&(d.isSnap=!0,d.pos=O,d.offset=r-O,p.isSnap=!0,p.pos=R,p.offset=i-R)}return{vertical:d,horizontal:p}}(t,e,n),c=s.horizontal,l=s.vertical,u=Jr(o,c),f=Jr(a,l),d=Math.abs(u),p=Math.abs(f);return{horizontal:{isBound:o.isBound,isSnap:c.isSnap,offset:u,dist:d},vertical:{isBound:a.isBound,isSnap:l.isSnap,offset:f,dist:p}}}(t,c,l,i):$r(t,i,{vertical:[l[0]],horizontal:[l[1]]}),f=u.horizontal,d=f.offset,p=f.isBound,h=f.isSnap,v=u.vertical,g=v.offset,m=v.isBound,b=v.isSnap,y=xe(s,a);if(!g&&!d)return{isBound:m||p,isSnap:b||h,sign:y,offset:[0,0]};var x=function(t,e,n,r){var i=lt(t,e)/Math.PI*180,o=n.vertical,a=o.isBound,s=o.isSnap,c=o.dist,l=n.horizontal,u=l.isBound,f=l.isSnap,d=i%180,p=d<3||d>177,h=d>87&&d<93;return l.dist<c&&(a||s&&!h&&(!r||!p))?"vertical":!u&&(!f||p||r&&h)?"":"horizontal"}(c,l,u,r);if(!x)return{sign:y,isBound:!1,isSnap:!1,offset:[0,0]};var E="vertical"===x,S=qr(c,l,-(E?g:d),E,o).offset.map((function(t,e){return t*(y[e]?2/y[e]:0)}));return{sign:y,isBound:E?m:p,isSnap:E?b:h,offset:S}}))}function Jr(t,e){return t.isBound?t.offset:e.isSnap?e.offset:0}function Zr(t){var e=t.state;if(!e.guidelines||!e.guidelines.length){var n=t.state.container,r=t.props.snapContainer||n,i=e.containerClientRect,o={left:0,top:0,bottom:0,right:0};if(n!==r){var a=wo(r,!0);if(a){var s=ro(a),c=Mo(e,[s.left-i.left,s.top-i.top]),l=Mo(e,[s.right-i.right,s.bottom-i.bottom]);o.left=dt(c[0],.1),o.top=dt(c[1],.1),o.right=dt(l[0],.1),o.bottom=dt(l[1],.1)}}e.snapOffset=o,e.guidelines=yr(t),e.enableSnap=!0}}function Qr(t,e,n,r,i,o){var a=Hi(t,e,n,o?4:3);return oo(a,xe(i,gi(a,r)))}function ti(t,e,n,r,i,o){var a=function(t,e,n){var r=[];n?(1!==Math.abs(e[0])||1!==Math.abs(e[1])?r.push([e,[-1,-1]],[e,[-1,1]],[e,[1,-1]],[e,[1,1]]):r.push([e,[t[0],-t[1]]],[e,[-t[0],t[1]]],[e,t]),r.push([e,t])):t[0]&&t[1]?r.push([e,[t[0],-t[1]]],[e,[-t[0],t[1]]]):t[0]?(1===Math.abs(e[0])?[1]:[1,-1]).forEach((function(n){r.push([[e[0],-1],[n*t[0],-1]],[[e[0],0],[n*t[0],0]],[[e[0],1],[n*t[0],1]])})):t[1]?(1===Math.abs(e[1])?[1]:[1,-1]).forEach((function(n){r.push([[-1,e[1]],[-1,n*t[1]]],[[0,e[1]],[0,n*t[1]]],[[1,e[1]],[1,n*t[1]]])})):r.push([e,[1,0]],[e,[-1,0]],[e,[0,-1]],[e,[0,1]],[[1,0],[1,-1]],[[1,0],[1,1]],[[0,1],[1,1]],[[0,1],[-1,1]],[[-1,0],[-1,-1]],[[-1,0],[-1,1]],[[0,-1],[1,-1]],[[0,-1],[-1,-1]]);return r}(n,o.fixedDirection,r),s=zr(e,n,r),c=kn(kn([],Ur(t,e,a,r,i,o),!0),kr(t,s,gi(e,[0,0]),o),!0),l=Mr(c,0),u=Mr(c,1);return{width:{isBound:l.isBound,offset:l.offset[0]},height:{isBound:u.isBound,offset:u.offset[1]}}}function ei(t,e,n,r,i,o,a,s){for(var c=ao(t.state),l=t.props.keepRatio,u=0,f=0,d=0;d<2;++d){var p=ti(t,e(u,f),i,l,a,s),h=p.width,v=p.height,g=h.isBound,m=v.isBound,b=h.offset,y=v.offset;if(1===d&&(g||(b=0),m||(y=0)),0===d&&a&&!g&&!m)return[0,0];if(l){var x=Math.abs(b)*(n?1/n:1),E=Math.abs(y)*(r?1/r:1);(g&&m?x<E:m||!g&&x<E)?b=n*y/r:y=r*b/n}u+=b,f+=y}if(i[0]&&i[1]){var S=function(t,e,n,r,i){var o=[-n[0],-n[1]],a=t.state,s=a.width,c=a.height,l=t.props.bounds,u=1/0,f=1/0;if(l){var d=[[n[0],-n[1]],[-n[0],n[1]]],p=l.left,h=void 0===p?-1/0:p,v=l.top,g=void 0===v?-1/0:v,m=l.right,b=void 0===m?1/0:m,y=l.bottom,x=void 0===y?1/0:y;d.forEach((function(t){var n=t[0]!==o[0],a=t[1]!==o[1],l=gi(e,t),d=360*lt(r,l)/Math.PI;if(a){var p=l.slice();(Math.abs(d-360)<2||Math.abs(d-180)<2)&&(p[1]=r[1]);var v=qr(r,p,(r[1]<l[1]?x:g)-l[1],!1,i),m=v.offset[1],y=v.isOutside;isNaN(m)||(f=c+(y?1:-1)*Math.abs(m))}if(n){p=l.slice(),(Math.abs(d-90)<2||Math.abs(d-270)<2)&&(p[0]=r[0]);var E=qr(r,p,(r[0]<l[0]?b:h)-l[0],!0,i),S=E.offset[0],C=E.isOutside;isNaN(S)||(u=s+(C?1:-1)*Math.abs(S))}}))}return{maxWidth:u,maxHeight:f}}(t,c,i,o,s),C=S.maxWidth,w=S.maxHeight,D=function(t,e,n,r,i,o,a,s,c){var l=gi(e,a),u=$r(t,s,{vertical:[l[0]],horizontal:[l[1]]}),f=u.horizontal.offset,d=u.vertical.offset;if(d||f){var p=pi({datas:c,distX:-d,distY:-f}),h=p[0],v=p[1];return[Math.min(i||1/0,n+a[0]*h)-n,Math.min(o||1/0,r+a[1]*v)-r]}return[0,0]}(t,e(u,f).map((function(t){return t.map((function(t){return dt(t,1e-4)}))})),n+u,r+f,C,w,i,a,s);u+=b=D[0],f+=y=D[1]}return[u,f]}function ni(t,e,n,r,i){if(!hr(t,"scalable"))return[0,0];var o=i.startOffsetWidth,a=i.startOffsetHeight,s=i.fixedPosition,c=i.fixedDirection,l=i.is3d,u=ei(t,(function(t,n){return Qr(function(t,e){var n=t.transformOrigin,r=t.offsetMatrix,i=t.is3d,o=t.targetMatrix,a=i?4:3;return mi(r,be(o,ke(e,a),a),n,a)}(i,ye(e,[t/o,n/a])),o,a,c,s,l)}),o,a,n,s,r,i);return[u[0]/o,u[1]/a]}function ri(t){var e=[];return t.forEach((function(t){t.guidelineInfos.forEach((function(t){var n=t.guideline;e.indexOf(n)>-1||e.push(n)}))})),e}function ii(t,e,n,r,i,o){var a=Gr(Ir(t,o),e,n),s=a.vertical,c=a.horizontal;s.forEach((function(t){t.isBound&&r.push({type:"bounds",pos:t.pos})})),c.forEach((function(t){t.isBound&&i.push({type:"bounds",pos:t.pos})}));var l=function(t){var e=t.props.innerBounds;if(!e)return{vertical:[],horizontal:[]};var n=t.getRect(),r=n.pos1,i=n.pos2,o=n.pos3,a=n.pos4,s=gi([r,i,o,a],[0,0]),c=e.left,l=e.top,u=e.width,f=e.height,d=[[c,l],[c,l+f]],p=[[c,l],[c+u,l]],h=[[c+u,l],[c+u,l+f]],v=[[c,l+f],[c+u,l+f]],g=[],m=[],b={top:!1,bottom:!1,left:!1,right:!1};return[[r,i],[i,a],[a,o],[o,r]].forEach((function(t){var e=Rr(s,t),n=e.horizontal,r=e.vertical,i=Br(t,p,r,1,!0),o=Br(t,v,r,1,!0),a=Br(t,d,n,1,!0),y=Br(t,h,n,1,!0);i.isBound&&!b.top&&(g.push(l),b.top=!0),o.isBound&&!b.bottom&&(g.push(l+f),b.bottom=!0),a.isBound&&!b.left&&(m.push(c),b.left=!0),y.isBound&&!b.right&&(m.push(c+u),b.right=!0)})),{horizontal:g,vertical:m}}(t),u=l.vertical,f=l.horizontal;u.forEach((function(t){Q(r,(function(e){var n=e.type,r=e.pos;return"bounds"===n&&r===t}))>=0||r.push({type:"bounds",pos:t})})),f.forEach((function(t){Q(i,(function(e){var n=e.type,r=e.pos;return"bounds"===n&&r===t}))>=0||i.push({type:"bounds",pos:t})}))}var oi={name:"snappable",dragRelation:"strong",props:{snappable:[Boolean,Array],snapContainer:Object,snapDirections:[Boolean,Object],elementSnapDirections:[Boolean,Object],snapGap:Boolean,snapGridWidth:Number,snapGridHeight:Number,isDisplaySnapDigit:Boolean,isDisplayInnerSnapDigit:Boolean,snapDigit:Number,snapThreshold:Number,horizontalGuidelines:Array,verticalGuidelines:Array,elementGuidelines:Array,bounds:Object,innerBounds:Object,snapDistFormat:Function},events:{onSnap:"snap"},css:[":host {\n    --bounds-color: #d66;\n}\n.guideline {\n    pointer-events: none;\n    z-index: 2;\n}\n.guideline.bounds {\n    background: #d66;\n    background: var(--bounds-color);\n}\n.guideline-group {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n.guideline-group .size-value {\n    position: absolute;\n    color: #f55;\n    font-size: 12px;\n    font-weight: bold;\n}\n.guideline-group.horizontal .size-value {\n    transform-origin: 50% 100%;\n    transform: translateX(-50%);\n    left: 50%;\n    bottom: 5px;\n}\n.guideline-group.vertical .size-value {\n    transform-origin: 0% 50%;\n    top: 50%;\n    transform: translateY(-50%);\n    left: 5px;\n}\n.guideline.gap {\n    background: #f55;\n}\n.size-value.gap {\n    color: #f55;\n}\n"],render:function(t,e){var n=t.state,r=n.top,i=n.left,o=n.pos1,a=n.pos2,s=n.pos3,c=n.pos4,l=n.snapRenderInfo;if(!l||!hr(t,""))return[];n.guidelines=yr(t);var u=Math.min(o[0],a[0],s[0],c[0]),f=Math.min(o[1],a[1],s[1],c[1]),d=l.externalPoses||[],p=ao(t.state),h=[],v=[],g=[],m=[],b=[],y=Vi(p),x=y.width,E=y.height,S=y.top,C=y.left,w=y.bottom,D=y.right,M={left:C,right:D,top:S,bottom:w,center:(C+D)/2,middle:(S+w)/2},R=d.length>0,O=R?Vi(d):{};if(!l.request){if(l.direction&&b.push(function(t,e,n){var r=[];if(n[0]&&n[1])r=[n,[-n[0],n[1]],[n[0],-n[1]]].map((function(t){return gi(e,t)}));else if(n[0]||n[1])t.props.keepRatio?r=[[-1,-1],[-1,1],[1,-1],[1,1],n].map((function(t){return gi(e,t)})):(r=vi(e,n)).length>1&&r.push([(r[0][0]+r[1][0])/2,(r[0][1]+r[1][1])/2]);else for(var i=[e[0],e[1],e[3],e[2],e[0]],o=0;o<4;++o)r.push(i[o]),r.push([(i[o][0]+i[o+1][0])/2,(i[o][1]+i[o+1][1])/2]);return xr(t,r.map((function(t){return t[0]})),r.map((function(t){return t[1]})),1)}(t,p,l.direction)),l.snap){var P=Vi(p);l.center&&(P.middle=(P.top+P.bottom)/2,P.center=(P.left+P.right)/2),b.push(Sr(t,P,1))}R&&(l.center&&(O.middle=(O.top+O.bottom)/2,O.center=(O.left+O.right)/2),b.push(Sr(t,O,1))),b.forEach((function(t){var e=t.vertical.posInfos,n=t.horizontal.posInfos;h.push.apply(h,e.filter((function(t){return t.guidelineInfos.some((function(t){return!t.guideline.hide}))})).map((function(t){return{type:"snap",pos:t.pos}}))),v.push.apply(v,n.filter((function(t){return t.guidelineInfos.some((function(t){return!t.guideline.hide}))})).map((function(t){return{type:"snap",pos:t.pos}}))),g.push.apply(g,ri(e)),m.push.apply(m,ri(n))}))}ii(t,[C,D],[S,w],h,v),R&&ii(t,[O.left,O.right],[O.top,O.bottom],h,v,l.externalBounds);var _=kn(kn([],g,!0),m,!0),B=_.filter((function(t){return t.element&&!t.gapRects})),k=_.filter((function(t){return t.gapRects}));return fo(t,"onSnap",{guidelines:_.filter((function(t){return!t.element})),elements:B,gaps:k},!0),kn(kn(kn(kn(kn(kn([],Wr(t,B,[u,f],M,e),!0),function(t,e,n,r,i){var o=[];return["horizontal","vertical"].forEach((function(a){var s=e.filter((function(t){return t.type===a})),c="vertical"===a?0:1,l=c?0:1,u=c?pr:dr,f=c?dr:pr,d=r[u.start],p=r[u.end],h=r[f.start],v=r[f.end];s.forEach((function(e){var r=e.gap,a=e.gapRects,s=e.className,g=Math.max.apply(Math,kn([h],a.map((function(t){return t.rect[f.start]})),!1)),m=Math.min.apply(Math,kn([v],a.map((function(t){return t.rect[f.end]})),!1)),b=(g+m)/2;g!==m&&b!==(h+v)/2&&a.forEach((function(e){var a=e.rect,f=[n[0],n[1]];if(a[u.end]<d)f[c]+=a[u.end]-d;else{if(!(p<a[u.start]))return;f[c]+=a[u.start]-d-r}f[l]+=b-h,o.push(Xr(t,c?"vertical":"horizontal","gap",o.length,r,f,s,i))}))}))})),o}(t,k,[u,f],M,e),!0),Yr(t,"horizontal",m,[i,r],M,e),!0),Yr(t,"vertical",g,[i,r],M,e),!0),Lr(t,"horizontal",v,u,r,x,0,e),!0),Lr(t,"vertical",h,f,i,E,1,e),!0)},dragStart:function(t,e){t.state.snapRenderInfo={request:e.isRequest,snap:!0,center:!0},Zr(t)},drag:function(t){t.state.guidelines=yr(t)},pinchStart:function(t){this.unset(t)},dragEnd:function(t){this.unset(t)},dragControlCondition:function(t,e){return!(!So(t,e)&&!cr(t,e))||(!e.isRequest&&e.inputEvent?ht(e.inputEvent.target,Pi("snap-control")):void 0)},dragControlStart:function(t){t.state.snapRenderInfo=null,Zr(t)},dragControl:function(t){this.drag(t)},dragControlEnd:function(t){this.unset(t)},dragGroupStart:function(t,e){this.dragStart(t,e)},dragGroup:function(t){this.drag(t)},dragGroupEnd:function(t){this.unset(t)},dragGroupControlStart:function(t){t.state.snapRenderInfo=null,Zr(t)},dragGroupControl:function(t){this.drag(t)},dragGroupControlEnd:function(t){this.unset(t)},unset:function(t){var e=t.state;e.enableSnap=!1,e.guidelines=[],e.snapRenderInfo=null,e.elementRects=[]}},ai={name:"draggable",props:{draggable:Boolean,throttleDrag:Number,throttleDragRotate:Number,startDragRotate:Number,edgeDraggable:Boolean},events:{onDragStart:"dragStart",onDrag:"drag",onDragEnd:"dragEnd",onDragGroupStart:"dragGroupStart",onDragGroup:"dragGroup",onDragGroupEnd:"dragGroupEnd"},render:function(t,e){var n=t.props,r=n.throttleDragRotate,i=n.zoom,o=t.state,a=o.dragInfo,s=o.beforeOrigin;if(!r||!a)return[];var c=a.dist;if(!c[0]&&!c[1])return[];var l=Ui(c),u=lt(c,[0,0]);return[e.createElement("div",{className:Pi("line","horizontal","dragline","dashed"),key:"dragRotateGuideline",style:{width:"".concat(l,"px"),transform:"translate(".concat(s[0],"px, ").concat(s[1],"px) rotate(").concat(u,"rad) scaleY(").concat(i,")")}})]},dragStart:function(t,e){var n=e.datas,r=e.parentEvent,i=e.parentGesto,o=t.state,a=o.target;if(o.gesto)return!1;o.gesto=i||t.targetGesto;var s=po(a);n.datas={},n.left=parseFloat(s.left||"")||0,n.top=parseFloat(s.top||"")||0,n.bottom=parseFloat(s.bottom||"")||0,n.right=parseFloat(s.right||"")||0,n.startValue=[0,0],ci(t,e),yi(e,"translate"),function(t,e){e.absolutePoses=ao(t.state)}(t,n),n.prevDist=[0,0],n.prevBeforeDist=[0,0],n.isDrag=!1,n.deltaOffset=[0,0];var c=co(t,e,Bn({set:function(t){n.startValue=t}},bi(e)));return!1!==(r||fo(t,"onDragStart",c))?(n.isDrag=!0,t.state.dragInfo={startRect:t.getRect(),dist:[0,0]}):(o.gesto=null,n.isPinch=!1),!!n.isDrag&&c},drag:function(t,e){if(e){li(e,"translate");var n=e.datas,r=e.parentEvent,i=e.parentFlag,o=e.isPinch,a=e.isRequest,s=e.deltaOffset,c=e.distX,l=e.distY,u=n.isDrag,f=n.prevDist,d=n.prevBeforeDist,p=n.startValue;if(u){s&&(c+=s[0],l+=s[1]);var h=t.props,v=h.parentMoveable,g=r?0:h.throttleDrag||0,m=r?0:h.throttleDragRotate||0,b=!1,y=0;if(!r&&m>0&&(c||l)){var x=h.startDragRotate||0,E=dt(x+180*lt([0,0],[c,l])/Math.PI,m)-x,S=l*Math.abs(Math.cos((E-90)/180*Math.PI)),C=Ui([c*Math.abs(Math.cos(E/180*Math.PI)),S]);y=E*Math.PI/180,c=C*Math.cos(y),l=C*Math.sin(y)}if(!o&&!r&&!i&&(!m||c||l)){var w=Vr(t,c,l,m,a||s,n),D=w[0],M=w[1],R=D.isSnap,O=D.isBound,P=D.offset,_=M.isSnap,B=M.isBound;b=R||_||O||B,c+=P,l+=M.offset}var k=ye(di({datas:n,distX:c,distY:l}),p),T=ye(function(t){var e=t.datas,n=t.distX,r=t.distY,i=di({datas:e,distX:n,distY:r}),o=i[0],a=i[1];return Se(fi(e,function(t,e){for(var n=Be(e),r=0;r<e-1;++r)n[e*(e-1)+r]=t[r]||0;return n}([o,a],4)),ve([0,0,0],4),4)}({datas:n,distX:c,distY:l}),p);m||b||(pt(T,g),pt(k,g));var z=xe(k,p),j=xe(T,p),G=xe(j,f),I=xe(z,d);n.prevDist=j,n.prevBeforeDist=z,n.passDelta=G,n.passDist=j;var N=n.left+z[0],F=n.top+z[1],A=n.right-z[0],L=n.bottom-z[1],Y=ui(n,"translate(".concat(T[0],"px, ").concat(T[1],"px)"),"translate(".concat(j[0],"px, ").concat(j[1],"px)"));if(Ei(e,Y),t.state.dragInfo.dist=r?[0,0]:j,r||v||!G.every((function(t){return!t}))||!I.some((function(t){return!t}))){var X=t.state,W=co(t,e,{transform:Y,dist:j,delta:G,translate:T,beforeDist:z,beforeDelta:I,beforeTranslate:k,left:N,top:F,right:A,bottom:L,width:X.width,height:X.height,isPinch:o});return!r&&fo(t,"onDrag",W),W}}}},dragAfter:function(t,e){var n=e.datas,r=n.deltaOffset;return!(!r[0]&&!r[1])&&(n.deltaOffset=[0,0],this.drag(t,Bn(Bn({},e),{deltaOffset:r})))},dragEnd:function(t,e){var n=e.parentEvent,r=e.datas;if(t.state.gesto=null,t.state.dragInfo=null,r.isDrag){r.isDrag=!1;var i=lo(t,e,{});return!n&&fo(t,"onDragEnd",i),i}},dragGroupStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY,o=this.dragStart(t,e);if(!o)return!1;var a=Zn(t,this,"dragStart",[r||0,i||0],e,!1),s=fo(t,"onDragGroupStart",Bn(Bn({},o),{targets:t.props.targets,events:a}));return n.isDrag=!1!==s,!!n.isDrag&&o},dragGroup:function(t,e){if(e.datas.isDrag){var n=this.drag(t,e),r=Zn(t,this,"drag",e.datas.passDelta,e,!1);if(n){var i=Bn({targets:t.props.targets,events:r},n);return fo(t,"onDragGroup",i),i}}},dragGroupEnd:function(t,e){var n=e.isDrag;if(e.datas.isDrag){this.dragEnd(t,e);var r=Zn(t,this,"dragEnd",[0,0],e,!1);return fo(t,"onDragGroupEnd",lo(t,e,{targets:t.props.targets,events:r})),n}},request:function(t){var e={},n=t.getRect(),r=0,i=0;return{isControl:!1,requestStart:function(){return{datas:e}},request:function(t){return"x"in t?r=t.x-n.left:"deltaX"in t&&(r+=t.deltaX),"y"in t?i=t.y-n.top:"deltaY"in t&&(i+=t.deltaY),{datas:e,distX:r,distY:i}},requestEnd:function(){return{datas:e,isDrag:!0}}}},unset:function(t){t.state.dragInfo=null}};function si(t,e){var n=e.clientX,r=e.clientY,i=e.datas,o=t.state,a=o.moveableClientRect,s=o.rootMatrix,c=o.is3d,l=o.pos1,u=xe(mo(s,[n-a.left,r-a.top],c?4:3),l),f=pi({datas:i,distX:u[0],distY:u[1]});return[f[0],f[1]]}function ci(t,e){var n=e.datas,r=t.state,i=r.allMatrix,o=r.beforeMatrix,a=r.is3d,s=r.left,c=r.top,l=r.origin,u=r.offsetMatrix,f=r.targetMatrix,d=r.transformOrigin,p=a?4:3;n.is3d=a,n.matrix=i,n.targetMatrix=f,n.beforeMatrix=o,n.offsetMatrix=u,n.transformOrigin=d,n.inverseMatrix=he(i,p),n.inverseBeforeMatrix=he(o,p),n.absoluteOrigin=ve(ye([s,c],l),p),n.startDragBeforeDist=Se(n.inverseBeforeMatrix,n.absoluteOrigin,p),n.startDragDist=Se(n.inverseMatrix,n.absoluteOrigin,p)}function li(t,e){var n=t.datas,r=t.originalDatas.beforeRenderable,i=n.transformIndex,o=r.nextTransforms,a=r.nextTransformAppendedIndexes,s=0;-1===i?(s=o.length,n.transformIndex=s):s=i+a.filter((function(t){return t<i})).length;var c=function(t,e){var n=t.slice(0,e<0?void 0:e),r=t.slice(0,e<0?void 0:e+1),i=t[e]||"",o=e<0?[]:t.slice(e),a=e<0?[]:t.slice(e+1),s=Ne(n),c=Ne(r),l=Ne([i]),u=Ne(o),f=Ne(a),d=Ie(s),p=Ie(c),h=Ie(u),v=Ie(f),g=be(d,h,4);return{transforms:t,beforeFunctionMatrix:d,beforeFunctionMatrix2:p,targetFunctionMatrix:Ie(l),afterFunctionMatrix:h,afterFunctionMatrix2:v,allFunctionMatrix:g,beforeFunctions:s,beforeFunctions2:c,targetFunction:l[0],afterFunctions:u,afterFunctions2:f,beforeFunctionTexts:n,beforeFunctionTexts2:r,targetFunctionText:i,afterFunctionTexts:o,afterFunctionTexts2:a}}(o,s),l=c.targetFunction,u="rotate"===e?"rotateZ":e;n.beforeFunctionTexts=c.beforeFunctionTexts,n.afterFunctionTexts=c.afterFunctionTexts,n.beforeTransform=c.beforeFunctionMatrix,n.beforeTransform2=c.beforeFunctionMatrix2,n.targetTansform=c.targetFunctionMatrix,n.afterTransform=c.afterFunctionMatrix,n.afterTransform2=c.afterFunctionMatrix2,n.targetAllTransform=c.allFunctionMatrix,l.functionName===u?(n.afterFunctionTexts.splice(0,1),n.isAppendTransform=!1):(n.isAppendTransform=!0,r.nextTransformAppendedIndexes=kn(kn([],a,!0),[s],!1))}function ui(t,e,n){return"".concat(t.beforeFunctionTexts.join(" ")," ").concat(t.isAppendTransform?n:e," ").concat(t.afterFunctionTexts.join(" "))}function fi(t,e,n){var r=t.beforeTransform,i=t.afterTransform,o=t.beforeTransform2,a=t.afterTransform2,s=t.targetAllTransform,c=n?be(s,e,4):be(e,s,4),l=be(he(n?o:r,4),c,4);return be(l,he(n?a:i,4),4)}function di(t){var e=t.datas,n=t.distX,r=t.distY,i=e.inverseBeforeMatrix,o=e.is3d,a=e.startDragBeforeDist,s=o?4:3;return xe(Se(i,ye(e.absoluteOrigin,[n,r]),s),a)}function pi(t,e){var n=t.datas,r=t.distX,i=t.distY,o=n.inverseBeforeMatrix,a=n.inverseMatrix,s=n.is3d,c=n.startDragBeforeDist,l=n.startDragDist,u=s?4:3;return xe(Se(e?o:a,ye(n.absoluteOrigin,[r,i]),u),e?c:l)}function hi(t){var e=[];return t[1]>=0&&(t[0]>=0&&e.push(3),t[0]<=0&&e.push(2)),t[1]<=0&&(t[0]>=0&&e.push(1),t[0]<=0&&e.push(0)),e}function vi(t,e){return hi(e).map((function(e){return t[e]}))}function gi(t,e){var n=vi(t,e);return[ct(n.map((function(t){return t[0]}))),ct(n.map((function(t){return t[1]})))]}function mi(t,e,n,r){return be(t,Bi(e,r,n),r)}function bi(t){var e=t.originalDatas.beforeRenderable;return{setTransform:function(n,r){void 0===r&&(r=-1),e.startTransforms=A(n)?n:H(n),xi(t,r)},setTransformIndex:function(e){xi(t,e)}}}function yi(t,e){xi(t,Q(t.originalDatas.beforeRenderable.startTransforms,(function(t){return 0===t.indexOf("".concat(e,"("))})))}function xi(t,e){var n=t.originalDatas.beforeRenderable,r=t.datas;if(r.transformIndex=e,-1!==e){var i=n.startTransforms[e];if(i){var o=Ne([i]);r.startValue=o[0].functionValue}}}function Ei(t,e){t.originalDatas.beforeRenderable.nextTransforms=H(e)}function Si(t){return t.originalDatas.beforeRenderable.nextTransforms.join(" ")}function Ci(t,e,n,r,i){return Ei(i,e),{transform:e,drag:ai.drag(t,Kn(i,t.state,n,r,!1))}}function wi(t,e,n,r,i){var o=t.state,a=o.left,s=o.top,c=t.props.groupable,l=function(t,e,n){var r=t.transformOrigin,i=t.offsetMatrix,o=t.is3d,a=e.beforeTransform,s=e.afterTransform,c=o?4:3;return mi(i,ge(be(be(a,je([n]),4),s,4),4,c),r,c)}(t.state,i,e),u=c?a:0,f=c?s:0,d=xe(r,Mi(t,n,l));return xe(d,[u,f])}function Di(t){var e=t.state,n=e.width,r=e.height,i=e.transformOrigin;return[i[0]/(n/2)-1,i[1]/(r/2)-1]}function Mi(t,e,n){void 0===n&&(n=t.state.allMatrix);var r=t.state,i=r.width,o=r.height,a=r.is3d?4:3;return qi(n,[i/2*(1+e[0]),o/2*(1+e[1])],a)}function Ri(t,e,n,r,i,o){var a=t.props.groupable,s=t.state,c=s.transformOrigin,l=s.targetMatrix,u=s.offsetMatrix,f=s.is3d,d=s.width,p=s.height,h=s.left,v=s.top,g=f?4:3,m=function(t,e,n,r,i,o){return void 0===r&&(r=e),void 0===i&&(i=n),void 0===o&&(o=[0,0]),t?t.map((function(t,a){var s=K(t),c=s.value,l=s.unit,u=a?i:r,f=a?n:e;return"%"===t||isNaN(c)?f*(u?o[a]/u:0):"%"!==l?c:f*c/100})):o}(o,e,n,d,p,c),b=a?h:0,y=a?v:0,x=function(t,e,n,r,i,o){var a=gi(Hi(e,n,r,i),o);return[t[0]-a[0],t[1]-a[1]]}(i,mi(u,l,m,g),e,n,g,r);return xe(x,[b,y])}function Oi(t,e){return gi(ao(t.state),e)}function Pi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return E.apply(void 0,kn([Nn],t,!1))}function _i(t){return t&&"none"!==t?F(t)?t:je(t):[1,0,0,1,0,0]}function Bi(t,e,n){return me(e,Te(n,e),t,Te(n.map((function(t){return-t})),e))}function ki(t){return Ti(po(t,":before")).map((function(e,n){var r=K(e),i=r.value,o=r.unit;return i*function(t,e,n){return"%"===e?Xi(t.ownerSVGElement)[n?"width":"height"]/100:1}(t,o,0===n)}))}function Ti(t){var e=t.transformOrigin;return e?e.split(" "):["0","0"]}function zi(t,e){void 0===e&&(e=po(t));var n=e.transform;if(n&&"none"!==n)return e.transform;if("transform"in t){var r=t.transform.baseVal;if(!r)return"";var i=r.length;if(!i)return"";for(var o=[],a=function(t){var e=r[0].matrix;o.push("matrix(".concat(["a","b","c","d","e","f"].map((function(t){return e[t]})).join(", "),")"))},s=0;s<i;++s)a();return o.join(" ")}return""}function ji(t,e,n){for(var r=document.body,i=!t||n?t:t.parentElement,o=t===e||i===e,a="relative";i&&i!==r;){e===i&&(o=!0);var s=po(i),c=i.tagName.toLowerCase(),l=zi(i,s);if(a=s.position,"svg"===c||"static"!==a||l&&"none"!==l)break;i=i.parentElement,a="relative"}return{isStatic:"static"===a,isEnd:o||!i||i===r,offsetParent:i||r}}function Gi(t,e){var n,r,i,o=t.tagName.toLowerCase(),a=t.offsetLeft,s=t.offsetTop,c=N(a),l=!c;return l||"svg"===o?i=(r=Ti(e).map((function(t){return parseFloat(t)}))).slice():(i=(r=In?ki(t):Ti(e).map((function(t){return parseFloat(t)}))).slice(),l=!0,n=function(t,e){if(!t.getBBox||"g"===t.tagName.toLowerCase())return[0,0,0,0];var n=t.getBBox(),r=Xi(t.ownerSVGElement),i=n.x-r.x,o=n.y-r.y;return[i,o,e[0]-i,e[1]-o]}(t,r),a=n[0],s=n[1],r[0]=n[2],r[1]=n[3]),{tagName:o,isSVG:c,hasOffset:l,offset:[a||0,s||0],origin:r,targetOrigin:i}}function Ii(t,e,n){void 0===n&&(n=po(t));var r=po(document.body),i=r.position;if(!(e||i&&"static"!==i))return[0,0];var o=parseInt(r.marginLeft,10),a=parseInt(r.marginTop,10);return"absolute"===n.position&&("auto"===n.top&&"auto"===n.bottom||(a=0),"auto"===n.left&&"auto"===n.right||(o=0)),[o,a]}function Ni(t){t.forEach((function(t){var e=t.matrix;e&&(t.matrix=ge(e,3,4))}))}function Fi(t){for(var e=t.parentElement,n=!1;e;){var r=po(e).transform;if(r&&"none"!==r){n=!0;break}if(e===document.body)break;e=e.parentElement}return{fixedContainer:e||document.body,hasTransform:n}}function Ai(t,e,n){for(var r,i,o,a,s,c=t,l=[],u=!n&&t===e||t===document.body,f=u,d=!1,p=3,h=!1,v=ji(e,e,!0).offsetParent;c&&!f;){f=u;var g=po(c),m=g.position,b=zi(c,g),y=(a=_i(b),void 0===(s=void 0)&&(s=6===a.length),s?[a[0],a[1],0,a[2],a[3],0,a[4],a[5],1]:a),x="fixed"===m,E={hasTransform:!1,fixedContainer:null};x&&(h=!0,v=(E=Fi(c)).fixedContainer);var S=y.length;d||16!==S||(d=!0,p=4,Ni(l),o&&(o=ge(o,3,4))),d&&9===S&&(y=ge(y,3,4));var C=Gi(c,g),w=C.tagName,D=C.hasOffset,M=C.isSVG,R=C.origin,O=C.targetOrigin,P=C.offset,_=P[0],B=P[1];"svg"===w&&o?(l.push({type:"target",target:c,matrix:Wi(c,p)}),l.push({type:"offset",target:c,matrix:Be(p)})):"g"===w&&t!==c&&(_=0,B=0);var k=void 0,T=!1,z=!1;if(x)k=E.fixedContainer,T=!0;else{var j=ji(c,e);k=j.offsetParent,T=j.isEnd,z=j.isStatic}Gn&&D&&!M&&z&&("relative"===m||"static"===m)&&(_-=k.offsetLeft,B-=k.offsetTop,u=u||T);var G=0,I=0,N=0,F=0;if(x)D&&E.hasTransform&&(N=k.clientLeft,F=k.clientTop);else if(D&&v!==k&&(G=k.clientLeft,I=k.clientTop),D&&k===document.body){var A=Ii(c,!1,g);_+=A[0],B+=A[1]}if(l.push({type:"target",target:c,matrix:Bi(y,p,R)}),D?l.push({type:"offset",target:c,matrix:Te([_-c.scrollLeft+G-N,B-c.scrollTop+I-F],p)}):l.push({type:"offset",target:c,origin:R}),o||(o=y),r||(r=R),i||(i=O),f||x)break;c=k,u=T,n&&c!==document.body||(f=u)}return o||(o=Be(p)),r||(r=[0,0]),i||(i=[0,0]),{offsetContainer:v,matrixes:l,targetMatrix:o,transformOrigin:r,targetOrigin:i,is3d:d,hasFixed:h}}function Li(t,e,n,r){void 0===n&&(n=e);var i=0,o=0,a=0,s={};if(t){var c=to(t);i=c.offsetWidth,o=c.offsetHeight}if(t){var l=function(t,e,n,r){var i;void 0===n&&(n=e);var o=Ai(t,e),a=o.matrixes,s=o.is3d,c=o.targetMatrix,l=o.transformOrigin,u=o.targetOrigin,f=o.offsetContainer,d=o.hasFixed,p=Ai(f,n,!0),h=p.matrixes,v=p.is3d,g=r||v||s,m=g?4:3,b="svg"!==t.tagName.toLowerCase()&&"ownerSVGElement"in t,y=c,x=Be(m),E=Be(m),S=Be(m),C=Be(m),w=a.length;h.reverse(),a.reverse(),!s&&g&&(y=ge(y,3,4),Ni(a));!v&&g&&Ni(h);h.forEach((function(t){E=be(E,t.matrix,m)}));var D=n||document.body,M=(null===(i=h[0])||void 0===i?void 0:i.target)||ji(D,D,!0).offsetParent,R=h.slice(1).reduce((function(t,e){return be(t,e.matrix,m)}),Be(m));a.forEach((function(t,e){if(w-2===e&&(S=x.slice()),w-1===e&&(C=x.slice()),!t.matrix){var n=function(t,e,n,r,i){var o,a=t.target,s=t.origin,c=e.matrix,l=to(a),u=l.offsetWidth,f=l.offsetHeight,d=n.getBoundingClientRect(),p=[0,0];n===document.body&&(p=Ii(a,!0));var h=a.getBoundingClientRect(),v=h.left-d.left+n.scrollLeft-(n.clientLeft||0)+p[0],g=h.top-d.top+n.scrollTop-(n.clientTop||0)+p[1],m=h.width,b=h.height,y=me(r,i,c),x=$i(y,u,f,r),E=x.left,S=x.top,C=x.width,w=x.height,D=qi(y,s,r),M=xe(D,[E,S]),R=[v+M[0]*m/C,g+M[1]*b/w],O=[0,0],P=0;for(;++P<10;){var _=he(i,r);o=xe(qi(_,R,r),qi(_,D,r)),O[0]=o[0],O[1]=o[1];var B=$i(me(r,i,Te(O,r),c),u,f,r),k=B.left-v,T=B.top-g;if(Math.abs(k)<2&&Math.abs(T)<2)break;R[0]-=k,R[1]-=T}return O.map((function(t){return Math.round(t)}))}(t,a[e+1],M,m,be(R,x,m));t.matrix=Te(n,m)}x=be(x,t.matrix,m)}));var O=!b&&s;y||(y=Be(O?4:3));var P=Yi(b&&16===y.length?ge(y,4,3):y,O);return E=pe(E,m,m),{hasFixed:d,rootMatrix:E,beforeMatrix:S,offsetMatrix:C,allMatrix:x,targetMatrix:y,targetTransform:P,transformOrigin:l,targetOrigin:u,is3d:g}}(t,e,n,r),u=Ki(l.allMatrix,l.transformOrigin,i,o);s=Bn(Bn({},l),u);var f=Ki(l.allMatrix,[50,50],100,100);a=eo([f.pos1,f.pos2],f.direction)}var d=r?4:3;return Bn({width:i,height:o,rotation:a,rootMatrix:Be(d),beforeMatrix:Be(d),offsetMatrix:Be(d),allMatrix:Be(d),targetMatrix:Be(d),targetTransform:"",transformOrigin:[0,0],targetOrigin:[0,0],is3d:!!r,left:0,top:0,right:0,bottom:0,origin:[0,0],pos1:[0,0],pos2:[0,0],pos3:[0,0],pos4:[0,0],direction:1,hasFixed:!1},s)}function Yi(t,e){return void 0===e&&(e=t.length>9),"".concat(e?"matrix3d":"matrix","(").concat(Ee(t,!e).join(","),")")}function Xi(t){var e=t.clientWidth,n=t.clientHeight;if(!t)return{x:0,y:0,width:0,height:0,clientWidth:e,clientHeight:n};var r=t.viewBox,i=r&&r.baseVal||{x:0,y:0,width:0,height:0};return{x:i.x,y:i.y,width:i.width||e,height:i.height||n,clientWidth:e,clientHeight:n}}function Wi(t,e){var n=Xi(t),r=n.width,i=n.height,o=n.clientWidth,a=n.clientHeight,s=o/r,c=a/i,l=t.preserveAspectRatio.baseVal,u=l.align,f=l.meetOrSlice,d=[0,0],p=[s,c],h=[0,0];if(1!==u){var v=(u-2)%3,g=Math.floor((u-2)/3);d[0]=r*v/2,d[1]=i*g/2;var m=2===f?Math.max(c,s):Math.min(s,c);p[0]=m,p[1]=m,h[0]=(o-r)/2*v,h[1]=(a-i)/2*g}var b=ke(p,e);return b[e*(e-1)]=h[0],b[e*(e-1)+1]=h[1],Bi(b,e,d)}function qi(t,e,n){return Se(t,ve(e,n),n)}function Hi(t,e,n,r){return[[0,0],[e,0],[0,n],[e,n]].map((function(e){return qi(t,e,r)}))}function Vi(t){var e=t.map((function(t){return t[0]})),n=t.map((function(t){return t[1]})),r=Math.min.apply(Math,e),i=Math.min.apply(Math,n),o=Math.max.apply(Math,e),a=Math.max.apply(Math,n);return{left:r,top:i,right:o,bottom:a,width:o-r,height:a-i}}function $i(t,e,n,r){return Vi(Hi(t,e,n,r))}function Ki(t,e,n,r){var i=16===t.length?4:3,o=Hi(t,n,r,i),a=o[0],s=a[0],c=a[1],l=o[1],u=l[0],f=l[1],d=o[2],p=d[0],h=d[1],v=o[3],g=v[0],m=v[1],b=qi(t,e,i),y=b[0],x=b[1],E=Math.min(s,u,p,g),S=Math.min(c,f,h,m),C=Math.max(s,u,p,g);return s=s-E||0,{left:E,top:S,right:C,bottom:Math.max(c,f,h,m),origin:[y=y-E||0,x=x-S||0],pos1:[s,c=c-S||0],pos2:[u=u-E||0,f=f-S||0],pos3:[p=p-E||0,h=h-S||0],pos4:[g=g-E||0,m=m-S||0],direction:ut(o)}}function Ui(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ji(t,e){return Ui([e[0]-t[0],e[1]-t[1]])}function Zi(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=lt(t,e));var i=Ji(t,e);return{transform:"translateY(-50%) translate(".concat(t[0],"px, ").concat(t[1],"px) rotate(").concat(r,"rad) scaleY(").concat(n,")"),width:"".concat(i,"px")}}function Qi(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.length,o=n.reduce((function(t,e){return t+e[0]}),0)/i,a=n.reduce((function(t,e){return t+e[1]}),0)/i;return{transform:"translateZ(0px) translate(".concat(o,"px, ").concat(a,"px) rotate(").concat(t,"rad) scale(").concat(e,")")}}function to(t,e){if(void 0===e&&(e=po(t)),!N(t.offsetWidth)||"svg"===t.tagName.toLowerCase()){var n="border-box"===e.boxSizing,r=parseFloat(e.borderLeftWidth)||0,i=parseFloat(e.borderRightWidth)||0,o=parseFloat(e.borderTopWidth)||0,a=parseFloat(e.borderBottomWidth)||0,s=parseFloat(e.paddingLeft)||0,c=parseFloat(e.paddingRight)||0,l=parseFloat(e.paddingTop)||0,u=parseFloat(e.paddingBottom)||0,f=parseFloat(e.width),d=parseFloat(e.height),p=(m=f,b=d,s+c),h=l+u,v=p+(r+i),g=h+(o+a);return n?(f=m-v,d=b-g):(m=f+v,b=d+g),{svg:!1,offsetWidth:m,offsetHeight:b,clientWidth:f+p,clientHeight:d+h,cssWidth:f,cssHeight:d}}var m,b,y=t.getBBox();return{svg:!0,offsetWidth:m=y.width,offsetHeight:b=y.height,clientWidth:m,clientHeight:b,cssWidth:m,cssHeight:b}}function eo(t,e){return lt(e>0?t[0]:t[1],e>0?t[1]:t[0])}function no(t,e,n,r,i){var o=1,a=[0,0],s={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},c={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},l={left:0,right:0,top:0,bottom:0,width:0,height:0,clientLeft:0,clientTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0},u=Li(e,n,i,!1);if(e){var f=u.is3d?4:3,d=Ki(u.offsetMatrix,ye(u.transformOrigin,function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=[],r=t[e*e-1],i=0;i<e-1;++i)n[i]=t[e*(e-1)+i]/r;return n[e-1]=0,n}(u.targetMatrix,f)),u.width,u.height);o=d.direction,a=ye(d.origin,[d.left-u.left,d.top-u.top]),s=ro(e),c=ro(ji(r,r,!0).offsetParent||document.body,!0),t&&(l=ro(t))}return Bn({targetClientRect:s,containerClientRect:c,moveableClientRect:l,beforeDirection:o,beforeOrigin:a,originalBeforeOrigin:a,target:e},u)}function ro(t,e){var n,r=0,i=0,o=0,a=0;if(t===document.body||t===document.documentElement){o=window.innerWidth,a=window.innerHeight;var s=[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop];r=(n=[-s[0],-s[1]])[0],i=n[1]}else{var c=t.getBoundingClientRect();r=c.left,i=c.top,o=c.width,a=c.height}var l={left:r,right:r+o,top:i,bottom:i+a,width:o,height:a};return e&&(l.clientLeft=t.clientLeft,l.clientTop=t.clientTop,l.clientWidth=t.clientWidth,l.clientHeight=t.clientHeight,l.scrollWidth=t.scrollWidth,l.scrollHeight=t.scrollHeight,l.overflow="visible"!==po(t).overflow),l}function io(t){if(t){var e=t.getAttribute("data-direction");if(e){var n=[0,0];return e.indexOf("w")>-1&&(n[0]=-1),e.indexOf("e")>-1&&(n[0]=1),e.indexOf("n")>-1&&(n[1]=-1),e.indexOf("s")>-1&&(n[1]=1),n}}}function oo(t,e){return[ye(e,t[0]),ye(e,t[1]),ye(e,t[2]),ye(e,t[3])]}function ao(t){var e=t.left,n=t.top;return oo([t.pos1,t.pos2,t.pos3,t.pos4],[e,n])}function so(t,e){var n;null===(n=t[e])||void 0===n||n.unset(),t[e]=null}function co(t,e,n,r){var i=e.datas;i.datas||(i.datas={});var o=Bn(Bn({},n),{target:t.state.target,clientX:e.clientX,clientY:e.clientY,inputEvent:e.inputEvent,currentTarget:t,moveable:t,datas:i.datas});return i.isStartEvent?r||(i.lastEvent=o):i.isStartEvent=!0,o}function lo(t,e,n){var r=e.datas,i="isDrag"in n?n.isDrag:e.isDrag;return r.datas||(r.datas={}),Bn(Bn({isDrag:i},n),{moveable:t,target:t.state.target,clientX:e.clientX,clientY:e.clientY,inputEvent:e.inputEvent,currentTarget:t,lastEvent:r.lastEvent,isDouble:e.isDouble,datas:r.datas})}function uo(t,e,n){t._emitter.on(e,n)}function fo(t,e,n,r){return t.triggerEvent(e,n,r)}function po(t,e){return window.getComputedStyle(t,e)}function ho(t,e,n){var r={},i={};return t.filter((function(t){var o=t.name;if(r[o]||!e.some((function(e){return t[e]})))return!1;if(!n&&t.ableGroup){if(i[t.ableGroup])return!1;i[t.ableGroup]=!0}return r[o]=!0,!0}))}function vo(t,e){return t===e||null==t&&null==e}function go(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.sort((function(t,e){return Math.abs(e)-Math.abs(t)})),t[0]}function mo(t,e,n){return Se(he(t,n),ve(e,n),n)}function bo(t,e){var n,r=t.is3d?4:3;return n=mo(t.rootMatrix,[e.distX,e.distY],r),e.distX=n[0],e.distY=n[1],e}function yo(t,e,n,r,i){return xe(qi(t,ye(n,e),i),r)}function xo(t,e,n){return n?"".concat(t/e*100,"%"):"".concat(t,"px")}function Eo(t){return Math.abs(t)<=Ln?0:t}function So(t,e){return e.isRequest?("resizable"===e.requestAble||"scalable"===e.requestAble)&&e.parentDirection:ht(e.inputEvent.target,Pi("direction"))}function Co(t){var e={};for(var n in t)e[t[n]]=n;return e}function wo(t,e){return t?L(t)?e?document.querySelector(t):t:Y(t)?t():"current"in t?t.current:t:null}function Do(t,e){return t?(!(n=t)||!F(n)||n instanceof Element||!A(n)&&!("length"in n)?[t]:[].slice.call(t)).reduce((function(t,n){return L(n)&&e?kn(kn([],t,!0),[].slice.call(document.querySelectorAll(n)),!0):(t.push(wo(n,e)),t)}),[]):[];var n}function Mo(t,e){var n=t.rootMatrix,r=t.is3d,i=he(n,r?4:3);return r||(i=ge(i,3,4)),i[12]=0,i[13]=0,i[14]=0,Ge(i,e)}function Ro(t,e,n,r){var i=n.ratio,o=n.startOffsetWidth,a=n.startOffsetHeight,s=0,c=0,l=r.distX,u=r.distY,f=r.parentDistance,d=r.parentDist,p=r.parentScale,h=r.isPinch,v=n.fixedDirection;if(d)s=d[0],c=d[1],e&&(s?c||(c=s/i):s=c*i);else if(p)s=(p[0]-1)*o,c=(p[1]-1)*a;else if(h)f&&(s=f,c=f*a/o);else{var g=pi({datas:n,distX:l,distY:u});if(g=[0,1].map((function(e){var n=Math.abs(t[e]-v[e]);return 0!==n&&(n=2/n),g[e]*n})),e&&o&&a){var m=lt([0,0],g),b=lt([0,0],t),y=Ui(g),x=Math.cos(m-b)*y;if(t[0])if(t[1]){var E=2*t[0]*o,S=2*t[1]*a,C=Ui([E+g[0],S+g[1]])-Ui([E,S]),w=lt([0,0],[i,1]);s=Math.cos(w)*C,c=Math.sin(w)*C}else c=(s=x)/i;else s=(c=x)*i}else s=t[0]*g[0],c=t[1]*g[1]}return{distWidth:s,distHeight:c}}var Oo=Tn("pinchable",{events:{onPinchStart:"pinchStart",onPinch:"pinch",onPinchEnd:"pinchEnd",onPinchGroupStart:"pinchGroupStart",onPinchGroup:"pinchGroup",onPinchGroupEnd:"pinchGroupEnd"},dragStart:function(){return!0},pinchStart:function(t,e){var n=e.datas,r=e.targets,i=e.angle,o=e.originalDatas,a=t.props,s=a.pinchable,c=a.ables;if(!s)return!1;var l="onPinch".concat(r?"Group":"","Start"),u="drag".concat(r?"Group":"","ControlStart"),f=(!0===s?t.controlAbles:c.filter((function(t){return s.indexOf(t.name)>-1}))).filter((function(t){return t.canPinch&&t[u]})),d=co(t,e,{});r&&(d.targets=r);var p=fo(t,l,d);n.isPinch=!1!==p,n.ables=f;var h=n.isPinch;return!!h&&(f.forEach((function(n){if(o[n.name]=o[n.name]||{},n[u]){var r=Bn(Bn({},e),{datas:o[n.name],parentRotate:i,isPinch:!0});n[u](t,r)}})),t.state.snapRenderInfo={request:e.isRequest,direction:[0,0]},h)},pinch:function(t,e){var n=e.datas,r=e.scale,i=e.distance,o=e.originalDatas,a=e.inputEvent,s=e.targets,c=e.angle;if(n.isPinch){var l=i*(1-1/r),u=co(t,e,{});s&&(u.targets=s);var f="onPinch".concat(s?"Group":"");fo(t,f,u);var d=n.ables,p="drag".concat(s?"Group":"","Control");return d.forEach((function(n){n[p]&&n[p](t,Bn(Bn({},e),{datas:o[n.name],inputEvent:a,parentDistance:l,parentRotate:c,isPinch:!0}))})),u}},pinchEnd:function(t,e){var n=e.datas,r=e.isPinch,i=e.inputEvent,o=e.targets,a=e.originalDatas;if(n.isPinch){var s="onPinch".concat(o?"Group":"","End"),c=lo(t,e,{isDrag:r});o&&(c.targets=o),fo(t,s,c);var l=n.ables,u="drag".concat(o?"Group":"","ControlEnd");return l.forEach((function(n){n[u]&&n[u](t,Bn(Bn({},e),{isDrag:r,datas:a[n.name],inputEvent:i,isPinch:!0}))})),r}},pinchGroupStart:function(t,e){return this.pinchStart(t,Bn(Bn({},e),{targets:t.props.targets}))},pinchGroup:function(t,e){return this.pinch(t,Bn(Bn({},e),{targets:t.props.targets}))},pinchGroupEnd:function(t,e){return this.pinchEnd(t,Bn(Bn({},e),{targets:t.props.targets}))}}),Po={name:"resizable",ableGroup:"size",canPinch:!0,props:{resizable:Boolean,throttleResize:Number,renderDirections:Array,keepRatio:Boolean,resizeFormat:Function},events:{onResizeStart:"resizeStart",onBeforeResize:"beforeResize",onResize:"resize",onResizeEnd:"resizeEnd",onResizeGroupStart:"resizeGroupStart",onBeforeResizeGroup:"beforeResizeGroup",onResizeGroup:"resizeGroup",onResizeGroupEnd:"resizeGroupEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.edge;if(r)return i?rr(t,e):nr(t,e)},dragControlCondition:So,dragControlStart:function(t,e){var n,r=e.inputEvent,i=e.isPinch,o=e.parentDirection,a=e.datas,s=e.parentFlag,c=o||(i?[0,0]:io(r.target)),l=t.state,u=l.target,f=l.width,d=l.height;if(!c||!u)return!1;!i&&ci(t,e),a.datas={},a.direction=c,a.startOffsetWidth=f,a.startOffsetHeight=d,a.prevWidth=0,a.prevHeight=0,n=function(t){var e=po(t);return[parseFloat(e.width),parseFloat(e.height)]}(u),a.startWidth=n[0],a.startHeight=n[1];var p=[Math.max(0,f-a.startWidth),Math.max(0,d-a.startHeight)];if(a.minSize=p,a.maxSize=[1/0,1/0],!s){var h=po(u),v=h.position,g=h.minWidth,m=h.minHeight,b=h.maxWidth,y=h.maxHeight,x="static"===v||"relative"===v,E=x?u.parentElement:u.offsetParent,S=f,C=d;if(E&&(S=E.clientWidth,C=E.clientHeight,x)){var w=po(E);S-=parseFloat(w.paddingLeft)||0,C-=parseFloat(w.paddingTop)||0}a.minSize=ye([it(g,S)||0,it(m,C)||0],p),a.maxSize=ye([it(b,S)||1/0,it(y,C)||1/0],p)}var D=t.props.transformOrigin||"% %";function M(t){a.ratio=t&&isFinite(t)?t:0}function R(t){a.fixedDirection=t,a.fixedPosition=gi(a.startPositions,t)}a.transformOrigin=D&&L(D)?D.split(" "):D,a.isWidth=!c[0]&&!c[1]||c[0]||!c[1],a.startPositions=ao(t.state),M(f/d),R([-c[0],-c[1]]),a.setFixedDirection=R;var O=co(t,e,{direction:c,set:function(t){var e=t[0],n=t[1];a.startWidth=e,a.startHeight=n},setMin:function(t){a.minSize=t},setMax:function(t){a.maxSize=[t[0]||1/0,t[1]||1/0]},setRatio:M,setFixedDirection:R,setOrigin:function(t){a.transformOrigin=t},dragStart:ai.dragStart(t,(new Un).dragStart([0,0],e))});return!1!==fo(t,"onResizeStart",O)&&(a.isResize=!0,t.state.snapRenderInfo={request:e.isRequest,direction:c}),!!a.isResize&&O},dragControl:function(t,e){var n,r=e.datas,i=e.parentFlag,o=e.isPinch,a=e.parentKeepRatio,s=e.dragClient,c=e.parentDist,l=e.isRequest,u=r.isResize,f=r.transformOrigin,d=r.startWidth,p=r.startHeight,h=r.prevWidth,v=r.prevHeight,g=r.minSize,m=r.maxSize,b=r.ratio,y=r.isWidth,x=r.startOffsetWidth,E=r.startOffsetHeight;if(u){var S=t.props,C=S.resizeFormat,w=S.throttleResize,D=void 0===w?1:w,M=S.parentMoveable,R=S.snapThreshold,O=void 0===R?5:R,P=r.direction,_=P,B=0,k=0;P[0]||P[1]||(_=[1,1]);var T=b&&(null!=a?a:S.keepRatio)||!1,z=X(),j=z[0],G=z[1];r.setFixedDirection(r.fixedDirection),fo(t,"onBeforeResize",co(t,e,{setFixedDirection:function(t){var e;return r.setFixedDirection(t),e=X(),j=e[0],G=e[1],[j,G]},boundingWidth:j,boundingHeight:G,setSize:function(t){j=t[0],G=t[1]}},!0));var I=s;s||(I=!i&&o?Oi(t,[0,0]):r.fixedPosition);var N=[0,0];if(o||(N=function(t,e,n,r,i,o,a){if(!hr(t,"resizable"))return[0,0];var s=a.fixedDirection,c=t.state,l=c.allMatrix,u=c.is3d;return ei(t,(function(t,r){return Qr(l,e+t,n+r,s,i,u)}),e,n,r,i,o,a)}(t,j,G,P,I,l,r)),c&&(!c[0]&&(N[0]=0),!c[1]&&(N[1]=0)),T){_[0]&&_[1]&&N[0]&&N[1]&&(Math.abs(N[0])>Math.abs(N[1])?N[1]=0:N[0]=0);var F=!N[0]&&!N[1];F&&W(),_[0]&&!_[1]||N[0]&&!N[1]||F&&y?(j+=N[0],G=j/b):(!_[0]&&_[1]||!N[0]&&N[1]||F&&!y)&&(G+=N[1],j=G*b)}else x+B<-O&&(N[0]=0),x+k<-O&&(N[1]=0),j+=N[0],G+=N[1];n=st([j,G],g,m,T),j=n[0],G=n[1],W();var A=[(B=j-x)-h,(k=G-E)-v];r.prevWidth=B,r.prevHeight=k;var L=Ri(t,j,G,r.fixedDirection,I,f);if(M||!A.every((function(t){return!t}))||!L.every((function(t){return!t}))){var Y=co(t,e,{width:d+B,height:p+k,offsetWidth:Math.round(j),offsetHeight:Math.round(G),boundingWidth:j,boundingHeight:G,direction:P,dist:[B,k],delta:A,isPinch:!!o,drag:ai.drag(t,Kn(e,t.state,L,!!o,!1))});return fo(t,"onResize",Y),Y}}function X(){var t=Ro(_,T,r,e);B=t.distWidth,k=t.distHeight;var n=_[0]||T?Math.max(x+B,Ln):x,i=_[1]||T?Math.max(E+k,Ln):E;return T&&x&&E&&(y?i=n/b:n=i*b),[n,i]}function W(){var t;C&&(t=C([j,G]),j=t[0],G=t[1]),j=dt(j,D),G=dt(G,D)}},dragControlAfter:function(t,e){var n=e.datas,r=n.isResize,i=n.startOffsetWidth,o=n.startOffsetHeight,a=n.prevWidth,s=n.prevHeight;if(r){var c=t.state,l=c.width-(i+a),u=c.height-(o+s),f=Math.abs(l)>3,d=Math.abs(u)>3;return f&&(n.startWidth+=l,n.startOffsetWidth+=l,n.prevWidth+=l),d&&(n.startHeight+=u,n.startOffsetHeight+=u,n.prevHeight+=u),f||d?this.dragControl(t,e):void 0}},dragControlEnd:function(t,e){var n=e.datas;if(n.isResize){n.isResize=!1;var r=lo(t,e,{});return fo(t,"onResizeEnd",r),r}},dragGroupControlCondition:So,dragGroupControlStart:function(t,e){var n=e.datas,r=this.dragControlStart(t,e);if(!r)return!1;var i=Jn(t,"resizable",e);function o(e,r){var i=n.fixedDirection,o=n.fixedPosition,a=gi(r.datas.startPositions||ao(e.state),i),s=Se(_e(-t.rotation/180*Math.PI,3),[a[0]-o[0],a[1]-o[1],1],3),c=s[0],l=s[1];return r.datas.originalX=c,r.datas.originalY=l,r}var a=Qn(t,this,"dragControlStart",e,(function(t,e){return o(t,e)})),s=function(t){r.setFixedDirection(t),a.forEach((function(e,n){e.setFixedDirection(t),o(e.moveable,i[n])}))};n.setFixedDirection=s;var c=Bn(Bn({},r),{targets:t.props.targets,events:a,setFixedDirection:s}),l=fo(t,"onResizeGroupStart",c);return n.isResize=!1!==l,!!n.isResize&&r},dragGroupControl:function(t,e){var n=e.datas;if(n.isResize){uo(t,"onBeforeResize",(function(n){fo(t,"onBeforeResizeGroup",co(t,e,Bn(Bn({},n),{targets:t.props.targets}),!0))}));var r=this.dragControl(t,e);if(r){var i=r.boundingWidth,o=r.boundingHeight,a=r.dist,s=t.props.keepRatio,c=[i/(i-a[0]),o/(o-a[1])],l=n.fixedPosition,u=Qn(t,this,"dragControl",e,(function(e,n){var r=Se(_e(t.rotation/180*Math.PI,3),[n.datas.originalX*c[0],n.datas.originalY*c[1],1],3),i=r[0],o=r[1];return Bn(Bn({},n),{parentDist:null,parentScale:c,dragClient:ye(l,[i,o]),parentKeepRatio:s})})),f=Bn({targets:t.props.targets,events:u},r);return fo(t,"onResizeGroup",f),f}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isResize){this.dragControlEnd(t,e);var r=Qn(t,this,"dragControlEnd",e);return fo(t,"onResizeGroupEnd",lo(t,e,{targets:t.props.targets,events:r})),n}},request:function(t){var e={},n=0,r=0,i=t.getRect();return{isControl:!0,requestStart:function(t){return{datas:e,parentDirection:t.direction||[1,1]}},request:function(t){return"offsetWidth"in t?n=t.offsetWidth-i.offsetWidth:"deltaWidth"in t&&(n+=t.deltaWidth),"offsetHeight"in t?r=t.offsetHeight-i.offsetHeight:"deltaHeight"in t&&(r+=t.deltaHeight),{datas:e,parentDist:[n,r],parentKeepRatio:t.keepRatio}},requestEnd:function(){return{datas:e,isDrag:!0}}}}},_o={name:"scalable",ableGroup:"size",canPinch:!0,props:{scalable:Boolean,throttleScale:Number,renderDirections:String,keepRatio:Boolean},events:{onScaleStart:"scaleStart",onBeforeScale:"beforeScale",onScale:"scale",onScaleEnd:"scaleEnd",onScaleGroupStart:"scaleGroupStart",onBeforeScaleGroup:"beforeScaleGroup",onScaleGroup:"scaleGroup",onScaleGroupEnd:"scaleGroupEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.scalable,o=n.edge;if(!r&&i)return o?rr(t,e):nr(t,e)},dragControlCondition:So,dragControlStart:function(t,e){var n=e.datas,r=e.isPinch,i=e.inputEvent,o=e.parentDirection||(r?[0,0]:io(i.target)),a=t.state,s=a.width,c=a.height,l=a.targetTransform,u=a.target,f=a.pos1,d=a.pos2,p=a.pos4;if(!o||!u)return!1;r||ci(t,e),n.datas={},n.transform=l,n.prevDist=[1,1],n.direction=o,n.startOffsetWidth=s,n.startOffsetHeight=c,n.startValue=[1,1];var h=ft(f,d),v=ft(d,p),g=!o[0]&&!o[1]||o[0]||!o[1];function m(t){n.ratio=t&&isFinite(t)?t:0}function b(t){n.fixedDirection=t,n.fixedPosition=gi(n.startPositions,t)}n.scaleWidth=h,n.scaleHeight=v,n.scaleXRatio=h/s,n.scaleYRatio=v/c,yi(e,"scale"),n.isWidth=g,n.startPositions=ao(t.state),n.setFixedDirection=b,m(ft(f,d)/ft(d,p)),b([-o[0],-o[1]]);var y=co(t,e,Bn(Bn({direction:o,set:function(t){n.startValue=t},setRatio:m,setFixedDirection:b},bi(e)),{dragStart:ai.dragStart(t,(new Un).dragStart([0,0],e))}));return!1!==fo(t,"onScaleStart",y)&&(n.isScale=!0,t.state.snapRenderInfo={request:e.isRequest,direction:o}),!!n.isScale&&y},dragControl:function(t,e){li(e,"scale");var n=e.datas,r=e.parentKeepRatio,i=e.parentFlag,o=e.isPinch,a=e.dragClient,s=e.isRequest,c=n.prevDist,l=n.direction,u=n.startOffsetWidth,f=n.startOffsetHeight,d=n.isScale,p=n.startValue,h=n.isWidth,v=n.ratio;if(!d)return!1;var g=t.props,m=g.throttleScale,b=g.parentMoveable,y=l;l[0]||l[1]||(y=[1,1]);var x=v&&(null!=r?r:g.keepRatio)||!1,E=t.state;function S(){var t=Ro(y,x,n,e),r=t.distWidth,i=t.distHeight,o=(u+r)/u,a=(f+i)/f;return o=y[0]||x?o*p[0]:p[0],a=y[1]||x?a*p[1]:p[1],0===o&&(o=(c[0]>0?1:-1)*Yn),0===a&&(a=(c[1]>0?1:-1)*Yn),[o,a]}var C=S();if(!o&&t.props.groupable){var w=(E.snapRenderInfo||{}).direction;A(w)&&(w[0]||w[1])&&(E.snapRenderInfo={direction:l,request:e.isRequest})}fo(t,"onBeforeScale",co(t,e,{scale:C,setFixedDirection:function(t){return n.setFixedDirection(t),C=S()},setScale:function(t){C=t}},!0));var D=[C[0]/p[0],C[1]/p[1]],M=a,R=[0,0];if(a||(M=!i&&o?Oi(t,[0,0]):n.fixedPosition),o||(R=ni(t,D,l,s,n)),x){y[0]&&y[1]&&R[0]&&R[1]&&(Math.abs(R[0]*u)>Math.abs(R[1]*f)?R[1]=0:R[0]=0);var O=!R[0]&&!R[1];if(O&&(h?D[0]=dt(D[0]*p[0],m)/p[0]:D[1]=dt(D[1]*p[1],m)/p[1]),y[0]&&!y[1]||R[0]&&!R[1]||O&&h){D[0]+=R[0];var P=u*D[0]*p[0]/v;D[1]=P/f/p[1]}else if(!y[0]&&y[1]||!R[0]&&R[1]||O&&!h){D[1]+=R[1];var _=f*D[1]*p[1]*v;D[0]=_/u/p[0]}}else D[0]+=R[0],D[1]+=R[1],R[0]||(D[0]=dt(D[0]*p[0],m)/p[0]),R[1]||(D[1]=dt(D[1]*p[1],m)/p[1]);0===D[0]&&(D[0]=(c[0]>0?1:-1)*Yn),0===D[1]&&(D[1]=(c[1]>0?1:-1)*Yn);var B,k,T=[D[0]/c[0],D[1]/c[1]];k=p,C=[(B=D)[0]*k[0],B[1]*k[1]];var z=function(t,e,n,r,i){return wi(t,"scale(".concat(e.join(", "),")"),n,r,i)}(t,D,n.fixedDirection,M,n),j=xe(z,n.prevInverseDist||[0,0]);if(n.prevDist=D,n.prevInverseDist=z,C[0]===c[0]&&C[1]===c[1]&&j.every((function(t){return!t}))&&!b)return!1;var G=ui(n,"scale(".concat(C.join(", "),")"),"scale(".concat(D.join(", "),")")),I=co(t,e,Bn({offsetWidth:u,offsetHeight:f,direction:l,scale:C,dist:D,delta:T,isPinch:!!o},Ci(t,G,j,o,e)));return fo(t,"onScale",I),I},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isScale&&(n.isScale=!1,fo(t,"onScaleEnd",lo(t,e,{})),r)},dragGroupControlCondition:So,dragGroupControlStart:function(t,e){var n=e.datas,r=this.dragControlStart(t,e);if(!r)return!1;var i=Jn(t,"resizable",e);function o(e,r){var i=n.fixedDirection,o=n.fixedPosition,a=gi(r.datas.startPositions||ao(e.state),i),s=Se(_e(-t.rotation/180*Math.PI,3),[a[0]-o[0],a[1]-o[1],1],3),c=s[0],l=s[1];return r.datas.originalX=c,r.datas.originalY=l,r}n.moveableScale=t.scale;var a=Qn(t,this,"dragControlStart",e,(function(t,e){return o(t,e)})),s=function(t){r.setFixedDirection(t),a.forEach((function(e,n){e.setFixedDirection(t),o(e.moveable,i[n])}))};n.setFixedDirection=s;var c=Bn(Bn({},r),{targets:t.props.targets,events:a,setFixedDirection:s}),l=fo(t,"onScaleGroupStart",c);return n.isScale=!1!==l,!!n.isScale&&c},dragGroupControl:function(t,e){var n=e.datas;if(n.isScale){uo(t,"onBeforeScale",(function(n){fo(t,"onBeforeScaleGroup",co(t,e,Bn(Bn({},n),{targets:t.props.targets}),!0))}));var r=this.dragControl(t,e);if(r){var i=n.moveableScale;t.scale=[r.scale[0]*i[0],r.scale[1]*i[1]];var o=t.props.keepRatio,a=r.dist,s=r.scale,c=n.fixedPosition,l=Qn(t,this,"dragControl",e,(function(e,n){var r=Se(_e(t.rotation/180*Math.PI,3),[n.datas.originalX*a[0],n.datas.originalY*a[1],1],3),i=r[0],l=r[1];return Bn(Bn({},n),{parentDist:null,parentScale:s,parentKeepRatio:o,dragClient:ye(c,[i,l])})})),u=Bn({targets:t.props.targets,events:l},r);return fo(t,"onScaleGroup",u),u}}},dragGroupControlEnd:function(t,e){var n=e.isDrag;if(e.datas.isScale){this.dragControlEnd(t,e);var r=Qn(t,this,"dragControlEnd",e);return fo(t,"onScaleGroupEnd",lo(t,e,{targets:t.props.targets,events:r})),n}},request:function(){var t={},e=0,n=0;return{isControl:!0,requestStart:function(e){return{datas:t,parentDirection:e.direction||[1,1]}},request:function(r){return e+=r.deltaWidth,n+=r.deltaHeight,{datas:t,parentDist:[e,n],parentKeepRatio:r.keepRatio}},requestEnd:function(){return{datas:t,isDrag:!0}}}}};function Bo(t,e){return t.map((function(t,n){return r=t,i=e[n],(r*(a=2)+i*(o=1))/(o+a);var r,i,o,a}))}function ko(t,e,n){var r=lt(t,e),i=lt(t,n)-r;return i>=0?i:i+2*Math.PI}var To={name:"warpable",ableGroup:"size",props:{warpable:Boolean,renderDirections:Array},events:{onWarpStart:"warpStart",onWarp:"warp",onWarpEnd:"warpEnd"},render:function(t,e){var n=t.props,r=n.resizable,i=n.scalable,o=n.warpable,a=n.zoom;if(r||i||!o)return[];var s=t.state,c=s.pos1,l=s.pos2,u=s.pos3,f=s.pos4,d=Bo(c,l),p=Bo(l,c),h=Bo(c,u),v=Bo(u,c),g=Bo(u,f),m=Bo(f,u),b=Bo(l,f),y=Bo(f,l);return kn([e.createElement("div",{className:Pi("line"),key:"middeLine1",style:Zi(d,g,a)}),e.createElement("div",{className:Pi("line"),key:"middeLine2",style:Zi(p,m,a)}),e.createElement("div",{className:Pi("line"),key:"middeLine3",style:Zi(h,b,a)}),e.createElement("div",{className:Pi("line"),key:"middeLine4",style:Zi(v,y,a)})],nr(t,e),!0)},dragControlCondition:function(t,e){return!e.isRequest&&ht(e.inputEvent.target,Pi("direction"))},dragControlStart:function(t,e){var n=e.datas,r=e.inputEvent,i=t.props.target,o=io(r.target);if(!o||!i)return!1;var a=t.state,s=a.transformOrigin,c=a.is3d,l=a.targetTransform,u=a.targetMatrix,f=a.width,d=a.height,p=a.left,h=a.top;return n.datas={},n.targetTransform=l,n.warpTargetMatrix=c?u:ge(u,3,4),n.targetInverseMatrix=pe(he(n.warpTargetMatrix,4),3,4),n.direction=o,n.left=p,n.top=h,n.poses=[[0,0],[f,0],[0,d],[f,d]].map((function(t){return xe(t,s)})),n.nextPoses=n.poses.map((function(t){var e=t[0],r=t[1];return Se(n.warpTargetMatrix,[e,r,0,1],4)})),n.startValue=Be(4),n.prevMatrix=Be(4),n.absolutePoses=ao(a),n.posIndexes=hi(o),ci(t,e),yi(e,"matrix3d"),a.snapRenderInfo={request:e.isRequest,direction:o},!1!==fo(t,"onWarpStart",co(t,e,Bn({set:function(t){n.startValue=t}},bi(e))))&&(n.isWarp=!0),n.isWarp},dragControl:function(t,e){var n=e.datas,r=e.isRequest,i=e.distX,o=e.distY,a=n.targetInverseMatrix,s=n.prevMatrix,c=n.isWarp,l=n.startValue,u=n.poses,f=n.posIndexes,d=n.absolutePoses;if(!c)return!1;if(li(e,"matrix3d"),hr(t,"warpable")){var p=f.map((function(t){return d[t]}));p.length>1&&p.push([(p[0][0]+p[1][0])/2,(p[0][1]+p[1][1])/2]);var h=$r(t,r,{horizontal:p.map((function(t){return t[1]+o})),vertical:p.map((function(t){return t[0]+i}))}),v=h.horizontal,g=h.vertical;o-=v.offset,i-=g.offset}var m=pi({datas:n,distX:i,distY:o},!0),b=n.nextPoses.slice();if(f.forEach((function(t){b[t]=ye(b[t],m)})),!An.every((function(t){return e=t.map((function(t){return u[t]})),n=t.map((function(t){return b[t]})),r=ko(e[0],e[1],e[2]),i=ko(n[0],n[1],n[2]),o=Math.PI,!(r>=o&&i<=o||r<=o&&i>=o);var e,n,r,i,o})))return!1;var y=ze(u[0],u[2],u[1],u[3],b[0],b[2],b[1],b[3]);if(!y.length)return!1;var x=fi(n,be(a,y,4),!0),E=be(he(s,4),x,4);n.prevMatrix=x;var S=be(l,x,4),C=ui(n,"matrix3d(".concat(S.join(", "),")"),"matrix3d(".concat(x.join(", "),")"));return Ei(e,C),fo(t,"onWarp",co(t,e,{delta:E,matrix:S,dist:x,multiply:be,transform:C})),!0},dragControlEnd:function(t,e){var n=e.datas,r=e.isDrag;return!!n.isWarp&&(n.isWarp=!1,fo(t,"onWarpEnd",lo(t,e,{})),r)}},zo=Pi("area-pieces"),jo=Pi("area-piece"),Go=Pi("avoid");function Io(t){var e=t.areaElement;if(e){var n=t.state,r=n.width,i=n.height;!function(t,e){if(t.classList)t.classList.remove(e);else{var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")}}(e,Go),e.style.cssText+="left: 0px; top: 0px; width: ".concat(r,"px; height: ").concat(i,"px")}}function No(t){return t.createElement("div",{key:"area_pieces",className:zo},t.createElement("div",{className:jo}),t.createElement("div",{className:jo}),t.createElement("div",{className:jo}),t.createElement("div",{className:jo}))}var Fo={name:"dragArea",props:{dragArea:Boolean,passDragArea:Boolean},events:{onClick:"click",onClickGroup:"clickGroup"},render:function(t,e){var n=t.props,r=n.target,i=n.dragArea,o=n.groupable,a=n.passDragArea,s=t.state,c=s.width,l=s.height,u=s.renderPoses,f=a?Pi("area","pass"):Pi("area");if(o)return[e.createElement("div",{key:"area",ref:S(t,"areaElement"),className:f}),No(e)];if(!r||!i)return[];var d=ze([0,0],[c,0],[0,l],[c,l],u[0],u[1],u[2],u[3]),p=d.length?Yi(d,!0):"none";return[e.createElement("div",{key:"area",ref:S(t,"areaElement"),className:f,style:{top:"0px",left:"0px",width:"".concat(c,"px"),height:"".concat(l,"px"),transformOrigin:"0 0",transform:p}}),No(e)]},dragStart:function(t,e){var n=e.datas,r=e.clientX,i=e.clientY;if(!e.inputEvent)return!1;n.isDragArea=!1;var o=t.areaElement,a=t.state,s=a.moveableClientRect,c=a.renderPoses,l=a.rootMatrix,u=a.is3d,f=s.left,d=s.top,p=Vi(c),h=p.left,v=p.top,g=p.width,m=p.height,b=mo(l,[r-f,i-d],u?4:3),y=b[0],x=b[1],E=[{left:h,top:v,width:g,height:(x-=v)-10},{left:h,top:v,width:(y-=h)-10,height:m},{left:h,top:v+x+10,width:g,height:m-x-10},{left:h+y+10,top:v,width:g-y-10,height:m}],S=[].slice.call(o.nextElementSibling.children);E.forEach((function(t,e){S[e].style.cssText="left: ".concat(t.left,"px;top: ").concat(t.top,"px; width: ").concat(t.width,"px; height: ").concat(t.height,"px;")})),vt(o,Go),a.disableNativeEvent=!0},drag:function(t,e){var n=e.datas,r=e.inputEvent;if(this.enableNativeEvent(t),!r)return!1;n.isDragArea||(n.isDragArea=!0,Io(t))},dragEnd:function(t,e){this.enableNativeEvent(t);var n=e.inputEvent,r=e.datas;if(!n)return!1;r.isDragArea||Io(t)},dragGroupStart:function(t,e){return this.dragStart(t,e)},dragGroup:function(t,e){return this.drag(t,e)},dragGroupEnd:function(t,e){return this.dragEnd(t,e)},unset:function(t){Io(t),t.state.disableNativeEvent=!1},enableNativeEvent:function(t){var e=t.state;e.disableNativeEvent&&et((function(){e.disableNativeEvent=!1}))}},Ao=Tn("origin",{render:function(t,e){var n=t.props.zoom,r=t.state,i=r.beforeOrigin,o=r.rotation;return[e.createElement("div",{className:Pi("control","origin"),style:Qi(o,n,i),key:"beforeOrigin"})]}});function Lo(t){var e=t.scrollContainer;return[e.scrollLeft,e.scrollTop]}var Yo={name:"scrollable",canPinch:!0,props:{scrollable:Boolean,scrollContainer:Object,scrollThreshold:Number,getScrollPosition:Function},events:{onScroll:"scroll",onScrollGroup:"scrollGroup"},dragRelation:"strong",dragStart:function(t,e){var n=t.props.scrollContainer,r=void 0===n?t.getContainer():n,i=new an,o=wo(r,!0);e.datas.dragScroll=i;var a=e.isControl?"controlGesto":"targetGesto",s=e.targets;i.on("scroll",(function(n){var r=n.container,i=n.direction,o=co(t,e,{scrollContainer:r,direction:i}),a=s?"onScrollGroup":"onScroll";s&&(o.targets=s),fo(t,a,o)})).on("move",(function(n){var r=n.offsetX,i=n.offsetY;t[a].scrollBy(r,i,e.inputEvent,!1)})),i.dragStart(e,{container:o})},checkScroll:function(t,e){var n=e.datas.dragScroll;if(n){var r=t.props,i=r.scrollContainer,o=void 0===i?t.getContainer():i,a=r.scrollThreshold,s=void 0===a?0:a,c=r.getScrollPosition,l=void 0===c?Lo:c;return n.drag(e,{container:o,threshold:s,getScrollPosition:function(t){return l({scrollContainer:t.container,direction:t.direction})}}),!0}},drag:function(t,e){return this.checkScroll(t,e)},dragEnd:function(t,e){e.datas.dragScroll.dragEnd(),e.datas.dragScroll=null},dragControlStart:function(t,e){return this.dragStart(t,Bn(Bn({},e),{isControl:!0}))},dragControl:function(t,e){return this.drag(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupStart:function(t,e){return this.dragStart(t,Bn(Bn({},e),{targets:t.props.targets}))},dragGroup:function(t,e){return this.drag(t,Bn(Bn({},e),{targets:t.props.targets}))},dragGroupEnd:function(t,e){return this.dragEnd(t,Bn(Bn({},e),{targets:t.props.targets}))},dragGroupControlStart:function(t,e){return this.dragStart(t,Bn(Bn({},e),{targets:t.props.targets,isControl:!0}))},dragGroupContro:function(t,e){return this.drag(t,Bn(Bn({},e),{targets:t.props.targets}))},dragGroupControEnd:function(t,e){return this.dragEnd(t,Bn(Bn({},e),{targets:t.props.targets}))}},Xo={name:"",props:{target:Object,dragTarget:Object,container:Object,portalContainer:Object,rootContainer:Object,useResizeObserver:Boolean,zoom:Number,transformOrigin:Array,edge:Boolean,ables:Array,className:String,pinchThreshold:Number,pinchOutside:Boolean,triggerAblesSimultaneously:Boolean,checkInput:Boolean,cspNonce:String,translateZ:Number,hideDefaultLines:Boolean,props:Object},events:{}},Wo=Tn("padding",{render:function(t,e){var n=t.props;if(n.dragArea)return[];var r=n.padding||{},i=r.left,o=void 0===i?0:i,a=r.top,s=void 0===a?0:a,c=r.right,l=void 0===c?0:c,u=r.bottom,f=void 0===u?0:u,d=t.state,p=d.renderPoses,h=[d.pos1,d.pos2,d.pos3,d.pos4],v=[];return o>0&&v.push([0,2]),s>0&&v.push([0,1]),l>0&&v.push([1,3]),f>0&&v.push([2,3]),v.map((function(t,n){var r=t[0],i=t[1],o=ze([0,0],[100,0],[0,100],[100,100],h[r],h[i],p[r],p[i]);if(o.length)return e.createElement("div",{key:"padding".concat(n),className:Pi("padding"),style:{transform:Yi(o,!0)}})}))}}),qo=["nw","ne","se","sw"];function Ho(t,e){var n=t[0]+t[1],r=n>e?e/n:1;return t[0]*=r,t[1]=e-t[1]*r,t}var Vo=[1,2,5,6],$o=[0,3,4,7],Ko=[1,-1,-1,1],Uo=[1,1,-1,-1];function Jo(t,e,n,r,i,o,a,s,c){void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=r),void 0===c&&(c=i);var l=[],u=!1,f=t.map((function(t,f){var d=e[f],p=d.horizontal,h=d.vertical;if(h&&!u&&(u=!0,l.push("/")),u){var v=Math.max(0,1===h?t[1]-a:c-t[1]);return l.push(xo(v,i,n)),v}v=Math.max(0,1===p?t[0]-o:s-t[0]);return l.push(xo(v,r,n)),v}));return{styles:l,raws:f}}function Zo(t){for(var e=[0,0],n=[0,0],r=t.length,i=0;i<r;++i){var o=t[i];o.sub&&(o.horizontal&&(0===e[1]&&(e[0]=i),e[1]=i-e[0]+1,n[0]=i+1),o.vertical&&(0===n[1]&&(n[0]=i),n[1]=i-n[0]+1))}return{horizontalRange:e,verticalRange:n}}function Qo(t,e,n,r,i,o){var a,s,c,l;void 0===o&&(o=[0,0]);var u=t.indexOf("/"),f=(u>-1?t.slice(0,u):t).length,d=t.slice(0,f),p=t.slice(f+1),h=d[0],v=void 0===h?"0px":h,g=d[1],m=void 0===g?v:g,b=d[2],y=void 0===b?v:b,x=d[3],E=void 0===x?m:x,S=p[0],C=void 0===S?v:S,w=p[1],D=void 0===w?C:w,M=p[2],R=void 0===M?C:M,O=p[3],P=void 0===O?D:O,_=[v,m,y,E].map((function(t){return it(t,e)})),B=[C,D,R,P].map((function(t){return it(t,n)})),k=_.slice(),T=B.slice();a=Ho([k[0],k[1]],e),k[0]=a[0],k[1]=a[1],s=Ho([k[3],k[2]],e),k[3]=s[0],k[2]=s[1],c=Ho([T[0],T[3]],n),T[0]=c[0],T[3]=c[1],l=Ho([T[1],T[2]],n),T[1]=l[0],T[2]=l[1];var z=k.slice(0,Math.max(o[0],d.length)),j=T.slice(0,Math.max(o[1],p.length));return kn(kn([],z.map((function(t,e){var o=qo[e];return{horizontal:Ko[e],vertical:0,pos:[r+t,i+(-1===Uo[e]?n:0)],sub:!0,raw:_[e],direction:o}})),!0),j.map((function(t,n){var o=qo[n];return{horizontal:0,vertical:Uo[n],pos:[r+(-1===Ko[n]?e:0),i+t],sub:!0,raw:B[n],direction:o}})),!0)}function ta(t,e,n,r,i){void 0===i&&(i=e.length);var o=Zo(t.slice(r)),a=o.horizontalRange,s=o.verticalRange,c=n-r,l=0;if(0===c)l=i;else if(c>0&&c<a[1])l=a[1]-c;else{if(!(c>=s[0]))return;l=s[0]+s[1]-c}t.splice(n,l),e.splice(n,l)}function ea(t,e,n,r,i,o,a,s,c,l,u){void 0===l&&(l=0),void 0===u&&(u=0);var f=Zo(t.slice(n)),d=f.horizontalRange,p=f.verticalRange;if(r>-1)for(var h=1===Ko[r]?o-l:s-o,v=d[1];v<=r;++v){var g=1===Uo[v]?u:c,m=0;if(r===v?m=o:0===v?m=l+h:-1===Ko[v]&&(m=s-(e[n][0]-l)),t.splice(n+v,0,{horizontal:Ko[v],vertical:0,pos:[m,g]}),e.splice(n+v,0,[m,g]),0===v)break}else if(i>-1){var b=1===Uo[i]?a-u:c-a;if(0===d[1]&&0===p[1]){var y=[l+b,u];t.push({horizontal:Ko[0],vertical:0,pos:y}),e.push(y)}var x=p[0];for(v=p[1];v<=i;++v){m=1===Ko[v]?l:s,g=0;if(i===v?g=a:0===v?g=u+b:1===Uo[v]?g=e[n+x][1]:-1===Uo[v]&&(g=c-(e[n+x][1]-u)),t.push({horizontal:0,vertical:Uo[v],pos:[m,g]}),e.push([m,g]),0===v)break}}}function na(t,e){return void 0===e&&(e=t.map((function(t){return t.raw}))),{horizontals:t.map((function(t,n){return t.horizontal?e[n]:null})).filter((function(t){return null!=t})),verticals:t.map((function(t,n){return t.vertical?e[n]:null})).filter((function(t){return null!=t}))}}var ra=[[0,-1,"n"],[1,0,"e"]],ia=[[-1,-1,"nw"],[0,-1,"n"],[1,-1,"ne"],[1,0,"e"],[1,1,"se"],[0,1,"s"],[-1,1,"sw"],[-1,0,"w"]];function oa(t,e,n){var r=t.props.clipRelative,i=t.state,o=i.width,a=i.height,s=e,c=s.type,l=s.poses,u="rect"===c,f="circle"===c;if("polygon"===c)return n.map((function(t){return"".concat(xo(t[0],o,r)," ").concat(xo(t[1],a,r))}));if(u||"inset"===c){var d=n[1][1],p=n[3][0],h=n[7][0],v=n[5][1];if(u)return[d,p,v,h].map((function(t){return"".concat(t,"px")}));var g=[d,o-p,a-v,h].map((function(t,e){return xo(t,e%2?o:a,r)}));if(n.length>8){var m=xe(n[4],n[0]),b=m[0],y=m[1];g.push.apply(g,kn(["round"],Jo(n.slice(8),l.slice(8),r,b,y,h,d,p,v).styles,!1))}return g}if(f||"ellipse"===c){var x=n[0],E=xo(Math.abs(n[1][1]-x[1]),f?Math.sqrt((o*o+a*a)/2):a,r);return(g=f?[E]:[xo(Math.abs(n[2][0]-x[0]),o,r),E]).push("at",xo(x[0],o,r),xo(x[1],a,r)),g}}function aa(t,e,n,r){var i=[r,(r+e)/2,e],o=[t,(t+n)/2,n];return ia.map((function(t){var e=t[0],n=t[1],r=t[2],a=i[e+1],s=o[n+1];return{vertical:Math.abs(n),horizontal:Math.abs(e),direction:r,pos:[a,s]}}))}function sa(t,e,n,r,i){var o,a,s,c,l,u,f,d=i;if(!d){var p=po(t),h=p.clipPath;d="none"!==h?h:p.clip}if(d&&"none"!==d&&"auto"!==d||(d=r)){var v=$(d),g=v.prefix,m=void 0===g?d:g,b=v.value,y=void 0===b?"":b,x="circle"===m,E=" ";if("polygon"===m){E=",";var S=(R=V(y||"0% 0%, 100% 0%, 100% 100%, 0% 100%")).map((function(t){var r=t.split(" "),i=r[0],o=r[1];return{vertical:1,horizontal:1,pos:[it(i,e),it(o,n)]}}));return{type:m,clipText:d,poses:S,splitter:E}}if(x||"ellipse"===m){var C="",w="",D=0,M=0,R=H(y);if(x){var O;O=void 0===(o=R[0])?"50%":o,C=void 0===(a=R[2])?"50%":a,w=void 0===(s=R[3])?"50%":s,D=it(O,Math.sqrt((e*e+n*n)/2)),M=D}else{var P,_;P=void 0===(c=R[0])?"50%":c,_=void 0===(l=R[1])?"50%":l,C=void 0===(u=R[3])?"50%":u,w=void 0===(f=R[4])?"50%":f,D=it(P,e),M=it(_,n)}var B=[it(C,e),it(w,n)];S=kn([{vertical:1,horizontal:1,pos:B,direction:"nesw"}],ra.slice(0,x?1:2).map((function(t){return{vertical:Math.abs(t[1]),horizontal:t[0],direction:t[2],sub:!0,pos:[B[0]+t[0]*D,B[1]+t[1]*M]}})),!0);return{type:m,clipText:d,radiusX:D,radiusY:M,left:B[0]-D,top:B[1]-M,poses:S,splitter:E}}if("inset"===m){var k=(R=H(y||"0 0 0 0")).indexOf("round"),T=(k>-1?R.slice(0,k):R).length,z=R.slice(T+1),j=R.slice(0,T),G=j[0],I=j[1],N=void 0===I?G:I,F=j[2],A=void 0===F?G:F,L=j[3],Y=void 0===L?N:L,X=[G,A].map((function(t){return it(t,n)})),W=X[0],q=X[1],U=[Y,N].map((function(t){return it(t,e)})),J=U[0],Z=U[1],Q=e-Z,tt=n-q,et=Qo(z,Q-J,tt-W,J,W);return{type:"inset",clipText:d,poses:S=kn(kn([],aa(W,Q,tt,J),!0),et,!0),top:W,left:J,right:Q,bottom:tt,radius:z,splitter:E}}if("rect"===m){E=",";var nt=(R=V(y||"0px, ".concat(e,"px, ").concat(n,"px, 0px"))).map((function(t){return K(t).value}));return{type:"rect",clipText:d,poses:S=aa(W=nt[0],Z=nt[1],q=nt[2],J=nt[3]),top:W,right:Z,bottom:q,left:J,values:R,splitter:E}}}}var ca={name:"clippable",props:{clippable:Boolean,defaultClipPath:String,customClipPath:String,clipRelative:Boolean,clipArea:Boolean,dragWithClip:Boolean,clipTargetBounds:Boolean,clipVerticalGuidelines:Array,clipHorizontalGuidelines:Array,clipSnapThreshold:Boolean},events:{onClipStart:"clipStart",onClip:"clip",onClipEnd:"clipEnd"},css:[".control.clip-control {\n    background: #6d6;\n    cursor: pointer;\n}\n.control.clip-control.clip-radius {\n    background: #d66;\n}\n.line.clip-line {\n    background: #6e6;\n    cursor: move;\n    z-index: 1;\n}\n.clip-area {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n.clip-ellipse {\n    position: absolute;\n    cursor: move;\n    border: 1px solid #6d6;\n    border: var(--zoompx) solid #6d6;\n    border-radius: 50%;\n    transform-origin: 0px 0px;\n}",":host {\n    --bounds-color: #d66;\n}",".guideline {\n    pointer-events: none;\n    z-index: 2;\n}",".line.guideline.bounds {\n    background: #d66;\n    background: var(--bounds-color);\n}"],render:function(t,e){var n=t.props,r=n.customClipPath,i=n.defaultClipPath,o=n.clipArea,a=n.zoom,s=t.state,c=s.target,l=s.width,u=s.height,f=s.allMatrix,d=s.is3d,p=s.left,h=s.top,v=s.pos1,g=s.pos2,m=s.pos3,b=s.pos4,y=s.clipPathState,x=s.snapBoundInfos,E=s.rotation;if(!c)return[];var S=sa(c,l,u,i||"inset",y||r);if(!S)return[];var C=d?4:3,w=S.type,D=S.poses.map((function(t){var e=qi(f,t.pos,C);return[e[0]-p,e[1]-h]})),M=[],R=[],O="rect"===w,P="inset"===w,_="polygon"===w;if(O||P||_){var B=P?D.slice(0,8):D;R=B.map((function(t,n){var r=0===n?B[B.length-1]:B[n-1],i=lt(r,t),o=Ji(r,t);return e.createElement("div",{key:"clipLine".concat(n),className:Pi("line","clip-line","snap-control"),"data-clip-index":n,style:{width:"".concat(o,"px"),transform:"translate(".concat(r[0],"px, ").concat(r[1],"px) rotate(").concat(i,"rad) scaleY(").concat(a,")")}})}))}if(M=D.map((function(t,n){return e.createElement("div",{key:"clipControl".concat(n),className:Pi("control","clip-control","snap-control"),"data-clip-index":n,style:{transform:"translate(".concat(t[0],"px, ").concat(t[1],"px) rotate(").concat(E,"rad) scale(").concat(a,")")}})})),P&&M.push.apply(M,D.slice(8).map((function(t,n){return e.createElement("div",{key:"clipRadiusControl".concat(n),className:Pi("control","clip-control","clip-radius","snap-control"),"data-clip-index":8+n,style:{transform:"translate(".concat(t[0],"px, ").concat(t[1],"px) rotate(").concat(E,"rad) scale(").concat(a,")")}})}))),"circle"===w||"ellipse"===w){var k=S.left,T=S.top,z=S.radiusX,j=S.radiusY,G=xe(qi(f,[k,T],C),qi(f,[0,0],C)),I=G[0],N=G[1],F="none";if(!o){for(var A=Math.max(10,z/5,j/5),L=[],Y=0;Y<=A;++Y){var X=2*Math.PI/A*Y;L.push([z+(z-a)*Math.cos(X),j+(j-a)*Math.sin(X)])}L.push([z,-2]),L.push([-2,-2]),L.push([-2,2*j+2]),L.push([2*z+2,2*j+2]),L.push([2*z+2,-2]),L.push([z,-2]),F="polygon(".concat(L.map((function(t){return"".concat(t[0],"px ").concat(t[1],"px")})).join(", "),")")}M.push(e.createElement("div",{key:"clipEllipse",className:Pi("clip-ellipse","snap-control"),style:{width:"".concat(2*z,"px"),height:"".concat(2*j,"px"),clipPath:F,transform:"translate(".concat(-p+I,"px, ").concat(-h+N,"px) ").concat(Yi(f))}}))}if(o){var W=Vi(kn([v,g,m,b],D,!0)),q=W.width,H=W.height,V=W.left,$=W.top;if(_||O||P){L=P?D.slice(0,8):D;M.push(e.createElement("div",{key:"clipArea",className:Pi("clip-area","snap-control"),style:{width:"".concat(q,"px"),height:"".concat(H,"px"),transform:"translate(".concat(V,"px, ").concat($,"px)"),clipPath:"polygon(".concat(L.map((function(t){return"".concat(t[0]-V,"px ").concat(t[1]-$,"px")})).join(", "),")")}}))}}return x&&["vertical","horizontal"].forEach((function(t){var n=x[t],r="horizontal"===t;n.isSnap&&R.push.apply(R,n.snap.posInfos.map((function(n,i){var o=n.pos,s=xe(qi(f,r?[0,o]:[o,0],C),[p,h]),c=xe(qi(f,r?[l,o]:[o,u],C),[p,h]);return er(e,"",s,c,a,"clip".concat(t,"snap").concat(i),"guideline")}))),n.isBound&&R.push.apply(R,n.bounds.map((function(n,i){var o=n.pos,s=xe(qi(f,r?[0,o]:[o,0],C),[p,h]),c=xe(qi(f,r?[l,o]:[o,u],C),[p,h]);return er(e,"",s,c,a,"clip".concat(t,"bounds").concat(i),"guideline","bounds","bold")})))})),kn(kn([],M,!0),R,!0)},dragControlCondition:function(t,e){return e.inputEvent&&(e.inputEvent.target.getAttribute("class")||"").indexOf("clip")>-1},dragStart:function(t,e){var n=t.props.dragWithClip;return!(void 0===n||n)&&this.dragControlStart(t,e)},drag:function(t,e){return this.dragControl(t,Bn(Bn({},e),{isDragTarget:!0}))},dragEnd:function(t,e){return this.dragControlEnd(t,e)},dragControlStart:function(t,e){var n=t.state,r=t.props,i=r.defaultClipPath,o=r.customClipPath,a=n.target,s=n.width,c=n.height,l=e.inputEvent?e.inputEvent.target:null,u=l&&l.getAttribute("class")||"",f=e.datas,d=sa(a,s,c,i||"inset",o);if(!d)return!1;var p=d.clipText;return!1===fo(t,"onClipStart",co(t,e,{clipType:d.type,clipStyle:p,poses:d.poses.map((function(t){return t.pos}))}))?(f.isClipStart=!1,!1):(f.isControl=u&&u.indexOf("clip-control")>-1,f.isLine=u.indexOf("clip-line")>-1,f.isArea=u.indexOf("clip-area")>-1||u.indexOf("clip-ellipse")>-1,f.index=l?parseInt(l.getAttribute("data-clip-index"),10):-1,f.clipPath=d,f.isClipStart=!0,n.clipPathState=p,ci(t,e),!0)},dragControl:function(t,e){var n,r=e.datas,i=e.originalDatas,o=e.isDragTarget;if(!r.isClipStart)return!1;var a=r,s=a.isControl,c=a.isLine,l=a.isArea,u=a.index,f=a.clipPath;if(!f)return!1;var d=0,p=0,h=i.draggable,v=pi(e);o&&h?(n=h.prevBeforeDist,d=n[0],p=n[1]):(d=v[0],p=v[1]);var g=[d,p],m=t.props,b=t.state,y=b.width,x=b.height,E=!l&&!s&&!c,S=f.type,C=f.poses,w=f.splitter,D=C.map((function(t){return t.pos}));E&&(d=-d,p=-p);var M=!s||"nesw"===C[u].direction,R="inset"===S||"rect"===S,O=C.map((function(){return[0,0]}));if(s&&!M){var P=C[u],_=P.horizontal,B=P.vertical,k=[d*Math.abs(_),p*Math.abs(B)];O=function(t,e,n,r){var i=t[e],o=i.direction,a=i.sub,s=t.map((function(){return[0,0]})),c=o?o.split(""):[];if(r&&e<8){var l=c.filter((function(t){return"w"===t||"e"===t}))[0],u=c.filter((function(t){return"n"===t||"s"===t}))[0];s[e]=n,t.forEach((function(t,e){var r=t.direction;r&&(r.indexOf(l)>-1&&(s[e][0]=n[0]),r.indexOf(u)>-1&&(s[e][1]=n[1]))})),l&&(s[1][0]=n[0]/2,s[5][0]=n[0]/2),u&&(s[3][1]=n[1]/2,s[7][1]=n[1]/2)}else o&&!a?c.forEach((function(e){var r="n"===e||"s"===e;t.forEach((function(t,i){var o=t.direction,a=t.horizontal,c=t.vertical;o&&-1!==o.indexOf(e)&&(s[i]=[r||!a?0:n[0],r&&c?n[1]:0])}))})):s[e]=n;return s}(C,u,k,R)}else M&&(O=D.map((function(){return[d,p]})));var T=D.map((function(t,e){return ye(t,O[e])})),z=kn([],T,!0);b.snapBoundInfos=null;var j="circle"===f.type,G="ellipse"===f.type;if(j||G){var I=Vi(T),N=Math.abs(I.bottom-I.top),F=Math.abs(G?I.right-I.left:N),A=T[0][1]+N,L=T[0][0]-F,Y=T[0][0]+F;j&&(z.push([Y,I.bottom]),O.push([1,0])),z.push([I.left,A]),O.push([0,1]),z.push([L,I.bottom]),O.push([1,0])}var X=mr((m.clipHorizontalGuidelines||[]).map((function(t){return it("".concat(t),x)})),(m.clipVerticalGuidelines||[]).map((function(t){return it("".concat(t),y)})),y,x),W=[],q=[];if(j||G)W=[z[4][0],z[2][0]],q=[z[1][1],z[3][1]];else if(R){var H=[z[0],z[2],z[4],z[6]],V=[O[0],O[2],O[4],O[6]];W=H.filter((function(t,e){return V[e][0]})).map((function(t){return t[0]})),q=H.filter((function(t,e){return V[e][1]})).map((function(t){return t[1]}))}else W=z.filter((function(t,e){return O[e][0]})).map((function(t){return t[0]})),q=z.filter((function(t,e){return O[e][1]})).map((function(t){return t[1]}));for(var $=[0,0],K=function(t){var e=Kr(X,m.clipTargetBounds&&{left:0,top:0,right:y,bottom:x},W,q,5),n=e.horizontal,r=e.vertical,i=n.offset,o=r.offset;if(n.isBound&&($[1]+=i),r.isBound&&($[0]+=o),!G&&!j||0!==O[0][0]||0!==O[0][1])return z.forEach((function(t,e){var n=O[e];n[0]&&(t[0]-=o),n[1]&&(t[1]-=i)})),"break";var a=Vi(T),s=a.bottom-a.top,c=G?a.right-a.left:s;c-=r.isBound?Math.abs(o):0===r.snapIndex?-o:o,s-=n.isBound?Math.abs(i):0===n.snapIndex?-i:i,j&&(c=s=Dr(r,n)>0?s:c);var l=z[0];z[1][1]=l[1]-s,z[2][0]=l[0]+c,z[3][1]=l[1]+s,z[4][0]=l[0]-c},U=0;U<2;++U){if("break"===K())break}var J=oa(t,f,T),Z="".concat(S,"(").concat(J.join(w),")");if(b.clipPathState=Z,j||G)W=[z[4][0],z[2][0]],q=[z[1][1],z[3][1]];else if(R){H=[z[0],z[2],z[4],z[6]];W=H.map((function(t){return t[0]})),q=H.map((function(t){return t[1]}))}else W=z.map((function(t){return t[0]})),q=z.map((function(t){return t[1]}));if(b.snapBoundInfos=Kr(X,m.clipTargetBounds&&{left:0,top:0,right:y,bottom:x},W,q,1),h){var Q=b.is3d,tt=b.allMatrix,et=Q?4:3,nt=$;o&&(nt=[g[0]+$[0]-v[0],g[1]+$[1]-v[1]]),h.deltaOffset=be(tt,[nt[0],nt[1],0,0],et)}return fo(t,"onClip",co(t,e,{clipEventType:"changed",clipType:S,poses:T,clipStyle:Z,clipStyles:J,distX:d,distY:p})),!0},dragControlEnd:function(t,e){this.unset(t);var n=e.isDrag,r=e.datas,i=e.isDouble,o=r.isLine,a=r.isClipStart,s=r.isControl;return!!a&&(fo(t,"onClipEnd",lo(t,e,{})),i&&(s?function(t,e){var n=e.datas,r=n.clipPath,i=n.index,o=r,a=o.type,s=o.poses,c=o.splitter,l=s.map((function(t){return t.pos})),u=l.length;if("polygon"===a)s.splice(i,1),l.splice(i,1);else{if("inset"!==a)return;if(i<8)return;if(ta(s,l,i,8,u),u===s.length)return}var f=oa(t,r,l);fo(t,"onClip",co(t,e,{clipEventType:"removed",clipType:a,poses:l,clipStyles:f,clipStyle:"".concat(a,"(").concat(f.join(c),")"),distX:0,distY:0}))}(t,e):o&&function(t,e){var n=si(t,e),r=n[0],i=n[1],o=e.datas,a=o.clipPath,s=o.index,c=a,l=c.type,u=c.poses,f=c.splitter,d=u.map((function(t){return t.pos}));if("polygon"===l)d.splice(s,0,[r,i]);else{if("inset"!==l)return;var p=Vo.indexOf(s),h=$o.indexOf(s),v=u.length;if(ea(u,d,8,p,h,r,i,d[4][0],d[4][1],d[0][0],d[0][1]),v===u.length)return}var g=oa(t,a,d);fo(t,"onClip",co(t,e,{clipEventType:"added",clipType:l,poses:d,clipStyles:g,clipStyle:"".concat(l,"(").concat(g.join(f),")"),distX:0,distY:0}))}(t,e)),i||n)},unset:function(t){t.state.clipPathState="",t.state.snapBoundInfos=null}},la={name:"originDraggable",props:{originDraggable:Boolean,originRelative:Boolean},events:{onDragOriginStart:"dragOriginStart",onDragOrigin:"dragOrigin",onDragOriginEnd:"dragOriginEnd"},css:[":host[data-able-origindraggable] .control.origin {\n    pointer-events: auto;\n}"],dragControlCondition:function(t,e){return e.isRequest?"originDraggable"===e.requestAble:ht(e.inputEvent.target,Pi("origin"))},dragControlStart:function(t,e){var n=e.datas;ci(t,e);var r=co(t,e,{dragStart:ai.dragStart(t,(new Un).dragStart([0,0],e))}),i=fo(t,"onDragOriginStart",r);return n.startOrigin=t.state.transformOrigin,n.startTargetOrigin=t.state.targetOrigin,n.prevOrigin=[0,0],n.isDragOrigin=!0,!1===i?(n.isDragOrigin=!1,!1):r},dragControl:function(t,e){var n=e.datas,r=e.isPinch,i=e.isRequest;if(!n.isDragOrigin)return!1;var o=pi(e),a=o[0],s=o[1],c=t.state,l=c.width,u=c.height,f=c.offsetMatrix,d=c.targetMatrix,p=c.is3d,h=t.props.originRelative,v=void 0===h||h,g=p?4:3,m=[a,s];if(i){var b=e.distOrigin;(b[0]||b[1])&&(m=b)}var y=ye(n.startOrigin,m),x=ye(n.startTargetOrigin,m),E=xe(m,n.prevOrigin),S=mi(f,d,y,g),C=t.getRect(),w=Vi(Hi(S,l,u,g)),D=[C.left-w.left,C.top-w.top];n.prevOrigin=m;var M=co(t,e,{width:l,height:u,origin:y,dist:m,delta:E,transformOrigin:[xo(x[0],l,v),xo(x[1],u,v)].join(" "),drag:ai.drag(t,Kn(e,t.state,D,!!r,!1))});return fo(t,"onDragOrigin",M),M},dragControlEnd:function(t,e){return!!e.datas.isDragOrigin&&(fo(t,"onDragOriginEnd",lo(t,e,{})),!0)},dragGroupControlCondition:function(t,e){return this.dragControlCondition(t,e)},dragGroupControlStart:function(t,e){return!!this.dragControlStart(t,e)},dragGroupControl:function(t,e){var n=this.dragControl(t,e);return!!n&&(t.transformOrigin=n.transformOrigin,!0)},request:function(t){var e={},n=t.getRect(),r=0,i=0,o=n.transformOrigin,a=[0,0];return{isControl:!0,requestStart:function(){return{datas:e}},request:function(t){return"deltaOrigin"in t?(a[0]+=t.deltaOrigin[0],a[1]+=t.deltaOrigin[1]):"origin"in t?(a[0]=t.origin[0]-o[0],a[1]=t.origin[1]-o[1]):("x"in t?r=t.x-n.left:"deltaX"in t&&(r+=t.deltaX),"y"in t?i=t.y-n.top:"deltaY"in t&&(i+=t.deltaY)),{datas:e,distX:r,distY:i,distOrigin:a}},requestEnd:function(){return{datas:e,isDrag:!0}}}}};function ua(t,e,n,r,i){var o;void 0===r&&(r=[0,0]);if(i)o=i;else{var a=po(t);o=a&&a.borderRadius||""}return Qo(!o||!i&&"0px"===o?[]:H(o),e,n,0,0,r)}function fa(t,e,n,r,i,o){var a=t.state,s=a.width,c=a.height,l=Jo(o,i,t.props.roundRelative,s,c),u=l.raws,f=l.styles,d=na(i,u),p=d.horizontals,h=d.verticals,v=f.join(" ");a.borderRadiusState=v,fo(t,"onRound",co(t,e,{horizontals:p,verticals:h,borderRadius:v,width:s,height:c,delta:r,dist:n}))}var da={name:"roundable",props:{roundable:Boolean,roundRelative:Boolean,minRoundControls:Array,maxRoundControls:Array,roundClickable:Boolean},events:{onRoundStart:"roundStart",onRound:"round",onRoundEnd:"roundEnd"},css:[".control.border-radius {\n    background: #d66;\n    cursor: pointer;\n}",":host[data-able-roundable] .line.direction {\n    cursor: pointer;\n}"],render:function(t,e){var n=t.state,r=n.target,i=n.width,o=n.height,a=n.allMatrix,s=n.is3d,c=n.left,l=n.top,u=n.borderRadiusState,f=t.props,d=f.minRoundControls,p=void 0===d?[0,0]:d,h=f.maxRoundControls,v=void 0===h?[4,4]:h,g=f.zoom;if(!r)return null;var m=s?4:3,b=ua(r,i,o,p,u);if(!b)return null;var y=0,x=0;return b.map((function(t,n){x+=Math.abs(t.horizontal),y+=Math.abs(t.vertical);var r=xe(qi(a,t.pos,m),[c,l]),i=t.vertical?y<=v[1]:x<=v[0];return e.createElement("div",{key:"borderRadiusControl".concat(n),className:Pi("control","border-radius"),"data-radius-index":n,style:{display:i?"block":"none",transform:"translate(".concat(r[0],"px, ").concat(r[1],"px) scale(").concat(g,")")}})}))},dragControlCondition:function(t,e){if(!e.inputEvent||e.isRequest)return!1;var n=e.inputEvent.target.getAttribute("class")||"";return n.indexOf("border-radius")>-1||n.indexOf("moveable-line")>-1&&n.indexOf("moveable-direction")>-1},dragControlStart:function(t,e){var n=e.inputEvent,r=e.datas,i=n.target,o=i.getAttribute("class")||"",a=o.indexOf("border-radius")>-1,s=o.indexOf("moveable-line")>-1&&o.indexOf("moveable-direction")>-1,c=a?parseInt(i.getAttribute("data-radius-index"),10):-1,l=s?parseInt(i.getAttribute("data-line-index"),10):-1;if(!a&&!s)return!1;if(!1===fo(t,"onRoundStart",co(t,e,{})))return!1;r.lineIndex=l,r.controlIndex=c,r.isControl=a,r.isLine=s,ci(t,e);var u=t.props,f=u.roundRelative,d=u.minRoundControls,p=void 0===d?[0,0]:d,h=t.state,v=h.target,g=h.width,m=h.height;r.isRound=!0,r.prevDist=[0,0];var b=ua(v,g,m,p)||[];return r.controlPoses=b,h.borderRadiusState=Jo(b.map((function(t){return t.pos})),b,f,g,m).styles.join(" "),!0},dragControl:function(t,e){var n=e.datas;if(!n.isRound||!n.isControl||!n.controlPoses.length)return!1;var r=n.controlIndex,i=n.controlPoses,o=pi(e),a=o[0],s=o[1],c=[a,s],l=xe(c,n.prevDist),u=t.props.maxRoundControls,f=void 0===u?[4,4]:u,d=t.state,p=d.width,h=d.height,v=i[r],g=v.vertical,m=v.horizontal,b=i.map((function(t){var e=t.horizontal,n=t.vertical,r=[e*m*c[0],n*g*c[1]];if(e){if(1===f[0])return r;if(f[0]<4&&e!==m)return r}else{if(0===f[1])return r[1]=n*m*c[0]/p*h,r;if(g){if(1===f[1])return r;if(f[1]<4&&n!==g)return r}}return[0,0]}));b[r]=c;var y=i.map((function(t,e){return ye(t.pos,b[e])}));return n.prevDist=[a,s],fa(t,e,c,l,i,y),!0},dragControlEnd:function(t,e){var n=t.state;n.borderRadiusState="";var r=e.datas,i=e.isDouble;if(!r.isRound)return!1;var o=n.width,a=n.height,s=r.isControl,c=r.controlIndex,l=r.isLine,u=r.lineIndex,f=r.controlPoses,d=f.map((function(t){return t.pos})),p=d.length,h=t.props.roundClickable;if(i&&(void 0===h||h)){if(s)ta(f,d,c,0);else if(l){var v=si(t,e);!function(t,e,n,r,i,o,a){var s=na(t),c=s.horizontals,l=s.verticals,u=c.length,f=l.length,d=-1,p=-1;0===n?0===u?d=0:1===u&&(d=1):3===n&&(u<=2?d=2:u<=3&&(d=3)),2===n?0===f?p=0:f<4&&(p=3):1===n&&(f<=1?p=1:f<=2&&(p=2)),ea(t,e,0,d,p,r,i,o,a)}(f,d,u,v[0],v[1],o,a)}p!==f.length&&fa(t,e,[0,0],[0,0],f,d)}return fo(t,"onRoundEnd",lo(t,e,{})),n.borderRadiusState="",!0},unset:function(t){t.state.borderRadiusState=""}};var pa={isPinch:!0,name:"beforeRenderable",props:{},events:{onBeforeRenderStart:"beforeRenderStart",onBeforeRender:"beforeRender",onBeforeRenderEnd:"beforeRenderEnd",onBeforeRenderGroupStart:"beforeRenderGroupStart",onBeforeRenderGroup:"beforeRenderGroup",onBeforeRenderGroupEnd:"beforeRenderGroupEnd"},dragRelation:"weak",setTransform:function(t,e){var n=t.state,r=n.is3d,i=n.target,o=n.targetMatrix,a=null==i?void 0:i.style.transform,s=r?"matrix3d(".concat(o.join(","),")"):"matrix(".concat(Ee(o,!0),")"),c=a&&"none"!==a?a:s;e.datas.startTransforms=function(t,e){return t===(e?"matrix3d(".concat(Be(4)):"matrix(".concat(Be(3),")"))||"matrix(1,0,0,1,0,0)"===t}(c,r)?[]:H(c)},resetTransform:function(t){t.datas.nextTransforms=t.datas.startTransforms,t.datas.nextTransformAppendedIndexes=[]},fillDragStartParams:function(t,e){return co(t,e,{setTransform:function(t){e.datas.startTransforms=A(t)?t:H(t)},isPinch:!!e.isPinch})},fillDragParams:function(t,e){return co(t,e,{isPinch:!!e.isPinch})},dragStart:function(t,e){this.setTransform(t,e),fo(t,"onBeforeRenderStart",this.fillDragStartParams(t,e))},drag:function(t,e){this.resetTransform(e),fo(t,"onBeforeRender",co(t,e,{isPinch:!!e.isPinch}))},dragEnd:function(t,e){fo(t,"onBeforeRenderEnd",co(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag}))},dragGroupStart:function(t,e){var n=this;this.dragStart(t,e);var r=Jn(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.setTransform(r,t),n.fillDragStartParams(r,t)}));fo(t,"onBeforeRenderGroupStart",co(t,e,{isPinch:!!e.isPinch,targets:t.props.targets,setTransform:function(){},events:o}))},dragGroup:function(t,e){var n=this;this.drag(t,e);var r=Jn(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.resetTransform(t),n.fillDragParams(r,t)}));fo(t,"onBeforeRenderGroup",co(t,e,{isPinch:!!e.isPinch,targets:t.props.targets,events:o}))},dragGroupEnd:function(t,e){this.dragEnd(t,e),fo(t,"onBeforeRenderGroupEnd",co(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag,targets:t.props.targets}))},dragControlStart:function(t,e){return this.dragStart(t,e)},dragControl:function(t,e){return this.drag(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupControlStart:function(t,e){return this.dragGroupStart(t,e)},dragGroupControl:function(t,e){return this.dragGroup(t,e)},dragGroupControlEnd:function(t,e){return this.dragGroupEnd(t,e)}},ha={name:"renderable",props:{},events:{onRenderStart:"renderStart",onRender:"render",onRenderEnd:"renderEnd",onRenderGroupStart:"renderGroupStart",onRenderGroup:"renderGroup",onRenderGroupEnd:"renderGroupEnd"},dragRelation:"weak",dragStart:function(t,e){fo(t,"onRenderStart",co(t,e,{isPinch:!!e.isPinch}))},drag:function(t,e){fo(t,"onRender",this.fillDragParams(t,e))},dragAfter:function(t,e){if(e.resultCount)return this.drag(t,e)},dragEnd:function(t,e){fo(t,"onRenderEnd",this.fillDragEndParams(t,e))},dragGroupStart:function(t,e){fo(t,"onRenderGroupStart",co(t,e,{isPinch:!!e.isPinch,targets:t.props.targets}))},dragGroup:function(t,e){var n=this,r=Jn(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.fillDragParams(r,t)}));fo(t,"onRenderGroup",co(t,e,{isPinch:!!e.isPinch,targets:t.props.targets,transform:Si(e),events:o}))},dragGroupEnd:function(t,e){var n=this,r=Jn(t,"beforeRenderable",e),i=t.moveables,o=r.map((function(t,e){var r=i[e];return n.fillDragEndParams(r,t)}));fo(t,"onRenderGroupEnd",co(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag,targets:t.props.targets,events:o}))},dragControlStart:function(t,e){return this.dragStart(t,e)},dragControl:function(t,e){return this.drag(t,e)},dragControlAfter:function(t,e){return this.dragAfter(t,e)},dragControlEnd:function(t,e){return this.dragEnd(t,e)},dragGroupControlStart:function(t,e){return this.dragGroupStart(t,e)},dragGroupControl:function(t,e){return this.dragGroup(t,e)},dragGroupControlEnd:function(t,e){return this.dragGroupEnd(t,e)},fillDragParams:function(t,e){return co(t,e,{isPinch:!!e.isPinch,transform:Si(e)})},fillDragEndParams:function(t,e){return co(t,e,{isPinch:!!e.isPinch,isDrag:e.isDrag})}};function va(t,e,n,r,i,o,a){var s="Start"===i,c=t.state.target,l=o.isRequest;if(!c||s&&r.indexOf("Control")>-1&&!l&&t.areaElement===o.inputEvent.target)return!1;var u="".concat(n).concat(r).concat(i),f="".concat(n).concat(r,"Condition"),d="End"===i,p="After"===i,h=s&&(!t.targetGesto||!t.controlGesto||!t.targetGesto.isFlag()||!t.controlGesto.isFlag());h&&t.updateRect(i,!0,!1),""!==i||l||bo(t.state,o);var v=kn([],t[e],!0);if(l){var g=o.requestAble;v.some((function(t){return t.name===g}))||v.push.apply(v,t.props.ables.filter((function(t){return t.name===g})))}if(!v.length)return!1;var m=kn(kn([pa],v,!0),[ha],!1).filter((function(t){return t[u]})),b=o.datas;h&&m.forEach((function(e){e.unset&&e.unset(t)}));var y,x=o.inputEvent;d&&x&&(y=document.elementFromPoint(o.clientX,o.clientY)||x.target);var E=0,S=m.filter((function(e){var n=e.name,r=b[n]||(b[n]={});if(s&&(r.isEventStart=!e[f]||e[f](t,o)),r.isEventStart){var i=e[u](t,Bn(Bn({},o),{resultCount:E,datas:r,originalDatas:b,inputTarget:y}));return t._emitter.off(),s&&!1===i&&(r.isEventStart=!1),E+=i?1:0,i}return!1})).length,C=!1;return s&&m.length&&!S&&(C=0===m.filter((function(t){var e=t.name,n=b[e];return!!n.isEventStart&&("strong"!==t.dragRelation||(n.isEventStart=!1,!1))})).length),(d||C)&&(t.state.gesto=null,t.moveables&&t.moveables.forEach((function(t){t.state.gesto=null}))),h&&C&&m.forEach((function(e){e.unset&&e.unset(t)})),s&&!l&&S&&(null==o||o.preventDefault()),!t.isUnmounted&&!C&&((!s&&S&&!a||d)&&(t.updateRect(d?i:"",!0,!1),t.forceUpdate()),s||d||p||!S||a||va(t,e,n,r,i+"After",o),!0)}function ga(t,e,n){var r=t.controlBox.getElement(),i=[];i.push(r),t.props.dragArea&&!t.props.dragTarget||i.push(e);var o=function(e){var n=e.inputEvent.target;return n===t.areaElement||!t.isMoveableElement(n)&&!t.controlBox.getElement().contains(n)||ht(n,"moveable-area")||ht(n,"moveable-padding")};return ma(t,i,"targetAbles",n,{dragStart:o,pinchStart:o})}function ma(t,e,n,r,i){void 0===i&&(i={});var o=t.props,a=o.pinchOutside,s=o.pinchThreshold,c={preventDefault:!1,container:window,pinchThreshold:s,pinchOutside:a},l=new bn(e,c);return["drag","pinch"].forEach((function(e){["Start","","End"].forEach((function(o){l.on("".concat(e).concat(o),(function(a){var s=a.eventType;!i[s]||i[s](a)?va(t,n,e,r,o,a)||a.stop():a.stop()}))}))})),l}var ba=function(){function t(t,e,n){var r=this;this.target=t,this.moveable=e,this.eventName=n,this.ables=[],this._onEvent=function(t){var e=r.eventName,n=r.moveable;n.state.disableNativeEvent||r.ables.forEach((function(r){r[e](n,{inputEvent:t})}))},t.addEventListener(n.toLowerCase(),this._onEvent)}var e=t.prototype;return e.setAbles=function(t){this.ables=t},e.destroy=function(){this.target.removeEventListener(this.eventName.toLowerCase(),this._onEvent),this.target=null,this.moveable=null},t}(),ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state=Bn({container:null,gesto:null,renderPoses:[[0,0],[0,0],[0,0],[0,0]],disableNativeEvent:!1},no(null)),e.enabledAbles=[],e.targetAbles=[],e.controlAbles=[],e.rotation=0,e.scale=[1,1],e.isUnmounted=!1,e.events={mouseEnter:null,mouseLeave:null},e._emitter=new On,e._prevTarget=null,e._prevDragArea=!1,e._observer=null,e._observerId=0,e.onPreventClick=function(t){t.stopPropagation(),mt(window,"click",e.onPreventClick,!0)},e.checkUpdateRect=function(){if(!e.isDragging()){var t=e.props.parentMoveable;t?t.checkUpdateRect():(nt(e._observerId),e._observerId=et((function(){e.isDragging()||e.updateRect()})))}},e}_n(e,t);var n=e.prototype;return n.render=function(){var t=this.props,e=this.state,n=t.parentPosition,r=t.className,i=t.target,o=t.zoom,a=t.cspNonce,s=t.translateZ,c=t.cssStyled,l=t.portalContainer;this.checkUpdate(),this.updateRenderPoses();var u=n||{left:0,top:0},f=u.left,d=u.top,p=e.left,h=e.top,v=e.target,g=e.direction,m=e.hasFixed,b=t.targets,y=(b&&b.length||i)&&v,x=this.isDragging(),E={};return this.getEnabledAbles().forEach((function(t){E["data-able-".concat(t.name.toLowerCase())]=!0})),_t(c,Bn({cspNonce:a,ref:S(this,"controlBox"),className:"".concat(Pi("control-box",-1===g?"reverse":"",x?"dragging":"")," ").concat(r)},E,{onClick:this.onPreventClick,portalContainer:l,style:{position:m?"fixed":"absolute",display:y?"block":"none",transform:"translate3d(".concat(p-f,"px, ").concat(h-d,"px, ").concat(s,")"),"--zoom":o,"--zoompx":"".concat(o,"px")}}),this.renderAbles(),this._renderLines())},n.componentDidMount=function(){this.isUnmounted=!1,this.controlBox.getElement();var t=this.props,e=t.parentMoveable,n=t.container,r=t.wrapperMoveable;this._updateTargets(),this._updateNativeEvents(),this._updateEvents(),n||e||r||this.updateRect("",!1,!0),this.updateCheckInput(),this._updateObserver(this.props)},n.componentDidUpdate=function(t){this._updateNativeEvents(),this._updateEvents(),this._updateTargets(),this.updateCheckInput(),this._updateObserver(t)},n.componentWillUnmount=function(){this.isUnmounted=!0,this._emitter.off(),so(this,"targetGesto"),so(this,"controlGesto");var t=this.events;for(var e in t){var n=t[e];n&&n.destroy()}},n.getContainer=function(){var t=this.props,e=t.parentMoveable,n=t.wrapperMoveable;return t.container||n&&n.getContainer()||e&&e.getContainer()||this.controlBox.getElement().parentElement},n.isMoveableElement=function(t){return t&&(t.getAttribute("class")||"").indexOf(Nn)>-1},n.dragStart=function(t){var e=this.targetGesto;return e&&!e.isFlag()&&e.triggerDragStart(t),this},n.hitTest=function(t){var e,n=this.state,r=n.target,i=n.pos1,o=n.pos2,a=n.pos3,s=n.pos4,c=n.targetClientRect;if(!r)return 0;if(t instanceof Element){var l=t.getBoundingClientRect();e={left:l.left,top:l.top,width:l.width,height:l.height}}else e=Bn({width:0,height:0},t);var u=e.left,f=e.top,d=e.width,p=e.height,h=qe([i,o,s,a],c),v=We(Ze(h,[[u,f],[u+d,f],[u+d,f+p],[u,f+p]])),g=We(h);return v&&g?Math.min(100,v/g*100):0},n.isInside=function(t,e){var n=this.state,r=n.target,i=n.pos1,o=n.pos2,a=n.pos3,s=n.pos4,c=n.targetClientRect;return!!r&&Ve([t,e],qe([i,o,s,a],c))},n.updateRect=function(t,e,n){void 0===n&&(n=!0);var r=this.props,i=r.parentMoveable,o=this.state.target||this.props.target,a=this.getContainer(),s=i?i.props.rootContainer:r.rootContainer;this.updateState(no(this.controlBox&&this.controlBox.getElement(),o,a,a,s||a),!i&&n)},n.isDragging=function(){return!!this.targetGesto&&this.targetGesto.isFlag()||!!this.controlGesto&&this.controlGesto.isFlag()},n.updateTarget=function(t){this.updateRect(t,!0)},n.getRect=function(){var t=this.state,e=ao(this.state),n=e[0],r=e[1],i=e[2],o=e[3],a=Vi(e),s=t.width,c=t.height,l=a.width,u=a.height,f=a.left,d=a.top,p=[t.left,t.top],h=ye(p,t.origin);return{width:l,height:u,left:f,top:d,pos1:n,pos2:r,pos3:i,pos4:o,offsetWidth:s,offsetHeight:c,beforeOrigin:ye(p,t.beforeOrigin),origin:h,transformOrigin:t.transformOrigin,rotation:this.getRotation()}},n.getManager=function(){return this},n.getRotation=function(){var t=this.state;return function(t,e,n){var r=lt(t,e)/Math.PI*180;return(r=n>=0?r:180-r)>=0?r:360+r}(t.pos1,t.pos2,t.direction)},n.request=function(t,e,n){void 0===e&&(e={});var r=this.props,i=r.ables,o=r.groupable,a=i.filter((function(e){return e.name===t}))[0];if(this.isDragging()||!a||!a.request)return{request:function(){return this},requestEnd:function(){return this}};var s=this,c=a.request(this),l=n||e.isInstant,u=c.isControl?"controlAbles":"targetAbles",f="".concat(o?"Group":"").concat(c.isControl?"Control":""),d={request:function(e){return va(s,u,"drag",f,"",Bn(Bn({},c.request(e)),{requestAble:t,isRequest:!0}),l),this},requestEnd:function(){return va(s,u,"drag",f,"End",Bn(Bn({},c.requestEnd()),{requestAble:t,isRequest:!0}),l),this}};return va(s,u,"drag",f,"Start",Bn(Bn({},c.requestStart(e)),{requestAble:t,isRequest:!0}),l),l?d.request(e).requestEnd():d},n.destroy=function(){this.componentWillUnmount()},n.updateRenderPoses=function(){var t=this.state,e=this.props,n=t.originalBeforeOrigin,r=t.transformOrigin,i=t.allMatrix,o=t.is3d,a=t.pos1,s=t.pos2,c=t.pos3,l=t.pos4,u=t.left,f=t.top,d=e.padding||{},p=d.left,h=void 0===p?0:p,v=d.top,g=void 0===v?0:v,m=d.bottom,b=void 0===m?0:m,y=d.right,x=void 0===y?0:y,E=o?4:3,S=e.groupable?n:ye(n,[u,f]);t.renderPoses=[ye(a,yo(i,[-h,-g],r,S,E)),ye(s,yo(i,[x,-g],r,S,E)),ye(c,yo(i,[-h,b],r,S,E)),ye(l,yo(i,[x,b],r,S,E))]},n.checkUpdate=function(){var t=this.props,e=t.target,n=t.container,r=t.parentMoveable,i=this.state,o=i.target,a=i.container;if((o||e)&&(this.updateAbles(),!vo(o,e)||!vo(a,n))){var s=n||this.controlBox;s&&this.unsetAbles(),this.updateState({target:e,container:n}),!r&&s&&this.updateRect("End",!1,!1)}},n.triggerEvent=function(t,e){this._emitter.trigger(t,e);var n=this.props[t];return n&&n(e)},n.useCSS=function(t,e){var n=this.props.customStyledMap,r=t+e;return n[r]||(n[r]=Mn(t,e)),n[r]},n.unsetAbles=function(){var t=this;this.targetAbles.forEach((function(e){e.unset&&e.unset(t)}))},n.updateAbles=function(t,e){void 0===t&&(t=this.props.ables),void 0===e&&(e="");var n=this.props,r=n.triggerAblesSimultaneously,i=t.filter((function(t){return t&&(t.always&&!1!==n[t.name]||n[t.name])})),o="drag".concat(e,"Start"),a="pinch".concat(e,"Start"),s="drag".concat(e,"ControlStart"),c=ho(i,[o,a],r),l=ho(i,[s],r);this.enabledAbles=i,this.targetAbles=c,this.controlAbles=l},n.updateState=function(t,e){if(e){if(this.isUnmounted)return;this.setState(t)}else{var n=this.state;for(var r in t)n[r]=t[r]}},n.getEnabledAbles=function(){var t=this.props;return t.ables.filter((function(e){return e&&t[e.name]}))},n.renderAbles=function(){var t,e=this,n=this.props.triggerAblesSimultaneously,r={createElement:_t};return function(t,e){var n=[],r={};return t.forEach((function(i,o){var a=e(i,o,t),s=r[a];s||(s=[],r[a]=s,n.push(s)),s.push(i)})),n}((t=ho(this.getEnabledAbles(),["render"],n).map((function(t){return(0,t.render)(e,r)||[]})),t.reduce((function(t,e){return t.concat(e)}),[])).filter((function(t){return t})),(function(t){return t.key})).map((function(t){return t[0]}))},n.updateCheckInput=function(){this.targetGesto&&(this.targetGesto.options.checkInput=this.props.checkInput)},n._updateObserver=function(t){var e,n=this.props,r=n.target;if(window.ResizeObserver&&r&&n.useResizeObserver){if(t.target!==r||!this._observer){var i=new ResizeObserver(this.checkUpdateRect);i.observe(r,{box:"border-box"}),this._observer=i}}else null===(e=this._observer)||void 0===e||e.disconnect()},n._updateEvents=function(){var t=this.controlBox.getElement(),e=this.targetAbles.length,n=this.controlAbles.length,r=this.props,i=r.dragTarget||r.target;(!e&&this.targetGesto||this._isTargetChanged(!0))&&(so(this,"targetGesto"),this.updateState({gesto:null})),n||so(this,"controlGesto"),i&&e&&!this.targetGesto&&(this.targetGesto=ga(this,i,"")),!this.controlGesto&&n&&(this.controlGesto=ma(this,t,"controlAbles","Control"))},n._updateTargets=function(){var t=this.props;this._prevTarget=t.dragTarget||t.target,this._prevDragArea=t.dragArea},n._renderLines=function(){var t=this.props,e=t.edge,n=t.zoom;if(t.hideDefaultLines)return[];var r=this.state.renderPoses,i={createElement:_t};return[er(i,e?"n":"",r[0],r[1],n,0),er(i,e?"e":"",r[1],r[3],n,1),er(i,e?"w":"",r[0],r[2],n,2),er(i,e?"s":"",r[2],r[3],n,3)]},n._isTargetChanged=function(t){var e=this.props,n=e.dragTarget||e.target,r=this._prevTarget,i=this._prevDragArea,o=e.dragArea;return!o&&r!==n||(t||o)&&i!==o},n._updateNativeEvents=function(){var t=this,e=this.props.dragArea?this.areaElement:this.state.target,n=this.events,r=rt(n);if(this._isTargetChanged())for(var i in n){var o=n[i];o&&o.destroy(),n[i]=null}if(e){var a=this.enabledAbles;r.forEach((function(r){var i=ho(a,[r]),o=i.length>0,s=n[r];o?(s||(s=new ba(e,t,r),n[r]=s),s.setAbles(i)):s&&(s.destroy(),n[r]=null)}))}},e.defaultProps={target:null,dragTarget:null,container:null,rootContainer:null,origin:!0,edge:!1,parentMoveable:null,wrapperMoveable:null,parentPosition:null,portalContainer:null,useResizeObserver:!1,ables:[],pinchThreshold:20,dragArea:!1,passDragArea:!1,transformOrigin:"",className:"",zoom:1,triggerAblesSimultaneously:!1,padding:{},pinchOutside:!0,checkInput:!1,groupable:!1,hideDefaultLines:!1,cspNonce:"",translateZ:0,cssStyled:null,customStyledMap:{},props:{}},e}(Lt),xa={name:"groupable",props:{defaultGroupRotate:Number,defaultGroupOrigin:String,groupable:Boolean},events:{},render:function(t,e){var n=t.props.targets||[];t.moveables=[];var r=t.state,i={left:r.left,top:r.top},o=t.props;return n.map((function(n,r){return e.createElement(ya,{key:"moveable"+r,ref:C(t,"moveables",r),target:n,origin:!1,cssStyled:o.cssStyled,customStyledMap:o.customStyledMap,useResizeObserver:o.useResizeObserver,parentMoveable:t,parentPosition:i})}))}},Ea=Tn("clickable",{props:{clickable:Boolean},events:{onClick:"click",onClickGroup:"clickGroup"},always:!0,dragRelation:"weak",dragStart:function(t,e){e.isRequest||gt(window,"click",t.onPreventClick,!0)},dragControlStart:function(t,e){this.dragStart(t,e)},dragGroupStart:function(t,e){this.dragStart(t,e),e.datas.inputTarget=e.inputEvent&&e.inputEvent.target},dragEnd:function(t,e){this.endEvent(t);var n=t.state.target,r=e.inputEvent,i=e.inputTarget,o=!t.isMoveableElement(i)&&t.controlBox.getElement().contains(i);if(e.isDrag&&!o||this.unset(t),r&&i&&!e.isDrag&&!t.isMoveableElement(i)&&!o){var a=n.contains(i);fo(t,"onClick",co(t,e,{isDouble:e.isDouble,inputTarget:i,isTarget:n===i,containsTarget:a}))}},dragGroupEnd:function(t,e){this.endEvent(t);var n=e.inputEvent,r=e.inputTarget;if(n&&r&&!e.isDrag&&!t.isMoveableElement(r)&&e.datas.inputTarget!==r){var i=t.props.targets,o=i.indexOf(r),a=o>-1,s=!1;-1===o&&(s=(o=Q(i,(function(t){return t.contains(r)})))>-1),fo(t,"onClickGroup",co(t,e,{isDouble:e.isDouble,targets:i,inputTarget:r,targetIndex:o,isTarget:a,containsTarget:s}))}},dragControlEnd:function(t,e){this.dragEnd(t,e)},dragGroupControlEnd:function(t,e){this.dragEnd(t,e)},endEvent:function(t){var e=this;et((function(){e.unset(t)}))},unset:function(t){mt(window,"click",t.onPreventClick,!0)}});function Sa(t){var e=t.originalDatas.draggable;return e||(t.originalDatas.draggable={},e=t.originalDatas.draggable),Bn(Bn({},t),{datas:e})}var Ca=Tn("edgeDraggable",{dragControlCondition:function(t,e){if(!t.props.edgeDraggable||!e.inputEvent)return!1;var n=e.inputEvent.target;return ht(n,Pi("direction"))&&ht(n,Pi("line"))},dragControlStart:function(t,e){return ai.dragStart(t,Sa(e))},dragControl:function(t,e){return ai.drag(t,Sa(e))},dragControlEnd:function(t,e){return ai.dragEnd(t,Sa(e))},dragGroupControlCondition:function(t,e){if(!t.props.edgeDraggable||!e.inputEvent)return!1;var n=e.inputEvent.target;return ht(n,Pi("direction"))&&ht(n,Pi("line"))},dragGroupControlStart:function(t,e){return ai.dragGroupStart(t,Sa(e))},dragGroupControl:function(t,e){return ai.dragGroup(t,Sa(e))},dragGroupControlEnd:function(t,e){return ai.dragGroupEnd(t,Sa(e))},unset:function(t){return ai.unset(t)}}),wa={name:"individualGroupable",props:{individualGroupable:Boolean},events:{}},Da=[pa,Xo,oi,Oo,ai,Ca,lr,Po,_o,To,Yo,Wo,Ao,la,ca,da,xa,wa,Ea,Fo,ha],Ma=Da.reduce((function(t,e){return Bn(Bn({},t),"events"in e?e.events:{})}),{}),Ra=Da.reduce((function(t,e){return Bn(Bn({},t),e.props)}),{}),Oa=Co(Ma),Pa=Object.keys(Oa),_a=Object.keys(Ra);function Ba(t,e){return Math.max.apply(Math,t.map((function(t){var n=t[0],r=t[1],i=t[2],o=t[3];return Math.max(n[e],r[e],i[e],o[e])})))}function ka(t,e){return Math.min.apply(Math,t.map((function(t){var n=t[0],r=t[1],i=t[2],o=t[3];return Math.min(n[e],r[e],i[e],o[e])})))}var Ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.differ=new Xe,e.moveables=[],e.transformOrigin="50% 50%",e}_n(e,t);var n=e.prototype;return n.checkUpdate=function(){this.updateAbles()},n.updateRect=function(t,e,n){if(void 0===n&&(n=!0),this.controlBox){this.moveables.forEach((function(e){e.updateRect(t,!1,!1)}));var r=this.state,i=this.props,o=r.target||i.target;(!e||""!==t&&i.updateGroup)&&(this.rotation=i.defaultGroupRotate,this.transformOrigin=i.defaultGroupOrigin||"50% 50%",this.scale=[1,1]);var a=this.rotation,s=this.scale,c=function(t,e){if(!t.length)return[0,0,0,0];var n=t.map((function(t){return ao(t.state)})),r=Xn,i=Xn,o=0,a=0,s=dt(e,Ln);if(s%90){var c=s/180*Math.PI,l=Math.tan(c),u=-1/l,f=[Wn,Xn],d=[Wn,Xn];n.forEach((function(t){t.forEach((function(t){var e=t[1]-l*t[0],n=t[1]-u*t[0];f[0]=Math.max(f[0],e),f[1]=Math.min(f[1],e),d[0]=Math.max(d[0],n),d[1]=Math.min(d[1],n)}))})),f.forEach((function(t){d.forEach((function(e){var n=(e-t)/(l-u),o=l*n+t;r=Math.min(r,n),i=Math.min(i,o)}))}));var p=n.map((function(t){var e=t[0],n=t[1],r=t[2],i=t[3];return[Re(e,-c),Re(n,-c),Re(r,-c),Re(i,-c)]}));o=Ba(p,0)-ka(p,0),a=Ba(p,1)-ka(p,1)}else if(r=ka(n,0),i=ka(n,1),o=Ba(n,0)-r,a=Ba(n,1)-i,s%180){var h=o;o=a,a=h}return[r,i,o,a]}(this.moveables,a),l=c[0],u=c[1],f=c[2],d=c[3],p="rotate(".concat(a,"deg) scale(").concat(s[0]>=0?1:-1,", ").concat(s[1]>=0?1:-1,")");o.style.cssText+="left:0px;top:0px; transform-origin: ".concat(this.transformOrigin,"; width:").concat(f,"px; height:").concat(d,"px;")+"transform:".concat(p),r.width=f,r.height=d;var h=this.getContainer(),v=no(this.controlBox.getElement(),o,this.controlBox.getElement(),this.getContainer(),this.props.rootContainer||h),g=[v.left,v.top],m=ao(v),b=m[0],y=m[1],x=m[2],E=m[3],S=He([b,y,x,E]),C=[S.minX,S.minY];v.pos1=xe(b,C),v.pos2=xe(y,C),v.pos3=xe(x,C),v.pos4=xe(E,C),v.left=l-v.left+C[0],v.top=u-v.top+C[1],v.origin=xe(ye(g,v.origin),C),v.beforeOrigin=xe(ye(g,v.beforeOrigin),C),v.originalBeforeOrigin=ye(g,v.originalBeforeOrigin);var w=v.targetClientRect,D=s[0]*s[1]>0?1:-1;w.top+=v.top-r.top,w.left+=v.left-r.left,o.style.transform="translate(".concat(-C[0],"px, ").concat(-C[1],"px) ").concat(p),this.updateState(Bn(Bn({},v),{direction:D,beforeDirection:D}),n)}},n.getRect=function(){return Bn(Bn({},t.prototype.getRect.call(this)),{children:this.moveables.map((function(t){return t.getRect()}))})},n.triggerEvent=function(e,n,r){if(r||e.indexOf("Group")>-1)return t.prototype.triggerEvent.call(this,e,n);this._emitter.trigger(e,n)},n.updateAbles=function(){t.prototype.updateAbles.call(this,kn(kn([],this.props.ables,!0),[xa],!1),"Group")},n._updateTargets=function(){t.prototype._updateTargets.call(this),this._prevTarget=this.props.dragTarget||this.areaElement},n._updateEvents=function(){var t=this.state,e=this.props,n=this._prevTarget,r=e.dragTarget||this.areaElement;n!==r&&(so(this,"targetGesto"),so(this,"controlGesto"),t.target=null),t.target||(t.target=this.areaElement,this.controlBox.getElement().style.display="block",this.targetGesto=ga(this,r,"Group"),this.controlGesto=ma(this,this.controlBox.getElement(),"controlAbles","GroupControl"));var i=!vo(t.container,e.container);i&&(t.container=e.container);var o=this.differ.update(e.targets),a=o.added,s=o.changed,c=o.removed;(i||a.length||s.length||c.length)&&this.updateRect()},n._updateObserver=function(){},e.defaultProps=Bn(Bn({},ya.defaultProps),{transformOrigin:["50%","50%"],groupable:!0,dragArea:!0,keepRatio:!0,targets:[],defaultGroupRotate:0,defaultGroupOrigin:"50% 50%"}),e}(ya),za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.moveables=[],e}_n(e,t);var n=e.prototype;return n.render=function(){var t=this,e=this.props,n=e.cspNonce,r=e.cssStyled,i=e.targets;return _t(r,{cspNonce:n,ref:S(this,"controlBox"),className:Pi("control-box")},i.map((function(e,n){return _t(ya,Bn({key:"moveable"+n,ref:C(t,"moveables",n)},t.props,{target:e,wrapperMoveable:t}))})))},n.componentDidUpdate=function(){},n.updateRect=function(t,e,n){void 0===n&&(n=!0),this.moveables.forEach((function(r){r.updateRect(t,e,n)}))},n.getRect=function(){return Bn(Bn({},t.prototype.getRect.call(this)),{children:this.moveables.map((function(t){return t.getRect()}))})},n.request=function(){return{request:function(){return this},requestEnd:function(){return this}}},n.dragStart=function(){return this},n.hitTest=function(){return 0},n.isInside=function(){return!1},n.isDragging=function(){return!1},n.updateRenderPoses=function(){},n.checkUpdate=function(){},n.triggerEvent=function(){},n.updateAbles=function(){},n._updateEvents=function(){},n._updateObserver=function(){},e}(ya),ja=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.refTargets=[],e.selectorMap={},e}_n(e,t);var n,r,i=e.prototype;return e.makeStyled=function(){var t={};this.getTotalAbles().forEach((function(e){var n=e.css;n&&n.forEach((function(e){t[e]=!0}))}));var e=rt(t).join("\n");this.defaultStyled=Mn("div",function(t,e){return e.replace(/([^}{]*){/gm,(function(e,n){return n.replace(/\.([^{,\s\d.]+)/g,"."+t+"$1")+"{"}))}(Nn,Fn+e))},e.getTotalAbles=function(){return kn([Xo,xa,wa,Fo],this.defaultAbles,!0)},i.render=function(){var t=this.constructor;t.defaultStyled||t.makeStyled();var e=this.props,n=e.ables,r=e.props,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(e,["ables","props"]),o=function(t,e){var n=[];return t.forEach((function(t){t&&(L(t)?e[t]&&n.push.apply(n,e[t]):n.push(t))})),n}(this._updateRefs(!0),this.selectorMap),a=o.length>1,s=kn(kn([],t.getTotalAbles(),!0),n||[],!0),c=Bn(Bn(Bn({},i),r||{}),{ables:s,cssStyled:t.defaultStyled,customStyledMap:t.customStyledMap});return a?i.individualGroupable?_t(za,Bn({key:"individual-group",ref:S(this,"moveable")},c,{target:null,targets:o})):_t(Ta,Bn({key:"group",ref:S(this,"moveable")},c,{target:null,targets:o})):_t(ya,Bn({key:"single",ref:S(this,"moveable")},c,{target:o[0]}))},i.componentDidMount=function(){this._updateRefs()},i.componentDidUpdate=function(){this._updateRefs()},i.componentWillUnmount=function(){this.selectorMap={},this.refTargets=[]},i.getManager=function(){return this.moveable},i._updateRefs=function(t){var e=this.refTargets,n=Do(this.props.target||this.props.targets),r="undefined"!=typeof document,i=e.length!==n.length||e.some((function(t,e){var r=n[e];return!(!t&&!r)&&t!==r})),o=this.selectorMap,a={};return this.refTargets.forEach((function(t){L(t)&&(o[t]?a[t]=o[t]:r&&(i=!0,a[t]=[].slice.call(document.querySelectorAll(t))))})),this.refTargets=n,this.selectorMap=a,!t&&i&&this.forceUpdate(),n},e.defaultAbles=[],e.customStyledMap={},e.defaultStyled=null,function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);o>3&&a&&Object.defineProperty(e,n,a)}([(n=$n,void 0===r&&(r={}),function(t,e){n.forEach((function(n){var i=r[n]||n;i in t||(t[i]=function(){for(var t,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=(t=this[e])[n].apply(t,r);return o===this[e]?this:o})}))})],e.prototype,"moveable",void 0),e}(Lt);const Ga=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _n(e,t),e.defaultAbles=Da,e}(ja);var Ia=function(t,e){return Ia=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Ia(t,e)};function Na(t,e){function n(){this.constructor=t}Ia(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Fa=function(){return Fa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Fa.apply(this,arguments)};var Aa=function(t){function e(e){var n=t.call(this,e)||this;return n.state={},n.state=n.props,n}return Na(e,t),e.prototype.render=function(){return t=_t(Ga,Fa({ref:S(this,"moveable")},this.state)),e=this.state.parentElement,_t(Yt,{element:t,container:e});var t,e},e}(At),La=_a,Ya=$n,Xa=Pa,Wa=function(){return Wa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Wa.apply(this,arguments)};var qa=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(F(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(F(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=Q(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(Wa({listener:e},n))},t}(),Ha=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this)||this;r.tempElement=document.createElement("div");var i=Fa({},n),o={};Xa.forEach((function(t){o[U("on "+t)]=function(e){return r.trigger(t,e)}})),Ht(_t(Aa,Fa({ref:S(r,"innerMoveable"),parentElement:e},i,o)),r.tempElement);var a=i.target;return A(a)&&a.length>1&&r.updateRect(),r}Na(e,t);var n=e.prototype;return n.setState=function(t,e){this.innerMoveable.setState(t,e)},n.forceUpdate=function(t){this.innerMoveable.forceUpdate(t)},n.dragStart=function(t){this.innerMoveable.$_timer&&this.forceUpdate(),this.getMoveable().dragStart(t)},n.destroy=function(){Ht(null,this.tempElement),this.off(),this.tempElement=null,this.innerMoveable=null},n.getMoveable=function(){return this.innerMoveable.moveable},e=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([w(Ya,(function(t,e){t[e]||(t[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.getMoveable();if(r&&r[e])return r[e].apply(r,t)})})),w(La,(function(t,e){Object.defineProperty(t,e,{get:function(){return this.getMoveable().props[e]},set:function(t){var n;this.setState(((n={})[e]=t,n))},enumerable:!0,configurable:!0})}))],e),e}(qa),Va=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Na(e,t),e}(Ha);const $a=Va;var Ka=n(80574),Ua=n(11590),Ja=function(t,e){return Ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},Ja(t,e)};function Za(t){return t&&"object"==typeof t}function Qa(t){return Array.isArray(t)}function ts(t){return"string"==typeof t}function es(t,e,n,r){t.addEventListener(e,n,r)}function ns(t,e,n){t.removeEventListener(e,n)}var rs=function(){return rs=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},rs.apply(this,arguments)};var is=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(Za(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(Za(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,(function(t){return t.listener===e}));i>-1&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(t,e){var n=this;return e&&this._addEvent(t,e,{once:!0}),new Promise((function(e){n._addEvent(t,e,{once:!0})}))},e.emit=function(t,e){var n=this;void 0===e&&(e={});var r=this._events[t];if(!t||!r)return!0;var i=!1;return e.eventType=t,e.stop=function(){i=!0},e.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(r).forEach((function(r){r.listener(e),r.once&&n.off(t,r.listener)})),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(rs({listener:e},n))},t}();var os,as,ss,cs=(os=function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return a[t];var n,o=String(t);return(n=r[o.toLowerCase()])?n:(n=i[o.toLowerCase()])||(1===o.length?o.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var o;if(o=r[e.toLowerCase()])return o===n;if(o=i[e.toLowerCase()])return o===n}else if("number"==typeof e)return e===n;return!1}};var r=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(o=97;o<123;o++)r[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)r[o-48]=o;for(o=1;o<13;o++)r["f"+o]=o+111;for(o=0;o<10;o++)r["numpad "+o]=o+96;var a=e.names=e.title={};for(o in r)a[r[o]]=o;for(var s in i)r[s]=i[s]},os(as={exports:{}},as.exports),as.exports),ls=(cs.code,cs.codes,cs.aliases,cs.names),us=(cs.title,{"+":"plus","left command":"meta","right command":"meta"}),fs={shift:1,ctrl:2,alt:3,meta:4};function ds(t){var e=ls[t]||"";for(var n in us)e=e.replace(n,us[n]);return e.replace(/\s/g,"")}function ps(t,e){void 0===e&&(e=ds(t.keyCode));var n=function(t){return[t.shiftKey&&"shift",t.ctrlKey&&"ctrl",t.altKey&&"alt",t.metaKey&&"meta"].filter(Boolean)}(t);return-1===n.indexOf(e)&&n.push(e),n.filter(Boolean)}function hs(t){var e=t.slice();return e.sort((function(t,e){return(fs[t]||5)-(fs[e]||5)})),e}const vs=function(t){function e(e){void 0===e&&(e=window);var n=t.call(this)||this;return n.container=e,n.ctrlKey=!1,n.altKey=!1,n.shiftKey=!1,n.metaKey=!1,n.clear=function(){return n.ctrlKey=!1,n.altKey=!1,n.shiftKey=!1,n.metaKey=!1,n},n.keydownEvent=function(t){n.triggerEvent("keydown",t)},n.keyupEvent=function(t){n.triggerEvent("keyup",t)},n.blur=function(){n.clear(),n.trigger("blur")},es(e,"blur",n.blur),es(e,"keydown",n.keydownEvent),es(e,"keyup",n.keyupEvent),n}!function(t,e){function n(){this.constructor=t}Ja(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t);var n=e.prototype;return Object.defineProperty(e,"global",{get:function(){return ss||(ss=new e)},enumerable:!1,configurable:!0}),e.setGlobal=function(){return this.global},n.destroy=function(){var t=this.container;this.clear(),this.off(),ns(t,"blur",this.blur),ns(t,"keydown",this.keydownEvent),ns(t,"keyup",this.keyupEvent)},n.keydown=function(t,e){return this.addEvent("keydown",t,e)},n.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},n.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},n.keyup=function(t,e){return this.addEvent("keyup",t,e)},n.addEvent=function(t,e,n){return Qa(e)?this.on(t+"."+hs(e).join("."),n):ts(e)?this.on(t+"."+e,n):this.on(t,e),this},n.removeEvent=function(t,e,n){return Qa(e)?this.off(t+"."+hs(e).join("."),n):ts(e)?this.off(t+"."+e,n):this.off(t,e),this},n.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=ds(e.keyCode),r={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,r),this.trigger(t+"."+n,r);var i=ps(e,n);i.length>1&&this.trigger(t+"."+i.join("."),r)},e}(is);var gs=function(t,e){return gs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},gs(t,e)};function ms(t,e){function n(){this.constructor=t}gs(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var bs=function(){return bs=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bs.apply(this,arguments)};function ys(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function xs(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function Es(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,c=e||document.createElement(r);for(var l in o)c.setAttribute(l,o[l]);var u=c.children;if(i.forEach((function(t,e){Es(t,u[e],c)})),a&&a.split(" ").forEach((function(t){ht(c,t)||vt(c,t)})),s){var f=c.style;for(var l in s)f[l]=s[l]}return!e&&n&&n.appendChild(c),c}function Ss(t,e,n){t!==e&&n(t,e)}function Cs(t,e,n){var r;void 0===n&&(n=t.datas.boundArea);var i=t.distX,o=void 0===i?0:i,a=t.distY,s=void 0===a?0:a,c=t.datas,l=c.startX,u=c.startY;if(e>0){var f=Math.sqrt((o*o+s*s)/(1+e*e));o=(o>=0?1:-1)*(e*f),s=(s>=0?1:-1)*f}var d=Math.abs(o),p=Math.abs(s);o=(o>=0?1:-1)*(d=(r=st([d,p],[0,0],[o<0?l-n.left:n.right-l,s<0?u-n.top:n.bottom-u],!!e))[0]),s=(s>=0?1:-1)*(p=r[1]);var h=l+Math.min(0,o),v=u+Math.min(0,s);return{left:h,top:v,right:h+d,bottom:v+p,width:d,height:p}}function ws(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top,i=e.width,o=e.height;return{pos1:[n,r],pos2:[n+i,r],pos3:[n,r+o],pos4:[n+i,r+o]}}function Ds(t,e,n){var r=Ye(t,e),i=r.list,o=r.prevList,a=r.added,s=r.removed,c=r.maintained;return xs(a.map((function(t){return i[t]})),s.map((function(t){return o[t]})),n?c.map((function(t){var e=t[1];return i[e]})):[])}var Ms=En("\n:host {\n    position: fixed;\n    display: none;\n    border: 1px solid #4af;\n    background: rgba(68, 170, 255, 0.5);\n    pointer-events: none;\n    will-change: transform;\n    z-index: 100;\n}\n"),Rs="selecto-selection "+Ms.className,Os=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition","clickBySelectEnd"],Ps=(xs(["dragContainer","cspNonce","continueSelectWithoutDeselect"],Os),Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.selectedTargets=[],n.dragScroll=new an,n._onDragStart=function(t,e){var r=t.datas,i=t.clientX,o=t.clientY,a=t.inputEvent,s=n.options,c=s.continueSelect,l=s.continueSelectWithoutDeselect,u=s.selectFromInside,f=s.selectByClick,d=s.rootContainer,p=s.boundContainer,h=s.preventDragFromInside,v=void 0===h||h,g=s.clickBySelectEnd,m=s.dragCondition;if(!m||m(t)){n.findSelectableTargets(r),r.startSelectedTargets=n.selectedTargets,r.scaleMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.containerX=0,r.containerY=0;var b={left:-1/0,top:-1/0,right:1/0,bottom:1/0};if(d){var y=n.container.getBoundingClientRect();r.containerX=y.left,r.containerY=y.top,r.scaleMatrix=function(t,e){void 0===e&&(e=document.body);for(var n=t,r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];n&&(r=Pe(je(getComputedStyle(n).transform),r),n!==e);)n=n.parentElement;return(r=he(r,4))[12]=0,r[13]=0,r[14]=0,r}(n.container,d)}if(p){var x=F(p)&&"element"in p?bs({left:!0,top:!0,bottom:!0,right:!0},p):{element:p,left:!0,top:!0,bottom:!0,right:!0},E=x.element;if(E){var S=(L(E)?document.querySelector(E):!0===E?n.container:E).getBoundingClientRect();x.left&&(b.left=S.left),x.top&&(b.top=S.top),x.right&&(b.right=S.right),x.bottom&&(b.bottom=S.bottom)}}r.boundArea=b;var C={left:i,top:o,right:i,bottom:o,width:0,height:0},w=[];if(!u||f&&!g){var D=n._findElement(e||document.elementFromPoint(i,o),r.selectableTargets);w=D?[D]:[]}var M=w.length>0,R=!u&&M;if(R&&!f)return t.stop(),!1;var O=a.type,P="mousedown"===O||"touchstart"===O;if(!(!(!t.isClick&&P)||n.emit("dragStart",bs({},t))))return t.stop(),!1;c?(w=Ds(n.selectedTargets,w,l),r.startPassedTargets=n.selectedTargets):r.startPassedTargets=[],n._select(n.selectedTargets,w,C,a,!0),r.startX=i,r.startY=o,r.selectFlag=!1,r.preventDragFromInside=!1;var _=Ge(r.scaleMatrix,[i-r.containerX,o-r.containerY]);if(r.boundsArea=n.target.style.cssText+="position: "+(d?"absolute":"fixed")+";left:0px;top:0px;transform: translate("+_[0]+"px, "+_[1]+"px)",R&&f&&!g)a.preventDefault(),v&&(n._selectEnd(r.startSelectedTargets,r.startPassedTargets,C,t),r.preventDragFromInside=!0);else{r.selectFlag=!0,"touchstart"===O&&a.preventDefault();var B=n.options.scrollOptions;B&&B.container&&n.dragScroll.dragStart(t,B),g&&(r.selectFlag=!1,t.preventDrag())}return!0}t.stop()},n._onDrag=function(t){var e;if(t.datas.selectFlag){var r=n.scrollOptions;if((null===(e=r)||void 0===e?void 0:e.container)&&n.dragScroll.drag(t,r))return}n._checkSelected(t)},n._onDragEnd=function(t){var e=t.datas,r=t.inputEvent,i=Cs(t,n.options.ratio),o=e.selectFlag;if(r&&!t.isClick&&n.emit("dragEnd",bs(bs({isDouble:!!t.isDouble,isDrag:!1,isSelect:o},t),{isClick:!!t.isClick,rect:i})),n.target.style.cssText+="display: none;",o)e.selectFlag=!1,n.dragScroll.dragEnd();else if(n.selectByClick&&n.clickBySelectEnd){var a=n._findElement(document.elementFromPoint(t.clientX,t.clientY),e.selectableTargets);n._select(n.selectedTargets,a?[a]:[],i,r)}e.preventDragFromInside||n._selectEnd(e.startSelectedTargets,e.startPassedTargets,i,t)},n._onKeyDown=function(t){n._sameCombiKey(t)&&(n.continueSelect=!0,n.emit("keydown",{}))},n._onKeyUp=function(t){n._sameCombiKey(t,!0)&&(n.continueSelect=!1,n.emit("keyup",{}))},n._onBlur=function(){n.toggleContinueSelect&&n.continueSelect&&(n.continueSelect=!1,n.emit("keyup",{}))},n._onDocumentSelectStart=function(t){if(n.gesto.isFlag()){var e=n.dragContainer;e===window&&(e=document.documentElement);var r=e instanceof Element?[e]:[].slice.call(e),i=t.target;r.some((function(e){if(e===i||e.contains(i))return t.preventDefault(),!0}))}},n.target=e.portalContainer,n.container=e.container||document.body,n.options=bs({portalContainer:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,clickBySelectEnd:!1,hitRate:100,continueSelect:!1,continueSelectWithoutDeselect:!1,toggleContinueSelect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,getElementRect:ws,cspNonce:"",ratio:0},e),n.initElement(),n.initDragScroll(),n.setKeyController(),n}ms(e,t);var n=e.prototype;return n.setSelectedTargets=function(t){return this.selectedTargets=t,this},n.getSelectedTargets=function(){return this.selectedTargets},n.setKeyContainer=function(t){var e=this,n=this.options;Ss(n.keyContainer,t,(function(){n.keyContainer=t,e.setKeyController()}))},n.setToggleContinueSelect=function(t){var e=this,n=this.options;Ss(n.toggleContinueSelect,t,(function(){n.toggleContinueSelect=t,e.setKeyEvent()}))},n.setPreventDefault=function(t){this.gesto.options.preventDefault=t},n.setCheckInput=function(t){this.gesto.options.checkInput=t},n.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},n.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),mt(document,"selectstart",this._onDocumentSelectStart),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},n.getElementPoints=function(t){var e=this.getElementRect||ws,n=e(t),r=[n.pos1,n.pos2,n.pos4,n.pos3];return e!==ws?qe(r,t.getBoundingClientRect()):r},n.getSelectableElements=function(){var t=[];return this.options.selectableTargets.forEach((function(e){F(e)?t.push(e):[].slice.call(document.querySelectorAll(e)).forEach((function(e){t.push(e)}))})),t},n.checkScroll=function(){var t;if(this.gesto.isFlag()){var e=this.scrollOptions;(null===(t=e)||void 0===t?void 0:t.container)&&this.dragScroll.checkScroll(bs({inputEvent:this.gesto.getCurrentEvent()},e))}},n.findSelectableTargets=function(t){var e=this;void 0===t&&(t=this.gesto.getEventDatas());var n=this.getSelectableElements(),r=n.map((function(t){return e.getElementPoints(t)}));t.selectableTargets=n,t.selectablePoints=r},n.clickTarget=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0]||t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,stop:function(){return!1}};return this._onDragStart(r,e)&&this._onDragEnd(r),this},n.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new vs(e||window),this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur",this._onBlur))},n.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},n.initElement=function(){this.target=Es(function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,a=void 0===o?"":o,s=i.style,c=void 0===s?{}:s,l=ys(i,["className","style"]);return{tag:t,className:a,style:c,attributes:l,children:n}}("div",{className:Rs}),this.target,this.container);var t=this.target,e=this.options,n=e.dragContainer,r=e.checkInput,i=e.preventDefault;this.dragContainer="string"==typeof n?[].slice.call(document.querySelectorAll(n)):n||this.target.parentNode,this.gesto=new bn(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:r,preventDefault:i}).on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd}),gt(document,"selectstart",this._onDocumentSelectStart),this.injectResult=Ms.inject(t,{nonce:this.options.cspNonce})},n.hitTest=function(t,e,n,r,i){var o=this.options,a=o.hitRate,s=o.selectByClick,c=t.left,l=t.top,u=t.right,f=t.bottom,d=[[c,l],[u,l],[u,f],[c,f]];return r.filter((function(t,r){var o=i[r],c=Ve([e,n],o);if(s&&c)return!0;var l=Ze(d,o);if(!l.length)return!1;var u=We(l),f=We(o),p=K(""+a);return"px"===p.unit?u>=p.value:ot(Math.round(u/f*100),0,100)>=Math.min(100,p.value)}))},n.initDragScroll=function(){var t=this;this.dragScroll.on("scroll",(function(e){var n=e.container,r=e.direction;t.emit("scroll",{container:n,direction:r})})).on("move",(function(e){var n=e.offsetX,r=e.offsetY,i=e.inputEvent,o=t.gesto;if(o&&o.isFlag()){var a=t.gesto.getEventDatas(),s=a.boundArea;a.startX-=n,a.startY-=r,a.selectablePoints.forEach((function(t){t.forEach((function(t){t[0]-=n,t[1]-=r}))})),s.left-=n,s.right-=n,s.top-=r,s.bottom-=r,t.gesto.scrollBy(n,r,i.inputEvent,!1),t._checkSelected(t.gesto.getCurrentEvent())}}))},n._select=function(t,e,n,r,i){var o=Ye(t,e),a=o.added,s=o.removed,c=o.prevList,l=o.list;this.selectedTargets=e,i&&this.emit("selectStart",{selected:e,added:a.map((function(t){return l[t]})),removed:s.map((function(t){return c[t]})),rect:n,inputEvent:r}),(a.length||s.length)&&this.emit("select",{selected:e,added:a.map((function(t){return l[t]})),removed:s.map((function(t){return c[t]})),rect:n,inputEvent:r})},n._selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=Ye(t,this.selectedTargets),s=a.added,c=a.removed,l=a.prevList,u=a.list,f=Ye(e,this.selectedTargets),d=f.added,p=f.removed,h=f.prevList,v=f.list,g=i&&i.type,m="mousedown"===g||"touchstart"===g;this.emit("selectEnd",{selected:this.selectedTargets,added:s.map((function(t){return u[t]})),removed:c.map((function(t){return l[t]})),afterAdded:d.map((function(t){return v[t]})),afterRemoved:p.map((function(t){return h[t]})),isDragStart:m,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i})},n._checkSelected=function(t,e){void 0===e&&(e=Cs(t,this.options.ratio));var n=t.datas,r=t.inputEvent,i=e.top,o=e.left,a=e.width,s=e.height,c=n.selectFlag,l=this.options,u=n.containerX,f=n.containerY,d=n.scaleMatrix,p=Ge(d,[o-u,i-f]),h=Ge(d,[a,s]),v=[],g=[];if(c){this.target.style.cssText+="display: block;left:0px;top:0px;transform: translate("+p[0]+"px, "+p[1]+"px);width:"+h[0]+"px;height:"+h[1]+"px;";var m=this.hitTest(e,n.startX,n.startY,n.selectableTargets,n.selectablePoints);v=this.selectedTargets,g=Ds(n.startPassedTargets,m,l.continueSelect&&l.continueSelectWithoutDeselect),this.selectedTargets=g}if(!1===this.emit("drag",bs(bs({},t),{isSelect:c,rect:e})))return this.target.style.cssText+="display: none;",void t.stop();c&&this._select(v,g,e,r)},n._sameCombiKey=function(t,e){var n=[].concat(this.options.toggleContinueSelect),r=ps(t.inputEvent,t.key),i=A(n[0])?n:[n];if(e){var o=t.key;return i.some((function(t){return t.some((function(t){return t===o}))}))}return i.some((function(t){return t.every((function(t){return r.indexOf(t)>-1}))}))},n._findElement=function(t,e){for(var n=t;n&&!(e.indexOf(n)>-1);)n=n.parentElement;return n},e=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([w(Os,(function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=U("set "+e);t[r]?n.set=function(t){this[r](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)}))],e),e}(en)),_s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ms(e,t),e}(Ps);const Bs=_s;var ks=n(78837),Ts=n(88036);const zs=t=>{var e;let{scene:n}=t;const[r,i]=(0,o.useState)(!1),[a,s]=(0,o.useState)({x:0,y:0}),l=js(),u=null===(e=n.selecto)||void 0===e?void 0:e.getSelectedTargets(),f=(0,o.useCallback)((t=>{t.preventDefault(),t.currentTarget&&n.select({targets:[t.currentTarget]}),s({x:t.pageX,y:t.pageY}),i(!0)}),[n]);if((0,o.useEffect)((()=>{if(u&&1===u.length){u[0].addEventListener("contextmenu",f)}}),[u,f]),!u)return(0,d.jsx)(d.Fragment,{});const p=()=>{i(!1)},h=()=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x.MenuItem,{label:"Delete",onClick:()=>{v(c.Delete),p()},className:l.menuItem}),(0,d.jsx)(x.MenuItem,{label:"Duplicate",onClick:()=>{v(c.Duplicate),p()},className:l.menuItem}),(0,d.jsx)(x.MenuItem,{label:"Bring to front",onClick:()=>{v(c.MoveTop),p()},className:l.menuItem}),(0,d.jsx)(x.MenuItem,{label:"Send to back",onClick:()=>{v(c.MoveBottom),p()},className:l.menuItem})]}),v=t=>{n.selection.pipe((0,Ua.P)()).subscribe((e=>{const n=e[0],r=n.parent;switch(t){case c.Delete:r.doAction(c.Delete,n);break;case c.Duplicate:r.doAction(c.Duplicate,n);break;case c.MoveTop:r.doAction(c.MoveTop,n);break;case c.MoveBottom:r.doAction(c.MoveBottom,n)}}))};return r?(0,d.jsx)("div",{onContextMenu:t=>{t.preventDefault(),p()},children:(0,d.jsx)(x.ContextMenu,{x:a.x,y:a.y,onClose:p,renderMenuItems:h,focusOnOpen:!1})}):(0,d.jsx)(d.Fragment,{})},js=()=>({menuItem:g.css`
    max-width: 60ch;
    overflow: hidden;
  `}),Gs={name:"dimensionViewable",props:{},events:{},render(t,e){const n=t.getRect();return(0,d.jsxs)("div",{className:"moveable-dimension",style:{position:"absolute",left:n.width/2+"px",top:`${n.height+20}px`,background:"#4af",borderRadius:"2px",padding:"2px 4px",color:"white",fontSize:"13px",whiteSpace:"nowrap",fontWeight:"bold",willChange:"transform",transform:"translate(-50%, 0px)",zIndex:100},children:[Math.round(n.offsetWidth)," x ",Math.round(n.offsetHeight)]},"dimension-viewable")}},Is=t=>({name:"constraintViewable",props:{},events:{},render(e,n){var r,i,o,a;const s=e.getRect(),c=t.findElementByTarget(e.state.target);if(null!=c&&c.isMoving||null!==(r=t.selecto)&&void 0!==r&&r.getSelectedTargets()&&(null===(i=t.selecto)||void 0===i?void 0:i.getSelectedTargets().length)>1)return;let l=null,f=null;const d=null!==(o=null!==(a=null==c?void 0:c.tempConstraint)&&void 0!==a?a:null==c?void 0:c.options.constraint)&&void 0!==o?o:{},p="1px dashed #4af",h=n.createElement("div",{style:{position:"absolute",left:s.width/2+"px",top:s.height/2-s.height/16+"px",borderLeft:p,height:s.height/8+"px",transform:"rotate(45deg)"}}),v=n.createElement("div",{style:{position:"absolute",left:s.width/2+"px",top:s.height/2-s.height/16+"px",borderLeft:p,height:s.height/8+"px",transform:"rotate(-45deg)"}}),g=n.createElement("div",{},[h,v]),m=n.createElement("div",{style:{position:"absolute",left:s.width/2+"px",bottom:"0px",borderLeft:p,height:"100vh"}}),b=n.createElement("div",{style:{position:"absolute",left:s.width/2+"px",top:`${s.height}px`,borderLeft:p,height:"100vh"}}),y=n.createElement("div",{},[m,b]),x=n.createElement("div",{style:{position:"absolute",left:s.width/2+"px",top:s.height/4+"px",borderLeft:p,height:s.height/2+"px"}}),E=n.createElement("div",{},[x,g]);switch(d.vertical){case u.fJ.Top:l=m;break;case u.fJ.Bottom:l=b;break;case u.fJ.TopBottom:l=y;break;case u.fJ.Center:l=E}const S=n.createElement("div",{style:{position:"absolute",right:"0px",top:s.height/2+"px",borderTop:p,width:"100vw"}}),C=n.createElement("div",{style:{position:"absolute",left:`${s.width}px`,top:s.height/2+"px",borderTop:p,width:"100vw"}}),w=n.createElement("div",{},[S,C]),D=n.createElement("div",{style:{position:"absolute",left:s.width/4+"px",top:s.height/2+"px",borderTop:p,width:s.width/2+"px"}}),M=n.createElement("div",{},[D,g]);switch(d.horizontal){case u._5.Left:f=S;break;case u._5.Right:f=C;break;case u._5.LeftRight:f=w;break;case u._5.Center:f=M}return n.createElement("div",{},[l,f])}}),Ns=["placement","constraint"];class Fs extends v{constructor(t,e,n){var r,i,o;super(t,e),o=t=>{this.div=t},(i="setRootRef")in(r=this)?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,this.options=t,this.scene=e,this.changeCallback=n,this.sizeStyle={height:"100%",width:"100%"}}isRoot(){return!0}onChange(t){this.revId++,this.options=Object.assign({},t),this.changeCallback()}getSaveModel(){const t=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}(this.options,Ns);return Object.assign({},t,{elements:this.elements.map((t=>t.getSaveModel()))})}render(){return(0,d.jsx)("div",{onContextMenu:t=>t.preventDefault(),ref:this.setRootRef,style:Object.assign({},this.sizeStyle,this.dataStyle),children:this.elements.map((t=>t.render()))},this.UID)}}function As(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ls{constructor(t,e,n){var r=this;As(this,"styles",Ys(ks.vc.theme2)),As(this,"selection",new m.t(1)),As(this,"moved",new Ka.x),As(this,"byName",new Map),As(this,"root",void 0),As(this,"revId",0),As(this,"width",0),As(this,"height",0),As(this,"style",{}),As(this,"data",void 0),As(this,"selecto",void 0),As(this,"moveable",void 0),As(this,"div",void 0),As(this,"currentLayer",void 0),As(this,"isEditingEnabled",void 0),As(this,"skipNextSelectionBroadcast",!1),As(this,"isPanelEditing",void 0!==y.locationService.getSearchObject().editPanel),As(this,"getNextElementName",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t?"Frame":"Element";let n=r.byName.size+1;const i=n+100;for(;n<i;){const t=`${e} ${n++}`;if(!r.byName.has(t))return t}return`${e} ${Date.now()}`})),As(this,"canRename",(t=>!this.byName.has(t))),As(this,"context",{getColor:t=>(0,Ts.FP)(this.data,t),getScale:t=>(0,Ts.pb)(this.data,t),getScalar:t=>(0,Ts.z2)(this.data,t),getText:t=>(0,Ts.WO)(this.data,t),getResource:t=>(0,Ts.Qz)(this.data,t)}),As(this,"generateFrameContainer",(t=>{let e=1/0,n=1/0,r=0,i=0;return t.forEach((t=>{var o;const a=null===(o=t.div)||void 0===o?void 0:o.getBoundingClientRect();a&&(e>a.top&&(e=a.top),n>a.left&&(n=a.left),r<a.right&&(r=a.right),i<a.bottom&&(i=a.bottom))})),{top:e,left:n,width:r-n,height:i-e}})),As(this,"save",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r.onSave(r.root.getSaveModel()),t&&setTimeout((()=>{r.div&&r.initMoveable(!0,r.isEditingEnabled)}))})),As(this,"findElementByTarget",(t=>{const e=[...this.root.elements];for(;e.length>0;){const n=e.shift();if(n&&n.div&&n.div===t)return n;const r=n instanceof v?n.elements:[];for(const t of r)e.unshift(t)}})),As(this,"setRef",(t=>{this.div=t})),As(this,"select",(t=>{this.selecto&&(this.selecto.setSelectedTargets(t.targets),this.updateSelection(t))})),As(this,"updateSelection",(t=>{if(this.moveable.target=t.targets,this.skipNextSelectionBroadcast)this.skipNextSelectionBroadcast=!1;else if(t.frame)this.selection.next([t.frame]);else{const e=t.targets.map((t=>this.findElementByTarget(t)));this.selection.next(e)}})),As(this,"generateTargetElements",(t=>{let e=[];const n=[...t];for(;n.length>0;){const t=n.shift();t&&t.div&&e.push(t.div);const r=t instanceof v?t.elements:[];for(const t of r)n.unshift(t)}return e})),As(this,"initMoveable",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=r.generateTargetElements(r.root.elements);t&&r.selecto&&r.selecto.destroy(),r.selecto=new Bs({container:r.div,selectableTargets:n,selectByClick:!0}),r.moveable=new $a(r.div,{draggable:e,resizable:e,ables:[Gs,Is(r)],props:{dimensionViewable:e,constraintViewable:e},origin:!1,className:r.styles.selected}).on("clickGroup",(t=>{r.selecto.clickTarget(t.inputEvent,t.inputTarget)})).on("dragStart",(t=>{const e=r.findElementByTarget(t.target);e&&(e.isMoving=!0)})).on("drag",(t=>{r.findElementByTarget(t.target).applyDrag(t)})).on("dragGroup",(t=>{t.events.forEach((t=>{r.findElementByTarget(t.target).applyDrag(t)}))})).on("dragEnd",(t=>{const e=r.findElementByTarget(t.target);e&&(e.setPlacementFromConstraint(),e.isMoving=!1),r.moved.next(Date.now())})).on("resizeStart",(t=>{const e=r.findElementByTarget(t.target);e&&(e.tempConstraint=Object.assign({},e.options.constraint),e.options.constraint={vertical:u.fJ.Top,horizontal:u._5.Left},e.setPlacementFromConstraint())})).on("resize",(t=>{r.findElementByTarget(t.target).applyResize(t),r.moved.next(Date.now())})).on("resizeGroup",(t=>{t.events.forEach((t=>{r.findElementByTarget(t.target).applyResize(t)})),r.moved.next(Date.now())})).on("resizeEnd",(t=>{const e=r.findElementByTarget(t.target);e&&(e.tempConstraint&&(e.options.constraint=e.tempConstraint,e.tempConstraint=void 0),e.setPlacementFromConstraint())}));let i=[];r.selecto.on("dragStart",(t=>{const e=t.inputEvent.target;(r.moveable.isMoveableElement(e)||i.some((t=>t===e||t.contains(e))))&&t.stop()})).on("selectEnd",(t=>{i=t.selected,r.updateSelection({targets:i}),t.isDragStart&&(t.inputEvent.preventDefault(),setTimeout((()=>{r.moveable.dragStart(t.inputEvent)})))}))})),this.onSave=n,this.root=this.load(t,e)}load(t,e){return this.root=new Fs(null!=t?t:{type:"frame",elements:[a.Nm]},this,this.save),this.isEditingEnabled=e,setTimeout((()=>{if(this.div){const t=e;this.initMoveable(t,e),this.currentLayer=this.root,this.selection.next([])}})),this.root}updateData(t){this.data=t,this.root.updateData(this.context)}updateSize(t,e){var n;this.width=t,this.height=e,this.style={width:t,height:e},null!==(n=this.selecto)&&void 0!==n&&n.getSelectedTargets().length&&this.clearCurrentSelection()}frameSelection(){this.selection.pipe((0,Ua.P)()).subscribe((t=>{var e;const n=t[0].parent,r=new v({type:"frame",name:this.getNextElementName(!0),elements:[]},this,t[0].parent),i=this.generateFrameContainer(t);r.options.placement=i,t.forEach((t=>{var e;const o=null===(e=t.div)||void 0===e?void 0:e.getBoundingClientRect();t.setPlacementFromConstraint(o,i),n.doAction(c.Delete,t),r.doAction(c.Duplicate,t,!1,!1)})),r.setPlacementFromConstraint(i,null===(e=n.div)||void 0===e?void 0:e.getBoundingClientRect()),n.elements.push(r),this.byName.set(r.getName(),r),this.save()}))}clearCurrentSelection(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.skipNextSelectionBroadcast=e;let n=new MouseEvent("click");null===(t=this.selecto)||void 0===t||t.clickTarget(n,this.div)}updateCurrentLayer(t){this.currentLayer=t,this.clearCurrentSelection(),this.save()}render(){const t=this.isPanelEditing||!this.isPanelEditing&&this.isEditingEnabled;return(0,d.jsxs)("div",{className:this.styles.wrap,style:this.style,ref:this.setRef,children:[this.root.render(),t&&(0,d.jsx)(x.Portal,{children:(0,d.jsx)(zs,{scene:this})})]},this.revId)}}const Ys=(0,x.stylesFactory)((t=>({wrap:g.css`
    overflow: hidden;
    position: relative;
  `,selected:g.css`
    z-index: 999 !important;
  `})));var Xs,Ws=n(21169),qs=n(53004),Hs=n.n(qs),Vs=n(87638),$s=n(17421),Ks=n(62597),Us=n(35327),Js=n(30090),Zs=n(64593),Qs=n(42724);const tc=t=>{let{onVerticalConstraintChange:e,onHorizontalConstraintChange:n,currentConstraints:r}=t;const i=(0,x.useStyles2)(ec(r));return(0,d.jsx)("svg",{version:"1.0",xmlns:"http://www.w3.org/2000/svg",width:"75.000000pt",height:"75.000000pt",viewBox:"0 0 228.000000 228.000000",preserveAspectRatio:"xMidYMid meet",style:{marginBottom:"4.8px"},children:(0,d.jsxs)("g",{transform:"translate(0.000000,228.000000) scale(0.100000,-0.100000)",fill:"#000000",stroke:"none",children:[Xs||(Xs=(0,d.jsx)("path",{fill:"#e5e5e5",d:"M198 2028 l-28 -32 0 -912 0 -912 31 -31 31 -31 915 0 915 0 29 29\n29 29 0 917 0 917 -27 29 -28 29 -920 0 -920 0 -27 -32z m1876 -17 c15 -16 16\n-98 16 -927 0 -860 -1 -909 -18 -926 -17 -17 -66 -18 -927 -18 -862 0 -910 1\n-927 18 -17 17 -18 65 -18 926 0 832 1 911 16 927 16 18 45 19 468 21 248 2\n659 2 912 0 431 -2 462 -4 478 -21z"})),(0,d.jsx)("rect",{className:i.topConstraint,height:"228",width:"46",y:"1735",x:"1123"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{e(a.fJ.Top)},height:"350",width:"300",y:"1680",x:"995",fill:"transparent"}),(0,d.jsx)("rect",{className:i.bottomConstraint,height:"228",width:"46",y:"210",x:"1123"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{e(a.fJ.Bottom)},height:"350",width:"300",y:"135",x:"995",fill:"transparent"}),(0,d.jsx)("rect",{className:i.leftConstraint,height:"46",width:"228",y:"1060",x:"265"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{n(a._5.Left)},height:"300",width:"350",y:"925",x:"200",fill:"transparent"}),(0,d.jsx)("rect",{className:i.rightConstraint,height:"46",width:"228",y:"1060",x:"1795"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{n(a._5.Right)},height:"300",width:"350",y:"925",x:"1730",fill:"transparent"}),(0,d.jsx)("path",{className:i.box,d:"M568 1669 c-17 -9 -18 -48 -18 -584 0 -558 1 -575 19 -585 27 -14\n1125 -14 1152 0 18 10 19 27 19 580 0 504 -2 570 -16 584 -14 14 -80 16 -577\n16 -363 -1 -568 -4 -579 -11z m1119 -42 c4 -5 4 -1079 0 -1084 -5 -4 -1079 -4\n-1084 0 -5 6 -4 1077 1 1085 4 7 1076 6 1083 -1z"}),(0,d.jsx)("rect",{className:i.verticalCenterConstraint,height:"456",width:"46",y:"855",x:"1123"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{e(a.fJ.Center)},height:"660",width:"300",y:"750",x:"995",fill:"transparent"}),(0,d.jsx)("rect",{className:i.horizontalCenterConstraint,height:"46",width:"456",y:"1060",x:"918"}),(0,d.jsx)("rect",{className:i.constraintHover,onClick:()=>{n(a._5.Center)},height:"300",width:"660",y:"925",x:"815",fill:"transparent"})]})})},ec=t=>e=>{const n=e.isDark?"#ffffff":"#000000";return{constraintHover:g.css`
      &:hover {
        fill: ${"#daebf7"};
        fill-opacity: ${"0.6"};
      }
    `,topConstraint:g.css`
      ${t.vertical===a.fJ.Top||t.vertical===a.fJ.TopBottom?"width: 92pt; x: 1085; fill: #0d99ff;":`fill: ${n};`}
    `,bottomConstraint:g.css`
      ${t.vertical===a.fJ.Bottom||t.vertical===a.fJ.TopBottom?"width: 92pt; x: 1085; fill: #0d99ff;":`fill: ${n};`}
    `,leftConstraint:g.css`
      ${t.horizontal===a._5.Left||t.horizontal===a._5.LeftRight?"height: 92pt; y: 1014; fill: #0d99ff;":`fill: ${n};`}
    `,rightConstraint:g.css`
      ${t.horizontal===a._5.Right||t.horizontal===a._5.LeftRight?"height: 92pt; y: 1014; fill: #0d99ff;":`fill: ${n};`}
    `,horizontalCenterConstraint:g.css`
      ${t.horizontal===a._5.Center?"height: 92pt; y: 1014; fill: #0d99ff;":`fill: ${n};`}
    `,verticalCenterConstraint:g.css`
      ${t.vertical===a.fJ.Center?"width: 92pt; x: 1085; fill: #0d99ff;":`fill: ${n};`}
    `,box:g.css`
      fill: ${n};
    `}},nc=t=>{let{onPositionChange:e,element:n,settings:r}=t;const i=(0,x.useStyles2)(rc),o=t=>{var r,i,o,l,u,f,d,p;const h={vertical:a.fJ.Top,horizontal:a._5.Left},v=Object.assign({},n.options.constraint);switch(n.options.constraint=h,n.setPlacementFromConstraint(),t){case a.Ru.Top:e(0,"top");break;case a.Ru.Bottom:e(c(null!==(r=null===(i=n.options.placement)||void 0===i?void 0:i.height)&&void 0!==r?r:0,"bottom"),"top");break;case a.Ru.VerticalCenter:e(s(null!==(o=null===(l=n.options.placement)||void 0===l?void 0:l.height)&&void 0!==o?o:0,"v"),"top");break;case a.Ru.Left:e(0,"left");break;case a.Ru.Right:e(c(null!==(u=null===(f=n.options.placement)||void 0===f?void 0:f.width)&&void 0!==u?u:0,"right"),"left");break;case a.Ru.HorizontalCenter:e(s(null!==(d=null===(p=n.options.placement)||void 0===p?void 0:p.width)&&void 0!==d?d:0,"h"),"left")}n.options.constraint=v,n.setPlacementFromConstraint()},s=(t,e)=>(("h"===e?r.scene.width:r.scene.height)-t)/2,c=(t,e)=>("right"===e?r.scene.width:r.scene.height)-t;return(0,d.jsxs)("div",{className:i.buttonGroup,children:[(0,d.jsx)(x.IconButton,{name:"horizontal-align-left",onClick:()=>o(a.Ru.Left),className:i.button,size:"lg",tooltip:"Align left"}),(0,d.jsx)(x.IconButton,{name:"horizontal-align-center",onClick:()=>o(a.Ru.HorizontalCenter),className:i.button,size:"lg",tooltip:"Align horizontal centers"}),(0,d.jsx)(x.IconButton,{name:"horizontal-align-right",onClick:()=>o(a.Ru.Right),className:i.button,size:"lg",tooltip:"Align right"}),(0,d.jsx)(x.IconButton,{name:"vertical-align-top",onClick:()=>o(a.Ru.Top),size:"lg",tooltip:"Align top"}),(0,d.jsx)(x.IconButton,{name:"vertical-align-center",onClick:()=>o(a.Ru.VerticalCenter),className:i.button,size:"lg",tooltip:"Align vertical centers"}),(0,d.jsx)(x.IconButton,{name:"vertical-align-bottom",onClick:()=>o(a.Ru.Bottom),className:i.button,size:"lg",tooltip:"Align bottom"})]})},rc=t=>({buttonGroup:g.css`
    display: flex;
    flex-wrap: wrap;
    padding: 12px 0 12px 0;
  `,button:g.css`
    margin-left: 5px;
    margin-right: 5px;
  `});var ic,oc,ac,sc;const cc=["top","left","bottom","right","width","height"],lc=[{label:"Left",value:a._5.Left},{label:"Right",value:a._5.Right},{label:"Left and right",value:a._5.LeftRight},{label:"Center",value:a._5.Center},{label:"Scale",value:a._5.Scale}],uc=[{label:"Top",value:a.fJ.Top},{label:"Bottom",value:a.fJ.Bottom},{label:"Top and bottom",value:a.fJ.TopBottom},{label:"Center",value:a.fJ.Center},{label:"Scale",value:a.fJ.Scale}],fc=t=>{var e,n;let{item:r}=t;const i=r.settings;if((0,Ks.Z)(null!=i&&i.scene?i.scene.moved:new Ka.x),!i)return ic||(ic=(0,d.jsx)("div",{children:"Loading..."}));const o=i.element;if(!o)return oc||(oc=(0,d.jsx)("div",{children:"???"}));const{options:a}=o,{placement:s,constraint:c}=a,l=()=>{setTimeout((()=>{i.scene.select({targets:[o.div]})}))},u=t=>{o.options.constraint.horizontal=t,o.setPlacementFromConstraint(),i.scene.revId++,i.scene.save(!0),l()},f=t=>{o.options.constraint.vertical=t,o.setPlacementFromConstraint(),i.scene.revId++,i.scene.save(!0),l()},p=(t,e)=>{o.options.placement[e]=null!=t?t:o.options.placement[e],o.applyLayoutStylesToDiv(),i.scene.clearCurrentSelection(!0),l()},h=null!==(e=null!==(n=o.tempConstraint)&&void 0!==n?n:c)&&void 0!==e?e:{};return(0,d.jsxs)("div",{children:[(0,d.jsx)(nc,{onPositionChange:p,settings:i,element:o}),ac||(ac=(0,d.jsx)("br",{})),(0,d.jsx)(x.Field,{label:"Constraints",children:(0,d.jsxs)(x.HorizontalGroup,{children:[(0,d.jsx)(tc,{onVerticalConstraintChange:f,onHorizontalConstraintChange:u,currentConstraints:h}),(0,d.jsxs)(x.VerticalGroup,{children:[(0,d.jsx)(x.Select,{options:uc,onChange:t=>{f(t.value)},value:h.vertical}),(0,d.jsx)(x.Select,{options:lc,onChange:t=>{u(t.value)},value:h.horizontal})]})]})}),sc||(sc=(0,d.jsx)("br",{})),(0,d.jsx)(x.Field,{label:"Position",children:(0,d.jsx)(d.Fragment,{children:cc.map((t=>{const e=s[t];return null==e?null:(0,d.jsx)(x.InlineFieldRow,{children:(0,d.jsx)(x.InlineField,{label:t,labelWidth:8,grow:!0,children:(0,d.jsx)(Qs.Y,{value:e,onChange:e=>p(e,t)})})},t)}))})})]})};var dc=n(36166);function pc(t){return{category:t.category,path:"--",values:e=>({getValue:e=>(0,i.get)(t.element.options,e),onChange:(e,n)=>{let r=t.element.options;if("type"===e&&n){const t=a.Jk.getIfExists(n);if(!t)return void console.warn("layer does not exist",n);r=Object.assign({},r,t.getNewOptions(r),{type:t.id})}else r=(0,Zs.hs)(r,e,n);t.element.onChange(r),t.element.updateData(t.scene.context)}}),build:(e,n)=>{var r;const{options:i}=t.element,o=a.Jk.selectOptions(null!=i&&i.type?[i.type]:[a.Nm.type]);e.addSelect({path:"type",name:void 0,settings:{options:o.options}});const s=a.Jk.getIfExists(null!==(r=null==i?void 0:i.type)&&void 0!==r?r:a.Nm.type);let c=i;c||(c=Object.assign({},s.getNewOptions(i),{type:s.id,name:`Element ${Date.now()}.${Math.floor(100*Math.random())}`}));const l=Object.assign({},n,{options:c});null!=s&&s.registerOptionsUI&&s.registerOptionsUI(e,l),dc.I.addBackground(e,l),dc.I.addBorder(e,l),e.addCustomEditor({category:["Layout"],id:"content",path:"__",name:"Quick placement",editor:fc,settings:t})}}}var hc,vc,gc,mc=n(5831),bc=n(38576),yc=n(12641);function xc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class Ec extends o.PureComponent{constructor(){super(...arguments),xc(this,"getScene",(()=>{const{settings:t}=this.props.item;if(null!=t&&t.layer)return t.layer.scene})),xc(this,"onAddItem",(t=>{var e;const{settings:n}=this.props.item;if(null==n||!n.layer)return;const{layer:r}=n,i=null!==(e=a.Jk.getIfExists(t.value))&&void 0!==e?e:s.C,o=i.getNewOptions();o.type=i.id;const c=new f.f(i,o,r);c.updateData(r.scene.context),r.elements.push(c),r.scene.save(),r.reinitializeMoveable()})),xc(this,"onSelect",(t=>{const{settings:e}=this.props.item;if(null!=e&&e.scene)try{let n={targets:[]};if(t instanceof v){const r=[];r.push(null==t?void 0:t.div),n.targets=r,n.frame=t,e.scene.select(n)}else if(t instanceof f.f){const r=[null==t?void 0:t.div];n.targets=r,e.scene.select(n)}}catch(t){mc.Z.emit(r.AppEvents.alertError,["Unable to select element, try selecting element in panel instead"])}})),xc(this,"onClearSelection",(()=>{const{settings:t}=this.props.item;if(null==t||!t.layer)return;const{layer:e}=t;e.scene.clearCurrentSelection()})),xc(this,"onDragEnd",(t=>{if(!t.destination)return;const{settings:e}=this.props.item;if(null==e||!e.layer)return;const{layer:n}=e,r=n.elements.length-1,i=-1*(t.source.index-r),o=-1*(t.destination.index-r);n.reorder(i,o)})),xc(this,"goUpLayer",(()=>{const t=this.props.item.settings;if(null==t||!t.layer||null==t||!t.scene)return;const{scene:e,layer:n}=t;n.parent&&e.updateCurrentLayer(n.parent)})),xc(this,"decoupleFrame",(()=>{const t=this.props.item.settings;if(null==t||!t.layer)return;const{layer:e}=t;this.deleteFrame(),e.elements.forEach((t=>{var n,r,i,o;const a=null===(n=t.div)||void 0===n?void 0:n.getBoundingClientRect();t.setPlacementFromConstraint(a,null===(r=e.parent)||void 0===r||null===(i=r.div)||void 0===i?void 0:i.getBoundingClientRect()),null===(o=e.parent)||void 0===o||o.doAction(c.Duplicate,t,!1,!1)}))})),xc(this,"onDecoupleFrame",(()=>{mc.Z.publish(new Ws.VJ({title:"Decouple frame",text:"Are you sure you want to decouple this frame?",text2:"This will remove the frame and push nested elements in the next level up.",confirmText:"Yes",yesText:"Decouple",onConfirm:async()=>{this.decoupleFrame()}}))})),xc(this,"deleteFrame",(()=>{var t;const e=this.props.item.settings;if(null==e||!e.layer)return;const{layer:n}=e,r=this.getScene();null==r||r.byName.delete(n.getName()),n.elements.forEach((t=>null==r?void 0:r.byName.delete(t.getName()))),null===(t=n.parent)||void 0===t||t.doAction(c.Delete,n),this.goUpLayer()})),xc(this,"onFrameSelection",(()=>{const t=this.getScene();t?t.frameSelection():console.warn("no scene!")})),xc(this,"onDeleteFrame",(()=>{mc.Z.publish(new Ws.VJ({title:"Delete frame",text:"Are you sure you want to delete this frame?",text2:"This will delete the frame and all nested elements.",icon:"trash-alt",confirmText:"Delete",yesText:"Delete",onConfirm:async()=>{this.deleteFrame()}}))}))}render(){const t=this.props.item.settings;if(!t)return hc||(hc=(0,d.jsx)("div",{children:"No settings"}));const e=t.layer;if(!e)return vc||(vc=(0,d.jsx)("div",{children:"Missing layer?"}));const n=t.selected?t.selected.map((t=>t.getName())):[];return(0,d.jsxs)(d.Fragment,{children:[!e.isRoot()&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x.Button,{icon:"angle-up",size:"sm",variant:"secondary",onClick:this.goUpLayer,children:"Go up level"}),(0,d.jsx)(x.Button,{size:"sm",variant:"secondary",onClick:()=>this.onSelect(e),children:"Select frame"}),(0,d.jsx)(x.Button,{size:"sm",variant:"secondary",onClick:()=>this.onDecoupleFrame(),children:"Decouple frame"}),(0,d.jsx)(x.Button,{size:"sm",variant:"secondary",onClick:()=>this.onDeleteFrame(),children:"Delete frame"})]}),(0,d.jsx)(yc.E,{onDragEnd:this.onDragEnd,onSelect:this.onSelect,onDelete:t=>{e.doAction(c.Delete,t)},onDuplicate:t=>{e.doAction(c.Duplicate,t)},getLayerInfo:t=>t.options.type,onNameChange:(t,e)=>{t.onChange(Object.assign({},t.options,{name:e}))},verifyLayerNameUniqueness:t=>{const e=this.getScene();return Boolean(null==e?void 0:e.canRename(t))},showActions:t=>!(t instanceof v),layers:e.elements,selection:n}),gc||(gc=(0,d.jsx)("br",{})),(0,d.jsxs)(x.HorizontalGroup,{children:[(0,d.jsx)(bc.f,{onChange:this.onAddItem,options:a.Jk.selectOptions().options,label:"Add item"}),n.length>0&&(0,d.jsx)(x.Button,{size:"sm",variant:"secondary",onClick:this.onClearSelection,children:"Clear selection"}),n.length>1&&(0,d.jsx)(x.Button,{size:"sm",variant:"secondary",onClick:this.onFrameSelection,children:"Frame selection"})]})]})}}function Sc(t){const{selected:e,scene:n}=t;if(n.currentLayer||(n.currentLayer=n.root),e)for(const t of e){if(t instanceof v){n.currentLayer=t;break}if(t.parent){n.currentLayer=t.parent;break}}const r=n.currentLayer.options||{elements:[]};return{category:["Layer"],path:"--",values:t=>({getValue:t=>(0,i.get)(r,t),onChange:(t,e)=>{var i,o;if("type"===t&&e)return void console.warn("unable to change layer type");const a=(0,Zs.hs)(r,t,e);null===(i=n.currentLayer)||void 0===i||i.onChange(a),null===(o=n.currentLayer)||void 0===o||o.updateData(n.context)}}),build:(i,o)=>{const a=n.currentLayer;a&&a.isRoot(),i.addCustomEditor({id:"content",path:"root",name:"Elements",editor:Ec,settings:{scene:n,layer:n.currentLayer,selected:e}});const s=Object.assign({},o,{options:r});dc.I.addBackground(i,s),dc.I.addBorder(i,s),a&&!a.isRoot()&&i.addCustomEditor({category:["Layout"],id:"content",path:"__",name:"Constraints",editor:fc,settings:{scene:t.scene,element:a}})}}}const Cc=()=>{var t;const e=(0,Ks.Z)(kc),n=null==e||null===(t=e.panel.context)||void 0===t?void 0:t.instanceState,r=(0,o.useMemo)((()=>{const t=n;if(!t)return new Us.j({id:"root",title:"root"});return function(t,e){const n={data:t.input,options:t.options},r=new Us.j({id:"root",title:"root"}),o=t=>{if(null!=t&&t.length){const e=t[0];let n=r.categories.find((t=>t.props.id===e));return n||(n=new Us.j({id:e,title:e}),r.categories.push(n)),n}return r},a={getValue:e=>(0,i.get)(t.options,e),onChange:(e,n)=>{t.onChange((0,Zs.hs)(t.options,e,n))}};return(0,Js.HZ)(e,a,o,n),r}({},((e,r)=>{e.addNestedOptions(Sc(n));const i=t.selected;if(1===(null==i?void 0:i.length)){const n=i[0];n instanceof v||e.addNestedOptions(pc({category:[`Selected element (${n.options.name})`],element:n,scene:t.scene}))}}))}),[n]);return(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{children:r.items.map((t=>t.render()))}),(0,d.jsx)("div",{children:r.categories.map((t=>(0,d.jsxs)("div",{children:[(0,d.jsx)("h5",{children:t.props.title}),(0,d.jsx)("div",{children:t.items.map((t=>t.render()))})]},t.props.id)))})]})};var wc,Dc;const Mc=t=>{let{onClose:e}=t;const n=document.querySelector("[data-btninlineedit]").getBoundingClientRect(),r=(0,o.useRef)(null),i=(0,x.useStyles2)(Rc),a="inlineEditPanel",s=350,c=400,l=n.x+70,u=n.y-c,f=$s.Z.getObject(a,{x:l,y:u,w:s,h:c}),[p,h]=(0,o.useState)({width:f.w,height:f.h}),[v,g]=(0,o.useState)({x:f.x,y:f.y}),m=(t,e,n,r)=>{$s.Z.setObject(a,{x:t,y:e,w:n,h:r})};return(0,d.jsx)(x.Portal,{children:(0,d.jsx)("div",{className:i.draggableWrapper,children:(0,d.jsx)(Hs(),{handle:"strong",onStop:(t,e)=>{let n=e.x<0?0:e.x,r=e.y<0?0:e.y;g({x:n,y:r}),m(n,r,p.width,p.height)},position:{x:v.x,y:v.y},children:(0,d.jsx)(Vs.Resizable,{height:p.height,width:p.width,onResize:(t,e)=>{const{size:n}=e;h({width:n.width,height:n.height}),m(v.x,v.y,n.width,n.height)},children:(0,d.jsxs)("div",{className:i.inlineEditorContainer,style:{height:`${p.height}px`,width:`${p.width}px`},ref:r,children:[(0,d.jsxs)("strong",{className:i.inlineEditorHeader,children:[(0,d.jsx)("div",{className:i.placeholder}),wc||(wc=(0,d.jsx)("div",{children:"Canvas Inline Editor"})),(0,d.jsx)(x.IconButton,{name:"times",size:"xl",className:i.inlineEditorClose,onClick:e})]}),(0,d.jsx)("div",{className:i.inlineEditorContentWrapper,children:(0,d.jsx)("div",{className:i.inlineEditorContent,children:Dc||(Dc=(0,d.jsx)(Cc,{}))})})]})})})})})},Rc=t=>({inlineEditorContainer:g.css`
    display: flex;
    flex-direction: column;
    background: ${t.v1.colors.panelBg};
    box-shadow: 5px 5px 20px -5px #000000;
    z-index: 1000;
    opacity: 1;
  `,draggableWrapper:g.css`
    width: 0;
    height: 0;
  `,inlineEditorHeader:g.css`
    display: flex;
    align-items: center;
    justify-content: center;
    background: ${t.colors.background.canvas};
    border: 1px solid ${t.colors.border.weak};
    height: 40px;
    cursor: move;
  `,inlineEditorContent:g.css`
    white-space: pre-wrap;
    padding: 10px;
  `,inlineEditorClose:g.css`
    margin-left: auto;
  `,placeholder:g.css`
    width: 24px;
    height: 24px;
    visibility: hidden;
    margin-right: auto;
  `,inlineEditorContentWrapper:g.css`
    overflow: scroll;
  `});function Oc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}let Pc,_c=[],Bc=!1;const kc=new m.t(1);class Tc extends o.Component{constructor(t){super(t),Oc(this,"panelContext",{}),Oc(this,"scene",void 0),Oc(this,"subs",new b.w0),Oc(this,"needsReload",!1),Oc(this,"styles",zc(y.config.theme)),Oc(this,"isEditing",void 0!==y.locationService.getSearchObject().editPanel),Oc(this,"onUpdateScene",(t=>{const{onOptionsChange:e,options:n}=this.props;e(Object.assign({},n,{root:t})),this.setState({refresh:this.state.refresh+1})})),Oc(this,"inlineEditButtonClick",(()=>{if(Bc)return this.forceUpdate(),void this.setActivePanel();this.setActivePanel(),this.setState({openInlineEdit:!0}),Bc=!0})),Oc(this,"inlineEditButtonClose",(()=>{this.setState({openInlineEdit:!1}),Bc=!1})),Oc(this,"setActivePanel",(()=>{Pc=this,kc.next({panel:this})})),Oc(this,"renderInlineEdit",(()=>(0,d.jsx)(Mc,{onClose:()=>this.inlineEditButtonClose()}))),this.state={refresh:0,openInlineEdit:!1},this.scene=new Ls(this.props.options.root,this.props.options.inlineEditing,this.onUpdateScene),this.scene.updateSize(t.width,t.height),this.scene.updateData(t.data),this.subs.add(this.props.eventBus.subscribe(Ws.xF,(t=>{this.scene.clearCurrentSelection(),this.inlineEditButtonClose()}))),this.subs.add(this.props.eventBus.subscribe(Ws.Yr,(t=>{this.props.id===t.payload&&(this.needsReload=!0)})))}componentDidMount(){Pc=this,kc.next({panel:this}),this.panelContext=this.context,this.panelContext.onInstanceStateChange&&(this.panelContext.onInstanceStateChange({scene:this.scene,layer:this.scene.root}),this.subs.add(this.scene.selection.subscribe({next:t=>{this.panelContext.onInstanceStateChange({scene:this.scene,selected:t,layer:this.scene.root}),Pc=this,kc.next({panel:this}),_c.forEach((t=>{t!==Pc&&t.scene.clearCurrentSelection(!0)}))}}))),_c.push(this)}componentWillUnmount(){this.subs.unsubscribe(),Bc=!1,_c=_c.filter((t=>{var e;return t.props.id!==(null===(e=Pc)||void 0===e?void 0:e.props.id)}))}shouldComponentUpdate(t,e){const{width:n,height:r,data:i}=this.props;let o=!1;n===t.width&&r===t.height||(this.scene.updateSize(t.width,t.height),o=!0),i!==t.data&&(this.scene.updateData(t.data),o=!0),this.state.refresh!==e.refresh&&(o=!0),this.state.openInlineEdit!==e.openInlineEdit&&(o=!0);const a=this.needsReload&&this.props.options!==t.options,s=this.props.options.inlineEditing!==t.options.inlineEditing;var c;(a||s)&&(this.needsReload=!1,this.scene.load(t.options.root,t.options.inlineEditing),this.scene.updateSize(t.width,t.height),this.scene.updateData(t.data),o=!0,s&&this.props.options.inlineEditing&&(null===(c=this.scene.selecto)||void 0===c||c.destroy()));return o}render(){return(0,d.jsxs)(d.Fragment,{children:[this.scene.render(),this.props.options.inlineEditing&&!this.isEditing&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:this.styles.inlineEditButton,children:(0,d.jsx)(x.Button,{size:"lg",variant:"secondary",icon:"edit","data-btninlineedit":this.props.id,onClick:this.inlineEditButtonClick})}),this.state.openInlineEdit&&this.renderInlineEdit()]})]})}}Oc(Tc,"contextType",x.PanelContextRoot);const zc=(0,x.stylesFactory)((t=>({inlineEditButton:g.css`
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 999;
  `}))),jc=new r.PanelPlugin(Tc).setNoPadding().useFieldConfig().setPanelOptions(((t,e)=>{const n=e.instanceState;if(t.addBooleanSwitch({path:"inlineEditing",name:"Inline editing",description:"Enable editing the panel directly",defaultValue:!0}),n){t.addNestedOptions(Sc(n));const e=n.selected;if(1===(null==e?void 0:e.length)){const r=e[0];r instanceof v||t.addNestedOptions(pc({category:[`Selected element (${r.options.name})`],element:r,scene:n.scene}))}}}))},62597:(t,e,n)=>{n.d(e,{Z:()=>o});var r=n(68404),i=n(40268);const o=function(t,e){var n=(0,r.useState)(e),o=n[0],a=n[1];return(0,i.Z)((function(){var e=t.subscribe(a);return function(){return e.unsubscribe()}}),[t]),o}}}]);
//# sourceMappingURL=canvasPanel.0699b14dc04956d607e8.js.map