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AI,EAAY,EAAI,EAAY,EAAI,EAAS,EAAI,EAAS,EAC7F,EAAS,EAAI,EAAI,EAAO,EAAY,EACpC,EAAS,EAAI,EAAS,EAAI,EAAS,EAAI,EAAY,EAAI,EAAY,EAAI,EAAS,EAAI,EAAS,EAG7F,IACA,EAAY,GACZ,EAAO,aAAe,EAAO,YAAY,EAAU,KAAI,EAkCvD,GA/B0B,IAC1B,MAAM,EAAI,EAAE,MACN,EAAI,EAAE,MAEZ,IAEA,MAAM,EAAO,EAAS,EAChB,EAAO,EAAS,EAEtB,EAAS,EAAI,EAAI,EAAY,EAAI,EAAI,EAAI,EAAI,EAAY,EACzD,EAAS,EAAI,EAAS,EAAI,EAAO,EAAS,EAC1C,EAAS,EAAI,EAAI,EAAO,EAAY,EACpC,EAAS,EAAI,EAAS,EAAI,EAAS,EAAI,EAAY,EAAI,EAAY,EAAI,EAAS,EAAI,EAAS,EAE7F,IACA,EAAY,GACZ,EAAO,aAAe,EAAO,YAAY,EAAU,KAAI,GAiBrD,EAAiB,KACjB,EACF,KAAK,GAAK,QAAU,OACtB,EAAS,QAAU,EAAQ,iBAAiB,QAAS,GACrD,EAAY,GAAU,GAEtB,KAAK,YAAe,IAClB,EAAY,IAAK,KAAa,GAAU,EAG1C,KAAK,OAAS,KACZ,EAAQ,iBAAiB,QAAS,EAAU,EAG9C,KAAK,SAAW,KACd,EAAQ,oBAAoB,QAAS,EAAU,CAEnD,iBAGa","file":"/npm/asw-drag-resize@1.0.4/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/asw-drag-resize@1.0.4/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const defaultBoxShape = {\n  h: 100,\n  w: 100,\n  x: 100,\n  y: 0,\n  hr: true,\n  wr: false,\n  xr: false,\n  yr: false,\n  move: true\n}\n\nconst defaultOffset = {\n  x: 0,\n  y: 0\n}\n\nconst defaultParentShape = {\n  h: 100,\n  w: 100,\n  x: 0,\n  y: 0\n}\n\nconst uuid = () => {\n  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>\n    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)\n  );\n}\n\nclass AswDragResize {\n\n  constructor(element, parentElement = document.body, { boxShape, events = {} }) {\n    const makeActive = (e) => {\n      e.preventDefault()\n      e.stopPropagation()\n      if (boxShape.active) {\n        setParentShape()\n        mask = document.getElementById(this.id)\n        if (!mask) {\n          mask = document.createElement('div')\n          mask.setAttribute('class', 'asw-dr-mask')\n          mask.setAttribute('id', this.id)\n          mask.innerHTML = `<div class=\"mask-container\">\n          <div class=\"resizer top-left\" value=\"tl\" ></div>\n          <div class=\"resizer top-right\" value=\"tr\" ></div>\n          <div class=\"resizer bottom-left\" value=\"bl\" ></div>\n          <div class=\"resizer bottom-right\" value=\"br\" ></div>\n          <div class=\"moving-mask\" id=\"moving_mask\" tabindex=\"1\"></div>\n        </div>`\n          document.body.append(mask)\n        } else {\n          mask.style.display = 'block'\n        }\n        mask.addEventListener('click', mask_click)\n        changeShape(boxShape)\n        active_drag()\n        active_resize()\n        window.addEventListener('click', checkClickOutside)\n        events.onActive && events.onActive(boxShape)\n      }\n    }\n\n    const checkClickOutside = (e) => {\n      if (!mask.contains(e.target)) {\n        window.removeEventListener('click', checkClickOutside)\n        inactive_drag()\n        inactive_resize()\n        mask.style.display = 'none'\n        events.onInactive && events.onInactive(boxShape)\n      }\n    }\n\n    const changeShape = (boxShape, withMask = true) => {\n\n      element.style.top = boxShape.y + (boxShape.yr ? '%' : 'px')\n      element.style.left = boxShape.x + (boxShape.xr ? '%' : 'px')\n      element.style.height = boxShape.h + (boxShape.hr ? '%' : 'px')\n      element.style.width = boxShape.w + (boxShape.wr ? '%' : 'px')\n      if (withMask) {\n        const elementBondingBox = element.getBoundingClientRect()\n        mask.style.top = elementBondingBox.top + 'px'\n        mask.style.left = elementBondingBox.left + 'px'\n        mask.style.width = elementBondingBox.width + 'px'\n        mask.style.height = elementBondingBox.height + 'px'\n      }\n    }\n\n    const setParentShape = () => {\n      const tempParentShape = parentElement.getBoundingClientRect()\n      parentShape.h = tempParentShape.height\n      parentShape.w = tempParentShape.width\n      parentShape.x = tempParentShape.x\n      parentShape.y = tempParentShape.y\n    }\n\n    const setOffset = (e) => {\n      offset.x = e.offsetX\n      offset.y = e.offsetY\n    }\n\n    const per_to_px = () => {\n      boxShape.x = boxShape.xr ? ((parentShape.w * boxShape.x) / 100) : boxShape.x\n      boxShape.y = boxShape.yr ? ((parentShape.h * boxShape.y) / 100) : boxShape.y\n      boxShape.w = boxShape.wr ? ((parentShape.w * boxShape.w) / 100) : boxShape.w\n      boxShape.h = boxShape.hr ? ((parentShape.h * boxShape.h) / 100) : boxShape.h\n    }\n\n    const px_to_per = () => {\n      boxShape.x = boxShape.xr ? (boxShape.x * 100) / parentShape.w : boxShape.x\n      boxShape.y = boxShape.yr ? (boxShape.y * 100) / parentShape.h : boxShape.y\n      boxShape.w = boxShape.wr ? (boxShape.w * 100) / parentShape.w : boxShape.w\n      boxShape.h = boxShape.hr ? (boxShape.h * 100) / parentShape.h : boxShape.h\n    }\n\n    const mask_click = (e) => {\n      events.maskClick && events.maskClick(e, boxShape)\n    }\n\n    const active_drag = () => {\n      movingMask = mask.querySelector('#moving_mask')\n      movingMask.addEventListener('mousedown', start_drag)\n      window.addEventListener('mouseup', stop_drag)\n      events.onDragActive && events.onDragActive(boxShape)\n    }\n\n    const inactive_drag = () => {\n      movingMask.removeEventListener('mousedown', start_drag)\n      window.removeEventListener('mouseup', stop_drag)\n      events.onDragInactive && events.onDragInactive(boxShape)\n    }\n\n    const start_drag = (e) => {\n      e.preventDefault()\n      setParentShape()\n      setOffset(e)\n      window.addEventListener('mousemove', draging)\n      events.onDragStart && events.onDragStart(boxShape)\n    }\n\n    const stop_drag = (e) => {\n      e.preventDefault()\n      window.removeEventListener('mousemove', draging)\n      events.onDragStop && events.onDragStop(boxShape)\n\n    }\n\n    const draging = (e) => {\n      e.preventDefault()\n      const x = e.pageX\n      const y = e.pageY\n\n      per_to_px()\n\n      boxShape.x = x - parentShape.x - offset.x\n      boxShape.x = boxShape.x < 0 ? 0 : boxShape.x\n      boxShape.x = boxShape.x > parentShape.w - boxShape.w ? parentShape.w - boxShape.w : boxShape.x\n\n      boxShape.y = y - parentShape.y - offset.y\n      boxShape.y = boxShape.y < 0 ? 0 : boxShape.y\n      boxShape.y = boxShape.y > parentShape.h - boxShape.h ? parentShape.h - boxShape.h : boxShape.y\n\n      px_to_per()\n      changeShape(boxShape)\n      events.onDraging && events.onDraging(boxShape)\n    }\n\n    const active_resize = () => {\n      resize_selectors = mask.querySelectorAll('.resizer') || []\n      resize_selectors.forEach(resize => resize.addEventListener('mousedown', start_resize))\n      window.addEventListener('mouseup', stop_resize)\n      events.onResizeActive && events.onResizeActive(boxShape)\n    }\n\n    const inactive_resize = () => {\n      resize_selectors = mask.querySelectorAll('.resizer') || []\n      resize_selectors.forEach(resize => resize.removeEventListener('mousedown', start_resize))\n      window.removeEventListener('mouseup', stop_resize)\n      events.onResizeInactive && events.onResizeInactive(boxShape)\n    }\n\n    const start_resize = (e) => {\n      e.preventDefault()\n      active_resizer = e.target.getAttribute('value')\n      window.addEventListener('mousemove', resizer_event_map[active_resizer])\n      events.onResizeStart && events.onResizeStart(boxShape)\n    }\n\n    const stop_resize = (e) => {\n      e.preventDefault()\n      window.removeEventListener('mousemove', resizer_event_map[active_resizer])\n      events.onResizeStop && events.onResizeStop(boxShape)\n    }\n\n    const resize_top_left = (e) => {\n      const x = e.pageX\n      const y = e.pageY\n\n      per_to_px()\n\n      const boxX = boxShape.x\n      const boxY = boxShape.y\n\n      boxShape.x = x - parentShape.x < 0 ? 0 : x - parentShape.x\n      boxShape.y = y - parentShape.y < 0 ? 0 : y - parentShape.y\n      boxShape.w = boxShape.w + boxX - boxShape.x\n      boxShape.h = boxShape.h + boxY - boxShape.y\n\n      px_to_per()\n      changeShape(boxShape)\n      events.onResizeing && events.onResizeing(boxShape, 'tl')\n    }\n\n    const resize_top_right = (e) => {\n      const x = e.pageX\n      const y = e.pageY\n\n      per_to_px()\n\n      const boxX = boxShape.x\n      const boxY = boxShape.y\n\n      boxShape.y = y - parentShape.y < 0 ? 0 : y - parentShape.y\n      boxShape.h = boxShape.h + boxY - boxShape.y\n      boxShape.w = x - boxX - parentShape.x\n      boxShape.w = boxShape.w + boxShape.x > parentShape.w ? parentShape.w - boxShape.x : boxShape.w\n\n\n      px_to_per()\n      changeShape(boxShape)\n      events.onResizeing && events.onResizeing(boxShape, 'tr')\n    }\n\n    const resize_bottom_right = (e) => {\n      const x = e.pageX\n      const y = e.pageY\n\n      per_to_px()\n\n      const boxX = boxShape.x\n      const boxY = boxShape.y\n\n      boxShape.w = x - boxX - parentShape.x\n      boxShape.w = boxShape.w + boxShape.x > parentShape.w ? parentShape.w - boxShape.x : boxShape.w\n      boxShape.h = y - boxY - parentShape.y\n      boxShape.h = boxShape.h + boxShape.y > parentShape.h ? parentShape.h - boxShape.y : boxShape.h\n\n\n      px_to_per()\n      changeShape(boxShape)\n      events.onResizeing && events.onResizeing(boxShape, 'br')\n    }\n\n    const resize_bottom_left = (e) => {\n      const x = e.pageX\n      const y = e.pageY\n\n      per_to_px()\n\n      const boxX = boxShape.x\n      const boxY = boxShape.y\n\n      boxShape.x = x - parentShape.x < 0 ? 0 : x - parentShape.x\n      boxShape.w = boxShape.w + boxX - boxShape.x\n      boxShape.h = y - boxY - parentShape.y\n      boxShape.h = boxShape.h + boxShape.y > parentShape.h ? parentShape.h - boxShape.y : boxShape.h\n\n      px_to_per()\n      changeShape(boxShape)\n      events.onResizeing && events.onResizeing(boxShape, 'bl')\n    }\n\n    boxShape = boxShape || { ...defaultBoxShape }\n    parentElement = parentElement || document.body\n    parentElement.style.position = 'relative'\n    element.style.position = 'absolute'\n    let parentShape = { ...defaultParentShape }\n    let offset = { ...defaultOffset }\n    let movingMask = null\n    let resize_selectors = null\n    let resizer_event_map = {\n      tl: resize_top_left,\n      tr: resize_top_right,\n      br: resize_bottom_right,\n      bl: resize_bottom_left\n    }\n    let active_resizer = null\n    let mask =\n      this.id = 'mask-' + uuid()\n    boxShape.active && element.addEventListener('click', makeActive)\n    changeShape(boxShape, false)\n\n    this.setBoxShape = (newShape) => {\n      changeShape({ ...boxShape, ...newShape })\n    }\n\n    this.active = () => {\n      element.addEventListener('click', makeActive)\n    }\n\n    this.inactive = () => {\n      element.removeEventListener('click', makeActive)\n    }\n  }\n}\n\nexport default AswDragResize"]}