tildefriends/core/split.min.js.map
2021-12-22 15:05:08 +00:00

1 line
37 KiB
Plaintext

{"version":3,"file":"split.min.js","sources":["../src/split.js"],"sourcesContent":["// The programming goals of Split.js are to deliver readable, understandable and\n// maintainable code, while at the same time manually optimizing for tiny minified file size,\n// browser compatibility without additional requirements\n// and very few assumptions about the user's page layout.\nconst global = typeof window !== 'undefined' ? window : null\nconst ssr = global === null\nconst document = !ssr ? global.document : undefined\n\n// Save a couple long function names that are used frequently.\n// This optimization saves around 400 bytes.\nconst addEventListener = 'addEventListener'\nconst removeEventListener = 'removeEventListener'\nconst getBoundingClientRect = 'getBoundingClientRect'\nconst gutterStartDragging = '_a'\nconst aGutterSize = '_b'\nconst bGutterSize = '_c'\nconst HORIZONTAL = 'horizontal'\nconst NOOP = () => false\n\n// Helper function determines which prefixes of CSS calc we need.\n// We only need to do this once on startup, when this anonymous function is called.\n//\n// Tests -webkit, -moz and -o prefixes. Modified from StackOverflow:\n// http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167\nconst calc = ssr\n ? 'calc'\n : `${['', '-webkit-', '-moz-', '-o-']\n .filter(prefix => {\n const el = document.createElement('div')\n el.style.cssText = `width:${prefix}calc(9px)`\n\n return !!el.style.length\n })\n .shift()}calc`\n\n// Helper function checks if its argument is a string-like type\nconst isString = v => typeof v === 'string' || v instanceof String\n\n// Helper function allows elements and string selectors to be used\n// interchangeably. In either case an element is returned. This allows us to\n// do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`.\nconst elementOrSelector = el => {\n if (isString(el)) {\n const ele = document.querySelector(el)\n if (!ele) {\n throw new Error(`Selector ${el} did not match a DOM element`)\n }\n return ele\n }\n\n return el\n}\n\n// Helper function gets a property from the properties object, with a default fallback\nconst getOption = (options, propName, def) => {\n const value = options[propName]\n if (value !== undefined) {\n return value\n }\n return def\n}\n\nconst getGutterSize = (gutterSize, isFirst, isLast, gutterAlign) => {\n if (isFirst) {\n if (gutterAlign === 'end') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n } else if (isLast) {\n if (gutterAlign === 'start') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n }\n\n return gutterSize\n}\n\n// Default options\nconst defaultGutterFn = (i, gutterDirection) => {\n const gut = document.createElement('div')\n gut.className = `gutter gutter-${gutterDirection}`\n return gut\n}\n\nconst defaultElementStyleFn = (dim, size, gutSize) => {\n const style = {}\n\n if (!isString(size)) {\n style[dim] = `${calc}(${size}% - ${gutSize}px)`\n } else {\n style[dim] = size\n }\n\n return style\n}\n\nconst defaultGutterStyleFn = (dim, gutSize) => ({ [dim]: `${gutSize}px` })\n\n// The main function to initialize a split. Split.js thinks about each pair\n// of elements as an independant pair. Dragging the gutter between two elements\n// only changes the dimensions of elements in that pair. This is key to understanding\n// how the following functions operate, since each function is bound to a pair.\n//\n// A pair object is shaped like this:\n//\n// {\n// a: DOM element,\n// b: DOM element,\n// aMin: Number,\n// bMin: Number,\n// dragging: Boolean,\n// parent: DOM element,\n// direction: 'horizontal' | 'vertical'\n// }\n//\n// The basic sequence:\n//\n// 1. Set defaults to something sane. `options` doesn't have to be passed at all.\n// 2. Initialize a bunch of strings based on the direction we're splitting.\n// A lot of the behavior in the rest of the library is paramatized down to\n// rely on CSS strings and classes.\n// 3. Define the dragging helper functions, and a few helpers to go with them.\n// 4. Loop through the elements while pairing them off. Every pair gets an\n// `pair` object and a gutter.\n// 5. Actually size the pair elements, insert gutters and attach event listeners.\nconst Split = (idsOption, options = {}) => {\n if (ssr) return {}\n\n let ids = idsOption\n let dimension\n let clientAxis\n let position\n let positionEnd\n let clientSize\n let elements\n\n // Allow HTMLCollection to be used as an argument when supported\n if (Array.from) {\n ids = Array.from(ids)\n }\n\n // All DOM elements in the split should have a common parent. We can grab\n // the first elements parent and hope users read the docs because the\n // behavior will be whacky otherwise.\n const firstElement = elementOrSelector(ids[0])\n const parent = firstElement.parentNode\n const parentStyle = getComputedStyle ? getComputedStyle(parent) : null\n const parentFlexDirection = parentStyle ? parentStyle.flexDirection : null\n\n // Set default options.sizes to equal percentages of the parent element.\n let sizes = getOption(options, 'sizes') || ids.map(() => 100 / ids.length)\n\n // Standardize minSize and maxSize to an array if it isn't already.\n // This allows minSize and maxSize to be passed as a number.\n const minSize = getOption(options, 'minSize', 100)\n const minSizes = Array.isArray(minSize) ? minSize : ids.map(() => minSize)\n const maxSize = getOption(options, 'maxSize', Infinity)\n const maxSizes = Array.isArray(maxSize) ? maxSize : ids.map(() => maxSize)\n\n // Get other options\n const expandToMin = getOption(options, 'expandToMin', false)\n const gutterSize = getOption(options, 'gutterSize', 10)\n const gutterAlign = getOption(options, 'gutterAlign', 'center')\n const snapOffset = getOption(options, 'snapOffset', 30)\n const dragInterval = getOption(options, 'dragInterval', 1)\n const direction = getOption(options, 'direction', HORIZONTAL)\n const cursor = getOption(\n options,\n 'cursor',\n direction === HORIZONTAL ? 'col-resize' : 'row-resize',\n )\n const gutter = getOption(options, 'gutter', defaultGutterFn)\n const elementStyle = getOption(\n options,\n 'elementStyle',\n defaultElementStyleFn,\n )\n const gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn)\n\n // 2. Initialize a bunch of strings based on the direction we're splitting.\n // A lot of the behavior in the rest of the library is paramatized down to\n // rely on CSS strings and classes.\n if (direction === HORIZONTAL) {\n dimension = 'width'\n clientAxis = 'clientX'\n position = 'left'\n positionEnd = 'right'\n clientSize = 'clientWidth'\n } else if (direction === 'vertical') {\n dimension = 'height'\n clientAxis = 'clientY'\n position = 'top'\n positionEnd = 'bottom'\n clientSize = 'clientHeight'\n }\n\n // 3. Define the dragging helper functions, and a few helpers to go with them.\n // Each helper is bound to a pair object that contains its metadata. This\n // also makes it easy to store references to listeners that that will be\n // added and removed.\n //\n // Even though there are no other functions contained in them, aliasing\n // this to self saves 50 bytes or so since it's used so frequently.\n //\n // The pair object saves metadata like dragging state, position and\n // event listener references.\n\n function setElementSize(el, size, gutSize, i) {\n // Split.js allows setting sizes via numbers (ideally), or if you must,\n // by string, like '300px'. This is less than ideal, because it breaks\n // the fluid layout that `calc(% - px)` provides. You're on your own if you do that,\n // make sure you calculate the gutter size by hand.\n const style = elementStyle(dimension, size, gutSize, i)\n\n Object.keys(style).forEach(prop => {\n // eslint-disable-next-line no-param-reassign\n el.style[prop] = style[prop]\n })\n }\n\n function setGutterSize(gutterElement, gutSize, i) {\n const style = gutterStyle(dimension, gutSize, i)\n\n Object.keys(style).forEach(prop => {\n // eslint-disable-next-line no-param-reassign\n gutterElement.style[prop] = style[prop]\n })\n }\n\n function getSizes() {\n return elements.map(element => element.size)\n }\n\n // Supports touch events, but not multitouch, so only the first\n // finger `touches[0]` is counted.\n function getMousePosition(e) {\n if ('touches' in e) return e.touches[0][clientAxis]\n return e[clientAxis]\n }\n\n // Actually adjust the size of elements `a` and `b` to `offset` while dragging.\n // calc is used to allow calc(percentage + gutterpx) on the whole split instance,\n // which allows the viewport to be resized without additional logic.\n // Element a's size is the same as offset. b's size is total size - a size.\n // Both sizes are calculated from the initial parent percentage,\n // then the gutter size is subtracted.\n function adjust(offset) {\n const a = elements[this.a]\n const b = elements[this.b]\n const percentage = a.size + b.size\n\n a.size = (offset / this.size) * percentage\n b.size = percentage - (offset / this.size) * percentage\n\n setElementSize(a.element, a.size, this[aGutterSize], a.i)\n setElementSize(b.element, b.size, this[bGutterSize], b.i)\n }\n\n // drag, where all the magic happens. The logic is really quite simple:\n //\n // 1. Ignore if the pair is not dragging.\n // 2. Get the offset of the event.\n // 3. Snap offset to min if within snappable range (within min + snapOffset).\n // 4. Actually adjust each element in the pair to offset.\n //\n // ---------------------------------------------------------------------\n // | | <- a.minSize || b.minSize -> | |\n // | | | <- this.snapOffset || this.snapOffset -> | | |\n // | | | || | | |\n // | | | || | | |\n // ---------------------------------------------------------------------\n // | <- this.start this.size -> |\n function drag(e) {\n let offset\n const a = elements[this.a]\n const b = elements[this.b]\n\n if (!this.dragging) return\n\n // Get the offset of the event from the first side of the\n // pair `this.start`. Then offset by the initial position of the\n // mouse compared to the gutter size.\n offset =\n getMousePosition(e) -\n this.start +\n (this[aGutterSize] - this.dragOffset)\n\n if (dragInterval > 1) {\n offset = Math.round(offset / dragInterval) * dragInterval\n }\n\n // If within snapOffset of min or max, set offset to min or max.\n // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both.\n // Include the appropriate gutter sizes to prevent overflows.\n if (offset <= a.minSize + snapOffset + this[aGutterSize]) {\n offset = a.minSize + this[aGutterSize]\n } else if (\n offset >=\n this.size - (b.minSize + snapOffset + this[bGutterSize])\n ) {\n offset = this.size - (b.minSize + this[bGutterSize])\n }\n\n if (offset >= a.maxSize - snapOffset + this[aGutterSize]) {\n offset = a.maxSize + this[aGutterSize]\n } else if (\n offset <=\n this.size - (b.maxSize - snapOffset + this[bGutterSize])\n ) {\n offset = this.size - (b.maxSize + this[bGutterSize])\n }\n\n // Actually adjust the size.\n adjust.call(this, offset)\n\n // Call the drag callback continously. Don't do anything too intensive\n // in this callback.\n getOption(options, 'onDrag', NOOP)(getSizes())\n }\n\n // Cache some important sizes when drag starts, so we don't have to do that\n // continously:\n //\n // `size`: The total size of the pair. First + second + first gutter + second gutter.\n // `start`: The leading side of the first element.\n //\n // ------------------------------------------------\n // | aGutterSize -> ||| |\n // | ||| |\n // | ||| |\n // | ||| <- bGutterSize |\n // ------------------------------------------------\n // | <- start size -> |\n function calculateSizes() {\n // Figure out the parent size minus padding.\n const a = elements[this.a].element\n const b = elements[this.b].element\n\n const aBounds = a[getBoundingClientRect]()\n const bBounds = b[getBoundingClientRect]()\n\n this.size =\n aBounds[dimension] +\n bBounds[dimension] +\n this[aGutterSize] +\n this[bGutterSize]\n this.start = aBounds[position]\n this.end = aBounds[positionEnd]\n }\n\n function innerSize(element) {\n // Return nothing if getComputedStyle is not supported (< IE9)\n // Or if parent element has no layout yet\n if (!getComputedStyle) return null\n\n const computedStyle = getComputedStyle(element)\n\n if (!computedStyle) return null\n\n let size = element[clientSize]\n\n if (size === 0) return null\n\n if (direction === HORIZONTAL) {\n size -=\n parseFloat(computedStyle.paddingLeft) +\n parseFloat(computedStyle.paddingRight)\n } else {\n size -=\n parseFloat(computedStyle.paddingTop) +\n parseFloat(computedStyle.paddingBottom)\n }\n\n return size\n }\n\n // When specifying percentage sizes that are less than the computed\n // size of the element minus the gutter, the lesser percentages must be increased\n // (and decreased from the other elements) to make space for the pixels\n // subtracted by the gutters.\n function trimToMin(sizesToTrim) {\n // Try to get inner size of parent element.\n // If it's no supported, return original sizes.\n const parentSize = innerSize(parent)\n if (parentSize === null) {\n return sizesToTrim\n }\n\n if (minSizes.reduce((a, b) => a + b, 0) > parentSize) {\n return sizesToTrim\n }\n\n // Keep track of the excess pixels, the amount of pixels over the desired percentage\n // Also keep track of the elements with pixels to spare, to decrease after if needed\n let excessPixels = 0\n const toSpare = []\n\n const pixelSizes = sizesToTrim.map((size, i) => {\n // Convert requested percentages to pixel sizes\n const pixelSize = (parentSize * size) / 100\n const elementGutterSize = getGutterSize(\n gutterSize,\n i === 0,\n i === sizesToTrim.length - 1,\n gutterAlign,\n )\n const elementMinSize = minSizes[i] + elementGutterSize\n\n // If element is too smal, increase excess pixels by the difference\n // and mark that it has no pixels to spare\n if (pixelSize < elementMinSize) {\n excessPixels += elementMinSize - pixelSize\n toSpare.push(0)\n return elementMinSize\n }\n\n // Otherwise, mark the pixels it has to spare and return it's original size\n toSpare.push(pixelSize - elementMinSize)\n return pixelSize\n })\n\n // If nothing was adjusted, return the original sizes\n if (excessPixels === 0) {\n return sizesToTrim\n }\n\n return pixelSizes.map((pixelSize, i) => {\n let newPixelSize = pixelSize\n\n // While there's still pixels to take, and there's enough pixels to spare,\n // take as many as possible up to the total excess pixels\n if (excessPixels > 0 && toSpare[i] - excessPixels > 0) {\n const takenPixels = Math.min(\n excessPixels,\n toSpare[i] - excessPixels,\n )\n\n // Subtract the amount taken for the next iteration\n excessPixels -= takenPixels\n newPixelSize = pixelSize - takenPixels\n }\n\n // Return the pixel size adjusted as a percentage\n return (newPixelSize / parentSize) * 100\n })\n }\n\n // stopDragging is very similar to startDragging in reverse.\n function stopDragging() {\n const self = this\n const a = elements[self.a].element\n const b = elements[self.b].element\n\n if (self.dragging) {\n getOption(options, 'onDragEnd', NOOP)(getSizes())\n }\n\n self.dragging = false\n\n // Remove the stored event listeners. This is why we store them.\n global[removeEventListener]('mouseup', self.stop)\n global[removeEventListener]('touchend', self.stop)\n global[removeEventListener]('touchcancel', self.stop)\n global[removeEventListener]('mousemove', self.move)\n global[removeEventListener]('touchmove', self.move)\n\n // Clear bound function references\n self.stop = null\n self.move = null\n\n a[removeEventListener]('selectstart', NOOP)\n a[removeEventListener]('dragstart', NOOP)\n b[removeEventListener]('selectstart', NOOP)\n b[removeEventListener]('dragstart', NOOP)\n\n a.style.userSelect = ''\n a.style.webkitUserSelect = ''\n a.style.MozUserSelect = ''\n a.style.pointerEvents = ''\n\n b.style.userSelect = ''\n b.style.webkitUserSelect = ''\n b.style.MozUserSelect = ''\n b.style.pointerEvents = ''\n\n self.gutter.style.cursor = ''\n self.parent.style.cursor = ''\n document.body.style.cursor = ''\n }\n\n // startDragging calls `calculateSizes` to store the inital size in the pair object.\n // It also adds event listeners for mouse/touch events,\n // and prevents selection while dragging so avoid the selecting text.\n function startDragging(e) {\n // Right-clicking can't start dragging.\n if ('button' in e && e.button !== 0) {\n return\n }\n\n // Alias frequently used variables to save space. 200 bytes.\n const self = this\n const a = elements[self.a].element\n const b = elements[self.b].element\n\n // Call the onDragStart callback.\n if (!self.dragging) {\n getOption(options, 'onDragStart', NOOP)(getSizes())\n }\n\n // Don't actually drag the element. We emulate that in the drag function.\n e.preventDefault()\n\n // Set the dragging property of the pair object.\n self.dragging = true\n\n // Create two event listeners bound to the same pair object and store\n // them in the pair object.\n self.move = drag.bind(self)\n self.stop = stopDragging.bind(self)\n\n // All the binding. `window` gets the stop events in case we drag out of the elements.\n global[addEventListener]('mouseup', self.stop)\n global[addEventListener]('touchend', self.stop)\n global[addEventListener]('touchcancel', self.stop)\n global[addEventListener]('mousemove', self.move)\n global[addEventListener]('touchmove', self.move)\n\n // Disable selection. Disable!\n a[addEventListener]('selectstart', NOOP)\n a[addEventListener]('dragstart', NOOP)\n b[addEventListener]('selectstart', NOOP)\n b[addEventListener]('dragstart', NOOP)\n\n a.style.userSelect = 'none'\n a.style.webkitUserSelect = 'none'\n a.style.MozUserSelect = 'none'\n a.style.pointerEvents = 'none'\n\n b.style.userSelect = 'none'\n b.style.webkitUserSelect = 'none'\n b.style.MozUserSelect = 'none'\n b.style.pointerEvents = 'none'\n\n // Set the cursor at multiple levels\n self.gutter.style.cursor = cursor\n self.parent.style.cursor = cursor\n document.body.style.cursor = cursor\n\n // Cache the initial sizes of the pair.\n calculateSizes.call(self)\n\n // Determine the position of the mouse compared to the gutter\n self.dragOffset = getMousePosition(e) - self.end\n }\n\n // adjust sizes to ensure percentage is within min size and gutter.\n sizes = trimToMin(sizes)\n\n // 5. Create pair and element objects. Each pair has an index reference to\n // elements `a` and `b` of the pair (first and second elements).\n // Loop through the elements while pairing them off. Every pair gets a\n // `pair` object and a gutter.\n //\n // Basic logic:\n //\n // - Starting with the second element `i > 0`, create `pair` objects with\n // `a = i - 1` and `b = i`\n // - Set gutter sizes based on the _pair_ being first/last. The first and last\n // pair have gutterSize / 2, since they only have one half gutter, and not two.\n // - Create gutter elements and add event listeners.\n // - Set the size of the elements, minus the gutter sizes.\n //\n // -----------------------------------------------------------------------\n // | i=0 | i=1 | i=2 | i=3 |\n // | | | | |\n // | pair 0 pair 1 pair 2 |\n // | | | | |\n // -----------------------------------------------------------------------\n const pairs = []\n elements = ids.map((id, i) => {\n // Create the element object.\n const element = {\n element: elementOrSelector(id),\n size: sizes[i],\n minSize: minSizes[i],\n maxSize: maxSizes[i],\n i,\n }\n\n let pair\n\n if (i > 0) {\n // Create the pair object with its metadata.\n pair = {\n a: i - 1,\n b: i,\n dragging: false,\n direction,\n parent,\n }\n\n pair[aGutterSize] = getGutterSize(\n gutterSize,\n i - 1 === 0,\n false,\n gutterAlign,\n )\n pair[bGutterSize] = getGutterSize(\n gutterSize,\n false,\n i === ids.length - 1,\n gutterAlign,\n )\n\n // if the parent has a reverse flex-direction, switch the pair elements.\n if (\n parentFlexDirection === 'row-reverse' ||\n parentFlexDirection === 'column-reverse'\n ) {\n const temp = pair.a\n pair.a = pair.b\n pair.b = temp\n }\n }\n\n // Determine the size of the current element. IE8 is supported by\n // staticly assigning sizes without draggable gutters. Assigns a string\n // to `size`.\n //\n // Create gutter elements for each pair.\n if (i > 0) {\n const gutterElement = gutter(i, direction, element.element)\n setGutterSize(gutterElement, gutterSize, i)\n\n // Save bound event listener for removal later\n pair[gutterStartDragging] = startDragging.bind(pair)\n\n // Attach bound event listener\n gutterElement[addEventListener](\n 'mousedown',\n pair[gutterStartDragging],\n )\n gutterElement[addEventListener](\n 'touchstart',\n pair[gutterStartDragging],\n )\n\n parent.insertBefore(gutterElement, element.element)\n\n pair.gutter = gutterElement\n }\n\n setElementSize(\n element.element,\n element.size,\n getGutterSize(\n gutterSize,\n i === 0,\n i === ids.length - 1,\n gutterAlign,\n ),\n i,\n )\n\n // After the first iteration, and we have a pair object, append it to the\n // list of pairs.\n if (i > 0) {\n pairs.push(pair)\n }\n\n return element\n })\n\n function adjustToMin(element) {\n const isLast = element.i === pairs.length\n const pair = isLast ? pairs[element.i - 1] : pairs[element.i]\n\n calculateSizes.call(pair)\n\n const size = isLast\n ? pair.size - element.minSize - pair[bGutterSize]\n : element.minSize + pair[aGutterSize]\n\n adjust.call(pair, size)\n }\n\n elements.forEach(element => {\n const computedSize = element.element[getBoundingClientRect]()[dimension]\n\n if (computedSize < element.minSize) {\n if (expandToMin) {\n adjustToMin(element)\n } else {\n // eslint-disable-next-line no-param-reassign\n element.minSize = computedSize\n }\n }\n })\n\n function setSizes(newSizes) {\n const trimmed = trimToMin(newSizes)\n trimmed.forEach((newSize, i) => {\n if (i > 0) {\n const pair = pairs[i - 1]\n\n const a = elements[pair.a]\n const b = elements[pair.b]\n\n a.size = trimmed[i - 1]\n b.size = newSize\n\n setElementSize(a.element, a.size, pair[aGutterSize], a.i)\n setElementSize(b.element, b.size, pair[bGutterSize], b.i)\n }\n })\n }\n\n function destroy(preserveStyles, preserveGutter) {\n pairs.forEach(pair => {\n if (preserveGutter !== true) {\n pair.parent.removeChild(pair.gutter)\n } else {\n pair.gutter[removeEventListener](\n 'mousedown',\n pair[gutterStartDragging],\n )\n pair.gutter[removeEventListener](\n 'touchstart',\n pair[gutterStartDragging],\n )\n }\n\n if (preserveStyles !== true) {\n const style = elementStyle(\n dimension,\n pair.a.size,\n pair[aGutterSize],\n )\n\n Object.keys(style).forEach(prop => {\n elements[pair.a].element.style[prop] = ''\n elements[pair.b].element.style[prop] = ''\n })\n }\n })\n }\n\n return {\n setSizes,\n getSizes,\n collapse(i) {\n adjustToMin(elements[i])\n },\n destroy,\n parent,\n pairs,\n }\n}\n\nexport default Split\n"],"names":["const","global","window","ssr","document","undefined","NOOP","calc","filter","prefix","el","createElement","style","cssText","length","shift","isString","v","String","elementOrSelector","ele","querySelector","Error","getOption","options","propName","def","value","getGutterSize","gutterSize","isFirst","isLast","gutterAlign","defaultGutterFn","i","gutterDirection","gut","className","defaultElementStyleFn","dim","size","gutSize","defaultGutterStyleFn","idsOption","let","dimension","clientAxis","position","positionEnd","clientSize","elements","ids","Array","from","parent","parentNode","parentStyle","getComputedStyle","parentFlexDirection","flexDirection","sizes","map","minSize","minSizes","isArray","maxSize","Infinity","maxSizes","expandToMin","snapOffset","dragInterval","direction","cursor","gutter","elementStyle","gutterStyle","setElementSize","Object","keys","forEach","prop","getSizes","element","getMousePosition","e","touches","adjust","offset","a","this","b","percentage","drag","dragging","start","dragOffset","Math","round","call","calculateSizes","aBounds","bBounds","end","trimToMin","sizesToTrim","parentSize","computedStyle","parseFloat","paddingLeft","paddingRight","paddingTop","paddingBottom","innerSize","reduce","excessPixels","toSpare","pixelSizes","pixelSize","elementGutterSize","elementMinSize","push","newPixelSize","takenPixels","min","stopDragging","stop","move","userSelect","webkitUserSelect","MozUserSelect","pointerEvents","body","startDragging","button","preventDefault","bind","pairs","adjustToMin","pair","id","temp","gutterElement","setGutterSize","insertBefore","computedSize","newSizes","trimmed","newSize","collapse","preserveStyles","preserveGutter","removeChild"],"mappings":";sOAIAA,IAAMC,EAA2B,oBAAXC,OAAyBA,OAAS,KAClDC,EAAiB,OAAXF,EACNG,EAAYD,OAAwBE,EAAlBJ,EAAOG,SAWzBE,oBAAa,GAObC,EAAOJ,EACP,OACG,CAAC,GAAI,WAAY,QAAS,OACxBK,iBAAOC,GACJT,IAAMU,EAAKN,EAASO,cAAc,OAGlC,OAFAD,EAAGE,MAAMC,QAAU,SAASJ,gBAEnBC,EAAGE,MAAME,UAErBC,eAGLC,WAAWC,SAAkB,iBAANA,GAAkBA,aAAaC,QAKtDC,WAAoBT,GACtB,GAAIM,EAASN,GAAK,CACdV,IAAMoB,EAAMhB,EAASiB,cAAcX,GACnC,IAAKU,EACD,MAAM,IAAIE,kBAAkBZ,kCAEhC,OAAOU,EAGX,OAAOV,GAILa,WAAaC,EAASC,EAAUC,GAClC1B,IAAM2B,EAAQH,EAAQC,GACtB,YAAcpB,IAAVsB,EACOA,EAEJD,GAGLE,WAAiBC,EAAYC,EAASC,EAAQC,GAChD,GAAIF,EAAS,CACT,GAAoB,QAAhBE,EACA,OAAO,EAEX,GAAoB,WAAhBA,EACA,OAAOH,EAAa,OAErB,GAAIE,EAAQ,CACf,GAAoB,UAAhBC,EACA,OAAO,EAEX,GAAoB,WAAhBA,EACA,OAAOH,EAAa,EAI5B,OAAOA,GAILI,WAAmBC,EAAGC,GACxBnC,IAAMoC,EAAMhC,EAASO,cAAc,OAEnC,OADAyB,EAAIC,UAAY,iBAAiBF,EAC1BC,GAGLE,WAAyBC,EAAKC,EAAMC,GACtCzC,IAAMY,EAAQ,GAQd,OANKI,EAASwB,GAGV5B,EAAM2B,GAAOC,EAFb5B,EAAM2B,GAA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